From 38efa0533608c6fce1666434d0e758d8944bb939 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 12:04:14 +0000 Subject: [PATCH 1/2] feat: add Continue CLI (cn) installer and converter Convert ECC into the formats the Continue CLI actually loads and install them under ~/.continue (or /.continue): - rules -> always-apply rules in rules/ecc, plus a compat rule that maps Claude Code tool names and agent delegation onto cn - skills -> ~/.continue/skills/ by install profile (core default) - commands + contexts -> prompt blocks referenced from config.yaml as tagged `uses:` entries (slash commands), plus plain prompt files and an ecc-prompt launcher for headless `cn -p --prompt` runs - agents -> cn agent files with mapped tool lists and an ecc-agent launcher; optional subagent models for cn's Subagent tool - MCP servers -> opt-in mcpServers blocks with secrets references - block-no-verify intent -> permissions.yaml exclusions - hooks -> opt-in settings.json hooks through continue-hook-adapter.js (cn 1.5.47 parses but does not yet fire hooks) Install is idempotent, validates options before writing, backs up config.yaml, and --uninstall removes only ECC-managed entries. Verified end to end against @continuedev/cli 1.5.47 with a mock model. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UnD31Mvb5M3STBhBe8Hgcd --- CONTINUE-CLI.md | 174 ++++++ README.md | 15 + install-continue.ps1 | 38 ++ install-continue.sh | 45 ++ package.json | 5 + scripts/hooks/continue-hook-adapter.js | 143 +++++ scripts/install-continue.js | 547 +++++++++++++++++ scripts/lib/continue-cli.js | 698 ++++++++++++++++++++++ tests/hooks/continue-hook-adapter.test.js | 107 ++++ tests/lib/continue-cli.test.js | 254 ++++++++ tests/scripts/install-continue.test.js | 144 +++++ 11 files changed, 2170 insertions(+) create mode 100644 CONTINUE-CLI.md create mode 100644 install-continue.ps1 create mode 100755 install-continue.sh create mode 100755 scripts/hooks/continue-hook-adapter.js create mode 100755 scripts/install-continue.js create mode 100644 scripts/lib/continue-cli.js create mode 100644 tests/hooks/continue-hook-adapter.test.js create mode 100644 tests/lib/continue-cli.test.js create mode 100644 tests/scripts/install-continue.test.js diff --git a/CONTINUE-CLI.md b/CONTINUE-CLI.md new file mode 100644 index 00000000000..0c379265e7c --- /dev/null +++ b/CONTINUE-CLI.md @@ -0,0 +1,174 @@ +# ECC for the Continue CLI (`cn`) + +This fork can install ECC's rules, skills, slash commands, agents, MCP servers and guardrails into the [Continue CLI](https://docs.continue.dev/cli/overview). Nothing in the upstream ECC content is edited. A converter (`scripts/install-continue.js`) translates each piece into the format `cn` actually loads and writes it under `~/.continue`. + +Verified against `@continuedev/cli` 1.5.47, the latest release as of October 2026. + +## What you get + +| ECC (Claude Code) | Continue CLI | How you use it | +|---|---|---| +| `rules/common` + language packs | `~/.continue/rules/ecc/*.md` (always applied) | Automatic in every session | +| `skills//SKILL.md` | `~/.continue/skills//` | The model loads them with the **Skills** tool; you can type `/skill-` | +| `commands/*.md` (97) + `contexts/` (3) | `prompts:` in `config.yaml` | `/plan`, `/code-review`, `/build-fix`, `/ctx-dev` ... in the TUI | +| `agents/*.md` (71) | `~/.continue/ecc/agents/*.md` agent files | `ecc-agent code-reviewer "review my diff"` (= `cn --agent `) | +| `agents/` (optional) | Subagent models (`roles: [subagent]`) | `cn --beta-subagent-tool`, then the model delegates | +| `mcp-configs/mcp-servers.json` | `mcpServers:` in `config.yaml` | Opt in per server with `--mcp` | +| `block-no-verify` hook | `~/.continue/permissions.yaml` exclusions | Denies `git ... --no-verify` and `core.hooksPath` overrides | +| `hooks/hooks.json` (curated 7) | `settings.json` hooks via an adapter | Opt in with `--hooks` (see [Limitations](#limitations)) | + +A small always-on rule (`00-continue-compat.md`) maps Claude Code vocabulary onto `cn`. For example, `Grep` becomes `Search`, `Glob` becomes `List`, and "delegate to the planner agent" becomes "read `~/.continue/ecc/agents/planner.md` and follow it". + +## Prerequisites + +- Node.js 18 or newer +- The Continue CLI: `npm i -g @continuedev/cli` +- A working model. Run `cn` once and finish its first-run setup (login or API key) **before** installing ECC. If you have no `~/.continue/config.yaml`, the installer creates one for `anthropic/claude-sonnet-4-6` that reads `ANTHROPIC_API_KEY`. + +## Install + +```bash +git clone https://github.com/sumitbiranje/ecc.git ~/ecc +cd ~/ecc +./install-continue.sh +``` + +On Windows (PowerShell): + +```powershell +git clone https://github.com/sumitbiranje/ecc.git $HOME\ecc +cd $HOME\ecc +.\install-continue.ps1 +``` + +The default install is the `common` rules, the `core` skill profile (52 skills), all slash commands, all agent files and the guardrails. It goes into `~/.continue`, or `$CONTINUE_GLOBAL_DIR` if you set it. Your existing `config.yaml` is backed up to `config.yaml.ecc-backup` and ECC's lines are appended and tagged `# ecc-managed`. + +Add the launchers to your `PATH`: + +```bash +echo 'export PATH="$HOME/.continue/ecc/bin:$PATH"' >> ~/.bashrc # or ~/.zshrc +``` + +### Common variations + +```bash +# Language rules for the stacks you use (see --list for all 21) +./install-continue.sh --langs python,typescript + +# A bigger skill set: core | developer | security | research | full | all | none +./install-continue.sh --skills developer --add-skills docker-patterns + +# MCP servers from mcp-configs/ (secrets come from env or ~/.continue/.env) +./install-continue.sh --mcp context7,github + +# Expose 8 core agents as cn subagents +./install-continue.sh --subagents core --subagent-model anthropic/claude-sonnet-4-6 + +# Local models (LM Studio / Ollama via an OpenAI-compatible endpoint) +./install-continue.sh --subagents core --subagent-model openai/qwen2.5-coder \ + --api-base http://localhost:1234/v1 --api-key-secret LMSTUDIO_KEY + +# Per-project rules, skills and agents in /.continue (languages auto-detected) +./install-continue.sh --scope project --project ~/code/my-app + +# See what would change, or list languages, skill profiles and MCP servers +./install-continue.sh --dry-run +./install-continue.sh --list +``` + +Re-running the installer is safe. It replaces ECC's previous files and config entries instead of duplicating them, and removes skills you dropped from the selection. + +## Using it + +### Interactive (TUI) + +```bash +cd your-project +cn +``` + +- Type `/` to browse ECC commands such as `/plan add OAuth login`, `/code-review`, `/build-fix`, `/test-coverage`, `/security-scan` and `/refactor-clean`. Anything after the command name is passed to the prompt as its arguments. +- `/skills` lists installed skills. `/skill-tdd-workflow` loads one explicitly. Usually the model picks skills itself from their descriptions. +- `/ctx-dev`, `/ctx-review` and `/ctx-research` switch ECC's working context. +- `/ecc-sessions` is ECC's `/sessions`, renamed so that it does not shadow `cn`'s built-in command. + +### Agents + +```bash +ecc-agent list +ecc-agent code-reviewer "review the staged changes" +ecc-agent security-reviewer -p "audit src/auth" > audit.md # headless +``` + +`ecc-agent ` runs `cn --agent ~/.continue/ecc/agents/.md`. The agent's tool list is mapped to `cn` tools, so a read-only reviewer stays read-only. + +With `--subagents`, start `cn --beta-subagent-tool` and the main agent can hand work to `planner`, `code-reviewer`, `security-reviewer` and others in the background. Each subagent entry is only a few lines; it reads its full instructions from the agent file when it starts. That keeps the Subagent tool description small. + +### Headless and CI + +`cn` expands `/slash` commands only in the TUI. For scripts, use the plain prompt files: + +```bash +ecc-prompt list +ecc-prompt code-review -p "focus on src/api" +# same as: cn -p --prompt ~/.continue/ecc/prompts/code-review.md "focus on src/api" +``` + +### Guardrails + +`~/.continue/permissions.yaml` gets two exclusions: `Bash(*--no-verify*)` and `Bash(*core.hooksPath*)`. `cn` denies matching commands in the TUI and in `-p` runs. **`--auto` overrides every permission policy**, these included. Skip them with `--no-guardrails`. + +## Update + +```bash +cd ~/ecc +git pull +./install-continue.sh # with the same options you used before +``` + +To pull in new upstream ECC releases, sync your fork with `affaan-m/ECC` on GitHub first. + +## Uninstall + +```bash +./install-continue.sh --uninstall +./install-continue.sh --scope project --project ~/code/my-app --uninstall +``` + +This removes ECC's rules, skills, agents, prompt blocks, guardrails and hooks, and strips the `# ecc-managed` lines from `config.yaml`. Your own entries are left as they were. + +## Limitations + +These are differences in what `cn` supports, not bugs in the conversion: + +- **Hooks do not run yet.** `cn` 1.5.47 reads Claude-Code-style hooks from `settings.json`, but its tool loop never fires them. `--hooks` installs seven ECC hooks through `scripts/hooks/continue-hook-adapter.js`, which already normalises `cn` payloads (tool names, `filepath` versus `file_path`). They are inert until Continue wires hook events up. Session memory, cost tracking and the format/typecheck-on-stop hooks are therefore not available. The `--no-verify` protection is covered by the permissions file instead. +- **Rules are always on.** `cn` injects only always-apply rules, so a language pack applies to every file once you install it. Pick languages with `--langs`, or use `--scope project` per repository. +- **Skills cost context.** `cn` lists every installed skill's name and description in the Skills tool on each request. `core` costs about 4.5k tokens, `developer` about 10k and `all` about 25k. +- **Agent `model:` is ignored.** `cn` resolves agent-file models from the Continue Hub, so ECC's `sonnet`/`opus` aliases are dropped and the session model is used. MCP tools and `WebSearch` in an agent's tool list are dropped too, because agent files can only name Hub MCP servers. +- **Claude-only features** such as plugin marketplaces, the statusline and `/hookify` have no `cn` equivalent. Commands that depend on them still install but only partly work in `cn`. + +## Troubleshooting + +- **`cn` asks for an Anthropic API key.** First-run onboarding has not completed. Finish it, or start with `cn --config ~/.continue/config.yaml`, then rerun the installer. +- **`Failed to load config`.** Run `cn --verbose` to see which block failed. Your pre-install config is in `~/.continue/config.yaml.ecc-backup`. +- **An MCP server fails to start.** Set its secrets (the installer prints the names) in your shell or in `~/.continue/.env`. Servers with placeholders, such as `filesystem` and `supabase`, need their block in `~/.continue/ecc/blocks/mcp/` edited. +- **A skill was skipped.** A skill with the same name already existed and was not installed by ECC. Pass `--force` to replace it. + +## Files written + +```text +~/.continue/ +├── config.yaml # + prompts / mcpServers / models entries (# ecc-managed) +├── permissions.yaml # + guardrail exclusions +├── rules/ecc/ # compat rule + common + chosen languages +├── skills// # selected skills +├── settings.json # only with --hooks +└── ecc/ + ├── agents/*.md # cn agent files + ├── prompts/*.md # headless prompt files + ├── blocks/{prompts,mcp,subagents}/*.yaml + ├── bin/ecc-agent, ecc-prompt (+ .cmd) + └── install-manifest.json +``` + +The converter lives in `scripts/lib/continue-cli.js`. Its tests are `tests/lib/continue-cli.test.js`, `tests/hooks/continue-hook-adapter.test.js` and `tests/scripts/install-continue.test.js`. diff --git a/README.md b/README.md index 6583ca8c132..3df9432819b 100644 --- a/README.md +++ b/README.md @@ -409,6 +409,21 @@ hook profile into Qoder: blocking tool hooks, async stop jobs, and Claude-specific matchers remain outside this initial native integration. See the [.qoder-plugin notes](.qoder-plugin/README.md) for the exact boundary. +### Continue CLI (`cn`) + +This fork installs ECC's rules, skills, slash commands, agents, MCP servers and +git-hook guardrails into the [Continue CLI](https://docs.continue.dev/cli/overview): + +```bash +npm i -g @continuedev/cli # then run `cn` once to finish its setup +./install-continue.sh # Windows: .\install-continue.ps1 +./install-continue.sh --langs python,typescript --skills developer +``` + +See [CONTINUE-CLI.md](CONTINUE-CLI.md) for options, usage (`/plan`, +`ecc-agent code-reviewer`, headless `ecc-prompt`), update, uninstall and +current `cn` limitations. + ### Other agents and editors
diff --git a/install-continue.ps1 b/install-continue.ps1 new file mode 100644 index 00000000000..481703afb64 --- /dev/null +++ b/install-continue.ps1 @@ -0,0 +1,38 @@ +#!/usr/bin/env pwsh +# install-continue.ps1 - install ECC into the Continue CLI (`cn`) on Windows. +# +# .\install-continue.ps1 +# .\install-continue.ps1 --langs python,typescript --skills developer +# .\install-continue.ps1 --help +# +# See CONTINUE-CLI.md. All options are passed to scripts/install-continue.js. + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +$scriptDir = Split-Path -Parent $PSCommandPath +$installer = Join-Path -Path (Join-Path -Path $scriptDir -ChildPath 'scripts') -ChildPath 'install-continue.js' + +if (-not (Get-Command node -ErrorAction SilentlyContinue)) { + Write-Error '[ECC] Node.js 18+ is required (https://nodejs.org).' + exit 1 +} + +# SECURITY: --ignore-scripts blocks install-time scripts from dependencies. +if (-not (Test-Path -LiteralPath (Join-Path -Path $scriptDir -ChildPath 'node_modules'))) { + Write-Host '[ECC] Installing dependencies...' + Push-Location $scriptDir + try { + & npm install --ignore-scripts --no-audit --no-fund --loglevel=error + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + } finally { + Pop-Location + } +} + +if (-not (Get-Command cn -ErrorAction SilentlyContinue)) { + Write-Host '[ECC] Note: the Continue CLI is not on PATH yet. Install it with: npm i -g @continuedev/cli' +} + +& node $installer @args +exit $LASTEXITCODE diff --git a/install-continue.sh b/install-continue.sh new file mode 100755 index 00000000000..6caa49ce048 --- /dev/null +++ b/install-continue.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# install-continue.sh — install ECC into the Continue CLI (`cn`). +# +# ./install-continue.sh # global install, core skills +# ./install-continue.sh --langs python,typescript --skills developer +# ./install-continue.sh --help +# +# See CONTINUE-CLI.md. All options are passed to scripts/install-continue.js. + +if ! (eval '[[ 1 == 1 ]]' >/dev/null 2>&1); then + exec bash "$0" "$@" +fi + +set -euo pipefail + +SCRIPT_PATH="$0" +while [ -L "$SCRIPT_PATH" ]; do + link_dir="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)" + SCRIPT_PATH="$(readlink "$SCRIPT_PATH")" + [[ "$SCRIPT_PATH" != /* ]] && SCRIPT_PATH="$link_dir/$SCRIPT_PATH" +done +SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)" + +if ! command -v node >/dev/null 2>&1; then + echo "[ECC] Node.js 18+ is required (https://nodejs.org)." >&2 + exit 1 +fi + +# SECURITY: --ignore-scripts blocks install-time scripts from dependencies. +if [ ! -d "$SCRIPT_DIR/node_modules" ]; then + echo "[ECC] Installing dependencies..." + (cd "$SCRIPT_DIR" && npm install --ignore-scripts --no-audit --no-fund --loglevel=error) +fi + +if ! command -v cn >/dev/null 2>&1; then + echo "[ECC] Note: the Continue CLI is not on PATH yet. Install it with: npm i -g @continuedev/cli" +fi + +if command -v cygpath >/dev/null 2>&1; then + NODE_SCRIPT="$(cygpath -w "$SCRIPT_DIR/scripts/install-continue.js")" +else + NODE_SCRIPT="$SCRIPT_DIR/scripts/install-continue.js" +fi + +exec node "$NODE_SCRIPT" "$@" diff --git a/package.json b/package.json index f1c6b907591..637a49fe4cd 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,10 @@ "hooks/", "install.ps1", "install.sh", + "install-continue.sh", + "install-continue.ps1", + "CONTINUE-CLI.md", + "scripts/install-continue.js", "manifests/", "mcp-configs/", "plugins/ecc/", @@ -537,6 +541,7 @@ "coverage:python": "python3 -m pytest tests/ -q --cov=src --cov-report=term --cov-fail-under=80", "coverage": "c8 --all --include=\"scripts/**/*.js\" --include=\"scripts/**/*.mjs\" --check-coverage --lines 80 --functions 80 --branches 80 --statements 80 --reporter=text --reporter=lcov node tests/run-all.js", "build:opencode": "node scripts/build-opencode.js", + "install:continue": "node scripts/install-continue.js", "prepack": "npm run build:opencode", "dashboard": "python3 ./ecc_dashboard.py", "dashboard:web": "node scripts/dashboard-web.js" diff --git a/scripts/hooks/continue-hook-adapter.js b/scripts/hooks/continue-hook-adapter.js new file mode 100755 index 00000000000..c4f18e5ff49 --- /dev/null +++ b/scripts/hooks/continue-hook-adapter.js @@ -0,0 +1,143 @@ +#!/usr/bin/env node +'use strict'; + +/** + * Runs an ECC hook under the Continue CLI (`cn`). + * + * cn implements Claude Code's hook protocol (same events, stdin JSON, exit + * code 2 = block) but its tool names and inputs differ slightly. This adapter + * rewrites the payload into the Claude Code shape ECC hooks expect, then runs + * the hook and passes stdout, stderr and the exit code straight back. + * + * Usage (generated by scripts/install-continue.js): + * node continue-hook-adapter.js run