@h-rig/standard-plugin 0.0.6-alpha.143 → 0.0.6-alpha.144
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/blocker-classifier.d.ts +1 -0
- package/dist/src/blocker-classifier.js +18 -0
- package/dist/src/bundle.js +35 -179
- package/dist/src/cli-surface.d.ts +2 -1
- package/dist/src/cli-surface.js +43 -9
- package/dist/src/default-lifecycle.d.ts +2 -0
- package/dist/src/default-lifecycle.js +12 -0
- package/dist/src/dependency-graph.d.ts +1 -0
- package/dist/src/dependency-graph.js +22 -0
- package/dist/src/github-issues-source.js +23 -12
- package/dist/src/index.d.ts +7 -1
- package/dist/src/index.js +165 -169
- package/dist/src/planning.d.ts +1 -0
- package/dist/src/planning.js +14 -0
- package/dist/src/plugin.d.ts +2 -1
- package/dist/src/plugin.js +38 -169
- package/dist/src/product-entrypoint.d.ts +3 -11
- package/dist/src/product-entrypoint.js +1 -96
- package/dist/src/product-plugin.d.ts +3 -0
- package/dist/src/product-plugin.js +18 -0
- package/dist/src/supervisor.d.ts +1 -0
- package/dist/src/supervisor.js +12 -0
- package/dist/src/task-cli.d.ts +1 -0
- package/dist/src/task-cli.js +14 -0
- package/package.json +42 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BLOCKERS_CLI_ID, BLOCKER_CLASSIFIER_PLUGIN_NAME, DEFAULT_BLOCKER_CLASSIFIER_ID, HUMAN_BLOCKERS_PANEL_ID, blockerClassifierPlugin, createBlockerClassifierPlugin, } from "@rig/blocker-classifier-plugin/plugin";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/standard-plugin/src/blocker-classifier.ts
|
|
3
|
+
import {
|
|
4
|
+
BLOCKERS_CLI_ID,
|
|
5
|
+
BLOCKER_CLASSIFIER_PLUGIN_NAME,
|
|
6
|
+
DEFAULT_BLOCKER_CLASSIFIER_ID,
|
|
7
|
+
HUMAN_BLOCKERS_PANEL_ID,
|
|
8
|
+
blockerClassifierPlugin,
|
|
9
|
+
createBlockerClassifierPlugin
|
|
10
|
+
} from "@rig/blocker-classifier-plugin/plugin";
|
|
11
|
+
export {
|
|
12
|
+
createBlockerClassifierPlugin,
|
|
13
|
+
blockerClassifierPlugin,
|
|
14
|
+
HUMAN_BLOCKERS_PANEL_ID,
|
|
15
|
+
DEFAULT_BLOCKER_CLASSIFIER_ID,
|
|
16
|
+
BLOCKER_CLASSIFIER_PLUGIN_NAME,
|
|
17
|
+
BLOCKERS_CLI_ID
|
|
18
|
+
};
|
package/dist/src/bundle.js
CHANGED
|
@@ -37,109 +37,6 @@ var init_metadata = __esm(() => {
|
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
// packages/standard-plugin/src/product-entrypoint.ts
|
|
41
|
-
var exports_product_entrypoint = {};
|
|
42
|
-
__export(exports_product_entrypoint, {
|
|
43
|
-
runRigOmpProductCommand: () => runRigOmpProductCommand
|
|
44
|
-
});
|
|
45
|
-
import { resolve as resolve3 } from "path";
|
|
46
|
-
import { runCli } from "@oh-my-pi/pi-coding-agent/cli";
|
|
47
|
-
import { parseArgs } from "@oh-my-pi/pi-coding-agent/cli/args";
|
|
48
|
-
import { resolveCliArgv } from "@oh-my-pi/pi-coding-agent/cli-commands";
|
|
49
|
-
import { prepareAcpTerminalAuthArgs } from "@oh-my-pi/pi-coding-agent/modes/acp/terminal-auth";
|
|
50
|
-
import { runRootCommand } from "@oh-my-pi/pi-coding-agent/main";
|
|
51
|
-
import { createAgentSession } from "@oh-my-pi/pi-coding-agent/sdk";
|
|
52
|
-
import { applyIdentityEnv, identityFilterFromEnv, reconcileRuns } from "@rig/client";
|
|
53
|
-
import rigExtension from "@rig/rig-extension";
|
|
54
|
-
import { resolveRigOmpConfigOverlayPath } from "@rig/runtime/control-plane/remote-config";
|
|
55
|
-
function withRigDefaultConfig(projectRoot, argv) {
|
|
56
|
-
return ["--config", resolveRigOmpConfigOverlayPath(projectRoot), ...argv];
|
|
57
|
-
}
|
|
58
|
-
function createRigAgentSession(options = {}) {
|
|
59
|
-
return createAgentSession({
|
|
60
|
-
...options,
|
|
61
|
-
extensions: [(api) => rigExtension(api), ...options.extensions ?? []]
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function productArgv(input) {
|
|
65
|
-
if (input.command === "launch" && input.args.length === 0)
|
|
66
|
-
return [];
|
|
67
|
-
if (input.command === "launch" && input.args[0]?.startsWith("-"))
|
|
68
|
-
return [...input.args];
|
|
69
|
-
return [input.command, ...input.args];
|
|
70
|
-
}
|
|
71
|
-
async function runRigOmpProductCommand(input) {
|
|
72
|
-
const projectRoot = resolve3(input.projectRoot);
|
|
73
|
-
const previousProjectRoot = process.env.RIG_PROJECT_ROOT;
|
|
74
|
-
const previousCwd = process.cwd();
|
|
75
|
-
const restorePublicIdentityEnv = applyIdentityEnv(projectRoot);
|
|
76
|
-
process.env.RIG_PROJECT_ROOT = projectRoot;
|
|
77
|
-
process.chdir(projectRoot);
|
|
78
|
-
try {
|
|
79
|
-
const argv = productArgv(input);
|
|
80
|
-
if (argv[0]?.startsWith("__omp_worker_") || argv[0] === "--smoke-test") {
|
|
81
|
-
await runCli(argv);
|
|
82
|
-
return { ok: true, group: "product", command: input.command };
|
|
83
|
-
}
|
|
84
|
-
if (process.stdin.isTTY) {
|
|
85
|
-
const reconcile = await reconcileRuns({
|
|
86
|
-
workspaceRoot: projectRoot,
|
|
87
|
-
identityFilter: identityFilterFromEnv()
|
|
88
|
-
}).catch(() => ({ flipped: [], resumable: [] }));
|
|
89
|
-
globalThis.__RIG_RESUMABLE__ = reconcile.resumable;
|
|
90
|
-
}
|
|
91
|
-
const resolved = resolveCliArgv(argv);
|
|
92
|
-
if ("error" in resolved) {
|
|
93
|
-
process.stderr.write(`error: ${resolved.error}
|
|
94
|
-
`);
|
|
95
|
-
process.exitCode = 1;
|
|
96
|
-
return { ok: true, group: "product", command: input.command };
|
|
97
|
-
}
|
|
98
|
-
const [ompCommand, ...ompCommandArgs] = resolved.argv;
|
|
99
|
-
if (ompCommand === "launch") {
|
|
100
|
-
const args = withRigDefaultConfig(projectRoot, ompCommandArgs);
|
|
101
|
-
await runRootCommand(parseArgs(args), args, { createAgentSession: createRigAgentSession });
|
|
102
|
-
} else if (ompCommand === "acp") {
|
|
103
|
-
const { args: preparedArgs, terminalAuth } = prepareAcpTerminalAuthArgs(ompCommandArgs);
|
|
104
|
-
const args = withRigDefaultConfig(projectRoot, preparedArgs);
|
|
105
|
-
const parsed = parseArgs(args);
|
|
106
|
-
if (!terminalAuth)
|
|
107
|
-
parsed.mode = "acp";
|
|
108
|
-
await runRootCommand(parsed, args, { createAgentSession: createRigAgentSession });
|
|
109
|
-
} else if (ompCommand === "join") {
|
|
110
|
-
const link = ompCommandArgs[0]?.trim();
|
|
111
|
-
if (!link) {
|
|
112
|
-
process.stderr.write(`Usage: rig join <link>
|
|
113
|
-
`);
|
|
114
|
-
process.exitCode = 1;
|
|
115
|
-
return { ok: true, group: "product", command: input.command };
|
|
116
|
-
}
|
|
117
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
118
|
-
process.stderr.write(`rig join requires an interactive terminal
|
|
119
|
-
`);
|
|
120
|
-
process.exitCode = 1;
|
|
121
|
-
return { ok: true, group: "product", command: input.command };
|
|
122
|
-
}
|
|
123
|
-
const args = withRigDefaultConfig(projectRoot, []);
|
|
124
|
-
const parsed = parseArgs(args);
|
|
125
|
-
parsed.join = link;
|
|
126
|
-
await runRootCommand(parsed, args, { createAgentSession: createRigAgentSession });
|
|
127
|
-
} else {
|
|
128
|
-
await runCli(resolved.argv);
|
|
129
|
-
}
|
|
130
|
-
return { ok: true, group: "product", command: input.command };
|
|
131
|
-
} finally {
|
|
132
|
-
restorePublicIdentityEnv();
|
|
133
|
-
process.chdir(previousCwd);
|
|
134
|
-
if (previousProjectRoot === undefined) {
|
|
135
|
-
delete process.env.RIG_PROJECT_ROOT;
|
|
136
|
-
} else {
|
|
137
|
-
process.env.RIG_PROJECT_ROOT = previousProjectRoot;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
var init_product_entrypoint = () => {};
|
|
142
|
-
|
|
143
40
|
// packages/standard-plugin/src/drift/extract-refs.ts
|
|
144
41
|
function stripFenceLines(markdown) {
|
|
145
42
|
const lines = markdown.split(/\r?\n/);
|
|
@@ -272,7 +169,7 @@ __export(exports_detect, {
|
|
|
272
169
|
});
|
|
273
170
|
import { existsSync as existsSync3 } from "fs";
|
|
274
171
|
import { readdir, readFile, stat } from "fs/promises";
|
|
275
|
-
import { basename as basename2, extname, relative, resolve as
|
|
172
|
+
import { basename as basename2, extname, relative, resolve as resolve3 } from "path";
|
|
276
173
|
function globLikeMatch(path, pattern) {
|
|
277
174
|
if (pattern === path)
|
|
278
175
|
return true;
|
|
@@ -299,7 +196,7 @@ async function collectFiles(root, options) {
|
|
|
299
196
|
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
300
197
|
if (entry.isDirectory() && DEFAULT_IGNORED_DIRS[entry.name])
|
|
301
198
|
continue;
|
|
302
|
-
const absolute =
|
|
199
|
+
const absolute = resolve3(dir, entry.name);
|
|
303
200
|
const rel = relative(root, absolute).replace(/\\/g, "/");
|
|
304
201
|
if (isIgnored(rel, options.ignore))
|
|
305
202
|
continue;
|
|
@@ -324,13 +221,13 @@ async function collectFiles(root, options) {
|
|
|
324
221
|
}
|
|
325
222
|
async function sourceReferenceCount(projectRoot, reference, docPath) {
|
|
326
223
|
if (reference.kind === "path")
|
|
327
|
-
return existsSync3(
|
|
224
|
+
return existsSync3(resolve3(projectRoot, reference.value)) ? 1 : 0;
|
|
328
225
|
let count = 0;
|
|
329
226
|
const sourceFiles = await collectFiles(projectRoot, { docs: false });
|
|
330
227
|
for (const sourceFile of sourceFiles) {
|
|
331
228
|
if (sourceFile === docPath)
|
|
332
229
|
continue;
|
|
333
|
-
const text = await readFile(
|
|
230
|
+
const text = await readFile(resolve3(projectRoot, sourceFile), "utf8").catch(() => "");
|
|
334
231
|
if (text.includes(reference.value))
|
|
335
232
|
count += 1;
|
|
336
233
|
}
|
|
@@ -357,7 +254,7 @@ function staleAnchorFinding(docPath, reference) {
|
|
|
357
254
|
};
|
|
358
255
|
}
|
|
359
256
|
async function detectDeletedReferences(projectRoot, docPath, git = makeDriftGit(projectRoot)) {
|
|
360
|
-
const markdown = await readFile(
|
|
257
|
+
const markdown = await readFile(resolve3(projectRoot, docPath), "utf8");
|
|
361
258
|
const docCommit = await git.lastCommitTouching(docPath);
|
|
362
259
|
const findings = [];
|
|
363
260
|
for (const reference of extractDriftReferences(markdown)) {
|
|
@@ -370,13 +267,13 @@ async function detectDeletedReferences(projectRoot, docPath, git = makeDriftGit(
|
|
|
370
267
|
return findings;
|
|
371
268
|
}
|
|
372
269
|
async function detectStaleAnchors(projectRoot, docPath, git = makeDriftGit(projectRoot)) {
|
|
373
|
-
const markdown = await readFile(
|
|
270
|
+
const markdown = await readFile(resolve3(projectRoot, docPath), "utf8");
|
|
374
271
|
const docCommit = await git.lastCommitTouching(docPath);
|
|
375
272
|
const findings = [];
|
|
376
273
|
for (const reference of extractDriftReferences(markdown).filter((ref) => ref.kind === "path")) {
|
|
377
|
-
if (!existsSync3(
|
|
274
|
+
if (!existsSync3(resolve3(projectRoot, reference.value)))
|
|
378
275
|
continue;
|
|
379
|
-
const sourceStat = await stat(
|
|
276
|
+
const sourceStat = await stat(resolve3(projectRoot, reference.value)).catch(() => null);
|
|
380
277
|
if (!sourceStat?.isFile())
|
|
381
278
|
continue;
|
|
382
279
|
const sourceCommit = await git.lastCommitTouching(reference.value);
|
|
@@ -653,16 +550,6 @@ import { createDependencyGraphPlugin } from "@rig/dependency-graph-plugin/plugin
|
|
|
653
550
|
import { createPlanningPlugin } from "@rig/planning-plugin/plugin";
|
|
654
551
|
import { createSupervisorPlugin } from "@rig/supervisor-plugin/plugin";
|
|
655
552
|
|
|
656
|
-
// packages/standard-plugin/src/cli-surface.ts
|
|
657
|
-
var STANDARD_CLI_SURFACE_PLUGIN_NAME = "@rig/standard-plugin:cli-surface";
|
|
658
|
-
var standardCliSurfacePlugin = {
|
|
659
|
-
name: STANDARD_CLI_SURFACE_PLUGIN_NAME,
|
|
660
|
-
version: "0.0.0-alpha.1",
|
|
661
|
-
contributes: {
|
|
662
|
-
capabilities: [{ id: "surface.cli", title: "Rig CLI surface", description: "Registry-dispatched command-line surface." }]
|
|
663
|
-
}
|
|
664
|
-
};
|
|
665
|
-
|
|
666
553
|
// packages/standard-plugin/src/run-worker-panels.ts
|
|
667
554
|
var RIG_RUN_STOP_PANEL_ACTION = "rig-run:stop";
|
|
668
555
|
var RIG_CAPABILITY_PANEL_SLOT = "capability";
|
|
@@ -709,7 +596,7 @@ var RUN_WORKER_PANEL_PLUGIN = {
|
|
|
709
596
|
};
|
|
710
597
|
|
|
711
598
|
// packages/standard-plugin/src/plugin.ts
|
|
712
|
-
import { resolve as
|
|
599
|
+
import { resolve as resolve4 } from "path";
|
|
713
600
|
import { definePlugin } from "@rig/core/config";
|
|
714
601
|
|
|
715
602
|
// packages/standard-plugin/src/github-issues-source.ts
|
|
@@ -745,11 +632,11 @@ function createStateGitHubCredentialProvider(options = {}) {
|
|
|
745
632
|
const candidates = [];
|
|
746
633
|
addCandidate(candidates, options.stateFile ?? process.env.RIG_GITHUB_AUTH_STATE_FILE);
|
|
747
634
|
addStateDir(candidates, options.stateDir);
|
|
635
|
+
addStateDir(candidates, process.env.RIG_STATE_DIR);
|
|
748
636
|
addProjectStateDir(candidates, process.env.PROJECT_RIG_ROOT);
|
|
749
637
|
addProjectStateDir(candidates, process.env.RIG_PROJECT_ROOT);
|
|
750
638
|
addProjectStateDir(candidates, process.env.RIG_HOST_PROJECT_ROOT);
|
|
751
639
|
addProjectStateDir(candidates, process.cwd());
|
|
752
|
-
addStateDir(candidates, process.env.RIG_STATE_DIR);
|
|
753
640
|
return candidates;
|
|
754
641
|
};
|
|
755
642
|
const readToken = () => {
|
|
@@ -769,7 +656,7 @@ function createStateGitHubCredentialProvider(options = {}) {
|
|
|
769
656
|
async resolveGitHubToken(input) {
|
|
770
657
|
const token = readToken();
|
|
771
658
|
if (input.purpose === "selected-repo") {
|
|
772
|
-
return { token: token ?? cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ??
|
|
659
|
+
return { token: token ?? cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ?? null) ?? "", source: "signed-in-user" };
|
|
773
660
|
}
|
|
774
661
|
if (token) {
|
|
775
662
|
return { token, source: "signed-in-user" };
|
|
@@ -841,9 +728,12 @@ function parseMetadataList(body, keys) {
|
|
|
841
728
|
}
|
|
842
729
|
return [...new Set(values)];
|
|
843
730
|
}
|
|
731
|
+
function bodyWithoutRigMetadataBlock(body) {
|
|
732
|
+
return body.replace(/<!-- rig:metadata:start -->\s*[\s\S]*?\s*<!-- rig:metadata:end -->/g, "");
|
|
733
|
+
}
|
|
844
734
|
function parseBodyKeyRefs(body, keys) {
|
|
845
735
|
const keyPattern = metadataKeyPattern(keys);
|
|
846
|
-
const values = body.split(/\r?\n/).flatMap((line) => {
|
|
736
|
+
const values = bodyWithoutRigMetadataBlock(body).split(/\r?\n/).flatMap((line) => {
|
|
847
737
|
const match = line.match(keyPattern);
|
|
848
738
|
return match?.[1] ? parseIssueRefs(match[1]) : [];
|
|
849
739
|
});
|
|
@@ -948,21 +838,29 @@ function isRigStickyStatusComment(body) {
|
|
|
948
838
|
return body.includes(RIG_STATUS_COMMENT_MARKER);
|
|
949
839
|
}
|
|
950
840
|
function ghSpawnOptions(extraEnv, timeoutMs) {
|
|
841
|
+
const env = {
|
|
842
|
+
...process.env,
|
|
843
|
+
...process.env.GH_TOKEN !== undefined ? { GH_TOKEN: process.env.GH_TOKEN } : {},
|
|
844
|
+
...process.env.GITHUB_TOKEN !== undefined ? { GITHUB_TOKEN: process.env.GITHUB_TOKEN } : {},
|
|
845
|
+
...process.env.RIG_GITHUB_TOKEN !== undefined ? { RIG_GITHUB_TOKEN: process.env.RIG_GITHUB_TOKEN } : {}
|
|
846
|
+
};
|
|
847
|
+
for (const [key, value] of Object.entries(extraEnv ?? {})) {
|
|
848
|
+
if (value === undefined)
|
|
849
|
+
delete env[key];
|
|
850
|
+
else
|
|
851
|
+
env[key] = value;
|
|
852
|
+
}
|
|
951
853
|
return {
|
|
952
854
|
encoding: "utf-8",
|
|
953
855
|
timeout: timeoutMs,
|
|
954
|
-
env
|
|
955
|
-
...process.env,
|
|
956
|
-
...process.env.GH_TOKEN !== undefined ? { GH_TOKEN: process.env.GH_TOKEN } : {},
|
|
957
|
-
...process.env.GITHUB_TOKEN !== undefined ? { GITHUB_TOKEN: process.env.GITHUB_TOKEN } : {},
|
|
958
|
-
...process.env.RIG_GITHUB_TOKEN !== undefined ? { RIG_GITHUB_TOKEN: process.env.RIG_GITHUB_TOKEN } : {},
|
|
959
|
-
...extraEnv ?? {}
|
|
960
|
-
}
|
|
856
|
+
env
|
|
961
857
|
};
|
|
962
858
|
}
|
|
963
859
|
function credentialEnv(token) {
|
|
964
860
|
const clean = token?.trim() ?? "";
|
|
965
|
-
|
|
861
|
+
if (clean)
|
|
862
|
+
return { GH_TOKEN: clean, GITHUB_TOKEN: clean, RIG_GITHUB_TOKEN: clean };
|
|
863
|
+
return { GH_TOKEN: undefined, GITHUB_TOKEN: undefined, RIG_GITHUB_TOKEN: undefined };
|
|
966
864
|
}
|
|
967
865
|
async function resolveCredentialEnv(opts, purpose) {
|
|
968
866
|
if (!opts.credentialProvider)
|
|
@@ -1711,40 +1609,9 @@ function createFilesTaskSource(opts) {
|
|
|
1711
1609
|
// packages/standard-plugin/src/plugin.ts
|
|
1712
1610
|
init_metadata();
|
|
1713
1611
|
init_metadata();
|
|
1612
|
+
import { createStandardProductEntrypointPlugin, standardProductEntrypointPlugin } from "@rig/product-entrypoint-plugin/plugin";
|
|
1613
|
+
import { createStandardTaskCliPlugin, standardTaskCliPlugin } from "@rig/task-cli-plugin/plugin";
|
|
1714
1614
|
var DOCS_HEALTH_PANEL_ID = "docs-health";
|
|
1715
|
-
var STANDARD_PRODUCT_COMMANDS = [
|
|
1716
|
-
{ command: "launch", description: "Open the Rig Cockpit through the OMP collaboration substrate.", usage: "rig [launch] [args...]" },
|
|
1717
|
-
{ command: "join", description: "Join an encrypted Rig/OMP collaborative session.", usage: "rig join <link>" },
|
|
1718
|
-
{ command: "acp", description: "Start the Rig product in OMP ACP mode.", usage: "rig acp [args...]" },
|
|
1719
|
-
{ command: "models", description: "Delegate model management to the Rig product substrate.", usage: "rig models [args...]" },
|
|
1720
|
-
{ command: "mcp", description: "Delegate MCP management to the Rig product substrate.", usage: "rig mcp [args...]" },
|
|
1721
|
-
{ command: "update", description: "Delegate product update handling to the Rig product substrate.", usage: "rig update [args...]" }
|
|
1722
|
-
];
|
|
1723
|
-
function standardProductCliCommandId(command) {
|
|
1724
|
-
return `@rig/standard-plugin:product-entrypoint:${command}`;
|
|
1725
|
-
}
|
|
1726
|
-
function standardProductCliCommandMetadata(descriptor) {
|
|
1727
|
-
return {
|
|
1728
|
-
id: standardProductCliCommandId(descriptor.command),
|
|
1729
|
-
family: descriptor.command,
|
|
1730
|
-
description: descriptor.description,
|
|
1731
|
-
usage: descriptor.usage,
|
|
1732
|
-
projectRequired: false
|
|
1733
|
-
};
|
|
1734
|
-
}
|
|
1735
|
-
function createStandardProductCliCommand(descriptor) {
|
|
1736
|
-
return {
|
|
1737
|
-
...standardProductCliCommandMetadata(descriptor),
|
|
1738
|
-
run: async (context, args) => {
|
|
1739
|
-
const { runRigOmpProductCommand: runRigOmpProductCommand2 } = await Promise.resolve().then(() => (init_product_entrypoint(), exports_product_entrypoint));
|
|
1740
|
-
return runRigOmpProductCommand2({
|
|
1741
|
-
projectRoot: context.projectRoot,
|
|
1742
|
-
command: descriptor.command,
|
|
1743
|
-
args
|
|
1744
|
-
});
|
|
1745
|
-
}
|
|
1746
|
-
};
|
|
1747
|
-
}
|
|
1748
1615
|
function requireStringField(config, field, kind) {
|
|
1749
1616
|
const value = config[field];
|
|
1750
1617
|
if (!value) {
|
|
@@ -1888,17 +1755,6 @@ function createStandardDocsDriftPlugin(opts = {}) {
|
|
|
1888
1755
|
cliCommands: [createLazyDocsDriftRuntimeCliCommand(opts)]
|
|
1889
1756
|
});
|
|
1890
1757
|
}
|
|
1891
|
-
function createStandardProductEntrypointPlugin() {
|
|
1892
|
-
return definePlugin({
|
|
1893
|
-
name: "@rig/standard-plugin:product-entrypoint",
|
|
1894
|
-
version: "0.1.0",
|
|
1895
|
-
contributes: {
|
|
1896
|
-
cliCommands: STANDARD_PRODUCT_COMMANDS.map(standardProductCliCommandMetadata)
|
|
1897
|
-
}
|
|
1898
|
-
}, {
|
|
1899
|
-
cliCommands: STANDARD_PRODUCT_COMMANDS.map(createStandardProductCliCommand)
|
|
1900
|
-
});
|
|
1901
|
-
}
|
|
1902
1758
|
function createStandardTaskSourcesPlugin(opts = {}) {
|
|
1903
1759
|
return definePlugin({
|
|
1904
1760
|
name: "@rig/standard-plugin:task-sources",
|
|
@@ -1928,7 +1784,7 @@ function createStandardTaskSourcesPlugin(opts = {}) {
|
|
|
1928
1784
|
owner: requireStringField(config, "owner", "github-issues"),
|
|
1929
1785
|
repo: requireStringField(config, "repo", "github-issues")
|
|
1930
1786
|
};
|
|
1931
|
-
const credentialProviderOptions = context?.projectRoot ? { stateDir:
|
|
1787
|
+
const credentialProviderOptions = context?.projectRoot ? { stateDir: resolve4(context.projectRoot, ".rig", "state") } : {};
|
|
1932
1788
|
options.credentialProvider = opts.githubCredentialProvider ?? createStateGitHubCredentialProvider(credentialProviderOptions);
|
|
1933
1789
|
if (opts.githubWorkspaceId)
|
|
1934
1790
|
options.workspaceId = opts.githubWorkspaceId;
|
|
@@ -1983,9 +1839,9 @@ function standardPlugins(options = {}) {
|
|
|
1983
1839
|
createBlockerClassifierPlugin(),
|
|
1984
1840
|
createPlanningPlugin(),
|
|
1985
1841
|
createSupervisorPlugin(),
|
|
1986
|
-
standardCliSurfacePlugin,
|
|
1987
1842
|
RUN_WORKER_PANEL_PLUGIN,
|
|
1988
1843
|
createStandardTaskSourcesPlugin(options.taskSources),
|
|
1844
|
+
createStandardTaskCliPlugin(),
|
|
1989
1845
|
createStandardDocsDriftPlugin(options.drift),
|
|
1990
1846
|
createStandardProductEntrypointPlugin()
|
|
1991
1847
|
];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RigPluginWithRuntime } from "@rig/core/config";
|
|
2
|
+
import type { CliCommandRegistration } from "@rig/contracts";
|
|
2
3
|
export declare const STANDARD_CLI_SURFACE_PLUGIN_NAME = "@rig/standard-plugin:cli-surface";
|
|
4
|
+
export declare const STANDARD_CLI_SURFACE_COMMAND_METADATA: readonly CliCommandRegistration[];
|
|
3
5
|
export declare const standardCliSurfacePlugin: RigPluginWithRuntime;
|
|
4
|
-
export declare function standardCliSurfaceRuntime(plugin: RigPluginWithRuntime): RigPluginWithRuntime;
|
package/dist/src/cli-surface.js
CHANGED
|
@@ -1,21 +1,55 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/standard-plugin/src/cli-surface.ts
|
|
3
3
|
var STANDARD_CLI_SURFACE_PLUGIN_NAME = "@rig/standard-plugin:cli-surface";
|
|
4
|
+
function standardCliCommand(family, options) {
|
|
5
|
+
return {
|
|
6
|
+
id: `${STANDARD_CLI_SURFACE_PLUGIN_NAME}:${family}`,
|
|
7
|
+
family,
|
|
8
|
+
description: options.description,
|
|
9
|
+
...options.usage ? { usage: options.usage } : {},
|
|
10
|
+
...options.aliases ? { aliases: [...options.aliases] } : {},
|
|
11
|
+
projectRequired: options.projectRequired ?? false
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
var STANDARD_CLI_SURFACE_COMMAND_METADATA = [
|
|
15
|
+
standardCliCommand("init", { description: "Initialize Rig project configuration." }),
|
|
16
|
+
standardCliCommand("setup", { description: "Install and inspect local Rig setup." }),
|
|
17
|
+
standardCliCommand("check", { description: "Run Rig setup checks.", usage: "rig check" }),
|
|
18
|
+
standardCliCommand("install", { description: "Install Rig distribution artifacts.", usage: "rig install [options]" }),
|
|
19
|
+
standardCliCommand("github", { description: "Manage GitHub auth and integration state." }),
|
|
20
|
+
standardCliCommand("doctor", { description: "Inspect Rig environment health." }),
|
|
21
|
+
standardCliCommand("repo", { description: "Manage repository state.", projectRequired: true }),
|
|
22
|
+
standardCliCommand("profile", { description: "Manage runtime profile settings." }),
|
|
23
|
+
standardCliCommand("review", { description: "Run review helpers.", projectRequired: true }),
|
|
24
|
+
standardCliCommand("git", { description: "Run Rig git automation.", projectRequired: true }),
|
|
25
|
+
standardCliCommand("harness", { description: "Inspect native harness integration." }),
|
|
26
|
+
standardCliCommand("pi", { description: "Inspect Pi/OMP runtime integration." }),
|
|
27
|
+
standardCliCommand("plugin", { description: "Inspect and run plugin compatibility commands." }),
|
|
28
|
+
standardCliCommand("queue", { description: "Inspect dispatch queue state.", projectRequired: true }),
|
|
29
|
+
standardCliCommand("agent", { description: "Run agent lifecycle helpers.", projectRequired: true }),
|
|
30
|
+
standardCliCommand("dist", { description: "Build and inspect Rig distributions." }),
|
|
31
|
+
standardCliCommand("workspace", { description: "Inspect workspace topology." }),
|
|
32
|
+
standardCliCommand("remote", { description: "Manage remote endpoints." }),
|
|
33
|
+
standardCliCommand("test", { description: "Run Rig test helpers." }),
|
|
34
|
+
standardCliCommand("inspect", { description: "Inspect live/project Rig state." }),
|
|
35
|
+
standardCliCommand("run", { description: "Dispatch and inspect runs.", projectRequired: true }),
|
|
36
|
+
standardCliCommand("task", { description: "List and inspect task-source tasks.", projectRequired: true }),
|
|
37
|
+
standardCliCommand("inbox", { description: "Inspect and resolve run inbox items.", projectRequired: true }),
|
|
38
|
+
standardCliCommand("stats", { description: "Inspect run statistics.", projectRequired: true }),
|
|
39
|
+
standardCliCommand("server", { description: "Manage selected local/remote execution server.", projectRequired: true }),
|
|
40
|
+
standardCliCommand("config", { description: "Inspect Rig configuration." }),
|
|
41
|
+
standardCliCommand("triage", { description: "Run issue triage helpers.", projectRequired: true })
|
|
42
|
+
];
|
|
4
43
|
var standardCliSurfacePlugin = {
|
|
5
44
|
name: STANDARD_CLI_SURFACE_PLUGIN_NAME,
|
|
6
45
|
version: "0.0.0-alpha.1",
|
|
7
46
|
contributes: {
|
|
8
|
-
capabilities: [{ id: "surface.cli", title: "Rig CLI surface", description: "Registry-dispatched command-line surface." }]
|
|
47
|
+
capabilities: [{ id: "surface.cli", title: "Rig CLI surface", description: "Registry-dispatched command-line surface." }],
|
|
48
|
+
cliCommands: STANDARD_CLI_SURFACE_COMMAND_METADATA
|
|
9
49
|
}
|
|
10
50
|
};
|
|
11
|
-
function standardCliSurfaceRuntime(plugin) {
|
|
12
|
-
if (plugin.name !== STANDARD_CLI_SURFACE_PLUGIN_NAME) {
|
|
13
|
-
throw new Error(`standard CLI surface runtime must use plugin name ${STANDARD_CLI_SURFACE_PLUGIN_NAME}, got ${plugin.name}`);
|
|
14
|
-
}
|
|
15
|
-
return plugin;
|
|
16
|
-
}
|
|
17
51
|
export {
|
|
18
|
-
standardCliSurfaceRuntime,
|
|
19
52
|
standardCliSurfacePlugin,
|
|
20
|
-
STANDARD_CLI_SURFACE_PLUGIN_NAME
|
|
53
|
+
STANDARD_CLI_SURFACE_PLUGIN_NAME,
|
|
54
|
+
STANDARD_CLI_SURFACE_COMMAND_METADATA
|
|
21
55
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/standard-plugin/src/default-lifecycle.ts
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_LIFECYCLE_PLUGIN_ID,
|
|
5
|
+
createDefaultLifecyclePlugin,
|
|
6
|
+
defaultLifecyclePlugin
|
|
7
|
+
} from "@rig/bundle-default-lifecycle/plugin";
|
|
8
|
+
export {
|
|
9
|
+
defaultLifecyclePlugin,
|
|
10
|
+
createDefaultLifecyclePlugin,
|
|
11
|
+
DEFAULT_LIFECYCLE_PLUGIN_ID
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DEPENDENCY_GRAPH_CLI_ID, DEPENDENCY_GRAPH_PANEL_ID, EPICS_PANEL_ID, PEOPLE_PANEL_ID, WORKSPACE_STATUS_CLI_ID, WORKSPACE_SUMMARY_CLI_ID, createDependencyGraphPlugin, dependencyGraphPlugin, } from "@rig/dependency-graph-plugin/plugin";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/standard-plugin/src/dependency-graph.ts
|
|
3
|
+
import {
|
|
4
|
+
DEPENDENCY_GRAPH_CLI_ID,
|
|
5
|
+
DEPENDENCY_GRAPH_PANEL_ID,
|
|
6
|
+
EPICS_PANEL_ID,
|
|
7
|
+
PEOPLE_PANEL_ID,
|
|
8
|
+
WORKSPACE_STATUS_CLI_ID,
|
|
9
|
+
WORKSPACE_SUMMARY_CLI_ID,
|
|
10
|
+
createDependencyGraphPlugin,
|
|
11
|
+
dependencyGraphPlugin
|
|
12
|
+
} from "@rig/dependency-graph-plugin/plugin";
|
|
13
|
+
export {
|
|
14
|
+
dependencyGraphPlugin,
|
|
15
|
+
createDependencyGraphPlugin,
|
|
16
|
+
WORKSPACE_SUMMARY_CLI_ID,
|
|
17
|
+
WORKSPACE_STATUS_CLI_ID,
|
|
18
|
+
PEOPLE_PANEL_ID,
|
|
19
|
+
EPICS_PANEL_ID,
|
|
20
|
+
DEPENDENCY_GRAPH_PANEL_ID,
|
|
21
|
+
DEPENDENCY_GRAPH_CLI_ID
|
|
22
|
+
};
|
|
@@ -11,7 +11,7 @@ function createEnvGitHubCredentialProvider() {
|
|
|
11
11
|
return {
|
|
12
12
|
async resolveGitHubToken(input) {
|
|
13
13
|
if (input.purpose === "selected-repo") {
|
|
14
|
-
return { token: cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ??
|
|
14
|
+
return { token: cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ?? null) ?? "", source: "signed-in-user" };
|
|
15
15
|
}
|
|
16
16
|
const token = cleanToken(process.env.RIG_GITHUB_TOKEN ?? process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN ?? null);
|
|
17
17
|
if (!token) {
|
|
@@ -46,11 +46,11 @@ function createStateGitHubCredentialProvider(options = {}) {
|
|
|
46
46
|
const candidates = [];
|
|
47
47
|
addCandidate(candidates, options.stateFile ?? process.env.RIG_GITHUB_AUTH_STATE_FILE);
|
|
48
48
|
addStateDir(candidates, options.stateDir);
|
|
49
|
+
addStateDir(candidates, process.env.RIG_STATE_DIR);
|
|
49
50
|
addProjectStateDir(candidates, process.env.PROJECT_RIG_ROOT);
|
|
50
51
|
addProjectStateDir(candidates, process.env.RIG_PROJECT_ROOT);
|
|
51
52
|
addProjectStateDir(candidates, process.env.RIG_HOST_PROJECT_ROOT);
|
|
52
53
|
addProjectStateDir(candidates, process.cwd());
|
|
53
|
-
addStateDir(candidates, process.env.RIG_STATE_DIR);
|
|
54
54
|
return candidates;
|
|
55
55
|
};
|
|
56
56
|
const readToken = () => {
|
|
@@ -70,7 +70,7 @@ function createStateGitHubCredentialProvider(options = {}) {
|
|
|
70
70
|
async resolveGitHubToken(input) {
|
|
71
71
|
const token = readToken();
|
|
72
72
|
if (input.purpose === "selected-repo") {
|
|
73
|
-
return { token: token ?? cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ??
|
|
73
|
+
return { token: token ?? cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ?? null) ?? "", source: "signed-in-user" };
|
|
74
74
|
}
|
|
75
75
|
if (token) {
|
|
76
76
|
return { token, source: "signed-in-user" };
|
|
@@ -142,9 +142,12 @@ function parseMetadataList(body, keys) {
|
|
|
142
142
|
}
|
|
143
143
|
return [...new Set(values)];
|
|
144
144
|
}
|
|
145
|
+
function bodyWithoutRigMetadataBlock(body) {
|
|
146
|
+
return body.replace(/<!-- rig:metadata:start -->\s*[\s\S]*?\s*<!-- rig:metadata:end -->/g, "");
|
|
147
|
+
}
|
|
145
148
|
function parseBodyKeyRefs(body, keys) {
|
|
146
149
|
const keyPattern = metadataKeyPattern(keys);
|
|
147
|
-
const values = body.split(/\r?\n/).flatMap((line) => {
|
|
150
|
+
const values = bodyWithoutRigMetadataBlock(body).split(/\r?\n/).flatMap((line) => {
|
|
148
151
|
const match = line.match(keyPattern);
|
|
149
152
|
return match?.[1] ? parseIssueRefs(match[1]) : [];
|
|
150
153
|
});
|
|
@@ -249,21 +252,29 @@ function isRigStickyStatusComment(body) {
|
|
|
249
252
|
return body.includes(RIG_STATUS_COMMENT_MARKER);
|
|
250
253
|
}
|
|
251
254
|
function ghSpawnOptions(extraEnv, timeoutMs) {
|
|
255
|
+
const env = {
|
|
256
|
+
...process.env,
|
|
257
|
+
...process.env.GH_TOKEN !== undefined ? { GH_TOKEN: process.env.GH_TOKEN } : {},
|
|
258
|
+
...process.env.GITHUB_TOKEN !== undefined ? { GITHUB_TOKEN: process.env.GITHUB_TOKEN } : {},
|
|
259
|
+
...process.env.RIG_GITHUB_TOKEN !== undefined ? { RIG_GITHUB_TOKEN: process.env.RIG_GITHUB_TOKEN } : {}
|
|
260
|
+
};
|
|
261
|
+
for (const [key, value] of Object.entries(extraEnv ?? {})) {
|
|
262
|
+
if (value === undefined)
|
|
263
|
+
delete env[key];
|
|
264
|
+
else
|
|
265
|
+
env[key] = value;
|
|
266
|
+
}
|
|
252
267
|
return {
|
|
253
268
|
encoding: "utf-8",
|
|
254
269
|
timeout: timeoutMs,
|
|
255
|
-
env
|
|
256
|
-
...process.env,
|
|
257
|
-
...process.env.GH_TOKEN !== undefined ? { GH_TOKEN: process.env.GH_TOKEN } : {},
|
|
258
|
-
...process.env.GITHUB_TOKEN !== undefined ? { GITHUB_TOKEN: process.env.GITHUB_TOKEN } : {},
|
|
259
|
-
...process.env.RIG_GITHUB_TOKEN !== undefined ? { RIG_GITHUB_TOKEN: process.env.RIG_GITHUB_TOKEN } : {},
|
|
260
|
-
...extraEnv ?? {}
|
|
261
|
-
}
|
|
270
|
+
env
|
|
262
271
|
};
|
|
263
272
|
}
|
|
264
273
|
function credentialEnv(token) {
|
|
265
274
|
const clean = token?.trim() ?? "";
|
|
266
|
-
|
|
275
|
+
if (clean)
|
|
276
|
+
return { GH_TOKEN: clean, GITHUB_TOKEN: clean, RIG_GITHUB_TOKEN: clean };
|
|
277
|
+
return { GH_TOKEN: undefined, GITHUB_TOKEN: undefined, RIG_GITHUB_TOKEN: undefined };
|
|
267
278
|
}
|
|
268
279
|
async function resolveCredentialEnv(opts, purpose) {
|
|
269
280
|
if (!opts.credentialProvider)
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { standardPlugins } from "./bundle";
|
|
2
|
+
export type { StandardPluginsOptions } from "./bundle";
|
|
3
|
+
export { DOCS_DRIFT_CAPABILITY_ID, DOCS_DRIFT_CLI_COMMAND, DOCS_DRIFT_CLI_ID, DOCS_DRIFT_STAGE_ID, DOCS_DRIFT_STAGE_MUTATION, DOCS_DRIFT_VALIDATOR, DOCS_DRIFT_VALIDATOR_ID, DOCS_HEALTH_PANEL_ID, createEnvGitHubCredentialProvider, createFilesTaskSource, createGitHubIssuesTaskSource, createStandardDocsDriftPlugin, createStandardProductEntrypointPlugin, createStandardTaskCliPlugin, createStandardTaskSourcesPlugin, createStateGitHubCredentialProvider, standardProductEntrypointPlugin, standardTaskCliPlugin, } from "./plugin";
|
|
4
|
+
export type { DocsDriftPluginOptions, DriftGit, DriftJudgeInput, DriftJudgeMismatch, DriftJudgeProvider, DriftReference, DriftReferenceKind, FilesTaskSourceOptions, GitHubIssuesOptions, StandardTaskSourcesPluginOptions, } from "./plugin";
|
|
5
|
+
export { RIG_CAPABILITY_PANEL_SLOT, RIG_RUN_STOP_PANEL_ACTION, RIG_SUPERVISOR_PANEL_ID, RUN_SUPERVISOR_PANEL_PRODUCER, RUN_SUPERVISOR_PANEL_REGISTRATION, RUN_WORKER_PANEL_PLUGIN, } from "./run-worker-panels";
|
|
6
|
+
export type { WorkerPanelProducerContext } from "./run-worker-panels";
|
|
7
|
+
export { STANDARD_CLI_SURFACE_COMMAND_METADATA, STANDARD_CLI_SURFACE_PLUGIN_NAME, standardCliSurfacePlugin, } from "./cli-surface";
|