mason-context 0.16.2 → 0.16.3
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 +9 -0
- package/README.md +13 -9
- package/dist/mason-audit.js +86 -66
- package/dist/mason-audit.js.map +1 -1
- package/dist/mason-auto.js +944 -771
- package/dist/mason-auto.js.map +1 -1
- package/dist/mason-drift.js +13 -0
- package/dist/mason-drift.js.map +1 -1
- package/dist/mason-hook.js +13 -0
- package/dist/mason-hook.js.map +1 -1
- package/dist/mason-mcp.js +1364 -1184
- package/dist/mason-mcp.js.map +1 -1
- package/dist/mason-review.js +62 -49
- package/dist/mason-review.js.map +1 -1
- package/dist/mason.js +1009 -836
- package/dist/mason.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.16.3 — 2026-09-09
|
|
4
|
+
|
|
5
|
+
- Coordinate overlapping hooks without holding the shared state lock during audit analysis. Reuse analysis for identical inputs, let changed inputs proceed independently, and revalidate before publishing results so older work cannot overwrite newer evidence.
|
|
6
|
+
- Retain independent execution receipts during parallel calls. Report repeated, durably recorded failures once per session until recovery; keep failures without receipts visible and preserve pre-edit evidence for shell and unknown tools.
|
|
7
|
+
- Accept decision bodies up to 2,500 characters, with a warning above the recommended 1,500. Preserve the full body, report precise validation limits, and shorten generated IDs at word boundaries where possible.
|
|
8
|
+
- Cover slow checks, overlapping CLI processes, failure recovery, and changing inputs with concurrency regressions. Simplify README badges for consistent rendering.
|
|
9
|
+
|
|
10
|
+
Run `mason upgrade` for standalone installations, then restart running assistants. Existing PATH-based project integrations do not need setup again for this release.
|
|
11
|
+
|
|
3
12
|
## 0.16.2 — 2026-09-09
|
|
4
13
|
|
|
5
14
|
- Guard generated hooks when Mason is absent, and keep a checkout without local host setup quiet. Preserve active failure diagnostics and strict MCP startup; setup/status/teardown recognize the generated guard variants without project wrapper scripts.
|
package/README.md
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# Mason
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
[](https://github.com/adrianczuczka/mason/actions/workflows/ci.yml)
|
|
5
|
-
[](https://www.npmjs.com/package/mason-context)
|
|
6
|
-
[](https://github.com/adrianczuczka/mason/blob/main/LICENSE)
|
|
7
|
-
[](https://github.com/adrianczuczka/mason/issues)
|
|
5
|
+
### Your agents are creating tech debt. Mason helps you prevent it.
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
**Remember why decisions were made · Catch outdated guidance · Find what else needs updating**
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
[](https://www.npmjs.com/package/mason-context)
|
|
10
|
+
[](https://github.com/adrianczuczka/mason/actions/workflows/ci.yml)
|
|
11
|
+
[](https://www.npmjs.com/package/mason-context)
|
|
12
|
+
[](https://github.com/adrianczuczka/mason/blob/main/LICENSE)
|
|
12
13
|
|
|
13
|
-
Works
|
|
14
|
+
[](https://github.com/adrianczuczka/mason/blob/main/docs/setup.md)
|
|
15
|
+
[](https://github.com/adrianczuczka/mason/blob/main/docs/setup.md)
|
|
16
|
+
[](https://github.com/adrianczuczka/mason/blob/main/docs/setup.md#other-clients)
|
|
17
|
+
[](https://github.com/adrianczuczka/mason/blob/main/docs/distribution.md)
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
</div>
|
|
16
20
|
|
|
17
21
|
## Get started
|
|
18
22
|
|
package/dist/mason-audit.js
CHANGED
|
@@ -1337,6 +1337,7 @@ import path14 from "path";
|
|
|
1337
1337
|
import fs8 from "fs/promises";
|
|
1338
1338
|
import path13 from "path";
|
|
1339
1339
|
import { createHash } from "crypto";
|
|
1340
|
+
import { z as z3 } from "zod";
|
|
1340
1341
|
|
|
1341
1342
|
// src/context/lexical.ts
|
|
1342
1343
|
import path12 from "path";
|
|
@@ -1479,6 +1480,18 @@ function decisionProvenance(record, freshness = "unknown") {
|
|
|
1479
1480
|
}
|
|
1480
1481
|
|
|
1481
1482
|
// src/decisions/decisions.ts
|
|
1483
|
+
var TITLE_MAX_CHARS = 80;
|
|
1484
|
+
var BODY_RECOMMENDED_CHARS = 1500;
|
|
1485
|
+
var BODY_MAX_CHARS = 2500;
|
|
1486
|
+
var boundedText = (field, max, hint) => z3.string({
|
|
1487
|
+
errorMap: (issue, ctx) => ({ message: issue.code === "too_big" ? `${field} has ${ctx.data.length} characters; maximum is ${max} (${ctx.data.length - max} over). ${hint}` : ctx.defaultError })
|
|
1488
|
+
}).trim().min(1, `${field} must be non-empty`).max(max);
|
|
1489
|
+
var decisionTitleSchema = boundedText("title", TITLE_MAX_CHARS, "Tighten it to a specific headline.");
|
|
1490
|
+
var decisionBodySchema = boundedText(
|
|
1491
|
+
"body",
|
|
1492
|
+
BODY_MAX_CHARS,
|
|
1493
|
+
`Aim for ${BODY_RECOMMENDED_CHARS} characters or fewer. Preserve the rule, reason, and exceptions; put supporting references in sources.`
|
|
1494
|
+
);
|
|
1482
1495
|
async function loadDecisionStore(rootDir) {
|
|
1483
1496
|
const records = [];
|
|
1484
1497
|
const diagnostics = [];
|
|
@@ -1654,96 +1667,103 @@ async function computeAudit(rootDir, options = {}) {
|
|
|
1654
1667
|
import fs10 from "fs/promises";
|
|
1655
1668
|
import path16 from "path";
|
|
1656
1669
|
import { createHash as createHash2, randomUUID as randomUUID2 } from "crypto";
|
|
1657
|
-
import { z as
|
|
1658
|
-
var checkSchema =
|
|
1659
|
-
var commitSchema =
|
|
1660
|
-
var anchorSchema =
|
|
1661
|
-
var count =
|
|
1662
|
-
var evidenceSchema =
|
|
1663
|
-
|
|
1664
|
-
kind:
|
|
1665
|
-
claimed:
|
|
1666
|
-
renamedTo:
|
|
1670
|
+
import { z as z4 } from "zod";
|
|
1671
|
+
var checkSchema = z4.enum(["deleted-reference", "new-module", "stale-count", "dead-command", "deps-changed", "decision-anchor-drift"]);
|
|
1672
|
+
var commitSchema = z4.object({ hash: z4.string().regex(/^[a-f0-9]{40,64}$/), date: z4.string(), subject: z4.string() });
|
|
1673
|
+
var anchorSchema = z4.object({ doc: z4.string(), line: z4.number().int().positive().nullable(), excerpt: z4.string().nullable() });
|
|
1674
|
+
var count = z4.number().int().nonnegative();
|
|
1675
|
+
var evidenceSchema = z4.discriminatedUnion("kind", [
|
|
1676
|
+
z4.object({
|
|
1677
|
+
kind: z4.literal("missing-path"),
|
|
1678
|
+
claimed: z4.string(),
|
|
1679
|
+
renamedTo: z4.string().nullable(),
|
|
1667
1680
|
deletedInCommit: commitSchema.nullable(),
|
|
1668
|
-
everTracked:
|
|
1669
|
-
parentDirExists:
|
|
1681
|
+
everTracked: z4.boolean(),
|
|
1682
|
+
parentDirExists: z4.boolean()
|
|
1670
1683
|
}),
|
|
1671
|
-
|
|
1672
|
-
kind:
|
|
1673
|
-
dir:
|
|
1684
|
+
z4.object({
|
|
1685
|
+
kind: z4.literal("unmentioned-dir"),
|
|
1686
|
+
dir: z4.string(),
|
|
1674
1687
|
sourceFileCount: count,
|
|
1675
1688
|
firstCommit: commitSchema.nullable(),
|
|
1676
|
-
checkedDocs:
|
|
1689
|
+
checkedDocs: z4.array(z4.string())
|
|
1677
1690
|
}),
|
|
1678
|
-
|
|
1679
|
-
kind:
|
|
1691
|
+
z4.object({
|
|
1692
|
+
kind: z4.literal("count-mismatch"),
|
|
1680
1693
|
claimed: count,
|
|
1681
1694
|
actual: count,
|
|
1682
|
-
unit:
|
|
1683
|
-
countedFrom:
|
|
1684
|
-
members:
|
|
1695
|
+
unit: z4.string(),
|
|
1696
|
+
countedFrom: z4.string(),
|
|
1697
|
+
members: z4.array(z4.string())
|
|
1685
1698
|
}),
|
|
1686
|
-
|
|
1687
|
-
kind:
|
|
1688
|
-
scriptName:
|
|
1689
|
-
invocation:
|
|
1690
|
-
manifestsChecked:
|
|
1691
|
-
availableScripts:
|
|
1699
|
+
z4.object({
|
|
1700
|
+
kind: z4.literal("missing-script"),
|
|
1701
|
+
scriptName: z4.string(),
|
|
1702
|
+
invocation: z4.string(),
|
|
1703
|
+
manifestsChecked: z4.array(z4.string()),
|
|
1704
|
+
availableScripts: z4.array(z4.string())
|
|
1692
1705
|
}),
|
|
1693
|
-
|
|
1694
|
-
kind:
|
|
1706
|
+
z4.object({
|
|
1707
|
+
kind: z4.literal("doc-behind-manifests"),
|
|
1695
1708
|
docLastCommit: commitSchema,
|
|
1696
|
-
manifestCommits:
|
|
1709
|
+
manifestCommits: z4.array(commitSchema.extend({ files: z4.array(z4.string()) })),
|
|
1697
1710
|
totalCommits: count
|
|
1698
1711
|
}),
|
|
1699
|
-
|
|
1700
|
-
kind:
|
|
1701
|
-
decisionId:
|
|
1702
|
-
title:
|
|
1703
|
-
changedFiles:
|
|
1704
|
-
refreshedHash:
|
|
1705
|
-
provenance:
|
|
1712
|
+
z4.object({
|
|
1713
|
+
kind: z4.literal("decision-anchor"),
|
|
1714
|
+
decisionId: z4.string(),
|
|
1715
|
+
title: z4.string(),
|
|
1716
|
+
changedFiles: z4.array(z4.string()),
|
|
1717
|
+
refreshedHash: z4.string(),
|
|
1718
|
+
provenance: z4.object({}).passthrough().optional()
|
|
1706
1719
|
})
|
|
1707
1720
|
]);
|
|
1708
|
-
var findingSchema =
|
|
1721
|
+
var findingSchema = z4.object({ message: z4.string(), anchor: anchorSchema, evidence: evidenceSchema });
|
|
1709
1722
|
var issueSchema = findingSchema.extend({
|
|
1710
|
-
type:
|
|
1711
|
-
confidence:
|
|
1723
|
+
type: z4.enum(["deleted-reference", "new-module", "stale-count", "dead-command"]),
|
|
1724
|
+
confidence: z4.enum(["certain", "likely"])
|
|
1712
1725
|
});
|
|
1713
|
-
var advisorySchema = findingSchema.extend({ type:
|
|
1714
|
-
var checkResultSchema =
|
|
1715
|
-
issues:
|
|
1716
|
-
advisories:
|
|
1717
|
-
suppressedAdvisories:
|
|
1718
|
-
skipped:
|
|
1726
|
+
var advisorySchema = findingSchema.extend({ type: z4.enum(["deps-changed", "decision-anchor-drift"]) });
|
|
1727
|
+
var checkResultSchema = z4.object({
|
|
1728
|
+
issues: z4.array(issueSchema),
|
|
1729
|
+
advisories: z4.array(advisorySchema),
|
|
1730
|
+
suppressedAdvisories: z4.array(advisorySchema).optional(),
|
|
1731
|
+
skipped: z4.array(z4.object({ check: z4.string(), reason: z4.string(), doc: z4.string().optional() }))
|
|
1719
1732
|
});
|
|
1720
|
-
var reportSchema =
|
|
1721
|
-
version:
|
|
1722
|
-
root:
|
|
1723
|
-
gitAvailable:
|
|
1733
|
+
var reportSchema = z4.object({
|
|
1734
|
+
version: z4.literal(1),
|
|
1735
|
+
root: z4.string(),
|
|
1736
|
+
gitAvailable: z4.literal(true),
|
|
1724
1737
|
headHash: commitSchema.shape.hash,
|
|
1725
|
-
checksRun:
|
|
1726
|
-
docs:
|
|
1727
|
-
path:
|
|
1738
|
+
checksRun: z4.array(checkSchema).nonempty(),
|
|
1739
|
+
docs: z4.array(z4.object({
|
|
1740
|
+
path: z4.enum(DOC_CANDIDATES),
|
|
1728
1741
|
lastCommit: commitSchema.nullable(),
|
|
1729
|
-
dirty:
|
|
1742
|
+
dirty: z4.boolean(),
|
|
1730
1743
|
lineCount: count
|
|
1731
1744
|
})).nonempty(),
|
|
1732
|
-
decisionsChecked:
|
|
1733
|
-
clean:
|
|
1734
|
-
issues:
|
|
1735
|
-
advisories:
|
|
1736
|
-
suppressedAdvisories:
|
|
1737
|
-
skippedChecks:
|
|
1745
|
+
decisionsChecked: z4.boolean(),
|
|
1746
|
+
clean: z4.boolean(),
|
|
1747
|
+
issues: z4.array(issueSchema),
|
|
1748
|
+
advisories: z4.array(advisorySchema),
|
|
1749
|
+
suppressedAdvisories: z4.array(advisorySchema).optional(),
|
|
1750
|
+
skippedChecks: z4.array(z4.object({ check: z4.string(), reason: z4.string(), doc: z4.string().optional() }))
|
|
1738
1751
|
});
|
|
1739
|
-
var baselineSchema =
|
|
1740
|
-
kind:
|
|
1741
|
-
version:
|
|
1742
|
-
createdAt:
|
|
1752
|
+
var baselineSchema = z4.object({
|
|
1753
|
+
kind: z4.literal("mason-audit-repair"),
|
|
1754
|
+
version: z4.literal(1),
|
|
1755
|
+
createdAt: z4.string().datetime(),
|
|
1743
1756
|
report: reportSchema,
|
|
1744
|
-
digest:
|
|
1757
|
+
digest: z4.string().regex(/^[a-f0-9]{64}$/)
|
|
1745
1758
|
});
|
|
1746
1759
|
var digest = (value) => createHash2("sha256").update(JSON.stringify(value)).digest("hex");
|
|
1760
|
+
var repairFindingSchema = z4.object({
|
|
1761
|
+
id: z4.string(),
|
|
1762
|
+
original: z4.union([issueSchema, advisorySchema]),
|
|
1763
|
+
status: z4.enum(["resolved", "unresolved", "review-required", "unverified"]),
|
|
1764
|
+
reason: z4.string(),
|
|
1765
|
+
current: z4.union([issueSchema, advisorySchema]).optional()
|
|
1766
|
+
});
|
|
1747
1767
|
function findingId(finding) {
|
|
1748
1768
|
const e = finding.evidence;
|
|
1749
1769
|
let key;
|
|
@@ -1797,7 +1817,7 @@ async function stableAudit(root, checks, options = {}) {
|
|
|
1797
1817
|
}
|
|
1798
1818
|
async function prepareRepair(rootDir, checks = ALL_CHECKS, options = {}) {
|
|
1799
1819
|
const root = await fs10.realpath(rootDir);
|
|
1800
|
-
const selected =
|
|
1820
|
+
const selected = z4.array(checkSchema).nonempty().parse(checks);
|
|
1801
1821
|
const report = await stableAudit(root, selected, options);
|
|
1802
1822
|
if (!report) throw new Error("No context files found to prepare a repair.");
|
|
1803
1823
|
if (!report.gitAvailable) throw new Error("Readable Git history is required to prepare a repair.");
|