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

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,5 +1,5 @@
1
- import { type DriftFinding, type DriftReport, type StageMutation, type StageResult, type ValidatorRegistration } from "@rig/contracts";
2
- import type { RegisteredValidator, ValidatorResult } from "@rig/core";
1
+ import { type DriftFinding, type DriftReport, type StageMutation, type StageResult, type StageRun, type ValidatorRegistration } from "@rig/contracts";
2
+ import type { RegisteredValidator, RuntimeCliCommand, RuntimeCliContext, ValidatorResult } from "@rig/core";
3
3
  import { type DriftDetectOptions } from "./detect";
4
4
  export interface DocsDriftPluginOptions {
5
5
  readonly docsGlobs?: readonly string[];
@@ -9,11 +9,19 @@ export interface DocsDriftPluginOptions {
9
9
  export declare const DOCS_DRIFT_VALIDATOR_ID = "std:docs-drift";
10
10
  export declare const DOCS_DRIFT_CLI_ID = "std:drift";
11
11
  export declare const DOCS_DRIFT_STAGE_ID = "docs-drift";
12
+ export declare const DOCS_DRIFT_CAPABILITY_ID = "std:docs-drift-capability";
12
13
  export declare const DOCS_DRIFT_VALIDATOR: ValidatorRegistration;
13
14
  export declare const DOCS_DRIFT_STAGE_MUTATION: StageMutation;
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
+ export declare const DOCS_DRIFT_CLI_COMMAND = "rig drift [--docs <csv>] [--ignore <csv>] [--fail-on-drift] [--json]";
15
16
  export declare function highConfidenceDriftFindings(report: DriftReport): readonly DriftFinding[];
16
17
  export declare function driftGateResult(report: DriftReport, mode?: "observe" | "enforce"): StageResult;
18
+ /**
19
+ * Executable for the `docs-drift` pre-merge gate stage (inserted by
20
+ * DOCS_DRIFT_STAGE_MUTATION before `merge-gate`). Reads the project root from the
21
+ * stage context metadata, runs deletion-survival drift detection, and blocks the
22
+ * pipeline on high-confidence drift when enforcing (`failOnDrift`), else observes.
23
+ */
24
+ export declare function createDocsDriftGateStage(options?: DocsDriftPluginOptions): StageRun;
17
25
  export declare function runDocsDriftValidation(options: DriftDetectOptions & {
18
26
  failOnDrift?: boolean;
19
27
  }): Promise<ValidatorResult>;
@@ -23,4 +31,33 @@ export interface RunDriftCliOptions {
23
31
  readonly write?: (message: string) => void;
24
32
  readonly writeError?: (message: string) => void;
25
33
  }
34
+ export declare function executeDrift(context: RuntimeCliContext, args: readonly string[], options?: DocsDriftPluginOptions): Promise<{
35
+ ok: boolean;
36
+ group: string;
37
+ command: string;
38
+ details: {
39
+ report: {
40
+ readonly degraded: boolean;
41
+ readonly generatedAt: string;
42
+ readonly findings: readonly {
43
+ readonly kind: "deleted-reference" | "stale-anchor" | "semantic-mismatch" | "issue-mismatch";
44
+ readonly detail: string;
45
+ readonly line: number | null;
46
+ readonly reference: string | null;
47
+ readonly docPath: string;
48
+ readonly confidence: "high" | "medium" | "low";
49
+ }[];
50
+ readonly scanned: number;
51
+ };
52
+ summary: {
53
+ total: number;
54
+ highConfidence: number;
55
+ degraded: boolean;
56
+ };
57
+ failOnDrift: boolean;
58
+ failed: boolean;
59
+ };
60
+ }>;
61
+ export declare function createDocsDriftRuntimeCliCommand(options?: DocsDriftPluginOptions): RuntimeCliCommand;
62
+ export declare const DOCS_DRIFT_RUNTIME_CLI_COMMAND: RuntimeCliCommand;
26
63
  export declare function runDriftCli(args: readonly string[], options?: RunDriftCliOptions): Promise<number>;
@@ -301,6 +301,7 @@ async function detectDrift(options) {
301
301
  var DOCS_DRIFT_VALIDATOR_ID = "std:docs-drift";
302
302
  var DOCS_DRIFT_CLI_ID = "std:drift";
303
303
  var DOCS_DRIFT_STAGE_ID = "docs-drift";
304
+ var DOCS_DRIFT_CAPABILITY_ID = "std:docs-drift-capability";
304
305
  var DOCS_DRIFT_VALIDATOR = {
305
306
  id: DOCS_DRIFT_VALIDATOR_ID,
306
307
  category: "regression",
@@ -312,11 +313,11 @@ var DOCS_DRIFT_STAGE_MUTATION = Schema.decodeUnknownSync(StageMutationSchema)({
312
313
  id: DOCS_DRIFT_STAGE_ID,
313
314
  kind: "gate",
314
315
  before: ["merge-gate"],
315
- after: ["verify"]
316
+ after: ["open-pr"]
316
317
  },
317
318
  contributedBy: DOCS_DRIFT_STAGE_ID
318
319
  });
319
- var DOCS_DRIFT_CLI_COMMAND = `bun -e 'import { runDriftCli } from "@rig/standard-plugin/drift"; process.exitCode = await runDriftCli(process.argv.slice(1), { projectRoot: process.cwd() });' --`;
320
+ var DOCS_DRIFT_CLI_COMMAND = "rig drift [--docs <csv>] [--ignore <csv>] [--fail-on-drift] [--json]";
320
321
  function highConfidenceDriftFindings(report) {
321
322
  return report.findings.filter((finding) => finding.confidence === "high");
322
323
  }
@@ -327,6 +328,17 @@ function driftGateResult(report, mode = "enforce") {
327
328
  }
328
329
  return { kind: "allow" };
329
330
  }
331
+ function createDocsDriftGateStage(options = {}) {
332
+ return async (ctx) => {
333
+ const projectRoot = typeof ctx.metadata?.projectRoot === "string" ? ctx.metadata.projectRoot : process.cwd();
334
+ const report = await detectDrift({
335
+ projectRoot,
336
+ ...options.docsGlobs !== undefined ? { docsGlobs: options.docsGlobs } : {},
337
+ ...options.ignoreGlobs !== undefined ? { ignoreGlobs: options.ignoreGlobs } : {}
338
+ });
339
+ return driftGateResult(report, options.failOnDrift ? "enforce" : "observe");
340
+ };
341
+ }
330
342
  async function runDocsDriftValidation(options) {
331
343
  const report = await detectDrift(options);
332
344
  const high = highConfidenceDriftFindings(report);
@@ -358,6 +370,76 @@ function takeOptionValue(args, index, flag) {
358
370
  throw new Error(`${flag} requires a value`);
359
371
  return value;
360
372
  }
373
+ function takeFlag(args, flag) {
374
+ const rest = [...args];
375
+ const index = rest.indexOf(flag);
376
+ if (index < 0)
377
+ return { value: false, rest };
378
+ rest.splice(index, 1);
379
+ return { value: true, rest };
380
+ }
381
+ function takeOption(args, flag) {
382
+ const rest = [...args];
383
+ const index = rest.indexOf(flag);
384
+ if (index < 0)
385
+ return { rest };
386
+ const value = rest[index + 1];
387
+ if (!value || value.startsWith("-"))
388
+ throw new Error(`${flag} requires a value.`);
389
+ rest.splice(index, 2);
390
+ return { value, rest };
391
+ }
392
+ function requireNoExtraArgs(args, usage) {
393
+ if (args.length > 0)
394
+ throw new Error(`Unexpected argument: ${args[0]}
395
+ Usage: ${usage}`);
396
+ }
397
+ function parseCsv(value) {
398
+ return value?.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0) ?? [];
399
+ }
400
+ function driftSummary(report) {
401
+ const highConfidence = highConfidenceDriftFindings(report).length;
402
+ return { total: report.findings.length, highConfidence, degraded: report.degraded };
403
+ }
404
+ async function executeDrift(context, args, options = {}) {
405
+ const json = takeFlag(args, "--json");
406
+ const docs = takeOption(json.rest, "--docs");
407
+ const ignore = takeOption(docs.rest, "--ignore");
408
+ const failOnDrift = takeFlag(ignore.rest, "--fail-on-drift");
409
+ requireNoExtraArgs(failOnDrift.rest, "rig drift [--docs <csv>] [--ignore <csv>] [--fail-on-drift] [--json]");
410
+ const docsGlobs = parseCsv(docs.value);
411
+ const ignoreGlobs = parseCsv(ignore.value);
412
+ const effectiveDocsGlobs = docsGlobs.length > 0 ? docsGlobs : options.docsGlobs;
413
+ const effectiveIgnoreGlobs = ignoreGlobs.length > 0 ? ignoreGlobs : options.ignoreGlobs;
414
+ const effectiveFailOnDrift = failOnDrift.value || options.failOnDrift === true;
415
+ const report = await detectDrift({
416
+ projectRoot: context.projectRoot,
417
+ ...effectiveDocsGlobs !== undefined ? { docsGlobs: effectiveDocsGlobs } : {},
418
+ ...effectiveIgnoreGlobs !== undefined ? { ignoreGlobs: effectiveIgnoreGlobs } : {}
419
+ });
420
+ const failed = effectiveFailOnDrift && highConfidenceDriftFindings(report).length > 0;
421
+ const details = { report, summary: driftSummary(report), failOnDrift: effectiveFailOnDrift, failed };
422
+ if (context.outputMode === "text") {
423
+ if (json.value)
424
+ console.log(JSON.stringify(details, null, 2));
425
+ else
426
+ console.log(report.findings.length === 0 ? `No drift findings across ${report.scanned} documents.` : report.findings.map((finding) => `${finding.docPath}:${finding.line ?? "?"} ${finding.kind} ${finding.confidence} ${finding.detail}`).join(`
427
+ `));
428
+ }
429
+ return { ok: !failed, group: "drift", command: "scan", details };
430
+ }
431
+ function createDocsDriftRuntimeCliCommand(options = {}) {
432
+ return {
433
+ id: DOCS_DRIFT_CLI_ID,
434
+ family: "drift",
435
+ command: DOCS_DRIFT_CLI_COMMAND,
436
+ description: "Scan documentation for stale code references.",
437
+ usage: DOCS_DRIFT_CLI_COMMAND,
438
+ projectRequired: true,
439
+ run: (context, args) => executeDrift(context, args, options)
440
+ };
441
+ }
442
+ var DOCS_DRIFT_RUNTIME_CLI_COMMAND = createDocsDriftRuntimeCliCommand();
361
443
  async function runDriftCli(args, options = {}) {
362
444
  const docsGlobs = [];
363
445
  const ignoreGlobs = [];
@@ -410,12 +492,17 @@ export {
410
492
  runDriftCli,
411
493
  runDocsDriftValidation,
412
494
  highConfidenceDriftFindings,
495
+ executeDrift,
413
496
  driftGateResult,
414
497
  createDocsDriftValidator,
498
+ createDocsDriftRuntimeCliCommand,
499
+ createDocsDriftGateStage,
415
500
  DOCS_DRIFT_VALIDATOR_ID,
416
501
  DOCS_DRIFT_VALIDATOR,
417
502
  DOCS_DRIFT_STAGE_MUTATION,
418
503
  DOCS_DRIFT_STAGE_ID,
504
+ DOCS_DRIFT_RUNTIME_CLI_COMMAND,
419
505
  DOCS_DRIFT_CLI_ID,
420
- DOCS_DRIFT_CLI_COMMAND
506
+ DOCS_DRIFT_CLI_COMMAND,
507
+ DOCS_DRIFT_CAPABILITY_ID
421
508
  };
@@ -1,25 +1,3 @@
1
- import { type RigPluginWithRuntime } from "@rig/core";
2
- import { createEnvGitHubCredentialProvider, createStateGitHubCredentialProvider, createGitHubIssuesTaskSource, type GitHubCredentialProvider, type GitHubIssuesOptions } from "./github-issues-source";
3
- import { createFilesTaskSource } from "./files-source";
4
- import { type DocsDriftPluginOptions } from "./drift/plugin";
5
- export { createGitHubIssuesTaskSource, createEnvGitHubCredentialProvider, createStateGitHubCredentialProvider, createFilesTaskSource };
6
- export { createDocsDriftValidator, DOCS_DRIFT_CLI_ID, DOCS_DRIFT_STAGE_ID, DOCS_DRIFT_VALIDATOR_ID, driftGateResult, runDocsDriftValidation, runDriftCli } from "./drift/plugin";
7
- export { detectDrift, detectDeletedReferences, detectStaleAnchors } from "./drift/detect";
8
- export { extractDriftReferences } from "./drift/extract-refs";
9
- export { makeDriftGit } from "./drift/git-adapter";
10
- export { judgeDocumentationDrift } from "./drift/judge";
11
- export type { DriftReference, DriftReferenceKind } from "./drift/extract-refs";
12
- export type { DriftGit } from "./drift/git-adapter";
13
- export type { DriftJudgeInput, DriftJudgeMismatch, DriftJudgeProvider } from "./drift/judge";
14
- export type { GitHubIssuesOptions } from "./github-issues-source";
15
- export type { FilesTaskSourceOptions } from "./files-source";
16
- export type { DocsDriftPluginOptions } from "./drift/plugin";
17
- export interface StandardPluginOptions {
18
- githubCredentialProvider?: GitHubCredentialProvider;
19
- githubWorkspaceId?: string;
20
- githubUserId?: string;
21
- githubSpawn?: GitHubIssuesOptions["spawn"];
22
- onGitHubTaskChanged?: GitHubIssuesOptions["onTaskChanged"];
23
- drift?: DocsDriftPluginOptions;
24
- }
25
- export default function standardPlugin(opts?: StandardPluginOptions): RigPluginWithRuntime;
1
+ export * from "./plugin";
2
+ export { default } from "./plugin";
3
+ export { standardProjectPlugins, type StandardProjectPluginsOptions } from "./bundle";
package/dist/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- // packages/standard-plugin/src/index.ts
2
+ // packages/standard-plugin/src/plugin.ts
3
3
  import { resolve as resolve4 } from "path";
4
4
  import { definePlugin } from "@rig/core";
5
5
 
@@ -1283,6 +1283,7 @@ async function detectDrift(options) {
1283
1283
  var DOCS_DRIFT_VALIDATOR_ID = "std:docs-drift";
1284
1284
  var DOCS_DRIFT_CLI_ID = "std:drift";
1285
1285
  var DOCS_DRIFT_STAGE_ID = "docs-drift";
1286
+ var DOCS_DRIFT_CAPABILITY_ID = "std:docs-drift-capability";
1286
1287
  var DOCS_DRIFT_VALIDATOR = {
1287
1288
  id: DOCS_DRIFT_VALIDATOR_ID,
1288
1289
  category: "regression",
@@ -1294,11 +1295,11 @@ var DOCS_DRIFT_STAGE_MUTATION = Schema.decodeUnknownSync(StageMutationSchema)({
1294
1295
  id: DOCS_DRIFT_STAGE_ID,
1295
1296
  kind: "gate",
1296
1297
  before: ["merge-gate"],
1297
- after: ["verify"]
1298
+ after: ["open-pr"]
1298
1299
  },
1299
1300
  contributedBy: DOCS_DRIFT_STAGE_ID
1300
1301
  });
1301
- var DOCS_DRIFT_CLI_COMMAND = `bun -e 'import { runDriftCli } from "@rig/standard-plugin/drift"; process.exitCode = await runDriftCli(process.argv.slice(1), { projectRoot: process.cwd() });' --`;
1302
+ var DOCS_DRIFT_CLI_COMMAND = "rig drift [--docs <csv>] [--ignore <csv>] [--fail-on-drift] [--json]";
1302
1303
  function highConfidenceDriftFindings(report) {
1303
1304
  return report.findings.filter((finding) => finding.confidence === "high");
1304
1305
  }
@@ -1309,6 +1310,17 @@ function driftGateResult(report, mode = "enforce") {
1309
1310
  }
1310
1311
  return { kind: "allow" };
1311
1312
  }
1313
+ function createDocsDriftGateStage(options = {}) {
1314
+ return async (ctx) => {
1315
+ const projectRoot = typeof ctx.metadata?.projectRoot === "string" ? ctx.metadata.projectRoot : process.cwd();
1316
+ const report = await detectDrift({
1317
+ projectRoot,
1318
+ ...options.docsGlobs !== undefined ? { docsGlobs: options.docsGlobs } : {},
1319
+ ...options.ignoreGlobs !== undefined ? { ignoreGlobs: options.ignoreGlobs } : {}
1320
+ });
1321
+ return driftGateResult(report, options.failOnDrift ? "enforce" : "observe");
1322
+ };
1323
+ }
1312
1324
  async function runDocsDriftValidation(options) {
1313
1325
  const report = await detectDrift(options);
1314
1326
  const high = highConfidenceDriftFindings(report);
@@ -1340,6 +1352,76 @@ function takeOptionValue(args, index, flag) {
1340
1352
  throw new Error(`${flag} requires a value`);
1341
1353
  return value;
1342
1354
  }
1355
+ function takeFlag(args, flag) {
1356
+ const rest = [...args];
1357
+ const index = rest.indexOf(flag);
1358
+ if (index < 0)
1359
+ return { value: false, rest };
1360
+ rest.splice(index, 1);
1361
+ return { value: true, rest };
1362
+ }
1363
+ function takeOption(args, flag) {
1364
+ const rest = [...args];
1365
+ const index = rest.indexOf(flag);
1366
+ if (index < 0)
1367
+ return { rest };
1368
+ const value = rest[index + 1];
1369
+ if (!value || value.startsWith("-"))
1370
+ throw new Error(`${flag} requires a value.`);
1371
+ rest.splice(index, 2);
1372
+ return { value, rest };
1373
+ }
1374
+ function requireNoExtraArgs(args, usage) {
1375
+ if (args.length > 0)
1376
+ throw new Error(`Unexpected argument: ${args[0]}
1377
+ Usage: ${usage}`);
1378
+ }
1379
+ function parseCsv(value) {
1380
+ return value?.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0) ?? [];
1381
+ }
1382
+ function driftSummary(report) {
1383
+ const highConfidence = highConfidenceDriftFindings(report).length;
1384
+ return { total: report.findings.length, highConfidence, degraded: report.degraded };
1385
+ }
1386
+ async function executeDrift(context, args, options = {}) {
1387
+ const json = takeFlag(args, "--json");
1388
+ const docs = takeOption(json.rest, "--docs");
1389
+ const ignore = takeOption(docs.rest, "--ignore");
1390
+ const failOnDrift = takeFlag(ignore.rest, "--fail-on-drift");
1391
+ requireNoExtraArgs(failOnDrift.rest, "rig drift [--docs <csv>] [--ignore <csv>] [--fail-on-drift] [--json]");
1392
+ const docsGlobs = parseCsv(docs.value);
1393
+ const ignoreGlobs = parseCsv(ignore.value);
1394
+ const effectiveDocsGlobs = docsGlobs.length > 0 ? docsGlobs : options.docsGlobs;
1395
+ const effectiveIgnoreGlobs = ignoreGlobs.length > 0 ? ignoreGlobs : options.ignoreGlobs;
1396
+ const effectiveFailOnDrift = failOnDrift.value || options.failOnDrift === true;
1397
+ const report = await detectDrift({
1398
+ projectRoot: context.projectRoot,
1399
+ ...effectiveDocsGlobs !== undefined ? { docsGlobs: effectiveDocsGlobs } : {},
1400
+ ...effectiveIgnoreGlobs !== undefined ? { ignoreGlobs: effectiveIgnoreGlobs } : {}
1401
+ });
1402
+ const failed = effectiveFailOnDrift && highConfidenceDriftFindings(report).length > 0;
1403
+ const details = { report, summary: driftSummary(report), failOnDrift: effectiveFailOnDrift, failed };
1404
+ if (context.outputMode === "text") {
1405
+ if (json.value)
1406
+ console.log(JSON.stringify(details, null, 2));
1407
+ else
1408
+ console.log(report.findings.length === 0 ? `No drift findings across ${report.scanned} documents.` : report.findings.map((finding) => `${finding.docPath}:${finding.line ?? "?"} ${finding.kind} ${finding.confidence} ${finding.detail}`).join(`
1409
+ `));
1410
+ }
1411
+ return { ok: !failed, group: "drift", command: "scan", details };
1412
+ }
1413
+ function createDocsDriftRuntimeCliCommand(options = {}) {
1414
+ return {
1415
+ id: DOCS_DRIFT_CLI_ID,
1416
+ family: "drift",
1417
+ command: DOCS_DRIFT_CLI_COMMAND,
1418
+ description: "Scan documentation for stale code references.",
1419
+ usage: DOCS_DRIFT_CLI_COMMAND,
1420
+ projectRequired: true,
1421
+ run: (context, args) => executeDrift(context, args, options)
1422
+ };
1423
+ }
1424
+ var DOCS_DRIFT_RUNTIME_CLI_COMMAND = createDocsDriftRuntimeCliCommand();
1343
1425
  async function runDriftCli(args, options = {}) {
1344
1426
  const docsGlobs = [];
1345
1427
  const ignoreGlobs = [];
@@ -1400,7 +1482,8 @@ async function judgeDocumentationDrift(provider, input) {
1400
1482
  confidence: mismatch.confidence ?? "medium"
1401
1483
  }));
1402
1484
  }
1403
- // packages/standard-plugin/src/index.ts
1485
+ // packages/standard-plugin/src/plugin.ts
1486
+ var DOCS_HEALTH_PANEL_ID = "docs-health";
1404
1487
  function requireStringField(config, field, kind) {
1405
1488
  const value = config[field];
1406
1489
  if (!value) {
@@ -1445,6 +1528,35 @@ function githubProjectsOptionsFromConfig(config, context) {
1445
1528
  function booleanOption(value) {
1446
1529
  return typeof value === "boolean" ? value : undefined;
1447
1530
  }
1531
+ function panelProjectRoot(context) {
1532
+ return isRecord(context) && typeof context.projectRoot === "string" && context.projectRoot.length > 0 ? context.projectRoot : null;
1533
+ }
1534
+ function driftFindingPanelId(finding, index) {
1535
+ return `${finding.docPath}:${finding.line ?? index}:${finding.kind}`;
1536
+ }
1537
+ function createDocsHealthPanelProducer(options = {}) {
1538
+ return async (context) => {
1539
+ const projectRoot = panelProjectRoot(context);
1540
+ if (!projectRoot)
1541
+ return;
1542
+ const report = await detectDrift({
1543
+ projectRoot,
1544
+ ...options.docsGlobs !== undefined ? { docsGlobs: options.docsGlobs } : {},
1545
+ ...options.ignoreGlobs !== undefined ? { ignoreGlobs: options.ignoreGlobs } : {}
1546
+ });
1547
+ return {
1548
+ findings: report.findings.map((finding, index) => ({
1549
+ id: driftFindingPanelId(finding, index),
1550
+ docPath: finding.docPath,
1551
+ kind: finding.kind,
1552
+ confidence: finding.confidence,
1553
+ summary: finding.detail,
1554
+ taskId: null
1555
+ })),
1556
+ degraded: report.degraded ? "drift scan degraded" : null
1557
+ };
1558
+ };
1559
+ }
1448
1560
  function standardPlugin(opts = {}) {
1449
1561
  return definePlugin({
1450
1562
  name: "rig-standard",
@@ -1463,17 +1575,33 @@ function standardPlugin(opts = {}) {
1463
1575
  description: "JSON files in a local directory"
1464
1576
  }
1465
1577
  ],
1578
+ capabilities: [
1579
+ { id: DOCS_DRIFT_CAPABILITY_ID, title: "Documentation drift detection", commandId: DOCS_DRIFT_CLI_ID, panelId: DOCS_HEALTH_PANEL_ID }
1580
+ ],
1581
+ panels: [
1582
+ { id: DOCS_HEALTH_PANEL_ID, slot: "capability", title: "Documentation drift", capabilityId: DOCS_DRIFT_CAPABILITY_ID }
1583
+ ],
1466
1584
  cliCommands: [
1467
1585
  {
1468
1586
  id: DOCS_DRIFT_CLI_ID,
1587
+ family: "drift",
1469
1588
  command: DOCS_DRIFT_CLI_COMMAND,
1470
- description: "Scan documentation for stale code references."
1589
+ description: "Scan documentation for stale code references.",
1590
+ projectRequired: true
1471
1591
  }
1472
1592
  ],
1473
1593
  stageMutations: [DOCS_DRIFT_STAGE_MUTATION]
1474
1594
  }
1475
1595
  }, {
1476
1596
  validators: [createDocsDriftValidator(opts.drift)],
1597
+ stages: { [DOCS_DRIFT_STAGE_ID]: createDocsDriftGateStage(opts.drift) },
1598
+ featureCapabilities: [
1599
+ { id: DOCS_DRIFT_CAPABILITY_ID, title: "Documentation drift detection", commandId: DOCS_DRIFT_CLI_ID, panelId: DOCS_HEALTH_PANEL_ID }
1600
+ ],
1601
+ panels: [
1602
+ { id: DOCS_HEALTH_PANEL_ID, slot: "capability", title: "Documentation drift", capabilityId: DOCS_DRIFT_CAPABILITY_ID, produce: createDocsHealthPanelProducer(opts.drift) }
1603
+ ],
1604
+ cliCommands: [createDocsDriftRuntimeCliCommand(opts.drift)],
1477
1605
  taskSources: [
1478
1606
  {
1479
1607
  id: "std:github-issues",
@@ -1530,12 +1658,30 @@ function standardPlugin(opts = {}) {
1530
1658
  ]
1531
1659
  });
1532
1660
  }
1661
+ // packages/standard-plugin/src/bundle.ts
1662
+ import { createBlockerClassifierPlugin } from "@rig/blocker-classifier-plugin";
1663
+ import { createDefaultLifecyclePlugin } from "@rig/bundle-default-lifecycle";
1664
+ import { createDependencyGraphPlugin } from "@rig/dependency-graph-plugin";
1665
+ import { createPlanningPlugin } from "@rig/planning-plugin";
1666
+ import { createSupervisorPlugin } from "@rig/supervisor-plugin";
1667
+ function standardProjectPlugins(options = {}) {
1668
+ return [
1669
+ createDefaultLifecyclePlugin(),
1670
+ createDependencyGraphPlugin(),
1671
+ createBlockerClassifierPlugin(),
1672
+ createPlanningPlugin(),
1673
+ createSupervisorPlugin(),
1674
+ standardPlugin(options.standard)
1675
+ ];
1676
+ }
1533
1677
  export {
1678
+ standardProjectPlugins,
1534
1679
  runDriftCli,
1535
1680
  runDocsDriftValidation,
1536
1681
  makeDriftGit,
1537
1682
  judgeDocumentationDrift,
1538
1683
  extractDriftReferences,
1684
+ executeDrift,
1539
1685
  driftGateResult,
1540
1686
  detectStaleAnchors,
1541
1687
  detectDrift,
@@ -1546,7 +1692,11 @@ export {
1546
1692
  createFilesTaskSource,
1547
1693
  createEnvGitHubCredentialProvider,
1548
1694
  createDocsDriftValidator,
1695
+ createDocsDriftRuntimeCliCommand,
1696
+ DOCS_HEALTH_PANEL_ID,
1549
1697
  DOCS_DRIFT_VALIDATOR_ID,
1550
1698
  DOCS_DRIFT_STAGE_ID,
1551
- DOCS_DRIFT_CLI_ID
1699
+ DOCS_DRIFT_RUNTIME_CLI_COMMAND,
1700
+ DOCS_DRIFT_CLI_ID,
1701
+ DOCS_DRIFT_CAPABILITY_ID
1552
1702
  };
@@ -0,0 +1,26 @@
1
+ import { type RigPluginWithRuntime } from "@rig/core";
2
+ import { createEnvGitHubCredentialProvider, createStateGitHubCredentialProvider, createGitHubIssuesTaskSource, type GitHubCredentialProvider, type GitHubIssuesOptions } from "./github-issues-source";
3
+ import { createFilesTaskSource } from "./files-source";
4
+ import { type DocsDriftPluginOptions } from "./drift/plugin";
5
+ export { createGitHubIssuesTaskSource, createEnvGitHubCredentialProvider, createStateGitHubCredentialProvider, createFilesTaskSource };
6
+ export { createDocsDriftRuntimeCliCommand, createDocsDriftValidator, DOCS_DRIFT_CAPABILITY_ID, DOCS_DRIFT_CLI_ID, DOCS_DRIFT_RUNTIME_CLI_COMMAND, DOCS_DRIFT_STAGE_ID, DOCS_DRIFT_VALIDATOR_ID, driftGateResult, executeDrift, runDocsDriftValidation, runDriftCli } from "./drift/plugin";
7
+ export { detectDrift, detectDeletedReferences, detectStaleAnchors } from "./drift/detect";
8
+ export { extractDriftReferences } from "./drift/extract-refs";
9
+ export { makeDriftGit } from "./drift/git-adapter";
10
+ export { judgeDocumentationDrift } from "./drift/judge";
11
+ export type { DriftReference, DriftReferenceKind } from "./drift/extract-refs";
12
+ export type { DriftGit } from "./drift/git-adapter";
13
+ export type { DriftJudgeInput, DriftJudgeMismatch, DriftJudgeProvider } from "./drift/judge";
14
+ export type { GitHubIssuesOptions } from "./github-issues-source";
15
+ export type { FilesTaskSourceOptions } from "./files-source";
16
+ export type { DocsDriftPluginOptions } from "./drift/plugin";
17
+ export declare const DOCS_HEALTH_PANEL_ID = "docs-health";
18
+ export interface StandardPluginOptions {
19
+ githubCredentialProvider?: GitHubCredentialProvider;
20
+ githubWorkspaceId?: string;
21
+ githubUserId?: string;
22
+ githubSpawn?: GitHubIssuesOptions["spawn"];
23
+ onGitHubTaskChanged?: GitHubIssuesOptions["onTaskChanged"];
24
+ drift?: DocsDriftPluginOptions;
25
+ }
26
+ export default function standardPlugin(opts?: StandardPluginOptions): RigPluginWithRuntime;