@h-rig/standard-plugin 0.0.6-alpha.143 → 0.0.6-alpha.145
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 +47 -181
- package/dist/src/cli-surface.d.ts +3 -3
- package/dist/src/cli-surface.js +9 -11
- 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 +6 -1
- package/dist/src/index.js +126 -172
- 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-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 +38 -16
- package/dist/src/product-entrypoint.d.ts +0 -11
- package/dist/src/product-entrypoint.js +0 -101
|
@@ -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";
|
|
@@ -708,9 +595,18 @@ var RUN_WORKER_PANEL_PLUGIN = {
|
|
|
708
595
|
}
|
|
709
596
|
};
|
|
710
597
|
|
|
711
|
-
// packages/standard-plugin/src/
|
|
712
|
-
import { resolve as resolve5 } from "path";
|
|
598
|
+
// packages/standard-plugin/src/cli-surface.ts
|
|
713
599
|
import { definePlugin } from "@rig/core/config";
|
|
600
|
+
var STANDARD_CLI_SURFACE_PLUGIN_NAME = "@rig/standard-plugin:cli-surface";
|
|
601
|
+
var standardCliSurfacePlugin = definePlugin({
|
|
602
|
+
name: STANDARD_CLI_SURFACE_PLUGIN_NAME,
|
|
603
|
+
version: "0.0.0-alpha.1",
|
|
604
|
+
contributes: {}
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
// packages/standard-plugin/src/plugin.ts
|
|
608
|
+
import { resolve as resolve4 } from "path";
|
|
609
|
+
import { definePlugin as definePlugin2 } from "@rig/core/config";
|
|
714
610
|
|
|
715
611
|
// packages/standard-plugin/src/github-issues-source.ts
|
|
716
612
|
import { spawnSync } from "child_process";
|
|
@@ -745,11 +641,11 @@ function createStateGitHubCredentialProvider(options = {}) {
|
|
|
745
641
|
const candidates = [];
|
|
746
642
|
addCandidate(candidates, options.stateFile ?? process.env.RIG_GITHUB_AUTH_STATE_FILE);
|
|
747
643
|
addStateDir(candidates, options.stateDir);
|
|
644
|
+
addStateDir(candidates, process.env.RIG_STATE_DIR);
|
|
748
645
|
addProjectStateDir(candidates, process.env.PROJECT_RIG_ROOT);
|
|
749
646
|
addProjectStateDir(candidates, process.env.RIG_PROJECT_ROOT);
|
|
750
647
|
addProjectStateDir(candidates, process.env.RIG_HOST_PROJECT_ROOT);
|
|
751
648
|
addProjectStateDir(candidates, process.cwd());
|
|
752
|
-
addStateDir(candidates, process.env.RIG_STATE_DIR);
|
|
753
649
|
return candidates;
|
|
754
650
|
};
|
|
755
651
|
const readToken = () => {
|
|
@@ -769,7 +665,7 @@ function createStateGitHubCredentialProvider(options = {}) {
|
|
|
769
665
|
async resolveGitHubToken(input) {
|
|
770
666
|
const token = readToken();
|
|
771
667
|
if (input.purpose === "selected-repo") {
|
|
772
|
-
return { token: token ?? cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ??
|
|
668
|
+
return { token: token ?? cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ?? null) ?? "", source: "signed-in-user" };
|
|
773
669
|
}
|
|
774
670
|
if (token) {
|
|
775
671
|
return { token, source: "signed-in-user" };
|
|
@@ -841,9 +737,12 @@ function parseMetadataList(body, keys) {
|
|
|
841
737
|
}
|
|
842
738
|
return [...new Set(values)];
|
|
843
739
|
}
|
|
740
|
+
function bodyWithoutRigMetadataBlock(body) {
|
|
741
|
+
return body.replace(/<!-- rig:metadata:start -->\s*[\s\S]*?\s*<!-- rig:metadata:end -->/g, "");
|
|
742
|
+
}
|
|
844
743
|
function parseBodyKeyRefs(body, keys) {
|
|
845
744
|
const keyPattern = metadataKeyPattern(keys);
|
|
846
|
-
const values = body.split(/\r?\n/).flatMap((line) => {
|
|
745
|
+
const values = bodyWithoutRigMetadataBlock(body).split(/\r?\n/).flatMap((line) => {
|
|
847
746
|
const match = line.match(keyPattern);
|
|
848
747
|
return match?.[1] ? parseIssueRefs(match[1]) : [];
|
|
849
748
|
});
|
|
@@ -948,21 +847,29 @@ function isRigStickyStatusComment(body) {
|
|
|
948
847
|
return body.includes(RIG_STATUS_COMMENT_MARKER);
|
|
949
848
|
}
|
|
950
849
|
function ghSpawnOptions(extraEnv, timeoutMs) {
|
|
850
|
+
const env = {
|
|
851
|
+
...process.env,
|
|
852
|
+
...process.env.GH_TOKEN !== undefined ? { GH_TOKEN: process.env.GH_TOKEN } : {},
|
|
853
|
+
...process.env.GITHUB_TOKEN !== undefined ? { GITHUB_TOKEN: process.env.GITHUB_TOKEN } : {},
|
|
854
|
+
...process.env.RIG_GITHUB_TOKEN !== undefined ? { RIG_GITHUB_TOKEN: process.env.RIG_GITHUB_TOKEN } : {}
|
|
855
|
+
};
|
|
856
|
+
for (const [key, value] of Object.entries(extraEnv ?? {})) {
|
|
857
|
+
if (value === undefined)
|
|
858
|
+
delete env[key];
|
|
859
|
+
else
|
|
860
|
+
env[key] = value;
|
|
861
|
+
}
|
|
951
862
|
return {
|
|
952
863
|
encoding: "utf-8",
|
|
953
864
|
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
|
-
}
|
|
865
|
+
env
|
|
961
866
|
};
|
|
962
867
|
}
|
|
963
868
|
function credentialEnv(token) {
|
|
964
869
|
const clean = token?.trim() ?? "";
|
|
965
|
-
|
|
870
|
+
if (clean)
|
|
871
|
+
return { GH_TOKEN: clean, GITHUB_TOKEN: clean, RIG_GITHUB_TOKEN: clean };
|
|
872
|
+
return { GH_TOKEN: undefined, GITHUB_TOKEN: undefined, RIG_GITHUB_TOKEN: undefined };
|
|
966
873
|
}
|
|
967
874
|
async function resolveCredentialEnv(opts, purpose) {
|
|
968
875
|
if (!opts.credentialProvider)
|
|
@@ -1711,40 +1618,9 @@ function createFilesTaskSource(opts) {
|
|
|
1711
1618
|
// packages/standard-plugin/src/plugin.ts
|
|
1712
1619
|
init_metadata();
|
|
1713
1620
|
init_metadata();
|
|
1621
|
+
import { createStandardProductEntrypointPlugin, standardProductEntrypointPlugin } from "@rig/product-entrypoint-plugin/plugin";
|
|
1622
|
+
import { createStandardTaskCliPlugin, standardTaskCliPlugin } from "@rig/task-cli-plugin/plugin";
|
|
1714
1623
|
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
1624
|
function requireStringField(config, field, kind) {
|
|
1749
1625
|
const value = config[field];
|
|
1750
1626
|
if (!value) {
|
|
@@ -1854,7 +1730,7 @@ function createLazyDocsDriftRuntimeCliCommand(options = {}) {
|
|
|
1854
1730
|
};
|
|
1855
1731
|
}
|
|
1856
1732
|
function createStandardDocsDriftPlugin(opts = {}) {
|
|
1857
|
-
return
|
|
1733
|
+
return definePlugin2({
|
|
1858
1734
|
name: "@rig/standard-plugin:docs-drift",
|
|
1859
1735
|
version: "0.1.0",
|
|
1860
1736
|
contributes: {
|
|
@@ -1888,19 +1764,8 @@ function createStandardDocsDriftPlugin(opts = {}) {
|
|
|
1888
1764
|
cliCommands: [createLazyDocsDriftRuntimeCliCommand(opts)]
|
|
1889
1765
|
});
|
|
1890
1766
|
}
|
|
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
1767
|
function createStandardTaskSourcesPlugin(opts = {}) {
|
|
1903
|
-
return
|
|
1768
|
+
return definePlugin2({
|
|
1904
1769
|
name: "@rig/standard-plugin:task-sources",
|
|
1905
1770
|
version: "0.1.0",
|
|
1906
1771
|
contributes: {
|
|
@@ -1928,7 +1793,7 @@ function createStandardTaskSourcesPlugin(opts = {}) {
|
|
|
1928
1793
|
owner: requireStringField(config, "owner", "github-issues"),
|
|
1929
1794
|
repo: requireStringField(config, "repo", "github-issues")
|
|
1930
1795
|
};
|
|
1931
|
-
const credentialProviderOptions = context?.projectRoot ? { stateDir:
|
|
1796
|
+
const credentialProviderOptions = context?.projectRoot ? { stateDir: resolve4(context.projectRoot, ".rig", "state") } : {};
|
|
1932
1797
|
options.credentialProvider = opts.githubCredentialProvider ?? createStateGitHubCredentialProvider(credentialProviderOptions);
|
|
1933
1798
|
if (opts.githubWorkspaceId)
|
|
1934
1799
|
options.workspaceId = opts.githubWorkspaceId;
|
|
@@ -1986,6 +1851,7 @@ function standardPlugins(options = {}) {
|
|
|
1986
1851
|
standardCliSurfacePlugin,
|
|
1987
1852
|
RUN_WORKER_PANEL_PLUGIN,
|
|
1988
1853
|
createStandardTaskSourcesPlugin(options.taskSources),
|
|
1854
|
+
createStandardTaskCliPlugin(),
|
|
1989
1855
|
createStandardDocsDriftPlugin(options.drift),
|
|
1990
1856
|
createStandardProductEntrypointPlugin()
|
|
1991
1857
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RigPluginWithRuntime } from "@rig/core/config";
|
|
2
1
|
export declare const STANDARD_CLI_SURFACE_PLUGIN_NAME = "@rig/standard-plugin:cli-surface";
|
|
3
|
-
export declare const standardCliSurfacePlugin: RigPluginWithRuntime;
|
|
4
|
-
export declare function
|
|
2
|
+
export declare const standardCliSurfacePlugin: import("@rig/core").RigPluginWithRuntime;
|
|
3
|
+
export declare function createStandardCliSurfacePlugin(): import("@rig/core").RigPluginWithRuntime;
|
|
4
|
+
export default standardCliSurfacePlugin;
|
package/dist/src/cli-surface.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/standard-plugin/src/cli-surface.ts
|
|
3
|
+
import { definePlugin } from "@rig/core/config";
|
|
3
4
|
var STANDARD_CLI_SURFACE_PLUGIN_NAME = "@rig/standard-plugin:cli-surface";
|
|
4
|
-
var standardCliSurfacePlugin = {
|
|
5
|
+
var standardCliSurfacePlugin = definePlugin({
|
|
5
6
|
name: STANDARD_CLI_SURFACE_PLUGIN_NAME,
|
|
6
7
|
version: "0.0.0-alpha.1",
|
|
7
|
-
contributes: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
8
|
+
contributes: {}
|
|
9
|
+
});
|
|
10
|
+
function createStandardCliSurfacePlugin() {
|
|
11
|
+
return standardCliSurfacePlugin;
|
|
16
12
|
}
|
|
13
|
+
var cli_surface_default = standardCliSurfacePlugin;
|
|
17
14
|
export {
|
|
18
|
-
standardCliSurfaceRuntime,
|
|
19
15
|
standardCliSurfacePlugin,
|
|
16
|
+
cli_surface_default as default,
|
|
17
|
+
createStandardCliSurfacePlugin,
|
|
20
18
|
STANDARD_CLI_SURFACE_PLUGIN_NAME
|
|
21
19
|
};
|
|
@@ -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,6 @@
|
|
|
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";
|