harnesstap 1.2.0 → 1.3.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/README.md +28 -15
- package/dist/apply-2GRNKR5H.js +67 -0
- package/dist/apply-2GRNKR5H.js.map +1 -0
- package/dist/approve-KQNCNH2R.js +181 -0
- package/dist/approve-KQNCNH2R.js.map +1 -0
- package/dist/audit-SLYOZCMI.js +434 -0
- package/dist/audit-SLYOZCMI.js.map +1 -0
- package/dist/auth-3IEVICFT.js +220 -0
- package/dist/auth-3IEVICFT.js.map +1 -0
- package/dist/bin.js +166 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk-2EIJYDNI.js +10945 -0
- package/dist/chunk-2EIJYDNI.js.map +1 -0
- package/dist/chunk-2H7UOFLK.js +11 -0
- package/dist/chunk-2H7UOFLK.js.map +1 -0
- package/dist/chunk-37E5M4JX.js +34 -0
- package/dist/chunk-37E5M4JX.js.map +1 -0
- package/dist/chunk-3FIWOI3H.js +98 -0
- package/dist/chunk-3FIWOI3H.js.map +1 -0
- package/dist/chunk-3IWTJCPA.js +6448 -0
- package/dist/chunk-3IWTJCPA.js.map +1 -0
- package/dist/chunk-3IZ7SEGT.js +346 -0
- package/dist/chunk-3IZ7SEGT.js.map +1 -0
- package/dist/chunk-3RBYT7QN.js +540 -0
- package/dist/chunk-3RBYT7QN.js.map +1 -0
- package/dist/chunk-4KNQZDZC.js +115 -0
- package/dist/chunk-4KNQZDZC.js.map +1 -0
- package/dist/chunk-5F3LNDZG.js +9 -0
- package/dist/chunk-5F3LNDZG.js.map +1 -0
- package/dist/chunk-63U7QWNY.js +364 -0
- package/dist/chunk-63U7QWNY.js.map +1 -0
- package/dist/chunk-6BY4BV5G.js +998 -0
- package/dist/chunk-6BY4BV5G.js.map +1 -0
- package/dist/chunk-7L2K4N25.js +610 -0
- package/dist/chunk-7L2K4N25.js.map +1 -0
- package/dist/chunk-7LWH5SWH.js +18 -0
- package/dist/chunk-7LWH5SWH.js.map +1 -0
- package/dist/chunk-BIBUCC2E.js +696 -0
- package/dist/chunk-BIBUCC2E.js.map +1 -0
- package/dist/chunk-BSOBXLYI.js +172 -0
- package/dist/chunk-BSOBXLYI.js.map +1 -0
- package/dist/chunk-C4QBVVEH.js +32 -0
- package/dist/chunk-C4QBVVEH.js.map +1 -0
- package/dist/chunk-CHQGE2HF.js +283 -0
- package/dist/chunk-CHQGE2HF.js.map +1 -0
- package/dist/chunk-DV74UZJI.js +87 -0
- package/dist/chunk-DV74UZJI.js.map +1 -0
- package/dist/chunk-DWVAR4BP.js +656 -0
- package/dist/chunk-DWVAR4BP.js.map +1 -0
- package/dist/chunk-DXKAKKLP.js +302 -0
- package/dist/chunk-DXKAKKLP.js.map +1 -0
- package/dist/chunk-EIWXS4RM.js +235 -0
- package/dist/chunk-EIWXS4RM.js.map +1 -0
- package/dist/chunk-EWBCFAF3.js +681 -0
- package/dist/chunk-EWBCFAF3.js.map +1 -0
- package/dist/chunk-F2L4VNQK.js +1759 -0
- package/dist/chunk-F2L4VNQK.js.map +1 -0
- package/dist/chunk-G26HZZDJ.js +1359 -0
- package/dist/chunk-G26HZZDJ.js.map +1 -0
- package/dist/chunk-GQKKX7OE.js +818 -0
- package/dist/chunk-GQKKX7OE.js.map +1 -0
- package/dist/chunk-GRJY22U6.js +691 -0
- package/dist/chunk-GRJY22U6.js.map +1 -0
- package/dist/chunk-H6DVP2SI.js +682 -0
- package/dist/chunk-H6DVP2SI.js.map +1 -0
- package/dist/chunk-HVVPTCKR.js +1173 -0
- package/dist/chunk-HVVPTCKR.js.map +1 -0
- package/dist/chunk-I6XFZLTJ.js +9 -0
- package/dist/chunk-I6XFZLTJ.js.map +1 -0
- package/dist/chunk-IBOABSIA.js +17 -0
- package/dist/chunk-IBOABSIA.js.map +1 -0
- package/dist/chunk-IK524ZDW.js +691 -0
- package/dist/chunk-IK524ZDW.js.map +1 -0
- package/dist/chunk-IRU7NBOT.js +141 -0
- package/dist/chunk-IRU7NBOT.js.map +1 -0
- package/dist/chunk-J4CKQXQ6.js +806 -0
- package/dist/chunk-J4CKQXQ6.js.map +1 -0
- package/dist/chunk-JKGSJGCC.js +311 -0
- package/dist/chunk-JKGSJGCC.js.map +1 -0
- package/dist/chunk-JQOKQKQT.js +158 -0
- package/dist/chunk-JQOKQKQT.js.map +1 -0
- package/dist/chunk-JRFUTIEH.js +426 -0
- package/dist/chunk-JRFUTIEH.js.map +1 -0
- package/dist/chunk-K2BPYEH5.js +491 -0
- package/dist/chunk-K2BPYEH5.js.map +1 -0
- package/dist/chunk-KCQC7YBK.js +7795 -0
- package/dist/chunk-KCQC7YBK.js.map +1 -0
- package/dist/chunk-KDAV2GUT.js +1357 -0
- package/dist/chunk-KDAV2GUT.js.map +1 -0
- package/dist/chunk-KDDXZBMC.js +583 -0
- package/dist/chunk-KDDXZBMC.js.map +1 -0
- package/dist/chunk-KMWHZSEG.js +41 -0
- package/dist/chunk-KMWHZSEG.js.map +1 -0
- package/dist/chunk-KRI4R7EM.js +25 -0
- package/dist/chunk-KRI4R7EM.js.map +1 -0
- package/dist/chunk-LNJ3WZZX.js +186 -0
- package/dist/chunk-LNJ3WZZX.js.map +1 -0
- package/dist/chunk-MWXA4PFE.js +103 -0
- package/dist/chunk-MWXA4PFE.js.map +1 -0
- package/dist/chunk-MY62SSKC.js +183 -0
- package/dist/chunk-MY62SSKC.js.map +1 -0
- package/dist/chunk-NAGAJ5UM.js +145 -0
- package/dist/chunk-NAGAJ5UM.js.map +1 -0
- package/dist/chunk-NJ7WRKIQ.js +532 -0
- package/dist/chunk-NJ7WRKIQ.js.map +1 -0
- package/dist/chunk-OS6NUIBJ.js +38 -0
- package/dist/chunk-OS6NUIBJ.js.map +1 -0
- package/dist/chunk-PXU2OS26.js +238 -0
- package/dist/chunk-PXU2OS26.js.map +1 -0
- package/dist/chunk-QO4LBDVI.js +496 -0
- package/dist/chunk-QO4LBDVI.js.map +1 -0
- package/dist/chunk-QRZPQNLX.js +65 -0
- package/dist/chunk-QRZPQNLX.js.map +1 -0
- package/dist/chunk-SNVAMWB7.js +40 -0
- package/dist/chunk-SNVAMWB7.js.map +1 -0
- package/dist/chunk-SPRVUATR.js +430 -0
- package/dist/chunk-SPRVUATR.js.map +1 -0
- package/dist/chunk-SY7G5QEI.js +35 -0
- package/dist/chunk-SY7G5QEI.js.map +1 -0
- package/dist/chunk-SZNBUIDR.js +6438 -0
- package/dist/chunk-SZNBUIDR.js.map +1 -0
- package/dist/chunk-TQ2NA4Z4.js +24 -0
- package/dist/chunk-TQ2NA4Z4.js.map +1 -0
- package/dist/chunk-TYULB6ZY.js +2959 -0
- package/dist/chunk-TYULB6ZY.js.map +1 -0
- package/dist/chunk-UJYFTXHV.js +296 -0
- package/dist/chunk-UJYFTXHV.js.map +1 -0
- package/dist/chunk-VC6OKCJF.js +184 -0
- package/dist/chunk-VC6OKCJF.js.map +1 -0
- package/dist/chunk-VL2NWCZV.js +118 -0
- package/dist/chunk-VL2NWCZV.js.map +1 -0
- package/dist/chunk-VL7BGD47.js +514 -0
- package/dist/chunk-VL7BGD47.js.map +1 -0
- package/dist/chunk-VQVUJYYY.js +244 -0
- package/dist/chunk-VQVUJYYY.js.map +1 -0
- package/dist/chunk-VZQG2JDV.js +9 -0
- package/dist/chunk-VZQG2JDV.js.map +1 -0
- package/dist/chunk-XFZQVYIN.js +115 -0
- package/dist/chunk-XFZQVYIN.js.map +1 -0
- package/dist/chunk-XGTTOO4R.js +84 -0
- package/dist/chunk-XGTTOO4R.js.map +1 -0
- package/dist/chunk-XQFT4PEP.js +60 -0
- package/dist/chunk-XQFT4PEP.js.map +1 -0
- package/dist/chunk-YDD3ES2K.js +571 -0
- package/dist/chunk-YDD3ES2K.js.map +1 -0
- package/dist/chunk-ZY2MZ2KQ.js +1140 -0
- package/dist/chunk-ZY2MZ2KQ.js.map +1 -0
- package/dist/compile-57EEIUMB.js +161 -0
- package/dist/compile-57EEIUMB.js.map +1 -0
- package/dist/config-4EJ3D7QJ.js +438 -0
- package/dist/config-4EJ3D7QJ.js.map +1 -0
- package/dist/doctor-EEV6P5CH.js +111 -0
- package/dist/doctor-EEV6P5CH.js.map +1 -0
- package/dist/environment-WFEG4DAT.js +2745 -0
- package/dist/environment-WFEG4DAT.js.map +1 -0
- package/dist/github-BSMQD72A.js +114 -0
- package/dist/github-BSMQD72A.js.map +1 -0
- package/dist/harness-VX3PNVQW.js +746 -0
- package/dist/harness-VX3PNVQW.js.map +1 -0
- package/dist/help-AW2HKX63.js +2079 -0
- package/dist/help-AW2HKX63.js.map +1 -0
- package/dist/help-BVFOZD7E.js +1892 -0
- package/dist/help-BVFOZD7E.js.map +1 -0
- package/dist/index.d.ts +164 -1
- package/dist/index.js +50 -59246
- package/dist/index.js.map +1 -1
- package/dist/init-SPN2GEZ4.js +873 -0
- package/dist/init-SPN2GEZ4.js.map +1 -0
- package/dist/lock-K2LLUU7H.js +455 -0
- package/dist/lock-K2LLUU7H.js.map +1 -0
- package/dist/marketplace-VEKSWGX3.js +495 -0
- package/dist/marketplace-VEKSWGX3.js.map +1 -0
- package/dist/mcp-T6DKIKSF.js +202 -0
- package/dist/mcp-T6DKIKSF.js.map +1 -0
- package/dist/migrate-OO37WSB2.js +1043 -0
- package/dist/migrate-OO37WSB2.js.map +1 -0
- package/dist/open-3V3QK5RK.js +32 -0
- package/dist/open-3V3QK5RK.js.map +1 -0
- package/dist/pack-V32UPC7W.js +99 -0
- package/dist/pack-V32UPC7W.js.map +1 -0
- package/dist/plugin-KOBNQ7GT.js +64 -0
- package/dist/plugin-KOBNQ7GT.js.map +1 -0
- package/dist/plugin-from-project-X3VO3MB6.js +16 -0
- package/dist/plugin-from-project-X3VO3MB6.js.map +1 -0
- package/dist/policy-F5MKZNOC.js +105 -0
- package/dist/policy-F5MKZNOC.js.map +1 -0
- package/dist/profile-H4PMH4XT.js +1886 -0
- package/dist/profile-H4PMH4XT.js.map +1 -0
- package/dist/project-QVNEJJGH.js +1392 -0
- package/dist/project-QVNEJJGH.js.map +1 -0
- package/dist/resource-GL4RLSGI.js +555 -0
- package/dist/resource-GL4RLSGI.js.map +1 -0
- package/dist/version-PBHZK44K.js +17 -0
- package/dist/version-PBHZK44K.js.map +1 -0
- package/package.json +21 -14
- package/schemas/ap-package.v1.json +36 -0
- package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
- package/schemas/fixtures/confidence.ap.json +13 -0
- package/schemas/fixtures/context7.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
- package/schemas/fixtures/superpowers.ap.json +13 -0
- package/schemas/fixtures/third-party-skills.ap.json +13 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findProjectConfig
|
|
3
|
+
} from "./chunk-3IZ7SEGT.js";
|
|
4
|
+
import "./chunk-I6XFZLTJ.js";
|
|
5
|
+
import "./chunk-7L2K4N25.js";
|
|
6
|
+
import {
|
|
7
|
+
formatUnicodeFinding,
|
|
8
|
+
hasCriticalUnicode,
|
|
9
|
+
scanUnicodeBuffer,
|
|
10
|
+
stripHiddenUnicode,
|
|
11
|
+
summarizeUnicodeFindings
|
|
12
|
+
} from "./chunk-JRFUTIEH.js";
|
|
13
|
+
import "./chunk-UJYFTXHV.js";
|
|
14
|
+
import "./chunk-3IWTJCPA.js";
|
|
15
|
+
import {
|
|
16
|
+
buildExecutableTrustContext,
|
|
17
|
+
findRequiredExecutableViolations,
|
|
18
|
+
installedTrustReports
|
|
19
|
+
} from "./chunk-KDDXZBMC.js";
|
|
20
|
+
import {
|
|
21
|
+
PolicyError,
|
|
22
|
+
buildAuditInstallPlan,
|
|
23
|
+
loadAndEvaluateProjectPolicy,
|
|
24
|
+
loadProjectPolicy
|
|
25
|
+
} from "./chunk-HVVPTCKR.js";
|
|
26
|
+
import {
|
|
27
|
+
diffDeployedFileHashes,
|
|
28
|
+
readLockfile
|
|
29
|
+
} from "./chunk-SPRVUATR.js";
|
|
30
|
+
import "./chunk-EWBCFAF3.js";
|
|
31
|
+
import {
|
|
32
|
+
PathEscapeError,
|
|
33
|
+
assertContainedPath,
|
|
34
|
+
listContainedFiles
|
|
35
|
+
} from "./chunk-2EIJYDNI.js";
|
|
36
|
+
import "./chunk-6BY4BV5G.js";
|
|
37
|
+
import "./chunk-GQKKX7OE.js";
|
|
38
|
+
import {
|
|
39
|
+
parseOutputFormat,
|
|
40
|
+
printJson
|
|
41
|
+
} from "./chunk-TQ2NA4Z4.js";
|
|
42
|
+
import {
|
|
43
|
+
fail,
|
|
44
|
+
formatCommand
|
|
45
|
+
} from "./chunk-DXKAKKLP.js";
|
|
46
|
+
import {
|
|
47
|
+
formatCount,
|
|
48
|
+
ui
|
|
49
|
+
} from "./chunk-YDD3ES2K.js";
|
|
50
|
+
import "./chunk-ZY2MZ2KQ.js";
|
|
51
|
+
import "./chunk-VQVUJYYY.js";
|
|
52
|
+
import "./chunk-DWVAR4BP.js";
|
|
53
|
+
|
|
54
|
+
// src/cli/commands/audit.ts
|
|
55
|
+
import { resolve as resolve2 } from "path";
|
|
56
|
+
|
|
57
|
+
// src/services/audit.ts
|
|
58
|
+
import { existsSync, lstatSync, readFileSync, writeFileSync } from "fs";
|
|
59
|
+
import { isAbsolute, join, relative, resolve } from "path";
|
|
60
|
+
var SOURCE_DIRS = [
|
|
61
|
+
".apm/agents",
|
|
62
|
+
".apm/skills",
|
|
63
|
+
".apm/commands",
|
|
64
|
+
".apm/hooks",
|
|
65
|
+
"agents",
|
|
66
|
+
"skills",
|
|
67
|
+
"commands",
|
|
68
|
+
"hooks"
|
|
69
|
+
];
|
|
70
|
+
var ROOT_CONTEXT_FILES = ["AGENTS.md", "CLAUDE.md", "GEMINI.md"];
|
|
71
|
+
var AuditUsageError = class extends Error {
|
|
72
|
+
constructor(message) {
|
|
73
|
+
super(message);
|
|
74
|
+
this.name = "AuditUsageError";
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
function toPosix(path) {
|
|
78
|
+
return path.split("\\").join("/");
|
|
79
|
+
}
|
|
80
|
+
function collectLockfileTargets(projectRoot) {
|
|
81
|
+
const lock = readLockfile(projectRoot);
|
|
82
|
+
if (!lock?.deployed_file_hashes) return [];
|
|
83
|
+
return Object.keys(lock.deployed_file_hashes).sort();
|
|
84
|
+
}
|
|
85
|
+
function collectSourceTargets(projectRoot) {
|
|
86
|
+
const files = [];
|
|
87
|
+
for (const dir of SOURCE_DIRS) {
|
|
88
|
+
const absolute = join(projectRoot, dir);
|
|
89
|
+
if (!existsSync(absolute)) continue;
|
|
90
|
+
if (lstatSync(absolute).isSymbolicLink()) {
|
|
91
|
+
throw new PathEscapeError(dir, projectRoot);
|
|
92
|
+
}
|
|
93
|
+
for (const child of listContainedFiles(absolute)) {
|
|
94
|
+
files.push(toPosix(join(dir, child)));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
for (const name of ROOT_CONTEXT_FILES) {
|
|
98
|
+
if (existsSync(join(projectRoot, name))) {
|
|
99
|
+
files.push(name);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return files;
|
|
103
|
+
}
|
|
104
|
+
function resolveFileTarget(projectRoot, file) {
|
|
105
|
+
const resolved = isAbsolute(file) ? resolve(file) : resolve(projectRoot, file);
|
|
106
|
+
const rel = toPosix(relative(projectRoot, resolved));
|
|
107
|
+
assertContainedPath(projectRoot, rel);
|
|
108
|
+
if (!existsSync(resolved)) {
|
|
109
|
+
throw new AuditUsageError(`File not found: ${file}`);
|
|
110
|
+
}
|
|
111
|
+
return rel;
|
|
112
|
+
}
|
|
113
|
+
function uniqueSorted(paths) {
|
|
114
|
+
return [...new Set(paths.map(toPosix))].sort();
|
|
115
|
+
}
|
|
116
|
+
function scanRelativeFile(projectRoot, relativePath) {
|
|
117
|
+
assertContainedPath(projectRoot, relativePath);
|
|
118
|
+
const absolute = join(projectRoot, relativePath);
|
|
119
|
+
if (!existsSync(absolute)) return [];
|
|
120
|
+
if (lstatSync(absolute).isSymbolicLink()) {
|
|
121
|
+
throw new PathEscapeError(relativePath, projectRoot);
|
|
122
|
+
}
|
|
123
|
+
return scanUnicodeBuffer(readFileSync(absolute), relativePath);
|
|
124
|
+
}
|
|
125
|
+
function readRelativeText(projectRoot, relativePath) {
|
|
126
|
+
const absolute = join(projectRoot, relativePath);
|
|
127
|
+
if (!existsSync(absolute)) return void 0;
|
|
128
|
+
if (lstatSync(absolute).isSymbolicLink()) {
|
|
129
|
+
throw new PathEscapeError(relativePath, projectRoot);
|
|
130
|
+
}
|
|
131
|
+
return readFileSync(absolute, "utf8");
|
|
132
|
+
}
|
|
133
|
+
function integrityForLock(projectRoot) {
|
|
134
|
+
const lock = readLockfile(projectRoot);
|
|
135
|
+
const expected = lock?.deployed_file_hashes;
|
|
136
|
+
if (!expected || Object.keys(expected).length === 0) {
|
|
137
|
+
return { ok: true, issues: [] };
|
|
138
|
+
}
|
|
139
|
+
const files = [];
|
|
140
|
+
for (const relativePath of Object.keys(expected).sort()) {
|
|
141
|
+
const content = readRelativeText(projectRoot, relativePath);
|
|
142
|
+
if (content === void 0) continue;
|
|
143
|
+
files.push({ path: relativePath, content });
|
|
144
|
+
}
|
|
145
|
+
const issues = diffDeployedFileHashes(expected, files);
|
|
146
|
+
return { ok: issues.length === 0, issues };
|
|
147
|
+
}
|
|
148
|
+
function skippedPolicy() {
|
|
149
|
+
return {
|
|
150
|
+
status: "skipped",
|
|
151
|
+
skippedReason: "no-policy",
|
|
152
|
+
enforcement: "off",
|
|
153
|
+
warnings: [],
|
|
154
|
+
violations: [],
|
|
155
|
+
blocks: false
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function evaluateAuditPolicy(projectRoot, options) {
|
|
159
|
+
try {
|
|
160
|
+
const manifest = findProjectConfig(projectRoot);
|
|
161
|
+
const lock = readLockfile(projectRoot);
|
|
162
|
+
const plan = buildAuditInstallPlan({
|
|
163
|
+
projectRoot,
|
|
164
|
+
apmDependencies: manifest?.apmDependencies,
|
|
165
|
+
mcpDependencies: manifest?.mcpDependencies,
|
|
166
|
+
...lock ? { lock } : {}
|
|
167
|
+
});
|
|
168
|
+
const evaluation = loadAndEvaluateProjectPolicy({
|
|
169
|
+
projectRoot,
|
|
170
|
+
...options.policy ? { policyPath: options.policy } : {},
|
|
171
|
+
...manifest?.policyPin ? { pin: manifest.policyPin } : {},
|
|
172
|
+
requirePolicy: options.ci === true && options.requirePolicy === true,
|
|
173
|
+
plan
|
|
174
|
+
});
|
|
175
|
+
const loaded = loadProjectPolicy({
|
|
176
|
+
projectRoot,
|
|
177
|
+
...options.policy ? { policyPath: options.policy } : {},
|
|
178
|
+
...manifest?.policyPin ? { pin: manifest.policyPin } : {},
|
|
179
|
+
requirePolicy: options.ci === true && options.requirePolicy === true
|
|
180
|
+
});
|
|
181
|
+
const trust = buildExecutableTrustContext({ projectRoot, loaded });
|
|
182
|
+
const reports = installedTrustReports(trust, {
|
|
183
|
+
...lock ? { lock } : {}
|
|
184
|
+
});
|
|
185
|
+
const required = findRequiredExecutableViolations({
|
|
186
|
+
context: trust,
|
|
187
|
+
require: loaded.policy?.executables.require ?? [],
|
|
188
|
+
...lock ? { lock } : {},
|
|
189
|
+
reports
|
|
190
|
+
});
|
|
191
|
+
if (required.length === 0) {
|
|
192
|
+
return evaluation;
|
|
193
|
+
}
|
|
194
|
+
const violations = [...evaluation.violations, ...required];
|
|
195
|
+
return {
|
|
196
|
+
...evaluation,
|
|
197
|
+
violations,
|
|
198
|
+
blocks: evaluation.blocks || options.ci === true
|
|
199
|
+
};
|
|
200
|
+
} catch (error) {
|
|
201
|
+
if (error instanceof PolicyError) {
|
|
202
|
+
return {
|
|
203
|
+
status: "failed",
|
|
204
|
+
enforcement: "block",
|
|
205
|
+
warnings: [],
|
|
206
|
+
violations: error.violations.length > 0 ? error.violations : [{ code: "policy-parse", message: error.message }],
|
|
207
|
+
blocks: true
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function exitCodeFor(result) {
|
|
214
|
+
if (result.policyBlocks) {
|
|
215
|
+
return 1;
|
|
216
|
+
}
|
|
217
|
+
if (result.ci) {
|
|
218
|
+
return hasCriticalUnicode(result.findings) || !result.integrityOk ? 1 : 0;
|
|
219
|
+
}
|
|
220
|
+
if (result.strip && !result.dryRun) {
|
|
221
|
+
return 0;
|
|
222
|
+
}
|
|
223
|
+
if (hasCriticalUnicode(result.findings)) return 1;
|
|
224
|
+
if (result.findings.some((finding) => finding.severity === "warning")) return 2;
|
|
225
|
+
return 0;
|
|
226
|
+
}
|
|
227
|
+
function auditProject(options = {}) {
|
|
228
|
+
if (options.ci && options.strip) {
|
|
229
|
+
throw new AuditUsageError("--ci cannot be combined with --strip");
|
|
230
|
+
}
|
|
231
|
+
if (options.ci && options.file) {
|
|
232
|
+
throw new AuditUsageError("--ci cannot be combined with --file");
|
|
233
|
+
}
|
|
234
|
+
if (options.ci && options.dryRun) {
|
|
235
|
+
throw new AuditUsageError("--ci cannot be combined with --dry-run");
|
|
236
|
+
}
|
|
237
|
+
if (options.dryRun && !options.strip) {
|
|
238
|
+
throw new AuditUsageError("--dry-run requires --strip");
|
|
239
|
+
}
|
|
240
|
+
if (options.requirePolicy && !options.ci) {
|
|
241
|
+
throw new AuditUsageError("--require-policy requires --ci");
|
|
242
|
+
}
|
|
243
|
+
if (options.requirePolicy && options.file) {
|
|
244
|
+
throw new AuditUsageError("--require-policy cannot be combined with --file");
|
|
245
|
+
}
|
|
246
|
+
if (options.requirePolicy && options.strip) {
|
|
247
|
+
throw new AuditUsageError("--require-policy cannot be combined with --strip");
|
|
248
|
+
}
|
|
249
|
+
const projectRoot = resolve(options.projectRoot ?? process.cwd());
|
|
250
|
+
const scannedFiles = options.file ? [resolveFileTarget(projectRoot, options.file)] : uniqueSorted([
|
|
251
|
+
...collectLockfileTargets(projectRoot).filter(
|
|
252
|
+
(relativePath) => existsSync(join(projectRoot, relativePath))
|
|
253
|
+
),
|
|
254
|
+
...collectSourceTargets(projectRoot)
|
|
255
|
+
]);
|
|
256
|
+
const findings = [];
|
|
257
|
+
for (const relativePath of scannedFiles) {
|
|
258
|
+
findings.push(...scanRelativeFile(projectRoot, relativePath));
|
|
259
|
+
}
|
|
260
|
+
const integrity = options.ci ? integrityForLock(projectRoot) : { ok: true, issues: [] };
|
|
261
|
+
const policy = options.file ? skippedPolicy() : evaluateAuditPolicy(projectRoot, options);
|
|
262
|
+
const stripped = [];
|
|
263
|
+
if (options.strip && !policy.blocks) {
|
|
264
|
+
for (const relativePath of scannedFiles) {
|
|
265
|
+
const content = readRelativeText(projectRoot, relativePath);
|
|
266
|
+
if (content === void 0) continue;
|
|
267
|
+
const result = stripHiddenUnicode(content);
|
|
268
|
+
if (result.removed === 0) continue;
|
|
269
|
+
stripped.push({ path: relativePath, removed: result.removed });
|
|
270
|
+
if (!options.dryRun) {
|
|
271
|
+
writeFileSync(join(projectRoot, relativePath), result.text, "utf8");
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const summary = summarizeUnicodeFindings(findings);
|
|
276
|
+
return {
|
|
277
|
+
findings,
|
|
278
|
+
summary,
|
|
279
|
+
integrity,
|
|
280
|
+
policy,
|
|
281
|
+
stripped,
|
|
282
|
+
scannedFiles,
|
|
283
|
+
exitCode: exitCodeFor({
|
|
284
|
+
ci: options.ci === true,
|
|
285
|
+
strip: options.strip === true,
|
|
286
|
+
dryRun: options.dryRun === true,
|
|
287
|
+
findings,
|
|
288
|
+
integrityOk: integrity.ok,
|
|
289
|
+
policyBlocks: policy.blocks
|
|
290
|
+
})
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// src/cli/commands/audit.ts
|
|
295
|
+
function printPolicy(policy) {
|
|
296
|
+
if (policy.status === "skipped") {
|
|
297
|
+
ui.info("Policy: skipped (no apm-policy.yml)");
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const label = policy.source ?? "apm-policy.yml";
|
|
301
|
+
if (policy.warnings.length > 0) {
|
|
302
|
+
for (const warning of policy.warnings) {
|
|
303
|
+
ui.warn(warning);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
for (const violation of policy.violations) {
|
|
307
|
+
if (policy.enforcement === "block" || policy.status === "failed") {
|
|
308
|
+
fail(violation.message);
|
|
309
|
+
} else {
|
|
310
|
+
ui.warn(violation.message);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (policy.status === "failed") {
|
|
314
|
+
fail(`Policy ${label}: failed`);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (policy.violations.length === 0) {
|
|
318
|
+
ui.success(`Policy ${label}: ok (${policy.enforcement})`);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const summary = `Policy ${label}: ${formatCount(policy.violations.length, "violation")} (${policy.enforcement})`;
|
|
322
|
+
if (policy.blocks) {
|
|
323
|
+
fail(summary);
|
|
324
|
+
} else {
|
|
325
|
+
ui.warn(summary);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function printHuman(result, opts) {
|
|
329
|
+
for (const finding of result.findings) {
|
|
330
|
+
if (finding.severity === "info") continue;
|
|
331
|
+
const line = formatUnicodeFinding(finding);
|
|
332
|
+
if (finding.severity === "critical") {
|
|
333
|
+
fail(line);
|
|
334
|
+
} else {
|
|
335
|
+
ui.warn(line);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
for (const issue of result.integrity.issues) {
|
|
339
|
+
switch (issue.kind) {
|
|
340
|
+
case "missing":
|
|
341
|
+
fail(`missing ${issue.path}`);
|
|
342
|
+
break;
|
|
343
|
+
case "extra":
|
|
344
|
+
fail(`extra ${issue.path}`);
|
|
345
|
+
break;
|
|
346
|
+
case "mismatch":
|
|
347
|
+
fail(`hash mismatch ${issue.path}`);
|
|
348
|
+
break;
|
|
349
|
+
case "unsafe-path":
|
|
350
|
+
fail(`unsafe path ${issue.path}`);
|
|
351
|
+
break;
|
|
352
|
+
default: {
|
|
353
|
+
const unhandled = issue.kind;
|
|
354
|
+
fail(`integrity ${String(unhandled)} ${issue.path}`);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (opts.strip) {
|
|
359
|
+
const verb = opts.dryRun ? "Would strip" : "Stripped";
|
|
360
|
+
for (const entry of result.stripped) {
|
|
361
|
+
ui.info(`${verb} ${formatCount(entry.removed, "character")} from ${entry.path}`);
|
|
362
|
+
}
|
|
363
|
+
if (result.stripped.length === 0) {
|
|
364
|
+
ui.info(`${opts.dryRun ? "Would strip" : "Stripped"} nothing`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (!opts.file) {
|
|
368
|
+
printPolicy(result.policy);
|
|
369
|
+
}
|
|
370
|
+
const { critical, warning, info } = result.summary;
|
|
371
|
+
const parts = [`${critical} critical`, `${warning} warning`, `${info} info`];
|
|
372
|
+
const integrityNote = opts.ci ? result.integrity.ok ? "integrity ok" : `${formatCount(result.integrity.issues.length, "integrity issue")}` : void 0;
|
|
373
|
+
const policyNote = opts.file ? void 0 : result.policy.status === "skipped" ? "policy skipped" : result.policy.violations.length === 0 ? "policy ok" : `${formatCount(result.policy.violations.length, "policy violation")}`;
|
|
374
|
+
const extras = [integrityNote, policyNote].filter(Boolean);
|
|
375
|
+
const scanned = formatCount(result.scannedFiles.length, "file");
|
|
376
|
+
const summary = extras.length > 0 ? `Scanned ${scanned}: ${parts.join(", ")}; ${extras.join("; ")}` : `Scanned ${scanned}: ${parts.join(", ")}`;
|
|
377
|
+
if (result.exitCode === 0) {
|
|
378
|
+
ui.success(summary);
|
|
379
|
+
} else if (result.exitCode === 2) {
|
|
380
|
+
ui.warn(summary);
|
|
381
|
+
} else {
|
|
382
|
+
fail(summary);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function handleAuditCommand(opts) {
|
|
386
|
+
const format = parseOutputFormat(opts.format);
|
|
387
|
+
try {
|
|
388
|
+
const result = auditProject({
|
|
389
|
+
projectRoot: resolve2(opts.project ?? "."),
|
|
390
|
+
file: opts.file,
|
|
391
|
+
ci: opts.ci,
|
|
392
|
+
strip: opts.strip,
|
|
393
|
+
dryRun: opts.dryRun,
|
|
394
|
+
policy: opts.policy,
|
|
395
|
+
requirePolicy: opts.requirePolicy
|
|
396
|
+
});
|
|
397
|
+
process.exitCode = result.exitCode;
|
|
398
|
+
if (format === "json") {
|
|
399
|
+
printJson({
|
|
400
|
+
passed: result.exitCode === 0,
|
|
401
|
+
summary: result.summary,
|
|
402
|
+
findings: result.findings,
|
|
403
|
+
integrity: result.integrity,
|
|
404
|
+
policy: result.policy,
|
|
405
|
+
stripped: result.stripped,
|
|
406
|
+
scanned_files: result.scannedFiles,
|
|
407
|
+
exit_code: result.exitCode
|
|
408
|
+
});
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
printHuman(result, opts);
|
|
412
|
+
} catch (error) {
|
|
413
|
+
if (error instanceof AuditUsageError) {
|
|
414
|
+
fail(error.message, {
|
|
415
|
+
hints: [formatCommand("audit --help")],
|
|
416
|
+
exitCode: 2
|
|
417
|
+
});
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
function registerAuditCommand(root) {
|
|
424
|
+
root.command("audit").description(
|
|
425
|
+
"Scan a project for hidden Unicode, lockfile hashes, apm-policy.yml, and executable trust"
|
|
426
|
+
).option("--project <path>", "Project directory", ".").option("--file <path>", "Scan a single file instead of the project").option("--ci", "CI gate: fail on critical Unicode, lockfile hash drift, policy, or untrusted required executables").option("--policy <path>", "Policy file (default: apm-policy.yml at project root)").option("--require-policy", "With --ci, fail if no policy file is present").option("--strip", "Remove critical and warning hidden-Unicode characters").option("--dry-run", "Preview --strip without writing").option("--format <mode>", "Output format: human or json", "human").action((opts) => {
|
|
427
|
+
handleAuditCommand(opts);
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
export {
|
|
431
|
+
handleAuditCommand,
|
|
432
|
+
registerAuditCommand
|
|
433
|
+
};
|
|
434
|
+
//# sourceMappingURL=audit-SLYOZCMI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/audit.ts","../src/services/audit.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { resolve } from \"node:path\";\nimport {\n AuditUsageError,\n auditProject,\n type AuditResult,\n} from \"../../services/audit.js\";\nimport type { PolicyEvaluation } from \"../../services/apm-policy.js\";\nimport { formatUnicodeFinding } from \"../../services/unicode-scan.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { formatCount } from \"../formatting.js\";\nimport {\n fail,\n formatCommand,\n} from \"../shared.js\";\n\nexport interface AuditCommandOpts {\n project?: string;\n file?: string;\n ci?: boolean;\n strip?: boolean;\n dryRun?: boolean;\n policy?: string;\n requirePolicy?: boolean;\n format?: string;\n}\n\nfunction printPolicy(policy: PolicyEvaluation): void {\n if (policy.status === \"skipped\") {\n ui.info(\"Policy: skipped (no apm-policy.yml)\");\n return;\n }\n const label = policy.source ?? \"apm-policy.yml\";\n if (policy.warnings.length > 0) {\n for (const warning of policy.warnings) {\n ui.warn(warning);\n }\n }\n for (const violation of policy.violations) {\n if (policy.enforcement === \"block\" || policy.status === \"failed\") {\n fail(violation.message);\n } else {\n ui.warn(violation.message);\n }\n }\n if (policy.status === \"failed\") {\n fail(`Policy ${label}: failed`);\n return;\n }\n if (policy.violations.length === 0) {\n ui.success(`Policy ${label}: ok (${policy.enforcement})`);\n return;\n }\n const summary = `Policy ${label}: ${formatCount(policy.violations.length, \"violation\")} (${policy.enforcement})`;\n if (policy.blocks) {\n fail(summary);\n } else {\n ui.warn(summary);\n }\n}\n\nfunction printHuman(result: AuditResult, opts: AuditCommandOpts): void {\n for (const finding of result.findings) {\n if (finding.severity === \"info\") continue;\n const line = formatUnicodeFinding(finding);\n if (finding.severity === \"critical\") {\n fail(line);\n } else {\n ui.warn(line);\n }\n }\n\n for (const issue of result.integrity.issues) {\n switch (issue.kind) {\n case \"missing\":\n fail(`missing ${issue.path}`);\n break;\n case \"extra\":\n fail(`extra ${issue.path}`);\n break;\n case \"mismatch\":\n fail(`hash mismatch ${issue.path}`);\n break;\n case \"unsafe-path\":\n fail(`unsafe path ${issue.path}`);\n break;\n default: {\n const unhandled: never = issue.kind;\n fail(`integrity ${String(unhandled)} ${issue.path}`);\n }\n }\n }\n\n if (opts.strip) {\n const verb = opts.dryRun ? \"Would strip\" : \"Stripped\";\n for (const entry of result.stripped) {\n ui.info(`${verb} ${formatCount(entry.removed, \"character\")} from ${entry.path}`);\n }\n if (result.stripped.length === 0) {\n ui.info(`${opts.dryRun ? \"Would strip\" : \"Stripped\"} nothing`);\n }\n }\n\n if (!opts.file) {\n printPolicy(result.policy);\n }\n\n const { critical, warning, info } = result.summary;\n const parts = [`${critical} critical`, `${warning} warning`, `${info} info`];\n const integrityNote = opts.ci\n ? result.integrity.ok\n ? \"integrity ok\"\n : `${formatCount(result.integrity.issues.length, \"integrity issue\")}`\n : undefined;\n const policyNote = opts.file\n ? undefined\n : result.policy.status === \"skipped\"\n ? \"policy skipped\"\n : result.policy.violations.length === 0\n ? \"policy ok\"\n : `${formatCount(result.policy.violations.length, \"policy violation\")}`;\n const extras = [integrityNote, policyNote].filter(Boolean);\n const scanned = formatCount(result.scannedFiles.length, \"file\");\n const summary = extras.length > 0\n ? `Scanned ${scanned}: ${parts.join(\", \")}; ${extras.join(\"; \")}`\n : `Scanned ${scanned}: ${parts.join(\", \")}`;\n if (result.exitCode === 0) {\n ui.success(summary);\n } else if (result.exitCode === 2) {\n ui.warn(summary);\n } else {\n fail(summary);\n }\n}\n\nexport function handleAuditCommand(opts: AuditCommandOpts): void {\n const format = parseOutputFormat(opts.format);\n\n try {\n const result = auditProject({\n projectRoot: resolve(opts.project ?? \".\"),\n file: opts.file,\n ci: opts.ci,\n strip: opts.strip,\n dryRun: opts.dryRun,\n policy: opts.policy,\n requirePolicy: opts.requirePolicy,\n });\n\n process.exitCode = result.exitCode;\n\n if (format === \"json\") {\n printJson({\n passed: result.exitCode === 0,\n summary: result.summary,\n findings: result.findings,\n integrity: result.integrity,\n policy: result.policy,\n stripped: result.stripped,\n scanned_files: result.scannedFiles,\n exit_code: result.exitCode,\n });\n return;\n }\n\n printHuman(result, opts);\n } catch (error) {\n if (error instanceof AuditUsageError) {\n fail(error.message, {\n hints: [formatCommand(\"audit --help\")],\n exitCode: 2,\n });\n return;\n }\n fail(error instanceof Error ? error.message : String(error));\n }\n}\n\nexport function registerAuditCommand(root: Command): void {\n root\n .command(\"audit\")\n .description(\n \"Scan a project for hidden Unicode, lockfile hashes, apm-policy.yml, and executable trust\",\n )\n .option(\"--project <path>\", \"Project directory\", \".\")\n .option(\"--file <path>\", \"Scan a single file instead of the project\")\n .option(\"--ci\", \"CI gate: fail on critical Unicode, lockfile hash drift, policy, or untrusted required executables\")\n .option(\"--policy <path>\", \"Policy file (default: apm-policy.yml at project root)\")\n .option(\"--require-policy\", \"With --ci, fail if no policy file is present\")\n .option(\"--strip\", \"Remove critical and warning hidden-Unicode characters\")\n .option(\"--dry-run\", \"Preview --strip without writing\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .action((opts: AuditCommandOpts) => {\n handleAuditCommand(opts);\n });\n}\n","import { existsSync, lstatSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { isAbsolute, join, relative, resolve } from \"node:path\";\nimport {\n PathEscapeError,\n assertContainedPath,\n listContainedFiles,\n} from \"../utils/path-containment.js\";\nimport {\n buildAuditInstallPlan,\n loadAndEvaluateProjectPolicy,\n loadProjectPolicy,\n PolicyError,\n type PolicyEvaluation,\n} from \"./apm-policy.js\";\nimport {\n buildExecutableTrustContext,\n findRequiredExecutableViolations,\n installedTrustReports,\n} from \"./executable-trust.js\";\nimport {\n diffDeployedFileHashes,\n type DeployedHashIssue,\n readLockfile,\n} from \"./lockfile.js\";\nimport { findProjectConfig } from \"./project-config.js\";\nimport {\n hasCriticalUnicode,\n scanUnicodeBuffer,\n stripHiddenUnicode,\n summarizeUnicodeFindings,\n type UnicodeScanFinding,\n type UnicodeScanSeverity,\n} from \"./unicode-scan.js\";\n\nconst SOURCE_DIRS = [\n \".apm/agents\",\n \".apm/skills\",\n \".apm/commands\",\n \".apm/hooks\",\n \"agents\",\n \"skills\",\n \"commands\",\n \"hooks\",\n] as const;\n\nconst ROOT_CONTEXT_FILES = [\"AGENTS.md\", \"CLAUDE.md\", \"GEMINI.md\"] as const;\n\nexport class AuditUsageError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"AuditUsageError\";\n }\n}\n\nexport interface AuditOptions {\n projectRoot?: string;\n file?: string;\n ci?: boolean;\n strip?: boolean;\n dryRun?: boolean;\n policy?: string;\n requirePolicy?: boolean;\n}\n\nexport interface AuditResult {\n findings: UnicodeScanFinding[];\n summary: Record<UnicodeScanSeverity, number>;\n integrity: { ok: boolean; issues: DeployedHashIssue[] };\n policy: PolicyEvaluation;\n stripped: Array<{ path: string; removed: number }>;\n scannedFiles: string[];\n exitCode: number;\n}\n\nfunction toPosix(path: string): string {\n return path.split(\"\\\\\").join(\"/\");\n}\n\nfunction collectLockfileTargets(projectRoot: string): string[] {\n const lock = readLockfile(projectRoot);\n if (!lock?.deployed_file_hashes) return [];\n return Object.keys(lock.deployed_file_hashes).sort();\n}\n\nfunction collectSourceTargets(projectRoot: string): string[] {\n const files: string[] = [];\n for (const dir of SOURCE_DIRS) {\n const absolute = join(projectRoot, dir);\n if (!existsSync(absolute)) continue;\n if (lstatSync(absolute).isSymbolicLink()) {\n throw new PathEscapeError(dir, projectRoot);\n }\n for (const child of listContainedFiles(absolute)) {\n files.push(toPosix(join(dir, child)));\n }\n }\n for (const name of ROOT_CONTEXT_FILES) {\n if (existsSync(join(projectRoot, name))) {\n files.push(name);\n }\n }\n return files;\n}\n\nfunction resolveFileTarget(projectRoot: string, file: string): string {\n const resolved = isAbsolute(file) ? resolve(file) : resolve(projectRoot, file);\n const rel = toPosix(relative(projectRoot, resolved));\n assertContainedPath(projectRoot, rel);\n if (!existsSync(resolved)) {\n throw new AuditUsageError(`File not found: ${file}`);\n }\n return rel;\n}\n\nfunction uniqueSorted(paths: string[]): string[] {\n return [...new Set(paths.map(toPosix))].sort();\n}\n\nfunction scanRelativeFile(projectRoot: string, relativePath: string): UnicodeScanFinding[] {\n assertContainedPath(projectRoot, relativePath);\n const absolute = join(projectRoot, relativePath);\n if (!existsSync(absolute)) return [];\n if (lstatSync(absolute).isSymbolicLink()) {\n throw new PathEscapeError(relativePath, projectRoot);\n }\n return scanUnicodeBuffer(readFileSync(absolute), relativePath);\n}\n\nfunction readRelativeText(projectRoot: string, relativePath: string): string | undefined {\n const absolute = join(projectRoot, relativePath);\n if (!existsSync(absolute)) return undefined;\n if (lstatSync(absolute).isSymbolicLink()) {\n throw new PathEscapeError(relativePath, projectRoot);\n }\n return readFileSync(absolute, \"utf8\");\n}\n\nfunction integrityForLock(\n projectRoot: string,\n): { ok: boolean; issues: DeployedHashIssue[] } {\n const lock = readLockfile(projectRoot);\n const expected = lock?.deployed_file_hashes;\n if (!expected || Object.keys(expected).length === 0) {\n return { ok: true, issues: [] };\n }\n\n const files: Array<{ path: string; content: string }> = [];\n for (const relativePath of Object.keys(expected).sort()) {\n const content = readRelativeText(projectRoot, relativePath);\n if (content === undefined) continue;\n files.push({ path: relativePath, content });\n }\n const issues = diffDeployedFileHashes(expected, files);\n return { ok: issues.length === 0, issues };\n}\n\nfunction skippedPolicy(): PolicyEvaluation {\n return {\n status: \"skipped\",\n skippedReason: \"no-policy\",\n enforcement: \"off\",\n warnings: [],\n violations: [],\n blocks: false,\n };\n}\n\nfunction evaluateAuditPolicy(\n projectRoot: string,\n options: AuditOptions,\n): PolicyEvaluation {\n try {\n const manifest = findProjectConfig(projectRoot);\n const lock = readLockfile(projectRoot);\n const plan = buildAuditInstallPlan({\n projectRoot,\n apmDependencies: manifest?.apmDependencies,\n mcpDependencies: manifest?.mcpDependencies,\n ...(lock ? { lock } : {}),\n });\n const evaluation = loadAndEvaluateProjectPolicy({\n projectRoot,\n ...(options.policy ? { policyPath: options.policy } : {}),\n ...(manifest?.policyPin ? { pin: manifest.policyPin } : {}),\n requirePolicy: options.ci === true && options.requirePolicy === true,\n plan,\n });\n const loaded = loadProjectPolicy({\n projectRoot,\n ...(options.policy ? { policyPath: options.policy } : {}),\n ...(manifest?.policyPin ? { pin: manifest.policyPin } : {}),\n requirePolicy: options.ci === true && options.requirePolicy === true,\n });\n const trust = buildExecutableTrustContext({ projectRoot, loaded });\n const reports = installedTrustReports(trust, {\n ...(lock ? { lock } : {}),\n });\n const required = findRequiredExecutableViolations({\n context: trust,\n require: loaded.policy?.executables.require ?? [],\n ...(lock ? { lock } : {}),\n reports,\n });\n if (required.length === 0) {\n return evaluation;\n }\n const violations = [...evaluation.violations, ...required];\n return {\n ...evaluation,\n violations,\n blocks: evaluation.blocks || options.ci === true,\n };\n } catch (error) {\n if (error instanceof PolicyError) {\n return {\n status: \"failed\",\n enforcement: \"block\",\n warnings: [],\n violations: error.violations.length > 0\n ? error.violations\n : [{ code: \"policy-parse\", message: error.message }],\n blocks: true,\n };\n }\n throw error;\n }\n}\n\nfunction exitCodeFor(result: {\n ci: boolean;\n strip: boolean;\n dryRun: boolean;\n findings: UnicodeScanFinding[];\n integrityOk: boolean;\n policyBlocks: boolean;\n}): number {\n if (result.policyBlocks) {\n return 1;\n }\n if (result.ci) {\n return hasCriticalUnicode(result.findings) || !result.integrityOk ? 1 : 0;\n }\n if (result.strip && !result.dryRun) {\n return 0;\n }\n if (hasCriticalUnicode(result.findings)) return 1;\n if (result.findings.some((finding) => finding.severity === \"warning\")) return 2;\n return 0;\n}\n\nexport function auditProject(options: AuditOptions = {}): AuditResult {\n if (options.ci && options.strip) {\n throw new AuditUsageError(\"--ci cannot be combined with --strip\");\n }\n if (options.ci && options.file) {\n throw new AuditUsageError(\"--ci cannot be combined with --file\");\n }\n if (options.ci && options.dryRun) {\n throw new AuditUsageError(\"--ci cannot be combined with --dry-run\");\n }\n if (options.dryRun && !options.strip) {\n throw new AuditUsageError(\"--dry-run requires --strip\");\n }\n if (options.requirePolicy && !options.ci) {\n throw new AuditUsageError(\"--require-policy requires --ci\");\n }\n if (options.requirePolicy && options.file) {\n throw new AuditUsageError(\"--require-policy cannot be combined with --file\");\n }\n if (options.requirePolicy && options.strip) {\n throw new AuditUsageError(\"--require-policy cannot be combined with --strip\");\n }\n\n const projectRoot = resolve(options.projectRoot ?? process.cwd());\n const scannedFiles = options.file\n ? [resolveFileTarget(projectRoot, options.file)]\n : uniqueSorted([\n ...collectLockfileTargets(projectRoot).filter((relativePath) =>\n existsSync(join(projectRoot, relativePath)),\n ),\n ...collectSourceTargets(projectRoot),\n ]);\n\n const findings: UnicodeScanFinding[] = [];\n for (const relativePath of scannedFiles) {\n findings.push(...scanRelativeFile(projectRoot, relativePath));\n }\n\n const integrity = options.ci\n ? integrityForLock(projectRoot)\n : { ok: true, issues: [] as DeployedHashIssue[] };\n\n const policy = options.file\n ? skippedPolicy()\n : evaluateAuditPolicy(projectRoot, options);\n\n const stripped: Array<{ path: string; removed: number }> = [];\n if (options.strip && !policy.blocks) {\n for (const relativePath of scannedFiles) {\n const content = readRelativeText(projectRoot, relativePath);\n if (content === undefined) continue;\n const result = stripHiddenUnicode(content);\n if (result.removed === 0) continue;\n stripped.push({ path: relativePath, removed: result.removed });\n if (!options.dryRun) {\n writeFileSync(join(projectRoot, relativePath), result.text, \"utf8\");\n }\n }\n }\n\n const summary = summarizeUnicodeFindings(findings);\n return {\n findings,\n summary,\n integrity,\n policy,\n stripped,\n scannedFiles,\n exitCode: exitCodeFor({\n ci: options.ci === true,\n strip: options.strip === true,\n dryRun: options.dryRun === true,\n findings,\n integrityOk: integrity.ok,\n policyBlocks: policy.blocks,\n }),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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