Skip to content

Commit 6dd0ac2

Browse files
RhysSullivanclaude
andcommitted
Accept a pasted npx skills add command in the GitHub import
Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent 8f5ab4c commit 6dd0ac2

6 files changed

Lines changed: 126 additions & 249 deletions

File tree

‎apps/local/.preview/dev.log‎

Lines changed: 6 additions & 238 deletions
Original file line numberDiff line numberDiff line change
@@ -8,253 +8,21 @@ portless
88

99
-- Proxy is running
1010
-- executor-local-agent-skills.localhost (auto-resolves to 127.0.0.1)
11-
-- Using port 4055
11+
-- Using port 4877
1212

1313
-> https://executor-local-agent-skills.localhost:1355
1414

15-
Running: PORT=4055 HOST=127.0.0.1 PORTLESS_URL=https://executor-local-agent-skills.localhost:1355 bunx --bun vite dev --port 4055 --strictPort --host 127.0.0.1
15+
Running: PORT=4877 HOST=127.0.0.1 PORTLESS_URL=https://executor-local-agent-skills.localhost:1355 bunx --bun vite dev --port 4877 --strictPort --host 127.0.0.1
1616

1717

18-
Open with auth: http://127.0.0.1:4055/?_token=Jh2Z1knuzRaiXPgZsB2Isb8K2PirdRhqu141j1uyPr4
18+
Open with auth: http://127.0.0.1:4877/?_token=Jh2Z1knuzRaiXPgZsB2Isb8K2PirdRhqu141j1uyPr4
1919

2020

21-
VITE v8.0.8 ready in 1153 ms
21+
VITE v8.0.8 ready in 731 ms
2222

23-
➜ Local: http://127.0.0.1:4055/
24-
[22:50:58.954] INFO (#35) http.span.1=920ms: Sent HTTP response {
23+
➜ Local: http://127.0.0.1:4877/
24+
[23:00:44.885] INFO (#35) http.span.1=1242ms: Sent HTTP response {
2525
"http.method": "POST",
2626
"http.url": "/skills/import",
2727
"http.status": 200,
2828
}
29-
[22:51:04.791] INFO (#103) http.span.2=5792ms: Sent HTTP response {
30-
"http.method": "POST",
31-
"http.url": "/skills/import",
32-
"http.status": 200,
33-
}
34-
[22:51:04.855] INFO (#1311) http.span.3=1ms: Sent HTTP response {
35-
"http.method": "POST",
36-
"http.url": "/skills/import",
37-
"http.status": 400,
38-
}
39-
10:51:19 PM [vite] (client) [console.warn] [React Grab] v0.1.32 is outdated (latest: v0.2.0). Run `npx grab@latest upgrade` to upgrade.
40-
[22:51:19.655] INFO (#1315) http.span.4=1ms: Sent HTTP response {
41-
"http.method": "GET",
42-
"http.url": "/integrations",
43-
"http.status": 200,
44-
}
45-
[22:51:19.662] INFO (#1316) http.span.5=2ms: Sent HTTP response {
46-
"http.method": "GET",
47-
"http.url": "/skills",
48-
"http.status": 200,
49-
}
50-
[22:51:19.667] INFO (#1318) http.span.7=4ms: Sent HTTP response {
51-
"http.method": "GET",
52-
"http.url": "/tools",
53-
"http.status": 200,
54-
}
55-
[22:51:19.792] INFO (#1317) http.span.6=130ms: Sent HTTP response {
56-
"http.method": "GET",
57-
"http.url": "/v1/app/npm/dist-tags",
58-
"http.status": 200,
59-
}
60-
[22:51:21.846] INFO (#1322) http.span.8=1ms: HttpServerError: RouteNotFound (GET /account/members) {
61-
"http.method": "GET",
62-
"http.url": "/account/members",
63-
"http.status": 404,
64-
}
65-
10:51:21 PM [vite] (client) [Unhandled error] FrontendHandledError: api_client/decode_or_transport: Decode error (404 GET http://127.0.0.1:4055/api/account/members)
66-
> reportViaGlobalErrorEvent ../react/src/api/error-reporting.tsx:136:4
67-
134 | const reportable = toReportableError(error, context);
68-
135 | globalThis.reportError(
69-
136 | new FrontendHandledError({
70-
| ^
71-
137 | message: `${contextLabel(context)}: ${reportable.message}`,
72-
138 | cause: reportable,
73-
> reportRendererHandledError src/crash-reporting.ts:44:53
74-
> ../react/src/api/error-reporting.tsx:120:4
75-
> reportHandledFrontendError ../react/src/api/error-reporting.tsx:180:2
76-
> Object.~effect/Effect/args ../react/src/api/client.tsx:30:4
77-
> ~effect/Effect/evaluate ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:625:23
78-
> FiberImpl.runLoop ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:444:107
79-
> FiberImpl.evaluate ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:412:22
80-
> ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:719:14
81-
> ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:695:46
82-
83-
[22:51:22.182] INFO (#1323) http.span.9=277ms: Sent HTTP response {
84-
"http.method": "POST",
85-
"http.url": "/skills/import",
86-
"http.status": 200,
87-
}
88-
10:51:57 PM [vite] (client) [console.warn] [React Grab] v0.1.32 is outdated (latest: v0.2.0). Run `npx grab@latest upgrade` to upgrade.
89-
[22:51:57.959] INFO (#2531) http.span.10=1ms: Sent HTTP response {
90-
"http.method": "GET",
91-
"http.url": "/integrations",
92-
"http.status": 200,
93-
}
94-
[22:51:57.965] INFO (#2532) http.span.11=1ms: Sent HTTP response {
95-
"http.method": "GET",
96-
"http.url": "/skills",
97-
"http.status": 200,
98-
}
99-
[22:51:57.965] INFO (#2533) http.span.12=0ms: Sent HTTP response {
100-
"http.method": "GET",
101-
"http.url": "/v1/app/npm/dist-tags",
102-
"http.status": 200,
103-
}
104-
[22:51:57.969] INFO (#2534) http.span.13=3ms: Sent HTTP response {
105-
"http.method": "GET",
106-
"http.url": "/tools",
107-
"http.status": 200,
108-
}
109-
[22:52:00.040] INFO (#2538) http.span.14=0ms: HttpServerError: RouteNotFound (GET /account/members) {
110-
"http.method": "GET",
111-
"http.url": "/account/members",
112-
"http.status": 404,
113-
}
114-
10:52:00 PM [vite] (client) [Unhandled error] FrontendHandledError: api_client/decode_or_transport: Decode error (404 GET http://127.0.0.1:4055/api/account/members)
115-
> reportViaGlobalErrorEvent ../react/src/api/error-reporting.tsx:136:4
116-
134 | const reportable = toReportableError(error, context);
117-
135 | globalThis.reportError(
118-
136 | new FrontendHandledError({
119-
| ^
120-
137 | message: `${contextLabel(context)}: ${reportable.message}`,
121-
138 | cause: reportable,
122-
> reportRendererHandledError src/crash-reporting.ts:44:53
123-
> ../react/src/api/error-reporting.tsx:120:4
124-
> reportHandledFrontendError ../react/src/api/error-reporting.tsx:180:2
125-
> Object.~effect/Effect/args ../react/src/api/client.tsx:30:4
126-
> ~effect/Effect/evaluate ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:625:23
127-
> FiberImpl.runLoop ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:444:107
128-
> FiberImpl.evaluate ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:412:22
129-
> ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:719:14
130-
> ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:695:46
131-
132-
[22:52:00.764] INFO (#2539) http.span.15=678ms: Sent HTTP response {
133-
"http.method": "POST",
134-
"http.url": "/skills/import",
135-
"http.status": 200,
136-
}
137-
10:52:39 PM [vite] (client) [console.warn] [React Grab] v0.1.32 is outdated (latest: v0.2.0). Run `npx grab@latest upgrade` to upgrade.
138-
[22:52:39.023] INFO (#3747) http.span.16=1ms: Sent HTTP response {
139-
"http.method": "GET",
140-
"http.url": "/integrations",
141-
"http.status": 200,
142-
}
143-
[22:52:39.029] INFO (#3748) http.span.17=1ms: Sent HTTP response {
144-
"http.method": "GET",
145-
"http.url": "/skills",
146-
"http.status": 200,
147-
}
148-
[22:52:39.031] INFO (#3749) http.span.18=0ms: Sent HTTP response {
149-
"http.method": "GET",
150-
"http.url": "/v1/app/npm/dist-tags",
151-
"http.status": 200,
152-
}
153-
[22:52:39.034] INFO (#3750) http.span.19=3ms: Sent HTTP response {
154-
"http.method": "GET",
155-
"http.url": "/tools",
156-
"http.status": 200,
157-
}
158-
[22:52:41.132] INFO (#3754) http.span.20=0ms: HttpServerError: RouteNotFound (GET /account/members) {
159-
"http.method": "GET",
160-
"http.url": "/account/members",
161-
"http.status": 404,
162-
}
163-
10:52:41 PM [vite] (client) [Unhandled error] FrontendHandledError: api_client/decode_or_transport: Decode error (404 GET http://127.0.0.1:4055/api/account/members)
164-
> reportViaGlobalErrorEvent ../react/src/api/error-reporting.tsx:136:4
165-
134 | const reportable = toReportableError(error, context);
166-
135 | globalThis.reportError(
167-
136 | new FrontendHandledError({
168-
| ^
169-
137 | message: `${contextLabel(context)}: ${reportable.message}`,
170-
138 | cause: reportable,
171-
> reportRendererHandledError src/crash-reporting.ts:44:53
172-
> ../react/src/api/error-reporting.tsx:120:4
173-
> reportHandledFrontendError ../react/src/api/error-reporting.tsx:180:2
174-
> Object.~effect/Effect/args ../react/src/api/client.tsx:30:4
175-
> ~effect/Effect/evaluate ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:625:23
176-
> FiberImpl.runLoop ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:444:107
177-
> FiberImpl.evaluate ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:412:22
178-
> ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:719:14
179-
> ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:695:46
180-
181-
[22:52:41.861] INFO (#3755) http.span.21=678ms: Sent HTTP response {
182-
"http.method": "POST",
183-
"http.url": "/skills/import",
184-
"http.status": 200,
185-
}
186-
10:53:36 PM [vite] (client) hmr update /@fs/Users/rhyssullivan/agent-workspace/usefulsoftwareco/.rifts/executor/agent-skills/packages/react/src/styles/globals.css, /@fs/Users/rhyssullivan/agent-workspace/usefulsoftwareco/.rifts/executor/agent-skills/packages/react/src/pages/skill-import-dialog.tsx
187-
10:53:40 PM [vite] (client) [console.warn] [React Grab] v0.1.32 is outdated (latest: v0.2.0). Run `npx grab@latest upgrade` to upgrade.
188-
[22:53:40.063] INFO (#4963) http.span.22=0ms: Sent HTTP response {
189-
"http.method": "GET",
190-
"http.url": "/integrations",
191-
"http.status": 200,
192-
}
193-
[22:53:40.069] INFO (#4964) http.span.23=1ms: Sent HTTP response {
194-
"http.method": "GET",
195-
"http.url": "/skills",
196-
"http.status": 200,
197-
}
198-
[22:53:40.070] INFO (#4965) http.span.24=0ms: Sent HTTP response {
199-
"http.method": "GET",
200-
"http.url": "/v1/app/npm/dist-tags",
201-
"http.status": 200,
202-
}
203-
[22:53:40.073] INFO (#4966) http.span.25=2ms: Sent HTTP response {
204-
"http.method": "GET",
205-
"http.url": "/tools",
206-
"http.status": 200,
207-
}
208-
[22:53:42.151] INFO (#4970) http.span.26=0ms: HttpServerError: RouteNotFound (GET /account/members) {
209-
"http.method": "GET",
210-
"http.url": "/account/members",
211-
"http.status": 404,
212-
}
213-
10:53:42 PM [vite] (client) [Unhandled error] FrontendHandledError: api_client/decode_or_transport: Decode error (404 GET http://127.0.0.1:4055/api/account/members)
214-
> reportViaGlobalErrorEvent ../react/src/api/error-reporting.tsx:136:4
215-
134 | const reportable = toReportableError(error, context);
216-
135 | globalThis.reportError(
217-
136 | new FrontendHandledError({
218-
| ^
219-
137 | message: `${contextLabel(context)}: ${reportable.message}`,
220-
138 | cause: reportable,
221-
> reportRendererHandledError src/crash-reporting.ts:44:53
222-
> ../react/src/api/error-reporting.tsx:120:4
223-
> reportHandledFrontendError ../react/src/api/error-reporting.tsx:180:2
224-
> Object.~effect/Effect/args ../react/src/api/client.tsx:30:4
225-
> ~effect/Effect/evaluate ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:625:23
226-
> FiberImpl.runLoop ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:444:107
227-
> FiberImpl.evaluate ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:412:22
228-
> ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:719:14
229-
> ../../node_modules/.bun/[email protected]/node_modules/effect/dist/internal/effect.js:695:46
230-
231-
[22:53:42.946] INFO (#4971) http.span.27=740ms: Sent HTTP response {
232-
"http.method": "POST",
233-
"http.url": "/skills/import",
234-
"http.status": 200,
235-
}
236-
[22:53:44.012] INFO (#6179) http.span.28=8ms: Sent HTTP response {
237-
"http.method": "PUT",
238-
"http.url": "/skills",
239-
"http.status": 200,
240-
}
241-
[22:53:44.014] INFO (#6181) http.span.29=1ms: Sent HTTP response {
242-
"http.method": "GET",
243-
"http.url": "/skills",
244-
"http.status": 200,
245-
}
246-
[22:53:44.018] INFO (#6182) http.span.30=2ms: Sent HTTP response {
247-
"http.method": "PUT",
248-
"http.url": "/skills",
249-
"http.status": 200,
250-
}
251-
[22:53:44.020] INFO (#6184) http.span.31=0ms: Sent HTTP response {
252-
"http.method": "GET",
253-
"http.url": "/skills",
254-
"http.status": 200,
255-
}
256-
[22:53:44.022] INFO (#6185) http.span.32=0ms: Sent HTTP response {
257-
"http.method": "GET",
258-
"http.url": "/skills",
259-
"http.status": 200,
260-
}

‎packages/core/api/src/skills/github-import.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,22 @@ describe("importSkillsFromGitHub", () => {
118118
expect(result.success.rejected.map((r) => r.directory)).toEqual(["skills/broken"]);
119119
});
120120

121+
it("narrows to the names a pasted `--skill` flag asked for", async () => {
122+
const files = {
123+
"skills/pdf/SKILL.md": valid,
124+
"skills/csv/SKILL.md": valid.replace("name: pdf", "name: csv"),
125+
};
126+
const result = await run(files, "npx skills add acme/skills --skill csv");
127+
expect(Result.isSuccess(result)).toBe(true);
128+
if (Result.isFailure(result)) return;
129+
expect(result.success.skills.map((s) => s.name)).toEqual(["csv"]);
130+
131+
const missing = await run(files, "npx skills add acme/skills --skill nope");
132+
expect(Result.isFailure(missing)).toBe(true);
133+
if (Result.isSuccess(missing)) return;
134+
expect(missing.failure.reason).toContain("No skill named `nope`");
135+
});
136+
121137
it("fails with a reason when the repo has no skills", async () => {
122138
const result = await run({ "README.md": "# repo" }, "acme/skills");
123139
expect(Result.isFailure(result)).toBe(true);

‎packages/core/api/src/skills/github-import.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,26 @@ export const importSkillsFromGitHub = (
290290
});
291291

292292
const outcomes = yield* Effect.forEach(chosen, readSkill, { concurrency: 3 });
293+
// `--skill x` names the skills wanted; the rest are read but not offered.
294+
// Matching is by frontmatter name, then by directory basename, so a name
295+
// that only exists on disk still resolves.
296+
const wanted = new Set(source.skills);
297+
const isWanted = (outcome: { readonly directory: string; readonly name?: string }) =>
298+
wanted.size === 0 ||
299+
(outcome.name !== undefined && wanted.has(outcome.name)) ||
300+
wanted.has(outcome.directory.slice(outcome.directory.lastIndexOf("/") + 1));
293301
const skills: GitHubSkillCandidate[] = [];
294302
const rejected: { directory: string; reason: string }[] = [];
295303
for (const outcome of outcomes) {
304+
if (!isWanted(outcome)) continue;
296305
if ("reason" in outcome) rejected.push(outcome);
297306
else skills.push(outcome);
298307
}
308+
if (wanted.size > 0 && skills.length === 0 && rejected.length === 0) {
309+
return yield* fail(
310+
`No skill named ${[...wanted].map((name) => `\`${name}\``).join(", ")} in ${label}.`,
311+
);
312+
}
299313
return { source: label, ref, skills, rejected, truncated };
300314
}).pipe(Effect.withSpan("skills.import.github"));
301315

@@ -306,7 +320,7 @@ export const parsedSourceOrError = (
306320
Option.match(parsed, {
307321
onNone: () =>
308322
fail(
309-
"Enter a GitHub repository (owner/repo), a path inside one, a github.com URL, or a skills.sh link.",
323+
"Enter a GitHub repository (owner/repo), a path inside one, a github.com URL, a skills.sh link, or an `npx skills add …` command.",
310324
),
311325
onSome: Effect.succeed,
312326
});

‎packages/core/sdk/src/skill-source.test.ts‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ const parse = (input: string) => Option.getOrNull(parseGitHubSkillSource(input))
77

88
describe("parseGitHubSkillSource", () => {
99
it.each([
10+
[
11+
"npx skills add https://github.com/kitlangton/skills --skill effect",
12+
{ owner: "kitlangton", repo: "skills", ref: null, path: "", skills: ["effect"] },
13+
],
14+
[
15+
"bunx skills add owner/repo -s a,b --skill=c",
16+
{ owner: "owner", repo: "repo", ref: null, path: "", skills: ["a", "b", "c"] },
17+
],
18+
[
19+
"gh skill install owner/repo/skills/pdf",
20+
{ owner: "owner", repo: "repo", ref: null, path: "skills/pdf", skills: [] },
21+
],
1022
["owner/repo", { owner: "owner", repo: "repo", ref: null, path: "" }],
1123
["owner/repo/skills/pdf", { owner: "owner", repo: "repo", ref: null, path: "skills/pdf" }],
1224
["github.com/owner/repo", { owner: "owner", repo: "repo", ref: null, path: "" }],
@@ -22,7 +34,7 @@ describe("parseGitHubSkillSource", () => {
2234
["https://skills.sh/owner/repo/pdf", { owner: "owner", repo: "repo", ref: null, path: "pdf" }],
2335
["https://www.github.com/owner/repo/", { owner: "owner", repo: "repo", ref: null, path: "" }],
2436
])("parses %s", (input, expected) => {
25-
expect(parse(input)).toEqual(expected);
37+
expect(parse(input)).toEqual({ skills: [], ...expected });
2638
});
2739

2840
it.each([
@@ -37,9 +49,11 @@ describe("parseGitHubSkillSource", () => {
3749
});
3850

3951
it("formats a source as owner/repo@ref/path", () => {
40-
expect(formatGitHubSkillSource({ owner: "o", repo: "r", ref: "main", path: "skills/x" })).toBe(
41-
"o/r@main/skills/x",
42-
);
43-
expect(formatGitHubSkillSource({ owner: "o", repo: "r", ref: null, path: "" })).toBe("o/r");
52+
expect(
53+
formatGitHubSkillSource({ owner: "o", repo: "r", ref: "main", path: "skills/x", skills: [] }),
54+
).toBe("o/r@main/skills/x");
55+
expect(
56+
formatGitHubSkillSource({ owner: "o", repo: "r", ref: null, path: "", skills: [] }),
57+
).toBe("o/r");
4458
});
4559
});

0 commit comments

Comments
 (0)