inkbridge 0.1.0-beta.13 → 0.1.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/inkbridge.mjs CHANGED
@@ -214,6 +214,66 @@ function printPath() {
214
214
  console.log(manifestPath);
215
215
  }
216
216
 
217
+ // ---------------------------------------------------------------------------
218
+ // skill — install the Inkbridge AI skill into the consuming project's
219
+ // .claude/skills/ folder. Maintainer-only convenience: lets developers who
220
+ // extend the plugin (us, the starter, future internal projects) get the
221
+ // canonical agent context without copy-pasting Markdown around.
222
+ //
223
+ // Two modes, picked automatically:
224
+ // - **Sibling mode**: if `../inkbridge/.claude/skills/inkbridge-figma-plugin`
225
+ // exists relative to PROJECT_ROOT, create a symlink. Edits in inkbridge
226
+ // propagate immediately. This is what the starter / co-located projects
227
+ // should use.
228
+ // - **Fetch mode**: otherwise, clone the skill folder from
229
+ // github.com/inkn9ne/inkbridge via degit. Snapshot install — re-run to
230
+ // update. This is what non-co-located projects should use.
231
+ // ---------------------------------------------------------------------------
232
+ import { symlink, rm } from "fs/promises";
233
+
234
+ const SKILL_REL_PATH = ".claude/skills/inkbridge-figma-plugin";
235
+
236
+ async function installSkill() {
237
+ const target = join(PROJECT_ROOT, SKILL_REL_PATH);
238
+ const siblingSource = resolve(PROJECT_ROOT, "..", "inkbridge", SKILL_REL_PATH);
239
+
240
+ await mkdir(dirname(target), { recursive: true });
241
+
242
+ if (existsSync(siblingSource)) {
243
+ // Sibling mode — symlink for live updates from the inkbridge repo
244
+ if (existsSync(target)) {
245
+ console.log(` ~ ${SKILL_REL_PATH} already exists — removing to relink`);
246
+ await rm(target, { recursive: true, force: true });
247
+ }
248
+ const relativeSource = resolve(siblingSource);
249
+ await symlink(relativeSource, target, "dir");
250
+ console.log(` ✓ symlinked ${SKILL_REL_PATH} → ${relativeSource}`);
251
+ console.log("");
252
+ console.log(" Sibling-mode install. Edits in the inkbridge repo's");
253
+ console.log(" .claude/skills/inkbridge-figma-plugin/ will propagate here");
254
+ console.log(" immediately. Reload Claude Code to pick up the skill.");
255
+ return;
256
+ }
257
+
258
+ // Fetch mode — pull the current main from GitHub via degit
259
+ if (existsSync(target)) {
260
+ console.log(` ~ ${SKILL_REL_PATH} already exists — re-fetching to update`);
261
+ await rm(target, { recursive: true, force: true });
262
+ }
263
+ const { spawn } = await import("child_process");
264
+ const args = ["degit", "inkn9ne/inkbridge/.claude/skills/inkbridge-figma-plugin", target];
265
+ console.log(` ↓ npx ${args.join(" ")}`);
266
+ await new Promise((resolve, reject) => {
267
+ const child = spawn("npx", args, { stdio: "inherit" });
268
+ child.on("exit", code => (code === 0 ? resolve() : reject(new Error(`degit exited ${code}`))));
269
+ child.on("error", reject);
270
+ });
271
+ console.log(` ✓ installed ${SKILL_REL_PATH} from inkn9ne/inkbridge`);
272
+ console.log("");
273
+ console.log(" Fetch-mode install (snapshot from main). Re-run");
274
+ console.log(" `pnpm exec inkbridge skill install` to update.");
275
+ }
276
+
217
277
  // ---------------------------------------------------------------------------
218
278
  // dispatch
219
279
  // ---------------------------------------------------------------------------
@@ -227,9 +287,22 @@ switch (command) {
227
287
  case "path":
228
288
  printPath();
229
289
  break;
290
+ case "skill": {
291
+ const sub = process.argv[3];
292
+ if (sub === "install") {
293
+ await installSkill();
294
+ } else {
295
+ console.log("Usage:");
296
+ console.log(" inkbridge skill install Install the AI skill into .claude/skills/");
297
+ console.log(" (symlinks to ../inkbridge if co-located,");
298
+ console.log(" otherwise fetches via degit from GitHub)");
299
+ }
300
+ break;
301
+ }
230
302
  default:
231
303
  console.log("Usage:");
232
- console.log(" inkbridge setup Wire up scanner/token-patch routes + scripts (run once after install)");
233
- console.log(" inkbridge path Print the manifest.json path for Figma Desktop");
304
+ console.log(" inkbridge setup Wire up scanner/token-patch routes + scripts (run once after install)");
305
+ console.log(" inkbridge path Print the manifest.json path for Figma Desktop");
306
+ console.log(" inkbridge skill install Install the AI development skill (maintainers only)");
234
307
  break;
235
308
  }