@codedrifters/configulator 0.0.274 → 0.0.275
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/lib/index.d.mts +551 -1
- package/lib/index.d.ts +552 -2
- package/lib/index.js +491 -15
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +480 -15
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -8487,6 +8487,63 @@ function buildDocsSyncSubAgent(_paths) {
|
|
|
8487
8487
|
"",
|
|
8488
8488
|
"---",
|
|
8489
8489
|
"",
|
|
8490
|
+
"## Phase 1: Scan",
|
|
8491
|
+
"",
|
|
8492
|
+
"Phase 1 walks the repo, runs every registered drift check, and",
|
|
8493
|
+
"writes a single combined **audit report** to disk. Phase 1 never",
|
|
8494
|
+
"edits documentation \u2014 only the persisted report changes between",
|
|
8495
|
+
"scan and fix.",
|
|
8496
|
+
"",
|
|
8497
|
+
"### Audit report",
|
|
8498
|
+
"",
|
|
8499
|
+
"The report shape is exported from `@codedrifters/configulator`",
|
|
8500
|
+
"as `AuditReport` (under `src/docs-sync/scan/`) so Phase 2 and",
|
|
8501
|
+
"any downstream consumers share one definition. Reports are",
|
|
8502
|
+
"persisted at:",
|
|
8503
|
+
"",
|
|
8504
|
+
"```",
|
|
8505
|
+
".claude/state/docs-sync/<issue-number>-audit.json",
|
|
8506
|
+
"```",
|
|
8507
|
+
"",
|
|
8508
|
+
"Every report carries a `schemaVersion`, the `issueNumber`, the",
|
|
8509
|
+
"invocation `mode` (`pr` or `audit`), the `generatedAt` UTC",
|
|
8510
|
+
"timestamp, the `repoRoot`, and an optional `scope` label, plus",
|
|
8511
|
+
"two parallel views of the findings:",
|
|
8512
|
+
"",
|
|
8513
|
+
"- **`categories`** \u2014 findings grouped by drift-check category.",
|
|
8514
|
+
" Every category key is always present; empty arrays are",
|
|
8515
|
+
" persisted explicitly. The five categories are `apiDiff`,",
|
|
8516
|
+
" `tsdocCoverage`, `referenceMismatches`, `linkFailures`, and",
|
|
8517
|
+
" `sampleFailures`.",
|
|
8518
|
+
"- **`findings`** \u2014 the same records re-aggregated as a single",
|
|
8519
|
+
" flat array, sorted by severity (`blocking` first), then",
|
|
8520
|
+
" category, file, line, and subject. Provided so consumers",
|
|
8521
|
+
" that don't need the category grouping can iterate one array",
|
|
8522
|
+
" and see the merge-blocking findings at the top.",
|
|
8523
|
+
"",
|
|
8524
|
+
"Every finding carries a `category`, `severity`",
|
|
8525
|
+
"(`mechanical` / `advisory` / `blocking`), `location`, `subject`,",
|
|
8526
|
+
"`details`, and an optional `fixHint` for the Phase 2 fix agent.",
|
|
8527
|
+
"",
|
|
8528
|
+
"### Orchestrator",
|
|
8529
|
+
"",
|
|
8530
|
+
"The scan is driven by `runScan(...)` (also exported under",
|
|
8531
|
+
"`src/docs-sync/scan/`). The orchestrator accepts a list of",
|
|
8532
|
+
"`AuditCheckRunner` instances, invokes each one in registration",
|
|
8533
|
+
"order, merges the findings into the report, and (optionally)",
|
|
8534
|
+
"persists the report to disk. The default check list is empty \u2014",
|
|
8535
|
+
"this skeleton release runs cleanly with no checks registered",
|
|
8536
|
+
"and produces a schema-compliant report whose category arrays",
|
|
8537
|
+
"are all empty.",
|
|
8538
|
+
"",
|
|
8539
|
+
"Children of the parent docs-sync epic plug runners into the",
|
|
8540
|
+
"orchestrator: API/TSDoc/reference checks land first, link",
|
|
8541
|
+
"and fenced-sample checks land second, the fix phase reads the",
|
|
8542
|
+
"persisted report, and the audit-mode walker reuses the same",
|
|
8543
|
+
"report shape.",
|
|
8544
|
+
"",
|
|
8545
|
+
"---",
|
|
8546
|
+
"",
|
|
8490
8547
|
"## Write Boundaries",
|
|
8491
8548
|
"",
|
|
8492
8549
|
"Even once the pipeline is wired, the following boundaries are",
|
|
@@ -26943,8 +27000,8 @@ var FALLBACKS = {
|
|
|
26943
27000
|
monorepoLayoutSeedBlock: ""
|
|
26944
27001
|
};
|
|
26945
27002
|
var TEMPLATE_RE = /\{\{(\w+(?:\.\w+)*)\}\}/g;
|
|
26946
|
-
function getNestedValue(obj,
|
|
26947
|
-
const parts =
|
|
27003
|
+
function getNestedValue(obj, path7) {
|
|
27004
|
+
const parts = path7.split(".");
|
|
26948
27005
|
let current = obj;
|
|
26949
27006
|
for (const part of parts) {
|
|
26950
27007
|
if (current == null || typeof current !== "object") {
|
|
@@ -27170,20 +27227,20 @@ var ClaudeRenderer = class _ClaudeRenderer {
|
|
|
27170
27227
|
obj.excludedCommands = [...sandbox.excludedCommands];
|
|
27171
27228
|
}
|
|
27172
27229
|
if (sandbox.filesystem) {
|
|
27173
|
-
const
|
|
27230
|
+
const fs4 = {};
|
|
27174
27231
|
if (sandbox.filesystem.allowRead?.length) {
|
|
27175
|
-
|
|
27232
|
+
fs4.allowRead = [...sandbox.filesystem.allowRead];
|
|
27176
27233
|
}
|
|
27177
27234
|
if (sandbox.filesystem.denyRead?.length) {
|
|
27178
|
-
|
|
27235
|
+
fs4.denyRead = [...sandbox.filesystem.denyRead];
|
|
27179
27236
|
}
|
|
27180
27237
|
if (sandbox.filesystem.allowWrite?.length) {
|
|
27181
|
-
|
|
27238
|
+
fs4.allowWrite = [...sandbox.filesystem.allowWrite];
|
|
27182
27239
|
}
|
|
27183
27240
|
if (sandbox.filesystem.denyWrite?.length) {
|
|
27184
|
-
|
|
27241
|
+
fs4.denyWrite = [...sandbox.filesystem.denyWrite];
|
|
27185
27242
|
}
|
|
27186
|
-
if (Object.keys(
|
|
27243
|
+
if (Object.keys(fs4).length > 0) obj.filesystem = fs4;
|
|
27187
27244
|
}
|
|
27188
27245
|
if (sandbox.network) {
|
|
27189
27246
|
const net = {};
|
|
@@ -29392,8 +29449,405 @@ function formatDiagnostic(d) {
|
|
|
29392
29449
|
return `${code}${text}`.trim();
|
|
29393
29450
|
}
|
|
29394
29451
|
|
|
29395
|
-
// src/docs-sync/
|
|
29452
|
+
// src/docs-sync/scan/audit-report.ts
|
|
29453
|
+
var AuditCategory = {
|
|
29454
|
+
/**
|
|
29455
|
+
* Findings produced by the public-API diff check that surfaces
|
|
29456
|
+
* added, renamed, or removed exports between the current branch
|
|
29457
|
+
* and the recorded baseline. Wired in by child issue #519.
|
|
29458
|
+
*/
|
|
29459
|
+
ApiDiff: "apiDiff",
|
|
29460
|
+
/**
|
|
29461
|
+
* Findings produced by the TSDoc-coverage check that flags public
|
|
29462
|
+
* exports without a one-sentence summary. Wired in by child issue
|
|
29463
|
+
* #519.
|
|
29464
|
+
*/
|
|
29465
|
+
TsdocCoverage: "tsdocCoverage",
|
|
29466
|
+
/**
|
|
29467
|
+
* Findings produced by the doc-reference cross-index check that
|
|
29468
|
+
* flags inline-code symbol mentions whose target is missing or
|
|
29469
|
+
* has changed. Wired in by child issue #519.
|
|
29470
|
+
*/
|
|
29471
|
+
ReferenceMismatches: "referenceMismatches",
|
|
29472
|
+
/**
|
|
29473
|
+
* Findings produced by the link-integrity check (internal via
|
|
29474
|
+
* `astro check`, external via `lychee`). Wired in by child issue
|
|
29475
|
+
* #520.
|
|
29476
|
+
*/
|
|
29477
|
+
LinkFailures: "linkFailures",
|
|
29478
|
+
/**
|
|
29479
|
+
* Findings produced by the fenced-sample compilation check that
|
|
29480
|
+
* flags ` ```ts ` / ` ```typescript ` / ` ```tsx ` blocks in the
|
|
29481
|
+
* docs that fail `tsc`. Wired in by child issue #520.
|
|
29482
|
+
*/
|
|
29483
|
+
SampleFailures: "sampleFailures"
|
|
29484
|
+
};
|
|
29485
|
+
var AuditSeverity = {
|
|
29486
|
+
/**
|
|
29487
|
+
* The finding has a deterministic mechanical fix that the Phase 2
|
|
29488
|
+
* (Fix) agent will auto-apply (TSDoc stubs, dead-link updates,
|
|
29489
|
+
* registry sync, etc.).
|
|
29490
|
+
*/
|
|
29491
|
+
Mechanical: "mechanical",
|
|
29492
|
+
/**
|
|
29493
|
+
* The finding deserves human attention but does not block the PR.
|
|
29494
|
+
* Surfaced as a non-blocking note on the sticky `## Docs sync`
|
|
29495
|
+
* comment.
|
|
29496
|
+
*/
|
|
29497
|
+
Advisory: "advisory",
|
|
29498
|
+
/**
|
|
29499
|
+
* The finding blocks the PR. Per the parent epic this is reserved
|
|
29500
|
+
* for the two narrow cases of confirmed broken external links and
|
|
29501
|
+
* fenced TS samples that fail to compile.
|
|
29502
|
+
*/
|
|
29503
|
+
Blocking: "blocking"
|
|
29504
|
+
};
|
|
29505
|
+
var AuditMode = {
|
|
29506
|
+
Pr: "pr",
|
|
29507
|
+
Audit: "audit"
|
|
29508
|
+
};
|
|
29509
|
+
var DOCS_SYNC_AUDIT_SCHEMA_VERSION = 1;
|
|
29510
|
+
function auditReportJsonSchema() {
|
|
29511
|
+
const locationSchema = {
|
|
29512
|
+
type: "object",
|
|
29513
|
+
additionalProperties: false,
|
|
29514
|
+
required: ["file", "line"],
|
|
29515
|
+
properties: {
|
|
29516
|
+
file: { type: "string" },
|
|
29517
|
+
line: { type: "integer", minimum: 0 }
|
|
29518
|
+
}
|
|
29519
|
+
};
|
|
29520
|
+
const findingBaseProperties = {
|
|
29521
|
+
severity: { type: "string", enum: ["mechanical", "advisory", "blocking"] },
|
|
29522
|
+
location: locationSchema,
|
|
29523
|
+
subject: { type: "string" },
|
|
29524
|
+
details: { type: "string" },
|
|
29525
|
+
fixHint: { type: "string" }
|
|
29526
|
+
};
|
|
29527
|
+
const apiDiffFindingSchema = {
|
|
29528
|
+
type: "object",
|
|
29529
|
+
required: [
|
|
29530
|
+
"category",
|
|
29531
|
+
"severity",
|
|
29532
|
+
"location",
|
|
29533
|
+
"subject",
|
|
29534
|
+
"details",
|
|
29535
|
+
"change",
|
|
29536
|
+
"symbol"
|
|
29537
|
+
],
|
|
29538
|
+
properties: {
|
|
29539
|
+
...findingBaseProperties,
|
|
29540
|
+
category: { type: "string", const: "apiDiff" },
|
|
29541
|
+
change: { type: "string", enum: ["added", "removed", "changed"] },
|
|
29542
|
+
symbol: { type: "string" }
|
|
29543
|
+
}
|
|
29544
|
+
};
|
|
29545
|
+
const tsdocCoverageFindingSchema = {
|
|
29546
|
+
type: "object",
|
|
29547
|
+
required: [
|
|
29548
|
+
"category",
|
|
29549
|
+
"severity",
|
|
29550
|
+
"location",
|
|
29551
|
+
"subject",
|
|
29552
|
+
"details",
|
|
29553
|
+
"shortfall",
|
|
29554
|
+
"symbol"
|
|
29555
|
+
],
|
|
29556
|
+
properties: {
|
|
29557
|
+
...findingBaseProperties,
|
|
29558
|
+
category: { type: "string", const: "tsdocCoverage" },
|
|
29559
|
+
shortfall: {
|
|
29560
|
+
type: "string",
|
|
29561
|
+
enum: [
|
|
29562
|
+
"missing-summary",
|
|
29563
|
+
"thin-summary",
|
|
29564
|
+
"missing-params",
|
|
29565
|
+
"missing-returns"
|
|
29566
|
+
]
|
|
29567
|
+
},
|
|
29568
|
+
symbol: { type: "string" }
|
|
29569
|
+
}
|
|
29570
|
+
};
|
|
29571
|
+
const referenceMismatchFindingSchema = {
|
|
29572
|
+
type: "object",
|
|
29573
|
+
required: [
|
|
29574
|
+
"category",
|
|
29575
|
+
"severity",
|
|
29576
|
+
"location",
|
|
29577
|
+
"subject",
|
|
29578
|
+
"details",
|
|
29579
|
+
"mismatch",
|
|
29580
|
+
"symbol"
|
|
29581
|
+
],
|
|
29582
|
+
properties: {
|
|
29583
|
+
...findingBaseProperties,
|
|
29584
|
+
category: { type: "string", const: "referenceMismatches" },
|
|
29585
|
+
mismatch: {
|
|
29586
|
+
type: "string",
|
|
29587
|
+
enum: ["unknown-symbol", "signature-changed"]
|
|
29588
|
+
},
|
|
29589
|
+
symbol: { type: "string" }
|
|
29590
|
+
}
|
|
29591
|
+
};
|
|
29592
|
+
const linkFailureFindingSchema = {
|
|
29593
|
+
type: "object",
|
|
29594
|
+
required: [
|
|
29595
|
+
"category",
|
|
29596
|
+
"severity",
|
|
29597
|
+
"location",
|
|
29598
|
+
"subject",
|
|
29599
|
+
"details",
|
|
29600
|
+
"url",
|
|
29601
|
+
"kind",
|
|
29602
|
+
"reason"
|
|
29603
|
+
],
|
|
29604
|
+
properties: {
|
|
29605
|
+
...findingBaseProperties,
|
|
29606
|
+
category: { type: "string", const: "linkFailures" },
|
|
29607
|
+
url: { type: "string" },
|
|
29608
|
+
kind: { type: "string", enum: ["internal", "external"] },
|
|
29609
|
+
reason: { type: "string" }
|
|
29610
|
+
}
|
|
29611
|
+
};
|
|
29612
|
+
const sampleFailureFindingSchema = {
|
|
29613
|
+
type: "object",
|
|
29614
|
+
required: [
|
|
29615
|
+
"category",
|
|
29616
|
+
"severity",
|
|
29617
|
+
"location",
|
|
29618
|
+
"subject",
|
|
29619
|
+
"details",
|
|
29620
|
+
"fenceIndex",
|
|
29621
|
+
"lang",
|
|
29622
|
+
"diagnostics"
|
|
29623
|
+
],
|
|
29624
|
+
properties: {
|
|
29625
|
+
...findingBaseProperties,
|
|
29626
|
+
category: { type: "string", const: "sampleFailures" },
|
|
29627
|
+
fenceIndex: { type: "integer", minimum: 0 },
|
|
29628
|
+
lang: { type: "string" },
|
|
29629
|
+
diagnostics: { type: "array", items: { type: "string" } }
|
|
29630
|
+
}
|
|
29631
|
+
};
|
|
29632
|
+
return {
|
|
29633
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
29634
|
+
title: "DocsSyncAuditReport",
|
|
29635
|
+
type: "object",
|
|
29636
|
+
additionalProperties: false,
|
|
29637
|
+
required: [
|
|
29638
|
+
"schemaVersion",
|
|
29639
|
+
"issueNumber",
|
|
29640
|
+
"mode",
|
|
29641
|
+
"generatedAt",
|
|
29642
|
+
"repoRoot",
|
|
29643
|
+
"scope",
|
|
29644
|
+
"categories",
|
|
29645
|
+
"findings"
|
|
29646
|
+
],
|
|
29647
|
+
properties: {
|
|
29648
|
+
schemaVersion: { type: "integer", const: DOCS_SYNC_AUDIT_SCHEMA_VERSION },
|
|
29649
|
+
issueNumber: { type: "integer", minimum: 0 },
|
|
29650
|
+
mode: { type: "string", enum: ["pr", "audit"] },
|
|
29651
|
+
generatedAt: { type: "string", format: "date-time" },
|
|
29652
|
+
repoRoot: { type: "string" },
|
|
29653
|
+
scope: { type: "string" },
|
|
29654
|
+
categories: {
|
|
29655
|
+
type: "object",
|
|
29656
|
+
additionalProperties: false,
|
|
29657
|
+
required: [
|
|
29658
|
+
"apiDiff",
|
|
29659
|
+
"tsdocCoverage",
|
|
29660
|
+
"referenceMismatches",
|
|
29661
|
+
"linkFailures",
|
|
29662
|
+
"sampleFailures"
|
|
29663
|
+
],
|
|
29664
|
+
properties: {
|
|
29665
|
+
apiDiff: { type: "array", items: apiDiffFindingSchema },
|
|
29666
|
+
tsdocCoverage: { type: "array", items: tsdocCoverageFindingSchema },
|
|
29667
|
+
referenceMismatches: {
|
|
29668
|
+
type: "array",
|
|
29669
|
+
items: referenceMismatchFindingSchema
|
|
29670
|
+
},
|
|
29671
|
+
linkFailures: { type: "array", items: linkFailureFindingSchema },
|
|
29672
|
+
sampleFailures: { type: "array", items: sampleFailureFindingSchema }
|
|
29673
|
+
}
|
|
29674
|
+
},
|
|
29675
|
+
findings: {
|
|
29676
|
+
type: "array",
|
|
29677
|
+
items: {
|
|
29678
|
+
oneOf: [
|
|
29679
|
+
apiDiffFindingSchema,
|
|
29680
|
+
tsdocCoverageFindingSchema,
|
|
29681
|
+
referenceMismatchFindingSchema,
|
|
29682
|
+
linkFailureFindingSchema,
|
|
29683
|
+
sampleFailureFindingSchema
|
|
29684
|
+
]
|
|
29685
|
+
}
|
|
29686
|
+
}
|
|
29687
|
+
}
|
|
29688
|
+
};
|
|
29689
|
+
}
|
|
29690
|
+
|
|
29691
|
+
// src/docs-sync/scan/run-scan.ts
|
|
29692
|
+
import * as fs3 from "fs";
|
|
29396
29693
|
import * as path5 from "path";
|
|
29694
|
+
var DEFAULT_AUDIT_REPORT_DIR = ".claude/state/docs-sync";
|
|
29695
|
+
var SEVERITY_RANK = {
|
|
29696
|
+
blocking: 0,
|
|
29697
|
+
advisory: 1,
|
|
29698
|
+
mechanical: 2
|
|
29699
|
+
};
|
|
29700
|
+
var AUDIT_CATEGORY_ORDER = [
|
|
29701
|
+
AuditCategory.ApiDiff,
|
|
29702
|
+
AuditCategory.TsdocCoverage,
|
|
29703
|
+
AuditCategory.ReferenceMismatches,
|
|
29704
|
+
AuditCategory.LinkFailures,
|
|
29705
|
+
AuditCategory.SampleFailures
|
|
29706
|
+
];
|
|
29707
|
+
function runScan(options) {
|
|
29708
|
+
const repoRoot = path5.resolve(options.repoRoot);
|
|
29709
|
+
const mode = options.mode;
|
|
29710
|
+
const scope = options.scope ?? "";
|
|
29711
|
+
const issueNumber = options.issueNumber;
|
|
29712
|
+
const checks = options.checks ?? [];
|
|
29713
|
+
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
29714
|
+
const persist = options.persist ?? false;
|
|
29715
|
+
const reportDir = options.reportDir ?? DEFAULT_AUDIT_REPORT_DIR;
|
|
29716
|
+
const context = {
|
|
29717
|
+
repoRoot,
|
|
29718
|
+
mode,
|
|
29719
|
+
scope,
|
|
29720
|
+
issueNumber
|
|
29721
|
+
};
|
|
29722
|
+
const collected = [];
|
|
29723
|
+
for (const check of checks) {
|
|
29724
|
+
const result = check.run(context);
|
|
29725
|
+
for (const finding of result) {
|
|
29726
|
+
collected.push(finding);
|
|
29727
|
+
}
|
|
29728
|
+
}
|
|
29729
|
+
const report = buildReport({
|
|
29730
|
+
issueNumber,
|
|
29731
|
+
mode,
|
|
29732
|
+
scope,
|
|
29733
|
+
repoRoot,
|
|
29734
|
+
generatedAt: now,
|
|
29735
|
+
findings: collected
|
|
29736
|
+
});
|
|
29737
|
+
let reportPath = "";
|
|
29738
|
+
if (persist) {
|
|
29739
|
+
reportPath = persistAuditReport({
|
|
29740
|
+
report,
|
|
29741
|
+
repoRoot,
|
|
29742
|
+
reportDir
|
|
29743
|
+
});
|
|
29744
|
+
}
|
|
29745
|
+
return { report, reportPath };
|
|
29746
|
+
}
|
|
29747
|
+
function buildReport(args) {
|
|
29748
|
+
const buckets = emptyCategoryBuckets();
|
|
29749
|
+
for (const finding of args.findings) {
|
|
29750
|
+
pushIntoBucket(buckets, finding);
|
|
29751
|
+
}
|
|
29752
|
+
buckets.apiDiff.sort(compareFindings);
|
|
29753
|
+
buckets.tsdocCoverage.sort(compareFindings);
|
|
29754
|
+
buckets.referenceMismatches.sort(compareFindings);
|
|
29755
|
+
buckets.linkFailures.sort(compareFindings);
|
|
29756
|
+
buckets.sampleFailures.sort(compareFindings);
|
|
29757
|
+
const flat = [];
|
|
29758
|
+
for (const key of AUDIT_CATEGORY_ORDER) {
|
|
29759
|
+
const bucket = buckets[key];
|
|
29760
|
+
for (const finding of bucket) {
|
|
29761
|
+
flat.push(finding);
|
|
29762
|
+
}
|
|
29763
|
+
}
|
|
29764
|
+
flat.sort(compareFindings);
|
|
29765
|
+
return {
|
|
29766
|
+
schemaVersion: DOCS_SYNC_AUDIT_SCHEMA_VERSION,
|
|
29767
|
+
issueNumber: args.issueNumber,
|
|
29768
|
+
mode: args.mode,
|
|
29769
|
+
generatedAt: args.generatedAt.toISOString(),
|
|
29770
|
+
repoRoot: args.repoRoot,
|
|
29771
|
+
scope: args.scope,
|
|
29772
|
+
categories: {
|
|
29773
|
+
apiDiff: buckets.apiDiff,
|
|
29774
|
+
tsdocCoverage: buckets.tsdocCoverage,
|
|
29775
|
+
referenceMismatches: buckets.referenceMismatches,
|
|
29776
|
+
linkFailures: buckets.linkFailures,
|
|
29777
|
+
sampleFailures: buckets.sampleFailures
|
|
29778
|
+
},
|
|
29779
|
+
findings: flat
|
|
29780
|
+
};
|
|
29781
|
+
}
|
|
29782
|
+
function persistAuditReport(args) {
|
|
29783
|
+
const repoRoot = path5.resolve(args.repoRoot);
|
|
29784
|
+
const reportDir = args.reportDir ?? DEFAULT_AUDIT_REPORT_DIR;
|
|
29785
|
+
const targetDir = path5.resolve(repoRoot, reportDir);
|
|
29786
|
+
fs3.mkdirSync(targetDir, { recursive: true });
|
|
29787
|
+
const targetFile = path5.join(
|
|
29788
|
+
targetDir,
|
|
29789
|
+
`${args.report.issueNumber}-audit.json`
|
|
29790
|
+
);
|
|
29791
|
+
const tempFile = `${targetFile}.tmp-${process.pid}-${Date.now()}`;
|
|
29792
|
+
const serialized = `${JSON.stringify(args.report, null, 2)}
|
|
29793
|
+
`;
|
|
29794
|
+
fs3.writeFileSync(tempFile, serialized, "utf-8");
|
|
29795
|
+
fs3.renameSync(tempFile, targetFile);
|
|
29796
|
+
return targetFile;
|
|
29797
|
+
}
|
|
29798
|
+
function emptyCategoryBuckets() {
|
|
29799
|
+
return {
|
|
29800
|
+
apiDiff: [],
|
|
29801
|
+
tsdocCoverage: [],
|
|
29802
|
+
referenceMismatches: [],
|
|
29803
|
+
linkFailures: [],
|
|
29804
|
+
sampleFailures: []
|
|
29805
|
+
};
|
|
29806
|
+
}
|
|
29807
|
+
function pushIntoBucket(buckets, finding) {
|
|
29808
|
+
switch (finding.category) {
|
|
29809
|
+
case AuditCategory.ApiDiff:
|
|
29810
|
+
buckets.apiDiff.push(finding);
|
|
29811
|
+
return;
|
|
29812
|
+
case AuditCategory.TsdocCoverage:
|
|
29813
|
+
buckets.tsdocCoverage.push(finding);
|
|
29814
|
+
return;
|
|
29815
|
+
case AuditCategory.ReferenceMismatches:
|
|
29816
|
+
buckets.referenceMismatches.push(finding);
|
|
29817
|
+
return;
|
|
29818
|
+
case AuditCategory.LinkFailures:
|
|
29819
|
+
buckets.linkFailures.push(finding);
|
|
29820
|
+
return;
|
|
29821
|
+
case AuditCategory.SampleFailures:
|
|
29822
|
+
buckets.sampleFailures.push(finding);
|
|
29823
|
+
return;
|
|
29824
|
+
default: {
|
|
29825
|
+
const exhaustive = finding;
|
|
29826
|
+
throw new Error(
|
|
29827
|
+
`runScan: unrecognized finding category: ${JSON.stringify(exhaustive)}`
|
|
29828
|
+
);
|
|
29829
|
+
}
|
|
29830
|
+
}
|
|
29831
|
+
}
|
|
29832
|
+
function compareFindings(a, b) {
|
|
29833
|
+
const sevDelta = SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity];
|
|
29834
|
+
if (sevDelta !== 0) {
|
|
29835
|
+
return sevDelta;
|
|
29836
|
+
}
|
|
29837
|
+
if (a.category !== b.category) {
|
|
29838
|
+
return a.category.localeCompare(b.category);
|
|
29839
|
+
}
|
|
29840
|
+
if (a.location.file !== b.location.file) {
|
|
29841
|
+
return a.location.file.localeCompare(b.location.file);
|
|
29842
|
+
}
|
|
29843
|
+
if (a.location.line !== b.location.line) {
|
|
29844
|
+
return a.location.line - b.location.line;
|
|
29845
|
+
}
|
|
29846
|
+
return a.subject.localeCompare(b.subject);
|
|
29847
|
+
}
|
|
29848
|
+
|
|
29849
|
+
// src/docs-sync/tsdoc-coverage/coverage.ts
|
|
29850
|
+
import * as path6 from "path";
|
|
29397
29851
|
import { TSDocParser } from "@microsoft/tsdoc";
|
|
29398
29852
|
import * as ts2 from "typescript";
|
|
29399
29853
|
var TsDocCoverageKind = {
|
|
@@ -29411,8 +29865,8 @@ var DEFAULT_THIN_SUMMARY_WORD_THRESHOLD = 4;
|
|
|
29411
29865
|
var DEFAULT_ENTRY_POINT = "src/index.ts";
|
|
29412
29866
|
function analyzeTsDocCoverage(options) {
|
|
29413
29867
|
const resolvedOptions = typeof options === "string" ? { packageRoot: options } : options;
|
|
29414
|
-
const packageRoot =
|
|
29415
|
-
const entryPoint =
|
|
29868
|
+
const packageRoot = path6.resolve(resolvedOptions.packageRoot);
|
|
29869
|
+
const entryPoint = path6.resolve(
|
|
29416
29870
|
packageRoot,
|
|
29417
29871
|
resolvedOptions.entryPoint ?? DEFAULT_ENTRY_POINT
|
|
29418
29872
|
);
|
|
@@ -29475,7 +29929,7 @@ function analyzeTsDocCoverage(options) {
|
|
|
29475
29929
|
}
|
|
29476
29930
|
function resolveCompilerOptions(packageRoot, tsconfigPath) {
|
|
29477
29931
|
if (tsconfigPath) {
|
|
29478
|
-
const absoluteTsconfig =
|
|
29932
|
+
const absoluteTsconfig = path6.resolve(packageRoot, tsconfigPath);
|
|
29479
29933
|
const configFile = ts2.readConfigFile(absoluteTsconfig, ts2.sys.readFile);
|
|
29480
29934
|
if (configFile.error) {
|
|
29481
29935
|
throw new Error(
|
|
@@ -29485,7 +29939,7 @@ function resolveCompilerOptions(packageRoot, tsconfigPath) {
|
|
|
29485
29939
|
const parsed = ts2.parseJsonConfigFileContent(
|
|
29486
29940
|
configFile.config,
|
|
29487
29941
|
ts2.sys,
|
|
29488
|
-
|
|
29942
|
+
path6.dirname(absoluteTsconfig)
|
|
29489
29943
|
);
|
|
29490
29944
|
return { ...parsed.options, noEmit: true };
|
|
29491
29945
|
}
|
|
@@ -29949,8 +30403,8 @@ var ResetTask = class _ResetTask extends Component14 {
|
|
|
29949
30403
|
const resetTask = this.project.tasks.addTask(this.taskName, {
|
|
29950
30404
|
description: "Delete build artifacts specified by pathsToRemove option, or artifactsDirectory if pathsToRemove is empty"
|
|
29951
30405
|
});
|
|
29952
|
-
this.pathsToRemove.forEach((
|
|
29953
|
-
resetTask.exec(`[ -e "${
|
|
30406
|
+
this.pathsToRemove.forEach((path7) => {
|
|
30407
|
+
resetTask.exec(`[ -e "${path7}" ] && rm -rf ${path7} || true`);
|
|
29954
30408
|
});
|
|
29955
30409
|
const rootHasTurbo = TurboRepo.of(this.project.root) !== void 0;
|
|
29956
30410
|
const isSubproject = this.project !== this.project.root;
|
|
@@ -31892,11 +32346,15 @@ export {
|
|
|
31892
32346
|
AGENT_RULE_SCOPE,
|
|
31893
32347
|
AGENT_TIER_ROLES,
|
|
31894
32348
|
AGENT_TIER_VALUES,
|
|
32349
|
+
AUDIT_CATEGORY_ORDER,
|
|
31895
32350
|
AgentConfig,
|
|
31896
32351
|
ApiExtractor,
|
|
31897
32352
|
AstroConfig,
|
|
31898
32353
|
AstroOutput,
|
|
31899
32354
|
AstroProject,
|
|
32355
|
+
AuditCategory,
|
|
32356
|
+
AuditMode,
|
|
32357
|
+
AuditSeverity,
|
|
31900
32358
|
AwsCdkProject,
|
|
31901
32359
|
AwsDeployWorkflow,
|
|
31902
32360
|
AwsDeploymentConfig,
|
|
@@ -31912,6 +32370,7 @@ export {
|
|
|
31912
32370
|
DEFAULT_API_EXTRACTOR_ENTRY_POINT,
|
|
31913
32371
|
DEFAULT_API_EXTRACTOR_REPORT_FILENAME,
|
|
31914
32372
|
DEFAULT_API_EXTRACTOR_REPORT_FOLDER,
|
|
32373
|
+
DEFAULT_AUDIT_REPORT_DIR,
|
|
31915
32374
|
DEFAULT_DECOMPOSITION_TEMPLATE,
|
|
31916
32375
|
DEFAULT_DELEGATE_TO_PR_REVIEWER,
|
|
31917
32376
|
DEFAULT_DISPATCH_MODEL,
|
|
@@ -31959,6 +32418,7 @@ export {
|
|
|
31959
32418
|
DEFAULT_WORKFLOW_DIAGRAMS_ENABLED,
|
|
31960
32419
|
DEFAULT_WORKFLOW_DIAGRAMS_PATH,
|
|
31961
32420
|
DEFAULT_WORKFLOW_DIAGRAMS_REQUIRE_UPDATE,
|
|
32421
|
+
DOCS_SYNC_AUDIT_SCHEMA_VERSION,
|
|
31962
32422
|
JsiiFaker,
|
|
31963
32423
|
LAYOUT_ENFORCEMENT,
|
|
31964
32424
|
LAYOUT_ROOT_BY_PROJECT_TYPE,
|
|
@@ -32000,6 +32460,7 @@ export {
|
|
|
32000
32460
|
addSyncLabelsWorkflow,
|
|
32001
32461
|
agendaBundle,
|
|
32002
32462
|
analyzeTsDocCoverage,
|
|
32463
|
+
auditReportJsonSchema,
|
|
32003
32464
|
awsCdkBundle,
|
|
32004
32465
|
baseBundle,
|
|
32005
32466
|
bcmWriterBundle,
|
|
@@ -32016,6 +32477,7 @@ export {
|
|
|
32016
32477
|
buildOrchestratorConventionsContent,
|
|
32017
32478
|
buildPeopleProfileBundle,
|
|
32018
32479
|
buildRegulatoryResearchBundle,
|
|
32480
|
+
buildReport,
|
|
32019
32481
|
buildRequirementsAnalystBundle,
|
|
32020
32482
|
buildRequirementsReviewerBundle,
|
|
32021
32483
|
buildRequirementsWriterBundle,
|
|
@@ -32032,6 +32494,7 @@ export {
|
|
|
32032
32494
|
compileFencedSamples,
|
|
32033
32495
|
customerProfileBundle,
|
|
32034
32496
|
docsSyncBundle,
|
|
32497
|
+
emptyCategoryBuckets,
|
|
32035
32498
|
extractApiProcedure,
|
|
32036
32499
|
extractDocReferences,
|
|
32037
32500
|
extractFencedSamples,
|
|
@@ -32045,6 +32508,7 @@ export {
|
|
|
32045
32508
|
meetingAnalysisBundle,
|
|
32046
32509
|
orchestratorBundle,
|
|
32047
32510
|
peopleProfileBundle,
|
|
32511
|
+
persistAuditReport,
|
|
32048
32512
|
pnpmBundle,
|
|
32049
32513
|
prReviewBundle,
|
|
32050
32514
|
projenBundle,
|
|
@@ -32111,6 +32575,7 @@ export {
|
|
|
32111
32575
|
resolveTypeScriptProjectOutdir,
|
|
32112
32576
|
resolveUnblockDependents,
|
|
32113
32577
|
resolveWorkflowDiagrams,
|
|
32578
|
+
runScan,
|
|
32114
32579
|
slackBundle,
|
|
32115
32580
|
softwareProfileBundle,
|
|
32116
32581
|
standardsResearchBundle,
|