vskill 1.0.1 → 1.0.3
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/agents.json +1 -1
- package/dist/commands/plugin.d.ts +9 -0
- package/dist/commands/plugin.js +123 -0
- package/dist/commands/plugin.js.map +1 -0
- package/dist/core/plugin-validator.d.ts +17 -0
- package/dist/core/plugin-validator.js +45 -0
- package/dist/core/plugin-validator.js.map +1 -0
- package/dist/eval-server/authoring-routes.d.ts +4 -0
- package/dist/eval-server/authoring-routes.js +117 -7
- package/dist/eval-server/authoring-routes.js.map +1 -1
- package/dist/eval-ui/assets/{CreateSkillPage-DN-DGWb_.js → CreateSkillPage-B9MwTYPn.js} +1 -1
- package/dist/eval-ui/assets/{FindSkillsPalette-_QIpTcPE.js → FindSkillsPalette-DSW-Zyl_.js} +2 -2
- package/dist/eval-ui/assets/{SearchPaletteCore-CThylxw2.js → SearchPaletteCore-91Jq-ilw.js} +1 -1
- package/dist/eval-ui/assets/{SkillDetailPanel-CYt2aARB.js → SkillDetailPanel-CPhEDst2.js} +1 -1
- package/dist/eval-ui/assets/{UpdateDropdown-CO0ZyyC_.js → UpdateDropdown-OxJwLHid.js} +1 -1
- package/dist/eval-ui/assets/index-DnXSuywx.js +122 -0
- package/dist/eval-ui/index.html +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/eval-ui/assets/index-vzRnBcdU.js +0 -122
package/agents.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
interface PluginNewOpts {
|
|
3
|
+
description?: string;
|
|
4
|
+
withSkill?: string;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function pluginNewCommand(pluginName: string, opts: PluginNewOpts): Promise<void>;
|
|
8
|
+
export declare function registerPluginCommand(program: Command): void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// 0793 — `vskill plugin <subcommand>` family.
|
|
3
|
+
//
|
|
4
|
+
// Today: `new <name>` scaffolds a Claude Code plugin (`.claude-plugin/plugin.json`)
|
|
5
|
+
// with optional first skill (`--with-skill <slug>`). We delegate schema
|
|
6
|
+
// validation to `claude plugin validate <path>` so vskill never duplicates
|
|
7
|
+
// Claude Code's plugin schema. When `claude` is not on PATH, validation
|
|
8
|
+
// soft-skips with a warning so vskill stays usable in CI.
|
|
9
|
+
//
|
|
10
|
+
// This command exists because Claude Code's `claude plugin` CLI has no
|
|
11
|
+
// `new`/`create`/`init` subcommand — plugin authoring is otherwise unowned.
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
import { existsSync, mkdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
14
|
+
import { resolve, join } from "node:path";
|
|
15
|
+
import { pluginJsonScaffold, skillMdScaffold, validateKebabName, } from "../eval-server/authoring-routes.js";
|
|
16
|
+
import { validateClaudePlugin } from "../core/plugin-validator.js";
|
|
17
|
+
import { bold, cyan, dim, green, red, yellow } from "../utils/output.js";
|
|
18
|
+
function exit(code) {
|
|
19
|
+
process.exit(code);
|
|
20
|
+
// satisfies TS in tests where exit is spied
|
|
21
|
+
throw new Error("process.exit did not terminate");
|
|
22
|
+
}
|
|
23
|
+
export async function pluginNewCommand(pluginName, opts) {
|
|
24
|
+
const nameErr = validateKebabName(pluginName, "plugin name");
|
|
25
|
+
if (nameErr) {
|
|
26
|
+
console.error(red("Error: ") + dim(nameErr));
|
|
27
|
+
exit(1);
|
|
28
|
+
}
|
|
29
|
+
const cwd = opts.cwd ? resolve(opts.cwd) : process.cwd();
|
|
30
|
+
const pluginDir = join(cwd, pluginName);
|
|
31
|
+
const manifestDir = join(pluginDir, ".claude-plugin");
|
|
32
|
+
const manifestPath = join(manifestDir, "plugin.json");
|
|
33
|
+
if (existsSync(manifestPath)) {
|
|
34
|
+
console.error(red("Error: ") +
|
|
35
|
+
dim(`plugin manifest already exists: ${manifestPath}`));
|
|
36
|
+
console.error(dim(" Pick a different name or delete the existing manifest first."));
|
|
37
|
+
exit(1);
|
|
38
|
+
}
|
|
39
|
+
let withSkill = null;
|
|
40
|
+
if (opts.withSkill !== undefined) {
|
|
41
|
+
const skillErr = validateKebabName(opts.withSkill, "--with-skill");
|
|
42
|
+
if (skillErr) {
|
|
43
|
+
console.error(red("Error: ") + dim(skillErr));
|
|
44
|
+
exit(1);
|
|
45
|
+
}
|
|
46
|
+
withSkill = opts.withSkill;
|
|
47
|
+
const skillDir = join(pluginDir, "skills", withSkill);
|
|
48
|
+
if (existsSync(skillDir)) {
|
|
49
|
+
console.error(red("Error: ") +
|
|
50
|
+
dim(`skill directory already exists: ${skillDir}`));
|
|
51
|
+
exit(1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const description = (opts.description ?? "").trim() || `Plugin: ${pluginName}`;
|
|
55
|
+
// Write the manifest (and optional first skill) as an all-or-nothing block.
|
|
56
|
+
// If validation fails we roll back the manifest; we leave the (newly
|
|
57
|
+
// created) skill folder in place because deleting user-visible new files we
|
|
58
|
+
// just created is more surprising than leaving them.
|
|
59
|
+
try {
|
|
60
|
+
mkdirSync(manifestDir, { recursive: true });
|
|
61
|
+
writeFileSync(manifestPath, pluginJsonScaffold(pluginName, description), "utf8");
|
|
62
|
+
if (withSkill) {
|
|
63
|
+
const skillDir = join(pluginDir, "skills", withSkill);
|
|
64
|
+
mkdirSync(skillDir, { recursive: true });
|
|
65
|
+
writeFileSync(join(skillDir, "SKILL.md"), skillMdScaffold(withSkill, description), "utf8");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
70
|
+
console.error(red("Error: ") + dim(`failed to write plugin files: ${message}`));
|
|
71
|
+
exit(1);
|
|
72
|
+
}
|
|
73
|
+
// Schema validation via `claude plugin validate` — single source of truth
|
|
74
|
+
// for the plugin schema.
|
|
75
|
+
const validation = validateClaudePlugin(pluginDir);
|
|
76
|
+
if (!validation.ok) {
|
|
77
|
+
try {
|
|
78
|
+
unlinkSync(manifestPath);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
/* best-effort rollback */
|
|
82
|
+
}
|
|
83
|
+
console.error(red("Error: ") + dim("claude plugin validate rejected the generated manifest:"));
|
|
84
|
+
console.error(validation.stderr || "(no stderr captured)");
|
|
85
|
+
console.error(dim(" The manifest has been removed. Please file an issue if this is unexpected."));
|
|
86
|
+
exit(1);
|
|
87
|
+
}
|
|
88
|
+
if (validation.skipped) {
|
|
89
|
+
console.warn(yellow("Warning: ") +
|
|
90
|
+
dim("`claude` CLI not found on PATH; plugin schema was NOT validated."));
|
|
91
|
+
console.warn(dim(" Install Claude Code (https://claude.com/claude-code) to enable validation."));
|
|
92
|
+
}
|
|
93
|
+
// Success summary
|
|
94
|
+
console.log(green("✔ Plugin scaffolded"));
|
|
95
|
+
console.log(dim(" manifest: ") + manifestPath);
|
|
96
|
+
if (withSkill) {
|
|
97
|
+
console.log(dim(" skill: ") + join(pluginDir, "skills", withSkill, "SKILL.md"));
|
|
98
|
+
}
|
|
99
|
+
console.log("");
|
|
100
|
+
console.log(bold("Next steps:"));
|
|
101
|
+
console.log(" " + cyan(`cd ${pluginName}`));
|
|
102
|
+
if (!withSkill) {
|
|
103
|
+
console.log(" " +
|
|
104
|
+
cyan(`vskill skill new --prompt "..."`) +
|
|
105
|
+
dim(" # add your first skill"));
|
|
106
|
+
}
|
|
107
|
+
console.log(" " + cyan(`vskill studio`) + dim(" # open in Skill Studio"));
|
|
108
|
+
}
|
|
109
|
+
export function registerPluginCommand(program) {
|
|
110
|
+
const plugin = program
|
|
111
|
+
.command("plugin")
|
|
112
|
+
.description("Plugin authoring: scaffold a Claude Code plugin (.claude-plugin/plugin.json + skills/)");
|
|
113
|
+
plugin
|
|
114
|
+
.command("new <name>")
|
|
115
|
+
.description("Scaffold a new plugin folder with manifest and (optional) first skill")
|
|
116
|
+
.option("--description <text>", "Description written into plugin.json")
|
|
117
|
+
.option("--with-skill <slug>", "Also scaffold <name>/skills/<slug>/SKILL.md as the first skill")
|
|
118
|
+
.option("--cwd <path>", "Create the plugin under this directory (default: process.cwd())")
|
|
119
|
+
.action(async (name, opts) => {
|
|
120
|
+
await pluginNewCommand(name, opts);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/commands/plugin.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8CAA8C;AAC9C,EAAE;AACF,oFAAoF;AACpF,wEAAwE;AACxE,2EAA2E;AAC3E,wEAAwE;AACxE,0DAA0D;AAC1D,EAAE;AACF,uEAAuE;AACvE,4EAA4E;AAC5E,8EAA8E;AAE9E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAQzE,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,4CAA4C;IAC5C,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,UAAkB,EAClB,IAAmB;IAEnB,MAAM,OAAO,GAAG,iBAAiB,CAAC,UAAU,EAAE,aAA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AAO,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,UAAU,EAAE,CAAC,CAAC,CAAC;IAC7C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CACT,IAAI;YACF,IAAI,CAAC,iCAAiC,CAAC;YACvC,GAAG,CAAC,0BAA0B,CAAC,CAClC,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC,0BAA0B,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,MAAM,MAAM,GAAG,OAAO;SACnB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CACV,wFAAwF,CACzF,CAAC;IAEJ,MAAM;SACH,OAAO,CAAC,YAAY,CAAC;SACrB,WAAW,CAAC,uEAAuE,CAAC;SACpF,MAAM,CAAC,sBAAsB,EAAE,sCAAsC,CAAC;SACtE,MAAM,CACL,qBAAqB,EACrB,gEAAgE,CACjE;SACA,MAAM,CAAC,cAAc,EAAE,iEAAiE,CAAC;SACzF,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,IAAmB,EAAE,EAAE;QAClD,MAAM,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface PluginValidationResult {
|
|
2
|
+
ok: boolean;
|
|
3
|
+
skipped: boolean;
|
|
4
|
+
stderr: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ValidateClaudePluginOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Override the binary name (tests inject a fake "claude").
|
|
9
|
+
*/
|
|
10
|
+
bin?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Timeout in ms. Defaults to 10s — `claude plugin validate` is local-only
|
|
13
|
+
* and typically returns in <300ms; 10s is generous headroom.
|
|
14
|
+
*/
|
|
15
|
+
timeoutMs?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function validateClaudePlugin(pluginPath: string, opts?: ValidateClaudePluginOptions): PluginValidationResult;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// 0793 — `claude plugin validate <path>` wrapper.
|
|
3
|
+
//
|
|
4
|
+
// vskill never duplicates Claude Code's plugin schema. Both `vskill plugin new`
|
|
5
|
+
// (CLI) and `POST /api/authoring/convert-to-plugin` (Studio) call this helper
|
|
6
|
+
// after writing a manifest to confirm the JSON we wrote conforms. When `claude`
|
|
7
|
+
// is not on PATH (e.g. CI without Claude Code installed), validation soft-skips
|
|
8
|
+
// with `{ ok: true, skipped: true }` so vskill stays usable; callers should
|
|
9
|
+
// surface that state to the user.
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
import { spawnSync } from "node:child_process";
|
|
12
|
+
export function validateClaudePlugin(pluginPath, opts = {}) {
|
|
13
|
+
const bin = opts.bin ?? "claude";
|
|
14
|
+
const result = spawnSync(bin, ["plugin", "validate", pluginPath], {
|
|
15
|
+
encoding: "utf8",
|
|
16
|
+
timeout: opts.timeoutMs ?? 10_000,
|
|
17
|
+
});
|
|
18
|
+
// ENOENT => `claude` not on PATH. Soft-skip so vskill remains usable in
|
|
19
|
+
// environments without Claude Code (CI, fresh dev boxes, etc).
|
|
20
|
+
// `result.error` is a NodeJS.ErrnoException when spawn itself failed.
|
|
21
|
+
const err = result.error;
|
|
22
|
+
if (err && err.code === "ENOENT") {
|
|
23
|
+
return { ok: true, skipped: true, stderr: "" };
|
|
24
|
+
}
|
|
25
|
+
if (err) {
|
|
26
|
+
// Any other spawn error (timeout, permission, etc): surface but don't
|
|
27
|
+
// treat as schema failure — caller decides what to do.
|
|
28
|
+
return {
|
|
29
|
+
ok: false,
|
|
30
|
+
skipped: false,
|
|
31
|
+
stderr: `failed to invoke ${bin}: ${err.message}`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (result.status === 0) {
|
|
35
|
+
return { ok: true, skipped: false, stderr: "" };
|
|
36
|
+
}
|
|
37
|
+
// `claude plugin validate` writes diagnostics to stderr (or stdout in some
|
|
38
|
+
// versions). Concatenate both so callers always see the message.
|
|
39
|
+
const stderr = [result.stderr ?? "", result.stdout ?? ""]
|
|
40
|
+
.filter((s) => s && s.trim().length > 0)
|
|
41
|
+
.join("\n")
|
|
42
|
+
.trim();
|
|
43
|
+
return { ok: false, skipped: false, stderr };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=plugin-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-validator.js","sourceRoot":"","sources":["../../src/core/plugin-validator.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kDAAkD;AAClD,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,4EAA4E;AAC5E,kCAAkC;AAClC,8EAA8E;AAE9E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAoB/C,MAAM,UAAU,oBAAoB,CAClC,UAAkB,EAClB,OAAoC,EAAE;IAEtC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC;IACjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE;QAChE,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,IAAI,CAAC,SAAS,IAAI,MAAM;KAClC,CAAC,CAAC;IAEH,wEAAwE;IACxE,+DAA+D;IAC/D,sEAAsE;IACtE,MAAM,GAAG,GAAG,MAAM,CAAC,KAA4C,CAAC;IAChE,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACjD,CAAC;IACD,IAAI,GAAG,EAAE,CAAC;QACR,sEAAsE;QACtE,uDAAuD;QACvD,OAAO;YACL,EAAE,EAAE,KAAK;YACT,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,oBAAoB,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE;SAClD,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAClD,CAAC;IAED,2EAA2E;IAC3E,iEAAiE;IACjE,MAAM,MAAM,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;SACtD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;SACvC,IAAI,CAAC,IAAI,CAAC;SACV,IAAI,EAAE,CAAC;IACV,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -16,6 +16,10 @@ export interface CreateSkillResponse {
|
|
|
16
16
|
skillMdPath: string;
|
|
17
17
|
manifestPath: string | null;
|
|
18
18
|
}
|
|
19
|
+
export declare function validateKebabName(value: string | undefined, field: string): string | null;
|
|
20
|
+
export declare function skillMdScaffold(skillName: string, description: string): string;
|
|
21
|
+
export declare function pluginJsonScaffold(pluginName: string, description: string): string;
|
|
19
22
|
export declare function makeCreateSkillHandler(root: string): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
20
23
|
export declare function makeSkillExistsHandler(root: string): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
24
|
+
export declare function makeConvertToPluginHandler(root: string): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
21
25
|
export declare function registerAuthoringRoutes(router: Router, root: string): void;
|
|
@@ -17,20 +17,28 @@
|
|
|
17
17
|
// Does NOT call the LLM — that's /api/skills/generate. This is the "empty
|
|
18
18
|
// scaffold" path. UI can chain to generate after create.
|
|
19
19
|
// ---------------------------------------------------------------------------
|
|
20
|
-
import { existsSync, mkdirSync, writeFileSync, statSync, readdirSync } from "node:fs";
|
|
21
|
-
import { join } from "node:path";
|
|
20
|
+
import { existsSync, mkdirSync, writeFileSync, statSync, readdirSync, unlinkSync, } from "node:fs";
|
|
21
|
+
import { join, resolve, sep } from "node:path";
|
|
22
22
|
import { sendJson, readBody } from "./router.js";
|
|
23
|
+
import { validateClaudePlugin } from "../core/plugin-validator.js";
|
|
23
24
|
const KEBAB = /^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;
|
|
24
|
-
function sendError(res, status, code, message) {
|
|
25
|
-
sendJson(res, { ok: false, code, error: message }, status);
|
|
25
|
+
function sendError(res, status, code, message, extra) {
|
|
26
|
+
sendJson(res, { ok: false, code, error: message, ...(extra ?? {}) }, status);
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
// Exported so the CLI (`vskill plugin new`) can reuse the same kebab rule
|
|
29
|
+
// without duplicating the regex / error message.
|
|
30
|
+
export function validateKebabName(value, field) {
|
|
28
31
|
if (typeof value !== "string" || !KEBAB.test(value)) {
|
|
29
32
|
return `${field} must be kebab-case (lowercase letters, digits, hyphens; 2-64 chars)`;
|
|
30
33
|
}
|
|
31
34
|
return null;
|
|
32
35
|
}
|
|
33
|
-
function
|
|
36
|
+
function validateKebab(value, field) {
|
|
37
|
+
return validateKebabName(value, field);
|
|
38
|
+
}
|
|
39
|
+
// Exported so `vskill plugin new --with-skill <name>` reuses the same stub.
|
|
40
|
+
// 0793 T-002.
|
|
41
|
+
export function skillMdScaffold(skillName, description) {
|
|
34
42
|
return [
|
|
35
43
|
"---",
|
|
36
44
|
`description: ${description}`,
|
|
@@ -42,7 +50,10 @@ function skillMdScaffold(skillName, description) {
|
|
|
42
50
|
"",
|
|
43
51
|
].join("\n");
|
|
44
52
|
}
|
|
45
|
-
|
|
53
|
+
// Exported so both `vskill plugin new` (CLI) and the convert-to-plugin
|
|
54
|
+
// endpoint can reuse the single source of truth for plugin.json content.
|
|
55
|
+
// 0793 T-001.
|
|
56
|
+
export function pluginJsonScaffold(pluginName, description) {
|
|
46
57
|
// 0703 follow-up: align with https://code.claude.com/docs/en/plugins-reference
|
|
47
58
|
// `name` is the only required field. `version` is intentionally omitted so
|
|
48
59
|
// Claude Code falls back to the git SHA — docs explicitly warn that a fixed
|
|
@@ -186,9 +197,108 @@ export function makeSkillExistsHandler(root) {
|
|
|
186
197
|
sendJson(res, { exists: existsSync(skillDir), path: skillDir }, 200);
|
|
187
198
|
};
|
|
188
199
|
}
|
|
200
|
+
function isInsideRoot(rootDir, absPath) {
|
|
201
|
+
const resolvedRoot = resolve(rootDir);
|
|
202
|
+
const resolvedPath = resolve(absPath);
|
|
203
|
+
return (resolvedPath === resolvedRoot ||
|
|
204
|
+
resolvedPath.startsWith(resolvedRoot + sep));
|
|
205
|
+
}
|
|
206
|
+
function hasAnyAuthoredSkill(pluginDir) {
|
|
207
|
+
const skillsRoot = join(pluginDir, "skills");
|
|
208
|
+
let entries;
|
|
209
|
+
try {
|
|
210
|
+
entries = readdirSync(skillsRoot);
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
for (const entry of entries) {
|
|
216
|
+
const skillMd = join(skillsRoot, entry, "SKILL.md");
|
|
217
|
+
try {
|
|
218
|
+
if (statSync(skillMd).isFile())
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
/* ignore */
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
export function makeConvertToPluginHandler(root) {
|
|
228
|
+
return async function handler(req, res) {
|
|
229
|
+
let body;
|
|
230
|
+
try {
|
|
231
|
+
body = (await readBody(req));
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
return sendError(res, 400, "invalid-json", "Malformed JSON body");
|
|
235
|
+
}
|
|
236
|
+
const nameErr = validateKebab(body.pluginName, "pluginName");
|
|
237
|
+
if (nameErr)
|
|
238
|
+
return sendError(res, 400, "invalid-plugin-name", nameErr);
|
|
239
|
+
const pluginName = body.pluginName;
|
|
240
|
+
if (typeof body.anchorSkillDir !== "string" || body.anchorSkillDir.length === 0) {
|
|
241
|
+
return sendError(res, 400, "invalid-anchor", "anchorSkillDir must be an absolute path of an existing skill directory");
|
|
242
|
+
}
|
|
243
|
+
const anchorSkillDir = resolve(body.anchorSkillDir);
|
|
244
|
+
if (!isInsideRoot(root, anchorSkillDir)) {
|
|
245
|
+
return sendError(res, 400, "anchor-outside-root", "anchorSkillDir must be inside the workspace root");
|
|
246
|
+
}
|
|
247
|
+
try {
|
|
248
|
+
if (!statSync(anchorSkillDir).isDirectory()) {
|
|
249
|
+
return sendError(res, 400, "anchor-not-found", `anchorSkillDir is not a directory: ${anchorSkillDir}`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
return sendError(res, 400, "anchor-not-found", `anchorSkillDir does not exist: ${anchorSkillDir}`);
|
|
254
|
+
}
|
|
255
|
+
// Plugin root = parent of `skills/<skill>` ⇒ dirname(dirname(anchor)).
|
|
256
|
+
// Works for both top-level layout (<root>/skills/<s>/) where pluginDir == root,
|
|
257
|
+
// and nested (<root>/<X>/skills/<s>/) where pluginDir == <root>/<X>.
|
|
258
|
+
const pluginDir = resolve(anchorSkillDir, "..", "..");
|
|
259
|
+
if (!isInsideRoot(root, pluginDir)) {
|
|
260
|
+
return sendError(res, 400, "plugin-dir-outside-root", "Resolved pluginDir is outside the workspace root");
|
|
261
|
+
}
|
|
262
|
+
if (!hasAnyAuthoredSkill(pluginDir)) {
|
|
263
|
+
return sendError(res, 400, "no-skills-to-convert", `pluginDir has no skills/*/SKILL.md to associate with the new plugin: ${pluginDir}`);
|
|
264
|
+
}
|
|
265
|
+
const manifestDir = join(pluginDir, ".claude-plugin");
|
|
266
|
+
const manifestPath = join(manifestDir, "plugin.json");
|
|
267
|
+
if (existsSync(manifestPath)) {
|
|
268
|
+
return sendError(res, 409, "plugin-already-exists", `Plugin manifest already exists: ${manifestPath}`);
|
|
269
|
+
}
|
|
270
|
+
const description = (body.description ?? "").trim() || `Plugin: ${pluginName}`;
|
|
271
|
+
try {
|
|
272
|
+
mkdirSync(manifestDir, { recursive: true });
|
|
273
|
+
writeFileSync(manifestPath, pluginJsonScaffold(pluginName, description), "utf8");
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
277
|
+
return sendError(res, 500, "write-failed", `Failed to write manifest: ${message}`);
|
|
278
|
+
}
|
|
279
|
+
const validation = validateClaudePlugin(pluginDir);
|
|
280
|
+
if (!validation.ok) {
|
|
281
|
+
try {
|
|
282
|
+
unlinkSync(manifestPath);
|
|
283
|
+
}
|
|
284
|
+
catch {
|
|
285
|
+
/* best-effort rollback */
|
|
286
|
+
}
|
|
287
|
+
return sendError(res, 422, "validation-failed", "claude plugin validate rejected the generated manifest", { stderr: validation.stderr });
|
|
288
|
+
}
|
|
289
|
+
sendJson(res, {
|
|
290
|
+
ok: true,
|
|
291
|
+
pluginDir,
|
|
292
|
+
manifestPath,
|
|
293
|
+
validation: validation.skipped ? "skipped" : "passed",
|
|
294
|
+
}, 200);
|
|
295
|
+
};
|
|
296
|
+
}
|
|
189
297
|
export function registerAuthoringRoutes(router, root) {
|
|
190
298
|
const handler = makeCreateSkillHandler(root);
|
|
191
299
|
router.post("/api/authoring/create-skill", (req, res) => handler(req, res));
|
|
300
|
+
const convertHandler = makeConvertToPluginHandler(root);
|
|
301
|
+
router.post("/api/authoring/convert-to-plugin", (req, res) => convertHandler(req, res));
|
|
192
302
|
const existsHandler = makeSkillExistsHandler(root);
|
|
193
303
|
router.get("/api/authoring/skill-exists", (req, res) => existsHandler(req, res));
|
|
194
304
|
// Helper endpoint: list authored plugins in the current root so the modal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoring-routes.js","sourceRoot":"","sources":["../../src/eval-server/authoring-routes.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,iFAAiF;AACjF,EAAE;AACF,mCAAmC;AACnC,YAAY;AACZ,6DAA6D;AAC7D,gDAAgD;AAChD,4BAA4B;AAC5B,mFAAmF;AACnF,MAAM;AACN,EAAE;AACF,oCAAoC;AACpC,oDAAoD;AACpD,uFAAuF;AACvF,0FAA0F;AAC1F,EAAE;AACF,0EAA0E;AAC1E,yDAAyD;AACzD,8EAA8E;AAG9E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAqBjD,MAAM,KAAK,GAAG,gCAAgC,CAAC;AAE/C,SAAS,SAAS,CAChB,GAAmB,EACnB,MAAc,EACd,IAAY,EACZ,OAAe;IAEf,QAAQ,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,aAAa,CAAC,KAAyB,EAAE,KAAa;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,GAAG,KAAK,sEAAsE,CAAC;IACxF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,eAAe,CAAC,SAAiB,EAAE,WAAmB;IAC7D,OAAO;QACL,K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GAAG,CAAC,CAAC;gBAC7B,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO;gBACT,CAAC;gBACD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;oBAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;wBAAE,SAAS;oBAChC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,KAAK,gBAAgB;wBAAE,SAAS;oBAChE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;oBAC9B,IAAI,CAAC;wBACH,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE;4BAAE,SAAS;oBAC/C,CAAC;oBAAC,MAAM,CAAC;wBACP,SAAS;oBACX,CAAC;oBACD,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;YAED,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC;YACP,6BAA6B;QAC/B,CAAC;QACD,QAAQ,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
1
|
+
{"version":3,"file":"authoring-routes.js","sourceRoot":"","sources":["../../src/eval-server/authoring-routes.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,iFAAiF;AACjF,EAAE;AACF,mCAAmC;AACnC,YAAY;AACZ,6DAA6D;AAC7D,gDAAgD;AAChD,4BAA4B;AAC5B,mFAAmF;AACnF,MAAM;AACN,EAAE;AACF,oCAAoC;AACpC,oDAAoD;AACpD,uFAAuF;AACvF,0FAA0F;AAC1F,EAAE;AACF,0EAA0E;AAC1E,yDAAyD;AACzD,8EAA8E;AAG9E,OAAO,EACL,UAAU,EACV,SAAS,EACT,aAAa,EACb,QAAQ,EACR,WAAW,EACX,U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"./index-vzRnBcdU.js";/* empty css */const le=[{key:"slashCommands",label:"Slash"},{key:"hooks",label:"Hooks"},{key:"mcp",label:"MCP"},{key:"customSystemPrompt",label:"Prompt"}];function ne({supported:r,label:l}){return e.jsx("span",{style:{display:"inline-block",fontSize:10,padding:"1px 5px",borderRadius:3,marginRight:3,background:r?"var(--color-success-bg, #d4edda)":"var(--surface-3, #2a2a2a)",color:r?"var(--color-success, #28a745)":"var(--text-tertiary, #666)",border:`1px solid ${r?"var(--color-success, #28a745)":"var(--border-subtle, #333)"}`},children:l})}function F({agent:r,checked:l,onToggle:g}){return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:6,cursor:"pointer",border:r.installed?"1px solid var(--color-primary, #6366f1)":"1px solid var(--border-subtle, #333)",background:l?"var(--surface-2, #1e1e1e)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:l,onChange:g,style:{accentColor:"var(--color-primary, #6366f1)"}}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontWeight:500,fontSize:13,color:"var(--text-primary, #fff)"},children:r.displayName}),r.installed&&e.jsx("span",{style:{fontSize:10,padding:"1px 5px",borderRadius:3,background:"var(--color-primary-bg, #312e81)",color:"var(--color-primary, #6366f1)"},children:"installed"})]}),e.jsx("div",{style:{marginTop:3},children:le.map(x=>e.jsx(ne,{supported:r.featureSupport[x.key],label:x.label},x.key))})]})]})}function oe({agents:r,selectedIds:l,onChange:g}){const x=new Set(l),i=r.filter(n=>n.isUniversal),a=r.filter(n=>!n.isUniversal),c=n=>{const o=x.has(n)?l.filter(h=>h!==n):[...l,n];g(o)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[i.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Universal Agents"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:i.map(n=>e.jsx(F,{agent:n,checked:x.has(n.id),onToggle:()=>c(n.id)},n.id))})]}),a.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Other Agents"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:a.map(n=>e.jsx(F,{agent:n,checked:x.has(n.id),onToggle:()=>c(n.id)},n.id))})]})]})}const ie="Cross-universal — emits the same skill to 8 universal agents (Claude, Codex, Cursor, Cline, Gemini CLI, OpenCode, Kimi, Amp). Constrains output to the common schema across all agents. Recommended for portable skills.",de="Powerful Claude-native engine — Anthropic's built-in skill-creator with a slightly richer schema (more expressive on Claude) but Claude-only. Pick this when you only target Claude Code and want full expressiveness.",ce="Generate raw — no engine assistance, you provide the full SKILL.md body.";function ue(r){return[{engine:"vskill",label:"VSkill skill-builder",caption:r.vskillSkillBuilder?`installed${r.vskillVersion?` v${r.vskillVersion}`:""}`:"not installed",tooltip:ie,detected:r.vskillSkillBuilder,installable:!0},{engine:"anthropic-skill-creator",label:"Anthropic skill-creator",caption:r.anthropicSkillCreator?"installed":"not installed",tooltip:de,detected:r.anthropicSkillCreator,installable:!0},{engine:"none",label:"No engine — generate raw",caption:"always available",tooltip:ce,detected:!0,installable:!1}]}function xe(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function pe(r){const{detection:l,selected:g,onSelect:x,onInstallClick:i}=r,a=j.useMemo(()=>xe(),[]),c=j.useMemo(()=>ue(l),[l]),n=a?"":"transition-colors";return e.jsxs("fieldset",{className:"flex flex-col gap-2",children:[e.jsx("legend",{className:"text-xs font-semibold text-gray-700",children:"Authoring engine"}),e.jsx("div",{role:"tablist","aria-label":"Authoring engine",className:"flex flex-col gap-1.5",children:c.map(o=>{const h=g===o.engine,p=!o.detected&&o.installable,y=["flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm cursor-pointer",n,h?"border-blue-600 bg-blue-50":"border-gray-300 bg-white hover:border-gray-400"].filter(Boolean).join(" "),f=o.detected?{}:{opacity:.6};return e.jsxs("div",{role:"tab",tabIndex:0,"data-testid":`engine-selector-${o.engine}`,"aria-selected":h?"true":"false",title:o.tooltip,style:f,className:y,onClick:()=>x(o.engine),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),x(o.engine))},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-gray-900",children:o.label}),e.jsx("span",{className:"text-xs text-gray-500",children:o.caption})]}),p&&e.jsx("button",{type:"button","data-testid":`install-${o.engine}`,className:"rounded border border-blue-600 px-2 py-1 text-xs font-medium text-blue-700 hover:bg-blue-100",onClick:u=>{u.stopPropagation(),i(o.engine)},children:"Install"})]},o.engine)})})]})}const A="(?:0|[1-9]\\d*)",H="[0-9A-Za-z-]",$=`(?:${A}|\\d*[A-Za-z-]${H}*)`,z=`${H}+`,me=`(?:-${$}(?:\\.${$})*)`,ge=`(?:\\+${z}(?:\\.${z})*)`,he=new RegExp(`^${A}\\.${A}\\.${A}${me}?${ge}?$`);function V(r){return typeof r!="string"?!1:he.test(r.trim())}const fe="Skill version (semver). Auto-bumps on update unless versioningMode=author.",ve="Must be valid semver (e.g. 1.0.0, 2.1.3-beta.1)";function ye(r){const{value:l,onChange:g,mode:x,onValidityChange:i,versionsHref:a,disabled:c}=r,[n,o]=j.useState(!1),[h,p]=j.useState(()=>V(l)),y=V(l);j.useEffect(()=>{y!==h?(p(y),i==null||i(y)):i&&i(y)},[y]);const f=n&&!y,u=["w-full rounded-md border px-3 py-2 text-sm font-mono",f?"border-red-500 bg-red-50 focus:outline-red-600":"border-gray-300 bg-white focus:outline-blue-600",c?"opacity-60 cursor-not-allowed":""].join(" ");return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-700",htmlFor:"version-input",children:"Version"}),e.jsx("input",{id:"version-input","data-testid":"version-input",type:"text",title:fe,value:l,onChange:m=>g(m.currentTarget.value),onBlur:()=>o(!0),"aria-invalid":f?"true":"false","aria-describedby":f?"version-input-helper":void 0,disabled:c,className:u,placeholder:"1.0.0"}),f&&e.jsx("span",{id:"version-input-helper","data-testid":"version-input-helper",className:"text-xs text-red-600",role:"alert",children:ve}),x==="update"&&a&&e.jsx("a",{"data-testid":"version-input-versions-link",href:a,target:"_blank",rel:"noreferrer",className:"text-xs text-blue-600 hover:underline",children:"Versions →"})]})}const E={status:"idle",liveTail:"",progress:[],exitCode:null,stderr:"",error:null};function be(r={}){const l=r.fetchImpl??globalThis.fetch,g=r.eventSourceCtor??globalThis.EventSource,[x,i]=j.useState(E),a=j.useRef(null),c=j.useRef(null);j.useEffect(()=>()=>{var p;(p=c.current)==null||p.close()},[]);const n=j.useCallback(()=>{var p;(p=c.current)==null||p.close(),c.current=null,a.current=null,i(E)},[]),o=j.useCallback(async p=>{if(!g){i({...E,status:"failure",error:"EventSource not available"});return}a.current=p,i({...E,status:"spawning"});let y;try{const u=await l("/api/studio/install-engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engine:p})});if(!u.ok){const w=await u.json().catch(()=>({}));i({...E,status:"failure",error:w.remediation??w.error??`HTTP ${u.status}`});return}y=(await u.json()).jobId}catch(u){i({...E,status:"failure",error:u.message});return}const f=new g(`/api/studio/install-engine/${y}/stream`);c.current=f,i(u=>({...u,status:"streaming"})),f.addEventListener("progress",u=>{try{const m=JSON.parse(u.data);i(w=>({...w,liveTail:m.line.length>60?m.line.slice(0,60)+"…":m.line,progress:[...w.progress,m].slice(-200)}))}catch{}}),f.addEventListener("done",u=>{try{const m=JSON.parse(u.data);f.close(),c.current=null,i(w=>({...w,status:m.success?"success":"failure",exitCode:m.exitCode,stderr:m.stderr,error:m.success?null:m.stderr||`exit ${m.exitCode}`}))}catch{f.close(),c.current=null,i(m=>({...m,status:"failure",error:"malformed done event"}))}}),f.addEventListener("error",()=>{f.close(),c.current=null,i(u=>({...u,status:u.status==="streaming"?"failure":u.status,error:u.error??"stream error"}))})},[g,l]),h=j.useCallback(async()=>{const p=a.current;p&&await o(p)},[o]);return{state:x,install:o,retry:h,reset:n}}const je={vskill:"vskill install anton-abyzov/vskill/skill-builder","anthropic-skill-creator":"claude plugin install skill-creator"},ke={vskill:"VSkill skill-builder","anthropic-skill-creator":"Anthropic skill-creator"},we="This runs the command in your terminal as your user. Inspect before approving.";function Ne(r){const{engine:l,onClose:g,onSuccess:x,hookOpts:i}=r,{state:a,install:c,retry:n}=be(i),o=je[l],h=ke[l],p=j.useRef(!1);return j.useEffect(()=>{a.status==="success"&&!p.current&&(p.current=!0,x())},[a.status,x]),e.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"install-engine-title","data-testid":"install-engine-modal",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:e.jsxs("div",{className:"w-full max-w-lg rounded-lg bg-white p-6 shadow-xl",children:[e.jsxs("h2",{id:"install-engine-title",className:"text-lg font-semibold text-gray-900",children:["Install ",h]}),a.status==="idle"&&e.jsx(Se,{command:o,onCancel:g,onRun:()=>c(l)}),(a.status==="spawning"||a.status==="streaming")&&e.jsx(Ce,{command:o,liveTail:a.liveTail}),a.status==="success"&&e.jsx(Le,{label:h,onClose:g}),a.status==="failure"&&e.jsx(Ee,{error:a.error??"Install failed",stderr:a.stderr,progress:a.progress,onRetry:()=>n(),onClose:g})]})})}function G({command:r}){return e.jsxs("pre",{"data-testid":"install-command-preview",className:"my-3 overflow-x-auto rounded bg-gray-900 px-3 py-2 font-mono text-xs text-green-300",children:["$ ",r]})}function Se(r){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Studio will run this command on your behalf:"}),e.jsx(G,{command:r.command}),e.jsx("p",{className:"text-xs text-amber-700","data-testid":"install-security-note",children:we}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button","data-testid":"install-cancel",className:"rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50",onClick:r.onCancel,children:"Cancel"}),e.jsx("button",{type:"button","data-testid":"install-run",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onRun,children:"Run install"})]})]})}function Ce(r){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Installing…"}),e.jsx(G,{command:r.command}),e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-gray-600",children:[e.jsx("span",{"data-testid":"install-spinner",className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-300 border-t-blue-600"}),e.jsx("span",{"data-testid":"install-live-tail",className:"font-mono",children:r.liveTail||"starting…"})]})]})}function Le(r){return e.jsxs(e.Fragment,{children:[e.jsxs("p",{"data-testid":"install-success",className:"mt-3 text-sm font-medium text-green-700",children:["✓ ",r.label," installed"]}),e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx("button",{type:"button","data-testid":"install-close",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onClose,children:"Done"})})]})}function Ee(r){const[l,g]=j.useState(!1),x=r.progress.filter(a=>a.stream==="stderr").map(a=>a.line),i=x.length>0?x.join(`
|
|
1
|
+
import{j as e,R as j,u as J,a as Z,r as b,g as D,b as B,w as X,c as ee,t as P,L as R,P as te,E as se,d as re,S as ae}from"./index-DnXSuywx.js";/* empty css */const le=[{key:"slashCommands",label:"Slash"},{key:"hooks",label:"Hooks"},{key:"mcp",label:"MCP"},{key:"customSystemPrompt",label:"Prompt"}];function ne({supported:r,label:l}){return e.jsx("span",{style:{display:"inline-block",fontSize:10,padding:"1px 5px",borderRadius:3,marginRight:3,background:r?"var(--color-success-bg, #d4edda)":"var(--surface-3, #2a2a2a)",color:r?"var(--color-success, #28a745)":"var(--text-tertiary, #666)",border:`1px solid ${r?"var(--color-success, #28a745)":"var(--border-subtle, #333)"}`},children:l})}function F({agent:r,checked:l,onToggle:g}){return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:6,cursor:"pointer",border:r.installed?"1px solid var(--color-primary, #6366f1)":"1px solid var(--border-subtle, #333)",background:l?"var(--surface-2, #1e1e1e)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:l,onChange:g,style:{accentColor:"var(--color-primary, #6366f1)"}}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontWeight:500,fontSize:13,color:"var(--text-primary, #fff)"},children:r.displayName}),r.installed&&e.jsx("span",{style:{fontSize:10,padding:"1px 5px",borderRadius:3,background:"var(--color-primary-bg, #312e81)",color:"var(--color-primary, #6366f1)"},children:"installed"})]}),e.jsx("div",{style:{marginTop:3},children:le.map(x=>e.jsx(ne,{supported:r.featureSupport[x.key],label:x.label},x.key))})]})]})}function oe({agents:r,selectedIds:l,onChange:g}){const x=new Set(l),i=r.filter(n=>n.isUniversal),a=r.filter(n=>!n.isUniversal),c=n=>{const o=x.has(n)?l.filter(h=>h!==n):[...l,n];g(o)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[i.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Universal Agents"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:i.map(n=>e.jsx(F,{agent:n,checked:x.has(n.id),onToggle:()=>c(n.id)},n.id))})]}),a.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Other Agents"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:a.map(n=>e.jsx(F,{agent:n,checked:x.has(n.id),onToggle:()=>c(n.id)},n.id))})]})]})}const ie="Cross-universal — emits the same skill to 8 universal agents (Claude, Codex, Cursor, Cline, Gemini CLI, OpenCode, Kimi, Amp). Constrains output to the common schema across all agents. Recommended for portable skills.",de="Powerful Claude-native engine — Anthropic's built-in skill-creator with a slightly richer schema (more expressive on Claude) but Claude-only. Pick this when you only target Claude Code and want full expressiveness.",ce="Generate raw — no engine assistance, you provide the full SKILL.md body.";function ue(r){return[{engine:"vskill",label:"VSkill skill-builder",caption:r.vskillSkillBuilder?`installed${r.vskillVersion?` v${r.vskillVersion}`:""}`:"not installed",tooltip:ie,detected:r.vskillSkillBuilder,installable:!0},{engine:"anthropic-skill-creator",label:"Anthropic skill-creator",caption:r.anthropicSkillCreator?"installed":"not installed",tooltip:de,detected:r.anthropicSkillCreator,installable:!0},{engine:"none",label:"No engine — generate raw",caption:"always available",tooltip:ce,detected:!0,installable:!1}]}function xe(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function pe(r){const{detection:l,selected:g,onSelect:x,onInstallClick:i}=r,a=j.useMemo(()=>xe(),[]),c=j.useMemo(()=>ue(l),[l]),n=a?"":"transition-colors";return e.jsxs("fieldset",{className:"flex flex-col gap-2",children:[e.jsx("legend",{className:"text-xs font-semibold text-gray-700",children:"Authoring engine"}),e.jsx("div",{role:"tablist","aria-label":"Authoring engine",className:"flex flex-col gap-1.5",children:c.map(o=>{const h=g===o.engine,p=!o.detected&&o.installable,y=["flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm cursor-pointer",n,h?"border-blue-600 bg-blue-50":"border-gray-300 bg-white hover:border-gray-400"].filter(Boolean).join(" "),f=o.detected?{}:{opacity:.6};return e.jsxs("div",{role:"tab",tabIndex:0,"data-testid":`engine-selector-${o.engine}`,"aria-selected":h?"true":"false",title:o.tooltip,style:f,className:y,onClick:()=>x(o.engine),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),x(o.engine))},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-gray-900",children:o.label}),e.jsx("span",{className:"text-xs text-gray-500",children:o.caption})]}),p&&e.jsx("button",{type:"button","data-testid":`install-${o.engine}`,className:"rounded border border-blue-600 px-2 py-1 text-xs font-medium text-blue-700 hover:bg-blue-100",onClick:u=>{u.stopPropagation(),i(o.engine)},children:"Install"})]},o.engine)})})]})}const A="(?:0|[1-9]\\d*)",H="[0-9A-Za-z-]",$=`(?:${A}|\\d*[A-Za-z-]${H}*)`,z=`${H}+`,me=`(?:-${$}(?:\\.${$})*)`,ge=`(?:\\+${z}(?:\\.${z})*)`,he=new RegExp(`^${A}\\.${A}\\.${A}${me}?${ge}?$`);function V(r){return typeof r!="string"?!1:he.test(r.trim())}const fe="Skill version (semver). Auto-bumps on update unless versioningMode=author.",ve="Must be valid semver (e.g. 1.0.0, 2.1.3-beta.1)";function ye(r){const{value:l,onChange:g,mode:x,onValidityChange:i,versionsHref:a,disabled:c}=r,[n,o]=j.useState(!1),[h,p]=j.useState(()=>V(l)),y=V(l);j.useEffect(()=>{y!==h?(p(y),i==null||i(y)):i&&i(y)},[y]);const f=n&&!y,u=["w-full rounded-md border px-3 py-2 text-sm font-mono",f?"border-red-500 bg-red-50 focus:outline-red-600":"border-gray-300 bg-white focus:outline-blue-600",c?"opacity-60 cursor-not-allowed":""].join(" ");return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-700",htmlFor:"version-input",children:"Version"}),e.jsx("input",{id:"version-input","data-testid":"version-input",type:"text",title:fe,value:l,onChange:m=>g(m.currentTarget.value),onBlur:()=>o(!0),"aria-invalid":f?"true":"false","aria-describedby":f?"version-input-helper":void 0,disabled:c,className:u,placeholder:"1.0.0"}),f&&e.jsx("span",{id:"version-input-helper","data-testid":"version-input-helper",className:"text-xs text-red-600",role:"alert",children:ve}),x==="update"&&a&&e.jsx("a",{"data-testid":"version-input-versions-link",href:a,target:"_blank",rel:"noreferrer",className:"text-xs text-blue-600 hover:underline",children:"Versions →"})]})}const E={status:"idle",liveTail:"",progress:[],exitCode:null,stderr:"",error:null};function be(r={}){const l=r.fetchImpl??globalThis.fetch,g=r.eventSourceCtor??globalThis.EventSource,[x,i]=j.useState(E),a=j.useRef(null),c=j.useRef(null);j.useEffect(()=>()=>{var p;(p=c.current)==null||p.close()},[]);const n=j.useCallback(()=>{var p;(p=c.current)==null||p.close(),c.current=null,a.current=null,i(E)},[]),o=j.useCallback(async p=>{if(!g){i({...E,status:"failure",error:"EventSource not available"});return}a.current=p,i({...E,status:"spawning"});let y;try{const u=await l("/api/studio/install-engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engine:p})});if(!u.ok){const w=await u.json().catch(()=>({}));i({...E,status:"failure",error:w.remediation??w.error??`HTTP ${u.status}`});return}y=(await u.json()).jobId}catch(u){i({...E,status:"failure",error:u.message});return}const f=new g(`/api/studio/install-engine/${y}/stream`);c.current=f,i(u=>({...u,status:"streaming"})),f.addEventListener("progress",u=>{try{const m=JSON.parse(u.data);i(w=>({...w,liveTail:m.line.length>60?m.line.slice(0,60)+"…":m.line,progress:[...w.progress,m].slice(-200)}))}catch{}}),f.addEventListener("done",u=>{try{const m=JSON.parse(u.data);f.close(),c.current=null,i(w=>({...w,status:m.success?"success":"failure",exitCode:m.exitCode,stderr:m.stderr,error:m.success?null:m.stderr||`exit ${m.exitCode}`}))}catch{f.close(),c.current=null,i(m=>({...m,status:"failure",error:"malformed done event"}))}}),f.addEventListener("error",()=>{f.close(),c.current=null,i(u=>({...u,status:u.status==="streaming"?"failure":u.status,error:u.error??"stream error"}))})},[g,l]),h=j.useCallback(async()=>{const p=a.current;p&&await o(p)},[o]);return{state:x,install:o,retry:h,reset:n}}const je={vskill:"vskill install anton-abyzov/vskill/skill-builder","anthropic-skill-creator":"claude plugin install skill-creator"},ke={vskill:"VSkill skill-builder","anthropic-skill-creator":"Anthropic skill-creator"},we="This runs the command in your terminal as your user. Inspect before approving.";function Ne(r){const{engine:l,onClose:g,onSuccess:x,hookOpts:i}=r,{state:a,install:c,retry:n}=be(i),o=je[l],h=ke[l],p=j.useRef(!1);return j.useEffect(()=>{a.status==="success"&&!p.current&&(p.current=!0,x())},[a.status,x]),e.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"install-engine-title","data-testid":"install-engine-modal",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:e.jsxs("div",{className:"w-full max-w-lg rounded-lg bg-white p-6 shadow-xl",children:[e.jsxs("h2",{id:"install-engine-title",className:"text-lg font-semibold text-gray-900",children:["Install ",h]}),a.status==="idle"&&e.jsx(Se,{command:o,onCancel:g,onRun:()=>c(l)}),(a.status==="spawning"||a.status==="streaming")&&e.jsx(Ce,{command:o,liveTail:a.liveTail}),a.status==="success"&&e.jsx(Le,{label:h,onClose:g}),a.status==="failure"&&e.jsx(Ee,{error:a.error??"Install failed",stderr:a.stderr,progress:a.progress,onRetry:()=>n(),onClose:g})]})})}function G({command:r}){return e.jsxs("pre",{"data-testid":"install-command-preview",className:"my-3 overflow-x-auto rounded bg-gray-900 px-3 py-2 font-mono text-xs text-green-300",children:["$ ",r]})}function Se(r){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Studio will run this command on your behalf:"}),e.jsx(G,{command:r.command}),e.jsx("p",{className:"text-xs text-amber-700","data-testid":"install-security-note",children:we}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button","data-testid":"install-cancel",className:"rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50",onClick:r.onCancel,children:"Cancel"}),e.jsx("button",{type:"button","data-testid":"install-run",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onRun,children:"Run install"})]})]})}function Ce(r){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Installing…"}),e.jsx(G,{command:r.command}),e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-gray-600",children:[e.jsx("span",{"data-testid":"install-spinner",className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-300 border-t-blue-600"}),e.jsx("span",{"data-testid":"install-live-tail",className:"font-mono",children:r.liveTail||"starting…"})]})]})}function Le(r){return e.jsxs(e.Fragment,{children:[e.jsxs("p",{"data-testid":"install-success",className:"mt-3 text-sm font-medium text-green-700",children:["✓ ",r.label," installed"]}),e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx("button",{type:"button","data-testid":"install-close",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onClose,children:"Done"})})]})}function Ee(r){const[l,g]=j.useState(!1),x=r.progress.filter(a=>a.stream==="stderr").map(a=>a.line),i=x.length>0?x.join(`
|
|
2
2
|
`):r.stderr;return e.jsxs(e.Fragment,{children:[e.jsx("p",{"data-testid":"install-failure",className:"mt-3 text-sm font-medium text-red-700",children:"✗ Install failed"}),e.jsx("p",{className:"mt-1 text-xs text-gray-700",children:r.error}),i&&e.jsxs("details",{className:"mt-3 text-xs",open:l,onToggle:a=>g(a.currentTarget.open),children:[e.jsx("summary",{className:"cursor-pointer text-gray-600",children:"stderr"}),e.jsx("pre",{"data-testid":"install-stderr",className:"mt-2 overflow-x-auto rounded bg-gray-900 px-3 py-2 font-mono text-xs text-red-300",children:i})]}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button","data-testid":"install-close",className:"rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50",onClick:r.onClose,children:"Close"}),e.jsx("button",{type:"button","data-testid":"install-retry",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onRetry,children:"Retry"})]})]})}const S={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Pe(r){return r?/API usage limits|usage limit/i.test(r)&&/regain access|reset/i.test(r):!1}function Ie(r){const l=r.match(/regain access on ([^"\\]+?)(?:\s*UTC)?["\\]/i)??r.match(/regain access on ([^"\\]+)/i);return l?`Resets ${l[1].trim()} UTC`:"Quota resets at the start of your next billing period"}function I(r){switch(r){case"claude-cli":return"Uses your logged-in Claude Code session — your existing CLI session handles quota. No API key needed. Overflow runs at standard API rates if extra usage is enabled in your account settings.";case"anthropic":return"Direct Anthropic API — pay-per-token. Full Opus / Sonnet / Haiku catalog. Requires ANTHROPIC_API_KEY.";case"openrouter":return"One API key → 300+ models from Anthropic, OpenAI (GPT-5 / o4-mini), Google (Gemini), Meta (Llama) and more. Same prices as direct.";case"ollama":return"Local models on your machine (Llama, Qwen, Mistral, etc.). Zero cost, zero data leaves your laptop.";case"lm-studio":return"Local models via LM Studio's OpenAI-compatible server. Works offline. Pick any model you've loaded in LM Studio.";default:return""}}function M({size:r=14,color:l="currentColor"}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:l,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function Re(){const{config:r}=J(),{refreshSkills:l,revealSkill:g}=Z(),[x,i]=b.useState(null),a=j.useMemo(()=>{if(typeof window>"u")return{};const s=window.location.hash,d=s.indexOf("?");if(d===-1)return{};const N=new URLSearchParams(s.slice(d+1)),k={};for(const v of["mode","skillName","description","pluginName"]){const L=N.get(v);L&&(k[v]=L)}return k},[]),[c,n]=b.useState("claude-cli"),[o,h]=b.useState("sonnet"),[p,y]=b.useState(!1),[f,u]=b.useState(null),m=b.useRef(!1),[w,W]=b.useState([]),[U,K]=b.useState(()=>D("activeAgent",null));b.useEffect(()=>{function s(){K(D("activeAgent",null))}return window.addEventListener("studio:agent-changed",s),window.addEventListener("storage",s),()=>{window.removeEventListener("studio:agent-changed",s),window.removeEventListener("storage",s)}},[]);const Y=U!=="claude-code";b.useEffect(()=>{fetch("/api/agents/installed").then(s=>s.json()).then(s=>{s.agents&&W(s.agents)}).catch(()=>{})},[]),b.useEffect(()=>{var k;if(!r)return;const s=r.providers.filter(v=>v.available),d=B().skillGenModel;if(s.length===0){m.current=!0;return}if(d&&typeof d=="object"&&typeof d.provider=="string"&&typeof d.model=="string"){const v=s.find(T=>T.id===d.provider),L=v==null?void 0:v.models.some(T=>T.id===d.model);if(v&&L){n(d.provider),h(d.model),y(!0),m.current=!0;return}u({provider:d.provider,model:d.model})}if(s.find(v=>v.id==="claude-cli"))n("claude-cli"),h("sonnet");else{const v=s[0];n(v.id),h(((k=v.models[0])==null?void 0:k.id)??"")}y(!1),m.current=!0},[r]),b.useEffect(()=>{const s=d=>{if(d.key!==null&&!d.key.includes("vskill.studio.prefs"))return;const k=B().skillGenModel;k&&typeof k=="object"&&typeof k.provider=="string"&&typeof k.model=="string"&&(n(k.provider),h(k.model),y(!0))};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[]);const O=b.useCallback((s,d)=>{X("skillGenModel",{provider:s,model:d}),y(!0)},[]),q=b.useCallback(()=>({provider:c,model:o}),[c,o]),Q=a.mode==="standalone"?3:void 0,t=ee({onCreated:(s,d)=>{l(),setTimeout(()=>g(s,d),500)},resolveAiConfigOverride:q,forceLayout:Q});b.useEffect(()=>{a.skillName&&!t.name&&t.setName(P(a.skillName)),a.description&&!t.description&&t.setDescription(a.description),a.description&&!t.aiPrompt&&t.setAiPrompt(a.description),a.pluginName&&!t.plugin&&t.setPlugin(P(a.pluginName))},[]);const C=r==null?void 0:r.providers.find(s=>s.id===c&&s.available),_=b.useMemo(()=>{const s=["---"];return t.description?s.push(`description: "${t.description.replace(/"/g,'\\"')}"`):s.push('description: ""'),t.allowedTools.trim()&&s.push(`allowed-tools: ${t.allowedTools.trim()}`),t.model&&s.push(`model: ${t.model}`),t.targetAgents.length>0&&s.push(`target-agents: ${t.targetAgents.join(", ")}`),s.push("---"),s.push(""),t.body.trim()?s.push(t.body.trim()):(s.push(`# /${t.name||"skill-name"}`),s.push(""),s.push("You are a helpful assistant.")),s.join(`
|
|
3
3
|
`)},[t.name,t.description,t.model,t.allowedTools,t.body]);return e.jsxs("div",{className:"px-4 py-6 sm:px-6 sm:py-7 lg:px-10 lg:py-8 max-w-6xl mx-auto w-full overflow-x-hidden",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:[e.jsx(R,{to:"/",className:"hover:underline",style:{color:"var(--text-tertiary)"},children:"Skills"}),e.jsx("span",{children:"/"}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"New Skill"})]}),e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-[22px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),t.standaloneLocked&&e.jsx("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider px-2 py-0.5 rounded whitespace-nowrap",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"1px solid var(--accent-muted)"},title:"You chose Standalone in the previous step. Plugin selection is disabled.",children:"Standalone"})]}),e.jsx("p",{className:"text-[13px] mt-1",style:{color:"var(--text-tertiary)"},children:"Define your skill's metadata, content, and placement"})]}),e.jsxs("div",{className:"inline-flex rounded-lg p-1 self-start sm:self-auto sm:flex-shrink-0 max-w-full",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},role:"tablist","aria-label":"Creation mode",children:[e.jsx("button",{onClick:()=>t.setMode("ai"),className:"px-4 py-2 rounded-md text-[13px] font-medium transition-all duration-200",style:{background:t.mode==="ai"?"var(--purple-muted)":"transparent",color:t.mode==="ai"?"var(--purple)":"var(--text-tertiary)",boxShadow:t.mode==="ai"?"0 1px 3px rgba(0,0,0,0.08)":"none"},children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(M,{size:14}),"AI-Assisted"]})}),e.jsx("button",{onClick:()=>t.setMode("manual"),className:"px-4 py-2 rounded-md text-[13px] font-medium transition-all duration-200",style:{background:t.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:t.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:t.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none"},children:"Manual"})]})]})]}),t.engineDetection&&e.jsx("div",{className:"mb-4",children:e.jsx(pe,{detection:t.engineDetection,selected:t.engine,onSelect:s=>t.setEngine(s),onInstallClick:s=>i(s)})}),t.layoutLoading&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),e.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),e.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!t.layoutLoading&&t.layout&&t.mode==="ai"&&e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 animate-fade-in",children:[e.jsxs("div",{className:"flex-1 min-w-0 space-y-5",children:[e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[e.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"var(--purple-muted)"},children:e.jsx(M,{size:13,color:"var(--purple)"})}),"Describe Your Skill"]}),e.jsx("textarea",{ref:t.promptRef,value:t.aiPrompt,onChange:s=>t.setAiPrompt(s.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
4
4
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-
|
|
2
|
-
import{r as t,j as d,_ as l}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-91Jq-ilw.js","assets/index-DnXSuywx.js","assets/index-CycZyHaL.css","assets/fonts-i7Lkz2zN.css","assets/skill-url-C4ekwoGs.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as t,j as d,_ as l}from"./index-DnXSuywx.js";/* empty css */const f=t.lazy(()=>l(()=>import("./SearchPaletteCore-91Jq-ilw.js"),__vite__mapDeps([0,1,2,3,4])));function w(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function y({onSelect:i,onNavigate:u}={}){const[n,o]=t.useState(!1),s=t.useRef(null),a=w();t.useEffect(()=>{function e(){s.current=document.activeElement??null,o(!0)}return window.addEventListener("openFindSkills",e),()=>window.removeEventListener("openFindSkills",e)},[]),t.useEffect(()=>{if(!n)return;function e(r){r.key==="Escape"&&o(!1)}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]),t.useEffect(()=>{if(n)return;const e=s.current;if(e&&typeof e.focus=="function")try{e.focus()}catch{}s.current=null},[n]);const c=t.useCallback((e,r)=>{try{typeof window<"u"&&window.sessionStorage&&window.sessionStorage.setItem("find-skills:last-query",r??"")}catch{}if(o(!1),i)try{i(e,r)}catch{}},[i]);return n?d.jsx("div",{"data-testid":"find-skills-palette-shell","data-reduced-motion":a?"true":"false",children:d.jsx(t.Suspense,{fallback:null,children:d.jsx(f,{initialOpen:!0,onSelect:c,onNavigate:u})})}):null}export{y as FindSkillsPalette,y as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,j as t,h as xe}from"./index-vzRnBcdU.js";import{a as ye}from"./skill-url-C4ekwoGs.js";/* empty css */function me(i){return i?i.replace(/<(?!\/?b>)[^>]+>/gi,""):""}function be(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ie(i,p){if(!i)return"";const d=be(i);if(!p)return d;const u=p.trim().split(/\s+/).filter(Boolean);if(u.length===0)return d;const T=u.map(W=>W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),b=new RegExp(`(${T})`,"gi");return d.replace(b,"<b>$1</b>")}function ve(i){return i?i<1e3?String(i):`${(i/1e3).toFixed(1)}k`:""}const ke=[{label:"Security",href:"/skills?category=security"},{label:"Coding",href:"/skills?category=development"},{label:"DevOps",href:"/skills?category=devops"},{label:"Testing",href:"/skills?category=testing"},{label:"Data",href:"/skills?category=data"},{label:"Design",href:"/skills?category=design"}],Se=[{label:"Submit a skill",href:"/submit"},{label:"Browse all skills",href:"/skills"}],J="var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif)",c="var(--font-mono, 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace)";function Ee({tier:i,isTainted:p,isBlocked:d}){const u={display:"inline-flex",alignItems:"center",padding:"1px 6px",height:16,borderRadius:3,fontFamily:c,fontSize:9.5,fontWeight:600,letterSpacing:"0.04em",whiteSpace:"nowrap",lineHeight:1,textTransform:"uppercase"};if(d)return t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":"BLOCKED",style:{...u,color:"#7A1F1F",background:"#FBE8E5",border:"1px solid #E8B7B0"},children:"BLOCKED"});if(p)return t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":"TAINTED",style:{...u,color:"#7A4A00",background:"#FBEFD3",border:"1px solid #E8C885"},children:"Tainted"});const b={CERTIFIED:{color:"var(--color-installed, #2F6A4A)",bg:"rgba(47,106,74,0.08)",border:"rgba(47,106,74,0.25)"},VERIFIED:{color:"var(--color-focus, #3B6EA8)",bg:"rgba(59,110,168,0.08)",border:"rgba(59,110,168,0.25)"},REJECTED:{color:"#7A1F1F",bg:"#FBE8E5",border:"#E8B7B0"},BLOCKED:{color:"#7A1F1F",bg:"#FBE8E5",border:"#E8B7B0"}}[i];return b?t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":i,style:{...u,color:b.color,background:b.bg,border:`1px solid ${b.border}`},children:xe(i)}):null}function O(){return t.jsxs("div",{"data-testid":"skeleton-row",style:{padding:"10px 18px",display:"flex",alignItems:"center",gap:10},children:[t.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[t.jsx("div",{style:{height:12,width:"32%",borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite"}}),t.jsx("div",{style:{height:9,width:"55%",borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite",animationDelay:"0.18s"}})]}),t.jsx("div",{style:{height:14,width:52,borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite",animationDelay:"0.36s"}})]})}function Fe(i){var d,u;const p=(d=i.target)==null?void 0:d.tagName;return!!(p==="INPUT"||p==="TEXTAREA"||p==="SELECT"||(u=i.target)!=null&&u.isContentEditable)}const je="/api/v1/studio/search",we="/api/v1/stats",Ae="/api/v1/studio/telemetry/search-select",Re=10,Q=20,Ce=150;function Be({onSelect:i,onNavigate:p,searchUrl:d=je,trendingUrl:u=we,telemetrySelectUrl:T=Ae,maxPages:b=Re,initialOpen:W=!1}={}){const[L,E]=a.useState(W),[o,F]=a.useState(""),[I,h]=a.useState([]),[U,v]=a.useState(0),[j,B]=a.useState(!1),[_,w]=a.useState(1),[H,x]=a.useState(!1),[M,V]=a.useState(!1),[$,k]=a.useState(null),[A,R]=a.useState(!1),Z=a.useRef(null),N=a.useRef(null),z=a.useRef(!1),ee=a.useRef(null),te=a.useRef(null),q=a.useRef(new Map),S=a.useRef(null),[,ue]=a.useState(!1),re=a.useMemo(()=>typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform||""),[]),K=a.useRef(o);a.useEffect(()=>{K.current=o},[o]),a.useEffect(()=>{S.current||fetch(u).then(e=>e.json()).then(e=>{S.current=e.trendingSkills??[],ue(!0)}).catch(()=>{})},[u]),a.useEffect(()=>{const e=r=>{if(r.key==="Escape"){E(!1);return}if(L&&(r.metaKey||r.ctrlKey)&&/^[1-9]$/.test(r.key)){r.preventDefault();const s=Number(r.key)-1;v(s),window.dispatchEvent(new CustomEvent("findSkillsActivateAt",{detail:{index:s}}));return}!r.metaKey&&!r.ctrlKey&&!r.altKey&&r.key.length===1&&!Fe(r)&&(z.current=!0,F(r.key),E(!0))},n=r=>{var y;const l=(y=r.detail)==null?void 0:y.query;l&&(z.current=!0,F(l)),E(!0)};return window.addEventListener("keydown",e),window.addEventListener("openFindSkills",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("openFindSkills",n)}},[L]),a.useLayoutEffect(()=>{var n;if(!L){(n=N.current)==null||n.abort();return}if(z.current)z.current=!1,h([]),v(0),w(1),x(!1),B(!1),k(null),R(!1);else{const r=(()=>{var s;try{return((s=window.sessionStorage)==null?void 0:s.getItem("find-skills:last-query"))??""}catch{return""}})();F(r),h([]),v(0),w(1),x(!1),B(!1),k(null),R(!1)}const e=Z.current;if(e){e.focus({preventScroll:!0});const r=e.value.length;e.setSelectionRange(r,r)}},[L]),a.useEffect(()=>{if(!o.trim()||o.trim().length<2){h([]),x(!1),w(1),k(null);return}const e=6e4,n=o.trim().toLowerCase(),r=q.current.get(n);if(r&&Date.now()-r.timestamp<e){h(r.results),x(r.hasMore),w(1),B(!1),k(null),fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=1`).then(m=>m.ok?m.json():null).then(m=>{var g;m&&q.current.set(n,{results:m.results||[],hasMore:((g=m.pagination)==null?void 0:g.hasMore)??!1,timestamp:Date.now()})}).catch(()=>{});return}B(!0),k(null);const l=new AbortController,y=setTimeout(async()=>{var m;try{const g=await fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=1`,{signal:l.signal});if(g.status>=500){R(!0),h([]),x(!1),k(null);return}if(!g.ok){h([]),x(!1),k(`search failed (${g.status})`);return}const ce=await g.json(),de=ce.results||[],pe=((m=ce.pagination)==null?void 0:m.hasMore)??!1;h(de),x(pe),w(1),R(!1),q.current.set(n,{results:de,hasMore:pe,timestamp:Date.now()})}catch(g){if(g instanceof DOMException&&g.name==="AbortError")return;R(!0),h([]),x(!1),k(null)}finally{l.signal.aborted||B(!1)}},Ce);return()=>{clearTimeout(y),l.abort()}},[o,d]);const C=_>=b,ne=a.useCallback(async()=>{var n,r;if(M||C)return;const e=_+1;V(!0),N.current=new AbortController;try{const s=await fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=${e}`,{signal:N.current.signal});if(!s.ok)return;const l=await s.json();h(y=>[...y,...l.results||[]]),x(((n=l.pagination)==null?void 0:n.hasMore)??!1),w(e)}catch(s){if(s instanceof DOMException&&s.name==="AbortError")return}finally{(r=N.current)!=null&&r.signal.aborted||V(!1)}},[_,o,M,C,d]);a.useEffect(()=>{const e=ee.current,n=te.current;if(!e||!n||typeof IntersectionObserver>"u")return;const r=new IntersectionObserver(s=>{s[0].isIntersecting&&H&&!j&&!M&&!C&&ne()},{root:n,rootMargin:"100px"});return r.observe(e),()=>r.disconnect()},[H,j,M,C,ne]);const P=e=>({name:e.name,displayName:e.displayName,author:e.author,repoUrl:e.repoUrl,certTier:e.certTier,githubStars:0,highlight:"",category:"",ownerSlug:e.ownerSlug,repoSlug:e.repoSlug,skillSlug:e.skillSlug}),G=(()=>{const e=o.trim();if(A&&e.length>=1&&S.current){const n=e.toLowerCase();return S.current.filter(r=>r.name.toLowerCase().includes(n)||(r.displayName??"").toLowerCase().includes(n)).slice(0,30).map(P)}if(e.length>=2)return I;if(e.length===1&&S.current){const n=e.toLowerCase();return S.current.filter(r=>r.name.toLowerCase().startsWith(n)||r.displayName.toLowerCase().startsWith(n)).slice(0,10).map(P)}return e.length===0&&S.current?S.current.slice(0,10).map(P):[]})(),f=[...G.map(e=>{const n=e.skillSlug||e.name.split("/").pop()||e.name,r=e.ownerSlug&&e.repoSlug?`${e.ownerSlug}/${e.repoSlug}`:e.author;return{type:"skill",label:n,publisher:r,name:e.name,command:e.command?e.pluginName?`${e.pluginName}:${e.command}`:e.command:void 0,pluginName:e.pluginName||void 0,meta:e.category||"",certTier:e.certTier,isTainted:e.isTainted,isBlocked:e.isBlocked,repoUrl:e.repoUrl,highlight:e.highlight,githubStars:e.githubStars,category:e.category,href:ye(e.name),sourceResult:e}}),...!o&&G.length===0?ke.map(e=>({type:"category",label:e.label,publisher:"",name:"",meta:"",certTier:"",repoUrl:"",href:e.href})):[],...!o&&G.length===0?Se.map(e=>({type:"action",label:e.label,publisher:"",name:"",meta:"",certTier:"",repoUrl:"",href:e.href})):[]],ae=a.useCallback(e=>{try{fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skillName:e,q:K.current.trim(),ts:Date.now()}),keepalive:!0}).catch(()=>{})}catch{}},[T]),D=a.useCallback((e,n)=>{if(n&&(ae(n.name),i))try{i(n,K.current.trim())}catch{}if(E(!1),p)try{p(e)}catch{}},[i,p,ae]);a.useEffect(()=>{function e(n){var l;const r=((l=n.detail)==null?void 0:l.index)??-1,s=f[r];s&&D(s.href,s.type==="skill"?s.sourceResult:void 0)}return window.addEventListener("findSkillsActivateAt",e),()=>window.removeEventListener("findSkillsActivateAt",e)},[f,D]);const fe=e=>{if(e.key==="ArrowDown")e.preventDefault(),v(n=>Math.min(n+1,f.length-1));else if(e.key==="ArrowUp")e.preventDefault(),v(n=>Math.max(n-1,0));else if(e.key==="Enter"&&f[U]){const n=f[U];D(n.href,n.type==="skill"?n.sourceResult:void 0)}};if(!L)return null;let ie="";const se=!j&&!$&&!A&&o.trim().length>=2&&I.length===0,Y=j&&I.length===0&&o.trim().length>=2&&!A,oe=o.trim(),le=()=>{R(!1);const e=o;F(""),setTimeout(()=>F(e),0)},ge={position:"fixed",inset:0,background:"color-mix(in srgb, var(--color-ink, #191919) 35%, transparent)",backdropFilter:"blur(6px) saturate(1.1)",WebkitBackdropFilter:"blur(6px) saturate(1.1)"},he={position:"relative",width:"100%",maxWidth:640,margin:"0 16px",background:"var(--bg-surface, #FFFFFF)",color:"var(--text-primary, #191919)",borderRadius:12,border:"1px solid var(--color-rule, #E8E1D6)",boxShadow:"0 1px 0 rgba(255,255,255,0.6) inset,0 24px 60px -12px rgba(25,20,15,0.28),0 12px 24px -8px rgba(25,20,15,0.18)",overflow:"hidden",fontFamily:J};return t.jsxs("div",{"data-testid":"find-skills-palette",role:"dialog","aria-modal":"true","aria-label":"Find verified skills",style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"min(18vh, 144px)"},onClick:()=>E(!1),children:[t.jsx("div",{style:ge}),t.jsx("style",{children:`
|
|
1
|
+
import{r as a,j as t,h as xe}from"./index-DnXSuywx.js";import{a as ye}from"./skill-url-C4ekwoGs.js";/* empty css */function me(i){return i?i.replace(/<(?!\/?b>)[^>]+>/gi,""):""}function be(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ie(i,p){if(!i)return"";const d=be(i);if(!p)return d;const u=p.trim().split(/\s+/).filter(Boolean);if(u.length===0)return d;const T=u.map(W=>W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),b=new RegExp(`(${T})`,"gi");return d.replace(b,"<b>$1</b>")}function ve(i){return i?i<1e3?String(i):`${(i/1e3).toFixed(1)}k`:""}const ke=[{label:"Security",href:"/skills?category=security"},{label:"Coding",href:"/skills?category=development"},{label:"DevOps",href:"/skills?category=devops"},{label:"Testing",href:"/skills?category=testing"},{label:"Data",href:"/skills?category=data"},{label:"Design",href:"/skills?category=design"}],Se=[{label:"Submit a skill",href:"/submit"},{label:"Browse all skills",href:"/skills"}],J="var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif)",c="var(--font-mono, 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace)";function Ee({tier:i,isTainted:p,isBlocked:d}){const u={display:"inline-flex",alignItems:"center",padding:"1px 6px",height:16,borderRadius:3,fontFamily:c,fontSize:9.5,fontWeight:600,letterSpacing:"0.04em",whiteSpace:"nowrap",lineHeight:1,textTransform:"uppercase"};if(d)return t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":"BLOCKED",style:{...u,color:"#7A1F1F",background:"#FBE8E5",border:"1px solid #E8B7B0"},children:"BLOCKED"});if(p)return t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":"TAINTED",style:{...u,color:"#7A4A00",background:"#FBEFD3",border:"1px solid #E8C885"},children:"Tainted"});const b={CERTIFIED:{color:"var(--color-installed, #2F6A4A)",bg:"rgba(47,106,74,0.08)",border:"rgba(47,106,74,0.25)"},VERIFIED:{color:"var(--color-focus, #3B6EA8)",bg:"rgba(59,110,168,0.08)",border:"rgba(59,110,168,0.25)"},REJECTED:{color:"#7A1F1F",bg:"#FBE8E5",border:"#E8B7B0"},BLOCKED:{color:"#7A1F1F",bg:"#FBE8E5",border:"#E8B7B0"}}[i];return b?t.jsx("span",{"data-testid":"mini-tier-badge","data-tier":i,style:{...u,color:b.color,background:b.bg,border:`1px solid ${b.border}`},children:xe(i)}):null}function O(){return t.jsxs("div",{"data-testid":"skeleton-row",style:{padding:"10px 18px",display:"flex",alignItems:"center",gap:10},children:[t.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[t.jsx("div",{style:{height:12,width:"32%",borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite"}}),t.jsx("div",{style:{height:9,width:"55%",borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite",animationDelay:"0.18s"}})]}),t.jsx("div",{style:{height:14,width:52,borderRadius:3,background:"var(--color-rule, #E8E1D6)",animation:"fsp-pulse 1.4s ease-in-out infinite",animationDelay:"0.36s"}})]})}function Fe(i){var d,u;const p=(d=i.target)==null?void 0:d.tagName;return!!(p==="INPUT"||p==="TEXTAREA"||p==="SELECT"||(u=i.target)!=null&&u.isContentEditable)}const je="/api/v1/studio/search",we="/api/v1/stats",Ae="/api/v1/studio/telemetry/search-select",Re=10,Q=20,Ce=150;function Be({onSelect:i,onNavigate:p,searchUrl:d=je,trendingUrl:u=we,telemetrySelectUrl:T=Ae,maxPages:b=Re,initialOpen:W=!1}={}){const[L,E]=a.useState(W),[o,F]=a.useState(""),[I,h]=a.useState([]),[U,v]=a.useState(0),[j,B]=a.useState(!1),[_,w]=a.useState(1),[H,x]=a.useState(!1),[M,V]=a.useState(!1),[$,k]=a.useState(null),[A,R]=a.useState(!1),Z=a.useRef(null),N=a.useRef(null),z=a.useRef(!1),ee=a.useRef(null),te=a.useRef(null),q=a.useRef(new Map),S=a.useRef(null),[,ue]=a.useState(!1),re=a.useMemo(()=>typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform||""),[]),K=a.useRef(o);a.useEffect(()=>{K.current=o},[o]),a.useEffect(()=>{S.current||fetch(u).then(e=>e.json()).then(e=>{S.current=e.trendingSkills??[],ue(!0)}).catch(()=>{})},[u]),a.useEffect(()=>{const e=r=>{if(r.key==="Escape"){E(!1);return}if(L&&(r.metaKey||r.ctrlKey)&&/^[1-9]$/.test(r.key)){r.preventDefault();const s=Number(r.key)-1;v(s),window.dispatchEvent(new CustomEvent("findSkillsActivateAt",{detail:{index:s}}));return}!r.metaKey&&!r.ctrlKey&&!r.altKey&&r.key.length===1&&!Fe(r)&&(z.current=!0,F(r.key),E(!0))},n=r=>{var y;const l=(y=r.detail)==null?void 0:y.query;l&&(z.current=!0,F(l)),E(!0)};return window.addEventListener("keydown",e),window.addEventListener("openFindSkills",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("openFindSkills",n)}},[L]),a.useLayoutEffect(()=>{var n;if(!L){(n=N.current)==null||n.abort();return}if(z.current)z.current=!1,h([]),v(0),w(1),x(!1),B(!1),k(null),R(!1);else{const r=(()=>{var s;try{return((s=window.sessionStorage)==null?void 0:s.getItem("find-skills:last-query"))??""}catch{return""}})();F(r),h([]),v(0),w(1),x(!1),B(!1),k(null),R(!1)}const e=Z.current;if(e){e.focus({preventScroll:!0});const r=e.value.length;e.setSelectionRange(r,r)}},[L]),a.useEffect(()=>{if(!o.trim()||o.trim().length<2){h([]),x(!1),w(1),k(null);return}const e=6e4,n=o.trim().toLowerCase(),r=q.current.get(n);if(r&&Date.now()-r.timestamp<e){h(r.results),x(r.hasMore),w(1),B(!1),k(null),fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=1`).then(m=>m.ok?m.json():null).then(m=>{var g;m&&q.current.set(n,{results:m.results||[],hasMore:((g=m.pagination)==null?void 0:g.hasMore)??!1,timestamp:Date.now()})}).catch(()=>{});return}B(!0),k(null);const l=new AbortController,y=setTimeout(async()=>{var m;try{const g=await fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=1`,{signal:l.signal});if(g.status>=500){R(!0),h([]),x(!1),k(null);return}if(!g.ok){h([]),x(!1),k(`search failed (${g.status})`);return}const ce=await g.json(),de=ce.results||[],pe=((m=ce.pagination)==null?void 0:m.hasMore)??!1;h(de),x(pe),w(1),R(!1),q.current.set(n,{results:de,hasMore:pe,timestamp:Date.now()})}catch(g){if(g instanceof DOMException&&g.name==="AbortError")return;R(!0),h([]),x(!1),k(null)}finally{l.signal.aborted||B(!1)}},Ce);return()=>{clearTimeout(y),l.abort()}},[o,d]);const C=_>=b,ne=a.useCallback(async()=>{var n,r;if(M||C)return;const e=_+1;V(!0),N.current=new AbortController;try{const s=await fetch(`${d}?q=${encodeURIComponent(o)}&limit=${Q}&page=${e}`,{signal:N.current.signal});if(!s.ok)return;const l=await s.json();h(y=>[...y,...l.results||[]]),x(((n=l.pagination)==null?void 0:n.hasMore)??!1),w(e)}catch(s){if(s instanceof DOMException&&s.name==="AbortError")return}finally{(r=N.current)!=null&&r.signal.aborted||V(!1)}},[_,o,M,C,d]);a.useEffect(()=>{const e=ee.current,n=te.current;if(!e||!n||typeof IntersectionObserver>"u")return;const r=new IntersectionObserver(s=>{s[0].isIntersecting&&H&&!j&&!M&&!C&&ne()},{root:n,rootMargin:"100px"});return r.observe(e),()=>r.disconnect()},[H,j,M,C,ne]);const P=e=>({name:e.name,displayName:e.displayName,author:e.author,repoUrl:e.repoUrl,certTier:e.certTier,githubStars:0,highlight:"",category:"",ownerSlug:e.ownerSlug,repoSlug:e.repoSlug,skillSlug:e.skillSlug}),G=(()=>{const e=o.trim();if(A&&e.length>=1&&S.current){const n=e.toLowerCase();return S.current.filter(r=>r.name.toLowerCase().includes(n)||(r.displayName??"").toLowerCase().includes(n)).slice(0,30).map(P)}if(e.length>=2)return I;if(e.length===1&&S.current){const n=e.toLowerCase();return S.current.filter(r=>r.name.toLowerCase().startsWith(n)||r.displayName.toLowerCase().startsWith(n)).slice(0,10).map(P)}return e.length===0&&S.current?S.current.slice(0,10).map(P):[]})(),f=[...G.map(e=>{const n=e.skillSlug||e.name.split("/").pop()||e.name,r=e.ownerSlug&&e.repoSlug?`${e.ownerSlug}/${e.repoSlug}`:e.author;return{type:"skill",label:n,publisher:r,name:e.name,command:e.command?e.pluginName?`${e.pluginName}:${e.command}`:e.command:void 0,pluginName:e.pluginName||void 0,meta:e.category||"",certTier:e.certTier,isTainted:e.isTainted,isBlocked:e.isBlocked,repoUrl:e.repoUrl,highlight:e.highlight,githubStars:e.githubStars,category:e.category,href:ye(e.name),sourceResult:e}}),...!o&&G.length===0?ke.map(e=>({type:"category",label:e.label,publisher:"",name:"",meta:"",certTier:"",repoUrl:"",href:e.href})):[],...!o&&G.length===0?Se.map(e=>({type:"action",label:e.label,publisher:"",name:"",meta:"",certTier:"",repoUrl:"",href:e.href})):[]],ae=a.useCallback(e=>{try{fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skillName:e,q:K.current.trim(),ts:Date.now()}),keepalive:!0}).catch(()=>{})}catch{}},[T]),D=a.useCallback((e,n)=>{if(n&&(ae(n.name),i))try{i(n,K.current.trim())}catch{}if(E(!1),p)try{p(e)}catch{}},[i,p,ae]);a.useEffect(()=>{function e(n){var l;const r=((l=n.detail)==null?void 0:l.index)??-1,s=f[r];s&&D(s.href,s.type==="skill"?s.sourceResult:void 0)}return window.addEventListener("findSkillsActivateAt",e),()=>window.removeEventListener("findSkillsActivateAt",e)},[f,D]);const fe=e=>{if(e.key==="ArrowDown")e.preventDefault(),v(n=>Math.min(n+1,f.length-1));else if(e.key==="ArrowUp")e.preventDefault(),v(n=>Math.max(n-1,0));else if(e.key==="Enter"&&f[U]){const n=f[U];D(n.href,n.type==="skill"?n.sourceResult:void 0)}};if(!L)return null;let ie="";const se=!j&&!$&&!A&&o.trim().length>=2&&I.length===0,Y=j&&I.length===0&&o.trim().length>=2&&!A,oe=o.trim(),le=()=>{R(!1);const e=o;F(""),setTimeout(()=>F(e),0)},ge={position:"fixed",inset:0,background:"color-mix(in srgb, var(--color-ink, #191919) 35%, transparent)",backdropFilter:"blur(6px) saturate(1.1)",WebkitBackdropFilter:"blur(6px) saturate(1.1)"},he={position:"relative",width:"100%",maxWidth:640,margin:"0 16px",background:"var(--bg-surface, #FFFFFF)",color:"var(--text-primary, #191919)",borderRadius:12,border:"1px solid var(--color-rule, #E8E1D6)",boxShadow:"0 1px 0 rgba(255,255,255,0.6) inset,0 24px 60px -12px rgba(25,20,15,0.28),0 12px 24px -8px rgba(25,20,15,0.18)",overflow:"hidden",fontFamily:J};return t.jsxs("div",{"data-testid":"find-skills-palette",role:"dialog","aria-modal":"true","aria-label":"Find verified skills",style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"min(18vh, 144px)"},onClick:()=>E(!1),children:[t.jsx("div",{style:ge}),t.jsx("style",{children:`
|
|
2
2
|
@keyframes fsp-pulse {
|
|
3
3
|
0%, 100% { opacity: 1; }
|
|
4
4
|
50% { opacity: 0.45; }
|