@devcortex/cli 1.3.0 → 1.3.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.
Files changed (2) hide show
  1. package/README.md +400 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,400 @@
1
+ # `dcx` — DevCortex CLI
2
+
3
+ > **Version:** 1.3.0
4
+ > **Package:** [`@devcortex/cli`](https://www.npmjs.com/package/@devcortex/cli)
5
+ > **Platform:** [devcortexai.com](https://www.devcortexai.com)
6
+
7
+ The `dcx` CLI connects AI coding agents (Claude Code, OpenCode) to your [DevCortex](https://www.devcortexai.com) project. It handles authentication, project linking, `CLAUDE.md` generation, and live supervision — replacing manual curl workflows with two commands.
8
+
9
+ ```
10
+ ┌─────────────────────────────────────────────────────┐
11
+ │ Without dcx With dcx │
12
+ │ ─────────────────── ────────────────── │
13
+ │ 1. Login via curl dcx login │
14
+ │ 2. Fetch project ID │
15
+ │ 3. Generate API key dcx start │
16
+ │ 4. Write .mcp.json │
17
+ │ 5. Download CLAUDE.md │
18
+ │ 6. Start claude │
19
+ └─────────────────────────────────────────────────────┘
20
+ ```
21
+
22
+ ---
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ npm install -g @devcortex/cli
28
+ ```
29
+
30
+ Requires **Node.js 18 or higher**.
31
+
32
+ > **Permission error?** If you see `EACCES: permission denied`, either:
33
+ >
34
+ > **Option 1 — use sudo (simplest):**
35
+ > ```bash
36
+ > sudo npm install -g @devcortex/cli
37
+ > ```
38
+ >
39
+ > **Option 2 — use pnpm (recommended):**
40
+ > ```bash
41
+ > npm install -g pnpm
42
+ > pnpm install -g @devcortex/cli
43
+ > ```
44
+ >
45
+ > **Option 3 — configure npm user directory:**
46
+ > ```bash
47
+ > mkdir -p ~/.npm-global
48
+ > npm config set prefix '~/.npm-global'
49
+ > echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
50
+ > source ~/.bashrc
51
+ > npm install -g @devcortex/cli
52
+ > ```
53
+ > Note: on some Linux systems the npm global symlink may not execute correctly.
54
+ > If `dcx` produces no output after install, use pnpm or sudo instead.
55
+ >
56
+ > See [npm docs on fixing permissions](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally) for more options.
57
+
58
+ Verify:
59
+
60
+ ```bash
61
+ dcx --version
62
+ dcx --help
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Quick Start
68
+
69
+ ```bash
70
+ # 1. Authenticate
71
+ dcx login
72
+
73
+ # 2. Link your project directory to DevCortex
74
+ cd ~/my-project
75
+ dcx init
76
+
77
+ # 3. Launch your AI agent with CLAUDE.md refreshed
78
+ dcx start
79
+ ```
80
+
81
+ `dcx start` fetches the latest requirements and issues from DevCortex, writes them to `CLAUDE.md`, and launches Claude Code (or OpenCode) — so your agent always starts with the current project context.
82
+
83
+ ---
84
+
85
+ ## Commands
86
+
87
+ | Command | Description |
88
+ |---|---|
89
+ | `dcx login` | Authenticate and store token locally |
90
+ | `dcx init` | Link current directory to a DevCortex project |
91
+ | `dcx start` | Refresh `CLAUDE.md` and launch AI agent |
92
+ | `dcx update` | Refresh `CLAUDE.md` without launching agent |
93
+ | `dcx status` | Show project health summary |
94
+ | `dcx logs` | Stream live audit events to terminal |
95
+ | `dcx keys` | Manage project API keys |
96
+ | `dcx list` | Query requirements, backlog, and issues |
97
+ | `dcx export` | Export requirements to CSV |
98
+ | `dcx import` | Import requirements from CSV |
99
+ | `dcx test-mcp` | Self-diagnose MCP connection health |
100
+ | `dcx issue` | Manage issues |
101
+
102
+ ---
103
+
104
+ ### `dcx login`
105
+
106
+ ```bash
107
+ dcx login
108
+ dcx login --email user@example.com --password mypassword
109
+ ```
110
+
111
+ Authenticates with DevCortex and stores your JWT token in `~/.devcortex/config.json`.
112
+
113
+ ---
114
+
115
+ ### `dcx init`
116
+
117
+ ```bash
118
+ dcx init
119
+ dcx init --agent opencode # generate AGENTS.md instead of CLAUDE.md
120
+ dcx init --project <projectId> # skip project selector
121
+ dcx init --force # overwrite existing files
122
+ ```
123
+
124
+ Links the current directory to a DevCortex project. Creates:
125
+
126
+ | File | Purpose | Commit? |
127
+ |------------------------|--------------------------------------|----------------|
128
+ | `.mcp.json` | MCP API key for agent connection | ❌ No (secret) |
129
+ | `CLAUDE.md` | Agent constitution with requirements | ✅ Yes |
130
+ | `.devcortex-link.json` | Project link (no secrets) | ✅ Yes |
131
+
132
+ `.mcp.json` is automatically added to `.gitignore`.
133
+
134
+ ---
135
+
136
+ ### `dcx start`
137
+
138
+ ```bash
139
+ dcx start
140
+ dcx start --agent claude
141
+ dcx start --agent opencode
142
+ dcx start --no-init # skip CLAUDE.md refresh, launch immediately
143
+ ```
144
+
145
+ Refreshes `CLAUDE.md` from the live database and launches your AI agent. Auto-detects Claude Code or OpenCode on your PATH.
146
+
147
+ **Install Claude Code:**
148
+ ```bash
149
+ npm install -g @anthropic-ai/claude-code
150
+ ```
151
+
152
+ **Install OpenCode:**
153
+ ```bash
154
+ npm install -g opencode-ai
155
+ ```
156
+
157
+ ---
158
+
159
+ ### `dcx update`
160
+
161
+ ```bash
162
+ dcx update
163
+ dcx update --watch # keep CLAUDE.md in sync continuously (polls every 60s)
164
+ ```
165
+
166
+ Refreshes `CLAUDE.md` without launching an agent. Use `--watch` in a background terminal when requirements change frequently during a session.
167
+
168
+ ---
169
+
170
+ ### `dcx status`
171
+
172
+ ```bash
173
+ dcx status
174
+ dcx status --json # machine-readable output
175
+ ```
176
+
177
+ Displays project health: requirements count, open issues, MCP connection status, token validity, and spec version.
178
+
179
+ ---
180
+
181
+ ### `dcx logs`
182
+
183
+ ```bash
184
+ dcx logs
185
+ dcx logs --tail 50
186
+ dcx logs --follow
187
+ ```
188
+
189
+ Streams live audit events from DevCortex — shows what your AI agent is reading and writing in real time.
190
+
191
+ ---
192
+
193
+ ### `dcx keys`
194
+
195
+ ```bash
196
+ dcx keys list # list all API keys for the project
197
+ dcx keys regenerate # rotate the key in .mcp.json
198
+ dcx keys revoke <keyId> # revoke a specific key
199
+ ```
200
+
201
+ Manages project-scoped API keys used by the MCP server.
202
+
203
+ ---
204
+
205
+ ### `dcx list`
206
+
207
+ ```bash
208
+ dcx list backlog
209
+ dcx list backlog --status APPROVED
210
+ dcx list issues
211
+ dcx list issues --severity HIGH
212
+ ```
213
+
214
+ Queries and displays requirements and issues from DevCortex.
215
+
216
+ ---
217
+
218
+ ### `dcx export`
219
+
220
+ ```bash
221
+ dcx export --csv # print CSV to stdout
222
+ dcx export --csv --out requirements.csv # write to file
223
+ ```
224
+
225
+ Exports project requirements as CSV.
226
+
227
+ ---
228
+
229
+ ### `dcx import`
230
+
231
+ ```bash
232
+ dcx import --csv requirements.csv # import from file
233
+ dcx import --csv requirements.csv --dry-run # preview only
234
+ ```
235
+
236
+ Imports requirements from CSV. Rows are matched by `reqId` — existing requirements are skipped, new ones are created.
237
+
238
+ ---
239
+
240
+ ### `dcx test-mcp`
241
+
242
+ ```bash
243
+ dcx test-mcp
244
+ ```
245
+
246
+ Self-diagnoses the MCP connection. Runs four checks:
247
+
248
+ 1. API reachable
249
+ 2. API key valid
250
+ 3. Project accessible
251
+ 4. MCP tools available
252
+
253
+ ```
254
+ ✔ 1. API reachable
255
+ ✔ 2. API key valid
256
+ ✔ 3. Project accessible
257
+ ✔ 4. MCP tools available
258
+
259
+ ✔ MCP connection healthy — 12 tools registered for my-org/My Project
260
+ ```
261
+
262
+ Run this whenever Claude Code reports an MCP connection error.
263
+
264
+ ---
265
+
266
+ ## Typical Workflows
267
+
268
+ ### Start a new project
269
+
270
+ ```bash
271
+ mkdir my-app && cd my-app
272
+ dcx init
273
+ dcx start
274
+ ```
275
+
276
+ ### Resume after a break
277
+
278
+ ```bash
279
+ cd my-app
280
+ dcx start # refreshes CLAUDE.md then launches agent
281
+ ```
282
+
283
+ ### Monitor an agent session
284
+
285
+ ```bash
286
+ # Terminal 1 — agent
287
+ dcx start
288
+
289
+ # Terminal 2 — live supervision
290
+ dcx logs
291
+ ```
292
+
293
+ ### Keep CLAUDE.md in sync automatically
294
+
295
+ ```bash
296
+ # Terminal 1 — watch for requirement changes
297
+ dcx update --watch
298
+
299
+ # Terminal 2 — agent (skip refresh since watch handles it)
300
+ dcx start --no-init
301
+ ```
302
+
303
+ ### New team member setup
304
+
305
+ ```bash
306
+ git clone https://github.com/org/my-project
307
+ cd my-project
308
+ dcx login
309
+ dcx init # generates personal .mcp.json (not committed)
310
+ dcx start
311
+ ```
312
+
313
+ ### Diagnose MCP problems
314
+
315
+ ```bash
316
+ dcx test-mcp
317
+ # If key is stale:
318
+ dcx init --force
319
+ dcx test-mcp
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Configuration
325
+
326
+ Config is stored at `~/.devcortex/config.json`:
327
+
328
+ ```json
329
+ {
330
+ "token": "eyJhbGci...",
331
+ "tokenExpiry": "2026-06-17T00:00:00.000Z",
332
+ "apiUrl": "https://api.devcortexai.com",
333
+ "defaultOrgSlug": "my-org",
334
+ "defaultProjectId": "cmmxbv3v..."
335
+ }
336
+ ```
337
+
338
+ ### Environment Variables
339
+
340
+ | Variable | Description | Default |
341
+ |----------------|-----------------------|-------------------------------|
342
+ | `DCX_API_URL` | Override API URL | `https://api.devcortexai.com` |
343
+ | `DCX_NO_COLOR` | Disable colour output | unset |
344
+
345
+ ### Override API URL
346
+
347
+ ```bash
348
+ dcx login --api-url https://staging-api.devcortexai.com
349
+ dcx status --api-url https://staging-api.devcortexai.com
350
+ ```
351
+
352
+ ---
353
+
354
+ ## Troubleshooting
355
+
356
+ **`✗ Not logged in — run dcx login first`**
357
+ Your token has expired (7-day TTL). Run `dcx login`.
358
+
359
+ **`✗ No project linked — run dcx init first`**
360
+ Run `dcx init` in your project directory.
361
+
362
+ **`✗ API unreachable`**
363
+ Check your internet connection or verify the API URL with `dcx status`.
364
+
365
+ **`✗ No AI agent found`**
366
+ Install Claude Code (`npm install -g @anthropic-ai/claude-code`) or OpenCode (`npm install -g opencode-ai`).
367
+
368
+ **MCP connection fails in Claude Code**
369
+ Run `dcx test-mcp` — it pinpoints exactly which of the four connection steps is failing and shows the fix.
370
+
371
+ **Reset config**
372
+ ```bash
373
+ rm ~/.devcortex/config.json
374
+ dcx login
375
+ dcx init
376
+ ```
377
+
378
+ ---
379
+
380
+ ## Files Reference
381
+
382
+ | File | Location | Purpose | Commit? |
383
+ |------------------------|-----------------|--------------------------|---------|
384
+ | `config.json` | `~/.devcortex/` | Token + defaults | ❌ No |
385
+ | `.mcp.json` | Project root | MCP API key | ❌ No |
386
+ | `.devcortex-link.json` | Project root | Project link | ✅ Yes |
387
+ | `CLAUDE.md` | Project root | Claude Code constitution | ✅ Yes |
388
+ | `AGENTS.md` | Project root | OpenCode constitution | ✅ Yes |
389
+
390
+ ---
391
+
392
+ ## Links
393
+
394
+ - **Platform:** [devcortexai.com](https://www.devcortexai.com)
395
+ - **npm:** [npmjs.com/package/@devcortex/cli](https://www.npmjs.com/package/@devcortex/cli)
396
+ - **Support:** [support@devcortexai.com](mailto:support@devcortexai.com)
397
+
398
+ ---
399
+
400
+ *DevCortex is built by MainRobin Pty Ltd(https://www.devcortexai.com). © 2026 MainRobin Pty Ltd.*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devcortex/cli",
3
- "version": "1.3.0",
3
+ "version": "1.3.3",
4
4
  "description": "DevCortex CLI — structured requirements for agentic development",
5
5
  "type": "module",
6
6
  "bin": {