threadroot 0.1.3 → 0.1.4

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,12 @@ 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.4 - Stable npx MCP config
8
+
9
+ ### Fixed
10
+
11
+ - `bootstrap --mcp` and `setup --global --mcp` now detect npm's `_npx` cache path and write a stable pinned `npx --yes threadroot@<version> mcp` Codex MCP command instead of pointing Codex at a transient npm cache file.
12
+
7
13
  ## 0.1.3 - Verified Codex MCP setup
8
14
 
9
15
  ### Added
package/README.md CHANGED
@@ -109,10 +109,12 @@ tr start "current task"
109
109
 
110
110
  Without `--yes`, `tr bootstrap` prints a dry-run plan. With `--yes`, it installs global
111
111
  agent bootstrap skills, initializes `.threadroot/` if needed, runs doctor, and prints
112
- task context. With `--mcp`, it also writes Codex MCP config using the current CLI entry
113
- (`node /path/dist/index.js mcp` when Threadroot can resolve the package path, or
114
- `threadroot mcp` as a fallback) and verifies the stdio server handshake. It does not write
115
- provider-specific project files unless you pass `--expose`.
112
+ task context. With `--mcp`, it also writes Codex MCP config using a durable command for
113
+ the current launch path. `npx` runs write a pinned `npx --yes threadroot@<version> mcp`
114
+ command instead of a transient npm cache path; local dev runs use
115
+ `node /path/dist/index.js mcp`; unknown launch paths fall back to `threadroot mcp`. The
116
+ setup verifies the stdio server handshake. It does not write provider-specific project
117
+ files unless you pass `--expose`.
116
118
 
117
119
  Global setup installs a tiny `threadroot` skill into supported agent user-skill
118
120
  directories so agents know to call `threadroot bootstrap --yes` when setup is missing
package/dist/index.js CHANGED
@@ -2399,6 +2399,11 @@ import { access, mkdtemp, readFile as readFile8, rm as rm2, writeFile as writeFi
2399
2399
  import { constants, realpathSync } from "fs";
2400
2400
  import { homedir as homedir2, tmpdir } from "os";
2401
2401
  import path14 from "path";
2402
+
2403
+ // src/core/version.ts
2404
+ var THREADROOT_VERSION = "0.1.4";
2405
+
2406
+ // src/core/mcp-check.ts
2402
2407
  var REQUIRED_MCP_TOOLS = [
2403
2408
  "context",
2404
2409
  "skills_list",
@@ -2419,14 +2424,19 @@ function codexConfigPath2(home = homedir2()) {
2419
2424
  return path14.join(home, ".codex", "config.toml");
2420
2425
  }
2421
2426
  function mcpEntryForCurrentProcess() {
2422
- const scriptPath = currentScriptPath();
2427
+ return mcpEntryForScriptPath(process.argv[1]);
2428
+ }
2429
+ function mcpEntryForScriptPath(rawScriptPath) {
2430
+ const scriptPath = currentScriptPath(rawScriptPath);
2431
+ if (scriptPath && isNpxPackagePath(scriptPath)) {
2432
+ return { command: "npx", args: ["--yes", `threadroot@${THREADROOT_VERSION}`, "mcp"] };
2433
+ }
2423
2434
  if (scriptPath && path14.basename(scriptPath) === "index.js" && scriptPath.includes(`${path14.sep}dist${path14.sep}`)) {
2424
2435
  return { command: process.execPath, args: [scriptPath, "mcp"] };
2425
2436
  }
2426
2437
  return { command: "threadroot", args: ["mcp"] };
2427
2438
  }
2428
- function currentScriptPath() {
2429
- const scriptPath = process.argv[1];
2439
+ function currentScriptPath(scriptPath) {
2430
2440
  if (!scriptPath) {
2431
2441
  return void 0;
2432
2442
  }
@@ -2436,6 +2446,10 @@ function currentScriptPath() {
2436
2446
  return scriptPath;
2437
2447
  }
2438
2448
  }
2449
+ function isNpxPackagePath(scriptPath) {
2450
+ const normalized = scriptPath.split(path14.sep).join("/");
2451
+ return normalized.includes("/.npm/_npx/") && normalized.includes("/node_modules/threadroot/");
2452
+ }
2439
2453
  async function readCodexThreadrootMcpEntry(home = homedir2()) {
2440
2454
  let raw;
2441
2455
  try {
@@ -2635,7 +2649,7 @@ function runMcpHandshake(entry, repoRoot, timeoutMs) {
2635
2649
  params: {
2636
2650
  protocolVersion: "2024-11-05",
2637
2651
  capabilities: {},
2638
- clientInfo: { name: "threadroot-check", version: "0.1.3" }
2652
+ clientInfo: { name: "threadroot-check", version: THREADROOT_VERSION }
2639
2653
  }
2640
2654
  })}
2641
2655
  `
@@ -2658,7 +2672,7 @@ async function runOneShotMcpHandshake(entry, repoRoot, timeoutMs) {
2658
2672
  params: {
2659
2673
  protocolVersion: "2024-11-05",
2660
2674
  capabilities: {},
2661
- clientInfo: { name: "threadroot-check", version: "0.1.3" }
2675
+ clientInfo: { name: "threadroot-check", version: THREADROOT_VERSION }
2662
2676
  }
2663
2677
  }),
2664
2678
  JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }),
@@ -4569,7 +4583,7 @@ async function handleMessage(repoRoot, request) {
4569
4583
  if (request.method === "initialize") {
4570
4584
  return resultResponse(request, {
4571
4585
  protocolVersion: "2024-11-05",
4572
- serverInfo: { name: "threadroot", version: "0.1.3" },
4586
+ serverInfo: { name: "threadroot", version: THREADROOT_VERSION },
4573
4587
  capabilities: { tools: {} },
4574
4588
  instructions: "Threadroot exposes the repository's AI agent harness. Call `context` before broad coding work, `doctor` for health and trust checks, inspect skills/tools before risky actions, and use `memory_append` for durable handoffs."
4575
4589
  });
@@ -5541,7 +5555,7 @@ async function runConnectionsCheck(repoRoot) {
5541
5555
  // src/cli.ts
5542
5556
  function createProgram(repoRoot = process.cwd()) {
5543
5557
  const program = new Command();
5544
- program.name("threadroot").description("Git for your AI agent harness: one command to bootstrap, one .threadroot source.").version("0.1.3");
5558
+ program.name("threadroot").description("Git for your AI agent harness: one command to bootstrap, one .threadroot source.").version(THREADROOT_VERSION);
5545
5559
  program.command("bootstrap").description("Plan or apply first-run Threadroot setup for this machine and repository.").option("-y, --yes", "Apply the setup plan. Without --yes, bootstrap prints a dry-run plan.").option("--dry-run", "Print the setup plan without writing files.").option("--agent <list>", "Provider(s): codex,claude,cursor,copilot,gemini,windsurf,antigravity,opencode,all.").option("--task <task>", "Task used for the initial context slice.").option("--mcp", "Also add Threadroot MCP to Codex global config when Codex is selected.").option("--expose <list>", "Also write project provider skill shims: codex,claude,cursor,copilot,gemini,windsurf,antigravity,opencode,all.").option("--no-global", "Skip one-time machine-level agent setup.").option("--no-init", "Skip project harness initialization.").option("--no-import", "Skip importing existing vendor files during init.").option("--profile <profile>", "Override the detected project profile during init.").action((options) => runBootstrap(repoRoot, options));
5546
5560
  program.command("start").argument("[task]", "Task to prepare context for.").option("--task <task>", "Task to prepare context for.").description("Start a focused Threadroot agent session: doctor, status, context, and command map.").action((task, options) => runStart(repoRoot, task, options));
5547
5561
  program.command("init").description("Scaffold a local-only Threadroot harness and import existing vendor files once.").option("--force", "Re-initialize over an existing harness.").option("--no-import", "Skip importing existing vendor files (blank-slate init).").option("--profile <profile>", "Override the detected project profile.").option("--adapters <list>", "Comma-separated adapters: agents,claude,copilot,cursor.").option("--expose <list>", "Comma-separated provider skill shims to write: codex,claude,cursor,copilot,gemini,windsurf,antigravity,opencode,all.").action((options) => runInit(repoRoot, options));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "threadroot",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Git for your AI agent harness: keep skills, tools, memory, rules, and agent setup in one local-first .threadroot directory.",
5
5
  "license": "MIT",
6
6
  "type": "module",