@descix/cli 1.0.5 → 1.0.7

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 (46) hide show
  1. package/README.md +130 -34
  2. package/agent-assets/guides/dynamic-site-pattern.md +10 -14
  3. package/agent-assets/guides/knowledge-only-pattern.md +11 -15
  4. package/agent-assets/guides/microservice-pattern.md +12 -14
  5. package/agent-assets/guides/static-site-pattern.md +12 -15
  6. package/agent-assets/instructions/onboarding-flow.md +4 -4
  7. package/agent-assets/reference/app-creation.md +36 -101
  8. package/agent-assets/reference/architecture.md +24 -27
  9. package/agent-assets/reference/local-dev.md +0 -4
  10. package/agent-assets/reference/mcp-integration.md +14 -22
  11. package/agent-assets/reference/workspace-config.md +97 -340
  12. package/agent-assets/rules/descix_mcp.template.mdc +1 -1
  13. package/bin/descix.js +159 -98
  14. package/lib/api-client.js +30 -22
  15. package/lib/commands/airdrop.js +10 -0
  16. package/lib/commands/auth.js +33 -3
  17. package/lib/commands/briefer/index.js +8 -5
  18. package/lib/commands/config.js +13 -31
  19. package/lib/commands/corpus.js +161 -54
  20. package/lib/commands/health.js +116 -21
  21. package/lib/commands/init.js +25 -48
  22. package/lib/commands/kb.js +14 -4
  23. package/lib/commands/update.js +0 -1
  24. package/lib/core/Chunker.js +1 -1
  25. package/lib/core/CorpusWalker.js +238 -47
  26. package/lib/core/Hydrator.js +88 -11
  27. package/lib/core/ManifestLoader.js +68 -0
  28. package/lib/core/Syncer.js +147 -46
  29. package/lib/interactive.js +158 -0
  30. package/lib/origin.js +3 -3
  31. package/lib/wallet-file.js +36 -37
  32. package/lib/wizard/setup.js +104 -22
  33. package/lib/workspace-config.js +325 -167
  34. package/lib/workspace-identity.js +0 -1
  35. package/package.json +3 -3
  36. package/templates/agent-claude.md +0 -3
  37. package/templates/agent-cline.md +0 -3
  38. package/templates/agent-copilot.md +0 -3
  39. package/templates/agent-cursor.md +0 -3
  40. package/templates/drive/app/kb/General/README.md +1 -1
  41. package/templates/drive_templates/agent_app_template/kb/General/README.md +1 -1
  42. package/templates/scaffolds/microservice/SERVICE_README_sdk.md +3 -3
  43. package/templates/scaffolds/microservice/defaults-config.json +3 -1
  44. package/templates/scaffolds/microservice/manifest.json +9 -5
  45. package/templates/scaffolds/microservice/package.json +1 -1
  46. package/templates/scaffolds/microservice/services/commandHandlers/sampleCommands.js +2 -2
package/README.md CHANGED
@@ -15,11 +15,12 @@ npm install -g @descix/cli
15
15
  descix login
16
16
  ```
17
17
 
18
- 2. **Setup your workspace**:
18
+ 2. **Initialize your workspace**:
19
19
  ```bash
20
- descix setup
20
+ descix init
21
21
  ```
22
- This will guide you through connecting your Google Drive and setting up your local environment.
22
+ This writes `.descix/workspace.json` for the current project. Pass `-c <community_id> -a <app_id>`
23
+ to pre-fill the app context, or `--from-invite <token>` to resolve an invite token.
23
24
 
24
25
  **Choosing an environment**:
25
26
  The `--dev` flag has been REMOVED. Its absence silently meant production, so the most common
@@ -58,40 +59,129 @@ Best for platform admins or agencies managing multiple communities.
58
59
  ## Core Commands
59
60
 
60
61
  - `descix login`: Authenticate with the platform.
61
- - `descix setup`: Initialize or repair your workspace configuration.
62
62
  - `descix status`: View your current environment status and workspace mode.
63
- - `descix init`: Create `.descix/workspace.json` for the current project.
64
- - `descix app create`: Show instructions; use `--quick -c <community> -a <name>` for template-only app creation, or use PWA / `descix-admin app create`.
65
- - `descix sync`: Sync content to the platform (Site, Assets).
66
- - `descix kb`: Manage Knowledge Base content (Pull -> Chunk -> Sync).
63
+ - `descix init`: Initialize workspace for DeSciX app development (Git-aware) — writes `.descix/workspace.json`.
64
+ - `descix app init`: Create (when it does not exist yet) and initialize an app — the one path to an app. See [Creating an App](#creating-an-app).
65
+ - `descix site init` / `descix site upload`: Scaffold an app's site, then build and deploy it. See [Deploying a Site](#deploying-a-site).
66
+ - `descix app sync-assets`: Sync local assets (`system_instructions.md`, `app_description.md`, `icon.png`) to the platform.
67
+ - `descix drive pull` / `descix drive push`: Drive content authoring — pull from Drive to local markdown, push staging back to Drive.
68
+ - `descix kb`: Manage Knowledge Bases (`list`, `create`, `delete`, and `corpus sync`).
67
69
 
68
70
  ## Knowledge Base Management (Git Mode)
69
71
 
70
- For apps managed via CLI (Git Mode), use the following commands to process your Knowledge Base locally:
72
+ The CLI exposes exactly ONE knowledge-base sync surface: `descix kb corpus sync`, driven by a
73
+ git-tracked corpus manifest. The older four-step local pipeline has been REMOVED — its invocations
74
+ now exit non-zero and name this replacement.
71
75
 
72
- 1. **Pull**: Fetch source documents from Drive.
76
+ 1. **Create** the knowledge base (once per KB):
73
77
  ```bash
74
- descix kb pull
78
+ descix kb create -c <community_id> -a <app_id> -k <kb_name>
75
79
  ```
76
- 2. **Chunk**: Process documents into chunks locally.
80
+ 2. **Author** a corpus manifest at `.descix/manifests/<kb_name>.json` describing the sources to sync.
81
+ 3. **Sync** the corpus to the platform (Pinecone):
77
82
  ```bash
78
- descix kb chunk
79
- ```
80
- 3. **Sync**: Push chunks to the platform (Pinecone).
81
- ```bash
82
- descix kb sync
83
- ```
84
- 4. **Build**: Run the full pipeline (Pull -> Chunk -> Sync).
85
- ```bash
86
- descix kb build
83
+ descix kb corpus sync -a <app_id> [-k <kb_name>]
87
84
  ```
85
+ It walks the git blobs at the manifest's ref, so only changed files are re-vectorized. Useful
86
+ flags: `--dry-run` (report drift, write nothing), `--show-walk` (print the resolved ref and the
87
+ files it would walk), `--ref <ref>` (override the git ref for all manifest sources).
88
+
89
+ To fetch source documents from Google Drive into local markdown, use `descix drive pull`.
90
+
91
+ ## Creating an App
92
+
93
+ `descix app init` is the one path to an app. It creates the app on the platform when it does not
94
+ exist yet, then registers and scaffolds it locally — one command, not two.
95
+
96
+ ```bash
97
+ descix app init -a <name> -c <community>
98
+ ```
99
+
100
+ Pass `-c` to create a new app in that community. **Omit `-c` to initialize an app that already
101
+ exists** — the CLI resolves the app from the Products registry and only does the local half.
102
+
103
+ The command is idempotent, so re-running it on a half-made app finishes the job.
104
+
105
+ **Options:**
106
+
107
+ - `-a, --app <app_id>` (required): the app ID. With `-c`, this is the app NAME to create.
108
+ - `-c, --community <id>`: the community to create the app in. It must already be materialized in
109
+ this environment. Required only for creation.
110
+ - `-s, --short <short_name>`: the short id segment (no hyphens). The `app_id` is composed
111
+ **server-side** as `{community}-{short}`; defaults to `--app`.
112
+ - `--overwrite`: when creating, overwrite an existing app record intentionally.
113
+ - `--kb <name>`: knowledge base name (default: `General`).
114
+ - `-p, --path <dir>`: local app directory (default: auto-detected, else the current directory).
115
+
116
+ **What it does, in order:**
117
+
118
+ 1. **Creates the app** (only when `-c` is given and the app does not exist): the server composes
119
+ the unique `app_id` and writes `Products/{app_id}` and `Community/{community}/Apps/{app_id}`.
120
+ Every app is guaranteed a default knowledge base at creation.
121
+ 2. **Registers it in `.descix/workspace.json`** if it is not already mapped.
122
+ 3. **Scaffolds the app folder**: creates `site/`, `microservice/` and `assets/`, and writes
123
+ `assets/system_instructions.md` and `assets/app_description.md` when they do not exist.
124
+ 4. **Creates the knowledge base record** for Git-mode sync.
125
+
126
+ It fails loud rather than guessing: initializing an app that does not exist without `-c` names the
127
+ `-c` invocation that would create it; a `-c` that disagrees with the app's real community is
128
+ refused; and `-p` against an already-mapped app names `descix app set-localpath` instead.
88
129
 
89
- ## Provisioning
130
+ **Next step** — author a corpus manifest at `.descix/manifests/<kb_name>.json`, then
131
+ `descix kb corpus sync -a <app_id>`.
90
132
 
91
- **Communities and apps are created in the PWA** (Workspace Config / Device Setup / App Manager) or via **Admin CLI** (`descix-admin community create`, `descix-admin app create`) for platform admins. The user CLI does not create communities or full app structures; use `descix init` to write `.descix/workspace.json` and PWA or Admin CLI to create entities.
133
+ Creating a **community** is a separate, admin-only operation: `descix community create` requires
134
+ platform-admin membership and deploys a real ERC-20 token contract to live Polygon. App developers
135
+ work inside a community that already exists.
92
136
 
93
- 1. Create your App in the PWA (Workspace Builder).
94
- 2. Run `descix setup` to hydrate your local folder structure.
137
+ ## Deploying a Site
138
+
139
+ An app's site is scaffolded, then uploaded. `descix site upload` is the deploy verb — there is no
140
+ `descix site deploy`.
141
+
142
+ ```bash
143
+ descix site init # scaffold site/ (optional — upload works on any site directory)
144
+ descix site upload --env dev
145
+ ```
146
+
147
+ ### `descix site init`
148
+
149
+ Copies the site scaffold — `index.html`, `app.js`, `styles.css`, `DeSciXAppSDK.js`, `README.md` —
150
+ into the app's `site/` directory. The app must already be mapped in `.descix/workspace.json`.
151
+
152
+ - `-f, --force`: overwrite an existing `site/` folder.
153
+ - `-c, --community <id>` / `-a, --app <id>`: auto-detected from context when omitted.
154
+
155
+ It scaffolds site content only; it writes no manifest. Skip it entirely if you already have a site.
156
+
157
+ ### `descix site upload`
158
+
159
+ Builds (when a manifest declares a build) and uploads the site to GCS, then updates the app's
160
+ metadata. Files are uploaded straight to GCS with short-lived **signed URLs** issued by
161
+ `get_site_deploy_token`; `confirm_site_deploy` then records the deploy and returns the site URL.
162
+
163
+ - `-p, --path <localPath>`: directory to deploy (default `./site`). **Ignored when a site manifest
164
+ exists.**
165
+ - `--preview`: deploy to the preview path.
166
+ - `--full`: force a full upload, ignoring the unchanged-file delta.
167
+ - `--dry-run`: show what would be deployed.
168
+ - `--no-cache`: set `Cache-Control: no-cache`.
169
+ - `-c, --community <id>` / `-a, --app <id>`: auto-detected from context when omitted.
170
+
171
+ **Site deploys target a cloud environment.** An upload that resolves to a local backend without
172
+ this invocation naming its target is refused — pass `--env <dev|demo|prod>`.
173
+
174
+ **Manifest-driven builds.** When `{app_root}/.descix/manifests/site.json` exists it takes over from
175
+ `-p`. Author it yourself; nothing generates it for you. It declares the sources to walk and,
176
+ optionally, a `buildCommand`, which runs in the app root with the environment-specific `VITE_*`
177
+ build variables the server returns injected into its environment:
178
+
179
+ ```json
180
+ {
181
+ "sources": [{ "path": "site/dist", "include": ["**/*"] }],
182
+ "buildCommand": "npm run build --prefix site"
183
+ }
184
+ ```
95
185
 
96
186
  ## Airdrop Admin Operations (WS-ADMIN-B1)
97
187
 
@@ -103,25 +193,31 @@ Admin-only commands for triggering airdrop migration batch runs. Per CEO-D-MANUA
103
193
 
104
194
  Manually trigger the server-side `airdrop_execute_queue` command on the target environment. Assembles `pending_migrations` rows into per-community batches and (when `BATCH_UPDATE_BALANCES_BROADCAST_ENABLED=true`) broadcasts to the Powch HD wallet. When the broadcast flag is off (default for DEV), batches are assembled but the downstream Powch handler returns `stopped_at_broadcast_boundary` — useful for verifying queue shape without spending MATIC.
105
195
 
196
+ **Read-only is the default.** Without `--apply`, the command runs as a dry run.
197
+
106
198
  **Options:**
107
199
 
200
+ - `--dry-run`: Read-only preview — encode calldata, estimate gas, validate the net-zero invariant. No PK, no transaction, no state mutation. Mutually exclusive with `--apply`.
201
+ - `--apply`: Live execution. Requires `--signer-pk-file` or the interactive prompt, and requires `--community`.
202
+ - `--community <slug>`: Community slug for per-community batch scoping. **Required for `--apply`**; optional in dry-run mode, where omitting it returns an aggregate preview across communities.
203
+ - `--signer-pk-file <path>`: Path to a file containing the admin signer PK (`0x` + 64 hex). Used for `--apply`; when omitted, the PK is requested at an interactive no-echo prompt. Inline PK flags and environment variables are rejected on security grounds (process-listing leak).
108
204
  - `--batch-size <n>`: Cap on users processed this run (server caps at `AIRDROP_MAX_RUN_USERS`; a larger `--batch-size` is clamped).
109
- - `--dry-run`: Assemble batches but skip the broadcast call entirely. Emits an `on_chain_log` row with `status: dry_run` for audit.
110
205
 
111
206
  **Examples:**
112
207
 
113
208
  ```bash
114
- # Dry run against DEV — safe to run repeatedly; no broadcast, no MATIC
209
+ # Dry run against DEV — safe to run repeatedly; no PK, no tx, no state mutation
115
210
  descix airdrop execute-queue --env dev --dry-run
116
211
 
117
- # Execute a capped real run (10 users max this invocation)
118
- descix airdrop execute-queue --env dev --batch-size 10
212
+ # Dry run scoped to one community
213
+ descix airdrop execute-queue --env dev --dry-run --community smile
119
214
 
120
- # Execute a full queue run (still gated by BATCH_UPDATE_BALANCES_BROADCAST_ENABLED)
121
- descix airdrop execute-queue --env dev
122
- ```
215
+ # Live execution, capped at 10 users this invocation (prompts for the signer PK)
216
+ descix airdrop execute-queue --env dev --apply --community smile --batch-size 10
123
217
 
124
- **Audit trail:** every invocation (dry-run or real) writes one `on_chain_log` row with `op.kind = "airdrop_execute_queue_trigger"` and `caller.operator_email = <invoking admin email>`.
218
+ # Live execution reading the signer PK from a file
219
+ descix airdrop execute-queue --env dev --apply --community smile --signer-pk-file ./signer.key
220
+ ```
125
221
 
126
222
  **Testing:**
127
223
 
@@ -131,4 +227,4 @@ cd DeSciX_Core/descix-cli && npm test
131
227
 
132
228
  ## Documentation
133
229
 
134
- For full documentation, please refer to the [DeSciX SDK Documentation](../../SERVICE_README_sdk.md).
230
+ For full documentation, please refer to the [DeSciX SDK Documentation](./SERVICE_README_sdk.md).
@@ -61,25 +61,21 @@ Keeping the scaffold's shape is what lets the service keep inheriting platform b
61
61
 
62
62
  ## Configuration (`workspace.json`)
63
63
 
64
+ One `env.products[]` entry, written by `descix app init` and `descix app set-port` (never by hand):
65
+
64
66
  ```json
65
67
  {
66
- "communities": {
67
- "my-community": {
68
- "apps": {
69
- "my-dynamic-app": {
70
- "localPath": "my-community/my-dynamic-app",
71
- "sync_mode": "git",
72
- "service": {
73
- "port": 4000,
74
- "devCommand": "npm run dev"
75
- }
76
- }
77
- }
78
- }
79
- }
68
+ "appId": "my-community-my-dynamic-app",
69
+ "communityId": "my-community",
70
+ "localPath": "my-dynamic-app",
71
+ "kbId": "General",
72
+ "microservice": { "port": 4001 }
80
73
  }
81
74
  ```
82
75
 
76
+ `descix microservice init` refuses to run until `microservice.port` is set: the gateway routes
77
+ `/s/<app_id>` to that port and the service must start on it.
78
+
83
79
  ## CLI Workflow
84
80
 
85
81
  ```bash
@@ -38,18 +38,15 @@ my-docs/
38
38
 
39
39
  ## Configuration (`workspace.json`)
40
40
 
41
+ One `env.products[]` entry, written by `descix app init` (never by hand); no `site` and no
42
+ `microservice` slot:
43
+
41
44
  ```json
42
45
  {
43
- "communities": {
44
- "my-community": {
45
- "apps": {
46
- "my-docs": {
47
- "localPath": "my-community/my-docs",
48
- "sync_mode": "git"
49
- }
50
- }
51
- }
52
- }
46
+ "appId": "my-community-my-docs",
47
+ "communityId": "my-community",
48
+ "localPath": "my-docs",
49
+ "kbId": "General"
53
50
  }
54
51
  ```
55
52
 
@@ -68,13 +65,12 @@ descix drive push -c <community> -a <app>
68
65
  # 4. Pull converted text back
69
66
  descix drive pull -c <community> -a <app>
70
67
 
71
- # 5. Chunk for RAG
72
- descix kb corpus sync -c <community> -a <app>
73
-
74
- # 6. Sync to Pinecone
75
- descix kb corpus sync -c <community> -a <app>
68
+ # 5. Commit the pulled markdown, name its folder in .descix/manifests/<KB>.json, then chunk + sync to Pinecone in one pass
69
+ descix kb corpus sync -a <app>
76
70
  ```
77
71
 
72
+ The git path needs no Drive at all: commit markdown, name it in the manifest, run step 5.
73
+
78
74
  ## Capabilities
79
75
 
80
76
  | Capability | Enabled |
@@ -85,25 +85,23 @@ out until something depends on the difference.
85
85
 
86
86
  ## Configuration (`workspace.json`)
87
87
 
88
+ One `env.products[]` entry, written by `descix app init`, `descix app set-port` and (for the optional
89
+ frontend) `descix app set-site` — never by hand:
90
+
88
91
  ```json
89
92
  {
90
- "communities": {
91
- "my-community": {
92
- "apps": {
93
- "my-service": {
94
- "localPath": "my-community/my-service",
95
- "sync_mode": "git",
96
- "service": {
97
- "port": 4000,
98
- "devCommand": "npm run start"
99
- }
100
- }
101
- }
102
- }
103
- }
93
+ "appId": "my-community-my-service",
94
+ "communityId": "my-community",
95
+ "localPath": "my-service",
96
+ "kbId": "General",
97
+ "site": { "static": "site" },
98
+ "microservice": { "port": 4001 }
104
99
  }
105
100
  ```
106
101
 
102
+ `descix microservice init` refuses to run until `microservice.port` is set: the gateway routes
103
+ `/s/<app_id>` to that port and the service must start on it.
104
+
107
105
  ## CLI Workflow
108
106
 
109
107
  ```bash
@@ -45,25 +45,22 @@ my-site/
45
45
 
46
46
  ## Configuration (`workspace.json`)
47
47
 
48
+ One `env.products[]` entry, written by `descix app init` and `descix app set-site` (never by hand):
49
+
48
50
  ```json
49
51
  {
50
- "communities": {
51
- "my-community": {
52
- "apps": {
53
- "my-site": {
54
- "localPath": "my-community/my-site",
55
- "sync_mode": "git",
56
- "site": {
57
- "port": 3000,
58
- "devCommand": "npm run docs:dev"
59
- }
60
- }
61
- }
62
- }
63
- }
52
+ "appId": "my-community-my-site",
53
+ "communityId": "my-community",
54
+ "localPath": "my-site",
55
+ "kbId": "General",
56
+ "site": { "static": "site" }
64
57
  }
65
58
  ```
66
59
 
60
+ For a framework dev server instead of files on disk, `descix app set-site -a <app_id> --port 3000`
61
+ writes `"site": { "port": 3000 }`; the gateway proxies `/p/<app_id>` to it without rewriting paths,
62
+ so the framework's base path must be `/p/<app_id>/`.
63
+
67
64
  ## CLI Workflow
68
65
 
69
66
  ```bash
@@ -116,4 +113,4 @@ This copies the site template with:
116
113
 
117
114
  ## Deployment
118
115
 
119
- Static files are deployed to Google Cloud Storage and served via signed URLs. The site URL is available in the app's metadata.
116
+ `descix site upload -a <app_id>` uploads the files (delta) to the app's site prefix in Google Cloud Storage and records the deploy manifest. The app is then served on its own host, `https://<app_id>.dev.descix.net/` on DEV and `https://<app_id>.descix.net/` on PROD; `descix site status -c <community> -a <app_id>` shows the deployed manifest.
@@ -17,13 +17,13 @@ Purpose: Maps local folders to DeSciX apps and stores all configuration.
17
17
  ```json
18
18
  {
19
19
  "version": "2.0",
20
- "primaryCommunity": "descix",
20
+ "primaryCommunity": "daita",
21
21
  "communities": {
22
- "descix": {
22
+ "daita": {
23
23
  "apps": {
24
24
  "appsdk": {
25
- "localPath": "descix/appsdk",
26
- "absolutePath": "/path/to/workspace/descix/appsdk",
25
+ "localPath": "daita/appsdk",
26
+ "absolutePath": "/path/to/workspace/daita/appsdk",
27
27
  "kbId": "General"
28
28
  }
29
29
  }
@@ -4,16 +4,17 @@
4
4
  **Version:** 2.0
5
5
  **Last Updated:** January 2026
6
6
 
7
- This document describes how apps and communities are created and hydrated in the DeSciX platform.
7
+ This document describes how apps and communities are created in the DeSciX platform and how the local workspace for an app is set up.
8
8
 
9
9
  ---
10
10
 
11
11
  ## 1. Core Philosophy
12
12
 
13
- **"PWA for Provisioning, CLI for Development"**
13
+ **"One path to an app"**
14
14
 
15
- - **Provisioning:** All apps and communities are created through the PWA. This enforces entitlement checks (NFTs, subscriptions) and ensures consistent folder structures via Drive templates.
16
- - **Development:** The CLI is the primary tool for hydrating the local workspace, managing content, and syncing to the cloud. The CLI does not create apps directly.
15
+ - **Apps:** `descix app init -a <name> -c <community> -p <dir>` creates the app on the platform (`create_app_for_community`, which composes the id `<community>-<short>` and guarantees the default KB) and registers it in the local workspace in one idempotent step. The PWA creates apps too; both reach the same server command. Entitlement checks run server-side either way.
16
+ - **Communities:** created by platform admins only (`descix community create` is `[ADMIN]` and writes live Polygon). A developer builds inside an existing community.
17
+ - **Development:** the CLI is the tool for the local workspace, content, and syncing to the cloud.
17
18
 
18
19
  **Important Distinction:**
19
20
 
@@ -128,7 +129,7 @@ the file to open first.
128
129
 
129
130
  ### Adding Scaffolds to Apps
130
131
 
131
- After an app is created via PWA, add code scaffolds via CLI:
132
+ After `descix app init` (or PWA creation), add code scaffolds via CLI:
132
133
 
133
134
  ```bash
134
135
  # Add site scaffold
@@ -213,96 +214,29 @@ sequenceDiagram
213
214
 
214
215
  ---
215
216
 
216
- ## 4. Workspace Builder
217
+ ## 4. Local Workspace
217
218
 
218
- The PWA Workspace Builder allows users to configure which apps to sync to their local workspace.
219
-
220
- ### Flow
221
-
222
- 1. User completes device login (`descix login --setup`)
223
- 2. PWA opens with Workspace Builder
224
- 3. User selects/creates apps to include
225
- 4. PWA returns `workspace_config` to CLI
226
- 5. CLI hydrates local folders
227
-
228
- ### Workspace Config Response
229
-
230
- ```json
231
- {
232
- "workspace_config": {
233
- "communities": {
234
- "descix": {
235
- "apps": {
236
- "agent": {
237
- "localPath": "descix/agent",
238
- "sync_mode": "git"
239
- }
240
- }
241
- }
242
- }
243
- },
244
- "drive_config": {
245
- "base_folder_id": "1ABC..."
246
- }
247
- }
248
- ```
249
-
250
- ---
251
-
252
- ## 5. CLI Hydration
253
-
254
- ### Setup Command
219
+ There is no PWA "workspace builder" hand-off and no hydration step. The local workspace is built by
220
+ CLI verbs, each writing one part of `.descix/workspace.json` (v2.1 — see `workspace-config.md`):
255
221
 
256
222
  ```bash
257
- descix mcp quickstart
223
+ descix config init --env dev # creates .descix/workspace.json, pins env.apiUrl
224
+ descix login # .descix/wallet.json (add it to .gitignore yourself)
225
+ descix app init -a <name> -c <community> -p . # env.products[] entry + site/ microservice/ assets/ + default KB
226
+ descix app set-site -a <app_id> --static site # what the gateway serves at /p/<app_id>
227
+ descix app set-port -a <app_id> -p 4001 # required before descix microservice init
258
228
  ```
259
229
 
260
- **Flow:**
261
- 1. Check prerequisites (gcloud CLI, ADC)
262
- 2. Verify Drive access
263
- 3. Open browser for device login
264
- 4. Receive workspace config from PWA
265
- 5. Call `Hydrator.hydrateWorkspace()`
266
- 6. Create local folder structure
267
- 7. Pull content from Drive
268
-
269
- ### Hydration Process
270
-
271
- The `Hydrator` module handles all folder creation and content sync:
272
-
273
- ```javascript
274
- // Hydrator.hydrateWorkspace() creates:
275
- [workspace]/
276
- ├── .descix/
277
- │ └── workspace.json # Workspace configuration (sole config file)
278
- ├── [community]/[app]/
279
- │ ├── assets/
280
- │ ├── kb/
281
- │ │ ├── staging/ # For local files to push to Drive
282
- │ │ ├── General/ # Converted text from Drive
283
- │ │ └── chunks/ # Generated chunk files
284
- │ ├── site/ # Optional: for CodeSite
285
- │ └── microservice/ # Optional: for backend service
286
- └── .gitignore # Updated with .descix/wallet.json
287
- ```
288
-
289
- **Note:** App configuration is stored in `workspace.json`, not in per-app `context.json` files. The CLI auto-detects app context based on the current working directory.
290
-
291
- ### Hydrating Individual Apps
292
-
293
- After initial setup, users can hydrate specific apps:
294
-
295
- ```bash
296
- # Pull entire app from Drive
297
- descix drive pull -c community -a app
298
-
299
- # Or use the build command for full pipeline
300
- descix kb corpus sync
301
- ```
230
+ `descix app init` creates `site/`, `microservice/` and `assets/` (with starter
231
+ `system_instructions.md` and `app_description.md`) under the app directory. Knowledge-base content
232
+ is whatever your corpus manifest names (`.descix/manifests/<KB>.json`); Drive content arrives via
233
+ `descix drive pull -c <community> -a <app_id>` into `kb/<KB>/` and goes back via `descix drive push`.
234
+ The CLI auto-detects the app from the directory you are standing in; `-c`/`-a` flags win over
235
+ detection.
302
236
 
303
237
  ---
304
238
 
305
- ## 6. Folder Structure Standards
239
+ ## 5. Folder Structure Standards
306
240
 
307
241
  ### App Folders
308
242
 
@@ -328,7 +262,7 @@ descix kb corpus sync
328
262
 
329
263
  ---
330
264
 
331
- ## 7. Entitlement Checks
265
+ ## 6. Entitlement Checks
332
266
 
333
267
  App creation requires appropriate entitlements:
334
268
 
@@ -343,7 +277,7 @@ The PWA and backend enforce these checks before template copying.
343
277
 
344
278
  ---
345
279
 
346
- ## 8. Key Backend Functions
280
+ ## 7. Key Backend Functions
347
281
 
348
282
  ### Template Copying
349
283
 
@@ -366,28 +300,29 @@ async function copyFolderRecursive(sourceFolderId, destParentId, newName) {
366
300
 
367
301
  ---
368
302
 
369
- ## 9. CLI Commands
303
+ ## 8. CLI Commands
370
304
 
371
- ### App Management (via PWA)
305
+ ### App Creation
372
306
 
373
- The CLI does not create apps directly. Users should:
307
+ ```bash
308
+ descix config init --env dev # pin the environment first (no default)
309
+ descix login # device-code sign-in
310
+ descix app init -a <name> -c <community> -p . # create on the platform + register locally + default KB
311
+ ```
374
312
 
375
- 1. Go to PWA dashboard
376
- 2. Create app/community
377
- 3. Run `descix mcp quickstart` or `descix login --setup` to hydrate
313
+ An app created in the PWA is initialized locally with the same verb, minus `-c`:
314
+ `descix app init -a <app_id> -p .`.
378
315
 
379
316
  ### Post-Creation Commands
380
317
 
381
318
  ```bash
382
- # After app is created via PWA:
383
- descix mcp quickstart # Hydrate workspace (first time)
384
- descix kb corpus sync # Pull, chunk, sync KB
385
- descix site upload -a app # Deploy static site
319
+ descix kb corpus sync -a <app_id> # chunk + sync the manifest's sources to Pinecone
320
+ descix site upload -a <app_id> # deploy the static site
386
321
  ```
387
322
 
388
323
  ---
389
324
 
390
- ## 10. File References
325
+ ## 9. File References
391
326
 
392
327
  | Component | Path | Description |
393
328
  |-----------|------|-------------|
@@ -397,7 +332,7 @@ descix site upload -a app # Deploy static site
397
332
  | Template Config | `DeSciX_Cloud/microservice/defaults-config.json` | Template folder IDs |
398
333
  | Drive Templates | `DeSciX_Core/descix-cli/templates/drive/` | Content templates |
399
334
  | Git Scaffolds | `DeSciX_Core/descix-cli/templates/scaffolds/` | Code scaffolds |
400
- | Hydrator | `DeSciX_Core/descix-cli/lib/core/Hydrator.js` | Workspace hydration |
335
+ | Hydrator | `DeSciX_Core/descix-cli/lib/core/Hydrator.js` | `copyScaffold` — copies the site / microservice scaffold into an app |
401
336
  | WorkspaceConfig | `DeSciX_Core/descix-cli/lib/workspace-config.js` | CLI configuration |
402
337
  | Setup Command | `DeSciX_Core/descix-cli/lib/wizard/setup.js` | Initial setup |
403
338
  | Scaffold Command | `DeSciX_Core/descix-cli/bin/descix.js` | CLI scaffolds |