opensteer 0.6.13 → 0.7.0
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/README.md +256 -184
- package/dist/chunk-PQYA6IX2.js +32571 -0
- package/dist/chunk-PQYA6IX2.js.map +1 -0
- package/dist/cli/bin.cjs +38201 -0
- package/dist/cli/bin.cjs.map +1 -0
- package/dist/cli/bin.d.cts +1 -0
- package/dist/cli/bin.d.ts +1 -0
- package/dist/cli/bin.js +5612 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/index.cjs +31309 -16009
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4440 -670
- package/dist/index.d.ts +4440 -670
- package/dist/index.js +438 -378
- package/dist/index.js.map +1 -0
- package/package.json +56 -62
- package/skills/README.md +21 -20
- package/skills/opensteer/SKILL.md +60 -194
- package/skills/opensteer/references/cli-reference.md +69 -113
- package/skills/opensteer/references/request-workflow.md +81 -0
- package/skills/opensteer/references/sdk-reference.md +101 -154
- package/CHANGELOG.md +0 -75
- package/bin/opensteer.mjs +0 -1423
- package/dist/browser-profile-client-CGXc0-P9.d.cts +0 -228
- package/dist/browser-profile-client-DHLzMf-K.d.ts +0 -228
- package/dist/chunk-2ES46WCO.js +0 -1437
- package/dist/chunk-3H5RRIMZ.js +0 -69
- package/dist/chunk-AVXUMEDG.js +0 -62
- package/dist/chunk-DN3GI5CH.js +0 -57
- package/dist/chunk-FAHE5DB2.js +0 -190
- package/dist/chunk-HBTSQ2V4.js +0 -15259
- package/dist/chunk-K5CL76MG.js +0 -81
- package/dist/chunk-U724TBY6.js +0 -1262
- package/dist/chunk-ZRCFF546.js +0 -77
- package/dist/cli/auth.cjs +0 -2022
- package/dist/cli/auth.d.cts +0 -114
- package/dist/cli/auth.d.ts +0 -114
- package/dist/cli/auth.js +0 -15
- package/dist/cli/local-profile.cjs +0 -197
- package/dist/cli/local-profile.d.cts +0 -18
- package/dist/cli/local-profile.d.ts +0 -18
- package/dist/cli/local-profile.js +0 -97
- package/dist/cli/profile.cjs +0 -18548
- package/dist/cli/profile.d.cts +0 -79
- package/dist/cli/profile.d.ts +0 -79
- package/dist/cli/profile.js +0 -1328
- package/dist/cli/server.cjs +0 -17232
- package/dist/cli/server.d.cts +0 -2
- package/dist/cli/server.d.ts +0 -2
- package/dist/cli/server.js +0 -977
- package/dist/cli/skills-installer.cjs +0 -230
- package/dist/cli/skills-installer.d.cts +0 -28
- package/dist/cli/skills-installer.d.ts +0 -28
- package/dist/cli/skills-installer.js +0 -201
- package/dist/extractor-4Q3TFZJB.js +0 -8
- package/dist/resolver-MGN64KCP.js +0 -7
- package/dist/types-Cr10igF3.d.cts +0 -345
- package/dist/types-Cr10igF3.d.ts +0 -345
- package/skills/electron/SKILL.md +0 -87
- package/skills/electron/references/opensteer-electron-recipes.md +0 -88
- package/skills/electron/references/opensteer-electron-workflow.md +0 -85
- package/skills/opensteer/references/examples.md +0 -118
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/cli/skills-installer.ts
|
|
21
|
-
var skills_installer_exports = {};
|
|
22
|
-
__export(skills_installer_exports, {
|
|
23
|
-
createSkillsInstallInvocation: () => createSkillsInstallInvocation,
|
|
24
|
-
parseOpensteerSkillsArgs: () => parseOpensteerSkillsArgs,
|
|
25
|
-
resolveLocalSkillSourcePath: () => resolveLocalSkillSourcePath,
|
|
26
|
-
resolveSkillsCliPath: () => resolveSkillsCliPath,
|
|
27
|
-
runOpensteerSkillsInstaller: () => runOpensteerSkillsInstaller
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(skills_installer_exports);
|
|
30
|
-
var import_node_child_process = require("child_process");
|
|
31
|
-
var import_node_module = require("module");
|
|
32
|
-
var import_node_fs = require("fs");
|
|
33
|
-
var import_node_path = require("path");
|
|
34
|
-
var HELP_TEXT = `Usage: opensteer skills <install|add> [options]
|
|
35
|
-
|
|
36
|
-
Installs the first-party Opensteer skill using the upstream "skills" CLI.
|
|
37
|
-
|
|
38
|
-
Commands:
|
|
39
|
-
install Install the opensteer skill
|
|
40
|
-
add Alias for install
|
|
41
|
-
|
|
42
|
-
Supported Options:
|
|
43
|
-
-a, --agent <agents...> Target specific agent(s)
|
|
44
|
-
-g, --global Install globally
|
|
45
|
-
-y, --yes Skip confirmations
|
|
46
|
-
--copy Copy files instead of symlinking
|
|
47
|
-
--all Install to all agents
|
|
48
|
-
-h, --help Show this help
|
|
49
|
-
|
|
50
|
-
Examples:
|
|
51
|
-
opensteer skills install
|
|
52
|
-
opensteer skills add --agent codex --global --yes
|
|
53
|
-
opensteer skills install --all --yes
|
|
54
|
-
`;
|
|
55
|
-
function parseOpensteerSkillsArgs(rawArgs) {
|
|
56
|
-
if (rawArgs.length === 0) {
|
|
57
|
-
return { mode: "help", passthroughArgs: [] };
|
|
58
|
-
}
|
|
59
|
-
const [subcommand, ...rest] = rawArgs;
|
|
60
|
-
if (subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
|
|
61
|
-
return { mode: "help", passthroughArgs: [] };
|
|
62
|
-
}
|
|
63
|
-
if (subcommand !== "install" && subcommand !== "add") {
|
|
64
|
-
return {
|
|
65
|
-
mode: "error",
|
|
66
|
-
passthroughArgs: [],
|
|
67
|
-
error: `Unsupported skills subcommand "${subcommand}". Use "install" or "add".`
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const passthroughArgs = [];
|
|
71
|
-
for (let i = 0; i < rest.length; i += 1) {
|
|
72
|
-
const arg = rest[i];
|
|
73
|
-
if (arg === "--help" || arg === "-h") {
|
|
74
|
-
return { mode: "help", passthroughArgs: [] };
|
|
75
|
-
}
|
|
76
|
-
if (arg === "--global" || arg === "-g") {
|
|
77
|
-
passthroughArgs.push(arg);
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
if (arg === "--yes" || arg === "-y") {
|
|
81
|
-
passthroughArgs.push(arg);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
if (arg === "--copy" || arg === "--all") {
|
|
85
|
-
passthroughArgs.push(arg);
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
if (arg === "--agent" || arg === "-a") {
|
|
89
|
-
passthroughArgs.push(arg);
|
|
90
|
-
if (i + 1 >= rest.length || rest[i + 1]?.startsWith("-")) {
|
|
91
|
-
return {
|
|
92
|
-
mode: "error",
|
|
93
|
-
passthroughArgs: [],
|
|
94
|
-
error: `${arg} requires at least one value.`
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
while (i + 1 < rest.length && !rest[i + 1]?.startsWith("-")) {
|
|
98
|
-
i += 1;
|
|
99
|
-
const agent = rest[i];
|
|
100
|
-
if (agent) {
|
|
101
|
-
passthroughArgs.push(agent);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
if (arg.startsWith("-")) {
|
|
107
|
-
return {
|
|
108
|
-
mode: "error",
|
|
109
|
-
passthroughArgs: [],
|
|
110
|
-
error: `Unsupported option "${arg}" for "opensteer skills".`
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
mode: "error",
|
|
115
|
-
passthroughArgs: [],
|
|
116
|
-
error: `Unexpected argument "${arg}".`
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
mode: "install",
|
|
121
|
-
passthroughArgs
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function resolveLocalSkillSourcePath() {
|
|
125
|
-
const packageRoot = resolvePackageRoot();
|
|
126
|
-
const sourcePath = (0, import_node_path.join)(packageRoot, "skills");
|
|
127
|
-
if (!(0, import_node_fs.existsSync)(sourcePath)) {
|
|
128
|
-
throw new Error(
|
|
129
|
-
`Opensteer skill source was not found at "${sourcePath}".`
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
return sourcePath;
|
|
133
|
-
}
|
|
134
|
-
function resolveSkillsCliPath() {
|
|
135
|
-
const require2 = (0, import_node_module.createRequire)(resolveCliEntrypointPath());
|
|
136
|
-
const skillsPackagePath = require2.resolve("skills/package.json");
|
|
137
|
-
const skillsPackageDir = (0, import_node_path.dirname)(skillsPackagePath);
|
|
138
|
-
const cliPath = (0, import_node_path.join)(skillsPackageDir, "bin", "cli.mjs");
|
|
139
|
-
if (!(0, import_node_fs.existsSync)(cliPath)) {
|
|
140
|
-
throw new Error(`skills CLI entrypoint was not found at "${cliPath}".`);
|
|
141
|
-
}
|
|
142
|
-
return cliPath;
|
|
143
|
-
}
|
|
144
|
-
function resolveCliEntrypointPath() {
|
|
145
|
-
const cliEntrypoint = process.argv[1];
|
|
146
|
-
if (!cliEntrypoint) {
|
|
147
|
-
throw new Error("Unable to resolve CLI entrypoint path for skills installer.");
|
|
148
|
-
}
|
|
149
|
-
return (0, import_node_fs.realpathSync)(cliEntrypoint);
|
|
150
|
-
}
|
|
151
|
-
function resolvePackageRoot() {
|
|
152
|
-
const cliEntrypointPath = resolveCliEntrypointPath();
|
|
153
|
-
const binDir = (0, import_node_path.dirname)(cliEntrypointPath);
|
|
154
|
-
return (0, import_node_path.resolve)(binDir, "..");
|
|
155
|
-
}
|
|
156
|
-
function createSkillsInstallInvocation(args) {
|
|
157
|
-
return {
|
|
158
|
-
cliPath: args.skillsCliPath,
|
|
159
|
-
cliArgs: [
|
|
160
|
-
"add",
|
|
161
|
-
args.localSkillSourcePath,
|
|
162
|
-
"--skill",
|
|
163
|
-
"opensteer",
|
|
164
|
-
...args.passthroughArgs
|
|
165
|
-
]
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
async function spawnInvocation(invocation) {
|
|
169
|
-
return await new Promise((resolvePromise, rejectPromise) => {
|
|
170
|
-
const child = (0, import_node_child_process.spawn)(process.execPath, [invocation.cliPath, ...invocation.cliArgs], {
|
|
171
|
-
stdio: "inherit",
|
|
172
|
-
env: process.env,
|
|
173
|
-
cwd: process.cwd()
|
|
174
|
-
});
|
|
175
|
-
child.once("error", (error) => {
|
|
176
|
-
rejectPromise(error);
|
|
177
|
-
});
|
|
178
|
-
child.once("exit", (code) => {
|
|
179
|
-
if (typeof code === "number") {
|
|
180
|
-
resolvePromise(code);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
resolvePromise(1);
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
function createDefaultDeps() {
|
|
188
|
-
return {
|
|
189
|
-
resolveSkillsCliPath,
|
|
190
|
-
resolveLocalSkillSourcePath,
|
|
191
|
-
spawnInvocation,
|
|
192
|
-
writeStdout(message) {
|
|
193
|
-
process.stdout.write(message);
|
|
194
|
-
},
|
|
195
|
-
writeStderr(message) {
|
|
196
|
-
process.stderr.write(message);
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
async function runOpensteerSkillsInstaller(rawArgs, overrideDeps = {}) {
|
|
201
|
-
const deps = {
|
|
202
|
-
...createDefaultDeps(),
|
|
203
|
-
...overrideDeps
|
|
204
|
-
};
|
|
205
|
-
const parsed = parseOpensteerSkillsArgs(rawArgs);
|
|
206
|
-
if (parsed.mode === "help") {
|
|
207
|
-
deps.writeStdout(HELP_TEXT);
|
|
208
|
-
return 0;
|
|
209
|
-
}
|
|
210
|
-
if (parsed.mode === "error") {
|
|
211
|
-
deps.writeStderr(`${parsed.error}
|
|
212
|
-
`);
|
|
213
|
-
deps.writeStderr('Run "opensteer skills --help" for usage.\n');
|
|
214
|
-
return 1;
|
|
215
|
-
}
|
|
216
|
-
const invocation = createSkillsInstallInvocation({
|
|
217
|
-
localSkillSourcePath: deps.resolveLocalSkillSourcePath(),
|
|
218
|
-
passthroughArgs: parsed.passthroughArgs,
|
|
219
|
-
skillsCliPath: deps.resolveSkillsCliPath()
|
|
220
|
-
});
|
|
221
|
-
return await deps.spawnInvocation(invocation);
|
|
222
|
-
}
|
|
223
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
224
|
-
0 && (module.exports = {
|
|
225
|
-
createSkillsInstallInvocation,
|
|
226
|
-
parseOpensteerSkillsArgs,
|
|
227
|
-
resolveLocalSkillSourcePath,
|
|
228
|
-
resolveSkillsCliPath,
|
|
229
|
-
runOpensteerSkillsInstaller
|
|
230
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
type ParseMode = 'help' | 'install' | 'error';
|
|
2
|
-
interface ParsedSkillsArgs {
|
|
3
|
-
mode: ParseMode;
|
|
4
|
-
passthroughArgs: string[];
|
|
5
|
-
error?: string;
|
|
6
|
-
}
|
|
7
|
-
interface SkillsInstallInvocation {
|
|
8
|
-
cliPath: string;
|
|
9
|
-
cliArgs: string[];
|
|
10
|
-
}
|
|
11
|
-
interface SkillsInstallerDeps {
|
|
12
|
-
resolveSkillsCliPath: () => string;
|
|
13
|
-
resolveLocalSkillSourcePath: () => string;
|
|
14
|
-
spawnInvocation: (invocation: SkillsInstallInvocation) => Promise<number>;
|
|
15
|
-
writeStdout: (message: string) => void;
|
|
16
|
-
writeStderr: (message: string) => void;
|
|
17
|
-
}
|
|
18
|
-
declare function parseOpensteerSkillsArgs(rawArgs: string[]): ParsedSkillsArgs;
|
|
19
|
-
declare function resolveLocalSkillSourcePath(): string;
|
|
20
|
-
declare function resolveSkillsCliPath(): string;
|
|
21
|
-
declare function createSkillsInstallInvocation(args: {
|
|
22
|
-
localSkillSourcePath: string;
|
|
23
|
-
passthroughArgs: string[];
|
|
24
|
-
skillsCliPath: string;
|
|
25
|
-
}): SkillsInstallInvocation;
|
|
26
|
-
declare function runOpensteerSkillsInstaller(rawArgs: string[], overrideDeps?: Partial<SkillsInstallerDeps>): Promise<number>;
|
|
27
|
-
|
|
28
|
-
export { createSkillsInstallInvocation, parseOpensteerSkillsArgs, resolveLocalSkillSourcePath, resolveSkillsCliPath, runOpensteerSkillsInstaller };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
type ParseMode = 'help' | 'install' | 'error';
|
|
2
|
-
interface ParsedSkillsArgs {
|
|
3
|
-
mode: ParseMode;
|
|
4
|
-
passthroughArgs: string[];
|
|
5
|
-
error?: string;
|
|
6
|
-
}
|
|
7
|
-
interface SkillsInstallInvocation {
|
|
8
|
-
cliPath: string;
|
|
9
|
-
cliArgs: string[];
|
|
10
|
-
}
|
|
11
|
-
interface SkillsInstallerDeps {
|
|
12
|
-
resolveSkillsCliPath: () => string;
|
|
13
|
-
resolveLocalSkillSourcePath: () => string;
|
|
14
|
-
spawnInvocation: (invocation: SkillsInstallInvocation) => Promise<number>;
|
|
15
|
-
writeStdout: (message: string) => void;
|
|
16
|
-
writeStderr: (message: string) => void;
|
|
17
|
-
}
|
|
18
|
-
declare function parseOpensteerSkillsArgs(rawArgs: string[]): ParsedSkillsArgs;
|
|
19
|
-
declare function resolveLocalSkillSourcePath(): string;
|
|
20
|
-
declare function resolveSkillsCliPath(): string;
|
|
21
|
-
declare function createSkillsInstallInvocation(args: {
|
|
22
|
-
localSkillSourcePath: string;
|
|
23
|
-
passthroughArgs: string[];
|
|
24
|
-
skillsCliPath: string;
|
|
25
|
-
}): SkillsInstallInvocation;
|
|
26
|
-
declare function runOpensteerSkillsInstaller(rawArgs: string[], overrideDeps?: Partial<SkillsInstallerDeps>): Promise<number>;
|
|
27
|
-
|
|
28
|
-
export { createSkillsInstallInvocation, parseOpensteerSkillsArgs, resolveLocalSkillSourcePath, resolveSkillsCliPath, runOpensteerSkillsInstaller };
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
// src/cli/skills-installer.ts
|
|
2
|
-
import { spawn } from "child_process";
|
|
3
|
-
import { createRequire } from "module";
|
|
4
|
-
import { existsSync, realpathSync } from "fs";
|
|
5
|
-
import { dirname, join, resolve } from "path";
|
|
6
|
-
var HELP_TEXT = `Usage: opensteer skills <install|add> [options]
|
|
7
|
-
|
|
8
|
-
Installs the first-party Opensteer skill using the upstream "skills" CLI.
|
|
9
|
-
|
|
10
|
-
Commands:
|
|
11
|
-
install Install the opensteer skill
|
|
12
|
-
add Alias for install
|
|
13
|
-
|
|
14
|
-
Supported Options:
|
|
15
|
-
-a, --agent <agents...> Target specific agent(s)
|
|
16
|
-
-g, --global Install globally
|
|
17
|
-
-y, --yes Skip confirmations
|
|
18
|
-
--copy Copy files instead of symlinking
|
|
19
|
-
--all Install to all agents
|
|
20
|
-
-h, --help Show this help
|
|
21
|
-
|
|
22
|
-
Examples:
|
|
23
|
-
opensteer skills install
|
|
24
|
-
opensteer skills add --agent codex --global --yes
|
|
25
|
-
opensteer skills install --all --yes
|
|
26
|
-
`;
|
|
27
|
-
function parseOpensteerSkillsArgs(rawArgs) {
|
|
28
|
-
if (rawArgs.length === 0) {
|
|
29
|
-
return { mode: "help", passthroughArgs: [] };
|
|
30
|
-
}
|
|
31
|
-
const [subcommand, ...rest] = rawArgs;
|
|
32
|
-
if (subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
|
|
33
|
-
return { mode: "help", passthroughArgs: [] };
|
|
34
|
-
}
|
|
35
|
-
if (subcommand !== "install" && subcommand !== "add") {
|
|
36
|
-
return {
|
|
37
|
-
mode: "error",
|
|
38
|
-
passthroughArgs: [],
|
|
39
|
-
error: `Unsupported skills subcommand "${subcommand}". Use "install" or "add".`
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const passthroughArgs = [];
|
|
43
|
-
for (let i = 0; i < rest.length; i += 1) {
|
|
44
|
-
const arg = rest[i];
|
|
45
|
-
if (arg === "--help" || arg === "-h") {
|
|
46
|
-
return { mode: "help", passthroughArgs: [] };
|
|
47
|
-
}
|
|
48
|
-
if (arg === "--global" || arg === "-g") {
|
|
49
|
-
passthroughArgs.push(arg);
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if (arg === "--yes" || arg === "-y") {
|
|
53
|
-
passthroughArgs.push(arg);
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (arg === "--copy" || arg === "--all") {
|
|
57
|
-
passthroughArgs.push(arg);
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (arg === "--agent" || arg === "-a") {
|
|
61
|
-
passthroughArgs.push(arg);
|
|
62
|
-
if (i + 1 >= rest.length || rest[i + 1]?.startsWith("-")) {
|
|
63
|
-
return {
|
|
64
|
-
mode: "error",
|
|
65
|
-
passthroughArgs: [],
|
|
66
|
-
error: `${arg} requires at least one value.`
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
while (i + 1 < rest.length && !rest[i + 1]?.startsWith("-")) {
|
|
70
|
-
i += 1;
|
|
71
|
-
const agent = rest[i];
|
|
72
|
-
if (agent) {
|
|
73
|
-
passthroughArgs.push(agent);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (arg.startsWith("-")) {
|
|
79
|
-
return {
|
|
80
|
-
mode: "error",
|
|
81
|
-
passthroughArgs: [],
|
|
82
|
-
error: `Unsupported option "${arg}" for "opensteer skills".`
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
mode: "error",
|
|
87
|
-
passthroughArgs: [],
|
|
88
|
-
error: `Unexpected argument "${arg}".`
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
mode: "install",
|
|
93
|
-
passthroughArgs
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function resolveLocalSkillSourcePath() {
|
|
97
|
-
const packageRoot = resolvePackageRoot();
|
|
98
|
-
const sourcePath = join(packageRoot, "skills");
|
|
99
|
-
if (!existsSync(sourcePath)) {
|
|
100
|
-
throw new Error(
|
|
101
|
-
`Opensteer skill source was not found at "${sourcePath}".`
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
return sourcePath;
|
|
105
|
-
}
|
|
106
|
-
function resolveSkillsCliPath() {
|
|
107
|
-
const require2 = createRequire(resolveCliEntrypointPath());
|
|
108
|
-
const skillsPackagePath = require2.resolve("skills/package.json");
|
|
109
|
-
const skillsPackageDir = dirname(skillsPackagePath);
|
|
110
|
-
const cliPath = join(skillsPackageDir, "bin", "cli.mjs");
|
|
111
|
-
if (!existsSync(cliPath)) {
|
|
112
|
-
throw new Error(`skills CLI entrypoint was not found at "${cliPath}".`);
|
|
113
|
-
}
|
|
114
|
-
return cliPath;
|
|
115
|
-
}
|
|
116
|
-
function resolveCliEntrypointPath() {
|
|
117
|
-
const cliEntrypoint = process.argv[1];
|
|
118
|
-
if (!cliEntrypoint) {
|
|
119
|
-
throw new Error("Unable to resolve CLI entrypoint path for skills installer.");
|
|
120
|
-
}
|
|
121
|
-
return realpathSync(cliEntrypoint);
|
|
122
|
-
}
|
|
123
|
-
function resolvePackageRoot() {
|
|
124
|
-
const cliEntrypointPath = resolveCliEntrypointPath();
|
|
125
|
-
const binDir = dirname(cliEntrypointPath);
|
|
126
|
-
return resolve(binDir, "..");
|
|
127
|
-
}
|
|
128
|
-
function createSkillsInstallInvocation(args) {
|
|
129
|
-
return {
|
|
130
|
-
cliPath: args.skillsCliPath,
|
|
131
|
-
cliArgs: [
|
|
132
|
-
"add",
|
|
133
|
-
args.localSkillSourcePath,
|
|
134
|
-
"--skill",
|
|
135
|
-
"opensteer",
|
|
136
|
-
...args.passthroughArgs
|
|
137
|
-
]
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
async function spawnInvocation(invocation) {
|
|
141
|
-
return await new Promise((resolvePromise, rejectPromise) => {
|
|
142
|
-
const child = spawn(process.execPath, [invocation.cliPath, ...invocation.cliArgs], {
|
|
143
|
-
stdio: "inherit",
|
|
144
|
-
env: process.env,
|
|
145
|
-
cwd: process.cwd()
|
|
146
|
-
});
|
|
147
|
-
child.once("error", (error) => {
|
|
148
|
-
rejectPromise(error);
|
|
149
|
-
});
|
|
150
|
-
child.once("exit", (code) => {
|
|
151
|
-
if (typeof code === "number") {
|
|
152
|
-
resolvePromise(code);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
resolvePromise(1);
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
function createDefaultDeps() {
|
|
160
|
-
return {
|
|
161
|
-
resolveSkillsCliPath,
|
|
162
|
-
resolveLocalSkillSourcePath,
|
|
163
|
-
spawnInvocation,
|
|
164
|
-
writeStdout(message) {
|
|
165
|
-
process.stdout.write(message);
|
|
166
|
-
},
|
|
167
|
-
writeStderr(message) {
|
|
168
|
-
process.stderr.write(message);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
async function runOpensteerSkillsInstaller(rawArgs, overrideDeps = {}) {
|
|
173
|
-
const deps = {
|
|
174
|
-
...createDefaultDeps(),
|
|
175
|
-
...overrideDeps
|
|
176
|
-
};
|
|
177
|
-
const parsed = parseOpensteerSkillsArgs(rawArgs);
|
|
178
|
-
if (parsed.mode === "help") {
|
|
179
|
-
deps.writeStdout(HELP_TEXT);
|
|
180
|
-
return 0;
|
|
181
|
-
}
|
|
182
|
-
if (parsed.mode === "error") {
|
|
183
|
-
deps.writeStderr(`${parsed.error}
|
|
184
|
-
`);
|
|
185
|
-
deps.writeStderr('Run "opensteer skills --help" for usage.\n');
|
|
186
|
-
return 1;
|
|
187
|
-
}
|
|
188
|
-
const invocation = createSkillsInstallInvocation({
|
|
189
|
-
localSkillSourcePath: deps.resolveLocalSkillSourcePath(),
|
|
190
|
-
passthroughArgs: parsed.passthroughArgs,
|
|
191
|
-
skillsCliPath: deps.resolveSkillsCliPath()
|
|
192
|
-
});
|
|
193
|
-
return await deps.spawnInvocation(invocation);
|
|
194
|
-
}
|
|
195
|
-
export {
|
|
196
|
-
createSkillsInstallInvocation,
|
|
197
|
-
parseOpensteerSkillsArgs,
|
|
198
|
-
resolveLocalSkillSourcePath,
|
|
199
|
-
resolveSkillsCliPath,
|
|
200
|
-
runOpensteerSkillsInstaller
|
|
201
|
-
};
|