@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
package/dist/src/plugin.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);
|
|
@@ -647,7 +544,7 @@ var init_plugin = __esm(() => {
|
|
|
647
544
|
});
|
|
648
545
|
|
|
649
546
|
// packages/standard-plugin/src/plugin.ts
|
|
650
|
-
import { resolve as
|
|
547
|
+
import { resolve as resolve4 } from "path";
|
|
651
548
|
import { definePlugin } from "@rig/core/config";
|
|
652
549
|
|
|
653
550
|
// packages/standard-plugin/src/github-issues-source.ts
|
|
@@ -662,7 +559,7 @@ function createEnvGitHubCredentialProvider() {
|
|
|
662
559
|
return {
|
|
663
560
|
async resolveGitHubToken(input) {
|
|
664
561
|
if (input.purpose === "selected-repo") {
|
|
665
|
-
return { token: cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ??
|
|
562
|
+
return { token: cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ?? null) ?? "", source: "signed-in-user" };
|
|
666
563
|
}
|
|
667
564
|
const token = cleanToken(process.env.RIG_GITHUB_TOKEN ?? process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN ?? null);
|
|
668
565
|
if (!token) {
|
|
@@ -697,11 +594,11 @@ function createStateGitHubCredentialProvider(options = {}) {
|
|
|
697
594
|
const candidates = [];
|
|
698
595
|
addCandidate(candidates, options.stateFile ?? process.env.RIG_GITHUB_AUTH_STATE_FILE);
|
|
699
596
|
addStateDir(candidates, options.stateDir);
|
|
597
|
+
addStateDir(candidates, process.env.RIG_STATE_DIR);
|
|
700
598
|
addProjectStateDir(candidates, process.env.PROJECT_RIG_ROOT);
|
|
701
599
|
addProjectStateDir(candidates, process.env.RIG_PROJECT_ROOT);
|
|
702
600
|
addProjectStateDir(candidates, process.env.RIG_HOST_PROJECT_ROOT);
|
|
703
601
|
addProjectStateDir(candidates, process.cwd());
|
|
704
|
-
addStateDir(candidates, process.env.RIG_STATE_DIR);
|
|
705
602
|
return candidates;
|
|
706
603
|
};
|
|
707
604
|
const readToken = () => {
|
|
@@ -721,7 +618,7 @@ function createStateGitHubCredentialProvider(options = {}) {
|
|
|
721
618
|
async resolveGitHubToken(input) {
|
|
722
619
|
const token = readToken();
|
|
723
620
|
if (input.purpose === "selected-repo") {
|
|
724
|
-
return { token: token ?? cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ??
|
|
621
|
+
return { token: token ?? cleanToken(process.env.RIG_GITHUB_SELECTED_TOKEN ?? null) ?? "", source: "signed-in-user" };
|
|
725
622
|
}
|
|
726
623
|
if (token) {
|
|
727
624
|
return { token, source: "signed-in-user" };
|
|
@@ -793,9 +690,12 @@ function parseMetadataList(body, keys) {
|
|
|
793
690
|
}
|
|
794
691
|
return [...new Set(values)];
|
|
795
692
|
}
|
|
693
|
+
function bodyWithoutRigMetadataBlock(body) {
|
|
694
|
+
return body.replace(/<!-- rig:metadata:start -->\s*[\s\S]*?\s*<!-- rig:metadata:end -->/g, "");
|
|
695
|
+
}
|
|
796
696
|
function parseBodyKeyRefs(body, keys) {
|
|
797
697
|
const keyPattern = metadataKeyPattern(keys);
|
|
798
|
-
const values = body.split(/\r?\n/).flatMap((line) => {
|
|
698
|
+
const values = bodyWithoutRigMetadataBlock(body).split(/\r?\n/).flatMap((line) => {
|
|
799
699
|
const match = line.match(keyPattern);
|
|
800
700
|
return match?.[1] ? parseIssueRefs(match[1]) : [];
|
|
801
701
|
});
|
|
@@ -900,21 +800,29 @@ function isRigStickyStatusComment(body) {
|
|
|
900
800
|
return body.includes(RIG_STATUS_COMMENT_MARKER);
|
|
901
801
|
}
|
|
902
802
|
function ghSpawnOptions(extraEnv, timeoutMs) {
|
|
803
|
+
const env = {
|
|
804
|
+
...process.env,
|
|
805
|
+
...process.env.GH_TOKEN !== undefined ? { GH_TOKEN: process.env.GH_TOKEN } : {},
|
|
806
|
+
...process.env.GITHUB_TOKEN !== undefined ? { GITHUB_TOKEN: process.env.GITHUB_TOKEN } : {},
|
|
807
|
+
...process.env.RIG_GITHUB_TOKEN !== undefined ? { RIG_GITHUB_TOKEN: process.env.RIG_GITHUB_TOKEN } : {}
|
|
808
|
+
};
|
|
809
|
+
for (const [key, value] of Object.entries(extraEnv ?? {})) {
|
|
810
|
+
if (value === undefined)
|
|
811
|
+
delete env[key];
|
|
812
|
+
else
|
|
813
|
+
env[key] = value;
|
|
814
|
+
}
|
|
903
815
|
return {
|
|
904
816
|
encoding: "utf-8",
|
|
905
817
|
timeout: timeoutMs,
|
|
906
|
-
env
|
|
907
|
-
...process.env,
|
|
908
|
-
...process.env.GH_TOKEN !== undefined ? { GH_TOKEN: process.env.GH_TOKEN } : {},
|
|
909
|
-
...process.env.GITHUB_TOKEN !== undefined ? { GITHUB_TOKEN: process.env.GITHUB_TOKEN } : {},
|
|
910
|
-
...process.env.RIG_GITHUB_TOKEN !== undefined ? { RIG_GITHUB_TOKEN: process.env.RIG_GITHUB_TOKEN } : {},
|
|
911
|
-
...extraEnv ?? {}
|
|
912
|
-
}
|
|
818
|
+
env
|
|
913
819
|
};
|
|
914
820
|
}
|
|
915
821
|
function credentialEnv(token) {
|
|
916
822
|
const clean = token?.trim() ?? "";
|
|
917
|
-
|
|
823
|
+
if (clean)
|
|
824
|
+
return { GH_TOKEN: clean, GITHUB_TOKEN: clean, RIG_GITHUB_TOKEN: clean };
|
|
825
|
+
return { GH_TOKEN: undefined, GITHUB_TOKEN: undefined, RIG_GITHUB_TOKEN: undefined };
|
|
918
826
|
}
|
|
919
827
|
async function resolveCredentialEnv(opts, purpose) {
|
|
920
828
|
if (!opts.credentialProvider)
|
|
@@ -1663,40 +1571,9 @@ function createFilesTaskSource(opts) {
|
|
|
1663
1571
|
// packages/standard-plugin/src/plugin.ts
|
|
1664
1572
|
init_metadata();
|
|
1665
1573
|
init_metadata();
|
|
1574
|
+
import { createStandardProductEntrypointPlugin, standardProductEntrypointPlugin } from "@rig/product-entrypoint-plugin/plugin";
|
|
1575
|
+
import { createStandardTaskCliPlugin, standardTaskCliPlugin } from "@rig/task-cli-plugin/plugin";
|
|
1666
1576
|
var DOCS_HEALTH_PANEL_ID = "docs-health";
|
|
1667
|
-
var STANDARD_PRODUCT_COMMANDS = [
|
|
1668
|
-
{ command: "launch", description: "Open the Rig Cockpit through the OMP collaboration substrate.", usage: "rig [launch] [args...]" },
|
|
1669
|
-
{ command: "join", description: "Join an encrypted Rig/OMP collaborative session.", usage: "rig join <link>" },
|
|
1670
|
-
{ command: "acp", description: "Start the Rig product in OMP ACP mode.", usage: "rig acp [args...]" },
|
|
1671
|
-
{ command: "models", description: "Delegate model management to the Rig product substrate.", usage: "rig models [args...]" },
|
|
1672
|
-
{ command: "mcp", description: "Delegate MCP management to the Rig product substrate.", usage: "rig mcp [args...]" },
|
|
1673
|
-
{ command: "update", description: "Delegate product update handling to the Rig product substrate.", usage: "rig update [args...]" }
|
|
1674
|
-
];
|
|
1675
|
-
function standardProductCliCommandId(command) {
|
|
1676
|
-
return `@rig/standard-plugin:product-entrypoint:${command}`;
|
|
1677
|
-
}
|
|
1678
|
-
function standardProductCliCommandMetadata(descriptor) {
|
|
1679
|
-
return {
|
|
1680
|
-
id: standardProductCliCommandId(descriptor.command),
|
|
1681
|
-
family: descriptor.command,
|
|
1682
|
-
description: descriptor.description,
|
|
1683
|
-
usage: descriptor.usage,
|
|
1684
|
-
projectRequired: false
|
|
1685
|
-
};
|
|
1686
|
-
}
|
|
1687
|
-
function createStandardProductCliCommand(descriptor) {
|
|
1688
|
-
return {
|
|
1689
|
-
...standardProductCliCommandMetadata(descriptor),
|
|
1690
|
-
run: async (context, args) => {
|
|
1691
|
-
const { runRigOmpProductCommand: runRigOmpProductCommand2 } = await Promise.resolve().then(() => (init_product_entrypoint(), exports_product_entrypoint));
|
|
1692
|
-
return runRigOmpProductCommand2({
|
|
1693
|
-
projectRoot: context.projectRoot,
|
|
1694
|
-
command: descriptor.command,
|
|
1695
|
-
args
|
|
1696
|
-
});
|
|
1697
|
-
}
|
|
1698
|
-
};
|
|
1699
|
-
}
|
|
1700
1577
|
function requireStringField(config, field, kind) {
|
|
1701
1578
|
const value = config[field];
|
|
1702
1579
|
if (!value) {
|
|
@@ -1840,17 +1717,6 @@ function createStandardDocsDriftPlugin(opts = {}) {
|
|
|
1840
1717
|
cliCommands: [createLazyDocsDriftRuntimeCliCommand(opts)]
|
|
1841
1718
|
});
|
|
1842
1719
|
}
|
|
1843
|
-
function createStandardProductEntrypointPlugin() {
|
|
1844
|
-
return definePlugin({
|
|
1845
|
-
name: "@rig/standard-plugin:product-entrypoint",
|
|
1846
|
-
version: "0.1.0",
|
|
1847
|
-
contributes: {
|
|
1848
|
-
cliCommands: STANDARD_PRODUCT_COMMANDS.map(standardProductCliCommandMetadata)
|
|
1849
|
-
}
|
|
1850
|
-
}, {
|
|
1851
|
-
cliCommands: STANDARD_PRODUCT_COMMANDS.map(createStandardProductCliCommand)
|
|
1852
|
-
});
|
|
1853
|
-
}
|
|
1854
1720
|
function createStandardTaskSourcesPlugin(opts = {}) {
|
|
1855
1721
|
return definePlugin({
|
|
1856
1722
|
name: "@rig/standard-plugin:task-sources",
|
|
@@ -1880,7 +1746,7 @@ function createStandardTaskSourcesPlugin(opts = {}) {
|
|
|
1880
1746
|
owner: requireStringField(config, "owner", "github-issues"),
|
|
1881
1747
|
repo: requireStringField(config, "repo", "github-issues")
|
|
1882
1748
|
};
|
|
1883
|
-
const credentialProviderOptions = context?.projectRoot ? { stateDir:
|
|
1749
|
+
const credentialProviderOptions = context?.projectRoot ? { stateDir: resolve4(context.projectRoot, ".rig", "state") } : {};
|
|
1884
1750
|
options.credentialProvider = opts.githubCredentialProvider ?? createStateGitHubCredentialProvider(credentialProviderOptions);
|
|
1885
1751
|
if (opts.githubWorkspaceId)
|
|
1886
1752
|
options.workspaceId = opts.githubWorkspaceId;
|
|
@@ -1927,8 +1793,11 @@ function createStandardTaskSourcesPlugin(opts = {}) {
|
|
|
1927
1793
|
});
|
|
1928
1794
|
}
|
|
1929
1795
|
export {
|
|
1796
|
+
standardTaskCliPlugin,
|
|
1797
|
+
standardProductEntrypointPlugin,
|
|
1930
1798
|
createStateGitHubCredentialProvider,
|
|
1931
1799
|
createStandardTaskSourcesPlugin,
|
|
1800
|
+
createStandardTaskCliPlugin,
|
|
1932
1801
|
createStandardProductEntrypointPlugin,
|
|
1933
1802
|
createStandardDocsDriftPlugin,
|
|
1934
1803
|
createGitHubIssuesTaskSource,
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
readonly command: RigProductCommandName;
|
|
5
|
-
readonly args: readonly string[];
|
|
6
|
-
};
|
|
7
|
-
export declare function runRigOmpProductCommand(input: RunRigOmpProductCommandInput): Promise<{
|
|
8
|
-
ok: true;
|
|
9
|
-
group: string;
|
|
10
|
-
command: string;
|
|
11
|
-
}>;
|
|
1
|
+
export { runRigOmpProductCommand } from "@rig/product-entrypoint-plugin/product-entrypoint";
|
|
2
|
+
export type { RigProductCommandName } from "@rig/product-entrypoint-plugin/metadata";
|
|
3
|
+
export type { RunRigOmpProductCommandInput } from "@rig/product-entrypoint-plugin/product-entrypoint";
|
|
@@ -1,101 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/standard-plugin/src/product-entrypoint.ts
|
|
3
|
-
import {
|
|
4
|
-
import { runCli } from "@oh-my-pi/pi-coding-agent/cli";
|
|
5
|
-
import { parseArgs } from "@oh-my-pi/pi-coding-agent/cli/args";
|
|
6
|
-
import { resolveCliArgv } from "@oh-my-pi/pi-coding-agent/cli-commands";
|
|
7
|
-
import { prepareAcpTerminalAuthArgs } from "@oh-my-pi/pi-coding-agent/modes/acp/terminal-auth";
|
|
8
|
-
import { runRootCommand } from "@oh-my-pi/pi-coding-agent/main";
|
|
9
|
-
import { createAgentSession } from "@oh-my-pi/pi-coding-agent/sdk";
|
|
10
|
-
import { applyIdentityEnv, identityFilterFromEnv, reconcileRuns } from "@rig/client";
|
|
11
|
-
import rigExtension from "@rig/rig-extension";
|
|
12
|
-
import { resolveRigOmpConfigOverlayPath } from "@rig/runtime/control-plane/remote-config";
|
|
13
|
-
function withRigDefaultConfig(projectRoot, argv) {
|
|
14
|
-
return ["--config", resolveRigOmpConfigOverlayPath(projectRoot), ...argv];
|
|
15
|
-
}
|
|
16
|
-
function createRigAgentSession(options = {}) {
|
|
17
|
-
return createAgentSession({
|
|
18
|
-
...options,
|
|
19
|
-
extensions: [(api) => rigExtension(api), ...options.extensions ?? []]
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
function productArgv(input) {
|
|
23
|
-
if (input.command === "launch" && input.args.length === 0)
|
|
24
|
-
return [];
|
|
25
|
-
if (input.command === "launch" && input.args[0]?.startsWith("-"))
|
|
26
|
-
return [...input.args];
|
|
27
|
-
return [input.command, ...input.args];
|
|
28
|
-
}
|
|
29
|
-
async function runRigOmpProductCommand(input) {
|
|
30
|
-
const projectRoot = resolve(input.projectRoot);
|
|
31
|
-
const previousProjectRoot = process.env.RIG_PROJECT_ROOT;
|
|
32
|
-
const previousCwd = process.cwd();
|
|
33
|
-
const restorePublicIdentityEnv = applyIdentityEnv(projectRoot);
|
|
34
|
-
process.env.RIG_PROJECT_ROOT = projectRoot;
|
|
35
|
-
process.chdir(projectRoot);
|
|
36
|
-
try {
|
|
37
|
-
const argv = productArgv(input);
|
|
38
|
-
if (argv[0]?.startsWith("__omp_worker_") || argv[0] === "--smoke-test") {
|
|
39
|
-
await runCli(argv);
|
|
40
|
-
return { ok: true, group: "product", command: input.command };
|
|
41
|
-
}
|
|
42
|
-
if (process.stdin.isTTY) {
|
|
43
|
-
const reconcile = await reconcileRuns({
|
|
44
|
-
workspaceRoot: projectRoot,
|
|
45
|
-
identityFilter: identityFilterFromEnv()
|
|
46
|
-
}).catch(() => ({ flipped: [], resumable: [] }));
|
|
47
|
-
globalThis.__RIG_RESUMABLE__ = reconcile.resumable;
|
|
48
|
-
}
|
|
49
|
-
const resolved = resolveCliArgv(argv);
|
|
50
|
-
if ("error" in resolved) {
|
|
51
|
-
process.stderr.write(`error: ${resolved.error}
|
|
52
|
-
`);
|
|
53
|
-
process.exitCode = 1;
|
|
54
|
-
return { ok: true, group: "product", command: input.command };
|
|
55
|
-
}
|
|
56
|
-
const [ompCommand, ...ompCommandArgs] = resolved.argv;
|
|
57
|
-
if (ompCommand === "launch") {
|
|
58
|
-
const args = withRigDefaultConfig(projectRoot, ompCommandArgs);
|
|
59
|
-
await runRootCommand(parseArgs(args), args, { createAgentSession: createRigAgentSession });
|
|
60
|
-
} else if (ompCommand === "acp") {
|
|
61
|
-
const { args: preparedArgs, terminalAuth } = prepareAcpTerminalAuthArgs(ompCommandArgs);
|
|
62
|
-
const args = withRigDefaultConfig(projectRoot, preparedArgs);
|
|
63
|
-
const parsed = parseArgs(args);
|
|
64
|
-
if (!terminalAuth)
|
|
65
|
-
parsed.mode = "acp";
|
|
66
|
-
await runRootCommand(parsed, args, { createAgentSession: createRigAgentSession });
|
|
67
|
-
} else if (ompCommand === "join") {
|
|
68
|
-
const link = ompCommandArgs[0]?.trim();
|
|
69
|
-
if (!link) {
|
|
70
|
-
process.stderr.write(`Usage: rig join <link>
|
|
71
|
-
`);
|
|
72
|
-
process.exitCode = 1;
|
|
73
|
-
return { ok: true, group: "product", command: input.command };
|
|
74
|
-
}
|
|
75
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
76
|
-
process.stderr.write(`rig join requires an interactive terminal
|
|
77
|
-
`);
|
|
78
|
-
process.exitCode = 1;
|
|
79
|
-
return { ok: true, group: "product", command: input.command };
|
|
80
|
-
}
|
|
81
|
-
const args = withRigDefaultConfig(projectRoot, []);
|
|
82
|
-
const parsed = parseArgs(args);
|
|
83
|
-
parsed.join = link;
|
|
84
|
-
await runRootCommand(parsed, args, { createAgentSession: createRigAgentSession });
|
|
85
|
-
} else {
|
|
86
|
-
await runCli(resolved.argv);
|
|
87
|
-
}
|
|
88
|
-
return { ok: true, group: "product", command: input.command };
|
|
89
|
-
} finally {
|
|
90
|
-
restorePublicIdentityEnv();
|
|
91
|
-
process.chdir(previousCwd);
|
|
92
|
-
if (previousProjectRoot === undefined) {
|
|
93
|
-
delete process.env.RIG_PROJECT_ROOT;
|
|
94
|
-
} else {
|
|
95
|
-
process.env.RIG_PROJECT_ROOT = previousProjectRoot;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
3
|
+
import { runRigOmpProductCommand } from "@rig/product-entrypoint-plugin/product-entrypoint";
|
|
99
4
|
export {
|
|
100
5
|
runRigOmpProductCommand
|
|
101
6
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createStandardProductEntrypointPlugin, standardProductEntrypointPlugin, } from "@rig/product-entrypoint-plugin/plugin";
|
|
2
|
+
export { STANDARD_PRODUCT_COMMANDS, standardProductCliCommandId, standardProductCliCommandMetadata, } from "@rig/product-entrypoint-plugin/metadata";
|
|
3
|
+
export type { RigProductCommandName, StandardProductCommandDescriptor, } from "@rig/product-entrypoint-plugin/metadata";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/standard-plugin/src/product-plugin.ts
|
|
3
|
+
import {
|
|
4
|
+
createStandardProductEntrypointPlugin,
|
|
5
|
+
standardProductEntrypointPlugin
|
|
6
|
+
} from "@rig/product-entrypoint-plugin/plugin";
|
|
7
|
+
import {
|
|
8
|
+
STANDARD_PRODUCT_COMMANDS,
|
|
9
|
+
standardProductCliCommandId,
|
|
10
|
+
standardProductCliCommandMetadata
|
|
11
|
+
} from "@rig/product-entrypoint-plugin/metadata";
|
|
12
|
+
export {
|
|
13
|
+
standardProductEntrypointPlugin,
|
|
14
|
+
standardProductCliCommandMetadata,
|
|
15
|
+
standardProductCliCommandId,
|
|
16
|
+
createStandardProductEntrypointPlugin,
|
|
17
|
+
STANDARD_PRODUCT_COMMANDS
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SUPERVISOR_PLUGIN_NAME, createSupervisorPlugin, supervisorPlugin, } from "@rig/supervisor-plugin/plugin";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/standard-plugin/src/supervisor.ts
|
|
3
|
+
import {
|
|
4
|
+
SUPERVISOR_PLUGIN_NAME,
|
|
5
|
+
createSupervisorPlugin,
|
|
6
|
+
supervisorPlugin
|
|
7
|
+
} from "@rig/supervisor-plugin/plugin";
|
|
8
|
+
export {
|
|
9
|
+
supervisorPlugin,
|
|
10
|
+
createSupervisorPlugin,
|
|
11
|
+
SUPERVISOR_PLUGIN_NAME
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { STANDARD_TASK_CLI_ID, STANDARD_TASK_CLI_PLUGIN_NAME, createStandardTaskCliPlugin, standardTaskCliPlugin, } from "@rig/task-cli-plugin/plugin";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/standard-plugin/src/task-cli.ts
|
|
3
|
+
import {
|
|
4
|
+
STANDARD_TASK_CLI_ID,
|
|
5
|
+
STANDARD_TASK_CLI_PLUGIN_NAME,
|
|
6
|
+
createStandardTaskCliPlugin,
|
|
7
|
+
standardTaskCliPlugin
|
|
8
|
+
} from "@rig/task-cli-plugin/plugin";
|
|
9
|
+
export {
|
|
10
|
+
standardTaskCliPlugin,
|
|
11
|
+
createStandardTaskCliPlugin,
|
|
12
|
+
STANDARD_TASK_CLI_PLUGIN_NAME,
|
|
13
|
+
STANDARD_TASK_CLI_ID
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-rig/standard-plugin",
|
|
3
|
-
"version": "0.0.6-alpha.
|
|
3
|
+
"version": "0.0.6-alpha.144",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "First-party contribution bundle for Rig's OMP extension plugin graph; not a standalone plugin runtime.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -21,6 +21,38 @@
|
|
|
21
21
|
"types": "./dist/src/plugin.d.ts",
|
|
22
22
|
"import": "./dist/src/plugin.js"
|
|
23
23
|
},
|
|
24
|
+
"./default-lifecycle": {
|
|
25
|
+
"types": "./dist/src/default-lifecycle.d.ts",
|
|
26
|
+
"import": "./dist/src/default-lifecycle.js"
|
|
27
|
+
},
|
|
28
|
+
"./dependency-graph": {
|
|
29
|
+
"types": "./dist/src/dependency-graph.d.ts",
|
|
30
|
+
"import": "./dist/src/dependency-graph.js"
|
|
31
|
+
},
|
|
32
|
+
"./blocker-classifier": {
|
|
33
|
+
"types": "./dist/src/blocker-classifier.d.ts",
|
|
34
|
+
"import": "./dist/src/blocker-classifier.js"
|
|
35
|
+
},
|
|
36
|
+
"./planning": {
|
|
37
|
+
"types": "./dist/src/planning.d.ts",
|
|
38
|
+
"import": "./dist/src/planning.js"
|
|
39
|
+
},
|
|
40
|
+
"./supervisor": {
|
|
41
|
+
"types": "./dist/src/supervisor.d.ts",
|
|
42
|
+
"import": "./dist/src/supervisor.js"
|
|
43
|
+
},
|
|
44
|
+
"./task-cli": {
|
|
45
|
+
"types": "./dist/src/task-cli.d.ts",
|
|
46
|
+
"import": "./dist/src/task-cli.js"
|
|
47
|
+
},
|
|
48
|
+
"./product-plugin": {
|
|
49
|
+
"types": "./dist/src/product-plugin.d.ts",
|
|
50
|
+
"import": "./dist/src/product-plugin.js"
|
|
51
|
+
},
|
|
52
|
+
"./product-entrypoint": {
|
|
53
|
+
"types": "./dist/src/product-entrypoint.d.ts",
|
|
54
|
+
"import": "./dist/src/product-entrypoint.js"
|
|
55
|
+
},
|
|
24
56
|
"./lifecycle-closeout": {
|
|
25
57
|
"types": "./dist/src/lifecycle-closeout.d.ts",
|
|
26
58
|
"import": "./dist/src/lifecycle-closeout.js"
|
|
@@ -49,17 +81,15 @@
|
|
|
49
81
|
"module": "./dist/src/index.js",
|
|
50
82
|
"types": "./dist/src/index.d.ts",
|
|
51
83
|
"dependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@rig/
|
|
54
|
-
"@rig/
|
|
55
|
-
"@rig/
|
|
56
|
-
"@rig/
|
|
57
|
-
"@rig/
|
|
58
|
-
"@rig/
|
|
59
|
-
"@rig/
|
|
60
|
-
"@rig/
|
|
61
|
-
"@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.143",
|
|
62
|
-
"@rig/supervisor-plugin": "npm:@h-rig/supervisor-plugin@0.0.6-alpha.143",
|
|
84
|
+
"@rig/blocker-classifier-plugin": "npm:@h-rig/blocker-classifier-plugin@0.0.6-alpha.144",
|
|
85
|
+
"@rig/bundle-default-lifecycle": "npm:@h-rig/bundle-default-lifecycle@0.0.6-alpha.144",
|
|
86
|
+
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.144",
|
|
87
|
+
"@rig/core": "npm:@h-rig/core@0.0.6-alpha.144",
|
|
88
|
+
"@rig/dependency-graph-plugin": "npm:@h-rig/dependency-graph-plugin@0.0.6-alpha.144",
|
|
89
|
+
"@rig/planning-plugin": "npm:@h-rig/planning-plugin@0.0.6-alpha.144",
|
|
90
|
+
"@rig/product-entrypoint-plugin": "0.0.6-alpha.144",
|
|
91
|
+
"@rig/task-cli-plugin": "0.0.6-alpha.144",
|
|
92
|
+
"@rig/supervisor-plugin": "npm:@h-rig/supervisor-plugin@0.0.6-alpha.144",
|
|
63
93
|
"effect": "4.0.0-beta.90"
|
|
64
94
|
}
|
|
65
95
|
}
|