audit-tools 0.30.0 → 0.30.2
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/audit/adapters/astGrep.d.ts +30 -0
- package/dist/audit/adapters/astGrep.d.ts.map +1 -0
- package/dist/audit/adapters/astGrep.js +46 -0
- package/dist/audit/adapters/astGrep.js.map +1 -0
- package/dist/audit/adapters/codeql.d.ts +47 -0
- package/dist/audit/adapters/codeql.d.ts.map +1 -0
- package/dist/audit/adapters/codeql.js +52 -0
- package/dist/audit/adapters/codeql.js.map +1 -0
- package/dist/audit/adapters/normalizeExternal.d.ts +24 -1
- package/dist/audit/adapters/normalizeExternal.d.ts.map +1 -1
- package/dist/audit/adapters/normalizeExternal.js +50 -0
- package/dist/audit/adapters/normalizeExternal.js.map +1 -1
- package/dist/audit/adapters/semgrep.d.ts +34 -15
- package/dist/audit/adapters/semgrep.d.ts.map +1 -1
- package/dist/audit/adapters/semgrep.js +54 -1
- package/dist/audit/adapters/semgrep.js.map +1 -1
- package/dist/audit/cli/mergeAndIngestCommand.d.ts +29 -1
- package/dist/audit/cli/mergeAndIngestCommand.d.ts.map +1 -1
- package/dist/audit/cli/mergeAndIngestCommand.js +71 -5
- package/dist/audit/cli/mergeAndIngestCommand.js.map +1 -1
- package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
- package/dist/audit/cli/nextStepHelpers.js +7 -6
- package/dist/audit/cli/nextStepHelpers.js.map +1 -1
- package/dist/audit/cli/resynthesizeCommand.d.ts.map +1 -1
- package/dist/audit/cli/resynthesizeCommand.js +3 -3
- package/dist/audit/cli/resynthesizeCommand.js.map +1 -1
- package/dist/audit/cli/submitPacketCommand.d.ts.map +1 -1
- package/dist/audit/cli/submitPacketCommand.js +6 -1
- package/dist/audit/cli/submitPacketCommand.js.map +1 -1
- package/dist/audit/contracts/workerSchemas.d.ts +13 -13
- package/dist/audit/contracts/workerSchemas.d.ts.map +1 -1
- package/dist/audit/contracts/workerSchemas.js +1 -1
- package/dist/audit/contracts/workerSchemas.js.map +1 -1
- package/dist/audit/contracts/wrapperResponse.d.ts +7 -0
- package/dist/audit/contracts/wrapperResponse.d.ts.map +1 -1
- package/dist/audit/contracts/wrapperResponse.js +1 -0
- package/dist/audit/contracts/wrapperResponse.js.map +1 -1
- package/dist/audit/extractors/graph.d.ts.map +1 -1
- package/dist/audit/extractors/graph.js +47 -0
- package/dist/audit/extractors/graph.js.map +1 -1
- package/dist/audit/io/artifacts.d.ts +2 -2
- package/dist/audit/io/artifacts.d.ts.map +1 -1
- package/dist/audit/io/artifacts.js +14 -11
- package/dist/audit/io/artifacts.js.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.d.ts +17 -0
- package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
- package/dist/audit/orchestrator/designReviewPrompt.js +26 -0
- package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
- package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
- package/dist/audit/orchestrator/executorRunners.js +20 -0
- package/dist/audit/orchestrator/executorRunners.js.map +1 -1
- package/dist/audit/orchestrator/executors.d.ts.map +1 -1
- package/dist/audit/orchestrator/executors.js +5 -0
- package/dist/audit/orchestrator/executors.js.map +1 -1
- package/dist/audit/orchestrator/nextStep.d.ts +37 -0
- package/dist/audit/orchestrator/nextStep.d.ts.map +1 -1
- package/dist/audit/orchestrator/nextStep.js +45 -0
- package/dist/audit/orchestrator/nextStep.js.map +1 -1
- package/dist/audit/supervisor/operatorHandoff.d.ts +12 -0
- package/dist/audit/supervisor/operatorHandoff.d.ts.map +1 -1
- package/dist/audit/supervisor/operatorHandoff.js +3 -1
- package/dist/audit/supervisor/operatorHandoff.js.map +1 -1
- package/dist/audit/types/externalAnalyzer.d.ts +68 -2
- package/dist/audit/types/externalAnalyzer.d.ts.map +1 -1
- package/dist/audit/types/externalAnalyzer.js +23 -0
- package/dist/audit/types/externalAnalyzer.js.map +1 -1
- package/dist/audit/types/reviewPlanning.d.ts +14 -14
- package/dist/audit/validation/auditResults.d.ts +17 -0
- package/dist/audit/validation/auditResults.d.ts.map +1 -1
- package/dist/audit/validation/auditResults.js +39 -0
- package/dist/audit/validation/auditResults.js.map +1 -1
- package/dist/audit/validation/sessionConfig.d.ts.map +1 -1
- package/dist/audit/validation/sessionConfig.js +4 -0
- package/dist/audit/validation/sessionConfig.js.map +1 -1
- package/dist/remediate/review/autonomousGate.d.ts +74 -0
- package/dist/remediate/review/autonomousGate.d.ts.map +1 -0
- package/dist/remediate/review/autonomousGate.js +179 -0
- package/dist/remediate/review/autonomousGate.js.map +1 -0
- package/dist/remediate/steps/contractPipeline.d.ts +8 -0
- package/dist/remediate/steps/contractPipeline.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipeline.js +1 -0
- package/dist/remediate/steps/contractPipeline.js.map +1 -1
- package/dist/remediate/steps/contractPipelinePrompts.d.ts +10 -0
- package/dist/remediate/steps/contractPipelinePrompts.d.ts.map +1 -1
- package/dist/remediate/steps/contractPipelinePrompts.js +32 -1
- package/dist/remediate/steps/contractPipelinePrompts.js.map +1 -1
- package/dist/remediate/steps/nextStep.d.ts +34 -0
- package/dist/remediate/steps/nextStep.d.ts.map +1 -1
- package/dist/remediate/steps/nextStep.js +144 -8
- package/dist/remediate/steps/nextStep.js.map +1 -1
- package/dist/shared/index.d.ts +11 -2
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +6 -2
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/io/auditToolsPaths.d.ts +35 -0
- package/dist/shared/io/auditToolsPaths.d.ts.map +1 -1
- package/dist/shared/io/auditToolsPaths.js +46 -1
- package/dist/shared/io/auditToolsPaths.js.map +1 -1
- package/dist/shared/io/frictionCapture.d.ts +83 -0
- package/dist/shared/io/frictionCapture.d.ts.map +1 -0
- package/dist/shared/io/frictionCapture.js +79 -0
- package/dist/shared/io/frictionCapture.js.map +1 -0
- package/dist/shared/io/gitignoreArtifacts.d.ts +94 -0
- package/dist/shared/io/gitignoreArtifacts.d.ts.map +1 -0
- package/dist/shared/io/gitignoreArtifacts.js +147 -0
- package/dist/shared/io/gitignoreArtifacts.js.map +1 -0
- package/dist/shared/quota/antigravityQuotaSource.d.ts.map +1 -1
- package/dist/shared/quota/antigravityQuotaSource.js +2 -0
- package/dist/shared/quota/antigravityQuotaSource.js.map +1 -1
- package/dist/shared/quota/claudeOAuthQuotaSource.d.ts +35 -2
- package/dist/shared/quota/claudeOAuthQuotaSource.d.ts.map +1 -1
- package/dist/shared/quota/claudeOAuthQuotaSource.js +157 -17
- package/dist/shared/quota/claudeOAuthQuotaSource.js.map +1 -1
- package/dist/shared/quota/codexQuotaSource.d.ts.map +1 -1
- package/dist/shared/quota/codexQuotaSource.js +2 -0
- package/dist/shared/quota/codexQuotaSource.js.map +1 -1
- package/dist/shared/quota/copilotQuotaSource.d.ts.map +1 -1
- package/dist/shared/quota/copilotQuotaSource.js +2 -0
- package/dist/shared/quota/copilotQuotaSource.js.map +1 -1
- package/dist/shared/quota/errorParsing.d.ts +19 -0
- package/dist/shared/quota/errorParsing.d.ts.map +1 -1
- package/dist/shared/quota/errorParsing.js +14 -1
- package/dist/shared/quota/errorParsing.js.map +1 -1
- package/dist/shared/quota/hostSessionQuotaSource.d.ts +138 -0
- package/dist/shared/quota/hostSessionQuotaSource.d.ts.map +1 -0
- package/dist/shared/quota/hostSessionQuotaSource.js +213 -0
- package/dist/shared/quota/hostSessionQuotaSource.js.map +1 -0
- package/dist/shared/quota/httpQuotaSource.d.ts +7 -3
- package/dist/shared/quota/httpQuotaSource.d.ts.map +1 -1
- package/dist/shared/quota/httpQuotaSource.js.map +1 -1
- package/dist/shared/reporting/auditDeliverable.d.ts +36 -0
- package/dist/shared/reporting/auditDeliverable.d.ts.map +1 -0
- package/dist/shared/reporting/auditDeliverable.js +85 -0
- package/dist/shared/reporting/auditDeliverable.js.map +1 -0
- package/dist/shared/types/sessionConfig.d.ts +13 -0
- package/dist/shared/types/sessionConfig.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/audit_result.schema.json +2 -2
- package/schemas/audit_results.schema.json +2 -2
- package/schemas/finding.schema.json +2 -2
- package/scripts/postinstall.mjs +64 -0
|
@@ -13,6 +13,19 @@
|
|
|
13
13
|
* explicit artifacts-dir override should honor the override verbatim and fall
|
|
14
14
|
* back to these helpers only for the default.
|
|
15
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* Canonical deliverable filenames shared by both halves of the pipeline. The
|
|
18
|
+
* audit half renders `audit-report.md` (human) from `audit-findings.json`
|
|
19
|
+
* (machine contract); the remediation half writes `remediation-report.md` /
|
|
20
|
+
* `remediation-outcomes.json`. These live here, in exactly one place, so the
|
|
21
|
+
* synthesis writer, the promote source/dest, the present_report prompt path,
|
|
22
|
+
* and the remediation close writer cannot drift to different spellings — a
|
|
23
|
+
* drift that previously surfaced as a promote-time ENOENT.
|
|
24
|
+
*/
|
|
25
|
+
export declare const AUDIT_REPORT_FILENAME = "audit-report.md";
|
|
26
|
+
export declare const AUDIT_FINDINGS_FILENAME = "audit-findings.json";
|
|
27
|
+
export declare const REMEDIATION_REPORT_FILENAME = "remediation-report.md";
|
|
28
|
+
export declare const REMEDIATION_OUTCOMES_FILENAME = "remediation-outcomes.json";
|
|
16
29
|
/** `<root>/.audit-tools` (absolute). */
|
|
17
30
|
export declare function auditToolsDir(root: string): string;
|
|
18
31
|
/** `<root>/.audit-tools/audit` — audit-code's default artifacts dir (absolute). */
|
|
@@ -33,4 +46,26 @@ export declare function stepsDir(artifactsDir: string): string;
|
|
|
33
46
|
* and externally supplied evidence. Takes an already-resolved artifacts dir.
|
|
34
47
|
*/
|
|
35
48
|
export declare function incomingDir(artifactsDir: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* `<artifactsDir>/audit-report.md` — where synthesis renders the human report
|
|
51
|
+
* and the promote step reads it FROM. Source and write target derive from this
|
|
52
|
+
* one helper so they are byte-identical.
|
|
53
|
+
*/
|
|
54
|
+
export declare function auditReportPath(artifactsDir: string): string;
|
|
55
|
+
/** `<artifactsDir>/audit-findings.json` — the canonical machine contract. */
|
|
56
|
+
export declare function auditFindingsPath(artifactsDir: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* `<dirname(artifactsDir)>/audit-report.md` — the promote destination, one
|
|
59
|
+
* level up from the working artifacts dir (i.e. `.audit-tools/audit-report.md`
|
|
60
|
+
* for the canonical `.audit-tools/audit/` artifacts dir). This is also where
|
|
61
|
+
* the present_report prompt points and where remediate-code probes first.
|
|
62
|
+
*/
|
|
63
|
+
export declare function promotedAuditReportPath(artifactsDir: string): string;
|
|
64
|
+
/** `<dirname(artifactsDir)>/audit-findings.json` — promoted machine contract. */
|
|
65
|
+
export declare function promotedAuditFindingsPath(artifactsDir: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* The directory deliverables are promoted INTO: the parent of the working
|
|
68
|
+
* artifacts dir. Single-sourced so every promote/present consumer agrees.
|
|
69
|
+
*/
|
|
70
|
+
export declare function outputDirFor(artifactsDir: string): string;
|
|
36
71
|
//# sourceMappingURL=auditToolsPaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auditToolsPaths.d.ts","sourceRoot":"","sources":["../../../src/shared/io/auditToolsPaths.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,wCAAwC;AACxC,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAExD"}
|
|
1
|
+
{"version":3,"file":"auditToolsPaths.d.ts","sourceRoot":"","sources":["../../../src/shared/io/auditToolsPaths.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AACvD,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAC7D,eAAO,MAAM,2BAA2B,0BAA0B,CAAC;AACnE,eAAO,MAAM,6BAA6B,8BAA8B,CAAC;AAEzE,wCAAwC;AACxC,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,iFAAiF;AACjF,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEzD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { join, resolve } from "node:path";
|
|
1
|
+
import { dirname, join, resolve } from "node:path";
|
|
2
2
|
/**
|
|
3
3
|
* Single source of truth for the on-disk `.audit-tools/` layout shared by both
|
|
4
4
|
* orchestrators. Every path is derived from a passed repository root (or, for
|
|
@@ -14,6 +14,19 @@ import { join, resolve } from "node:path";
|
|
|
14
14
|
* explicit artifacts-dir override should honor the override verbatim and fall
|
|
15
15
|
* back to these helpers only for the default.
|
|
16
16
|
*/
|
|
17
|
+
/**
|
|
18
|
+
* Canonical deliverable filenames shared by both halves of the pipeline. The
|
|
19
|
+
* audit half renders `audit-report.md` (human) from `audit-findings.json`
|
|
20
|
+
* (machine contract); the remediation half writes `remediation-report.md` /
|
|
21
|
+
* `remediation-outcomes.json`. These live here, in exactly one place, so the
|
|
22
|
+
* synthesis writer, the promote source/dest, the present_report prompt path,
|
|
23
|
+
* and the remediation close writer cannot drift to different spellings — a
|
|
24
|
+
* drift that previously surfaced as a promote-time ENOENT.
|
|
25
|
+
*/
|
|
26
|
+
export const AUDIT_REPORT_FILENAME = "audit-report.md";
|
|
27
|
+
export const AUDIT_FINDINGS_FILENAME = "audit-findings.json";
|
|
28
|
+
export const REMEDIATION_REPORT_FILENAME = "remediation-report.md";
|
|
29
|
+
export const REMEDIATION_OUTCOMES_FILENAME = "remediation-outcomes.json";
|
|
17
30
|
/** `<root>/.audit-tools` (absolute). */
|
|
18
31
|
export function auditToolsDir(root) {
|
|
19
32
|
return resolve(root, ".audit-tools");
|
|
@@ -44,4 +57,36 @@ export function stepsDir(artifactsDir) {
|
|
|
44
57
|
export function incomingDir(artifactsDir) {
|
|
45
58
|
return join(artifactsDir, "incoming");
|
|
46
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* `<artifactsDir>/audit-report.md` — where synthesis renders the human report
|
|
62
|
+
* and the promote step reads it FROM. Source and write target derive from this
|
|
63
|
+
* one helper so they are byte-identical.
|
|
64
|
+
*/
|
|
65
|
+
export function auditReportPath(artifactsDir) {
|
|
66
|
+
return join(artifactsDir, AUDIT_REPORT_FILENAME);
|
|
67
|
+
}
|
|
68
|
+
/** `<artifactsDir>/audit-findings.json` — the canonical machine contract. */
|
|
69
|
+
export function auditFindingsPath(artifactsDir) {
|
|
70
|
+
return join(artifactsDir, AUDIT_FINDINGS_FILENAME);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* `<dirname(artifactsDir)>/audit-report.md` — the promote destination, one
|
|
74
|
+
* level up from the working artifacts dir (i.e. `.audit-tools/audit-report.md`
|
|
75
|
+
* for the canonical `.audit-tools/audit/` artifacts dir). This is also where
|
|
76
|
+
* the present_report prompt points and where remediate-code probes first.
|
|
77
|
+
*/
|
|
78
|
+
export function promotedAuditReportPath(artifactsDir) {
|
|
79
|
+
return join(outputDirFor(artifactsDir), AUDIT_REPORT_FILENAME);
|
|
80
|
+
}
|
|
81
|
+
/** `<dirname(artifactsDir)>/audit-findings.json` — promoted machine contract. */
|
|
82
|
+
export function promotedAuditFindingsPath(artifactsDir) {
|
|
83
|
+
return join(outputDirFor(artifactsDir), AUDIT_FINDINGS_FILENAME);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The directory deliverables are promoted INTO: the parent of the working
|
|
87
|
+
* artifacts dir. Single-sourced so every promote/present consumer agrees.
|
|
88
|
+
*/
|
|
89
|
+
export function outputDirFor(artifactsDir) {
|
|
90
|
+
return dirname(artifactsDir);
|
|
91
|
+
}
|
|
47
92
|
//# sourceMappingURL=auditToolsPaths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auditToolsPaths.js","sourceRoot":"","sources":["../../../src/shared/io/auditToolsPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"auditToolsPaths.js","sourceRoot":"","sources":["../../../src/shared/io/auditToolsPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,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AAC,YAAoB;IAC5D,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,uBAAuB,CAAC,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,YAAoB;IAC/C,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool-emitted end-of-run friction capture, single-sourced for BOTH orchestrators
|
|
3
|
+
* (audit-code + remediate-code) so the artifact shape, filename, persist helper,
|
|
4
|
+
* and "already captured?" check cannot drift between the two halves of the
|
|
5
|
+
* pipeline. The host (the active LLM agent) owns ONLY the friction CONTENT; the
|
|
6
|
+
* tool owns the structure, the filename, the per-run `run_id` key, and the
|
|
7
|
+
* `schema_version`.
|
|
8
|
+
*
|
|
9
|
+
* Properties this module guarantees (the obligation that drives the close-out
|
|
10
|
+
* lives in each orchestrator's nextStep; this is the shared substrate):
|
|
11
|
+
* - DETERMINISTIC: the persist + the "captured?" probe are pure file ops keyed
|
|
12
|
+
* only off `(artifactsDir, run_id)`, never host discretion.
|
|
13
|
+
* - PARITY: one shape, one helper — both orchestrators import the same code, so
|
|
14
|
+
* a divergent spelling is impossible.
|
|
15
|
+
* - DEGRADE-CLEANLY: a run with ZERO frictions still writes a valid artifact
|
|
16
|
+
* (`frictions: []`) and counts as captured, so the close-out never blocks
|
|
17
|
+
* completion.
|
|
18
|
+
* - NEVER RE-LOOP: once an artifact exists for a `run_id`, `frictionCaptured`
|
|
19
|
+
* is true and the obligation short-circuits — the close-out fires at most once
|
|
20
|
+
* per run.
|
|
21
|
+
* - OS/PATH-AGNOSTIC: every path derives from `node:path` joins off the supplied
|
|
22
|
+
* artifacts dir, never a platform-baked literal.
|
|
23
|
+
*
|
|
24
|
+
* This module NEVER references a specific project's docs/backlog.md: the friction
|
|
25
|
+
* artifact is a per-project, per-run record under the run's own artifacts dir; it
|
|
26
|
+
* is not coupled to any one repository's tracking doc.
|
|
27
|
+
*/
|
|
28
|
+
export declare const FRICTION_CAPTURE_SCHEMA_VERSION = "friction-capture/v1alpha1";
|
|
29
|
+
/** Subdirectory under the artifacts dir holding per-run friction records. */
|
|
30
|
+
export declare const FRICTION_CAPTURE_DIRNAME = "friction";
|
|
31
|
+
/** One friction item the host recorded. Only `note` is required. */
|
|
32
|
+
export interface FrictionItem {
|
|
33
|
+
/** Free-form description of the friction hit this run. */
|
|
34
|
+
note: string;
|
|
35
|
+
/** Optional severity hint, host-supplied. */
|
|
36
|
+
severity?: "info" | "low" | "medium" | "high";
|
|
37
|
+
/** Optional category: a bug/defect vs. a standing environment/tooling trap. */
|
|
38
|
+
category?: "bug" | "trap" | "suggestion";
|
|
39
|
+
/** Optional path/area the friction relates to. */
|
|
40
|
+
area?: string;
|
|
41
|
+
}
|
|
42
|
+
/** The per-run friction artifact. The tool owns every field except `frictions`. */
|
|
43
|
+
export interface FrictionCaptureArtifact {
|
|
44
|
+
schema_version: typeof FRICTION_CAPTURE_SCHEMA_VERSION;
|
|
45
|
+
/** Which orchestrator emitted this record. */
|
|
46
|
+
tool: "audit-code" | "remediate-code";
|
|
47
|
+
/** Per-project run id this close-out belongs to. */
|
|
48
|
+
run_id: string;
|
|
49
|
+
/** ISO timestamp the record was persisted. */
|
|
50
|
+
captured_at: string;
|
|
51
|
+
/** Host-supplied friction content; an empty array is the clean-degrade case. */
|
|
52
|
+
frictions: FrictionItem[];
|
|
53
|
+
}
|
|
54
|
+
/** `<artifactsDir>/friction` — where per-run friction records live (absolute). */
|
|
55
|
+
export declare function frictionCaptureDir(artifactsDir: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* `<artifactsDir>/friction/<run_id>.json` — the per-run, run_id-keyed friction
|
|
58
|
+
* record path. The run_id is sanitized to a filename-safe token so an arbitrary
|
|
59
|
+
* run id (plan ids, ledger run ids) never escapes the friction dir or collides
|
|
60
|
+
* with path separators across OSes.
|
|
61
|
+
*/
|
|
62
|
+
export declare function frictionCapturePath(artifactsDir: string, runId: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Whether this run's friction close-out has already been captured. Pure read; a
|
|
65
|
+
* record present (even with zero frictions) means the close-out fired — the
|
|
66
|
+
* obligation must short-circuit so it never re-loops.
|
|
67
|
+
*/
|
|
68
|
+
export declare function frictionCaptured(artifactsDir: string, runId: string): Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Persist the per-run friction artifact via a SINGLE shared atomic write
|
|
71
|
+
* (`writeJsonFile` is temp-then-rename). The tool stamps `schema_version`,
|
|
72
|
+
* `run_id`, `tool`, and `captured_at`; the caller supplies only the
|
|
73
|
+
* host-recorded `frictions` (defaulting to `[]` for the clean-degrade case).
|
|
74
|
+
* Idempotent enough for a close-out: re-persisting overwrites the same run_id
|
|
75
|
+
* record atomically.
|
|
76
|
+
*/
|
|
77
|
+
export declare function persistFrictionCapture(params: {
|
|
78
|
+
artifactsDir: string;
|
|
79
|
+
runId: string;
|
|
80
|
+
tool: FrictionCaptureArtifact["tool"];
|
|
81
|
+
frictions?: FrictionItem[];
|
|
82
|
+
}): Promise<FrictionCaptureArtifact>;
|
|
83
|
+
//# sourceMappingURL=frictionCapture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frictionCapture.d.ts","sourceRoot":"","sources":["../../../src/shared/io/frictionCapture.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,+BAA+B,8BAA8B,CAAC;AAE3E,6EAA6E;AAC7E,eAAO,MAAM,wBAAwB,aAAa,CAAC;AAEnD,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,YAAY,CAAC;IACzC,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,mFAAmF;AACnF,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,OAAO,+BAA+B,CAAC;IACvD,8CAA8C;IAC9C,IAAI,EAAE,YAAY,GAAG,gBAAgB,CAAC;IACtC,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/E;AAQD;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACtC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;CAC5B,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAUnC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { readOptionalJsonFile, writeJsonFile } from "./json.js";
|
|
3
|
+
/**
|
|
4
|
+
* Tool-emitted end-of-run friction capture, single-sourced for BOTH orchestrators
|
|
5
|
+
* (audit-code + remediate-code) so the artifact shape, filename, persist helper,
|
|
6
|
+
* and "already captured?" check cannot drift between the two halves of the
|
|
7
|
+
* pipeline. The host (the active LLM agent) owns ONLY the friction CONTENT; the
|
|
8
|
+
* tool owns the structure, the filename, the per-run `run_id` key, and the
|
|
9
|
+
* `schema_version`.
|
|
10
|
+
*
|
|
11
|
+
* Properties this module guarantees (the obligation that drives the close-out
|
|
12
|
+
* lives in each orchestrator's nextStep; this is the shared substrate):
|
|
13
|
+
* - DETERMINISTIC: the persist + the "captured?" probe are pure file ops keyed
|
|
14
|
+
* only off `(artifactsDir, run_id)`, never host discretion.
|
|
15
|
+
* - PARITY: one shape, one helper — both orchestrators import the same code, so
|
|
16
|
+
* a divergent spelling is impossible.
|
|
17
|
+
* - DEGRADE-CLEANLY: a run with ZERO frictions still writes a valid artifact
|
|
18
|
+
* (`frictions: []`) and counts as captured, so the close-out never blocks
|
|
19
|
+
* completion.
|
|
20
|
+
* - NEVER RE-LOOP: once an artifact exists for a `run_id`, `frictionCaptured`
|
|
21
|
+
* is true and the obligation short-circuits — the close-out fires at most once
|
|
22
|
+
* per run.
|
|
23
|
+
* - OS/PATH-AGNOSTIC: every path derives from `node:path` joins off the supplied
|
|
24
|
+
* artifacts dir, never a platform-baked literal.
|
|
25
|
+
*
|
|
26
|
+
* This module NEVER references a specific project's docs/backlog.md: the friction
|
|
27
|
+
* artifact is a per-project, per-run record under the run's own artifacts dir; it
|
|
28
|
+
* is not coupled to any one repository's tracking doc.
|
|
29
|
+
*/
|
|
30
|
+
export const FRICTION_CAPTURE_SCHEMA_VERSION = "friction-capture/v1alpha1";
|
|
31
|
+
/** Subdirectory under the artifacts dir holding per-run friction records. */
|
|
32
|
+
export const FRICTION_CAPTURE_DIRNAME = "friction";
|
|
33
|
+
/** `<artifactsDir>/friction` — where per-run friction records live (absolute). */
|
|
34
|
+
export function frictionCaptureDir(artifactsDir) {
|
|
35
|
+
return join(artifactsDir, FRICTION_CAPTURE_DIRNAME);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* `<artifactsDir>/friction/<run_id>.json` — the per-run, run_id-keyed friction
|
|
39
|
+
* record path. The run_id is sanitized to a filename-safe token so an arbitrary
|
|
40
|
+
* run id (plan ids, ledger run ids) never escapes the friction dir or collides
|
|
41
|
+
* with path separators across OSes.
|
|
42
|
+
*/
|
|
43
|
+
export function frictionCapturePath(artifactsDir, runId) {
|
|
44
|
+
return join(frictionCaptureDir(artifactsDir), `${sanitizeRunId(runId)}.json`);
|
|
45
|
+
}
|
|
46
|
+
/** Reduce a run id to a stable, filename-safe token (OS-agnostic). */
|
|
47
|
+
function sanitizeRunId(runId) {
|
|
48
|
+
const cleaned = runId.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
49
|
+
return cleaned.length > 0 ? cleaned : "run";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Whether this run's friction close-out has already been captured. Pure read; a
|
|
53
|
+
* record present (even with zero frictions) means the close-out fired — the
|
|
54
|
+
* obligation must short-circuit so it never re-loops.
|
|
55
|
+
*/
|
|
56
|
+
export async function frictionCaptured(artifactsDir, runId) {
|
|
57
|
+
const existing = await readOptionalJsonFile(frictionCapturePath(artifactsDir, runId));
|
|
58
|
+
return existing !== undefined && existing !== null;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Persist the per-run friction artifact via a SINGLE shared atomic write
|
|
62
|
+
* (`writeJsonFile` is temp-then-rename). The tool stamps `schema_version`,
|
|
63
|
+
* `run_id`, `tool`, and `captured_at`; the caller supplies only the
|
|
64
|
+
* host-recorded `frictions` (defaulting to `[]` for the clean-degrade case).
|
|
65
|
+
* Idempotent enough for a close-out: re-persisting overwrites the same run_id
|
|
66
|
+
* record atomically.
|
|
67
|
+
*/
|
|
68
|
+
export async function persistFrictionCapture(params) {
|
|
69
|
+
const artifact = {
|
|
70
|
+
schema_version: FRICTION_CAPTURE_SCHEMA_VERSION,
|
|
71
|
+
tool: params.tool,
|
|
72
|
+
run_id: params.runId,
|
|
73
|
+
captured_at: new Date().toISOString(),
|
|
74
|
+
frictions: params.frictions ?? [],
|
|
75
|
+
};
|
|
76
|
+
await writeJsonFile(frictionCapturePath(params.artifactsDir, params.runId), artifact);
|
|
77
|
+
return artifact;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=frictionCapture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frictionCapture.js","sourceRoot":"","sources":["../../../src/shared/io/frictionCapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,2BAA2B,CAAC;AAE3E,6EAA6E;AAC7E,MAAM,CAAC,MAAM,wBAAwB,GAAG,UAAU,CAAC;AA2BnD,kFAAkF;AAClF,MAAM,UAAU,kBAAkB,CAAC,YAAoB;IACrD,OAAO,IAAI,CAAC,YAAY,EAAE,wBAAwB,CAAC,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAAoB,EAAE,KAAa;IACrE,OAAO,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAChF,CAAC;AAED,sEAAsE;AACtE,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAChF,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,YAAoB,EACpB,KAAa;IAEb,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CACzC,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,CACzC,CAAC;IACF,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,CAAC;AACrD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,MAK5C;IACC,MAAM,QAAQ,GAA4B;QACxC,cAAc,EAAE,+BAA+B;QAC/C,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAM,CAAC,KAAK;QACpB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE;KAClC,CAAC;IACF,MAAM,aAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC;IACtF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install/ensure-time `.gitignore` management for the artifacts audit-tools emits
|
|
3
|
+
* into a consuming repo's working tree. Single-sourced (TS, shared) so both
|
|
4
|
+
* orchestrators and the postinstall agree on WHICH paths are build/install
|
|
5
|
+
* artifacts vs. visibility-conditional deliverables — the ignore patterns are
|
|
6
|
+
* derived from the same canonical filename constants the writers use, never
|
|
7
|
+
* re-spelled here, so a renamed deliverable can never drift out of the ignore
|
|
8
|
+
* set.
|
|
9
|
+
*
|
|
10
|
+
* Two tiers (from docs/backlog.md, Ethan 2026-06-22):
|
|
11
|
+
* - ALWAYS-ignore: generated host/skill/install assets + the per-run friction
|
|
12
|
+
* CAPTURE sidecar. These are build/install artifacts; never tracked, every
|
|
13
|
+
* platform, unconditionally.
|
|
14
|
+
* - VISIBILITY-CONDITIONAL: the process-conclusion deliverables
|
|
15
|
+
* (audit/remediation report + machine contract) and the meta-audit
|
|
16
|
+
* reflections file. Private repo => keep tracked; public repo => ignore by
|
|
17
|
+
* default (don't publish internal findings/reflections unless opted in).
|
|
18
|
+
*
|
|
19
|
+
* Everything here is OS-agnostic: `.gitignore` patterns are always written with
|
|
20
|
+
* forward slashes and LF, regardless of host platform — git itself uses POSIX
|
|
21
|
+
* separators in ignore files on every OS.
|
|
22
|
+
*/
|
|
23
|
+
/** Repo visibility as it drives the conditional ignore decision. */
|
|
24
|
+
export type RepoVisibility = "private" | "public";
|
|
25
|
+
/**
|
|
26
|
+
* Always-ignored generated assets (build/install artifacts). Forward slashes +
|
|
27
|
+
* trailing slash for directories so git treats them as dir matches on every OS.
|
|
28
|
+
* `.audit-code/` is the host renderer / install-asset + generated-skill tree;
|
|
29
|
+
* the friction CAPTURE sidecar is matched per-artifacts-dir (audit + remediation).
|
|
30
|
+
*/
|
|
31
|
+
export declare const ALWAYS_IGNORE_PATTERNS: readonly string[];
|
|
32
|
+
/**
|
|
33
|
+
* Visibility-conditional ignores: the canonical deliverables (imported from the
|
|
34
|
+
* shared filename constants, never hardcoded literals) promoted into
|
|
35
|
+
* `.audit-tools/`, plus the meta-audit reflections file appended under each
|
|
36
|
+
* artifacts dir. Ignored only when the repo is public.
|
|
37
|
+
*/
|
|
38
|
+
export declare const VISIBILITY_CONDITIONAL_PATTERNS: readonly string[];
|
|
39
|
+
/** Anchored marker block so re-runs replace OUR lines and never clobber user lines. */
|
|
40
|
+
export declare const GITIGNORE_BLOCK_BEGIN = "# >>> audit-tools managed ignores >>>";
|
|
41
|
+
export declare const GITIGNORE_BLOCK_END = "# <<< audit-tools managed ignores <<<";
|
|
42
|
+
/**
|
|
43
|
+
* Render the managed block body (between markers) for a given visibility. The
|
|
44
|
+
* always-ignore patterns are present for BOTH private and public; the
|
|
45
|
+
* conditional patterns appear only for public.
|
|
46
|
+
*/
|
|
47
|
+
export declare function renderGitignoreBlock(visibility: RepoVisibility): string;
|
|
48
|
+
/**
|
|
49
|
+
* Idempotent additive merge of the managed block into an existing `.gitignore`
|
|
50
|
+
* body. If a prior managed block exists (matched by the anchored markers) it is
|
|
51
|
+
* replaced in place; user lines outside the markers are never touched. A re-run
|
|
52
|
+
* with the same visibility yields byte-identical output (no duplicate blocks).
|
|
53
|
+
* Output is always LF-normalized with a single trailing newline.
|
|
54
|
+
*/
|
|
55
|
+
export declare function mergeGitignoreBlock(existing: string, block: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Detect repo visibility, degrade-safe. Order of authority:
|
|
58
|
+
* 1. An explicit operator override (config flag / env) ALWAYS wins.
|
|
59
|
+
* 2. Otherwise probe `gh repo view --json isPrivate` via the injected runner.
|
|
60
|
+
* 3. If gh is missing/errors/returns unparseable output, fall back to the
|
|
61
|
+
* default-safe `unknown => private` (keep deliverables tracked). NEVER throws.
|
|
62
|
+
*
|
|
63
|
+
* `runGh` is injected so tests stub it (no live gh, OS-agnostic). It returns the
|
|
64
|
+
* raw stdout of the gh call, or null on any failure.
|
|
65
|
+
*/
|
|
66
|
+
export declare function detectRepoVisibility(params: {
|
|
67
|
+
repoRoot: string;
|
|
68
|
+
/** Explicit operator override; when set it wins unconditionally. */
|
|
69
|
+
override?: RepoVisibility | null;
|
|
70
|
+
/** Injected gh runner: returns gh stdout, or null if gh is unavailable/failed. */
|
|
71
|
+
runGh?: (repoRoot: string) => string | null;
|
|
72
|
+
}): RepoVisibility;
|
|
73
|
+
/**
|
|
74
|
+
* Ensure the consuming repo's `.gitignore` carries the managed block for the
|
|
75
|
+
* resolved visibility. Pure-ish: all side effects go through injected fs hooks
|
|
76
|
+
* so tests run without touching disk. NEVER throws — any error degrades to a
|
|
77
|
+
* no-op result so postinstall can never fail over gitignore management.
|
|
78
|
+
*
|
|
79
|
+
* Returns the resolved visibility and whether the file content changed.
|
|
80
|
+
*/
|
|
81
|
+
export declare function ensureArtifactGitignore(params: {
|
|
82
|
+
repoRoot: string;
|
|
83
|
+
override?: RepoVisibility | null;
|
|
84
|
+
runGh?: (repoRoot: string) => string | null;
|
|
85
|
+
/** Injected readers/writers (default to node:fs) for testability. */
|
|
86
|
+
fileExists?: (path: string) => boolean;
|
|
87
|
+
readFile?: (path: string) => string;
|
|
88
|
+
writeFile?: (path: string, content: string) => void;
|
|
89
|
+
}): {
|
|
90
|
+
visibility: RepoVisibility;
|
|
91
|
+
changed: boolean;
|
|
92
|
+
path: string;
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=gitignoreArtifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignoreArtifacts.d.ts","sourceRoot":"","sources":["../../../src/shared/io/gitignoreArtifacts.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAGnD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,EAAE,SAAS,MAAM,EAM5D,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,0CAA0C,CAAC;AAC7E,eAAO,MAAM,mBAAmB,0CAA0C,CAAC;AAE3E;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM,CAkBvE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAkB3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACjC,kFAAkF;IAClF,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CAC7C,GAAG,cAAc,CAyBjB;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC5C,qEAAqE;IACrE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD,GAAG;IAAE,UAAU,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA0BjE"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { AUDIT_REPORT_FILENAME, AUDIT_FINDINGS_FILENAME, REMEDIATION_REPORT_FILENAME, REMEDIATION_OUTCOMES_FILENAME, } from "./auditToolsPaths.js";
|
|
4
|
+
import { FRICTION_CAPTURE_DIRNAME } from "./frictionCapture.js";
|
|
5
|
+
import { AGENT_FEEDBACK_FILENAME } from "../agentReflections.js";
|
|
6
|
+
/**
|
|
7
|
+
* Always-ignored generated assets (build/install artifacts). Forward slashes +
|
|
8
|
+
* trailing slash for directories so git treats them as dir matches on every OS.
|
|
9
|
+
* `.audit-code/` is the host renderer / install-asset + generated-skill tree;
|
|
10
|
+
* the friction CAPTURE sidecar is matched per-artifacts-dir (audit + remediation).
|
|
11
|
+
*/
|
|
12
|
+
export const ALWAYS_IGNORE_PATTERNS = [
|
|
13
|
+
".audit-code/",
|
|
14
|
+
`.audit-tools/*/${FRICTION_CAPTURE_DIRNAME}/`,
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* Visibility-conditional ignores: the canonical deliverables (imported from the
|
|
18
|
+
* shared filename constants, never hardcoded literals) promoted into
|
|
19
|
+
* `.audit-tools/`, plus the meta-audit reflections file appended under each
|
|
20
|
+
* artifacts dir. Ignored only when the repo is public.
|
|
21
|
+
*/
|
|
22
|
+
export const VISIBILITY_CONDITIONAL_PATTERNS = [
|
|
23
|
+
`.audit-tools/${AUDIT_REPORT_FILENAME}`,
|
|
24
|
+
`.audit-tools/${AUDIT_FINDINGS_FILENAME}`,
|
|
25
|
+
`.audit-tools/${REMEDIATION_REPORT_FILENAME}`,
|
|
26
|
+
`.audit-tools/${REMEDIATION_OUTCOMES_FILENAME}`,
|
|
27
|
+
`.audit-tools/*/${AGENT_FEEDBACK_FILENAME}`,
|
|
28
|
+
];
|
|
29
|
+
/** Anchored marker block so re-runs replace OUR lines and never clobber user lines. */
|
|
30
|
+
export const GITIGNORE_BLOCK_BEGIN = "# >>> audit-tools managed ignores >>>";
|
|
31
|
+
export const GITIGNORE_BLOCK_END = "# <<< audit-tools managed ignores <<<";
|
|
32
|
+
/**
|
|
33
|
+
* Render the managed block body (between markers) for a given visibility. The
|
|
34
|
+
* always-ignore patterns are present for BOTH private and public; the
|
|
35
|
+
* conditional patterns appear only for public.
|
|
36
|
+
*/
|
|
37
|
+
export function renderGitignoreBlock(visibility) {
|
|
38
|
+
const lines = [
|
|
39
|
+
GITIGNORE_BLOCK_BEGIN,
|
|
40
|
+
"# Generated/install artifacts — always ignored (build artifacts, not source).",
|
|
41
|
+
...ALWAYS_IGNORE_PATTERNS,
|
|
42
|
+
];
|
|
43
|
+
if (visibility === "public") {
|
|
44
|
+
lines.push("# Deliverables + meta-audit reflections — ignored because this repo is public.", ...VISIBILITY_CONDITIONAL_PATTERNS);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
lines.push("# Deliverables + meta-audit reflections kept tracked (private repo).");
|
|
48
|
+
}
|
|
49
|
+
lines.push(GITIGNORE_BLOCK_END);
|
|
50
|
+
return lines.join("\n");
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Idempotent additive merge of the managed block into an existing `.gitignore`
|
|
54
|
+
* body. If a prior managed block exists (matched by the anchored markers) it is
|
|
55
|
+
* replaced in place; user lines outside the markers are never touched. A re-run
|
|
56
|
+
* with the same visibility yields byte-identical output (no duplicate blocks).
|
|
57
|
+
* Output is always LF-normalized with a single trailing newline.
|
|
58
|
+
*/
|
|
59
|
+
export function mergeGitignoreBlock(existing, block) {
|
|
60
|
+
const normalized = existing.replace(/\r\n/g, "\n");
|
|
61
|
+
const beginIdx = normalized.indexOf(GITIGNORE_BLOCK_BEGIN);
|
|
62
|
+
const endIdx = normalized.indexOf(GITIGNORE_BLOCK_END);
|
|
63
|
+
if (beginIdx !== -1 && endIdx !== -1 && endIdx > beginIdx) {
|
|
64
|
+
const before = normalized.slice(0, beginIdx).replace(/\n+$/, "");
|
|
65
|
+
const after = normalized
|
|
66
|
+
.slice(endIdx + GITIGNORE_BLOCK_END.length)
|
|
67
|
+
.replace(/^\n+/, "");
|
|
68
|
+
const head = before.length > 0 ? `${before}\n\n` : "";
|
|
69
|
+
const tail = after.length > 0 ? `\n\n${after}` : "";
|
|
70
|
+
return `${head}${block}${tail}`.replace(/\n*$/, "\n");
|
|
71
|
+
}
|
|
72
|
+
const base = normalized.replace(/\n+$/, "");
|
|
73
|
+
const head = base.length > 0 ? `${base}\n\n` : "";
|
|
74
|
+
return `${head}${block}`.replace(/\n*$/, "\n");
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Detect repo visibility, degrade-safe. Order of authority:
|
|
78
|
+
* 1. An explicit operator override (config flag / env) ALWAYS wins.
|
|
79
|
+
* 2. Otherwise probe `gh repo view --json isPrivate` via the injected runner.
|
|
80
|
+
* 3. If gh is missing/errors/returns unparseable output, fall back to the
|
|
81
|
+
* default-safe `unknown => private` (keep deliverables tracked). NEVER throws.
|
|
82
|
+
*
|
|
83
|
+
* `runGh` is injected so tests stub it (no live gh, OS-agnostic). It returns the
|
|
84
|
+
* raw stdout of the gh call, or null on any failure.
|
|
85
|
+
*/
|
|
86
|
+
export function detectRepoVisibility(params) {
|
|
87
|
+
if (params.override === "private" || params.override === "public") {
|
|
88
|
+
return params.override;
|
|
89
|
+
}
|
|
90
|
+
if (typeof params.runGh !== "function") {
|
|
91
|
+
return "private";
|
|
92
|
+
}
|
|
93
|
+
let stdout = null;
|
|
94
|
+
try {
|
|
95
|
+
stdout = params.runGh(params.repoRoot);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return "private";
|
|
99
|
+
}
|
|
100
|
+
if (typeof stdout !== "string" || stdout.trim().length === 0) {
|
|
101
|
+
return "private";
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
const parsed = JSON.parse(stdout);
|
|
105
|
+
if (parsed && typeof parsed.isPrivate === "boolean") {
|
|
106
|
+
return parsed.isPrivate ? "private" : "public";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// fall through to default-safe
|
|
111
|
+
}
|
|
112
|
+
return "private";
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Ensure the consuming repo's `.gitignore` carries the managed block for the
|
|
116
|
+
* resolved visibility. Pure-ish: all side effects go through injected fs hooks
|
|
117
|
+
* so tests run without touching disk. NEVER throws — any error degrades to a
|
|
118
|
+
* no-op result so postinstall can never fail over gitignore management.
|
|
119
|
+
*
|
|
120
|
+
* Returns the resolved visibility and whether the file content changed.
|
|
121
|
+
*/
|
|
122
|
+
export function ensureArtifactGitignore(params) {
|
|
123
|
+
const gitignorePath = join(params.repoRoot, ".gitignore");
|
|
124
|
+
const fileExists = params.fileExists ?? ((p) => existsSync(p));
|
|
125
|
+
const readFile = params.readFile ?? ((p) => readFileSync(p, "utf8"));
|
|
126
|
+
const writeFile = params.writeFile ?? ((p, c) => writeFileSync(p, c, "utf8"));
|
|
127
|
+
const visibility = detectRepoVisibility({
|
|
128
|
+
repoRoot: params.repoRoot,
|
|
129
|
+
override: params.override,
|
|
130
|
+
runGh: params.runGh,
|
|
131
|
+
});
|
|
132
|
+
try {
|
|
133
|
+
const block = renderGitignoreBlock(visibility);
|
|
134
|
+
const existing = fileExists(gitignorePath) ? readFile(gitignorePath) : "";
|
|
135
|
+
const merged = mergeGitignoreBlock(existing, block);
|
|
136
|
+
const changed = merged !== existing;
|
|
137
|
+
if (changed) {
|
|
138
|
+
writeFile(gitignorePath, merged);
|
|
139
|
+
}
|
|
140
|
+
return { visibility, changed, path: gitignorePath };
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
// Degrade to a no-op: gitignore management must never fail the install.
|
|
144
|
+
return { visibility, changed: false, path: gitignorePath };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=gitignoreArtifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignoreArtifacts.js","sourceRoot":"","sources":["../../../src/shared/io/gitignoreArtifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AA4BjE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACvD,cAAc;IACd,kBAAkB,wBAAwB,GAAG;CAC9C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAsB;IAChE,gBAAgB,qBAAqB,EAAE;IACvC,gBAAgB,uBAAuB,EAAE;IACzC,gBAAgB,2BAA2B,EAAE;IAC7C,gBAAg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,EAAE,iBAAiB,GACrB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAapC;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,mBAAmB,EACzB,KAAK,EAAE,MAAM,GACZ,kBAAkB,GAAG,IAAI,CAiB3B"}
|
|
@@ -62,6 +62,8 @@ export async function fetchAntigravityUsage(creds, ctx) {
|
|
|
62
62
|
}
|
|
63
63
|
/** Maps `fetchAvailableModels` → least-remaining model's fraction + its reset. */
|
|
64
64
|
export function mapAntigravityUsage(body, nowMs) {
|
|
65
|
+
if (body == null || typeof body !== "object")
|
|
66
|
+
return null;
|
|
65
67
|
const infos = (body.models ?? [])
|
|
66
68
|
.map((m) => m.quotaInfo)
|
|
67
69
|
.filter((q) => !!q && typeof q.remainingFraction === "number");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"antigravityQuotaSource.js","sourceRoot":"","sources":["../../../src/shared/quota/antigravityQuotaSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,aAAa,GAGd,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;GAcG;AAEH,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;AAC5D,MAAM,cAAc,GAClB,qEAAqE,CAAC;AACxE,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAuBzC,MAAM,OAAO,sBAAuB,SAAQ,mBAAmB;IACpD,IAAI,GAAG,aAAa,CAAC;IACb,SAAS,CAAsB;IAC/B,OAAO,CAAU;IACjB,aAAa,CAAc;IAE5C,YAAY,UAAyC,EAAE;QACrD,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACnC,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