Add interactive mode to concore init CLI#510
Add interactive mode to concore init CLI#510pradeeban merged 7 commits intoControlCore-Project:devfrom
Conversation
|
@pradeeban @Rahuljagwani @mayureshkothare , Would love to know your suggestions on this, We can improve this much more but I think this was the next simple step to increase the project usability from the perspective of "End-User" |
There was a problem hiding this comment.
Pull request overview
Adds an interactive wizard to concore init so users can choose which language node stubs to generate, producing a multi-node workflow.graphml scaffold and corresponding source files under src/.
Changes:
- Introduces GraphML templates + a builder to generate one unconnected node per selected language.
- Adds an interactive selection wizard and
init_project_interactive()project generator. - Extends the CLI with
concore init --interactive / -iand makes the project name optional in interactive mode (prompted if omitted).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
concore_cli/commands/init.py |
Adds language node definitions, interactive wizard, GraphML generator, and interactive project scaffolding. |
concore_cli/cli.py |
Adds --interactive/-i flag and optional name argument to route to interactive init flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@GREENRAT-K405 excellent feature. Pls address the bot comments. Then I will merge it. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
There are also some workflow failures. Pls check: 0s |
Thank you @pradeeban will fix this shortly! |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
concore_cli/commands/init.py
Outdated
| " concoredocker cd = new concoredocker();\n" | ||
| " double maxtime = 100;\n" | ||
| " double delay = 0.02;\n" | ||
| ' String init_val = "[0.0, 0.0]";\n\n' | ||
| " String val = cd.initval(init_val);\n" | ||
| " while (cd.simtime() < maxtime) {\n" | ||
| " while (cd.unchanged()) {\n" | ||
| ' val = cd.read(1, "data", init_val);\n' | ||
| " }\n" | ||
| " // TODO: process val\n" | ||
| ' cd.write(1, "result", val, 0);\n' |
There was a problem hiding this comment.
The Java stub as generated here won’t compile against the repo’s Java APIs: concoredocker exposes static methods like initVal(...), read(...) returns a ReadResult, and simtime is accessed via getSimtime(). The stub currently calls non-existent instance methods (initval, simtime()) and treats read as returning String.
Please update the Java stub to match the actual concoredocker/concore API in this repository (method names/casing, static access, and handling of ReadResult.data).
| " concoredocker cd = new concoredocker();\n" | |
| " double maxtime = 100;\n" | |
| " double delay = 0.02;\n" | |
| ' String init_val = "[0.0, 0.0]";\n\n' | |
| " String val = cd.initval(init_val);\n" | |
| " while (cd.simtime() < maxtime) {\n" | |
| " while (cd.unchanged()) {\n" | |
| ' val = cd.read(1, "data", init_val);\n' | |
| " }\n" | |
| " // TODO: process val\n" | |
| ' cd.write(1, "result", val, 0);\n' | |
| " double maxtime = 100;\n" | |
| " double delay = 0.02;\n" | |
| ' String init_val = "[0.0, 0.0]";\n\n' | |
| " String val = concoredocker.initVal(init_val);\n" | |
| " while (concoredocker.getSimtime() < maxtime) {\n" | |
| " while (concoredocker.unchanged()) {\n" | |
| ' concoredocker.ReadResult result = concoredocker.read(1, "data", init_val);\n' | |
| " val = result.data;\n" | |
| " }\n" | |
| " // TODO: process val\n" | |
| ' concoredocker.write(1, "result", val, 0);\n' |
There was a problem hiding this comment.
can improve after java has been properly integrated in concore
There was a problem hiding this comment.
@avinxshKD has largely implemented Java version, and so our Java implementation is probably beyond the "toy" phase. What do you say, @avinxshKD?
| @click.argument("name", required=False, default=None) | ||
| @click.option("--template", default="basic", help="Template type to use") | ||
| def init(name, template): | ||
| @click.option( | ||
| "--interactive", | ||
| "-i", | ||
| is_flag=True, | ||
| help="Launch guided wizard to select node types", | ||
| ) | ||
| def init(name, template, interactive): | ||
| """Create a new concore project""" | ||
| try: | ||
| init_project(name, template, console) | ||
| if interactive: | ||
| if not name: | ||
| name = console.input("[cyan]Project name:[/cyan] ").strip() | ||
| if not name: | ||
| console.print("[red]Error:[/red] Project name is required.") | ||
| sys.exit(1) | ||
| selected = run_wizard(console) | ||
| init_project_interactive(name, selected, console) | ||
| else: | ||
| if not name: | ||
| console.print( | ||
| "[red]Error:[/red] Provide a project name or use --interactive." | ||
| ) | ||
| sys.exit(1) | ||
| init_project(name, template, console) |
There was a problem hiding this comment.
There are existing CLI tests (e.g., tests/test_cli.py::test_init_command), but the new init --interactive/-i behavior isn’t covered. This introduces multiple new branches (prompting for missing name, language selection, multi-node GraphML generation) that can regress without tests.
Please add tests that exercise: (1) init -i <name> with a fixed selection via CliRunner.invoke(..., input=...) and assert that the expected stub files + node labels exist, and (2) init -i with empty name input returning a non-zero exit code and the expected error message.
There was a problem hiding this comment.
can write the tests separately, will ask mentor
There was a problem hiding this comment.
Yes, tests are an "easy" contribution. Can be a subsequent PR.
|
@pradeeban please have a look, this should be ready! |
|
@pradeeban Also, would you have any suggestion to improve the interactive mode? |
|
Just noted on the Java issue above. Also to consider how will this work once we have a Julia version, especially as we seriously consider it as part of the GSoC 2026. Perhaps, document this somewhere in a DEV-GUIDE.md (create a new one if one does not exist. We surely have one for concore-editor: DEV-GUIDE.md). |
…ng guide for future julia integration for init --interactive
|
Great @pradeeban ! I have updated the stub for java and also made a DEV-GUIDE.md as you suggested, I have taken reference from one of the samples I have made for julia node. |
|
Awesome. This is fancy! |
concore init --interactive (or -i)
Users can now select Python, C++, Octave, Verilog, and Java nodes during setup.
Generates a workflow.graphml containing all selected nodes, differently colored and positioned vertically (separated by some distance), I made this design choice for better visibility.
Here is the actual implementation:



Also I have kept the project name in "concore init --interactive" command optional, if the user misses it, they will be prompted to give project name separately.
This fixes #511