@mp-lb/forum-cli 0.1.42 → 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));
@@ -18812,14 +18811,20 @@ var recentStoreVisitSchema = external_exports.object({
18812
18811
  storeId: storeUuidSchema,
18813
18812
  visitedAt: external_exports.string().datetime()
18814
18813
  });
18814
+ var recentFileVisitSchema = external_exports.object({
18815
+ fileId: external_exports.string().min(1).max(200),
18816
+ visitedAt: external_exports.string().datetime()
18817
+ });
18815
18818
  var storePreferenceIdSchema = external_exports.union([
18816
18819
  storeUuidSchema,
18817
18820
  storeIdSchema
18818
18821
  ]);
18819
18822
  var pinnedStoreIdsValueSchema = external_exports.array(storePreferenceIdSchema);
18820
18823
  var recentStoresValueSchema = external_exports.array(recentStoreVisitSchema);
18824
+ var recentFilesValueSchema = external_exports.array(recentFileVisitSchema);
18821
18825
  var pinnedStoreIdsSchema = pinnedStoreIdsValueSchema.default([]);
18822
18826
  var recentStoresSchema = recentStoresValueSchema.default([]);
18827
+ var recentFilesSchema = recentFilesValueSchema.default([]);
18823
18828
  var createTypeLastUsedAtSchema = external_exports.record(
18824
18829
  external_exports.string().min(1).max(100),
18825
18830
  external_exports.string().datetime()
@@ -18828,6 +18833,7 @@ var userPreferencesSchema = external_exports.object({
18828
18833
  id: storeOwnerIdSchema,
18829
18834
  pinnedStoreIds: pinnedStoreIdsSchema,
18830
18835
  recentStores: recentStoresSchema,
18836
+ recentFiles: recentFilesSchema,
18831
18837
  createTypeLastUsedAt: createTypeLastUsedAtSchema.default({}),
18832
18838
  recentStoresEnabled: external_exports.boolean().default(true),
18833
18839
  showHomeWelcomeBanner: external_exports.boolean().default(true),
@@ -18848,6 +18854,7 @@ var userPreferencesSchema = external_exports.object({
18848
18854
  var userPreferencesUpdateSchema = external_exports.object({
18849
18855
  pinnedStoreIds: pinnedStoreIdsValueSchema,
18850
18856
  recentStores: recentStoresValueSchema,
18857
+ recentFiles: recentFilesValueSchema,
18851
18858
  createTypeLastUsedAt: createTypeLastUsedAtSchema,
18852
18859
  recentStoresEnabled: external_exports.boolean(),
18853
18860
  showHomeWelcomeBanner: external_exports.boolean(),
@@ -18867,6 +18874,21 @@ var readPublicUserEncryptionKeysInputSchema = external_exports.object({
18867
18874
  });
18868
18875
  var readOwnUserPreferencesInputSchema = external_exports.object({});
18869
18876
  var pruneOwnRecentStoresInputSchema = external_exports.object({});
18877
+ var recordOwnRecentFileInputSchema = external_exports.object({
18878
+ fileId: external_exports.string().min(1).max(200)
18879
+ });
18880
+ var listOwnRecentFilesInputSchema = external_exports.object({});
18881
+ var clearOwnRecentsInputSchema = external_exports.object({});
18882
+ var resolvedRecentFileSchema = external_exports.object({
18883
+ fileId: external_exports.string(),
18884
+ name: external_exports.string(),
18885
+ path: external_exports.string(),
18886
+ storeEmoji: external_exports.string().nullable(),
18887
+ storeId: external_exports.string(),
18888
+ storeSlug: external_exports.string(),
18889
+ visitedAt: external_exports.string().datetime(),
18890
+ workspaceId: external_exports.string()
18891
+ });
18870
18892
  var updateOwnPinnedStoreInputSchema = external_exports.object({
18871
18893
  storeId: storePreferenceIdSchema
18872
18894
  });
@@ -19584,21 +19606,21 @@ var isKey = (value) => /^\w*$/.test(value);
19584
19606
  var isUndefined = (val) => val === void 0;
19585
19607
  var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
19586
19608
  var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
19587
- var get = (object2, path22, defaultValue) => {
19588
- if (!path22 || !isObject2(object2)) {
19609
+ var get = (object2, path25, defaultValue) => {
19610
+ if (!path25 || !isObject2(object2)) {
19589
19611
  return defaultValue;
19590
19612
  }
19591
- const paths = isKey(path22) ? [path22] : stringToPath(path22);
19613
+ const paths = isKey(path25) ? [path25] : stringToPath(path25);
19592
19614
  const result = paths.reduce((result2, key) => {
19593
19615
  return isNullOrUndefined(result2) ? void 0 : result2[key];
19594
19616
  }, object2);
19595
- 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;
19596
19618
  };
19597
19619
  var isBoolean = (value) => typeof value === "boolean";
19598
19620
  var isFunction = (value) => typeof value === "function";
19599
- var set2 = (object2, path22, value) => {
19621
+ var set2 = (object2, path25, value) => {
19600
19622
  let index = -1;
19601
- const tempPath = isKey(path22) ? [path22] : stringToPath(path22);
19623
+ const tempPath = isKey(path25) ? [path25] : stringToPath(path25);
19602
19624
  const length = tempPath.length;
19603
19625
  const lastIndex = length - 1;
19604
19626
  while (++index < length) {
@@ -19796,12 +19818,12 @@ function isEmptyArray(obj) {
19796
19818
  }
19797
19819
  return true;
19798
19820
  }
19799
- function unset(object2, path22) {
19800
- if (isString(path22) && Object.prototype.hasOwnProperty.call(object2, path22)) {
19801
- delete object2[path22];
19821
+ function unset(object2, path25) {
19822
+ if (isString(path25) && Object.prototype.hasOwnProperty.call(object2, path25)) {
19823
+ delete object2[path25];
19802
19824
  return object2;
19803
19825
  }
19804
- const paths = Array.isArray(path22) ? path22 : isKey(path22) ? [path22] : stringToPath(path22);
19826
+ const paths = Array.isArray(path25) ? path25 : isKey(path25) ? [path25] : stringToPath(path25);
19805
19827
  const childObject = paths.length === 1 ? object2 : baseGet(object2, paths);
19806
19828
  const index = paths.length - 1;
19807
19829
  const key = paths[index];
@@ -22647,6 +22669,41 @@ var redeemPromoCodeResultSchema = external_exports.object({
22647
22669
  grantAmount: external_exports.number().int().nonnegative()
22648
22670
  });
22649
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
+
22650
22707
  // ../../packages/core/src/structuredFileSchemas.ts
22651
22708
  var structuredSchemaReferenceShape = {
22652
22709
  $schema: external_exports.string().url().optional()
@@ -23467,6 +23524,7 @@ var creatableFileTypeSections = [
23467
23524
  t("board", "Board", ".board.json"),
23468
23525
  t("calendar", "Calendar", ".calendar.json"),
23469
23526
  t("list", "List", ".list.json"),
23527
+ t("skills", "Skills index", ".skills.json"),
23470
23528
  t("data-table", "Data table", ".table.json"),
23471
23529
  t("spreadsheet", "Spreadsheet", ".sheet.json"),
23472
23530
  t("experiment", "Experimental tracker", ".experiment.json"),
@@ -23528,7 +23586,7 @@ var publicActionSubmitResultSchema = external_exports.unknown();
23528
23586
 
23529
23587
  // ../../packages/core/src/widgetRuntime.ts
23530
23588
  var widgetRuntimeOutputPathSchema = storePathSchema.refine(
23531
- (path22) => path22 !== "/",
23589
+ (path25) => path25 !== "/",
23532
23590
  {
23533
23591
  message: "Path must not be the root directory."
23534
23592
  }
@@ -23578,7 +23636,7 @@ var widgetRuntimeCompleteAttachmentUploadInputSchema = storeRefSchema.safeExtend
23578
23636
  treeVisibility: external_exports.enum(["visible", "hidden"]).optional(),
23579
23637
  uploadIntentId: external_exports.string().trim().min(1)
23580
23638
  });
23581
- 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("//"), {
23582
23640
  message: "Link path must be a relative application path."
23583
23641
  });
23584
23642
  var widgetRuntimeCreateSigningLinkInputSchema = storeRefSchema.safeExtend({
@@ -23631,8 +23689,8 @@ var storeMemberSchema = external_exports.object({
23631
23689
 
23632
23690
  // ../../packages/store-tree/src/patterns.ts
23633
23691
  var escapeRegex2 = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
23634
- var basename2 = (path22) => {
23635
- const segments2 = path22.split("/").filter(Boolean);
23692
+ var basename2 = (path25) => {
23693
+ const segments2 = path25.split("/").filter(Boolean);
23636
23694
  return segments2[segments2.length - 1] ?? "";
23637
23695
  };
23638
23696
  var normalizeStorePathPattern = (pattern) => pattern.trim();
@@ -23650,7 +23708,7 @@ var storePathPatternToRegex = (pattern) => {
23650
23708
  return new RegExp(source, "i");
23651
23709
  };
23652
23710
  var doesStorePathPatternMatch = ({
23653
- path: path22,
23711
+ path: path25,
23654
23712
  pattern,
23655
23713
  mode = "path"
23656
23714
  }) => {
@@ -23658,7 +23716,7 @@ var doesStorePathPatternMatch = ({
23658
23716
  if (!normalizedPattern) {
23659
23717
  return true;
23660
23718
  }
23661
- const normalizedPath = normalizeStorePath(path22);
23719
+ const normalizedPath = normalizeStorePath(path25);
23662
23720
  const target = mode === "basename" ? basename2(normalizedPath) : normalizedPath;
23663
23721
  if (patternHasWildcard(normalizedPattern)) {
23664
23722
  return storePathPatternToRegex(normalizedPattern).test(target);
@@ -23746,8 +23804,8 @@ var isIssueRecord = (value) => {
23746
23804
  return isRecord2(value) && typeof value.message === "string";
23747
23805
  };
23748
23806
  var formatIssue = (issue2) => {
23749
- const path22 = Array.isArray(issue2.path) && issue2.path.length > 0 ? issue2.path.map(String).join(".") : "";
23750
- 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;
23751
23809
  };
23752
23810
  var formatIssueArray = (issues) => {
23753
23811
  if (!issues.every(isIssueRecord)) {
@@ -24220,7 +24278,7 @@ var buildContentChangedConflictExplainer = (issues) => {
24220
24278
  body: [
24221
24279
  pathSubject(
24222
24280
  paths,
24223
- (path22) => `${path22} changed both locally and remotely.`,
24281
+ (path25) => `${path25} changed both locally and remotely.`,
24224
24282
  (count) => `${count} files changed both locally and remotely.`
24225
24283
  ),
24226
24284
  "Forum left these files alone because either overwrite direction could lose work."
@@ -24252,7 +24310,7 @@ var buildLocalDeleteRemoteChangeExplainer = (issues) => {
24252
24310
  body: [
24253
24311
  pathSubject(
24254
24312
  paths,
24255
- (path22) => `${path22} was deleted locally, but the remote file changed.`,
24313
+ (path25) => `${path25} was deleted locally, but the remote file changed.`,
24256
24314
  (count) => `${count} files were deleted locally, but changed remotely.`
24257
24315
  ),
24258
24316
  "Forum did not delete newer remote work automatically."
@@ -24284,7 +24342,7 @@ var buildMoveDestinationConflictExplainer = (issues) => {
24284
24342
  body: [
24285
24343
  pathSubject(
24286
24344
  paths,
24287
- (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.`,
24288
24346
  (count) => `${count} paths are remote move destinations that already exist locally.`
24289
24347
  ),
24290
24348
  "Forum synced unrelated files but left these paths alone."
@@ -24319,7 +24377,7 @@ var buildMoveRemoteChangeConflictExplainer = (issues) => {
24319
24377
  body: [
24320
24378
  pathSubject(
24321
24379
  paths,
24322
- (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.`,
24323
24381
  (count) => `${count} files were involved in moves while the other side changed them.`
24324
24382
  ),
24325
24383
  "Forum did not combine the move and content change automatically."
@@ -24351,7 +24409,7 @@ var buildMoveMoveConflictExplainer = (issues) => {
24351
24409
  body: [
24352
24410
  pathSubject(
24353
24411
  paths,
24354
- (path22) => `${path22} moved locally and remotely to different paths.`,
24412
+ (path25) => `${path25} moved locally and remotely to different paths.`,
24355
24413
  (count) => `${count} files moved locally and remotely to different paths.`
24356
24414
  ),
24357
24415
  "Forum left these moves unresolved because choosing a path automatically could hide work."
@@ -24383,7 +24441,7 @@ var buildDeleteMoveConflictExplainer = (issues) => {
24383
24441
  body: [
24384
24442
  pathSubject(
24385
24443
  paths,
24386
- (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.`,
24387
24445
  (count) => `${count} files were deleted on one side and moved on the other.`
24388
24446
  ),
24389
24447
  "Forum did not choose between delete and move automatically."
@@ -24415,7 +24473,7 @@ var buildReferenceLocalFileConflictExplainer = (issues) => {
24415
24473
  body: [
24416
24474
  pathSubject(
24417
24475
  paths,
24418
- (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.`,
24419
24477
  (count) => `${count} paths are now remote references, but local files have changes.`
24420
24478
  ),
24421
24479
  "Forum left the local files alone because replacing them would discard local work."
@@ -24447,7 +24505,7 @@ var buildUnsupportedLocalEntryExplainer = (issues) => {
24447
24505
  body: [
24448
24506
  pathSubject(
24449
24507
  paths,
24450
- (path22) => `${path22} is an unsupported local filesystem entry.`,
24508
+ (path25) => `${path25} is an unsupported local filesystem entry.`,
24451
24509
  (count) => `${count} local filesystem entries are unsupported.`
24452
24510
  ),
24453
24511
  "Forum skipped these paths and continued with unrelated files where it could."
@@ -24479,7 +24537,7 @@ var buildReadOnlyLocalChangeExplainer = (issues) => {
24479
24537
  body: [
24480
24538
  pathSubject(
24481
24539
  paths,
24482
- (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.`,
24483
24541
  (count) => `${count} files have local changes, but their sync rules are read-only.`
24484
24542
  ),
24485
24543
  "Forum left these files alone so remote updates cannot overwrite local work."
@@ -24576,7 +24634,7 @@ var checkoutConflictIssuesFromResult = (result) => checkoutIssuesFromResult(resu
24576
24634
  (issue2) => issue2.type === "conflict"
24577
24635
  );
24578
24636
  var formatCheckoutExplainer = (explainer) => {
24579
- 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}`)];
24580
24638
  const actionLines = explainer.actions.map(
24581
24639
  (action) => `${styleText.bold(`${action.label}:`)} ${action.text}`
24582
24640
  );
@@ -24766,19 +24824,19 @@ import { TextDecoder as TextDecoder2 } from "util";
24766
24824
  import ignore2 from "ignore";
24767
24825
 
24768
24826
  // src/buildCheckoutFileManifestEntry.ts
24769
- var toManifestRemotePath = (path22) => path22.startsWith("/") ? path22 : `/${path22}`;
24827
+ var toManifestRemotePath = (path25) => path25.startsWith("/") ? path25 : `/${path25}`;
24770
24828
  var buildCheckoutFileManifestEntry = ({
24771
24829
  storageClass,
24772
24830
  hash: hash2,
24773
24831
  manifestEntry,
24774
- path: path22,
24832
+ path: path25,
24775
24833
  remoteFile,
24776
24834
  source,
24777
24835
  syncedAt
24778
24836
  }) => {
24779
24837
  const remoteFileId = remoteFile.id ?? remoteFile._id ?? manifestEntry?.remoteFileId;
24780
24838
  if (!remoteFileId) {
24781
- 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`);
24782
24840
  }
24783
24841
  return {
24784
24842
  storageClass,
@@ -24786,7 +24844,7 @@ var buildCheckoutFileManifestEntry = ({
24786
24844
  isExecutable: storageClass === "text" ? remoteFile.isExecutable === true || void 0 : void 0,
24787
24845
  lastSyncedAt: syncedAt,
24788
24846
  remoteFileId,
24789
- remotePath: remoteFile.path ?? manifestEntry?.remotePath ?? toManifestRemotePath(path22),
24847
+ remotePath: remoteFile.path ?? manifestEntry?.remotePath ?? toManifestRemotePath(path25),
24790
24848
  remoteUpdatedAt: remoteFile.updatedAt ?? null,
24791
24849
  remoteRevisionNumber: remoteFile.revisionNumber ?? null,
24792
24850
  ...source ? { source } : {}
@@ -27551,16 +27609,16 @@ var updateFileManifestEntry = ({
27551
27609
  hash: hash2,
27552
27610
  manifest,
27553
27611
  manifestEntry,
27554
- path: path22,
27612
+ path: path25,
27555
27613
  remoteFile,
27556
27614
  source,
27557
27615
  syncedAt
27558
27616
  }) => {
27559
- manifest.files[path22] = buildCheckoutFileManifestEntry({
27617
+ manifest.files[path25] = buildCheckoutFileManifestEntry({
27560
27618
  storageClass,
27561
27619
  hash: hash2,
27562
27620
  manifestEntry,
27563
- path: path22,
27621
+ path: path25,
27564
27622
  remoteFile,
27565
27623
  source,
27566
27624
  syncedAt
@@ -29041,7 +29099,7 @@ var remoteFileHash = async ({
29041
29099
  client,
29042
29100
  remoteFile,
29043
29101
  storeRef,
29044
- path: path22
29102
+ path: path25
29045
29103
  }) => {
29046
29104
  const textHash = remoteTextHash(remoteFile);
29047
29105
  if (textHash) {
@@ -29052,7 +29110,7 @@ var remoteFileHash = async ({
29052
29110
  }
29053
29111
  const { downloadUrl } = await client.createFileDownloadUrlByRef({
29054
29112
  ...storeRef,
29055
- path: path22
29113
+ path: path25
29056
29114
  });
29057
29115
  const response = await fetch(downloadUrl);
29058
29116
  if (!response.ok) {
@@ -30479,9 +30537,9 @@ var createHumanWatchSubscriber = ({
30479
30537
  return;
30480
30538
  }
30481
30539
  case "sync.watch.conflict.raised": {
30482
- const path22 = String(details.path ?? "");
30540
+ const path25 = String(details.path ?? "");
30483
30541
  const suggestions = details.suggestions ?? [];
30484
- error51(`Conflict: ${path22} \u2014 ${event.message ?? "needs attention"}`);
30542
+ error51(`Conflict: ${path25} \u2014 ${event.message ?? "needs attention"}`);
30485
30543
  if (suggestions.length > 0) {
30486
30544
  error51(` ${formatSuggestions(suggestions)}`);
30487
30545
  }
@@ -30510,10 +30568,10 @@ import notifier from "node-notifier";
30510
30568
  var createNotifyWatchSubscriber = () => {
30511
30569
  return (event) => {
30512
30570
  if (event.eventType === "sync.watch.conflict.raised") {
30513
- const path22 = event.details?.path;
30571
+ const path25 = event.details?.path;
30514
30572
  notifier.notify({
30515
30573
  title: "Forum sync conflict",
30516
- 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"
30517
30575
  });
30518
30576
  return;
30519
30577
  }
@@ -30629,10 +30687,10 @@ var createConflictTracker = () => {
30629
30687
  );
30630
30688
  const raised = current.filter((conflict) => !active.has(conflict.path));
30631
30689
  const cleared = [...active.keys()].filter(
30632
- (path22) => !currentByPath.has(path22)
30690
+ (path25) => !currentByPath.has(path25)
30633
30691
  );
30634
- for (const path22 of cleared) {
30635
- active.delete(path22);
30692
+ for (const path25 of cleared) {
30693
+ active.delete(path25);
30636
30694
  }
30637
30695
  for (const conflict of current) {
30638
30696
  active.set(conflict.path, conflict);
@@ -30643,13 +30701,13 @@ var createConflictTracker = () => {
30643
30701
  };
30644
30702
 
30645
30703
  // src/watch/conflictResolutionHints.ts
30646
- var keepLocal = (path22) => ({
30704
+ var keepLocal = (path25) => ({
30647
30705
  label: "Keep local",
30648
- command: `fm push --force ${path22}`
30706
+ command: `fm push --force ${path25}`
30649
30707
  });
30650
- var acceptRemote = (path22) => ({
30708
+ var acceptRemote = (path25) => ({
30651
30709
  label: "Accept remote",
30652
- command: `fm pull --force ${path22}`
30710
+ command: `fm pull --force ${path25}`
30653
30711
  });
30654
30712
  var review = (label, command) => ({
30655
30713
  label,
@@ -30665,23 +30723,23 @@ var forceResolvableTypes = /* @__PURE__ */ new Set([
30665
30723
  "reference-local-file",
30666
30724
  "read-only-local-change"
30667
30725
  ]);
30668
- var conflictResolutionSuggestions = (conflictType, path22) => {
30726
+ var conflictResolutionSuggestions = (conflictType, path25) => {
30669
30727
  if (forceResolvableTypes.has(conflictType)) {
30670
- return [keepLocal(path22), acceptRemote(path22)];
30728
+ return [keepLocal(path25), acceptRemote(path25)];
30671
30729
  }
30672
- return [review("Review", `fm status ${path22}`)];
30730
+ return [review("Review", `fm status ${path25}`)];
30673
30731
  };
30674
30732
 
30675
30733
  // src/watch/extractWatchConflicts.ts
30676
30734
  var toWatchConflict = (issue2) => {
30677
- const { path: path22, message, relatedPaths } = issue2.details.details;
30735
+ const { path: path25, message, relatedPaths } = issue2.details.details;
30678
30736
  const conflictType = issue2.details.type;
30679
30737
  return {
30680
- path: path22,
30738
+ path: path25,
30681
30739
  conflictType,
30682
30740
  message,
30683
30741
  relatedPaths: relatedPaths ?? [],
30684
- suggestions: conflictResolutionSuggestions(conflictType, path22)
30742
+ suggestions: conflictResolutionSuggestions(conflictType, path25)
30685
30743
  };
30686
30744
  };
30687
30745
  var extractWatchConflicts = (result) => {
@@ -30772,9 +30830,9 @@ var createCheckoutWatcher = ({
30772
30830
  })
30773
30831
  );
30774
30832
  }
30775
- for (const path22 of cleared) {
30833
+ for (const path25 of cleared) {
30776
30834
  bus.emit(
30777
- watchEvent("sync.watch.conflict.cleared", void 0, { path: path22 })
30835
+ watchEvent("sync.watch.conflict.cleared", void 0, { path: path25 })
30778
30836
  );
30779
30837
  }
30780
30838
  bus.emit(
@@ -31345,7 +31403,6 @@ var retrySafeOperations = /* @__PURE__ */ new Set([
31345
31403
  "stores.list",
31346
31404
  "stores.readByRef",
31347
31405
  "userPreferences.read",
31348
- "skills.getBuiltInSkill",
31349
31406
  "files.listDirectory",
31350
31407
  "files.listDirectoryByRef",
31351
31408
  "files.listTreeByRef",
@@ -31354,6 +31411,8 @@ var retrySafeOperations = /* @__PURE__ */ new Set([
31354
31411
  "files.search",
31355
31412
  "files.readFile",
31356
31413
  "files.readFileByRef",
31414
+ "skills.readIndex",
31415
+ "skills.read",
31357
31416
  "files.listFileVersions",
31358
31417
  "files.listFileVersionsByRef",
31359
31418
  "files.listFileVersionsById",
@@ -31460,11 +31519,9 @@ var createStoreClient = ({
31460
31519
  "files.deleteFileByRef",
31461
31520
  () => trpc.files.deleteFileByRef.mutate(input)
31462
31521
  ),
31522
+ readSkillIndex: (input) => call("skills.readIndex", () => trpc.skills.readIndex.query(input)),
31523
+ readSkill: (input) => call("skills.read", () => trpc.skills.read.query(input)),
31463
31524
  readUserPreferences: () => call("userPreferences.read", () => trpc.userPreferences.read.query({})),
31464
- getBuiltInSkill: (input) => call(
31465
- "skills.getBuiltInSkill",
31466
- () => trpc.skills.getBuiltInSkill.query(input)
31467
- ),
31468
31525
  upsertUserPreferences: (input) => call(
31469
31526
  "userPreferences.upsert",
31470
31527
  () => trpc.userPreferences.upsert.mutate(input)
@@ -31635,54 +31692,17 @@ var writeConfig = async (stateDir, config2) => {
31635
31692
  await writeJsonAtomic(configPath(stateDir), config2);
31636
31693
  };
31637
31694
 
31638
- // src/skillIntegration.ts
31639
- import { constants } from "fs";
31640
- import { access as access2 } from "fs/promises";
31695
+ // src/expandHomePath.ts
31641
31696
  import os from "os";
31642
- import path19 from "path";
31643
- import Enquirer from "enquirer";
31644
-
31645
- // src/skillProviders/claude.ts
31646
31697
  import path17 from "path";
31647
- var claudeSkillProvider = {
31648
- id: "claude",
31649
- globalRootCandidates: (home) => [path17.join(home, ".claude", "skills")],
31650
- localRoot: (projectDir) => path17.join(projectDir, ".claude", "skills")
31651
- };
31652
-
31653
- // src/skillProviders/codex.ts
31654
- import path18 from "path";
31655
- var codexSkillProvider = {
31656
- id: "codex",
31657
- globalRootCandidates: (home) => [
31658
- path18.join(home, ".codex", "skills"),
31659
- path18.join(home, ".agents", "skills")
31660
- ],
31661
- localRoot: (projectDir) => path18.join(projectDir, ".codex", "skills")
31662
- };
31663
-
31664
- // src/skillProviders/registry.ts
31665
- var skillProviderRegistry = [
31666
- codexSkillProvider,
31667
- claudeSkillProvider
31668
- ];
31669
- var supportedSkillAgents = skillProviderRegistry.map(
31670
- (provider) => provider.id
31671
- );
31672
- var skillProviderByAgent = Object.fromEntries(
31673
- skillProviderRegistry.map((provider) => [provider.id, provider])
31674
- );
31675
-
31676
- // src/skillIntegration.ts
31677
31698
  var expandHomePath = (input) => {
31678
- if (input === "~") {
31679
- return process.env.HOME || os.homedir();
31680
- }
31681
- if (input.startsWith("~/")) {
31682
- return path19.join(process.env.HOME || os.homedir(), input.slice(2));
31683
- }
31684
- 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;
31685
31702
  };
31703
+
31704
+ // src/pathExists.ts
31705
+ import { access as access2 } from "fs/promises";
31686
31706
  var pathExists3 = async (filePath) => {
31687
31707
  try {
31688
31708
  await access2(filePath);
@@ -31691,43 +31711,401 @@ var pathExists3 = async (filePath) => {
31691
31711
  return false;
31692
31712
  }
31693
31713
  };
31694
- var chooseExistingPath = async (candidates) => {
31695
- for (const candidate of candidates) {
31696
- if (await pathExists3(candidate)) {
31697
- 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
+ });
31698
31868
  }
31699
31869
  }
31700
- return candidates[0] ?? "";
31870
+ return changes;
31701
31871
  };
31702
- var getSkillRoot = async (agent, scope, projectDir) => {
31703
- const provider = skillProviderByAgent[agent];
31704
- if (scope === "local") {
31705
- 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 });
31706
31928
  }
31707
- const home = process.env.HOME || os.homedir();
31708
- return chooseExistingPath(provider.globalRootCandidates(home));
31709
31929
  };
31710
- var selectSkillAgents = async () => {
31711
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
31712
- throw new Error(
31713
- "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.`
31714
32039
  );
31715
32040
  }
31716
- const answers = await Enquirer.prompt({
31717
- type: "select",
31718
- name: "selectedAgent",
31719
- message: "Install skill for",
31720
- choices: [
31721
- { name: "all", message: "all" },
31722
- { name: "codex", message: "codex" },
31723
- { name: "claude", message: "claude" }
31724
- ],
31725
- 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
31726
32054
  });
31727
- if (answers.selectedAgent === "all") {
31728
- 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;
31729
32108
  }
31730
- return [answers.selectedAgent];
31731
32109
  };
31732
32110
 
31733
32111
  // src/fileSchemas.ts
@@ -32196,15 +32574,15 @@ var editEncryptedText = async ({
32196
32574
 
32197
32575
  // src/openInEditor.ts
32198
32576
  import { spawn } from "child_process";
32199
- 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";
32200
32578
  import { tmpdir } from "os";
32201
- import path20 from "path";
32579
+ import path23 from "path";
32202
32580
  var openInEditor = async (currentText, { extension = "" } = {}) => {
32203
32581
  const editor = process.env.EDITOR?.trim() || "vi";
32204
- const dir = await mkdtemp(path20.join(tmpdir(), "fm-edit-"));
32205
- 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}`);
32206
32584
  try {
32207
- await writeFile5(tempPath, currentText, "utf8");
32585
+ await writeFile6(tempPath, currentText, "utf8");
32208
32586
  const exitCode = await new Promise((resolve, reject) => {
32209
32587
  const child = spawn(
32210
32588
  "/bin/sh",
@@ -32217,9 +32595,9 @@ var openInEditor = async (currentText, { extension = "" } = {}) => {
32217
32595
  if (exitCode !== 0) {
32218
32596
  return null;
32219
32597
  }
32220
- return await readFile7(tempPath, "utf8");
32598
+ return await readFile9(tempPath, "utf8");
32221
32599
  } finally {
32222
- await rm4(dir, { force: true, recursive: true }).catch(() => {
32600
+ await rm5(dir, { force: true, recursive: true }).catch(() => {
32223
32601
  });
32224
32602
  }
32225
32603
  };
@@ -32306,7 +32684,7 @@ var standaloneIncludeId = (paragraph) => {
32306
32684
  var textContent = (file2) => file2?.content && "text" in file2.content ? file2.content.text : null;
32307
32685
  var compileMarkdown = async ({
32308
32686
  entry,
32309
- readFile: readFile9,
32687
+ readFile: readFile11,
32310
32688
  optional: optional2,
32311
32689
  limits = {}
32312
32690
  }) => {
@@ -32350,7 +32728,7 @@ var compileMarkdown = async ({
32350
32728
  throw new Error(`Include cycle: ${[...chain, id].join(" -> ")}`);
32351
32729
  let target;
32352
32730
  try {
32353
- target = await readFile9(id);
32731
+ target = await readFile11(id);
32354
32732
  } catch (error51) {
32355
32733
  if (optional2) {
32356
32734
  warnings.push(`Omitted unreadable include ${id} from ${label}.`);
@@ -32457,9 +32835,8 @@ Usage:
32457
32835
  fm delete <filePath> [--store <storeId>] [--token <jwt>]
32458
32836
  fm rm <filePath> [--store <storeId>] [--token <jwt>]
32459
32837
  fm write <filename-or-path> (<text>|--file|-f <localPath>) [-s <storeIds>] [--token <jwt>] [--force]
32460
- fm skill install [--provider <all|codex|claude>] [--global] [--yes] [--dry-run|-d]
32461
- fm skill add <storeId> <path> [--provider <all|codex|claude>] [--global] [--yes] [--dry-run|-d]
32462
- fm skill add --store <storeId> <path> [--provider <all|codex|claude>] [--global] [--yes] [--dry-run|-d]
32838
+
32839
+ fm skills --help
32463
32840
 
32464
32841
  Local checkout commands:
32465
32842
  fm clone <storeId> [localPath] [--token <jwt>] [--readonly] [--verbose]
@@ -32519,7 +32896,7 @@ Output:
32519
32896
  `;
32520
32897
  var readCliVersion = async () => {
32521
32898
  const packageJson = JSON.parse(
32522
- await readFile8(new URL("../package.json", import.meta.url), "utf8")
32899
+ await readFile10(new URL("../package.json", import.meta.url), "utf8")
32523
32900
  );
32524
32901
  return typeof packageJson.version === "string" ? packageJson.version : "unknown";
32525
32902
  };
@@ -32535,9 +32912,6 @@ var parseArgvCommandName = (argv) => {
32535
32912
  "--path",
32536
32913
  "--ref",
32537
32914
  "--target",
32538
- "--agent",
32539
- "--provider",
32540
- "--target-dir",
32541
32915
  "--state-dir",
32542
32916
  "--interval-ms",
32543
32917
  "--paths-file"
@@ -32573,9 +32947,6 @@ var parseArgs = (argv) => {
32573
32947
  let encryptionPassword = null;
32574
32948
  let recipientSecret = null;
32575
32949
  let recipientName = null;
32576
- const skillAgents = [];
32577
- let skillGlobal = false;
32578
- let skillTargetDir = null;
32579
32950
  let syncPath = null;
32580
32951
  let syncTarget = null;
32581
32952
  let pathsFile = null;
@@ -32639,13 +33010,13 @@ var parseArgs = (argv) => {
32639
33010
  continue;
32640
33011
  }
32641
33012
  if (current === "--file" || current === "-f") {
32642
- inputFilePath = next ? path21.resolve(next) : inputFilePath;
33013
+ inputFilePath = next ? path24.resolve(next) : inputFilePath;
32643
33014
  index += 1;
32644
33015
  continue;
32645
33016
  }
32646
33017
  if (current === "--output" || current === "-o") {
32647
33018
  if (!next) throw new Error(`${current} requires a local output path.`);
32648
- outputFilePath = path21.resolve(next);
33019
+ outputFilePath = path24.resolve(next);
32649
33020
  index += 1;
32650
33021
  continue;
32651
33022
  }
@@ -32698,31 +33069,11 @@ var parseArgs = (argv) => {
32698
33069
  index += 1;
32699
33070
  continue;
32700
33071
  }
32701
- if (current === "--agent" || current === "--provider") {
32702
- if (!next) {
32703
- throw new Error(`${current} requires a provider name.`);
32704
- }
32705
- skillAgents.push(next);
32706
- index += 1;
32707
- continue;
32708
- }
32709
- if (current === "--target-dir") {
32710
- if (!next) {
32711
- throw new Error("--target-dir requires a path.");
32712
- }
32713
- skillTargetDir = path21.resolve(expandHomePath(next));
32714
- index += 1;
32715
- continue;
32716
- }
32717
- if (current === "--global") {
32718
- skillGlobal = true;
32719
- continue;
32720
- }
32721
33072
  if (current === "--update") {
32722
33073
  continue;
32723
33074
  }
32724
33075
  if (current === "--state-dir") {
32725
- stateDir = path21.resolve(next ?? stateDir);
33076
+ stateDir = path24.resolve(next ?? stateDir);
32726
33077
  index += 1;
32727
33078
  continue;
32728
33079
  }
@@ -32730,12 +33081,12 @@ var parseArgs = (argv) => {
32730
33081
  if (!next) {
32731
33082
  throw new Error("--paths-file requires a file path.");
32732
33083
  }
32733
- pathsFile = path21.resolve(expandHomePath(next));
33084
+ pathsFile = path24.resolve(expandHomePath(next));
32734
33085
  index += 1;
32735
33086
  continue;
32736
33087
  }
32737
33088
  if (current.startsWith("--paths-file=")) {
32738
- pathsFile = path21.resolve(
33089
+ pathsFile = path24.resolve(
32739
33090
  expandHomePath(current.slice("--paths-file=".length))
32740
33091
  );
32741
33092
  continue;
@@ -32830,9 +33181,6 @@ var parseArgs = (argv) => {
32830
33181
  encryptionPassword,
32831
33182
  recipientSecret,
32832
33183
  recipientName,
32833
- skillAgents,
32834
- skillGlobal,
32835
- skillTargetDir,
32836
33184
  syncPath,
32837
33185
  syncTarget,
32838
33186
  pathsFile,
@@ -32856,9 +33204,6 @@ var parseArgs = (argv) => {
32856
33204
  };
32857
33205
  };
32858
33206
  var describeCommand = (commandName, rest) => {
32859
- if (commandName === "skill" && rest[0]) {
32860
- return `skill ${rest[0]}`;
32861
- }
32862
33207
  if (commandName === "sync" && rest[0] === "reset") {
32863
33208
  return "sync reset";
32864
33209
  }
@@ -32871,27 +33216,7 @@ var supportsDryRun = (commandName, rest) => {
32871
33216
  if (commandName === "sync") {
32872
33217
  return rest[0] !== "reset";
32873
33218
  }
32874
- return commandName === "skill" && (rest[0] === "add" || rest[0] === "install") || commandName === "encryption" && rest[0] === "migrate";
32875
- };
32876
- var resolveSkillAddInputs = (rest, storeFilters) => {
32877
- if (storeFilters.length === 0) {
32878
- return {
32879
- skillPathInput: rest[2],
32880
- storeInput: rest[1]
32881
- };
32882
- }
32883
- if (storeFilters.length > 1) {
32884
- throw new Error("skill add accepts exactly one --store value.");
32885
- }
32886
- if (rest[2]) {
32887
- throw new Error(
32888
- `Usage: ${commandNames} skill add --store <storeId> <path> [--provider <all|codex|claude>] [--global]`
32889
- );
32890
- }
32891
- return {
32892
- skillPathInput: rest[1],
32893
- storeInput: storeFilters[0]
32894
- };
33219
+ return commandName === "encryption" && rest[0] === "migrate";
32895
33220
  };
32896
33221
  var assertDryRunSupported = (parsed, command, rest) => {
32897
33222
  if (!parsed.dryRun || supportsDryRun(command, rest)) {
@@ -32945,10 +33270,10 @@ var listDirectoryEntries = async (listDirectory, directoryPath) => {
32945
33270
  if (left.type !== "directory" && right.type === "directory") {
32946
33271
  return 1;
32947
33272
  }
32948
- return path21.basename(left.path).localeCompare(path21.basename(right.path));
33273
+ return path24.basename(left.path).localeCompare(path24.basename(right.path));
32949
33274
  }).forEach((entry) => {
32950
33275
  const suffix = entry.type === "directory" ? "/" : "";
32951
- renderOutput(`${path21.basename(entry.path)}${suffix}`);
33276
+ renderOutput(`${path24.basename(entry.path)}${suffix}`);
32952
33277
  });
32953
33278
  };
32954
33279
  var listStores = async (listStoresMetadata) => {
@@ -33226,198 +33551,6 @@ Could not verify whether ${input.path} was deleted after the transient archive f
33226
33551
  throw new Error(`File not found: ${input.path}`);
33227
33552
  }
33228
33553
  };
33229
- var skillNamePattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
33230
- var normalizeSkillAgent = (input) => {
33231
- const normalized = input.trim().toLowerCase();
33232
- if (normalized === "codex" || normalized === "claude") {
33233
- return normalized;
33234
- }
33235
- throw new Error(
33236
- `Unsupported skill agent: ${input}. Supported agents: ${supportedSkillAgents.join(", ")}`
33237
- );
33238
- };
33239
- var normalizeSkillAgents = (inputs) => {
33240
- if (inputs.some((input) => input.trim().toLowerCase() === "all")) {
33241
- return supportedSkillAgents;
33242
- }
33243
- return [...new Set(inputs.map(normalizeSkillAgent))];
33244
- };
33245
- var normalizeRemoteSkillPath = (input) => {
33246
- const normalized = path21.posix.normalize(`/${input.trim()}`);
33247
- if (normalized === "/") {
33248
- throw new Error("Skill path must not be the store root.");
33249
- }
33250
- if (normalized.includes("\0")) {
33251
- throw new Error("Skill path contains an invalid null byte.");
33252
- }
33253
- return normalized;
33254
- };
33255
- var parentRemotePath = (filePath) => {
33256
- const parent = path21.posix.dirname(filePath);
33257
- return parent === "." ? "/" : parent;
33258
- };
33259
- var joinRemotePath = (left, right) => {
33260
- return path21.posix.join(left, right).replace(/\/+/g, "/");
33261
- };
33262
- var readRemoteSkillTextFile = async (filePath, storeRef, client) => {
33263
- const file2 = await client.readFileByRef({ ...storeRef, path: filePath });
33264
- if (!file2) {
33265
- throw new Error(`File not found: ${filePath}`);
33266
- }
33267
- const text = getTextContent(file2.content);
33268
- if (text === null) {
33269
- throw new Error(`File is binary and cannot be read as text: ${filePath}`);
33270
- }
33271
- return text;
33272
- };
33273
- var readRemoteSkillFileBytes = async (filePath, storeRef, client) => {
33274
- const file2 = await client.readFileByRef({ ...storeRef, path: filePath });
33275
- if (!file2) {
33276
- throw new Error(`File not found: ${filePath}`);
33277
- }
33278
- const text = getTextContent(file2.content);
33279
- if (text !== null) {
33280
- return new TextEncoder().encode(text);
33281
- }
33282
- const downloadUrl = await createRemoteFileDownloadUrl(
33283
- filePath,
33284
- storeRef,
33285
- client
33286
- );
33287
- const response = await fetch(downloadUrl);
33288
- if (!response.ok) {
33289
- throw new Error(
33290
- `Failed to download ${filePath}: ${response.status} ${response.statusText}`
33291
- );
33292
- }
33293
- return new Uint8Array(await response.arrayBuffer());
33294
- };
33295
- var collectRemoteSkillFiles = async ({
33296
- client,
33297
- directoryPath,
33298
- files,
33299
- rootPath,
33300
- storeRef
33301
- }) => {
33302
- const listing = await client.listDirectoryByRef({
33303
- ...storeRef,
33304
- directoryPath
33305
- });
33306
- for (const entry of listing.entries) {
33307
- if (entry.type === "directory") {
33308
- await collectRemoteSkillFiles({
33309
- client,
33310
- directoryPath: entry.path,
33311
- files,
33312
- rootPath,
33313
- storeRef
33314
- });
33315
- continue;
33316
- }
33317
- if (entry.type !== "text") {
33318
- throw new Error(
33319
- `Skill contains unsupported ${entry.type} entry: ${entry.path}`
33320
- );
33321
- }
33322
- const relativePath = path21.posix.relative(rootPath, entry.path);
33323
- if (!relativePath || relativePath.startsWith("..")) {
33324
- throw new Error(
33325
- `Unexpected skill entry outside skill root: ${entry.path}`
33326
- );
33327
- }
33328
- files.push({
33329
- bytes: await readRemoteSkillFileBytes(entry.path, storeRef, client),
33330
- relativePath
33331
- });
33332
- }
33333
- };
33334
- var resolveRemoteSkillRoot = async (inputPath, storeRef, client) => {
33335
- const normalizedPath = normalizeRemoteSkillPath(inputPath);
33336
- if (path21.posix.basename(normalizedPath) === "SKILL.md") {
33337
- await readRemoteSkillTextFile(normalizedPath, storeRef, client);
33338
- return {
33339
- rootPath: parentRemotePath(normalizedPath),
33340
- skillMarkdownPath: normalizedPath
33341
- };
33342
- }
33343
- const skillMarkdownPath = joinRemotePath(normalizedPath, "SKILL.md");
33344
- await readRemoteSkillTextFile(skillMarkdownPath, storeRef, client);
33345
- return {
33346
- rootPath: normalizedPath,
33347
- skillMarkdownPath
33348
- };
33349
- };
33350
- var parseSkillMetadata = (source) => {
33351
- const match = source.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
33352
- if (!match) {
33353
- throw new Error("SKILL.md must start with YAML frontmatter.");
33354
- }
33355
- const metadata = parseYaml(match[1] ?? "");
33356
- if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) {
33357
- throw new Error("SKILL.md frontmatter must be a YAML object.");
33358
- }
33359
- const name = metadata.name;
33360
- const description = metadata.description;
33361
- if (typeof name !== "string" || !name.trim()) {
33362
- throw new Error("SKILL.md frontmatter must include a non-empty name.");
33363
- }
33364
- if (typeof description !== "string" || !description.trim()) {
33365
- throw new Error(
33366
- "SKILL.md frontmatter must include a non-empty description."
33367
- );
33368
- }
33369
- const normalizedName = name.trim();
33370
- if (normalizedName.length > 64 || !skillNamePattern.test(normalizedName)) {
33371
- throw new Error(
33372
- "SKILL.md name must be 1-64 lowercase letters, numbers, and hyphens, with no leading, trailing, or repeated hyphens."
33373
- );
33374
- }
33375
- return {
33376
- description: description.trim(),
33377
- name: normalizedName
33378
- };
33379
- };
33380
- var readSkillMarkdownFromBundle = (bundle) => {
33381
- const skillMarkdown = bundle.files.find(
33382
- (file2) => file2.relativePath === "SKILL.md"
33383
- );
33384
- if (!skillMarkdown) {
33385
- throw new Error("Skill bundle is missing SKILL.md.");
33386
- }
33387
- return new TextDecoder().decode(skillMarkdown.bytes);
33388
- };
33389
- var validateSkillBundle = (bundle) => {
33390
- const metadata = parseSkillMetadata(readSkillMarkdownFromBundle(bundle));
33391
- if (metadata.name !== bundle.name) {
33392
- throw new Error(
33393
- `SKILL.md name "${metadata.name}" must match skill bundle "${bundle.name}".`
33394
- );
33395
- }
33396
- };
33397
- var resolveSkillInstallTargets = async ({
33398
- agents,
33399
- projectDir,
33400
- scope,
33401
- skillName,
33402
- targetDir
33403
- }) => {
33404
- const selectedAgents = agents.length > 0 ? normalizeSkillAgents(agents) : await selectSkillAgents();
33405
- if (targetDir && selectedAgents.length !== 1) {
33406
- throw new Error(
33407
- "--target-dir requires exactly one --provider or --agent value."
33408
- );
33409
- }
33410
- return Promise.all(
33411
- selectedAgents.map(async (agent) => {
33412
- const rootDir = targetDir ?? await getSkillRoot(agent, scope, projectDir);
33413
- return {
33414
- agent,
33415
- rootDir,
33416
- targetDir: path21.join(rootDir, skillName)
33417
- };
33418
- })
33419
- );
33420
- };
33421
33554
  var confirmYesNo = async ({
33422
33555
  assumeYes,
33423
33556
  nonInteractiveMessage,
@@ -33440,186 +33573,6 @@ var confirmYesNo = async ({
33440
33573
  readline.close();
33441
33574
  }
33442
33575
  };
33443
- var confirmSkillInstall = async (targets, assumeYes) => {
33444
- return confirmYesNo({
33445
- assumeYes,
33446
- nonInteractiveMessage: "Refusing to install or update skills without interactive confirmation. Rerun with --yes to confirm in a non-interactive shell.",
33447
- prompt: `Install or update ${targets.length} skill target${targets.length === 1 ? "" : "s"}? [y/N] `
33448
- });
33449
- };
33450
- var formatSkillTarget = (target, existingTargetDirs) => {
33451
- const suffix = existingTargetDirs.has(target.targetDir) ? " (updates existing)" : "";
33452
- return ` ${target.agent.padEnd(7)} ${target.targetDir}${suffix}`;
33453
- };
33454
- var writeSkillFiles = async (target, files, replaceExisting) => {
33455
- const temporaryDirectory = path21.join(
33456
- target.rootDir,
33457
- `.${path21.basename(target.targetDir)}.tmp-${process.pid}-${Date.now()}`
33458
- );
33459
- await rm5(temporaryDirectory, { recursive: true, force: true });
33460
- await mkdir6(temporaryDirectory, { recursive: true });
33461
- try {
33462
- for (const file2 of files) {
33463
- const localPath = path21.join(temporaryDirectory, file2.relativePath);
33464
- await mkdir6(path21.dirname(localPath), { recursive: true });
33465
- await writeFile6(localPath, file2.bytes);
33466
- }
33467
- if (replaceExisting) {
33468
- await rm5(target.targetDir, { recursive: true, force: true });
33469
- }
33470
- await rename4(temporaryDirectory, target.targetDir);
33471
- } catch (error51) {
33472
- await rm5(temporaryDirectory, { recursive: true, force: true });
33473
- throw error51;
33474
- }
33475
- };
33476
- var installSkillBundle = async ({
33477
- agents,
33478
- assumeYes,
33479
- bundle,
33480
- dryRun,
33481
- isGlobal,
33482
- targetDir
33483
- }) => {
33484
- validateSkillBundle(bundle);
33485
- const targets = await resolveSkillInstallTargets({
33486
- agents,
33487
- projectDir: process.cwd(),
33488
- scope: isGlobal ? "global" : "local",
33489
- skillName: bundle.name,
33490
- targetDir
33491
- });
33492
- const existingTargets = (await Promise.all(
33493
- targets.map(
33494
- async (target) => await pathExists3(target.targetDir) ? target : null
33495
- )
33496
- )).filter((target) => target !== null);
33497
- const existingTargetDirs = new Set(
33498
- existingTargets.map((target) => target.targetDir)
33499
- );
33500
- const action = existingTargets.length === 0 ? "Install" : existingTargets.length === targets.length ? "Update" : "Install or update";
33501
- renderOutput(
33502
- `${dryRun ? `Would ${action.toLowerCase()}` : action} skill ${bundle.name} from ${bundle.sourceLabel} into:`
33503
- );
33504
- renderOutput("");
33505
- targets.forEach(
33506
- (target) => renderOutput(formatSkillTarget(target, existingTargetDirs))
33507
- );
33508
- if (dryRun) {
33509
- return;
33510
- }
33511
- if (!await confirmSkillInstall(targets, assumeYes)) {
33512
- throw new Error("Aborted skill install.");
33513
- }
33514
- for (const target of targets) {
33515
- await mkdir6(target.rootDir, { recursive: true });
33516
- }
33517
- for (const target of targets) {
33518
- await writeSkillFiles(
33519
- target,
33520
- bundle.files,
33521
- existingTargetDirs.has(target.targetDir)
33522
- );
33523
- }
33524
- targets.forEach((target) => {
33525
- renderOutput(
33526
- `Installed ${bundle.name} for ${target.agent}: ${target.targetDir}`
33527
- );
33528
- });
33529
- };
33530
- var readRemoteSkillBundle = async ({
33531
- client,
33532
- skillPathInput,
33533
- storeInput
33534
- }) => {
33535
- const storeRef = await resolveOwnStoreRef(storeInput, client);
33536
- const { rootPath, skillMarkdownPath } = await resolveRemoteSkillRoot(
33537
- skillPathInput,
33538
- storeRef,
33539
- client
33540
- );
33541
- const skillMarkdown = await readRemoteSkillTextFile(
33542
- skillMarkdownPath,
33543
- storeRef,
33544
- client
33545
- );
33546
- const metadata = parseSkillMetadata(skillMarkdown);
33547
- const rootName = path21.posix.basename(rootPath);
33548
- if (metadata.name !== rootName) {
33549
- throw new Error(
33550
- `SKILL.md name "${metadata.name}" must match skill directory "${rootName}".`
33551
- );
33552
- }
33553
- const files = [];
33554
- await collectRemoteSkillFiles({
33555
- client,
33556
- directoryPath: rootPath,
33557
- files,
33558
- rootPath,
33559
- storeRef
33560
- });
33561
- return {
33562
- description: metadata.description,
33563
- files,
33564
- name: metadata.name,
33565
- sourceLabel: `${storeInput}:${rootPath}`
33566
- };
33567
- };
33568
- var runSkillAddCommand = async ({
33569
- client,
33570
- dryRun,
33571
- agents,
33572
- assumeYes,
33573
- isGlobal,
33574
- storeInput,
33575
- skillPathInput,
33576
- targetDir
33577
- }) => {
33578
- if (!storeInput || !skillPathInput) {
33579
- throw new Error(
33580
- `Usage: ${commandNames} skill add <storeId> <path> [--provider <all|codex|claude>] [--global]`
33581
- );
33582
- }
33583
- await installSkillBundle({
33584
- agents,
33585
- assumeYes,
33586
- bundle: await readRemoteSkillBundle({ client, skillPathInput, storeInput }),
33587
- dryRun,
33588
- isGlobal,
33589
- targetDir
33590
- });
33591
- };
33592
- var readBuiltInForumSkillBundle = async (client) => {
33593
- const bundle = await client.getBuiltInSkill({ id: "forum" });
33594
- return {
33595
- description: bundle.description,
33596
- files: bundle.files.map(
33597
- (file2) => ({
33598
- bytes: new TextEncoder().encode(file2.text),
33599
- relativePath: file2.path
33600
- })
33601
- ),
33602
- name: bundle.name,
33603
- sourceLabel: "built-in Forum skill"
33604
- };
33605
- };
33606
- var runSkillInstallCommand = async ({
33607
- agents,
33608
- assumeYes,
33609
- client,
33610
- dryRun,
33611
- isGlobal,
33612
- targetDir
33613
- }) => {
33614
- await installSkillBundle({
33615
- agents,
33616
- assumeYes,
33617
- bundle: await readBuiltInForumSkillBundle(client),
33618
- dryRun,
33619
- isGlobal,
33620
- targetDir
33621
- });
33622
- };
33623
33576
  var runFileCommand = async (subcommand, args, parsed, client) => {
33624
33577
  const storeRef = await resolveSingleStoreRef(parsed.storeFilters, client);
33625
33578
  if (subcommand === "ls") {
@@ -33724,7 +33677,7 @@ var readWriteTextInput = async (inlineText, inputFilePath) => {
33724
33677
  throw new Error("Provide either inline text or --file, not both.");
33725
33678
  }
33726
33679
  if (inputFilePath) {
33727
- return readFile8(inputFilePath, "utf8");
33680
+ return readFile10(inputFilePath, "utf8");
33728
33681
  }
33729
33682
  return inlineText ?? null;
33730
33683
  };
@@ -33740,7 +33693,7 @@ var readRemoteTextFile = async (filePath, storeRef, client) => {
33740
33693
  return text;
33741
33694
  };
33742
33695
  var normalizeRemotePath = (input) => {
33743
- const normalized = path21.posix.normalize(`/${input.trim()}`);
33696
+ const normalized = path24.posix.normalize(`/${input.trim()}`);
33744
33697
  if (normalized.includes("\0")) {
33745
33698
  throw new Error("Path contains an invalid null byte.");
33746
33699
  }
@@ -34034,7 +33987,7 @@ var diffRemoteFiles = async ({
34034
33987
  storeRef
34035
33988
  }) => {
34036
33989
  const leftText = await readRemoteTextFile(leftPath, storeRef, client);
34037
- 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);
34038
33991
  return buildUnifiedDiff({
34039
33992
  leftLabel: leftPath,
34040
33993
  leftText,
@@ -34101,8 +34054,8 @@ var copyRemotePath = async (args, storeRef, client) => {
34101
34054
  (entry) => entry.path.startsWith(`${normalizedSource}/`)
34102
34055
  );
34103
34056
  for (const entry of descendants) {
34104
- const relativePath = path21.posix.relative(normalizedSource, entry.path);
34105
- const targetPath = path21.posix.join(normalizedDestination, relativePath);
34057
+ const relativePath = path24.posix.relative(normalizedSource, entry.path);
34058
+ const targetPath = path24.posix.join(normalizedDestination, relativePath);
34106
34059
  if (entry.type === "directory") {
34107
34060
  await createRemoteDirectory(targetPath, storeRef, client);
34108
34061
  continue;
@@ -34297,19 +34250,19 @@ var runDecryptCommand = async (rest, parsed, client) => {
34297
34250
  );
34298
34251
  };
34299
34252
  var runEditCommand = async (rest, parsed, client) => {
34300
- const filePath = parsed.inputFilePath ?? (rest[0] ? path21.resolve(rest[0]) : null);
34253
+ const filePath = parsed.inputFilePath ?? (rest[0] ? path24.resolve(rest[0]) : null);
34301
34254
  if (!filePath) {
34302
34255
  throw new Error(
34303
34256
  `Usage: ${commandNames} edit (<localPath>|--file|-f <localPath>) [--password <password>] [--token <jwt>]`
34304
34257
  );
34305
34258
  }
34306
- const encryptedText = await readFile8(filePath, "utf8");
34259
+ const encryptedText = await readFile10(filePath, "utf8");
34307
34260
  const [password, userEncryption] = await Promise.all([
34308
34261
  readEncryptionPassword(parsed),
34309
34262
  readUserEncryption(client)
34310
34263
  ]);
34311
34264
  const result = await editEncryptedText({
34312
- edit: (currentPlaintext) => openInEditor(currentPlaintext, { extension: path21.extname(filePath) }),
34265
+ edit: (currentPlaintext) => openInEditor(currentPlaintext, { extension: path24.extname(filePath) }),
34313
34266
  encryptedText,
34314
34267
  password,
34315
34268
  userEncryption: userEncryption.userEncryption
@@ -34362,7 +34315,7 @@ var runEncryptAddRecipientCommand = async (rest, parsed, client) => {
34362
34315
  userEncryption: userEncryption.userEncryption
34363
34316
  });
34364
34317
  if (parsed.inputFilePath) {
34365
- await writeFile6(parsed.inputFilePath, result.encryptedText, "utf8");
34318
+ await writeFile7(parsed.inputFilePath, result.encryptedText, "utf8");
34366
34319
  }
34367
34320
  if (parsed.json) {
34368
34321
  renderOutput({
@@ -34385,11 +34338,11 @@ var runEncryptAddRecipientCommand = async (rest, parsed, client) => {
34385
34338
  `);
34386
34339
  renderOutput(result.encryptedText);
34387
34340
  };
34388
- var defaultEncryptionMigrationBackupPath = () => path21.resolve(process.cwd(), "doctrine-encryption-migration.json");
34389
- 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"));
34390
34343
  var writeEncryptionMigrationBackup = async (backupPath, backup) => {
34391
- await mkdir6(path21.dirname(backupPath), { recursive: true });
34392
- 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)}
34393
34346
  `, "utf8");
34394
34347
  };
34395
34348
  var confirmEncryptionMigration = async ({
@@ -34676,7 +34629,7 @@ var runEncryptionMigrateCommand = async (rest, parsed, client) => {
34676
34629
  `Usage: ${commandNames} encryption migrate [backup-file] [--store <storeId>] [--password <password>] [--dry-run] [--yes]`
34677
34630
  );
34678
34631
  }
34679
- const backupPath = path21.resolve(
34632
+ const backupPath = path24.resolve(
34680
34633
  rest[1] ?? defaultEncryptionMigrationBackupPath()
34681
34634
  );
34682
34635
  const password = await readEncryptionPassword(parsed);
@@ -34751,7 +34704,7 @@ var doesRemoteQueryMatchPath = (query, filePath) => {
34751
34704
  if (query.startsWith("/")) {
34752
34705
  return normalizedPath === query;
34753
34706
  }
34754
- const filename = path21.basename(filePath).toLowerCase();
34707
+ const filename = path24.basename(filePath).toLowerCase();
34755
34708
  return filename === query || normalizedPath === query || filename.includes(query) || normalizedPath.includes(query);
34756
34709
  };
34757
34710
  var queryRemoteFiles = async (query, storeFilters, client) => {
@@ -34823,7 +34776,7 @@ var printRemoteQueryMatches = (matches) => {
34823
34776
  });
34824
34777
  };
34825
34778
  var normalizeRemoteDirectoryPath = (input) => {
34826
- const normalized = path21.posix.normalize(`/${input.trim()}`);
34779
+ const normalized = path24.posix.normalize(`/${input.trim()}`);
34827
34780
  if (normalized.includes("\0")) {
34828
34781
  throw new Error("Path contains an invalid null byte.");
34829
34782
  }
@@ -34943,12 +34896,12 @@ var labelFromTreeDirectoryPath = (directoryPath) => {
34943
34896
  if (directoryPath === "/") {
34944
34897
  return "./";
34945
34898
  }
34946
- return `${path21.posix.basename(directoryPath)}/`;
34899
+ return `${path24.posix.basename(directoryPath)}/`;
34947
34900
  };
34948
34901
  var doesTreeFilterMatchDirectory = (filter, directoryPath) => {
34949
34902
  const normalizedFilter = filter.trim().toLowerCase();
34950
34903
  const normalizedPath = directoryPath.toLowerCase();
34951
- const basename3 = path21.posix.basename(directoryPath).toLowerCase();
34904
+ const basename3 = path24.posix.basename(directoryPath).toLowerCase();
34952
34905
  return basename3.includes(normalizedFilter) || normalizedPath.includes(normalizedFilter);
34953
34906
  };
34954
34907
  var resolveTreeDirectoryPath = async ({
@@ -35003,7 +34956,7 @@ var printRemoteTreeChildren = async ({
35003
34956
  const childPrefix = isLast ? " " : "\u2502 ";
35004
34957
  const suffix = entry.type === "directory" ? "/" : "";
35005
34958
  lines.push(
35006
- `${prefix}${connector}${path21.posix.basename(entry.path)}${suffix}`
34959
+ `${prefix}${connector}${path24.posix.basename(entry.path)}${suffix}`
35007
34960
  );
35008
34961
  if (entry.type === "directory") {
35009
34962
  await printRemoteTreeChildren({
@@ -35615,9 +35568,9 @@ var shouldPrintCheckoutDetail = (detail, verbose) => {
35615
35568
  var formatCheckoutDetail = (detail, options2) => {
35616
35569
  const status = checkoutStatusLabel(detail, options2);
35617
35570
  const direction = checkoutDirectionLabel(detail);
35618
- const path22 = formatCheckoutDetailPath(detail, options2.syncRules);
35571
+ const path25 = formatCheckoutDetailPath(detail, options2.syncRules);
35619
35572
  const reason = styleText.dim(checkoutDetailMessage(detail));
35620
- return direction ? `${direction} ${status} ${path22} ${reason}` : `${status} ${path22} ${reason}`;
35573
+ return direction ? `${direction} ${status} ${path25} ${reason}` : `${status} ${path25} ${reason}`;
35621
35574
  };
35622
35575
  var formatCheckoutDetailPath = (detail, syncRules) => {
35623
35576
  const localPath = formatLocalCheckoutPath(detail.relativePath);
@@ -35829,9 +35782,9 @@ var checkoutReportGroups = (details, options2) => {
35829
35782
  );
35830
35783
  };
35831
35784
  var checkoutReportDetailLine = (detail, options2) => {
35832
- const path22 = formatCheckoutDetailPath(detail, options2.syncRules);
35785
+ const path25 = formatCheckoutDetailPath(detail, options2.syncRules);
35833
35786
  const message = detail.status === "failed" || detail.status === "skipped" || detail.status === "ignored" ? detail.message ?? checkoutDetailMessage(detail) : "";
35834
- return message ? ` ${path22} ${styleText.dim(message)}` : ` ${path22}`;
35787
+ return message ? ` ${path25} ${styleText.dim(message)}` : ` ${path25}`;
35835
35788
  };
35836
35789
  var checkoutReportGroupBlock = ({
35837
35790
  dryRun,
@@ -35958,13 +35911,13 @@ var statusChangeKind = (detail) => {
35958
35911
  var formatStatusChange = (detail, syncRules) => {
35959
35912
  const kind = statusChangeKind(detail);
35960
35913
  const tone = kind === "deleted" ? "error" : kind === "added" ? "ok" : "warn";
35961
- const path22 = formatCheckoutDetailPath(detail, syncRules);
35962
- return ` ${styleText.color(tone, kind.padEnd(8))} ${path22}`;
35914
+ const path25 = formatCheckoutDetailPath(detail, syncRules);
35915
+ return ` ${styleText.color(tone, kind.padEnd(8))} ${path25}`;
35963
35916
  };
35964
35917
  var formatStatusBlock = (detail, syncRules) => {
35965
35918
  const message = detail.message ? ` ${styleText.dim(detail.message)}` : "";
35966
- const path22 = formatCheckoutDetailPath(detail, syncRules);
35967
- 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}`;
35968
35921
  };
35969
35922
  var actionableStatusDetails = (result) => result.details.filter(
35970
35923
  (detail) => detail.status === "succeeded" || detail.status === "deleted"
@@ -36623,15 +36576,15 @@ var runCheckoutStatus = async ({
36623
36576
  var isCheckoutStateGitPath = isCheckoutStateDirectoryPath;
36624
36577
  var checkoutFilesManifestPath2 = () => `${resolveCheckoutStateDirectoryName()}/files.json`;
36625
36578
  var isInsideOrEqual = (parentPath, childPath2) => {
36626
- const relativePath = path21.relative(parentPath, childPath2);
36627
- return relativePath === "" || !relativePath.startsWith("..") && !path21.isAbsolute(relativePath);
36579
+ const relativePath = path24.relative(parentPath, childPath2);
36580
+ return relativePath === "" || !relativePath.startsWith("..") && !path24.isAbsolute(relativePath);
36628
36581
  };
36629
36582
  var resolveSyncTargetPaths = (checkout) => checkout.syncRules.map(
36630
- (rule) => path21.resolve(checkout.rootDir, rule.target || ".")
36583
+ (rule) => path24.resolve(checkout.rootDir, rule.target || ".")
36631
36584
  );
36632
- var resolveCheckoutManifestGitPath = (checkout, gitRoot) => path21.relative(
36585
+ var resolveCheckoutManifestGitPath = (checkout, gitRoot) => path24.relative(
36633
36586
  gitRoot,
36634
- path21.join(checkout.rootDir, checkoutFilesManifestPath2())
36587
+ path24.join(checkout.rootDir, checkoutFilesManifestPath2())
36635
36588
  ) || checkoutFilesManifestPath2();
36636
36589
  var stageCheckoutManifest = async ({
36637
36590
  checkout,
@@ -36657,7 +36610,7 @@ var assertGitChangesStayInSyncTargets = async ({
36657
36610
  if (isCheckoutStateGitPath(entry.path)) {
36658
36611
  return false;
36659
36612
  }
36660
- const absolutePath = path21.resolve(gitRoot, entry.path);
36613
+ const absolutePath = path24.resolve(gitRoot, entry.path);
36661
36614
  return !allowedPaths.some(
36662
36615
  (allowedPath) => isInsideOrEqual(allowedPath, absolutePath)
36663
36616
  );
@@ -36679,7 +36632,7 @@ var stageGitSyncTargets = async ({
36679
36632
  }) => {
36680
36633
  const targetPaths = [];
36681
36634
  for (const targetPath of resolveSyncTargetPaths(checkout)) {
36682
- const relativePath = path21.relative(gitRoot, targetPath) || ".";
36635
+ const relativePath = path24.relative(gitRoot, targetPath) || ".";
36683
36636
  const tracked = await runGit(gitRoot, ["ls-files", "--", relativePath]);
36684
36637
  if (await pathExists3(targetPath) || tracked.stdout.trim()) {
36685
36638
  targetPaths.push(relativePath);
@@ -36979,7 +36932,7 @@ var writeCheckoutConfig = async (directoryPath, metadata, workspaceSlug, options
36979
36932
  );
36980
36933
  }
36981
36934
  await writeForumProjectConfig(
36982
- path21.join(directoryPath, defaultProjectConfigFilename),
36935
+ path24.join(directoryPath, defaultProjectConfigFilename),
36983
36936
  {
36984
36937
  syncRules: [
36985
36938
  {
@@ -37016,7 +36969,7 @@ var normalizeProjectConfigPath = (value, fieldName, allowCurrentDirectory = fals
37016
36969
  }
37017
36970
  throw new Error(`${fieldName} must be a non-empty relative path.`);
37018
36971
  }
37019
- if (path21.isAbsolute(value)) {
36972
+ if (path24.isAbsolute(value)) {
37020
36973
  throw new Error(`${fieldName} must be a relative path.`);
37021
36974
  }
37022
36975
  const segments2 = trimmed.split("/");
@@ -37198,7 +37151,7 @@ var defaultCloneDirectoryName = (storeId) => {
37198
37151
  var fsErrorCode = (error51) => error51 instanceof Error && "code" in error51 ? String(error51.code ?? "") : "";
37199
37152
  var ensureGitMetadataExists = async (directoryPath) => {
37200
37153
  try {
37201
- await lstat2(path21.join(directoryPath, ".git"));
37154
+ await lstat5(path24.join(directoryPath, ".git"));
37202
37155
  } catch (error51) {
37203
37156
  if (fsErrorCode(error51) === "ENOENT") {
37204
37157
  throw new Error(
@@ -37236,8 +37189,8 @@ var confirmGitMetadataDeletion = async (localPath, assumeYes) => {
37236
37189
  "Refusing to delete .git without interactive confirmation. Rerun with --yes to confirm in a non-interactive shell."
37237
37190
  );
37238
37191
  }
37239
- const gitPath = path21.join(localPath, ".git");
37240
- const gitignorePath = path21.join(localPath, ".gitignore");
37192
+ const gitPath = path24.join(localPath, ".git");
37193
+ const gitignorePath = path24.join(localPath, ".gitignore");
37241
37194
  const confirmationPhrase = "DELETE GIT";
37242
37195
  renderWarning("");
37243
37196
  renderWarning("DANGER: Forum is about to remove Git from this checkout.");
@@ -37283,7 +37236,7 @@ var runGitConvertCommand = async ({
37283
37236
  );
37284
37237
  }
37285
37238
  await writeForumProjectConfig(
37286
- path21.join(localPath, defaultProjectConfigFilename),
37239
+ path24.join(localPath, defaultProjectConfigFilename),
37287
37240
  {
37288
37241
  syncRules: [
37289
37242
  {
@@ -37345,14 +37298,18 @@ var runGitConvertCommand = async ({
37345
37298
  "Aborted before deleting Git metadata. The Forum push completed, but .git and .gitignore were left in place."
37346
37299
  );
37347
37300
  }
37348
- await rm5(path21.join(localPath, ".gitignore"), { force: true });
37349
- 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 });
37350
37303
  renderOutput(
37351
37304
  `${created ? "Created" : "Using existing"} store ${metadata.slug}`
37352
37305
  );
37353
37306
  renderOutput(`Converted Git repository to Forum checkout at ${localPath}`);
37354
37307
  };
37355
37308
  var main = async (argv = process.argv.slice(2)) => {
37309
+ if (parseArgvCommandName(argv) === "skills") {
37310
+ await runSkillsCommand(argv);
37311
+ return;
37312
+ }
37356
37313
  const parsed = parseArgs(argv);
37357
37314
  configureRenderer({ json: parsed.json });
37358
37315
  let [command, ...rest] = parsed.args;
@@ -37469,7 +37426,7 @@ var main = async (argv = process.argv.slice(2)) => {
37469
37426
  }
37470
37427
  if (command === "hash" && parsed.local) {
37471
37428
  const filePath = rest[0];
37472
- renderOutput(await hashLocalFile(path21.resolve(filePath)));
37429
+ renderOutput(await hashLocalFile(path24.resolve(filePath)));
37473
37430
  return;
37474
37431
  }
37475
37432
  const config2 = await resolveConfig(parsed);
@@ -37650,51 +37607,6 @@ var main = async (argv = process.argv.slice(2)) => {
37650
37607
  }
37651
37608
  return;
37652
37609
  }
37653
- if (command === "skill") {
37654
- const subcommand = rest[0];
37655
- if (subcommand === "install") {
37656
- if (rest[1] || parsed.storeFilters.length > 0) {
37657
- throw new Error(
37658
- `Usage: ${commandNames} skill install [--provider <all|codex|claude>] [--global]`
37659
- );
37660
- }
37661
- await withActivity(
37662
- "Installing built-in skill",
37663
- () => runSkillInstallCommand({
37664
- agents: parsed.skillAgents,
37665
- assumeYes: parsed.yes,
37666
- client,
37667
- dryRun: parsed.dryRun,
37668
- isGlobal: parsed.skillGlobal,
37669
- targetDir: parsed.skillTargetDir
37670
- })
37671
- );
37672
- return;
37673
- }
37674
- if (subcommand === "add") {
37675
- const { skillPathInput, storeInput } = resolveSkillAddInputs(
37676
- rest,
37677
- parsed.storeFilters
37678
- );
37679
- await withActivity(
37680
- "Installing skill",
37681
- () => runSkillAddCommand({
37682
- agents: parsed.skillAgents,
37683
- assumeYes: parsed.yes,
37684
- client,
37685
- dryRun: parsed.dryRun,
37686
- isGlobal: parsed.skillGlobal,
37687
- skillPathInput,
37688
- storeInput,
37689
- targetDir: parsed.skillTargetDir
37690
- })
37691
- );
37692
- return;
37693
- }
37694
- throw new Error(
37695
- `Usage: ${commandNames} skill install|add <storeId> <path> [--provider <all|codex|claude>] [--global]`
37696
- );
37697
- }
37698
37610
  if (command === "hash") {
37699
37611
  const filePath = rest[0];
37700
37612
  const hash2 = await withActivity("Hashing remote file", async () => {
@@ -38001,8 +37913,8 @@ var main = async (argv = process.argv.slice(2)) => {
38001
37913
  `Usage: ${commandNames} clone <storeId> [localPath] [--readonly]`
38002
37914
  );
38003
37915
  }
38004
- const localPath = path21.resolve(
38005
- rest[1] ?? path21.join(process.cwd(), defaultCloneDirectoryName(remoteInput))
37916
+ const localPath = path24.resolve(
37917
+ rest[1] ?? path24.join(process.cwd(), defaultCloneDirectoryName(remoteInput))
38006
37918
  );
38007
37919
  const { metadata, workspaceSlug, storeRef } = await resolveReadableStore(
38008
37920
  remoteInput,
@@ -38030,7 +37942,7 @@ var main = async (argv = process.argv.slice(2)) => {
38030
37942
  storeRef,
38031
37943
  syncRules: checkout.syncRules
38032
37944
  });
38033
- renderOutput(`Cloned store ${metadata.slug} to ${path21.resolve(localPath)}`);
37945
+ renderOutput(`Cloned store ${metadata.slug} to ${path24.resolve(localPath)}`);
38034
37946
  formatCheckoutResult("Pulled", result, {
38035
37947
  detailsRendered: Boolean(progress),
38036
37948
  verbose: parsed.verbose
@@ -38080,7 +37992,7 @@ var main = async (argv = process.argv.slice(2)) => {
38080
37992
  });
38081
37993
  result.warnings.forEach((warning) => renderWarning(warning));
38082
37994
  if (parsed.outputFilePath) {
38083
- await writeFile6(parsed.outputFilePath, result.text, "utf8");
37995
+ await writeFile7(parsed.outputFilePath, result.text, "utf8");
38084
37996
  } else {
38085
37997
  renderOutput(result.text);
38086
37998
  }