primitive-admin 1.1.0-alpha.82 → 1.1.0-alpha.84
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/assets/skill/skills/primitive-platform/SKILL.md +105 -675
- package/dist/src/commands/collections.js +61 -0
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/databases.js +10 -2
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +38 -0
- package/dist/src/commands/documents.js +535 -62
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/functions.js +303 -121
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/locks.js +15 -1
- package/dist/src/commands/locks.js.map +1 -1
- package/dist/src/commands/sync.d.ts +50 -0
- package/dist/src/commands/sync.js +560 -312
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +103 -2
- package/dist/src/lib/api-client.js +162 -18
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/config-object-descriptor.js +5 -5
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js +8 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/document-ingest-artifact.d.ts +120 -0
- package/dist/src/lib/document-ingest-artifact.js +505 -0
- package/dist/src/lib/document-ingest-artifact.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +51 -0
- package/dist/src/lib/document-ingest-input.js +132 -0
- package/dist/src/lib/document-ingest-input.js.map +1 -0
- package/dist/src/lib/document-ingest-rows.d.ts +137 -0
- package/dist/src/lib/document-ingest-rows.js +181 -0
- package/dist/src/lib/document-ingest-rows.js.map +1 -0
- package/dist/src/lib/document-ingest.d.ts +101 -0
- package/dist/src/lib/document-ingest.js +384 -0
- package/dist/src/lib/document-ingest.js.map +1 -0
- package/dist/src/lib/function-bundle.d.ts +6 -0
- package/dist/src/lib/function-bundle.js +8 -0
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +1 -1
- package/dist/src/lib/function-collect.js +16 -0
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +5 -1
- package/dist/src/lib/function-db-types.js +32 -3
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-document-types.d.ts +83 -0
- package/dist/src/lib/function-document-types.js +155 -1
- package/dist/src/lib/function-document-types.js.map +1 -1
- package/dist/src/lib/function-grants-preflight.js +5 -0
- package/dist/src/lib/function-grants-preflight.js.map +1 -1
- package/dist/src/lib/function-log-lines.d.ts +76 -0
- package/dist/src/lib/function-log-lines.js +160 -0
- package/dist/src/lib/function-log-lines.js.map +1 -0
- package/dist/src/lib/function-log-row.d.ts +29 -0
- package/dist/src/lib/function-log-row.js +73 -0
- package/dist/src/lib/function-log-row.js.map +1 -0
- package/dist/src/lib/function-run.d.ts +53 -35
- package/dist/src/lib/function-run.js +55 -44
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +6 -9
- package/dist/src/lib/function-schema-codegen.js +22 -35
- package/dist/src/lib/function-schema-codegen.js.map +1 -1
- package/dist/src/lib/function-sync.d.ts +226 -35
- package/dist/src/lib/function-sync.js +731 -99
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-versions.d.ts +122 -0
- package/dist/src/lib/function-versions.js +182 -0
- package/dist/src/lib/function-versions.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +390 -146
- package/dist/src/lib/generated-config-surfaces.js +1207 -401
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/log-inspection.d.ts +2 -0
- package/dist/src/lib/log-inspection.js +4 -0
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/output.d.ts +15 -0
- package/dist/src/lib/output.js +28 -0
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/resolve-owner.d.ts +19 -0
- package/dist/src/lib/resolve-owner.js +20 -0
- package/dist/src/lib/resolve-owner.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +49 -3
- package/dist/src/lib/skill-installer.js +275 -100
- package/dist/src/lib/skill-installer.js.map +1 -1
- package/dist/src/lib/snapshot-audit-source.d.ts +45 -0
- package/dist/src/lib/snapshot-audit-source.js +58 -0
- package/dist/src/lib/snapshot-audit-source.js.map +1 -0
- package/dist/src/lib/snapshot-audit-store.d.ts +52 -0
- package/dist/src/lib/snapshot-audit-store.js +196 -0
- package/dist/src/lib/snapshot-audit-store.js.map +1 -0
- package/dist/src/lib/snapshot-audit.d.ts +207 -0
- package/dist/src/lib/snapshot-audit.js +431 -0
- package/dist/src/lib/snapshot-audit.js.map +1 -0
- package/dist/src/lib/snapshot-build-rows.d.ts +60 -0
- package/dist/src/lib/snapshot-build-rows.js +87 -0
- package/dist/src/lib/snapshot-build-rows.js.map +1 -0
- package/dist/src/lib/snapshot-build.d.ts +50 -0
- package/dist/src/lib/snapshot-build.js +111 -0
- package/dist/src/lib/snapshot-build.js.map +1 -0
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +23 -16
- package/dist/src/lib/swift-codegen/functionGenerator.js +34 -33
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +45 -2
- package/dist/src/lib/sync-selectors.js +66 -5
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,523 +1,96 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: primitive-platform
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
is writing code that uses js-bao, js-bao-wss-client, primitive-app
|
|
6
|
-
platform feature (documents, databases,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
when something looks like a platform bug or missing platform capability, to
|
|
12
|
-
|
|
13
|
-
the app to a newer platform version — bumping js-bao, js-bao-wss-client, primitive-app, or
|
|
14
|
-
primitive CLI — which follows the "Upgrading Platform Libraries" workflow below.
|
|
4
|
+
Fetches the Primitive platform's agent guides and applies them. MUST be used whenever the user
|
|
5
|
+
is writing or reviewing code that uses js-bao, js-bao-wss-client, primitive-app,
|
|
6
|
+
primitive-functions, or any Primitive platform feature (documents, databases, server functions,
|
|
7
|
+
prompts, integrations, blobs, authentication, users/groups), and before running any `primitive`
|
|
8
|
+
CLI command. All development guidance lives in the guides this skill fetches; after writing or
|
|
9
|
+
modifying code that touches Primitive APIs, it cross-references the code against those guides
|
|
10
|
+
and corrects mistakes. Use this skill even if the user doesn't explicitly ask for it. Also use it
|
|
11
|
+
when something looks like a platform bug or missing platform capability, to record the platform
|
|
12
|
+
feedback in the app's PRIMITIVE-FEEDBACK.md. Also trigger whenever the user wants to upgrade or
|
|
13
|
+
update the app to a newer platform version — bumping js-bao, js-bao-wss-client, primitive-app, or
|
|
14
|
+
the primitive CLI — which follows the "Upgrading Platform Libraries" workflow below.
|
|
15
15
|
allowed-tools: Bash, Read, Edit, Write, Glob, Grep, Agent
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
-
# Primitive Platform
|
|
18
|
+
# Primitive Platform
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
Everything about how to build on Primitive — APIs, configuration, the CLI, patterns and
|
|
21
|
+
pitfalls — lives in the **agent guides** the `primitive` CLI serves. This skill tells you how to
|
|
22
|
+
get the right guides and when to read them. It deliberately teaches nothing about the platform
|
|
23
|
+
itself: never write Primitive code, answer a Primitive question, or run a Primitive command from
|
|
24
|
+
memory or from this file. Fetch the guide.
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
always fetch the latest from the CLI.
|
|
26
|
+
## Getting the guides
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
The Primitive CLI is **project-scoped**, and project mode is **strongly preferred** for any work
|
|
29
|
-
inside a repo. Each project has a `primitive/config.json` (committed to the repo) that defines
|
|
30
|
-
named environments (`dev`, `prod`, `staging`, …), where each environment binds an `apiUrl` and a
|
|
31
|
-
required `appId`. Per-environment auth tokens live in `.primitive/credentials.json`
|
|
32
|
-
(gitignored). There is no global "currently active app" — the active environment determines the
|
|
33
|
-
server *and* the app.
|
|
34
|
-
|
|
35
|
-
There is no global fallback. Outside a project only `primitive login` and `primitive init` work
|
|
36
|
-
(plus `logout`, login's inverse, and `bootstrap`, which creates the first admin on a fresh server);
|
|
37
|
-
every other command stops with an error naming the missing `primitive/config.json`. **Treat a
|
|
38
|
-
missing project config as a setup gap to fix, not a mode to operate in.**
|
|
39
|
-
|
|
40
|
-
**Before running any CLI commands**, your *first* check is whether the project is in project mode:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
ls primitive/config.json # exists at project root or any ancestor?
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
The two branches below are not equivalent — pick the one that matches reality and follow it.
|
|
47
|
-
|
|
48
|
-
### Branch A — `primitive/config.json` exists (project mode)
|
|
49
|
-
|
|
50
|
-
The active environment is resolved in this order:
|
|
51
|
-
1. `--env <name>` flag on the command
|
|
52
|
-
2. `PRIMITIVE_ENV` environment variable
|
|
53
|
-
3. This machine's selection in `.primitive/local.json` (written by `primitive env use`, gitignored)
|
|
54
|
-
4. `defaultEnvironment` in `primitive/config.json` — the committed team default
|
|
55
|
-
5. The sole environment, if exactly one is defined
|
|
56
|
-
|
|
57
|
-
`primitive env use <name>` does NOT edit the committed config: pointing this
|
|
58
|
-
machine at a different backend never shows up as a file change. `env list`
|
|
59
|
-
shows the resolved current environment and the committed team default
|
|
60
|
-
separately, and reports a corrupt or dangling selection rather than falling
|
|
61
|
-
back to the default.
|
|
62
|
-
|
|
63
|
-
Confirm you're targeting the correct environment:
|
|
64
|
-
|
|
65
|
-
1. **Read the CLI header.** Every command prints `Env | App | Server` at the top of its output —
|
|
66
|
-
verify these match the project's intended target.
|
|
67
|
-
2. **Inspect the project config:**
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
primitive env list # All environments (CURRENT and TEAM DEFAULT shown separately)
|
|
71
|
-
primitive env show # Details for the currently-resolved env
|
|
72
|
-
primitive whoami # Authenticated user + resolved server/app
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**To switch environments** for a one-off command, pass `--env <name>`. To point this machine at
|
|
76
|
-
a different environment, run `primitive env use <name>` (local state; the committed
|
|
77
|
-
`defaultEnvironment` is unchanged). To switch the *app* an env points at, edit the env's
|
|
78
|
-
`appId` in `primitive/config.json`. Every environment names exactly one app, and there is no
|
|
79
|
-
per-machine app selection that could differ from it.
|
|
80
|
-
|
|
81
|
-
### Branch B — no project config (project mode NOT set up)
|
|
82
|
-
|
|
83
|
-
Without a project config there is nothing to run against. Every app-scoped command (`whoami`,
|
|
84
|
-
`apps list`, `config pull`, …) exits non-zero with an error naming the missing
|
|
85
|
-
`primitive/config.json` and pointing at `primitive init`. The CLI does not fall back to
|
|
86
|
-
`~/.primitive/credentials.json` or any other global state, and no flag points a command at another
|
|
87
|
-
directory's tree — so there is no "proceed against global state" option to offer, and `--app`,
|
|
88
|
-
`--env` or environment variables do not change what the error does.
|
|
89
|
-
|
|
90
|
-
**Your default action is to get into a project.** Stop and work out with the user which of the two
|
|
91
|
-
supported flows applies before doing anything else:
|
|
92
|
-
|
|
93
|
-
1. **This repo is (or should become) a Primitive project that was never scaffolded** — run
|
|
94
|
-
`primitive init` at the repo root. `init` creates the app, writes `primitive/config.json` with a
|
|
95
|
-
`dev` environment bound to that app, and seeds that environment's credentials from the session
|
|
96
|
-
it logs you in with. It prompts before overwriting a non-empty directory, so read what it says.
|
|
97
|
-
2. **The project already exists somewhere else** — `cd` into it (or any subdirectory; the CLI walks
|
|
98
|
-
up to find `primitive/config.json`) and run the command there. To reach a different app, use
|
|
99
|
-
the project whose environment names it; there is no cross-app read from outside a project.
|
|
100
|
-
|
|
101
|
-
Prompt the user, e.g.:
|
|
102
|
-
|
|
103
|
-
> "This repo has no `primitive/config.json`, so the CLI has no environment to target and every
|
|
104
|
-
> app-scoped command stops here. If this repo should be a Primitive project, I'll run
|
|
105
|
-
> `primitive init` at the root, which creates the app and the config. If the project lives
|
|
106
|
-
> elsewhere, tell me where and I'll run the commands from there. Which is it?"
|
|
107
|
-
|
|
108
|
-
`primitive env add` does NOT create the config — it adds an environment to an existing one and
|
|
109
|
-
fails with the same error outside a project. Use it once a project exists, to bind a second
|
|
110
|
-
backend (`primitive env add prod --api-url <url> --app-id <id>`).
|
|
111
|
-
|
|
112
|
-
Do not rely on `.env` files like `PRIMITIVE_API_URL` to control CLI targeting — those are not
|
|
113
|
-
read by the CLI, and the project config is the source of truth.
|
|
114
|
-
|
|
115
|
-
**Why this matters:** If the CLI were pointed at the wrong environment (e.g., prod instead of dev),
|
|
116
|
-
commands like `primitive config push` would modify the wrong server. Refusing outside a project is
|
|
117
|
-
what makes that mistake impossible to commit silently: the only target a command has is the one the
|
|
118
|
-
project's environment names. Verify and surface it before running mutating operations.
|
|
119
|
-
|
|
120
|
-
## Step 1: Discover Available Guides
|
|
121
|
-
|
|
122
|
-
Before writing or reviewing any Primitive code, run:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
primitive guides list
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
This returns the full list of available guide topics with descriptions, keywords, and use cases.
|
|
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.
|
|
144
|
-
|
|
145
|
-
## Step 2: Fetch the Relevant Guides
|
|
146
|
-
|
|
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:
|
|
28
|
+
`primitive guides` works anywhere, inside a Primitive project or not.
|
|
149
29
|
|
|
150
30
|
```bash
|
|
31
|
+
primitive guides list # every topic: description, keywords, use cases, variants
|
|
151
32
|
primitive guides get <topic> --language <ts|swift> --platform <web|ios|macos>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
**
|
|
169
|
-
or
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
If no issues are found, briefly confirm the code follows best practices.
|
|
215
|
-
|
|
216
|
-
## CLI Quick Reference
|
|
217
|
-
|
|
218
|
-
Remind users of these essential commands when relevant:
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
# Verify current configuration (DO THIS FIRST)
|
|
222
|
-
primitive env list # List environments (CURRENT vs committed TEAM DEFAULT)
|
|
223
|
-
primitive env show # Details for the currently-resolved env (api URL, app ID)
|
|
224
|
-
primitive whoami # Authenticated user + resolved server/app
|
|
225
|
-
|
|
226
|
-
# Switching environments
|
|
227
|
-
primitive env use <name> # Select this machine's environment (gitignored local state)
|
|
228
|
-
primitive --env <name> <command> # One-off override for a single command
|
|
229
|
-
PRIMITIVE_ENV=<name> <command> # Override via env var (useful in scripts/CI)
|
|
230
|
-
|
|
231
|
-
# Setup — existing project (most common: adopting Primitive in an existing repo)
|
|
232
|
-
pnpm add -g primitive-admin # Install CLI (pnpm preferred; npm works too)
|
|
233
|
-
primitive env add dev --api-url <url> --app-id <id> # Add env to primitive/config.json
|
|
234
|
-
primitive env add prod --api-url <url> --app-id <id> # (creates the file if missing)
|
|
235
|
-
primitive login # Authenticate (tokens stored per-env)
|
|
236
|
-
|
|
237
|
-
# Setup — brand-new project (greenfield only)
|
|
238
|
-
primitive init my-new-app # Scaffolds template, creates a new app
|
|
239
|
-
# on the server, runs pnpm install.
|
|
240
|
-
primitive init my-new-app --platform web,ios # One app, a web client AND a native
|
|
241
|
-
# client: web/ and ios/, with the project
|
|
242
|
-
# config, git repo and the shared
|
|
243
|
-
# models/models.toml at the root.
|
|
244
|
-
|
|
245
|
-
# Setup — adding a client to an app that already exists
|
|
246
|
-
primitive init ios --platform ios # Run INSIDE the app's repo: adds the
|
|
247
|
-
# client to the app the nearest ancestor
|
|
248
|
-
# primitive/config.json targets. Writes
|
|
249
|
-
# no nested .primitive/ or .git/ and makes
|
|
250
|
-
# no commit — review with `git status`.
|
|
251
|
-
# Read the multi-client guide first.
|
|
252
|
-
|
|
253
|
-
# Guides (the most important commands for development)
|
|
254
|
-
primitive guides list # See all guides: topics, descriptions, available (lang,platform) combinations
|
|
255
|
-
primitive guides get <topic> # Read a guide's default variant
|
|
256
|
-
primitive guides get <topic> --language swift --platform ios # Read a specific language/platform variant
|
|
257
|
-
|
|
258
|
-
# Configuration as Code
|
|
259
|
-
primitive config init # Scaffold the environment's config directory
|
|
260
|
-
primitive config pull # Pull config from server
|
|
261
|
-
primitive config push # Push config to server
|
|
262
|
-
primitive config diff # Preview changes before push
|
|
263
|
-
|
|
264
|
-
# Taking something out of service (or putting it back)
|
|
265
|
-
primitive workflows disable <key> # same verb pair on every type that has one
|
|
266
|
-
primitive cron-triggers disable <id>
|
|
267
|
-
primitive webhooks disable <id>
|
|
268
|
-
primitive integrations disable <key>
|
|
269
|
-
primitive prompts disable <key>
|
|
270
|
-
primitive functions disable <id> # a pushed server function
|
|
271
|
-
primitive users disable <user-id> # a person, not an object — reversible
|
|
272
|
-
primitive feature-flags disable <key> # super-admin platform toggle
|
|
273
|
-
|
|
274
|
-
# Retiring an object (soft delete; NOT the same as disable)
|
|
275
|
-
primitive workflows archive <key> # same verb on the six types that carry
|
|
276
|
-
primitive cron-triggers archive <id> # `archived`; confirms first, -y skips
|
|
277
|
-
primitive webhooks archive <id>
|
|
278
|
-
primitive integrations archive <id> # the ID column of `integrations list`
|
|
279
|
-
primitive prompts archive <id> # the ID column of `prompts list`
|
|
280
|
-
primitive functions archive <id> # the ID column of `functions list`
|
|
281
|
-
|
|
282
|
-
# Running a server function (#3448)
|
|
283
|
-
primitive functions invoke <key> --input '{"n":1}' # request mode: run it, print the result
|
|
284
|
-
primitive functions start <key> --wait # task mode: start a run and wait for it
|
|
285
|
-
primitive functions runs wait <function-id> <run-id> # wait for a run already started
|
|
286
|
-
primitive functions invoke <key> --user <user-id> # as that app user (admin/owner; token revoked after)
|
|
287
|
-
primitive functions invoke <key> --as system # no caller: ctx.user null, a manual trigger
|
|
288
|
-
primitive functions logs <function-id> --invocation <id> # the record an invoke's id names
|
|
289
|
-
primitive functions logs <function-id> --run <run-id> # one task run's records
|
|
290
|
-
# invoke/start take the KEY; runs, wait, steps, terminate and logs take the ID.
|
|
291
|
-
# Exit codes: 0 completed, 1 failed or refused, 124 the wait gave up, 130 Ctrl-C.
|
|
292
|
-
# The wrong verb is REFUSED, never converted — on both sides.
|
|
293
|
-
|
|
294
|
-
# Common operations
|
|
295
|
-
primitive apps list # List apps on the active env's server
|
|
296
|
-
primitive apps create "Name" # Create an app (does NOT auto-bind to an env;
|
|
297
|
-
# edit primitive/config.json or use `env add` to bind)
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
**Availability is not configuration.** Whether a workflow, cron trigger,
|
|
301
|
-
webhook, integration, prompt or server function is in service is one
|
|
302
|
-
server-owned `status` field, changed only by `<noun> enable|disable` (or the
|
|
303
|
-
matching console action) and by the delete flow, whose CLI spelling is
|
|
304
|
-
`<noun> archive` on those same six types. It is not a TOML key: `config pull` does not emit it,
|
|
305
|
-
`config push` never sends it, and a file that still carries a `status` line
|
|
306
|
-
fails the push with a message naming the verbs. So a push cannot put something back in service
|
|
307
|
-
that an operator took out of it, and a fresh environment stood up from config
|
|
308
|
-
has everything active. Anything newly CREATED is active; there is no `draft`
|
|
309
|
-
state on any object. For a server function, creation is the only writer of
|
|
310
|
-
`active`: a `config push` to a disabled function updates its code and leaves it
|
|
311
|
-
out of service, so shipping a fix never puts a public endpoint back in service
|
|
312
|
-
on its own.
|
|
313
|
-
|
|
314
|
-
The keys spelled `status` that ARE yours are the per-VERSION ones: a prompt's
|
|
315
|
-
`[[configs]] status`, and a workflow named config's `[config] status` in its
|
|
316
|
-
`workflows/<key>.configs/<name>.toml` sidecar. They say which named version is
|
|
317
|
-
retired, not whether the object is serving. For a prompt, `config pull` writes
|
|
318
|
-
the line only for a config that is retired (`status = "archived"`); an omitted
|
|
319
|
-
line means `active`, so an ordinary pulled prompt file carries no `status` at
|
|
320
|
-
all. A workflow config sidecar still states its own either way.
|
|
321
|
-
|
|
322
|
-
**`archive` retires, `--prune` destroys.** `<noun> archive <id>` writes the
|
|
323
|
-
third value, `archived`: the delete lifecycle rather than availability. The row
|
|
324
|
-
is kept so its history still resolves, it goes on holding its key — and, for
|
|
325
|
-
webhooks and cron triggers, its slot against the per-app cap — `enable` refuses
|
|
326
|
-
it, and there is no un-archive. Reclaiming the key means a hard delete: remove
|
|
327
|
-
the object's TOML file and run a confirmed `primitive config push --prune`, then
|
|
328
|
-
re-add the file and push. There is no `--hard` flag and no per-type `delete`
|
|
329
|
-
verb; prune-by-push is the CLI's only hard delete. `users` and `admins` carry
|
|
330
|
-
`enable`/`disable` but no `archive` — people are not configuration objects.
|
|
331
|
-
|
|
332
|
-
Per-VERSION status is a different thing and stays in TOML: a prompt, workflow
|
|
333
|
-
or script config retires a named version with `status = "archived"` inside its
|
|
334
|
-
`[[configs]]` entry, which says which version is live, not whether the object
|
|
335
|
-
is serving.
|
|
336
|
-
|
|
337
|
-
## Debugging and inspection
|
|
338
|
-
|
|
339
|
-
The CLI is the reference surface for inspecting a running app — reading what
|
|
340
|
-
happened without opening the admin UI. The inspection commands share one set of
|
|
341
|
-
conventions so they behave predictably across resources.
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
# Workflow runs (the reference tailing command)
|
|
345
|
-
primitive workflows runs list <workflow-id> # recent runs
|
|
346
|
-
primitive workflows runs list <workflow-id> --json # normalized inspection items
|
|
347
|
-
primitive workflows runs list <workflow-id> --watch # re-render the list every 2s (snapshot)
|
|
348
|
-
primitive workflows runs list <workflow-id> --follow # append runs as they start or change (tail)
|
|
349
|
-
primitive workflows runs list --user-id <user-id> # one user's runs, across every workflow
|
|
350
|
-
primitive workflows runs steps <workflow-id> <run-id> # every step run of one run
|
|
351
|
-
primitive workflows runs status <workflow-id> <run-id> # one run's status + step results
|
|
352
|
-
|
|
353
|
-
# The other log-shaped views
|
|
354
|
-
primitive integrations logs <integration-id> # outbound calls: status, timing, actor
|
|
355
|
-
primitive webhooks events <webhook-id> # inbound deliveries and how they were handled
|
|
356
|
-
primitive analytics events # app activity events
|
|
357
|
-
|
|
358
|
-
# Per-subject analytics — one home, the analytics noun
|
|
359
|
-
primitive analytics workflows --window-days 7 # top workflows by runs
|
|
360
|
-
primitive analytics prompts --window-days 7 # top prompts by executions
|
|
361
|
-
primitive analytics integrations # calls, error rate, latency
|
|
362
|
-
primitive analytics workflow-usage # step kinds configured, and their runs
|
|
363
|
-
|
|
364
|
-
# Blob storage
|
|
365
|
-
primitive blob-buckets list # buckets in the app (app-scoped: no selector)
|
|
366
|
-
primitive blob-buckets head <bucket> <key> # object metadata without downloading
|
|
367
|
-
|
|
368
|
-
# Live connections and sessions
|
|
369
|
-
primitive connections list --user-id <id> # active WebSocket connections
|
|
370
|
-
primitive sessions list --user-id <id> # auth sessions
|
|
371
|
-
|
|
372
|
-
# Database records and app documents
|
|
373
|
-
primitive databases records query <database> ... # read records
|
|
374
|
-
primitive databases records get <database> <model-name> <record-id>
|
|
375
|
-
primitive documents records query <document> <model-name> [--filter '{...}']
|
|
376
|
-
primitive documents records get <document> <model-name> <record-id>
|
|
377
|
-
primitive documents dump <document-id> # every model's records as JSON
|
|
378
|
-
primitive documents export <document-id> # dump a document's contents
|
|
379
|
-
primitive documents create "<title>" [--owner <user-id-or-email>] # mint a document (--owner needs a super-admin or assigned-console-admin token; app-role admins create as themselves)
|
|
380
|
-
primitive documents delete <document-id> [-y] [--json] # delete a document (document owner / app owner / super-admin or assigned-console-admin; app-role admins only via a containing collection's document.delete rule)
|
|
381
|
-
|
|
382
|
-
# Metadata
|
|
383
|
-
primitive metadata get <type> <id> <category> # resource metadata VALUES
|
|
384
|
-
primitive metadata-category-configs list # category DEFINITIONS (schema + read/write rules)
|
|
385
|
-
primitive metadata-category-configs get <type> <category>
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
**Uniform flags across every inspection command:**
|
|
389
|
-
|
|
390
|
-
- `--app <id>` — target app (falls back to the resolved env's app).
|
|
391
|
-
- `--json` — the output you parse in scripts. Most commands print the endpoint
|
|
392
|
-
payload as-is; the log views below normalize theirs into the shared item
|
|
393
|
-
shape. Either way it is a JSON document, never a bare array — except the
|
|
394
|
-
type-config readers (`group-type-configs`, `collection-type-configs`,
|
|
395
|
-
`metadata-category-configs`), whose `list --json` prints the configs as a
|
|
396
|
-
bare array (`jq '.[]'`). Data goes to
|
|
397
|
-
stdout; status, warnings and the `CLI Version: …` banner go to stderr — so
|
|
398
|
-
even the always-JSON commands that take no `--json` flag pipe cleanly
|
|
399
|
-
(`primitive documents dump <doc> | jq .`).
|
|
400
|
-
- `--limit <n>` / `--cursor <c>` — paged reads. The response envelope is always
|
|
401
|
-
`{ items, hasMore, nextCursor? }`. Both `records query` verbs print that
|
|
402
|
-
envelope whatever shape their endpoint returns, and neither emits the
|
|
403
|
-
deprecated `cursor` alias — read `nextCursor`. Aggregate reads walk the
|
|
404
|
-
`nextCursor` chain.
|
|
405
|
-
- `list` always requires a **selector** (`--user-id`, `--owner`, a resource id, …)
|
|
406
|
-
so it never enumerates the whole app — **except** genuinely app-scoped
|
|
407
|
-
resources like `blob-buckets list`, which lists the app's buckets directly.
|
|
408
|
-
`--user-id` is the spelling on every list/inspection selector; `connections
|
|
409
|
-
list`, `sessions list` and `tokens list` still accept `--user` as a
|
|
410
|
-
deprecated alias that prints a notice on stderr.
|
|
411
|
-
|
|
412
|
-
**One `--json` item shape across the log views.** `workflows runs list`,
|
|
413
|
-
`workflows runs steps`, `integrations logs`, `webhooks events` and `analytics
|
|
414
|
-
events` all emit the same item envelope inside their endpoint's pagination
|
|
415
|
-
envelope — never a bare array:
|
|
416
|
-
|
|
417
|
-
```json
|
|
418
|
-
{
|
|
419
|
-
"items": [
|
|
420
|
-
{
|
|
421
|
-
"source": "workflow-run",
|
|
422
|
-
"timestamp": "2026-07-24T18:03:11.204Z",
|
|
423
|
-
"outcome": "error",
|
|
424
|
-
"nativeStatus": "failed",
|
|
425
|
-
"correlation": { "runId": "01J…", "workflowId": "01J…", "userId": "01J…" },
|
|
426
|
-
"detail": { "workflowKey": "summarize", "errorMessage": "…" }
|
|
427
|
-
}
|
|
428
|
-
],
|
|
429
|
-
"hasMore": false
|
|
430
|
-
}
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
- `source` is the discriminator: `workflow-run`, `workflow-step`,
|
|
434
|
-
`integration`, `webhook`, `activity`.
|
|
435
|
-
- `outcome` is the normalized verdict — `ok`, `error`, `pending`, or `neutral`
|
|
436
|
-
— and `nativeStatus` keeps the source's own value (an HTTP integer, `failed`,
|
|
437
|
-
`duplicate`, …) verbatim, so filtering on the raw value stays possible. A
|
|
438
|
-
webhook that was accepted but matched no active workflow is `ok` with
|
|
439
|
-
`nativeStatus: "workflow_inactive"` — a non-dispatch, not a failure.
|
|
440
|
-
- `correlation` carries the pivot keys that let you follow one operation
|
|
441
|
-
between views (`runId`, `stepId`, `traceId`, `workflowId`, `webhookId`,
|
|
442
|
-
`userId`) plus the row's own id (`stepRunId`, `eventId`), so a row you
|
|
443
|
-
printed can always be looked up again.
|
|
444
|
-
- `detail` is a per-source allowlist of operator-facing fields, not the whole
|
|
445
|
-
stored record.
|
|
446
|
-
- Pagination rides alongside `items`: `hasMore` plus `nextCursor` where the
|
|
447
|
-
endpoint pages by cursor, `page`/`pageSize`/`totalRows` for `analytics
|
|
448
|
-
events`. `integrations logs` returns `{ items }` — it filters within a
|
|
449
|
-
bounded scan rather than paging.
|
|
450
|
-
- The normalization is `--json`-only: the human tables stay per-view because
|
|
451
|
-
each shows columns the shared shape has no room for (queue delay, inter-step
|
|
452
|
-
gap, token counts, event id). `--watch --json` reprints the same envelope
|
|
453
|
-
each tick; `--follow --json` emits one item per line (newline-delimited
|
|
454
|
-
JSON), since a tail has no closing bracket to wait for.
|
|
455
|
-
|
|
456
|
-
**Per-user inspection.** Two views can be keyed on a user:
|
|
457
|
-
|
|
458
|
-
```bash
|
|
459
|
-
primitive workflows runs list --user-id <user-id> # every run that user started
|
|
460
|
-
primitive analytics events --user-id <user-id> # that user's activity events
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
`workflows runs list --user-id` makes `<workflow-id>` optional — it lists the
|
|
464
|
-
user's runs across every workflow. Pass both to narrow to one workflow.
|
|
465
|
-
`integrations logs` and `webhooks events` have no `--user-id`: an integration
|
|
466
|
-
invocation records the actor but is indexed by integration, and a webhook event
|
|
467
|
-
carries no user identity at all. To follow a user through those, take the
|
|
468
|
-
`runId`/`traceId` from that user's workflow runs and match it in the
|
|
469
|
-
integration logs.
|
|
470
|
-
|
|
471
|
-
**`--watch` vs `--follow` (both poll — there is no server push):**
|
|
472
|
-
|
|
473
|
-
- `--watch` re-fetches the current snapshot each interval and re-renders the whole
|
|
474
|
-
view (a periodic re-`list`/`get`). It works on any list command with no server
|
|
475
|
-
change.
|
|
476
|
-
- `--follow` tails: it appends new/changed rows since a server-owned checkpoint,
|
|
477
|
-
like `tail -f`. It is offered **only** where the endpoint supports the resume
|
|
478
|
-
contract (today: `workflows runs list`); other commands offer only `--watch`
|
|
479
|
-
until their endpoint adds it. Passing `--follow` where it isn't supported fails
|
|
480
|
-
with a clear message.
|
|
481
|
-
- `--interval <seconds>` sets the poll interval (minimum 1s, default 2s).
|
|
482
|
-
- `--watch` and `--follow` are mutually exclusive.
|
|
483
|
-
- `--json --follow` emits **NDJSON** (one JSON object per new row per line) — a
|
|
484
|
-
tail is an unbounded stream, so it can't be one array; pipe it to `jq -c`.
|
|
485
|
-
`--json --watch` emits one array per redraw.
|
|
486
|
-
- Ctrl-C stops a tail cleanly (exit 0).
|
|
487
|
-
|
|
488
|
-
**`--follow` shows the latest observed version of a row, not every state change.**
|
|
489
|
-
It re-emits a run when a newer version is observed between polls, so a run you
|
|
490
|
-
already saw can reappear at its new position after its status changes — that is
|
|
491
|
-
expected, not a duplicate. Fast transitions that happen between two polls collapse
|
|
492
|
-
to the latest stored version. This is near-lossless observed-version tailing:
|
|
493
|
-
rows sharing a timestamp, or a delayed index update, can occasionally be skipped
|
|
494
|
-
or re-shown. Use it to watch activity, not as an exactly-once event log.
|
|
495
|
-
|
|
496
|
-
## When the User is Starting a New Feature
|
|
497
|
-
|
|
498
|
-
If the user describes a new feature they want to build:
|
|
499
|
-
|
|
500
|
-
1. **Verify CLI configuration** per Step 0 — confirm the active environment in
|
|
501
|
-
`primitive/config.json` (and its bound `apiUrl` / `appId`) match the project's intended target
|
|
502
|
-
before running any commands
|
|
503
|
-
2. **Run `primitive guides list`** to discover available topics and their `(language, platform)` combinations
|
|
504
|
-
3. **Identify which guides are relevant** to their feature from the list output
|
|
505
|
-
4. **Fetch those guides** with `primitive guides get <topic> --language <lang> --platform <platform>`
|
|
506
|
-
(using the project's language/platform; omit the flags if unknown)
|
|
507
|
-
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
|
|
508
|
-
6. **Outline the implementation steps** referencing specific patterns from the guides
|
|
509
|
-
7. **Write the code** following the patterns exactly
|
|
510
|
-
8. **Review automatically** per Step 4 above
|
|
511
|
-
|
|
512
|
-
## When the User Asks "How Do I...?"
|
|
513
|
-
|
|
514
|
-
For any question about Primitive platform capabilities:
|
|
515
|
-
|
|
516
|
-
1. **Run `primitive guides list`** to find the relevant topic (and its available language/platform combinations)
|
|
517
|
-
2. **Fetch the guide**: `primitive guides get <topic> --language <lang> --platform <platform>` (omit the flags if the language/platform is unknown)
|
|
518
|
-
3. **Answer from the guide content** — don't guess or make up APIs
|
|
519
|
-
4. **Include working code examples** from the guide
|
|
520
|
-
5. **Point the user to the guide** for further reading: "You can see more examples by running `primitive guides get <topic>`"
|
|
33
|
+
primitive guides get <topic> # the topic's default variant
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- **Which topics.** Read the `list` output and fetch every guide whose topic the task touches.
|
|
37
|
+
A feature usually spans several (a server function that writes a database and runs a prompt
|
|
38
|
+
needs all three guides). Fetch them BEFORE writing code.
|
|
39
|
+
- **Which variant.** Pass the project's language and platform. A `Package.swift`,
|
|
40
|
+
`*.xcodeproj`, or `project.yml` means `--language swift` with `--platform ios` or `macos`; a
|
|
41
|
+
web app with `package.json` and `js-bao-wss-client` means `--language ts --platform web`. The
|
|
42
|
+
`COMBINATIONS` column of `list` shows what each guide offers. The flags never fail: an unknown
|
|
43
|
+
value or unavailable combination falls back to the default variant, so pass your best guess,
|
|
44
|
+
or omit them when you can't tell. `--language` accepts `typescript`/`javascript`/`js` for `ts`.
|
|
45
|
+
- **Which channel.** Outside a project the CLI serves the production guides. Inside a project it
|
|
46
|
+
serves the guides matching the server the project's current environment points at, so an app
|
|
47
|
+
on the alpha environment reads the alpha guides. The version follows the installed
|
|
48
|
+
`js-bao-wss-client`.
|
|
49
|
+
- **Freshness.** Guides are cached under `~/.primitive/guides/` for 24 hours. After upgrading the
|
|
50
|
+
CLI or the libraries, pass `--refresh` on the first `list` and `get`.
|
|
51
|
+
- **Where to start.** `configuration` covers projects, environments, and pushing config;
|
|
52
|
+
`data-modeling` covers choosing where data lives; `inspecting-and-debugging` covers reading a
|
|
53
|
+
running app. For a CLI command you have not used, fetch the guide for its feature first.
|
|
54
|
+
|
|
55
|
+
## Writing code
|
|
56
|
+
|
|
57
|
+
1. Fetch the guides for every feature the change touches.
|
|
58
|
+
2. Follow them exactly: method names, argument order, lifecycle, configuration shapes, and the
|
|
59
|
+
follow-up steps they name (codegen, pushing config, typechecking).
|
|
60
|
+
3. Never guess an API. If the guide you have does not answer the question, fetch the related
|
|
61
|
+
guides it links before inventing anything. If none does, it is a platform gap: see "The
|
|
62
|
+
platform feedback doc" below.
|
|
63
|
+
4. Before running a `primitive` command that changes server state, read the `Env | App | Server`
|
|
64
|
+
header every command prints and confirm it names the environment you intend. The
|
|
65
|
+
`configuration` guide explains projects and environments.
|
|
66
|
+
|
|
67
|
+
## Reviewing code (automatic, after every change)
|
|
68
|
+
|
|
69
|
+
After writing or modifying code that touches Primitive, review it without being asked:
|
|
70
|
+
|
|
71
|
+
1. **Identify the features touched.** Imports from `js-bao`, `js-bao-wss-client`,
|
|
72
|
+
`primitive-app`, or `primitive-functions`; files in the project's configuration tree; model
|
|
73
|
+
definitions and schemas.
|
|
74
|
+
2. **Fetch those guides** in the project's language and platform.
|
|
75
|
+
3. **Compare the code against them.** API usage, lifecycle, access and authorization, anything
|
|
76
|
+
the guide warns against, and any follow-up step the guide requires that the change skipped.
|
|
77
|
+
4. **Fix what's wrong.** Cite the guide section, edit the file (don't just suggest), and name any
|
|
78
|
+
command the user still needs to run. If nothing is wrong, say so briefly.
|
|
79
|
+
|
|
80
|
+
## When the user is starting a new feature
|
|
81
|
+
|
|
82
|
+
1. Run `primitive guides list` and pick every relevant topic.
|
|
83
|
+
2. Fetch those guides in the project's language and platform.
|
|
84
|
+
3. Recommend a data model from the guides. If requirements are ambiguous, ask clarifying
|
|
85
|
+
questions first: a data model is much easier to get right up front than to migrate.
|
|
86
|
+
4. Outline the implementation, citing the guide patterns it follows.
|
|
87
|
+
5. Write the code, then review it as above.
|
|
88
|
+
|
|
89
|
+
## When the user asks "How do I…?"
|
|
90
|
+
|
|
91
|
+
1. Find the topic with `primitive guides list`, then fetch it.
|
|
92
|
+
2. Answer from the guide, with its examples. Don't guess or invent APIs.
|
|
93
|
+
3. Point the user at the guide for more: `primitive guides get <topic>`.
|
|
521
94
|
|
|
522
95
|
## Upgrading Platform Libraries
|
|
523
96
|
|
|
@@ -528,7 +101,7 @@ moved too, and new platform capabilities should be considered. The refreshed gui
|
|
|
528
101
|
source of truth for what the platform can do now.
|
|
529
102
|
|
|
530
103
|
The backend is upgraded by the platform team, not by the app — the app only chooses which
|
|
531
|
-
environment it points at (
|
|
104
|
+
environment it points at (see the `configuration` guide). A library upgrade against the production environment
|
|
532
105
|
needs no server-side changes.
|
|
533
106
|
|
|
534
107
|
### 1. Snapshot the current state
|
|
@@ -632,16 +205,18 @@ guides for the app's feature areas. Compare against what the app actually does:
|
|
|
632
205
|
|
|
633
206
|
### 8. Verify and stamp
|
|
634
207
|
|
|
635
|
-
Run the app's tests, apply the
|
|
208
|
+
Run the app's tests, apply the post-change review above to everything modified, and
|
|
636
209
|
update the feedback doc's upgrade stamp (date, channel, versions, and the template
|
|
637
210
|
commit synced in Step 6).
|
|
638
211
|
|
|
639
212
|
### The platform feedback doc
|
|
640
213
|
|
|
641
214
|
Convention: a `PRIMITIVE-FEEDBACK.md` at the app root tracks the app's relationship to the
|
|
642
|
-
platform — when it was last upgraded,
|
|
643
|
-
This is what makes upgrades mechanical instead of
|
|
644
|
-
|
|
215
|
+
platform — when it was last upgraded, which workarounds exist for platform problems, and
|
|
216
|
+
what the app found missing or broken. This is what makes upgrades mechanical instead of
|
|
217
|
+
archaeological, and it is also how platform feedback reaches the platform team: **the
|
|
218
|
+
platform team reads this document. No issue is filed from an app.** If the app doesn't
|
|
219
|
+
have one, create it the first time there is something to record:
|
|
645
220
|
|
|
646
221
|
```markdown
|
|
647
222
|
# Platform Feedback
|
|
@@ -653,171 +228,26 @@ have one, create it during the first upgrade:
|
|
|
653
228
|
- Template: primitive-vue-template @ main 0f1c2d3
|
|
654
229
|
|
|
655
230
|
## Open items
|
|
656
|
-
-
|
|
231
|
+
- Symptom or missing capability. Evidence: `POST /app/x/api/databases` returns 500
|
|
232
|
+
(error text below). Workaround: `src/lib/foo.ts:42` (retry loop). Remove when: the
|
|
233
|
+
create returns 201 on the first call.
|
|
657
234
|
|
|
658
235
|
## Resolved
|
|
659
|
-
-
|
|
236
|
+
- Symptom. Workaround removed 2026-07-21.
|
|
660
237
|
```
|
|
661
238
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
## Filing Platform Issues
|
|
667
|
-
|
|
668
|
-
Sometimes the problem is in the platform itself — a bug in js-bao, the client library,
|
|
669
|
-
the CLI, or a capability the platform doesn't have — rather than in the user's app.
|
|
670
|
-
Platform work is tracked as GitHub issues on `Primitive-Labs/js-bao-wss`.
|
|
671
|
-
|
|
672
|
-
**Gate: only suggest filing an issue if the signed-in GitHub user is a member of the
|
|
673
|
-
Primitive-Labs org.** Check silently before ever raising the option:
|
|
674
|
-
|
|
675
|
-
```bash
|
|
676
|
-
gh api user/memberships/orgs/Primitive-Labs --jq .state 2>/dev/null
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
If this doesn't print `active` (not a member, or `gh` is missing or unauthenticated),
|
|
680
|
-
don't mention filing an issue at all — help the user work around the problem instead.
|
|
681
|
-
|
|
682
|
-
### Tracker hygiene (issues and comments alike)
|
|
683
|
-
|
|
684
|
-
Everything you write to the tracker — new issues and follow-up comments on existing
|
|
685
|
-
ones — is read by an agent pipeline and by maintainers who have none of your session's
|
|
686
|
-
context. What you write is all they get, and investigating is the assignee's job —
|
|
687
|
-
yours is to state the problem clearly.
|
|
239
|
+
**When something looks like a platform problem** — a bug in js-bao, the client library,
|
|
240
|
+
the CLI, or a capability the platform doesn't have — rather than a problem in the user's
|
|
241
|
+
app, write it into this document under **Open items**. That is the whole of what to do
|
|
242
|
+
with it; help the user work around the problem in the app, and record:
|
|
688
243
|
|
|
689
|
-
- **
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
- **
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
- **Describe the problem, not the solution.** Don't prescribe the fix or assume a
|
|
697
|
-
particular implementation.
|
|
698
|
-
- **Don't relitigate decisions rejected in earlier issues** — carry forward the
|
|
699
|
-
discovered tradeoffs, stated neutrally.
|
|
700
|
-
|
|
701
|
-
### Bugs (an existing platform feature not working as designed)
|
|
702
|
-
|
|
703
|
-
Body template — fill each section with as much precision as possible, so the issue is
|
|
704
|
-
easy to reproduce on the first try:
|
|
705
|
-
|
|
706
|
-
```
|
|
707
|
-
## Repro steps
|
|
708
|
-
<numbered, precise, minimal: exact API calls, config, versions. The test:
|
|
709
|
-
someone with no context reproduces it on the first try>
|
|
710
|
-
|
|
711
|
-
## Observed behavior
|
|
712
|
-
<what actually happens, with verbatim error text / response bodies in fenced
|
|
713
|
-
blocks>
|
|
714
|
-
|
|
715
|
-
## Expected behavior
|
|
716
|
-
<what should happen instead, stated as an observable outcome — this is what
|
|
717
|
-
"fixed" means, and what a fix will be tested against>
|
|
718
|
-
|
|
719
|
-
## Design review needed?
|
|
720
|
-
<tick any that apply; leave all unticked if the fix looks self-contained>
|
|
721
|
-
|
|
722
|
-
- [ ] Involves a critical security decision (auth, permissions, CEL, secrets, webhook
|
|
723
|
-
verification, DO routing)
|
|
724
|
-
- [ ] Risks a performance regression on a per-request, per-message or per-connection path
|
|
725
|
-
- [ ] Requires a data model or index change (`models.yaml`)
|
|
726
|
-
- [ ] Breaks an existing API contract (removes or retypes something in `openapi.json`, or
|
|
727
|
-
changes a `src/client` public signature non-additively)
|
|
728
|
-
```
|
|
729
|
-
|
|
730
|
-
Write "Expected behavior" as the acceptance criterion: the observable outcome that
|
|
731
|
-
defines the bug as fixed. If prior investigation exists (an earlier thread, a
|
|
732
|
-
session's debugging), link it — don't inline a root-cause theory as fact.
|
|
733
|
-
|
|
734
|
-
The "Design review needed?" checkboxes decide the bug's route: any tick sends it
|
|
735
|
-
through the design gate; all unticked sends it straight to implementation, with
|
|
736
|
-
"Expected behavior" as the acceptance criteria. When unsure, leave a box unticked —
|
|
737
|
-
the worker re-checks against its own diff and routes itself back if one applies.
|
|
738
|
-
|
|
739
|
-
Labels: `type:bug` only.
|
|
740
|
-
|
|
741
|
-
### Features / enhancements / platform extensions
|
|
742
|
-
|
|
743
|
-
```
|
|
744
|
-
## Problem
|
|
745
|
-
<the application-level problem being solved, and who hits it — a concrete
|
|
746
|
-
scenario, not an abstraction, and not a solution>
|
|
747
|
-
|
|
748
|
-
## What I tried
|
|
749
|
-
<existing platform features attempted, and why each falls short — omit if none apply>
|
|
750
|
-
|
|
751
|
-
## What a solution needs to enable
|
|
752
|
-
<the outcomes a solution must make possible, as bullets — capabilities from
|
|
753
|
-
the consumer's perspective, not designs>
|
|
754
|
-
```
|
|
755
|
-
|
|
756
|
-
Keep "What a solution needs to enable" outcome-shaped: "an app can resume a follow
|
|
757
|
-
from the last event it saw across restarts" — not "add a `resumeAfter` token to the
|
|
758
|
-
list endpoint". If you have a design idea worth preserving, put it in a comment,
|
|
759
|
-
clearly labeled as an idea — never in the body.
|
|
760
|
-
|
|
761
|
-
Labels: `type:feature` only.
|
|
762
|
-
|
|
763
|
-
### Filing
|
|
764
|
-
|
|
765
|
-
Use only `type:bug` or `type:feature` (e.g. file performance problems as `type:bug`
|
|
766
|
-
with measurements in the repro steps). Search open issues for duplicates first:
|
|
767
|
-
|
|
768
|
-
```bash
|
|
769
|
-
gh issue list --repo Primitive-Labs/js-bao-wss --search "<keywords>" --state open \
|
|
770
|
-
--json number,title
|
|
771
|
-
```
|
|
772
|
-
|
|
773
|
-
Then create the issue with exactly one `type:*` label and nothing else — **no
|
|
774
|
-
assignee** (triage assigns sponsors; unassigned is the correct starting state), no
|
|
775
|
-
priority labels, no `state:*` label, and no `dispatch-v3` (state and dispatch labels
|
|
776
|
-
are added together by triage once it judges the filing complete — never by the
|
|
777
|
-
filer; an issue waiting for triage is the correct starting state):
|
|
778
|
-
|
|
779
|
-
```bash
|
|
780
|
-
gh issue create --repo Primitive-Labs/js-bao-wss \
|
|
781
|
-
--title "<one-line symptom or need>" \
|
|
782
|
-
--label "type:bug" \
|
|
783
|
-
--body "<template body>"
|
|
784
|
-
```
|
|
244
|
+
- **The symptom**: one line, what goes wrong or what is missing.
|
|
245
|
+
- **The evidence**: the exact call, config, or command and the verbatim error or
|
|
246
|
+
response, in a fenced block if it is more than a line. Precision here is what lets the
|
|
247
|
+
platform team reproduce it.
|
|
248
|
+
- **The workaround location**: `file:line` of the code the app carries because of it.
|
|
249
|
+
- **The condition for removing the workaround**: the observable platform behavior that
|
|
250
|
+
means the workaround can come out. A later upgrade re-tests exactly this (Step 5).
|
|
785
251
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
`docs-filing.md`), which the pipeline validates against with
|
|
789
|
-
`.claude/skills/_shared/check-filing.sh` before an issue can be picked up — a body
|
|
790
|
-
missing a required section stalls in triage until a human repairs it. If the
|
|
791
|
-
templates here and the repo's ever disagree, the repo's win. When working inside a
|
|
792
|
-
js-bao-wss checkout, don't file by hand at all: use that repo's `/file-issue` skill,
|
|
793
|
-
which interviews for the sections, validates the draft offline, and files with the
|
|
794
|
-
right labels.
|
|
795
|
-
|
|
796
|
-
### Follow-up comments on existing issues
|
|
797
|
-
|
|
798
|
-
When the duplicate search finds an issue that already covers the problem, comment
|
|
799
|
-
there instead of filing. A comment is a **delta on the thread, not a fresh report** —
|
|
800
|
-
the hygiene rules above (1000-character prose cap, fenced blocks exempt, problem not
|
|
801
|
-
solution, self-contained) apply to it unchanged, plus:
|
|
802
|
-
|
|
803
|
-
- **Lead with what's new**: a repro, a counterexample, a version/deployment where the
|
|
804
|
-
behavior changed, a confirmation that it no longer reproduces. Don't restate what
|
|
805
|
-
the thread already establishes — reference it.
|
|
806
|
-
- **Evidence goes in fenced blocks**, exactly as in an issue body: numbered repro
|
|
807
|
-
steps, exact commands and API calls, verbatim errors, versions and app/resource
|
|
808
|
-
ids. Prose interprets the evidence; it must not be the container for it.
|
|
809
|
-
- **One comment, one issue's scope.** Evidence that implicates a *different* issue
|
|
810
|
-
belongs in a separate comment on that issue, cross-referenced by number — not
|
|
811
|
-
folded into this one.
|
|
812
|
-
- **State facts; leave triage to the maintainers.** Stage, priority, closure, and
|
|
813
|
-
duplicate-of verdicts are theirs. If the evidence points at a next step (re-test
|
|
814
|
-
after X lands, likely duplicate of #N), one closing sentence may say so — never
|
|
815
|
-
more.
|
|
816
|
-
|
|
817
|
-
### Record the issue in the app
|
|
818
|
-
|
|
819
|
-
After filing, add an entry to the app's `PRIMITIVE-FEEDBACK.md` (see "The platform feedback doc"
|
|
820
|
-
above) under **Open items**: the issue number, a one-line symptom, and — if you built a
|
|
821
|
-
workaround in the app — where it lives (`file:line`). This is what lets a future upgrade
|
|
822
|
-
find and remove the workaround once the platform fix ships. If a workaround is added
|
|
823
|
-
later for an already-filed issue, update the entry then.
|
|
252
|
+
Entries sometimes carry a platform issue number (Primitive-Labs members add them); items
|
|
253
|
+
without one are just as useful — the document is the feedback channel, not the tracker.
|