@devcortex/cli 1.3.0 → 1.3.1

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