cngkit 1.1.6 → 1.1.8

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 (57) hide show
  1. package/README.md +249 -79
  2. package/dist/{chunk-SNTLRTQ2.js → chunk-CELXWAUR.js} +5 -13
  3. package/dist/chunk-CELXWAUR.js.map +1 -0
  4. package/dist/chunk-FIRWCD2M.js +415 -0
  5. package/dist/chunk-FIRWCD2M.js.map +1 -0
  6. package/dist/{chunk-YY2VGJ5N.js → chunk-MLKBG5YJ.js} +2 -2
  7. package/dist/{chunk-YY2VGJ5N.js.map → chunk-MLKBG5YJ.js.map} +1 -1
  8. package/dist/{chunk-Z3J7PPZB.js → chunk-PXSVLAAG.js} +13 -1364
  9. package/dist/{chunk-Z3J7PPZB.js.map → chunk-PXSVLAAG.js.map} +1 -1
  10. package/dist/chunk-QZEB4VMX.js +32 -0
  11. package/dist/chunk-QZEB4VMX.js.map +1 -0
  12. package/dist/chunk-SFZS5K6B.js +319 -0
  13. package/dist/chunk-SFZS5K6B.js.map +1 -0
  14. package/dist/{chunk-SSRUN6G5.js → chunk-WPBMAXXM.js} +5 -20
  15. package/dist/chunk-WPBMAXXM.js.map +1 -0
  16. package/dist/{chunk-F6YQGKLK.js → chunk-WR4HJ57I.js} +3 -3
  17. package/dist/chunk-WR4HJ57I.js.map +1 -0
  18. package/dist/chunk-X3THKPHT.js +83 -0
  19. package/dist/chunk-X3THKPHT.js.map +1 -0
  20. package/dist/cli.js +13 -11
  21. package/dist/cli.js.map +1 -1
  22. package/dist/commands/coderoom/index.js +7 -6
  23. package/dist/commands/coderoom/index.js.map +1 -1
  24. package/dist/commands/coderoom/join.js +6 -5
  25. package/dist/commands/coderoom/join.js.map +1 -1
  26. package/dist/commands/coderoom/share.js +6 -5
  27. package/dist/commands/coderoom/share.js.map +1 -1
  28. package/dist/commands/index.js +6 -5
  29. package/dist/commands/index.js.map +1 -1
  30. package/dist/commands/knowledges/audiences.js +8 -5
  31. package/dist/commands/knowledges/audiences.js.map +1 -1
  32. package/dist/commands/knowledges/files.js +8 -5
  33. package/dist/commands/knowledges/files.js.map +1 -1
  34. package/dist/commands/knowledges/glob.js +8 -5
  35. package/dist/commands/knowledges/glob.js.map +1 -1
  36. package/dist/commands/knowledges/grep.js +8 -5
  37. package/dist/commands/knowledges/grep.js.map +1 -1
  38. package/dist/commands/knowledges/index.js +7 -6
  39. package/dist/commands/knowledges/index.js.map +1 -1
  40. package/dist/commands/knowledges/list.js +8 -5
  41. package/dist/commands/knowledges/list.js.map +1 -1
  42. package/dist/commands/knowledges/read.js +8 -5
  43. package/dist/commands/knowledges/read.js.map +1 -1
  44. package/dist/commands/knowledges/search.js +8 -5
  45. package/dist/commands/knowledges/search.js.map +1 -1
  46. package/dist/commands/knowledges/status.js +8 -5
  47. package/dist/commands/knowledges/status.js.map +1 -1
  48. package/dist/commands/login.js +49 -6
  49. package/dist/commands/login.js.map +1 -1
  50. package/dist/commands/scrub.js +256 -7
  51. package/dist/commands/scrub.js.map +1 -1
  52. package/dist/commands/transcripts.js +377 -6
  53. package/dist/commands/transcripts.js.map +1 -1
  54. package/package.json +1 -1
  55. package/dist/chunk-F6YQGKLK.js.map +0 -1
  56. package/dist/chunk-SNTLRTQ2.js.map +0 -1
  57. package/dist/chunk-SSRUN6G5.js.map +0 -1
package/README.md CHANGED
@@ -1,127 +1,297 @@
1
1
  # cngkit
2
2
 
3
- Opinionated Curly.ng CLI kit for Coderoom collaboration, Harness knowledges, and website tooling.
3
+ [![npm version](https://img.shields.io/npm/v/cngkit.svg)](https://www.npmjs.com/package/cngkit)
4
+ [![Node.js >= 20](https://img.shields.io/badge/node-%3E%3D20-339933)](https://nodejs.org/)
5
+
6
+ Curly.ng's operator CLI for shared code rooms, safe local cleanup, local agent transcript
7
+ inspection, and terminal access to the hosted Harness knowledge catalog.
8
+
9
+ `cngkit` is built for developers and AI agents who need practical commands that work
10
+ well in terminals, scripts, and coding assistants. Human-facing status lines use Ink
11
+ styling when the terminal supports color. Data-heavy output stays plain and easy to pipe.
12
+
13
+ ## Quick Start
14
+
15
+ Run it without installing:
4
16
 
5
17
  ```bash
6
- npx cngkit
18
+ npx --yes cngkit@latest --help
7
19
  ```
8
20
 
9
- The CLI provides Coderoom collaboration, secret scrubbing, and a terminal front door to
10
- the Cloudflare-backed Harness knowledges catalog:
21
+ Or install it globally:
11
22
 
12
- - `cngkit login` opens Curly.ng login in a browser, or prints the URL in headless environments.
13
- - `cngkit coderoom share [room-code]` starts a live shared code room from the current directory.
14
- - `cngkit coderoom join <room-code>` joins another developer's shared code room.
15
- - `cngkit scrub [path]` scans a file or directory with TruffleHog and prints a redacted report.
16
- - `cngkit scrub [path] --yes` rewrites detected secret values inline with `[CNGKIT_SECRET:<detector>:<verified|unverified>]` placeholders.
17
- - `cngkit transcripts list [--source all|codex|claude] [--limit n]` lists recent local Claude/Codex transcript files.
18
- - `cngkit transcripts read <path-or-session-id> [--limit n]` prints normalized user/assistant transcript entries.
19
- - `cngkit transcripts grep <query> [--limit n] [--file-limit n]` searches recent local transcript entries.
20
- - `cngkit knowledges status` prints the remote catalog state.
21
- - `cngkit knowledges audiences` lists available audience filters.
22
- - `cngkit knowledges search <query> [--limit n]` runs semantic search against Cloudflare Vectorize (default limit 5).
23
- - `cngkit knowledges list [query] [--limit n]` lists known subskills (default limit 25).
24
- - `cngkit knowledges files [query] [--audience id] [--limit n]` lists uploaded catalog files (default limit 25).
25
- - `cngkit knowledges read <file-path> [--offset n] [--limit n]` reads a catalog file excerpt (default limit 200).
26
- - `cngkit knowledges grep <pattern> [--path path] [--include glob] [--output-mode content|files_with_matches|count] [--context n] [--case-insensitive]` searches catalog file contents (default mode `content`, default path `/`).
27
- - `cngkit knowledges glob [pattern] [--path path]` lists catalog files by supported glob pattern (default pattern `**/*.md`, default path `/`).
28
- - `.git/` and files ignored by the repo's `.gitignore` are not synced.
29
- - Later changes override earlier changes for the MVP conflict rule.
23
+ ```bash
24
+ npm install -g cngkit
25
+ cngkit --help
26
+ ```
30
27
 
31
- Help is baked into the CLI as Markdown with progressive disclosure:
28
+ Check the installed version:
32
29
 
33
30
  ```bash
34
- cngkit --help
35
- cngkit scrub --help
36
- cngkit transcripts --help
37
- cngkit knowledges --help
38
- cngkit knowledges read --help
39
- cngkit knowledges grep --help
40
- cngkit knowledges glob --help
31
+ cngkit --version
32
+ ```
33
+
34
+ `cngkit` requires Node.js 20 or newer.
35
+
36
+ ## What It Does
37
+
38
+ ```bash
39
+ cngkit login
40
+ cngkit coderoom share
41
+ cngkit coderoom join <room-code>
42
+ cngkit scrub [path]
43
+ cngkit transcripts list --limit 12
44
+ cngkit knowledges search "cloudflare backend" --limit 3
45
+ cngkit knowledges read /libraries/lib-cloudflare/SUBSKILL.md --limit 80
46
+ ```
47
+
48
+ The CLI currently has four main jobs:
49
+
50
+ - **Coderoom**: start or join a live shared working-tree room.
51
+ - **Scrub**: scan local files for secrets and optionally mask them inline.
52
+ - **Transcripts**: inspect local Claude and Codex transcript files from the terminal.
53
+ - **Knowledges**: search and read the hosted Harness knowledge catalog.
54
+
55
+ ## Coderoom
56
+
57
+ Coderoom is a live room for quickly sharing a working tree with another developer or agent.
58
+ One machine starts a room, another joins with the room code, and the Curly backend relays
59
+ file changes.
60
+
61
+ Start a room:
62
+
63
+ ```bash
64
+ cngkit coderoom share
65
+ ```
66
+
67
+ Join a room:
68
+
69
+ ```bash
70
+ cngkit coderoom join <room-code>
71
+ ```
72
+
73
+ Use your own room code:
74
+
75
+ ```bash
76
+ cngkit coderoom share design-review-01
77
+ ```
78
+
79
+ Coderoom deliberately skips `.git/` and files ignored by `.gitignore`. It is a live relay,
80
+ not durable cloud storage or a backup system. The current conflict rule is simple: the latest
81
+ received change wins.
82
+
83
+ ## Harness Knowledges
84
+
85
+ The `knowledges` commands read the Cloudflare-backed Harness catalog from Curly.ng. They are
86
+ read-only and designed for AI-friendly terminal use.
87
+
88
+ Check catalog health:
89
+
90
+ ```bash
91
+ cngkit knowledges status
92
+ ```
93
+
94
+ Find relevant knowledge:
95
+
96
+ ```bash
97
+ cngkit knowledges search "cloudflare backend" --limit 3
98
+ ```
99
+
100
+ Read a catalog file:
101
+
102
+ ```bash
103
+ cngkit knowledges read /libraries/lib-cloudflare/SUBSKILL.md --limit 80
104
+ ```
105
+
106
+ List matching files:
107
+
108
+ ```bash
109
+ cngkit knowledges glob "**/*.md" --path /libraries/lib-cloudflare
110
+ ```
111
+
112
+ Search inside files:
113
+
114
+ ```bash
115
+ cngkit knowledges grep Cloudflare --path /libraries/lib-cloudflare --output-mode files_with_matches
41
116
  ```
42
117
 
43
- Global options accepted by every command:
118
+ Return JSON for another tool:
119
+
120
+ ```bash
121
+ cngkit knowledges status --json
122
+ cngkit knowledges search "vector search" --limit 5 --json
123
+ ```
44
124
 
45
- - `--api-base-url <url>` overrides the Curly backend URL (default: `CNGKIT_API_BASE_URL` or `https://curly.ng`).
46
- - `--version` prints the installed `cngkit` version.
47
- - `--help` / `-h` prints the progressive help for the current command.
125
+ Catalog path shortcuts are supported. For example:
48
126
 
49
- The canonical CLI spec lives at `docs/superpowers/specs/2026-06-25-cngkit-cli-spec.md`
50
- in the repository. The baked help source lives in `src/help-specs.ts`; keep both
51
- aligned when changing command behavior.
127
+ ```text
128
+ /libraries/lib-cloudflare/SUBSKILL.md
129
+ ```
130
+
131
+ maps to:
132
+
133
+ ```text
134
+ skills/knowledges/subskills/libraries/lib-cloudflare/SUBSKILL.md
135
+ ```
52
136
 
53
- Command routing is implemented with Pastel route files under `src/commands/`, rendered
54
- through Ink. `tsup` emits a file-preserving ESM build so the published package contains
55
- `dist/cli.js` plus `dist/commands/**`; the private workspace client stays bundled while
56
- public runtime packages remain normal package dependencies.
137
+ ## Secret Scrubbing
57
138
 
58
- `scrub` requires the `trufflehog` binary on `PATH`. On macOS, install it with:
139
+ `scrub` scans a file or directory with TruffleHog and prints a redacted report.
140
+
141
+ ```bash
142
+ cngkit scrub .
143
+ ```
144
+
145
+ Inline masking rewrites files, so it is gated behind `--yes`:
146
+
147
+ ```bash
148
+ cngkit scrub . --yes
149
+ ```
150
+
151
+ Masked values use this format:
152
+
153
+ ```text
154
+ [CNGKIT_SECRET:<detector>:<verified|unverified>]
155
+ ```
156
+
157
+ `scrub` requires the `trufflehog` binary on `PATH`.
158
+
159
+ macOS install:
59
160
 
60
161
  ```bash
61
162
  brew install trufflehog
62
163
  ```
63
164
 
64
- Inline masking is intentionally gated behind `--yes` because it rewrites files in place.
165
+ Safety notes:
166
+
167
+ - The default mode is report-only.
168
+ - Raw secret values are never printed.
169
+ - `--mask` is accepted as a compatibility alias, but inline changes still require `--yes`.
65
170
 
66
171
  ## Local Agent Transcripts
67
172
 
68
- The `transcripts` command reads local JSONL logs from `~/.codex/sessions`,
69
- `~/.codex/archived_sessions`, `~/.claude/projects`, and `~/.claude/history.jsonl`.
70
- It is local-only operator tooling: transcript contents are not uploaded to the Curly backend.
173
+ `transcripts` reads local JSONL files from:
174
+
175
+ - `~/.codex/sessions`
176
+ - `~/.codex/archived_sessions`
177
+ - `~/.claude/projects`
178
+ - `~/.claude/history.jsonl`
179
+
180
+ List recent transcript files:
71
181
 
72
182
  ```bash
73
183
  cngkit transcripts list --limit 12
184
+ ```
185
+
186
+ Read a transcript by path or partial session id:
187
+
188
+ ```bash
74
189
  cngkit transcripts read <path-or-session-id> --source codex --limit 80
190
+ ```
191
+
192
+ Search recent transcript entries:
193
+
194
+ ```bash
75
195
  cngkit transcripts grep "deploy failed" --source all --file-limit 60 --limit 20
76
196
  ```
77
197
 
78
- By default, `read` and `grep` print only user/assistant text and skip internal prompt,
79
- hook, and tool noise. Use `--include-internal` when debugging transcript plumbing.
198
+ Transcript commands are local-only. They do not upload transcript content to Curly.ng.
199
+ By default, they print user and assistant text and skip internal prompt, hook, and tool noise.
200
+ Use `--include-internal` when debugging transcript plumbing.
80
201
 
81
- ## Coderoom
202
+ ## Backend Selection
82
203
 
83
- Coderoom is for quickly uniting developers around one working tree. One developer starts
84
- a room, another joins it, and the Curly backend relays file changes through the
85
- `/api/cng/sync/:roomCode` WebSocket room.
204
+ By default, `cngkit` talks to:
205
+
206
+ ```text
207
+ https://curly.ng
208
+ ```
209
+
210
+ Override the backend for one command:
86
211
 
87
212
  ```bash
88
- cngkit coderoom share
89
- cngkit coderoom join <room-code>
213
+ cngkit --api-base-url https://curly.ng knowledges status
90
214
  ```
91
215
 
92
- The frontend helper lives at `/coderoom`. It presents Coderoom as a Drive-like
93
- shared workspace: a room code acts like a share link, connected machines act like
94
- collaborators, and file events act like the activity stream. Current Coderoom
95
- rooms are live relays, not durable cloud storage.
216
+ Or with an environment variable:
96
217
 
97
- ## Harness Knowledges
218
+ ```bash
219
+ CNGKIT_API_BASE_URL=https://curly.ng cngkit knowledges status
220
+ ```
221
+
222
+ ## Help
98
223
 
99
- The `knowledges` command group reads the Cloudflare-backed Harness catalog from the
100
- Curly API. These commands are read-only:
224
+ Help is baked into the CLI as Markdown:
101
225
 
102
226
  ```bash
103
- cngkit knowledges status
104
- cngkit knowledges audiences
105
- cngkit knowledges search "cloudflare backend" --limit 3
106
- cngkit knowledges files "vector search" --audience builders
107
- cngkit knowledges read /libraries/lib-cloudflare/SUBSKILL.md --limit 80
108
- cngkit knowledges grep Cloudflare --path /libraries/lib-cloudflare --output-mode files_with_matches
109
- cngkit knowledges glob "**/*.md" --path /libraries/lib-cloudflare
227
+ cngkit --help
228
+ cngkit help
229
+ cngkit help knowledges
230
+ cngkit coderoom --help
231
+ cngkit knowledges read --help
232
+ cngkit transcripts --help
110
233
  ```
111
234
 
112
- Add `--json` to any `knowledges` command when another tool should consume the
113
- raw API response. `grep` also accepts `--output-mode <content|files_with_matches|count>`
114
- (default `content`), `--include <glob>` (default `*`), `--context <n>` (default `0`), and
115
- `--case-insensitive`. Result limits default to `5` for `search` and `25` for `list` and
116
- `files`; `read` defaults to `200` lines with a backend cap of `2000`, and accepts `--offset`
117
- for paging.
235
+ Help and machine-readable output are intentionally plain text. Status, warnings, and errors
236
+ use Ink color in interactive terminals, but `--json`, file reads, glob results, grep results,
237
+ and piped output stay clean.
118
238
 
119
- `read` and `grep` accept shorthand catalog paths: `/libraries/lib-cloudflare/SUBSKILL.md`
120
- expands to `skills/knowledges/subskills/libraries/lib-cloudflare/SUBSKILL.md`, mirroring the
121
- Claude `read`/`grep` tool convention.
239
+ ## Terminal UI Stack
240
+
241
+ `cngkit` uses the Ink family without adding a custom command framework:
242
+
243
+ - **Pastel** owns command and subcommand routing through files under `src/commands/`.
244
+ - **Ink** owns terminal rendering through built-in components such as `<Text>`.
245
+ - **Zod** owns option and argument schemas for each route.
246
+
247
+ So yes, subcommands are built in through Pastel's nested route files. Adding a
248
+ subcommand is normally a new `.tsx` file under the matching command folder:
249
+
250
+ ```text
251
+ src/commands/
252
+ coderoom/
253
+ share.tsx cngkit coderoom share
254
+ join.tsx cngkit coderoom join
255
+ knowledges/
256
+ read.tsx cngkit knowledges read
257
+ grep.tsx cngkit knowledges grep
258
+ glob.tsx cngkit knowledges glob
259
+ ```
260
+
261
+ The CLI does not hand-roll ANSI escape codes. Status styles go through Ink's built-in
262
+ `<Text color="..." bold dimColor>` support. Commands that return content for agents or shell
263
+ pipelines write raw lines instead.
264
+
265
+ ## For Contributors
266
+
267
+ The package source lives in `apps/cng`.
268
+
269
+ ```text
270
+ src/
271
+ cli/ Pastel bootstrap support, help text, option schemas, Ink output runner
272
+ commands/ Thin Pastel route files
273
+ features/ Command behavior grouped by feature
274
+ shared/ Config, output, browser, API client, shared command utilities
275
+ ```
276
+
277
+ The route files under `src/commands/` should stay thin. Put behavior in
278
+ `src/features/<feature>/`, and put cross-feature runtime helpers in `src/shared/`.
279
+ For output, use the shared `CommandOutput` methods:
280
+
281
+ - `success`, `warning`, `info`, `muted`, and `error` for human-facing terminal status.
282
+ - `raw` for JSON, file content, file paths, grep results, and anything another tool may parse.
283
+
284
+ Useful local checks:
285
+
286
+ ```bash
287
+ pnpm --filter cngkit run typecheck
288
+ pnpm --filter cngkit run lint
289
+ pnpm --filter cngkit run build
290
+ pnpm --filter cngkit run smoke
291
+ ```
122
292
 
123
- This package is mostly personal tooling for Curly.ng. It is intentionally opinionated,
124
- small, and practical rather than a general synchronization platform.
293
+ The package build uses `tsup` to emit a file-preserving ESM build. The published binary is
294
+ `dist/cli.js`, and Pastel discovers command files under `dist/commands/**`.
125
295
 
126
296
  ## License
127
297
 
@@ -1,23 +1,15 @@
1
1
  import {
2
+ createCommandOutput,
2
3
  formatError
3
- } from "./chunk-SSRUN6G5.js";
4
+ } from "./chunk-X3THKPHT.js";
4
5
 
5
- // src/ink/command-runner.tsx
6
+ // src/cli/command-runner.tsx
6
7
  import { useEffect } from "react";
7
8
  import { useApp } from "ink";
8
9
  function CommandRunner({ run }) {
9
10
  const { exit } = useApp();
10
11
  useEffect(() => {
11
- const output = {
12
- info(message) {
13
- process.stdout.write(`${message}
14
- `);
15
- },
16
- error(message) {
17
- process.stderr.write(`${message}
18
- `);
19
- }
20
- };
12
+ const output = createCommandOutput(process.stdout, process.stderr);
21
13
  void run(output).catch((error) => {
22
14
  process.exitCode = 1;
23
15
  output.error(formatError(error));
@@ -31,4 +23,4 @@ function CommandRunner({ run }) {
31
23
  export {
32
24
  CommandRunner
33
25
  };
34
- //# sourceMappingURL=chunk-SNTLRTQ2.js.map
26
+ //# sourceMappingURL=chunk-CELXWAUR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/command-runner.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useApp } from \"ink\";\n\nimport { createCommandOutput, formatError, type CommandOutput } from \"../shared/output.js\";\n\ntype CommandRunnerProps = {\n readonly run: (output: CommandOutput) => Promise<void>;\n};\n\nexport function CommandRunner({ run }: CommandRunnerProps) {\n const { exit } = useApp();\n\n useEffect(() => {\n const output = createCommandOutput(process.stdout, process.stderr);\n\n void run(output)\n .catch((error: unknown) => {\n process.exitCode = 1;\n output.error(formatError(error));\n })\n .finally(() => {\n exit();\n });\n }, [exit, run]);\n\n return null;\n}\n"],"mappings":";;;;;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAQhB,SAAS,cAAc,EAAE,IAAI,GAAuB;AACzD,QAAM,EAAE,KAAK,IAAI,OAAO;AAExB,YAAU,MAAM;AACd,UAAM,SAAS,oBAAoB,QAAQ,QAAQ,QAAQ,MAAM;AAEjE,SAAK,IAAI,MAAM,EACZ,MAAM,CAAC,UAAmB;AACzB,cAAQ,WAAW;AACnB,aAAO,MAAM,YAAY,KAAK,CAAC;AAAA,IACjC,CAAC,EACA,QAAQ,MAAM;AACb,WAAK;AAAA,IACP,CAAC;AAAA,EACL,GAAG,CAAC,MAAM,GAAG,CAAC;AAEd,SAAO;AACT;","names":[]}