@sechroom/cli 2026.6.1 → 2026.6.2-rc.2ab57437

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 (3) hide show
  1. package/README.md +136 -9
  2. package/dist/index.js +3872 -95
  3. package/package.json +9 -10
package/README.md CHANGED
@@ -54,15 +54,27 @@ npm i -g @sechroom/cli@next
54
54
  npx @sechroom/cli login
55
55
  ```
56
56
 
57
+ ## Develop
58
+
59
+ This is a **pnpm workspace member** (`frontend/apps/cli`). Install from the repo root
60
+ (`pnpm install`), then run scripts via the filter (or `pnpm <script>` from this dir):
61
+
62
+ ```bash
63
+ pnpm --filter @sechroom/cli run gen # regenerate the typed client
64
+ pnpm --filter @sechroom/cli run check-types
65
+ pnpm --filter @sechroom/cli run build
66
+ pnpm --filter @sechroom/cli run dev -- --help # tsx, no build
67
+ ```
68
+
57
69
  ## Generate the client (once, and after any API change)
58
70
 
59
71
  ```bash
60
72
  # defaults to https://app.sechroom.ai/api/openapi/v1.json
61
- npm run gen
62
- SECHROOM_OPENAPI_URL=https://<host>/api/openapi/v1.json npm run gen # other envs
73
+ pnpm --filter @sechroom/cli run gen
74
+ SECHROOM_OPENAPI_URL=https://<host>/api/openapi/v1.json pnpm --filter @sechroom/cli run gen # other envs
63
75
  ```
64
76
 
65
- `npm run gen` overwrites `src/generated/api.d.ts`. The **real generated types are
77
+ `gen` overwrites `src/generated/api.d.ts`. The **real generated types are
66
78
  committed** (regenerated from the live prod spec) so builds are hermetic — no
67
79
  live-API dependency at compile time; re-run `gen` after any API change. Generating
68
80
  against the live schema is what caught the original placeholder's shape drift
@@ -82,17 +94,119 @@ sechroom memory get mem_XXXX
82
94
  sechroom memory search "convention lifecycle drift" --limit 5
83
95
  sechroom worklog append --text "shipped CLI skeleton; pointers: ..." --source claude-code-chris
84
96
 
97
+ sechroom lookup mem_XXXX # what is this id? -> kind / title / view URL
98
+ sechroom lookup sechroom:mem_XXXX --json # namespaced form also resolves
99
+
85
100
  sechroom --json memory get mem_XXXX # agent-friendly
86
101
  ```
87
102
 
103
+ **Output shape.** Mutating commands (`memory create`, `worklog append`) print a concise confirmation line — id + view URL — the way the MCP tools hand an LLM a result, instead of dumping the raw envelope. Pass `--json` for the full response body (the machine channel) on any command. Output is lightly colorized on a TTY and auto-plain when piped, under `--json`, or when `NO_COLOR` is set.
104
+
105
+ ```bash
106
+ sechroom memory create --text "a note" --title "Note"
107
+ # ✓ created memory mem_XXXX "Note" → https://sechroom.yi.ocd.codes/view/mem_XXXX
108
+ ```
109
+
110
+ **Per-directory config.** A project dir can pin its own `tenant` + `baseUrl` in a local `.sechroom.json`, discovered by walking **up** from cwd (nearest wins, so any subdir inherits it). It overrides the global config — precedence: `--flag` > env > directory-local > global > default. `clientId` / auth state stays global.
111
+
112
+ ```bash
113
+ sechroom config set --local tenant cli-smoke # this dir + subdirs
114
+ sechroom config set --local baseUrl https://staging.app.sechroom.ai/api
115
+ sechroom config show # resolved values + which source won
116
+ ```
117
+
118
+ **Smoke testing.** There is a dedicated **`cli-smoke`** tenant on **both staging and prod** for exercising the CLI without touching real tenants — point at staging and use it:
119
+
120
+ ```bash
121
+ sechroom config set --local baseUrl https://staging.app.sechroom.ai/api
122
+ sechroom config set --local tenant cli-smoke
123
+ sechroom login
124
+ sechroom worklog append --text "cli smoke" --source claude-code-chris
125
+ ```
126
+
88
127
  Headless:
89
128
 
90
129
  ```bash
91
- export SECHROOM_TOKEN="<jwt from /auth/dev/token>"
130
+ export SECHROOM_TOKEN="<bearer: a PAT or dev-token JWT>"
92
131
  export SECHROOM_TENANT=ocd
93
132
  sechroom --json memory search "rate limiting"
94
133
  ```
95
134
 
135
+ ## Command surface (MCP parity)
136
+
137
+ The CLI mirrors the sechroom MCP tool surface — every command is a thin wrapper over the same HTTP endpoint the matching MCP tool shims, so enforcement (`[TenantPermission]`) is identical. Run `sechroom <group> --help` for the subcommands + examples.
138
+
139
+ | Group | Covers |
140
+ |---|---|
141
+ | `memory` | create / get / search · edit-text(+batch) · archive / restore / move · versions / revert · list-archived · owners / tags / types · sum-tokens · similar · by-url |
142
+ | `relationship` | create / list / delete · suggest · `suggestion` get / accept / reject / defer |
143
+ | `workspace` | create / list / get · rename / describe / move · archive / restore · feed |
144
+ | `project` | create / list / get · rename / describe / move · status · victory-conditions · archive / restore |
145
+ | `filing` | suggestions / get · preview · accept / reject / defer / edit-and-accept |
146
+ | `continuity` | snapshot-create / -get · snapshots · resume-me / resume-lane · changed-since · load-set · grant / revoke-grant |
147
+ | `id` | next / peek (FR-_/D-_ sequence allocation) |
148
+ | `account` | profile / set-profile · feed · reviews / review-get / review-accept · lookup-batch |
149
+ | `chat` | send · messages · replies · stop-tracking (Slack / Discord, via `--surface`) |
150
+ | `worklog` · `lookup` | append · resolve any id |
151
+
152
+ Notes on deliberate gaps (API-rooted, not CLI):
153
+ - **No `memory delete`** — the API exposes no hard DELETE; `memory archive` is the soft-delete path.
154
+ - **`memory revert`** needs `--text` + `--content` — the revert endpoint doesn't reconstruct a version's body from its number; pull them from `memory versions` / `memory get` first.
155
+
156
+ ## Onboarding (`init` / `setup`)
157
+
158
+ `sechroom init` wires a project for sechroom by rendering the server's
159
+ operator-surface setup descriptors (`GET /operator-surface/setup`, tenant-scoped
160
+ — the aggregator URL is baked in) into local AI-client config + agent instruction
161
+ files. **Idempotent — merges/appends, never clobbers** (JSON `mcpServers` merge;
162
+ Codex TOML table replace; instruction files use a managed marker block).
163
+
164
+ ```bash
165
+ sechroom init # Claude Code (default): .mcp.json + CLAUDE.md
166
+ sechroom init --client all # claude-code, claude-desktop, codex, cursor
167
+ sechroom init --client codex,cursor # a subset
168
+ sechroom init --mcp-only # just the MCP config (skip agent files)
169
+ sechroom init --dry-run --json # preview the writes, no changes
170
+
171
+ # granular pieces init orchestrates:
172
+ sechroom setup mcp claude-desktop # just the MCP config for one client
173
+ sechroom setup agent-files codex # just the AGENTS.md instruction file
174
+ ```
175
+
176
+ ### `sechroom onboard` — guided first run
177
+
178
+ `onboard` orchestrates the whole zero-to-wired path interactively: configure base
179
+ URL + tenant, sign in, set the profile timezone, then wire your AI client(s). Two
180
+ prompts make it fit how you actually work:
181
+
182
+ - **Where to save config** — globally (`~/.config/sechroom`, all projects) or a
183
+ directory-local `.sechroom.json` (this project + subdirs). Defaults to local
184
+ when a `.sechroom.json` already governs the dir.
185
+ - **How far to wire** — full (MCP server + agent instructions), agent
186
+ instructions only (skip `.mcp.json`), or **CLI only** (write nothing for AI
187
+ clients — for when you just want the `sechroom` command).
188
+
189
+ ```bash
190
+ sechroom onboard # interactive: asks where to save + how to wire
191
+ sechroom onboard --cli-only # just the CLI — no .mcp.json, no agent files
192
+ sechroom onboard --no-mcp # agent instructions only, skip MCP config
193
+ sechroom onboard --local # save tenant + base URL to ./.sechroom.json
194
+ sechroom onboard --yes # non-interactive: defaults + global config + full wire
195
+ ```
196
+
197
+ Per client → where it writes:
198
+
199
+ | client | MCP config | instruction file |
200
+ |---|---|---|
201
+ | `claude-code` | `./.mcp.json` | `./CLAUDE.md` |
202
+ | `claude-desktop` | `claude_desktop_config.json` (OS path) | `~/.claude/CLAUDE.md` |
203
+ | `codex` | `~/.codex/config.toml` | `./AGENTS.md` |
204
+ | `cursor` | `./.cursor/mcp.json` | `./AGENTS.md` |
205
+
206
+ The instruction-file step pulls the role template the SEM Starter bundle ships
207
+ (via the descriptor's tag-query artifact). If that bundle isn't installed in the
208
+ tenant, the step **skips gracefully** with a note (MCP config still gets written).
209
+
96
210
  ## Layout
97
211
 
98
212
  ```
@@ -101,10 +215,23 @@ src/
101
215
  auth.ts OAuth auth-code+PKCE loopback (fixed-port DCR) + refresh + cache
102
216
  client.ts openapi-fetch client (auth + tenant middleware) + emit/fail
103
217
  config.ts base-url / tenant / token resolution + persistence
104
- generated/api.d.ts typed client — `npm run gen`; real types committed (hermetic)
218
+ generated/api.d.ts typed client — `pnpm run gen`; real types committed (hermetic)
105
219
  commands/
106
- memory.ts create / get / search
220
+ memory.ts create / get / search / edit / archive / move / versions / …
221
+ relationships.ts relationships + relationship-suggestions
222
+ workspace.ts workspace CRUD + feed
223
+ project.ts project CRUD + status / victory-conditions
224
+ filing.ts filing-suggestion review (accept / reject / defer / edit-and-accept)
225
+ continuity.ts snapshots + resume / grant
226
+ account.ts id next/peek + profile / feed / reviews / lookup-batch
227
+ chat.ts read Slack / Discord messages + replies
107
228
  worklog.ts append
229
+ lookup.ts resolve any id (mem_…/unprefixed/sechroom:<id>) -> kind/title/url
230
+ setup.ts init + setup mcp/agent-files
231
+ setup/
232
+ operator-surface.ts fetch GET /operator-surface/setup + resolve template artifacts
233
+ clients.ts client→(surface, local paths, format) registry
234
+ apply.ts writers: mcp json merge / codex toml / instruction marker block
108
235
  ```
109
236
 
110
237
  ## Remaining before ship
@@ -123,9 +250,9 @@ Public **npmjs** under the `@sechroom` org is the host; **TeamCity** is the
123
250
  publisher (build config `Sechroom_PublishCli`). The full pipeline — steps,
124
251
  parameters, npm auth, provisioning, and how to run a publish — is documented in
125
252
  [`ci/PUBLISHING.md`](./ci/PUBLISHING.md). In short: a manual-trigger config runs
126
- `npm ci → gen → typecheck → build → publish` in a `node:20` container, authed by
127
- a masked `NPM_TOKEN` param; `next` stamps a per-build prerelease, `latest` ships
128
- `BASE_CLI_VERSION`.
253
+ `pnpm install → gen → check-types → build → publish` (filtered to `@sechroom/cli`)
254
+ in a `node:20` container, authed by a masked `NPM_TOKEN` param. Every publish gets a
255
+ fresh calendar version `YYYY.M.<n>` (own counter); the dist-tag separates next/latest.
129
256
 
130
257
  Why public npmjs: the CLI is customer-facing, and `npx @sechroom/cli` must work
131
258
  with zero `.npmrc`/token on the customer side. GitHub Packages or a private