@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.
- package/README.md +95 -0
- package/SERVICE_README_sdk.md +399 -0
- package/agent-assets/guides/README.md +61 -0
- package/agent-assets/guides/dynamic-site-pattern.md +125 -0
- package/agent-assets/guides/knowledge-only-pattern.md +93 -0
- package/agent-assets/guides/microservice-pattern.md +152 -0
- package/agent-assets/guides/static-site-pattern.md +111 -0
- package/agent-assets/instructions/app-asset-validation.md +477 -0
- package/agent-assets/instructions/onboarding-flow.md +408 -0
- package/agent-assets/instructions/standard-folder-structure.md +125 -0
- package/agent-assets/reference/app-creation.md +381 -0
- package/agent-assets/reference/architecture.md +406 -0
- package/agent-assets/reference/local-dev.md +138 -0
- package/agent-assets/reference/mcp-integration.md +424 -0
- package/agent-assets/reference/workspace-config.md +415 -0
- package/agent-assets/rules/descix_mcp.template.mdc +243 -0
- package/bin/descix.js +3930 -0
- package/bin/mcp-server.js +382 -0
- package/descix-cli-1.0.0.tgz +0 -0
- package/lib/agent-files.js +162 -0
- package/lib/api-client.js +458 -0
- package/lib/auth-guard.js +67 -0
- package/lib/commands/app-wizard.js +627 -0
- package/lib/commands/auth.js +407 -0
- package/lib/commands/buy.js +207 -0
- package/lib/commands/clone.js +91 -0
- package/lib/commands/config.js +155 -0
- package/lib/commands/doctor.js +277 -0
- package/lib/commands/folder.js +291 -0
- package/lib/commands/init.js +257 -0
- package/lib/commands/kb.js +654 -0
- package/lib/commands/mcp.js +273 -0
- package/lib/commands/serve.js +12 -0
- package/lib/commands/status.js +239 -0
- package/lib/commands/update.js +653 -0
- package/lib/core/Chunker.js +610 -0
- package/lib/core/Hydrator.js +801 -0
- package/lib/core/PathContext.js +335 -0
- package/lib/core/Syncer.js +310 -0
- package/lib/core/index.js +32 -0
- package/lib/global-config.js +86 -0
- package/lib/google-storage-adc.js +511 -0
- package/lib/wallet-file.js +232 -0
- package/lib/wizard/setup.js +502 -0
- package/lib/workspace-config.js +712 -0
- package/lib/workspace-utils.js +126 -0
- package/package.json +41 -0
- package/templates/agent-claude.md +226 -0
- package/templates/agent-cline.md +133 -0
- package/templates/agent-copilot.md +133 -0
- package/templates/agent-cursor.md +133 -0
- package/templates/descix_mcp.mdc +122 -0
- package/templates/drive/README.md +42 -0
- package/templates/drive/app/assets/app_description.md +13 -0
- package/templates/drive/app/assets/icon.png +0 -0
- package/templates/drive/app/assets/system_instructions.md +17 -0
- package/templates/drive/app/kb/General/README.md +25 -0
- package/templates/drive/community/Apps/.gitkeep +4 -0
- package/templates/drive/community/community_assets/community_description.md +15 -0
- package/templates/drive/community/community_assets/icon.png +0 -0
- package/templates/drive_templates/README.md +104 -0
- package/templates/drive_templates/agent_app_template/assets/app_description.txt +13 -0
- package/templates/drive_templates/agent_app_template/assets/system_instructions.txt +17 -0
- package/templates/drive_templates/agent_app_template/kb/General/README.md +25 -0
- package/templates/drive_templates/agent_app_template/microservice/.gitkeep +10 -0
- package/templates/drive_templates/agent_app_template/site/.gitkeep +4 -0
- package/templates/drive_templates/community_template/Apps/.gitkeep +4 -0
- package/templates/drive_templates/community_template/community_assets/community_description.txt +15 -0
- package/templates/scaffolds/README.md +62 -0
- package/templates/scaffolds/microservice/Dockerfile +19 -0
- package/templates/scaffolds/microservice/SERVICE_README_sdk.md +399 -0
- package/templates/scaffolds/microservice/app.js +50 -0
- package/templates/scaffolds/microservice/app.yaml +8 -0
- package/templates/scaffolds/microservice/defaults-config.json +5 -0
- package/templates/scaffolds/microservice/dev-overrides.json.example +5 -0
- package/templates/scaffolds/microservice/manifest.json +49 -0
- package/templates/scaffolds/microservice/package-lock.json +2645 -0
- package/templates/scaffolds/microservice/package.json +29 -0
- package/templates/scaffolds/microservice/scripts/register.js +55 -0
- package/templates/scaffolds/microservice/services/apiFront.js +75 -0
- package/templates/scaffolds/microservice/services/commandHandlers/sampleCommands.js +57 -0
- package/templates/scaffolds/microservice/services/mcpClient.js +78 -0
- package/templates/scaffolds/microservice/services/utils.js +247 -0
- package/templates/scaffolds/microservice/setup-schema.json +18 -0
- package/templates/scaffolds/microservice/templates/SERVICE_README_TEMPLATE.md +143 -0
- package/templates/scaffolds/site/DeSciXAppSDK.js +62 -0
- package/templates/scaffolds/site/README.md +51 -0
- package/templates/scaffolds/site/app.js +22 -0
- package/templates/scaffolds/site/index.html +42 -0
- package/templates/scaffolds/site/styles.css +123 -0
- package/test-hydration.js +150 -0
- package/vendor/mcp/transports/http-sse-transport.js +196 -0
- package/vendor/mcp/transports/index.js +15 -0
- package/vendor/mcp/transports/stdio-transport.js +118 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
# Entitlements-First Onboarding Flow
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document guides AI agents through the entitlements-driven onboarding process for DeSciX developers. The key principle: **users purchase apps/communities in the PWA first, then configure local folders**.
|
|
6
|
+
|
|
7
|
+
## Configuration: workspace.json
|
|
8
|
+
|
|
9
|
+
DeSciX uses **workspace.json** as the sole configuration file.
|
|
10
|
+
|
|
11
|
+
### workspace.json (Workspace Root)
|
|
12
|
+
|
|
13
|
+
Location: `{workspace_root}/.descix/workspace.json`
|
|
14
|
+
|
|
15
|
+
Purpose: Maps local folders to DeSciX apps and stores all configuration.
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"version": "2.0",
|
|
20
|
+
"primaryCommunity": "descix",
|
|
21
|
+
"communities": {
|
|
22
|
+
"descix": {
|
|
23
|
+
"apps": {
|
|
24
|
+
"appsdk": {
|
|
25
|
+
"localPath": "descix/appsdk",
|
|
26
|
+
"absolutePath": "/path/to/workspace/descix/appsdk",
|
|
27
|
+
"kbId": "General"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"driveConfig": {
|
|
33
|
+
"base_folder_id": "...",
|
|
34
|
+
"base_folder_name": "..."
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Used for:**
|
|
40
|
+
- CLI auto-detection of community/app from current directory
|
|
41
|
+
- `tell_me_how --scope project` to discover project-specific tools
|
|
42
|
+
- MCP server to know which apps are in scope
|
|
43
|
+
- CLI to find the workspace root
|
|
44
|
+
|
|
45
|
+
### Key Principle
|
|
46
|
+
|
|
47
|
+
**workspace.json** is the single configuration file that maps local folders to DeSciX apps and contains all sync configuration. It is created once at the workspace root during onboarding.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Prerequisites
|
|
52
|
+
|
|
53
|
+
Before starting onboarding:
|
|
54
|
+
1. User has run `descix login` successfully
|
|
55
|
+
2. User has purchased SDK entitlement (descix/sdk or descix/docs)
|
|
56
|
+
3. `.descix/wallet.json` exists with valid credentials
|
|
57
|
+
4. This file exists at `.descix/sdk-assets/instructions/onboarding-flow.md`
|
|
58
|
+
|
|
59
|
+
## Onboarding Decision Tree
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
START
|
|
63
|
+
│
|
|
64
|
+
├── Is this a fresh workspace (no .descix/workspace.json)?
|
|
65
|
+
│ └── YES → Run Full Setup Flow
|
|
66
|
+
│
|
|
67
|
+
├── Does workspace.json exist but has unconfigured apps?
|
|
68
|
+
│ └── YES → Run App Configuration Flow
|
|
69
|
+
│
|
|
70
|
+
└── Is everything configured?
|
|
71
|
+
└── YES → Ready for development
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Full Setup Flow
|
|
75
|
+
|
|
76
|
+
### Step 1: Fetch Entitlements
|
|
77
|
+
|
|
78
|
+
Always start by checking what the user owns:
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
execute_remote_command({
|
|
82
|
+
command: "fetch_my_purchases",
|
|
83
|
+
params: {}
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
This returns:
|
|
88
|
+
- `communities`: Communities the user belongs to (with roles)
|
|
89
|
+
- `apps`: Apps the user owns or can develop
|
|
90
|
+
- `service_slots`: Available service deployment slots
|
|
91
|
+
|
|
92
|
+
### Step 2: Present Entitlements to User
|
|
93
|
+
|
|
94
|
+
Format the response clearly:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Based on your entitlements, you have access to:
|
|
98
|
+
|
|
99
|
+
Communities:
|
|
100
|
+
1. {community_name} ({community_id}) - {role}
|
|
101
|
+
2. ...
|
|
102
|
+
|
|
103
|
+
Apps you can develop:
|
|
104
|
+
- {community_id}/{app_id} ({app_name})
|
|
105
|
+
- ...
|
|
106
|
+
|
|
107
|
+
Service Slots:
|
|
108
|
+
- {slot_count} available for microservice deployment
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Step 3: Scan Workspace Folders
|
|
112
|
+
|
|
113
|
+
Identify potential project folders:
|
|
114
|
+
- Look for directories with `package.json`, `Cargo.toml`, `requirements.txt`
|
|
115
|
+
- Ignore: `node_modules`, `.git`, `dist`, `build`, `.descix`
|
|
116
|
+
- Note folders that are already registered in `workspace.json`
|
|
117
|
+
|
|
118
|
+
### Step 4: Ask User About Folder Mappings
|
|
119
|
+
|
|
120
|
+
Present options:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
I see these folders in your workspace:
|
|
124
|
+
- frontend/ (React app with build system)
|
|
125
|
+
- backend/ (Node.js with Express)
|
|
126
|
+
- docs/ (Markdown documentation)
|
|
127
|
+
|
|
128
|
+
Would you like to map any to your apps?
|
|
129
|
+
|
|
130
|
+
Suggested mappings based on folder contents:
|
|
131
|
+
- frontend/ → {community}/pwa (Static Site)
|
|
132
|
+
- backend/ → {community}/api (Microservice)
|
|
133
|
+
- docs/ → {community}/docs (Knowledge Only)
|
|
134
|
+
|
|
135
|
+
Which mappings should I create?
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Step 5: Create Configuration Files
|
|
139
|
+
|
|
140
|
+
For each mapping, create appropriate config:
|
|
141
|
+
|
|
142
|
+
1. **workspace.json** (root level):
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"version": "2.0",
|
|
146
|
+
"primaryCommunity": "{primary_community_id}",
|
|
147
|
+
"directoryMappings": {
|
|
148
|
+
"{folder}": {
|
|
149
|
+
"communityId": "{community_id}",
|
|
150
|
+
"appId": "{app_id}",
|
|
151
|
+
"kbId": "General"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## App Configuration Flow
|
|
158
|
+
|
|
159
|
+
For apps that exist in entitlements but aren't configured locally:
|
|
160
|
+
|
|
161
|
+
### Step 1: Identify Unconfigured Apps
|
|
162
|
+
|
|
163
|
+
Compare:
|
|
164
|
+
- Apps from `fetch_my_purchases`
|
|
165
|
+
- Mappings in `workspace.json`
|
|
166
|
+
|
|
167
|
+
### Step 2: Ask About Each Unconfigured App
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
You have these apps that aren't linked to local folders:
|
|
171
|
+
- {community}/{app} - {description}
|
|
172
|
+
|
|
173
|
+
Would you like to:
|
|
174
|
+
1. Link to an existing folder
|
|
175
|
+
2. Create a new folder for this app
|
|
176
|
+
3. Skip for now
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Step 3: Determine Packaging Type
|
|
180
|
+
|
|
181
|
+
For each folder being configured:
|
|
182
|
+
|
|
183
|
+
1. Read `packaging-types.md` for the decision tree
|
|
184
|
+
2. Read `folder-analysis.md` for detection heuristics
|
|
185
|
+
3. Present options to user with recommendations
|
|
186
|
+
4. Use appropriate template from `templates/{type}/`
|
|
187
|
+
|
|
188
|
+
### Step 4: Validate Folder Structure
|
|
189
|
+
|
|
190
|
+
After determining packaging type, ensure the folder follows the [Standard Folder Structure](./standard-folder-structure.md):
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
{app_folder}/
|
|
194
|
+
├── assets/ # App identity (required)
|
|
195
|
+
├── kb/General/ # Knowledge base (required)
|
|
196
|
+
├── site/ # Static site (required)
|
|
197
|
+
└── microservice/ # Backend service (required)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Validation Steps:**
|
|
201
|
+
|
|
202
|
+
1. Check if each required folder exists
|
|
203
|
+
2. Check if required assets exist (`app_description.md`, `icon.png`, `system_instructions.md`)
|
|
204
|
+
3. Check if kb/ has a README.md
|
|
205
|
+
4. For missing folders/files, offer to create with placeholders
|
|
206
|
+
|
|
207
|
+
Use `validate_app_structure` command:
|
|
208
|
+
|
|
209
|
+
```javascript
|
|
210
|
+
execute_remote_command({
|
|
211
|
+
command: "validate_app_structure",
|
|
212
|
+
params: { local_path: "/path/to/app" }
|
|
213
|
+
})
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Step 5: Pull from Drive (Optional)
|
|
217
|
+
|
|
218
|
+
If the app already exists remotely, offer to pull existing assets:
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
I notice this app ({community_id}/{app_id}) already exists on DeSciX.
|
|
222
|
+
|
|
223
|
+
Remote assets found:
|
|
224
|
+
- ✓ app_description.md
|
|
225
|
+
- ✓ icon.png
|
|
226
|
+
- ✓ system_instructions.md
|
|
227
|
+
|
|
228
|
+
Your local folder is missing some of these.
|
|
229
|
+
|
|
230
|
+
Would you like me to pull them from Drive?
|
|
231
|
+
[Yes, pull missing assets] [No, I'll create new ones]
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Use `pull_app_assets_from_drive` command:
|
|
235
|
+
|
|
236
|
+
```javascript
|
|
237
|
+
execute_remote_command({
|
|
238
|
+
command: "pull_app_assets_from_drive",
|
|
239
|
+
params: {
|
|
240
|
+
community_id: "...",
|
|
241
|
+
app_id: "...",
|
|
242
|
+
local_path: "/path/to/app",
|
|
243
|
+
folders: ["assets", "kb"] // Which folders to pull
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Step 6: Create Missing Structure
|
|
249
|
+
|
|
250
|
+
For any missing folders or files:
|
|
251
|
+
|
|
252
|
+
1. Create the folder structure
|
|
253
|
+
2. Add placeholder READMEs explaining purpose
|
|
254
|
+
3. Use templates from `templates/common/`
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
Creating standard folder structure...
|
|
258
|
+
|
|
259
|
+
Created:
|
|
260
|
+
✓ assets/app_description.md (from template)
|
|
261
|
+
✓ assets/system_instructions.md (from template)
|
|
262
|
+
○ assets/icon.png (TODO: add a 512x512 PNG)
|
|
263
|
+
✓ kb/General/README.md
|
|
264
|
+
✓ site/README.md (placeholder)
|
|
265
|
+
✓ microservice/README.md (placeholder)
|
|
266
|
+
|
|
267
|
+
Your app structure is now ready. Run `descix update app` to sync.
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Key Principles
|
|
271
|
+
|
|
272
|
+
### Never Assume
|
|
273
|
+
- Always ask before creating mappings
|
|
274
|
+
- Present options, let user choose
|
|
275
|
+
- Explain trade-offs of each packaging type
|
|
276
|
+
|
|
277
|
+
### Entitlements Are Truth
|
|
278
|
+
- If user doesn't own an app, they can't configure it locally
|
|
279
|
+
- Service slots determine microservice deployment capacity
|
|
280
|
+
- Community role affects what operations are allowed
|
|
281
|
+
|
|
282
|
+
### Local Config Mirrors Remote
|
|
283
|
+
- `workspace.json` reflects purchased entitlements and sync configuration
|
|
284
|
+
- Changes require re-sync, not re-purchase
|
|
285
|
+
|
|
286
|
+
## Error Handling
|
|
287
|
+
|
|
288
|
+
### "No entitlements found"
|
|
289
|
+
User hasn't purchased anything yet. Direct them to the PWA store.
|
|
290
|
+
|
|
291
|
+
### "App not in entitlements"
|
|
292
|
+
User is trying to configure an app they don't own. Suggest purchase.
|
|
293
|
+
|
|
294
|
+
### "Folder already configured"
|
|
295
|
+
Check if configuration matches intended app. Offer to update or skip.
|
|
296
|
+
|
|
297
|
+
## Next Steps After Onboarding
|
|
298
|
+
|
|
299
|
+
Once configured, guide user to:
|
|
300
|
+
|
|
301
|
+
### Sync Commands (in order)
|
|
302
|
+
|
|
303
|
+
1. **Sync app assets**: `descix update app`
|
|
304
|
+
- Uploads app_description.md, icon.png, system_instructions.md to Drive
|
|
305
|
+
|
|
306
|
+
2. **Sync knowledge base**: `descix update kb`
|
|
307
|
+
- Indexes documents to Pinecone for RAG
|
|
308
|
+
|
|
309
|
+
3. **Deploy static site** (if applicable): `descix site upload`
|
|
310
|
+
- Uploads site/ contents to GCS
|
|
311
|
+
|
|
312
|
+
4. **Register microservice** (if applicable): `descix microservice register`
|
|
313
|
+
- Registers service with gateway
|
|
314
|
+
- Run `descix microservice vectorize` for tell_me_how discovery
|
|
315
|
+
|
|
316
|
+
### Ongoing Development
|
|
317
|
+
|
|
318
|
+
- Use `tell_me_how` for tool discovery and guidance
|
|
319
|
+
- Use `chat_with_kb` to test your AI agent
|
|
320
|
+
- Use `validate_app_structure` before syncing to catch issues
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Agent Conversation Templates
|
|
325
|
+
|
|
326
|
+
Use these dialogue patterns when guiding users through onboarding.
|
|
327
|
+
|
|
328
|
+
### Initial Greeting
|
|
329
|
+
|
|
330
|
+
```
|
|
331
|
+
Welcome! I see you've set up DeSciX in this workspace.
|
|
332
|
+
|
|
333
|
+
Let me check your entitlements and help you configure your apps...
|
|
334
|
+
|
|
335
|
+
You have access to:
|
|
336
|
+
- **{community_name}** community ({role})
|
|
337
|
+
- {app_1} - {app_1_status}
|
|
338
|
+
- {app_2} - {app_2_status}
|
|
339
|
+
|
|
340
|
+
Would you like me to help you:
|
|
341
|
+
1. Link a folder to one of your apps
|
|
342
|
+
2. Explore what you can do with a specific app
|
|
343
|
+
3. Something else
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Presenting Entitlements
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
Based on your purchases, here's what you can work with:
|
|
350
|
+
|
|
351
|
+
**Communities:**
|
|
352
|
+
| Community | Role | Apps |
|
|
353
|
+
|-----------|------|------|
|
|
354
|
+
| {name} | {role} | {count} |
|
|
355
|
+
|
|
356
|
+
**Your Apps:**
|
|
357
|
+
| App | Status | Local Folder |
|
|
358
|
+
|-----|--------|--------------|
|
|
359
|
+
| {app_id} | Configured / Not linked | {folder or "—"} |
|
|
360
|
+
|
|
361
|
+
Which app would you like to work on?
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### After Successful Setup
|
|
365
|
+
|
|
366
|
+
```
|
|
367
|
+
All done! Your app is configured.
|
|
368
|
+
|
|
369
|
+
**Summary:**
|
|
370
|
+
- App: {community}/{app}
|
|
371
|
+
- Type: {packaging_type}
|
|
372
|
+
- Folder: {folder_path}
|
|
373
|
+
|
|
374
|
+
**What you can do now:**
|
|
375
|
+
- Use `tell_me_how` to discover tools
|
|
376
|
+
- Ask me to sync content when you make changes
|
|
377
|
+
- Run `descix kb sync` to update RAG index
|
|
378
|
+
|
|
379
|
+
Anything else I can help with?
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Error Recovery
|
|
383
|
+
|
|
384
|
+
```
|
|
385
|
+
The command didn't work as expected.
|
|
386
|
+
|
|
387
|
+
**What I tried:** {command}
|
|
388
|
+
**What happened:** {error_summary}
|
|
389
|
+
|
|
390
|
+
Let me try to fix this:
|
|
391
|
+
1. First, I'll check {diagnostic_step}
|
|
392
|
+
2. If that's fine, I'll try {alternative_approach}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### When User Has No Apps
|
|
396
|
+
|
|
397
|
+
```
|
|
398
|
+
I checked your entitlements, but you don't have any apps yet.
|
|
399
|
+
|
|
400
|
+
To get started, you'll need to:
|
|
401
|
+
1. Visit the DeSciX PWA
|
|
402
|
+
2. Create or purchase an app in a community
|
|
403
|
+
3. Come back here and I'll help you set it up
|
|
404
|
+
|
|
405
|
+
Would you like me to explain how app creation works?
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
For pattern-specific guidance, see [guides/](../guides/).
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Standard DeSciX Workspace Structure (Mono-Repo)
|
|
2
|
+
|
|
3
|
+
This document defines the canonical folder structure for DeSciX workspaces. Following this structure ensures consistency, discoverability, and seamless integration with platform tools.
|
|
4
|
+
|
|
5
|
+
## Workspace Hierarchy
|
|
6
|
+
|
|
7
|
+
DeSciX uses a "Mono-Repo" style structure where multiple communities and apps can coexist in a single workspace.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
/ (Workspace Root)
|
|
11
|
+
├── .descix/
|
|
12
|
+
│ ├── workspace.json # Workspace configuration (maps communities/apps)
|
|
13
|
+
│ └── wallet.json # Developer credentials (DO NOT COMMIT)
|
|
14
|
+
│
|
|
15
|
+
├── [Community_ID]/ # Community Folder
|
|
16
|
+
│ ├── community_assets/
|
|
17
|
+
│ │ ├── icon.png
|
|
18
|
+
│ │ └── description.md
|
|
19
|
+
│ │
|
|
20
|
+
│ └── [App_ID]/ # App Folder
|
|
21
|
+
│ ├── assets/ # App Metadata
|
|
22
|
+
│ │ ├── app_description.md
|
|
23
|
+
│ │ ├── icon.png
|
|
24
|
+
│ │ └── system_instructions.md (AI Persona)
|
|
25
|
+
│ │
|
|
26
|
+
│ ├── kb/ # Knowledge Base (RAG)
|
|
27
|
+
│ │ ├── staging/ # Local files to push to Drive
|
|
28
|
+
│ │ │ └── new-doc.pdf
|
|
29
|
+
│ │ ├── General/ # Converted markdown (from Drive pull)
|
|
30
|
+
│ │ │ └── *.md
|
|
31
|
+
│ │ └── chunks/ # JSON chunk files (for vectorization)
|
|
32
|
+
│ │ └── *.chunks.json
|
|
33
|
+
│ │
|
|
34
|
+
│ ├── site/ # Frontend UI (Optional)
|
|
35
|
+
│ │ ├── index.html
|
|
36
|
+
│ │ └── src/
|
|
37
|
+
│ │
|
|
38
|
+
│ └── microservice/ # Backend Logic (Optional)
|
|
39
|
+
│ ├── Dockerfile
|
|
40
|
+
│ ├── package.json
|
|
41
|
+
│ └── src/
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Folder Purposes
|
|
45
|
+
|
|
46
|
+
### Root Level
|
|
47
|
+
- **`.descix/workspace.json`**: The source of truth for which apps are active in this workspace. Generated by the PWA Setup Flow.
|
|
48
|
+
- **`.descix/wallet.json`**: Your authentication credentials.
|
|
49
|
+
|
|
50
|
+
### Community Level (`[Community_ID]/`)
|
|
51
|
+
Contains all apps belonging to a specific community.
|
|
52
|
+
- **`community_assets/`**: Metadata for the community itself (branding, description).
|
|
53
|
+
|
|
54
|
+
### App Level (`[Community_ID]/[App_ID]/`)
|
|
55
|
+
Self-contained folder for a single application.
|
|
56
|
+
|
|
57
|
+
#### `assets/` - App Identity
|
|
58
|
+
- **`app_description.md`**: Public description for the App Store.
|
|
59
|
+
- **`system_instructions.md`**: Instructions for the AI Agent that interacts with users of this app.
|
|
60
|
+
- **`icon.png`**: App Icon.
|
|
61
|
+
|
|
62
|
+
#### `kb/` - Knowledge Base
|
|
63
|
+
The KB folder supports both local-first (Git mode) and Drive-based workflows:
|
|
64
|
+
- **`staging/`**: Place raw files here (PDFs, images) to push them to Drive via `descix kb push`.
|
|
65
|
+
- **`General/`**: The canonical source of text content. Files here are pulled from Drive and converted to Markdown via `descix kb pull`.
|
|
66
|
+
- **`chunks/`**: Processed JSON chunk files ready for vectorization via `descix kb sync`.
|
|
67
|
+
|
|
68
|
+
**CLI-Centric Processing (Git Mode):**
|
|
69
|
+
```bash
|
|
70
|
+
descix kb push # Push staging/ -> Drive
|
|
71
|
+
descix kb pull # Pull Drive -> General/ (converted to markdown)
|
|
72
|
+
descix kb chunk # Generate chunks from General/ -> chunks/
|
|
73
|
+
descix kb sync # Push chunks to Pinecone via service layer
|
|
74
|
+
descix kb build # Convenience: pull → chunk → sync
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### `site/` - Frontend
|
|
78
|
+
- Contains the static website or Single Page Application (SPA).
|
|
79
|
+
- **`index.html`**: Entry point.
|
|
80
|
+
|
|
81
|
+
#### `microservice/` - Backend
|
|
82
|
+
- Contains the server-side logic.
|
|
83
|
+
- **`Dockerfile`**: Defines the runtime environment.
|
|
84
|
+
- **`src/`**: Source code.
|
|
85
|
+
|
|
86
|
+
## Configuration Files
|
|
87
|
+
|
|
88
|
+
### `.descix/workspace.json` (Root)
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"version": "2.0",
|
|
92
|
+
"communities": {
|
|
93
|
+
"my-dao": {
|
|
94
|
+
"apps": {
|
|
95
|
+
"governance": {
|
|
96
|
+
"localPath": "my-dao/governance",
|
|
97
|
+
"sync_mode": "git"
|
|
98
|
+
},
|
|
99
|
+
"treasury": {
|
|
100
|
+
"localPath": "my-dao/treasury",
|
|
101
|
+
"sync_mode": "drive"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**`sync_mode` Options:**
|
|
110
|
+
| Mode | KB Source | Use Case |
|
|
111
|
+
|------|-----------|----------|
|
|
112
|
+
| `git` | Local files | CLI-managed apps, developers (default for CLI) |
|
|
113
|
+
| `drive` | Pull from Drive | PWA-created apps, non-technical users |
|
|
114
|
+
|
|
115
|
+
**Note:** The CLI only supports `git` mode operations. If you are using the CLI, you are effectively in `git` mode.
|
|
116
|
+
|
|
117
|
+
## Agent Workflow for Migration
|
|
118
|
+
|
|
119
|
+
When encountering an unstructured project:
|
|
120
|
+
|
|
121
|
+
1. **Analyze**: Identify which files belong to Frontend (`site`), Backend (`microservice`), or Documentation (`kb`).
|
|
122
|
+
2. **Scaffold**: Create the standard folder structure if missing.
|
|
123
|
+
3. **Move**: Relocate files into their respective folders.
|
|
124
|
+
4. **Refactor**: Update relative import paths in the code to reflect the new locations.
|
|
125
|
+
5. **Update Config**: Ensure `workspace.json` has the correct app mappings.
|