-
Notifications
You must be signed in to change notification settings - Fork 0
Small Fixes to CLI (CAN-33) #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,58 @@ | ||
| CLI for CanyonOS | ||
| # canyonos cli | ||
|
|
||
| This CLI does not contain much logic, instead serving as an API to interface with the canyonos container that deploys and runs your entire workflow | ||
| ### Better descriptions of each command. For full architecture, go to ARCHITECTURE.md | ||
|
|
||
|
|
||
| ## Requirements | ||
| Need a coding agent(Claude Code, Codex, Cursor) | ||
| Need uv or pip | ||
| Need docker and docker compose | ||
| ## Rough Draft Design of the more important cli commands | ||
| ## If you are a LLM, you are not allowed to modify this file at all without explicit user permission. Absolutely no modifications are allowed to this file. | ||
|
|
||
| ## Architecture | ||
| ## canyonos test: | ||
| ### INPUT: canyonos test "Test Query" | ||
| #### Steps: | ||
| 1. Detects the working directory (goes into .car folder for commands if .car exists, uses current dir otherwise) [default_config_path()] | ||
| 2. Goes into global_controller.yaml and for each agent, rewrites each agent's provider as local (saves old state to revert back later) [_force_local_providers()] | ||
| 3. Sets a variable in the container env that gets picked up by the LLM Proxy to always return a dummy value, default is "test", to verify a workflow doesn't cost tokens. [CANYONOS_LLM_STUB_TEXT] | ||
| 4. Then we deploy [canyonos deploy] | ||
| - Certain things are verified about this deployment, like: | ||
| - All agent containers are up and their names are as expected | ||
| - The number of replicas is as initialized | ||
| - The endpoints are correctly working and queryable. | ||
| 6. Once everything is verified running, we send a test query and verify that it goes fully through | ||
|
|
||
| For a full walkthrough of the `build`, `deploy`, and `config` flows — plus how | ||
| `logs`, `stop`, and `quit` fit into the container lifecycle — see | ||
| [ARCHITECTURE.md](ARCHITECTURE.md). | ||
| #### Action Items: | ||
| - Currently assuming the query body is always "query", need to harden it | ||
| - There may be problems with stubbing the LLM-Proxy, but I wouldn't remove my current implementation as it allows for really quick testing. | ||
| - Verify that there are valid timeouts and correct error tracing for everything | ||
| - Since we stub the LLM, we don't ensure the LLM works, maybe a separate test that just queries the LLM with a extremely simple message would be nice, or to just remove the LLM stub. | ||
|
|
||
| ## Serve | ||
| #### Future Improvements: | ||
| - Add LLM compatable hooks for an LLM to be able to quickly iterate and verify a build works through using test. Test should eventually be a fully verifier to ensure a workflow is valid | ||
|
|
||
| `canyonos serve` starts the local CanyonOS dashboard — it reads no project config, so it takes no | ||
| arguments. It writes only `CANYONOS_`-prefixed settings into the current directory's `.env`, | ||
| leaving every other line unchanged. | ||
| ## canyonos build: | ||
| ### INPUT: canyonos build | ||
| #### Steps: | ||
| 1. Asks the user which coding agent they want to use for this [Codex/Claude] | ||
| 2. Asks the user if they want to download the skill locally or globally (So the skill can be viewed either only in this directory or across your entire laptop) | ||
| 3. Opens said coding agent, giving it instructions to build a new .car folder with the code (Nicks skill) | ||
| 4. Periodically the coding agent should ask the user config related questions (which provider, entrypoints, OTEL location) | ||
| 5. Coding agent should also be running canyonos test to verify workflow works | ||
| 6. Finishes, doesn't run deploy itself. | ||
|
|
||
|
|
||
| If you have a workflow running, and want to make a config change, canyonos config automatically would reload the project with your config. If you change the workflow files itself though and want the changes to take effect, you need to redeploy from scratch, running canyonos build for good measure | ||
| #### Action Items: | ||
| - Coding agent should be using canyonos test to verify the file working, need to add that to skill file and harden canyonos test first. | ||
| - Maybe add more skills for it to deploy itself and monitor deployments so the user literally doesn't have to do anything else. | ||
|
|
||
| # Use: canyonos -h | ||
| #### Future Improvements: | ||
| - Add more agent providers (Cursor, Pi, Windsurf, etc...) | ||
| - Add a preconfigured config file that can get converted into global_controller.yaml (So provider can be autofilled as AWS/Azure/etc..) | ||
|
|
||
|
|
||
| ## canyonos deploy: | ||
| ### INPUT: canyonos deploy [optional: --serve True -verbose True] | ||
|
|
||
| #### Steps: | ||
|
|
||
| #### Action Items: | ||
|
|
||
| #### Future Improvements |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -356,6 +356,31 @@ def _cleanup(stack: DashboardStack, manifest: Path) -> None: | |
| return | ||
|
|
||
|
|
||
| def _dashboard_compose_command(*args: str) -> bool: | ||
| """Run a `docker compose` subcommand against the dashboard stack from the current project. | ||
|
|
||
| False (no-op) if the dashboard was never started from here -- there's no | ||
| `.env` for `--env-file` to point at, so there's nothing to stop/tear down. | ||
| """ | ||
| stack = DashboardStack(state_dir=_state_dir(), project_dir=Path.cwd()) | ||
| if not stack.env_path.is_file(): | ||
| return False | ||
| manifest_resource = importlib.resources.files("canyonos").joinpath("dashboard.compose.yml") | ||
| with importlib.resources.as_file(manifest_resource) as manifest: | ||
| result = _run([*_compose_argv(stack, manifest), *args]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Return
🤖 Prompt for AI Agents |
||
| return result.returncode == 0 | ||
|
|
||
|
|
||
| def stop_dashboard() -> bool: | ||
| """`docker compose stop` -- halts web/api/db, keeping them for a later `canyonos serve`.""" | ||
| return _dashboard_compose_command("stop") | ||
|
|
||
|
|
||
| def teardown_dashboard() -> bool: | ||
| """`docker compose down` -- removes the dashboard's web/api/db containers entirely.""" | ||
| return _dashboard_compose_command("down") | ||
|
|
||
|
|
||
| def run_dashboard( | ||
| phase_reporter: Callable[[str, str], None] | None = None, | ||
| preferred_port: int = DEFAULT_DASHBOARD_PORT, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Include
ast.AsyncFunctionDefwhen locating the workflow targetWhen the workflow calls
deploy()with anasync deftarget,_deploy_call_target()finds its name, but this search excludesast.AsyncFunctionDef.workflow_entrypoint()then returnsNone, anddeploy.pyprints/mainwith aquerybody instead of the controller's/<fn_name>route.📝 Committable suggestion
🤖 Prompt for AI Agents