@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.js CHANGED
@@ -180,11 +180,15 @@ __export(index_exports, {
180
180
  AGENT_RULE_SCOPE: () => AGENT_RULE_SCOPE,
181
181
  AGENT_TIER_ROLES: () => AGENT_TIER_ROLES,
182
182
  AGENT_TIER_VALUES: () => AGENT_TIER_VALUES,
183
+ AUDIT_CATEGORY_ORDER: () => AUDIT_CATEGORY_ORDER,
183
184
  AgentConfig: () => AgentConfig,
184
185
  ApiExtractor: () => ApiExtractor,
185
186
  AstroConfig: () => AstroConfig,
186
187
  AstroOutput: () => AstroOutput,
187
188
  AstroProject: () => AstroProject,
189
+ AuditCategory: () => AuditCategory,
190
+ AuditMode: () => AuditMode,
191
+ AuditSeverity: () => AuditSeverity,
188
192
  AwsCdkProject: () => AwsCdkProject,
189
193
  AwsDeployWorkflow: () => AwsDeployWorkflow,
190
194
  AwsDeploymentConfig: () => AwsDeploymentConfig,
@@ -200,6 +204,7 @@ __export(index_exports, {
200
204
  DEFAULT_API_EXTRACTOR_ENTRY_POINT: () => DEFAULT_API_EXTRACTOR_ENTRY_POINT,
201
205
  DEFAULT_API_EXTRACTOR_REPORT_FILENAME: () => DEFAULT_API_EXTRACTOR_REPORT_FILENAME,
202
206
  DEFAULT_API_EXTRACTOR_REPORT_FOLDER: () => DEFAULT_API_EXTRACTOR_REPORT_FOLDER,
207
+ DEFAULT_AUDIT_REPORT_DIR: () => DEFAULT_AUDIT_REPORT_DIR,
203
208
  DEFAULT_DECOMPOSITION_TEMPLATE: () => DEFAULT_DECOMPOSITION_TEMPLATE,
204
209
  DEFAULT_DELEGATE_TO_PR_REVIEWER: () => DEFAULT_DELEGATE_TO_PR_REVIEWER,
205
210
  DEFAULT_DISPATCH_MODEL: () => DEFAULT_DISPATCH_MODEL,
@@ -247,6 +252,7 @@ __export(index_exports, {
247
252
  DEFAULT_WORKFLOW_DIAGRAMS_ENABLED: () => DEFAULT_WORKFLOW_DIAGRAMS_ENABLED,
248
253
  DEFAULT_WORKFLOW_DIAGRAMS_PATH: () => DEFAULT_WORKFLOW_DIAGRAMS_PATH,
249
254
  DEFAULT_WORKFLOW_DIAGRAMS_REQUIRE_UPDATE: () => DEFAULT_WORKFLOW_DIAGRAMS_REQUIRE_UPDATE,
255
+ DOCS_SYNC_AUDIT_SCHEMA_VERSION: () => DOCS_SYNC_AUDIT_SCHEMA_VERSION,
250
256
  JsiiFaker: () => JsiiFaker,
251
257
  LAYOUT_ENFORCEMENT: () => LAYOUT_ENFORCEMENT,
252
258
  LAYOUT_ROOT_BY_PROJECT_TYPE: () => LAYOUT_ROOT_BY_PROJECT_TYPE,
@@ -288,6 +294,7 @@ __export(index_exports, {
288
294
  addSyncLabelsWorkflow: () => addSyncLabelsWorkflow,
289
295
  agendaBundle: () => agendaBundle,
290
296
  analyzeTsDocCoverage: () => analyzeTsDocCoverage,
297
+ auditReportJsonSchema: () => auditReportJsonSchema,
291
298
  awsCdkBundle: () => awsCdkBundle,
292
299
  baseBundle: () => baseBundle,
293
300
  bcmWriterBundle: () => bcmWriterBundle,
@@ -304,6 +311,7 @@ __export(index_exports, {
304
311
  buildOrchestratorConventionsContent: () => buildOrchestratorConventionsContent,
305
312
  buildPeopleProfileBundle: () => buildPeopleProfileBundle,
306
313
  buildRegulatoryResearchBundle: () => buildRegulatoryResearchBundle,
314
+ buildReport: () => buildReport,
307
315
  buildRequirementsAnalystBundle: () => buildRequirementsAnalystBundle,
308
316
  buildRequirementsReviewerBundle: () => buildRequirementsReviewerBundle,
309
317
  buildRequirementsWriterBundle: () => buildRequirementsWriterBundle,
@@ -320,6 +328,7 @@ __export(index_exports, {
320
328
  compileFencedSamples: () => compileFencedSamples,
321
329
  customerProfileBundle: () => customerProfileBundle,
322
330
  docsSyncBundle: () => docsSyncBundle,
331
+ emptyCategoryBuckets: () => emptyCategoryBuckets,
323
332
  extractApiProcedure: () => extractApiProcedure,
324
333
  extractDocReferences: () => extractDocReferences,
325
334
  extractFencedSamples: () => extractFencedSamples,
@@ -333,6 +342,7 @@ __export(index_exports, {
333
342
  meetingAnalysisBundle: () => meetingAnalysisBundle,
334
343
  orchestratorBundle: () => orchestratorBundle,
335
344
  peopleProfileBundle: () => peopleProfileBundle,
345
+ persistAuditReport: () => persistAuditReport,
336
346
  pnpmBundle: () => pnpmBundle,
337
347
  prReviewBundle: () => prReviewBundle,
338
348
  projenBundle: () => projenBundle,
@@ -399,6 +409,7 @@ __export(index_exports, {
399
409
  resolveTypeScriptProjectOutdir: () => resolveTypeScriptProjectOutdir,
400
410
  resolveUnblockDependents: () => resolveUnblockDependents,
401
411
  resolveWorkflowDiagrams: () => resolveWorkflowDiagrams,
412
+ runScan: () => runScan,
402
413
  slackBundle: () => slackBundle,
403
414
  softwareProfileBundle: () => softwareProfileBundle,
404
415
  standardsResearchBundle: () => standardsResearchBundle,
@@ -8736,6 +8747,63 @@ function buildDocsSyncSubAgent(_paths) {
8736
8747
  "",
8737
8748
  "---",
8738
8749
  "",
8750
+ "## Phase 1: Scan",
8751
+ "",
8752
+ "Phase 1 walks the repo, runs every registered drift check, and",
8753
+ "writes a single combined **audit report** to disk. Phase 1 never",
8754
+ "edits documentation \u2014 only the persisted report changes between",
8755
+ "scan and fix.",
8756
+ "",
8757
+ "### Audit report",
8758
+ "",
8759
+ "The report shape is exported from `@codedrifters/configulator`",
8760
+ "as `AuditReport` (under `src/docs-sync/scan/`) so Phase 2 and",
8761
+ "any downstream consumers share one definition. Reports are",
8762
+ "persisted at:",
8763
+ "",
8764
+ "```",
8765
+ ".claude/state/docs-sync/<issue-number>-audit.json",
8766
+ "```",
8767
+ "",
8768
+ "Every report carries a `schemaVersion`, the `issueNumber`, the",
8769
+ "invocation `mode` (`pr` or `audit`), the `generatedAt` UTC",
8770
+ "timestamp, the `repoRoot`, and an optional `scope` label, plus",
8771
+ "two parallel views of the findings:",
8772
+ "",
8773
+ "- **`categories`** \u2014 findings grouped by drift-check category.",
8774
+ " Every category key is always present; empty arrays are",
8775
+ " persisted explicitly. The five categories are `apiDiff`,",
8776
+ " `tsdocCoverage`, `referenceMismatches`, `linkFailures`, and",
8777
+ " `sampleFailures`.",
8778
+ "- **`findings`** \u2014 the same records re-aggregated as a single",
8779
+ " flat array, sorted by severity (`blocking` first), then",
8780
+ " category, file, line, and subject. Provided so consumers",
8781
+ " that don't need the category grouping can iterate one array",
8782
+ " and see the merge-blocking findings at the top.",
8783
+ "",
8784
+ "Every finding carries a `category`, `severity`",
8785
+ "(`mechanical` / `advisory` / `blocking`), `location`, `subject`,",
8786
+ "`details`, and an optional `fixHint` for the Phase 2 fix agent.",
8787
+ "",
8788
+ "### Orchestrator",
8789
+ "",
8790
+ "The scan is driven by `runScan(...)` (also exported under",
8791
+ "`src/docs-sync/scan/`). The orchestrator accepts a list of",
8792
+ "`AuditCheckRunner` instances, invokes each one in registration",
8793
+ "order, merges the findings into the report, and (optionally)",
8794
+ "persists the report to disk. The default check list is empty \u2014",
8795
+ "this skeleton release runs cleanly with no checks registered",
8796
+ "and produces a schema-compliant report whose category arrays",
8797
+ "are all empty.",
8798
+ "",
8799
+ "Children of the parent docs-sync epic plug runners into the",
8800
+ "orchestrator: API/TSDoc/reference checks land first, link",
8801
+ "and fenced-sample checks land second, the fix phase reads the",
8802
+ "persisted report, and the audit-mode walker reuses the same",
8803
+ "report shape.",
8804
+ "",
8805
+ "---",
8806
+ "",
8739
8807
  "## Write Boundaries",
8740
8808
  "",
8741
8809
  "Even once the pipeline is wired, the following boundaries are",
@@ -27192,8 +27260,8 @@ var FALLBACKS = {
27192
27260
  monorepoLayoutSeedBlock: ""
27193
27261
  };
27194
27262
  var TEMPLATE_RE = /\{\{(\w+(?:\.\w+)*)\}\}/g;
27195
- function getNestedValue(obj, path6) {
27196
- const parts = path6.split(".");
27263
+ function getNestedValue(obj, path7) {
27264
+ const parts = path7.split(".");
27197
27265
  let current = obj;
27198
27266
  for (const part of parts) {
27199
27267
  if (current == null || typeof current !== "object") {
@@ -27419,20 +27487,20 @@ var ClaudeRenderer = class _ClaudeRenderer {
27419
27487
  obj.excludedCommands = [...sandbox.excludedCommands];
27420
27488
  }
27421
27489
  if (sandbox.filesystem) {
27422
- const fs3 = {};
27490
+ const fs4 = {};
27423
27491
  if (sandbox.filesystem.allowRead?.length) {
27424
- fs3.allowRead = [...sandbox.filesystem.allowRead];
27492
+ fs4.allowRead = [...sandbox.filesystem.allowRead];
27425
27493
  }
27426
27494
  if (sandbox.filesystem.denyRead?.length) {
27427
- fs3.denyRead = [...sandbox.filesystem.denyRead];
27495
+ fs4.denyRead = [...sandbox.filesystem.denyRead];
27428
27496
  }
27429
27497
  if (sandbox.filesystem.allowWrite?.length) {
27430
- fs3.allowWrite = [...sandbox.filesystem.allowWrite];
27498
+ fs4.allowWrite = [...sandbox.filesystem.allowWrite];
27431
27499
  }
27432
27500
  if (sandbox.filesystem.denyWrite?.length) {
27433
- fs3.denyWrite = [...sandbox.filesystem.denyWrite];
27501
+ fs4.denyWrite = [...sandbox.filesystem.denyWrite];
27434
27502
  }
27435
- if (Object.keys(fs3).length > 0) obj.filesystem = fs3;
27503
+ if (Object.keys(fs4).length > 0) obj.filesystem = fs4;
27436
27504
  }
27437
27505
  if (sandbox.network) {
27438
27506
  const net = {};
@@ -29641,8 +29709,405 @@ function formatDiagnostic(d) {
29641
29709
  return `${code}${text}`.trim();
29642
29710
  }
29643
29711
 
29644
- // src/docs-sync/tsdoc-coverage/coverage.ts
29712
+ // src/docs-sync/scan/audit-report.ts
29713
+ var AuditCategory = {
29714
+ /**
29715
+ * Findings produced by the public-API diff check that surfaces
29716
+ * added, renamed, or removed exports between the current branch
29717
+ * and the recorded baseline. Wired in by child issue #519.
29718
+ */
29719
+ ApiDiff: "apiDiff",
29720
+ /**
29721
+ * Findings produced by the TSDoc-coverage check that flags public
29722
+ * exports without a one-sentence summary. Wired in by child issue
29723
+ * #519.
29724
+ */
29725
+ TsdocCoverage: "tsdocCoverage",
29726
+ /**
29727
+ * Findings produced by the doc-reference cross-index check that
29728
+ * flags inline-code symbol mentions whose target is missing or
29729
+ * has changed. Wired in by child issue #519.
29730
+ */
29731
+ ReferenceMismatches: "referenceMismatches",
29732
+ /**
29733
+ * Findings produced by the link-integrity check (internal via
29734
+ * `astro check`, external via `lychee`). Wired in by child issue
29735
+ * #520.
29736
+ */
29737
+ LinkFailures: "linkFailures",
29738
+ /**
29739
+ * Findings produced by the fenced-sample compilation check that
29740
+ * flags ` ```ts ` / ` ```typescript ` / ` ```tsx ` blocks in the
29741
+ * docs that fail `tsc`. Wired in by child issue #520.
29742
+ */
29743
+ SampleFailures: "sampleFailures"
29744
+ };
29745
+ var AuditSeverity = {
29746
+ /**
29747
+ * The finding has a deterministic mechanical fix that the Phase 2
29748
+ * (Fix) agent will auto-apply (TSDoc stubs, dead-link updates,
29749
+ * registry sync, etc.).
29750
+ */
29751
+ Mechanical: "mechanical",
29752
+ /**
29753
+ * The finding deserves human attention but does not block the PR.
29754
+ * Surfaced as a non-blocking note on the sticky `## Docs sync`
29755
+ * comment.
29756
+ */
29757
+ Advisory: "advisory",
29758
+ /**
29759
+ * The finding blocks the PR. Per the parent epic this is reserved
29760
+ * for the two narrow cases of confirmed broken external links and
29761
+ * fenced TS samples that fail to compile.
29762
+ */
29763
+ Blocking: "blocking"
29764
+ };
29765
+ var AuditMode = {
29766
+ Pr: "pr",
29767
+ Audit: "audit"
29768
+ };
29769
+ var DOCS_SYNC_AUDIT_SCHEMA_VERSION = 1;
29770
+ function auditReportJsonSchema() {
29771
+ const locationSchema = {
29772
+ type: "object",
29773
+ additionalProperties: false,
29774
+ required: ["file", "line"],
29775
+ properties: {
29776
+ file: { type: "string" },
29777
+ line: { type: "integer", minimum: 0 }
29778
+ }
29779
+ };
29780
+ const findingBaseProperties = {
29781
+ severity: { type: "string", enum: ["mechanical", "advisory", "blocking"] },
29782
+ location: locationSchema,
29783
+ subject: { type: "string" },
29784
+ details: { type: "string" },
29785
+ fixHint: { type: "string" }
29786
+ };
29787
+ const apiDiffFindingSchema = {
29788
+ type: "object",
29789
+ required: [
29790
+ "category",
29791
+ "severity",
29792
+ "location",
29793
+ "subject",
29794
+ "details",
29795
+ "change",
29796
+ "symbol"
29797
+ ],
29798
+ properties: {
29799
+ ...findingBaseProperties,
29800
+ category: { type: "string", const: "apiDiff" },
29801
+ change: { type: "string", enum: ["added", "removed", "changed"] },
29802
+ symbol: { type: "string" }
29803
+ }
29804
+ };
29805
+ const tsdocCoverageFindingSchema = {
29806
+ type: "object",
29807
+ required: [
29808
+ "category",
29809
+ "severity",
29810
+ "location",
29811
+ "subject",
29812
+ "details",
29813
+ "shortfall",
29814
+ "symbol"
29815
+ ],
29816
+ properties: {
29817
+ ...findingBaseProperties,
29818
+ category: { type: "string", const: "tsdocCoverage" },
29819
+ shortfall: {
29820
+ type: "string",
29821
+ enum: [
29822
+ "missing-summary",
29823
+ "thin-summary",
29824
+ "missing-params",
29825
+ "missing-returns"
29826
+ ]
29827
+ },
29828
+ symbol: { type: "string" }
29829
+ }
29830
+ };
29831
+ const referenceMismatchFindingSchema = {
29832
+ type: "object",
29833
+ required: [
29834
+ "category",
29835
+ "severity",
29836
+ "location",
29837
+ "subject",
29838
+ "details",
29839
+ "mismatch",
29840
+ "symbol"
29841
+ ],
29842
+ properties: {
29843
+ ...findingBaseProperties,
29844
+ category: { type: "string", const: "referenceMismatches" },
29845
+ mismatch: {
29846
+ type: "string",
29847
+ enum: ["unknown-symbol", "signature-changed"]
29848
+ },
29849
+ symbol: { type: "string" }
29850
+ }
29851
+ };
29852
+ const linkFailureFindingSchema = {
29853
+ type: "object",
29854
+ required: [
29855
+ "category",
29856
+ "severity",
29857
+ "location",
29858
+ "subject",
29859
+ "details",
29860
+ "url",
29861
+ "kind",
29862
+ "reason"
29863
+ ],
29864
+ properties: {
29865
+ ...findingBaseProperties,
29866
+ category: { type: "string", const: "linkFailures" },
29867
+ url: { type: "string" },
29868
+ kind: { type: "string", enum: ["internal", "external"] },
29869
+ reason: { type: "string" }
29870
+ }
29871
+ };
29872
+ const sampleFailureFindingSchema = {
29873
+ type: "object",
29874
+ required: [
29875
+ "category",
29876
+ "severity",
29877
+ "location",
29878
+ "subject",
29879
+ "details",
29880
+ "fenceIndex",
29881
+ "lang",
29882
+ "diagnostics"
29883
+ ],
29884
+ properties: {
29885
+ ...findingBaseProperties,
29886
+ category: { type: "string", const: "sampleFailures" },
29887
+ fenceIndex: { type: "integer", minimum: 0 },
29888
+ lang: { type: "string" },
29889
+ diagnostics: { type: "array", items: { type: "string" } }
29890
+ }
29891
+ };
29892
+ return {
29893
+ $schema: "http://json-schema.org/draft-07/schema#",
29894
+ title: "DocsSyncAuditReport",
29895
+ type: "object",
29896
+ additionalProperties: false,
29897
+ required: [
29898
+ "schemaVersion",
29899
+ "issueNumber",
29900
+ "mode",
29901
+ "generatedAt",
29902
+ "repoRoot",
29903
+ "scope",
29904
+ "categories",
29905
+ "findings"
29906
+ ],
29907
+ properties: {
29908
+ schemaVersion: { type: "integer", const: DOCS_SYNC_AUDIT_SCHEMA_VERSION },
29909
+ issueNumber: { type: "integer", minimum: 0 },
29910
+ mode: { type: "string", enum: ["pr", "audit"] },
29911
+ generatedAt: { type: "string", format: "date-time" },
29912
+ repoRoot: { type: "string" },
29913
+ scope: { type: "string" },
29914
+ categories: {
29915
+ type: "object",
29916
+ additionalProperties: false,
29917
+ required: [
29918
+ "apiDiff",
29919
+ "tsdocCoverage",
29920
+ "referenceMismatches",
29921
+ "linkFailures",
29922
+ "sampleFailures"
29923
+ ],
29924
+ properties: {
29925
+ apiDiff: { type: "array", items: apiDiffFindingSchema },
29926
+ tsdocCoverage: { type: "array", items: tsdocCoverageFindingSchema },
29927
+ referenceMismatches: {
29928
+ type: "array",
29929
+ items: referenceMismatchFindingSchema
29930
+ },
29931
+ linkFailures: { type: "array", items: linkFailureFindingSchema },
29932
+ sampleFailures: { type: "array", items: sampleFailureFindingSchema }
29933
+ }
29934
+ },
29935
+ findings: {
29936
+ type: "array",
29937
+ items: {
29938
+ oneOf: [
29939
+ apiDiffFindingSchema,
29940
+ tsdocCoverageFindingSchema,
29941
+ referenceMismatchFindingSchema,
29942
+ linkFailureFindingSchema,
29943
+ sampleFailureFindingSchema
29944
+ ]
29945
+ }
29946
+ }
29947
+ }
29948
+ };
29949
+ }
29950
+
29951
+ // src/docs-sync/scan/run-scan.ts
29952
+ var fs3 = __toESM(require("fs"));
29645
29953
  var path5 = __toESM(require("path"));
29954
+ var DEFAULT_AUDIT_REPORT_DIR = ".claude/state/docs-sync";
29955
+ var SEVERITY_RANK = {
29956
+ blocking: 0,
29957
+ advisory: 1,
29958
+ mechanical: 2
29959
+ };
29960
+ var AUDIT_CATEGORY_ORDER = [
29961
+ AuditCategory.ApiDiff,
29962
+ AuditCategory.TsdocCoverage,
29963
+ AuditCategory.ReferenceMismatches,
29964
+ AuditCategory.LinkFailures,
29965
+ AuditCategory.SampleFailures
29966
+ ];
29967
+ function runScan(options) {
29968
+ const repoRoot = path5.resolve(options.repoRoot);
29969
+ const mode = options.mode;
29970
+ const scope = options.scope ?? "";
29971
+ const issueNumber = options.issueNumber;
29972
+ const checks = options.checks ?? [];
29973
+ const now = options.now ?? /* @__PURE__ */ new Date();
29974
+ const persist = options.persist ?? false;
29975
+ const reportDir = options.reportDir ?? DEFAULT_AUDIT_REPORT_DIR;
29976
+ const context = {
29977
+ repoRoot,
29978
+ mode,
29979
+ scope,
29980
+ issueNumber
29981
+ };
29982
+ const collected = [];
29983
+ for (const check of checks) {
29984
+ const result = check.run(context);
29985
+ for (const finding of result) {
29986
+ collected.push(finding);
29987
+ }
29988
+ }
29989
+ const report = buildReport({
29990
+ issueNumber,
29991
+ mode,
29992
+ scope,
29993
+ repoRoot,
29994
+ generatedAt: now,
29995
+ findings: collected
29996
+ });
29997
+ let reportPath = "";
29998
+ if (persist) {
29999
+ reportPath = persistAuditReport({
30000
+ report,
30001
+ repoRoot,
30002
+ reportDir
30003
+ });
30004
+ }
30005
+ return { report, reportPath };
30006
+ }
30007
+ function buildReport(args) {
30008
+ const buckets = emptyCategoryBuckets();
30009
+ for (const finding of args.findings) {
30010
+ pushIntoBucket(buckets, finding);
30011
+ }
30012
+ buckets.apiDiff.sort(compareFindings);
30013
+ buckets.tsdocCoverage.sort(compareFindings);
30014
+ buckets.referenceMismatches.sort(compareFindings);
30015
+ buckets.linkFailures.sort(compareFindings);
30016
+ buckets.sampleFailures.sort(compareFindings);
30017
+ const flat = [];
30018
+ for (const key of AUDIT_CATEGORY_ORDER) {
30019
+ const bucket = buckets[key];
30020
+ for (const finding of bucket) {
30021
+ flat.push(finding);
30022
+ }
30023
+ }
30024
+ flat.sort(compareFindings);
30025
+ return {
30026
+ schemaVersion: DOCS_SYNC_AUDIT_SCHEMA_VERSION,
30027
+ issueNumber: args.issueNumber,
30028
+ mode: args.mode,
30029
+ generatedAt: args.generatedAt.toISOString(),
30030
+ repoRoot: args.repoRoot,
30031
+ scope: args.scope,
30032
+ categories: {
30033
+ apiDiff: buckets.apiDiff,
30034
+ tsdocCoverage: buckets.tsdocCoverage,
30035
+ referenceMismatches: buckets.referenceMismatches,
30036
+ linkFailures: buckets.linkFailures,
30037
+ sampleFailures: buckets.sampleFailures
30038
+ },
30039
+ findings: flat
30040
+ };
30041
+ }
30042
+ function persistAuditReport(args) {
30043
+ const repoRoot = path5.resolve(args.repoRoot);
30044
+ const reportDir = args.reportDir ?? DEFAULT_AUDIT_REPORT_DIR;
30045
+ const targetDir = path5.resolve(repoRoot, reportDir);
30046
+ fs3.mkdirSync(targetDir, { recursive: true });
30047
+ const targetFile = path5.join(
30048
+ targetDir,
30049
+ `${args.report.issueNumber}-audit.json`
30050
+ );
30051
+ const tempFile = `${targetFile}.tmp-${process.pid}-${Date.now()}`;
30052
+ const serialized = `${JSON.stringify(args.report, null, 2)}
30053
+ `;
30054
+ fs3.writeFileSync(tempFile, serialized, "utf-8");
30055
+ fs3.renameSync(tempFile, targetFile);
30056
+ return targetFile;
30057
+ }
30058
+ function emptyCategoryBuckets() {
30059
+ return {
30060
+ apiDiff: [],
30061
+ tsdocCoverage: [],
30062
+ referenceMismatches: [],
30063
+ linkFailures: [],
30064
+ sampleFailures: []
30065
+ };
30066
+ }
30067
+ function pushIntoBucket(buckets, finding) {
30068
+ switch (finding.category) {
30069
+ case AuditCategory.ApiDiff:
30070
+ buckets.apiDiff.push(finding);
30071
+ return;
30072
+ case AuditCategory.TsdocCoverage:
30073
+ buckets.tsdocCoverage.push(finding);
30074
+ return;
30075
+ case AuditCategory.ReferenceMismatches:
30076
+ buckets.referenceMismatches.push(finding);
30077
+ return;
30078
+ case AuditCategory.LinkFailures:
30079
+ buckets.linkFailures.push(finding);
30080
+ return;
30081
+ case AuditCategory.SampleFailures:
30082
+ buckets.sampleFailures.push(finding);
30083
+ return;
30084
+ default: {
30085
+ const exhaustive = finding;
30086
+ throw new Error(
30087
+ `runScan: unrecognized finding category: ${JSON.stringify(exhaustive)}`
30088
+ );
30089
+ }
30090
+ }
30091
+ }
30092
+ function compareFindings(a, b) {
30093
+ const sevDelta = SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity];
30094
+ if (sevDelta !== 0) {
30095
+ return sevDelta;
30096
+ }
30097
+ if (a.category !== b.category) {
30098
+ return a.category.localeCompare(b.category);
30099
+ }
30100
+ if (a.location.file !== b.location.file) {
30101
+ return a.location.file.localeCompare(b.location.file);
30102
+ }
30103
+ if (a.location.line !== b.location.line) {
30104
+ return a.location.line - b.location.line;
30105
+ }
30106
+ return a.subject.localeCompare(b.subject);
30107
+ }
30108
+
30109
+ // src/docs-sync/tsdoc-coverage/coverage.ts
30110
+ var path6 = __toESM(require("path"));
29646
30111
  var import_tsdoc = require("@microsoft/tsdoc");
29647
30112
  var ts2 = __toESM(require("typescript"));
29648
30113
  var TsDocCoverageKind = {
@@ -29660,8 +30125,8 @@ var DEFAULT_THIN_SUMMARY_WORD_THRESHOLD = 4;
29660
30125
  var DEFAULT_ENTRY_POINT = "src/index.ts";
29661
30126
  function analyzeTsDocCoverage(options) {
29662
30127
  const resolvedOptions = typeof options === "string" ? { packageRoot: options } : options;
29663
- const packageRoot = path5.resolve(resolvedOptions.packageRoot);
29664
- const entryPoint = path5.resolve(
30128
+ const packageRoot = path6.resolve(resolvedOptions.packageRoot);
30129
+ const entryPoint = path6.resolve(
29665
30130
  packageRoot,
29666
30131
  resolvedOptions.entryPoint ?? DEFAULT_ENTRY_POINT
29667
30132
  );
@@ -29724,7 +30189,7 @@ function analyzeTsDocCoverage(options) {
29724
30189
  }
29725
30190
  function resolveCompilerOptions(packageRoot, tsconfigPath) {
29726
30191
  if (tsconfigPath) {
29727
- const absoluteTsconfig = path5.resolve(packageRoot, tsconfigPath);
30192
+ const absoluteTsconfig = path6.resolve(packageRoot, tsconfigPath);
29728
30193
  const configFile = ts2.readConfigFile(absoluteTsconfig, ts2.sys.readFile);
29729
30194
  if (configFile.error) {
29730
30195
  throw new Error(
@@ -29734,7 +30199,7 @@ function resolveCompilerOptions(packageRoot, tsconfigPath) {
29734
30199
  const parsed = ts2.parseJsonConfigFileContent(
29735
30200
  configFile.config,
29736
30201
  ts2.sys,
29737
- path5.dirname(absoluteTsconfig)
30202
+ path6.dirname(absoluteTsconfig)
29738
30203
  );
29739
30204
  return { ...parsed.options, noEmit: true };
29740
30205
  }
@@ -30189,8 +30654,8 @@ var ResetTask = class _ResetTask extends import_projen14.Component {
30189
30654
  const resetTask = this.project.tasks.addTask(this.taskName, {
30190
30655
  description: "Delete build artifacts specified by pathsToRemove option, or artifactsDirectory if pathsToRemove is empty"
30191
30656
  });
30192
- this.pathsToRemove.forEach((path6) => {
30193
- resetTask.exec(`[ -e "${path6}" ] && rm -rf ${path6} || true`);
30657
+ this.pathsToRemove.forEach((path7) => {
30658
+ resetTask.exec(`[ -e "${path7}" ] && rm -rf ${path7} || true`);
30194
30659
  });
30195
30660
  const rootHasTurbo = TurboRepo.of(this.project.root) !== void 0;
30196
30661
  const isSubproject = this.project !== this.project.root;
@@ -32129,11 +32594,15 @@ var TypeScriptConfig = class extends import_projen23.Component {
32129
32594
  AGENT_RULE_SCOPE,
32130
32595
  AGENT_TIER_ROLES,
32131
32596
  AGENT_TIER_VALUES,
32597
+ AUDIT_CATEGORY_ORDER,
32132
32598
  AgentConfig,
32133
32599
  ApiExtractor,
32134
32600
  AstroConfig,
32135
32601
  AstroOutput,
32136
32602
  AstroProject,
32603
+ AuditCategory,
32604
+ AuditMode,
32605
+ AuditSeverity,
32137
32606
  AwsCdkProject,
32138
32607
  AwsDeployWorkflow,
32139
32608
  AwsDeploymentConfig,
@@ -32149,6 +32618,7 @@ var TypeScriptConfig = class extends import_projen23.Component {
32149
32618
  DEFAULT_API_EXTRACTOR_ENTRY_POINT,
32150
32619
  DEFAULT_API_EXTRACTOR_REPORT_FILENAME,
32151
32620
  DEFAULT_API_EXTRACTOR_REPORT_FOLDER,
32621
+ DEFAULT_AUDIT_REPORT_DIR,
32152
32622
  DEFAULT_DECOMPOSITION_TEMPLATE,
32153
32623
  DEFAULT_DELEGATE_TO_PR_REVIEWER,
32154
32624
  DEFAULT_DISPATCH_MODEL,
@@ -32196,6 +32666,7 @@ var TypeScriptConfig = class extends import_projen23.Component {
32196
32666
  DEFAULT_WORKFLOW_DIAGRAMS_ENABLED,
32197
32667
  DEFAULT_WORKFLOW_DIAGRAMS_PATH,
32198
32668
  DEFAULT_WORKFLOW_DIAGRAMS_REQUIRE_UPDATE,
32669
+ DOCS_SYNC_AUDIT_SCHEMA_VERSION,
32199
32670
  JsiiFaker,
32200
32671
  LAYOUT_ENFORCEMENT,
32201
32672
  LAYOUT_ROOT_BY_PROJECT_TYPE,
@@ -32237,6 +32708,7 @@ var TypeScriptConfig = class extends import_projen23.Component {
32237
32708
  addSyncLabelsWorkflow,
32238
32709
  agendaBundle,
32239
32710
  analyzeTsDocCoverage,
32711
+ auditReportJsonSchema,
32240
32712
  awsCdkBundle,
32241
32713
  baseBundle,
32242
32714
  bcmWriterBundle,
@@ -32253,6 +32725,7 @@ var TypeScriptConfig = class extends import_projen23.Component {
32253
32725
  buildOrchestratorConventionsContent,
32254
32726
  buildPeopleProfileBundle,
32255
32727
  buildRegulatoryResearchBundle,
32728
+ buildReport,
32256
32729
  buildRequirementsAnalystBundle,
32257
32730
  buildRequirementsReviewerBundle,
32258
32731
  buildRequirementsWriterBundle,
@@ -32269,6 +32742,7 @@ var TypeScriptConfig = class extends import_projen23.Component {
32269
32742
  compileFencedSamples,
32270
32743
  customerProfileBundle,
32271
32744
  docsSyncBundle,
32745
+ emptyCategoryBuckets,
32272
32746
  extractApiProcedure,
32273
32747
  extractDocReferences,
32274
32748
  extractFencedSamples,
@@ -32282,6 +32756,7 @@ var TypeScriptConfig = class extends import_projen23.Component {
32282
32756
  meetingAnalysisBundle,
32283
32757
  orchestratorBundle,
32284
32758
  peopleProfileBundle,
32759
+ persistAuditReport,
32285
32760
  pnpmBundle,
32286
32761
  prReviewBundle,
32287
32762
  projenBundle,
@@ -32348,6 +32823,7 @@ var TypeScriptConfig = class extends import_projen23.Component {
32348
32823
  resolveTypeScriptProjectOutdir,
32349
32824
  resolveUnblockDependents,
32350
32825
  resolveWorkflowDiagrams,
32826
+ runScan,
32351
32827
  slackBundle,
32352
32828
  softwareProfileBundle,
32353
32829
  standardsResearchBundle,