lazy-skill 0.1.1 → 0.1.2
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.
|
@@ -75,6 +75,25 @@ export function createInstallPlan(input) {
|
|
|
75
75
|
const scope = input.scope === "project" ? "project" : "global";
|
|
76
76
|
return { skillRef: input.skillRef, agents, scope };
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Splits a registry id into the package and skill the installer expects.
|
|
80
|
+
*
|
|
81
|
+
* A registry id is `{source}/{slug}`, and for GitHub sources the source is
|
|
82
|
+
* itself `owner/repo` — so `skills-101/superpowers/ai-video-generation` means
|
|
83
|
+
* the repo `skills-101/superpowers` and the single skill
|
|
84
|
+
* `ai-video-generation`. Passing the whole id as the package makes the
|
|
85
|
+
* installer look for a repository that does not exist, and it reports
|
|
86
|
+
* "No valid skills found" rather than failing loudly.
|
|
87
|
+
*
|
|
88
|
+
* A two-segment id is a whole repository, so every skill in it is installed.
|
|
89
|
+
*/
|
|
90
|
+
export function splitSkillRef(skillRef) {
|
|
91
|
+
const parts = skillRef.split("/");
|
|
92
|
+
if (parts.length >= 3) {
|
|
93
|
+
return { pkg: parts.slice(0, 2).join("/"), skill: parts.slice(2).join("/") };
|
|
94
|
+
}
|
|
95
|
+
return { pkg: skillRef, skill: "*" };
|
|
96
|
+
}
|
|
78
97
|
/**
|
|
79
98
|
* The exact argv passed to the installer.
|
|
80
99
|
*
|
|
@@ -84,6 +103,7 @@ export function createInstallPlan(input) {
|
|
|
84
103
|
* flag even if the pattern above is ever loosened.
|
|
85
104
|
*/
|
|
86
105
|
export function buildInstallArgs(plan) {
|
|
106
|
+
const { pkg, skill } = splitSkillRef(plan.skillRef);
|
|
87
107
|
const args = [
|
|
88
108
|
"--yes",
|
|
89
109
|
UPSTREAM_PACKAGE,
|
|
@@ -91,12 +111,12 @@ export function buildInstallArgs(plan) {
|
|
|
91
111
|
"--agent",
|
|
92
112
|
plan.agents.join(","),
|
|
93
113
|
"--skill",
|
|
94
|
-
|
|
114
|
+
skill,
|
|
95
115
|
"--yes",
|
|
96
116
|
];
|
|
97
117
|
if (plan.scope === "global")
|
|
98
118
|
args.push("--global");
|
|
99
|
-
args.push("--",
|
|
119
|
+
args.push("--", pkg);
|
|
100
120
|
return args;
|
|
101
121
|
}
|
|
102
122
|
/** What the user is shown before anything runs (§23). */
|