threadroot 0.1.4 → 0.1.5

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/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ All notable changes to Threadroot will be documented here.
4
4
 
5
5
  Threadroot follows semantic versioning after the first public release. While `0.x`, minor versions may include breaking changes as the harness format settles.
6
6
 
7
+ ## 0.1.5 - Website integration contracts
8
+
9
+ ### Added
10
+
11
+ - `bootstrap --packs <list>` to install capability packs during first-run setup.
12
+ - Machine-readable `--json` output for `bootstrap`, `start`, `status`, `context`, `doctor`, `mcp check`, and `mcp setup`.
13
+ - Connection authoring flags for `--allow` and `--deny` command fragments.
14
+ - `INTEGRATION.md` as the website/cloud contract for prompt generation, JSON CLI usage, and future auth/sync shape.
15
+
16
+ ### Changed
17
+
18
+ - MCP tool calls now return structured content alongside text content.
19
+ - MCP `tools_run` no longer accepts model-supplied confirmation for risky tools; agents must ask the user to approve via the CLI.
20
+ - Connection `allow` and `deny` rules are enforced when connection-backed shell tools run.
21
+ - Pack installs now write object-level provenance and sha256 integrity entries to `.threadroot/lock.json`.
22
+ - Release guidance now points toward npm provenance and signature verification.
23
+
7
24
  ## 0.1.4 - Stable npx MCP config
8
25
 
9
26
  ### Fixed
package/INTEGRATION.md ADDED
@@ -0,0 +1,256 @@
1
+ # Threadroot Integration Contract
2
+
3
+ This document is the handoff surface for a future website, prompt generator, and
4
+ cloud/auth repo. The OSS CLI remains the source of truth. The website should
5
+ generate prompts and commands that drive this CLI instead of reimplementing
6
+ harness logic.
7
+
8
+ ## Product Boundary
9
+
10
+ Threadroot OSS is the local agent harness compiler:
11
+
12
+ - `.threadroot/` is canonical project state.
13
+ - The CLI initializes, validates, compiles, and exposes harness context.
14
+ - MCP exposes the same local harness to agent clients.
15
+ - Tools and connections execute locally only.
16
+ - No secrets are stored in the repo.
17
+
18
+ The website/cloud repo can add:
19
+
20
+ - Prompt generation for new/existing projects.
21
+ - Account login, repo/project bindings, and saved project preferences.
22
+ - Cloud-hosted skill, pack, and tool authoring workflows.
23
+ - Optional sync of approved harness objects into a local repo.
24
+
25
+ The website/cloud repo must not bypass the local CLI trust model for execution.
26
+
27
+ ## Website Prompt Generator Inputs
28
+
29
+ The website should ask for a small set of high-signal choices:
30
+
31
+ - Project state: `new`, `existing`, or `existing-with-agent-files`.
32
+ - Primary agent/provider: `codex`, `claude`, `cursor`, `copilot`, `gemini`,
33
+ `windsurf`, `antigravity`, `opencode`, or `all`.
34
+ - IDE/editor: VS Code, Cursor, terminal-only, other.
35
+ - Project profile: `nextjs`, `vite-react`, `fastapi`, `python-cli`,
36
+ `node-cli`, `dbt`, or `empty`.
37
+ - Stack tags: TypeScript, React, Python, testing, security, system design,
38
+ CLI, data, cloud.
39
+ - Cloud/tooling needs: GitHub, AWS, Azure, Snowflake, dbt, none.
40
+ - Initial task: a short natural language task.
41
+ - Project clutter preference: local-only default, optional provider exposure.
42
+ - MCP preference: configure Codex MCP now, project-local MCP later, or skip.
43
+
44
+ ## Prompt-to-CLI Mapping
45
+
46
+ The website should prefer one bootstrap command plus verification:
47
+
48
+ ```bash
49
+ threadroot bootstrap --yes \
50
+ --agent <agent-or-all> \
51
+ --profile <profile> \
52
+ --task "<initial task>" \
53
+ --packs <comma-separated-packs> \
54
+ --mcp \
55
+ --json
56
+ ```
57
+
58
+ Use `--no-import` for a blank/new repo when the user wants a clean start:
59
+
60
+ ```bash
61
+ threadroot bootstrap --yes --no-import --profile empty --task "start this project" --json
62
+ ```
63
+
64
+ Use import for an existing repo so Threadroot can preserve useful existing
65
+ agent/vendor context:
66
+
67
+ ```bash
68
+ threadroot bootstrap --yes --profile <profile> --task "<task>" --json
69
+ ```
70
+
71
+ Provider-native project files stay opt-in:
72
+
73
+ ```bash
74
+ threadroot expose <agent>
75
+ ```
76
+
77
+ Verification commands:
78
+
79
+ ```bash
80
+ threadroot doctor --json
81
+ threadroot status --json
82
+ threadroot context "<task>" --json
83
+ threadroot mcp check --json
84
+ ```
85
+
86
+ The success message generated by the website prompt should be:
87
+
88
+ ```text
89
+ Success: Threadroot is ready. Run threadroot start "<task>" for future sessions.
90
+ ```
91
+
92
+ ## Pack Mapping
93
+
94
+ Initial pack choices should map conservatively:
95
+
96
+ | User choice | Packs |
97
+ | --- | --- |
98
+ | TypeScript or Node CLI | `typescript-node` |
99
+ | React app | `react-app`, `testing` |
100
+ | Python | `python`, `testing` |
101
+ | Testing-heavy project | `testing` |
102
+ | Code review / PR workflow | `code-review` |
103
+ | Security work | `security-review` |
104
+ | Architecture / product planning | `system-design` |
105
+
106
+ If uncertain, install fewer packs. Agents can list and install more later:
107
+
108
+ ```bash
109
+ threadroot packs list --json
110
+ threadroot packs inspect <pack> --json
111
+ threadroot packs install <pack> --json
112
+ ```
113
+
114
+ Pack installs record object-level provenance in `.threadroot/lock.json` with
115
+ `source: pack:<name>` and sha256 integrity.
116
+
117
+ ## JSON Surfaces
118
+
119
+ The website/cloud repo should call these commands instead of scraping text:
120
+
121
+ ```bash
122
+ threadroot bootstrap --json
123
+ threadroot start "<task>" --json
124
+ threadroot status --json
125
+ threadroot doctor --json
126
+ threadroot context "<task>" --json
127
+ threadroot mcp check --json
128
+ threadroot mcp setup --json
129
+ threadroot skills list --json
130
+ threadroot skills inspect <path> --json
131
+ threadroot skills validate --json
132
+ threadroot tools list --json
133
+ threadroot tools detect --json
134
+ threadroot tools check --json
135
+ threadroot connections list --json
136
+ threadroot connections check --json
137
+ threadroot packs list --json
138
+ threadroot packs inspect <pack> --json
139
+ threadroot packs validate <pack> --json
140
+ threadroot packs install <pack> --json
141
+ ```
142
+
143
+ Until `1.0`, these JSON shapes are alpha contracts. The website should parse
144
+ only fields it uses and tolerate extra fields.
145
+
146
+ ## Tools And Connections
147
+
148
+ Tool creation should stay local and explicit:
149
+
150
+ ```bash
151
+ threadroot tools create \
152
+ --from-command "pnpm test" \
153
+ --description "Run the test suite" \
154
+ --risk low \
155
+ --healthcheck "pnpm test" \
156
+ --json
157
+ ```
158
+
159
+ Connection creation should wrap official local CLIs only:
160
+
161
+ ```bash
162
+ threadroot connections add aws-dev \
163
+ --provider aws \
164
+ --command aws \
165
+ --profile dev \
166
+ --risk high \
167
+ --confirm \
168
+ --allow "sts get-caller-identity,s3 ls,logs tail" \
169
+ --deny "delete,terminate,iam" \
170
+ --healthcheck "aws sts get-caller-identity --profile dev" \
171
+ --json
172
+ ```
173
+
174
+ Rules:
175
+
176
+ - Connections must not store credentials.
177
+ - Users authenticate through official CLIs such as `gh`, `aws`, `az`, or
178
+ Snowflake CLI.
179
+ - MCP cannot self-confirm risky tool execution.
180
+ - High-risk, untrusted, or blocked tools must be approved through the local CLI.
181
+
182
+ ## Future Cloud/Auth CLI Contract
183
+
184
+ Do not implement these in OSS until the cloud repo exists, but reserve the shape:
185
+
186
+ ```bash
187
+ threadroot login
188
+ threadroot auth status --json
189
+ threadroot link --repo owner/name --project <project-id>
190
+ threadroot sync status --json
191
+ threadroot sync pull --json
192
+ threadroot sync push --json
193
+ threadroot sync apply --from cloud --json
194
+ ```
195
+
196
+ Expected cloud files, if added later:
197
+
198
+ ```text
199
+ .threadroot/cloud.json # repo binding, no secrets
200
+ ~/.threadroot/auth.json # local auth cache or pointer, never committed
201
+ ```
202
+
203
+ `.threadroot/cloud.json` should contain only non-secret metadata:
204
+
205
+ ```json
206
+ {
207
+ "version": 1,
208
+ "projectId": "trp_...",
209
+ "repo": "owner/name",
210
+ "remote": "https://api.threadroot.dev"
211
+ }
212
+ ```
213
+
214
+ The auth flow should use device/browser login for CLI users and store tokens
215
+ outside the repository. Repo sync should operate on harness objects, not source
216
+ code, and should always show a diff or status before applying remote changes.
217
+
218
+ ## Cloud Data Model Sketch
219
+
220
+ Minimum useful entities:
221
+
222
+ - User
223
+ - Organization
224
+ - RepoBinding
225
+ - CloudProject
226
+ - HarnessSnapshot
227
+ - Skill
228
+ - ToolTemplate
229
+ - ConnectionTemplate
230
+ - Pack
231
+ - InstallEvent
232
+ - AuditEvent
233
+
234
+ Store generated skills/tools/packs as versioned artifacts. Do not store local CLI
235
+ secrets, cloud provider keys, or repo source code in v1 cloud.
236
+
237
+ ## Security And Release Anchors
238
+
239
+ - Prefer npm trusted publishing/provenance for package releases.
240
+ - Keep `.threadroot/lock.json` as the local provenance ledger.
241
+ - Treat MCP tools as agent-controlled and require human approval for sensitive
242
+ actions.
243
+ - Prefer explicit allow/deny policies for connection-backed tools.
244
+ - Keep website-generated prompts short and command-driven.
245
+ - Use `threadroot doctor --json` as the machine-readable trust gate.
246
+
247
+ ## Website Readiness Checklist
248
+
249
+ The OSS core is ready for website work when:
250
+
251
+ - `pnpm release:check` passes.
252
+ - `threadroot bootstrap --yes --packs <list> --json` initializes a temp repo.
253
+ - `threadroot doctor --json` reports `ok: true` or actionable findings.
254
+ - Pack installs write `.threadroot/lock.json` provenance.
255
+ - MCP check verifies the local stdio server.
256
+ - README and generated agent prompts reference only real commands.
package/README.md CHANGED
@@ -39,6 +39,7 @@ node dist/index.js --help
39
39
  ```bash
40
40
  tr bootstrap --yes # one-time machine setup + local-only .threadroot/
41
41
  tr bootstrap --yes --mcp # also configure and verify global Codex MCP
42
+ tr bootstrap --yes --packs testing,typescript-node
42
43
  tr start "write tests" # doctor, status, relevant context, and command map
43
44
  tr mcp check # verify Codex MCP config and server handshake
44
45
  tr expose codex # optional: write a thin project skill shim for Codex
@@ -49,32 +50,32 @@ tr expose codex # optional: write a thin project skill shim for Codex
49
50
  ## CLI surface
50
51
 
51
52
  ```bash
52
- tr bootstrap [--yes] [--agent <list>] [--task <task>] [--mcp] [--expose <list>]
53
- tr start ["<task>"]
53
+ tr bootstrap [--yes] [--agent <list>] [--task <task>] [--mcp] [--expose <list>] [--packs <list>] [--json]
54
+ tr start ["<task>"] [--json]
54
55
  tr setup --global [--agent <list>] [--dry-run] [--check] [--undo] [--mcp]
55
56
  tr init [--force] [--no-import] [--profile <p>] [--adapters <list>] [--expose <list>]
56
57
  tr expose [agent|all] [--dry-run] [--check] [--undo] [--force]
57
- tr status
58
+ tr status [--json]
58
59
  tr diff
59
- tr doctor
60
+ tr doctor [--json]
60
61
  tr compile [--adapter <agents|claude|copilot|cursor>]
61
- tr context "<task>" # assemble the task-relevant harness slice
62
- tr run <tool> [--input k=v ...] [-y]
62
+ tr context "<task>" [--json] # assemble the task-relevant harness slice
63
+ tr run <tool> [--input k=v ...] [-y] [--json]
63
64
  tr install <source> [--kind skill|tool|rule|connection] [--path <p>] [--user]
64
65
  tr remember "<note>" [--type project|current-focus|handoff|pitfalls]
65
66
  tr memory read <type>
66
67
  tr memory append <type> "<note>"
67
- tr skills list | validate [--path <path>]
68
- tr skills inspect <path>
69
- tr tools list | detect | check
70
- tr tools add <name> --description "<text>" [--run "<cmd>"]
71
- tr tools create --from-command "<cmd>"
72
- tr connections list | check
73
- tr connections add <name> --provider <p> --command <cmd>
74
- tr packs list | inspect <pack> | validate <pack> | install <pack>
68
+ tr skills list [--json] | validate [--path <path>] [--json]
69
+ tr skills inspect <path> [--json]
70
+ tr tools list | detect | check [--json]
71
+ tr tools add <name> --description "<text>" [--run "<cmd>"] [--json]
72
+ tr tools create --from-command "<cmd>" [--json]
73
+ tr connections list | check [--json]
74
+ tr connections add <name> --provider <p> --command <cmd> [--allow <patterns>] [--deny <patterns>] [--json]
75
+ tr packs list | inspect <pack> | validate <pack> | install <pack> [--json]
75
76
  tr mcp # run the local MCP server (stdio)
76
- tr mcp check # verify Codex MCP config and required tools
77
- tr mcp setup [--write] # wire MCP into agents
77
+ tr mcp check [--json] # verify Codex MCP config and required tools
78
+ tr mcp setup [--write] [--json] # wire MCP into agents
78
79
  ```
79
80
 
80
81
  ## The harness (`.threadroot/`)
@@ -152,7 +153,8 @@ every Threadroot skill into provider directories.
152
153
  add-test, debug-failure, write-docs, conventional-commits.
153
154
  - **Starter tools:** wrapped from the repo's detected command surface (scripts, Make/just),
154
155
  auto-added to `tools.allow`.
155
- - **Profile presets:** node-cli, web, python, etc. (detected by the scanner).
156
+ - **Profile presets:** `nextjs`, `vite-react`, `fastapi`, `python-cli`, `node-cli`,
157
+ `dbt`, and `empty` (detected by the scanner or set with `--profile`).
156
158
  - **Adapters:** disabled by default to keep new repos local-only; use `tr expose` for
157
159
  skill-compatible providers or `tr compile --adapter <name>` for legacy instruction
158
160
  files.
@@ -202,6 +204,8 @@ tr connections add aws-dev \
202
204
  --profile dev \
203
205
  --risk high \
204
206
  --confirm \
207
+ --allow "sts get-caller-identity,s3 ls,logs tail" \
208
+ --deny "delete,terminate,iam" \
205
209
  --healthcheck "aws sts get-caller-identity --profile dev"
206
210
  tr connections check
207
211
  ```
@@ -253,6 +257,10 @@ Tools: `context`, `skills_list`, `skills_get`, `tools_list`, `tools_check`, `too
253
257
  `tools_create`, `tools_detect`, `connections_list`, `connections_check`, `memory_read`,
254
258
  `memory_append`, `status`, `doctor`.
255
259
 
260
+ MCP can run tools that are already safe under the harness policy. It cannot self-confirm
261
+ `confirm:true`, high-risk, untrusted, or connection-policy-blocked tools; agents should ask
262
+ the user to run `threadroot run <tool> --yes` after review.
263
+
256
264
  `tr mcp setup` also prints a copy/paste agent prompt that follows the real CLI flow:
257
265
  check availability, run `threadroot bootstrap --yes`, run `threadroot start "<task>"`,
258
266
  and ask before writing project-local MCP config.
@@ -274,6 +282,12 @@ pnpm test
274
282
  pnpm build
275
283
  ```
276
284
 
285
+ ## Website and cloud integration
286
+
287
+ The public CLI is the stable foundation for the private website/cloud repo. See
288
+ [INTEGRATION.md](./INTEGRATION.md) for the prompt-generator contract, JSON command
289
+ surface, future auth/sync shape, and cloud data model sketch.
290
+
277
291
  ## Publishing
278
292
 
279
293
  The npm package ships only `dist/`, `skills/`, `packs/`, and package metadata. Before
@@ -299,12 +313,13 @@ THREADROOT_ROOT="$(pwd)"
299
313
  TMP_REPO="$(mktemp -d /tmp/threadroot-smoke.XXXXXX)"
300
314
  rsync -a --exclude .git --exclude node_modules --exclude dist ./ "$TMP_REPO/"
301
315
  cd "$TMP_REPO"
302
- HOME="$TMP_REPO/home" node "$THREADROOT_ROOT/dist/index.js" bootstrap --yes --agent codex --mcp --no-import
303
- HOME="$TMP_REPO/home" node "$THREADROOT_ROOT/dist/index.js" mcp check
304
- HOME="$TMP_REPO/home" node "$THREADROOT_ROOT/dist/index.js" start "write tests"
316
+ HOME="$TMP_REPO/home" node "$THREADROOT_ROOT/dist/index.js" bootstrap --yes --agent codex --mcp --no-import --packs testing --json
317
+ HOME="$TMP_REPO/home" node "$THREADROOT_ROOT/dist/index.js" mcp check --json
318
+ HOME="$TMP_REPO/home" node "$THREADROOT_ROOT/dist/index.js" start "write tests" --json
305
319
  node "$THREADROOT_ROOT/dist/index.js" expose codex
306
320
  node "$THREADROOT_ROOT/dist/index.js" status
307
321
  node "$THREADROOT_ROOT/dist/index.js" context "write tests"
322
+ node "$THREADROOT_ROOT/dist/index.js" context "write tests" --json
308
323
  node "$THREADROOT_ROOT/dist/index.js" skills validate
309
324
  node "$THREADROOT_ROOT/dist/index.js" skills validate --path skills
310
325
  node "$THREADROOT_ROOT/dist/index.js" skills inspect skills/system-design
@@ -312,7 +327,7 @@ node "$THREADROOT_ROOT/dist/index.js" packs list
312
327
  node "$THREADROOT_ROOT/dist/index.js" packs inspect testing
313
328
  node "$THREADROOT_ROOT/dist/index.js" tools create --from-command "node --version" --description "Check Node.js"
314
329
  node "$THREADROOT_ROOT/dist/index.js" tools check
315
- node "$THREADROOT_ROOT/dist/index.js" connections add node-local --provider node --command node --risk low --healthcheck "node --version"
330
+ node "$THREADROOT_ROOT/dist/index.js" connections add node-local --provider node --command node --risk low --allow "--version" --deny "rm,delete" --healthcheck "node --version"
316
331
  node "$THREADROOT_ROOT/dist/index.js" connections check
317
332
  node "$THREADROOT_ROOT/dist/index.js" compile
318
333
  node "$THREADROOT_ROOT/dist/index.js" diff