@gluecharm-lab/easyspecs-cli 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +99 -71
  2. package/commands.md +35 -15
  3. package/dist/main.cjs +18122 -11116
  4. package/dist/main.cjs.map +4 -4
  5. package/package.json +2 -2
  6. package/resources/opencode-agents/agent-ace-curator.md +3 -0
  7. package/resources/opencode-agents/agent-context-drift-compare.md +48 -0
  8. package/resources/opencode-agents/agent-list-data-model.md +4 -0
  9. package/resources/opencode-agents/agent-list-entity-fields.md +4 -0
  10. package/resources/opencode-agents/agent-list-experiences.md +4 -0
  11. package/resources/opencode-agents/agent-list-features.md +4 -0
  12. package/resources/opencode-agents/agent-list-scenarios.md +4 -0
  13. package/resources/opencode-agents/agent-list-services.md +4 -0
  14. package/resources/opencode-agents/agent-list-tech-stack.md +4 -0
  15. package/resources/opencode-agents/agent-list-use-cases.md +8 -0
  16. package/resources/opencode-agents/agent-md-method-detail.md +1 -0
  17. package/resources/opencode-agents/agent-md-tool-detail.md +2 -1
  18. package/resources/opencode-agents/agent-review-data-model-list.md +6 -0
  19. package/resources/opencode-agents/agent-review-entity-fields-list.md +6 -0
  20. package/resources/opencode-agents/agent-review-experiences-list.md +6 -0
  21. package/resources/opencode-agents/agent-review-features-list.md +8 -0
  22. package/resources/opencode-agents/agent-review-scenarios-list.md +5 -0
  23. package/resources/opencode-agents/agent-review-services-list.md +6 -0
  24. package/resources/opencode-agents/agent-review-tech-stack-list.md +6 -0
  25. package/resources/opencode-agents/agent-review-use-cases-list.md +6 -0
  26. package/resources/schemas/context-lists/data-model-list.schema.json +24 -0
  27. package/resources/schemas/context-lists/entity-fields-list.schema.json +24 -0
  28. package/resources/schemas/context-lists/experiences-list.schema.json +24 -0
  29. package/resources/schemas/context-lists/features-list.schema.json +24 -0
  30. package/resources/schemas/context-lists/repo-surface-scan.schema.json +24 -0
  31. package/resources/schemas/context-lists/scenarios-list.schema.json +24 -0
  32. package/resources/schemas/context-lists/services-list.schema.json +24 -0
  33. package/resources/schemas/context-lists/tech-stack-list.schema.json +24 -0
  34. package/resources/schemas/context-lists/use-cases-list.schema.json +24 -0
  35. package/resources/schemas/srs-46-config.schema.json +27 -0
package/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # EasySpecs CLI
2
2
 
3
- Headless **EasySpecs** command-line tool for **context analysis**, **diagnoses**, **macro pipelines**, **upload to EasySpecs**, **auth**, and **ACE** — the same orchestration ideas as the **EasySpecs VS Code extension**, without an editor.
3
+ Headless **EasySpecs** command-line tool for **context analysis**, **diagnoses**, the **Generate Context** factory (**`analysis`**), **download/upload context** to EasySpecs, **auth**, and **ACE** — the same orchestration ideas as the **EasySpecs VS Code extension**, without an editor.
4
+
5
+ **Vocabulary (SRS-53, same repo):** A **Factory** is the full ordered **`analysis`** run. A **Pipeline** is one major stage inside it (synthesis, coverage, remediation, link mapping, upload). A **Workstation** is one atomic OpenCode or programmatic step inside a pipeline. Canonical **`config.json`** keys live under **`easyspecs.factory.*`**, **`easyspecs.workstations.*`**, and **`easyspecs.pipelines.upload.*`**; legacy **`easyspecs.orchestration.*`**, **`easyspecs.macro.debug`**, and several **`easyspecs.analysis.*`** tunables still work for one deprecation cycle and may log **`[deprecated-setting]`** on stderr when read. Human stderr may tag lines **`[factory]`**, **`[pipeline:…]`**, **`[workstation:…]`**, **`[pool]`**, **`[ace]`**.
4
6
 
5
7
  Published as **`@gluecharm-lab/easyspecs-cli`** (npm org **gluecharm-lab**; **EasySpecs** is the product). The executable on your `PATH` is **`easyspecs-cli`**.
6
8
 
7
9
  ## Requirements
8
10
 
9
11
  - **Node.js** ≥ 18
10
- - **OpenCode** (`opencode` on `PATH`) for flows that run agents — install from OpenCode’s own documentation
11
- - A **git repository** with **`.gluecharm/`** (documentation + context layout) when running analysis, diagnose, or upload against a project
12
+ - **OpenCode** (`opencode` on `PATH`) for flows that run agents — install OpenCode using its own install instructions
12
13
 
13
14
  ## Install
14
15
 
@@ -33,57 +34,68 @@ npx @gluecharm-lab/easyspecs-cli@latest help
33
34
 
34
35
  ## Quick start
35
36
 
37
+ From a git repo (**OpenCode** on **`PATH`** for agent steps). The CLI creates minimal **`.gluecharm/`** directories when needed for **analysis**, **`update context`**, **diagnose**, **upload**, and **download context**:
38
+
36
39
  ```bash
37
40
  cd /your/repo
38
41
  easyspecs-cli doctor
39
- easyspecs-cli doctor --inspect-config
40
- easyspecs-cli help
42
+ easyspecs-cli config init
43
+ easyspecs-cli analysis
41
44
  ```
42
45
 
43
- Use **`config init`** to create **`.easyspecs/config.json`** with defaults (add **`--overwrite`** to replace an existing file). Set **`easyspecs.easyspecsProjectId`** and **`easyspecs.defaultGitRemoteUrl`** from the shell with **`config set-project-id <id>`** and **`config set-git-remote <url>`** (each overwrites that field). Use **`--ci`** for non-interactive CI: no prompts, stricter defaults (e.g. macro outer-iteration cap). Tunables belong in **`<repo>/.easyspecs/config.json`** — do not rely on **`EASYSPECS_*`** environment variables for product settings.
46
+ **`config init`** creates **`.easyspecs/config.json`** with defaults (add **`--overwrite`** to replace an existing file). **`analysis`** runs the full **Generate Context** factory (synthesis convergence, coverage, remediation, report, link mapping, index assembly; optional **`--upload`** for backend sync after **`auth login`** + **`config set-project-id <id>`**). Add **`--synthesis-only`** to stop after the synthesis phase. **`update context`** (SRS-55) refreshes context from a **git delta** since **`easyspecs.factory.updateContext.lastRunAt`** or the latest workspace **`.gluecharm/context`** mtime: writes **`changes-since-date.md`**, runs scoped zero-reference remediation when there are commits and touched paths, honors global **`--promote` / `--no-promote`**, optional **`--upload`**, and persists **`lastRunAt`** on success. Use **`download context`** (same auth + project id) to pull context from EasySpecs into **`.gluecharm/context`**. Use **`--ci`** in automation for non-interactive behaviour and stricter defaults (e.g. Factory outer-iteration cap).
47
+
48
+ Set **`easyspecs.defaultGitRemoteUrl`** with **`config set-git-remote <url>`** when you want that recorded in config. Tunables belong in **`<repo>/.easyspecs/config.json`** — do not rely on **`EASYSPECS_*`** environment variables for product settings.
49
+
50
+ Optional checks:
44
51
 
45
52
  ```bash
53
+ easyspecs-cli doctor --inspect-config
54
+ easyspecs-cli help
46
55
  easyspecs-cli diagnose coordination-duplicates --cwd /your/repo --ci --json
47
56
  ```
48
57
 
49
- ## Commands (overview)
58
+ ## Download context (pull from EasySpecs)
50
59
 
51
- | Area | Examples |
52
- | ---- | ---------- |
53
- | **Health** | `doctor` (`--readiness`, `--inspect-config`), `version` |
54
- | **Config** | `doctor --inspect-config`, `config init`, `config set-project-id`, `config set-git-remote` |
55
- | **Auth** | `auth login --email … --password …`, `auth logout`, `auth status` |
56
- | **Run synthesis** | `run synthesis`; **`run synthesis resume-missing`** / **`resume-synthesis`** |
57
- | **Analysis** (full macro pipeline) | `analysis` (optional **`--upload`** after login; **`--synthesis-only`** stops after synthesis) |
58
- | **Diagnose** | `diagnose reference-coverage`, `coordination-duplicates`, `coverage-report`, … |
59
- | **Upload** | `upload context`, `upload republish` |
60
- | **ACE** | `ace clear`, `ace learn`, `ace auto-learn` |
60
+ Use this when you want the **application context** that is already stored in EasySpecs (CMS **`srs_discovery`** rows) written into your repo’s **`.gluecharm/context`**, for example after a fresh clone or to align with the cloud.
61
61
 
62
- Run **`easyspecs-cli help`** for the full command tree. This README does not duplicate every flag; the built-in help matches the installed package version.
62
+ **Prerequisites:** same as **`upload context`**: a prior **`auth login`**, and **`easyspecs.easyspecsProjectId`** set (e.g. **`easyspecs-cli config set-project-id <uuid>`**). The CLI creates minimal **`.gluecharm/`** layout when needed, including **`.gluecharm/context`**.
63
63
 
64
- ## Terminal diagnostics (colors)
64
+ **Behaviour:** the CLI **GET**s the application, reads linked **`srs_discovery`** ids, then **POST**s **batch get** to **`/api/batch/content/srs_discovery/get`** and writes one file per row under **`<repo>/.gluecharm/context`**, using each row’s **`name`** as a safe relative path (path traversal is rejected). Rows named **`easyspecs-upload-target.json`** are skipped. When files are written, ids are merged into **`index-application-context.json`** the same way as after upload, if that index file exists.
65
65
 
66
- Long-running commands (**`run synthesis`**, **`analysis`**, **`diagnose`** with **`--verbose`**, etc.) print **structured lines** on stderr with bracket prefixes such as **`[pool]`**, **`[queue]`**, **`[setup]`**, **`[AgentCode]`**, **`[context]`**, **`[index]`** — same vocabulary as the EasySpecs Analysis output in VS Code. Logs say **AgentCode** for the agent subprocess; the executable on your machine may still be **`opencode`** on **`PATH`**.
66
+ ```bash
67
+ cd /your/repo
68
+ easyspecs-cli auth login --email you@example.com --password '…'
69
+ easyspecs-cli config set-project-id <your-easyspecs-project-uuid>
70
+ easyspecs-cli download context
71
+ ```
67
72
 
68
- When **stderr** is an interactive **TTY**, those prefixes are **colorized** (ANSI) for faster scanning.
73
+ | Flag | Meaning |
74
+ | ---- | ------- |
75
+ | *(none)* | Skip any local file that already exists (no silent overwrite). |
76
+ | `--force` | Overwrite existing files that map to cloud rows. |
77
+ | `--replace-from-cloud` | Delete local files under **`.gluecharm/context`** first, then write from the cloud. Root **`easyspecs-upload-target.json`** is preserved when present. Implies a full replace of downloaded content; pair with care. |
69
78
 
70
- | Mechanism | Effect |
71
- | --------- | ------ |
72
- | **`NO_COLOR`** set to any non-empty value | Colors **disabled** ([no-color.org](https://no-color.org/)). |
73
- | **`FORCE_COLOR`** set to any non-empty value | Colors **allowed** even if stderr is **not** a TTY (e.g. piping to **`tee`**). |
74
- | **`--json`** | Normal runs **suppress** stderr diagnostics; stderr never receives ANSI in that mode so JSON on stdout stays machine-safe. With **`--json --verbose`**, stderr lines are **plain text** (no ANSI). |
79
+ **`--json`:** prints one summary line on stdout with **`ok`**, **`downloaded`**, **`skipped`**, **`failed`** (count), and **`localRemoved`** (files deleted when **`--replace-from-cloud`** was used). With **`--verbose`**, if **`failed` > 0`**, the line may include a **`failures`** array. A non-zero exit is used when **`failed` > 0`**.
75
80
 
76
- **Behaviour:** bracket tags are colorized; **`[pool]`** lines bold the work-item id and dim **`(active n/m)`**; **`[AgentCode]`** lines dim **`prompt` / `command` / `cwd` / `argv`** labels; multi-line **`stderr`/`stdout`** dumps are indented and dimmed; **blank lines** appear when the phase family changes (e.g. **`[setup]`** → **`[pool]`**, **`[pool]`** → **`[AgentCode]`**). Purely visual — message text is unchanged for grep.
81
+ **Examples:**
82
+
83
+ ```bash
84
+ easyspecs-cli download context
85
+ easyspecs-cli download context --force
86
+ easyspecs-cli download context --replace-from-cloud
87
+ easyspecs-cli --json download context
88
+ ```
77
89
 
78
90
  ## Configuration
79
91
 
80
- Primary configuration file: **`<repo>/.easyspecs/config.json`** (auto-created when needed, except for **`help`**, **`version`**, and **`doctor`** which do not create the file on first run). **`auth login --email … --password …`** stores tokens for upload commands (optional **`--session-path`** on the command tail updates **`easyspecs.cliSessionPath`** in **`config.json`**).
92
+ Primary configuration file: **`<repo>/.easyspecs/config.json`** (auto-created when needed, except for **`help`**, **`version`**, and **`doctor`** which do not create the file on first run). **`auth login --email … --password …`** stores tokens for **upload** and **download context** commands. You may append **`--session-path <file>`** at the **end** of the **`auth login`** argument list to update **`easyspecs.cliSessionPath`** in **`config.json`** for that login flow.
81
93
 
82
94
  After **`auth login`**, session data is stored at **`easyspecs.cliSessionPath`** in **`config.json`** when that path is set (otherwise **`~/.easyspecs/cli-session.json`**). Tools such as the VS Code extension may spawn **`easyspecs-cli`** with global **`--session-path <file>`** so this process uses a temporary session file without editing **`config.json`**.
83
95
 
84
96
  ### Default **`config.json`** (from **`easyspecs-cli config init`**)
85
97
 
86
- Run **`easyspecs-cli config init`** in your repo (add **`--overwrite`** to replace an existing file). A fresh install writes **`.easyspecs/config.json`** equivalent to the following default shape:
98
+ Run **`easyspecs-cli config init`** in your repo (add **`--overwrite`** to replace an existing file). A fresh install writes **`.easyspecs/config.json`** with a shape similar to:
87
99
 
88
100
  ```json
89
101
  {
@@ -152,6 +164,8 @@ Run **`easyspecs-cli config init`** in your repo (add **`--overwrite`** to repla
152
164
  }
153
165
  ```
154
166
 
167
+ Your file may gain additional keys over time (for example cloud-analysis cache fields under **`easyspecs.analysis`**); validate against the schema your package version documents.
168
+
155
169
  ### Config keys (reference)
156
170
 
157
171
  Merge order for **`easyspecs-cli`**: **`.easyspecs/config.json`** plus global CLI flags (for example **`--api-base-url`**, **`--environment`**). The CLI does **not** read **`EASYSPECS_*`** or **`VITE_*`** for product settings.
@@ -161,19 +175,24 @@ Merge order for **`easyspecs-cli`**: **`.easyspecs/config.json`** plus global CL
161
175
  | `schemaVersion` | Integer (e.g. `2`) for future migrations. |
162
176
  | `easyspecs.deploymentEnvironment` | `production` or `staging` (default `production`). Used with built-in System Manager URLs when `apiBaseUrl` is empty. |
163
177
  | `easyspecs.apiBaseUrl` | Explicit System Manager origin; wins after `--api-base-url`. Default non-empty value uses the production API host. Use **`""`** if you want the built-in URL from **`deploymentEnvironment`** / **`--environment`** only. |
164
- | `easyspecs.easyspecsProjectId` | EasySpecs **project** id (Content application UUID) for uploads. Set with **`config set-project-id`** or the EasySpecs app; legacy **`applicationId`** in older files may be migrated into this field. |
178
+ | `easyspecs.easyspecsProjectId` | EasySpecs **project** id (Content application UUID) for **`upload context`**, **`upload republish`**, and **`download context`**. Set with **`config set-project-id`** or the EasySpecs app; legacy **`applicationId`** in older files may be migrated into this field. |
165
179
  | `easyspecs.defaultGitRemoteUrl` | Optional primary **`git remote`** URL (HTTPS or SSH) for reference; analysis still uses the live repo. |
166
180
  | `easyspecs.cliSessionPath` | Repo-relative or absolute path to **`cli-session.json`**. Empty **`""`** → **`~/.easyspecs/cli-session.json`**. Precedence: global **`--session-path`** → **`cliSessionPath`** → home default. |
167
181
  | `easyspecs.openCode` | `executable`, `skipCredentialsCheck` (shortcut; see **`openCodeRuntime`**). |
168
- | `easyspecs.analysis.*` | Pipeline: argv template, timeouts, repair attempts, concurrency, `promoteContextToWorkspace`. |
169
- | `easyspecs.orchestration.*` | Macro delays, outer iterations, ping-pong cap. |
182
+ | `easyspecs.analysis.*` | **`promoteContextToWorkspace`**, ACE toggles, and other analysis-only flags. Cloud “already analyzed” cache is canonical under **`easyspecs.factory.cloudContextAnalyzed`** / **`At`** (legacy **`easyspecs.analysis.cloudContext*`** still read once with deprecation stderr). |
183
+ | `easyspecs.factory.*` | Factory debug, backoff, outer-iteration caps, ping-pong cap, cloud cache. Replaces **`easyspecs.orchestration.*`** and **`easyspecs.macro.debug`** (aliases still read). |
184
+ | `easyspecs.workstations.*` | OpenCode argv, timeouts, repair attempts, pool width, coordination lock timeout (canonical; legacy **`easyspecs.analysis.openCodeTest*`** / **`markdown*`** / **`listJsonSchemaRepairAttempts`** / **`maxConcurrentOpenCodeAgents`** aliases). |
185
+ | `easyspecs.pipelines.upload.useBatch` | Upload batching (legacy **`easyspecs.analysis.uploadUseBatch`**). |
186
+ | `easyspecs.orchestration.*` | **Deprecated** — prefer **`easyspecs.factory.*`**. |
170
187
  | `easyspecs.openCodeRuntime` | Providers (`apiKey`, `defaultModel` per provider), `run`, `coordinationRepairs`, `pool`, `projectConfigOverlay`. |
171
188
  | `easyspecs.diagnose.zeroReference.maxPercentNonReferenced` | Number or **`null`**. **`null`** means **`diagnose reference-coverage`** does not fail on percentage alone. |
172
189
  | `easyspecs.diagnose.coordinationDuplicates.strict` | Boolean (default **`true`**). |
173
190
  | `easyspecs.upload.contextDirectory` | Repo-relative or absolute override for **`upload republish`**; empty **`""`** → automatic resolution from the analysis snapshot. |
174
- | `easyspecs.macro.debug` | When **`true`**, macro phase transitions log extra lines to stderr. |
191
+ | `easyspecs.upload.fetchContextAnalyzedInCloud` | Boolean, default **`true`**. When **`true`**, after a successful **`upload context`** / **`upload republish`**, the CLI may **`GET`** application status and emit **`contextAnalyzedInCloud`** / **`contextAnalyzedInCloudAt`** on **`--json`**, and update **`easyspecs.analysis.cloudContext*`** cache. When **`false`**, skips that fetch. |
192
+ | `easyspecs.upload.contextAnalyzedStatusTimeoutMs` | Optional positive integer (ms) for that GET; default **15000** if omitted. |
193
+ | `easyspecs.factory.debug` | When **`true`**, Factory phase transitions log extra lines to stderr. Legacy **`easyspecs.macro.debug`**. |
175
194
  | `easyspecs.cli.bundledResourcesRoot` | Optional absolute or repo-relative path to the bundled **`resources/`** directory. Empty → resolve next to the installed CLI package. |
176
- | `easyspecs.auth.ciLogin.email` / `password` | Used with **`--ci`** when **`--email` / `--password`** are omitted on the command line. Prefer CI-generated **`config.json`**; avoid committing secrets. |
195
+ | `easyspecs.auth.ciLogin.email` / `password` | Used with **`--ci`** when **`--email` / `--password`** are omitted on **`auth login`**. Prefer CI-generated **`config.json`**; avoid committing secrets. |
177
196
 
178
197
  **Resolved API base URL:** `--api-base-url` → non-empty **`easyspecs.apiBaseUrl`** → built-in URL from **`--environment`** or **`easyspecs.deploymentEnvironment`** or **`production`**.
179
198
 
@@ -181,69 +200,78 @@ Merge order for **`easyspecs-cli`**: **`.easyspecs/config.json`** plus global CL
181
200
 
182
201
  ## Global flags
183
202
 
184
- `--cwd`, `--ci`, `--json`, `--verbose`, `--api-base-url`, **`--session-path`**, `--environment`, `--promote` / `--no-promote` details in **`easyspecs-cli --help`**.
185
-
186
- ### Global options (table)
203
+ These appear **before** the subcommand (everything after the first non-flag token is the command and its arguments).
187
204
 
188
205
  | Flag | Effect |
189
206
  | ---- | ------ |
190
207
  | `--cwd <dir>` | Repository root for git resolution and paths (default: current working directory). |
191
- | `--ci` | Non-interactive mode; affects merged settings (e.g. macro outer-iteration default). **`EASYSPECS_CI` is not read** — use this flag. |
208
+ | `--ci` | Non-interactive mode; affects merged settings (e.g. Factory outer-iteration default). **`EASYSPECS_CI` is not read** — use this flag. |
192
209
  | `--json` | On supported exits, one JSON summary line on stdout. |
193
210
  | `--verbose` | Extra stderr logging where implemented. |
194
211
  | `--api-base-url <url>` | System Manager API origin for this process (overrides `easyspecs.apiBaseUrl`). |
212
+ | `--session-path <file>` | Session JSON path for **this process only** (overrides **`easyspecs.cliSessionPath`**); does not rewrite **`config.json`** unless you use **`auth login`** tail **`--session-path`** as documented under **Auth**. |
195
213
  | `--environment production` \| `staging` | Alias **`--env`**. Overrides `easyspecs.deploymentEnvironment` for built-in URL selection when no explicit URL is set. |
196
214
  | `--promote` | After **`run synthesis`**, copy generated **`.gluecharm/context`** from the analysis worktree into the workspace repo when applicable. |
197
215
  | `--no-promote` | Disable that promotion for this run. |
198
216
  | `--help`, `-h` | Built-in help. Does **not** create **`.easyspecs/config.json`**. |
199
217
  | `--version`, `-V` | CLI package version. Does **not** create config. |
200
- | `--config <path>` | Reserved / unused in current releases; read **`<repo>/.easyspecs/config.json`** instead. |
218
+ | `--config <path>` | Parsed but **unused** in current releases; read **`<repo>/.easyspecs/config.json`** instead. |
201
219
 
202
- ### Diagnose-only flags
220
+ ## Diagnose / context flags
203
221
 
204
- Used after **`diagnose <subcommand>`**:
222
+ Used on the tail of **`diagnose <subcommand>`** or **`context link-graph`**:
205
223
 
206
224
  | Flag | Values | Meaning |
207
225
  | ---- | ------ | ------- |
208
- | `--root` | `workspace` or `worktree` | Resolve paths against the workspace repo root or an analysis checkout. |
209
- | `--worktree` | path | Analysis git checkout (use with **`--root worktree`** when needed). |
226
+ | `--root` | `workspace` or `worktree` | Resolve paths against the workspace repo root or an analysis checkout (**required** for **`reference-coverage`**, **`coordination-duplicates`**, **`coverage-report`**, **`missing-artefacts`**, **`context link-graph`**). |
227
+ | `--worktree` | path | Analysis git checkout (use with **`--root worktree`**, or alone where **`diagnose zero-reference`** documents it). |
228
+
229
+ ## Commands and flags (complete)
210
230
 
211
- ## Command reference
231
+ Every command the CLI accepts, with command-specific tokens. Global flags above apply to all of these unless noted.
212
232
 
213
- | Command | Tokens / notes | Behaviour summary |
214
- | ------- | ---------------- | ------------------ |
215
- | `help`, `--help` | — | Prints usage. |
233
+ | Command | Command-specific flags / tokens | Behaviour summary |
234
+ | ------- | ------------------------------- | ------------------ |
235
+ | `help` or first token `--help` | — | Prints usage (same as **`--help`** before the command). |
216
236
  | `version` | — | Prints the CLI package version string. |
217
- | `doctor` | **`--readiness`**, **`--inspect-config`** | Does **not** create **`config.json`**. Default (no flags) behaves like **`--readiness`**. **`--inspect-config`** prints redacted merged settings and config. |
218
- | `config init` | **`--overwrite`** optional | Writes full defaults; may import legacy **`.easyspecs/cli.json`** once if present. |
219
- | `config set-project-id <id>` | — | Sets **`easyspecs.easyspecsProjectId`**. |
220
- | `config set-git-remote <url>` | — | Sets **`easyspecs.defaultGitRemoteUrl`**. |
221
- | `auth login` | **`--email`**, **`--password`**, optional tail **`--session-path`** | Login against the resolved API; writes session file. With **`--ci`**, credentials may come from **`easyspecs.auth.ciLogin`** in **`config.json`** if argv omits email/password. |
222
- | `auth logout` | | Clears the effective session file. |
223
- | `auth status` | — | Shows whether a session file exists / looks populated. |
224
- | `run synthesis` | — | Context artefact pipeline pass; **`requireOpenCode`** applies. |
225
- | `run synthesis resume-missing`, `resume-synthesis` | **`--worktree`** | Resumes remediation / synthesis on a known checkout. |
226
- | `analysis` | **`--synthesis-only`**, **`--upload`** | Full macro loop; **`--upload`** needs **`auth login`** and project id in config. |
227
- | `diagnose reference-coverage` | **`--root`**, **`--worktree`** | Optional percent gate via **`easyspecs.diagnose.zeroReference.maxPercentNonReferenced`**. |
228
- | `diagnose coordination-duplicates` | same | **`easyspecs.diagnose.coordinationDuplicates.strict`**. |
229
- | `diagnose coverage-report` | same | Coverage report path on disk. |
230
- | `diagnose missing-artefacts` | same | Lists missing artefacts from workspace state. |
231
- | `diagnose zero-reference` | **`--worktree`** | Zero-reference remediation pool (**OpenCode**). |
232
- | `upload context` | | Requires auth session and **`easyspecs.easyspecsProjectId`**. |
233
- | `upload republish` | | Same auth rules; context dir from **`easyspecs.upload.contextDirectory`** or analysis snapshot. |
237
+ | `doctor` | **`--readiness`**, **`--inspect-config`** (optional; default if none → readiness-style check) | Does **not** create **`config.json`**. **`--readiness`**: repo root, API URL, OpenCode, agents dir. **`--inspect-config`**: redacted merged settings + config JSON. Both flags together runs both. |
238
+ | `config init` | **`--overwrite`** (optional) | Writes **`.easyspecs/config.json`** with defaults; may import legacy **`.easyspecs/cli.json`** once if present. Existing file unchanged unless **`--overwrite`**. |
239
+ | `config set-project-id <easyspecsProjectId>` | — | Sets **`easyspecs.easyspecsProjectId`** (creates config with defaults if missing). |
240
+ | `config set-git-remote <url>` | — | Sets **`easyspecs.defaultGitRemoteUrl`** (same bootstrap-if-missing behaviour). |
241
+ | `config dump` | | **Deprecated.** Prints the same redacted payload as **`doctor --inspect-config`** and stderr warns to use **`doctor --inspect-config`**. |
242
+ | `auth login` | **`--email <email> --password <password>`**, optional tail **`--session-path <path>`** | Login to resolved API; writes session file. With **`--ci`**, credentials may come from **`easyspecs.auth.ciLogin`** in **`config.json`** if argv omits email/password. Tail **`--session-path`** updates **`easyspecs.cliSessionPath`** in **`config.json`**. Global **`--session-path`** overrides effective session file without editing **`config.json`**. |
243
+ | `auth logout` | — | Deletes the effective session file. |
244
+ | `auth status` | — | Reports whether a session file exists / looks populated. |
245
+ | `run synthesis` | | Context artefact pipeline pass; **`requireOpenCode`** applies. **`--promote` / `--no-promote`** affect promotion after success. |
246
+ | `run synthesis resume-missing` | **`--worktree <path>`** (optional) | Parallel missing-artefact remediation pool on an existing checkout (from **`--worktree`** or last snapshot). **`requireOpenCode`**. |
247
+ | `run synthesis resume-synthesis` | **`--worktree <path>`** (optional) | Same implementation as **`resume-missing`** (alias command path). |
248
+ | `analysis` | **`--synthesis-only`**, **`--upload`**, **`--skip-upload`**, **`--force-new-context-analysis`** (any order among argv tokens after **`analysis`**) | Full **Generate Context** factory unless **`--synthesis-only`**. **`--upload`** runs backend sync after the factory (needs **`auth login`** + **`easyspecs.easyspecsProjectId`**). Without **`--upload`**, backend sync is skipped. **`--skip-upload`** appears in **`easyspecs-cli help`**; omit **`--upload`** to skip upload. If **`easyspecs.factory.cloudContextAnalyzed`** is **`true`** (legacy **`easyspecs.analysis.cloudContextAnalyzed`**) and neither **`--synthesis-only`** nor **`--force-new-context-analysis`** is set, exits **0** early with **`analysisSkipped`** (machine JSON fields). |
249
+ | `update context` | **`--upload`** (optional; any order in tail) | **SRS-55** incremental refresh: git window after baseline → worktree → **`changes-since-date.md`** → optional remediation → **`--promote` / `--no-promote`** → optional **`--upload`** (mtime-scoped files) → **`easyspecs.factory.updateContext.lastRunAt`**. Needs seeded context on **HEAD** (or workspace copy); see **`commands.md`**. |
250
+ | `diagnose reference-coverage` | **`--root workspace`** \| **`--root worktree`**, optional **`--worktree <path>`** | Reference coverage gate; optional percent limit via **`easyspecs.diagnose.zeroReference.maxPercentNonReferenced`**. |
251
+ | `diagnose coordination-duplicates` | same | Duplicate/orphan reporting; **`easyspecs.diagnose.coordinationDuplicates.strict`**. |
252
+ | `diagnose coverage-report` | same | Writes coverage execution report path. |
253
+ | `diagnose missing-artefacts` | same | Lists missing artefacts from workspace state (JSON on stdout in human mode). |
254
+ | `diagnose zero-reference` | **`--worktree <path>`** (optional; no **`--root`** branch) | Zero-reference remediation pool (**OpenCode**). After a successful pool run, applies **SRS-51** context markdown navigation links under the analysis checkout context directory (fails the command if that step reports broken links). |
255
+ | `context link-graph` | **`--root workspace`** \| **`--root worktree`**, optional **`--worktree <path>`** | **SRS-51:** refreshes EasySpecs navigation marker blocks in **`.gluecharm/context/**/*.md`** from coordination JSON only (no agents). **`--json`** may include **`contextDir`**, **`error`**, **`brokenLinks`**. |
256
+ | `download context` | **`--force`**, **`--replace-from-cloud`** (optional; any order after **`download context`**) | Requires **`auth login`** session + **`easyspecs.easyspecsProjectId`**. Fetches **`srs_discovery`** ids from **`GET /api/content/application/:id`**, hydrates rows with **`POST /api/batch/content/srs_discovery/get`**, writes UTF-8 files under **`<repo>/.gluecharm/context`**. Default skips existing paths; **`--force`** overwrites; **`--replace-from-cloud`** wipes local context files first (preserves root **`easyspecs-upload-target.json`**). **`--json`**: **`downloaded`**, **`skipped`**, **`failed`**, **`localRemoved`**. Non-zero exit if **`failed` > 0`. Full narrative under **Download context (pull from EasySpecs)** above. |
257
+ | `upload context` | — | Requires auth session + **`easyspecs.easyspecsProjectId`**. Context dir: **`<repo>/.gluecharm/context`**. Optional cloud status GET per **`easyspecs.upload.fetchContextAnalyzedInCloud`**. |
258
+ | `upload republish` | — | Same auth + project id; context dir from **`easyspecs.upload.contextDirectory`** or analysis worktree snapshot. Same optional cloud status behaviour as **`upload context`**. |
234
259
  | `ace clear` | — | Deletes learnings under **`.gluecharm/context/learnings`**. |
235
- | `ace learn`, `ace auto-learn` | **`--worktree`** | ACE offline learning pools (**OpenCode**). |
260
+ | `ace learn` | **`--worktree <path>`** (optional) | Offline ACE learn from traces; **`requireOpenCode`**. Worktree = **`--worktree`** if it contains **`.opencode/schemas/ace`**, else workspace root. |
261
+ | `ace auto-learn` | **`--worktree <path>`** (optional) | ACE auto-learn pool; **`requireOpenCode`**. Worktree = **`--worktree`** if valid git dir, else workspace root. Concurrency capped by **`merged.pipelineOpenCode.maxConcurrentAgents`** (schema field name; mirrors **`easyspecs.workstations.maxConcurrentAi`** / legacy **`maxConcurrentOpenCodeAgents`**). |
262
+
263
+ **OpenCode:** commands that spawn agents require **`opencode`** (or configured executable) on **`PATH`** and credentials unless **`skipCredentialsCheck`** or provider keys in **`config.json`** apply (**`requireOpenCode`**).
264
+
265
+ **EasySpecs API session:** **`download context`**, **`upload context`**, **`upload republish`**, **`analysis --upload`**, and **`update context --upload`** need a prior **`auth login`** (or **`--ci`** with **`easyspecs.auth.ciLogin`** in **`config.json`** when argv omits email/password on login), plus **`easyspecs.easyspecsProjectId`** for the upload/download commands.
266
+
267
+ **Unknown command:** prints help and exits with a usage error.
236
268
 
237
269
  ## Product information
238
270
 
239
- **EasySpecs** is a product for agentic documentation and requirements: use the public marketing and app entry at **easyspecs.ai** (sign-in, projects, browser workspace). This npm package is the **headless CLI** only; it does not bundle the web app.
271
+ **EasySpecs** is a product for agentic documentation and requirements. The public site and app live at **easyspecs.ai** (sign-in, projects, browser workspace). This npm package is the **headless CLI** only; it does not bundle the web app.
240
272
 
241
273
  ## License
242
274
 
243
275
  Copyright © **Spaii Edutainment SL** (Barcelona, Spain).
244
276
 
245
- This package is licensed under the **Elastic License 2.0** (**ELv2**, SPDX **`Elastic-2.0`**). The complete license text is included in the **`LICENSE`** file published inside **`@gluecharm-lab/easyspecs-cli`**. Other artifacts outside this tarball may use different licenses.
246
-
247
- ## Bundled documentation
248
-
249
- This package also ships **`commands.md`** in the same directory as this **`README.md`**, with an extended command and configuration reference (same scope as this file, in alternate layout).
277
+ This package is licensed under the **Elastic License 2.0** (**ELv2**, SPDX **`Elastic-2.0`**). The complete license text ships in the **`LICENSE`** file inside the published **`@gluecharm-lab/easyspecs-cli`** package on npm.
package/commands.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # EasySpecs CLI — commands, flags, and configuration
2
2
 
3
- Published package: **`@gluecharm-lab/easyspecs-cli`** (`easyspecs-cli`). Source of truth for routing: [`src/cli/main.ts`](../../src/cli/main.ts), argument parsing: [`src/cli/argv.ts`](../../src/cli/argv.ts), merged settings: [`mergeEasyspecsCliSettings`](../../src/cli/cliSettings.ts), per-repo config: [`src/config/easyspecsConfigFile.ts`](../../src/config/easyspecsConfigFile.ts), CLI API URL resolution: [`src/easyspecsApiBaseUrlCli.ts`](../../src/easyspecsApiBaseUrlCli.ts). The VS Code extension resolves API URLs via [`src/apiBaseUrlResolve.ts`](../../src/apiBaseUrlResolve.ts); **`easyspecs-cli` does not use that chain** for System Manager origin (**SRS-43 R30 / R34**).
3
+ Published package: **`@gluecharm-lab/easyspecs-cli`** (`easyspecs-cli`). Source of truth for routing and option registration: [`src/cli/cliProgram.ts`](../../src/cli/cliProgram.ts), command dispatch and business flow wiring: [`src/cli/main.ts`](../../src/cli/main.ts), merged settings: [`mergeEasyspecsCliSettings`](../../src/cli/cliSettings.ts), per-repo config: [`src/config/easyspecsConfigFile.ts`](../../src/config/easyspecsConfigFile.ts), CLI API URL resolution: [`src/easyspecsApiBaseUrlCli.ts`](../../src/easyspecsApiBaseUrlCli.ts). The VS Code extension resolves API URLs via [`src/apiBaseUrlResolve.ts`](../../src/apiBaseUrlResolve.ts); **`easyspecs-cli` does not use that chain** for System Manager origin (**SRS-43 R30 / R34**).
4
+
5
+ ### Vocabulary (SRS-53)
6
+
7
+ End-to-end behaviour and file layout: see the repo root companion **`run-analysis-flow.md`** (no URL; same repository).
8
+
9
+ | Term | One-line meaning |
10
+ |------|------------------|
11
+ | **Factory** | The ordered **Generate Context** run (CLI: **`analysis`**; VS Code: Diagnosis **Run factory** / **Stop factory**). |
12
+ | **Pipeline** | A named stage the Factory composes: Synthesis, Coverage, Remediation, Link Mapping, Upload, or Download. |
13
+ | **Workstation** | One atomic unit inside a Pipeline (OpenCode agent + deterministic validators / repair loop, or a programmatic step). |
14
+
15
+ **Stderr tags (human TTY mode):** phase changes may insert a blank line when the family changes. Tags include **`[factory]`**, **`[pipeline:synthesis]`** (and `coverage`, `remediation`, `link-mapping`, `upload`, `download`), **`[workstation:<id>]`** for OpenCode subprocess lines, **`[pool]`** / **`[queue]`** for work queues, **`[deprecated-setting]`** when a legacy **`config.json`** key was consumed (canonical keys: **`easyspecs.factory.*`**, **`easyspecs.workstations.*`**, **`easyspecs.pipelines.upload.*`** — see SRS-53 alias table). **`[ace]`** and **`[open questions]`** unchanged.
4
16
 
5
17
  Quick usage:
6
18
 
@@ -12,12 +24,12 @@ easyspecs-cli help
12
24
 
13
25
  ## Global options
14
26
 
15
- These flags may appear **before** the subcommand. Anything after the first non-flag token is treated as the command and its arguments ([`parseArgv`](../../src/cli/argv.ts)).
27
+ These flags may appear **before** the subcommand. Parsing and command registration are implemented with Commander in [`src/cli/cliProgram.ts`](../../src/cli/cliProgram.ts), with command execution in [`src/cli/main.ts`](../../src/cli/main.ts).
16
28
 
17
29
  | Flag | Effect |
18
30
  |------|--------|
19
31
  | `--cwd <dir>` | Repository root for git resolution and file paths (default: current working directory). |
20
- | `--ci` | Non-interactive mode; feeds into merged settings (e.g. macro outer-iteration default when unlimited). **`EASYSPECS_CI` is not read** — use this flag in CI. |
32
+ | `--ci` | Non-interactive mode; feeds into merged settings (e.g. Factory outer-iteration default when unlimited). **`EASYSPECS_CI` is not read** — use this flag in CI. |
21
33
  | `--json` | On supported exits, prints one JSON summary line on stdout; suppresses some human-oriented stderr unless `--verbose`. |
22
34
  | `--verbose` | Extra stderr logging where implemented. |
23
35
  | `--api-base-url <url>` | System Manager API origin for this process (overrides `easyspecs.apiBaseUrl` in config). |
@@ -28,7 +40,7 @@ These flags may appear **before** the subcommand. Anything after the first non-f
28
40
  | `--version`, `-V` | Print CLI package version (also `version` as first positional). Does **not** create config. |
29
41
  | `--config <path>` | Parsed but **unused** by `main.ts` today; configuration is read from `<repoRoot>/.easyspecs/config.json`. |
30
42
 
31
- Environment (stderr styling): **`NO_COLOR`** (any non-empty value) disables ANSI colors. **`FORCE_COLOR`** (any non-empty value) allows colors even when stderr is not a TTY. With **`--json`**, human stderr is normally suppressed; **`--json --verbose`** prints plain stderr **without** ANSI. In human mode, a **blank line** may be printed when the diagnostic **phase** changes (e.g. **`[setup]`** → **`[pool]`** / **`[AgentCode]`**). See **README** (Terminal diagnostics).
43
+ Environment (stderr styling): **`NO_COLOR`** (any non-empty value) disables ANSI colors. **`FORCE_COLOR`** (any non-empty value) allows colors even when stderr is not a TTY. With **`--json`**, human stderr is normally suppressed; **`--json --verbose`** prints plain stderr **without** ANSI. In human mode, a **blank line** may be printed when the diagnostic **phase** changes (e.g. **`[factory]`** → **`[pool]`** / **`[workstation:listFeatures]`**). See **README** (Terminal diagnostics).
32
44
 
33
45
  ---
34
46
 
@@ -40,6 +52,8 @@ Canonical JSON created on first need (except **`help`**, **`version`**, and **`d
40
52
 
41
53
  Merge uses **this file + global CLI flags only** — no `EASYSPECS_*` / `VITE_*` product overrides on **`easyspecs-cli`** (**R34**).
42
54
 
55
+ **Workspace layout (SRS-48):** For **`analysis`**, **`update context`**, **`diagnose`**, **`upload`**, **`download context`**, and **`context link-graph`**, the CLI creates the minimal **`.gluecharm/`** directories (**`docs/srs`**, **`content`**, **`logs`**, **`context`**) under the relevant filesystem root when they are missing. You do not need to copy a Gluecharm template tree before first use.
56
+
43
57
  | Path | Purpose |
44
58
  |------|---------|
45
59
  | `schemaVersion` | Integer (e.g. `2`) for future migrations. |
@@ -49,15 +63,17 @@ Merge uses **this file + global CLI flags only** — no `EASYSPECS_*` / `VITE_*`
49
63
  | `easyspecs.defaultGitRemoteUrl` | Optional primary **`git remote`** URL (HTTPS or SSH) for documentation / tooling; analysis still uses the live repo. Related: **`index-application-context.json`** `repository`, **`.easyspecs/analysis-worktree.json`** `repositoryRoot`. |
50
64
  | `easyspecs.cliSessionPath` | Repo-relative or absolute path to **`cli-session.json`** written by **`auth login`**. Empty **`""`** → **`~/.easyspecs/cli-session.json`**. Effective path: global **`--session-path`** (if passed) → **`cliSessionPath`** → default home path ([`cliSession.ts`](../../src/cli/cliSession.ts)). |
51
65
  | `easyspecs.openCode` | `executable`, `skipCredentialsCheck` (legacy shortcut; see also `openCodeRuntime`). |
52
- | `easyspecs.analysis.*` | Pipeline: argv template, timeouts, repair attempts, concurrency, `promoteContextToWorkspace`. **SRS-46:** `cloudContextAnalyzed` (boolean), `cloudContextAnalyzedAt` (`null` or ISO `date-time` string; when `cloudContextAnalyzed` is `true`, `At` must be non-null). |
53
- | `easyspecs.orchestration.*` | Macro delays, outer iterations, ping-pong cap, etc. |
66
+ | `easyspecs.analysis.*` | Remaining analysis flags (e.g. **`promoteContextToWorkspace`**, ACE toggles). **SRS-46 cache** now lives under **`easyspecs.factory.cloudContextAnalyzed`** / **`…At`** (canonical); legacy **`easyspecs.analysis.cloudContext*`** still read for one cycle. |
67
+ | `easyspecs.factory.*` | Factory: **`debug`** (stderr phase transitions; legacy **`easyspecs.macro.debug`**), backoff (`initialDelayMs`, `multiplier`, `maxDelayMs`), `maxOuterIterationsPerPipeline`, `maxPingPongCycles`, `synthesisRemediationShareBackoff`, cloud-context-analyzed cache. Legacy **`easyspecs.orchestration.*`** aliases per SRS-53. |
68
+ | `easyspecs.workstations.*` | OpenCode argv template, timeouts, repair attempts, pool width, coordination lock timeout. Legacy **`easyspecs.analysis.openCodeTest*`** / **`listJsonSchemaRepairAttempts`** / **`markdown*`** / **`maxConcurrentOpenCodeAgents`** / **`coordinationListLockTimeoutMs`** aliases. |
69
+ | `easyspecs.pipelines.upload.useBatch` | Upload batching preference. Legacy **`easyspecs.analysis.uploadUseBatch`**. |
70
+ | `easyspecs.orchestration.*` | **Deprecated** — use **`easyspecs.factory.*`** (SRS-53); still merged when present. |
54
71
  | `easyspecs.openCodeRuntime` | Annex-aligned block: `providers` (per-provider `apiKey`, `defaultModel`), `run`, `coordinationRepairs`, `pool`, `projectConfigOverlay` — see [`srs-43-opencode.schema.json`](../../.gluecharm/docs/srs/srs-43-opencode.schema.json). |
55
72
  | `easyspecs.diagnose.zeroReference.maxPercentNonReferenced` | `number` \| **`null`**. When **`null`**, `diagnose reference-coverage` does not fail on percent alone (**SRS-44**). |
56
73
  | `easyspecs.diagnose.coordinationDuplicates.strict` | Boolean (default **`true`**). When **`true`**, duplicate/orphan rows fail `diagnose coordination-duplicates`. |
57
74
  | `easyspecs.upload.contextDirectory` | Repo-relative or absolute override for **`upload republish`** context dir; empty **`""`** → automatic (analysis snapshot). |
58
- | `easyspecs.upload.fetchContextAnalyzedInCloud` | Boolean, default **`true`**. When **`true`**, after a fully successful **`upload context`** / **`upload republish`**, the CLI performs **`GET /api/content/application/:id`** and emits **`contextAnalyzedInCloud`** / **`contextAnalyzedInCloudAt`** on **`--json`**; updates **`easyspecs.analysis.cloudContext*`** cache. When **`false`**, skips that GET and omits those JSON keys. |
75
+ | `easyspecs.upload.fetchContextAnalyzedInCloud` | Boolean, default **`true`**. When **`true`**, after a fully successful **`upload context`** / **`upload republish`**, the CLI performs **`GET /api/content/application/:id`** and emits **`contextAnalyzedInCloud`** / **`contextAnalyzedInCloudAt`** on **`--json`**; updates **`easyspecs.factory.cloudContext*`** cache (legacy **`easyspecs.analysis.cloudContext*`**). When **`false`**, skips that GET and omits those JSON keys. |
59
76
  | `easyspecs.upload.contextAnalyzedStatusTimeoutMs` | Optional positive integer (ms). GET timeout; default **15000** if omitted. |
60
- | `easyspecs.macro.debug` | When **`true`**, macro phase transitions log to stderr ([`macroHeadlessHost`](../../src/analysis/macroHeadlessHost.ts)). |
61
77
  | `easyspecs.cli.bundledResourcesRoot` | Optional path to bundled **`resources/`** (folder containing **`opencode-agents/`**). Empty → infer next to the CLI package. |
62
78
  | `easyspecs.auth.ciLogin.email` / `password` | Used only with **`--ci`** when **`--email` / `--password`** are omitted (**SRS-44**). Prefer CI-generated **`config.json`**; do not commit secrets. |
63
79
 
@@ -75,9 +91,9 @@ Provider API keys for OpenCode runs should live under **`easyspecs.openCodeRunti
75
91
 
76
92
  ---
77
93
 
78
- ## Diagnose-only flags
94
+ ## Diagnose / context flags
79
95
 
80
- Used after `diagnose <subcommand>`:
96
+ Used after `diagnose <subcommand>` or **`context link-graph`**:
81
97
 
82
98
  | Flag | Values | Meaning |
83
99
  |------|--------|---------|
@@ -103,13 +119,17 @@ Each row lists **command-specific CLI tokens**, then **what configuration applie
103
119
  | `auth status` | — | Reads session file. |
104
120
  | `run synthesis` | — | Single SRS-9 context pass (same as extension **Run Analysis**). **`requireOpenCode`** → executable + credentials unless skip flag. Uses **`merged.pipelineOpenCode`** from **`config.json`**. **`--promote` / `--no-promote`** controls promotion after success. |
105
121
  | `run synthesis resume-missing`, `run synthesis resume-synthesis` | Optional **`--worktree <path>`** | Same implementation: resolves checkout via `--worktree` or stored snapshot ([`resolveAdHocCheckoutRoot`](../../src/cli/main.ts)). OpenCode + **`merged.pipelineOpenCode`**. |
106
- | `analysis` | Optional tokens anywhere in argv: **`--synthesis-only`**, **`--upload`**, **`--force-new-context-analysis`** | **SRS-32** full loop: synthesis convergence (until no missing artefacts), then coverage, zero-ref, report, index, optional backend sync. **`merged.macroOrchestration`** from config + **`--ci`** defaults. **`--upload`** requires prior **`auth login`** session. Macro debug: **`easyspecs.macro.debug`**. OpenCode options from **`merged.pipelineOpenCode`**. **SRS-46:** if **`easyspecs.analysis.cloudContextAnalyzed`** is **`true`** and neither **`--synthesis-only`** nor **`--force-new-context-analysis`** is set, exits **0** without running the macro or **`--upload`** (machine fields: **`analysisSkipped`**, **`skipReason`**, **`cloudContextAnalyzedAt`**). |
122
+ | `analysis` | Optional tokens anywhere in argv: **`--synthesis-only`**, **`--upload`**, **`--force-new-context-analysis`** | **SRS-32** full **Factory** loop: synthesis convergence (until no missing artefacts), coverage, zero-ref, report, **link mapping**, index assembly, optional backend sync. Factory timing from **`merged.factory`** (internal merge shape in [`cliSettings.ts`](../../src/cli/cliSettings.ts)) + **`--ci`** defaults. **`--upload`** requires prior **`auth login`** session. Debug: **`easyspecs.factory.debug`** (legacy **`easyspecs.macro.debug`**). OpenCode options from **`merged.pipelineOpenCode`**. **SRS-46:** if **`easyspecs.factory.cloudContextAnalyzed`** is **`true`** (legacy **`easyspecs.analysis.cloudContextAnalyzed`**) and neither **`--synthesis-only`** nor **`--force-new-context-analysis`** is set, exits **0** without running the Factory or **`--upload`** (machine fields: **`analysisSkipped`**, **`skipReason`**, **`cloudContextAnalyzedAt`**). |
123
+ | `update context` | Optional **`--upload`** (anywhere in tail, same pattern as **`analysis --upload`**) | **SRS-55:** incremental context refresh — baseline **`easyspecs.factory.updateContext.lastRunAt`** **or** max workspace **`.gluecharm/context`** mtime → git commits after baseline → analysis worktree → seed check (optional copy from workspace if **HEAD** worktree lacks context) → **`changes-since-date.md`** → optional scoped zero-reference remediation → **`--promote` / `--no-promote`** (global) → optional **`--upload`** (files touched this run via mtime gate) → persist **`lastRunAt`**. **`--upload`** requires **`auth`** + **`easyspecs.easyspecsProjectId`**. |
107
124
  | `diagnose reference-coverage` | **`--root workspace`** \| **`--root worktree`**, optional **`--worktree <path>`** | Gate when **`easyspecs.diagnose.zeroReference.maxPercentNonReferenced`** is a finite number (not **`null`**): failure when metric exceeds it. |
108
125
  | `diagnose coordination-duplicates` | Same **`--root`** / **`--worktree`** | **`easyspecs.diagnose.coordinationDuplicates.strict`**: when **`true`** (default), duplicate/orphan issues fail the exit code. |
109
126
  | `diagnose coverage-report` | Same **`--root`** / **`--worktree`** | Uses repo/worktree paths only; no extra env in `main.ts`. |
110
127
  | `diagnose missing-artefacts` | Same **`--root`** / **`--worktree`** | Reads artefact snapshot from workspace state; no OpenCode. |
111
- | `diagnose zero-reference` | Optional **`--worktree <path>`** (no `--root` branch in this handler) | **`requireOpenCode`**; **`merged.pipelineOpenCode`** for pool concurrency/argv/timeout. Checkout from **`--worktree`** or snapshot ([`resolveAdHocCheckoutRoot`](../../src/cli/main.ts)). |
112
- | `upload context` | | Requires **`auth`** session. Context dir: **`<repoRoot>/.gluecharm/context`**. Project id: **`easyspecs.easyspecsProjectId`** in **`config.json`** only. **SRS-46:** on full success, optional cloud status GET (see **`fetchContextAnalyzedInCloud`**); **`--json`** may add **`contextAnalyzedInCloud`** / **`contextAnalyzedInCloudAt`**; updates **`easyspecs.analysis.cloudContext*`** when fetch is enabled. |
128
+ | `diagnose zero-reference` | Optional **`--worktree <path>`** (no `--root` branch in this handler) | **`requireOpenCode`**; **`merged.pipelineOpenCode`** for pool concurrency/argv/timeout. Checkout from **`--worktree`** or snapshot ([`resolveAdHocCheckoutRoot`](../../src/cli/main.ts)). On full success, runs **SRS-51** markdown link graph on **`<checkout>/.gluecharm/context`** before exit (**non-zero** if link validation fails). |
129
+ | `context link-graph` | **`--root workspace`** \| **`--root worktree`**, optional **`--worktree <path>`** | **SRS-51:** deterministic navigation sections in context markdown under **`<root>/.gluecharm/context`**. No OpenCode. **`--json`**: **`ok`**, **`contextDir`**, **`error`**, **`brokenLinks`**. Exit **`validation`** on broken relative links inside EasySpecs nav regions. |
130
+ | `context drift <referencePath>` | **`--label <slug>`**, **`--index <path>`**, **`--dry-run`**. Optional **`--root`** / **`--worktree`** tail tokens are accepted and ignored for v1 routing. | **SRS-56:** analysis worktree → OpenCode drift agent → **`.gluecharm/context/drift/drift-<slug>-<date>.md`** + reference index patch → global **`--promote` / `--no-promote`**. Success stdout: drift report path. |
131
+ | `download context` | Optional **`--force`**, **`--replace-from-cloud`** | **SRS-49:** requires **`auth`** session. **`GET /api/content/application/:id`** → **`srs_discovery`** ids → **`POST /api/batch/content/srs_discovery/get`** → writes files under **`<repoRoot>/.gluecharm/context`**. **`--force`** overwrites existing paths; **`--replace-from-cloud`** deletes local context files first (preserves root **`easyspecs-upload-target.json`**). **`--json`** stdout: **`downloaded`**, **`skipped`**, **`failed`**, **`localRemoved`**. Exit **`upload`** when any row fails. |
132
+ | `upload context` | — | Requires **`auth`** session. Context dir: **`<repoRoot>/.gluecharm/context`**. Project id: **`easyspecs.easyspecsProjectId`** in **`config.json`** only. **SRS-46:** on full success, optional cloud status GET (see **`fetchContextAnalyzedInCloud`**); **`--json`** may add **`contextAnalyzedInCloud`** / **`contextAnalyzedInCloudAt`**; updates **`easyspecs.factory.cloudContext*`** when fetch is enabled (legacy **`easyspecs.analysis.cloudContext*`**). |
113
133
  | `upload republish` | — | Same auth + upload pipeline; context dir from **`easyspecs.upload.contextDirectory`** if non-empty and valid, else analysis worktree **`…/.gluecharm/context`** from snapshot, else error. Same project id rule as **`upload context`**. Same **SRS-46** JSON + cache behaviour as **`upload context`**. |
114
134
  | `ace clear` | — | Deletes **`<repoRoot>/.gluecharm/context/learnings`**. |
115
135
  | `ace learn` | Optional **`--worktree <path>`** | **`requireOpenCode`**; worktree chosen if `--worktree` points at checkout with **`.opencode/schemas/ace`**, else **`repoRoot`** ([`main.ts`](../../src/cli/main.ts)). **`merged.pipelineOpenCode`** for spawn argv/timeout. |
@@ -120,6 +140,6 @@ Each row lists **command-specific CLI tokens**, then **what configuration applie
120
140
  ## Notes
121
141
 
122
142
  - Commands that **spawn OpenCode** call **`requireOpenCode`**: binary must respond (`easyspecs.openCode.executable` / `opencode` on **`PATH`**), and credentials must look ready unless **`easyspecs.openCode.skipCredentialsCheck`**, or provider keys exist in **`config.json`**, or the parent shell already has provider env (probe behaviour in [`opencodeCli`](../../src/opencodeCli.ts)).
123
- - **`upload`** / **`analysis --upload`** require a prior **`auth login`** session (**`--email`** / **`--password`**, or **`--ci`** with **`easyspecs.auth.ciLogin`** in **`config.json`**).
143
+ - **`download context`** / **`upload`** / **`analysis --upload`** / **`update context --upload`** require a prior **`auth login`** session (**`--email`** / **`--password`**, or **`--ci`** with **`easyspecs.auth.ciLogin`** in **`config.json`**).
124
144
  - Unknown commands print help and exit with a usage error.
125
- - Git subprocesses may set **`GIT_TERMINAL_PROMPT=0`** on the child environment ([`coverageReferenceValidation`](../../src/analysis/coverageReferenceValidation.ts)).
145
+ - Git subprocesses may set **`GIT_TERMINAL_PROMPT=0`** on the child environment ([`runCoveragePipeline`](../../src/pipelines/coverage/coveragePipeline.ts)).