@h-rig/standard-plugin 0.0.6-alpha.135 → 0.0.6-alpha.136

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.
@@ -1,4 +1,4 @@
1
- import { type DriftFinding, type DriftReport, type StageMutation, type StageResult, type ValidatorRegistration } from "@rig/contracts";
1
+ import { type DriftFinding, type DriftReport, type StageMutation, type StageResult, type StageRun, type ValidatorRegistration } from "@rig/contracts";
2
2
  import type { RegisteredValidator, ValidatorResult } from "@rig/core";
3
3
  import { type DriftDetectOptions } from "./detect";
4
4
  export interface DocsDriftPluginOptions {
@@ -14,6 +14,13 @@ export declare const DOCS_DRIFT_STAGE_MUTATION: StageMutation;
14
14
  export declare const DOCS_DRIFT_CLI_COMMAND = "bun -e 'import { runDriftCli } from \"@rig/standard-plugin/drift\"; process.exitCode = await runDriftCli(process.argv.slice(1), { projectRoot: process.cwd() });' --";
15
15
  export declare function highConfidenceDriftFindings(report: DriftReport): readonly DriftFinding[];
16
16
  export declare function driftGateResult(report: DriftReport, mode?: "observe" | "enforce"): StageResult;
17
+ /**
18
+ * Executable for the `docs-drift` pre-merge gate stage (inserted by
19
+ * DOCS_DRIFT_STAGE_MUTATION before `merge-gate`). Reads the project root from the
20
+ * stage context metadata, runs deletion-survival drift detection, and blocks the
21
+ * pipeline on high-confidence drift when enforcing (`failOnDrift`), else observes.
22
+ */
23
+ export declare function createDocsDriftGateStage(options?: DocsDriftPluginOptions): StageRun;
17
24
  export declare function runDocsDriftValidation(options: DriftDetectOptions & {
18
25
  failOnDrift?: boolean;
19
26
  }): Promise<ValidatorResult>;
@@ -312,7 +312,7 @@ var DOCS_DRIFT_STAGE_MUTATION = Schema.decodeUnknownSync(StageMutationSchema)({
312
312
  id: DOCS_DRIFT_STAGE_ID,
313
313
  kind: "gate",
314
314
  before: ["merge-gate"],
315
- after: ["verify"]
315
+ after: ["open-pr"]
316
316
  },
317
317
  contributedBy: DOCS_DRIFT_STAGE_ID
318
318
  });
@@ -327,6 +327,17 @@ function driftGateResult(report, mode = "enforce") {
327
327
  }
328
328
  return { kind: "allow" };
329
329
  }
330
+ function createDocsDriftGateStage(options = {}) {
331
+ return async (ctx) => {
332
+ const projectRoot = typeof ctx.metadata?.projectRoot === "string" ? ctx.metadata.projectRoot : process.cwd();
333
+ const report = await detectDrift({
334
+ projectRoot,
335
+ ...options.docsGlobs !== undefined ? { docsGlobs: options.docsGlobs } : {},
336
+ ...options.ignoreGlobs !== undefined ? { ignoreGlobs: options.ignoreGlobs } : {}
337
+ });
338
+ return driftGateResult(report, options.failOnDrift ? "enforce" : "observe");
339
+ };
340
+ }
330
341
  async function runDocsDriftValidation(options) {
331
342
  const report = await detectDrift(options);
332
343
  const high = highConfidenceDriftFindings(report);
@@ -412,6 +423,7 @@ export {
412
423
  highConfidenceDriftFindings,
413
424
  driftGateResult,
414
425
  createDocsDriftValidator,
426
+ createDocsDriftGateStage,
415
427
  DOCS_DRIFT_VALIDATOR_ID,
416
428
  DOCS_DRIFT_VALIDATOR,
417
429
  DOCS_DRIFT_STAGE_MUTATION,
package/dist/src/index.js CHANGED
@@ -1294,7 +1294,7 @@ var DOCS_DRIFT_STAGE_MUTATION = Schema.decodeUnknownSync(StageMutationSchema)({
1294
1294
  id: DOCS_DRIFT_STAGE_ID,
1295
1295
  kind: "gate",
1296
1296
  before: ["merge-gate"],
1297
- after: ["verify"]
1297
+ after: ["open-pr"]
1298
1298
  },
1299
1299
  contributedBy: DOCS_DRIFT_STAGE_ID
1300
1300
  });
@@ -1309,6 +1309,17 @@ function driftGateResult(report, mode = "enforce") {
1309
1309
  }
1310
1310
  return { kind: "allow" };
1311
1311
  }
1312
+ function createDocsDriftGateStage(options = {}) {
1313
+ return async (ctx) => {
1314
+ const projectRoot = typeof ctx.metadata?.projectRoot === "string" ? ctx.metadata.projectRoot : process.cwd();
1315
+ const report = await detectDrift({
1316
+ projectRoot,
1317
+ ...options.docsGlobs !== undefined ? { docsGlobs: options.docsGlobs } : {},
1318
+ ...options.ignoreGlobs !== undefined ? { ignoreGlobs: options.ignoreGlobs } : {}
1319
+ });
1320
+ return driftGateResult(report, options.failOnDrift ? "enforce" : "observe");
1321
+ };
1322
+ }
1312
1323
  async function runDocsDriftValidation(options) {
1313
1324
  const report = await detectDrift(options);
1314
1325
  const high = highConfidenceDriftFindings(report);
@@ -1474,6 +1485,7 @@ function standardPlugin(opts = {}) {
1474
1485
  }
1475
1486
  }, {
1476
1487
  validators: [createDocsDriftValidator(opts.drift)],
1488
+ stages: { [DOCS_DRIFT_STAGE_ID]: createDocsDriftGateStage(opts.drift) },
1477
1489
  taskSources: [
1478
1490
  {
1479
1491
  id: "std:github-issues",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/standard-plugin",
3
- "version": "0.0.6-alpha.135",
3
+ "version": "0.0.6-alpha.136",
4
4
  "type": "module",
5
5
  "description": "First-party contribution bundle for Rig's OMP extension plugin graph; not a standalone plugin runtime.",
6
6
  "license": "UNLICENSED",
@@ -29,8 +29,8 @@
29
29
  "module": "./dist/src/index.js",
30
30
  "types": "./dist/src/index.d.ts",
31
31
  "dependencies": {
32
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.135",
33
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.135",
32
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.136",
33
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.136",
34
34
  "effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@8881a9b"
35
35
  }
36
36
  }