primitive-admin 1.0.48 → 1.0.50
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 +102 -2
- package/assets/skill/skills/primitive-platform/SKILL.md +85 -30
- package/dist/bin/primitive.d.ts +2 -0
- package/dist/bin/primitive.js +66 -1
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.d.ts +2 -0
- package/dist/src/commands/analytics.d.ts +2 -0
- package/dist/src/commands/apps.d.ts +2 -0
- package/dist/src/commands/apps.js +20 -0
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth.d.ts +2 -0
- package/dist/src/commands/blob-buckets.d.ts +2 -0
- package/dist/src/commands/catalog.d.ts +2 -0
- package/dist/src/commands/collection-type-configs.d.ts +2 -0
- package/dist/src/commands/collections.d.ts +2 -0
- package/dist/src/commands/comparisons.d.ts +2 -0
- package/dist/src/commands/cron-triggers.d.ts +2 -0
- package/dist/src/commands/cron-triggers.js +8 -15
- package/dist/src/commands/cron-triggers.js.map +1 -1
- package/dist/src/commands/database-types.d.ts +2 -0
- package/dist/src/commands/databases.d.ts +2 -0
- package/dist/src/commands/databases.js +31 -0
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +2 -0
- package/dist/src/commands/email-templates.d.ts +2 -0
- package/dist/src/commands/env.d.ts +12 -0
- package/dist/src/commands/group-type-configs.d.ts +2 -0
- package/dist/src/commands/groups.d.ts +2 -0
- package/dist/src/commands/guides.d.ts +84 -0
- package/dist/src/commands/guides.js +201 -24
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/init.d.ts +17 -0
- package/dist/src/commands/init.js +63 -25
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.d.ts +2 -0
- package/dist/src/commands/integrations.js +22 -5
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/llm.d.ts +2 -0
- package/dist/src/commands/prompts.d.ts +2 -0
- package/dist/src/commands/rule-sets.d.ts +2 -0
- package/dist/src/commands/secrets.d.ts +2 -0
- package/dist/src/commands/skill.d.ts +2 -0
- package/dist/src/commands/sync.d.ts +113 -0
- package/dist/src/commands/sync.js +366 -12
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.d.ts +2 -0
- package/dist/src/commands/tokens.js +104 -1
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/users.d.ts +2 -0
- package/dist/src/commands/waitlist.d.ts +2 -0
- package/dist/src/commands/waitlist.js +1 -1
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/webhooks.d.ts +2 -0
- package/dist/src/commands/workflows.d.ts +49 -0
- package/dist/src/commands/workflows.js +74 -21
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +1244 -0
- package/dist/src/lib/api-client.js +30 -0
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/auth-flow.d.ts +8 -0
- package/dist/src/lib/cli-manifest.d.ts +60 -0
- package/dist/src/lib/cli-manifest.js +70 -0
- package/dist/src/lib/cli-manifest.js.map +1 -0
- package/dist/src/lib/config.d.ts +37 -0
- package/dist/src/lib/confirm-prompt.d.ts +66 -0
- package/dist/src/lib/confirm-prompt.js +85 -0
- package/dist/src/lib/confirm-prompt.js.map +1 -0
- package/dist/src/lib/constants.d.ts +2 -0
- package/dist/src/lib/crash-handlers.d.ts +20 -0
- package/dist/src/lib/crash-handlers.js +49 -0
- package/dist/src/lib/crash-handlers.js.map +1 -0
- package/dist/src/lib/credentials-store.d.ts +79 -0
- package/dist/src/lib/csv.d.ts +48 -0
- package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +111 -0
- package/dist/src/lib/db-codegen/dbNaming.d.ts +45 -0
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +97 -0
- package/dist/src/lib/db-codegen/dbTemplates.js +31 -10
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +78 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/env-resolver.d.ts +62 -0
- package/dist/src/lib/fetch.d.ts +5 -0
- package/dist/src/lib/init-config.d.ts +46 -0
- package/dist/src/lib/init-config.js +7 -0
- package/dist/src/lib/init-config.js.map +1 -1
- package/dist/src/lib/migration-nag.d.ts +49 -0
- package/dist/src/lib/output.d.ts +49 -0
- package/dist/src/lib/output.js +25 -1
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/paginate.d.ts +33 -0
- package/dist/src/lib/project-config.d.ts +97 -0
- package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
- package/dist/src/lib/resolve-platform.d.ts +45 -0
- package/dist/src/lib/resolve-platform.js +43 -0
- package/dist/src/lib/resolve-platform.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +23 -0
- package/dist/src/lib/snapshots.d.ts +99 -0
- package/dist/src/lib/snapshots.js +357 -0
- package/dist/src/lib/snapshots.js.map +1 -0
- package/dist/src/lib/sync-paths.d.ts +72 -0
- package/dist/src/lib/sync-paths.js +29 -1
- package/dist/src/lib/sync-paths.js.map +1 -1
- package/dist/src/lib/template.d.ts +93 -0
- package/dist/src/lib/token-inject.d.ts +56 -0
- package/dist/src/lib/token-inject.js +204 -0
- package/dist/src/lib/token-inject.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +132 -0
- package/dist/src/lib/toml-params-validator.d.ts +95 -0
- package/dist/src/lib/version-check.d.ts +10 -0
- package/dist/src/lib/workflow-fragments.d.ts +41 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +86 -0
- package/dist/src/lib/workflow-toml-validator.js +31 -1
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/dist/src/types/index.d.ts +513 -0
- package/dist/src/validators.d.ts +64 -0
- package/dist/src/validators.js +63 -0
- package/dist/src/validators.js.map +1 -0
- package/package.json +8 -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
|
|
|
@@ -298,7 +304,7 @@ primitive tokens revoke <token-id> [app-id] # Revoke t
|
|
|
298
304
|
**Create options:**
|
|
299
305
|
- `--name <name>` - Token name (required)
|
|
300
306
|
- `--user <user-id>` - App user ID to associate the token with (required)
|
|
301
|
-
- `--ttl <duration>` - Token lifetime (e.g., 7d, 30d, 4w,
|
|
307
|
+
- `--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
308
|
|
|
303
309
|
### Databases
|
|
304
310
|
|
|
@@ -620,6 +626,100 @@ For contributors writing new commands, the output helpers in
|
|
|
620
626
|
`success()` / `info()` / `warn()` / `keyValue()` / `divider()` / `heading()`
|
|
621
627
|
for diagnostics about what the command did.
|
|
622
628
|
|
|
629
|
+
## Programmatic surfaces
|
|
630
|
+
|
|
631
|
+
### `primitive help --json` — command manifest
|
|
632
|
+
|
|
633
|
+
`primitive help --json` prints a machine-readable manifest of the full command
|
|
634
|
+
tree (commands, subcommands, positional args, options, aliases, global options,
|
|
635
|
+
and the CLI version) to **stdout** as a single JSON document, then exits `0`. It
|
|
636
|
+
is hidden/undocumented in human `--help` output, auth-free, and runs entirely
|
|
637
|
+
offline (no project config, no credentials, no network) — so it works in any
|
|
638
|
+
directory, including one with no `.primitive/`.
|
|
639
|
+
|
|
640
|
+
```bash
|
|
641
|
+
primitive help --json | jq '.commands[] | select(.name=="sync") | .commands[].name'
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
Shape (`schemaVersion: 1`):
|
|
645
|
+
|
|
646
|
+
```jsonc
|
|
647
|
+
{
|
|
648
|
+
"schemaVersion": 1,
|
|
649
|
+
"name": "primitive",
|
|
650
|
+
"version": "1.0.49",
|
|
651
|
+
"globalOptions": [ { "flags": "-e, --env <name>", "description": "…", "required": true, "defaultValue": null } ],
|
|
652
|
+
"commands": [
|
|
653
|
+
{
|
|
654
|
+
"name": "sync",
|
|
655
|
+
"description": "…",
|
|
656
|
+
"aliases": [],
|
|
657
|
+
"args": [],
|
|
658
|
+
"options": [],
|
|
659
|
+
"commands": [
|
|
660
|
+
{
|
|
661
|
+
"name": "push",
|
|
662
|
+
"description": "…",
|
|
663
|
+
"aliases": [],
|
|
664
|
+
"args": [ { "name": "app-id", "required": false, "variadic": false, "description": "…" } ],
|
|
665
|
+
"options": [ { "flags": "--dir <path>", "description": "…", "required": true, "defaultValue": null } ],
|
|
666
|
+
"commands": []
|
|
667
|
+
}
|
|
668
|
+
]
|
|
669
|
+
}
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
`schemaVersion` is the contract knob: consumers assert the shape they understand
|
|
675
|
+
and fail loud if a future CLI bumps it (a breaking change for downstream tooling
|
|
676
|
+
such as docs CI that drift-gates documented invocations against the published
|
|
677
|
+
CLI).
|
|
678
|
+
|
|
679
|
+
### `primitive-admin/validators` — TOML validators
|
|
680
|
+
|
|
681
|
+
The TOML validators that `sync push` runs as its load-bearing gate are exported
|
|
682
|
+
from the `primitive-admin/validators` subpath (ESM-only, with types) so external
|
|
683
|
+
tooling can validate exactly the way the published CLI does — instead of
|
|
684
|
+
re-implementing the flow and silently drifting.
|
|
685
|
+
|
|
686
|
+
```ts
|
|
687
|
+
import {
|
|
688
|
+
validateWorkflowTomlSource, // source-level wrapper (parse → expand → validate)
|
|
689
|
+
validateWorkflowToml, // raw: pure fn over already-parsed TOML
|
|
690
|
+
formatWorkflowTomlErrors,
|
|
691
|
+
validateOperations, // raw: pure fn over already-parsed operations[]
|
|
692
|
+
formatIssue,
|
|
693
|
+
} from "primitive-admin/validators";
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
Two contracts:
|
|
697
|
+
|
|
698
|
+
- **`validateWorkflowTomlSource(raw, filePath)`** — pass the **raw TOML source
|
|
699
|
+
string** and the workflow's path. It runs the *identical* parse →
|
|
700
|
+
`expandWorkflowTomlData()` (`include` fragment expansion) → `validateWorkflowToml`
|
|
701
|
+
→ `formatWorkflowTomlErrors` path that `sync push` runs, so it cannot diverge
|
|
702
|
+
from `sync push` on workflow `include` fragments. Returns
|
|
703
|
+
`{ errors, formatted }` (`formatted` is `null` when valid). Fragment files
|
|
704
|
+
resolve relative to `<filePath>/../../workflow-fragments/`, matching the CLI.
|
|
705
|
+
|
|
706
|
+
- **The raw validators** (`validateWorkflowToml`, `validateOperations`,
|
|
707
|
+
`formatWorkflowTomlErrors`, `formatIssue`) are **pure functions over
|
|
708
|
+
already-parsed TOML** — they do *not* read files or parse TOML. The consumer
|
|
709
|
+
parses (e.g. with `@iarna/toml`) and, for workflows, performs any `include`
|
|
710
|
+
expansion itself. There is **no coupling on a specific TOML parser version**:
|
|
711
|
+
pass whatever parsed object / `operations[]` you already have.
|
|
712
|
+
|
|
713
|
+
```ts
|
|
714
|
+
import * as TOML from "@iarna/toml";
|
|
715
|
+
const data = TOML.parse(raw);
|
|
716
|
+
const errs = validateWorkflowToml(data);
|
|
717
|
+
if (errs.length) throw new Error(formatWorkflowTomlErrors(path, errs));
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
Internal helpers (`collectParamRefs`, `declaredParamNames`,
|
|
721
|
+
`locateOperationLine`) are intentionally **not** exported.
|
|
722
|
+
|
|
623
723
|
## Exit Codes
|
|
624
724
|
|
|
625
725
|
- `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
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
66
|
-
(legacy mode). Commands
|
|
67
|
-
|
|
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
|
-
**
|
|
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
|
-
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
|
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
|
|
189
|
-
primitive guides get <topic> # Read
|
|
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>`"
|
package/dist/bin/primitive.js
CHANGED
|
@@ -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;
|
|
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,SAAS,EAAE,MAAM,IAAI,CAAC;AAC7C,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,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC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,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"}
|
|
@@ -10,6 +10,7 @@ Examples:
|
|
|
10
10
|
$ primitive apps list
|
|
11
11
|
$ primitive apps create "My New App"
|
|
12
12
|
$ primitive apps update 01HXY... --mode invite-only --passkey
|
|
13
|
+
$ primitive apps update 01HXY... --member-invitations-enabled true --member-invitation-limit 5
|
|
13
14
|
`);
|
|
14
15
|
// List apps
|
|
15
16
|
apps
|
|
@@ -105,6 +106,12 @@ Examples:
|
|
|
105
106
|
printResult(" Passkey", settings.passkeyEnabled);
|
|
106
107
|
printResult(" Magic Link", settings.magicLinkEnabled);
|
|
107
108
|
printResult(" OTP (Email Code)", settings.otpEnabled);
|
|
109
|
+
divider();
|
|
110
|
+
info("Member Invitations:");
|
|
111
|
+
printResult(" Enabled", settings.memberInvitationsEnabled);
|
|
112
|
+
printResult(" Limit", settings.memberInvitationLimit === 0
|
|
113
|
+
? "0 (unlimited)"
|
|
114
|
+
: settings.memberInvitationLimit);
|
|
108
115
|
if (settings.corsMode === "custom") {
|
|
109
116
|
divider();
|
|
110
117
|
info("CORS:");
|
|
@@ -138,6 +145,8 @@ Examples:
|
|
|
138
145
|
.option("--passkey <bool>", "Enable/disable passkey authentication")
|
|
139
146
|
.option("--magic-link <bool>", "Enable/disable magic link authentication")
|
|
140
147
|
.option("--otp <bool>", "Enable/disable OTP (email code) authentication")
|
|
148
|
+
.option("--member-invitations-enabled <bool>", "Enable/disable invitations created by role 'member' users")
|
|
149
|
+
.option("--member-invitation-limit <n>", "Max invitations a member may create (non-negative integer; 0 = unlimited)")
|
|
141
150
|
.option("--cors-mode <mode>", "CORS mode: universal, custom")
|
|
142
151
|
.option("--cors-origins <origins>", "Comma-separated list of allowed origins")
|
|
143
152
|
.option("--cors-credentials <bool>", "Allow credentials in CORS")
|
|
@@ -168,6 +177,17 @@ Examples:
|
|
|
168
177
|
payload.magicLinkEnabled = options.magicLink === "true";
|
|
169
178
|
if (options.otp !== undefined)
|
|
170
179
|
payload.otpEnabled = options.otp === "true";
|
|
180
|
+
if (options.memberInvitationsEnabled !== undefined)
|
|
181
|
+
payload.memberInvitationsEnabled = options.memberInvitationsEnabled === "true";
|
|
182
|
+
if (options.memberInvitationLimit !== undefined) {
|
|
183
|
+
const raw = String(options.memberInvitationLimit).trim();
|
|
184
|
+
// Integer-only (no decimals/whitespace/sign) and non-negative.
|
|
185
|
+
if (!/^\d+$/.test(raw)) {
|
|
186
|
+
error("Invalid --member-invitation-limit. Must be a non-negative integer (0 = unlimited).");
|
|
187
|
+
process.exit(1);
|
|
188
|
+
}
|
|
189
|
+
payload.memberInvitationLimit = parseInt(raw, 10);
|
|
190
|
+
}
|
|
171
191
|
if (options.corsMode)
|
|
172
192
|
payload.corsMode = options.corsMode;
|
|
173
193
|
if (options.corsOrigins)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../../src/commands/apps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAY,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,IAAI,WAAW,EACrB,WAAW,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,CAAC;QACH,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC9B,OAAO,CAAC,QAAQ,OAAO,MAAM,KAAK,YAAY,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiClient } from "../lib/api-client.js";
|
|
2
2
|
import { resolveAppId } from "../lib/config.js";
|
|
3
|
+
import { confirmPrompt } from "../lib/confirm-prompt.js";
|
|
3
4
|
import { success, error, info, keyValue, result as printResult, formatTable, formatDate, formatStatus, json, divider, } from "../lib/output.js";
|
|
4
5
|
export function registerCronTriggersCommands(program) {
|
|
5
6
|
const cron = program
|
|
@@ -253,23 +254,15 @@ Examples:
|
|
|
253
254
|
.option("-y, --yes", "Skip confirmation prompt")
|
|
254
255
|
.action(async (triggerId, options) => {
|
|
255
256
|
const resolvedAppId = resolveAppId(undefined, options);
|
|
256
|
-
if (!options.yes) {
|
|
257
|
-
const inquirer = await import("inquirer");
|
|
258
|
-
const { confirm } = await inquirer.default.prompt([
|
|
259
|
-
{
|
|
260
|
-
type: "confirm",
|
|
261
|
-
name: "confirm",
|
|
262
|
-
message: `Delete cron trigger ${triggerId}?`,
|
|
263
|
-
default: false,
|
|
264
|
-
},
|
|
265
|
-
]);
|
|
266
|
-
if (!confirm) {
|
|
267
|
-
info("Cancelled.");
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
257
|
const client = new ApiClient();
|
|
272
258
|
try {
|
|
259
|
+
if (!options.yes) {
|
|
260
|
+
const confirmed = await confirmPrompt(`Delete cron trigger ${triggerId}?`);
|
|
261
|
+
if (!confirmed) {
|
|
262
|
+
info("Cancelled.");
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
273
266
|
await client.deleteCronTrigger(resolvedAppId, triggerId);
|
|
274
267
|
success("Cron trigger deleted.");
|
|
275
268
|
}
|