primitive-admin 1.1.0-alpha.24 → 1.1.0-alpha.26
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 +64 -8
- package/assets/skill/skills/primitive-platform/SKILL.md +175 -0
- package/dist/bin/primitive.js +61 -6
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/analytics.js +464 -55
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/auth.js +114 -4
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/collection-type-configs.js +178 -0
- package/dist/src/commands/collection-type-configs.js.map +1 -0
- package/dist/src/commands/collections.js +512 -0
- package/dist/src/commands/collections.js.map +1 -0
- package/dist/src/commands/databases.js +601 -32
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.js +406 -1
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.js +267 -0
- package/dist/src/commands/email-templates.js.map +1 -0
- package/dist/src/commands/groups.js +2 -2
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/init.js +528 -149
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +481 -20
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/secrets.js +108 -0
- package/dist/src/commands/secrets.js.map +1 -0
- package/dist/src/commands/skill.js +29 -0
- package/dist/src/commands/skill.js.map +1 -0
- package/dist/src/commands/sync.js +297 -3
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/users.js +324 -1
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/webhooks.js +386 -0
- package/dist/src/commands/webhooks.js.map +1 -0
- package/dist/src/commands/workflows.js +326 -4
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.js +384 -12
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/constants.js +3 -0
- package/dist/src/lib/constants.js.map +1 -0
- package/dist/src/lib/init-config.js +87 -0
- package/dist/src/lib/init-config.js.map +1 -0
- package/dist/src/lib/skill-installer.js +135 -0
- package/dist/src/lib/skill-installer.js.map +1 -0
- package/dist/src/lib/template.js +199 -17
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/version-check.js +169 -0
- package/dist/src/lib/version-check.js.map +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -198,6 +198,26 @@ primitive integrations secrets add <id> --data '{"apiKey":"..."}'
|
|
|
198
198
|
primitive integrations secrets archive <id> <secret-id>
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
+
### Secrets
|
|
202
|
+
|
|
203
|
+
Manage encrypted app secrets (API keys, tokens, credentials). Values are encrypted at rest and never displayed after creation.
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
primitive secrets list [--app <app-id>] # List secrets (values never shown)
|
|
207
|
+
primitive secrets set <KEY> --value <value> [--summary <text>] # Create or update a secret
|
|
208
|
+
primitive secrets delete <KEY> # Delete a secret
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Examples:**
|
|
212
|
+
```bash
|
|
213
|
+
primitive secrets set OPENAI_API_KEY --value "sk-..." --summary "Production key"
|
|
214
|
+
primitive secrets set STRIPE_SECRET --value "sk_live_..."
|
|
215
|
+
primitive secrets list --json
|
|
216
|
+
primitive secrets delete STRIPE_SECRET
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Keys must be uppercase letters, digits, and underscores (e.g., `OPENAI_API_KEY`). Max 100 secrets per app, 2 KB per value. The `set` command is an upsert — it creates or updates automatically. Use `{{secrets.KEY}}` in workflows and `secrets.KEY` in CEL rules.
|
|
220
|
+
|
|
201
221
|
### Prompts
|
|
202
222
|
|
|
203
223
|
Manage LLM prompt configurations.
|
|
@@ -314,9 +334,17 @@ primitive databases indexes create <database-id> <model> <field> [options] # Cr
|
|
|
314
334
|
primitive databases indexes drop <database-id> <model> <field> # Drop index
|
|
315
335
|
```
|
|
316
336
|
|
|
337
|
+
**Export / Import:**
|
|
338
|
+
```bash
|
|
339
|
+
primitive databases export [app-id] <database-id> --output <dir> # Export records, indexes, constraints
|
|
340
|
+
primitive databases import [app-id] <path> --overwrite --dry-run # Import from export directory
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Export creates a directory with `metadata.json`, `records.jsonl`, `indexes.json`, and `constraints.json`. Import restores records and indexes into a new or existing database. Database type config (operations, triggers, access rules) is managed separately via `primitive sync` — run `sync push` on the target app before importing.
|
|
344
|
+
|
|
317
345
|
### Documents
|
|
318
346
|
|
|
319
|
-
Manage document ownership
|
|
347
|
+
Manage document ownership, group permissions, and export/import.
|
|
320
348
|
|
|
321
349
|
```bash
|
|
322
350
|
primitive documents transfer-owner [app-id] <document-id> <new-owner-id> # Transfer ownership
|
|
@@ -331,6 +359,15 @@ primitive documents group-permissions revoke <document-id> <group-type> <group-i
|
|
|
331
359
|
|
|
332
360
|
Permission values: `read-write`, `reader`
|
|
333
361
|
|
|
362
|
+
**Export / Import:**
|
|
363
|
+
```bash
|
|
364
|
+
primitive documents export [app-id] <document-id> --output <dir> # Export Yjs state, blobs, permissions, aliases
|
|
365
|
+
primitive documents export-all [app-id] --user-id <id> --owned-only # Export all docs for a user
|
|
366
|
+
primitive documents import [app-id] <path> --overwrite --aliases overwrite|skip --dry-run # Import from export
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
Export creates a directory per document with `metadata.json`, `document.yjs` (Yjs state), `permissions.json` (for reference), and `blobs/` (attachments). Permissions are exported for reference but not restored during import — the importing admin is the new owner and manages sharing in the target app. Document IDs are preserved across import. User-scoped aliases can be restored with `--aliases overwrite` (update existing) or `--aliases skip` (keep existing, default).
|
|
370
|
+
|
|
334
371
|
### Groups
|
|
335
372
|
|
|
336
373
|
Manage groups, members, and memberships.
|
|
@@ -368,15 +405,34 @@ Group permissions on documents are managed via `primitive documents group-permis
|
|
|
368
405
|
View usage analytics for an app.
|
|
369
406
|
|
|
370
407
|
```bash
|
|
371
|
-
|
|
372
|
-
primitive analytics
|
|
373
|
-
primitive analytics
|
|
374
|
-
primitive analytics
|
|
408
|
+
# Overview & active users
|
|
409
|
+
primitive analytics overview [app-id] # DAU / WAU / MAU + growth
|
|
410
|
+
primitive analytics daily-active [app-id] # Daily active users time series
|
|
411
|
+
primitive analytics rolling-active [app-id] # Rolling active users (28 points)
|
|
412
|
+
primitive analytics cohort-retention [app-id] # Weekly cohort retention matrix
|
|
413
|
+
|
|
414
|
+
# Users
|
|
415
|
+
primitive analytics top-users [app-id] # Most active users
|
|
416
|
+
primitive analytics user-search [app-id] --query <q> # Search by email or ULID
|
|
417
|
+
primitive analytics user-detail <user-ulid> [app-id] # User activity breakdown
|
|
418
|
+
primitive analytics user-snapshot <user-ulid> [app-id] # Latest context snapshot
|
|
419
|
+
|
|
420
|
+
# Events
|
|
421
|
+
primitive analytics events [app-id] # Paginated event feed
|
|
422
|
+
primitive analytics events-grouped [app-id] # Events grouped by dimension
|
|
423
|
+
|
|
424
|
+
# Features
|
|
425
|
+
primitive analytics integrations [app-id] # Integration usage metrics
|
|
426
|
+
primitive analytics workflows [app-id] # Top workflows by runs
|
|
427
|
+
primitive analytics prompts [app-id] # Top prompts by executions
|
|
375
428
|
```
|
|
376
429
|
|
|
377
|
-
**
|
|
378
|
-
- `--window-days <n>` - Time window (default
|
|
379
|
-
- `--limit <n>` - Result limit
|
|
430
|
+
**Common options:**
|
|
431
|
+
- `--window-days <n>` - Time window in days (default varies per command)
|
|
432
|
+
- `--limit <n>` - Result limit (top-users, workflows, prompts)
|
|
433
|
+
- `--group-by <dim>` - Dimension for events-grouped (action, feature, route, country, deviceType, plan, day)
|
|
434
|
+
- `--page <n>` - Page number for events feed (0-based)
|
|
435
|
+
- `--json` - Output raw JSON
|
|
380
436
|
|
|
381
437
|
### Admins (Super-Admin Only)
|
|
382
438
|
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: primitive-platform
|
|
3
|
+
description: >
|
|
4
|
+
Expert guide for building applications on the Primitive platform. MUST be used whenever the user
|
|
5
|
+
is writing code that uses js-bao, js-bao-wss-client, primitive-app components, or any Primitive
|
|
6
|
+
platform feature (documents, databases, workflows, prompts, integrations, blobs, authentication,
|
|
7
|
+
users/groups). Also trigger whenever about to run any `primitive` CLI command (e.g., primitive sync, primitive integrations, primitive apps, primitive use) to ensure Step 0 CLI verification is performed first. After writing or modifying code that touches Primitive
|
|
8
|
+
APIs, this skill cross-references the implementation against official guides and automatically
|
|
9
|
+
corrects common mistakes. Use this skill even if the user doesn't explicitly ask for it —
|
|
10
|
+
any Primitive-related code should be validated against current best practices.
|
|
11
|
+
allowed-tools: Bash, Read, Edit, Write, Glob, Grep, Agent
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Primitive Platform Development Guide
|
|
15
|
+
|
|
16
|
+
You are an expert on the Primitive platform. Your job is to help developers write correct,
|
|
17
|
+
idiomatic Primitive code by leveraging the CLI's built-in guide system and enforcing best practices.
|
|
18
|
+
|
|
19
|
+
**The CLI guides are the single source of truth.** Never hardcode or memorize guide content —
|
|
20
|
+
always fetch the latest from the CLI.
|
|
21
|
+
|
|
22
|
+
## Step 0: Verify CLI Configuration
|
|
23
|
+
|
|
24
|
+
The Primitive CLI maintains state for the **currently active server endpoint and app**. Before
|
|
25
|
+
running any CLI commands, confirm you're targeting the correct environment:
|
|
26
|
+
|
|
27
|
+
1. **Check for a `.env` file** in the project root (e.g., `.env`, `.env.local`, `.env.development`).
|
|
28
|
+
It typically contains `PRIMITIVE_API_URL` or similar variables that set the server endpoint,
|
|
29
|
+
and may reference a specific app ID.
|
|
30
|
+
2. **Run a CLI command and read its output.** The CLI prints the active server URL and app context
|
|
31
|
+
at the top of most command outputs — verify these match the project's intended environment.
|
|
32
|
+
3. **Use inspection commands** to confirm current state:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
primitive whoami # Shows authenticated user, app ID, and server endpoint
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Why this matters:** If the CLI is pointed at the wrong server (e.g., production instead of
|
|
39
|
+
development) or the wrong app, commands like `primitive sync push` will modify the wrong
|
|
40
|
+
environment. Always verify before running mutating operations.
|
|
41
|
+
|
|
42
|
+
## Step 1: Discover Available Guides
|
|
43
|
+
|
|
44
|
+
Before writing or reviewing any Primitive code, run:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
primitive guides list
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This returns the full list of available guide topics with descriptions, keywords, and use cases.
|
|
51
|
+
Use this output to determine which guides are relevant to the current task.
|
|
52
|
+
|
|
53
|
+
## Step 2: Fetch the Relevant Guides
|
|
54
|
+
|
|
55
|
+
For each relevant topic identified in Step 1, fetch the full guide:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
primitive guides get <topic>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Always fetch guide(s) BEFORE writing code.** If multiple features are involved, fetch multiple
|
|
62
|
+
guides. The guides contain:
|
|
63
|
+
- Complete API documentation with method signatures
|
|
64
|
+
- Working code examples (TypeScript/JavaScript)
|
|
65
|
+
- Common patterns and anti-patterns
|
|
66
|
+
- Configuration examples (TOML files for `primitive sync`)
|
|
67
|
+
- Decision frameworks for architecture choices
|
|
68
|
+
|
|
69
|
+
**Do not guess or assume API patterns.** If you're unsure about a method signature, parameter,
|
|
70
|
+
or pattern, fetch the guide. The guides are comprehensive and authoritative.
|
|
71
|
+
|
|
72
|
+
## Step 3: Write Code Following Guide Patterns
|
|
73
|
+
|
|
74
|
+
When writing Primitive code:
|
|
75
|
+
|
|
76
|
+
1. **Follow the patterns from the fetched guides exactly** — method names, argument order, lifecycle patterns
|
|
77
|
+
2. **Use `primitive sync`** for all backend configuration (workflows, prompts, integrations, databases)
|
|
78
|
+
3. **Configuration lives in TOML files** in version control, pushed via `primitive sync push`
|
|
79
|
+
4. **Run `pnpm codegen`** after creating or modifying js-bao models
|
|
80
|
+
|
|
81
|
+
## Step 4: Post-Code Review (Automatic)
|
|
82
|
+
|
|
83
|
+
After writing or modifying Primitive-related code, **automatically perform this review**:
|
|
84
|
+
|
|
85
|
+
### 4a. Identify What Was Written
|
|
86
|
+
Determine which Primitive features the new/modified code touches by scanning for:
|
|
87
|
+
- Import statements from `js-bao`, `js-bao-wss-client`, or `primitive-app`
|
|
88
|
+
- Primitive API calls (documents.open, databases.connect, workflows, etc.)
|
|
89
|
+
- Model definitions, schemas, queries
|
|
90
|
+
- Configuration files (TOML for sync)
|
|
91
|
+
|
|
92
|
+
### 4b. Fetch and Cross-Reference
|
|
93
|
+
Run `primitive guides list` to identify which guides cover the features used, then fetch each one:
|
|
94
|
+
```bash
|
|
95
|
+
primitive guides get <topic>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Compare the written code against the guide content:
|
|
99
|
+
- **API usage patterns** — Are methods called correctly with proper arguments?
|
|
100
|
+
- **Lifecycle management** — Are documents opened before queries? Is auth checked first?
|
|
101
|
+
- **Access control** — Are CEL expressions or permissions configured properly?
|
|
102
|
+
- **Anti-patterns** — Does the code do anything the guide explicitly warns against?
|
|
103
|
+
- **Missing steps** — Does the code need `pnpm codegen`, `primitive sync push`, or other follow-up?
|
|
104
|
+
|
|
105
|
+
### 4c. Report and Fix
|
|
106
|
+
If issues are found:
|
|
107
|
+
1. **Explain the issue** — cite the specific guide section that applies
|
|
108
|
+
2. **Show the fix** — provide corrected code
|
|
109
|
+
3. **Apply the fix** — edit the file directly (don't just suggest, actually fix it)
|
|
110
|
+
4. **Note any CLI commands needed** — e.g., `pnpm codegen` or `primitive sync push`
|
|
111
|
+
|
|
112
|
+
If no issues are found, briefly confirm the code follows best practices.
|
|
113
|
+
|
|
114
|
+
## CLI Quick Reference
|
|
115
|
+
|
|
116
|
+
Remind users of these essential commands when relevant:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Verify current configuration (DO THIS FIRST)
|
|
120
|
+
<<<<<<< HEAD
|
|
121
|
+
primitive whoami # Check auth status, server endpoint
|
|
122
|
+
primitive status # Check active app context and server
|
|
123
|
+
=======
|
|
124
|
+
primitive whoami # Check authenticated user, app ID, and server endpoint
|
|
125
|
+
>>>>>>> origin/main
|
|
126
|
+
# Also check .env / .env.local / .env.development in the project for
|
|
127
|
+
# PRIMITIVE_API_URL or app ID settings — these control which server the CLI targets.
|
|
128
|
+
|
|
129
|
+
# Setup
|
|
130
|
+
npm install -g primitive-admin # Install CLI
|
|
131
|
+
primitive login # Authenticate
|
|
132
|
+
primitive use "My App" # Set app context
|
|
133
|
+
|
|
134
|
+
# Guides (the most important commands for development)
|
|
135
|
+
primitive guides list # See all available guides with topics and descriptions
|
|
136
|
+
primitive guides get <topic> # Read detailed guide for a specific topic
|
|
137
|
+
|
|
138
|
+
# Configuration as Code
|
|
139
|
+
primitive sync init --dir ./config # Initialize config directory
|
|
140
|
+
primitive sync pull --dir ./config # Pull config from server
|
|
141
|
+
primitive sync push --dir ./config # Push config to server
|
|
142
|
+
primitive sync diff --dir ./config # Preview changes before push
|
|
143
|
+
|
|
144
|
+
# Common operations
|
|
145
|
+
primitive apps list # List apps
|
|
146
|
+
primitive apps create "Name" # Create app
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## When the User is Starting a New Feature
|
|
150
|
+
|
|
151
|
+
If the user describes a new feature they want to build:
|
|
152
|
+
|
|
153
|
+
1. **Verify CLI configuration** per Step 0 — confirm the server endpoint and app ID match the
|
|
154
|
+
project's intended environment before running any commands
|
|
155
|
+
2. **Run `primitive guides list`** to discover available topics
|
|
156
|
+
3. **Identify which guides are relevant** to their feature from the list output
|
|
157
|
+
4. **Fetch those guides** with `primitive guides get <topic>`
|
|
158
|
+
<<<<<<< HEAD
|
|
159
|
+
5. **Recommend a data modeling approach** based on the guide content
|
|
160
|
+
=======
|
|
161
|
+
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
|
|
162
|
+
>>>>>>> origin/main
|
|
163
|
+
6. **Outline the implementation steps** referencing specific patterns from the guides
|
|
164
|
+
7. **Write the code** following the patterns exactly
|
|
165
|
+
8. **Review automatically** per Step 4 above
|
|
166
|
+
|
|
167
|
+
## When the User Asks "How Do I...?"
|
|
168
|
+
|
|
169
|
+
For any question about Primitive platform capabilities:
|
|
170
|
+
|
|
171
|
+
1. **Run `primitive guides list`** to find the relevant topic
|
|
172
|
+
2. **Fetch the guide**: `primitive guides get <topic>`
|
|
173
|
+
3. **Answer from the guide content** — don't guess or make up APIs
|
|
174
|
+
4. **Include working code examples** from the guide
|
|
175
|
+
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,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command } from "commander";
|
|
2
|
+
import { Command, CommanderError } from "commander";
|
|
3
3
|
import { readFileSync } from "fs";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import { dirname, resolve } from "path";
|
|
@@ -9,6 +9,7 @@ import { registerAppsCommands } from "../src/commands/apps.js";
|
|
|
9
9
|
import { registerUsersCommands } from "../src/commands/users.js";
|
|
10
10
|
import { registerWaitlistCommands } from "../src/commands/waitlist.js";
|
|
11
11
|
import { registerIntegrationsCommands } from "../src/commands/integrations.js";
|
|
12
|
+
import { registerWebhooksCommands } from "../src/commands/webhooks.js";
|
|
12
13
|
import { registerPromptsCommands } from "../src/commands/prompts.js";
|
|
13
14
|
import { registerWorkflowsCommands } from "../src/commands/workflows.js";
|
|
14
15
|
import { registerAdminsCommands } from "../src/commands/admins.js";
|
|
@@ -25,14 +26,39 @@ import { registerGroupTypeConfigsCommands } from "../src/commands/group-type-con
|
|
|
25
26
|
import { registerDatabaseTypesCommands } from "../src/commands/database-types.js";
|
|
26
27
|
import { registerGuidesCommands } from "../src/commands/guides.js";
|
|
27
28
|
import { registerDocumentsCommands } from "../src/commands/documents.js";
|
|
29
|
+
import chalk from "chalk";
|
|
30
|
+
import { registerEmailTemplatesCommands } from "../src/commands/email-templates.js";
|
|
31
|
+
import { registerCollectionsCommands } from "../src/commands/collections.js";
|
|
32
|
+
import { registerCollectionTypeConfigsCommands } from "../src/commands/collection-type-configs.js";
|
|
28
33
|
import { error } from "../src/lib/output.js";
|
|
29
34
|
import { ApiError } from "../src/lib/api-client.js";
|
|
35
|
+
import { checkForUpdate } from "../src/lib/version-check.js";
|
|
36
|
+
import { loadCredentials } from "../src/lib/config.js";
|
|
37
|
+
import { checkSkillStatus } from "../src/lib/skill-installer.js";
|
|
38
|
+
import { registerSkillCommands } from "../src/commands/skill.js";
|
|
39
|
+
import { registerSecretsCommands } from "../src/commands/secrets.js";
|
|
30
40
|
const __filename = fileURLToPath(import.meta.url);
|
|
31
41
|
const __dirname = dirname(__filename);
|
|
32
42
|
const pkg = JSON.parse(readFileSync(resolve(__dirname, "../../package.json"), "utf-8"));
|
|
43
|
+
const isVersionFlag = process.argv.includes("--version") || process.argv.includes("-V");
|
|
44
|
+
const subcommand = process.argv[2];
|
|
45
|
+
const isJsonOutput = process.argv.includes("--json");
|
|
46
|
+
const skipHeader = isVersionFlag || isJsonOutput || subcommand === "login" || subcommand === "logout" || subcommand === "token";
|
|
47
|
+
if (!skipHeader) {
|
|
48
|
+
const creds = loadCredentials();
|
|
49
|
+
const appName = creds?.currentAppName;
|
|
50
|
+
const appId = creds?.currentAppId;
|
|
51
|
+
const appInfo = appName
|
|
52
|
+
? `${appName} (${appId})`
|
|
53
|
+
: appId || "None set";
|
|
54
|
+
const server = creds?.serverUrl || "Not configured";
|
|
55
|
+
console.log(chalk.dim(`CLI Version: ${pkg.version} | App: ${appInfo} | Server: ${server}`));
|
|
56
|
+
console.log();
|
|
57
|
+
}
|
|
33
58
|
const program = new Command();
|
|
34
59
|
program
|
|
35
60
|
.name("primitive")
|
|
61
|
+
.exitOverride()
|
|
36
62
|
.description(`CLI for administering Primitive applications.
|
|
37
63
|
|
|
38
64
|
Manage apps, users, integrations, prompts, workflows, and more from the command line.
|
|
@@ -63,6 +89,7 @@ registerAppsCommands(program);
|
|
|
63
89
|
registerUsersCommands(program);
|
|
64
90
|
registerWaitlistCommands(program);
|
|
65
91
|
registerIntegrationsCommands(program);
|
|
92
|
+
registerWebhooksCommands(program);
|
|
66
93
|
registerPromptsCommands(program);
|
|
67
94
|
registerWorkflowsCommands(program);
|
|
68
95
|
registerAdminsCommands(program);
|
|
@@ -79,22 +106,50 @@ registerGroupTypeConfigsCommands(program);
|
|
|
79
106
|
registerDatabaseTypesCommands(program);
|
|
80
107
|
registerGuidesCommands(program);
|
|
81
108
|
registerDocumentsCommands(program);
|
|
109
|
+
registerEmailTemplatesCommands(program);
|
|
110
|
+
registerCollectionsCommands(program);
|
|
111
|
+
registerCollectionTypeConfigsCommands(program);
|
|
112
|
+
registerSkillCommands(program);
|
|
113
|
+
registerSecretsCommands(program);
|
|
82
114
|
// Global error handler
|
|
83
115
|
program.hook("preAction", () => {
|
|
84
116
|
// Reset API client state before each command
|
|
85
117
|
});
|
|
118
|
+
// Commands that should never show post-command messages (update check, skill status)
|
|
119
|
+
const suppressPostMessages = isJsonOutput || subcommand === "token";
|
|
120
|
+
async function runPostCommandMessages() {
|
|
121
|
+
if (suppressPostMessages)
|
|
122
|
+
return;
|
|
123
|
+
// Claude Code skill: auto-update if installed, or show hint if not.
|
|
124
|
+
// Skip for `init` (handles its own prompt), `skill` (explicit management),
|
|
125
|
+
// and non-interactive contexts (--json, --version, token, etc.).
|
|
126
|
+
if (!skipHeader && subcommand !== "skill" && subcommand !== "init") {
|
|
127
|
+
await checkSkillStatus();
|
|
128
|
+
}
|
|
129
|
+
await checkForUpdate(pkg.version);
|
|
130
|
+
}
|
|
86
131
|
// Parse and execute
|
|
87
|
-
program.parseAsync(process.argv)
|
|
132
|
+
program.parseAsync(process.argv)
|
|
133
|
+
.then(async () => {
|
|
134
|
+
await runPostCommandMessages();
|
|
135
|
+
})
|
|
136
|
+
.catch(async (err) => {
|
|
137
|
+
// Commander throws CommanderError for help display, version flag, etc.
|
|
138
|
+
// Run post-command messages then exit with the intended code.
|
|
139
|
+
if (err instanceof CommanderError) {
|
|
140
|
+
await runPostCommandMessages();
|
|
141
|
+
process.exit(err.exitCode);
|
|
142
|
+
}
|
|
88
143
|
if (err instanceof ApiError) {
|
|
89
144
|
error(err.message);
|
|
90
145
|
if (err.statusCode === 401) {
|
|
91
146
|
error("Try running 'primitive login' to authenticate.");
|
|
92
147
|
}
|
|
148
|
+
await runPostCommandMessages();
|
|
93
149
|
process.exit(err.statusCode === 401 ? 2 : 1);
|
|
94
150
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
151
|
+
error(err.message || "An unexpected error occurred");
|
|
152
|
+
await runPostCommandMessages();
|
|
153
|
+
process.exit(1);
|
|
99
154
|
});
|
|
100
155
|
//# sourceMappingURL=primitive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive.js","sourceRoot":"","sources":["../../bin/primitive.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,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,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,OAA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