@runuai/host 0.9.134 → 0.9.135
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/lib/skills.ts +24 -7
- package/package.json +1 -1
package/lib/skills.ts
CHANGED
|
@@ -220,15 +220,32 @@ export function nonInteractiveInstallCommand(command: string): string {
|
|
|
220
220
|
const found = add.exec(command);
|
|
221
221
|
if (!found) return command;
|
|
222
222
|
// Only the flags AFTER the subcommand count: `npx -y skills add …` is npx's
|
|
223
|
-
// own -y, not the CLI's.
|
|
224
|
-
|
|
223
|
+
// own -y, not the CLI's. And the CLI wants its options AFTER the source —
|
|
224
|
+
// put before it, the parser reports "Missing required argument: source"
|
|
225
|
+
// (live 2026-09-10, smoke 14) — so the flags go right after the source
|
|
226
|
+
// token: the first token past `add` that is not an option or an option's
|
|
227
|
+
// value, stopping at a shell operator.
|
|
228
|
+
const afterAdd = found.index + found[0].length;
|
|
229
|
+
const rest = command.slice(afterAdd);
|
|
230
|
+
const tail = rest.split(/(?=\s(?:&&|\|\||[|;]))/)[0] ?? rest;
|
|
225
231
|
const flags: string[] = [];
|
|
226
|
-
if (!/(^|\s)(-y|--yes)(\s|$)/.test(
|
|
227
|
-
if (!/(^|\s)(-a|--agent)(\s|=)/.test(
|
|
232
|
+
if (!/(^|\s)(-y|--yes)(\s|$)/.test(tail)) flags.push("-y");
|
|
233
|
+
if (!/(^|\s)(-a|--agent)(\s|=)/.test(tail)) flags.push("--agent claude-code");
|
|
228
234
|
if (flags.length === 0) return command;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
235
|
+
const valued = /^(-a|--agent|-s|--skill)$/;
|
|
236
|
+
const tokens = [...tail.matchAll(/\S+/g)];
|
|
237
|
+
let sourceEnd = -1;
|
|
238
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
239
|
+
const token = tokens[i]![0];
|
|
240
|
+
if (token.startsWith("-")) {
|
|
241
|
+
if (valued.test(token)) i += 1; // skip the option's value
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
sourceEnd = tokens[i]!.index! + token.length;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
const at = sourceEnd >= 0 ? afterAdd + sourceEnd : afterAdd + tail.length;
|
|
248
|
+
return `${command.slice(0, at)} ${flags.join(" ")}${command.slice(at)}`;
|
|
232
249
|
}
|
|
233
250
|
|
|
234
251
|
/**
|