threadctx 0.3.0 → 0.4.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.
- package/dist/threadctx.mjs +32 -8
- package/package.json +4 -4
package/dist/threadctx.mjs
CHANGED
|
@@ -10852,6 +10852,7 @@ var LICENSE_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
|
|
10852
10852
|
MCowBQYDK2VwAyEAjxD7a4Ug5yVw5+Ra8bY1IZVLobxeiCS9dtrVwekYjqw=
|
|
10853
10853
|
-----END PUBLIC KEY-----
|
|
10854
10854
|
`;
|
|
10855
|
+
var LICENSE_PLANS = ["audit", "team", "business", "agency"];
|
|
10855
10856
|
var PREFIX = "tctx1";
|
|
10856
10857
|
function verifyLicense(key, opts = {}) {
|
|
10857
10858
|
const parts = key.trim().split(".");
|
|
@@ -10866,11 +10867,18 @@ function verifyLicense(key, opts = {}) {
|
|
|
10866
10867
|
} catch {
|
|
10867
10868
|
return { ok: false, reason: "malformed" };
|
|
10868
10869
|
}
|
|
10869
|
-
if (claims.v !== 1 || typeof claims.exp !== "number" || typeof claims.org !== "string" || !
|
|
10870
|
+
if (claims.v !== 1 || typeof claims.exp !== "number" || typeof claims.org !== "string" || !LICENSE_PLANS.includes(claims.plan))
|
|
10871
|
+
return { ok: false, reason: "unsupported" };
|
|
10872
|
+
if (claims.agentRepoLimit !== void 0 && (!Number.isInteger(claims.agentRepoLimit) || claims.agentRepoLimit < 1))
|
|
10873
|
+
return { ok: false, reason: "unsupported" };
|
|
10874
|
+
if (claims.orgs !== void 0 && (!Array.isArray(claims.orgs) || claims.orgs.some((o) => typeof o !== "string")))
|
|
10870
10875
|
return { ok: false, reason: "unsupported" };
|
|
10871
10876
|
if (claims.exp * 1e3 < (opts.now ?? /* @__PURE__ */ new Date()).getTime())
|
|
10872
10877
|
return { ok: false, reason: "expired" };
|
|
10873
|
-
|
|
10878
|
+
const want = opts.org?.trim().toLowerCase();
|
|
10879
|
+
if (want && claims.orgs?.length && !claims.orgs.includes(want))
|
|
10880
|
+
return { ok: false, reason: "wrong-org" };
|
|
10881
|
+
if (want && !claims.orgs?.length && claims.org !== "*" && claims.org !== want)
|
|
10874
10882
|
return { ok: false, reason: "wrong-org" };
|
|
10875
10883
|
return { ok: true, claims };
|
|
10876
10884
|
}
|
|
@@ -14576,7 +14584,7 @@ var S002 = {
|
|
|
14576
14584
|
report({
|
|
14577
14585
|
path: first.artifact.path,
|
|
14578
14586
|
line: 1,
|
|
14579
|
-
message: hasAgents ? `${tools.length} tools have their own context files (${names}), and ${isolatedNames.join(" and ")} ${isolatedNames.length === 1 ? "does" : "do"} not read AGENTS.md. Their copies
|
|
14587
|
+
message: hasAgents ? `${tools.length} tools have their own context files (${names}), and ${isolatedNames.join(" and ")} ${isolatedNames.length === 1 ? "does" : "do"} not read AGENTS.md. Their copies can drift apart.` : `${tools.length} tools have their own context files (${names}) with no shared source. Their copies can drift apart.`,
|
|
14580
14588
|
evidence: isolated.map((t) => t.files.map((f) => f.artifact.path).join(", ")).join("; "),
|
|
14581
14589
|
fingerprintKey: names,
|
|
14582
14590
|
fix: hasAgents && isolated.some((t) => t.tool === "claude-code") && ctx.catalog.get("CLAUDE.md") ? { kind: "suggested", description: "Import AGENTS.md from CLAUDE.md so Claude Code reads the shared instructions.", edits: [{ path: "CLAUDE.md", startLine: 1, endLine: 0, replacement: "@AGENTS.md\n" }] } : void 0
|
|
@@ -14731,7 +14739,7 @@ function applySuppressions(findings, inline, config, now, diagnostics) {
|
|
|
14731
14739
|
}
|
|
14732
14740
|
|
|
14733
14741
|
// ../rules/dist/version.js
|
|
14734
|
-
var ENGINE_VERSION = "0.
|
|
14742
|
+
var ENGINE_VERSION = "0.4.0";
|
|
14735
14743
|
var REGISTRY_VERSION = "2026.10.1";
|
|
14736
14744
|
|
|
14737
14745
|
// ../rules/dist/engine.js
|
|
@@ -15536,6 +15544,10 @@ function renderMarkdown(result, opts = {}) {
|
|
|
15536
15544
|
out.push(`- ${t.label}: \u2248${t.alwaysTokenEstimate.toLocaleString("en-US")} tokens across ${t.layers} file${t.layers === 1 ? "" : "s"}`);
|
|
15537
15545
|
out.push("", "</details>");
|
|
15538
15546
|
}
|
|
15547
|
+
if (opts.orgAuditOwner !== void 0) {
|
|
15548
|
+
const owner = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/.test(opts.orgAuditOwner) ? opts.orgAuditOwner : "<your-org>";
|
|
15549
|
+
out.push("", `See every repository in your organisation: \`npx threadctx audit --org ${owner}\` (free summary).`);
|
|
15550
|
+
}
|
|
15539
15551
|
out.push("", `<sub>[threadctx](https://threadctx.dev) ${result.engine.version}${opts.footerUrl ? ` \xB7 [history and badge](${opts.footerUrl})` : ""} \xB7 [how grades work](https://threadctx.dev/methodology)</sub>`);
|
|
15540
15552
|
return `${out.join("\n")}
|
|
15541
15553
|
`;
|
|
@@ -16152,7 +16164,7 @@ function planFixes(fs, findings, kinds = ["safe"]) {
|
|
|
16152
16164
|
}
|
|
16153
16165
|
|
|
16154
16166
|
// src/init.ts
|
|
16155
|
-
var ACTION_PIN = { sha: "
|
|
16167
|
+
var ACTION_PIN = { sha: "380c9b3cf45a7fd3dd086cdd13dd3c8c075ff811", tag: "v1.3.0" };
|
|
16156
16168
|
var CHECKOUT_PIN = { sha: "3d3c42e5aac5ba805825da76410c181273ba90b1", tag: "v7.0.1" };
|
|
16157
16169
|
var WORKFLOW_PATH = ".github/workflows/agent-context.yml";
|
|
16158
16170
|
function workflowYaml() {
|
|
@@ -16485,7 +16497,9 @@ function findLicense(arg, io) {
|
|
|
16485
16497
|
}
|
|
16486
16498
|
function describeLicense(claims) {
|
|
16487
16499
|
const days = Math.max(0, Math.ceil((claims.exp * 1e3 - Date.now()) / 864e5));
|
|
16488
|
-
|
|
16500
|
+
const who = claims.orgs?.length ? claims.orgs.join(", ") : claims.org === "*" ? "any organisation" : claims.org;
|
|
16501
|
+
const limit = claims.agentRepoLimit ? `, up to ${claims.agentRepoLimit} agent repositories` : "";
|
|
16502
|
+
return `${claims.plan} licence for ${who}${limit}, ${days} day${days === 1 ? "" : "s"} left (id ${claims.id})`;
|
|
16489
16503
|
}
|
|
16490
16504
|
async function runAudit(o, io) {
|
|
16491
16505
|
if (!ORG.test(o.org)) throw new AuditUsageError(`'${o.org}' is not a valid GitHub organisation or user name`);
|
|
@@ -16548,6 +16562,15 @@ async function runAudit(o, io) {
|
|
|
16548
16562
|
summary.trend = fleetTrend(previous, summary);
|
|
16549
16563
|
}
|
|
16550
16564
|
const evidence = evidencePack(summary, repos);
|
|
16565
|
+
const agentRepos = summary.repos.withContext;
|
|
16566
|
+
if (claims?.agentRepoLimit && agentRepos > claims.agentRepoLimit) {
|
|
16567
|
+
io.stderr(`
|
|
16568
|
+
This organisation has ${agentRepos} agent repositories; your ${claims.plan} licence covers up to ${claims.agentRepoLimit}.
|
|
16569
|
+
Showing the free summary. Upgrade for the full report: https://threadctx.dev/pricing?org=${encodeURIComponent(o.org)}&repos=${agentRepos}
|
|
16570
|
+
|
|
16571
|
+
`);
|
|
16572
|
+
claims = void 0;
|
|
16573
|
+
}
|
|
16551
16574
|
const files = [];
|
|
16552
16575
|
if (claims) {
|
|
16553
16576
|
const dir = resolve3(io.cwd, o.outDir ?? `threadctx-audit-${o.org}`);
|
|
@@ -16702,7 +16725,7 @@ async function main(argv, io) {
|
|
|
16702
16725
|
return 2;
|
|
16703
16726
|
}
|
|
16704
16727
|
io.stderr(`threadctx: unexpected error: ${e.stack ?? e}
|
|
16705
|
-
Please report this
|
|
16728
|
+
Please report this to hello@threadctx.dev
|
|
16706
16729
|
`);
|
|
16707
16730
|
return 2;
|
|
16708
16731
|
}
|
|
@@ -16854,7 +16877,8 @@ function cmdCompare(baseFile, headFile, v, io) {
|
|
|
16854
16877
|
if (format === "json") out = `${JSON.stringify({ base: c.base, head: c.head, added: c.added, fixed: c.fixed, existing: c.existing }, null, 2)}
|
|
16855
16878
|
`;
|
|
16856
16879
|
else if (format === "md") {
|
|
16857
|
-
const
|
|
16880
|
+
const owner = io.env.GITHUB_REPOSITORY_OWNER ?? io.env.GITHUB_REPOSITORY?.split("/")[0] ?? "";
|
|
16881
|
+
const md = renderMarkdown(head, { baseline: { grade: base.grade, score: base.score }, newFingerprints: new Set(c.added.map((f) => f.fingerprint)), orgAuditOwner: owner });
|
|
16858
16882
|
out = c.fixed.length ? md.replace("\n<sub>", `
|
|
16859
16883
|
\u2705 **${c.fixed.length} fixed** by this change.
|
|
16860
16884
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "threadctx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"mcpName": "io.github.threadctx-dev/threadctx",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"dependencies": {},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"diff": "^9.0.0",
|
|
43
|
-
"@threadctx/adapters": "0.1.0",
|
|
44
|
-
"@threadctx/discovery": "0.1.0",
|
|
45
43
|
"@threadctx/core": "0.1.0",
|
|
46
44
|
"@threadctx/rules": "0.1.0",
|
|
47
|
-
"@threadctx/
|
|
45
|
+
"@threadctx/discovery": "0.1.0",
|
|
46
|
+
"@threadctx/report": "0.1.0",
|
|
47
|
+
"@threadctx/adapters": "0.1.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsc -b && node build.mjs"
|