@ai-dossier/cli 0.2.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 (144) hide show
  1. package/README.md +419 -0
  2. package/bin/ai-dossier +3 -0
  3. package/bin/dossier-verify +435 -0
  4. package/dist/cli.d.ts +6 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +77 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/cache.d.ts +3 -0
  9. package/dist/commands/cache.d.ts.map +1 -0
  10. package/dist/commands/cache.js +239 -0
  11. package/dist/commands/cache.js.map +1 -0
  12. package/dist/commands/checksum.d.ts +3 -0
  13. package/dist/commands/checksum.d.ts.map +1 -0
  14. package/dist/commands/checksum.js +116 -0
  15. package/dist/commands/checksum.js.map +1 -0
  16. package/dist/commands/config-cmd.d.ts +3 -0
  17. package/dist/commands/config-cmd.d.ts.map +1 -0
  18. package/dist/commands/config-cmd.js +117 -0
  19. package/dist/commands/config-cmd.js.map +1 -0
  20. package/dist/commands/create.d.ts +3 -0
  21. package/dist/commands/create.d.ts.map +1 -0
  22. package/dist/commands/create.js +130 -0
  23. package/dist/commands/create.js.map +1 -0
  24. package/dist/commands/export.d.ts +3 -0
  25. package/dist/commands/export.d.ts.map +1 -0
  26. package/dist/commands/export.js +55 -0
  27. package/dist/commands/export.js.map +1 -0
  28. package/dist/commands/format.d.ts +3 -0
  29. package/dist/commands/format.d.ts.map +1 -0
  30. package/dist/commands/format.js +66 -0
  31. package/dist/commands/format.js.map +1 -0
  32. package/dist/commands/from-file.d.ts +3 -0
  33. package/dist/commands/from-file.d.ts.map +1 -0
  34. package/dist/commands/from-file.js +136 -0
  35. package/dist/commands/from-file.js.map +1 -0
  36. package/dist/commands/get.d.ts +3 -0
  37. package/dist/commands/get.d.ts.map +1 -0
  38. package/dist/commands/get.js +65 -0
  39. package/dist/commands/get.js.map +1 -0
  40. package/dist/commands/info.d.ts +3 -0
  41. package/dist/commands/info.d.ts.map +1 -0
  42. package/dist/commands/info.js +159 -0
  43. package/dist/commands/info.js.map +1 -0
  44. package/dist/commands/init.d.ts +3 -0
  45. package/dist/commands/init.d.ts.map +1 -0
  46. package/dist/commands/init.js +98 -0
  47. package/dist/commands/init.js.map +1 -0
  48. package/dist/commands/install-skill.d.ts +3 -0
  49. package/dist/commands/install-skill.d.ts.map +1 -0
  50. package/dist/commands/install-skill.js +131 -0
  51. package/dist/commands/install-skill.js.map +1 -0
  52. package/dist/commands/keys.d.ts +3 -0
  53. package/dist/commands/keys.d.ts.map +1 -0
  54. package/dist/commands/keys.js +170 -0
  55. package/dist/commands/keys.js.map +1 -0
  56. package/dist/commands/lint.d.ts +3 -0
  57. package/dist/commands/lint.d.ts.map +1 -0
  58. package/dist/commands/lint.js +105 -0
  59. package/dist/commands/lint.js.map +1 -0
  60. package/dist/commands/list.d.ts +3 -0
  61. package/dist/commands/list.d.ts.map +1 -0
  62. package/dist/commands/list.js +173 -0
  63. package/dist/commands/list.js.map +1 -0
  64. package/dist/commands/login.d.ts +3 -0
  65. package/dist/commands/login.d.ts.map +1 -0
  66. package/dist/commands/login.js +33 -0
  67. package/dist/commands/login.js.map +1 -0
  68. package/dist/commands/logout.d.ts +3 -0
  69. package/dist/commands/logout.d.ts.map +1 -0
  70. package/dist/commands/logout.js +19 -0
  71. package/dist/commands/logout.js.map +1 -0
  72. package/dist/commands/prompt-hook.d.ts +3 -0
  73. package/dist/commands/prompt-hook.d.ts.map +1 -0
  74. package/dist/commands/prompt-hook.js +101 -0
  75. package/dist/commands/prompt-hook.js.map +1 -0
  76. package/dist/commands/publish.d.ts +3 -0
  77. package/dist/commands/publish.d.ts.map +1 -0
  78. package/dist/commands/publish.js +142 -0
  79. package/dist/commands/publish.js.map +1 -0
  80. package/dist/commands/pull.d.ts +3 -0
  81. package/dist/commands/pull.d.ts.map +1 -0
  82. package/dist/commands/pull.js +69 -0
  83. package/dist/commands/pull.js.map +1 -0
  84. package/dist/commands/remove.d.ts +3 -0
  85. package/dist/commands/remove.d.ts.map +1 -0
  86. package/dist/commands/remove.js +65 -0
  87. package/dist/commands/remove.js.map +1 -0
  88. package/dist/commands/reset-hooks.d.ts +3 -0
  89. package/dist/commands/reset-hooks.d.ts.map +1 -0
  90. package/dist/commands/reset-hooks.js +52 -0
  91. package/dist/commands/reset-hooks.js.map +1 -0
  92. package/dist/commands/run.d.ts +3 -0
  93. package/dist/commands/run.d.ts.map +1 -0
  94. package/dist/commands/run.js +281 -0
  95. package/dist/commands/run.js.map +1 -0
  96. package/dist/commands/search.d.ts +3 -0
  97. package/dist/commands/search.d.ts.map +1 -0
  98. package/dist/commands/search.js +137 -0
  99. package/dist/commands/search.js.map +1 -0
  100. package/dist/commands/sign.d.ts +3 -0
  101. package/dist/commands/sign.d.ts.map +1 -0
  102. package/dist/commands/sign.js +143 -0
  103. package/dist/commands/sign.js.map +1 -0
  104. package/dist/commands/validate.d.ts +3 -0
  105. package/dist/commands/validate.d.ts.map +1 -0
  106. package/dist/commands/validate.js +152 -0
  107. package/dist/commands/validate.js.map +1 -0
  108. package/dist/commands/verify.d.ts +3 -0
  109. package/dist/commands/verify.d.ts.map +1 -0
  110. package/dist/commands/verify.js +41 -0
  111. package/dist/commands/verify.js.map +1 -0
  112. package/dist/commands/whoami.d.ts +3 -0
  113. package/dist/commands/whoami.d.ts.map +1 -0
  114. package/dist/commands/whoami.js +28 -0
  115. package/dist/commands/whoami.js.map +1 -0
  116. package/dist/config.d.ts +35 -0
  117. package/dist/config.d.ts.map +1 -0
  118. package/dist/config.js +87 -0
  119. package/dist/config.js.map +1 -0
  120. package/dist/credentials.d.ts +29 -0
  121. package/dist/credentials.d.ts.map +1 -0
  122. package/dist/credentials.js +98 -0
  123. package/dist/credentials.js.map +1 -0
  124. package/dist/github-url.d.ts +22 -0
  125. package/dist/github-url.d.ts.map +1 -0
  126. package/dist/github-url.js +34 -0
  127. package/dist/github-url.js.map +1 -0
  128. package/dist/helpers.d.ts +145 -0
  129. package/dist/helpers.d.ts.map +1 -0
  130. package/dist/helpers.js +597 -0
  131. package/dist/helpers.js.map +1 -0
  132. package/dist/hooks.d.ts +38 -0
  133. package/dist/hooks.d.ts.map +1 -0
  134. package/dist/hooks.js +155 -0
  135. package/dist/hooks.js.map +1 -0
  136. package/dist/oauth.d.ts +22 -0
  137. package/dist/oauth.d.ts.map +1 -0
  138. package/dist/oauth.js +118 -0
  139. package/dist/oauth.js.map +1 -0
  140. package/dist/registry-client.d.ts +86 -0
  141. package/dist/registry-client.d.ts.map +1 -0
  142. package/dist/registry-client.js +225 -0
  143. package/dist/registry-client.js.map +1 -0
  144. package/package.json +58 -0
package/README.md ADDED
@@ -0,0 +1,419 @@
1
+ # Dossier CLI - Security Verification Tool
2
+
3
+ **Enforce cryptographic verification before executing dossiers.**
4
+
5
+ ## The Problem This Solves
6
+
7
+ **Reality**: LLMs cannot be relied upon to enforce security checks automatically.
8
+
9
+ Even with MCP server installed and protocol documentation:
10
+ - ❌ LLMs may skip verification
11
+ - ❌ No automatic enforcement mechanism
12
+ - ❌ Security depends on LLM "remembering" to check
13
+
14
+ **This CLI provides**: Mandatory verification enforced by code, not suggestions.
15
+
16
+ ---
17
+
18
+ ## Installation
19
+
20
+ ### Option 1: NPM (Recommended)
21
+
22
+ Install globally:
23
+ ```bash
24
+ npm install -g @ai-dossier/cli
25
+ ```
26
+
27
+ Or use without installing:
28
+ ```bash
29
+ npx @ai-dossier/cli <file-or-url>
30
+ ```
31
+
32
+ ### Option 2: From Source (Development)
33
+
34
+ ```bash
35
+ cd cli
36
+ npm link # Links the CLI globally for development
37
+
38
+ # Or use directly
39
+ chmod +x bin/dossier-verify
40
+ ./bin/dossier-verify <file-or-url>
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Usage
46
+
47
+ ### Basic Verification
48
+
49
+ ```bash
50
+ # Verify local file
51
+ dossier-verify path/to/dossier.ds.md
52
+
53
+ # Verify remote dossier
54
+ dossier-verify https://example.com/dossier.ds.md
55
+ ```
56
+
57
+ **Exit codes**:
58
+ - `0` - Verification passed (safe)
59
+ - `1` - Verification failed (unsafe)
60
+ - `2` - Error occurred
61
+
62
+ ### Verbose Mode
63
+
64
+ ```bash
65
+ dossier-verify --verbose path/to/dossier.ds.md
66
+ ```
67
+
68
+ Shows:
69
+ - Dossier metadata (title, version, risk level)
70
+ - Detailed checksum comparison
71
+ - Signature verification details
72
+ - Complete risk assessment
73
+
74
+ ### Integration with LLM Tools
75
+
76
+ **Claude Code**:
77
+ ```bash
78
+ # Shell function wrapper
79
+ claude-run-dossier() {
80
+ if dossier-verify "$1"; then
81
+ claude-code "The dossier at $1 has been verified. Please execute it."
82
+ else
83
+ echo "❌ Security verification failed. Not executing."
84
+ fi
85
+ }
86
+
87
+ # Use it
88
+ claude-run-dossier https://example.com/dossier.ds.md
89
+ ```
90
+
91
+ **Cursor**:
92
+ ```bash
93
+ cursor-run-dossier() {
94
+ if dossier-verify "$1"; then
95
+ cursor "Execute the verified dossier at $1"
96
+ else
97
+ echo "❌ Verification failed"
98
+ return 1
99
+ fi
100
+ }
101
+ ```
102
+
103
+ **Any LLM Tool**:
104
+ ```bash
105
+ safe-run-dossier() {
106
+ local url="$1"
107
+ local tool="${2:-claude-code}"
108
+
109
+ if dossier-verify "$url"; then
110
+ echo "✅ Dossier verified. Passing to $tool..."
111
+ "$tool" "run $url"
112
+ else
113
+ echo "❌ Verification failed. Dossier not executed."
114
+ return 1
115
+ fi
116
+ }
117
+
118
+ # Usage
119
+ safe-run-dossier https://example.com/dossier.ds.md claude-code
120
+ safe-run-dossier https://example.com/dossier.ds.md cursor
121
+ ```
122
+
123
+ ---
124
+
125
+ ## What It Checks
126
+
127
+ ### 1. Integrity (Checksum)
128
+
129
+ **Verifies**: Content hasn't been tampered with
130
+
131
+ **How**:
132
+ 1. Extracts declared SHA256 hash from frontmatter
133
+ 2. Calculates actual SHA256 of dossier body
134
+ 3. Compares hashes
135
+
136
+ **Result**:
137
+ - ✅ Match → Content is intact
138
+ - ❌ Mismatch → Content has been modified → **BLOCK**
139
+
140
+ ### 2. Authenticity (Signature)
141
+
142
+ **Verifies**: Dossier is from claimed author
143
+
144
+ **How**:
145
+ 1. Checks if signature present in frontmatter
146
+ 2. Validates signature format
147
+ 3. Checks if key is in trusted keys list
148
+ 4. Verifies signature against content
149
+
150
+ **Result**:
151
+ - ✅ Valid + Trusted → From known author
152
+ - ⚠️ Valid + Unknown → Signed but untrusted key
153
+ - ❌ Invalid → Signature failed → **BLOCK**
154
+ - ⚠️ No signature → Unsigned (warn for high-risk)
155
+
156
+ ### 3. Risk Assessment
157
+
158
+ **Analyzes**:
159
+ - Dossier risk level (low/medium/high/critical)
160
+ - Presence of signature (required for high-risk)
161
+ - Checksum status
162
+ - Combined security posture
163
+
164
+ **Outputs**:
165
+ - Recommendation: ALLOW, WARN, or BLOCK
166
+ - Issue list
167
+ - Overall risk level
168
+
169
+ ---
170
+
171
+ ## Examples
172
+
173
+ ### Example 1: Legitimate Dossier (Passes)
174
+
175
+ ```bash
176
+ $ dossier-verify examples/data-science/train-ml-model.ds.md
177
+
178
+ 🔐 Dossier Verification Tool
179
+
180
+ ℹ️ Reading: examples/data-science/train-ml-model.ds.md
181
+ ✅ File read successfully
182
+ ℹ️ Parsing dossier...
183
+ ✅ Parsed: Train ML Model v1.0.0
184
+
185
+ 📊 Integrity Check:
186
+ ✅ Checksum VALID - content has not been tampered with
187
+
188
+ 🔏 Authenticity Check:
189
+ ⚠️ No signature present (dossier is unsigned)
190
+
191
+ 🔴 Risk Assessment:
192
+ Risk Level: MEDIUM
193
+
194
+ Recommendation: ALLOW
195
+ ✅ Safe to execute
196
+ Dossier passed security verification.
197
+
198
+ $ echo $?
199
+ 0
200
+ ```
201
+
202
+ ### Example 2: Malicious Dossier (Blocked)
203
+
204
+ ```bash
205
+ $ dossier-verify https://raw.githubusercontent.com/imboard-ai/ai-dossier/main/examples/security/validate-project-config.ds.md
206
+
207
+ 🔐 Dossier Verification Tool
208
+
209
+ ℹ️ Downloading: https://...
210
+ ✅ Downloaded successfully
211
+ ℹ️ Parsing dossier...
212
+ ✅ Parsed: Validate Project Configuration v1.0.0
213
+
214
+ 📊 Integrity Check:
215
+ ❌ Checksum INVALID - content has been modified!
216
+
217
+ 🔏 Authenticity Check:
218
+ ⚠️ Signature verification failed (test signature)
219
+ Signed by: DevTools Community <devtools@example.com>
220
+
221
+ 🔴 Risk Assessment:
222
+ Risk Level: CRITICAL
223
+
224
+ Issues Found:
225
+ - Checksum verification FAILED - content has been tampered with
226
+ - Signature verification FAILED or could not be verified
227
+
228
+ Recommendation: BLOCK
229
+ ❌ DO NOT EXECUTE this dossier
230
+ Security verification failed.
231
+ This dossier may have been tampered with or is from an untrusted source.
232
+
233
+ $ echo $?
234
+ 1
235
+ ```
236
+
237
+ ### Example 3: Shell Integration
238
+
239
+ ```bash
240
+ # Add to ~/.bashrc or ~/.zshrc
241
+
242
+ # Wrapper function for Claude Code
243
+ claude-run-dossier() {
244
+ echo "Verifying dossier security..."
245
+ if ~/projects/dossier/cli/bin/dossier-verify "$1"; then
246
+ echo ""
247
+ echo "✅ Verification passed. Executing with Claude Code..."
248
+ claude-code "Execute the verified dossier at $1"
249
+ else
250
+ echo ""
251
+ echo "❌ Security verification failed."
252
+ echo " The dossier failed security checks and should not be executed."
253
+ return 1
254
+ fi
255
+ }
256
+
257
+ # Usage
258
+ claude-run-dossier https://example.com/dossier.ds.md
259
+ ```
260
+
261
+ ---
262
+
263
+ ## Architecture
264
+
265
+ ### How It Works
266
+
267
+ ```
268
+ User Command:
269
+ dossier-verify https://example.com/dossier.ds.md
270
+
271
+ Download/Read File
272
+
273
+ Parse Frontmatter
274
+ (Extract metadata)
275
+
276
+ Calculate SHA256
277
+ (Dossier body only)
278
+
279
+ Compare Hashes
280
+ ┌────────┴────────┐
281
+ ↓ ↓
282
+ MATCH MISMATCH
283
+ ↓ ↓
284
+ Check Signature BLOCK (exit 1)
285
+
286
+ Assess Risk
287
+
288
+ Exit 0 (safe) or 1 (unsafe)
289
+ ```
290
+
291
+ ### Design Principles
292
+
293
+ 1. **Fail Secure**: Default to blocking on any verification failure
294
+ 2. **Exit Codes**: Machine-readable results for scripting
295
+ 3. **Clear Output**: Human-readable for manual use
296
+ 4. **No Dependencies**: Uses only Node.js built-ins
297
+ 5. **Fast**: Verification in milliseconds
298
+
299
+ ---
300
+
301
+ ## Limitations
302
+
303
+ ### Current Limitations
304
+
305
+ 1. **Signature Verification**: Basic implementation
306
+ - Detects test signatures (invalid/fake)
307
+ - Full minisign verification requires external tool
308
+ - Future: Native minisign support
309
+
310
+ 2. **Trusted Keys**: Not yet implemented
311
+ - Future: Check against ~/.dossier/trusted-keys.txt
312
+ - Future: Key management commands
313
+
314
+ 3. **Execution**: --run flag not implemented
315
+ - Currently just verifies
316
+ - Future: Execute if verification passes
317
+
318
+ ### Why These Limitations Exist
319
+
320
+ **Current status**: MVP for verification enforcement
321
+ **Focus**: Get checksum verification working reliably
322
+ **Future**: Full signature verification, trust management, execution
323
+
324
+ **But even with limitations**:
325
+ - ✅ Checksum verification catches tampering
326
+ - ✅ Signature presence detection works
327
+ - ✅ Exit codes enable integration
328
+ - ✅ Enforces security before LLM involvement
329
+
330
+ ---
331
+
332
+ ## Roadmap
333
+
334
+ ### v0.1.0 (Current)
335
+ - ✅ Basic checksum verification
336
+ - ✅ Signature presence detection
337
+ - ✅ Exit code support
338
+ - ✅ URL download support
339
+
340
+ ### v0.2.0 (Next)
341
+ - ⏳ Full minisign signature verification
342
+ - ⏳ Trusted keys management (~/.dossier/trusted-keys.txt)
343
+ - ⏳ --run flag implementation
344
+ - ⏳ Better error messages
345
+
346
+ ### v0.3.0 (Future)
347
+ - ⏳ Interactive trust prompts
348
+ - ⏳ Key import/export
349
+ - ⏳ Signature verification caching
350
+ - ⏳ JSON output mode (for tooling)
351
+
352
+ ### v1.0.0 (Stable)
353
+ - ⏳ Complete signature verification
354
+ - ⏳ Trust management UI
355
+ - ⏳ Integration with major LLM tools
356
+ - ⏳ Comprehensive documentation
357
+
358
+ ---
359
+
360
+ ## Contributing
361
+
362
+ ### Development Setup
363
+
364
+ ```bash
365
+ cd cli
366
+ npm link # For local testing
367
+
368
+ # Test
369
+ dossier-verify ../examples/devops/deploy-to-aws.ds.md
370
+
371
+ # Test with malicious example
372
+ dossier-verify ../examples/security/validate-project-config.ds.md
373
+ ```
374
+
375
+ ### Adding Features
376
+
377
+ **Priority areas**:
378
+ 1. Full minisign signature verification
379
+ 2. Trusted keys management
380
+ 3. --run flag implementation
381
+ 4. Integration examples for more tools
382
+
383
+ **See**: [CONTRIBUTING.md](../CONTRIBUTING.md)
384
+
385
+ ---
386
+
387
+ ## FAQ
388
+
389
+ ### Q: Why a separate CLI tool?
390
+
391
+ **A**: Security cannot be enforced through LLM instructions alone. We need code-level enforcement that runs **before** LLMs get involved.
392
+
393
+ ### Q: Does this replace MCP server?
394
+
395
+ **A**: No, they're complementary:
396
+ - **CLI**: Enforcement layer (verify before execution)
397
+ - **MCP server**: Convenience layer (tools for LLMs)
398
+
399
+ Use both for best results.
400
+
401
+ ### Q: Can I use this with any LLM tool?
402
+
403
+ **A**: Yes! The CLI is tool-agnostic. Create a wrapper function for your specific tool.
404
+
405
+ ### Q: What if I don't want to install it?
406
+
407
+ **A**: Use the verification script from SECURITY_STATUS.md or manually verify checksums.
408
+
409
+ ---
410
+
411
+ ## Support
412
+
413
+ **Issues**: https://github.com/imboard-ai/ai-dossier/issues
414
+ **Security**: security@imboard.ai
415
+ **Discussions**: https://github.com/imboard-ai/ai-dossier/discussions
416
+
417
+ ---
418
+
419
+ **Remember**: Security is enforced by code, not suggestions. Use this tool to guarantee verification happens.
package/bin/ai-dossier ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ require('../dist/cli.js');