@descix/cli 1.0.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 (94) hide show
  1. package/README.md +95 -0
  2. package/SERVICE_README_sdk.md +399 -0
  3. package/agent-assets/guides/README.md +61 -0
  4. package/agent-assets/guides/dynamic-site-pattern.md +125 -0
  5. package/agent-assets/guides/knowledge-only-pattern.md +93 -0
  6. package/agent-assets/guides/microservice-pattern.md +152 -0
  7. package/agent-assets/guides/static-site-pattern.md +111 -0
  8. package/agent-assets/instructions/app-asset-validation.md +477 -0
  9. package/agent-assets/instructions/onboarding-flow.md +408 -0
  10. package/agent-assets/instructions/standard-folder-structure.md +125 -0
  11. package/agent-assets/reference/app-creation.md +381 -0
  12. package/agent-assets/reference/architecture.md +406 -0
  13. package/agent-assets/reference/local-dev.md +138 -0
  14. package/agent-assets/reference/mcp-integration.md +424 -0
  15. package/agent-assets/reference/workspace-config.md +415 -0
  16. package/agent-assets/rules/descix_mcp.template.mdc +243 -0
  17. package/bin/descix.js +3930 -0
  18. package/bin/mcp-server.js +382 -0
  19. package/descix-cli-1.0.0.tgz +0 -0
  20. package/lib/agent-files.js +162 -0
  21. package/lib/api-client.js +458 -0
  22. package/lib/auth-guard.js +67 -0
  23. package/lib/commands/app-wizard.js +627 -0
  24. package/lib/commands/auth.js +407 -0
  25. package/lib/commands/buy.js +207 -0
  26. package/lib/commands/clone.js +91 -0
  27. package/lib/commands/config.js +155 -0
  28. package/lib/commands/doctor.js +277 -0
  29. package/lib/commands/folder.js +291 -0
  30. package/lib/commands/init.js +257 -0
  31. package/lib/commands/kb.js +654 -0
  32. package/lib/commands/mcp.js +273 -0
  33. package/lib/commands/serve.js +12 -0
  34. package/lib/commands/status.js +239 -0
  35. package/lib/commands/update.js +653 -0
  36. package/lib/core/Chunker.js +610 -0
  37. package/lib/core/Hydrator.js +801 -0
  38. package/lib/core/PathContext.js +335 -0
  39. package/lib/core/Syncer.js +310 -0
  40. package/lib/core/index.js +32 -0
  41. package/lib/global-config.js +86 -0
  42. package/lib/google-storage-adc.js +511 -0
  43. package/lib/wallet-file.js +232 -0
  44. package/lib/wizard/setup.js +502 -0
  45. package/lib/workspace-config.js +712 -0
  46. package/lib/workspace-utils.js +126 -0
  47. package/package.json +41 -0
  48. package/templates/agent-claude.md +226 -0
  49. package/templates/agent-cline.md +133 -0
  50. package/templates/agent-copilot.md +133 -0
  51. package/templates/agent-cursor.md +133 -0
  52. package/templates/descix_mcp.mdc +122 -0
  53. package/templates/drive/README.md +42 -0
  54. package/templates/drive/app/assets/app_description.md +13 -0
  55. package/templates/drive/app/assets/icon.png +0 -0
  56. package/templates/drive/app/assets/system_instructions.md +17 -0
  57. package/templates/drive/app/kb/General/README.md +25 -0
  58. package/templates/drive/community/Apps/.gitkeep +4 -0
  59. package/templates/drive/community/community_assets/community_description.md +15 -0
  60. package/templates/drive/community/community_assets/icon.png +0 -0
  61. package/templates/drive_templates/README.md +104 -0
  62. package/templates/drive_templates/agent_app_template/assets/app_description.txt +13 -0
  63. package/templates/drive_templates/agent_app_template/assets/system_instructions.txt +17 -0
  64. package/templates/drive_templates/agent_app_template/kb/General/README.md +25 -0
  65. package/templates/drive_templates/agent_app_template/microservice/.gitkeep +10 -0
  66. package/templates/drive_templates/agent_app_template/site/.gitkeep +4 -0
  67. package/templates/drive_templates/community_template/Apps/.gitkeep +4 -0
  68. package/templates/drive_templates/community_template/community_assets/community_description.txt +15 -0
  69. package/templates/scaffolds/README.md +62 -0
  70. package/templates/scaffolds/microservice/Dockerfile +19 -0
  71. package/templates/scaffolds/microservice/SERVICE_README_sdk.md +399 -0
  72. package/templates/scaffolds/microservice/app.js +50 -0
  73. package/templates/scaffolds/microservice/app.yaml +8 -0
  74. package/templates/scaffolds/microservice/defaults-config.json +5 -0
  75. package/templates/scaffolds/microservice/dev-overrides.json.example +5 -0
  76. package/templates/scaffolds/microservice/manifest.json +49 -0
  77. package/templates/scaffolds/microservice/package-lock.json +2645 -0
  78. package/templates/scaffolds/microservice/package.json +29 -0
  79. package/templates/scaffolds/microservice/scripts/register.js +55 -0
  80. package/templates/scaffolds/microservice/services/apiFront.js +75 -0
  81. package/templates/scaffolds/microservice/services/commandHandlers/sampleCommands.js +57 -0
  82. package/templates/scaffolds/microservice/services/mcpClient.js +78 -0
  83. package/templates/scaffolds/microservice/services/utils.js +247 -0
  84. package/templates/scaffolds/microservice/setup-schema.json +18 -0
  85. package/templates/scaffolds/microservice/templates/SERVICE_README_TEMPLATE.md +143 -0
  86. package/templates/scaffolds/site/DeSciXAppSDK.js +62 -0
  87. package/templates/scaffolds/site/README.md +51 -0
  88. package/templates/scaffolds/site/app.js +22 -0
  89. package/templates/scaffolds/site/index.html +42 -0
  90. package/templates/scaffolds/site/styles.css +123 -0
  91. package/test-hydration.js +150 -0
  92. package/vendor/mcp/transports/http-sse-transport.js +196 -0
  93. package/vendor/mcp/transports/index.js +15 -0
  94. package/vendor/mcp/transports/stdio-transport.js +118 -0
@@ -0,0 +1,477 @@
1
+ # App Asset Validation
2
+
3
+ This document guides the AI agent through validating an app's folder structure and assets before configuration or sync operations.
4
+
5
+ ## Validation Workflow
6
+
7
+ ### Step 1: Check Folder Structure
8
+
9
+ Verify these folders exist:
10
+
11
+ ```
12
+ {app_folder}/
13
+ ├── assets/ # Required
14
+ ├── kb/ # Required
15
+ │ └── General/ # Required (default KB)
16
+ ├── site/ # Required (even if placeholder)
17
+ └── microservice/ # Required (even if placeholder)
18
+ ```
19
+
20
+ **If folders are missing**, offer to create them with appropriate placeholder content.
21
+
22
+ ### Step 2: Check Required Assets
23
+
24
+ #### `assets/app_description.md`
25
+
26
+ **Check**: File exists and has meaningful content (> 50 characters)
27
+
28
+ **If missing or empty**, guide the user:
29
+
30
+ ```
31
+ I notice your app is missing a description. Let me help you create one.
32
+
33
+ Questions to answer:
34
+ 1. What does this app do in 1-2 sentences?
35
+ 2. Who is the target audience?
36
+ 3. What are the key features?
37
+
38
+ Based on your answers, I'll create assets/app_description.md.
39
+ ```
40
+
41
+ #### `assets/icon.png`
42
+
43
+ **Check**: File exists and is a valid PNG
44
+
45
+ **If missing**, inform the user:
46
+
47
+ ```
48
+ Your app needs an icon (assets/icon.png).
49
+
50
+ Requirements:
51
+ - 512x512 pixels recommended
52
+ - PNG format with transparency
53
+ - Used in store listing and app header
54
+
55
+ Would you like me to note this as a TODO, or do you have an icon to add?
56
+ ```
57
+
58
+ #### `assets/system_instructions.md`
59
+
60
+ **Check**: File exists and has meaningful content (> 100 characters)
61
+
62
+ **If missing**, guide the user:
63
+
64
+ ```
65
+ Your app needs AI agent instructions. This defines how the chat
66
+ assistant behaves when users interact with your app.
67
+
68
+ Questions to consider:
69
+ 1. What persona should the AI have?
70
+ 2. What topics should it help with?
71
+ 3. What should it refuse to do?
72
+ 4. What tone/style should it use?
73
+
74
+ I can create a starter template based on your app description.
75
+ ```
76
+
77
+ ### Step 3: Check Knowledge Base
78
+
79
+ #### `kb/General/README.md`
80
+
81
+ **Check**: File exists with overview content
82
+
83
+ **If missing**, create from app_description or guide:
84
+
85
+ ```
86
+ Your knowledge base needs a README. This is the first document
87
+ the AI will reference when answering questions.
88
+
89
+ I can create one based on your app description, or you can
90
+ provide specific content for the overview.
91
+ ```
92
+
93
+ #### KB Content
94
+
95
+ **Check**: At least one documentation file in `kb/General/`
96
+
97
+ **If empty**, suggest:
98
+
99
+ ```
100
+ Your knowledge base is empty. The AI can only answer questions
101
+ based on content in kb/General/.
102
+
103
+ Suggestions:
104
+ - Move existing documentation here
105
+ - Create a getting-started.md
106
+ - Add API reference docs
107
+ - Include user guides
108
+ ```
109
+
110
+ ### Step 4: Check Site Folder
111
+
112
+ **Check**: `site/` exists with `index.html` OR `README.md` placeholder
113
+
114
+ **If empty**, create placeholder:
115
+
116
+ ```markdown
117
+ # Site Folder
118
+
119
+ This folder is reserved for static site content.
120
+
121
+ ## Current Status
122
+ This app does not yet have a web UI.
123
+
124
+ ## To Add a Site
125
+ 1. Add HTML/CSS/JS files directly here, OR
126
+ 2. Configure your build tool to output to `site/dist/`
127
+ 3. Run `descix update site` to deploy
128
+
129
+ ## Supported Content
130
+ - Static HTML files
131
+ - Build output from React, Vue, VitePress, etc.
132
+ - Assets (images, CSS, JS)
133
+ ```
134
+
135
+ ### Step 5: Check Microservice Folder
136
+
137
+ **Check**: `microservice/` exists with `README.md`
138
+
139
+ **If empty**, create placeholder:
140
+
141
+ ```markdown
142
+ # Microservice Folder
143
+
144
+ This folder is reserved for backend service code.
145
+
146
+ ## Current Status
147
+ This app does not have a backend microservice.
148
+
149
+ ## To Add a Service
150
+ 1. Create command handlers in `handlers/`
151
+ 2. Add SERVICE_README_*.md for tell_me_how discovery
152
+ 3. Configure manifest.json at the app root
153
+ 4. Run `descix microservice register` to register with the platform
154
+
155
+ ## Benefits
156
+ - Expose custom MCP tools
157
+ - Add backend logic to your AI agent
158
+ - Integrate with external services
159
+ ```
160
+
161
+ ## Pull from Drive Workflow
162
+
163
+ If the app already exists on Drive, offer to pull existing assets.
164
+
165
+ ### Check if App Exists Remotely
166
+
167
+ ```
168
+ Use: validate_app_assets({ community_id, app_id, check_drive: true })
169
+
170
+ Returns:
171
+ {
172
+ "local_assets": { ... },
173
+ "remote_assets": { ... },
174
+ "missing_locally": ["icon.png", "system_instructions.md"],
175
+ "can_pull": true
176
+ }
177
+ ```
178
+
179
+ ### Offer to Pull
180
+
181
+ ```
182
+ I found your app already exists on DeSciX Drive with these assets:
183
+ - ✓ app_description.md (234 bytes)
184
+ - ✓ icon.png (45KB)
185
+ - ✓ system_instructions.md (1.2KB)
186
+
187
+ Your local folder is missing:
188
+ - icon.png
189
+ - system_instructions.md
190
+
191
+ Would you like me to pull these from Drive to your local folder?
192
+ [Yes, pull missing assets] [No, I'll create new ones]
193
+ ```
194
+
195
+ ### Execute Pull
196
+
197
+ ```
198
+ Use: pull_app_assets_from_drive({
199
+ community_id,
200
+ app_id,
201
+ local_path,
202
+ folders: ["assets", "kb"] // Optional: specify which folders
203
+ })
204
+ ```
205
+
206
+ ## Validation Results Format
207
+
208
+ After validation, report status clearly:
209
+
210
+ ```
211
+ ## App Structure Validation: my-app
212
+
213
+ ### Folder Structure
214
+ ✓ assets/ exists
215
+ ✓ kb/General/ exists
216
+ ✓ site/ exists
217
+ ✓ microservice/ exists
218
+
219
+ ### Required Assets
220
+ ✓ assets/app_description.md (523 bytes)
221
+ ✗ assets/icon.png - MISSING
222
+ ✓ assets/system_instructions.md (1.2KB)
223
+
224
+ ### Knowledge Base
225
+ ✓ kb/General/README.md exists
226
+ ✓ 5 documents found (12.4KB total)
227
+
228
+ ### Site
229
+ ○ site/ contains placeholder only (no UI)
230
+
231
+ ### Microservice
232
+ ○ microservice/ contains placeholder only (no service)
233
+
234
+ ### Recommendations
235
+ 1. Add an icon.png (512x512) to assets/
236
+ 2. Consider adding a welcome page to site/
237
+ ```
238
+
239
+ ## Asset Content Guidelines
240
+
241
+ ### app_description.md Template
242
+
243
+ ```markdown
244
+ # {App Name}
245
+
246
+ {One-sentence summary of what the app does.}
247
+
248
+ ## Overview
249
+
250
+ {2-3 sentences expanding on the summary. What problem does it solve?
251
+ Who is it for?}
252
+
253
+ ## Key Features
254
+
255
+ - {Feature 1}
256
+ - {Feature 2}
257
+ - {Feature 3}
258
+
259
+ ## Use Cases
260
+
261
+ - {Use case 1}
262
+ - {Use case 2}
263
+ ```
264
+
265
+ ### system_instructions.md Template
266
+
267
+ ```markdown
268
+ # System Instructions for {App Name}
269
+
270
+ ## Persona
271
+
272
+ You are an AI assistant for {App Name}. {One sentence describing the
273
+ assistant's role and expertise.}
274
+
275
+ ## Core Responsibilities
276
+
277
+ 1. {Primary responsibility}
278
+ 2. {Secondary responsibility}
279
+ 3. {Tertiary responsibility}
280
+
281
+ ## Knowledge Domain
282
+
283
+ You have access to documentation about:
284
+ - {Topic 1}
285
+ - {Topic 2}
286
+ - {Topic 3}
287
+
288
+ ## Response Guidelines
289
+
290
+ - {Guideline 1: e.g., "Be concise and technical"}
291
+ - {Guideline 2: e.g., "Provide code examples when relevant"}
292
+ - {Guideline 3: e.g., "Ask clarifying questions before complex tasks"}
293
+
294
+ ## Constraints
295
+
296
+ Do NOT:
297
+ - {Constraint 1: e.g., "Make up information not in the knowledge base"}
298
+ - {Constraint 2: e.g., "Provide advice outside the domain"}
299
+ - {Constraint 3: e.g., "Execute commands without user confirmation"}
300
+
301
+ ## Tone
302
+
303
+ {Describe the desired tone: professional, friendly, technical, etc.}
304
+ ```
305
+
306
+ ### kb/README.md Template
307
+
308
+ ```markdown
309
+ # {App Name} Knowledge Base
310
+
311
+ Welcome to the {App Name} documentation.
312
+
313
+ ## Contents
314
+
315
+ - [Getting Started](./getting-started.md)
316
+ - [User Guide](./user-guide.md)
317
+ - [API Reference](./api-reference.md)
318
+
319
+ ## Quick Start
320
+
321
+ {Brief instructions to get started with the app}
322
+
323
+ ## Need Help?
324
+
325
+ {Instructions for getting support or asking questions}
326
+ ```
327
+
328
+ ## Error Recovery
329
+
330
+ ### Missing .descix/ Folder
331
+
332
+ ```
333
+ This folder doesn't appear to be configured as a DeSciX app.
334
+
335
+ Options:
336
+ 1. Run `descix init` to configure this folder as a new app
337
+ 2. Run `descix setup` to configure the entire workspace
338
+ 3. Check if this is the correct folder
339
+
340
+ Which would you like to do?
341
+ ```
342
+
343
+ ### Corrupted workspace.json
344
+
345
+ ```
346
+ The .descix/workspace.json file appears to be invalid.
347
+
348
+ I can:
349
+ 1. Back up the current file and create a new one
350
+ 2. Attempt to repair the existing file
351
+ 3. Show you the error for manual fixing
352
+
353
+ Error: {JSON parse error message}
354
+ ```
355
+
356
+ ### Permission Errors
357
+
358
+ ```
359
+ I couldn't access {folder/file}. This might be a permissions issue.
360
+
361
+ Please check:
362
+ 1. You have read/write access to this folder
363
+ 2. The folder isn't locked by another process
364
+ 3. The path exists: {full path}
365
+ ```
366
+
367
+ ## Integration with Workflows
368
+
369
+ ### Before `descix update app`
370
+
371
+ Always run validation:
372
+ 1. Check `assets/` folder structure
373
+ 2. Verify all required files exist
374
+ 3. Warn about missing icon
375
+ 4. Confirm app_description has meaningful content
376
+
377
+ ### Before `descix update kb`
378
+
379
+ 1. Check `kb/General/` exists
380
+ 2. Verify at least one document exists
381
+ 3. Warn if no README.md
382
+ 4. Report total document count and size
383
+
384
+ ### Before `descix update site`
385
+
386
+ 1. Check `site/` exists
387
+ 2. Verify either index.html or dist/index.html exists
388
+ 3. Warn if only placeholder README
389
+
390
+ ### Before `descix microservice register`
391
+
392
+ 1. Check `microservice/` exists
393
+ 2. Verify manifest.json exists (root or microservice/)
394
+ 3. Check for SERVICE_README_*.md
395
+ 4. Warn if no command handlers found
396
+
397
+ ---
398
+
399
+ ## Folder Analysis Heuristics
400
+
401
+ Use these patterns to automatically detect project type and recommend appropriate packaging.
402
+
403
+ ### Detection Priority
404
+
405
+ 1. **Existing DeSciX config** - Already configured?
406
+ 2. **Service indicators** - Has backend logic?
407
+ 3. **Static site indicators** - Has build output?
408
+ 4. **Knowledge indicators** - Has documentation?
409
+
410
+ ### Service Indicators (Backend Logic)
411
+
412
+ | Pattern | Indicates | Packaging Type |
413
+ |---------|-----------|----------------|
414
+ | `manifest.json` with `commands` | DeSciX microservice | Microservice/Dynamic |
415
+ | `app.yaml` + `Dockerfile` | Cloud deployment | Dynamic Site |
416
+ | `express`, `fastify` in package.json | Node.js server | Microservice |
417
+ | `api/` or `routes/` directory | API structure | Microservice |
418
+ | `SERVICE_README*.md` | Documented service | Microservice |
419
+
420
+ ### Static Site Indicators
421
+
422
+ | Pattern | Indicates | Packaging Type |
423
+ |---------|-----------|----------------|
424
+ | `dist/index.html` | Built static site | Static Site |
425
+ | `build/index.html` | Built static site | Static Site |
426
+ | `vite.config.*` | Vite project | Static Site |
427
+ | `.vitepress/` | VitePress docs | Static Site |
428
+ | `docusaurus.config.js` | Docusaurus | Static Site |
429
+
430
+ ### Knowledge Indicators
431
+
432
+ | Pattern | Indicates | Packaging Type |
433
+ |---------|-----------|----------------|
434
+ | `docs/` directory | Documentation folder | Knowledge-Only |
435
+ | Multiple `*.md` files | Markdown docs | Knowledge-Only |
436
+ | `*.pdf` files | PDF documents | Knowledge-Only |
437
+
438
+ ### Analysis Algorithm
439
+
440
+ ```
441
+ 1. Check workspace.json for app registration
442
+ - If app exists, read current config
443
+
444
+ 2. Check for service indicators
445
+ - manifest.json with commands → Microservice
446
+ - Dockerfile + app.yaml → Dynamic Site
447
+ - Server files (app.js, server.js) → Microservice
448
+
449
+ 3. Check for static site indicators
450
+ - Build output (dist/, build/) → Static Site
451
+ - Build config (vite, webpack) → Static Site
452
+
453
+ 4. Check for knowledge indicators
454
+ - docs/ folder → Knowledge-Only
455
+ - Multiple .md files → Knowledge-Only
456
+
457
+ 5. Default to Knowledge-Only if no other indicators
458
+ ```
459
+
460
+ ### Presenting Analysis Results
461
+
462
+ ```
463
+ **Analysis Results for '{folder_name}':**
464
+
465
+ I found:
466
+ ├── **Framework:** {framework_name}
467
+ ├── **Build System:** {build_tool}
468
+ ├── **Backend:** {yes/no}
469
+ └── **Documentation:** {count} files
470
+
471
+ **Recommended Packaging Type:** {Type}
472
+ **Why:** {reason}
473
+
474
+ Should I set up '{folder_name}' as a **{Type}** app?
475
+ ```
476
+
477
+ For detailed pattern guides, see [guides/](../guides/).