vskill 1.0.19 → 1.0.20

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.
Files changed (30) hide show
  1. package/README.md +58 -7
  2. package/agents.json +1 -1
  3. package/dist/bin.js +0 -0
  4. package/dist/commands/add-lockfile.d.ts +6 -0
  5. package/dist/commands/add-lockfile.js +10 -0
  6. package/dist/commands/add-lockfile.js.map +1 -1
  7. package/dist/commands/add.js +16 -1
  8. package/dist/commands/add.js.map +1 -1
  9. package/dist/discovery/github-tree.d.ts +23 -3
  10. package/dist/discovery/github-tree.js +172 -24
  11. package/dist/discovery/github-tree.js.map +1 -1
  12. package/dist/eval-ui/assets/{CreateSkillPage-Cv93Croj.js → CreateSkillPage-gG-MYioa.js} +5 -5
  13. package/dist/eval-ui/assets/{FindSkillsPalette-BY9DAhHh.js → FindSkillsPalette-DgVp_buC.js} +2 -2
  14. package/dist/eval-ui/assets/{SearchPaletteCore-DMVcq7UB.js → SearchPaletteCore-D2gKxOTT.js} +1 -1
  15. package/dist/eval-ui/assets/{SkillDetailPanel-B_lbhK6q.js → SkillDetailPanel-Ioc5XaDA.js} +1 -1
  16. package/dist/eval-ui/assets/{UpdateDropdown-4AbjZLpq.js → UpdateDropdown-B9rCyfnR.js} +1 -1
  17. package/dist/eval-ui/assets/{main-tpOyw9SC.js → main-sUAgJ9SV.js} +34 -34
  18. package/dist/eval-ui/index.html +1 -1
  19. package/dist/lib/github-fetch.d.ts +1 -0
  20. package/dist/lib/github-fetch.js +11 -1
  21. package/dist/lib/github-fetch.js.map +1 -1
  22. package/dist/lockfile/types.d.ts +8 -0
  23. package/dist/sidecar/eval-ui-manifest.json +1 -0
  24. package/dist/sidecar/sea-config.json +57 -0
  25. package/dist/sidecar/sea-prep.blob +0 -0
  26. package/dist/sidecar/server.cjs +141627 -0
  27. package/dist/sidecar/vskill-version.txt +1 -0
  28. package/dist/updater/source-fetcher.js +2 -2
  29. package/dist/updater/source-fetcher.js.map +1 -1
  30. package/package.json +1 -1
@@ -2,6 +2,7 @@
2
2
  // GitHub Trees API skill discovery
3
3
  // ---------------------------------------------------------------------------
4
4
  import { yellow } from "../utils/output.js";
5
+ import { createGitHubFetch, githubFetch } from "../lib/github-fetch.js";
5
6
  // ---- Rate-limit warning (deduplicated per CLI invocation) -----------------
6
7
  let rateLimitWarned = false;
7
8
  /** @internal Reset flag — for testing only */
@@ -22,6 +23,89 @@ export function warnRateLimitOnce(res) {
22
23
  rateLimitWarned = true;
23
24
  console.error(yellow("GitHub API rate limit reached. Set GITHUB_TOKEN for higher limits."));
24
25
  }
26
+ function hasOwn(obj, key) {
27
+ return Object.prototype.hasOwnProperty.call(obj, key);
28
+ }
29
+ function hasExplicitToken(options) {
30
+ return !!options && hasOwn(options, "token") && !!options.token;
31
+ }
32
+ function githubApiHeaders(token) {
33
+ const headers = {
34
+ Accept: "application/vnd.github.v3+json",
35
+ };
36
+ if (token)
37
+ headers.Authorization = `Bearer ${token}`;
38
+ return headers;
39
+ }
40
+ function mergeHeaders(base, init) {
41
+ const headers = { ...base };
42
+ if (!init)
43
+ return headers;
44
+ if (init instanceof Headers) {
45
+ init.forEach((value, key) => {
46
+ headers[key] = value;
47
+ });
48
+ return headers;
49
+ }
50
+ if (Array.isArray(init)) {
51
+ for (const [key, value] of init)
52
+ headers[key] = value;
53
+ return headers;
54
+ }
55
+ return { ...headers, ...init };
56
+ }
57
+ function branchCacheKey(owner, repo, options) {
58
+ return `${owner}/${repo}:${hasExplicitToken(options) ? "explicit-auth" : "default-auth"}`;
59
+ }
60
+ function requestGitHub(url, init = {}, options) {
61
+ const headers = mergeHeaders(githubApiHeaders(options?.token), init.headers);
62
+ const requestInit = { ...init, headers };
63
+ if (options?.fetchImpl)
64
+ return options.fetchImpl(url, requestInit);
65
+ if (options && hasOwn(options, "token")) {
66
+ return createGitHubFetch({
67
+ tokenProvider: () => options.token || null,
68
+ })(url, requestInit);
69
+ }
70
+ return githubFetch(url, requestInit);
71
+ }
72
+ export function classifyGitHubFailure(res) {
73
+ const status = res.status;
74
+ const rateRemaining = res.headers?.get("x-ratelimit-remaining");
75
+ if (status === 401 || (status === 403 && rateRemaining !== "0")) {
76
+ return {
77
+ code: "unauthorized",
78
+ status,
79
+ message: "GitHub authentication failed or the token lacks access to this repository.",
80
+ };
81
+ }
82
+ if (status === 403 && rateRemaining === "0") {
83
+ return {
84
+ code: "rate_limited",
85
+ status,
86
+ message: "GitHub API rate limit exceeded.",
87
+ };
88
+ }
89
+ if (status === 404) {
90
+ return {
91
+ code: "missing",
92
+ status,
93
+ message: "GitHub repository, branch, or skill path was not found.",
94
+ };
95
+ }
96
+ if (status === 429 || status >= 500) {
97
+ return {
98
+ code: "transient",
99
+ status,
100
+ message: `GitHub returned a transient HTTP ${status} response.`,
101
+ };
102
+ }
103
+ return {
104
+ code: "transient",
105
+ status,
106
+ message: `GitHub returned HTTP ${status}.`,
107
+ };
108
+ }
25
109
  // ---- Branch cache ---------------------------------------------------------
26
110
  /**
27
111
  * Fetch the default branch for a GitHub repo. Falls back to "main" on error.
@@ -32,16 +116,14 @@ const branchCache = new Map();
32
116
  export function _resetBranchCache() {
33
117
  branchCache.clear();
34
118
  }
35
- export async function getDefaultBranch(owner, repo) {
36
- const key = `${owner}/${repo}`;
119
+ export async function getDefaultBranch(owner, repo, options) {
120
+ const key = branchCacheKey(owner, repo, options);
37
121
  const cached = branchCache.get(key);
38
122
  if (cached)
39
123
  return cached;
40
124
  let branch = "main";
41
125
  try {
42
- const res = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {
43
- headers: { Accept: "application/vnd.github.v3+json" },
44
- });
126
+ const res = await requestGitHub(`https://api.github.com/repos/${owner}/${repo}`, {}, options);
45
127
  if (res.ok) {
46
128
  const data = (await res.json());
47
129
  branch = data.default_branch || "main";
@@ -53,15 +135,25 @@ export async function getDefaultBranch(owner, repo) {
53
135
  branchCache.set(key, branch);
54
136
  return branch;
55
137
  }
138
+ export async function getBranchHeadSha(owner, repo, branch, options) {
139
+ try {
140
+ const res = await requestGitHub(`https://api.github.com/repos/${owner}/${repo}/commits/${encodeURIComponent(branch)}`, {}, options);
141
+ if (!res.ok)
142
+ return null;
143
+ const data = (await res.json());
144
+ return typeof data.sha === "string" && data.sha ? data.sha : null;
145
+ }
146
+ catch {
147
+ return null;
148
+ }
149
+ }
56
150
  /**
57
151
  * Check whether a GitHub repo exists. Returns false only on 404.
58
152
  * Fails open on network errors or rate limits (returns true).
59
153
  */
60
- export async function checkRepoExists(owner, repo) {
154
+ export async function checkRepoExists(owner, repo, options) {
61
155
  try {
62
- const res = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {
63
- headers: { Accept: "application/vnd.github.v3+json" },
64
- });
156
+ const res = await requestGitHub(`https://api.github.com/repos/${owner}/${repo}`, {}, options);
65
157
  if (res.status === 404)
66
158
  return false;
67
159
  return true;
@@ -107,6 +199,43 @@ export function extractDescription(content) {
107
199
  }
108
200
  return undefined;
109
201
  }
202
+ function encodeRepoPath(path) {
203
+ return path
204
+ .replace(/^\/+/, "")
205
+ .split("/")
206
+ .map((segment) => encodeURIComponent(segment))
207
+ .join("/");
208
+ }
209
+ export async function fetchGitHubFileText(owner, repo, branch, path, options) {
210
+ try {
211
+ const url = `https://api.github.com/repos/${owner}/${repo}/contents/${encodeRepoPath(path)}?ref=${encodeURIComponent(branch)}`;
212
+ const res = await requestGitHub(url, {
213
+ signal: AbortSignal.timeout(10000),
214
+ headers: { Accept: "application/vnd.github+json" },
215
+ }, options);
216
+ if (!res.ok)
217
+ return null;
218
+ const data = (await res.json());
219
+ if (Array.isArray(data))
220
+ return null;
221
+ if (data.encoding === "base64" && typeof data.content === "string") {
222
+ return Buffer.from(data.content.replace(/\s/g, ""), "base64").toString("utf8");
223
+ }
224
+ if (typeof data.content === "string")
225
+ return data.content;
226
+ if (data.download_url) {
227
+ const rawRes = await requestGitHub(data.download_url, {
228
+ signal: AbortSignal.timeout(10000),
229
+ }, options);
230
+ if (rawRes.ok)
231
+ return await rawRes.text();
232
+ }
233
+ }
234
+ catch {
235
+ // File not found, timeout, or malformed GitHub payload.
236
+ }
237
+ return null;
238
+ }
110
239
  /**
111
240
  * Discover all SKILL.md files in a GitHub repo using the Trees API.
112
241
  *
@@ -120,25 +249,33 @@ export function extractDescription(content) {
120
249
  *
121
250
  * Returns empty array on any API error (caller falls back to single-skill fetch).
122
251
  */
123
- export async function discoverSkills(owner, repo) {
124
- const branch = await getDefaultBranch(owner, repo);
252
+ export async function discoverSkills(owner, repo, options) {
253
+ const result = await discoverSkillsDetailed(owner, repo, options);
254
+ return result.skills;
255
+ }
256
+ export async function discoverSkillsDetailed(owner, repo, options) {
257
+ const branch = await getDefaultBranch(owner, repo, options);
125
258
  const url = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}?recursive=1`;
126
259
  let tree;
127
260
  try {
128
- const res = await fetch(url, {
129
- headers: { Accept: "application/vnd.github.v3+json" },
130
- });
261
+ const res = await requestGitHub(url, {}, options);
131
262
  if (!res.ok) {
132
263
  warnRateLimitOnce(res);
133
- return [];
264
+ return { skills: [], error: classifyGitHubFailure(res) };
134
265
  }
135
266
  const data = (await res.json());
136
267
  if (!Array.isArray(data?.tree))
137
- return [];
268
+ return { skills: [] };
138
269
  tree = data.tree;
139
270
  }
140
271
  catch {
141
- return [];
272
+ return {
273
+ skills: [],
274
+ error: {
275
+ code: "transient",
276
+ message: "Failed to connect to GitHub.",
277
+ },
278
+ };
142
279
  }
143
280
  const skills = [];
144
281
  // Collect agents/*.md paths per skill for a second pass
@@ -219,19 +356,30 @@ export async function discoverSkills(owner, repo) {
219
356
  // Fetch descriptions in parallel with a 3s timeout per skill
220
357
  await Promise.allSettled(skills.map(async (skill) => {
221
358
  try {
222
- const controller = new AbortController();
223
- const timer = setTimeout(() => controller.abort(), 3000);
224
- const res = await fetch(skill.rawUrl, { signal: controller.signal });
225
- clearTimeout(timer);
226
- if (!res.ok)
359
+ let content = null;
360
+ if (hasExplicitToken(options)) {
361
+ content = await fetchGitHubFileText(owner, repo, branch, skill.path, options);
362
+ }
363
+ else {
364
+ const controller = new AbortController();
365
+ const timer = setTimeout(() => controller.abort(), 3000);
366
+ try {
367
+ const res = await requestGitHub(skill.rawUrl, { signal: controller.signal }, options);
368
+ if (res.ok)
369
+ content = await res.text();
370
+ }
371
+ finally {
372
+ clearTimeout(timer);
373
+ }
374
+ }
375
+ if (!content)
227
376
  return;
228
- const content = await res.text();
229
377
  skill.description = extractDescription(content);
230
378
  }
231
379
  catch {
232
380
  // Timeout or network error — leave description undefined
233
381
  }
234
382
  }));
235
- return skills;
383
+ return { skills };
236
384
  }
237
385
  //# sourceMappingURL=github-tree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"github-tree.js","sourceRoot":"","sources":["../../src/discovery/github-tree.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,mCAAmC;AACnC,8EAA8E;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,8EAA8E;AAE9E,IAAI,eAAe,GAAG,KAAK,CAAC;AAE5B,8CAA8C;AAC9C,MAAM,UAAU,qBAAqB;IACnC,eAAe,GAAG,KAAK,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAa;IAC7C,IAAI,eAAe;QAAE,OAAO;IAC5B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO;IAC/B,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,GAAG;QAAE,OAAO;IAC7D,eAAe,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,KAAK,CACX,MAAM,CAAC,oEAAoE,CAAC,CAC7E,CAAC;AACJ,CAAC;AAED,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE9C,+CAA+C;AAC/C,MAAM,UAAU,iBAAiB;IAC/B,WAAW,CAAC,KAAK,EAAE,CAAC;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yD;QAC3D,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC"}
@@ -1,8 +1,8 @@
1
- import{j as e,R as j,r as b}from"./globals-hm1COkXX.js";import{u as Z,b as X,g as B,r as D,w as ee,c as te,d as se,t as P,L as R,P as re,E as le,e as ae,S as ne}from"./main-tpOyw9SC.js";import"./useDesktopBridge-9oZFQsrw.js";/* empty css */const oe=[{key:"slashCommands",label:"Slash"},{key:"hooks",label:"Hooks"},{key:"mcp",label:"MCP"},{key:"customSystemPrompt",label:"Prompt"}];function ie({supported:r,label:a}){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:a})}function F({agent:r,checked:a,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:a?"var(--surface-2, #1e1e1e)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:a,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:oe.map(x=>e.jsx(ie,{supported:r.featureSupport[x.key],label:x.label},x.key))})]})]})}function de({agents:r,selectedIds:a,onChange:g}){const x=new Set(a),i=r.filter(n=>n.isUniversal),l=r.filter(n=>!n.isUniversal),c=n=>{const o=x.has(n)?a.filter(h=>h!==n):[...a,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))})]}),l.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:l.map(n=>e.jsx(F,{agent:n,checked:x.has(n.id),onToggle:()=>c(n.id)},n.id))})]})]})}const ce="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.",ue="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.",xe="Generate raw — no engine assistance, you provide the full SKILL.md body.";function pe(r){return[{engine:"vskill",label:"VSkill skill-builder",caption:r.vskillSkillBuilder?`installed${r.vskillVersion?` v${r.vskillVersion}`:""}`:"not installed",tooltip:ce,detected:r.vskillSkillBuilder,installable:!0},{engine:"anthropic-skill-creator",label:"Anthropic skill-creator",caption:r.anthropicSkillCreator?"installed":"not installed",tooltip:ue,detected:r.anthropicSkillCreator,installable:!0},{engine:"none",label:"No engine — generate raw",caption:"always available",tooltip:xe,detected:!0,installable:!1}]}function me(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function ge(r){const{detection:a,selected:g,onSelect:x,onInstallClick:i}=r,l=j.useMemo(()=>me(),[]),c=j.useMemo(()=>pe(a),[a]),n=l?"":"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}+`,he=`(?:-${$}(?:\\.${$})*)`,fe=`(?:\\+${z}(?:\\.${z})*)`,ve=new RegExp(`^${A}\\.${A}\\.${A}${he}?${fe}?$`);function V(r){return typeof r!="string"?!1:ve.test(r.trim())}const ye="Skill version (semver). Auto-bumps on update unless versioningMode=author.",be="Must be valid semver (e.g. 1.0.0, 2.1.3-beta.1)";function je(r){const{value:a,onChange:g,mode:x,onValidityChange:i,versionsHref:l,disabled:c}=r,[n,o]=j.useState(!1),[h,p]=j.useState(()=>V(a)),y=V(a);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:ye,value:a,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:be}),x==="update"&&l&&e.jsx("a",{"data-testid":"version-input-versions-link",href:l,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 ke(r={}){const a=r.fetchImpl??globalThis.fetch,g=r.eventSourceCtor??globalThis.EventSource,[x,i]=j.useState(E),l=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,l.current=null,i(E)},[]),o=j.useCallback(async p=>{if(!g){i({...E,status:"failure",error:"EventSource not available"});return}l.current=p,i({...E,status:"spawning"});let y;try{const u=await a("/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,a]),h=j.useCallback(async()=>{const p=l.current;p&&await o(p)},[o]);return{state:x,install:o,retry:h,reset:n}}const we={vskill:"vskill install anton-abyzov/vskill/skill-builder","anthropic-skill-creator":"claude plugin install skill-creator"},Ne={vskill:"VSkill skill-builder","anthropic-skill-creator":"Anthropic skill-creator"},Se="This runs the command in your terminal as your user. Inspect before approving.";function Ce(r){const{engine:a,onClose:g,onSuccess:x,hookOpts:i}=r,{state:l,install:c,retry:n}=ke(i),o=we[a],h=Ne[a],p=j.useRef(!1);return j.useEffect(()=>{l.status==="success"&&!p.current&&(p.current=!0,x())},[l.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]}),l.status==="idle"&&e.jsx(Le,{command:o,onCancel:g,onRun:()=>c(a)}),(l.status==="spawning"||l.status==="streaming")&&e.jsx(Ee,{command:o,liveTail:l.liveTail}),l.status==="success"&&e.jsx(Pe,{label:h,onClose:g}),l.status==="failure"&&e.jsx(Ie,{error:l.error??"Install failed",stderr:l.stderr,progress:l.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 Le(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:Se}),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 Ee(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 Pe(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 Ie(r){const[a,g]=j.useState(!1),x=r.progress.filter(l=>l.stream==="stderr").map(l=>l.line),i=x.length>0?x.join(`
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:a,onToggle:l=>g(l.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 Ae(r){return r?/API usage limits|usage limit/i.test(r)&&/regain access|reset/i.test(r):!1}function Te(r){const a=r.match(/regain access on ([^"\\]+?)(?:\s*UTC)?["\\]/i)??r.match(/regain access on ([^"\\]+)/i);return a?`Resets ${a[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:a="currentColor"}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:a,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 Be(){const{config:r}=Z(),{refreshSkills:a,revealSkill:g}=X(),[x,i]=b.useState(null),l=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(()=>B("activeAgent",null));b.useEffect(()=>{function s(){K(B("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=D().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=D().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)=>{ee("skillGenModel",{provider:s,model:d}),y(!0)},[]),q=b.useCallback(()=>({provider:c,model:o}),[c,o]),Q=l.mode==="standalone"?3:void 0,{flushBySkillName:J}=te(),t=se({onCreated:(s,d)=>{a(),setTimeout(()=>g(s,d),500)},resolveAiConfigOverride:q,forceLayout:Q,flushPendingForSkillName:J});b.useEffect(()=>{l.skillName&&!t.name&&t.setName(P(l.skillName)),l.description&&!t.description&&t.setDescription(l.description),l.description&&!t.aiPrompt&&t.setAiPrompt(l.description),l.pluginName&&!t.plugin&&t.setPlugin(P(l.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
- `)},[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(ge,{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.
1
+ import{j as e,R as b,r as v}from"./globals-hm1COkXX.js";import{o as Z,u as X,b as ee,g as B,r as F,w as te,c as se,d as re,t as P,L as R,P as le,E as ae,e as ne,S as ie}from"./main-sUAgJ9SV.js";import"./useDesktopBridge-9oZFQsrw.js";/* empty css */const oe=[{key:"slashCommands",label:"Slash"},{key:"hooks",label:"Hooks"},{key:"mcp",label:"MCP"},{key:"customSystemPrompt",label:"Prompt"}];function de({supported:r,label:n}){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:n})}function D({agent:r,checked:n,onToggle:f}){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:n?"var(--surface-2, #1e1e1e)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:n,onChange:f,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:oe.map(i=>e.jsx(de,{supported:r.featureSupport[i.key],label:i.label},i.key))})]})]})}function ce({agents:r,selectedIds:n,onChange:f}){const i=new Set(n),x=r.filter(a=>a.isUniversal),l=r.filter(a=>!a.isUniversal),p=a=>{const d=i.has(a)?n.filter(c=>c!==a):[...n,a];f(d)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[x.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:x.map(a=>e.jsx(D,{agent:a,checked:i.has(a.id),onToggle:()=>p(a.id)},a.id))})]}),l.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:l.map(a=>e.jsx(D,{agent:a,checked:i.has(a.id),onToggle:()=>p(a.id)},a.id))})]})]})}const ue="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.",xe="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.",pe="Generate raw — no engine assistance, you provide the full SKILL.md body.";function me(r){return[{engine:"vskill",label:"VSkill skill-builder",caption:r.vskillSkillBuilder?`installed${r.vskillVersion?` v${r.vskillVersion}`:""}`:"not installed",tooltip:ue,detected:r.vskillSkillBuilder,installable:!0},{engine:"anthropic-skill-creator",label:"Anthropic skill-creator",caption:r.anthropicSkillCreator?"installed":"not installed",tooltip:xe,detected:r.anthropicSkillCreator,installable:!0},{engine:"none",label:"No engine — generate raw",caption:"always available",tooltip:pe,detected:!0,installable:!1}]}function ge(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function he(r){const{detection:n,selected:f,onSelect:i,onInstallClick:x}=r,l=b.useMemo(()=>ge(),[]),p=b.useMemo(()=>me(n),[n]),a=l?"":"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:p.map(d=>{const c=f===d.engine,k=!d.detected&&d.installable,h=["flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm cursor-pointer",a,c?"border-blue-600 bg-blue-50":"border-gray-300 bg-white hover:border-gray-400"].filter(Boolean).join(" "),u=d.detected?{}:{opacity:.6};return e.jsxs("div",{role:"tab",tabIndex:0,"data-testid":`engine-selector-${d.engine}`,"aria-selected":c?"true":"false",title:d.tooltip,style:u,className:h,onClick:()=>i(d.engine),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),i(d.engine))},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-gray-900",children:d.label}),e.jsx("span",{className:"text-xs text-gray-500",children:d.caption})]}),k&&e.jsx("button",{type:"button","data-testid":`install-${d.engine}`,className:"rounded border border-blue-600 px-2 py-1 text-xs font-medium text-blue-700 hover:bg-blue-100",onClick:g=>{g.stopPropagation(),x(d.engine)},children:"Install"})]},d.engine)})})]})}const A="(?:0|[1-9]\\d*)",H="[0-9A-Za-z-]",$=`(?:${A}|\\d*[A-Za-z-]${H}*)`,z=`${H}+`,fe=`(?:-${$}(?:\\.${$})*)`,ye=`(?:\\+${z}(?:\\.${z})*)`,ve=new RegExp(`^${A}\\.${A}\\.${A}${fe}?${ye}?$`);function V(r){return typeof r!="string"?!1:ve.test(r.trim())}const be="Skill version (semver). Auto-bumps on update unless versioningMode=author.",je="Must be valid semver (e.g. 1.0.0, 2.1.3-beta.1)";function ke(r){const{value:n,onChange:f,mode:i,onValidityChange:x,versionsHref:l,disabled:p}=r,[a,d]=b.useState(!1),[c,k]=b.useState(()=>V(n)),h=V(n);b.useEffect(()=>{h!==c?(k(h),x==null||x(h)):x&&x(h)},[h]);const u=a&&!h,g=["w-full rounded-md border px-3 py-2 text-sm font-mono",u?"border-red-500 bg-red-50 focus:outline-red-600":"border-gray-300 bg-white focus:outline-blue-600",p?"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:be,value:n,onChange:m=>f(m.currentTarget.value),onBlur:()=>d(!0),"aria-invalid":u?"true":"false","aria-describedby":u?"version-input-helper":void 0,disabled:p,className:g,placeholder:"1.0.0"}),u&&e.jsx("span",{id:"version-input-helper","data-testid":"version-input-helper",className:"text-xs text-red-600",role:"alert",children:je}),i==="update"&&l&&e.jsx("a",{"data-testid":"version-input-versions-link",href:l,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 we(r={}){const n=r.fetchImpl??globalThis.fetch,[f,i]=b.useState(E),x=b.useRef(null),l=b.useRef(null);b.useEffect(()=>()=>{var c;(c=l.current)==null||c.close()},[]);const p=b.useCallback(()=>{var c;(c=l.current)==null||c.close(),l.current=null,x.current=null,i(E)},[]),a=b.useCallback(async c=>{x.current=c,i({...E,status:"spawning"});let k;try{const u=await n("/api/studio/install-engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engine:c})});if(!u.ok){const m=await u.json().catch(()=>({}));i({...E,status:"failure",error:m.remediation??m.error??`HTTP ${u.status}`});return}k=(await u.json()).jobId}catch(u){i({...E,status:"failure",error:u.message});return}let h;h=Z(`/api/studio/install-engine/${k}/stream`,{fetchImpl:n,timeoutMessage:"install-engine SSE stream timed out",onEvent:({event:u,data:g})=>{if(u==="progress"){try{const m=JSON.parse(g);i(S=>({...S,liveTail:m.line.length>60?m.line.slice(0,60)+"…":m.line,progress:[...S.progress,m].slice(-200)}))}catch{}return}if(u==="done")try{const m=JSON.parse(g);h.close(),l.current=null,i(S=>({...S,status:m.success?"success":"failure",exitCode:m.exitCode,stderr:m.stderr,error:m.success?null:m.stderr||`exit ${m.exitCode}`}))}catch{h.close(),l.current=null,i(m=>({...m,status:"failure",error:"malformed done event"}))}},onError:u=>{l.current=null,i(g=>({...g,status:g.status==="streaming"?"failure":g.status,error:g.error??u.message}))}}),l.current=h,i(u=>({...u,status:"streaming"}))},[n]),d=b.useCallback(async()=>{const c=x.current;c&&await a(c)},[a]);return{state:f,install:a,retry:d,reset:p}}const Ne={vskill:"vskill install anton-abyzov/vskill/skill-builder","anthropic-skill-creator":"claude plugin install skill-creator"},Se={vskill:"VSkill skill-builder","anthropic-skill-creator":"Anthropic skill-creator"},Ce="This runs the command in your terminal as your user. Inspect before approving.";function Le(r){const{engine:n,onClose:f,onSuccess:i,hookOpts:x}=r,{state:l,install:p,retry:a}=we(x),d=Ne[n],c=Se[n],k=b.useRef(!1);return b.useEffect(()=>{l.status==="success"&&!k.current&&(k.current=!0,i())},[l.status,i]),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 ",c]}),l.status==="idle"&&e.jsx(Ee,{command:d,onCancel:f,onRun:()=>p(n)}),(l.status==="spawning"||l.status==="streaming")&&e.jsx(Pe,{command:d,liveTail:l.liveTail}),l.status==="success"&&e.jsx(Ie,{label:c,onClose:f}),l.status==="failure"&&e.jsx(Ae,{error:l.error??"Install failed",stderr:l.stderr,progress:l.progress,onRetry:()=>a(),onClose:f})]})})}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 Ee(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:Ce}),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 Pe(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 Ie(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 Ae(r){const[n,f]=b.useState(!1),i=r.progress.filter(l=>l.stream==="stderr").map(l=>l.line),x=i.length>0?i.join(`
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}),x&&e.jsxs("details",{className:"mt-3 text-xs",open:n,onToggle:l=>f(l.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:x})]}),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 N={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Te(r){return r?/API usage limits|usage limit/i.test(r)&&/regain access|reset/i.test(r):!1}function Re(r){const n=r.match(/regain access on ([^"\\]+?)(?:\s*UTC)?["\\]/i)??r.match(/regain access on ([^"\\]+)/i);return n?`Resets ${n[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:n="currentColor"}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:n,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 Fe(){const{config:r}=X(),{refreshSkills:n,revealSkill:f}=ee(),[i,x]=v.useState(null),l=b.useMemo(()=>{if(typeof window>"u")return{};const s=window.location.hash,o=s.indexOf("?");if(o===-1)return{};const w=new URLSearchParams(s.slice(o+1)),j={};for(const y of["mode","skillName","description","pluginName"]){const L=w.get(y);L&&(j[y]=L)}return j},[]),[p,a]=v.useState("claude-cli"),[d,c]=v.useState("sonnet"),[k,h]=v.useState(!1),[u,g]=v.useState(null),m=v.useRef(!1),[S,W]=v.useState([]),[U,K]=v.useState(()=>B("activeAgent",null));v.useEffect(()=>{function s(){K(B("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";v.useEffect(()=>{fetch("/api/agents/installed").then(s=>s.json()).then(s=>{s.agents&&W(s.agents)}).catch(()=>{})},[]),v.useEffect(()=>{var j;if(!r)return;const s=r.providers.filter(y=>y.available),o=F().skillGenModel;if(s.length===0){m.current=!0;return}if(o&&typeof o=="object"&&typeof o.provider=="string"&&typeof o.model=="string"){const y=s.find(T=>T.id===o.provider),L=y==null?void 0:y.models.some(T=>T.id===o.model);if(y&&L){a(o.provider),c(o.model),h(!0),m.current=!0;return}g({provider:o.provider,model:o.model})}if(s.find(y=>y.id==="claude-cli"))a("claude-cli"),c("sonnet");else{const y=s[0];a(y.id),c(((j=y.models[0])==null?void 0:j.id)??"")}h(!1),m.current=!0},[r]),v.useEffect(()=>{const s=o=>{if(o.key!==null&&!o.key.includes("vskill.studio.prefs"))return;const j=F().skillGenModel;j&&typeof j=="object"&&typeof j.provider=="string"&&typeof j.model=="string"&&(a(j.provider),c(j.model),h(!0))};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[]);const O=v.useCallback((s,o)=>{te("skillGenModel",{provider:s,model:o}),h(!0)},[]),q=v.useCallback(()=>({provider:p,model:d}),[p,d]),Q=l.mode==="standalone"?3:void 0,{flushBySkillName:J}=se(),t=re({onCreated:(s,o)=>{n(),setTimeout(()=>f(s,o),500)},resolveAiConfigOverride:q,forceLayout:Q,flushPendingForSkillName:J});v.useEffect(()=>{l.skillName&&!t.name&&t.setName(P(l.skillName)),l.description&&!t.description&&t.setDescription(l.description),l.description&&!t.aiPrompt&&t.setAiPrompt(l.description),l.pluginName&&!t.plugin&&t.setPlugin(P(l.pluginName))},[]);const C=r==null?void 0:r.providers.find(s=>s.id===p&&s.available),_=v.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
+ `)},[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(he,{detection:t.engineDetection,selected:t.engine,onSelect:s=>t.setEngine(s),onInstallClick:s=>x(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
 
5
- Include any specific behaviors, constraints, or output formats you want.`,rows:6,disabled:t.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...S,minHeight:"140px"},onKeyDown:s=>{s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),t.handleGenerate())}}),e.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),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("span",{children:"Source Model"}),!p&&c==="claude-cli"&&o==="sonnet"&&e.jsx("span",{className:"text-[10px] font-normal uppercase tracking-wider px-1.5 py-0.5 rounded",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"Default"})]}),f&&e.jsxs("div",{role:"status",className:"mb-3 px-3 py-2 rounded-lg text-[12px] flex items-center justify-between gap-3",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:[e.jsxs("span",{children:["Previous selection ",e.jsxs("code",{children:[f.provider,"/",f.model]})," unavailable — reverted to default."]}),e.jsx("button",{onClick:()=>u(null),className:"text-[11px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},"aria-label":"Dismiss notice",children:"✕"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",title:C?void 0:"Install a provider (Ollama / LM Studio / OpenRouter) or run `claude login` to enable model selection.",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),e.jsx("select",{value:c,onChange:s=>{var v;const d=s.target.value;n(d);const N=r==null?void 0:r.providers.find(L=>L.id===d),k=((v=N==null?void 0:N.models[0])==null?void 0:v.id)??o;N!=null&&N.models[0]&&h(k),O(d,k)},disabled:t.generating||!C,title:C?I(c)||void 0:"Install a provider (Ollama / LM Studio / OpenRouter) or run `claude login` to enable model selection.",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S,children:r==null?void 0:r.providers.filter(s=>s.available).map(s=>e.jsx("option",{value:s.id,title:I(s.id),children:s.label},s.id))}),I(c)&&e.jsxs("div",{className:"mt-1.5 text-[11px]",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:[I(c),c==="claude-cli"&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:"https://claude.com/settings/usage",target:"_blank",rel:"noreferrer",style:{color:"var(--color-accent, #2f6f8f)",textDecoration:"underline"},children:"Enable extra usage →"})]})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Model"}),e.jsx("select",{value:o,onChange:s=>{const d=s.target.value;h(d),O(c,d)},disabled:t.generating||!C,className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S,children:C==null?void 0:C.models.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))})]})]})]}),Y&&w.length>0&&e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Target Agents",e.jsx("span",{className:"text-[11px] font-normal ml-2",style:{color:"var(--text-tertiary)"},children:"(optional — leave empty for Claude Code default)"})]}),e.jsx(de,{agents:w,selectedIds:t.targetAgents,onChange:t.setTargetAgents})]}),t.generating&&t.aiProgress.length>0&&e.jsx("div",{children:e.jsx(re,{entries:t.aiProgress,isRunning:!0})}),t.aiError&&e.jsx("div",{children:Ae(t.aiError)?e.jsxs("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--yellow-muted)",color:"var(--text-primary)",border:"1px solid var(--yellow)"},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Your Claude Code session quota is exhausted"}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",lineHeight:1.5,marginBottom:8},children:[Te(t.aiError),". Switch to another provider (Anthropic API, OpenRouter, or a local model) or enable extra usage to continue past your monthly quota."]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("a",{href:"https://claude.com/settings/usage",target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",padding:"4px 10px",fontSize:12,fontWeight:500,color:"var(--color-paper, #fff)",background:"var(--color-accent, #2f6f8f)",borderRadius:4,textDecoration:"none"},children:"Enable extra usage →"}),e.jsx("button",{onClick:t.clearAiError,style:{padding:"4px 10px",fontSize:12,color:"var(--text-primary)",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,cursor:"pointer"},children:"Dismiss"})]})]}):t.aiClassifiedError?e.jsx(le,{error:t.aiClassifiedError,onRetry:t.handleGenerate,onDismiss:t.clearAiError}):e.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:t.aiError})}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.generating?e.jsx("button",{onClick:t.handleCancelGenerate,className:"px-6 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:"Cancel Generation"}):e.jsxs("button",{onClick:t.handleGenerate,disabled:!t.aiPrompt.trim(),className:"px-6 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:t.aiPrompt.trim()?"var(--color-action, #2F5B8E)":"var(--surface-3)",color:t.aiPrompt.trim()?"var(--color-action-ink, #FFFFFF)":"var(--text-tertiary)",cursor:t.aiPrompt.trim()?"pointer":"not-allowed"},children:[e.jsx(M,{size:14})," Generate Skill"]}),e.jsx(R,{to:"/",className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)"},children:"Cancel"})]})]}),e.jsx("div",{className:"w-full lg:w-[340px] lg:flex-shrink-0 min-w-0",children:e.jsx("div",{className:"lg:sticky lg:top-8",children:e.jsxs("div",{className:"glass-card p-4",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"SKILL.md Preview"}),e.jsx("pre",{className:"text-[11px] font-mono leading-relaxed overflow-auto max-h-[500px] p-3 rounded-lg",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:_})]})})})]}),!t.layoutLoading&&t.layout&&t.mode==="manual"&&e.jsx("div",{className:"animate-fade-in",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",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("div",{className:"flex items-center justify-between flex-wrap gap-2 mb-3",children:[e.jsx("h3",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Location"}),t.standaloneLocked&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium px-2 py-1 rounded-md whitespace-nowrap",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"1px solid var(--accent-muted)"},title:"You chose Standalone in the previous step. To change, go back and pick a different destination.",children:[e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Standalone skill"]})]}),t.standaloneLocked?e.jsxs("p",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:["Lives at ",e.jsxs("code",{style:{fontFamily:"var(--font-mono)",fontSize:11},children:["<project>/skills/","<name>","/SKILL.md"]})," — works with every agent. No plugin selected."]}):e.jsxs(e.Fragment,{children:[t.creatableLayouts.length>1&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.creatableLayouts.map(s=>e.jsx("button",{onClick:()=>{t.setSelectedLayout(s.layout);const d=s.existingPlugins[0];t.setPlugin(d||""),t.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150 whitespace-nowrap",style:{background:t.selectedLayout===s.layout?"var(--accent)":"var(--surface-3)",color:t.selectedLayout===s.layout?"var(--color-paper)":"var(--text-secondary)",border:`1px solid ${t.selectedLayout===s.layout?"var(--accent)":"var(--border-subtle)"}`},children:s.label},s.layout)),!t.creatableLayouts.find(s=>s.layout===3)&&e.jsx("button",{onClick:()=>{t.setSelectedLayout(3),t.setPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150 whitespace-nowrap",style:{background:t.selectedLayout===3?"var(--accent)":"var(--surface-3)",color:t.selectedLayout===3?"var(--color-paper)":"var(--text-secondary)",border:`1px solid ${t.selectedLayout===3?"var(--accent)":"var(--border-subtle)"}`},children:"Root skills/"})]})]}),t.selectedLayout!==3&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),e.jsxs("select",{value:t.plugin,onChange:s=>{t.setPlugin(s.target.value),t.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S,children:[t.availablePlugins.map(s=>e.jsx("option",{value:s,children:s},s)),e.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),t.plugin==="__new__"&&e.jsx("input",{type:"text",value:t.newPlugin,onChange:s=>t.setNewPlugin(P(s.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:S})]})]}),e.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono overflow-x-auto",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)",wordBreak:"break-all",overflowWrap:"anywhere",lineHeight:1.55},children:t.pathPreview})]}),!t.standaloneLocked&&t.showPluginRecommendation&&t.pluginLayoutInfo&&t.selectedLayout===3&&e.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",style:{background:"var(--accent-muted)",color:"var(--text-secondary)",border:"1px solid var(--accent-muted)"},children:[e.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),e.jsxs("span",{children:["Plugins detected (",e.jsx("strong",{children:t.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:t.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"var(--accent)",color:"var(--color-paper)",border:"none",cursor:"pointer"},children:"Use plugin"}),e.jsx("button",{onClick:()=>t.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsxs("div",{className:"glass-card p-5",children:[e.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:["Name ",e.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),e.jsx("input",{type:"text",value:t.name,onChange:s=>t.setName(P(s.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S})]}),e.jsx("div",{className:"mb-4",children:e.jsx(je,{value:t.version,onChange:t.setVersion,onValidityChange:t.setVersionValid,mode:"create"})}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:["Description ",e.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),e.jsx("textarea",{value:t.description,onChange:s=>t.setDescription(s.target.value),placeholder:"Brief description — used for auto-activation keywords",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...S,minHeight:"72px"}}),e.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"This text is used by Claude to decide when to activate the skill"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Model"}),e.jsxs("select",{value:t.model,onChange:s=>t.setModel(s.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S,children:[e.jsx("option",{value:"",children:"Any (default)"}),e.jsx("option",{value:"opus",children:"Opus"}),e.jsx("option",{value:"sonnet",children:"Sonnet"}),e.jsx("option",{value:"haiku",children:"Haiku"})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),e.jsx("input",{type:"text",value:t.allowedTools,onChange:s=>t.setAllowedTools(s.target.value),placeholder:"Read, Write, Edit, Bash, Glob, Grep",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:S})]})]})]}),e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),e.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),e.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(s=>e.jsxs("button",{onClick:()=>t.setBodyViewMode(s),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:t.bodyViewMode===s?"var(--surface-4)":"transparent",color:t.bodyViewMode===s?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:t.bodyViewMode===s?600:400,border:"none",cursor:"pointer"},children:[s==="write"?e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]}):e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),e.jsx("span",{children:s==="write"?"Write":"Preview"})]},s))})]}),t.bodyViewMode==="write"?e.jsx("textarea",{value:t.body,onChange:s=>t.setBody(s.target.value),placeholder:`# /my-skill
5
+ Include any specific behaviors, constraints, or output formats you want.`,rows:6,disabled:t.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...N,minHeight:"140px"},onKeyDown:s=>{s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),t.handleGenerate())}}),e.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),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("span",{children:"Source Model"}),!k&&p==="claude-cli"&&d==="sonnet"&&e.jsx("span",{className:"text-[10px] font-normal uppercase tracking-wider px-1.5 py-0.5 rounded",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"Default"})]}),u&&e.jsxs("div",{role:"status",className:"mb-3 px-3 py-2 rounded-lg text-[12px] flex items-center justify-between gap-3",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:[e.jsxs("span",{children:["Previous selection ",e.jsxs("code",{children:[u.provider,"/",u.model]})," unavailable — reverted to default."]}),e.jsx("button",{onClick:()=>g(null),className:"text-[11px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},"aria-label":"Dismiss notice",children:"✕"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",title:C?void 0:"Install a provider (Ollama / LM Studio / OpenRouter) or run `claude login` to enable model selection.",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),e.jsx("select",{value:p,onChange:s=>{var y;const o=s.target.value;a(o);const w=r==null?void 0:r.providers.find(L=>L.id===o),j=((y=w==null?void 0:w.models[0])==null?void 0:y.id)??d;w!=null&&w.models[0]&&c(j),O(o,j)},disabled:t.generating||!C,title:C?I(p)||void 0:"Install a provider (Ollama / LM Studio / OpenRouter) or run `claude login` to enable model selection.",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N,children:r==null?void 0:r.providers.filter(s=>s.available).map(s=>e.jsx("option",{value:s.id,title:I(s.id),children:s.label},s.id))}),I(p)&&e.jsxs("div",{className:"mt-1.5 text-[11px]",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:[I(p),p==="claude-cli"&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:"https://claude.com/settings/usage",target:"_blank",rel:"noreferrer",style:{color:"var(--color-accent, #2f6f8f)",textDecoration:"underline"},children:"Enable extra usage →"})]})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Model"}),e.jsx("select",{value:d,onChange:s=>{const o=s.target.value;c(o),O(p,o)},disabled:t.generating||!C,className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N,children:C==null?void 0:C.models.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))})]})]})]}),Y&&S.length>0&&e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Target Agents",e.jsx("span",{className:"text-[11px] font-normal ml-2",style:{color:"var(--text-tertiary)"},children:"(optional — leave empty for Claude Code default)"})]}),e.jsx(ce,{agents:S,selectedIds:t.targetAgents,onChange:t.setTargetAgents})]}),t.generating&&t.aiProgress.length>0&&e.jsx("div",{children:e.jsx(le,{entries:t.aiProgress,isRunning:!0})}),t.aiError&&e.jsx("div",{children:Te(t.aiError)?e.jsxs("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--yellow-muted)",color:"var(--text-primary)",border:"1px solid var(--yellow)"},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Your Claude Code session quota is exhausted"}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",lineHeight:1.5,marginBottom:8},children:[Re(t.aiError),". Switch to another provider (Anthropic API, OpenRouter, or a local model) or enable extra usage to continue past your monthly quota."]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("a",{href:"https://claude.com/settings/usage",target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",padding:"4px 10px",fontSize:12,fontWeight:500,color:"var(--color-paper, #fff)",background:"var(--color-accent, #2f6f8f)",borderRadius:4,textDecoration:"none"},children:"Enable extra usage →"}),e.jsx("button",{onClick:t.clearAiError,style:{padding:"4px 10px",fontSize:12,color:"var(--text-primary)",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,cursor:"pointer"},children:"Dismiss"})]})]}):t.aiClassifiedError?e.jsx(ae,{error:t.aiClassifiedError,onRetry:t.handleGenerate,onDismiss:t.clearAiError}):e.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:t.aiError})}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.generating?e.jsx("button",{onClick:t.handleCancelGenerate,className:"px-6 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:"Cancel Generation"}):e.jsxs("button",{onClick:t.handleGenerate,disabled:!t.aiPrompt.trim(),className:"px-6 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:t.aiPrompt.trim()?"var(--color-action, #2F5B8E)":"var(--surface-3)",color:t.aiPrompt.trim()?"var(--color-action-ink, #FFFFFF)":"var(--text-tertiary)",cursor:t.aiPrompt.trim()?"pointer":"not-allowed"},children:[e.jsx(M,{size:14})," Generate Skill"]}),e.jsx(R,{to:"/",className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)"},children:"Cancel"})]})]}),e.jsx("div",{className:"w-full lg:w-[340px] lg:flex-shrink-0 min-w-0",children:e.jsx("div",{className:"lg:sticky lg:top-8",children:e.jsxs("div",{className:"glass-card p-4",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"SKILL.md Preview"}),e.jsx("pre",{className:"text-[11px] font-mono leading-relaxed overflow-auto max-h-[500px] p-3 rounded-lg",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:_})]})})})]}),!t.layoutLoading&&t.layout&&t.mode==="manual"&&e.jsx("div",{className:"animate-fade-in",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",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("div",{className:"flex items-center justify-between flex-wrap gap-2 mb-3",children:[e.jsx("h3",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Location"}),t.standaloneLocked&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-medium px-2 py-1 rounded-md whitespace-nowrap",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"1px solid var(--accent-muted)"},title:"You chose Standalone in the previous step. To change, go back and pick a different destination.",children:[e.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Standalone skill"]})]}),t.standaloneLocked?e.jsxs("p",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)",lineHeight:1.5},children:["Lives at ",e.jsxs("code",{style:{fontFamily:"var(--font-mono)",fontSize:11},children:["<project>/skills/","<name>","/SKILL.md"]})," — works with every agent. No plugin selected."]}):e.jsxs(e.Fragment,{children:[t.creatableLayouts.length>1&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.creatableLayouts.map(s=>e.jsx("button",{onClick:()=>{t.setSelectedLayout(s.layout);const o=s.existingPlugins[0];t.setPlugin(o||""),t.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150 whitespace-nowrap",style:{background:t.selectedLayout===s.layout?"var(--accent)":"var(--surface-3)",color:t.selectedLayout===s.layout?"var(--color-paper)":"var(--text-secondary)",border:`1px solid ${t.selectedLayout===s.layout?"var(--accent)":"var(--border-subtle)"}`},children:s.label},s.layout)),!t.creatableLayouts.find(s=>s.layout===3)&&e.jsx("button",{onClick:()=>{t.setSelectedLayout(3),t.setPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150 whitespace-nowrap",style:{background:t.selectedLayout===3?"var(--accent)":"var(--surface-3)",color:t.selectedLayout===3?"var(--color-paper)":"var(--text-secondary)",border:`1px solid ${t.selectedLayout===3?"var(--accent)":"var(--border-subtle)"}`},children:"Root skills/"})]})]}),t.selectedLayout!==3&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),e.jsxs("select",{value:t.plugin,onChange:s=>{t.setPlugin(s.target.value),t.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N,children:[t.availablePlugins.map(s=>e.jsx("option",{value:s,children:s},s)),e.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),t.plugin==="__new__"&&e.jsx("input",{type:"text",value:t.newPlugin,onChange:s=>t.setNewPlugin(P(s.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:N})]})]}),e.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono overflow-x-auto",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)",wordBreak:"break-all",overflowWrap:"anywhere",lineHeight:1.55},children:t.pathPreview})]}),!t.standaloneLocked&&t.showPluginRecommendation&&t.pluginLayoutInfo&&t.selectedLayout===3&&e.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",style:{background:"var(--accent-muted)",color:"var(--text-secondary)",border:"1px solid var(--accent-muted)"},children:[e.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),e.jsxs("span",{children:["Plugins detected (",e.jsx("strong",{children:t.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:t.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"var(--accent)",color:"var(--color-paper)",border:"none",cursor:"pointer"},children:"Use plugin"}),e.jsx("button",{onClick:()=>t.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsxs("div",{className:"glass-card p-5",children:[e.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:["Name ",e.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),e.jsx("input",{type:"text",value:t.name,onChange:s=>t.setName(P(s.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N})]}),e.jsx("div",{className:"mb-4",children:e.jsx(ke,{value:t.version,onChange:t.setVersion,onValidityChange:t.setVersionValid,mode:"create"})}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:["Description ",e.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),e.jsx("textarea",{value:t.description,onChange:s=>t.setDescription(s.target.value),placeholder:"Brief description — used for auto-activation keywords",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...N,minHeight:"72px"}}),e.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"This text is used by Claude to decide when to activate the skill"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Model"}),e.jsxs("select",{value:t.model,onChange:s=>t.setModel(s.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N,children:[e.jsx("option",{value:"",children:"Any (default)"}),e.jsx("option",{value:"opus",children:"Opus"}),e.jsx("option",{value:"sonnet",children:"Sonnet"}),e.jsx("option",{value:"haiku",children:"Haiku"})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),e.jsx("input",{type:"text",value:t.allowedTools,onChange:s=>t.setAllowedTools(s.target.value),placeholder:"Read, Write, Edit, Bash, Glob, Grep",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:N})]})]})]}),e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),e.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),e.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(s=>e.jsxs("button",{onClick:()=>t.setBodyViewMode(s),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:t.bodyViewMode===s?"var(--surface-4)":"transparent",color:t.bodyViewMode===s?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:t.bodyViewMode===s?600:400,border:"none",cursor:"pointer"},children:[s==="write"?e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]}):e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),e.jsx("span",{children:s==="write"?"Write":"Preview"})]},s))})]}),t.bodyViewMode==="write"?e.jsx("textarea",{value:t.body,onChange:s=>t.setBody(s.target.value),placeholder:`# /my-skill
6
6
 
7
7
  You are an expert at...
8
8
 
@@ -10,4 +10,4 @@ You are an expert at...
10
10
 
11
11
  1. First, understand the request
12
12
  2. Then, implement the solution
13
- 3. Finally, verify the result`,rows:12,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...S,minHeight:"200px"}}):t.body.trim()?e.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"200px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:ae(t.body)}}):e.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"200px",maxHeight:"400px",overflowY:"auto"},children:e.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),e.jsx(ne,{skillName:t.name||"{skill}",hasEvals:!1,isDraft:t.draftSaved}),t.error&&e.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:t.error}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:t.handleCreate,disabled:t.creating||!t.name||!t.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:t.creating||!t.name||!t.description?"var(--surface-3)":"var(--color-action, #2F5B8E)",color:t.creating||!t.name||!t.description?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:t.creating||!t.name||!t.description?"not-allowed":"pointer",opacity:t.creating?.7:1},children:t.creating?"Creating...":"Create Skill"}),e.jsx(R,{to:"/",className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)"},children:"Cancel"})]})]}),e.jsx("div",{className:"w-full lg:w-[340px] lg:flex-shrink-0 min-w-0",children:e.jsx("div",{className:"lg:sticky lg:top-8",children:e.jsxs("div",{className:"glass-card p-4",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"SKILL.md Preview"}),e.jsx("pre",{className:"text-[11px] font-mono leading-relaxed overflow-auto max-h-[500px] p-3 rounded-lg",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:_})]})})})]})}),x&&e.jsx(Ce,{engine:x,onClose:()=>i(null),onSuccess:()=>{t.refreshEngineDetection()}})]})}export{Be as CreateSkillPage};
13
+ 3. Finally, verify the result`,rows:12,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...N,minHeight:"200px"}}):t.body.trim()?e.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"200px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:ne(t.body)}}):e.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"200px",maxHeight:"400px",overflowY:"auto"},children:e.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),e.jsx(ie,{skillName:t.name||"{skill}",hasEvals:!1,isDraft:t.draftSaved}),t.error&&e.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:t.error}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:t.handleCreate,disabled:t.creating||!t.name||!t.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:t.creating||!t.name||!t.description?"var(--surface-3)":"var(--color-action, #2F5B8E)",color:t.creating||!t.name||!t.description?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:t.creating||!t.name||!t.description?"not-allowed":"pointer",opacity:t.creating?.7:1},children:t.creating?"Creating...":"Create Skill"}),e.jsx(R,{to:"/",className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)"},children:"Cancel"})]})]}),e.jsx("div",{className:"w-full lg:w-[340px] lg:flex-shrink-0 min-w-0",children:e.jsx("div",{className:"lg:sticky lg:top-8",children:e.jsxs("div",{className:"glass-card p-4",children:[e.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider mb-3",style:{color:"var(--text-tertiary)"},children:"SKILL.md Preview"}),e.jsx("pre",{className:"text-[11px] font-mono leading-relaxed overflow-auto max-h-[500px] p-3 rounded-lg",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:_})]})})})]})}),i&&e.jsx(Le,{engine:i,onClose:()=>x(null),onSuccess:()=>{t.refreshEngineDetection()}})]})}export{Fe as CreateSkillPage};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-DMVcq7UB.js","assets/globals-hm1COkXX.js","assets/globals-Dpf9KmYH.css","assets/skill-url-C4ekwoGs.js","assets/main-tpOyw9SC.js","assets/useDesktopBridge-9oZFQsrw.js","assets/fonts-i7Lkz2zN.css"])))=>i.map(i=>d[i]);
2
- import{_ as f}from"./useDesktopBridge-9oZFQsrw.js";import{r as t,j as d}from"./globals-hm1COkXX.js";const l=t.lazy(()=>f(()=>import("./SearchPaletteCore-DMVcq7UB.js"),__vite__mapDeps([0,1,2,3,4,5,6])));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(l,{initialOpen:!0,onSelect:c,onNavigate:u})})}):null}export{y as FindSkillsPalette,y as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-D2gKxOTT.js","assets/globals-hm1COkXX.js","assets/globals-Dpf9KmYH.css","assets/skill-url-C4ekwoGs.js","assets/main-sUAgJ9SV.js","assets/useDesktopBridge-9oZFQsrw.js","assets/fonts-i7Lkz2zN.css"])))=>i.map(i=>d[i]);
2
+ import{_ as f}from"./useDesktopBridge-9oZFQsrw.js";import{r as t,j as d}from"./globals-hm1COkXX.js";const l=t.lazy(()=>f(()=>import("./SearchPaletteCore-D2gKxOTT.js"),__vite__mapDeps([0,1,2,3,4,5,6])));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(l,{initialOpen:!0,onSelect:c,onNavigate:u})})}):null}export{y as FindSkillsPalette,y as default};