pcific 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/SKILL.md +127 -0
- package/dist/api/catalog.js +637 -0
- package/dist/api/run.js +960 -0
- package/dist/api/search.js +171 -0
- package/dist/api/shortcuts.js +799 -0
- package/dist/bin.js +648 -0
- package/dist/commands/auth.js +513 -0
- package/dist/commands/doctor.js +410 -0
- package/dist/commands/init.js +306 -0
- package/dist/commands/sync.js +214 -0
- package/dist/detect.js +214 -0
- package/dist/env.js +339 -0
- package/dist/goLive.js +629 -0
- package/dist/keyLink.js +305 -0
- package/dist/mcp/server.js +206 -0
- package/dist/mcp/tools.js +689 -0
- package/dist/python/template.js +793 -0
- package/dist/schema/discover.js +324 -0
- package/dist/schema/helpers.js +396 -0
- package/dist/schema/prismaToJsonSchema.js +197 -0
- package/dist/schema/push.js +570 -0
- package/dist/schema/tsToJsonSchema.js +405 -0
- package/dist/schema/zodToJsonSchema.js +442 -0
- package/dist/templates/openapi.json +1 -0
- package/dist/templates/sdk/auth.ts +139 -0
- package/dist/templates/sdk/client.ts +1059 -0
- package/dist/templates/sdk/errors.ts +76 -0
- package/dist/templates/sdk/generated-types.ts +5746 -0
- package/dist/templates/sdk/http.ts +359 -0
- package/dist/templates/sdk/index.ts +84 -0
- package/dist/templates/sdk/json.ts +24 -0
- package/dist/templates/sdk/kit.ts +516 -0
- package/dist/templates/sdk/multipart.ts +99 -0
- package/dist/templates/sdk/sse.ts +131 -0
- package/dist/templates/sdk/verify.ts +766 -0
- package/dist/templates/sdk-js/auth.d.ts +20 -0
- package/dist/templates/sdk-js/auth.js +85 -0
- package/dist/templates/sdk-js/client.d.ts +324 -0
- package/dist/templates/sdk-js/client.js +607 -0
- package/dist/templates/sdk-js/errors.d.ts +51 -0
- package/dist/templates/sdk-js/errors.js +48 -0
- package/dist/templates/sdk-js/generated-types.d.ts +5736 -0
- package/dist/templates/sdk-js/generated-types.js +5 -0
- package/dist/templates/sdk-js/http.d.ts +50 -0
- package/dist/templates/sdk-js/http.js +263 -0
- package/dist/templates/sdk-js/index.d.ts +9 -0
- package/dist/templates/sdk-js/index.js +7 -0
- package/dist/templates/sdk-js/json.d.ts +11 -0
- package/dist/templates/sdk-js/json.js +16 -0
- package/dist/templates/sdk-js/kit.d.ts +220 -0
- package/dist/templates/sdk-js/kit.js +208 -0
- package/dist/templates/sdk-js/multipart.d.ts +23 -0
- package/dist/templates/sdk-js/multipart.js +61 -0
- package/dist/templates/sdk-js/sse.d.ts +12 -0
- package/dist/templates/sdk-js/sse.js +99 -0
- package/dist/templates/sdk-js/verify.d.ts +114 -0
- package/dist/templates/sdk-js/verify.js +506 -0
- package/dist/templates.js +925 -0
- package/dist/ui.js +399 -0
- package/dist/webhooks/events.js +171 -0
- package/dist/webhooks/listen.js +772 -0
- package/package.json +32 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PCIFIC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pcific
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Zero-dependency open-source CLI for [PCIFIC Business](https://business.pcific.ai). Connect a project in one command, copy clean owned code into your repo (default) or install `@pcific/sdk`, search and edit all 142 API operations, push listing schemas, inspect usage and logs, test signed webhooks locally, and run a local test-key-only MCP server for coding agents.
|
|
4
|
+
|
|
5
|
+
## Quickstart
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx pcific init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
- **Copy mode (default):** writes clean, readable, zero-dependency files directly into your repo (TypeScript, JavaScript, or Python) and adds nothing to `package.json`. Refresh managed files anytime with `npx pcific sync`.
|
|
12
|
+
- **Package mode:** installs `@pcific/sdk` and generates a thin starter client and optional PCIFIC Kit embed-session route.
|
|
13
|
+
|
|
14
|
+
## Commands
|
|
15
|
+
|
|
16
|
+
### Setup, authentication, and verification
|
|
17
|
+
|
|
18
|
+
- `pcific init [--mode copy|package] [--yes] [--plain] [--json]` — Link a test key via browser approval into `.env` (never printed), protect `.gitignore`, scaffold client + typed PCIFIC Kit loader + starter route + `PCIFIC.md`, and run a live health check.
|
|
19
|
+
- `pcific login [--reauth] [--shop <name>] [--plain] [--json]` — Sign in through your browser and link a test key straight into `.env` without scaffolding or modifying code files.
|
|
20
|
+
- `pcific logout [--plain] [--json]` — Remove local `PCIFIC_TEST_KEY` and `PCIFIC_MARKETPLACE_ID` from `.env` (and point to `/dashboard/keys` to revoke on the server).
|
|
21
|
+
- `pcific whoami [--plain] [--json]` — Show the active business, shop, key name and prefix, permissions, and daily test cap from `/api/v1/me`.
|
|
22
|
+
- `pcific sync [--apply]` — Check `/changelog.txt?since=<date>` and refresh managed Copy-mode files without touching your own code.
|
|
23
|
+
- `pcific doctor [--json]` — Verify `.env`, `.gitignore`, API key identity and scopes, daily test cap, and catalogue schema status.
|
|
24
|
+
- `pcific go-live [--no-open] [--json]` — Run production preflight checks, open `/dashboard/keys` so the business owner creates the live key themselves, and print copy-ready production environment variables.
|
|
25
|
+
|
|
26
|
+
### Universal OpenAPI CLI (all 142 public operations)
|
|
27
|
+
|
|
28
|
+
- `pcific search "<query>" [--limit N] [--json]` — Search all 142 PCIFIC API operations offline in milliseconds.
|
|
29
|
+
- `pcific api list [--tag <tag>] [--json]` — List every public PCIFIC API operation.
|
|
30
|
+
- `pcific api describe <operationId> [--json]` — Show HTTP method, path, parameters, body fields, and an example command.
|
|
31
|
+
- `pcific api <operationId> [--param k=v] [--query k=v] [--data '<json>'|@file.json] [--dry-run] [--json]` — Preview locally (`--dry-run`) or execute any read/write operation (shop settings, tool settings, Message Check policy, embed branding, spend limits, documents, webhooks, shops) with automatic `Idempotency-Key` headers.
|
|
32
|
+
|
|
33
|
+
### Schemas, inspection, webhooks, and coding agents
|
|
34
|
+
|
|
35
|
+
- `pcific schema discover` / `pcific schema push [--file <path>] [--publish] [--about "..."] [--dry-run]` — Discover Zod, TypeScript, Prisma, or JSON Schema product models, diff against your shop's draft, upload, and publish a version.
|
|
36
|
+
- `pcific usage [--json]` — Show credit balance, monthly tool totals, spend limits, and daily test cap.
|
|
37
|
+
- `pcific stats [--from YYYY-MM-DD] [--to YYYY-MM-DD] [--json]` — Show analytics and monitoring summary.
|
|
38
|
+
- `pcific logs [--limit N] [--id <requestId>] [--json]` — List recent requests or inspect one request by ID.
|
|
39
|
+
- `pcific docs [slug] [--quick] [--changelog --since YYYY-MM-DD]` — Read `/llms.txt`, plain-text docs, quick cheat sheets, or `/changelog.txt` without an API key.
|
|
40
|
+
- `pcific webhooks listen --forward <url>` / `pcific webhooks trigger <event> --forward <url>` / `pcific webhooks list` — Test signed `PCIFIC-Signature` webhooks locally across all 13 event types.
|
|
41
|
+
- `pcific mcp` — Start a local stdio MCP server strictly limited to test keys.
|
|
42
|
+
|
|
43
|
+
## Security guarantees
|
|
44
|
+
|
|
45
|
+
- CLI and MCP commands operate on **test keys only** (`PCIFIC_TEST_KEY`) and refuse live keys (`pcific_live_...`).
|
|
46
|
+
- Test keys written during `pcific init` and `pcific login` use atomic `0600` file writes and are never printed to stdout or stderr.
|
|
47
|
+
- Live keys stay on `/dashboard/keys` for the business owner to place directly into their production hosting provider.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT
|
package/dist/SKILL.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pcific
|
|
3
|
+
description: Connect, configure, test, and verify PCIFIC Business integrations (Safeguard, Orbit, Ask PCIFIC, PixelTrace, Message Check, Dispute Pack) using the zero-dependency `pcific` CLI. Use when integrating PCIFIC into a shop or platform, discovering or calling PCIFIC OpenAPI operations, pushing listing schemas, inspecting logs or usage, testing webhooks locally, or preparing to go live.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PCIFIC CLI Skill
|
|
7
|
+
|
|
8
|
+
Use the `pcific` CLI (`npx pcific ...`) to work with PCIFIC Business from any coding agent (Claude Code, Cursor, Codex, Antigravity) without guessing endpoints or handling secret keys in chat.
|
|
9
|
+
|
|
10
|
+
## Core Safety Rules
|
|
11
|
+
|
|
12
|
+
1. **Test keys only**: Never ask the user to paste a live key (`pcific_live_...`) into chat, terminal commands, or local `.env`. The `pcific` CLI refuses `pcific_live_...` keys everywhere.
|
|
13
|
+
2. **Link test keys without pasting secrets**: Run `npx pcific init` so the human approves a scoped test key in their browser and the CLI writes `PCIFIC_TEST_KEY` (and `PCIFIC_MARKETPLACE_ID` when scoped to one shop) directly into `.env`.
|
|
14
|
+
3. **Always preview writes first**: Run `npx pcific api <operationId> ... --dry-run` before sending a write request. `--dry-run` is a local CLI preview only and never sends `?dryRun=1` to the server.
|
|
15
|
+
4. **Never repeat query parameters**: PCIFIC rejects repeated query parameters with `400 QUERY_PARAMETER_REPEATED`. Pass each `--query key=value` once.
|
|
16
|
+
5. **Production key selection**: In application code, store `PCIFIC_TEST_KEY` and `PCIFIC_LIVE_KEY` separately and select between them using `PCIFIC_MODE` (`test` or `live`, defaulting to `test` outside production).
|
|
17
|
+
6. **Live key handoff**: When the integration is ready for production, run `npx pcific go-live`. It runs preflight checks with the test key and opens `https://business.pcific.ai/dashboard/keys` so the human owner creates and copies the live key straight into their hosting provider's secret manager.
|
|
18
|
+
|
|
19
|
+
## Fast Workflow
|
|
20
|
+
|
|
21
|
+
### 1. Initialize and verify setup
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx pcific init
|
|
25
|
+
npx pcific login
|
|
26
|
+
npx pcific whoami
|
|
27
|
+
npx pcific doctor
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- `init` links a test key into `.env` without printing it, scaffolds client code, and verifies the connection.
|
|
31
|
+
- `login` links a test key into `.env` through the browser without scaffolding files (use `--reauth` to rotate or switch shops); `whoami` inspects the active account and key from `/api/v1/me`; `logout` clears local test keys from `.env`.
|
|
32
|
+
- `doctor` checks `.env`, `.gitignore`, test key validity, usage allowance, and published listing schema readiness.
|
|
33
|
+
|
|
34
|
+
### 2. Discover any of the 142 public API operations locally (zero network calls)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx pcific search "safeguard settings"
|
|
38
|
+
npx pcific search "embed branding" --limit 5
|
|
39
|
+
npx pcific search "spend limits"
|
|
40
|
+
npx pcific search "message check policy"
|
|
41
|
+
npx pcific api list --tag Safeguard
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Non-TTY callers automatically receive compact JSON to save context tokens. Pass `--plain` for plain text or `--json` to force compact JSON.
|
|
45
|
+
|
|
46
|
+
### 3. Inspect an operation's exact contract before calling it
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx pcific api describe put-safeguard-settings
|
|
50
|
+
npx pcific api describe put-message-check-policy
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`describe` resolves OpenAPI `$ref` schemas locally and prints path parameters, query parameters, required/optional JSON body fields, descriptions, and an example command.
|
|
54
|
+
|
|
55
|
+
### 4. Preview and execute API calls with your test key
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Local preview only (no network call, Authorization redacted)
|
|
59
|
+
npx pcific api put-safeguard-settings \
|
|
60
|
+
--data '{"minimumScore":7,"webSearch":true}' \
|
|
61
|
+
--dry-run
|
|
62
|
+
|
|
63
|
+
# Execute against PCIFIC with automatic Idempotency-Key on writes
|
|
64
|
+
npx pcific api put-safeguard-settings \
|
|
65
|
+
--data '{"minimumScore":7,"webSearch":true}'
|
|
66
|
+
|
|
67
|
+
# Path and query parameters
|
|
68
|
+
npx pcific api get-webhook --param id=<webhook-id>
|
|
69
|
+
npx pcific api list-request-logs --query limit=10
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- `--data` accepts inline JSON, `@path/to/payload.json`, or `-` for stdin.
|
|
73
|
+
- Non-GET calls automatically send a fresh `Idempotency-Key` header (override with `--idempotency-key <key>`).
|
|
74
|
+
- When `PCIFIC_MARKETPLACE_ID` is set (or `--marketplace-id <id>` is passed), `?marketplaceId=<id>` is appended automatically on operations that accept a `marketplaceId` query parameter (unless already provided via `--query`).
|
|
75
|
+
- On non-2xx responses, the CLI surfaces PCIFIC's `code`, `error`, `tryThis`, `problems`, and `requestId`.
|
|
76
|
+
|
|
77
|
+
### 5. Push and publish listing schemas
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npx pcific schema push --publish
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Orbit and Safeguard require a published listing schema version describing your shop's categories and fields.
|
|
84
|
+
|
|
85
|
+
### 6. Check usage, analytics, logs, and plain-text docs
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Credit balance, per-tool prices, spend limits, and daily test cap
|
|
89
|
+
npx pcific usage
|
|
90
|
+
|
|
91
|
+
# Combined /api/v1/analytics + /api/v1/monitoring/summary
|
|
92
|
+
npx pcific stats --from 2026-01-01 --to 2026-01-31
|
|
93
|
+
|
|
94
|
+
# Request logs (requires a test key with the explicit `logs` scope)
|
|
95
|
+
npx pcific logs --limit 20
|
|
96
|
+
npx pcific logs --id <requestId>
|
|
97
|
+
|
|
98
|
+
# Plain-text documentation (no API key required)
|
|
99
|
+
npx pcific docs # /llms.txt index
|
|
100
|
+
npx pcific docs safeguard # /docs/safeguard.txt
|
|
101
|
+
npx pcific docs safeguard --quick # compact JSON cheat sheet
|
|
102
|
+
npx pcific docs --changelog --since 2026-01-01
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 7. Test webhooks locally and run the MCP server
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Trigger a signed test webhook event against your local receiver
|
|
109
|
+
npx pcific webhooks trigger safeguard.review_finished --forward http://127.0.0.1:3000/api/webhooks/pcific
|
|
110
|
+
|
|
111
|
+
# Start the local PCIFIC MCP server for agent tool access
|
|
112
|
+
npx pcific mcp
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 8. Prepare for production go-live
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npx pcific go-live
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`go-live` verifies:
|
|
122
|
+
1. Your test key and shop identity via `GET /api/v1/key`.
|
|
123
|
+
2. Whether a listing schema version is published via `GET /api/v1/catalogue/status`.
|
|
124
|
+
3. Whether webhook endpoints are configured via `GET /api/v1/webhooks`.
|
|
125
|
+
4. Local hygiene (`.gitignore` excludes `.env`, no live key in local `.env`, and codebase references `PCIFIC_MODE` and `PCIFIC_LIVE_KEY`).
|
|
126
|
+
|
|
127
|
+
It then opens `https://business.pcific.ai/dashboard/keys` (skip with `--no-open`) and prints copy-ready environment variables (`PCIFIC_MODE=live`, `PCIFIC_LIVE_KEY=<paste from dashboard>`, `PCIFIC_MARKETPLACE_ID=<id>`) and secret commands for Vercel, Cloudflare Workers (`wrangler secret put`), Fly.io, and Railway.
|