Skip to content

Add interactive mode to concore init CLI#510

Merged
pradeeban merged 7 commits intoControlCore-Project:devfrom
GREENRAT-K405:feat-cli-init-interactive
Mar 26, 2026
Merged

Add interactive mode to concore init CLI#510
pradeeban merged 7 commits intoControlCore-Project:devfrom
GREENRAT-K405:feat-cli-init-interactive

Conversation

@GREENRAT-K405
Copy link

@GREENRAT-K405 GREENRAT-K405 commented Mar 25, 2026

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:
image
image
image

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

Copilot AI review requested due to automatic review settings March 25, 2026 17:53
@GREENRAT-K405
Copy link
Author

@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"

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 / -i and 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.

@pradeeban
Copy link
Member

@GREENRAT-K405 excellent feature. Pls address the bot comments. Then I will merge it.

@pradeeban pradeeban marked this pull request as draft March 25, 2026 20:38
GREENRAT-K405 and others added 2 commits March 26, 2026 02:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@pradeeban
Copy link
Member

There are also some workflow failures. Pls check:

0s
Run ruff format --check .
24 files already formatted
error: Failed to parse concore_cli/commands/init.py:284:9: Positional argument cannot follow keyword argument
Error: Process completed with exit code 2.

@GREENRAT-K405
Copy link
Author

GREENRAT-K405 commented Mar 25, 2026

There are also some workflow failures. Pls check:

0s Run ruff format --check . 24 files already formatted error: Failed to parse concore_cli/commands/init.py:284:9: Positional argument cannot follow keyword argument Error: Process completed with exit code 2.

Thank you @pradeeban will fix this shortly!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +158 to +168
" 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'
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
" 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'

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can improve after java has been properly integrated in concore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avinxshKD has largely implemented Java version, and so our Java implementation is probably beyond the "toy" phase. What do you say, @avinxshKD?

Comment on lines +27 to +52
@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)
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can write the tests separately, will ask mentor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, tests are an "easy" contribution. Can be a subsequent PR.

@GREENRAT-K405
Copy link
Author

@pradeeban please have a look, this should be ready!

@GREENRAT-K405
Copy link
Author

@pradeeban Also, would you have any suggestion to improve the interactive mode?

@pradeeban
Copy link
Member

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
@GREENRAT-K405
Copy link
Author

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.

@pradeeban pradeeban marked this pull request as ready for review March 26, 2026 00:13
@pradeeban pradeeban merged commit c3fea64 into ControlCore-Project:dev Mar 26, 2026
6 checks passed
@pradeeban
Copy link
Member

Awesome. This is fancy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants