threadctx 0.4.0 → 0.5.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 (2) hide show
  1. package/dist/threadctx.mjs +51 -10
  2. package/package.json +23 -7
@@ -14739,7 +14739,7 @@ function applySuppressions(findings, inline, config, now, diagnostics) {
14739
14739
  }
14740
14740
 
14741
14741
  // ../rules/dist/version.js
14742
- var ENGINE_VERSION = "0.4.0";
14742
+ var ENGINE_VERSION = "0.5.0";
14743
14743
  var REGISTRY_VERSION = "2026.10.1";
14744
14744
 
14745
14745
  // ../rules/dist/engine.js
@@ -14910,7 +14910,7 @@ function scan(fs, opts = {}) {
14910
14910
  findings: unique,
14911
14911
  diagnostics,
14912
14912
  artifacts: artifacts.map((a) => ({ path: a.artifact.path, tool: a.artifact.tool, kind: a.artifact.kind, tokenEstimate: a.artifact.tokenEstimate, contentHash: a.artifact.contentHash, origin: a.artifact.origin })),
14913
- tools: ADAPTERS.map((a, i) => ({ id: a.id, label: a.label, status: a.status, verified: a.verifiedAgainst.date, alwaysTokenEstimate: state.rootContexts[i].alwaysTokenEstimate, layers: state.rootContexts[i].layers.length })),
14913
+ tools: ADAPTERS.map((a, i) => ({ id: a.id, label: a.label, status: a.status, verified: a.verifiedAgainst.date, alwaysTokenEstimate: state.rootContexts[i].alwaysTokenEstimate, layers: state.rootContexts[i].layers.length, alwaysLoaded: [...new Set(state.rootContexts[i].layers.filter((l) => l.loading === "always").map((l) => l.path))] })),
14914
14914
  mcpServers: state.mcp.map((s) => ({ client: s.client, name: s.name, source: s.sourcePath, transport: s.transport })),
14915
14915
  rules: [...metas.values()].filter((m) => checks.some((c) => c.meta.id === m.id)),
14916
14916
  facts: statedFacts(ctx)
@@ -15477,6 +15477,27 @@ function painter(color) {
15477
15477
  return { red: wrap("31"), yellow: wrap("33"), blue: wrap("34"), green: wrap("32"), dim: wrap("2"), bold: wrap("1"), cyan: wrap("36") };
15478
15478
  }
15479
15479
  var GRADE_COLOR = { A: "green", B: "green", C: "yellow", D: "yellow", F: "red" };
15480
+ var SHORT_LABEL = { "agents-md": "Codex / AGENTS.md" };
15481
+ function renderAgentMap(result, p) {
15482
+ const tools = result.tools;
15483
+ if (!tools.some((t) => t.layers > 0))
15484
+ return [];
15485
+ const label2 = (t) => SHORT_LABEL[t.id] ?? t.label.split(" (")[0];
15486
+ const width = Math.max(...tools.map((t) => label2(t).length));
15487
+ const sharedExists = result.artifacts.some((a) => a.path === "AGENTS.md");
15488
+ const lines = ["", p.bold("What each agent loads at session start")];
15489
+ for (const t of tools) {
15490
+ const files = t.alwaysLoaded ?? [];
15491
+ const name = label2(t).padEnd(width);
15492
+ if (!files.length) {
15493
+ lines.push(` ${name} ${p.dim("nothing: this agent starts with no repository instructions")}`);
15494
+ continue;
15495
+ }
15496
+ const missesShared = sharedExists && t.id !== "agents-md" && !files.includes("AGENTS.md");
15497
+ lines.push(` ${name} ${files.join(" \u2192 ")} ${p.dim(`\u2248${t.alwaysTokenEstimate.toLocaleString("en-US")} tokens`)}` + (missesShared ? ` ${p.yellow("does not see AGENTS.md")}` : ""));
15498
+ }
15499
+ return lines;
15500
+ }
15480
15501
  function renderText(result, opts) {
15481
15502
  const p = painter(opts.color);
15482
15503
  const out = [];
@@ -15502,9 +15523,10 @@ function renderText(result, opts) {
15502
15523
  const fixable = open.filter((f) => f.fix?.kind === "safe").length;
15503
15524
  if (fixable)
15504
15525
  out.push(p.dim(`${fixable} finding${fixable === 1 ? "" : "s"} can be fixed automatically: threadctx fix`));
15505
- const tools = result.tools.filter((t) => t.layers > 0);
15506
- if (tools.length) {
15507
- out.push(p.dim(`Always-loaded context (estimated tokens): ${tools.map((t) => `${t.label.split(" (")[0]} \u2248${t.alwaysTokenEstimate.toLocaleString("en-US")}`).join(" \xB7 ")}`));
15526
+ out.push(...renderAgentMap(result, p));
15527
+ if (opts.next?.length) {
15528
+ const width = Math.max(...opts.next.map(([cmd]) => cmd.length));
15529
+ out.push("", p.bold("Next"), ...opts.next.map(([cmd, why]) => ` ${p.cyan(cmd.padEnd(width))} ${p.dim(why)}`));
15508
15530
  }
15509
15531
  for (const d of result.diagnostics) {
15510
15532
  const tag = d.level === "error" ? p.red("error") : d.level === "warning" ? p.yellow("note") : p.dim("note");
@@ -16164,7 +16186,7 @@ function planFixes(fs, findings, kinds = ["safe"]) {
16164
16186
  }
16165
16187
 
16166
16188
  // src/init.ts
16167
- var ACTION_PIN = { sha: "380c9b3cf45a7fd3dd086cdd13dd3c8c075ff811", tag: "v1.3.0" };
16189
+ var ACTION_PIN = { sha: "0fcf8348d004ae084b5e557dddd381da25a6db6a", tag: "v1.4.1" };
16168
16190
  var CHECKOUT_PIN = { sha: "3d3c42e5aac5ba805825da76410c181273ba90b1", tag: "v7.0.1" };
16169
16191
  var WORKFLOW_PATH = ".github/workflows/agent-context.yml";
16170
16192
  function workflowYaml() {
@@ -16350,8 +16372,11 @@ function summarize(result) {
16350
16372
  const lines = [`Grade ${result.grade} (${result.score}/100): ${result.counts.blocker} blockers, ${result.counts.warning} warnings, ${result.counts.info} info.`];
16351
16373
  for (const f of open.slice(0, 25)) lines.push(`- ${f.severity} ${f.ruleId} ${f.path || "."}${f.line ? `:${f.line}` : ""}: ${f.message}${f.fix?.kind === "safe" ? " (fixable: threadctx fix)" : ""}`);
16352
16374
  if (open.length > 25) lines.push(`\u2026and ${open.length - 25} more.`);
16353
- const loaded = result.tools.filter((t) => t.layers > 0).map((t) => `${t.label.split(" (")[0]} \u2248${t.alwaysTokenEstimate} tokens`);
16354
- if (loaded.length) lines.push(`Always-loaded context (estimates): ${loaded.join(", ")}.`);
16375
+ const loaded = result.tools.filter((t) => t.layers > 0);
16376
+ if (loaded.length) {
16377
+ lines.push("Loaded at session start (estimates):");
16378
+ for (const t of result.tools) lines.push(`- ${t.label.split(" (")[0]}: ${t.alwaysLoaded.length ? `${t.alwaysLoaded.join(" \u2192 ")} (\u2248${t.alwaysTokenEstimate} tokens)` : "nothing"}`);
16379
+ }
16355
16380
  return lines.join("\n");
16356
16381
  }
16357
16382
  function callTool(name, args, root) {
@@ -16725,7 +16750,7 @@ async function main(argv, io) {
16725
16750
  return 2;
16726
16751
  }
16727
16752
  io.stderr(`threadctx: unexpected error: ${e.stack ?? e}
16728
- Please report this to hello@threadctx.dev
16753
+ Please report it at https://github.com/threadctx-dev/threadctx-cli/issues
16729
16754
  `);
16730
16755
  return 2;
16731
16756
  }
@@ -16832,7 +16857,7 @@ async function cmdScan(pathArg, v, io, color) {
16832
16857
  view = repo;
16833
16858
  result = doScan(repo, v, io);
16834
16859
  }
16835
- const out = format === "json" ? renderJson(result) : format === "sarif" ? renderSarif(result) : format === "md" ? renderMarkdown(result) : renderText(result, { color: v.output ? false : color, verbose: Boolean(v.verbose) });
16860
+ const out = format === "json" ? renderJson(result) : format === "sarif" ? renderSarif(result) : format === "md" ? renderMarkdown(result) : renderText(result, { color: v.output ? false : color, verbose: Boolean(v.verbose), next: !v.output && !remoteLabel ? nextSteps(result, v, io) : void 0 });
16836
16861
  if (v.output) {
16837
16862
  const dest = resolve4(io.cwd, v.output);
16838
16863
  mkdirSync3(dirname2(dest), { recursive: true });
@@ -17170,6 +17195,22 @@ function cmdPackValidate(file, io) {
17170
17195
  `);
17171
17196
  return 0;
17172
17197
  }
17198
+ function nextSteps(result, v, io) {
17199
+ if (!io.isTTY || io.env.CI || io.env.THREADCTX_NO_UPSELL || io.env.THREADCTX_NO_HINTS) return void 0;
17200
+ const open = result.findings.filter((f) => !f.suppressed);
17201
+ const out = [];
17202
+ const hidden = v.verbose ? [] : open.filter((f) => f.severity === "info");
17203
+ if (hidden.length) {
17204
+ const byRule = /* @__PURE__ */ new Map();
17205
+ for (const f of hidden) byRule.set(f.ruleId, (byRule.get(f.ruleId) ?? 0) + 1);
17206
+ const top = [...byRule].sort((a, b) => b[1] - a[1]).slice(0, 2).map(([id, n2]) => `${RULES.find((r) => r.id === id)?.title ?? id}${n2 > 1 ? ` (${n2})` : ""}`);
17207
+ out.push(["threadctx scan --verbose", `${hidden.length} hidden info finding${hidden.length === 1 ? "" : "s"}: ${top.join("; ")}`]);
17208
+ }
17209
+ if (result.tools.some((t) => t.layers > 0)) out.push(["threadctx explain <file>", "which files each agent loads for that file, in order, with token estimates"]);
17210
+ const fixable = open.filter((f) => f.fix?.kind === "safe").length;
17211
+ if (fixable) out.push(["threadctx fix --pr", `${fixable} safe fix${fixable === 1 ? "" : "es"} in one pull request`]);
17212
+ return out.length ? out : void 0;
17213
+ }
17173
17214
  var UPGRADE_URL = "https://threadctx.dev/pricing";
17174
17215
  function maybeUpgradeLine(result, io, remote) {
17175
17216
  if (!UPGRADE_URL || !io.isTTY || io.env.CI || io.env.THREADCTX_NO_UPSELL) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "threadctx",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "mcpName": "io.github.threadctx-dev/threadctx",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -18,8 +18,16 @@
18
18
  "threadctx": "dist/threadctx.mjs",
19
19
  "ctx": "dist/threadctx.mjs"
20
20
  },
21
- "description": "Your coding agents' instructions are stale and copied across tools. See what each agent is told, grade it, and fix it. Zero dependencies.",
21
+ "description": "See exactly what each coding agent is told. Maps which AGENTS.md, CLAUDE.md, Cursor, Copilot and Gemini files every agent loads, flags stale paths, duplication and unpinned MCP servers, and fixes the mechanical ones. Offline, zero dependencies.",
22
22
  "homepage": "https://threadctx.dev",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/threadctx-dev/threadctx-cli.git",
26
+ "directory": "packages/cli"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/threadctx-dev/threadctx-cli/issues"
30
+ },
23
31
  "keywords": [
24
32
  "agents",
25
33
  "ai",
@@ -31,7 +39,15 @@
31
39
  "context",
32
40
  "lint",
33
41
  "mcp",
34
- "sarif"
42
+ "sarif",
43
+ "claude-md",
44
+ "cursor-rules",
45
+ "copilot-instructions",
46
+ "codex",
47
+ "linter",
48
+ "ai-agents",
49
+ "mcp-server",
50
+ "context-engineering"
35
51
  ],
36
52
  "author": "threadctx",
37
53
  "publishConfig": {
@@ -40,11 +56,11 @@
40
56
  "dependencies": {},
41
57
  "devDependencies": {
42
58
  "diff": "^9.0.0",
43
- "@threadctx/core": "0.1.0",
44
- "@threadctx/rules": "0.1.0",
45
- "@threadctx/discovery": "0.1.0",
46
59
  "@threadctx/report": "0.1.0",
47
- "@threadctx/adapters": "0.1.0"
60
+ "@threadctx/rules": "0.1.0",
61
+ "@threadctx/adapters": "0.1.0",
62
+ "@threadctx/core": "0.1.0",
63
+ "@threadctx/discovery": "0.1.0"
48
64
  },
49
65
  "scripts": {
50
66
  "build": "tsc -b && node build.mjs"