@h-rig/standard-plugin 0.0.6-alpha.136 → 0.0.6-alpha.138
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/dist/src/bundle.d.ts +6 -0
- package/dist/src/bundle.js +1602 -0
- package/dist/src/drift/plugin.d.ts +32 -2
- package/dist/src/drift/plugin.js +77 -2
- package/dist/src/index.d.ts +3 -25
- package/dist/src/index.js +143 -5
- package/dist/src/plugin.d.ts +26 -0
- package/dist/src/plugin.js +1685 -0
- package/package.json +16 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DriftFinding, type DriftReport, type StageMutation, type StageResult, type StageRun, type ValidatorRegistration } from "@rig/contracts";
|
|
2
|
-
import type { RegisteredValidator, ValidatorResult } from "@rig/core";
|
|
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,9 +9,10 @@ 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 = "
|
|
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;
|
|
17
18
|
/**
|
|
@@ -30,4 +31,33 @@ export interface RunDriftCliOptions {
|
|
|
30
31
|
readonly write?: (message: string) => void;
|
|
31
32
|
readonly writeError?: (message: string) => void;
|
|
32
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;
|
|
33
63
|
export declare function runDriftCli(args: readonly string[], options?: RunDriftCliOptions): Promise<number>;
|
package/dist/src/drift/plugin.js
CHANGED
|
@@ -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",
|
|
@@ -316,7 +317,7 @@ var DOCS_DRIFT_STAGE_MUTATION = Schema.decodeUnknownSync(StageMutationSchema)({
|
|
|
316
317
|
},
|
|
317
318
|
contributedBy: DOCS_DRIFT_STAGE_ID
|
|
318
319
|
});
|
|
319
|
-
var DOCS_DRIFT_CLI_COMMAND =
|
|
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
|
}
|
|
@@ -369,6 +370,76 @@ function takeOptionValue(args, index, flag) {
|
|
|
369
370
|
throw new Error(`${flag} requires a value`);
|
|
370
371
|
return value;
|
|
371
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();
|
|
372
443
|
async function runDriftCli(args, options = {}) {
|
|
373
444
|
const docsGlobs = [];
|
|
374
445
|
const ignoreGlobs = [];
|
|
@@ -421,13 +492,17 @@ export {
|
|
|
421
492
|
runDriftCli,
|
|
422
493
|
runDocsDriftValidation,
|
|
423
494
|
highConfidenceDriftFindings,
|
|
495
|
+
executeDrift,
|
|
424
496
|
driftGateResult,
|
|
425
497
|
createDocsDriftValidator,
|
|
498
|
+
createDocsDriftRuntimeCliCommand,
|
|
426
499
|
createDocsDriftGateStage,
|
|
427
500
|
DOCS_DRIFT_VALIDATOR_ID,
|
|
428
501
|
DOCS_DRIFT_VALIDATOR,
|
|
429
502
|
DOCS_DRIFT_STAGE_MUTATION,
|
|
430
503
|
DOCS_DRIFT_STAGE_ID,
|
|
504
|
+
DOCS_DRIFT_RUNTIME_CLI_COMMAND,
|
|
431
505
|
DOCS_DRIFT_CLI_ID,
|
|
432
|
-
DOCS_DRIFT_CLI_COMMAND
|
|
506
|
+
DOCS_DRIFT_CLI_COMMAND,
|
|
507
|
+
DOCS_DRIFT_CAPABILITY_ID
|
|
433
508
|
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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/
|
|
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",
|
|
@@ -1298,7 +1299,7 @@ var DOCS_DRIFT_STAGE_MUTATION = Schema.decodeUnknownSync(StageMutationSchema)({
|
|
|
1298
1299
|
},
|
|
1299
1300
|
contributedBy: DOCS_DRIFT_STAGE_ID
|
|
1300
1301
|
});
|
|
1301
|
-
var DOCS_DRIFT_CLI_COMMAND =
|
|
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
|
}
|
|
@@ -1351,6 +1352,76 @@ function takeOptionValue(args, index, flag) {
|
|
|
1351
1352
|
throw new Error(`${flag} requires a value`);
|
|
1352
1353
|
return value;
|
|
1353
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();
|
|
1354
1425
|
async function runDriftCli(args, options = {}) {
|
|
1355
1426
|
const docsGlobs = [];
|
|
1356
1427
|
const ignoreGlobs = [];
|
|
@@ -1411,7 +1482,8 @@ async function judgeDocumentationDrift(provider, input) {
|
|
|
1411
1482
|
confidence: mismatch.confidence ?? "medium"
|
|
1412
1483
|
}));
|
|
1413
1484
|
}
|
|
1414
|
-
// packages/standard-plugin/src/
|
|
1485
|
+
// packages/standard-plugin/src/plugin.ts
|
|
1486
|
+
var DOCS_HEALTH_PANEL_ID = "docs-health";
|
|
1415
1487
|
function requireStringField(config, field, kind) {
|
|
1416
1488
|
const value = config[field];
|
|
1417
1489
|
if (!value) {
|
|
@@ -1456,6 +1528,35 @@ function githubProjectsOptionsFromConfig(config, context) {
|
|
|
1456
1528
|
function booleanOption(value) {
|
|
1457
1529
|
return typeof value === "boolean" ? value : undefined;
|
|
1458
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
|
+
}
|
|
1459
1560
|
function standardPlugin(opts = {}) {
|
|
1460
1561
|
return definePlugin({
|
|
1461
1562
|
name: "rig-standard",
|
|
@@ -1474,11 +1575,19 @@ function standardPlugin(opts = {}) {
|
|
|
1474
1575
|
description: "JSON files in a local directory"
|
|
1475
1576
|
}
|
|
1476
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
|
+
],
|
|
1477
1584
|
cliCommands: [
|
|
1478
1585
|
{
|
|
1479
1586
|
id: DOCS_DRIFT_CLI_ID,
|
|
1587
|
+
family: "drift",
|
|
1480
1588
|
command: DOCS_DRIFT_CLI_COMMAND,
|
|
1481
|
-
description: "Scan documentation for stale code references."
|
|
1589
|
+
description: "Scan documentation for stale code references.",
|
|
1590
|
+
projectRequired: true
|
|
1482
1591
|
}
|
|
1483
1592
|
],
|
|
1484
1593
|
stageMutations: [DOCS_DRIFT_STAGE_MUTATION]
|
|
@@ -1486,6 +1595,13 @@ function standardPlugin(opts = {}) {
|
|
|
1486
1595
|
}, {
|
|
1487
1596
|
validators: [createDocsDriftValidator(opts.drift)],
|
|
1488
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)],
|
|
1489
1605
|
taskSources: [
|
|
1490
1606
|
{
|
|
1491
1607
|
id: "std:github-issues",
|
|
@@ -1542,12 +1658,30 @@ function standardPlugin(opts = {}) {
|
|
|
1542
1658
|
]
|
|
1543
1659
|
});
|
|
1544
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
|
+
}
|
|
1545
1677
|
export {
|
|
1678
|
+
standardProjectPlugins,
|
|
1546
1679
|
runDriftCli,
|
|
1547
1680
|
runDocsDriftValidation,
|
|
1548
1681
|
makeDriftGit,
|
|
1549
1682
|
judgeDocumentationDrift,
|
|
1550
1683
|
extractDriftReferences,
|
|
1684
|
+
executeDrift,
|
|
1551
1685
|
driftGateResult,
|
|
1552
1686
|
detectStaleAnchors,
|
|
1553
1687
|
detectDrift,
|
|
@@ -1558,7 +1692,11 @@ export {
|
|
|
1558
1692
|
createFilesTaskSource,
|
|
1559
1693
|
createEnvGitHubCredentialProvider,
|
|
1560
1694
|
createDocsDriftValidator,
|
|
1695
|
+
createDocsDriftRuntimeCliCommand,
|
|
1696
|
+
DOCS_HEALTH_PANEL_ID,
|
|
1561
1697
|
DOCS_DRIFT_VALIDATOR_ID,
|
|
1562
1698
|
DOCS_DRIFT_STAGE_ID,
|
|
1563
|
-
|
|
1699
|
+
DOCS_DRIFT_RUNTIME_CLI_COMMAND,
|
|
1700
|
+
DOCS_DRIFT_CLI_ID,
|
|
1701
|
+
DOCS_DRIFT_CAPABILITY_ID
|
|
1564
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;
|