@oxy-hq/cli 0.1.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.
Files changed (39) hide show
  1. package/README.md +163 -0
  2. package/dist/main.mjs +6688 -0
  3. package/dist/main.mjs.map +1 -0
  4. package/dist/mcp-VdontkUr.mjs +316 -0
  5. package/dist/mcp-VdontkUr.mjs.map +1 -0
  6. package/json-schemas/agent-test.json +104 -0
  7. package/json-schemas/agentic.json +406 -0
  8. package/json-schemas/app.json +1884 -0
  9. package/json-schemas/config.json +2215 -0
  10. package/json-schemas/flow-test.json +124 -0
  11. package/json-schemas/global-semantics.json +782 -0
  12. package/json-schemas/workflow.json +1907 -0
  13. package/package.json +65 -0
  14. package/skills/oxy-airway-pipelines/SKILL.md +338 -0
  15. package/skills/oxy-automations/SKILL.md +67 -0
  16. package/skills/oxy-cli/SKILL.md +134 -0
  17. package/skills/oxy-custom-apps/SKILL.md +330 -0
  18. package/skills/oxy-data-architecture/SKILL.md +225 -0
  19. package/skills/oxy-semantic-modeling/SKILL.md +216 -0
  20. package/template/.gitattributes +2 -0
  21. package/template/.github/scripts/ci-publish.sh +77 -0
  22. package/template/.github/scripts/discover-apps.sh +175 -0
  23. package/template/.github/scripts/publish-env.sh +55 -0
  24. package/template/.github/workflows/publish.yaml +653 -0
  25. package/template/.github/workflows/validate.yaml +264 -0
  26. package/template/.nvmrc +1 -0
  27. package/template/.oxyc-managed +297 -0
  28. package/template/README.md +414 -0
  29. package/template/_gitignore +32 -0
  30. package/template/apps/.gitkeep +0 -0
  31. package/template/config.yml +53 -0
  32. package/template/memory/.gitkeep +0 -0
  33. package/template/package.json +17 -0
  34. package/template/pipelines/.gitkeep +0 -0
  35. package/template/pnpm-workspace.yaml +32 -0
  36. package/template/scripts/dev.sh +443 -0
  37. package/template/semantics/topics/.gitkeep +0 -0
  38. package/template/semantics/views/.gitkeep +0 -0
  39. package/template/workflows/.gitkeep +0 -0
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # `@oxy-hq/cli` — `oxyc`
2
+
3
+ The Oxy CLI. Two halves under one command:
4
+
5
+ - **Talk to the API** — a `gh api`-shaped client, with discovery, so a caller
6
+ with a token and nothing else can find and call any endpoint.
7
+ - **Work on a customer account** — which customer, where their repo is, keeping
8
+ it in line with the template, and scoping a Claude session to them.
9
+
10
+ They are one tool because they share one answer to "who is this about": stand
11
+ in a customer's repo and `oxyc api {org}/workspaces` needs no ids typed.
12
+
13
+ > **Not on npm yet.** `@oxy-hq/cli` is deliberately absent from the publish
14
+ > workflow until npm Trusted Publishing is configured for it, so `npx
15
+ > @oxy-hq/cli` and `pnpm add -g @oxy-hq/cli` 404 today. Install from a
16
+ > checkout:
17
+
18
+ ```bash
19
+ cd sdk/cli && pnpm install && pnpm build
20
+ node dist/main.mjs --help # or `pnpm link --global`, then: oxyc
21
+ ```
22
+
23
+ Once it is published, the two lines above become:
24
+
25
+ ```bash
26
+ npx @oxy-hq/cli --help # no install
27
+ pnpm add -g @oxy-hq/cli # then: oxyc
28
+ ```
29
+
30
+ ## Talking to the API
31
+
32
+ ```bash
33
+ oxyc login --env dev # browser flow; shares its token with `oxy login`
34
+ oxyc whoami # who the token is, checked against the server
35
+
36
+ oxyc routes threads # what exists, and what each endpoint does
37
+ oxyc schema {workspace}/threads -X POST # the body it expects
38
+ oxyc api {workspace}/threads --jq '.threads[].title'
39
+ ```
40
+
41
+ ## Development
42
+
43
+ ```bash
44
+ oxyc validate # check the workspace's YAML against the schemas
45
+ oxyc proxy --env dev # local app dev against cloud data
46
+ oxyc mcp # serve the API as MCP tools, for an agent runtime
47
+ oxyc guide # a page to paste into AGENTS.md / CLAUDE.md
48
+ ```
49
+
50
+ **`oxyc validate`** checks `config.yml`, `.automation.yml`, `.agentic.yml`,
51
+ `.app.yml` and `.agent.test.yml` against `json-schemas/*.json` — which are
52
+ generated from the Rust config types, so this is a second *reader* of one
53
+ definition rather than a second definition. It does not replace `oxy validate`:
54
+ that one loads the workspace and can resolve `databases:` and `llm.ref`. Where
55
+ they disagree, it wins. No network, no token — the one command that works
56
+ entirely offline.
57
+
58
+ **`oxyc proxy`** forwards a dev server's Oxy calls to a cloud target with your
59
+ login token attached. Side-effecting calls are **held** and tracking events
60
+ **dropped** by default (`--allow-writes` / `--allow-events`); a production
61
+ target is refused without `--yes`.
62
+
63
+ **`oxyc mcp`** serves the API as four MCP tools — `oxy_routes`, `oxy_schema`,
64
+ `oxy_request`, `oxy_whoami` — over stdio. Four rather than one per endpoint
65
+ because an agent runtime ships every tool's schema on every turn, and ~670 of
66
+ them is tens of KB per request; discovery stays a question the agent asks.
67
+
68
+ ```bash
69
+ claude mcp add oxyc -- npx -y @oxy-hq/cli mcp --env production
70
+ ```
71
+
72
+ `oxyc api` follows `gh api` down to the flag letters:
73
+
74
+ | | |
75
+ | --- | --- |
76
+ | `-X, --method` | HTTP method. Defaults to GET, or POST with a body. |
77
+ | `-f, --raw-field k=v` | a **string** parameter |
78
+ | `-F, --field k=v` | a **typed** parameter — `true` / `3` / `["a"]` / `@file` / `@-` |
79
+ | `-F 'ids[]=a' -F 'ids[]=b'` | repeats accumulate into an array |
80
+ | `--input @body.json` | raw body from a file, or `-` for stdin |
81
+ | `-q, --jq <expr>` | filter through `jq` |
82
+ | `--md` | render results as a markdown table — handles arrays of objects, `{columns, rows}`, and the header-row-first arrays `/sql/query` returns |
83
+ | `--paginate` / `--slurp` | walk every page; `--slurp` keeps them separate |
84
+ | `--cache 5m` | reuse a recent successful GET |
85
+ | `-i` / `--silent` / `--verbose` | headers / nothing / log the request |
86
+
87
+ On GET, HEAD and DELETE, fields become query parameters instead of a body.
88
+
89
+ **Placeholders.** `{org}`, `{workspace}`, `{project}`, `{customer}` and `{me}`
90
+ are filled from context — the customer repo you are standing in, a pasted
91
+ `--env` URL, or `--org` / `--workspace` / `--project`. An unresolved
92
+ placeholder is an error naming the flag that would fill it, never a literal
93
+ sent to the server.
94
+
95
+ **Surfaces.** `/api/**` takes the bearer from `oxyc login`; `/external/api/**`
96
+ takes `X-API-Key` from `$OXY_API_KEY`. The path picks, so you never have to.
97
+
98
+ **Exit codes** are the point of the tool for a script or an agent — `oxyc
99
+ exit-codes` prints them. `4` is "log in again", `5` is "no such thing", `7` is
100
+ "retryable", `2` is "you called it wrong".
101
+
102
+ ## Working on a customer account
103
+
104
+ ```bash
105
+ oxyc list # who the customers are
106
+ oxyc <customer> # a Claude session scoped to them
107
+ oxyc <customer> --here # …while you work in one of OUR repos
108
+ oxyc doctor <customer> # what the tool knows, changing nothing
109
+ oxyc update <customer> # drift from the workspace template
110
+ oxyc adopt <customer> # give an IMPORTED repo the managed files
111
+ oxyc activity <customer> # merged PRs, theirs and ours
112
+ ```
113
+
114
+ ## Acting as an org
115
+
116
+ ```bash
117
+ oxyc assume start --org acme -r "triage #123" # 60 min, not renewable
118
+ oxyc assume status # what is live, minutes left
119
+ oxyc assume end # or --all
120
+ oxyc login --login-env dev,staging # log into several at once
121
+ ```
122
+
123
+ A staff 403 on a tenant surface usually means **no active session**, not a
124
+ mis-modeled role. The session belongs to your account rather than this
125
+ terminal, so your browser is in there too — and `end` gets you out of both.
126
+
127
+ A customer **is** a GitHub repo carrying the `oxy-customer` topic. Tagging the
128
+ repo is the whole of registration — there is no customer file anywhere, which
129
+ is why there is nothing to keep in sync.
130
+
131
+ `update` and `adopt` **report by default and write only with `--apply`**, and
132
+ neither ever commits, branches or pushes. What each may rewrite is decided by
133
+ `template/.oxyc-managed` and nothing else: a file nobody classified is the
134
+ customer's and is never touched.
135
+
136
+ ## Environment
137
+
138
+ | | |
139
+ | --- | --- |
140
+ | `OXY_TOKEN` | bearer, overriding the login cache (the CI path) |
141
+ | `OXY_API_KEY` | key for the `/external/api` surface |
142
+ | `OXYC_ORG` | the GitHub org customer repos live in (default `oxy-hq`) |
143
+ | `OXYC_DOSSIER_ROOT` | where customer clones go (default `~/.oxyc/dossiers`) |
144
+ | `OXYC_TEMPLATE_DIR` | use a working copy of the template instead of the shipped one |
145
+ | `NO_COLOR` | plain output |
146
+
147
+ ## Two audiences, one tool
148
+
149
+ Attached to a terminal you get colour, aligned tables and a searchable picker.
150
+ Piped — or read by an agent — you get markdown tables and no colour, because
151
+ that is what an LLM reads most reliably and most cheaply. Raw `api` response
152
+ bodies are verbatim in both, so `| jq` always works.
153
+
154
+ Everything that is not the answer goes to **stderr**. stdout carries the
155
+ response body and nothing else.
156
+
157
+ ## Requirements
158
+
159
+ `node >= 20`. `gh` (authenticated) for anything touching the customer registry;
160
+ `jq` for `--jq`; `git` for the repo commands. Each is reported by name, with
161
+ its install line, the first time something needs it.
162
+
163
+ Maintainer's notes: [`internal-docs/oxy-api-cli.md`](../../internal-docs/oxy-api-cli.md).