@ai-dossier/cli 0.4.1 → 0.5.0

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 (115) hide show
  1. package/README.md +147 -25
  2. package/bin/dossier-verify +6 -440
  3. package/dist/cli.js +82 -21
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/cache.d.ts.map +1 -1
  6. package/dist/commands/cache.js.map +1 -1
  7. package/dist/commands/checksum.js.map +1 -1
  8. package/dist/commands/commands.d.ts.map +1 -1
  9. package/dist/commands/commands.js +4 -2
  10. package/dist/commands/commands.js.map +1 -1
  11. package/dist/commands/config-cmd.d.ts.map +1 -1
  12. package/dist/commands/config-cmd.js +229 -69
  13. package/dist/commands/config-cmd.js.map +1 -1
  14. package/dist/commands/create.d.ts.map +1 -1
  15. package/dist/commands/create.js +17 -8
  16. package/dist/commands/create.js.map +1 -1
  17. package/dist/commands/export.d.ts.map +1 -1
  18. package/dist/commands/export.js +24 -8
  19. package/dist/commands/export.js.map +1 -1
  20. package/dist/commands/format.d.ts.map +1 -1
  21. package/dist/commands/format.js.map +1 -1
  22. package/dist/commands/get.d.ts.map +1 -1
  23. package/dist/commands/get.js +18 -6
  24. package/dist/commands/get.js.map +1 -1
  25. package/dist/commands/history.d.ts +6 -0
  26. package/dist/commands/history.d.ts.map +1 -0
  27. package/dist/commands/history.js +80 -0
  28. package/dist/commands/history.js.map +1 -0
  29. package/dist/commands/info.d.ts.map +1 -1
  30. package/dist/commands/info.js +19 -6
  31. package/dist/commands/info.js.map +1 -1
  32. package/dist/commands/install-skill.d.ts.map +1 -1
  33. package/dist/commands/install-skill.js +16 -9
  34. package/dist/commands/install-skill.js.map +1 -1
  35. package/dist/commands/lint.d.ts.map +1 -1
  36. package/dist/commands/lint.js.map +1 -1
  37. package/dist/commands/list.d.ts.map +1 -1
  38. package/dist/commands/list.js +55 -41
  39. package/dist/commands/list.js.map +1 -1
  40. package/dist/commands/login.d.ts.map +1 -1
  41. package/dist/commands/login.js +25 -5
  42. package/dist/commands/login.js.map +1 -1
  43. package/dist/commands/logout.d.ts.map +1 -1
  44. package/dist/commands/logout.js +22 -5
  45. package/dist/commands/logout.js.map +1 -1
  46. package/dist/commands/prompt-hook.d.ts.map +1 -1
  47. package/dist/commands/prompt-hook.js +4 -13
  48. package/dist/commands/prompt-hook.js.map +1 -1
  49. package/dist/commands/publish.d.ts.map +1 -1
  50. package/dist/commands/publish.js +22 -55
  51. package/dist/commands/publish.js.map +1 -1
  52. package/dist/commands/pull.d.ts.map +1 -1
  53. package/dist/commands/pull.js +31 -14
  54. package/dist/commands/pull.js.map +1 -1
  55. package/dist/commands/remove.d.ts.map +1 -1
  56. package/dist/commands/remove.js +17 -43
  57. package/dist/commands/remove.js.map +1 -1
  58. package/dist/commands/reset-hooks.js +1 -1
  59. package/dist/commands/reset-hooks.js.map +1 -1
  60. package/dist/commands/run.d.ts.map +1 -1
  61. package/dist/commands/run.js +192 -48
  62. package/dist/commands/run.js.map +1 -1
  63. package/dist/commands/search.d.ts.map +1 -1
  64. package/dist/commands/search.js +33 -29
  65. package/dist/commands/search.js.map +1 -1
  66. package/dist/commands/sign.js.map +1 -1
  67. package/dist/commands/skill-export.d.ts +3 -0
  68. package/dist/commands/skill-export.d.ts.map +1 -0
  69. package/dist/commands/skill-export.js +179 -0
  70. package/dist/commands/skill-export.js.map +1 -0
  71. package/dist/commands/validate.d.ts.map +1 -1
  72. package/dist/commands/validate.js.map +1 -1
  73. package/dist/commands/verify.d.ts.map +1 -1
  74. package/dist/commands/verify.js +1 -8
  75. package/dist/commands/verify.js.map +1 -1
  76. package/dist/commands/whoami.d.ts.map +1 -1
  77. package/dist/commands/whoami.js +108 -25
  78. package/dist/commands/whoami.js.map +1 -1
  79. package/dist/config.d.ts +29 -1
  80. package/dist/config.d.ts.map +1 -1
  81. package/dist/config.js +133 -3
  82. package/dist/config.js.map +1 -1
  83. package/dist/credentials.d.ts +14 -9
  84. package/dist/credentials.d.ts.map +1 -1
  85. package/dist/credentials.js +122 -54
  86. package/dist/credentials.js.map +1 -1
  87. package/dist/help.d.ts +7 -0
  88. package/dist/help.d.ts.map +1 -0
  89. package/dist/help.js +86 -0
  90. package/dist/help.js.map +1 -0
  91. package/dist/helpers.d.ts +10 -10
  92. package/dist/helpers.d.ts.map +1 -1
  93. package/dist/helpers.js +25 -28
  94. package/dist/helpers.js.map +1 -1
  95. package/dist/multi-registry.d.ts +71 -0
  96. package/dist/multi-registry.d.ts.map +1 -0
  97. package/dist/multi-registry.js +136 -0
  98. package/dist/multi-registry.js.map +1 -0
  99. package/dist/registry-client.d.ts +62 -15
  100. package/dist/registry-client.d.ts.map +1 -1
  101. package/dist/registry-client.js +11 -14
  102. package/dist/registry-client.js.map +1 -1
  103. package/dist/run-log.d.ts +37 -0
  104. package/dist/run-log.d.ts.map +1 -0
  105. package/dist/run-log.js +78 -0
  106. package/dist/run-log.js.map +1 -0
  107. package/dist/verify-dossier.d.ts +28 -0
  108. package/dist/verify-dossier.d.ts.map +1 -0
  109. package/dist/verify-dossier.js +329 -0
  110. package/dist/verify-dossier.js.map +1 -0
  111. package/dist/write-auth.d.ts +24 -0
  112. package/dist/write-auth.d.ts.map +1 -0
  113. package/dist/write-auth.js +85 -0
  114. package/dist/write-auth.js.map +1 -0
  115. package/package.json +1 -1
package/README.md CHANGED
@@ -36,8 +36,8 @@ cd cli
36
36
  npm link # Links the CLI globally for development
37
37
 
38
38
  # Or use directly
39
- chmod +x bin/dossier-verify
40
- ./bin/dossier-verify <file-or-url>
39
+ chmod +x bin/ai-dossier
40
+ ./bin/ai-dossier verify <file-or-url>
41
41
  ```
42
42
 
43
43
  ---
@@ -74,10 +74,10 @@ Commands that require confirmation (`publish`, `remove`, `cache clean`) will fai
74
74
 
75
75
  ```bash
76
76
  # Verify local file
77
- dossier-verify path/to/dossier.ds.md
77
+ ai-dossier verify path/to/dossier.ds.md
78
78
 
79
79
  # Verify remote dossier
80
- dossier-verify https://example.com/dossier.ds.md
80
+ ai-dossier verify https://example.com/dossier.ds.md
81
81
  ```
82
82
 
83
83
  **Exit codes**:
@@ -88,7 +88,7 @@ dossier-verify https://example.com/dossier.ds.md
88
88
  ### Verbose Mode
89
89
 
90
90
  ```bash
91
- dossier-verify --verbose path/to/dossier.ds.md
91
+ ai-dossier verify --verbose path/to/dossier.ds.md
92
92
  ```
93
93
 
94
94
  Shows:
@@ -103,7 +103,7 @@ Shows:
103
103
  ```bash
104
104
  # Shell function wrapper
105
105
  claude-run-dossier() {
106
- if dossier-verify "$1"; then
106
+ if ai-dossier verify "$1"; then
107
107
  claude-code "The dossier at $1 has been verified. Please execute it."
108
108
  else
109
109
  echo "❌ Security verification failed. Not executing."
@@ -117,7 +117,7 @@ claude-run-dossier https://example.com/dossier.ds.md
117
117
  **Cursor**:
118
118
  ```bash
119
119
  cursor-run-dossier() {
120
- if dossier-verify "$1"; then
120
+ if ai-dossier verify "$1"; then
121
121
  cursor "Execute the verified dossier at $1"
122
122
  else
123
123
  echo "❌ Verification failed"
@@ -132,7 +132,7 @@ safe-run-dossier() {
132
132
  local url="$1"
133
133
  local tool="${2:-claude-code}"
134
134
 
135
- if dossier-verify "$url"; then
135
+ if ai-dossier verify "$url"; then
136
136
  echo "✅ Dossier verified. Passing to $tool..."
137
137
  "$tool" "run $url"
138
138
  else
@@ -148,6 +148,30 @@ safe-run-dossier https://example.com/dossier.ds.md cursor
148
148
 
149
149
  ---
150
150
 
151
+ ## Multi-Registry Resolution
152
+
153
+ The CLI queries all configured registries in parallel when resolving dossiers (e.g., `dossier get`, `dossier run`, `dossier pull`). This uses `Promise.allSettled()` so a single registry failure does not block results from other registries.
154
+
155
+ ### Error Handling
156
+
157
+ All multi-registry operations return structured errors alongside results:
158
+
159
+ ```
160
+ $ dossier get org/my-dossier
161
+ # If registry A is down but registry B has it → returns result silently from B
162
+ # If no registry has it → displays errors from each registry
163
+ ```
164
+
165
+ When **all registries fail**, the CLI displays per-registry error details showing which registry failed and why. When at least one registry succeeds, the result is returned without surfacing errors from other registries.
166
+
167
+ This means you can configure multiple registries for redundancy — the CLI will succeed as long as at least one registry can serve the requested dossier. Registries are queried in the order they appear in your configuration; the first successful response is used.
168
+
169
+ ### Configuration
170
+
171
+ See `dossier config` for managing registry URLs. Multiple registries are queried in parallel, not sequentially.
172
+
173
+ ---
174
+
151
175
  ## What It Checks
152
176
 
153
177
  ### 1. Integrity (Checksum)
@@ -199,7 +223,7 @@ safe-run-dossier https://example.com/dossier.ds.md cursor
199
223
  ### Example 1: Legitimate Dossier (Passes)
200
224
 
201
225
  ```bash
202
- $ dossier-verify examples/data-science/train-ml-model.ds.md
226
+ $ ai-dossier verify examples/data-science/train-ml-model.ds.md
203
227
 
204
228
  🔐 Dossier Verification Tool
205
229
 
@@ -228,7 +252,7 @@ $ echo $?
228
252
  ### Example 2: Malicious Dossier (Blocked)
229
253
 
230
254
  ```bash
231
- $ dossier-verify https://raw.githubusercontent.com/imboard-ai/ai-dossier/main/examples/security/validate-project-config.ds.md
255
+ $ ai-dossier verify https://raw.githubusercontent.com/imboard-ai/ai-dossier/main/examples/security/validate-project-config.ds.md
232
256
 
233
257
  🔐 Dossier Verification Tool
234
258
 
@@ -268,7 +292,7 @@ $ echo $?
268
292
  # Wrapper function for Claude Code
269
293
  claude-run-dossier() {
270
294
  echo "Verifying dossier security..."
271
- if ~/projects/dossier/cli/bin/dossier-verify "$1"; then
295
+ if ai-dossier verify "$1"; then
272
296
  echo ""
273
297
  echo "✅ Verification passed. Executing with Claude Code..."
274
298
  claude-code "Execute the verified dossier at $1"
@@ -286,13 +310,106 @@ claude-run-dossier https://example.com/dossier.ds.md
286
310
 
287
311
  ---
288
312
 
313
+ ## Registry Configuration
314
+
315
+ The CLI supports multiple registries for discovering, pulling, and publishing dossiers.
316
+
317
+ ### Configuration File (`~/.dossier/config.json`)
318
+
319
+ Configure registries in your user config:
320
+
321
+ ```json
322
+ {
323
+ "registries": {
324
+ "public": {
325
+ "url": "https://dossier-registry.vercel.app",
326
+ "default": true
327
+ },
328
+ "internal": {
329
+ "url": "https://dossier.internal.example.com"
330
+ },
331
+ "readonly-mirror": {
332
+ "url": "https://mirror.example.com",
333
+ "readonly": true
334
+ }
335
+ },
336
+ "defaultRegistry": "public"
337
+ }
338
+ ```
339
+
340
+ ### Project-Level Config (`.dossierrc.json`)
341
+
342
+ Place a `.dossierrc.json` in your project root to add project-specific registries:
343
+
344
+ ```json
345
+ {
346
+ "registries": {
347
+ "team": {
348
+ "url": "https://dossier.myteam.example.com"
349
+ }
350
+ },
351
+ "defaultRegistry": "team"
352
+ }
353
+ ```
354
+
355
+ Project registries are merged with user registries. User-configured registries take precedence on name conflicts to prevent credential exfiltration.
356
+
357
+ ### Environment Variable
358
+
359
+ Set `DOSSIER_REGISTRY_URL` to add a virtual `env` registry:
360
+
361
+ ```bash
362
+ export DOSSIER_REGISTRY_URL=https://custom-registry.example.com
363
+ ```
364
+
365
+ ### Resolution Priority
366
+
367
+ When resolving registries, the CLI follows this priority:
368
+
369
+ 1. `--registry` flag on the command
370
+ 2. `DOSSIER_REGISTRY_URL` environment variable
371
+ 3. Project-level `.dossierrc.json`
372
+ 4. User-level `~/.dossier/config.json`
373
+ 5. Hardcoded default (public registry)
374
+
375
+ ### Per-Command Registry Flag
376
+
377
+ Write commands accept `--registry <name>` to target a specific registry:
378
+
379
+ ```bash
380
+ ai-dossier publish --registry team my-dossier.ds.md
381
+ ai-dossier login --registry internal
382
+ ```
383
+
384
+ Read commands (`search`, `get`, `pull`) query all configured registries in parallel.
385
+
386
+ ---
387
+
388
+ ## Agent Discovery (`--agent`)
389
+
390
+ The `--agent` flag outputs a machine-readable JSON manifest describing the CLI's capabilities. This is designed for AI agents that need to discover what the CLI can do programmatically:
391
+
392
+ ```bash
393
+ ai-dossier --agent
394
+ ```
395
+
396
+ Output includes:
397
+ - CLI version and available commands
398
+ - Supported flags (`--json`, `-y`/`--yes`)
399
+ - Capabilities (multi-registry, non-TTY safe, machine-readable errors)
400
+ - Discovery command for full command listing
401
+
402
+ This enables agents to auto-configure their integration with the Dossier CLI without parsing help text.
403
+
404
+ ---
405
+
289
406
  ## Architecture
290
407
 
291
408
  ### How It Works
292
409
 
293
410
  ```
294
411
  User Command:
295
- dossier-verify https://example.com/dossier.ds.md
412
+ ai-dossier verify https://example.com/dossier.ds.md
296
413
 
297
414
  Download/Read File
298
415
 
@@ -357,23 +474,28 @@ Exit 0 (safe) or 1 (unsafe)
357
474
 
358
475
  ## Roadmap
359
476
 
360
- ### v0.1.0 (Current)
477
+ ### v0.1.0
361
478
  - ✅ Basic checksum verification
362
479
  - ✅ Signature presence detection
363
480
  - ✅ Exit code support
364
481
  - ✅ URL download support
365
482
 
366
- ### v0.2.0 (Next)
367
- - Full minisign signature verification
368
- - Trusted keys management (~/.dossier/trusted-keys.txt)
369
- - --run flag implementation
370
- - ⏳ Better error messages
483
+ ### v0.2.0
484
+ - Multi-command CLI structure (`ai-dossier <command>`)
485
+ - `dossier run` command with 5-stage verification pipeline
486
+ - LLM auto-detection and execution integration
487
+
488
+ ### v0.3.0
489
+ - ✅ Modular TypeScript migration
490
+ - ✅ Comprehensive test suite (261+ tests)
491
+ - ✅ CLI parity with dossier-tools
492
+ - ✅ `@ai-dossier` npm scope and CI/CD publishing
371
493
 
372
- ### v0.3.0 (Future)
373
- - Interactive trust prompts
374
- - Key import/export
375
- - Signature verification caching
376
- - JSON output mode (for tooling)
494
+ ### v0.4.0 (Current)
495
+ - Unified dossier parser across core/cli/mcp
496
+ - JSON output mode (`--json` flag on commands)
497
+ - Registry integration (publish, remove, install-skill)
498
+ - Non-TTY stdin detection
377
499
 
378
500
  ### v1.0.0 (Stable)
379
501
  - ⏳ Complete signature verification
@@ -392,10 +514,10 @@ cd cli
392
514
  npm link # For local testing
393
515
 
394
516
  # Test
395
- dossier-verify ../examples/devops/deploy-to-aws.ds.md
517
+ ai-dossier verify ../examples/devops/deploy-to-aws.ds.md
396
518
 
397
519
  # Test with malicious example
398
- dossier-verify ../examples/security/validate-project-config.ds.md
520
+ ai-dossier verify ../examples/security/validate-project-config.ds.md
399
521
  ```
400
522
 
401
523
  ### Adding Features