@webpieces/pr-gate 0.4.486 → 0.4.488

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-context-writer.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/pr-context-writer.ts"],"names":[],"mappings":";;;;AAAA,0DAEiC;AACjC,yCAA2D;AAE3D;;;;;;;;;;;GAWG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IAEH;IACA;IAFrB,YACqB,SAAoB,EACpB,iBAAoC;QADpC,cAAS,GAAT,SAAS,CAAW;QACpB,sBAAiB,GAAjB,iBAAiB,CAAmB;IACtD,CAAC;IAEJ;;;;;;;;;OASG;IACH,MAAM,CAAC,QAAgB,EAAE,WAAmB,EAAE,SAAiB;QAC3D,IAAI,SAAS,KAAK,EAAE;YAAE,OAAO,IAAI,qCAAsB,EAAE,CAAC;QAC1D,MAAM,IAAI,GAAG,IAAI,kCAAmB,EAAE,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QACrF,MAAM,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAC3C,QAAQ,EAAE,WAAW,EAAE,IAAI,wBAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CACnE,CAAC;QACF,OAAO,IAAI,qCAAsB,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IACpD,CAAC;CACJ,CAAA;AA1BY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGL,wBAAS;QACD,gCAAiB;GAHhD,eAAe,CA0B3B","sourcesContent":["import {\n ChangedFilesOptions, ChecklistReviewContext, DiffScope, PrContext, ReviewJsonService,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\n/**\n * Writes `pr-context.json` (the 3-point base/head sha + the FULL changed-file set) and returns the context\n * every printed review instruction inlines.\n *\n * Extracted so `wp-start-upsert-pr` and `wp-checklist` cannot diverge. It used to live only in wp-start,\n * which meant `wp-checklist` — the command wp-start tells the AI to run FIRST — silently rendered its\n * reviewer blocks with NO `git diff` command and NO full-file-set path whenever wp-start had not run this\n * cycle. A reviewer handed filenames and no way to read the diff is exactly the failure this instruction\n * exists to prevent, and it failed silently, which is worse.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class PrContextWriter {\n constructor(\n private readonly diffScope: DiffScope,\n private readonly reviewJsonService: ReviewJsonService,\n ) {}\n\n /**\n * Compute + persist the context against the fork point the CALLER already resolved, so the sha a\n * reviewer is told to diff against is byte-identical to the one the pattern matching used. Returns an\n * EMPTY context when `forkPoint` is '' (no fork point from main) — callers must say so out loud rather\n * than quietly omit the lines it would have filled; see ChecklistInstructionsService.diffLines.\n *\n * Two things mirror ChecklistScanner deliberately: no head argument to `getChangedFiles` (so the\n * working tree and untracked files are included, not just commits), and `tsOnly:false` (the default\n * drops every *.sql / Dockerfile / .env* file a checklist most wants to key on).\n */\n ensure(repoRoot: string, featureName: string, forkPoint: string): ChecklistReviewContext {\n if (forkPoint === '') return new ChecklistReviewContext();\n const opts = new ChangedFilesOptions();\n opts.tsOnly = false;\n const changed = this.diffScope.getChangedFiles(repoRoot, forkPoint, undefined, opts);\n const p = this.reviewJsonService.writePrContext(\n repoRoot, featureName, new PrContext(forkPoint, 'HEAD', changed),\n );\n return new ChecklistReviewContext(forkPoint, p);\n }\n}\n"]}