primitive-admin 1.1.0-alpha.34 → 1.1.0-alpha.36

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 (153) hide show
  1. package/README.md +129 -10
  2. package/assets/skill/skills/primitive-platform/SKILL.md +85 -30
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +66 -1
  5. package/dist/bin/primitive.js.map +1 -1
  6. package/dist/src/commands/admins.d.ts +2 -0
  7. package/dist/src/commands/admins.js +25 -27
  8. package/dist/src/commands/admins.js.map +1 -1
  9. package/dist/src/commands/analytics.d.ts +2 -0
  10. package/dist/src/commands/apps.d.ts +2 -0
  11. package/dist/src/commands/apps.js +28 -0
  12. package/dist/src/commands/apps.js.map +1 -1
  13. package/dist/src/commands/auth.d.ts +2 -0
  14. package/dist/src/commands/blob-buckets.d.ts +2 -0
  15. package/dist/src/commands/blob-buckets.js +30 -26
  16. package/dist/src/commands/blob-buckets.js.map +1 -1
  17. package/dist/src/commands/catalog.d.ts +2 -0
  18. package/dist/src/commands/catalog.js +17 -18
  19. package/dist/src/commands/catalog.js.map +1 -1
  20. package/dist/src/commands/collection-type-configs.d.ts +2 -0
  21. package/dist/src/commands/collection-type-configs.js +9 -9
  22. package/dist/src/commands/collection-type-configs.js.map +1 -1
  23. package/dist/src/commands/collections.d.ts +2 -0
  24. package/dist/src/commands/collections.js +33 -36
  25. package/dist/src/commands/collections.js.map +1 -1
  26. package/dist/src/commands/comparisons.d.ts +2 -0
  27. package/dist/src/commands/cron-triggers.d.ts +2 -0
  28. package/dist/src/commands/cron-triggers.js +8 -15
  29. package/dist/src/commands/cron-triggers.js.map +1 -1
  30. package/dist/src/commands/database-types.d.ts +2 -0
  31. package/dist/src/commands/database-types.js +17 -18
  32. package/dist/src/commands/database-types.js.map +1 -1
  33. package/dist/src/commands/databases.d.ts +2 -0
  34. package/dist/src/commands/databases.js +72 -45
  35. package/dist/src/commands/databases.js.map +1 -1
  36. package/dist/src/commands/documents.d.ts +2 -0
  37. package/dist/src/commands/documents.js +17 -18
  38. package/dist/src/commands/documents.js.map +1 -1
  39. package/dist/src/commands/email-templates.d.ts +2 -0
  40. package/dist/src/commands/email-templates.js +9 -9
  41. package/dist/src/commands/email-templates.js.map +1 -1
  42. package/dist/src/commands/env.d.ts +12 -0
  43. package/dist/src/commands/group-type-configs.d.ts +2 -0
  44. package/dist/src/commands/group-type-configs.js +9 -9
  45. package/dist/src/commands/group-type-configs.js.map +1 -1
  46. package/dist/src/commands/groups.d.ts +2 -0
  47. package/dist/src/commands/groups.js +17 -18
  48. package/dist/src/commands/groups.js.map +1 -1
  49. package/dist/src/commands/guides.d.ts +84 -0
  50. package/dist/src/commands/guides.js +201 -24
  51. package/dist/src/commands/guides.js.map +1 -1
  52. package/dist/src/commands/init.d.ts +17 -0
  53. package/dist/src/commands/init.js +63 -25
  54. package/dist/src/commands/init.js.map +1 -1
  55. package/dist/src/commands/integrations.d.ts +2 -0
  56. package/dist/src/commands/integrations.js +39 -23
  57. package/dist/src/commands/integrations.js.map +1 -1
  58. package/dist/src/commands/llm.d.ts +2 -0
  59. package/dist/src/commands/llm.js +4 -2
  60. package/dist/src/commands/llm.js.map +1 -1
  61. package/dist/src/commands/prompts.d.ts +2 -0
  62. package/dist/src/commands/prompts.js +33 -36
  63. package/dist/src/commands/prompts.js.map +1 -1
  64. package/dist/src/commands/rule-sets.d.ts +2 -0
  65. package/dist/src/commands/rule-sets.js +9 -9
  66. package/dist/src/commands/rule-sets.js.map +1 -1
  67. package/dist/src/commands/secrets.d.ts +2 -0
  68. package/dist/src/commands/skill.d.ts +2 -0
  69. package/dist/src/commands/sync.d.ts +99 -0
  70. package/dist/src/commands/sync.js +437 -31
  71. package/dist/src/commands/sync.js.map +1 -1
  72. package/dist/src/commands/tokens.d.ts +2 -0
  73. package/dist/src/commands/tokens.js +113 -10
  74. package/dist/src/commands/tokens.js.map +1 -1
  75. package/dist/src/commands/users.d.ts +2 -0
  76. package/dist/src/commands/users.js +41 -45
  77. package/dist/src/commands/users.js.map +1 -1
  78. package/dist/src/commands/waitlist.d.ts +2 -0
  79. package/dist/src/commands/waitlist.js +10 -10
  80. package/dist/src/commands/waitlist.js.map +1 -1
  81. package/dist/src/commands/webhooks.d.ts +2 -0
  82. package/dist/src/commands/webhooks.js +9 -9
  83. package/dist/src/commands/webhooks.js.map +1 -1
  84. package/dist/src/commands/workflows.d.ts +49 -0
  85. package/dist/src/commands/workflows.js +136 -57
  86. package/dist/src/commands/workflows.js.map +1 -1
  87. package/dist/src/lib/api-client.d.ts +1229 -0
  88. package/dist/src/lib/api-client.js +44 -11
  89. package/dist/src/lib/api-client.js.map +1 -1
  90. package/dist/src/lib/auth-flow.d.ts +8 -0
  91. package/dist/src/lib/cli-manifest.d.ts +60 -0
  92. package/dist/src/lib/cli-manifest.js +70 -0
  93. package/dist/src/lib/cli-manifest.js.map +1 -0
  94. package/dist/src/lib/config.d.ts +37 -0
  95. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  96. package/dist/src/lib/confirm-prompt.js +110 -0
  97. package/dist/src/lib/confirm-prompt.js.map +1 -0
  98. package/dist/src/lib/constants.d.ts +2 -0
  99. package/dist/src/lib/crash-handlers.d.ts +20 -0
  100. package/dist/src/lib/crash-handlers.js +49 -0
  101. package/dist/src/lib/crash-handlers.js.map +1 -0
  102. package/dist/src/lib/credentials-store.d.ts +79 -0
  103. package/dist/src/lib/csv.d.ts +48 -0
  104. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  105. package/dist/src/lib/db-codegen/dbGenerator.d.ts +111 -0
  106. package/dist/src/lib/db-codegen/dbNaming.d.ts +45 -0
  107. package/dist/src/lib/db-codegen/dbTemplates.d.ts +97 -0
  108. package/dist/src/lib/db-codegen/dbTemplates.js +31 -10
  109. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  110. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +78 -0
  111. package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
  112. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  113. package/dist/src/lib/env-resolver.d.ts +62 -0
  114. package/dist/src/lib/fetch.d.ts +5 -0
  115. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  116. package/dist/src/lib/generated-allowlist.js +181 -0
  117. package/dist/src/lib/generated-allowlist.js.map +1 -0
  118. package/dist/src/lib/init-config.d.ts +46 -0
  119. package/dist/src/lib/init-config.js +7 -0
  120. package/dist/src/lib/init-config.js.map +1 -1
  121. package/dist/src/lib/migration-nag.d.ts +49 -0
  122. package/dist/src/lib/output.d.ts +49 -0
  123. package/dist/src/lib/output.js +25 -1
  124. package/dist/src/lib/output.js.map +1 -1
  125. package/dist/src/lib/paginate.d.ts +33 -0
  126. package/dist/src/lib/project-config.d.ts +97 -0
  127. package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
  128. package/dist/src/lib/resolve-platform.d.ts +45 -0
  129. package/dist/src/lib/resolve-platform.js +43 -0
  130. package/dist/src/lib/resolve-platform.js.map +1 -0
  131. package/dist/src/lib/skill-installer.d.ts +23 -0
  132. package/dist/src/lib/snapshots.d.ts +99 -0
  133. package/dist/src/lib/snapshots.js +357 -0
  134. package/dist/src/lib/snapshots.js.map +1 -0
  135. package/dist/src/lib/sync-paths.d.ts +72 -0
  136. package/dist/src/lib/sync-paths.js +29 -1
  137. package/dist/src/lib/sync-paths.js.map +1 -1
  138. package/dist/src/lib/template.d.ts +93 -0
  139. package/dist/src/lib/token-inject.d.ts +56 -0
  140. package/dist/src/lib/token-inject.js +204 -0
  141. package/dist/src/lib/token-inject.js.map +1 -0
  142. package/dist/src/lib/toml-database-config.d.ts +132 -0
  143. package/dist/src/lib/toml-params-validator.d.ts +95 -0
  144. package/dist/src/lib/version-check.d.ts +10 -0
  145. package/dist/src/lib/workflow-fragments.d.ts +41 -0
  146. package/dist/src/lib/workflow-toml-validator.d.ts +95 -0
  147. package/dist/src/lib/workflow-toml-validator.js +71 -130
  148. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  149. package/dist/src/types/index.d.ts +513 -0
  150. package/dist/src/validators.d.ts +64 -0
  151. package/dist/src/validators.js +63 -0
  152. package/dist/src/validators.js.map +1 -0
  153. package/package.json +11 -2
package/README.md CHANGED
@@ -192,9 +192,15 @@ primitive integrations logs <id> # View invocation logs
192
192
  - `--timeout <ms>` - Request timeout in milliseconds
193
193
 
194
194
  **Secrets management:**
195
+
196
+ Integration-scoped secrets are **deprecated** and can no longer be created. Use
197
+ app-level secrets instead (`primitive secrets set <KEY> --value <value>`) and reference
198
+ them in integration config via `{{secrets.KEY}}`. See the **Secrets** section
199
+ below. The remaining integration-secret commands only list/archive legacy
200
+ secrets:
201
+
195
202
  ```bash
196
203
  primitive integrations secrets list <integration-id>
197
- primitive integrations secrets add <id> --data '{"apiKey":"..."}'
198
204
  primitive integrations secrets archive <id> <secret-id>
199
205
  ```
200
206
 
@@ -274,14 +280,33 @@ pushes a workflow TOML (`workflows create --from-file`,
274
280
  `workflows draft update --from-file`, `workflows configs create --from-file`,
275
281
  `workflows configs update --from-file`, and `primitive sync push`) runs the
276
282
  file through `cli/src/lib/workflow-toml-validator.ts` before sending it to
277
- the server. The validator rejects any step with a top-level field outside
278
- the universal-and-consumed allowlist — most commonly catching the footgun
279
- where `[steps.<id>.request]` is written under `[[steps]]` (TOML places the
280
- sub-table under `steps[N][<id>]`, not the intended `steps[N].request`, so
281
- the runtime silently runs the step with an empty `request` block). The
282
- correct form for the most-recent step is `[steps.request]`. When adding a
283
- new step kind that consumes a new top-level field, add the field name to
284
- `ALLOWLISTED_FIELDS` in that file.
283
+ the server. For a step whose `kind` the CLI knows about, the validator
284
+ rejects any top-level field outside the allowlist — most commonly catching
285
+ the footgun where `[steps.<id>.request]` is written under `[[steps]]` (TOML
286
+ places the sub-table under `steps[N][<id>]`, not the intended
287
+ `steps[N].request`, so the runtime silently runs the step with an empty
288
+ `request` block). The correct form for the most-recent step is
289
+ `[steps.request]`. For a step whose `kind` the CLI does NOT know (an older
290
+ CLI run against a newer server that registered a new step kind), the
291
+ per-field check is skipped — so a valid new-kind field is never falsely
292
+ rejected — while the kind-agnostic misnested-header footgun detector still
293
+ fires (issue #998).
294
+
295
+ **The allowlist is generated, not hand-maintained (issue #998):** The field
296
+ union and the known-kind set live in the committed artifact
297
+ `cli/src/lib/generated-allowlist.ts`, generated from the server step runners
298
+ (`src/workflows/steps/*.ts`) and the universal `BaseStepDefinition` shape by
299
+ `cli/scripts/gen-allowlist.mjs`. The generator runs automatically at CLI
300
+ `prebuild`; regenerate manually with `node cli/scripts/gen-allowlist.mjs`
301
+ (or `pnpm -C cli gen:allowlist`). The union is derived from what each runner
302
+ *reads* off the step config — not from what the `*StepDefinition` type
303
+ declares (types over-declare and would weaken the footgun detector). A
304
+ freshness guard (`node cli/scripts/gen-allowlist.mjs --check`, also asserted
305
+ by `cli/tests/unit/workflow-toml-validator-drift-guard.test.ts`) fails if the
306
+ committed artifact drifts from a fresh scan, so the historical hand-edit
307
+ drift (#685/#802/#971) cannot recur. When you add a new step kind or a runner
308
+ starts reading a new field, just regenerate and commit the artifact — there is
309
+ no hand-maintained list to update.
285
310
 
286
311
  ### Tokens
287
312
 
@@ -298,7 +323,7 @@ primitive tokens revoke <token-id> [app-id] # Revoke t
298
323
  **Create options:**
299
324
  - `--name <name>` - Token name (required)
300
325
  - `--user <user-id>` - App user ID to associate the token with (required)
301
- - `--ttl <duration>` - Token lifetime (e.g., 7d, 30d, 4w, 3m, 1y). Omit for never-expiring
326
+ - `--ttl <duration>` - Token lifetime (e.g., 30m, 2h, 7d, 30d, 4w, 3mo, 1y). Omit for never-expiring. Units: `m`/`min`=minutes (≤1440), `h`=hours (≤24), `d`=days, `w`=weeks, `mo`=months, `y`=years. **Note:** as of #420 `m` means minutes (was months); use `mo` for months.
302
327
 
303
328
  ### Databases
304
329
 
@@ -620,6 +645,100 @@ For contributors writing new commands, the output helpers in
620
645
  `success()` / `info()` / `warn()` / `keyValue()` / `divider()` / `heading()`
621
646
  for diagnostics about what the command did.
622
647
 
648
+ ## Programmatic surfaces
649
+
650
+ ### `primitive help --json` — command manifest
651
+
652
+ `primitive help --json` prints a machine-readable manifest of the full command
653
+ tree (commands, subcommands, positional args, options, aliases, global options,
654
+ and the CLI version) to **stdout** as a single JSON document, then exits `0`. It
655
+ is hidden/undocumented in human `--help` output, auth-free, and runs entirely
656
+ offline (no project config, no credentials, no network) — so it works in any
657
+ directory, including one with no `.primitive/`.
658
+
659
+ ```bash
660
+ primitive help --json | jq '.commands[] | select(.name=="sync") | .commands[].name'
661
+ ```
662
+
663
+ Shape (`schemaVersion: 1`):
664
+
665
+ ```jsonc
666
+ {
667
+ "schemaVersion": 1,
668
+ "name": "primitive",
669
+ "version": "1.0.49",
670
+ "globalOptions": [ { "flags": "-e, --env <name>", "description": "…", "required": true, "defaultValue": null } ],
671
+ "commands": [
672
+ {
673
+ "name": "sync",
674
+ "description": "…",
675
+ "aliases": [],
676
+ "args": [],
677
+ "options": [],
678
+ "commands": [
679
+ {
680
+ "name": "push",
681
+ "description": "…",
682
+ "aliases": [],
683
+ "args": [ { "name": "app-id", "required": false, "variadic": false, "description": "…" } ],
684
+ "options": [ { "flags": "--dir <path>", "description": "…", "required": true, "defaultValue": null } ],
685
+ "commands": []
686
+ }
687
+ ]
688
+ }
689
+ ]
690
+ }
691
+ ```
692
+
693
+ `schemaVersion` is the contract knob: consumers assert the shape they understand
694
+ and fail loud if a future CLI bumps it (a breaking change for downstream tooling
695
+ such as docs CI that drift-gates documented invocations against the published
696
+ CLI).
697
+
698
+ ### `primitive-admin/validators` — TOML validators
699
+
700
+ The TOML validators that `sync push` runs as its load-bearing gate are exported
701
+ from the `primitive-admin/validators` subpath (ESM-only, with types) so external
702
+ tooling can validate exactly the way the published CLI does — instead of
703
+ re-implementing the flow and silently drifting.
704
+
705
+ ```ts
706
+ import {
707
+ validateWorkflowTomlSource, // source-level wrapper (parse → expand → validate)
708
+ validateWorkflowToml, // raw: pure fn over already-parsed TOML
709
+ formatWorkflowTomlErrors,
710
+ validateOperations, // raw: pure fn over already-parsed operations[]
711
+ formatIssue,
712
+ } from "primitive-admin/validators";
713
+ ```
714
+
715
+ Two contracts:
716
+
717
+ - **`validateWorkflowTomlSource(raw, filePath)`** — pass the **raw TOML source
718
+ string** and the workflow's path. It runs the *identical* parse →
719
+ `expandWorkflowTomlData()` (`include` fragment expansion) → `validateWorkflowToml`
720
+ → `formatWorkflowTomlErrors` path that `sync push` runs, so it cannot diverge
721
+ from `sync push` on workflow `include` fragments. Returns
722
+ `{ errors, formatted }` (`formatted` is `null` when valid). Fragment files
723
+ resolve relative to `<filePath>/../../workflow-fragments/`, matching the CLI.
724
+
725
+ - **The raw validators** (`validateWorkflowToml`, `validateOperations`,
726
+ `formatWorkflowTomlErrors`, `formatIssue`) are **pure functions over
727
+ already-parsed TOML** — they do *not* read files or parse TOML. The consumer
728
+ parses (e.g. with `@iarna/toml`) and, for workflows, performs any `include`
729
+ expansion itself. There is **no coupling on a specific TOML parser version**:
730
+ pass whatever parsed object / `operations[]` you already have.
731
+
732
+ ```ts
733
+ import * as TOML from "@iarna/toml";
734
+ const data = TOML.parse(raw);
735
+ const errs = validateWorkflowToml(data);
736
+ if (errs.length) throw new Error(formatWorkflowTomlErrors(path, errs));
737
+ ```
738
+
739
+ Internal helpers (`collectParamRefs`, `declaredParamNames`,
740
+ `locateOperationLine`) are intentionally **not** exported.
741
+
623
742
  ## Exit Codes
624
743
 
625
744
  - `0` - Success
@@ -21,11 +21,15 @@ always fetch the latest from the CLI.
21
21
 
22
22
  ## Step 0: Verify CLI Configuration
23
23
 
24
- The Primitive CLI is **project-scoped**. Each project has a `.primitive/config.json` (committed to
25
- the repo) that defines named environments (`dev`, `prod`, `staging`, ), where each environment
26
- binds an `apiUrl` and (optionally) an `appId`. Per-environment auth tokens live in
27
- `.primitive/credentials.json` (gitignored). There is no global "currently active app" — the active
28
- environment determines the server *and* the app.
24
+ The Primitive CLI is **project-scoped**, and project mode is **strongly preferred** for any work
25
+ inside a repo. Each project has a `.primitive/config.json` (committed to the repo) that defines
26
+ named environments (`dev`, `prod`, `staging`, ), where each environment binds an `apiUrl` and
27
+ (optionally) an `appId`. Per-environment auth tokens live in `.primitive/credentials.json`
28
+ (gitignored). There is no global "currently active app" — the active environment determines the
29
+ server *and* the app.
30
+
31
+ The legacy global fallback (`~/.primitive/credentials.json`) exists only for one-off use outside a
32
+ project. **Inside a project, treat its absence as a setup gap to fix, not a mode to operate in.**
29
33
 
30
34
  **Before running any CLI commands**, your *first* check is whether the project is in project mode:
31
35
 
@@ -62,29 +66,56 @@ no-op when the active env already pins an `appId`.
62
66
 
63
67
  ### Branch B — no `.primitive/config.json` (project mode NOT set up)
64
68
 
65
- In this branch the CLI silently falls back to global state in `~/.primitive/credentials.json`
66
- (legacy mode). Commands will run against whatever app/server happens to be globally active —
67
- which the agent didn't set and the user may have forgotten about. **This is a footgun.** Do not
68
- proceed silently.
69
+ Without project config the CLI silently falls back to global state in `~/.primitive/credentials.json`
70
+ (legacy mode). Commands run against whatever app/server happens to be globally active — which the
71
+ agent didn't set and the user may have forgotten about. **This is a footgun, not a supported way to
72
+ work inside a project.** Do not proceed silently, and do not treat the global fallback as the
73
+ default path.
69
74
 
70
- **Surface the gap to the user before running mutating commands.** Say something like:
75
+ **Your default action is to set up project mode.** Stop and prompt the user to create the project
76
+ config before doing anything else. Don't bury the recommendation behind an equal-weight "or proceed
77
+ against global state" option — make setting up project config the clear, recommended next step.
71
78
 
72
- > "This project doesn't have a `.primitive/config.json`, so the CLI will use your global state
73
- > (`<server>` / `<app from `whoami`>`). I'd recommend setting up project-scoped config with
74
- > `primitive env add <name> --api-url <url> [--app-id <id>]` so this project pins its own
75
- > environment. Want me to set that up, or proceed against global state for now?"
79
+ First gather the context you'll propose (so the prompt is concrete, not abstract):
76
80
 
77
- `primitive env add` is additive — it only writes an entry to `.primitive/config.json` (creating
78
- the file if needed). It does not touch source code, create apps on the server, or install
79
- dependencies, so it's safe to run in any existing project.
81
+ ```bash
82
+ primitive whoami # current global server + app, if any shows what the fallback WOULD target
83
+ ```
84
+
85
+ Then prompt the user, e.g.:
86
+
87
+ > "This project has no `.primitive/config.json`, so the CLI isn't in project mode. I recommend
88
+ > setting up project-scoped config so this repo pins its own environment instead of relying on your
89
+ > global state (currently `<server>` / `<app from whoami>`, which I didn't set). I'll add an env
90
+ > with:
91
+ >
92
+ > ```bash
93
+ > primitive env add dev --api-url <url> --app-id <id>
94
+ > ```
95
+ >
96
+ > Does this look right, or should I adjust the env name / URL / app?"
97
+
98
+ If you need the user to pick the env name, server, or app, ask them. Confirm the values before
99
+ running `env add` — but the question to resolve is *which* project config to create, not *whether*
100
+ to create one.
101
+
102
+ `primitive env add` is additive and safe — it only writes an entry to `.primitive/config.json`
103
+ (creating the file if needed). It does not touch source code, create apps on the server, or install
104
+ dependencies.
105
+
106
+ **Only fall back to global state if the user explicitly declines project setup** after you've
107
+ recommended it. Even then, name the exact server/app the command will hit and get clear
108
+ confirmation before running anything mutating (`primitive sync push`, `primitive apps create`, etc.).
109
+ A read-only command (`whoami`, `guides list`) against global state is fine while you're still
110
+ working out the config.
80
111
 
81
112
  Do not rely on `.env` files like `PRIMITIVE_API_URL` to control CLI targeting — those are not
82
113
  read by the CLI in project mode, and the project config is the source of truth.
83
114
 
84
115
  **Why this matters:** If the CLI is pointed at the wrong environment (e.g., prod instead of dev),
85
116
  commands like `primitive sync push` will modify the wrong server. Silent fallback to global state
86
- makes this exact mistake easy to commit. Always verify and surfacebefore running mutating
87
- operations.
117
+ makes this exact mistake easy to commit. Setting up project config is the durable fix verify and
118
+ surface before running mutating operations.
88
119
 
89
120
  ## Step 1: Discover Available Guides
90
121
 
@@ -95,20 +126,41 @@ primitive guides list
95
126
  ```
96
127
 
97
128
  This returns the full list of available guide topics with descriptions, keywords, and use cases.
98
- Use this output to determine which guides are relevant to the current task.
129
+ The `COMBINATIONS` column shows which `(language, platform)` variants each guide is available in
130
+ (e.g. `ts; swift`). Use this output to determine which guides are relevant to the current task —
131
+ and which language/platform variant to request in Step 2.
132
+
133
+ ### Determine the project's language and platform
134
+
135
+ Figure out what the project you're working in targets, then request the matching variant when
136
+ fetching guides:
137
+
138
+ - A `Package.swift`, `*.xcodeproj`, or `project.yml` → `--language swift` (plus `--platform ios`
139
+ or `--platform macos` as appropriate).
140
+ - A Vite/React/Node web app (`package.json`, `js-bao-wss-client`) → `--language ts --platform web`.
141
+
142
+ If you can't tell, omit the flags — every guide has a default variant, so a bare
143
+ `primitive guides get <topic>` always returns something useful.
99
144
 
100
145
  ## Step 2: Fetch the Relevant Guides
101
146
 
102
- For each relevant topic identified in Step 1, fetch the full guide:
147
+ For each relevant topic identified in Step 1, fetch the full guide, passing the project's
148
+ language/platform so you get the right variant:
103
149
 
104
150
  ```bash
151
+ primitive guides get <topic> --language <ts|swift> --platform <web|ios|macos>
152
+ # or, when the project's language/platform is unknown or doesn't matter:
105
153
  primitive guides get <topic>
106
154
  ```
107
155
 
156
+ `--language` accepts aliases (`typescript`/`javascript`/`js` → `ts`). These flags **never fail**:
157
+ an unknown value or an unavailable combination falls back to the guide's default variant rather
158
+ than erroring, so it's always safe to pass your best guess.
159
+
108
160
  **Always fetch guide(s) BEFORE writing code.** If multiple features are involved, fetch multiple
109
161
  guides. The guides contain:
110
162
  - Complete API documentation with method signatures
111
- - Working code examples (TypeScript/JavaScript)
163
+ - Working code examples in the requested language (e.g. TypeScript or Swift)
112
164
  - Common patterns and anti-patterns
113
165
  - Configuration examples (TOML files for `primitive sync`)
114
166
  - Decision frameworks for architecture choices
@@ -137,9 +189,10 @@ Determine which Primitive features the new/modified code touches by scanning for
137
189
  - Configuration files (TOML for sync)
138
190
 
139
191
  ### 4b. Fetch and Cross-Reference
140
- Run `primitive guides list` to identify which guides cover the features used, then fetch each one:
192
+ Run `primitive guides list` to identify which guides cover the features used, then fetch each one
193
+ in the project's language/platform:
141
194
  ```bash
142
- primitive guides get <topic>
195
+ primitive guides get <topic> --language <ts|swift> --platform <web|ios|macos>
143
196
  ```
144
197
 
145
198
  Compare the written code against the guide content:
@@ -185,8 +238,9 @@ primitive init my-new-app # Scaffolds template, cr
185
238
  # Do NOT run inside an existing repo.
186
239
 
187
240
  # Guides (the most important commands for development)
188
- primitive guides list # See all available guides with topics and descriptions
189
- primitive guides get <topic> # Read detailed guide for a specific topic
241
+ primitive guides list # See all guides: topics, descriptions, available (lang,platform) combinations
242
+ primitive guides get <topic> # Read a guide's default variant
243
+ primitive guides get <topic> --language swift --platform ios # Read a specific language/platform variant
190
244
 
191
245
  # Configuration as Code
192
246
  primitive sync init --dir ./config # Initialize config directory
@@ -207,9 +261,10 @@ If the user describes a new feature they want to build:
207
261
  1. **Verify CLI configuration** per Step 0 — confirm the active environment in
208
262
  `.primitive/config.json` (and its bound `apiUrl` / `appId`) match the project's intended target
209
263
  before running any commands
210
- 2. **Run `primitive guides list`** to discover available topics
264
+ 2. **Run `primitive guides list`** to discover available topics and their `(language, platform)` combinations
211
265
  3. **Identify which guides are relevant** to their feature from the list output
212
- 4. **Fetch those guides** with `primitive guides get <topic>`
266
+ 4. **Fetch those guides** with `primitive guides get <topic> --language <lang> --platform <platform>`
267
+ (using the project's language/platform; omit the flags if unknown)
213
268
  5. **Recommend a data modeling approach** based on the guide content. If requirements are unclear or ambiguous, **ask the user clarifying questions before proceeding** — it's much easier to get the data model right upfront than to migrate later
214
269
  6. **Outline the implementation steps** referencing specific patterns from the guides
215
270
  7. **Write the code** following the patterns exactly
@@ -219,8 +274,8 @@ If the user describes a new feature they want to build:
219
274
 
220
275
  For any question about Primitive platform capabilities:
221
276
 
222
- 1. **Run `primitive guides list`** to find the relevant topic
223
- 2. **Fetch the guide**: `primitive guides get <topic>`
277
+ 1. **Run `primitive guides list`** to find the relevant topic (and its available language/platform combinations)
278
+ 2. **Fetch the guide**: `primitive guides get <topic> --language <lang> --platform <platform>` (omit the flags if the language/platform is unknown)
224
279
  3. **Answer from the guide content** — don't guess or make up APIs
225
280
  4. **Include working code examples** from the guide
226
281
  5. **Point the user to the guide** for further reading: "You can see more examples by running `primitive guides get <topic>`"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command, CommanderError } from "commander";
3
- import { readFileSync } from "fs";
3
+ import { readFileSync, writeSync } from "fs";
4
4
  import { fileURLToPath } from "url";
5
5
  import { dirname, resolve } from "path";
6
6
  import { registerInitCommand } from "../src/commands/init.js";
@@ -32,6 +32,8 @@ import { registerEmailTemplatesCommands } from "../src/commands/email-templates.
32
32
  import { registerCollectionsCommands } from "../src/commands/collections.js";
33
33
  import { registerCollectionTypeConfigsCommands } from "../src/commands/collection-type-configs.js";
34
34
  import { error } from "../src/lib/output.js";
35
+ import { installGlobalCrashHandlers } from "../src/lib/crash-handlers.js";
36
+ import { buildCliManifest } from "../src/lib/cli-manifest.js";
35
37
  import { ApiError } from "../src/lib/api-client.js";
36
38
  import { checkForUpdate } from "../src/lib/version-check.js";
37
39
  import { loadCredentials } from "../src/lib/config.js";
@@ -43,9 +45,40 @@ import { registerEnvCommands } from "../src/commands/env.js";
43
45
  import { setCurrentEnvName, getCurrentEnvNameSafe, getProjectConfig, } from "../src/lib/env-resolver.js";
44
46
  import { ProjectConfigError, PROJECT_CONFIG_DISPLAY_NAME, findProjectConfigPath } from "../src/lib/project-config.js";
45
47
  import { maybeWarnLegacyMigration } from "../src/lib/migration-nag.js";
48
+ // Install global crash handlers first thing. Without these, an error that
49
+ // escapes the top-level `.catch` below — e.g. ERR_USE_AFTER_CLOSE thrown from
50
+ // inside an inquirer event callback when stdin isn't a usable TTY — makes Node
51
+ // print only its bare `Node.js vX` banner and die with no message (issue #972).
52
+ installGlobalCrashHandlers();
46
53
  const __filename = fileURLToPath(import.meta.url);
47
54
  const __dirname = dirname(__filename);
48
55
  const pkg = JSON.parse(readFileSync(resolve(__dirname, "../../package.json"), "utf-8"));
56
+ /**
57
+ * Write a string to a file descriptor synchronously, in full, before
58
+ * returning. Handles two pitfalls of a single `fs.writeSync` on a pipe:
59
+ * - partial writes: `writeSync` may write fewer bytes than requested (e.g.
60
+ * only what fits in the OS pipe buffer), so we loop on the returned count;
61
+ * - `EAGAIN` on a non-blocking fd with a slow/full consumer: retry instead of
62
+ * throwing.
63
+ * This guarantees the whole payload reaches the kernel before the caller
64
+ * exits, with no dependency on the event loop draining stdout.
65
+ */
66
+ function writeAllSync(fd, text) {
67
+ const buf = Buffer.from(text, "utf-8");
68
+ let offset = 0;
69
+ while (offset < buf.length) {
70
+ try {
71
+ offset += writeSync(fd, buf, offset, buf.length - offset);
72
+ }
73
+ catch (err) {
74
+ // Retry on EAGAIN (non-blocking fd, consumer not ready yet). Rethrow
75
+ // anything else.
76
+ if (err.code === "EAGAIN")
77
+ continue;
78
+ throw err;
79
+ }
80
+ }
81
+ }
49
82
  const isVersionFlag = process.argv.includes("--version") || process.argv.includes("-V");
50
83
  const subcommand = process.argv[2];
51
84
  const isJsonOutput = process.argv.includes("--json");
@@ -233,6 +266,38 @@ registerCollectionTypeConfigsCommands(program);
233
266
  registerSkillCommands(program);
234
267
  registerSecretsCommands(program);
235
268
  registerBlobBucketsCommands(program);
269
+ // `primitive help --json` — machine-readable command manifest (issue #983).
270
+ //
271
+ // Mechanism: a pre-parse argv guard, NOT a registered `help` subcommand.
272
+ // Commander already injects its own built-in `help [command]`; registering our
273
+ // own would risk clobbering `primitive help <command>`. By special-casing the
274
+ // invocation here — after every register*Commands() call so the full tree is
275
+ // built — we serialize commander's public accessors and exit before parseAsync.
276
+ // It is auth-free, runs offline (no project config / credentials / network),
277
+ // and `--json` already suppresses the header, skill-status nag, and update
278
+ // check (see `isJsonOutput` above), so stdout carries pure JSON.
279
+ //
280
+ // Hidden/undocumented: there is no visible `help --json` entry in human help
281
+ // output; it's discoverable for tooling/agents that know to ask for it.
282
+ if (process.argv[2] === "help" && process.argv.includes("--json")) {
283
+ // Emit the full manifest synchronously, then exit. The naive form — the
284
+ // async `json()` helper (`console.log`) followed by an immediate
285
+ // `process.exit(0)` — races the flush on the documented `primitive help
286
+ // --json | jq` pipe path: the ~365KB manifest far exceeds the 64KB OS pipe
287
+ // buffer, so exiting before the kernel drains it truncates the JSON for
288
+ // piped consumers.
289
+ //
290
+ // Robust fix: write to fd 1 with `fs.writeSync` in a loop. A single
291
+ // `writeSync` is NOT enough — on a non-blocking pipe fd it returns after a
292
+ // *partial* write (only what currently fits in the pipe buffer) without
293
+ // looping, silently dropping the tail; and on a slow consumer it can throw
294
+ // `EAGAIN`. Looping over the returned byte count and retrying on `EAGAIN`
295
+ // guarantees every byte is handed to the kernel before `process.exit(0)`,
296
+ // independent of the event loop. Output is byte-identical to `json()`: the
297
+ // same `JSON.stringify(..., null, 2)` plus a single trailing newline.
298
+ writeAllSync(1, JSON.stringify(buildCliManifest(program, pkg.version), null, 2) + "\n");
299
+ process.exit(0);
300
+ }
236
301
  // Global error handler
237
302
  program.hook("preAction", () => {
238
303
  // Reset API client state before each command
@@ -1 +1 @@
1
- {"version":3,"file":"primitive.js","sourceRoot":"","sources":["../../bin/primitive.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,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AAE,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;QAC5B,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnB,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;YAC3B,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,sBAAsB,EAAE,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,OAAO,IAAI,8BAA8B,CAAC,CAAC;IACrD,MAAM,sBAAsB,EAAE,CAAC;IAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare function registerAdminsCommands(program: Command): void;
@@ -1,5 +1,6 @@
1
1
  import { ApiClient } from "../lib/api-client.js";
2
2
  import { success, error, info, keyValue, formatTable, formatId, formatDate, json, divider, } from "../lib/output.js";
3
+ import { confirmPrompt } from "../lib/confirm-prompt.js";
3
4
  export function registerAdminsCommands(program) {
4
5
  const admins = program
5
6
  .command("admins")
@@ -161,15 +162,14 @@ Examples:
161
162
  .option("-y, --yes", "Skip confirmation prompt")
162
163
  .action(async (adminId, options) => {
163
164
  if (!options.yes) {
164
- const inquirer = await import("inquirer");
165
- const { confirm } = await inquirer.default.prompt([
166
- {
167
- type: "confirm",
168
- name: "confirm",
169
- message: `Disable admin ${adminId}?`,
170
- default: false,
171
- },
172
- ]);
165
+ let confirm;
166
+ try {
167
+ confirm = await confirmPrompt(`Disable admin ${adminId}?`);
168
+ }
169
+ catch (err) {
170
+ error(err.message);
171
+ process.exit(1);
172
+ }
173
173
  if (!confirm) {
174
174
  info("Cancelled.");
175
175
  return;
@@ -241,15 +241,14 @@ Examples:
241
241
  .option("-y, --yes", "Skip confirmation prompt")
242
242
  .action(async (invitationId, options) => {
243
243
  if (!options.yes) {
244
- const inquirer = await import("inquirer");
245
- const { confirm } = await inquirer.default.prompt([
246
- {
247
- type: "confirm",
248
- name: "confirm",
249
- message: `Delete invitation ${invitationId}?`,
250
- default: false,
251
- },
252
- ]);
244
+ let confirm;
245
+ try {
246
+ confirm = await confirmPrompt(`Delete invitation ${invitationId}?`);
247
+ }
248
+ catch (err) {
249
+ error(err.message);
250
+ process.exit(1);
251
+ }
253
252
  if (!confirm) {
254
253
  info("Cancelled.");
255
254
  return;
@@ -347,15 +346,14 @@ Examples:
347
346
  return;
348
347
  }
349
348
  if (!options.yes) {
350
- const inquirer = await import("inquirer");
351
- const { confirm } = await inquirer.default.prompt([
352
- {
353
- type: "confirm",
354
- name: "confirm",
355
- message: `Revoke deferred ${options.type} grant ${deferredId}?`,
356
- default: false,
357
- },
358
- ]);
349
+ let confirm;
350
+ try {
351
+ confirm = await confirmPrompt(`Revoke deferred ${options.type} grant ${deferredId}?`);
352
+ }
353
+ catch (err) {
354
+ error(err.message);
355
+ process.exit(1);
356
+ }
359
357
  if (!confirm) {
360
358
  info("Cancelled.");
361
359
  return;