@mp-lb/forum-cli 0.1.43 → 0.1.44

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/dist/index.js CHANGED
@@ -1879,12 +1879,12 @@ var KNOWN_JUNK_RULES = [
1879
1879
  ];
1880
1880
  var detectJunk = (paths, rules = KNOWN_JUNK_RULES) => {
1881
1881
  const grouped = /* @__PURE__ */ new Map();
1882
- for (const path22 of paths) {
1883
- const rule = rules.find((candidate) => candidate.matches(path22));
1882
+ for (const path25 of paths) {
1883
+ const rule = rules.find((candidate) => candidate.matches(path25));
1884
1884
  if (!rule) continue;
1885
1885
  const existing = grouped.get(rule);
1886
- if (existing) existing.push(path22);
1887
- else grouped.set(rule, [path22]);
1886
+ if (existing) existing.push(path25);
1887
+ else grouped.set(rule, [path25]);
1888
1888
  }
1889
1889
  return rules.filter((rule) => grouped.has(rule)).map((rule) => ({
1890
1890
  rule,
@@ -2102,18 +2102,10 @@ var prepareCheckoutIgnore = async ({
2102
2102
 
2103
2103
  // src/index.ts
2104
2104
  import { realpathSync, watch as watch2 } from "fs";
2105
- import path21 from "path";
2106
- import {
2107
- lstat as lstat2,
2108
- mkdir as mkdir6,
2109
- readFile as readFile8,
2110
- rename as rename4,
2111
- rm as rm5,
2112
- writeFile as writeFile6
2113
- } from "fs/promises";
2105
+ import path24 from "path";
2106
+ import { lstat as lstat5, mkdir as mkdir7, readFile as readFile10, rm as rm6, writeFile as writeFile7 } from "fs/promises";
2114
2107
  import { createInterface as createInterface2 } from "readline/promises";
2115
2108
  import { pathToFileURL } from "url";
2116
- import { parse as parseYaml } from "yaml";
2117
2109
 
2118
2110
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
2119
2111
  var external_exports = {};
@@ -2881,10 +2873,10 @@ function mergeDefs(...defs) {
2881
2873
  function cloneDef(schema) {
2882
2874
  return mergeDefs(schema._zod.def);
2883
2875
  }
2884
- function getElementAtPath(obj, path22) {
2885
- if (!path22)
2876
+ function getElementAtPath(obj, path25) {
2877
+ if (!path25)
2886
2878
  return obj;
2887
- return path22.reduce((acc, key) => acc?.[key], obj);
2879
+ return path25.reduce((acc, key) => acc?.[key], obj);
2888
2880
  }
2889
2881
  function promiseAllObject(promisesObj) {
2890
2882
  const keys = Object.keys(promisesObj);
@@ -3293,11 +3285,11 @@ function explicitlyAborted(x, startIndex = 0) {
3293
3285
  }
3294
3286
  return false;
3295
3287
  }
3296
- function prefixIssues(path22, issues) {
3288
+ function prefixIssues(path25, issues) {
3297
3289
  return issues.map((iss) => {
3298
3290
  var _a3;
3299
3291
  (_a3 = iss).path ?? (_a3.path = []);
3300
- iss.path.unshift(path22);
3292
+ iss.path.unshift(path25);
3301
3293
  return iss;
3302
3294
  });
3303
3295
  }
@@ -3444,16 +3436,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
3444
3436
  }
3445
3437
  function formatError(error51, mapper = (issue2) => issue2.message) {
3446
3438
  const fieldErrors = { _errors: [] };
3447
- const processError = (error52, path22 = []) => {
3439
+ const processError = (error52, path25 = []) => {
3448
3440
  for (const issue2 of error52.issues) {
3449
3441
  if (issue2.code === "invalid_union" && issue2.errors.length) {
3450
- issue2.errors.map((issues) => processError({ issues }, [...path22, ...issue2.path]));
3442
+ issue2.errors.map((issues) => processError({ issues }, [...path25, ...issue2.path]));
3451
3443
  } else if (issue2.code === "invalid_key") {
3452
- processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
3444
+ processError({ issues: issue2.issues }, [...path25, ...issue2.path]);
3453
3445
  } else if (issue2.code === "invalid_element") {
3454
- processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
3446
+ processError({ issues: issue2.issues }, [...path25, ...issue2.path]);
3455
3447
  } else {
3456
- const fullpath = [...path22, ...issue2.path];
3448
+ const fullpath = [...path25, ...issue2.path];
3457
3449
  if (fullpath.length === 0) {
3458
3450
  fieldErrors._errors.push(mapper(issue2));
3459
3451
  } else {
@@ -3480,17 +3472,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
3480
3472
  }
3481
3473
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
3482
3474
  const result = { errors: [] };
3483
- const processError = (error52, path22 = []) => {
3475
+ const processError = (error52, path25 = []) => {
3484
3476
  var _a3, _b;
3485
3477
  for (const issue2 of error52.issues) {
3486
3478
  if (issue2.code === "invalid_union" && issue2.errors.length) {
3487
- issue2.errors.map((issues) => processError({ issues }, [...path22, ...issue2.path]));
3479
+ issue2.errors.map((issues) => processError({ issues }, [...path25, ...issue2.path]));
3488
3480
  } else if (issue2.code === "invalid_key") {
3489
- processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
3481
+ processError({ issues: issue2.issues }, [...path25, ...issue2.path]);
3490
3482
  } else if (issue2.code === "invalid_element") {
3491
- processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
3483
+ processError({ issues: issue2.issues }, [...path25, ...issue2.path]);
3492
3484
  } else {
3493
- const fullpath = [...path22, ...issue2.path];
3485
+ const fullpath = [...path25, ...issue2.path];
3494
3486
  if (fullpath.length === 0) {
3495
3487
  result.errors.push(mapper(issue2));
3496
3488
  continue;
@@ -3522,8 +3514,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
3522
3514
  }
3523
3515
  function toDotPath(_path) {
3524
3516
  const segs = [];
3525
- const path22 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
3526
- for (const seg of path22) {
3517
+ const path25 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
3518
+ for (const seg of path25) {
3527
3519
  if (typeof seg === "number")
3528
3520
  segs.push(`[${seg}]`);
3529
3521
  else if (typeof seg === "symbol")
@@ -16215,13 +16207,13 @@ function resolveRef(ref, ctx) {
16215
16207
  if (!ref.startsWith("#")) {
16216
16208
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
16217
16209
  }
16218
- const path22 = ref.slice(1).split("/").filter(Boolean);
16219
- if (path22.length === 0) {
16210
+ const path25 = ref.slice(1).split("/").filter(Boolean);
16211
+ if (path25.length === 0) {
16220
16212
  return ctx.rootSchema;
16221
16213
  }
16222
16214
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
16223
- if (path22[0] === defsKey) {
16224
- const key = path22[1];
16215
+ if (path25[0] === defsKey) {
16216
+ const key = path25[1];
16225
16217
  if (!key || !ctx.defs[key]) {
16226
16218
  throw new Error(`Reference not found: ${ref}`);
16227
16219
  }
@@ -17259,6 +17251,7 @@ var fileTypeIdSchema = external_exports.union([
17259
17251
  external_exports.literal("experiment"),
17260
17252
  external_exports.literal("invoice"),
17261
17253
  external_exports.literal("list"),
17254
+ external_exports.literal("skills"),
17262
17255
  external_exports.literal("lottie"),
17263
17256
  external_exports.literal("meta_ad_campaign"),
17264
17257
  external_exports.literal("resume"),
@@ -17275,6 +17268,12 @@ var fileTypeIdSchema = external_exports.union([
17275
17268
  external_exports.literal("unknown")
17276
17269
  ]);
17277
17270
  var fileTypeDefinitions = [
17271
+ {
17272
+ id: "skills",
17273
+ label: "Skills index",
17274
+ extensions: [".skills.json"],
17275
+ storageClass: textStorageClass
17276
+ },
17278
17277
  {
17279
17278
  id: "asset-library",
17280
17279
  label: "Asset Library",
@@ -17559,8 +17558,8 @@ var normalizeStorePath = (value) => {
17559
17558
  }
17560
17559
  return segments2.length === 0 ? "/" : `/${segments2.join("/")}`;
17561
17560
  };
17562
- var storePathToArray = (path22) => {
17563
- const normalizedPath = normalizeStorePath(path22);
17561
+ var storePathToArray = (path25) => {
17562
+ const normalizedPath = normalizeStorePath(path25);
17564
17563
  return normalizedPath === "/" ? [] : normalizedPath.split("/").filter(Boolean);
17565
17564
  };
17566
17565
  var storePathSchema = external_exports.string().trim().min(1).transform((value) => normalizeStorePath(value));
@@ -19607,21 +19606,21 @@ var isKey = (value) => /^\w*$/.test(value);
19607
19606
  var isUndefined = (val) => val === void 0;
19608
19607
  var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
19609
19608
  var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
19610
- var get = (object2, path22, defaultValue) => {
19611
- if (!path22 || !isObject2(object2)) {
19609
+ var get = (object2, path25, defaultValue) => {
19610
+ if (!path25 || !isObject2(object2)) {
19612
19611
  return defaultValue;
19613
19612
  }
19614
- const paths = isKey(path22) ? [path22] : stringToPath(path22);
19613
+ const paths = isKey(path25) ? [path25] : stringToPath(path25);
19615
19614
  const result = paths.reduce((result2, key) => {
19616
19615
  return isNullOrUndefined(result2) ? void 0 : result2[key];
19617
19616
  }, object2);
19618
- return isUndefined(result) || result === object2 ? isUndefined(object2[path22]) ? defaultValue : object2[path22] : result;
19617
+ return isUndefined(result) || result === object2 ? isUndefined(object2[path25]) ? defaultValue : object2[path25] : result;
19619
19618
  };
19620
19619
  var isBoolean = (value) => typeof value === "boolean";
19621
19620
  var isFunction = (value) => typeof value === "function";
19622
- var set2 = (object2, path22, value) => {
19621
+ var set2 = (object2, path25, value) => {
19623
19622
  let index = -1;
19624
- const tempPath = isKey(path22) ? [path22] : stringToPath(path22);
19623
+ const tempPath = isKey(path25) ? [path25] : stringToPath(path25);
19625
19624
  const length = tempPath.length;
19626
19625
  const lastIndex = length - 1;
19627
19626
  while (++index < length) {
@@ -19819,12 +19818,12 @@ function isEmptyArray(obj) {
19819
19818
  }
19820
19819
  return true;
19821
19820
  }
19822
- function unset(object2, path22) {
19823
- if (isString(path22) && Object.prototype.hasOwnProperty.call(object2, path22)) {
19824
- delete object2[path22];
19821
+ function unset(object2, path25) {
19822
+ if (isString(path25) && Object.prototype.hasOwnProperty.call(object2, path25)) {
19823
+ delete object2[path25];
19825
19824
  return object2;
19826
19825
  }
19827
- const paths = Array.isArray(path22) ? path22 : isKey(path22) ? [path22] : stringToPath(path22);
19826
+ const paths = Array.isArray(path25) ? path25 : isKey(path25) ? [path25] : stringToPath(path25);
19828
19827
  const childObject = paths.length === 1 ? object2 : baseGet(object2, paths);
19829
19828
  const index = paths.length - 1;
19830
19829
  const key = paths[index];
@@ -22670,6 +22669,41 @@ var redeemPromoCodeResultSchema = external_exports.object({
22670
22669
  grantAmount: external_exports.number().int().nonnegative()
22671
22670
  });
22672
22671
 
22672
+ // ../../packages/core/src/skills/skillIndexSchema.ts
22673
+ var skillSlugSchema = external_exports.string().min(1).max(64).regex(
22674
+ /^[a-z0-9]+(?:-[a-z0-9]+)*$/,
22675
+ "Use lowercase letters, numbers, and single hyphens."
22676
+ );
22677
+ var skillStorePathSchema = external_exports.string().min(1).max(1024).regex(
22678
+ // eslint-disable-next-line no-control-regex -- Store paths must reject control characters.
22679
+ /^(?!\.{1,2}(?:\/|$))(?!.*\/\.{1,2}(?:\/|$))[^/\\:\u0000-\u001f\u007f]+(?:\/[^/\\:\u0000-\u001f\u007f]+)*$/,
22680
+ "Use a path from the store root, without a leading slash, URL, or dot segments."
22681
+ );
22682
+ var skillIndexPathSchema = skillStorePathSchema.regex(/\.skills\.json$/i);
22683
+ var skillDocumentPathSchema = skillStorePathSchema.regex(/\.(md|markdown)$/i);
22684
+ var skillIndexItemSchema = external_exports.strictObject({
22685
+ slug: skillSlugSchema,
22686
+ description: external_exports.string().trim().min(1).max(1024),
22687
+ path: skillDocumentPathSchema
22688
+ });
22689
+ var skillIndexSchema = external_exports.strictObject({
22690
+ $schema: external_exports.string().optional(),
22691
+ version: external_exports.literal(1),
22692
+ items: external_exports.array(skillIndexItemSchema)
22693
+ }).superRefine((index, ctx) => {
22694
+ const slugs = /* @__PURE__ */ new Set();
22695
+ index.items.forEach((item, position) => {
22696
+ if (slugs.has(item.slug)) {
22697
+ ctx.addIssue({
22698
+ code: "custom",
22699
+ path: ["items", position, "slug"],
22700
+ message: `Duplicate skill: ${item.slug}`
22701
+ });
22702
+ }
22703
+ slugs.add(item.slug);
22704
+ });
22705
+ });
22706
+
22673
22707
  // ../../packages/core/src/structuredFileSchemas.ts
22674
22708
  var structuredSchemaReferenceShape = {
22675
22709
  $schema: external_exports.string().url().optional()
@@ -23490,6 +23524,7 @@ var creatableFileTypeSections = [
23490
23524
  t("board", "Board", ".board.json"),
23491
23525
  t("calendar", "Calendar", ".calendar.json"),
23492
23526
  t("list", "List", ".list.json"),
23527
+ t("skills", "Skills index", ".skills.json"),
23493
23528
  t("data-table", "Data table", ".table.json"),
23494
23529
  t("spreadsheet", "Spreadsheet", ".sheet.json"),
23495
23530
  t("experiment", "Experimental tracker", ".experiment.json"),
@@ -23551,7 +23586,7 @@ var publicActionSubmitResultSchema = external_exports.unknown();
23551
23586
 
23552
23587
  // ../../packages/core/src/widgetRuntime.ts
23553
23588
  var widgetRuntimeOutputPathSchema = storePathSchema.refine(
23554
- (path22) => path22 !== "/",
23589
+ (path25) => path25 !== "/",
23555
23590
  {
23556
23591
  message: "Path must not be the root directory."
23557
23592
  }
@@ -23601,7 +23636,7 @@ var widgetRuntimeCompleteAttachmentUploadInputSchema = storeRefSchema.safeExtend
23601
23636
  treeVisibility: external_exports.enum(["visible", "hidden"]).optional(),
23602
23637
  uploadIntentId: external_exports.string().trim().min(1)
23603
23638
  });
23604
- var widgetRuntimeLinkPathSchema = external_exports.string().trim().min(1).max(2048).refine((path22) => path22.startsWith("/") && !path22.startsWith("//"), {
23639
+ var widgetRuntimeLinkPathSchema = external_exports.string().trim().min(1).max(2048).refine((path25) => path25.startsWith("/") && !path25.startsWith("//"), {
23605
23640
  message: "Link path must be a relative application path."
23606
23641
  });
23607
23642
  var widgetRuntimeCreateSigningLinkInputSchema = storeRefSchema.safeExtend({
@@ -23654,8 +23689,8 @@ var storeMemberSchema = external_exports.object({
23654
23689
 
23655
23690
  // ../../packages/store-tree/src/patterns.ts
23656
23691
  var escapeRegex2 = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
23657
- var basename2 = (path22) => {
23658
- const segments2 = path22.split("/").filter(Boolean);
23692
+ var basename2 = (path25) => {
23693
+ const segments2 = path25.split("/").filter(Boolean);
23659
23694
  return segments2[segments2.length - 1] ?? "";
23660
23695
  };
23661
23696
  var normalizeStorePathPattern = (pattern) => pattern.trim();
@@ -23673,7 +23708,7 @@ var storePathPatternToRegex = (pattern) => {
23673
23708
  return new RegExp(source, "i");
23674
23709
  };
23675
23710
  var doesStorePathPatternMatch = ({
23676
- path: path22,
23711
+ path: path25,
23677
23712
  pattern,
23678
23713
  mode = "path"
23679
23714
  }) => {
@@ -23681,7 +23716,7 @@ var doesStorePathPatternMatch = ({
23681
23716
  if (!normalizedPattern) {
23682
23717
  return true;
23683
23718
  }
23684
- const normalizedPath = normalizeStorePath(path22);
23719
+ const normalizedPath = normalizeStorePath(path25);
23685
23720
  const target = mode === "basename" ? basename2(normalizedPath) : normalizedPath;
23686
23721
  if (patternHasWildcard(normalizedPattern)) {
23687
23722
  return storePathPatternToRegex(normalizedPattern).test(target);
@@ -23769,8 +23804,8 @@ var isIssueRecord = (value) => {
23769
23804
  return isRecord2(value) && typeof value.message === "string";
23770
23805
  };
23771
23806
  var formatIssue = (issue2) => {
23772
- const path22 = Array.isArray(issue2.path) && issue2.path.length > 0 ? issue2.path.map(String).join(".") : "";
23773
- return path22 ? `${path22}: ${issue2.message}` : issue2.message;
23807
+ const path25 = Array.isArray(issue2.path) && issue2.path.length > 0 ? issue2.path.map(String).join(".") : "";
23808
+ return path25 ? `${path25}: ${issue2.message}` : issue2.message;
23774
23809
  };
23775
23810
  var formatIssueArray = (issues) => {
23776
23811
  if (!issues.every(isIssueRecord)) {
@@ -24243,7 +24278,7 @@ var buildContentChangedConflictExplainer = (issues) => {
24243
24278
  body: [
24244
24279
  pathSubject(
24245
24280
  paths,
24246
- (path22) => `${path22} changed both locally and remotely.`,
24281
+ (path25) => `${path25} changed both locally and remotely.`,
24247
24282
  (count) => `${count} files changed both locally and remotely.`
24248
24283
  ),
24249
24284
  "Forum left these files alone because either overwrite direction could lose work."
@@ -24275,7 +24310,7 @@ var buildLocalDeleteRemoteChangeExplainer = (issues) => {
24275
24310
  body: [
24276
24311
  pathSubject(
24277
24312
  paths,
24278
- (path22) => `${path22} was deleted locally, but the remote file changed.`,
24313
+ (path25) => `${path25} was deleted locally, but the remote file changed.`,
24279
24314
  (count) => `${count} files were deleted locally, but changed remotely.`
24280
24315
  ),
24281
24316
  "Forum did not delete newer remote work automatically."
@@ -24307,7 +24342,7 @@ var buildMoveDestinationConflictExplainer = (issues) => {
24307
24342
  body: [
24308
24343
  pathSubject(
24309
24344
  paths,
24310
- (path22) => `${path22} is the destination of a remote move, but already exists locally.`,
24345
+ (path25) => `${path25} is the destination of a remote move, but already exists locally.`,
24311
24346
  (count) => `${count} paths are remote move destinations that already exist locally.`
24312
24347
  ),
24313
24348
  "Forum synced unrelated files but left these paths alone."
@@ -24342,7 +24377,7 @@ var buildMoveRemoteChangeConflictExplainer = (issues) => {
24342
24377
  body: [
24343
24378
  pathSubject(
24344
24379
  paths,
24345
- (path22) => `${path22} was involved in a move while the other side changed it.`,
24380
+ (path25) => `${path25} was involved in a move while the other side changed it.`,
24346
24381
  (count) => `${count} files were involved in moves while the other side changed them.`
24347
24382
  ),
24348
24383
  "Forum did not combine the move and content change automatically."
@@ -24374,7 +24409,7 @@ var buildMoveMoveConflictExplainer = (issues) => {
24374
24409
  body: [
24375
24410
  pathSubject(
24376
24411
  paths,
24377
- (path22) => `${path22} moved locally and remotely to different paths.`,
24412
+ (path25) => `${path25} moved locally and remotely to different paths.`,
24378
24413
  (count) => `${count} files moved locally and remotely to different paths.`
24379
24414
  ),
24380
24415
  "Forum left these moves unresolved because choosing a path automatically could hide work."
@@ -24406,7 +24441,7 @@ var buildDeleteMoveConflictExplainer = (issues) => {
24406
24441
  body: [
24407
24442
  pathSubject(
24408
24443
  paths,
24409
- (path22) => `${path22} was deleted on one side and moved on the other.`,
24444
+ (path25) => `${path25} was deleted on one side and moved on the other.`,
24410
24445
  (count) => `${count} files were deleted on one side and moved on the other.`
24411
24446
  ),
24412
24447
  "Forum did not choose between delete and move automatically."
@@ -24438,7 +24473,7 @@ var buildReferenceLocalFileConflictExplainer = (issues) => {
24438
24473
  body: [
24439
24474
  pathSubject(
24440
24475
  paths,
24441
- (path22) => `${path22} is now a remote reference, but the local file has changes.`,
24476
+ (path25) => `${path25} is now a remote reference, but the local file has changes.`,
24442
24477
  (count) => `${count} paths are now remote references, but local files have changes.`
24443
24478
  ),
24444
24479
  "Forum left the local files alone because replacing them would discard local work."
@@ -24470,7 +24505,7 @@ var buildUnsupportedLocalEntryExplainer = (issues) => {
24470
24505
  body: [
24471
24506
  pathSubject(
24472
24507
  paths,
24473
- (path22) => `${path22} is an unsupported local filesystem entry.`,
24508
+ (path25) => `${path25} is an unsupported local filesystem entry.`,
24474
24509
  (count) => `${count} local filesystem entries are unsupported.`
24475
24510
  ),
24476
24511
  "Forum skipped these paths and continued with unrelated files where it could."
@@ -24502,7 +24537,7 @@ var buildReadOnlyLocalChangeExplainer = (issues) => {
24502
24537
  body: [
24503
24538
  pathSubject(
24504
24539
  paths,
24505
- (path22) => `${path22} has local changes, but its sync rule is read-only.`,
24540
+ (path25) => `${path25} has local changes, but its sync rule is read-only.`,
24506
24541
  (count) => `${count} files have local changes, but their sync rules are read-only.`
24507
24542
  ),
24508
24543
  "Forum left these files alone so remote updates cannot overwrite local work."
@@ -24599,7 +24634,7 @@ var checkoutConflictIssuesFromResult = (result) => checkoutIssuesFromResult(resu
24599
24634
  (issue2) => issue2.type === "conflict"
24600
24635
  );
24601
24636
  var formatCheckoutExplainer = (explainer) => {
24602
- const pathLines = explainer.paths.length <= 1 ? [] : ["", ...formatPathList(explainer.paths).map((path22) => ` ${path22}`)];
24637
+ const pathLines = explainer.paths.length <= 1 ? [] : ["", ...formatPathList(explainer.paths).map((path25) => ` ${path25}`)];
24603
24638
  const actionLines = explainer.actions.map(
24604
24639
  (action) => `${styleText.bold(`${action.label}:`)} ${action.text}`
24605
24640
  );
@@ -24789,19 +24824,19 @@ import { TextDecoder as TextDecoder2 } from "util";
24789
24824
  import ignore2 from "ignore";
24790
24825
 
24791
24826
  // src/buildCheckoutFileManifestEntry.ts
24792
- var toManifestRemotePath = (path22) => path22.startsWith("/") ? path22 : `/${path22}`;
24827
+ var toManifestRemotePath = (path25) => path25.startsWith("/") ? path25 : `/${path25}`;
24793
24828
  var buildCheckoutFileManifestEntry = ({
24794
24829
  storageClass,
24795
24830
  hash: hash2,
24796
24831
  manifestEntry,
24797
- path: path22,
24832
+ path: path25,
24798
24833
  remoteFile,
24799
24834
  source,
24800
24835
  syncedAt
24801
24836
  }) => {
24802
24837
  const remoteFileId = remoteFile.id ?? remoteFile._id ?? manifestEntry?.remoteFileId;
24803
24838
  if (!remoteFileId) {
24804
- throw new Error(`Remote file ${path22} did not include a file id`);
24839
+ throw new Error(`Remote file ${path25} did not include a file id`);
24805
24840
  }
24806
24841
  return {
24807
24842
  storageClass,
@@ -24809,7 +24844,7 @@ var buildCheckoutFileManifestEntry = ({
24809
24844
  isExecutable: storageClass === "text" ? remoteFile.isExecutable === true || void 0 : void 0,
24810
24845
  lastSyncedAt: syncedAt,
24811
24846
  remoteFileId,
24812
- remotePath: remoteFile.path ?? manifestEntry?.remotePath ?? toManifestRemotePath(path22),
24847
+ remotePath: remoteFile.path ?? manifestEntry?.remotePath ?? toManifestRemotePath(path25),
24813
24848
  remoteUpdatedAt: remoteFile.updatedAt ?? null,
24814
24849
  remoteRevisionNumber: remoteFile.revisionNumber ?? null,
24815
24850
  ...source ? { source } : {}
@@ -27574,16 +27609,16 @@ var updateFileManifestEntry = ({
27574
27609
  hash: hash2,
27575
27610
  manifest,
27576
27611
  manifestEntry,
27577
- path: path22,
27612
+ path: path25,
27578
27613
  remoteFile,
27579
27614
  source,
27580
27615
  syncedAt
27581
27616
  }) => {
27582
- manifest.files[path22] = buildCheckoutFileManifestEntry({
27617
+ manifest.files[path25] = buildCheckoutFileManifestEntry({
27583
27618
  storageClass,
27584
27619
  hash: hash2,
27585
27620
  manifestEntry,
27586
- path: path22,
27621
+ path: path25,
27587
27622
  remoteFile,
27588
27623
  source,
27589
27624
  syncedAt
@@ -29064,7 +29099,7 @@ var remoteFileHash = async ({
29064
29099
  client,
29065
29100
  remoteFile,
29066
29101
  storeRef,
29067
- path: path22
29102
+ path: path25
29068
29103
  }) => {
29069
29104
  const textHash = remoteTextHash(remoteFile);
29070
29105
  if (textHash) {
@@ -29075,7 +29110,7 @@ var remoteFileHash = async ({
29075
29110
  }
29076
29111
  const { downloadUrl } = await client.createFileDownloadUrlByRef({
29077
29112
  ...storeRef,
29078
- path: path22
29113
+ path: path25
29079
29114
  });
29080
29115
  const response = await fetch(downloadUrl);
29081
29116
  if (!response.ok) {
@@ -30502,9 +30537,9 @@ var createHumanWatchSubscriber = ({
30502
30537
  return;
30503
30538
  }
30504
30539
  case "sync.watch.conflict.raised": {
30505
- const path22 = String(details.path ?? "");
30540
+ const path25 = String(details.path ?? "");
30506
30541
  const suggestions = details.suggestions ?? [];
30507
- error51(`Conflict: ${path22} \u2014 ${event.message ?? "needs attention"}`);
30542
+ error51(`Conflict: ${path25} \u2014 ${event.message ?? "needs attention"}`);
30508
30543
  if (suggestions.length > 0) {
30509
30544
  error51(` ${formatSuggestions(suggestions)}`);
30510
30545
  }
@@ -30533,10 +30568,10 @@ import notifier from "node-notifier";
30533
30568
  var createNotifyWatchSubscriber = () => {
30534
30569
  return (event) => {
30535
30570
  if (event.eventType === "sync.watch.conflict.raised") {
30536
- const path22 = event.details?.path;
30571
+ const path25 = event.details?.path;
30537
30572
  notifier.notify({
30538
30573
  title: "Forum sync conflict",
30539
- message: typeof path22 === "string" ? `${path22} needs attention` : event.message ?? "A file needs attention"
30574
+ message: typeof path25 === "string" ? `${path25} needs attention` : event.message ?? "A file needs attention"
30540
30575
  });
30541
30576
  return;
30542
30577
  }
@@ -30652,10 +30687,10 @@ var createConflictTracker = () => {
30652
30687
  );
30653
30688
  const raised = current.filter((conflict) => !active.has(conflict.path));
30654
30689
  const cleared = [...active.keys()].filter(
30655
- (path22) => !currentByPath.has(path22)
30690
+ (path25) => !currentByPath.has(path25)
30656
30691
  );
30657
- for (const path22 of cleared) {
30658
- active.delete(path22);
30692
+ for (const path25 of cleared) {
30693
+ active.delete(path25);
30659
30694
  }
30660
30695
  for (const conflict of current) {
30661
30696
  active.set(conflict.path, conflict);
@@ -30666,13 +30701,13 @@ var createConflictTracker = () => {
30666
30701
  };
30667
30702
 
30668
30703
  // src/watch/conflictResolutionHints.ts
30669
- var keepLocal = (path22) => ({
30704
+ var keepLocal = (path25) => ({
30670
30705
  label: "Keep local",
30671
- command: `fm push --force ${path22}`
30706
+ command: `fm push --force ${path25}`
30672
30707
  });
30673
- var acceptRemote = (path22) => ({
30708
+ var acceptRemote = (path25) => ({
30674
30709
  label: "Accept remote",
30675
- command: `fm pull --force ${path22}`
30710
+ command: `fm pull --force ${path25}`
30676
30711
  });
30677
30712
  var review = (label, command) => ({
30678
30713
  label,
@@ -30688,23 +30723,23 @@ var forceResolvableTypes = /* @__PURE__ */ new Set([
30688
30723
  "reference-local-file",
30689
30724
  "read-only-local-change"
30690
30725
  ]);
30691
- var conflictResolutionSuggestions = (conflictType, path22) => {
30726
+ var conflictResolutionSuggestions = (conflictType, path25) => {
30692
30727
  if (forceResolvableTypes.has(conflictType)) {
30693
- return [keepLocal(path22), acceptRemote(path22)];
30728
+ return [keepLocal(path25), acceptRemote(path25)];
30694
30729
  }
30695
- return [review("Review", `fm status ${path22}`)];
30730
+ return [review("Review", `fm status ${path25}`)];
30696
30731
  };
30697
30732
 
30698
30733
  // src/watch/extractWatchConflicts.ts
30699
30734
  var toWatchConflict = (issue2) => {
30700
- const { path: path22, message, relatedPaths } = issue2.details.details;
30735
+ const { path: path25, message, relatedPaths } = issue2.details.details;
30701
30736
  const conflictType = issue2.details.type;
30702
30737
  return {
30703
- path: path22,
30738
+ path: path25,
30704
30739
  conflictType,
30705
30740
  message,
30706
30741
  relatedPaths: relatedPaths ?? [],
30707
- suggestions: conflictResolutionSuggestions(conflictType, path22)
30742
+ suggestions: conflictResolutionSuggestions(conflictType, path25)
30708
30743
  };
30709
30744
  };
30710
30745
  var extractWatchConflicts = (result) => {
@@ -30795,9 +30830,9 @@ var createCheckoutWatcher = ({
30795
30830
  })
30796
30831
  );
30797
30832
  }
30798
- for (const path22 of cleared) {
30833
+ for (const path25 of cleared) {
30799
30834
  bus.emit(
30800
- watchEvent("sync.watch.conflict.cleared", void 0, { path: path22 })
30835
+ watchEvent("sync.watch.conflict.cleared", void 0, { path: path25 })
30801
30836
  );
30802
30837
  }
30803
30838
  bus.emit(
@@ -31368,7 +31403,6 @@ var retrySafeOperations = /* @__PURE__ */ new Set([
31368
31403
  "stores.list",
31369
31404
  "stores.readByRef",
31370
31405
  "userPreferences.read",
31371
- "skills.getBuiltInSkill",
31372
31406
  "files.listDirectory",
31373
31407
  "files.listDirectoryByRef",
31374
31408
  "files.listTreeByRef",
@@ -31377,6 +31411,8 @@ var retrySafeOperations = /* @__PURE__ */ new Set([
31377
31411
  "files.search",
31378
31412
  "files.readFile",
31379
31413
  "files.readFileByRef",
31414
+ "skills.readIndex",
31415
+ "skills.read",
31380
31416
  "files.listFileVersions",
31381
31417
  "files.listFileVersionsByRef",
31382
31418
  "files.listFileVersionsById",
@@ -31483,11 +31519,9 @@ var createStoreClient = ({
31483
31519
  "files.deleteFileByRef",
31484
31520
  () => trpc.files.deleteFileByRef.mutate(input)
31485
31521
  ),
31522
+ readSkillIndex: (input) => call("skills.readIndex", () => trpc.skills.readIndex.query(input)),
31523
+ readSkill: (input) => call("skills.read", () => trpc.skills.read.query(input)),
31486
31524
  readUserPreferences: () => call("userPreferences.read", () => trpc.userPreferences.read.query({})),
31487
- getBuiltInSkill: (input) => call(
31488
- "skills.getBuiltInSkill",
31489
- () => trpc.skills.getBuiltInSkill.query(input)
31490
- ),
31491
31525
  upsertUserPreferences: (input) => call(
31492
31526
  "userPreferences.upsert",
31493
31527
  () => trpc.userPreferences.upsert.mutate(input)
@@ -31658,54 +31692,17 @@ var writeConfig = async (stateDir, config2) => {
31658
31692
  await writeJsonAtomic(configPath(stateDir), config2);
31659
31693
  };
31660
31694
 
31661
- // src/skillIntegration.ts
31662
- import { constants } from "fs";
31663
- import { access as access2 } from "fs/promises";
31695
+ // src/expandHomePath.ts
31664
31696
  import os from "os";
31665
- import path19 from "path";
31666
- import Enquirer from "enquirer";
31667
-
31668
- // src/skillProviders/claude.ts
31669
31697
  import path17 from "path";
31670
- var claudeSkillProvider = {
31671
- id: "claude",
31672
- globalRootCandidates: (home) => [path17.join(home, ".claude", "skills")],
31673
- localRoot: (projectDir) => path17.join(projectDir, ".claude", "skills")
31674
- };
31675
-
31676
- // src/skillProviders/codex.ts
31677
- import path18 from "path";
31678
- var codexSkillProvider = {
31679
- id: "codex",
31680
- globalRootCandidates: (home) => [
31681
- path18.join(home, ".codex", "skills"),
31682
- path18.join(home, ".agents", "skills")
31683
- ],
31684
- localRoot: (projectDir) => path18.join(projectDir, ".codex", "skills")
31685
- };
31686
-
31687
- // src/skillProviders/registry.ts
31688
- var skillProviderRegistry = [
31689
- codexSkillProvider,
31690
- claudeSkillProvider
31691
- ];
31692
- var supportedSkillAgents = skillProviderRegistry.map(
31693
- (provider) => provider.id
31694
- );
31695
- var skillProviderByAgent = Object.fromEntries(
31696
- skillProviderRegistry.map((provider) => [provider.id, provider])
31697
- );
31698
-
31699
- // src/skillIntegration.ts
31700
31698
  var expandHomePath = (input) => {
31701
- if (input === "~") {
31702
- return process.env.HOME || os.homedir();
31703
- }
31704
- if (input.startsWith("~/")) {
31705
- return path19.join(process.env.HOME || os.homedir(), input.slice(2));
31706
- }
31707
- return input;
31699
+ const home = process.env.HOME || os.homedir();
31700
+ if (input === "~") return home;
31701
+ return input.startsWith("~/") ? path17.join(home, input.slice(2)) : input;
31708
31702
  };
31703
+
31704
+ // src/pathExists.ts
31705
+ import { access as access2 } from "fs/promises";
31709
31706
  var pathExists3 = async (filePath) => {
31710
31707
  try {
31711
31708
  await access2(filePath);
@@ -31714,43 +31711,401 @@ var pathExists3 = async (filePath) => {
31714
31711
  return false;
31715
31712
  }
31716
31713
  };
31717
- var chooseExistingPath = async (candidates) => {
31718
- for (const candidate of candidates) {
31719
- if (await pathExists3(candidate)) {
31720
- return candidate;
31714
+
31715
+ // src/skills/runSkillsCommand.ts
31716
+ import { CommanderError } from "commander";
31717
+
31718
+ // src/skills/createSkillsCommand.ts
31719
+ import { Command } from "commander";
31720
+
31721
+ // src/skills/parseSkillAgents.ts
31722
+ import { InvalidArgumentError } from "commander";
31723
+ var parseSkillAgents = (value) => {
31724
+ const agents = value === "all" ? ["codex", "claude"] : value.split(",").map((agent) => agent.trim());
31725
+ if (!agents.length || agents.some((agent) => agent !== "codex" && agent !== "claude"))
31726
+ throw new InvalidArgumentError("Choose codex, claude, or codex,claude.");
31727
+ return [...new Set(agents)];
31728
+ };
31729
+
31730
+ // src/skills/parseSkillIndexPath.ts
31731
+ import { InvalidArgumentError as InvalidArgumentError2 } from "commander";
31732
+ var parseSkillIndexPath = (value) => {
31733
+ const result = skillIndexPathSchema.safeParse(value.replace(/^\//, ""));
31734
+ if (!result.success)
31735
+ throw new InvalidArgumentError2(
31736
+ "Expected a store-relative .skills.json path without dot segments."
31737
+ );
31738
+ return result.data;
31739
+ };
31740
+
31741
+ // src/skills/loadSkillsCommand.ts
31742
+ import os2 from "os";
31743
+
31744
+ // src/skills/loadSkillStubs.ts
31745
+ import { lstat as lstat4, mkdir as mkdir6, open, unlink } from "fs/promises";
31746
+ import path21 from "path";
31747
+
31748
+ // src/skills/planSkillStubs.ts
31749
+ import { lstat as lstat3, readdir as readdir5, readFile as readFile8 } from "fs/promises";
31750
+ import path19 from "path";
31751
+ import { isDeepStrictEqual } from "util";
31752
+
31753
+ // src/skills/createSkillStub.ts
31754
+ var quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
31755
+ var createSkillStub = (item, source) => [
31756
+ "---",
31757
+ `name: ${item.slug}`,
31758
+ `description: ${JSON.stringify(item.description)}`,
31759
+ "compatibility: Requires the Forum CLI (fm), network access, and read access to the source store.",
31760
+ "---",
31761
+ "",
31762
+ "This skill's instructions live in Forum. Before using the skill, fetch them:",
31763
+ "",
31764
+ "```sh",
31765
+ `DOCTRINE_API_URL=${quote(source.apiBaseUrl)} fm skills read ${quote(item.slug)} --store ${quote(source.storeId)} --index ${quote(source.indexPath)}`,
31766
+ "```",
31767
+ "",
31768
+ "Read and follow the returned instructions. If the fetch fails, report the error and do not substitute the description or previously fetched instructions.",
31769
+ "The response identifies the source store, document path, and revision. Resolve supporting document paths in that Forum store, relative to the source document, and fetch them with fm read. They are not files next to this local stub.",
31770
+ "Fetch current instructions when starting a new use of this skill. Instructions already loaded into a task do not update automatically.",
31771
+ "",
31772
+ "Generated by fm skills load. Edit the index and instructions in Forum, then reload the index to refresh discovery metadata.",
31773
+ ""
31774
+ ].join("\n");
31775
+
31776
+ // src/skills/readSkillStubMarker.ts
31777
+ import { lstat as lstat2, readFile as readFile7, readdir as readdir4 } from "fs/promises";
31778
+ import path18 from "path";
31779
+ import { createHash as createHash3 } from "crypto";
31780
+ var readSkillStubMarker = async (directory) => {
31781
+ const stat4 = await lstat2(directory).catch((error51) => {
31782
+ if (error51.code === "ENOENT") return null;
31783
+ throw error51;
31784
+ });
31785
+ if (!stat4) return null;
31786
+ if (!stat4.isDirectory() || stat4.isSymbolicLink())
31787
+ throw new Error(
31788
+ `Skill destination is not a regular directory: ${directory}`
31789
+ );
31790
+ const markerPath = path18.join(directory, ".forum-skill.json");
31791
+ const names = await readdir4(directory);
31792
+ if (!names.includes(".forum-skill.json")) return null;
31793
+ const markerStat = await lstat2(markerPath);
31794
+ if (!markerStat.isFile() || markerStat.isSymbolicLink())
31795
+ throw new Error(`Invalid Forum skill marker: ${markerPath}`);
31796
+ const marker = JSON.parse(
31797
+ await readFile7(markerPath, "utf8")
31798
+ );
31799
+ if (marker.version !== 1 || typeof marker.source?.storeId !== "string" || typeof marker.source?.indexPath !== "string" || typeof marker.source?.apiBaseUrl !== "string" || typeof marker.hash !== "string") {
31800
+ throw new Error(`Invalid Forum skill marker: ${markerPath}`);
31801
+ }
31802
+ if (names.some((name) => name !== "SKILL.md" && name !== ".forum-skill.json"))
31803
+ throw new Error(
31804
+ `Skill contains local files; refusing to replace it: ${directory}`
31805
+ );
31806
+ const stubPath = path18.join(directory, "SKILL.md");
31807
+ const stubStat = await lstat2(stubPath);
31808
+ if (!stubStat.isFile() || stubStat.isSymbolicLink())
31809
+ throw new Error(`Invalid generated skill: ${stubPath}`);
31810
+ const content = await readFile7(stubPath, "utf8");
31811
+ if (createHash3("sha256").update(content).digest("hex") !== marker.hash)
31812
+ throw new Error(
31813
+ `Generated skill was edited locally; refusing to replace it: ${stubPath}`
31814
+ );
31815
+ return marker;
31816
+ };
31817
+
31818
+ // src/skills/planSkillStubs.ts
31819
+ var planSkillStubs = async (input, roots) => {
31820
+ const changes = [];
31821
+ for (const { agent, root } of roots) {
31822
+ const directories = await readdir5(root, { withFileTypes: true }).catch(
31823
+ (error51) => {
31824
+ if (error51.code === "ENOENT") return [];
31825
+ throw error51;
31826
+ }
31827
+ );
31828
+ for (const item of input.index.items) {
31829
+ const destination = path19.join(root, item.slug);
31830
+ const exists2 = directories.some((entry) => entry.name === item.slug);
31831
+ const marker = exists2 ? await readSkillStubMarker(destination) : null;
31832
+ if (exists2 && (!marker || !isDeepStrictEqual(marker.source, input.source)))
31833
+ throw new Error(
31834
+ `Skill name collision: ${destination}. Choose a different slug; existing skills are never overwritten.`
31835
+ );
31836
+ const content = createSkillStub(item, input.source);
31837
+ const unchanged = marker && await readFile8(path19.join(destination, "SKILL.md"), "utf8") === content;
31838
+ changes.push({
31839
+ agent,
31840
+ slug: item.slug,
31841
+ path: destination,
31842
+ action: unchanged ? "unchanged" : exists2 ? "update" : "create",
31843
+ content
31844
+ });
31845
+ }
31846
+ const slugs = new Set(input.index.items.map((item) => item.slug));
31847
+ for (const entry of directories) {
31848
+ if (!entry.isDirectory() || entry.isSymbolicLink() || slugs.has(entry.name) || entry.name.startsWith("."))
31849
+ continue;
31850
+ const destination = path19.join(root, entry.name);
31851
+ const markerPath = path19.join(destination, ".forum-skill.json");
31852
+ const markerStat = await lstat3(markerPath).catch(
31853
+ (error51) => {
31854
+ if (error51.code === "ENOENT") return null;
31855
+ throw error51;
31856
+ }
31857
+ );
31858
+ if (!markerStat?.isFile() || markerStat.isSymbolicLink()) continue;
31859
+ const candidate = JSON.parse(await readFile8(markerPath, "utf8"));
31860
+ if (!isDeepStrictEqual(candidate.source, input.source)) continue;
31861
+ await readSkillStubMarker(destination);
31862
+ changes.push({
31863
+ agent,
31864
+ slug: entry.name,
31865
+ path: destination,
31866
+ action: "remove"
31867
+ });
31721
31868
  }
31722
31869
  }
31723
- return candidates[0] ?? "";
31870
+ return changes;
31724
31871
  };
31725
- var getSkillRoot = async (agent, scope, projectDir) => {
31726
- const provider = skillProviderByAgent[agent];
31727
- if (scope === "local") {
31728
- return provider.localRoot(projectDir);
31872
+
31873
+ // src/skills/applySkillStubChanges.ts
31874
+ import { createHash as createHash4 } from "crypto";
31875
+ import { mkdtemp, rename as rename4, rm as rm4, writeFile as writeFile5 } from "fs/promises";
31876
+ import path20 from "path";
31877
+ var applySkillStubChanges = async (changes, source) => {
31878
+ const applied = [];
31879
+ try {
31880
+ for (const change of changes) {
31881
+ if (change.action === "unchanged") continue;
31882
+ const temporary = await mkdtemp(
31883
+ path20.join(path20.dirname(change.path), ".forum-skills-")
31884
+ );
31885
+ const entry = {
31886
+ change,
31887
+ temporary,
31888
+ backup: null,
31889
+ installed: false
31890
+ };
31891
+ applied.push(entry);
31892
+ if (change.action !== "remove") {
31893
+ const content = change.content;
31894
+ const marker = {
31895
+ version: 1,
31896
+ source,
31897
+ hash: createHash4("sha256").update(content).digest("hex")
31898
+ };
31899
+ await writeFile5(path20.join(temporary, "SKILL.md"), content, "utf8");
31900
+ await writeFile5(
31901
+ path20.join(temporary, ".forum-skill.json"),
31902
+ `${JSON.stringify(marker, null, 2)}
31903
+ `,
31904
+ "utf8"
31905
+ );
31906
+ }
31907
+ if (change.action !== "create") {
31908
+ const backup = `${temporary}-backup`;
31909
+ await rename4(change.path, backup);
31910
+ entry.backup = backup;
31911
+ }
31912
+ if (change.action !== "remove") {
31913
+ await rename4(temporary, change.path);
31914
+ entry.installed = true;
31915
+ }
31916
+ }
31917
+ } catch (error51) {
31918
+ for (const entry of applied.toReversed()) {
31919
+ if (entry.installed) await rm4(entry.change.path, { recursive: true });
31920
+ if (entry.backup) await rename4(entry.backup, entry.change.path);
31921
+ await rm4(entry.temporary, { recursive: true, force: true });
31922
+ }
31923
+ throw error51;
31924
+ }
31925
+ for (const entry of applied) {
31926
+ if (entry.backup) await rm4(entry.backup, { recursive: true });
31927
+ await rm4(entry.temporary, { recursive: true, force: true });
31729
31928
  }
31730
- const home = process.env.HOME || os.homedir();
31731
- return chooseExistingPath(provider.globalRootCandidates(home));
31732
31929
  };
31733
- var selectSkillAgents = async () => {
31734
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
31735
- throw new Error(
31736
- "Skill provider selection requires an interactive shell. Rerun with --provider codex, --provider claude, or --provider all."
31930
+
31931
+ // src/skills/loadSkillStubs.ts
31932
+ var loadSkillStubs = async (input) => {
31933
+ skillIndexSchema.parse(input.index);
31934
+ skillIndexPathSchema.parse(input.source.indexPath);
31935
+ const base = path21.resolve(input.global ? input.home : input.directory);
31936
+ const roots = [...new Set(input.agents)].map((agent) => ({
31937
+ agent,
31938
+ root: path21.join(base, agent === "codex" ? ".agents" : ".claude", "skills")
31939
+ }));
31940
+ const locks = [];
31941
+ try {
31942
+ for (const { root } of roots) {
31943
+ for (const directory of [path21.dirname(root), root]) {
31944
+ const stat4 = await lstat4(directory).catch(
31945
+ (error51) => {
31946
+ if (error51.code === "ENOENT") return null;
31947
+ throw error51;
31948
+ }
31949
+ );
31950
+ if (stat4 && (!stat4.isDirectory() || stat4.isSymbolicLink()))
31951
+ throw new Error(
31952
+ `Skill root must be a regular directory: ${directory}`
31953
+ );
31954
+ }
31955
+ if (!input.dryRun) {
31956
+ await mkdir6(root, { recursive: true });
31957
+ const lockPath = path21.join(root, ".forum-skills.lock");
31958
+ const file2 = await open(lockPath, "wx").catch(
31959
+ (error51) => {
31960
+ if (error51.code === "EEXIST")
31961
+ throw new Error(
31962
+ `Skills load is locked: ${lockPath}. If no load is running, remove the stale lock and retry.`
31963
+ );
31964
+ throw error51;
31965
+ }
31966
+ );
31967
+ locks.push({ path: lockPath, file: file2 });
31968
+ }
31969
+ }
31970
+ const changes = await planSkillStubs(input, roots);
31971
+ if (!input.dryRun) await applySkillStubChanges(changes, input.source);
31972
+ return {
31973
+ dryRun: input.dryRun,
31974
+ source: input.source,
31975
+ changes: changes.map(({ agent, path: path25, slug, action }) => ({
31976
+ agent,
31977
+ path: path25,
31978
+ slug,
31979
+ action
31980
+ }))
31981
+ };
31982
+ } finally {
31983
+ for (const lock of locks) {
31984
+ await lock.file.close();
31985
+ await unlink(lock.path);
31986
+ }
31987
+ }
31988
+ };
31989
+
31990
+ // src/skills/resolveSkillCommandContext.ts
31991
+ import path22 from "path";
31992
+ var resolveSkillCommandContext = async (options2) => {
31993
+ const segments2 = options2.store.split("/");
31994
+ const storeRef = storeRefSchema.parse(
31995
+ segments2.length === 2 ? { workspaceSlug: segments2[0], storeSlug: segments2[1] } : segments2.length === 1 ? { storeId: options2.store } : {}
31996
+ );
31997
+ const saved = await readConfig(
31998
+ options2.stateDir ? path22.resolve(options2.stateDir) : defaultStateDir()
31999
+ );
32000
+ const apiBaseUrl = (process.env.DOCTRINE_API_URL || DEFAULT_API_BASE_URL).replace(/\/+$/, "");
32001
+ const token = options2.token || process.env.DOCTRINE_TOKEN || saved.token;
32002
+ return { client: createClient({ apiBaseUrl, token }), apiBaseUrl, storeRef };
32003
+ };
32004
+
32005
+ // src/skills/loadSkillsCommand.ts
32006
+ var loadSkillsCommand = async (indexPath, _options, command) => {
32007
+ const options2 = command.optsWithGlobals();
32008
+ configureRenderer({ json: Boolean(options2.json) });
32009
+ const { client, apiBaseUrl, storeRef } = await resolveSkillCommandContext(
32010
+ options2
32011
+ );
32012
+ const result = await client.readSkillIndex({
32013
+ ...storeRef,
32014
+ indexPath,
32015
+ validateTargets: true
32016
+ });
32017
+ const report = await loadSkillStubs({
32018
+ agents: options2.agents,
32019
+ directory: process.cwd(),
32020
+ global: Boolean(options2.global),
32021
+ home: os2.homedir(),
32022
+ index: result.index,
32023
+ source: {
32024
+ apiBaseUrl,
32025
+ storeId: result.storeId,
32026
+ indexPath: result.indexPath
32027
+ },
32028
+ dryRun: Boolean(options2.dryRun)
32029
+ });
32030
+ if (options2.json) renderOutput(JSON.stringify(report));
32031
+ else {
32032
+ report.changes.forEach(
32033
+ (change) => renderOutput(
32034
+ `${report.dryRun ? "Would " : ""}${change.action} ${change.agent}: ${change.path}`
32035
+ )
32036
+ );
32037
+ renderOutput(
32038
+ `Skills ${report.dryRun ? "validated" : "loaded"}. Instructions are fetched live; reload this index after changing descriptions or membership.`
31737
32039
  );
31738
32040
  }
31739
- const answers = await Enquirer.prompt({
31740
- type: "select",
31741
- name: "selectedAgent",
31742
- message: "Install skill for",
31743
- choices: [
31744
- { name: "all", message: "all" },
31745
- { name: "codex", message: "codex" },
31746
- { name: "claude", message: "claude" }
31747
- ],
31748
- hint: "Use Up/Down to move, Enter to continue"
32041
+ };
32042
+
32043
+ // src/skills/readSkillCommand.ts
32044
+ var readSkillCommand = async (slug, _options, command) => {
32045
+ const options2 = command.optsWithGlobals();
32046
+ configureRenderer({ json: Boolean(options2.json) });
32047
+ const { client, storeRef } = await resolveSkillCommandContext(
32048
+ options2
32049
+ );
32050
+ const result = await client.readSkill({
32051
+ ...storeRef,
32052
+ indexPath: options2.index,
32053
+ slug
31749
32054
  });
31750
- if (answers.selectedAgent === "all") {
31751
- return supportedSkillAgents;
32055
+ renderOutput(
32056
+ options2.json ? JSON.stringify(result) : [
32057
+ `Skill: ${result.slug}`,
32058
+ `Store: ${result.storeId}`,
32059
+ `Document: ${result.path}`,
32060
+ `Revision: ${result.revisionNumber}`,
32061
+ "Supporting paths are relative to this document in the source Forum store.",
32062
+ "",
32063
+ result.text
32064
+ ].join("\n")
32065
+ );
32066
+ };
32067
+
32068
+ // src/skills/createSkillsCommand.ts
32069
+ var createSkillsCommand = () => {
32070
+ const program = new Command().name("fm").description("Forum skills CLI").option("--token <token>", "Use a Forum access token").option("--state-dir <path>", "Read CLI configuration from this directory").option("--json", "Print structured JSON").exitOverride();
32071
+ const skills = program.command("skills").description(
32072
+ "Discover local skills and read their live Forum instructions"
32073
+ );
32074
+ skills.command("load").description("Create or refresh local skill stubs from a Forum index").argument("<index>", "Skills index path in the store", parseSkillIndexPath).requiredOption(
32075
+ "--store <store>",
32076
+ "Source store (workspace/store or store ID)"
32077
+ ).option(
32078
+ "--agents <agents>",
32079
+ "Agent destinations: codex, claude, or all",
32080
+ parseSkillAgents,
32081
+ ["codex", "claude"]
32082
+ ).option(
32083
+ "--global",
32084
+ "Load into user skill directories instead of this project"
32085
+ ).option("--dry-run, -d", "Validate and show changes without writing files").action(loadSkillsCommand);
32086
+ skills.command("read").description("Fetch current instructions for a skill in a Forum index").argument(
32087
+ "<slug>",
32088
+ "Skill slug",
32089
+ (value) => skillSlugSchema.parse(value)
32090
+ ).requiredOption(
32091
+ "--store <store>",
32092
+ "Source store (workspace/store or store ID)"
32093
+ ).requiredOption(
32094
+ "--index <path>",
32095
+ "Skills index path in the store",
32096
+ parseSkillIndexPath
32097
+ ).action(readSkillCommand);
32098
+ return program;
32099
+ };
32100
+
32101
+ // src/skills/runSkillsCommand.ts
32102
+ var runSkillsCommand = async (argv) => {
32103
+ try {
32104
+ await createSkillsCommand().parseAsync(argv, { from: "user" });
32105
+ } catch (error51) {
32106
+ if (error51 instanceof CommanderError && error51.exitCode === 0) return;
32107
+ throw error51;
31752
32108
  }
31753
- return [answers.selectedAgent];
31754
32109
  };
31755
32110
 
31756
32111
  // src/fileSchemas.ts
@@ -32219,15 +32574,15 @@ var editEncryptedText = async ({
32219
32574
 
32220
32575
  // src/openInEditor.ts
32221
32576
  import { spawn } from "child_process";
32222
- import { mkdtemp, readFile as readFile7, rm as rm4, writeFile as writeFile5 } from "fs/promises";
32577
+ import { mkdtemp as mkdtemp2, readFile as readFile9, rm as rm5, writeFile as writeFile6 } from "fs/promises";
32223
32578
  import { tmpdir } from "os";
32224
- import path20 from "path";
32579
+ import path23 from "path";
32225
32580
  var openInEditor = async (currentText, { extension = "" } = {}) => {
32226
32581
  const editor = process.env.EDITOR?.trim() || "vi";
32227
- const dir = await mkdtemp(path20.join(tmpdir(), "fm-edit-"));
32228
- const tempPath = path20.join(dir, `edit${extension}`);
32582
+ const dir = await mkdtemp2(path23.join(tmpdir(), "fm-edit-"));
32583
+ const tempPath = path23.join(dir, `edit${extension}`);
32229
32584
  try {
32230
- await writeFile5(tempPath, currentText, "utf8");
32585
+ await writeFile6(tempPath, currentText, "utf8");
32231
32586
  const exitCode = await new Promise((resolve, reject) => {
32232
32587
  const child = spawn(
32233
32588
  "/bin/sh",
@@ -32240,9 +32595,9 @@ var openInEditor = async (currentText, { extension = "" } = {}) => {
32240
32595
  if (exitCode !== 0) {
32241
32596
  return null;
32242
32597
  }
32243
- return await readFile7(tempPath, "utf8");
32598
+ return await readFile9(tempPath, "utf8");
32244
32599
  } finally {
32245
- await rm4(dir, { force: true, recursive: true }).catch(() => {
32600
+ await rm5(dir, { force: true, recursive: true }).catch(() => {
32246
32601
  });
32247
32602
  }
32248
32603
  };
@@ -32329,7 +32684,7 @@ var standaloneIncludeId = (paragraph) => {
32329
32684
  var textContent = (file2) => file2?.content && "text" in file2.content ? file2.content.text : null;
32330
32685
  var compileMarkdown = async ({
32331
32686
  entry,
32332
- readFile: readFile9,
32687
+ readFile: readFile11,
32333
32688
  optional: optional2,
32334
32689
  limits = {}
32335
32690
  }) => {
@@ -32373,7 +32728,7 @@ var compileMarkdown = async ({
32373
32728
  throw new Error(`Include cycle: ${[...chain, id].join(" -> ")}`);
32374
32729
  let target;
32375
32730
  try {
32376
- target = await readFile9(id);
32731
+ target = await readFile11(id);
32377
32732
  } catch (error51) {
32378
32733
  if (optional2) {
32379
32734
  warnings.push(`Omitted unreadable include ${id} from ${label}.`);
@@ -32480,9 +32835,8 @@ Usage:
32480
32835
  fm delete <filePath> [--store <storeId>] [--token <jwt>]
32481
32836
  fm rm <filePath> [--store <storeId>] [--token <jwt>]
32482
32837
  fm write <filename-or-path> (<text>|--file|-f <localPath>) [-s <storeIds>] [--token <jwt>] [--force]
32483
- fm skill install [--provider <all|codex|claude>] [--global] [--yes] [--dry-run|-d]
32484
- fm skill add <storeId> <path> [--provider <all|codex|claude>] [--global] [--yes] [--dry-run|-d]
32485
- fm skill add --store <storeId> <path> [--provider <all|codex|claude>] [--global] [--yes] [--dry-run|-d]
32838
+
32839
+ fm skills --help
32486
32840
 
32487
32841
  Local checkout commands:
32488
32842
  fm clone <storeId> [localPath] [--token <jwt>] [--readonly] [--verbose]
@@ -32542,7 +32896,7 @@ Output:
32542
32896
  `;
32543
32897
  var readCliVersion = async () => {
32544
32898
  const packageJson = JSON.parse(
32545
- await readFile8(new URL("../package.json", import.meta.url), "utf8")
32899
+ await readFile10(new URL("../package.json", import.meta.url), "utf8")
32546
32900
  );
32547
32901
  return typeof packageJson.version === "string" ? packageJson.version : "unknown";
32548
32902
  };
@@ -32558,9 +32912,6 @@ var parseArgvCommandName = (argv) => {
32558
32912
  "--path",
32559
32913
  "--ref",
32560
32914
  "--target",
32561
- "--agent",
32562
- "--provider",
32563
- "--target-dir",
32564
32915
  "--state-dir",
32565
32916
  "--interval-ms",
32566
32917
  "--paths-file"
@@ -32596,9 +32947,6 @@ var parseArgs = (argv) => {
32596
32947
  let encryptionPassword = null;
32597
32948
  let recipientSecret = null;
32598
32949
  let recipientName = null;
32599
- const skillAgents = [];
32600
- let skillGlobal = false;
32601
- let skillTargetDir = null;
32602
32950
  let syncPath = null;
32603
32951
  let syncTarget = null;
32604
32952
  let pathsFile = null;
@@ -32662,13 +33010,13 @@ var parseArgs = (argv) => {
32662
33010
  continue;
32663
33011
  }
32664
33012
  if (current === "--file" || current === "-f") {
32665
- inputFilePath = next ? path21.resolve(next) : inputFilePath;
33013
+ inputFilePath = next ? path24.resolve(next) : inputFilePath;
32666
33014
  index += 1;
32667
33015
  continue;
32668
33016
  }
32669
33017
  if (current === "--output" || current === "-o") {
32670
33018
  if (!next) throw new Error(`${current} requires a local output path.`);
32671
- outputFilePath = path21.resolve(next);
33019
+ outputFilePath = path24.resolve(next);
32672
33020
  index += 1;
32673
33021
  continue;
32674
33022
  }
@@ -32721,31 +33069,11 @@ var parseArgs = (argv) => {
32721
33069
  index += 1;
32722
33070
  continue;
32723
33071
  }
32724
- if (current === "--agent" || current === "--provider") {
32725
- if (!next) {
32726
- throw new Error(`${current} requires a provider name.`);
32727
- }
32728
- skillAgents.push(next);
32729
- index += 1;
32730
- continue;
32731
- }
32732
- if (current === "--target-dir") {
32733
- if (!next) {
32734
- throw new Error("--target-dir requires a path.");
32735
- }
32736
- skillTargetDir = path21.resolve(expandHomePath(next));
32737
- index += 1;
32738
- continue;
32739
- }
32740
- if (current === "--global") {
32741
- skillGlobal = true;
32742
- continue;
32743
- }
32744
33072
  if (current === "--update") {
32745
33073
  continue;
32746
33074
  }
32747
33075
  if (current === "--state-dir") {
32748
- stateDir = path21.resolve(next ?? stateDir);
33076
+ stateDir = path24.resolve(next ?? stateDir);
32749
33077
  index += 1;
32750
33078
  continue;
32751
33079
  }
@@ -32753,12 +33081,12 @@ var parseArgs = (argv) => {
32753
33081
  if (!next) {
32754
33082
  throw new Error("--paths-file requires a file path.");
32755
33083
  }
32756
- pathsFile = path21.resolve(expandHomePath(next));
33084
+ pathsFile = path24.resolve(expandHomePath(next));
32757
33085
  index += 1;
32758
33086
  continue;
32759
33087
  }
32760
33088
  if (current.startsWith("--paths-file=")) {
32761
- pathsFile = path21.resolve(
33089
+ pathsFile = path24.resolve(
32762
33090
  expandHomePath(current.slice("--paths-file=".length))
32763
33091
  );
32764
33092
  continue;
@@ -32853,9 +33181,6 @@ var parseArgs = (argv) => {
32853
33181
  encryptionPassword,
32854
33182
  recipientSecret,
32855
33183
  recipientName,
32856
- skillAgents,
32857
- skillGlobal,
32858
- skillTargetDir,
32859
33184
  syncPath,
32860
33185
  syncTarget,
32861
33186
  pathsFile,
@@ -32879,9 +33204,6 @@ var parseArgs = (argv) => {
32879
33204
  };
32880
33205
  };
32881
33206
  var describeCommand = (commandName, rest) => {
32882
- if (commandName === "skill" && rest[0]) {
32883
- return `skill ${rest[0]}`;
32884
- }
32885
33207
  if (commandName === "sync" && rest[0] === "reset") {
32886
33208
  return "sync reset";
32887
33209
  }
@@ -32894,27 +33216,7 @@ var supportsDryRun = (commandName, rest) => {
32894
33216
  if (commandName === "sync") {
32895
33217
  return rest[0] !== "reset";
32896
33218
  }
32897
- return commandName === "skill" && (rest[0] === "add" || rest[0] === "install") || commandName === "encryption" && rest[0] === "migrate";
32898
- };
32899
- var resolveSkillAddInputs = (rest, storeFilters) => {
32900
- if (storeFilters.length === 0) {
32901
- return {
32902
- skillPathInput: rest[2],
32903
- storeInput: rest[1]
32904
- };
32905
- }
32906
- if (storeFilters.length > 1) {
32907
- throw new Error("skill add accepts exactly one --store value.");
32908
- }
32909
- if (rest[2]) {
32910
- throw new Error(
32911
- `Usage: ${commandNames} skill add --store <storeId> <path> [--provider <all|codex|claude>] [--global]`
32912
- );
32913
- }
32914
- return {
32915
- skillPathInput: rest[1],
32916
- storeInput: storeFilters[0]
32917
- };
33219
+ return commandName === "encryption" && rest[0] === "migrate";
32918
33220
  };
32919
33221
  var assertDryRunSupported = (parsed, command, rest) => {
32920
33222
  if (!parsed.dryRun || supportsDryRun(command, rest)) {
@@ -32968,10 +33270,10 @@ var listDirectoryEntries = async (listDirectory, directoryPath) => {
32968
33270
  if (left.type !== "directory" && right.type === "directory") {
32969
33271
  return 1;
32970
33272
  }
32971
- return path21.basename(left.path).localeCompare(path21.basename(right.path));
33273
+ return path24.basename(left.path).localeCompare(path24.basename(right.path));
32972
33274
  }).forEach((entry) => {
32973
33275
  const suffix = entry.type === "directory" ? "/" : "";
32974
- renderOutput(`${path21.basename(entry.path)}${suffix}`);
33276
+ renderOutput(`${path24.basename(entry.path)}${suffix}`);
32975
33277
  });
32976
33278
  };
32977
33279
  var listStores = async (listStoresMetadata) => {
@@ -33249,198 +33551,6 @@ Could not verify whether ${input.path} was deleted after the transient archive f
33249
33551
  throw new Error(`File not found: ${input.path}`);
33250
33552
  }
33251
33553
  };
33252
- var skillNamePattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
33253
- var normalizeSkillAgent = (input) => {
33254
- const normalized = input.trim().toLowerCase();
33255
- if (normalized === "codex" || normalized === "claude") {
33256
- return normalized;
33257
- }
33258
- throw new Error(
33259
- `Unsupported skill agent: ${input}. Supported agents: ${supportedSkillAgents.join(", ")}`
33260
- );
33261
- };
33262
- var normalizeSkillAgents = (inputs) => {
33263
- if (inputs.some((input) => input.trim().toLowerCase() === "all")) {
33264
- return supportedSkillAgents;
33265
- }
33266
- return [...new Set(inputs.map(normalizeSkillAgent))];
33267
- };
33268
- var normalizeRemoteSkillPath = (input) => {
33269
- const normalized = path21.posix.normalize(`/${input.trim()}`);
33270
- if (normalized === "/") {
33271
- throw new Error("Skill path must not be the store root.");
33272
- }
33273
- if (normalized.includes("\0")) {
33274
- throw new Error("Skill path contains an invalid null byte.");
33275
- }
33276
- return normalized;
33277
- };
33278
- var parentRemotePath = (filePath) => {
33279
- const parent = path21.posix.dirname(filePath);
33280
- return parent === "." ? "/" : parent;
33281
- };
33282
- var joinRemotePath = (left, right) => {
33283
- return path21.posix.join(left, right).replace(/\/+/g, "/");
33284
- };
33285
- var readRemoteSkillTextFile = async (filePath, storeRef, client) => {
33286
- const file2 = await client.readFileByRef({ ...storeRef, path: filePath });
33287
- if (!file2) {
33288
- throw new Error(`File not found: ${filePath}`);
33289
- }
33290
- const text = getTextContent(file2.content);
33291
- if (text === null) {
33292
- throw new Error(`File is binary and cannot be read as text: ${filePath}`);
33293
- }
33294
- return text;
33295
- };
33296
- var readRemoteSkillFileBytes = async (filePath, storeRef, client) => {
33297
- const file2 = await client.readFileByRef({ ...storeRef, path: filePath });
33298
- if (!file2) {
33299
- throw new Error(`File not found: ${filePath}`);
33300
- }
33301
- const text = getTextContent(file2.content);
33302
- if (text !== null) {
33303
- return new TextEncoder().encode(text);
33304
- }
33305
- const downloadUrl = await createRemoteFileDownloadUrl(
33306
- filePath,
33307
- storeRef,
33308
- client
33309
- );
33310
- const response = await fetch(downloadUrl);
33311
- if (!response.ok) {
33312
- throw new Error(
33313
- `Failed to download ${filePath}: ${response.status} ${response.statusText}`
33314
- );
33315
- }
33316
- return new Uint8Array(await response.arrayBuffer());
33317
- };
33318
- var collectRemoteSkillFiles = async ({
33319
- client,
33320
- directoryPath,
33321
- files,
33322
- rootPath,
33323
- storeRef
33324
- }) => {
33325
- const listing = await client.listDirectoryByRef({
33326
- ...storeRef,
33327
- directoryPath
33328
- });
33329
- for (const entry of listing.entries) {
33330
- if (entry.type === "directory") {
33331
- await collectRemoteSkillFiles({
33332
- client,
33333
- directoryPath: entry.path,
33334
- files,
33335
- rootPath,
33336
- storeRef
33337
- });
33338
- continue;
33339
- }
33340
- if (entry.type !== "text") {
33341
- throw new Error(
33342
- `Skill contains unsupported ${entry.type} entry: ${entry.path}`
33343
- );
33344
- }
33345
- const relativePath = path21.posix.relative(rootPath, entry.path);
33346
- if (!relativePath || relativePath.startsWith("..")) {
33347
- throw new Error(
33348
- `Unexpected skill entry outside skill root: ${entry.path}`
33349
- );
33350
- }
33351
- files.push({
33352
- bytes: await readRemoteSkillFileBytes(entry.path, storeRef, client),
33353
- relativePath
33354
- });
33355
- }
33356
- };
33357
- var resolveRemoteSkillRoot = async (inputPath, storeRef, client) => {
33358
- const normalizedPath = normalizeRemoteSkillPath(inputPath);
33359
- if (path21.posix.basename(normalizedPath) === "SKILL.md") {
33360
- await readRemoteSkillTextFile(normalizedPath, storeRef, client);
33361
- return {
33362
- rootPath: parentRemotePath(normalizedPath),
33363
- skillMarkdownPath: normalizedPath
33364
- };
33365
- }
33366
- const skillMarkdownPath = joinRemotePath(normalizedPath, "SKILL.md");
33367
- await readRemoteSkillTextFile(skillMarkdownPath, storeRef, client);
33368
- return {
33369
- rootPath: normalizedPath,
33370
- skillMarkdownPath
33371
- };
33372
- };
33373
- var parseSkillMetadata = (source) => {
33374
- const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
33375
- if (!match) {
33376
- throw new Error("SKILL.md must start with YAML frontmatter.");
33377
- }
33378
- const metadata = parseYaml(match[1] ?? "");
33379
- if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) {
33380
- throw new Error("SKILL.md frontmatter must be a YAML object.");
33381
- }
33382
- const name = metadata.name;
33383
- const description = metadata.description;
33384
- if (typeof name !== "string" || !name.trim()) {
33385
- throw new Error("SKILL.md frontmatter must include a non-empty name.");
33386
- }
33387
- if (typeof description !== "string" || !description.trim()) {
33388
- throw new Error(
33389
- "SKILL.md frontmatter must include a non-empty description."
33390
- );
33391
- }
33392
- const normalizedName = name.trim();
33393
- if (normalizedName.length > 64 || !skillNamePattern.test(normalizedName)) {
33394
- throw new Error(
33395
- "SKILL.md name must be 1-64 lowercase letters, numbers, and hyphens, with no leading, trailing, or repeated hyphens."
33396
- );
33397
- }
33398
- return {
33399
- description: description.trim(),
33400
- name: normalizedName
33401
- };
33402
- };
33403
- var readSkillMarkdownFromBundle = (bundle) => {
33404
- const skillMarkdown = bundle.files.find(
33405
- (file2) => file2.relativePath === "SKILL.md"
33406
- );
33407
- if (!skillMarkdown) {
33408
- throw new Error("Skill bundle is missing SKILL.md.");
33409
- }
33410
- return new TextDecoder().decode(skillMarkdown.bytes);
33411
- };
33412
- var validateSkillBundle = (bundle) => {
33413
- const metadata = parseSkillMetadata(readSkillMarkdownFromBundle(bundle));
33414
- if (metadata.name !== bundle.name) {
33415
- throw new Error(
33416
- `SKILL.md name "${metadata.name}" must match skill bundle "${bundle.name}".`
33417
- );
33418
- }
33419
- };
33420
- var resolveSkillInstallTargets = async ({
33421
- agents,
33422
- projectDir,
33423
- scope,
33424
- skillName,
33425
- targetDir
33426
- }) => {
33427
- const selectedAgents = agents.length > 0 ? normalizeSkillAgents(agents) : await selectSkillAgents();
33428
- if (targetDir && selectedAgents.length !== 1) {
33429
- throw new Error(
33430
- "--target-dir requires exactly one --provider or --agent value."
33431
- );
33432
- }
33433
- return Promise.all(
33434
- selectedAgents.map(async (agent) => {
33435
- const rootDir = targetDir ?? await getSkillRoot(agent, scope, projectDir);
33436
- return {
33437
- agent,
33438
- rootDir,
33439
- targetDir: path21.join(rootDir, skillName)
33440
- };
33441
- })
33442
- );
33443
- };
33444
33554
  var confirmYesNo = async ({
33445
33555
  assumeYes,
33446
33556
  nonInteractiveMessage,
@@ -33463,186 +33573,6 @@ var confirmYesNo = async ({
33463
33573
  readline.close();
33464
33574
  }
33465
33575
  };
33466
- var confirmSkillInstall = async (targets, assumeYes) => {
33467
- return confirmYesNo({
33468
- assumeYes,
33469
- nonInteractiveMessage: "Refusing to install or update skills without interactive confirmation. Rerun with --yes to confirm in a non-interactive shell.",
33470
- prompt: `Install or update ${targets.length} skill target${targets.length === 1 ? "" : "s"}? [y/N] `
33471
- });
33472
- };
33473
- var formatSkillTarget = (target, existingTargetDirs) => {
33474
- const suffix = existingTargetDirs.has(target.targetDir) ? " (updates existing)" : "";
33475
- return ` ${target.agent.padEnd(7)} ${target.targetDir}${suffix}`;
33476
- };
33477
- var writeSkillFiles = async (target, files, replaceExisting) => {
33478
- const temporaryDirectory = path21.join(
33479
- target.rootDir,
33480
- `.${path21.basename(target.targetDir)}.tmp-${process.pid}-${Date.now()}`
33481
- );
33482
- await rm5(temporaryDirectory, { recursive: true, force: true });
33483
- await mkdir6(temporaryDirectory, { recursive: true });
33484
- try {
33485
- for (const file2 of files) {
33486
- const localPath = path21.join(temporaryDirectory, file2.relativePath);
33487
- await mkdir6(path21.dirname(localPath), { recursive: true });
33488
- await writeFile6(localPath, file2.bytes);
33489
- }
33490
- if (replaceExisting) {
33491
- await rm5(target.targetDir, { recursive: true, force: true });
33492
- }
33493
- await rename4(temporaryDirectory, target.targetDir);
33494
- } catch (error51) {
33495
- await rm5(temporaryDirectory, { recursive: true, force: true });
33496
- throw error51;
33497
- }
33498
- };
33499
- var installSkillBundle = async ({
33500
- agents,
33501
- assumeYes,
33502
- bundle,
33503
- dryRun,
33504
- isGlobal,
33505
- targetDir
33506
- }) => {
33507
- validateSkillBundle(bundle);
33508
- const targets = await resolveSkillInstallTargets({
33509
- agents,
33510
- projectDir: process.cwd(),
33511
- scope: isGlobal ? "global" : "local",
33512
- skillName: bundle.name,
33513
- targetDir
33514
- });
33515
- const existingTargets = (await Promise.all(
33516
- targets.map(
33517
- async (target) => await pathExists3(target.targetDir) ? target : null
33518
- )
33519
- )).filter((target) => target !== null);
33520
- const existingTargetDirs = new Set(
33521
- existingTargets.map((target) => target.targetDir)
33522
- );
33523
- const action = existingTargets.length === 0 ? "Install" : existingTargets.length === targets.length ? "Update" : "Install or update";
33524
- renderOutput(
33525
- `${dryRun ? `Would ${action.toLowerCase()}` : action} skill ${bundle.name} from ${bundle.sourceLabel} into:`
33526
- );
33527
- renderOutput("");
33528
- targets.forEach(
33529
- (target) => renderOutput(formatSkillTarget(target, existingTargetDirs))
33530
- );
33531
- if (dryRun) {
33532
- return;
33533
- }
33534
- if (!await confirmSkillInstall(targets, assumeYes)) {
33535
- throw new Error("Aborted skill install.");
33536
- }
33537
- for (const target of targets) {
33538
- await mkdir6(target.rootDir, { recursive: true });
33539
- }
33540
- for (const target of targets) {
33541
- await writeSkillFiles(
33542
- target,
33543
- bundle.files,
33544
- existingTargetDirs.has(target.targetDir)
33545
- );
33546
- }
33547
- targets.forEach((target) => {
33548
- renderOutput(
33549
- `Installed ${bundle.name} for ${target.agent}: ${target.targetDir}`
33550
- );
33551
- });
33552
- };
33553
- var readRemoteSkillBundle = async ({
33554
- client,
33555
- skillPathInput,
33556
- storeInput
33557
- }) => {
33558
- const storeRef = await resolveOwnStoreRef(storeInput, client);
33559
- const { rootPath, skillMarkdownPath } = await resolveRemoteSkillRoot(
33560
- skillPathInput,
33561
- storeRef,
33562
- client
33563
- );
33564
- const skillMarkdown = await readRemoteSkillTextFile(
33565
- skillMarkdownPath,
33566
- storeRef,
33567
- client
33568
- );
33569
- const metadata = parseSkillMetadata(skillMarkdown);
33570
- const rootName = path21.posix.basename(rootPath);
33571
- if (metadata.name !== rootName) {
33572
- throw new Error(
33573
- `SKILL.md name "${metadata.name}" must match skill directory "${rootName}".`
33574
- );
33575
- }
33576
- const files = [];
33577
- await collectRemoteSkillFiles({
33578
- client,
33579
- directoryPath: rootPath,
33580
- files,
33581
- rootPath,
33582
- storeRef
33583
- });
33584
- return {
33585
- description: metadata.description,
33586
- files,
33587
- name: metadata.name,
33588
- sourceLabel: `${storeInput}:${rootPath}`
33589
- };
33590
- };
33591
- var runSkillAddCommand = async ({
33592
- client,
33593
- dryRun,
33594
- agents,
33595
- assumeYes,
33596
- isGlobal,
33597
- storeInput,
33598
- skillPathInput,
33599
- targetDir
33600
- }) => {
33601
- if (!storeInput || !skillPathInput) {
33602
- throw new Error(
33603
- `Usage: ${commandNames} skill add <storeId> <path> [--provider <all|codex|claude>] [--global]`
33604
- );
33605
- }
33606
- await installSkillBundle({
33607
- agents,
33608
- assumeYes,
33609
- bundle: await readRemoteSkillBundle({ client, skillPathInput, storeInput }),
33610
- dryRun,
33611
- isGlobal,
33612
- targetDir
33613
- });
33614
- };
33615
- var readBuiltInForumSkillBundle = async (client) => {
33616
- const bundle = await client.getBuiltInSkill({ id: "forum" });
33617
- return {
33618
- description: bundle.description,
33619
- files: bundle.files.map(
33620
- (file2) => ({
33621
- bytes: new TextEncoder().encode(file2.text),
33622
- relativePath: file2.path
33623
- })
33624
- ),
33625
- name: bundle.name,
33626
- sourceLabel: "built-in Forum skill"
33627
- };
33628
- };
33629
- var runSkillInstallCommand = async ({
33630
- agents,
33631
- assumeYes,
33632
- client,
33633
- dryRun,
33634
- isGlobal,
33635
- targetDir
33636
- }) => {
33637
- await installSkillBundle({
33638
- agents,
33639
- assumeYes,
33640
- bundle: await readBuiltInForumSkillBundle(client),
33641
- dryRun,
33642
- isGlobal,
33643
- targetDir
33644
- });
33645
- };
33646
33576
  var runFileCommand = async (subcommand, args, parsed, client) => {
33647
33577
  const storeRef = await resolveSingleStoreRef(parsed.storeFilters, client);
33648
33578
  if (subcommand === "ls") {
@@ -33747,7 +33677,7 @@ var readWriteTextInput = async (inlineText, inputFilePath) => {
33747
33677
  throw new Error("Provide either inline text or --file, not both.");
33748
33678
  }
33749
33679
  if (inputFilePath) {
33750
- return readFile8(inputFilePath, "utf8");
33680
+ return readFile10(inputFilePath, "utf8");
33751
33681
  }
33752
33682
  return inlineText ?? null;
33753
33683
  };
@@ -33763,7 +33693,7 @@ var readRemoteTextFile = async (filePath, storeRef, client) => {
33763
33693
  return text;
33764
33694
  };
33765
33695
  var normalizeRemotePath = (input) => {
33766
- const normalized = path21.posix.normalize(`/${input.trim()}`);
33696
+ const normalized = path24.posix.normalize(`/${input.trim()}`);
33767
33697
  if (normalized.includes("\0")) {
33768
33698
  throw new Error("Path contains an invalid null byte.");
33769
33699
  }
@@ -34057,7 +33987,7 @@ var diffRemoteFiles = async ({
34057
33987
  storeRef
34058
33988
  }) => {
34059
33989
  const leftText = await readRemoteTextFile(leftPath, storeRef, client);
34060
- const rightText = localRight ? await readFile8(path21.resolve(rightPath), "utf8") : await readRemoteTextFile(rightPath, storeRef, client);
33990
+ const rightText = localRight ? await readFile10(path24.resolve(rightPath), "utf8") : await readRemoteTextFile(rightPath, storeRef, client);
34061
33991
  return buildUnifiedDiff({
34062
33992
  leftLabel: leftPath,
34063
33993
  leftText,
@@ -34124,8 +34054,8 @@ var copyRemotePath = async (args, storeRef, client) => {
34124
34054
  (entry) => entry.path.startsWith(`${normalizedSource}/`)
34125
34055
  );
34126
34056
  for (const entry of descendants) {
34127
- const relativePath = path21.posix.relative(normalizedSource, entry.path);
34128
- const targetPath = path21.posix.join(normalizedDestination, relativePath);
34057
+ const relativePath = path24.posix.relative(normalizedSource, entry.path);
34058
+ const targetPath = path24.posix.join(normalizedDestination, relativePath);
34129
34059
  if (entry.type === "directory") {
34130
34060
  await createRemoteDirectory(targetPath, storeRef, client);
34131
34061
  continue;
@@ -34320,19 +34250,19 @@ var runDecryptCommand = async (rest, parsed, client) => {
34320
34250
  );
34321
34251
  };
34322
34252
  var runEditCommand = async (rest, parsed, client) => {
34323
- const filePath = parsed.inputFilePath ?? (rest[0] ? path21.resolve(rest[0]) : null);
34253
+ const filePath = parsed.inputFilePath ?? (rest[0] ? path24.resolve(rest[0]) : null);
34324
34254
  if (!filePath) {
34325
34255
  throw new Error(
34326
34256
  `Usage: ${commandNames} edit (<localPath>|--file|-f <localPath>) [--password <password>] [--token <jwt>]`
34327
34257
  );
34328
34258
  }
34329
- const encryptedText = await readFile8(filePath, "utf8");
34259
+ const encryptedText = await readFile10(filePath, "utf8");
34330
34260
  const [password, userEncryption] = await Promise.all([
34331
34261
  readEncryptionPassword(parsed),
34332
34262
  readUserEncryption(client)
34333
34263
  ]);
34334
34264
  const result = await editEncryptedText({
34335
- edit: (currentPlaintext) => openInEditor(currentPlaintext, { extension: path21.extname(filePath) }),
34265
+ edit: (currentPlaintext) => openInEditor(currentPlaintext, { extension: path24.extname(filePath) }),
34336
34266
  encryptedText,
34337
34267
  password,
34338
34268
  userEncryption: userEncryption.userEncryption
@@ -34385,7 +34315,7 @@ var runEncryptAddRecipientCommand = async (rest, parsed, client) => {
34385
34315
  userEncryption: userEncryption.userEncryption
34386
34316
  });
34387
34317
  if (parsed.inputFilePath) {
34388
- await writeFile6(parsed.inputFilePath, result.encryptedText, "utf8");
34318
+ await writeFile7(parsed.inputFilePath, result.encryptedText, "utf8");
34389
34319
  }
34390
34320
  if (parsed.json) {
34391
34321
  renderOutput({
@@ -34408,11 +34338,11 @@ var runEncryptAddRecipientCommand = async (rest, parsed, client) => {
34408
34338
  `);
34409
34339
  renderOutput(result.encryptedText);
34410
34340
  };
34411
- var defaultEncryptionMigrationBackupPath = () => path21.resolve(process.cwd(), "doctrine-encryption-migration.json");
34412
- var readEncryptionMigrationBackup = async (backupPath) => JSON.parse(await readFile8(backupPath, "utf8"));
34341
+ var defaultEncryptionMigrationBackupPath = () => path24.resolve(process.cwd(), "doctrine-encryption-migration.json");
34342
+ var readEncryptionMigrationBackup = async (backupPath) => JSON.parse(await readFile10(backupPath, "utf8"));
34413
34343
  var writeEncryptionMigrationBackup = async (backupPath, backup) => {
34414
- await mkdir6(path21.dirname(backupPath), { recursive: true });
34415
- await writeFile6(backupPath, `${JSON.stringify(backup, null, 2)}
34344
+ await mkdir7(path24.dirname(backupPath), { recursive: true });
34345
+ await writeFile7(backupPath, `${JSON.stringify(backup, null, 2)}
34416
34346
  `, "utf8");
34417
34347
  };
34418
34348
  var confirmEncryptionMigration = async ({
@@ -34699,7 +34629,7 @@ var runEncryptionMigrateCommand = async (rest, parsed, client) => {
34699
34629
  `Usage: ${commandNames} encryption migrate [backup-file] [--store <storeId>] [--password <password>] [--dry-run] [--yes]`
34700
34630
  );
34701
34631
  }
34702
- const backupPath = path21.resolve(
34632
+ const backupPath = path24.resolve(
34703
34633
  rest[1] ?? defaultEncryptionMigrationBackupPath()
34704
34634
  );
34705
34635
  const password = await readEncryptionPassword(parsed);
@@ -34774,7 +34704,7 @@ var doesRemoteQueryMatchPath = (query, filePath) => {
34774
34704
  if (query.startsWith("/")) {
34775
34705
  return normalizedPath === query;
34776
34706
  }
34777
- const filename = path21.basename(filePath).toLowerCase();
34707
+ const filename = path24.basename(filePath).toLowerCase();
34778
34708
  return filename === query || normalizedPath === query || filename.includes(query) || normalizedPath.includes(query);
34779
34709
  };
34780
34710
  var queryRemoteFiles = async (query, storeFilters, client) => {
@@ -34846,7 +34776,7 @@ var printRemoteQueryMatches = (matches) => {
34846
34776
  });
34847
34777
  };
34848
34778
  var normalizeRemoteDirectoryPath = (input) => {
34849
- const normalized = path21.posix.normalize(`/${input.trim()}`);
34779
+ const normalized = path24.posix.normalize(`/${input.trim()}`);
34850
34780
  if (normalized.includes("\0")) {
34851
34781
  throw new Error("Path contains an invalid null byte.");
34852
34782
  }
@@ -34966,12 +34896,12 @@ var labelFromTreeDirectoryPath = (directoryPath) => {
34966
34896
  if (directoryPath === "/") {
34967
34897
  return "./";
34968
34898
  }
34969
- return `${path21.posix.basename(directoryPath)}/`;
34899
+ return `${path24.posix.basename(directoryPath)}/`;
34970
34900
  };
34971
34901
  var doesTreeFilterMatchDirectory = (filter, directoryPath) => {
34972
34902
  const normalizedFilter = filter.trim().toLowerCase();
34973
34903
  const normalizedPath = directoryPath.toLowerCase();
34974
- const basename3 = path21.posix.basename(directoryPath).toLowerCase();
34904
+ const basename3 = path24.posix.basename(directoryPath).toLowerCase();
34975
34905
  return basename3.includes(normalizedFilter) || normalizedPath.includes(normalizedFilter);
34976
34906
  };
34977
34907
  var resolveTreeDirectoryPath = async ({
@@ -35026,7 +34956,7 @@ var printRemoteTreeChildren = async ({
35026
34956
  const childPrefix = isLast ? " " : "\u2502 ";
35027
34957
  const suffix = entry.type === "directory" ? "/" : "";
35028
34958
  lines.push(
35029
- `${prefix}${connector}${path21.posix.basename(entry.path)}${suffix}`
34959
+ `${prefix}${connector}${path24.posix.basename(entry.path)}${suffix}`
35030
34960
  );
35031
34961
  if (entry.type === "directory") {
35032
34962
  await printRemoteTreeChildren({
@@ -35638,9 +35568,9 @@ var shouldPrintCheckoutDetail = (detail, verbose) => {
35638
35568
  var formatCheckoutDetail = (detail, options2) => {
35639
35569
  const status = checkoutStatusLabel(detail, options2);
35640
35570
  const direction = checkoutDirectionLabel(detail);
35641
- const path22 = formatCheckoutDetailPath(detail, options2.syncRules);
35571
+ const path25 = formatCheckoutDetailPath(detail, options2.syncRules);
35642
35572
  const reason = styleText.dim(checkoutDetailMessage(detail));
35643
- return direction ? `${direction} ${status} ${path22} ${reason}` : `${status} ${path22} ${reason}`;
35573
+ return direction ? `${direction} ${status} ${path25} ${reason}` : `${status} ${path25} ${reason}`;
35644
35574
  };
35645
35575
  var formatCheckoutDetailPath = (detail, syncRules) => {
35646
35576
  const localPath = formatLocalCheckoutPath(detail.relativePath);
@@ -35852,9 +35782,9 @@ var checkoutReportGroups = (details, options2) => {
35852
35782
  );
35853
35783
  };
35854
35784
  var checkoutReportDetailLine = (detail, options2) => {
35855
- const path22 = formatCheckoutDetailPath(detail, options2.syncRules);
35785
+ const path25 = formatCheckoutDetailPath(detail, options2.syncRules);
35856
35786
  const message = detail.status === "failed" || detail.status === "skipped" || detail.status === "ignored" ? detail.message ?? checkoutDetailMessage(detail) : "";
35857
- return message ? ` ${path22} ${styleText.dim(message)}` : ` ${path22}`;
35787
+ return message ? ` ${path25} ${styleText.dim(message)}` : ` ${path25}`;
35858
35788
  };
35859
35789
  var checkoutReportGroupBlock = ({
35860
35790
  dryRun,
@@ -35981,13 +35911,13 @@ var statusChangeKind = (detail) => {
35981
35911
  var formatStatusChange = (detail, syncRules) => {
35982
35912
  const kind = statusChangeKind(detail);
35983
35913
  const tone = kind === "deleted" ? "error" : kind === "added" ? "ok" : "warn";
35984
- const path22 = formatCheckoutDetailPath(detail, syncRules);
35985
- return ` ${styleText.color(tone, kind.padEnd(8))} ${path22}`;
35914
+ const path25 = formatCheckoutDetailPath(detail, syncRules);
35915
+ return ` ${styleText.color(tone, kind.padEnd(8))} ${path25}`;
35986
35916
  };
35987
35917
  var formatStatusBlock = (detail, syncRules) => {
35988
35918
  const message = detail.message ? ` ${styleText.dim(detail.message)}` : "";
35989
- const path22 = formatCheckoutDetailPath(detail, syncRules);
35990
- return ` ${styleText.color("error", "blocked ".padEnd(8))} ${path22}${message}`;
35919
+ const path25 = formatCheckoutDetailPath(detail, syncRules);
35920
+ return ` ${styleText.color("error", "blocked ".padEnd(8))} ${path25}${message}`;
35991
35921
  };
35992
35922
  var actionableStatusDetails = (result) => result.details.filter(
35993
35923
  (detail) => detail.status === "succeeded" || detail.status === "deleted"
@@ -36646,15 +36576,15 @@ var runCheckoutStatus = async ({
36646
36576
  var isCheckoutStateGitPath = isCheckoutStateDirectoryPath;
36647
36577
  var checkoutFilesManifestPath2 = () => `${resolveCheckoutStateDirectoryName()}/files.json`;
36648
36578
  var isInsideOrEqual = (parentPath, childPath2) => {
36649
- const relativePath = path21.relative(parentPath, childPath2);
36650
- return relativePath === "" || !relativePath.startsWith("..") && !path21.isAbsolute(relativePath);
36579
+ const relativePath = path24.relative(parentPath, childPath2);
36580
+ return relativePath === "" || !relativePath.startsWith("..") && !path24.isAbsolute(relativePath);
36651
36581
  };
36652
36582
  var resolveSyncTargetPaths = (checkout) => checkout.syncRules.map(
36653
- (rule) => path21.resolve(checkout.rootDir, rule.target || ".")
36583
+ (rule) => path24.resolve(checkout.rootDir, rule.target || ".")
36654
36584
  );
36655
- var resolveCheckoutManifestGitPath = (checkout, gitRoot) => path21.relative(
36585
+ var resolveCheckoutManifestGitPath = (checkout, gitRoot) => path24.relative(
36656
36586
  gitRoot,
36657
- path21.join(checkout.rootDir, checkoutFilesManifestPath2())
36587
+ path24.join(checkout.rootDir, checkoutFilesManifestPath2())
36658
36588
  ) || checkoutFilesManifestPath2();
36659
36589
  var stageCheckoutManifest = async ({
36660
36590
  checkout,
@@ -36680,7 +36610,7 @@ var assertGitChangesStayInSyncTargets = async ({
36680
36610
  if (isCheckoutStateGitPath(entry.path)) {
36681
36611
  return false;
36682
36612
  }
36683
- const absolutePath = path21.resolve(gitRoot, entry.path);
36613
+ const absolutePath = path24.resolve(gitRoot, entry.path);
36684
36614
  return !allowedPaths.some(
36685
36615
  (allowedPath) => isInsideOrEqual(allowedPath, absolutePath)
36686
36616
  );
@@ -36702,7 +36632,7 @@ var stageGitSyncTargets = async ({
36702
36632
  }) => {
36703
36633
  const targetPaths = [];
36704
36634
  for (const targetPath of resolveSyncTargetPaths(checkout)) {
36705
- const relativePath = path21.relative(gitRoot, targetPath) || ".";
36635
+ const relativePath = path24.relative(gitRoot, targetPath) || ".";
36706
36636
  const tracked = await runGit(gitRoot, ["ls-files", "--", relativePath]);
36707
36637
  if (await pathExists3(targetPath) || tracked.stdout.trim()) {
36708
36638
  targetPaths.push(relativePath);
@@ -37002,7 +36932,7 @@ var writeCheckoutConfig = async (directoryPath, metadata, workspaceSlug, options
37002
36932
  );
37003
36933
  }
37004
36934
  await writeForumProjectConfig(
37005
- path21.join(directoryPath, defaultProjectConfigFilename),
36935
+ path24.join(directoryPath, defaultProjectConfigFilename),
37006
36936
  {
37007
36937
  syncRules: [
37008
36938
  {
@@ -37039,7 +36969,7 @@ var normalizeProjectConfigPath = (value, fieldName, allowCurrentDirectory = fals
37039
36969
  }
37040
36970
  throw new Error(`${fieldName} must be a non-empty relative path.`);
37041
36971
  }
37042
- if (path21.isAbsolute(value)) {
36972
+ if (path24.isAbsolute(value)) {
37043
36973
  throw new Error(`${fieldName} must be a relative path.`);
37044
36974
  }
37045
36975
  const segments2 = trimmed.split("/");
@@ -37221,7 +37151,7 @@ var defaultCloneDirectoryName = (storeId) => {
37221
37151
  var fsErrorCode = (error51) => error51 instanceof Error && "code" in error51 ? String(error51.code ?? "") : "";
37222
37152
  var ensureGitMetadataExists = async (directoryPath) => {
37223
37153
  try {
37224
- await lstat2(path21.join(directoryPath, ".git"));
37154
+ await lstat5(path24.join(directoryPath, ".git"));
37225
37155
  } catch (error51) {
37226
37156
  if (fsErrorCode(error51) === "ENOENT") {
37227
37157
  throw new Error(
@@ -37259,8 +37189,8 @@ var confirmGitMetadataDeletion = async (localPath, assumeYes) => {
37259
37189
  "Refusing to delete .git without interactive confirmation. Rerun with --yes to confirm in a non-interactive shell."
37260
37190
  );
37261
37191
  }
37262
- const gitPath = path21.join(localPath, ".git");
37263
- const gitignorePath = path21.join(localPath, ".gitignore");
37192
+ const gitPath = path24.join(localPath, ".git");
37193
+ const gitignorePath = path24.join(localPath, ".gitignore");
37264
37194
  const confirmationPhrase = "DELETE GIT";
37265
37195
  renderWarning("");
37266
37196
  renderWarning("DANGER: Forum is about to remove Git from this checkout.");
@@ -37306,7 +37236,7 @@ var runGitConvertCommand = async ({
37306
37236
  );
37307
37237
  }
37308
37238
  await writeForumProjectConfig(
37309
- path21.join(localPath, defaultProjectConfigFilename),
37239
+ path24.join(localPath, defaultProjectConfigFilename),
37310
37240
  {
37311
37241
  syncRules: [
37312
37242
  {
@@ -37368,14 +37298,18 @@ var runGitConvertCommand = async ({
37368
37298
  "Aborted before deleting Git metadata. The Forum push completed, but .git and .gitignore were left in place."
37369
37299
  );
37370
37300
  }
37371
- await rm5(path21.join(localPath, ".gitignore"), { force: true });
37372
- await rm5(path21.join(localPath, ".git"), { recursive: true, force: true });
37301
+ await rm6(path24.join(localPath, ".gitignore"), { force: true });
37302
+ await rm6(path24.join(localPath, ".git"), { recursive: true, force: true });
37373
37303
  renderOutput(
37374
37304
  `${created ? "Created" : "Using existing"} store ${metadata.slug}`
37375
37305
  );
37376
37306
  renderOutput(`Converted Git repository to Forum checkout at ${localPath}`);
37377
37307
  };
37378
37308
  var main = async (argv = process.argv.slice(2)) => {
37309
+ if (parseArgvCommandName(argv) === "skills") {
37310
+ await runSkillsCommand(argv);
37311
+ return;
37312
+ }
37379
37313
  const parsed = parseArgs(argv);
37380
37314
  configureRenderer({ json: parsed.json });
37381
37315
  let [command, ...rest] = parsed.args;
@@ -37492,7 +37426,7 @@ var main = async (argv = process.argv.slice(2)) => {
37492
37426
  }
37493
37427
  if (command === "hash" && parsed.local) {
37494
37428
  const filePath = rest[0];
37495
- renderOutput(await hashLocalFile(path21.resolve(filePath)));
37429
+ renderOutput(await hashLocalFile(path24.resolve(filePath)));
37496
37430
  return;
37497
37431
  }
37498
37432
  const config2 = await resolveConfig(parsed);
@@ -37673,51 +37607,6 @@ var main = async (argv = process.argv.slice(2)) => {
37673
37607
  }
37674
37608
  return;
37675
37609
  }
37676
- if (command === "skill") {
37677
- const subcommand = rest[0];
37678
- if (subcommand === "install") {
37679
- if (rest[1] || parsed.storeFilters.length > 0) {
37680
- throw new Error(
37681
- `Usage: ${commandNames} skill install [--provider <all|codex|claude>] [--global]`
37682
- );
37683
- }
37684
- await withActivity(
37685
- "Installing built-in skill",
37686
- () => runSkillInstallCommand({
37687
- agents: parsed.skillAgents,
37688
- assumeYes: parsed.yes,
37689
- client,
37690
- dryRun: parsed.dryRun,
37691
- isGlobal: parsed.skillGlobal,
37692
- targetDir: parsed.skillTargetDir
37693
- })
37694
- );
37695
- return;
37696
- }
37697
- if (subcommand === "add") {
37698
- const { skillPathInput, storeInput } = resolveSkillAddInputs(
37699
- rest,
37700
- parsed.storeFilters
37701
- );
37702
- await withActivity(
37703
- "Installing skill",
37704
- () => runSkillAddCommand({
37705
- agents: parsed.skillAgents,
37706
- assumeYes: parsed.yes,
37707
- client,
37708
- dryRun: parsed.dryRun,
37709
- isGlobal: parsed.skillGlobal,
37710
- skillPathInput,
37711
- storeInput,
37712
- targetDir: parsed.skillTargetDir
37713
- })
37714
- );
37715
- return;
37716
- }
37717
- throw new Error(
37718
- `Usage: ${commandNames} skill install|add <storeId> <path> [--provider <all|codex|claude>] [--global]`
37719
- );
37720
- }
37721
37610
  if (command === "hash") {
37722
37611
  const filePath = rest[0];
37723
37612
  const hash2 = await withActivity("Hashing remote file", async () => {
@@ -38024,8 +37913,8 @@ var main = async (argv = process.argv.slice(2)) => {
38024
37913
  `Usage: ${commandNames} clone <storeId> [localPath] [--readonly]`
38025
37914
  );
38026
37915
  }
38027
- const localPath = path21.resolve(
38028
- rest[1] ?? path21.join(process.cwd(), defaultCloneDirectoryName(remoteInput))
37916
+ const localPath = path24.resolve(
37917
+ rest[1] ?? path24.join(process.cwd(), defaultCloneDirectoryName(remoteInput))
38029
37918
  );
38030
37919
  const { metadata, workspaceSlug, storeRef } = await resolveReadableStore(
38031
37920
  remoteInput,
@@ -38053,7 +37942,7 @@ var main = async (argv = process.argv.slice(2)) => {
38053
37942
  storeRef,
38054
37943
  syncRules: checkout.syncRules
38055
37944
  });
38056
- renderOutput(`Cloned store ${metadata.slug} to ${path21.resolve(localPath)}`);
37945
+ renderOutput(`Cloned store ${metadata.slug} to ${path24.resolve(localPath)}`);
38057
37946
  formatCheckoutResult("Pulled", result, {
38058
37947
  detailsRendered: Boolean(progress),
38059
37948
  verbose: parsed.verbose
@@ -38103,7 +37992,7 @@ var main = async (argv = process.argv.slice(2)) => {
38103
37992
  });
38104
37993
  result.warnings.forEach((warning) => renderWarning(warning));
38105
37994
  if (parsed.outputFilePath) {
38106
- await writeFile6(parsed.outputFilePath, result.text, "utf8");
37995
+ await writeFile7(parsed.outputFilePath, result.text, "utf8");
38107
37996
  } else {
38108
37997
  renderOutput(result.text);
38109
37998
  }