vskill 1.0.14 → 1.0.16

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 (122) hide show
  1. package/README.md +61 -0
  2. package/agents.json +1 -1
  3. package/dist/agents/agents-registry.d.ts +8 -3
  4. package/dist/agents/agents-registry.js.map +1 -1
  5. package/dist/bin.js +0 -0
  6. package/dist/clone/github-scaffold.d.ts +38 -0
  7. package/dist/clone/github-scaffold.js +108 -0
  8. package/dist/clone/github-scaffold.js.map +1 -0
  9. package/dist/clone/provenance-fork.d.ts +34 -0
  10. package/dist/clone/provenance-fork.js +97 -0
  11. package/dist/clone/provenance-fork.js.map +1 -0
  12. package/dist/clone/reference-scanner.d.ts +19 -0
  13. package/dist/clone/reference-scanner.js +144 -0
  14. package/dist/clone/reference-scanner.js.map +1 -0
  15. package/dist/clone/skill-locator.d.ts +26 -0
  16. package/dist/clone/skill-locator.js +248 -0
  17. package/dist/clone/skill-locator.js.map +1 -0
  18. package/dist/clone/target-router.d.ts +73 -0
  19. package/dist/clone/target-router.js +200 -0
  20. package/dist/clone/target-router.js.map +1 -0
  21. package/dist/clone/types.d.ts +82 -0
  22. package/dist/clone/types.js +11 -0
  23. package/dist/clone/types.js.map +1 -0
  24. package/dist/commands/add.js +96 -32
  25. package/dist/commands/add.js.map +1 -1
  26. package/dist/commands/auth.d.ts +23 -0
  27. package/dist/commands/auth.js +273 -0
  28. package/dist/commands/auth.js.map +1 -0
  29. package/dist/commands/clone-prompts.d.ts +13 -0
  30. package/dist/commands/clone-prompts.js +67 -0
  31. package/dist/commands/clone-prompts.js.map +1 -0
  32. package/dist/commands/clone.d.ts +70 -0
  33. package/dist/commands/clone.js +649 -0
  34. package/dist/commands/clone.js.map +1 -0
  35. package/dist/commands/eval/serve.js +8 -1
  36. package/dist/commands/eval/serve.js.map +1 -1
  37. package/dist/commands/keys.js +54 -2
  38. package/dist/commands/keys.js.map +1 -1
  39. package/dist/eval/skill-scanner.d.ts +2 -12
  40. package/dist/eval/skill-scanner.js +27 -5
  41. package/dist/eval/skill-scanner.js.map +1 -1
  42. package/dist/eval-server/api-routes.js +527 -35
  43. package/dist/eval-server/api-routes.js.map +1 -1
  44. package/dist/eval-server/data-events.d.ts +1 -1
  45. package/dist/eval-server/data-events.js.map +1 -1
  46. package/dist/eval-server/eval-server.js +8 -1
  47. package/dist/eval-server/eval-server.js.map +1 -1
  48. package/dist/eval-server/install-engine-routes-helpers.d.ts +1 -3
  49. package/dist/eval-server/install-engine-routes-helpers.js +6 -14
  50. package/dist/eval-server/install-engine-routes-helpers.js.map +1 -1
  51. package/dist/eval-server/install-state-routes.d.ts +21 -0
  52. package/dist/eval-server/install-state-routes.js +111 -0
  53. package/dist/eval-server/install-state-routes.js.map +1 -0
  54. package/dist/eval-server/origin-resolver.d.ts +42 -0
  55. package/dist/eval-server/origin-resolver.js +168 -0
  56. package/dist/eval-server/origin-resolver.js.map +1 -0
  57. package/dist/eval-server/platform-proxy.d.ts +10 -0
  58. package/dist/eval-server/platform-proxy.js +58 -2
  59. package/dist/eval-server/platform-proxy.js.map +1 -1
  60. package/dist/eval-server/skill-resolver.js +40 -0
  61. package/dist/eval-server/skill-resolver.js.map +1 -1
  62. package/dist/eval-server/utils/resolve-editor.d.ts +6 -1
  63. package/dist/eval-server/utils/resolve-editor.js +11 -26
  64. package/dist/eval-server/utils/resolve-editor.js.map +1 -1
  65. package/dist/eval-server/utils/scan-install-locations.d.ts +7 -0
  66. package/dist/eval-server/utils/scan-install-locations.js +20 -0
  67. package/dist/eval-server/utils/scan-install-locations.js.map +1 -1
  68. package/dist/eval-server/utils/which.d.ts +15 -0
  69. package/dist/eval-server/utils/which.js +76 -0
  70. package/dist/eval-server/utils/which.js.map +1 -0
  71. package/dist/eval-ui/assets/{CreateSkillPage-CKvqAya0.js → CreateSkillPage-CvdYq8Rr.js} +5 -5
  72. package/dist/eval-ui/assets/{FindSkillsPalette-B8pTa5NP.js → FindSkillsPalette-DsSgotS9.js} +2 -2
  73. package/dist/eval-ui/assets/{SearchPaletteCore-CkVRvaZk.js → SearchPaletteCore-Bf3PBC64.js} +2 -2
  74. package/dist/eval-ui/assets/SkillDetailPanel-DAD2yJO-.js +1 -0
  75. package/dist/eval-ui/assets/{UpdateDropdown-DA7OktXO.js → UpdateDropdown-h5Hg3h7Z.js} +1 -1
  76. package/dist/eval-ui/assets/{index-BKAvJDDF.css → index-CKLqBL52.css} +1 -1
  77. package/dist/eval-ui/assets/index-JaDg6FlU.js +124 -0
  78. package/dist/eval-ui/index.html +2 -2
  79. package/dist/index.js +39 -0
  80. package/dist/index.js.map +1 -1
  81. package/dist/installer/canonical.js +2 -11
  82. package/dist/installer/canonical.js.map +1 -1
  83. package/dist/installer/frontmatter.d.ts +26 -0
  84. package/dist/installer/frontmatter.js +91 -1
  85. package/dist/installer/frontmatter.js.map +1 -1
  86. package/dist/lib/github-fetch.d.ts +22 -0
  87. package/dist/lib/github-fetch.js +152 -0
  88. package/dist/lib/github-fetch.js.map +1 -0
  89. package/dist/lib/keychain.d.ts +41 -0
  90. package/dist/lib/keychain.js +232 -0
  91. package/dist/lib/keychain.js.map +1 -0
  92. package/dist/studio/lib/provenance.js +3 -2
  93. package/dist/studio/lib/provenance.js.map +1 -1
  94. package/dist/studio/lib/query.d.ts +1 -0
  95. package/dist/studio/lib/query.js +7 -0
  96. package/dist/studio/lib/query.js.map +1 -0
  97. package/dist/studio/lib/scope-transfer.d.ts +6 -0
  98. package/dist/studio/lib/scope-transfer.js +5 -2
  99. package/dist/studio/lib/scope-transfer.js.map +1 -1
  100. package/dist/studio/routes/index.js +3 -0
  101. package/dist/studio/routes/index.js.map +1 -1
  102. package/dist/studio/routes/ops.js +1 -3
  103. package/dist/studio/routes/ops.js.map +1 -1
  104. package/dist/studio/routes/promote.js +1 -3
  105. package/dist/studio/routes/promote.js.map +1 -1
  106. package/dist/studio/routes/revert.js +2 -17
  107. package/dist/studio/routes/revert.js.map +1 -1
  108. package/dist/studio/routes/test-install.js +1 -3
  109. package/dist/studio/routes/test-install.js.map +1 -1
  110. package/dist/studio/types.d.ts +13 -0
  111. package/dist/utils/claude-plugin.d.ts +26 -0
  112. package/dist/utils/claude-plugin.js +60 -0
  113. package/dist/utils/claude-plugin.js.map +1 -1
  114. package/dist/utils/skill-builder-detection.d.ts +14 -1
  115. package/dist/utils/skill-builder-detection.js +20 -8
  116. package/dist/utils/skill-builder-detection.js.map +1 -1
  117. package/dist/utils/skill-creator-detection.d.ts +10 -2
  118. package/dist/utils/skill-creator-detection.js +12 -43
  119. package/dist/utils/skill-creator-detection.js.map +1 -1
  120. package/package.json +2 -1
  121. package/dist/eval-ui/assets/SkillDetailPanel-d4_LquVH.js +0 -1
  122. package/dist/eval-ui/assets/index-DCbohW6l.js +0 -122
@@ -7,6 +7,7 @@
7
7
  // traversal via an explicit allowlist of root prefixes.
8
8
  // ---------------------------------------------------------------------------
9
9
  import { existsSync, realpathSync } from "node:fs";
10
+ import { homedir } from "node:os";
10
11
  import { join, basename, resolve } from "node:path";
11
12
  import { getSkillDirEntry } from "./skill-dir-registry.js";
12
13
  function assertContained(candidate, root) {
@@ -59,6 +60,45 @@ export function resolveAllowedSkillDir(root, plugin, skill, allowedRoots) {
59
60
  if (entry) {
60
61
  return validateAgainstAllowlist(entry.dir, allowedRoots);
61
62
  }
63
+ // 0823 F-006: when no registry entry exists, try plugin-scoped fallbacks
64
+ // for installed-agent-dir plugins (.claude, .cursor, .gemini, ...). Each
65
+ // candidate is restricted to roots that match the plugin's agent dir to
66
+ // prevent cross-plugin name collisions (e.g. a `.cursor` request must NOT
67
+ // accidentally resolve to a same-named skill under `~/.claude/skills/`).
68
+ //
69
+ // The plugin-aware preference order is:
70
+ // (1) ~/{plugin}/skills/<skill> — agent's own canonical location
71
+ // (2) ~/.agents/skills/<skill> — vskill --global canonical location
72
+ // (cross-agent, accepted only when
73
+ // the plugin is an agent-dir form)
74
+ // Both candidates still pass through validateAgainstAllowlist so symlink
75
+ // escapes and traversal segments are rejected.
76
+ if (plugin && plugin.startsWith(".")) {
77
+ // Tier 1: skill under the agent's own home dir (~/.claude/skills/<skill>)
78
+ const home = homedir();
79
+ const agentLocal = join(home, plugin, "skills", skill);
80
+ if (existsSync(join(agentLocal, "SKILL.md"))) {
81
+ try {
82
+ return validateAgainstAllowlist(agentLocal, allowedRoots);
83
+ }
84
+ catch (err) {
85
+ // 0823 F-005: log allowlist rejections (typically symlink escape) so
86
+ // operators can spot tampering. Caller still gets the next-tier
87
+ // candidate via the fall-through below.
88
+ console.warn(`[skill-resolver] tier-1 candidate rejected for ${plugin}/${skill}:`, err.message);
89
+ }
90
+ }
91
+ // Tier 2: shared ~/.agents/skills/<skill> (vskill --global)
92
+ const agentsShared = join(home, ".agents", "skills", skill);
93
+ if (existsSync(join(agentsShared, "SKILL.md"))) {
94
+ try {
95
+ return validateAgainstAllowlist(agentsShared, allowedRoots);
96
+ }
97
+ catch (err) {
98
+ console.warn(`[skill-resolver] tier-2 candidate rejected for ${plugin}/${skill}:`, err.message);
99
+ }
100
+ }
101
+ }
62
102
  return resolveSkillDir(root, plugin, skill);
63
103
  }
64
104
  function validateAgainstAllowlist(candidate, allowedRoots) {
@@ -1 +1 @@
1
- {"version":3,"file":"skill-resolver.js","sourceRoot":"","sources":["../../src/eval-server/skill-resolver.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,yDAAyD;AACzD,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,wDAAwD;AACxD,8EAA8E;AAE9E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,SAAS,eAAe,CAAC,SAAiB,EAAE,IAAY;IACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;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
4
  file?: string;
@@ -9,5 +10,9 @@ export type EditorLaunch = {
9
10
  export declare class NoEditorError extends Error {
10
11
  constructor();
11
12
  }
12
- export declare function defaultWhich(cmd: string): boolean;
13
+ /**
14
+ * Backwards-compatible re-export. New code should import `whichSync` from
15
+ * `./which.js` directly.
16
+ */
17
+ export declare const defaultWhich: typeof whichSync;
13
18
  export declare function resolveEditorCommand(target: EditorTarget, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, which?: (cmd: string) => boolean): EditorLaunch;
@@ -16,8 +16,8 @@
16
16
  // Pure: no I/O on import. `which`, `env`, and `platform` are injectable so
17
17
  // tests pin them deterministically.
18
18
  // ---------------------------------------------------------------------------
19
- import { execFileSync } from "node:child_process";
20
19
  import { join } from "node:path";
20
+ import { whichSync } from "./which.js";
21
21
  export class NoEditorError extends Error {
22
22
  constructor() {
23
23
  super("no_editor");
@@ -27,37 +27,22 @@ export class NoEditorError extends Error {
27
27
  function pathFor(target) {
28
28
  return target.file ? join(target.dir, target.file) : target.dir;
29
29
  }
30
+ // Limitation: this is whitespace-only tokenization. A `$VISUAL` value with a
31
+ // quoted path (e.g. `code "/Applications/Visual Studio Code.app/.../code"`)
32
+ // will tokenize incorrectly and the launch will fail with ENOENT, surfacing
33
+ // as the generic "Could not open" toast in the UI. Acceptable for the common
34
+ // `command --flag` shape; switch to a shell-aware parser if needed.
30
35
  function splitEnvCommand(value) {
31
36
  if (!value)
32
37
  return null;
33
38
  const tokens = value.trim().split(/\s+/).filter(Boolean);
34
39
  return tokens.length > 0 ? tokens : null;
35
40
  }
36
- const whichCache = new Map();
37
- export function defaultWhich(cmd) {
38
- const cached = whichCache.get(cmd);
39
- if (cached !== undefined)
40
- return cached;
41
- let ok = false;
42
- try {
43
- if (process.platform === "win32") {
44
- execFileSync("where", [cmd], { stdio: "ignore", timeout: 1000 });
45
- }
46
- else {
47
- execFileSync("command", ["-v", cmd], {
48
- stdio: "ignore",
49
- timeout: 1000,
50
- shell: "/bin/sh",
51
- });
52
- }
53
- ok = true;
54
- }
55
- catch {
56
- ok = false;
57
- }
58
- whichCache.set(cmd, ok);
59
- return ok;
60
- }
41
+ /**
42
+ * Backwards-compatible re-export. New code should import `whichSync` from
43
+ * `./which.js` directly.
44
+ */
45
+ export const defaultWhich = whichSync;
61
46
  export function resolveEditorCommand(target, env = process.env, platform = process.platform, which = defaultWhich) {
62
47
  const path = pathFor(target);
63
48
  // 1 + 2: $VISUAL / $EDITOR
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-editor.js","sourceRoot":"","sources":["../../../src/eval-server/utils/resolve-editor.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,2BAA2B;AAC3B,EAAE;AACF,wEAAwE;AACxE,EAAE;AACF,wCAAwC;AACxC,4EAA4E;AAC5E,wBAAwB;AACxB,yBAAyB;AACzB,yBAAyB;AACzB,uFAAuF;AACvF,EAAE;AACF,sEAAsE;AACtE,4CAA4C;AAC5C,EAAE;AACF,2EAA2E;AAC3E,oCAAoC;AACpC,8EAA8E;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAKjC,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC;QACE,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,SAAS,OAAO,CAAC,MAAoB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;AAClE,CAAC;AAED,SAAS,eAAe,CAAC,KAAyB;IAChD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAA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,CAAC,QAAQ,EAAE,QAAQ,CAAU,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACzC,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC;YACnC,OAAO,EAAE,OAAO,EAAE,OAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;QACvD,CAAC;IACH,CAAC;IAED,yCAAyC;IACzC,KAAK,MAAM,SAAS,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC3C,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;YACrB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,gBAAgB;IAChB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,KAAK,OAAO;YACV,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,KAAK,OAAO;YACV,sEAAsE;YACtE,mEAAmE;YACnE,kDAAkD;YAClD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;QAC7D;YACE,MAAM,IAAI,aAAa,EAAE,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -9,6 +9,13 @@ export interface InstallLocation {
9
9
  symlinked: boolean;
10
10
  readonly: boolean;
11
11
  }
12
+ /**
13
+ * Pick the highest-precedence install (project > personal > plugin) from a
14
+ * set of locations. Returns undefined for an empty input. Used by both the
15
+ * /api/skills/updates row builder and the reveal-in-editor route so they
16
+ * agree on which copy is the "live" one to surface or open.
17
+ */
18
+ export declare function pickHighestPrecedenceLocation(locations: readonly InstallLocation[]): InstallLocation | undefined;
12
19
  /**
13
20
  * Find every install location of a skill identified by its canonical platform
14
21
  * name (e.g. "anton-abyzov/greet-anton/greet-anton"). Returns one entry per
@@ -108,6 +108,26 @@ function pluginLocations(slug) {
108
108
  readonly: true,
109
109
  }));
110
110
  }
111
+ const SCOPE_PRECEDENCE = {
112
+ project: 0,
113
+ personal: 1,
114
+ plugin: 2,
115
+ };
116
+ /**
117
+ * Pick the highest-precedence install (project > personal > plugin) from a
118
+ * set of locations. Returns undefined for an empty input. Used by both the
119
+ * /api/skills/updates row builder and the reveal-in-editor route so they
120
+ * agree on which copy is the "live" one to surface or open.
121
+ */
122
+ export function pickHighestPrecedenceLocation(locations) {
123
+ let winner;
124
+ for (const loc of locations) {
125
+ if (!winner || SCOPE_PRECEDENCE[loc.scope] < SCOPE_PRECEDENCE[winner.scope]) {
126
+ winner = loc;
127
+ }
128
+ }
129
+ return winner;
130
+ }
111
131
  /**
112
132
  * Find every install location of a skill identified by its canonical platform
113
133
  * name (e.g. "anton-abyzov/greet-anton/greet-anton"). Returns one entry per
@@ -1 +1 @@
1
- {"version":3,"file":"scan-install-locations.js","sourceRoot":"","sources":["../../../src/eval-server/utils/scan-install-locations.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wCAAwC;AACxC,EAAE;AACF,gFAAgF;AAChF,6EAA6E;AAC7E,+EAA+E;AAC/E,EAAE;AACF,UAAU;AACV,uDAAuD;AACvD,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,qEAAqE;AACrE,8EAA8E;AAE9E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MA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B,EAAE,CAAC;IAEtC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QAC5D,IAAI,IAAI;YAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzB,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACpD,IAAI,QAAQ;YAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,GAAG,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAEnC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,2EAA2E;AAC3E,KAAK,OAAO,CAAC"}
1
+ {"version":3,"file":"scan-install-locations.js","sourceRoot":"","sources":["../../../src/eval-server/utils/scan-install-locations.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wCAAwC;AACxC,EAAE;AACF,gFAAgF;AAChF,6EAA6E;AAC7E,+EAA+E;AAC/E,EAAE;AACF,UAAU;AACV,uDAAuD;AACvD,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,qEAAqE;AACrE,8EAA8E;AAE9E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EACL,oBAAoB,GAErB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAezE,MAAM,UAAU,GAAG,mBAAmB,CAAC;AAEvC,SAAS,UAAU,CAAC,CAAS;IAC3B,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,OAAO,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IAEnC,MAAM,IAAI,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,MAAM,GAAG,GAAsB,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,oBAAoB,EAAE,CAAC;IAEtC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QAC5D,IAAI,IAAI;YAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzB,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACpD,IAAI,QAAQ;YAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,GAAG,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAEnC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,2EAA2E;AAC3E,KAAK,OAAO,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * True iff `cmd` is on PATH. Memoized for the lifetime of the process.
3
+ * Returns false for empty input or anything containing shell metacharacters
4
+ * (defense in depth — argv arrays already prevent injection, but rejecting
5
+ * weird input early avoids surprises in error logs).
6
+ */
7
+ export declare function whichSync(cmd: string): boolean;
8
+ /**
9
+ * Test seam: same contract as `whichSync` but with a caller-supplied probe.
10
+ * Does not consult or populate the module-level cache, so tests can vary
11
+ * the probe across cases without polluting subsequent calls.
12
+ */
13
+ export declare function whichSyncWith(cmd: string, probe: (cmd: string) => boolean): boolean;
14
+ /** Test-only: drop the memoized cache. Not exported through utils/index. */
15
+ export declare function _resetWhichCacheForTests(): void;
@@ -0,0 +1,76 @@
1
+ // ---------------------------------------------------------------------------
2
+ // which.ts — single shared "is this command on PATH?" helper.
3
+ //
4
+ // Consolidates three previous implementations (isCliAvailable in
5
+ // install-engine-routes-helpers.ts, isBinaryOnPath in api-routes.ts,
6
+ // defaultWhich in resolve-editor.ts). The merged version keeps the most
7
+ // hardened behavior of each:
8
+ //
9
+ // - shell-metacharacter guard from isCliAvailable (rejects anything
10
+ // outside [a-zA-Z0-9._-])
11
+ // - argv-array spawn (no shell) from defaultWhich
12
+ // - 1-second timeout from defaultWhich
13
+ // - per-process Map cache from defaultWhich
14
+ //
15
+ // Use `whichSync` everywhere. The injectable variant `whichSyncWith` accepts
16
+ // a custom probe function so tests can pin behavior without touching the
17
+ // process environment.
18
+ // ---------------------------------------------------------------------------
19
+ import { execFileSync } from "node:child_process";
20
+ const SAFE_CMD = /^[a-zA-Z0-9._-]+$/;
21
+ const cache = new Map();
22
+ function defaultProbe(cmd) {
23
+ try {
24
+ if (process.platform === "win32") {
25
+ execFileSync("where", [cmd], { stdio: "ignore", timeout: 1000 });
26
+ }
27
+ else {
28
+ // `command -v` is the POSIX-portable lookup. We invoke it via /bin/sh
29
+ // because `command` is a shell builtin, not a binary on PATH. Args are
30
+ // passed via the `shell` option's command-string mechanism, but we
31
+ // hand-build the exact string to avoid argv re-quoting surprises and
32
+ // because `cmd` has already passed the SAFE_CMD allowlist (no shell
33
+ // metacharacters can reach this point).
34
+ execFileSync("command", ["-v", cmd], {
35
+ stdio: "ignore",
36
+ timeout: 1000,
37
+ shell: "/bin/sh",
38
+ });
39
+ }
40
+ return true;
41
+ }
42
+ catch {
43
+ return false;
44
+ }
45
+ }
46
+ /**
47
+ * True iff `cmd` is on PATH. Memoized for the lifetime of the process.
48
+ * Returns false for empty input or anything containing shell metacharacters
49
+ * (defense in depth — argv arrays already prevent injection, but rejecting
50
+ * weird input early avoids surprises in error logs).
51
+ */
52
+ export function whichSync(cmd) {
53
+ if (!cmd || !SAFE_CMD.test(cmd))
54
+ return false;
55
+ const cached = cache.get(cmd);
56
+ if (cached !== undefined)
57
+ return cached;
58
+ const result = defaultProbe(cmd);
59
+ cache.set(cmd, result);
60
+ return result;
61
+ }
62
+ /**
63
+ * Test seam: same contract as `whichSync` but with a caller-supplied probe.
64
+ * Does not consult or populate the module-level cache, so tests can vary
65
+ * the probe across cases without polluting subsequent calls.
66
+ */
67
+ export function whichSyncWith(cmd, probe) {
68
+ if (!cmd || !SAFE_CMD.test(cmd))
69
+ return false;
70
+ return probe(cmd);
71
+ }
72
+ /** Test-only: drop the memoized cache. Not exported through utils/index. */
73
+ export function _resetWhichCacheForTests() {
74
+ cache.clear();
75
+ }
76
+ //# sourceMappingURL=which.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"which.js","sourceRoot":"","sources":["../../../src/eval-server/utils/which.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8DAA8D;AAC9D,EAAE;AACF,iEAAiE;AACjE,qEAAqE;AACrE,wEAAwE;AACxE,6BAA6B;AAC7B,EAAE;AACF,sEAAsE;AACtE,8BAA8B;AAC9B,oDAAoD;AACpD,yCAAyC;AACzC,8CAA8C;AAC9C,EAAE;AACF,6EAA6E;AAC7E,yEAAyE;AACzE,uBAAuB;AACvB,8EAA8E;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,QAAQ,GAAG,mBAAmB,CAAC;AAErC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAmB,CAAC;AAEzC,SAAS,YAAY,CAAC,GAAW;IAC/B,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACjC,YAAY,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACN,sEAAsE;YACtE,uEAAuE;YACvE,mEAAmE;YACnE,qEAAqE;YACrE,oEAAoE;YACpE,wCAAwC;YACxC,YAAY,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE;gBACnC,KAAK,EAAE,QAAQ;gBACf,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,SAAS;aACjB,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9C,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACjC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAW,EACX,KAA+B;IAE/B,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,wBAAwB;IACtC,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC"}
@@ -1,8 +1,8 @@
1
- import{j as e,R as j,u as J,a as Z,r as b,g as D,b as B,w as X,c as ee,t as P,L as R,P as te,E as se,d as re,S as ae}from"./index-DCbohW6l.js";/* empty css */const le=[{key:"slashCommands",label:"Slash"},{key:"hooks",label:"Hooks"},{key:"mcp",label:"MCP"},{key:"customSystemPrompt",label:"Prompt"}];function ne({supported:r,label:l}){return e.jsx("span",{style:{display:"inline-block",fontSize:10,padding:"1px 5px",borderRadius:3,marginRight:3,background:r?"var(--color-success-bg, #d4edda)":"var(--surface-3, #2a2a2a)",color:r?"var(--color-success, #28a745)":"var(--text-tertiary, #666)",border:`1px solid ${r?"var(--color-success, #28a745)":"var(--border-subtle, #333)"}`},children:l})}function F({agent:r,checked:l,onToggle:g}){return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:6,cursor:"pointer",border:r.installed?"1px solid var(--color-primary, #6366f1)":"1px solid var(--border-subtle, #333)",background:l?"var(--surface-2, #1e1e1e)":"transparent"},children:[e.jsx("input",{type:"checkbox",checked:l,onChange:g,style:{accentColor:"var(--color-primary, #6366f1)"}}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontWeight:500,fontSize:13,color:"var(--text-primary, #fff)"},children:r.displayName}),r.installed&&e.jsx("span",{style:{fontSize:10,padding:"1px 5px",borderRadius:3,background:"var(--color-primary-bg, #312e81)",color:"var(--color-primary, #6366f1)"},children:"installed"})]}),e.jsx("div",{style:{marginTop:3},children:le.map(x=>e.jsx(ne,{supported:r.featureSupport[x.key],label:x.label},x.key))})]})]})}function oe({agents:r,selectedIds:l,onChange:g}){const x=new Set(l),i=r.filter(n=>n.isUniversal),a=r.filter(n=>!n.isUniversal),c=n=>{const o=x.has(n)?l.filter(h=>h!==n):[...l,n];g(o)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[i.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Universal Agents"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:i.map(n=>e.jsx(F,{agent:n,checked:x.has(n.id),onToggle:()=>c(n.id)},n.id))})]}),a.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary, #999)",marginBottom:6},children:"Other Agents"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:a.map(n=>e.jsx(F,{agent:n,checked:x.has(n.id),onToggle:()=>c(n.id)},n.id))})]})]})}const ie="Cross-universal — emits the same skill to 8 universal agents (Claude, Codex, Cursor, Cline, Gemini CLI, OpenCode, Kimi, Amp). Constrains output to the common schema across all agents. Recommended for portable skills.",de="Powerful Claude-native engine — Anthropic's built-in skill-creator with a slightly richer schema (more expressive on Claude) but Claude-only. Pick this when you only target Claude Code and want full expressiveness.",ce="Generate raw — no engine assistance, you provide the full SKILL.md body.";function ue(r){return[{engine:"vskill",label:"VSkill skill-builder",caption:r.vskillSkillBuilder?`installed${r.vskillVersion?` v${r.vskillVersion}`:""}`:"not installed",tooltip:ie,detected:r.vskillSkillBuilder,installable:!0},{engine:"anthropic-skill-creator",label:"Anthropic skill-creator",caption:r.anthropicSkillCreator?"installed":"not installed",tooltip:de,detected:r.anthropicSkillCreator,installable:!0},{engine:"none",label:"No engine — generate raw",caption:"always available",tooltip:ce,detected:!0,installable:!1}]}function xe(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function pe(r){const{detection:l,selected:g,onSelect:x,onInstallClick:i}=r,a=j.useMemo(()=>xe(),[]),c=j.useMemo(()=>ue(l),[l]),n=a?"":"transition-colors";return e.jsxs("fieldset",{className:"flex flex-col gap-2",children:[e.jsx("legend",{className:"text-xs font-semibold text-gray-700",children:"Authoring engine"}),e.jsx("div",{role:"tablist","aria-label":"Authoring engine",className:"flex flex-col gap-1.5",children:c.map(o=>{const h=g===o.engine,p=!o.detected&&o.installable,y=["flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm cursor-pointer",n,h?"border-blue-600 bg-blue-50":"border-gray-300 bg-white hover:border-gray-400"].filter(Boolean).join(" "),f=o.detected?{}:{opacity:.6};return e.jsxs("div",{role:"tab",tabIndex:0,"data-testid":`engine-selector-${o.engine}`,"aria-selected":h?"true":"false",title:o.tooltip,style:f,className:y,onClick:()=>x(o.engine),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),x(o.engine))},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-gray-900",children:o.label}),e.jsx("span",{className:"text-xs text-gray-500",children:o.caption})]}),p&&e.jsx("button",{type:"button","data-testid":`install-${o.engine}`,className:"rounded border border-blue-600 px-2 py-1 text-xs font-medium text-blue-700 hover:bg-blue-100",onClick:u=>{u.stopPropagation(),i(o.engine)},children:"Install"})]},o.engine)})})]})}const A="(?:0|[1-9]\\d*)",H="[0-9A-Za-z-]",$=`(?:${A}|\\d*[A-Za-z-]${H}*)`,z=`${H}+`,me=`(?:-${$}(?:\\.${$})*)`,ge=`(?:\\+${z}(?:\\.${z})*)`,he=new RegExp(`^${A}\\.${A}\\.${A}${me}?${ge}?$`);function V(r){return typeof r!="string"?!1:he.test(r.trim())}const fe="Skill version (semver). Auto-bumps on update unless versioningMode=author.",ve="Must be valid semver (e.g. 1.0.0, 2.1.3-beta.1)";function ye(r){const{value:l,onChange:g,mode:x,onValidityChange:i,versionsHref:a,disabled:c}=r,[n,o]=j.useState(!1),[h,p]=j.useState(()=>V(l)),y=V(l);j.useEffect(()=>{y!==h?(p(y),i==null||i(y)):i&&i(y)},[y]);const f=n&&!y,u=["w-full rounded-md border px-3 py-2 text-sm font-mono",f?"border-red-500 bg-red-50 focus:outline-red-600":"border-gray-300 bg-white focus:outline-blue-600",c?"opacity-60 cursor-not-allowed":""].join(" ");return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-700",htmlFor:"version-input",children:"Version"}),e.jsx("input",{id:"version-input","data-testid":"version-input",type:"text",title:fe,value:l,onChange:m=>g(m.currentTarget.value),onBlur:()=>o(!0),"aria-invalid":f?"true":"false","aria-describedby":f?"version-input-helper":void 0,disabled:c,className:u,placeholder:"1.0.0"}),f&&e.jsx("span",{id:"version-input-helper","data-testid":"version-input-helper",className:"text-xs text-red-600",role:"alert",children:ve}),x==="update"&&a&&e.jsx("a",{"data-testid":"version-input-versions-link",href:a,target:"_blank",rel:"noreferrer",className:"text-xs text-blue-600 hover:underline",children:"Versions →"})]})}const E={status:"idle",liveTail:"",progress:[],exitCode:null,stderr:"",error:null};function be(r={}){const l=r.fetchImpl??globalThis.fetch,g=r.eventSourceCtor??globalThis.EventSource,[x,i]=j.useState(E),a=j.useRef(null),c=j.useRef(null);j.useEffect(()=>()=>{var p;(p=c.current)==null||p.close()},[]);const n=j.useCallback(()=>{var p;(p=c.current)==null||p.close(),c.current=null,a.current=null,i(E)},[]),o=j.useCallback(async p=>{if(!g){i({...E,status:"failure",error:"EventSource not available"});return}a.current=p,i({...E,status:"spawning"});let y;try{const u=await l("/api/studio/install-engine",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({engine:p})});if(!u.ok){const w=await u.json().catch(()=>({}));i({...E,status:"failure",error:w.remediation??w.error??`HTTP ${u.status}`});return}y=(await u.json()).jobId}catch(u){i({...E,status:"failure",error:u.message});return}const f=new g(`/api/studio/install-engine/${y}/stream`);c.current=f,i(u=>({...u,status:"streaming"})),f.addEventListener("progress",u=>{try{const m=JSON.parse(u.data);i(w=>({...w,liveTail:m.line.length>60?m.line.slice(0,60)+"…":m.line,progress:[...w.progress,m].slice(-200)}))}catch{}}),f.addEventListener("done",u=>{try{const m=JSON.parse(u.data);f.close(),c.current=null,i(w=>({...w,status:m.success?"success":"failure",exitCode:m.exitCode,stderr:m.stderr,error:m.success?null:m.stderr||`exit ${m.exitCode}`}))}catch{f.close(),c.current=null,i(m=>({...m,status:"failure",error:"malformed done event"}))}}),f.addEventListener("error",()=>{f.close(),c.current=null,i(u=>({...u,status:u.status==="streaming"?"failure":u.status,error:u.error??"stream error"}))})},[g,l]),h=j.useCallback(async()=>{const p=a.current;p&&await o(p)},[o]);return{state:x,install:o,retry:h,reset:n}}const je={vskill:"vskill install anton-abyzov/vskill/skill-builder","anthropic-skill-creator":"claude plugin install skill-creator"},ke={vskill:"VSkill skill-builder","anthropic-skill-creator":"Anthropic skill-creator"},we="This runs the command in your terminal as your user. Inspect before approving.";function Ne(r){const{engine:l,onClose:g,onSuccess:x,hookOpts:i}=r,{state:a,install:c,retry:n}=be(i),o=je[l],h=ke[l],p=j.useRef(!1);return j.useEffect(()=>{a.status==="success"&&!p.current&&(p.current=!0,x())},[a.status,x]),e.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"install-engine-title","data-testid":"install-engine-modal",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:e.jsxs("div",{className:"w-full max-w-lg rounded-lg bg-white p-6 shadow-xl",children:[e.jsxs("h2",{id:"install-engine-title",className:"text-lg font-semibold text-gray-900",children:["Install ",h]}),a.status==="idle"&&e.jsx(Se,{command:o,onCancel:g,onRun:()=>c(l)}),(a.status==="spawning"||a.status==="streaming")&&e.jsx(Ce,{command:o,liveTail:a.liveTail}),a.status==="success"&&e.jsx(Le,{label:h,onClose:g}),a.status==="failure"&&e.jsx(Ee,{error:a.error??"Install failed",stderr:a.stderr,progress:a.progress,onRetry:()=>n(),onClose:g})]})})}function G({command:r}){return e.jsxs("pre",{"data-testid":"install-command-preview",className:"my-3 overflow-x-auto rounded bg-gray-900 px-3 py-2 font-mono text-xs text-green-300",children:["$ ",r]})}function Se(r){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Studio will run this command on your behalf:"}),e.jsx(G,{command:r.command}),e.jsx("p",{className:"text-xs text-amber-700","data-testid":"install-security-note",children:we}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button","data-testid":"install-cancel",className:"rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50",onClick:r.onCancel,children:"Cancel"}),e.jsx("button",{type:"button","data-testid":"install-run",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onRun,children:"Run install"})]})]})}function Ce(r){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-sm text-gray-700",children:"Installing…"}),e.jsx(G,{command:r.command}),e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-gray-600",children:[e.jsx("span",{"data-testid":"install-spinner",className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-300 border-t-blue-600"}),e.jsx("span",{"data-testid":"install-live-tail",className:"font-mono",children:r.liveTail||"starting…"})]})]})}function Le(r){return e.jsxs(e.Fragment,{children:[e.jsxs("p",{"data-testid":"install-success",className:"mt-3 text-sm font-medium text-green-700",children:["✓ ",r.label," installed"]}),e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx("button",{type:"button","data-testid":"install-close",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onClose,children:"Done"})})]})}function Ee(r){const[l,g]=j.useState(!1),x=r.progress.filter(a=>a.stream==="stderr").map(a=>a.line),i=x.length>0?x.join(`
2
- `):r.stderr;return e.jsxs(e.Fragment,{children:[e.jsx("p",{"data-testid":"install-failure",className:"mt-3 text-sm font-medium text-red-700",children:"✗ Install failed"}),e.jsx("p",{className:"mt-1 text-xs text-gray-700",children:r.error}),i&&e.jsxs("details",{className:"mt-3 text-xs",open:l,onToggle:a=>g(a.currentTarget.open),children:[e.jsx("summary",{className:"cursor-pointer text-gray-600",children:"stderr"}),e.jsx("pre",{"data-testid":"install-stderr",className:"mt-2 overflow-x-auto rounded bg-gray-900 px-3 py-2 font-mono text-xs text-red-300",children:i})]}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button","data-testid":"install-close",className:"rounded border border-gray-300 px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50",onClick:r.onClose,children:"Close"}),e.jsx("button",{type:"button","data-testid":"install-retry",className:"rounded bg-blue-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700",onClick:r.onRetry,children:"Retry"})]})]})}const S={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Pe(r){return r?/API usage limits|usage limit/i.test(r)&&/regain access|reset/i.test(r):!1}function Ie(r){const l=r.match(/regain access on ([^"\\]+?)(?:\s*UTC)?["\\]/i)??r.match(/regain access on ([^"\\]+)/i);return l?`Resets ${l[1].trim()} UTC`:"Quota resets at the start of your next billing period"}function I(r){switch(r){case"claude-cli":return"Uses your logged-in Claude Code session — your existing CLI session handles quota. No API key needed. Overflow runs at standard API rates if extra usage is enabled in your account settings.";case"anthropic":return"Direct Anthropic API — pay-per-token. Full Opus / Sonnet / Haiku catalog. Requires ANTHROPIC_API_KEY.";case"openrouter":return"One API key → 300+ models from Anthropic, OpenAI (GPT-5 / o4-mini), Google (Gemini), Meta (Llama) and more. Same prices as direct.";case"ollama":return"Local models on your machine (Llama, Qwen, Mistral, etc.). Zero cost, zero data leaves your laptop.";case"lm-studio":return"Local models via LM Studio's OpenAI-compatible server. Works offline. Pick any model you've loaded in LM Studio.";default:return""}}function M({size:r=14,color:l="currentColor"}){return e.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:l,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function Re(){const{config:r}=J(),{refreshSkills:l,revealSkill:g}=Z(),[x,i]=b.useState(null),a=j.useMemo(()=>{if(typeof window>"u")return{};const s=window.location.hash,d=s.indexOf("?");if(d===-1)return{};const N=new URLSearchParams(s.slice(d+1)),k={};for(const v of["mode","skillName","description","pluginName"]){const L=N.get(v);L&&(k[v]=L)}return k},[]),[c,n]=b.useState("claude-cli"),[o,h]=b.useState("sonnet"),[p,y]=b.useState(!1),[f,u]=b.useState(null),m=b.useRef(!1),[w,W]=b.useState([]),[U,K]=b.useState(()=>D("activeAgent",null));b.useEffect(()=>{function s(){K(D("activeAgent",null))}return window.addEventListener("studio:agent-changed",s),window.addEventListener("storage",s),()=>{window.removeEventListener("studio:agent-changed",s),window.removeEventListener("storage",s)}},[]);const Y=U!=="claude-code";b.useEffect(()=>{fetch("/api/agents/installed").then(s=>s.json()).then(s=>{s.agents&&W(s.agents)}).catch(()=>{})},[]),b.useEffect(()=>{var k;if(!r)return;const s=r.providers.filter(v=>v.available),d=B().skillGenModel;if(s.length===0){m.current=!0;return}if(d&&typeof d=="object"&&typeof d.provider=="string"&&typeof d.model=="string"){const v=s.find(T=>T.id===d.provider),L=v==null?void 0:v.models.some(T=>T.id===d.model);if(v&&L){n(d.provider),h(d.model),y(!0),m.current=!0;return}u({provider:d.provider,model:d.model})}if(s.find(v=>v.id==="claude-cli"))n("claude-cli"),h("sonnet");else{const v=s[0];n(v.id),h(((k=v.models[0])==null?void 0:k.id)??"")}y(!1),m.current=!0},[r]),b.useEffect(()=>{const s=d=>{if(d.key!==null&&!d.key.includes("vskill.studio.prefs"))return;const k=B().skillGenModel;k&&typeof k=="object"&&typeof k.provider=="string"&&typeof k.model=="string"&&(n(k.provider),h(k.model),y(!0))};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[]);const O=b.useCallback((s,d)=>{X("skillGenModel",{provider:s,model:d}),y(!0)},[]),q=b.useCallback(()=>({provider:c,model:o}),[c,o]),Q=a.mode==="standalone"?3:void 0,t=ee({onCreated:(s,d)=>{l(),setTimeout(()=>g(s,d),500)},resolveAiConfigOverride:q,forceLayout:Q});b.useEffect(()=>{a.skillName&&!t.name&&t.setName(P(a.skillName)),a.description&&!t.description&&t.setDescription(a.description),a.description&&!t.aiPrompt&&t.setAiPrompt(a.description),a.pluginName&&!t.plugin&&t.setPlugin(P(a.pluginName))},[]);const C=r==null?void 0:r.providers.find(s=>s.id===c&&s.available),_=b.useMemo(()=>{const s=["---"];return t.description?s.push(`description: "${t.description.replace(/"/g,'\\"')}"`):s.push('description: ""'),t.allowedTools.trim()&&s.push(`allowed-tools: ${t.allowedTools.trim()}`),t.model&&s.push(`model: ${t.model}`),t.targetAgents.length>0&&s.push(`target-agents: ${t.targetAgents.join(", ")}`),s.push("---"),s.push(""),t.body.trim()?s.push(t.body.trim()):(s.push(`# /${t.name||"skill-name"}`),s.push(""),s.push("You are a helpful assistant.")),s.join(`
3
- `)},[t.name,t.description,t.model,t.allowedTools,t.body]);return e.jsxs("div",{className:"px-4 py-6 sm:px-6 sm:py-7 lg:px-10 lg:py-8 max-w-6xl mx-auto w-full overflow-x-hidden",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:[e.jsx(R,{to:"/",className:"hover:underline",style:{color:"var(--text-tertiary)"},children:"Skills"}),e.jsx("span",{children:"/"}),e.jsx("span",{style:{color:"var(--text-secondary)"},children:"New Skill"})]}),e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-[22px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),t.standaloneLocked&&e.jsx("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider px-2 py-0.5 rounded whitespace-nowrap",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"1px solid var(--accent-muted)"},title:"You chose Standalone in the previous step. Plugin selection is disabled.",children:"Standalone"})]}),e.jsx("p",{className:"text-[13px] mt-1",style:{color:"var(--text-tertiary)"},children:"Define your skill's metadata, content, and placement"})]}),e.jsxs("div",{className:"inline-flex rounded-lg p-1 self-start sm:self-auto sm:flex-shrink-0 max-w-full",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},role:"tablist","aria-label":"Creation mode",children:[e.jsx("button",{onClick:()=>t.setMode("ai"),className:"px-4 py-2 rounded-md text-[13px] font-medium transition-all duration-200",style:{background:t.mode==="ai"?"var(--purple-muted)":"transparent",color:t.mode==="ai"?"var(--purple)":"var(--text-tertiary)",boxShadow:t.mode==="ai"?"0 1px 3px rgba(0,0,0,0.08)":"none"},children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(M,{size:14}),"AI-Assisted"]})}),e.jsx("button",{onClick:()=>t.setMode("manual"),className:"px-4 py-2 rounded-md text-[13px] font-medium transition-all duration-200",style:{background:t.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:t.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:t.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none"},children:"Manual"})]})]})]}),t.engineDetection&&e.jsx("div",{className:"mb-4",children:e.jsx(pe,{detection:t.engineDetection,selected:t.engine,onSelect:s=>t.setEngine(s),onInstallClick:s=>i(s)})}),t.layoutLoading&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),e.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),e.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!t.layoutLoading&&t.layout&&t.mode==="ai"&&e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 animate-fade-in",children:[e.jsxs("div",{className:"flex-1 min-w-0 space-y-5",children:[e.jsxs("div",{className:"glass-card p-5",children:[e.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[e.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"var(--purple-muted)"},children:e.jsx(M,{size:13,color:"var(--purple)"})}),"Describe Your Skill"]}),e.jsx("textarea",{ref:t.promptRef,value:t.aiPrompt,onChange:s=>t.setAiPrompt(s.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
1
+ import{j as e,R as j,u as Z,b as X,r as b,g as B,c as D,w as ee,d as te,e as se,t as P,L as R,P as re,E as le,f as ae,S as ne}from"./index-JaDg6FlU.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 Oe(){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.
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(oe,{agents:w,selectedIds:t.targetAgents,onChange:t.setTargetAgents})]}),t.generating&&t.aiProgress.length>0&&e.jsx("div",{children:e.jsx(te,{entries:t.aiProgress,isRunning:!0})}),t.aiError&&e.jsx("div",{children:Pe(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:[Ie(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(se,{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(ye,{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:{...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
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:re(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(ae,{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(Ne,{engine:x,onClose:()=>i(null),onSuccess:()=>{t.refreshEngineDetection()}})]})}export{Re 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:{...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{Oe as CreateSkillPage};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-CkVRvaZk.js","assets/index-DCbohW6l.js","assets/index-BKAvJDDF.css","assets/fonts-i7Lkz2zN.css","assets/skill-url-C4ekwoGs.js"])))=>i.map(i=>d[i]);
2
- import{r as t,j as d,_ as l}from"./index-DCbohW6l.js";/* empty css */const f=t.lazy(()=>l(()=>import("./SearchPaletteCore-CkVRvaZk.js"),__vite__mapDeps([0,1,2,3,4])));function w(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function y({onSelect:i,onNavigate:u}={}){const[n,o]=t.useState(!1),s=t.useRef(null),a=w();t.useEffect(()=>{function e(){s.current=document.activeElement??null,o(!0)}return window.addEventListener("openFindSkills",e),()=>window.removeEventListener("openFindSkills",e)},[]),t.useEffect(()=>{if(!n)return;function e(r){r.key==="Escape"&&o(!1)}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]),t.useEffect(()=>{if(n)return;const e=s.current;if(e&&typeof e.focus=="function")try{e.focus()}catch{}s.current=null},[n]);const c=t.useCallback((e,r)=>{try{typeof window<"u"&&window.sessionStorage&&window.sessionStorage.setItem("find-skills:last-query",r??"")}catch{}if(o(!1),i)try{i(e,r)}catch{}},[i]);return n?d.jsx("div",{"data-testid":"find-skills-palette-shell","data-reduced-motion":a?"true":"false",children:d.jsx(t.Suspense,{fallback:null,children:d.jsx(f,{initialOpen:!0,onSelect:c,onNavigate:u})})}):null}export{y as FindSkillsPalette,y as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SearchPaletteCore-Bf3PBC64.js","assets/index-JaDg6FlU.js","assets/index-CKLqBL52.css","assets/fonts-i7Lkz2zN.css","assets/skill-url-C4ekwoGs.js"])))=>i.map(i=>d[i]);
2
+ import{r as t,j as d,_ as l}from"./index-JaDg6FlU.js";/* empty css */const f=t.lazy(()=>l(()=>import("./SearchPaletteCore-Bf3PBC64.js"),__vite__mapDeps([0,1,2,3,4])));function w(){if(typeof window>"u"||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function y({onSelect:i,onNavigate:u}={}){const[n,o]=t.useState(!1),s=t.useRef(null),a=w();t.useEffect(()=>{function e(){s.current=document.activeElement??null,o(!0)}return window.addEventListener("openFindSkills",e),()=>window.removeEventListener("openFindSkills",e)},[]),t.useEffect(()=>{if(!n)return;function e(r){r.key==="Escape"&&o(!1)}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]),t.useEffect(()=>{if(n)return;const e=s.current;if(e&&typeof e.focus=="function")try{e.focus()}catch{}s.current=null},[n]);const c=t.useCallback((e,r)=>{try{typeof window<"u"&&window.sessionStorage&&window.sessionStorage.setItem("find-skills:last-query",r??"")}catch{}if(o(!1),i)try{i(e,r)}catch{}},[i]);return n?d.jsx("div",{"data-testid":"find-skills-palette-shell","data-reduced-motion":a?"true":"false",children:d.jsx(t.Suspense,{fallback:null,children:d.jsx(f,{initialOpen:!0,onSelect:c,onNavigate:u})})}):null}export{y as FindSkillsPalette,y as default};