@serviceme/devtools-cli 0.2.0 → 0.3.0

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.
@@ -68,6 +68,7 @@ var BRIDGE_METHODS = [
68
68
  "repo.remove",
69
69
  "repo.enable",
70
70
  "repo.disable",
71
+ "repo.update",
71
72
  "repo.sync",
72
73
  "repo.syncAll",
73
74
  "auth.status",
@@ -212,7 +213,7 @@ function normalizeServicemeError(error, fallbackCode = "internal_error") {
212
213
  }
213
214
 
214
215
  // src/version.ts
215
- var SERVICEME_CLI_VERSION = "0.2.0";
216
+ var SERVICEME_CLI_VERSION = "0.3.0";
216
217
 
217
218
  // src/bridge/handlers/AuthBridgeHandlers.ts
218
219
  var import_auth2 = require("@serviceme/devtools-core/auth");
@@ -597,6 +598,13 @@ var BridgeServer = class {
597
598
  this.writeSuccess(request.id, result);
598
599
  return;
599
600
  }
601
+ case "repo.update": {
602
+ const r = request;
603
+ if (!this.skillRepoHandler) return this.unsupportedV2(request.id);
604
+ const result = await this.skillRepoHandler.repoUpdate(r.params);
605
+ this.writeSuccess(request.id, result);
606
+ return;
607
+ }
600
608
  case "repo.sync": {
601
609
  const r = request;
602
610
  if (!this.skillRepoHandler) return this.unsupportedV2(request.id);
package/dist/cli.js CHANGED
@@ -112,6 +112,7 @@ var BRIDGE_METHODS = [
112
112
  "repo.remove",
113
113
  "repo.enable",
114
114
  "repo.disable",
115
+ "repo.update",
115
116
  "repo.sync",
116
117
  "repo.syncAll",
117
118
  "auth.status",
@@ -776,7 +777,7 @@ var readline = __toESM(require("readline"));
776
777
 
777
778
  // src/version.ts
778
779
  var SERVICEME_CLI_NAME = "serviceme";
779
- var SERVICEME_CLI_VERSION = "0.2.0";
780
+ var SERVICEME_CLI_VERSION = "0.3.0";
780
781
 
781
782
  // src/bridge/handlers/AuthBridgeHandlers.ts
782
783
  var import_auth3 = require("@serviceme/devtools-core/auth");
@@ -1161,6 +1162,13 @@ var BridgeServer = class {
1161
1162
  this.writeSuccess(request.id, result);
1162
1163
  return;
1163
1164
  }
1165
+ case "repo.update": {
1166
+ const r = request;
1167
+ if (!this.skillRepoHandler) return this.unsupportedV2(request.id);
1168
+ const result = await this.skillRepoHandler.repoUpdate(r.params);
1169
+ this.writeSuccess(request.id, result);
1170
+ return;
1171
+ }
1164
1172
  case "repo.sync": {
1165
1173
  const r = request;
1166
1174
  if (!this.skillRepoHandler) return this.unsupportedV2(request.id);
@@ -1335,10 +1343,7 @@ var SkillRepoBridgeHandler = class {
1335
1343
  detail = await store.get(params.repoId, params.name);
1336
1344
  } catch (err) {
1337
1345
  if (err instanceof import_skill_store.SkillNotFoundError) {
1338
- throw createServicemeError(
1339
- "not_found",
1340
- `Skill ${params.repoId}/${params.name} not found`
1341
- );
1346
+ throw createServicemeError("not_found", `Skill ${params.repoId}/${params.name} not found`);
1342
1347
  }
1343
1348
  throw err;
1344
1349
  }
@@ -1360,11 +1365,7 @@ var SkillRepoBridgeHandler = class {
1360
1365
  */
1361
1366
  async install(params) {
1362
1367
  const kind = params.kind ?? "skill";
1363
- const source = await this.resolveEntrySource(
1364
- params.repoId,
1365
- params.name,
1366
- kind
1367
- );
1368
+ const source = await this.resolveEntrySource(params.repoId, params.name, kind);
1368
1369
  try {
1369
1370
  const result = await (0, import_skill_linker.installSkillToWorkspace)({
1370
1371
  repoId: params.repoId,
@@ -1399,11 +1400,7 @@ var SkillRepoBridgeHandler = class {
1399
1400
  */
1400
1401
  async convertToSymlink(params) {
1401
1402
  const kind = params.kind ?? "skill";
1402
- const source = await this.resolveEntrySource(
1403
- params.repoId,
1404
- params.name,
1405
- kind
1406
- );
1403
+ const source = await this.resolveEntrySource(params.repoId, params.name, kind);
1407
1404
  try {
1408
1405
  const result = await (0, import_skill_linker.convertToSymlink)({
1409
1406
  repoId: params.repoId,
@@ -1464,9 +1461,7 @@ var SkillRepoBridgeHandler = class {
1464
1461
  const kind = params.kind ?? "skill";
1465
1462
  const scope = params.scope ?? "workspace";
1466
1463
  const scopesToScan = scope === "all" ? ["workspace", "user"] : [scope];
1467
- const linked = (await Promise.all(
1468
- scopesToScan.map((s) => (0, import_skill_linker.listLinkedSkills)(params.workspaceDir, kind, s))
1469
- )).flat();
1464
+ const linked = (await Promise.all(scopesToScan.map((s) => (0, import_skill_linker.listLinkedSkills)(params.workspaceDir, kind, s)))).flat();
1470
1465
  return {
1471
1466
  links: linked.map((l) => ({
1472
1467
  repoId: l.repoId,
@@ -1557,15 +1552,9 @@ var SkillRepoBridgeHandler = class {
1557
1552
  * literal, so we can't carry the "wasn't there" case in the result.
1558
1553
  */
1559
1554
  async draftDelete(params) {
1560
- const existing = await this.draftsStore.tryReadSummary(
1561
- params.kind,
1562
- params.id
1563
- );
1555
+ const existing = await this.draftsStore.tryReadSummary(params.kind, params.id);
1564
1556
  if (!existing) {
1565
- throw createServicemeError(
1566
- "not_found",
1567
- `Draft ${params.kind}/${params.id} not found`
1568
- );
1557
+ throw createServicemeError("not_found", `Draft ${params.kind}/${params.id} not found`);
1569
1558
  }
1570
1559
  await this.draftsStore.delete(params.kind, params.id);
1571
1560
  return { deleted: true };
@@ -1594,7 +1583,8 @@ var SkillRepoBridgeHandler = class {
1594
1583
  const result = await repoManager.addUserRepo({
1595
1584
  url: params.url,
1596
1585
  branch: params.branch,
1597
- name: params.name
1586
+ name: params.name,
1587
+ useProxy: params.useProxy
1598
1588
  });
1599
1589
  return {
1600
1590
  repo: toBridgeRepoEntry(result.repo),
@@ -1607,7 +1597,8 @@ var SkillRepoBridgeHandler = class {
1607
1597
  * repos (the Store enforces this).
1608
1598
  */
1609
1599
  async repoRemove(params) {
1610
- await this.reposStore.removeUserRepo(params.repoId);
1600
+ const repoManager = this.buildRepoManager();
1601
+ await repoManager.removeUserRepo(params.repoId);
1611
1602
  return { removed: true };
1612
1603
  }
1613
1604
  /** Enable a repo (sets `enabled = true`). */
@@ -1620,6 +1611,27 @@ var SkillRepoBridgeHandler = class {
1620
1611
  const repo = await this.reposStore.disableRepo(params.repoId);
1621
1612
  return { repo: toBridgeRepoEntry(repo) };
1622
1613
  }
1614
+ /** Update editable repo fields (url/branch/name/enabled). */
1615
+ async repoUpdate(params) {
1616
+ const patch = {};
1617
+ if (typeof params.url === "string") {
1618
+ patch.url = params.url;
1619
+ }
1620
+ if (typeof params.branch === "string") {
1621
+ patch.branch = params.branch;
1622
+ }
1623
+ if (typeof params.name === "string") {
1624
+ patch.name = params.name;
1625
+ }
1626
+ if (typeof params.enabled === "boolean") {
1627
+ patch.enabled = params.enabled;
1628
+ }
1629
+ if (typeof params.useProxy === "boolean") {
1630
+ patch.useProxy = params.useProxy;
1631
+ }
1632
+ const repo = await this.reposStore.updateRepo(params.repoId, patch);
1633
+ return { repo: toBridgeRepoEntry(repo) };
1634
+ }
1623
1635
  /** Sync (pull) a single repo. Returns the per-repo outcome. */
1624
1636
  async repoSync(params) {
1625
1637
  const repoManager = this.buildRepoManager();
@@ -1679,18 +1691,12 @@ var SkillRepoBridgeHandler = class {
1679
1691
  entry = await store.get(repoId, name);
1680
1692
  } catch (err) {
1681
1693
  if (err instanceof import_skill_store.SkillNotFoundError) {
1682
- throw createServicemeError(
1683
- "not_found",
1684
- `Skill ${repoId}/${name} not present on disk`
1685
- );
1694
+ throw createServicemeError("not_found", `Skill ${repoId}/${name} not present on disk`);
1686
1695
  }
1687
1696
  throw err;
1688
1697
  }
1689
1698
  if (entry.kind !== kind) {
1690
- throw createServicemeError(
1691
- "not_found",
1692
- `Skill ${repoId}/${name} not present on disk`
1693
- );
1699
+ throw createServicemeError("not_found", `Skill ${repoId}/${name} not present on disk`);
1694
1700
  }
1695
1701
  const sourceIsFile = entry.dir === entry.manifestPath;
1696
1702
  return { sourcePath: entry.dir, sourceIsFile };
@@ -1721,6 +1727,7 @@ function toBridgeRepoEntry(repo) {
1721
1727
  url: repo.url,
1722
1728
  branch: repo.branch,
1723
1729
  enabled: repo.enabled,
1730
+ useProxy: repo.useProxy,
1724
1731
  writeEnabled: repo.writeEnabled,
1725
1732
  source: repo.source,
1726
1733
  description: repo.description,
@@ -1857,7 +1864,7 @@ async function handleEnroll(parsed) {
1857
1864
  async function handleRotateSecret(parsed) {
1858
1865
  const gracePeriodDaysArg = getStringFlag(parsed, "gracePeriodDays");
1859
1866
  const gracePeriodDays = gracePeriodDaysArg ? parseInt(gracePeriodDaysArg, 10) : 7;
1860
- if (isNaN(gracePeriodDays) || gracePeriodDays < 0 || gracePeriodDays > 365) {
1867
+ if (Number.isNaN(gracePeriodDays) || gracePeriodDays < 0 || gracePeriodDays > 365) {
1861
1868
  throw createServicemeError("invalid_params", "Expected --gracePeriodDays <0-365>.");
1862
1869
  }
1863
1870
  const core = makeDeviceCore();
@@ -2439,7 +2446,7 @@ async function handleCreate(parsed) {
2439
2446
  writeSuccess({ task });
2440
2447
  }
2441
2448
  function handleList3(parsed) {
2442
- const wp = requireWorkspace(parsed);
2449
+ const _wp = requireWorkspace(parsed);
2443
2450
  const mgr = new import_devtools_core11.TaskConfigManager();
2444
2451
  const tasks = mgr.listTasks();
2445
2452
  const fields = getStringFlag(parsed, "fields");
@@ -2454,7 +2461,7 @@ function handleList3(parsed) {
2454
2461
  writeSuccess({ tasks: result, total: tasks.length });
2455
2462
  }
2456
2463
  function handleGet(parsed) {
2457
- const wp = requireWorkspace(parsed);
2464
+ const _wp = requireWorkspace(parsed);
2458
2465
  const id = requireId(parsed);
2459
2466
  const mgr = new import_devtools_core11.TaskConfigManager();
2460
2467
  const task = mgr.getTask(id);
@@ -2466,7 +2473,7 @@ function handleGet(parsed) {
2466
2473
  writeSuccess({ task: result });
2467
2474
  }
2468
2475
  async function handleEdit(parsed) {
2469
- const wp = requireWorkspace(parsed);
2476
+ const _wp = requireWorkspace(parsed);
2470
2477
  const id = requireId(parsed);
2471
2478
  const mgr = new import_devtools_core11.TaskConfigManager();
2472
2479
  const existing = mgr.getTask(id);
@@ -2510,7 +2517,7 @@ async function handleEdit(parsed) {
2510
2517
  writeSuccess({ task });
2511
2518
  }
2512
2519
  function handleDelete(parsed) {
2513
- const wp = requireWorkspace(parsed);
2520
+ const _wp = requireWorkspace(parsed);
2514
2521
  const id = requireId(parsed);
2515
2522
  requireConfirmation(parsed);
2516
2523
  const mgr = new import_devtools_core11.TaskConfigManager();
@@ -2526,7 +2533,7 @@ function handleDelete(parsed) {
2526
2533
  writeSuccess({ id, name: existing.name });
2527
2534
  }
2528
2535
  function handleToggle(parsed) {
2529
- const wp = requireWorkspace(parsed);
2536
+ const _wp = requireWorkspace(parsed);
2530
2537
  const id = requireId(parsed);
2531
2538
  const enabledStr = getStringFlag(parsed, "enabled");
2532
2539
  if (enabledStr === void 0) {
@@ -2568,7 +2575,7 @@ async function handleTrigger(parsed) {
2568
2575
  writeSuccess({ log });
2569
2576
  }
2570
2577
  function handleLogs(parsed) {
2571
- const wp = requireWorkspace(parsed);
2578
+ const _wp = requireWorkspace(parsed);
2572
2579
  const taskId = getStringFlag(parsed, "task-id");
2573
2580
  const limitStr = getStringFlag(parsed, "limit");
2574
2581
  const limit = limitStr ? Math.min(Number(limitStr), 200) : 20;
@@ -2819,7 +2826,7 @@ function getSchedulerStatus() {
2819
2826
  pidFile: pidMgr.getPidPath()
2820
2827
  };
2821
2828
  }
2822
- function handleStart(parsed) {
2829
+ function handleStart(_parsed) {
2823
2830
  const pidMgr = new import_devtools_core12.PidManager("", { pidPath: (0, import_devtools_core12.getSchedulerPidPath)() });
2824
2831
  const existingPid = pidMgr.getRunningPid();
2825
2832
  if (existingPid !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serviceme/devtools-cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Unified SERVICEME CLI for automation, project scaffolding, and bridge-based tooling.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "repository": {
@@ -43,12 +43,13 @@
43
43
  "tsup": "^8.5.1",
44
44
  "tsx": "^4.22.0",
45
45
  "typescript": "^5.9.3",
46
- "@serviceme/devtools-core": "0.2.0",
47
- "@serviceme/devtools-protocol": "0.2.0"
46
+ "@serviceme/devtools-core": "0.3.0",
47
+ "@serviceme/devtools-protocol": "0.3.0"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "tsup --config tsup.config.ts",
51
51
  "lint": "biome check src test",
52
+ "format": "biome format --write src test",
52
53
  "release:check": "pnpm run test && npm pack --dry-run",
53
54
  "test": "pnpm run build && node --test test/*.test.js && node --import tsx --test 'src/**/__tests__/**/*.test.ts'",
54
55
  "pack": "npm pack",