devworkspace 0.4.2 → 0.4.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  All notable changes are documented here. This project follows [Semantic Versioning](https://semver.org/). Workspace schema changes are called out under **Breaking**.
4
4
 
5
+ ## [0.4.3] - 2026-11-04
6
+
7
+ ### Added
8
+ - **Automatic MCP Configuration Generation & Launcher Strategy**:
9
+ - Implemented dynamic MCP launcher resolution (`resolveMcpServerDef`) supporting `auto`, `direct`, and `npx` execution modes.
10
+ - Automatically configures `npx -y devworkspace mcp serve` for users running via `npx` or lacking global CLI installations, eliminating manual edits to `.mcp.json`.
11
+ - Added `--launcher <auto|direct|npx>` and `--package-version <version>` CLI options to `setup`, `init`, and `mcp setup`.
12
+ - **Onboarding MCP Integration**:
13
+ - Added support for `--agent <name>` during `devworkspace init` (e.g. `npx devworkspace init --agent claude-code`) to configure MCP client settings during onboarding.
14
+ - Added clear onboarding guidance in `devworkspace init` and `setup` pointing users to connect AI coding agents via MCP.
15
+ - **Doctor MCP Launcher Diagnostics**:
16
+ - Added `checkMcpLauncher` in `devworkspace doctor` to detect unresolvable or missing MCP server commands across `.mcp.json`, `mcp.json`, and `.antigravity/mcp.json`, providing actionable remediation hints.
17
+ - **Task-Aware Path Retrieval Fallback**:
18
+ - Improved `get_task_context` so natural-language tasks retrieve relevant real repository files based on path segments even when `features.json`, Graphify output, and ADRs are absent.
19
+ - Suppressed non-path detector labels and prioritized domain file matches in candidate ranking.
20
+ - Added graceful handling and explicit reporting for missing or corrupted Graphify knowledge graphs.
21
+ - **Regression Test Suite**:
22
+ - Added 18 task-aware retrieval regression tests covering path candidate discovery, ranking, and Graphify notices.
23
+ - Added 12 MCP setup and launcher regression tests covering all 11 required scenarios: first-time generation, idempotency, server preservation, malformed JSON protection, global vs npx launchers, version pinning, cross-platform resolution, live MCP stdio handshake, and doctor diagnostics.
24
+
25
+ ### Fixed
26
+ - **MCP Client Connectivity for npx Users**:
27
+ - Fixed client failures where AI coding agents could not spawn `devworkspace mcp serve` when installed or invoked through `npx` without a global executable on system `PATH`.
28
+
5
29
  ## [0.4.2] - 2026-11-04
6
30
 
7
31
  ### Added
package/README.md CHANGED
@@ -44,39 +44,219 @@ flowchart LR
44
44
 
45
45
  ## Quick Start
46
46
 
47
- ### Prerequisites
48
- Node.js **20.11 or newer**. Works on Windows, macOS, and Linux. Git is strongly recommended.
47
+ Follow this end-to-end setup flow to initialize DevWorkspace, connect your AI coding agent, configure optional helper integrations, and verify your repository.
48
+
49
+ ### Step 1: Prerequisites
50
+
51
+ Before setting up DevWorkspace, verify the following system requirements:
52
+
53
+ - **Node.js**: Version **20.11 or newer** (`node --version`). Supported across Windows, macOS, and Linux.
54
+ - **Git**: Strongly recommended (`git --version`). DevWorkspace functions in non-Git folders, but Git is recommended for branch tracking, dirty file detection, and uncommitted change protection.
55
+ - **AI Coding Agent**: A supported coding agent, such as **Claude Code**, **Cursor**, **GitHub Copilot**, **OpenAI Codex**, or **Google Antigravity**.
56
+ - **Optional Integrations Prerequisites**: If you choose to install optional helper tools such as **Graphify**, you will need **Python 3.10+** (or `uv` / `pipx`). Python is **not** required for DevWorkspace core functionality, CLI commands, or MCP tools.
57
+
58
+ ### Step 2: Initialize and Analyze the Repository
59
+
60
+ Navigate to your project root and run:
49
61
 
50
- ### Step 1: Initialize the Workspace
51
62
  ```bash
52
63
  cd my-project
53
64
  npx devworkspace init
65
+ npx devworkspace analyze
54
66
  ```
55
- Creates `.devworkspace/` with a nested `.gitignore` for machine-local state. It never modifies your source files and is safe to run multiple times.
56
67
 
57
- ### Step 2: Analyze Project Structure & Testing Contract
68
+ What these commands do:
69
+ - **`devworkspace init`**: Creates the `.devworkspace/` directory and writes a nested `.gitignore` for machine-local state (`.devworkspace/local/`). It never touches your application source files and is completely safe to re-run.
70
+ - **`devworkspace analyze`**: Scans package manifests, lockfiles, frameworks, entry points, and build scripts offline. It generates:
71
+ - `.devworkspace/context/commands.json`: Your project's deterministic verification contract (test, lint, and typecheck commands).
72
+ - `.devworkspace/context/facts.json`: Detected repository facts (ecosystems, package manager, frameworks).
73
+ - `.devworkspace/analysis/onboarding-prompt.md`: An optional onboarding prompt you can paste into Claude Code to review findings and record baseline knowledge.
74
+
75
+ ### Step 3: Configure Your Coding Agent
76
+
77
+ DevWorkspace provides two distinct ways to equip coding agents with repository context. You can use either or both:
78
+
79
+ 1. **Model Context Protocol (MCP)**: Exposes dynamic context retrieval tools over stdio to compatible agents (**Claude Code**, **OpenAI Codex**, **Google Antigravity**).
80
+ 2. **File-Based Agent Instructions**: Injects managed Markdown operating rules into persistent instruction files for **Cursor**, **GitHub Copilot**, **OpenAI Codex**, and **Claude Code**.
81
+
82
+ > [!NOTE]
83
+ > Installing file-based agent instructions and configuring MCP are separate operations. Both can be configured in the same repository and coexist seamlessly without conflict.
84
+
85
+ #### Option A: Configure MCP (Claude Code, Codex, Antigravity)
86
+
87
+ Generate the agent's MCP configuration and rule references:
88
+
58
89
  ```bash
59
- npx devworkspace analyze
90
+ # For Claude Code (writes .mcp.json and managed section in CLAUDE.md)
91
+ npx devworkspace setup --agent claude-code
92
+
93
+ # For OpenAI Codex (writes mcp.json and managed section in AGENTS.md)
94
+ npx devworkspace setup --agent codex
95
+
96
+ # For Google Antigravity (writes .antigravity/mcp.json and .antigravity/rules)
97
+ npx devworkspace setup --agent antigravity
98
+
99
+ # Or configure all supported MCP agents at once:
100
+ npx devworkspace setup --agent all
101
+ ```
102
+
103
+ *(Pass `--check` to preview planned file edits without modifying disk: `npx devworkspace setup --agent claude-code --check`.)*
104
+
105
+ #### Option B: Install File-Based Agent Instructions (Cursor, Copilot, Codex, Claude)
106
+
107
+ Inject managed instruction blocks and workflow skills into your repository:
108
+
109
+ ```bash
110
+ # For Cursor (.cursor/rules/devworkspace.mdc)
111
+ npx devworkspace agent install --agent cursor
112
+
113
+ # For GitHub Copilot (.github/copilot-instructions.md)
114
+ npx devworkspace agent install --agent copilot
115
+
116
+ # For OpenAI Codex (AGENTS.md)
117
+ npx devworkspace agent install --agent codex
118
+
119
+ # For Claude Code (CLAUDE.md and .claude/skills/devworkspace/SKILL.md)
120
+ npx devworkspace agent install --agent claude
121
+
122
+ # Or install for all supported agents in one command:
123
+ npx devworkspace agent install --agent all
124
+ ```
125
+
126
+ *(Pass `--dry-run` to preview changes: `npx devworkspace agent install --agent all --dry-run`.)*
127
+
128
+ ### Step 4: Install Optional Integrations (Optional)
129
+
130
+ DevWorkspace can orchestrate external developer tools to expand your agent's capabilities:
131
+ - **[Graphify](https://github.com/Graphify-Labs/graphify)**: Structural code knowledge graphs for call hierarchies, imports, and symbol dependencies.
132
+ - **[Agent Skills](https://github.com/addyosmani/agent-skills)**: Workflows for spec drafting, implementation plans, and shipping checklists.
133
+ - **[Ponytail](https://github.com/DietrichGebert/ponytail)**: Code quality review and complexity reduction.
134
+
135
+ > [!TIP]
136
+ > These integrations are **strictly optional**. DevWorkspace's core workspace, facts, verification contracts, and MCP tools function fully without them.
137
+
138
+ Preview and install optional integrations:
139
+
140
+ ```bash
141
+ # Preview what would be installed without making changes
142
+ npx devworkspace setup --integrations --dry-run
143
+
144
+ # Install and verify optional integrations (requires explicit consent with --yes)
145
+ npx devworkspace setup --integrations --yes
146
+ ```
147
+
148
+ *(You can limit installation to specific tools using `--only graphify` or `--only graphify,agent-skills`.)*
149
+
150
+ ### Step 5: Restart the Agent When Required
151
+
152
+ When DevWorkspace installs native plugins or skills for Claude Code (such as Graphify or Agent Skills), the agent's running process must load them into memory:
153
+
154
+ 1. **Check for `RESTART_REQUIRED`**: If diagnostic output reports `RESTART_REQUIRED`, the integration files exist on disk, but the coding agent has not yet loaded them.
155
+ 2. **Reload or Restart**:
156
+ - In **Claude Code**: Run `/reload-plugins` inside your interactive session, or exit and restart the `claude` CLI.
157
+ - In **VS Code / Cursor**: Restart the IDE window or reload the editor developer window (`Developer: Reload Window`).
158
+ 3. **Acknowledge Restart in DevWorkspace**: Once the agent has been restarted, clear the pending notice:
159
+ ```bash
160
+ npx devworkspace integrations status --restarted
161
+ ```
162
+
163
+ *Note: File-on-disk presence is not proof of in-memory agent loading. Acknowledging the restart updates DevWorkspace's tracking so diagnostics report accurate statuses.*
164
+
165
+ ### Step 6: Build the Graphify Project Graph (If Graphify is Installed)
166
+
167
+ Installing the Graphify CLI and its project skill does **not** automatically build the project knowledge graph. Generating the graph is an explicit, model-driven operation:
168
+
169
+ 1. **Open Claude Code**: Launch your interactive agent session in the repository:
170
+ ```bash
171
+ claude
172
+ ```
173
+ 2. **Execute Graph Generation**: Inside the Claude Code prompt, run:
174
+ ```text
175
+ /graphify .
176
+ ```
177
+ *Generating the graph uses the model to analyze ASTs, symbols, and relationships. It may take several minutes depending on repository size.*
178
+ 3. **Verify the Graph**: Exit back to your terminal and check graph status:
179
+ ```bash
180
+ npx devworkspace graph status
181
+ ```
182
+ When generated, DevWorkspace will display the graph location (`graphify-out/graph.json`), total node counts, and edge relationships. You can trace symbols with:
183
+ ```bash
184
+ npx devworkspace graph trace --from src/index.ts --depth 2
185
+ ```
186
+
187
+ **Fallback Guidance When Graphify is Not Used:**
188
+ If Graphify is not installed or `graphify-out/graph.json` has not been built, DevWorkspace continues to operate normally. MCP tools like `trace_symbol_dependencies` gracefully detect the absence of the graph, notify the agent that the knowledge graph is unavailable, and provide direct file paths to inspect instead.
189
+
190
+ ### Step 7: Verify the Complete Setup
191
+
192
+ Run the comprehensive health check to verify your setup:
193
+
194
+ ```bash
195
+ npx devworkspace doctor
196
+ ```
197
+
198
+ And if you installed optional integrations:
199
+
200
+ ```bash
201
+ npx devworkspace integrations status
60
202
  ```
61
- Scans dependencies, frameworks, entry points, and scripts. Generates detected facts and your project's verification contract.
62
203
 
63
- ### Step 3: Connect Your Coding Agent
64
- Choose the integration method that fits your agent (both can coexist safely):
204
+ **Understanding the Output Terminology:**
205
+ - **`Core workspace: READY`** (or `HEALTHY`): All core checks pass—`.devworkspace/` is valid, verification commands match manifests, and agent instruction files are intact.
206
+ - **Integrations Statuses (reported independently from core)**:
207
+ - **`VERIFIED`**: The tool was executed and all documented capabilities checked out.
208
+ - **`NOT_INSTALLED`**: Optional integration is absent. This is normal if you did not install it.
209
+ - **`RESTART_REQUIRED`**: Files installed; agent needs to be restarted or `/reload-plugins` executed.
210
+ - **`PREREQUISITES_MISSING`**: Python 3.10+ or required tool missing; output provides exact remediation.
211
+ - **`DEGRADED`**: Installed as portable fallback skills without native CLI hooks.
212
+ - **Independent Readiness**: A healthy core workspace (`Core workspace: READY`) safely coexists with optional integrations that are `NOT_INSTALLED`. Missing optional integrations do **not** fail `devworkspace doctor`.
213
+
214
+ ---
215
+
216
+ ## Windows PowerShell Setup Example
65
217
 
66
- - **Option A: Model Context Protocol (MCP)** — Recommended for Claude Code, Codex, and Antigravity:
67
- ```bash
68
- npx devworkspace setup --agent claude-code
69
- ```
70
- - **Option B: File-Based Instructions** — For Cursor, Copilot, Codex, and Claude:
71
- ```bash
72
- npx devworkspace agent install --agent all
73
- ```
218
+ For Windows developers using PowerShell, here is the complete sequence of commands:
219
+
220
+ ```powershell
221
+ # 1. Navigate to your project folder (use your actual project path)
222
+ Set-Location "C:\Projects\sample-app"
223
+
224
+ # 2. Initialize and discover repository structure
225
+ npx devworkspace init
226
+ npx devworkspace analyze
227
+
228
+ # 3. Configure your agent (choose MCP, file-based instructions, or both)
229
+ # Option A: Configure MCP for Claude Code
230
+ npx devworkspace setup --agent claude-code
231
+
232
+ # Option B: Install instructions for Cursor, Copilot, Codex, or Claude
233
+ npx devworkspace agent install --agent all
234
+
235
+ # 4. Optional: Install Graphify, Agent Skills & Ponytail (requires Python 3.10+ / uv)
236
+ npx devworkspace setup --integrations --yes
237
+
238
+ # 5. Verify core health and integration status
239
+ npx devworkspace doctor
240
+ npx devworkspace integrations status
241
+
242
+ # 6. If Graphify was installed, build the knowledge graph inside Claude Code:
243
+ # NOTE: Run this inside an interactive Claude Code session, NOT in PowerShell!
244
+ # claude
245
+ # > /graphify .
246
+
247
+ # 7. Acknowledge agent restart after reloading Claude Code
248
+ npx devworkspace integrations status --restarted
249
+ ```
250
+
251
+ ### macOS & Linux Quick Command
74
252
 
75
- ### Step 4: Verify Workspace Readiness
76
253
  ```bash
254
+ cd ~/projects/sample-app
255
+ npx devworkspace init && npx devworkspace analyze
256
+ npx devworkspace setup --agent claude-code
257
+ npx devworkspace agent install --agent all
77
258
  npx devworkspace doctor
78
259
  ```
79
- Checks workspace health, instruction files, and testing contract consistency. When it reports `Core workspace: READY`, your project is ready for development.
80
260
 
81
261
  ---
82
262
 
@@ -240,6 +420,20 @@ Details on scopes, prerequisites, and integration health checks: [docs/integrati
240
420
 
241
421
  ---
242
422
 
423
+ ## Troubleshooting & Common Setup Issues
424
+
425
+ | Symptom | Documented Resolution | Relevant Guide |
426
+ | --- | --- | --- |
427
+ | **Agent instructions missing** | Run `npx devworkspace agent install --agent <name>` (or `--agent all`) to generate managed instruction blocks (`CLAUDE.md`, `AGENTS.md`, `.cursor/rules/`, or Copilot rules). | [Agent Integrations](docs/agents.md) |
428
+ | **MCP server or configuration missing** | Run `npx devworkspace setup --agent <name>` (or `npx devworkspace mcp setup --agent <name>`) to configure `.mcp.json`, `mcp.json`, or `.antigravity/mcp.json`. Ensure `devworkspace` is on your `PATH`. | [MCP Guide](docs/mcp.md) |
429
+ | **`RESTART_REQUIRED` status** | Newly installed Claude Code plugins or skills must be loaded into memory. In Claude Code, run `/reload-plugins` or restart your CLI session. In IDEs, reload the window. Then acknowledge the restart with `npx devworkspace integrations status --restarted`. | [Integrations](docs/integrations.md) |
430
+ | **Graphify CLI missing** | Install Python 3.10+ (or `uv` / `pipx`), then run `npx devworkspace setup --integrations --yes`. Alternatively, install Graphify directly via `uv tool install graphifyy` or `pipx install graphifyy`. | [Integrations](docs/integrations.md) |
431
+ | **Graphify skill missing** | Run `npx devworkspace integrations repair --yes` to restore missing project skill folders without re-running completed machine steps. | [Integrations](docs/integrations.md) |
432
+ | **No graph built yet** | Installing the Graphify CLI and skill does not build the graph automatically. Launch Claude Code (`claude`) and run `/graphify .` in the session. Verify the generated graph with `npx devworkspace graph status`. | [Integrations](docs/integrations.md) |
433
+ | **Core workspace healthy but integrations incomplete** | Core workspace health (`Core workspace: READY`) and optional integration readiness are independent. Missing optional integrations (status `NOT_INSTALLED`) do not affect core DevWorkspace context, testing contracts, or MCP tools. | [Troubleshooting](docs/troubleshooting.md) |
434
+
435
+ ---
436
+
243
437
  ## Portability
244
438
 
245
439
  Commit `.devworkspace/` to your version control system (machine-local files in `.devworkspace/local/` are ignored automatically). On another workstation, clone the repository and run `npx devworkspace doctor`. Project identity is managed via a UUID in `project.json` rather than hardcoded file paths, so repository paths can change without breaking project state. Full guide: [docs/portability.md](docs/portability.md).
@@ -83,6 +83,12 @@ export declare const OPTIONS: {
83
83
  readonly agent: {
84
84
  readonly type: "string";
85
85
  };
86
+ readonly launcher: {
87
+ readonly type: "string";
88
+ };
89
+ readonly 'package-version': {
90
+ readonly type: "string";
91
+ };
86
92
  readonly type: {
87
93
  readonly type: "string";
88
94
  };
package/dist/cli/args.js CHANGED
@@ -28,6 +28,8 @@ export const OPTIONS = {
28
28
  full: { type: 'boolean' },
29
29
  all: { type: 'boolean' },
30
30
  agent: { type: 'string' },
31
+ launcher: { type: 'string' },
32
+ 'package-version': { type: 'string' },
31
33
  type: { type: 'string' },
32
34
  title: { type: 'string' },
33
35
  key: { type: 'string' },
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIvD,qGAAqG;AACrG,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;IACrC,OAAO,EAAE,EAAE,IAAI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AAC,CAAC,CAAC,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,CAAuB,EAAE,CAAS;IACpD,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpB,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACtC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAAE,MAAM,IAAI,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC;IAC1G,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["import { parseArgs } from 'node:util';\nimport { DevWorkspaceError } from '../errors/index.js';\n\ntype OptionSpec = { type: 'boolean' | 'string'; short?: string; multiple?: boolean };\n\n/** Every flag the CLI understands. Unknown flags are rejected so typos never silently do nothing. */\nexport const OPTIONS = {\n help: { type: 'boolean', short: 'h' },\n version: { type: 'boolean', short: 'v' },\n json: { type: 'boolean' },\n debug: { type: 'boolean' },\n 'no-color': { type: 'boolean' },\n ascii: { type: 'boolean' },\n 'dry-run': { type: 'boolean' },\n yes: { type: 'boolean', short: 'y' },\n 'include-agent-files': { type: 'boolean' },\n integrations: { type: 'boolean' },\n 'with-integrations': { type: 'boolean' },\n only: { type: 'string', multiple: true },\n scope: { type: 'string' },\n restarted: { type: 'boolean' },\n quick: { type: 'boolean' },\n cwd: { type: 'string' },\n root: { type: 'string' },\n fix: { type: 'boolean' },\n strict: { type: 'boolean' },\n out: { type: 'string', short: 'o' },\n overwrite: { type: 'boolean' },\n 'allow-different-project': { type: 'boolean' },\n topic: { type: 'string' },\n full: { type: 'boolean' },\n all: { type: 'boolean' },\n agent: { type: 'string' },\n type: { type: 'string' },\n title: { type: 'string' },\n key: { type: 'string' },\n value: { type: 'string' },\n source: { type: 'string' },\n 'source-type': { type: 'string' },\n file: { type: 'string', multiple: true },\n confidence: { type: 'string' },\n status: { type: 'string' },\n reason: { type: 'string' },\n detail: { type: 'string' },\n note: { type: 'string' },\n phase: { type: 'string' },\n passed: { type: 'string' },\n failed: { type: 'string' },\n criteria: { type: 'string', multiple: true },\n plan: { type: 'string', multiple: true },\n area: { type: 'string', multiple: true },\n 'decision-note': { type: 'string', multiple: true },\n summary: { type: 'string' },\n blocker: { type: 'string', multiple: true },\n 'clear-blockers': { type: 'boolean' },\n require: { type: 'string', multiple: true },\n 'user-work-intact': { type: 'boolean' },\n 'knowledge-reviewed': { type: 'boolean' },\n 'final-state-inspected': { type: 'boolean' },\n context: { type: 'string' },\n for: { type: 'string' },\n role: { type: 'string' },\n decision: { type: 'string' },\n consequences: { type: 'string' },\n supersedes: { type: 'string' },\n goal: { type: 'string' },\n done: { type: 'string', multiple: true },\n 'tests-run': { type: 'string', multiple: true },\n remaining: { type: 'string', multiple: true },\n next: { type: 'string' },\n task: { type: 'string' },\n limit: { type: 'string' },\n package: { type: 'string' },\n check: { type: 'string', multiple: true },\n target: { type: 'string' },\n timeout: { type: 'string' },\n deep: { type: 'boolean' },\n id: { type: 'string' },\n name: { type: 'string' },\n description: { type: 'string' },\n symbol: { type: 'string' },\n entry: { type: 'string', multiple: true },\n route: { type: 'string', multiple: true },\n service: { type: 'string', multiple: true },\n model: { type: 'string', multiple: true },\n test: { type: 'string', multiple: true },\n tag: { type: 'string', multiple: true },\n from: { type: 'string' },\n depth: { type: 'string' },\n} as const satisfies Record<string, OptionSpec>;\n\nexport interface ParsedArgs {\n positionals: string[];\n values: Record<string, string | boolean | string[] | undefined>;\n}\n\nexport function parseCli(argv: string[]): ParsedArgs {\n try {\n const normalizedArgv = argv.map((arg, idx) => {\n if (arg === '--check') {\n const next = argv[idx + 1];\n if (!next || next.startsWith('-')) {\n return '--check=true';\n }\n }\n return arg;\n });\n const { values, positionals } = parseArgs({ args: normalizedArgv, options: OPTIONS, allowPositionals: true, strict: true });\n return { positionals, values: values as ParsedArgs['values'] };\n } catch (e) {\n throw new DevWorkspaceError('USAGE', (e as Error).message.replace(/^Unknown option/, 'Unknown option'), {\n hint: 'Run \"devworkspace --help\" or \"devworkspace <command> --help\".',\n });\n }\n}\n\nexport function str(v: ParsedArgs['values'], k: string): string | undefined {\n const x = v[k];\n return typeof x === 'string' ? x : undefined;\n}\n\nexport function bool(v: ParsedArgs['values'], k: string): boolean {\n return v[k] === true;\n}\n\nexport function isCheckOrDryRun(v: ParsedArgs['values']): boolean {\n if (bool(v, 'dry-run')) return true;\n const checks = list(v, 'check');\n return checks.includes('true');\n}\n\nexport function list(v: ParsedArgs['values'], k: string): string[] {\n const x = v[k];\n return Array.isArray(x) ? x : [];\n}\n\nexport function int(v: ParsedArgs['values'], k: string): number | undefined {\n const s = str(v, k);\n if (s === undefined) return undefined;\n const n = Number(s);\n if (!Number.isInteger(n)) throw new DevWorkspaceError('USAGE', `--${k} must be an integer (got \"${s}\").`);\n return n;\n}\n"]}
1
+ {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIvD,qGAAqG;AACrG,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;IACrC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;IACxC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IACzB,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC1B,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC/B,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC1B,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC9B,GAAG,EAAE,EAAE,I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ACtC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAAE,MAAM,IAAI,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC;IAC1G,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["import { parseArgs } from 'node:util';\nimport { DevWorkspaceError } from '../errors/index.js';\n\ntype OptionSpec = { type: 'boolean' | 'string'; short?: string; multiple?: boolean };\n\n/** Every flag the CLI understands. Unknown flags are rejected so typos never silently do nothing. */\nexport const OPTIONS = {\n help: { type: 'boolean', short: 'h' },\n version: { type: 'boolean', short: 'v' },\n json: { type: 'boolean' },\n debug: { type: 'boolean' },\n 'no-color': { type: 'boolean' },\n ascii: { type: 'boolean' },\n 'dry-run': { type: 'boolean' },\n yes: { type: 'boolean', short: 'y' },\n 'include-agent-files': { type: 'boolean' },\n integrations: { type: 'boolean' },\n 'with-integrations': { type: 'boolean' },\n only: { type: 'string', multiple: true },\n scope: { type: 'string' },\n restarted: { type: 'boolean' },\n quick: { type: 'boolean' },\n cwd: { type: 'string' },\n root: { type: 'string' },\n fix: { type: 'boolean' },\n strict: { type: 'boolean' },\n out: { type: 'string', short: 'o' },\n overwrite: { type: 'boolean' },\n 'allow-different-project': { type: 'boolean' },\n topic: { type: 'string' },\n full: { type: 'boolean' },\n all: { type: 'boolean' },\n agent: { type: 'string' },\n launcher: { type: 'string' },\n 'package-version': { type: 'string' },\n type: { type: 'string' },\n title: { type: 'string' },\n key: { type: 'string' },\n value: { type: 'string' },\n source: { type: 'string' },\n 'source-type': { type: 'string' },\n file: { type: 'string', multiple: true },\n confidence: { type: 'string' },\n status: { type: 'string' },\n reason: { type: 'string' },\n detail: { type: 'string' },\n note: { type: 'string' },\n phase: { type: 'string' },\n passed: { type: 'string' },\n failed: { type: 'string' },\n criteria: { type: 'string', multiple: true },\n plan: { type: 'string', multiple: true },\n area: { type: 'string', multiple: true },\n 'decision-note': { type: 'string', multiple: true },\n summary: { type: 'string' },\n blocker: { type: 'string', multiple: true },\n 'clear-blockers': { type: 'boolean' },\n require: { type: 'string', multiple: true },\n 'user-work-intact': { type: 'boolean' },\n 'knowledge-reviewed': { type: 'boolean' },\n 'final-state-inspected': { type: 'boolean' },\n context: { type: 'string' },\n for: { type: 'string' },\n role: { type: 'string' },\n decision: { type: 'string' },\n consequences: { type: 'string' },\n supersedes: { type: 'string' },\n goal: { type: 'string' },\n done: { type: 'string', multiple: true },\n 'tests-run': { type: 'string', multiple: true },\n remaining: { type: 'string', multiple: true },\n next: { type: 'string' },\n task: { type: 'string' },\n limit: { type: 'string' },\n package: { type: 'string' },\n check: { type: 'string', multiple: true },\n target: { type: 'string' },\n timeout: { type: 'string' },\n deep: { type: 'boolean' },\n id: { type: 'string' },\n name: { type: 'string' },\n description: { type: 'string' },\n symbol: { type: 'string' },\n entry: { type: 'string', multiple: true },\n route: { type: 'string', multiple: true },\n service: { type: 'string', multiple: true },\n model: { type: 'string', multiple: true },\n test: { type: 'string', multiple: true },\n tag: { type: 'string', multiple: true },\n from: { type: 'string' },\n depth: { type: 'string' },\n} as const satisfies Record<string, OptionSpec>;\n\nexport interface ParsedArgs {\n positionals: string[];\n values: Record<string, string | boolean | string[] | undefined>;\n}\n\nexport function parseCli(argv: string[]): ParsedArgs {\n try {\n const normalizedArgv = argv.map((arg, idx) => {\n if (arg === '--check') {\n const next = argv[idx + 1];\n if (!next || next.startsWith('-')) {\n return '--check=true';\n }\n }\n return arg;\n });\n const { values, positionals } = parseArgs({ args: normalizedArgv, options: OPTIONS, allowPositionals: true, strict: true });\n return { positionals, values: values as ParsedArgs['values'] };\n } catch (e) {\n throw new DevWorkspaceError('USAGE', (e as Error).message.replace(/^Unknown option/, 'Unknown option'), {\n hint: 'Run \"devworkspace --help\" or \"devworkspace <command> --help\".',\n });\n }\n}\n\nexport function str(v: ParsedArgs['values'], k: string): string | undefined {\n const x = v[k];\n return typeof x === 'string' ? x : undefined;\n}\n\nexport function bool(v: ParsedArgs['values'], k: string): boolean {\n return v[k] === true;\n}\n\nexport function isCheckOrDryRun(v: ParsedArgs['values']): boolean {\n if (bool(v, 'dry-run')) return true;\n const checks = list(v, 'check');\n return checks.includes('true');\n}\n\nexport function list(v: ParsedArgs['values'], k: string): string[] {\n const x = v[k];\n return Array.isArray(x) ? x : [];\n}\n\nexport function int(v: ParsedArgs['values'], k: string): number | undefined {\n const s = str(v, k);\n if (s === undefined) return undefined;\n const n = Number(s);\n if (!Number.isInteger(n)) throw new DevWorkspaceError('USAGE', `--${k} must be an integer (got \"${s}\").`);\n return n;\n}\n"]}
package/dist/cli/run.js CHANGED
@@ -94,6 +94,19 @@ const handlers = {
94
94
  c.data(r, renderInit(c.style, r));
95
95
  if (r.setup)
96
96
  c.exit = setupExitCode(r.setup);
97
+ const agent = str(c.args.values, 'agent');
98
+ if (agent) {
99
+ const mcpResult = await setupMcpAgent({
100
+ cwd: r.root,
101
+ agent,
102
+ check: isCheckOrDryRun(c.args.values),
103
+ launcher: str(c.args.values, 'launcher'),
104
+ packageVersion: str(c.args.values, 'package-version'),
105
+ });
106
+ c.data(mcpResult, renderMcpSetup(c.style, mcpResult));
107
+ if (mcpResult.conflicts > 0)
108
+ c.exit = EXIT.WARNINGS;
109
+ }
97
110
  },
98
111
  async setup(c) {
99
112
  if (str(c.args.values, 'agent')) {
@@ -101,6 +114,8 @@ const handlers = {
101
114
  cwd: c.svc.cwd,
102
115
  agent: str(c.args.values, 'agent'),
103
116
  check: isCheckOrDryRun(c.args.values),
117
+ launcher: str(c.args.values, 'launcher'),
118
+ packageVersion: str(c.args.values, 'package-version'),
104
119
  });
105
120
  c.data(r, renderMcpSetup(c.style, r));
106
121
  if (r.conflicts > 0)
@@ -155,6 +170,8 @@ const handlers = {
155
170
  cwd: c.svc.cwd,
156
171
  agent: str(c.args.values, 'agent') ?? 'claude-code',
157
172
  check: isCheckOrDryRun(c.args.values),
173
+ launcher: str(c.args.values, 'launcher'),
174
+ packageVersion: str(c.args.values, 'package-version'),
158
175
  });
159
176
  c.data(r, renderMcpSetup(c.style, r));
160
177
  if (r.conflicts > 0)