threadctx 0.6.0 → 0.6.1
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/dist/threadctx.mjs +35 -5
- package/package.json +3 -3
package/dist/threadctx.mjs
CHANGED
|
@@ -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.6.
|
|
14742
|
+
var ENGINE_VERSION = "0.6.1";
|
|
14743
14743
|
var REGISTRY_VERSION = "2026.10.1";
|
|
14744
14744
|
|
|
14745
14745
|
// ../rules/dist/engine.js
|
|
@@ -16273,7 +16273,7 @@ function planFixes(fs, findings, kinds = ["safe"]) {
|
|
|
16273
16273
|
}
|
|
16274
16274
|
|
|
16275
16275
|
// src/init.ts
|
|
16276
|
-
var ACTION_PIN = { sha: "
|
|
16276
|
+
var ACTION_PIN = { sha: "97cbb2f34f392f4f18dd9d95cfba3c4c87b231de", tag: "v1.6.0" };
|
|
16277
16277
|
var CHECKOUT_PIN = { sha: "3d3c42e5aac5ba805825da76410c181273ba90b1", tag: "v7.0.1" };
|
|
16278
16278
|
var WORKFLOW_PATH = ".github/workflows/agent-context.yml";
|
|
16279
16279
|
function workflowYaml() {
|
|
@@ -16921,12 +16921,41 @@ function sessionStartText(root, result, entries, repo, tool = "claude-code") {
|
|
|
16921
16921
|
return `${lines.join("\n")}
|
|
16922
16922
|
`;
|
|
16923
16923
|
}
|
|
16924
|
+
function sessionStartBanner(result, entries, tool = "claude-code") {
|
|
16925
|
+
const t = result.tools.find((x) => x.id === tool);
|
|
16926
|
+
const open = result.findings.filter((f) => !f.suppressed);
|
|
16927
|
+
const loaded = new Set(t?.alwaysLoaded ?? []);
|
|
16928
|
+
const wasted = open.filter((f) => loaded.has(f.path)).reduce((n2, f) => n2 + (f.wasteTokens ?? 0), 0);
|
|
16929
|
+
const parts = [`threadctx \xB7 context ${result.grade} (${result.score}/100)`];
|
|
16930
|
+
if (t && t.alwaysLoaded.length) parts.push(`\u2248${fmt(t.alwaysTokenEstimate)} tokens loaded every session${wasted ? `, \u2248${fmt(wasted)} duplicated` : ""}`);
|
|
16931
|
+
const blockers = open.filter((f) => f.severity === "blocker").length;
|
|
16932
|
+
if (blockers) parts.push(`${blockers} blocker${blockers === 1 ? "" : "s"}: run npx threadctx scan`);
|
|
16933
|
+
if (entries.length) {
|
|
16934
|
+
const c = summary(entries);
|
|
16935
|
+
const flagged = (c.stale ?? 0) + (c.conflict ?? 0) + (c.unsafe ?? 0);
|
|
16936
|
+
parts.push(`memory ${entries.filter((e) => e.check.serve).length}/${entries.length} served${flagged ? `, ${flagged} flagged: /memory-review` : ""}`);
|
|
16937
|
+
} else {
|
|
16938
|
+
parts.push("memory empty");
|
|
16939
|
+
}
|
|
16940
|
+
return parts.join(" \xB7 ");
|
|
16941
|
+
}
|
|
16924
16942
|
function cmdSessionStart(flags, io) {
|
|
16925
16943
|
try {
|
|
16926
16944
|
const root = rootOf(io);
|
|
16927
16945
|
const result = scan(openRepo(root), { now: io.now() });
|
|
16928
16946
|
const s = store(io);
|
|
16929
|
-
|
|
16947
|
+
const tool = flags.tool ?? "claude-code";
|
|
16948
|
+
const entries = s.checked();
|
|
16949
|
+
const text = sessionStartText(root, result, entries, s.repo, tool);
|
|
16950
|
+
if (flags.format === "hook") {
|
|
16951
|
+
io.stdout(`${JSON.stringify({
|
|
16952
|
+
systemMessage: sessionStartBanner(result, entries, tool),
|
|
16953
|
+
hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: text }
|
|
16954
|
+
})}
|
|
16955
|
+
`);
|
|
16956
|
+
} else {
|
|
16957
|
+
io.stdout(text);
|
|
16958
|
+
}
|
|
16930
16959
|
} catch {
|
|
16931
16960
|
}
|
|
16932
16961
|
return 0;
|
|
@@ -17132,7 +17161,8 @@ Usage:
|
|
|
17132
17161
|
threadctx memory <list|check|add|renew|forget>
|
|
17133
17162
|
Checked memory: every entry is verified against the repository
|
|
17134
17163
|
before an agent sees it. 'threadctx memory help' for details
|
|
17135
|
-
threadctx session-start
|
|
17164
|
+
threadctx session-start [--format hook]
|
|
17165
|
+
Context grade, tokens loaded and memory health, for a SessionStart hook
|
|
17136
17166
|
threadctx audit --org <name> Grade every repository of a GitHub organisation or user, and find where
|
|
17137
17167
|
they disagree. Free: fleet grade and headline findings. With a licence:
|
|
17138
17168
|
full HTML report, CSV and JSON. Code never leaves your machine.
|
|
@@ -17244,7 +17274,7 @@ Run 'threadctx --help' for usage.`);
|
|
|
17244
17274
|
throw new UsageError(e.message);
|
|
17245
17275
|
}
|
|
17246
17276
|
case "session-start":
|
|
17247
|
-
return cmdSessionStart({ tool: v.tool }, io);
|
|
17277
|
+
return cmdSessionStart({ tool: v.tool, format: v.format }, io);
|
|
17248
17278
|
case "audit":
|
|
17249
17279
|
return cmdAudit(v, io, color);
|
|
17250
17280
|
case "license":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "threadctx",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"mcpName": "io.github.threadctx-dev/threadctx",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"diff": "^9.0.0",
|
|
59
59
|
"@threadctx/core": "0.1.0",
|
|
60
|
+
"@threadctx/discovery": "0.1.0",
|
|
60
61
|
"@threadctx/adapters": "0.1.0",
|
|
61
|
-
"@threadctx/report": "0.1.0",
|
|
62
62
|
"@threadctx/rules": "0.1.0",
|
|
63
|
-
"@threadctx/
|
|
63
|
+
"@threadctx/report": "0.1.0"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "tsc -b && node build.mjs"
|