@oxy-hq/cli 0.12.0 → 0.12.1

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.
@@ -7,23 +7,7 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
7
7
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
8
8
  import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
9
9
 
10
- //#region src/commands/mcp-sandbox.ts
11
- /**
12
- * What `oxyc mcp` serves when its credential is a sandbox agent token
13
- * (`oxy_sbx_…`): the sandbox loop, `oxy_whoami`, and four tools that exist
14
- * only here.
15
- *
16
- * A SMALLER LIST, NOT A FILTERED ONE. The generic tools — `oxy_request`,
17
- * `oxy_routes`, `oxy_schema` — and the workspace-preview tools are dropped:
18
- * the server answers this token `404` on everything they reach, and a tool
19
- * that can only fail still costs its schema on every turn. What replaces
20
- * `oxy_request` is named: a sandbox's secret is set with `oxy_env_secret_set`,
21
- * which can carry the one rule a generic request cannot — a `dev-<handle>`
22
- * environment, and nothing else.
23
- *
24
- * Tool DEFINITIONS and the startup decision live here. The calls themselves
25
- * are cases in `mcp.ts`'s `callTool`, beside the verbs they share code with.
26
- */
10
+ // src/commands/mcp-sandbox.ts
27
11
  const APP = {
28
12
  type: "string",
29
13
  description: "\"<org-slug>/<app-slug>\" or the app UUID."
@@ -32,7 +16,6 @@ const OWN_SANDBOX = {
32
16
  type: "string",
33
17
  description: "dev-<handle> — a sandbox this token created. Production and staging are refused."
34
18
  };
35
- /** The sandbox tools whose `appEnv` is optional for staff and required here. */
36
19
  const NEEDS_SANDBOX = /* @__PURE__ */ new Set([
37
20
  "oxy_fn_call",
38
21
  "oxy_fn_run",
@@ -48,7 +31,6 @@ const WHOAMI = {
48
31
  properties: {}
49
32
  }
50
33
  };
51
- /** The four tools only a sandbox agent token is served. */
52
34
  const SANDBOX_AGENT_TOOLS = [
53
35
  {
54
36
  name: "oxy_env_secret_list",
@@ -120,7 +102,6 @@ const SANDBOX_AGENT_TOOLS = [
120
102
  }
121
103
  }
122
104
  ];
123
- /** A sandbox tool as this credential must call it: the environment is not optional. */
124
105
  function forSandboxAgent(tool) {
125
106
  if (tool.name === "oxy_env_show" || tool.name === "oxy_env_update" || tool.name === "oxy_env_reset") return {
126
107
  ...tool,
@@ -146,14 +127,7 @@ function forSandboxAgent(tool) {
146
127
  }
147
128
  };
148
129
  }
149
- /**
150
- * The loop's tools a sandbox agent token is never served: an environment's
151
- * schedules switch is staff's to flip (the server refuses the token there),
152
- * and a tool that can only fail still costs its schema on every turn. A
153
- * token runs a scheduled function once with `oxy_fn_run` instead.
154
- */
155
130
  const STAFF_ONLY = /* @__PURE__ */ new Set(["oxy_env_schedules"]);
156
- /** The list for a sandbox agent token, built from the loop's own definitions. */
157
131
  function sandboxAgentTools(sandboxLoop) {
158
132
  const loop = sandboxLoop.filter((tool) => !STAFF_ONLY.has(tool.name));
159
133
  return [
@@ -162,19 +136,6 @@ function sandboxAgentTools(sandboxLoop) {
162
136
  ...SANDBOX_AGENT_TOOLS
163
137
  ];
164
138
  }
165
- /**
166
- * Decide the tool list, and FAIL CLOSED before serving one.
167
- *
168
- * `oxyc mcp` is what an agent runtime starts, with the agent's own token in
169
- * its environment. Started without `--login`, an unset variable is exit `4`
170
- * right here: falling back to the login cache would hand the agent its
171
- * operator's whole reach, silently, for the life of the session. An
172
- * `OXY_API_KEY` the caller also set is a credential it named, and is let by.
173
- *
174
- * A sandbox agent token is then asked what it is (`GET /api/auth/token`).
175
- * Refused there, it is dead and the session never starts. Unreachable, the
176
- * prefix still picks the smaller list — the safe direction to be wrong in.
177
- */
178
139
  async function startupToolSet(ctx) {
179
140
  const bearer = ctx.storedBearer();
180
141
  if (envOnly(ctx.flags) && !bearer && !ctx.apiKey()) throw notAuthenticated(ctx.target(), ctx.flags);
@@ -188,66 +149,11 @@ async function startupToolSet(ctx) {
188
149
  }
189
150
  return "sandbox_agent";
190
151
  }
191
- /** A tool the session does not serve, called anyway. */
192
152
  function notServed(name, set) {
193
153
  return set === "sandbox_agent" ? `${name} is not served to a sandbox agent token. It does the sandbox loop with the tools listed, and nothing else.` : `unknown tool: ${name}`;
194
154
  }
195
155
 
196
- //#endregion
197
- //#region src/commands/mcp.ts
198
- /**
199
- * `oxyc mcp` — the Oxy API as MCP tools, over stdio.
200
- *
201
- * It replaced the Rust `oxy mcp stdio|sse`, which took a local checkout and
202
- * exposed the semantic model, automations and `.sql` files in it. This one
203
- * takes a TOKEN and exposes the deployment's HTTP API — the same surface
204
- * `oxyc api` reaches, for an agent that would rather call a tool than shell out.
205
- *
206
- * FOUR GENERIC TOOLS FOR THE WHOLE API — the design decision that makes most
207
- * of it affordable.
208
- *
209
- * The obvious shape is one tool per endpoint, and it is the wrong one: the API
210
- * has ~670 routes, an agent runtime ships every tool's JSON schema in every
211
- * request, and that is tens of kilobytes of context spent on each turn before
212
- * a single question is asked. It would also go stale on every deploy, since
213
- * the tool list would be baked into this package rather than read from the
214
- * deployment.
215
- *
216
- * So discovery stays a QUESTION the agent asks (`oxy_routes`, `oxy_schema`)
217
- * rather than a payload it carries, exactly as the CLI does it, for
218
- * everything a generic request can do safely.
219
- *
220
- * TWO NAMED EXCEPTIONS: `SANDBOX_TOOLS` and `PREVIEW_TOOLS` below. The sandbox
221
- * loop and the workspace-previews loop are meant to run UNSUPERVISED — create
222
- * a sandbox, publish into it, call a function, tear it down — and that needs
223
- * per-operation validation (the `dev-<handle>` grammar, a confirm gate before
224
- * a delete, a hard refusal of `--app-env` outside `dev-<handle>` on the
225
- * publish tool) that `oxy_request` has no way to carry. Each of those tools
226
- * calls its CLI verb's own request-building function (`env.ts`, `fn.ts`,
227
- * `checks.ts`, `preview.ts`, `preview-runs.ts`, …), so there is exactly one
228
- * implementation of each request, and a tool's result is the same JSON
229
- * document that verb's `--json` prints. `mcp.test.ts` pins the full tool list
230
- * and a raised (and justified) per-turn schema budget.
231
- *
232
- * Target resolution and placeholder substitution are the CLI's — the same
233
- * `Context`, so `{org}` / `{workspace}` resolve the same way.
234
- *
235
- * THE CREDENTIAL IS THE TOKEN VARIABLE AND NOTHING ELSE, unless the server is
236
- * started with `--login`. An agent runtime starts this with the agent's own
237
- * token in `OXY_TOKEN`; with the variable unset, the process exits `4` rather
238
- * than serving on whatever `oxyc login` cached for the machine's owner. A
239
- * person who does want their own login passes `--login`.
240
- *
241
- * A SANDBOX AGENT TOKEN (`oxy_sbx_…`) GETS A DIFFERENT, SMALLER LIST — the
242
- * sandbox loop, `oxy_whoami`, three secret tools and `oxy_token_revoke`; no
243
- * `oxy_request`, no discovery, no previews. See `mcp-sandbox.ts`.
244
- */
245
- /**
246
- * Package version, reported in the MCP handshake.
247
- *
248
- * Read from `package.json` rather than restated, so a release bump cannot
249
- * leave the server announcing a version nobody shipped.
250
- */
156
+ // src/commands/mcp.ts
251
157
  const VERSION = (() => {
252
158
  try {
253
159
  const here = dirname(fileURLToPath(import.meta.url));
@@ -255,10 +161,6 @@ const VERSION = (() => {
255
161
  } catch {}
256
162
  return "0.0.0";
257
163
  })();
258
- /**
259
- * A tool result. MCP wants content blocks; everything here is text, because
260
- * the caller is a language model and the payloads are JSON or markdown.
261
- */
262
164
  function text(body, isError = false) {
263
165
  return {
264
166
  content: [{
@@ -268,13 +170,6 @@ function text(body, isError = false) {
268
170
  isError
269
171
  };
270
172
  }
271
- /**
272
- * A tool result carrying one JSON document — the same shape the matching
273
- * verb's `--json` prints, so a tool's result and the CLI's output never
274
- * drift apart. On failure the exit-code class is appended, same spelling as
275
- * the generic catch-all below (`[exit N NAME]`), so an agent branches on it
276
- * the way it would on `oxyc`'s own exit code.
277
- */
278
173
  function jsonResult(data, opts = {}) {
279
174
  const body = JSON.stringify(data);
280
175
  if (!opts.isError) return text(body);
@@ -352,22 +247,6 @@ const TOOLS = [
352
247
  }
353
248
  }
354
249
  ];
355
- /**
356
- * THE SANDBOX LOOP, AS TOOLS — the deliberate exception to "four, not one per
357
- * endpoint" above. A generic `oxy_request` can call these same routes, but it
358
- * cannot carry the per-operation validation that makes the loop safe for an
359
- * agent to drive unsupervised: the dev-<handle> grammar, the confirm-before-
360
- * delete gate, and the hard refusal of a sandbox publish outside dev-<handle>.
361
- * Every one of these reuses its CLI verb's own request-building function —
362
- * see `env.ts` / `fn.ts` / `checks.ts` / `invocations.ts` / `logs.ts` /
363
- * `publish.ts` — so there is exactly one implementation of each request, and
364
- * the tool result is the same JSON document that verb's `--json` prints.
365
- *
366
- * Each description says what it returns AND what to call next, so the loop
367
- * reads off the tool list alone: env_create → publish_sandbox → fn_call /
368
- * checks_run → invocations_list / invocations_held / logs → iterate from
369
- * publish_sandbox → env_delete.
370
- */
371
250
  const PLANES_ARG = {
372
251
  type: "object",
373
252
  description: "Plane key to mode, e.g. {\"semantic\": \"branch:<git branch>\"}; \"default\" clears a key."
@@ -766,19 +645,6 @@ const SANDBOX_TOOLS = [
766
645
  }
767
646
  }
768
647
  ];
769
- /**
770
- * WORKSPACE PREVIEWS, AS TOOLS — the same exception as `SANDBOX_TOOLS` above,
771
- * for the same reason: the run-kind grammar and the create/wait/timeout
772
- * contract are per-operation validation a generic `oxy_request` cannot carry.
773
- * Each reuses its `oxyc preview` verb's own request-building function (see
774
- * `preview.ts` / `preview-runs.ts`), so there is one implementation of each
775
- * request and the tool result matches that verb's `--json` output.
776
- *
777
- * The loop: preview_create (waits for the compile) → preview_checks → " +
778
- * preview_run (procedure or airway_sample) → preview_run_show (waits for the " +
779
- * run) → preview_runs_list to see transform_build/compare runs the server " +
780
- * queued on its own → preview_delete when done.
781
- */
782
648
  const PREVIEW_TOOLS = [
783
649
  {
784
650
  name: "oxy_preview_create",
@@ -935,47 +801,15 @@ const ALL_TOOLS = [
935
801
  ...SANDBOX_TOOLS,
936
802
  ...PREVIEW_TOOLS
937
803
  ];
938
- /** The list a session serves — decided once, from its credential (`mcp-sandbox.ts`). */
939
804
  function toolsFor(set) {
940
805
  return set === "sandbox_agent" ? sandboxAgentTools(SANDBOX_TOOLS) : ALL_TOOLS;
941
806
  }
942
- /**
943
- * Above this many matches, `oxy_routes` drops the descriptions.
944
- *
945
- * DEGRADES, IT DOES NOT REFUSE — the same shape as `oxyc routes`, which picks
946
- * `renderDetailed` under 40 matches and the compact method+path table above it
947
- * (`discover.ts`). The expensive field is `description`, not the row: a trimmed
948
- * row is a few tens of bytes, so several hundred still fit in a result an agent
949
- * can read, while the descriptions are what turn a broad match into hundreds of
950
- * KB of context spent before a question is asked.
951
- *
952
- * The threshold is on the COUNT, not on whether a `filter` was supplied — a
953
- * filter is not evidence of narrowing. `searchRoutes` matches a substring of
954
- * method, path, surface or description, so `"admin"`, `"workspace"` and
955
- * `"query"` are all filters a model reaches for in good faith that clear this.
956
- */
957
807
  const MAX_DESCRIBED_ROUTES = 60;
958
- /**
959
- * And above THIS many, there is nothing useful to return at all.
960
- *
961
- * Deliberately far above the threshold that drops descriptions: refusing is the
962
- * answer only when even the trimmed listing would be a context dump, which for
963
- * a deployment of ~670 routes means "you asked for effectively all of them".
964
- */
965
808
  const MAX_ROUTES_PER_RESULT = 400;
966
- /** `{ a: 1 }` → the `-f`/`-F` pairs `parseFields` understands. */
967
809
  function fieldPairs(fields) {
968
810
  if (!fields) return [];
969
811
  return Object.entries(fields).map(([k, v]) => `${k}=${JSON.stringify(v)}`);
970
812
  }
971
- /**
972
- * Check the arguments the schema says are required.
973
- *
974
- * `inputSchema.required` is ADVISORY on the low-level `Server` — it is handed
975
- * to the model, not enforced by the transport. Without this, `oxy_schema` with
976
- * no `path` matched every path and returned the whole OpenAPI document, and
977
- * `oxy_request` with none built a request to `/api/`.
978
- */
979
813
  function optionalString(name, value) {
980
814
  if (value === void 0 || value === null) return void 0;
981
815
  if (typeof value === "string") return value;
@@ -1308,18 +1142,6 @@ async function callTool(ctx, name, args) {
1308
1142
  default: return text(`unknown tool: ${name}`, true);
1309
1143
  }
1310
1144
  }
1311
- /**
1312
- * Serve MCP on stdio until the client disconnects.
1313
- *
1314
- * STDIO IS THE WHOLE TRANSPORT, deliberately. An HTTP/SSE server would need a
1315
- * port, a lifetime and an auth story of its own; stdio is what every agent
1316
- * runtime already launches, and the process inherits the caller's environment
1317
- * — which is where the token and the target come from.
1318
- *
1319
- * NOTHING MAY BE WRITTEN TO STDOUT except protocol frames. `log.info` and
1320
- * friends already go to stderr, which is why this can share the CLI's own
1321
- * plumbing without corrupting the stream.
1322
- */
1323
1145
  async function runMcp(ctx) {
1324
1146
  markMcpSession();
1325
1147
  const set = await startupToolSet(ctx);
@@ -1351,6 +1173,5 @@ async function runMcp(ctx) {
1351
1173
  });
1352
1174
  }
1353
1175
 
1354
- //#endregion
1355
1176
  export { runMcp };
1356
- //# sourceMappingURL=mcp-WxYfGpMF.mjs.map
1177
+ //# sourceMappingURL=mcp-CJWQm-yd.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-CJWQm-yd.mjs","names":[],"sources":["../src/commands/mcp-sandbox.ts","../src/commands/mcp.ts"],"mappings":";;;;;;;;;;AAoCA,MAAM,MAAM;CAAE,MAAM;CAAU,aAAa;AAA2C;AACtF,MAAM,cAAc;CAClB,MAAM;CACN,aAAa;AACf;AAGA,MAAM,gCAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,SAAkB;CACtB,MAAM;CACN,aACE;CAIF,aAAa;EAAE,MAAM;EAAU,YAAY,CAAC;CAAE;AAChD;AAGA,MAAa,sBAAiC;CAC5C;EACE,MAAM;EACN,aACE;EAGF,aAAa;GACX,MAAM;GACN,YAAY;IAAE,KAAK;IAAK,QAAQ;GAAY;GAC5C,UAAU,CAAC,OAAO,QAAQ;EAC5B;CACF;CACA;EACE,MAAM;EACN,aACE;EAGF,aAAa;GACX,MAAM;GACN,YAAY;IACV,KAAK;IACL,QAAQ;IACR,KAAK;KAAE,MAAM;KAAU,aAAa;IAA6C;IACjF,OAAO;KAAE,MAAM;KAAU,aAAa;IAAsB;GAC9D;GACA,UAAU;IAA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,SAAS,SAAS,UAAa,SAAS,EAAE,CAAC,CAAC,KAAK,MAY3D;IAJzB,iBAAiB,WACb,SAAS,MAAM,KAAK,GAAG,aAAa,MAAM,IAAI,EAAE,MAC/C,MAAM,aAAa,iBAAiB,MAAM,eAAe,MAC1D;GACgC,CAAC,CACpC,QAAQ,MAAM,MAAM,UAAa,MAAM,EAAE,CAAC,CAC1C,KAAK,MACO,GAAG,IAAI;EACxB;CACF,CAAC;CAED,MAAM,OAAO,QAAQ,IAAI,qBAAqB,CAAC;CAI/C,MAAM,IAAI,SAAe,YAAY;EACnC,QAAQ,MAAM,GAAG,SAAS,OAAO;EACjC,OAAO,UAAU;CACnB,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy-hq/cli",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "oxyc — the Oxy CLI: a gh-api-style client for the Oxy HTTP API, plus the customer-account tooling that scopes a session to one customer.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -56,10 +56,10 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@oxy-hq/sdk": "workspace:*",
59
- "@types/node": "^26.6.4",
60
- "tsdown": "^0.23.0",
59
+ "@types/node": "^26.6.6",
60
+ "tsdown": "^0.23.7",
61
61
  "typescript": "^7.0.2",
62
- "vitest": "^5.0.3"
62
+ "vitest": "^5.1.0"
63
63
  },
64
64
  "engines": {
65
65
  "node": ">=20"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oxy-cli
3
- description: Use when you need data out of an Oxy deployment — querying a customer's warehouse or semantic layer, reading threads/runs/apps/orgs, checking why an endpoint 4xxs, or reproducing a customer-reported bug against real data. Also when you need to know which endpoints exist or what body one takes. Triggers on "query the customer's data", "what does this API return", "debug this in production/dev", "which endpoint", "check the thread/run/app", "oxyc", "oxy api".
3
+ description: Use when you need data out of an Oxy deployment — querying a customer's warehouse or semantic layer, reading threads/runs/apps/orgs, checking why an endpoint 4xxs, or reproducing a customer-reported bug against real data. Also when you need to know which endpoints exist or what body one takes, and (staff) when standing a new customer account up or checking which of its steps have landed. Triggers on "query the customer's data", "what does this API return", "debug this in production/dev", "which endpoint", "check the thread/run/app", "oxyc", "oxy api", "stand up a new customer", "new account setup", "oxyc bootstrap".
4
4
  ---
5
5
 
6
6
  # Getting data out of Oxy with `oxyc`
@@ -10,7 +10,10 @@ resolves the token, picks the right credential for the surface, and can tell
10
10
  you what endpoints exist.
11
11
 
12
12
  ```bash
13
- # Not published to npm yet, so `npx @oxy-hq/cli` 404s. From a checkout:
13
+ npm i -g @oxy-hq/cli # or: npx @oxy-hq/cli <command>
14
+ oxyc <command>
15
+
16
+ # From a checkout instead, when you want the build in your working tree:
14
17
  node <repo>/sdk/cli/dist/main.mjs <command>
15
18
  ```
16
19
 
@@ -124,6 +127,43 @@ Orgs take a slug or UUID, users a UUID. Rules on a flag with `per_org: false` ar
124
127
  Treat a running split as immutable. `oxyc flags org <org>` is what a member of that org
125
128
  sees.
126
129
 
130
+ ## Standing a customer up (staff)
131
+
132
+ `oxyc bootstrap` is the sequence a new customer account goes through, and the part of
133
+ it a command can do. **Staff only, and it says so rather than failing oddly:** most
134
+ phases read or write the admin surface, creating the organization needs the
135
+ org-creation capability, and the subscription phase is the Global Owner's alone. A
136
+ customer's own agent cannot run this and should not try.
137
+
138
+ oxyc bootstrap plan <customer> [--crews] # the whole sequence; reads nothing, writes nothing
139
+ oxyc bootstrap run <customer> --owner <email> # do the phases oxyc can, print the rest
140
+ oxyc bootstrap verify <customer> [--json] # which phases have landed
141
+
142
+ Shared flags: `--name <display>`, `--repo <owner/repo>`, `--app <slug>`, `--writer
143
+ app:<slug>|pipeline:<source>` (repeatable), `--crews`, `--phase <id>` (repeatable).
144
+ `run` also takes `--owner`, `--dry-run` and `--yes`. The phases are `repo`, `org`,
145
+ `billing`, `oltp`, `git-link`, `workspace`, `airhouse`, `app`, `secrets` and — with
146
+ `--crews` — `frontline`.
147
+
148
+ **`run` is safe to re-run**, which is the whole point: a half-finished standup is the
149
+ common case. It reads every phase before it writes, and writes only what is missing —
150
+ exactly two things, the organization and the workspace's Airhouse tenant — then prints
151
+ a checklist for the rest. It never buys the OLTP store (a billable project at a paid
152
+ provider), never provisions a subscription, never sets a secret's value and never
153
+ enrols a worker.
154
+
155
+ **It works one surface at a time.** The admin surface is refused while an
156
+ `oxyc assume` session is live, and the import that gives a workspace its git remote is
157
+ org-scoped — so a standup crosses between staff and tenant credentials twice. `plan`
158
+ prints the stage boundaries; `run` refuses before writing anything rather than
159
+ half-writing.
160
+
161
+ `verify` distinguishes **`unknown` from `no`**: a phase it could not read — an expired
162
+ token, or an assume session closing the admin surface — is not a phase that has not
163
+ happened, and only `no` fails. Exit `9` means a phase has not landed, `8` that a live
164
+ assume session blocked the attempt. `--json` gives `{id, landed, detail, next}` per
165
+ phase, which is the form to branch on.
166
+
127
167
  ## An agent's own credential
128
168
 
129
169
  If you are an agent, run on your own token — never on the person's
@@ -187,6 +187,16 @@ what changed). **Is it already in the customer's warehouse?** → read it there.
187
187
  with `_` can't back a schema. Both stores are written **as the app**, whoever
188
188
  invoked the function, so a scheduled run writes like a click.
189
189
 
190
+ **A store has to exist before your schema can.** The org's OLTP Postgres is bought
191
+ and provisioned for the account, not created by publishing, so on a new or
192
+ part-provisioned account `ctx.oltp` fails for a reason that is nothing to do with your
193
+ code — and the same is true of a secret that was set in staging but never in
194
+ production. You cannot provision it yourself. What to ask for by name: Oxy staff run
195
+ `oxyc bootstrap verify <org>`, which reports every account-level step as landed,
196
+ missing or unreadable and names the command that fixes each one. Quote the phase it
197
+ reports (`oltp`, `secrets`, `airhouse`) and you will get a straight answer instead of
198
+ a round trip.
199
+
190
200
  **Facts, in practice.** Airhouse is DuckLake: no `PRIMARY KEY`, `UNIQUE`,
191
201
  indexes or foreign keys — publish refuses a migration carrying one. So:
192
202