@gluecharm-lab/easyspecs-cli 0.0.5 → 0.0.8

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.
package/LICENSE ADDED
@@ -0,0 +1,95 @@
1
+ Copyright (c) Spaii Edutainment SL, Barcelona, Spain. All rights reserved.
2
+
3
+ Elastic License 2.0
4
+
5
+ URL: https://www.elastic.co/licensing/elastic-license
6
+
7
+ Acceptance
8
+
9
+ By using the software, you agree to all of the terms and conditions below.
10
+
11
+ Copyright License
12
+
13
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
14
+ non-sublicensable, non-transferable license to use, copy, distribute, make
15
+ available, and prepare derivative works of the software, in each case subject to
16
+ the limitations and conditions below.
17
+
18
+ Limitations
19
+
20
+ You may not provide the software to third parties as a hosted or managed
21
+ service, where the service provides users with access to any substantial set of
22
+ the features or functionality of the software.
23
+
24
+ You may not move, change, disable, or circumvent the license key functionality
25
+ in the software, and you may not remove or obscure any functionality in the
26
+ software that is protected by the license key.
27
+
28
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
29
+ of the licensor in the software. Any use of the licensor's trademarks is subject
30
+ to applicable law.
31
+
32
+ Patents
33
+
34
+ The licensor grants you a license, under any patent claims the licensor can
35
+ license, or becomes able to license, to make, have made, use, sell, offer for
36
+ sale, import and have imported the software, in each case subject to the
37
+ limitations and conditions in this license. This license does not cover any
38
+ patent claims that you cause to be infringed by modifications or additions to
39
+ the software. If you or your company make any written claim that the software
40
+ infringes or contributes to infringement of any patent, your patent license for
41
+ the software granted under these terms ends immediately. If your company makes
42
+ such a claim, your patent license ends immediately for work on behalf of your
43
+ company.
44
+
45
+ Notices
46
+
47
+ You must ensure that anyone who gets a copy of any part of the software from you
48
+ also gets a copy of these terms.
49
+
50
+ If you modify the software, you must include in any modified copies of the
51
+ software prominent notices stating that you have modified the software.
52
+
53
+ No Other Rights
54
+
55
+ These terms do not imply any licenses other than those expressly granted in
56
+ these terms.
57
+
58
+ Termination
59
+
60
+ If you use the software in violation of these terms, such use is not licensed,
61
+ and your licenses will automatically terminate. If the licensor provides you
62
+ with a notice of your violation, and you cease all violation of this license no
63
+ later than 30 days after you receive that notice, your licenses will be
64
+ reinstated retroactively. However, if you violate these terms after such
65
+ reinstatement, any additional violation of these terms will cause your licenses
66
+ to terminate automatically and permanently.
67
+
68
+ No Liability
69
+
70
+ As far as the law allows, the software comes as is, without any warranty or
71
+ condition, and the licensor will not be liable to you for any damages arising
72
+ out of these terms or the use or nature of the software, under any kind of
73
+ legal claim.
74
+
75
+ Definitions
76
+
77
+ The licensor is the entity offering these terms, and the software is the
78
+ software the licensor makes available under these terms, including any portion
79
+ of it.
80
+
81
+ you refers to the individual or entity agreeing to these terms.
82
+
83
+ your company is any legal entity, sole proprietorship, or other kind of
84
+ organization that you work for, plus all organizations that have control over,
85
+ are under the control of, or are under common control with that
86
+ organization. control means ownership of substantially all the assets of an
87
+ entity, or the power to direct its management and policies by vote, contract, or
88
+ otherwise. Control can be direct or indirect.
89
+
90
+ your licenses are all the licenses granted to you for the software under
91
+ these terms.
92
+
93
+ use means anything you do with the software requiring one of your licenses.
94
+
95
+ trademark means trademarks, service marks, and similar rights.
package/README.md CHANGED
@@ -8,7 +8,7 @@ Published as **`@gluecharm-lab/easyspecs-cli`** (npm org **gluecharm-lab**; **Ea
8
8
 
9
9
  - **Node.js** ≥ 18
10
10
  - **[OpenCode](https://opencode.ai)** on `PATH` for flows that run agents
11
- - A **git repository** with **`.gluecharm/`** (SRS + context layout) when running analysis/diagnose/upload against a project
11
+ - A **git repository** with **`.gluecharm/`** (documentation + context layout) when running analysis, diagnose, or upload against a project
12
12
 
13
13
  ## Install
14
14
 
@@ -40,7 +40,7 @@ easyspecs-cli doctor --inspect-config
40
40
  easyspecs-cli help
41
41
  ```
42
42
 
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 come from **`<repo>/.easyspecs/config.json`**, not `EASYSPECS_*` env overrides (**SRS-43**).
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 come from **`<repo>/.easyspecs/config.json`**, not ad-hoc environment-variable overrides for product settings.
44
44
 
45
45
  ```bash
46
46
  easyspecs-cli diagnose coordination-duplicates --cwd /your/repo --ci --json
@@ -54,7 +54,7 @@ easyspecs-cli diagnose coordination-duplicates --cwd /your/repo --ci --json
54
54
  | **Config** | `doctor --inspect-config` (inspect merged settings), `config init`, `config set-project-id`, `config set-git-remote` |
55
55
  | **Auth** | `auth login --email … --password …`, `auth logout`, `auth status` |
56
56
  | **Run synthesis** | `run synthesis`; **`run synthesis resume-missing`** / **`resume-synthesis`** |
57
- | **Analysis** (full SRS-32 loop) | `analysis` (optional **`--upload`** after login; **`--synthesis-only`** stops after synthesis) |
57
+ | **Analysis** (full macro pipeline) | `analysis` (optional **`--upload`** after login; **`--synthesis-only`** stops after synthesis) |
58
58
  | **Diagnose** | `diagnose reference-coverage`, `coordination-duplicates`, `coverage-report`, … |
59
59
  | **Upload** | `upload context`, `upload republish` |
60
60
  | **ACE** | `ace clear`, `ace learn`, `ace auto-learn` |
@@ -63,14 +63,7 @@ Run **`easyspecs-cli help`** and **`easyspecs-cli <command> --help`** for the fu
63
63
 
64
64
  ## Configuration
65
65
 
66
- Primary configuration file: **`<repo>/.easyspecs/config.json`** (auto-created when needed). See **[`commands.md`](./commands.md)** for flags and merge rules. **`auth login --email … --password …`** stores tokens for upload commands (optional **`--session-path`** updates **`easyspecs.cliSessionPath`**); legacy **`--ci auth login`** can use env vars instead.
67
-
68
- | Variable | Purpose |
69
- |----------|---------|
70
- | `EASYSPECS_EMAIL` / `EASYSPECS_PASSWORD` | Optional legacy with **`easyspecs-cli --ci auth login`** (when **`--email` / `--password`** omitted) |
71
- | `EASYSPECS_EXTENSION_ROOT` | Path to an **easyspecs.ai-vsc-extension** clone (bundled resources) |
72
- | `EASYSPECS_CLI_RESOURCES` | Override directory containing **`opencode-agents/`** (normally bundled) |
73
- | `EASYSPECS_APPLICATION_ID` | Fallback when upload target JSON omits `application_id` |
66
+ Primary configuration file: **`<repo>/.easyspecs/config.json`** (auto-created when needed). See **[`commands.md`](./commands.md)** for flags and merge rules. **`auth login --email … --password …`** stores tokens for upload commands (optional **`--session-path`** tail updates **`easyspecs.cliSessionPath`** in **`config.json`**).
74
67
 
75
68
  After **`auth login`**, session data is stored at **`easyspecs.cliSessionPath`** in **`config.json`** when set (otherwise **`~/.easyspecs/cli-session.json`**). When the VS Code extension delegates with a temp session file, it passes global **`--session-path <file>`** on the spawned **`easyspecs-cli`** process.
76
69
 
@@ -78,13 +71,18 @@ After **`auth login`**, session data is stored at **`easyspecs.cliSessionPath`**
78
71
 
79
72
  `--cwd`, `--ci`, `--json`, `--verbose`, `--api-base-url`, **`--session-path`**, `--environment`, `--promote` / `--no-promote` (see **`--help`**).
80
73
 
81
- ## Source & full documentation
74
+ ## Website & documentation
75
+
76
+ - **Product website:** **[easyspecs.ai](https://easyspecs.ai/)** — sign in, projects, documentation in the browser, and product information. This is the public EasySpecs site (not a source-code host).
82
77
 
83
- Built from the **easyspecs.ai-vsc-extension** monorepo:
78
+ - **Command reference** (flags, env, merge rules): [`commands.md`](./commands.md) in this npm package.
84
79
 
85
- - **Repository:** [gitlab.com/…/easyspecs.ai-vsc-extension](https://gitlab.com/glue-charm-extended/gluecharm-extended/easyspecs.ai-vsc-extension) directory **`packages/cli`**
86
- - **Full operator manual (install, CI examples, exit codes):** [USER-MANUAL-SRS-39.md](https://gitlab.com/glue-charm-extended/gluecharm-extended/easyspecs.ai-vsc-extension/-/blob/main/.gluecharm/docs/srs/USER-MANUAL-SRS-39.md) (same repo, `main` branch)
80
+ - **CLI:** run **`easyspecs-cli help`** for the full command tree.
81
+
82
+ Engineering source for this CLI is maintained privately; use **easyspecs.ai** and the docs bundled here for support and usage.
87
83
 
88
84
  ## License
89
85
 
90
- **MIT** see the [extension repository](https://gitlab.com/glue-charm-extended/gluecharm-extended/easyspecs.ai-vsc-extension) for the full license file.
86
+ Copyright © **Spaii Edutainment SL** (Barcelona, Spain).
87
+
88
+ This package is licensed under the **Elastic License 2.0** (**ELv2**, SPDX **`Elastic-2.0`**). See **[`LICENSE`](./LICENSE)** in this package for the full text and [Elastic’s licensing overview](https://www.elastic.co/licensing/elastic-license). Other artifacts in the monorepo may use different licenses.
package/commands.md ADDED
@@ -0,0 +1,122 @@
1
+ # EasySpecs CLI — commands, flags, and configuration
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**).
4
+
5
+ Quick usage:
6
+
7
+ ```bash
8
+ easyspecs-cli help
9
+ ```
10
+
11
+ ---
12
+
13
+ ## Global options
14
+
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)).
16
+
17
+ | Flag | Effect |
18
+ |------|--------|
19
+ | `--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. |
21
+ | `--json` | On supported exits, prints one JSON summary line on stdout; suppresses some human-oriented stderr unless `--verbose`. |
22
+ | `--verbose` | Extra stderr logging where implemented. |
23
+ | `--api-base-url <url>` | System Manager API origin for this process (overrides `easyspecs.apiBaseUrl` in config). |
24
+ | `--environment production` \| `--environment staging` | Alias: **`--env`**. Overrides `easyspecs.deploymentEnvironment` for built-in URL selection when no explicit URL is set. |
25
+ | `--promote` | After a successful `run synthesis`, copy generated `.gluecharm/context` from the analysis worktree into the workspace repo (when promotion is applicable). |
26
+ | `--no-promote` | Disable that promotion step for this run. |
27
+ | `--help`, `-h` | Show built-in help (also `help` as first positional). Does **not** create `.easyspecs/config.json`. |
28
+ | `--version`, `-V` | Print CLI package version (also `version` as first positional). Does **not** create config. |
29
+ | `--config <path>` | Parsed but **unused** by `main.ts` today; configuration is read from `<repoRoot>/.easyspecs/config.json`. |
30
+
31
+ ---
32
+
33
+ ## Shared configuration (SRS-43)
34
+
35
+ ### File: `<repoRoot>/.easyspecs/config.json`
36
+
37
+ Canonical JSON created on first need (except **`help`**, **`version`**, and **`doctor`** — no auto-create). Invalid JSON fails with a clear path (**R6**). If **`config.json`** is missing and **`.easyspecs/cli.json`** exists, settings are imported once (**§6 M2**) into the new file.
38
+
39
+ Merge uses **this file + global CLI flags only** — no `EASYSPECS_*` / `VITE_*` product overrides on **`easyspecs-cli`** (**R34**).
40
+
41
+ | Path | Purpose |
42
+ |------|---------|
43
+ | `schemaVersion` | Integer (e.g. `1`) for future migrations. |
44
+ | `easyspecs.deploymentEnvironment` | `production` or `staging` (default `production`). Used with built-in System Manager URLs when `apiBaseUrl` is empty. |
45
+ | `easyspecs.apiBaseUrl` | Explicit System Manager origin; wins after `--api-base-url`. Generated defaults use **`https://api.easyspecs.ai`** (production). Use **`""`** only if you want the built-in URL from **`deploymentEnvironment`** / **`--environment`** instead. |
46
+ | `easyspecs.easyspecsProjectId` | Optional EasySpecs **project** id (Content application UUID). **Only** store for uploads / Sync — set via **`Send context`**, **`Changes → Sync`**, **`config set-project-id`**, or **`easyspecs-cli`**. **`upload`** / **`analysis --upload`** read **only** this field (merged **`easyspecs.applicationId`** legacy key maps here). |
47
+ | `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`. |
48
+ | `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)). |
49
+ | `easyspecs.openCode` | `executable`, `skipCredentialsCheck` (legacy shortcut; see also `openCodeRuntime`). |
50
+ | `easyspecs.analysis.*` | Pipeline: argv template, timeouts, repair attempts, concurrency, `promoteContextToWorkspace`. |
51
+ | `easyspecs.orchestration.*` | Macro delays, outer iterations, ping-pong cap, etc. |
52
+ | `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). |
53
+
54
+ ### Resolved System Manager URL (`easyspecs-cli`)
55
+
56
+ **Order:** `--api-base-url` → non-empty `easyspecs.apiBaseUrl` → built-in URL from effective environment (**`--environment`** \|\| **`easyspecs.deploymentEnvironment`** \|\| **`production`**). No `.env` / `process.env` product keys (**R30**).
57
+
58
+ Built-in defaults ship in [`src/easyspecsBuiltInApiUrls.ts`](../../src/easyspecsBuiltInApiUrls.ts).
59
+
60
+ ### Environment variables still used by the CLI
61
+
62
+ | Variable | Purpose |
63
+ |----------|---------|
64
+ | `EASYSPECS_EMAIL` / `EASYSPECS_PASSWORD` | Optional legacy **`auth login`** when **`--ci`** is set and **`--email` / `--password`** are omitted (**SRS-43 §5.3**). Prefer explicit **`--email`** / **`--password`** on the command line for scripts (credentials appear in process listings — avoid shared machines). |
65
+ | `EASYSPECS_EXTENSION_ROOT` | Extension/monorepo root for bundled resources. |
66
+ | `EASYSPECS_CLI_RESOURCES` | Override directory containing **`opencode-agents/`**. |
67
+ | `EASYSPECS_UPLOAD_CONTEXT_DIR` | Upload republish context dir bridging. |
68
+ | `EASYSPECS_CLI_MACRO_DEBUG` | Macro extra logging ([`macroHeadlessHost`](../../src/analysis/macroHeadlessHost.ts)). |
69
+ | OS-level (e.g. `PATH`) | Finding `node`, `opencode`, `git`. |
70
+
71
+ Provider API keys for OpenCode runs should live under **`easyspecs.openCodeRuntime.providers`** in **`config.json`**; they are injected into the **child** OpenCode process (**R13**) and redacted in **`doctor --inspect-config`** (**R17**).
72
+
73
+ ---
74
+
75
+ ## Diagnose-only flags
76
+
77
+ Used after `diagnose <subcommand>`:
78
+
79
+ | Flag | Values | Meaning |
80
+ |------|--------|---------|
81
+ | `--root` | `workspace` or `worktree` | Whether paths resolve against the workspace repo root or an analysis checkout ([`parseTailFlags`](../../src/cli/parseTailFlags.ts)). |
82
+ | `--worktree` | path | Analysis git checkout (required for `--root worktree` when no path embedded in `--root` flow; combined with explicit `--worktree` — see `main.ts`). |
83
+
84
+ ---
85
+
86
+ ## Command reference
87
+
88
+ Each row lists **command-specific CLI tokens**, then **what configuration applies**.
89
+
90
+ | Command | Command-specific flags / tokens | Configuration & notes |
91
+ |---------|--------------------------------|----------------------|
92
+ | `help`, `--help` | — | Global options only; prints usage. |
93
+ | `version` | — | Prints [`PKG_VERSION`](../../src/cli/main.ts) from the bundle. |
94
+ | `doctor` | Optional **`--readiness`**, **`--inspect-config`** | **Does not** create `config.json`. Default (no flags) = **`--readiness`**: repo root, resolved API URL, OpenCode installed/credentials, agents dir. **`--inspect-config`** alone: redacted **`merged`** + **`easyspecsConfig`**. **`--readiness --inspect-config`**: both. Global flags apply (**`--cwd`**, **`--ci`**, **`--api-base-url`**, **`--session-path`**, **`--environment`**, **`--promote`** / **`--no-promote`**). |
95
+ | `config init` | Optional **`--overwrite`** | Creates **`<repo>/.easyspecs/config.json`** with full defaults if missing; imports legacy **`cli.json`** / **`settings.json`** (ACE) when present, same as first-time bootstrap. If the file already exists, does nothing unless **`--overwrite`** (replaces with that bootstrap content). Does not run other commands. |
96
+ | `config set-project-id <id>` | — | Writes **`easyspecs.easyspecsProjectId`** to **`config.json`**, replacing any previous value. Creates **`config.json`** (defaults + legacy import) if missing. |
97
+ | `config set-git-remote <url>` | — | Writes **`easyspecs.defaultGitRemoteUrl`** to **`config.json`**, replacing any previous value. Same bootstrap-if-missing behaviour as **`set-project-id`**. |
98
+ | `auth login` | **`--email <email> --password <password>`**, optional **`--session-path <path>`** (tail; updates **`config.json`**) | Calls **`POST /api/authentication/login`**. On success prints **`OK`** (stdout), exit **0**, and writes tokens + **`apiBaseUrl`** to the session file. Tail **`--session-path`** updates **`easyspecs.cliSessionPath`** in **`config.json`** (normalized repo-relative when under the repo) and writes the session there for this run; omit it to use the existing **`easyspecs.cliSessionPath`** / default **`~/.easyspecs/cli-session.json`**. Global **`--session-path`** (before the command) overrides the effective session file for any command without changing **`config.json`**. On failure prints **`KO: …`** (stderr), exit **`auth`**. Legacy: **`easyspecs-cli --ci auth login`** with **`EASYSPECS_*`** when CLI credentials omitted. **`--password`** on argv is visible to **`ps`**. |
99
+ | `auth logout` | — | Deletes the effective session file (same path rules as **`auth login`**). |
100
+ | `auth status` | — | Reads session file. |
101
+ | `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. |
102
+ | `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`**. |
103
+ | `analysis` | Optional tokens anywhere in argv: **`--synthesis-only`**, **`--upload`** | **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. **`EASYSPECS_CLI_MACRO_DEBUG`**. OpenCode options from **`merged.pipelineOpenCode`**. |
104
+ | `diagnose reference-coverage` | **`--root workspace`** \| **`--root worktree`**, optional **`--worktree <path>`** | **`EASYSPECS_MAX_PERCENT_NON_REFERENCED`**: if set to a finite number, failure when metric exceeds it. |
105
+ | `diagnose coordination-duplicates` | Same **`--root`** / **`--worktree`** | **`EASYSPECS_DUPLICATES_STRICT`**: unless `0`, duplicate/orphan issues fail the exit code. |
106
+ | `diagnose coverage-report` | Same **`--root`** / **`--worktree`** | Uses repo/worktree paths only; no extra env in `main.ts`. |
107
+ | `diagnose missing-artefacts` | Same **`--root`** / **`--worktree`** | Reads artefact snapshot from workspace state; no OpenCode. |
108
+ | `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)). |
109
+ | `upload context` | — | Requires **`auth`** session. Context dir: **`<repoRoot>/.gluecharm/context`**. Project id: **`easyspecs.easyspecsProjectId`** in **`config.json`** only. |
110
+ | `upload republish` | — | Same auth + upload pipeline; context dir from **`EASYSPECS_UPLOAD_CONTEXT_DIR`** if set and valid, else analysis worktree **`…/.gluecharm/context`** from snapshot, else error. Same project id rule as **`upload context`**. |
111
+ | `ace clear` | — | Deletes **`<repoRoot>/.gluecharm/context/learnings`**. |
112
+ | `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. |
113
+ | `ace auto-learn` | Optional **`--worktree <path>`** | **`requireOpenCode`**; checkout = `--worktree` if valid git dir, else **`repoRoot`**. **`merged.pipelineOpenCode.maxConcurrentOpenCodeAgents`** caps parallelism. |
114
+
115
+ ---
116
+
117
+ ## Notes
118
+
119
+ - 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)).
120
+ - **`upload`** / **`analysis --upload`** require a prior **`auth login`** session (**`--email`** / **`--password`**, or legacy **`--ci`** + env).
121
+ - Unknown commands print help and exit with a usage error.
122
+ - Git subprocesses may set **`GIT_TERMINAL_PROMPT=0`** on the child environment ([`coverageReferenceValidation`](../../src/analysis/coverageReferenceValidation.ts)).
package/dist/main.cjs CHANGED
@@ -17657,7 +17657,6 @@ function loadSrsDiscoveryIdMapFromContextDir(contextDir2, log) {
17657
17657
  }
17658
17658
 
17659
17659
  // src/analysis/contextSrsDiscoveryUpload.ts
17660
- var UPLOAD_TARGET_FILENAME = "easyspecs-upload-target.json";
17661
17660
  var ADAPTIVE_B_INITIAL = 100;
17662
17661
  var ADAPTIVE_B_MIN = 1;
17663
17662
  var ADAPTIVE_B_MAX = 500;
@@ -17787,31 +17786,9 @@ function listContextFilesForUpload(contextDir2, excludeBasenames = /* @__PURE__
17787
17786
  out.sort((a, b) => a.localeCompare(b));
17788
17787
  return out;
17789
17788
  }
17790
- function readUploadTargetFile(contextDir2) {
17791
- const p = path37.join(contextDir2, UPLOAD_TARGET_FILENAME);
17792
- if (!fs38.existsSync(p)) {
17793
- return void 0;
17794
- }
17795
- try {
17796
- const raw = fs38.readFileSync(p, "utf8");
17797
- const j = JSON.parse(raw);
17798
- if (!isRecord5(j)) {
17799
- return void 0;
17800
- }
17801
- const aid = j.application_id;
17802
- const upd = j.updated_at;
17803
- if (typeof aid !== "string" || aid.trim() === "" || typeof upd !== "string") {
17804
- return void 0;
17805
- }
17806
- const name = j.application_name;
17807
- return {
17808
- application_id: aid.trim(),
17809
- updated_at: upd,
17810
- ...typeof name === "string" && name ? { application_name: name } : {}
17811
- };
17812
- } catch {
17813
- return void 0;
17814
- }
17789
+ function getEasyspecsProjectIdFromRepoConfig(repoConfig) {
17790
+ const id = repoConfig.easyspecs?.easyspecsProjectId?.trim();
17791
+ return id || void 0;
17815
17792
  }
17816
17793
  async function validateApplicationExists(requestJson, applicationId) {
17817
17794
  const p = `/api/content/application/${encodeURIComponent(applicationId)}`;
@@ -18535,16 +18512,19 @@ function buildMacroOrchestrationDepsHeadless(input) {
18535
18512
  if (input.runBackendSyncImpl) {
18536
18513
  return input.runBackendSyncImpl();
18537
18514
  }
18538
- const wsContextDir = path38.join(repoRoot, ".gluecharm", "context");
18539
18515
  const snap = readAnalysisWorkspaceSnapshot(storageContext);
18540
18516
  const wtContextDir = snap?.adHocWorktreePath && fs39.existsSync(path38.join(snap.adHocWorktreePath, ".gluecharm", "context")) ? path38.join(snap.adHocWorktreePath, ".gluecharm", "context") : "";
18541
18517
  if (!wtContextDir) {
18542
18518
  return { ok: false, message: "No worktree context to upload." };
18543
18519
  }
18544
- const target = readUploadTargetFile(wtContextDir) ?? readUploadTargetFile(wsContextDir);
18545
- const applicationId = target?.application_id?.trim();
18520
+ let applicationId;
18521
+ try {
18522
+ applicationId = getEasyspecsProjectIdFromRepoConfig(readEasyspecsConfig(repoRoot))?.trim();
18523
+ } catch {
18524
+ applicationId = void 0;
18525
+ }
18546
18526
  if (!applicationId) {
18547
- return { ok: false, message: "Missing easyspecs-upload-target.json (application_id)." };
18527
+ return { ok: false, message: "Missing easyspecs.easyspecsProjectId in .easyspecs/config.json." };
18548
18528
  }
18549
18529
  return { ok: false, message: "Upload from CLI requires `easyspecs upload context` (not wired in macro headless default)." };
18550
18530
  }
@@ -19477,7 +19457,7 @@ function parseAuthLoginTail(tail) {
19477
19457
  }
19478
19458
 
19479
19459
  // src/cli/main.ts
19480
- var PKG_VERSION = "0.0.5";
19460
+ var PKG_VERSION = "0.0.8";
19481
19461
  function logErr(flags, ...a) {
19482
19462
  if (!flags.json) {
19483
19463
  console.error(...a);
@@ -19690,17 +19670,17 @@ async function main() {
19690
19670
  { easyspecs: { easyspecsProjectId: id } },
19691
19671
  { warnMigration: (m) => logErr(flags, `[EasySpecs] ${m}`) }
19692
19672
  );
19693
- const path44 = easyspecsConfigPath(repoRoot);
19673
+ const configJsonPath = easyspecsConfigPath(repoRoot);
19694
19674
  if (flags.json) {
19695
19675
  printJsonLine({
19696
19676
  command: "config set-project-id",
19697
19677
  durationMs: Date.now() - t0,
19698
19678
  ok: true,
19699
- path: path44,
19679
+ path: configJsonPath,
19700
19680
  easyspecsProjectId: cfg.easyspecs?.easyspecsProjectId ?? ""
19701
19681
  });
19702
19682
  } else {
19703
- console.log(`Updated ${path44} \u2014 easyspecs.easyspecsProjectId`);
19683
+ console.log(`Updated ${configJsonPath} \u2014 easyspecs.easyspecsProjectId`);
19704
19684
  }
19705
19685
  process.exit(ExitCode.ok);
19706
19686
  } catch (e) {
@@ -20161,12 +20141,11 @@ async function main() {
20161
20141
  if (!wtContextDir) {
20162
20142
  return { ok: false, message: "No worktree context to upload." };
20163
20143
  }
20164
- const target = readUploadTargetFile(wtContextDir) ?? readUploadTargetFile(wsContextDir);
20165
- const appId = target?.application_id?.trim() || repoConfig.easyspecs?.easyspecsProjectId?.trim() || process.env.EASYSPECS_APPLICATION_ID?.trim();
20144
+ const appId = getEasyspecsProjectIdFromRepoConfig(repoConfig)?.trim();
20166
20145
  if (!appId) {
20167
20146
  return {
20168
20147
  ok: false,
20169
- message: "Missing application_id in easyspecs-upload-target.json or easyspecs.easyspecsProjectId in .easyspecs/config.json"
20148
+ message: "Missing easyspecs.easyspecsProjectId in .easyspecs/config.json."
20170
20149
  };
20171
20150
  }
20172
20151
  let access = s.accessToken;
@@ -20251,12 +20230,11 @@ async function main() {
20251
20230
  ctxDir = wt;
20252
20231
  }
20253
20232
  }
20254
- const target = readUploadTargetFile(ctxDir);
20255
- const appIdRaw = target?.application_id?.trim() || repoConfig.easyspecs?.easyspecsProjectId?.trim() || process.env.EASYSPECS_APPLICATION_ID?.trim();
20233
+ const appIdRaw = getEasyspecsProjectIdFromRepoConfig(repoConfig)?.trim();
20256
20234
  if (!appIdRaw) {
20257
20235
  finish(ExitCode.misconfiguration, {
20258
20236
  ok: false,
20259
- error: "Missing application_id in easyspecs-upload-target.json or easyspecs.easyspecsProjectId in .easyspecs/config.json"
20237
+ error: "Missing easyspecs.easyspecsProjectId in .easyspecs/config.json."
20260
20238
  });
20261
20239
  }
20262
20240
  const applicationId = appIdRaw;