@nuucognition/flint-cli 0.6.0-dev.0 → 0.6.0-dev.1

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
@@ -455,8 +455,8 @@ var init_parseUtil = __esm({
455
455
  init_errors();
456
456
  init_en();
457
457
  makeIssue = (params) => {
458
- const { data, path: path29, errorMaps, issueData } = params;
459
- const fullPath = [...path29, ...issueData.path || []];
458
+ const { data, path: path30, errorMaps, issueData } = params;
459
+ const fullPath = [...path30, ...issueData.path || []];
460
460
  const fullIssue = {
461
461
  ...issueData,
462
462
  path: fullPath
@@ -767,11 +767,11 @@ var init_types = __esm({
767
767
  init_parseUtil();
768
768
  init_util();
769
769
  ParseInputLazyPath = class {
770
- constructor(parent, value, path29, key) {
770
+ constructor(parent, value, path30, key) {
771
771
  this._cachedPath = [];
772
772
  this.parent = parent;
773
773
  this.data = value;
774
- this._path = path29;
774
+ this._path = path30;
775
775
  this._key = key;
776
776
  }
777
777
  get path() {
@@ -5117,9 +5117,9 @@ async function readLocalState(flintPath) {
5117
5117
  }
5118
5118
  }
5119
5119
  async function writeLocalState(flintPath, state) {
5120
- const path29 = getLocalStatePath(flintPath);
5121
- await mkdir2(dirname4(path29), { recursive: true });
5122
- await writeFile2(path29, JSON.stringify(state, null, 2) + "\n");
5120
+ const path30 = getLocalStatePath(flintPath);
5121
+ await mkdir2(dirname4(path30), { recursive: true });
5122
+ await writeFile2(path30, JSON.stringify(state, null, 2) + "\n");
5123
5123
  }
5124
5124
  async function getLocalFlintVersion(flintPath) {
5125
5125
  const state = await readLocalState(flintPath);
@@ -5168,8 +5168,8 @@ function parseWorkspaceToml(content) {
5168
5168
  }
5169
5169
  return config;
5170
5170
  }
5171
- function generateReferenceMarkdown(path29) {
5172
- return `**Path:** ${path29}
5171
+ function generateReferenceMarkdown(path30) {
5172
+ return `**Path:** ${path30}
5173
5173
  **Type:** codebase
5174
5174
 
5175
5175
  ## Key Paths
@@ -5181,9 +5181,9 @@ function generateReferenceMarkdown(path29) {
5181
5181
  (add notes here)
5182
5182
  `;
5183
5183
  }
5184
- async function isDirectory(path29) {
5184
+ async function isDirectory(path30) {
5185
5185
  try {
5186
- const s = await stat(path29);
5186
+ const s = await stat(path30);
5187
5187
  return s.isDirectory();
5188
5188
  } catch {
5189
5189
  return false;
@@ -5225,17 +5225,17 @@ async function readFlintJson(flintPath) {
5225
5225
  async function writeFlintJsonFile(flintPath, data) {
5226
5226
  await writeFile22(join32(flintPath, FLINT_JSON), JSON.stringify(data, null, 2) + "\n");
5227
5227
  }
5228
- async function isDirectory2(path29) {
5228
+ async function isDirectory2(path30) {
5229
5229
  try {
5230
- const s = await stat3(path29);
5230
+ const s = await stat3(path30);
5231
5231
  return s.isDirectory();
5232
5232
  } catch {
5233
5233
  return false;
5234
5234
  }
5235
5235
  }
5236
- async function fileExists(path29) {
5236
+ async function fileExists(path30) {
5237
5237
  try {
5238
- await stat3(path29);
5238
+ await stat3(path30);
5239
5239
  return true;
5240
5240
  } catch {
5241
5241
  return false;
@@ -5358,16 +5358,16 @@ async function readFlintJson2(flintPath) {
5358
5358
  async function writeFlintJsonFile2(flintPath, data) {
5359
5359
  await writeFile32(join6(flintPath, FLINT_JSON2), JSON.stringify(data, null, 2) + "\n");
5360
5360
  }
5361
- async function pathExists(path29) {
5361
+ async function pathExists(path30) {
5362
5362
  try {
5363
- await stat6(path29);
5363
+ await stat6(path30);
5364
5364
  return true;
5365
5365
  } catch {
5366
5366
  return false;
5367
5367
  }
5368
5368
  }
5369
- async function ensureDir(path29) {
5370
- await mkdir42(path29, { recursive: true });
5369
+ async function ensureDir(path30) {
5370
+ await mkdir42(path30, { recursive: true });
5371
5371
  }
5372
5372
  function toKebabCase(name) {
5373
5373
  return name.replace(/\([^)]*\)\s*/g, "").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/^-+|-+$/g, "");
@@ -5627,11 +5627,11 @@ async function renameDeclaredRepoFolders(ctx, baseDir, repositories, changes, wa
5627
5627
  changes.push(`Renamed ${baseDir}/${legacyName} \u2192 ${baseDir}/${repo.name}`);
5628
5628
  }
5629
5629
  }
5630
- async function removeDirIfEmpty(path29) {
5630
+ async function removeDirIfEmpty(path30) {
5631
5631
  try {
5632
- const entries = await readdir6(path29);
5632
+ const entries = await readdir6(path30);
5633
5633
  if (entries.length === 0) {
5634
- await rmdir(path29);
5634
+ await rmdir(path30);
5635
5635
  }
5636
5636
  } catch {
5637
5637
  }
@@ -6377,24 +6377,24 @@ function createMigrationContext(flintPath, options3 = {}) {
6377
6377
  log,
6378
6378
  warn,
6379
6379
  error: error3,
6380
- async exists(path29) {
6380
+ async exists(path30) {
6381
6381
  try {
6382
- await access2(resolve18(path29));
6382
+ await access2(resolve18(path30));
6383
6383
  return true;
6384
6384
  } catch {
6385
6385
  return false;
6386
6386
  }
6387
6387
  },
6388
- async read(path29) {
6389
- return readFile6(resolve18(path29), "utf-8");
6388
+ async read(path30) {
6389
+ return readFile6(resolve18(path30), "utf-8");
6390
6390
  },
6391
- async write(path29, content) {
6392
- const fullPath = resolve18(path29);
6391
+ async write(path30, content) {
6392
+ const fullPath = resolve18(path30);
6393
6393
  await mkdir6(dirname22(fullPath), { recursive: true });
6394
6394
  await writeFile5(fullPath, content, "utf-8");
6395
6395
  },
6396
- async delete(path29) {
6397
- await unlink2(resolve18(path29));
6396
+ async delete(path30) {
6397
+ await unlink2(resolve18(path30));
6398
6398
  },
6399
6399
  // ── Intent (flint.toml) ──────────────────────────────────────────────
6400
6400
  async readIntentText() {
@@ -6432,14 +6432,14 @@ function createMigrationContext(flintPath, options3 = {}) {
6432
6432
  await mkdir6(dirname22(dest), { recursive: true });
6433
6433
  await rename6(resolve18(from), dest);
6434
6434
  },
6435
- async rm(path29, options22) {
6436
- await fsRm(resolve18(path29), { recursive: options22?.recursive ?? false, force: true });
6435
+ async rm(path30, options22) {
6436
+ await fsRm(resolve18(path30), { recursive: options22?.recursive ?? false, force: true });
6437
6437
  },
6438
- async mkdir(path29, options22) {
6439
- await mkdir6(resolve18(path29), { recursive: options22?.recursive ?? true });
6438
+ async mkdir(path30, options22) {
6439
+ await mkdir6(resolve18(path30), { recursive: options22?.recursive ?? true });
6440
6440
  },
6441
- async readDir(path29) {
6442
- return readdir9(resolve18(path29));
6441
+ async readDir(path30) {
6442
+ return readdir9(resolve18(path30));
6443
6443
  }
6444
6444
  }
6445
6445
  };
@@ -8417,8 +8417,8 @@ async function findFlintRoot(startPath) {
8417
8417
  }
8418
8418
  return null;
8419
8419
  }
8420
- async function isInsideFlint(path29) {
8421
- const flintRoot = await findFlintRoot(path29);
8420
+ async function isInsideFlint(path30) {
8421
+ const flintRoot = await findFlintRoot(path30);
8422
8422
  return flintRoot !== null;
8423
8423
  }
8424
8424
  function getTypePrefix() {
@@ -8511,9 +8511,9 @@ function isDevShard(decl) {
8511
8511
  const mode = resolveShardMode(decl);
8512
8512
  return mode === "dev-remote" || mode === "dev-local";
8513
8513
  }
8514
- async function exists(path29) {
8514
+ async function exists(path30) {
8515
8515
  try {
8516
- await stat22(path29);
8516
+ await stat22(path30);
8517
8517
  return true;
8518
8518
  } catch {
8519
8519
  return false;
@@ -9661,9 +9661,9 @@ var init_chunk_DM3D33H6 = __esm({
9661
9661
 
9662
9662
  // ../../packages/flint/dist/chunk-STM4NXTT.js
9663
9663
  import { access as access3 } from "fs/promises";
9664
- async function exists2(path29) {
9664
+ async function exists2(path30) {
9665
9665
  try {
9666
- await access3(path29);
9666
+ await access3(path30);
9667
9667
  return true;
9668
9668
  } catch {
9669
9669
  return false;
@@ -9766,51 +9766,51 @@ function isRecord(value) {
9766
9766
  function isNonEmptyString(value) {
9767
9767
  return typeof value === "string" && value.trim().length > 0;
9768
9768
  }
9769
- function addIssue(issues, path29, message) {
9770
- issues.push(`Invalid "${path29}": ${message}`);
9769
+ function addIssue(issues, path30, message) {
9770
+ issues.push(`Invalid "${path30}": ${message}`);
9771
9771
  }
9772
- function validateString(value, path29, issues, options3 = {}) {
9772
+ function validateString(value, path30, issues, options3 = {}) {
9773
9773
  if (value === void 0) {
9774
9774
  if (options3.required) {
9775
- issues.push(`Missing required field "${path29}"`);
9775
+ issues.push(`Missing required field "${path30}"`);
9776
9776
  }
9777
9777
  return void 0;
9778
9778
  }
9779
9779
  if (!isNonEmptyString(value)) {
9780
- addIssue(issues, path29, "expected a non-empty string");
9780
+ addIssue(issues, path30, "expected a non-empty string");
9781
9781
  return void 0;
9782
9782
  }
9783
9783
  if (options3.exact && value !== options3.exact) {
9784
- addIssue(issues, path29, `expected "${options3.exact}", got "${value}"`);
9784
+ addIssue(issues, path30, `expected "${options3.exact}", got "${value}"`);
9785
9785
  return void 0;
9786
9786
  }
9787
9787
  if (options3.singleLine && /\r|\n/.test(value)) {
9788
- addIssue(issues, path29, "expected a single-line string");
9788
+ addIssue(issues, path30, "expected a single-line string");
9789
9789
  return void 0;
9790
9790
  }
9791
9791
  if (options3.pattern && !options3.pattern.test(value)) {
9792
- addIssue(issues, path29, options3.patternDescription ?? `expected to match ${options3.pattern}`);
9792
+ addIssue(issues, path30, options3.patternDescription ?? `expected to match ${options3.pattern}`);
9793
9793
  return void 0;
9794
9794
  }
9795
9795
  return value;
9796
9796
  }
9797
- function validateStringArray(value, path29, issues) {
9797
+ function validateStringArray(value, path30, issues) {
9798
9798
  if (value === void 0) return void 0;
9799
9799
  if (!Array.isArray(value)) {
9800
- addIssue(issues, path29, "expected an array of strings");
9800
+ addIssue(issues, path30, "expected an array of strings");
9801
9801
  return void 0;
9802
9802
  }
9803
9803
  const items = [];
9804
9804
  value.forEach((entry, index) => {
9805
- const item = validateString(entry, `${path29}[${index}]`, issues);
9805
+ const item = validateString(entry, `${path30}[${index}]`, issues);
9806
9806
  if (item !== void 0) {
9807
9807
  items.push(item);
9808
9808
  }
9809
9809
  });
9810
9810
  return items;
9811
9811
  }
9812
- function validateNodeScriptPath(value, path29, issues, options3 = {}) {
9813
- const validated = validateString(value, path29, issues, {
9812
+ function validateNodeScriptPath(value, path30, issues, options3 = {}) {
9813
+ const validated = validateString(value, path30, issues, {
9814
9814
  required: options3.required,
9815
9815
  singleLine: true
9816
9816
  });
@@ -9818,19 +9818,19 @@ function validateNodeScriptPath(value, path29, issues, options3 = {}) {
9818
9818
  return void 0;
9819
9819
  }
9820
9820
  if (validated.startsWith("/") || validated.startsWith("\\")) {
9821
- addIssue(issues, path29, "expected a relative path inside the shard");
9821
+ addIssue(issues, path30, "expected a relative path inside the shard");
9822
9822
  return void 0;
9823
9823
  }
9824
9824
  if (validated.split(/[\\/]+/).some((segment) => segment === "..")) {
9825
- addIssue(issues, path29, "path traversal is not allowed");
9825
+ addIssue(issues, path30, "path traversal is not allowed");
9826
9826
  return void 0;
9827
9827
  }
9828
9828
  if (!validated.endsWith(".js")) {
9829
- addIssue(issues, path29, 'expected a Node.js ".js" file');
9829
+ addIssue(issues, path30, 'expected a Node.js ".js" file');
9830
9830
  return void 0;
9831
9831
  }
9832
9832
  if (options3.prefix && !validated.startsWith(`${options3.prefix}/`)) {
9833
- addIssue(issues, path29, `expected a path under "${options3.prefix}/"`);
9833
+ addIssue(issues, path30, `expected a path under "${options3.prefix}/"`);
9834
9834
  return void 0;
9835
9835
  }
9836
9836
  return validated;
@@ -10054,8 +10054,8 @@ function normalizeLegacyManifest(raw, _context) {
10054
10054
  install
10055
10055
  };
10056
10056
  }
10057
- function addWarning(warnings, path29, message) {
10058
- warnings.push(`"${path29}": ${message}`);
10057
+ function addWarning(warnings, path30, message) {
10058
+ warnings.push(`"${path30}": ${message}`);
10059
10059
  }
10060
10060
  function parseShardManifestContent(content, manifestPath) {
10061
10061
  let parsed;
@@ -10627,9 +10627,9 @@ function classifyGitError(error3) {
10627
10627
  }
10628
10628
  return "unknown";
10629
10629
  }
10630
- async function pathExists3(path29) {
10630
+ async function pathExists3(path30) {
10631
10631
  try {
10632
- await stat23(path29);
10632
+ await stat23(path30);
10633
10633
  return true;
10634
10634
  } catch {
10635
10635
  return false;
@@ -11182,8 +11182,8 @@ async function updateShardLocalStateSetup(flintPath, name, shorthand, setup) {
11182
11182
  await syncSetupStateFile(getShardLocalStatePath(flintPath, name), shorthand, setup, { setup });
11183
11183
  }
11184
11184
  async function getShardSetupState(flintPath, name) {
11185
- const readLayer = async (path29) => {
11186
- const snap = await readSetupStateFileSnapshot(path29, "required");
11185
+ const readLayer = async (path30) => {
11186
+ const snap = await readSetupStateFileSnapshot(path30, "required");
11187
11187
  return snap ? { exists: true, setup: snap.setup } : { exists: false, setup: null };
11188
11188
  };
11189
11189
  return {
@@ -11193,8 +11193,8 @@ async function getShardSetupState(flintPath, name) {
11193
11193
  }
11194
11194
  async function setShardSetupState(flintPath, name, shorthand, scope, setup) {
11195
11195
  await ensureShardSystemFolders(flintPath);
11196
- const path29 = scope === "flint" ? getShardStatePath(flintPath, name) : getShardLocalStatePath(flintPath, name);
11197
- await syncSetupStateFile(path29, shorthand, setup, { setup });
11196
+ const path30 = scope === "flint" ? getShardStatePath(flintPath, name) : getShardLocalStatePath(flintPath, name);
11197
+ await syncSetupStateFile(path30, shorthand, setup, { setup });
11198
11198
  }
11199
11199
  function processTemplate(content) {
11200
11200
  const now = /* @__PURE__ */ new Date();
@@ -14106,42 +14106,44 @@ import { randomUUID as randomUUID22 } from "crypto";
14106
14106
  import { fileURLToPath as fileURLToPath2 } from "url";
14107
14107
  import { stat as stat82 } from "fs/promises";
14108
14108
  import { join as join142 } from "path";
14109
+ import path22 from "path";
14110
+ import { fileURLToPath as fileURLToPath22 } from "url";
14109
14111
  import { readdir as readdir92, readFile as readFile82, mkdir as mkdir12, writeFile as writeFile82, rm as rm62, stat as stat92, copyFile as copyFile2 } from "fs/promises";
14110
14112
  import { join as join152, basename as basename5, dirname as dirname52, resolve as resolve6, relative as relative3, sep as sep3, extname as extname2 } from "path";
14111
14113
  import { promises as fs42 } from "fs";
14112
- import path42 from "path";
14114
+ import path52 from "path";
14113
14115
  import { promises as fs22 } from "fs";
14114
- import path22 from "path";
14115
- import { promises as fs32 } from "fs";
14116
14116
  import path32 from "path";
14117
+ import { promises as fs32 } from "fs";
14118
+ import path42 from "path";
14117
14119
  import { promises as fs52 } from "fs";
14118
- import path52 from "path";
14119
14120
  import path6 from "path";
14121
+ import path7 from "path";
14120
14122
  import { randomUUID as randomUUID32 } from "crypto";
14121
14123
  import { promises as fs72 } from "fs";
14122
- import path7 from "path";
14123
14124
  import path8 from "path";
14124
- import { promises as fs8 } from "fs";
14125
14125
  import path9 from "path";
14126
+ import { promises as fs8 } from "fs";
14126
14127
  import path10 from "path";
14127
14128
  import path11 from "path";
14129
+ import path12 from "path";
14128
14130
  import { exec as exec5 } from "child_process";
14129
14131
  import { promises as fs9 } from "fs";
14130
- import path12 from "path";
14132
+ import path13 from "path";
14131
14133
  import { promisify as promisify62 } from "util";
14132
14134
  import { promises as fs10 } from "fs";
14133
- import path13 from "path";
14134
- import { promises as fs11 } from "fs";
14135
14135
  import path14 from "path";
14136
- import { promises as fs12 } from "fs";
14136
+ import { promises as fs11 } from "fs";
14137
14137
  import path15 from "path";
14138
- import { promises as fs13 } from "fs";
14138
+ import { promises as fs12 } from "fs";
14139
14139
  import path16 from "path";
14140
- import { promises as fs14 } from "fs";
14140
+ import { promises as fs13 } from "fs";
14141
14141
  import path17 from "path";
14142
+ import { promises as fs14 } from "fs";
14143
+ import path18 from "path";
14142
14144
  import { exec as exec6 } from "child_process";
14143
14145
  import { promises as fs15 } from "fs";
14144
- import path18 from "path";
14146
+ import path19 from "path";
14145
14147
  import { promisify as promisify72 } from "util";
14146
14148
  function formatFlintFolderName(name) {
14147
14149
  const prefix = getTypePrefix();
@@ -14228,20 +14230,20 @@ Create notes in \`Mesh/\` and link them with \`[[wiki-links]]\`.
14228
14230
  async function createMediaDir(flintPath) {
14229
14231
  await mkdir24(join25(flintPath, "Media"), { recursive: true });
14230
14232
  }
14231
- async function isValidFlint(path192) {
14233
+ async function isValidFlint(path202) {
14232
14234
  try {
14233
- const stats = await stat24(path192);
14235
+ const stats = await stat24(path202);
14234
14236
  if (!stats.isDirectory()) {
14235
14237
  return false;
14236
14238
  }
14237
- return hasFlintToml(path192);
14239
+ return hasFlintToml(path202);
14238
14240
  } catch {
14239
14241
  return false;
14240
14242
  }
14241
14243
  }
14242
- async function getFlintNameFromPath(path192) {
14244
+ async function getFlintNameFromPath(path202) {
14243
14245
  try {
14244
- const toml = await readFlintToml(path192);
14246
+ const toml = await readFlintToml(path202);
14245
14247
  if (!toml) return null;
14246
14248
  return toml.flint?.name ?? null;
14247
14249
  } catch {
@@ -14431,9 +14433,9 @@ function normalizePlateName(name) {
14431
14433
  function isSlug(value) {
14432
14434
  return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value);
14433
14435
  }
14434
- async function fileExists2(path192) {
14436
+ async function fileExists2(path202) {
14435
14437
  try {
14436
- await stat32(path192);
14438
+ await stat32(path202);
14437
14439
  return true;
14438
14440
  } catch {
14439
14441
  return false;
@@ -16131,9 +16133,9 @@ async function createArtifactFromTemplate(flintPath, request) {
16131
16133
  throw new Error(`Unsupported template: ${request.template}`);
16132
16134
  }
16133
16135
  }
16134
- async function pathExists4(path192) {
16136
+ async function pathExists4(path202) {
16135
16137
  try {
16136
- await stat42(path192);
16138
+ await stat42(path202);
16137
16139
  return true;
16138
16140
  } catch {
16139
16141
  return false;
@@ -16388,9 +16390,9 @@ function getTinderboxFlintMode(declaration) {
16388
16390
  function getTinderboxFolderName(name) {
16389
16391
  return `(Flint) ${name}`;
16390
16392
  }
16391
- async function pathExists32(path192) {
16393
+ async function pathExists32(path202) {
16392
16394
  try {
16393
- await stat52(path192);
16395
+ await stat52(path202);
16394
16396
  return true;
16395
16397
  } catch {
16396
16398
  return false;
@@ -16681,10 +16683,10 @@ async function reconcileTinderbox(root, config) {
16681
16683
  });
16682
16684
  return { matched, undeclared, missing, renamed };
16683
16685
  }
16684
- function buildFlintEntry(path192, name, toml) {
16686
+ function buildFlintEntry(path202, name, toml) {
16685
16687
  const entry = {
16686
16688
  name,
16687
- path: resolve32(path192),
16689
+ path: resolve32(path202),
16688
16690
  source: "local"
16689
16691
  };
16690
16692
  if (toml?.flint.tags?.length) {
@@ -17093,15 +17095,15 @@ async function setTinderboxIdentity(root, name) {
17093
17095
  }
17094
17096
  return { applied, failed };
17095
17097
  }
17096
- async function countFiles(path192) {
17097
- const stats = await stat52(path192);
17098
+ async function countFiles(path202) {
17099
+ const stats = await stat52(path202);
17098
17100
  if (!stats.isDirectory()) {
17099
17101
  return 1;
17100
17102
  }
17101
- const entries = await readdir42(path192, { withFileTypes: true });
17103
+ const entries = await readdir42(path202, { withFileTypes: true });
17102
17104
  let count = 1;
17103
17105
  for (const entry of entries) {
17104
- count += await countFiles(join92(path192, entry.name));
17106
+ count += await countFiles(join92(path202, entry.name));
17105
17107
  }
17106
17108
  return count;
17107
17109
  }
@@ -19054,8 +19056,8 @@ async function isRebaseInProgress(cwd) {
19054
19056
  const result = await runGit(cwd, ["rev-parse", "--git-path", "rebase-merge"]);
19055
19057
  if (result.success) {
19056
19058
  const { access: access32 } = await import("fs/promises");
19057
- const path192 = await import("path");
19058
- const rebasePath = path192.resolve(cwd, result.output.trim());
19059
+ const path202 = await import("path");
19060
+ const rebasePath = path202.resolve(cwd, result.output.trim());
19059
19061
  try {
19060
19062
  await access32(rebasePath);
19061
19063
  return true;
@@ -19065,8 +19067,8 @@ async function isRebaseInProgress(cwd) {
19065
19067
  const result2 = await runGit(cwd, ["rev-parse", "--git-path", "rebase-apply"]);
19066
19068
  if (result2.success) {
19067
19069
  const { access: access32 } = await import("fs/promises");
19068
- const path192 = await import("path");
19069
- const rebasePath = path192.resolve(cwd, result2.output.trim());
19070
+ const path202 = await import("path");
19071
+ const rebasePath = path202.resolve(cwd, result2.output.trim());
19070
19072
  try {
19071
19073
  await access32(rebasePath);
19072
19074
  return true;
@@ -19080,8 +19082,8 @@ async function getRebaseBranch(cwd) {
19080
19082
  const result = await runGit(cwd, ["rev-parse", "--git-path", "rebase-merge/head-name"]);
19081
19083
  if (result.success) {
19082
19084
  const { readFile: readFile92 } = await import("fs/promises");
19083
- const path192 = await import("path");
19084
- const headNamePath = path192.resolve(cwd, result.output.trim());
19085
+ const path202 = await import("path");
19086
+ const headNamePath = path202.resolve(cwd, result.output.trim());
19085
19087
  try {
19086
19088
  const ref = (await readFile92(headNamePath, "utf-8")).trim();
19087
19089
  return ref.replace(/^refs\/heads\//, "");
@@ -19099,7 +19101,7 @@ async function getConflictFiles(cwd) {
19099
19101
  }
19100
19102
  async function hasConflictMarkers(cwd, files) {
19101
19103
  const { readFile: readFile92 } = await import("fs/promises");
19102
- const path192 = await import("path");
19104
+ const path202 = await import("path");
19103
19105
  let filesToCheck = files;
19104
19106
  if (!filesToCheck || filesToCheck.length === 0) {
19105
19107
  const result = await runGit(cwd, ["diff", "--name-only", "HEAD"]);
@@ -19117,7 +19119,7 @@ async function hasConflictMarkers(cwd, files) {
19117
19119
  const conflicted = [];
19118
19120
  for (const file of filesToCheck) {
19119
19121
  try {
19120
- const content = await readFile92(path192.resolve(cwd, file), "utf-8");
19122
+ const content = await readFile92(path202.resolve(cwd, file), "utf-8");
19121
19123
  if (content.includes("<<<<<<<") && content.includes("=======") && content.includes(">>>>>>>")) {
19122
19124
  conflicted.push(file);
19123
19125
  }
@@ -19413,6 +19415,13 @@ async function resolveSource(flintPath, ref) {
19413
19415
  return { status: "unfulfilled", name: ref, type: "flint-bundle", path: sourcePath };
19414
19416
  }
19415
19417
  }
19418
+ function resolvePromptsBasePath() {
19419
+ try {
19420
+ return resolvePackageBasePath("@nuucognition/flint", import.meta.url);
19421
+ } catch {
19422
+ return path22.resolve(path22.dirname(fileURLToPath22(import.meta.url)), "_flint");
19423
+ }
19424
+ }
19416
19425
  async function loadFlintPrompt(name, variables = {}) {
19417
19426
  return loadPrompt(name, variables, {
19418
19427
  basePath: PROMPTS_BASE_PATH,
@@ -19430,9 +19439,9 @@ async function buildFlintApplicationPrompt(flintPath) {
19430
19439
  }
19431
19440
  return (await loadFlintPrompt("flint-application", { person })).trim();
19432
19441
  }
19433
- async function exists22(path192) {
19442
+ async function exists22(path202) {
19434
19443
  try {
19435
- await stat92(path192);
19444
+ await stat92(path202);
19436
19445
  return true;
19437
19446
  } catch {
19438
19447
  return false;
@@ -19866,13 +19875,13 @@ async function applyEffect(world, effect) {
19866
19875
  await writeFlintJsonPatch(world.root, effect.patch);
19867
19876
  return;
19868
19877
  case "writeSharedFile":
19869
- await writeFile9(path22.resolve(world.root, effect.path), effect.contents);
19878
+ await writeFile9(path32.resolve(world.root, effect.path), effect.contents);
19870
19879
  return;
19871
19880
  case "deleteSharedPath":
19872
- await deletePath(path22.resolve(world.root, effect.path));
19881
+ await deletePath(path32.resolve(world.root, effect.path));
19873
19882
  return;
19874
19883
  case "writeLocalFile":
19875
- await writeFile9(path22.resolve(world.root, ".flint", effect.path), effect.contents);
19884
+ await writeFile9(path32.resolve(world.root, ".flint", effect.path), effect.contents);
19876
19885
  return;
19877
19886
  }
19878
19887
  }
@@ -19883,25 +19892,25 @@ async function writeFlintJsonPatch(root, patch) {
19883
19892
  await writeFlintJson2(root, merged);
19884
19893
  }
19885
19894
  async function writeFile9(file, contents) {
19886
- await fs22.mkdir(path22.dirname(file), { recursive: true });
19895
+ await fs22.mkdir(path32.dirname(file), { recursive: true });
19887
19896
  await fs22.writeFile(file, contents, "utf8");
19888
19897
  }
19889
19898
  async function deletePath(target) {
19890
19899
  await fs22.rm(target, { recursive: true, force: true });
19891
19900
  }
19892
19901
  async function syncMarkers(root, set) {
19893
- const dir = path32.join(root, set.dir);
19902
+ const dir = path42.join(root, set.dir);
19894
19903
  await fs32.mkdir(dir, { recursive: true });
19895
19904
  const expected = /* @__PURE__ */ new Set();
19896
19905
  for (const entry of set.entries) {
19897
19906
  expected.add(entry.filename);
19898
- const file = path32.join(dir, entry.filename);
19907
+ const file = path42.join(dir, entry.filename);
19899
19908
  await fs32.writeFile(file, renderMarker(entry), "utf8");
19900
19909
  }
19901
19910
  const existing = await fs32.readdir(dir, { withFileTypes: true });
19902
19911
  for (const dirent of existing) {
19903
19912
  if (expected.has(dirent.name)) continue;
19904
- await fs32.rm(path32.join(dir, dirent.name), { recursive: true, force: true });
19913
+ await fs32.rm(path42.join(dir, dirent.name), { recursive: true, force: true });
19905
19914
  }
19906
19915
  }
19907
19916
  function renderMarker(marker) {
@@ -20002,15 +20011,15 @@ async function runPhase(features2, world, opts, plan, receipts) {
20002
20011
  return dispatchDrifts(drifts, features2, world, opts, plan, receipts);
20003
20012
  }
20004
20013
  async function pruneMetadataParents(root, markerDirs) {
20005
- const METADATA_ROOT = path42.join("Mesh", "Metadata");
20014
+ const METADATA_ROOT = path52.join("Mesh", "Metadata");
20006
20015
  const expectedByParent = /* @__PURE__ */ new Map();
20007
20016
  for (const dir of markerDirs) {
20008
- const norm = path42.normalize(dir);
20009
- if (!norm.startsWith(METADATA_ROOT + path42.sep) && norm !== METADATA_ROOT) continue;
20017
+ const norm = path52.normalize(dir);
20018
+ if (!norm.startsWith(METADATA_ROOT + path52.sep) && norm !== METADATA_ROOT) continue;
20010
20019
  let cur = norm;
20011
- while (cur !== METADATA_ROOT && cur !== "." && cur !== path42.dirname(cur)) {
20012
- const parent = path42.dirname(cur);
20013
- const child = path42.basename(cur);
20020
+ while (cur !== METADATA_ROOT && cur !== "." && cur !== path52.dirname(cur)) {
20021
+ const parent = path52.dirname(cur);
20022
+ const child = path52.basename(cur);
20014
20023
  if (!expectedByParent.has(parent)) expectedByParent.set(parent, /* @__PURE__ */ new Set());
20015
20024
  expectedByParent.get(parent).add(child);
20016
20025
  if (parent === METADATA_ROOT) break;
@@ -20018,7 +20027,7 @@ async function pruneMetadataParents(root, markerDirs) {
20018
20027
  }
20019
20028
  }
20020
20029
  for (const [parent, expected] of expectedByParent) {
20021
- const parentAbs = path42.join(root, parent);
20030
+ const parentAbs = path52.join(root, parent);
20022
20031
  let entries;
20023
20032
  try {
20024
20033
  entries = await fs42.readdir(parentAbs, { withFileTypes: true });
@@ -20027,7 +20036,7 @@ async function pruneMetadataParents(root, markerDirs) {
20027
20036
  }
20028
20037
  for (const dirent of entries) {
20029
20038
  if (expected.has(dirent.name)) continue;
20030
- await fs42.rm(path42.join(parentAbs, dirent.name), { recursive: true, force: true });
20039
+ await fs42.rm(path52.join(parentAbs, dirent.name), { recursive: true, force: true });
20031
20040
  }
20032
20041
  }
20033
20042
  }
@@ -20061,7 +20070,7 @@ async function loadWorld(root, opts = {}) {
20061
20070
  const parseErrors = [];
20062
20071
  const intent = await readIntent(root, parseErrors);
20063
20072
  const entity = await readEntity(root, parseErrors);
20064
- const local = await walkLocal(path52.join(root, localDir), root, parseErrors);
20073
+ const local = await walkLocal(path6.join(root, localDir), root, parseErrors);
20065
20074
  return { root, intent, entity, local, parseErrors };
20066
20075
  }
20067
20076
  async function readIntent(root, parseErrors) {
@@ -20131,7 +20140,7 @@ async function walkLocal(dir, root, parseErrors) {
20131
20140
  throw err;
20132
20141
  }
20133
20142
  for (const entry of entries) {
20134
- const full = path52.join(dir, entry.name);
20143
+ const full = path6.join(dir, entry.name);
20135
20144
  if (entry.isDirectory()) {
20136
20145
  out[entry.name] = await walkLocal(full, root, parseErrors);
20137
20146
  } else {
@@ -20142,7 +20151,7 @@ async function walkLocal(dir, root, parseErrors) {
20142
20151
  JSON.parse(content);
20143
20152
  } catch (err) {
20144
20153
  parseErrors.push({
20145
- source: path52.relative(root, full),
20154
+ source: path6.relative(root, full),
20146
20155
  path: full,
20147
20156
  message: err instanceof Error ? err.message : String(err)
20148
20157
  });
@@ -20214,7 +20223,7 @@ function partitionIntent(world) {
20214
20223
  });
20215
20224
  }
20216
20225
  function renderBody2(entry) {
20217
- const repoPath = path7.join(BUNDLE_EXPORTS_DIR, `(Bundle) ${entry.name}`);
20226
+ const repoPath = path8.join(BUNDLE_EXPORTS_DIR, `(Bundle) ${entry.name}`);
20218
20227
  return [
20219
20228
  `# ${entry.name}`,
20220
20229
  "",
@@ -20355,7 +20364,7 @@ function toSnake6(name) {
20355
20364
  return name.trim().replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "").toLowerCase();
20356
20365
  }
20357
20366
  function renderMarkerBody(entry) {
20358
- const repoPath = path12.join(WORKSPACE_REPOS_DIR, entry.name);
20367
+ const repoPath = path13.join(WORKSPACE_REPOS_DIR, entry.name);
20359
20368
  return [
20360
20369
  `# ${entry.name}`,
20361
20370
  "",
@@ -20406,7 +20415,7 @@ async function readShardSpecAndErrors(folderPath) {
20406
20415
  return { shardSpec: snapshot?.["shard-spec"] ?? null, errors };
20407
20416
  }
20408
20417
  async function listDevLocalFolders(flintPath) {
20409
- const shardsDir = path13.join(flintPath, SHARDS_DIR);
20418
+ const shardsDir = path14.join(flintPath, SHARDS_DIR);
20410
20419
  let entries;
20411
20420
  try {
20412
20421
  entries = await fs10.readdir(shardsDir, { withFileTypes: true });
@@ -20426,9 +20435,9 @@ async function listDevLocalFolders(flintPath) {
20426
20435
  }
20427
20436
  async function healScaffolding(folderPath, entry) {
20428
20437
  for (const sub of SHARD_SPEC_DIRS_SOURCE) {
20429
- await fs10.mkdir(path13.join(folderPath, sub), { recursive: true });
20438
+ await fs10.mkdir(path14.join(folderPath, sub), { recursive: true });
20430
20439
  }
20431
- const yamlPath = path13.join(folderPath, "shard.yaml");
20440
+ const yamlPath = path14.join(folderPath, "shard.yaml");
20432
20441
  if (!await fileExists22(yamlPath)) {
20433
20442
  const stub = `shard-spec: "0.2.0"
20434
20443
  version: "0.1.0"
@@ -20438,16 +20447,16 @@ description: ""
20438
20447
  `;
20439
20448
  await fs10.writeFile(yamlPath, stub, "utf-8");
20440
20449
  }
20441
- const readmePath = path13.join(folderPath, "README.md");
20450
+ const readmePath = path14.join(folderPath, "README.md");
20442
20451
  if (!await fileExists22(readmePath)) {
20443
20452
  await fs10.writeFile(readmePath, `# ${entry.name}
20444
20453
  `, "utf-8");
20445
20454
  }
20446
- const releasePath = path13.join(folderPath, "RELEASE.md");
20455
+ const releasePath = path14.join(folderPath, "RELEASE.md");
20447
20456
  if (!await fileExists22(releasePath)) {
20448
20457
  await fs10.writeFile(releasePath, "# 0.1.0\n\n- Initial shard scaffold\n", "utf-8");
20449
20458
  }
20450
- const migrationsPath = path13.join(folderPath, "MIGRATIONS.md");
20459
+ const migrationsPath = path14.join(folderPath, "MIGRATIONS.md");
20451
20460
  if (!await fileExists22(migrationsPath)) {
20452
20461
  await fs10.writeFile(
20453
20462
  migrationsPath,
@@ -20490,7 +20499,7 @@ async function readShardSpecAndErrors2(folderPath) {
20490
20499
  return { shardSpec: snapshot?.["shard-spec"] ?? null, errors };
20491
20500
  }
20492
20501
  async function listDevPrefixedFolders(flintPath, prefix) {
20493
- const shardsDir = path14.join(flintPath, SHARDS_DIR2);
20502
+ const shardsDir = path15.join(flintPath, SHARDS_DIR2);
20494
20503
  let entries;
20495
20504
  try {
20496
20505
  entries = await fs11.readdir(shardsDir, { withFileTypes: true });
@@ -20517,7 +20526,7 @@ async function cloneEntry(flintPath, entry) {
20517
20526
  }
20518
20527
  }
20519
20528
  async function findDevRemoteFolder(flintPath, kebabName) {
20520
- const shardsDir = path14.join(flintPath, SHARDS_DIR2);
20529
+ const shardsDir = path15.join(flintPath, SHARDS_DIR2);
20521
20530
  let entries;
20522
20531
  try {
20523
20532
  entries = await fs11.readdir(shardsDir, { withFileTypes: true });
@@ -20531,7 +20540,7 @@ async function findDevRemoteFolder(flintPath, kebabName) {
20531
20540
  const display = entry.name.slice("(Dev Remote) ".length);
20532
20541
  const displayKebab = display.replace(/[^A-Za-z0-9]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
20533
20542
  if (displayKebab === lowered) {
20534
- return path14.join(shardsDir, entry.name);
20543
+ return path15.join(shardsDir, entry.name);
20535
20544
  }
20536
20545
  }
20537
20546
  return null;
@@ -20575,11 +20584,11 @@ async function uninstallInstalledShard(flintPath, name) {
20575
20584
  }
20576
20585
  async function readSourceState(source, flintRoot) {
20577
20586
  if (!source) return { sourcePath: null, sourceMissing: false, sourceVersion: null };
20578
- const isExternalLocal = source.startsWith("./") || source.startsWith("../") || path15.isAbsolute(source);
20587
+ const isExternalLocal = source.startsWith("./") || source.startsWith("../") || path16.isAbsolute(source);
20579
20588
  if (!isExternalLocal) {
20580
20589
  return { sourcePath: null, sourceMissing: false, sourceVersion: null };
20581
20590
  }
20582
- const sourcePath = path15.isAbsolute(source) ? source : path15.resolve(flintRoot, source);
20591
+ const sourcePath = path16.isAbsolute(source) ? source : path16.resolve(flintRoot, source);
20583
20592
  const exists32 = await directoryExists2(sourcePath);
20584
20593
  if (!exists32) {
20585
20594
  return { sourcePath, sourceMissing: true, sourceVersion: null };
@@ -20616,7 +20625,7 @@ function driftOf6(payload) {
20616
20625
  return { feature: INSTALLED_SHARDS_FEATURE_ID, kind: payload.kind, payload };
20617
20626
  }
20618
20627
  async function collectManifests(flintPath) {
20619
- const shardsDir = path16.join(flintPath, SHARDS_DIR4);
20628
+ const shardsDir = path17.join(flintPath, SHARDS_DIR4);
20620
20629
  let entries;
20621
20630
  try {
20622
20631
  entries = await fs13.readdir(shardsDir, { withFileTypes: true });
@@ -20627,7 +20636,7 @@ async function collectManifests(flintPath) {
20627
20636
  for (const entry of entries) {
20628
20637
  if (!entry.isDirectory()) continue;
20629
20638
  if (entry.name.startsWith("(Shards)")) continue;
20630
- const folderPath = path16.join(shardsDir, entry.name);
20639
+ const folderPath = path17.join(shardsDir, entry.name);
20631
20640
  const read = await readShardManifest(folderPath).catch(() => null);
20632
20641
  const manifest = read?.manifest ?? await readShardManifestSnapshot(folderPath).catch(() => null);
20633
20642
  if (!manifest) continue;
@@ -20651,7 +20660,7 @@ function driftOf7(payload) {
20651
20660
  return { feature: FLINT_BUNDLES_FEATURE_ID, kind: payload.kind, payload };
20652
20661
  }
20653
20662
  function renderBody7(args) {
20654
- const repoPath = path17.join(FLINT_BUNDLES_DIR, args.bundleName);
20663
+ const repoPath = path18.join(FLINT_BUNDLES_DIR, args.bundleName);
20655
20664
  return [
20656
20665
  `# ${args.bundleName}`,
20657
20666
  "",
@@ -20674,8 +20683,8 @@ async function copyDir3(src, dst) {
20674
20683
  await fs14.mkdir(dst, { recursive: true });
20675
20684
  const entries = await fs14.readdir(src, { withFileTypes: true });
20676
20685
  for (const entry of entries) {
20677
- const s = path17.join(src, entry.name);
20678
- const d = path17.join(dst, entry.name);
20686
+ const s = path18.join(src, entry.name);
20687
+ const d = path18.join(dst, entry.name);
20679
20688
  if (entry.isDirectory()) await copyDir3(s, d);
20680
20689
  else if (entry.isFile()) await fs14.copyFile(s, d);
20681
20690
  }
@@ -20692,7 +20701,7 @@ function partitionIntent11(world) {
20692
20701
  });
20693
20702
  }
20694
20703
  function renderBody8(entry) {
20695
- const repoPath = path18.join(SOURCE_REPOS_DIR, entry.name);
20704
+ const repoPath = path19.join(SOURCE_REPOS_DIR, entry.name);
20696
20705
  return [
20697
20706
  `# ${entry.name}`,
20698
20707
  "",
@@ -20832,7 +20841,7 @@ var init_dist4 = __esm({
20832
20841
  execAsync4 = promisify52(exec4);
20833
20842
  __dirname2 = dirname42(fileURLToPath2(import.meta.url));
20834
20843
  presetsCache = null;
20835
- PROMPTS_BASE_PATH = resolvePackageBasePath("@nuucognition/flint", import.meta.url);
20844
+ PROMPTS_BASE_PATH = resolvePromptsBasePath();
20836
20845
  IntentFrameSchema = external_exports.object({
20837
20846
  flint: external_exports.object({
20838
20847
  name: external_exports.string(),
@@ -20856,7 +20865,7 @@ var init_dist4 = __esm({
20856
20865
  EMPTY_INTENT = { flint: { name: "" } };
20857
20866
  EMPTY_ENTITY = {};
20858
20867
  IDENTITY_FEATURE_ID = "identity";
20859
- IDENTITY_MARKERS_DIR = path6.join("Mesh", "Metadata", "Constitutive", "Identity");
20868
+ IDENTITY_MARKERS_DIR = path7.join("Mesh", "Metadata", "Constitutive", "Identity");
20860
20869
  identity2 = {
20861
20870
  id: IDENTITY_FEATURE_ID,
20862
20871
  healStrategy: { unidentified: "auto", unnamed: "block" },
@@ -20929,7 +20938,7 @@ var init_dist4 = __esm({
20929
20938
  };
20930
20939
  BUNDLE_EXPORTS_FEATURE_ID = "bundle-exports";
20931
20940
  BUNDLE_EXPORTS_DIR = "Exports";
20932
- BUNDLE_EXPORTS_MARKERS_DIR = path7.join(
20941
+ BUNDLE_EXPORTS_MARKERS_DIR = path8.join(
20933
20942
  "Mesh",
20934
20943
  "Metadata",
20935
20944
  "Outputs",
@@ -20951,12 +20960,12 @@ var init_dist4 = __esm({
20951
20960
  return { malformedDeclarations: partitionIntent(world).malformed };
20952
20961
  },
20953
20962
  async readActual(world) {
20954
- const dir = path7.join(world.root, BUNDLE_EXPORTS_DIR);
20963
+ const dir = path8.join(world.root, BUNDLE_EXPORTS_DIR);
20955
20964
  try {
20956
20965
  const items = await fs72.readdir(dir, { withFileTypes: true });
20957
20966
  return items.filter((d) => d.isDirectory() && d.name.startsWith("(Bundle) ")).map((d) => ({
20958
20967
  name: d.name.slice("(Bundle) ".length),
20959
- path: path7.join(dir, d.name)
20968
+ path: path8.join(dir, d.name)
20960
20969
  }));
20961
20970
  } catch (err) {
20962
20971
  if (err.code === "ENOENT") return [];
@@ -20975,7 +20984,7 @@ var init_dist4 = __esm({
20975
20984
  payload: {
20976
20985
  kind: "missing",
20977
20986
  entry,
20978
- targetPath: path7.join(BUNDLE_EXPORTS_DIR, `(Bundle) ${entry.name}`)
20987
+ targetPath: path8.join(BUNDLE_EXPORTS_DIR, `(Bundle) ${entry.name}`)
20979
20988
  }
20980
20989
  });
20981
20990
  }
@@ -20988,7 +20997,7 @@ var init_dist4 = __esm({
20988
20997
  payload: {
20989
20998
  kind: "extra",
20990
20999
  bundleName: a.name,
20991
- targetPath: path7.join(BUNDLE_EXPORTS_DIR, `(Bundle) ${a.name}`)
21000
+ targetPath: path8.join(BUNDLE_EXPORTS_DIR, `(Bundle) ${a.name}`)
20992
21001
  }
20993
21002
  });
20994
21003
  }
@@ -21030,7 +21039,7 @@ var init_dist4 = __esm({
21030
21039
  }
21031
21040
  };
21032
21041
  CODEBASE_REFERENCES_FEATURE_ID = "codebase-references";
21033
- CODEBASE_REFERENCES_MARKERS_DIR = path8.join(
21042
+ CODEBASE_REFERENCES_MARKERS_DIR = path9.join(
21034
21043
  "Mesh",
21035
21044
  "Metadata",
21036
21045
  "References",
@@ -21100,7 +21109,7 @@ var init_dist4 = __esm({
21100
21109
  }
21101
21110
  };
21102
21111
  FLINT_BUNDLE_REFERENCES_FEATURE_ID = "flint-bundle-references";
21103
- FLINT_BUNDLE_REFERENCES_MARKERS_DIR = path9.join(
21112
+ FLINT_BUNDLE_REFERENCES_MARKERS_DIR = path10.join(
21104
21113
  "Mesh",
21105
21114
  "Metadata",
21106
21115
  "References",
@@ -21172,7 +21181,7 @@ var init_dist4 = __esm({
21172
21181
  `Cannot fulfill flint bundle reference "${payload.entry.name}": producing flint "${flint}" not found in ~/.nuucognition/flint/registry.json. Run \`flint register\` inside that flint.`
21173
21182
  );
21174
21183
  }
21175
- const bundlePath = path9.join(producer.path, "Exports", `(Bundle) ${bundle}`);
21184
+ const bundlePath = path10.join(producer.path, "Exports", `(Bundle) ${bundle}`);
21176
21185
  if (!await isDir(bundlePath)) {
21177
21186
  throw new Error(
21178
21187
  `Cannot fulfill flint bundle reference "${payload.entry.name}": producer flint "${flint}" has no export at ${bundlePath}. Run \`flint export bundle ${bundle}\` inside that flint.`
@@ -21200,7 +21209,7 @@ var init_dist4 = __esm({
21200
21209
  }
21201
21210
  };
21202
21211
  FLINT_REFERENCES_FEATURE_ID = "flint-references";
21203
- FLINT_REFERENCES_MARKERS_DIR = path10.join(
21212
+ FLINT_REFERENCES_MARKERS_DIR = path11.join(
21204
21213
  "Mesh",
21205
21214
  "Metadata",
21206
21215
  "References",
@@ -21285,7 +21294,7 @@ var init_dist4 = __esm({
21285
21294
  }
21286
21295
  };
21287
21296
  LATTICE_REFERENCES_FEATURE_ID = "lattice-references";
21288
- LATTICE_REFERENCES_MARKERS_DIR = path11.join(
21297
+ LATTICE_REFERENCES_MARKERS_DIR = path12.join(
21289
21298
  "Mesh",
21290
21299
  "Metadata",
21291
21300
  "References",
@@ -21356,8 +21365,8 @@ var init_dist4 = __esm({
21356
21365
  };
21357
21366
  execAsync5 = promisify62(exec5);
21358
21367
  WORKSPACE_REPOS_FEATURE_ID = "workspace-repos";
21359
- WORKSPACE_REPOS_DIR = path12.join("Workspace", "Repos");
21360
- WORKSPACE_REPOS_MARKERS_DIR = path12.join("Mesh", "Metadata", "Related", "Repos");
21368
+ WORKSPACE_REPOS_DIR = path13.join("Workspace", "Repos");
21369
+ WORKSPACE_REPOS_MARKERS_DIR = path13.join("Mesh", "Metadata", "Related", "Repos");
21361
21370
  WorkspaceRepoEntrySchema = external_exports.object({
21362
21371
  name: external_exports.string().min(1),
21363
21372
  url: external_exports.string().url()
@@ -21377,7 +21386,7 @@ var init_dist4 = __esm({
21377
21386
  return { malformedDeclarations: partitionIntent6(world).malformed };
21378
21387
  },
21379
21388
  async readActual(world) {
21380
- const dir = path12.join(world.root, WORKSPACE_REPOS_DIR);
21389
+ const dir = path13.join(world.root, WORKSPACE_REPOS_DIR);
21381
21390
  let entries;
21382
21391
  try {
21383
21392
  const items = await fs9.readdir(dir, { withFileTypes: true });
@@ -21388,7 +21397,7 @@ var init_dist4 = __esm({
21388
21397
  }
21389
21398
  const repos = [];
21390
21399
  for (const name of entries) {
21391
- const repoPath = path12.join(dir, name);
21400
+ const repoPath = path13.join(dir, name);
21392
21401
  const [originUrl, hasUncommittedChanges2] = await Promise.all([
21393
21402
  readOriginUrl(repoPath),
21394
21403
  readDirty(repoPath)
@@ -21408,7 +21417,7 @@ var init_dist4 = __esm({
21408
21417
  driftOf5({
21409
21418
  kind: "missing",
21410
21419
  entry,
21411
- targetPath: path12.join(WORKSPACE_REPOS_DIR, entry.name)
21420
+ targetPath: path13.join(WORKSPACE_REPOS_DIR, entry.name)
21412
21421
  })
21413
21422
  );
21414
21423
  continue;
@@ -21430,7 +21439,7 @@ var init_dist4 = __esm({
21430
21439
  driftOf5({
21431
21440
  kind: "extra",
21432
21441
  name: cloned.name,
21433
- targetPath: path12.join(WORKSPACE_REPOS_DIR, cloned.name)
21442
+ targetPath: path13.join(WORKSPACE_REPOS_DIR, cloned.name)
21434
21443
  })
21435
21444
  );
21436
21445
  }
@@ -21443,8 +21452,8 @@ var init_dist4 = __esm({
21443
21452
  async apply(drift, world) {
21444
21453
  const payload = drift.payload;
21445
21454
  if (payload.kind !== "missing") return [];
21446
- const target = path12.join(world.root, payload.targetPath);
21447
- await fs9.mkdir(path12.dirname(target), { recursive: true });
21455
+ const target = path13.join(world.root, payload.targetPath);
21456
+ await fs9.mkdir(path13.dirname(target), { recursive: true });
21448
21457
  await execAsync5(
21449
21458
  `git clone ${shellQuote(payload.entry.url)} ${shellQuote(target)}`
21450
21459
  );
@@ -21526,20 +21535,20 @@ var init_dist4 = __esm({
21526
21535
  const intent = partitionIntent7(world).valid;
21527
21536
  const declared = [];
21528
21537
  for (const entry of intent) {
21529
- const resolvedPath = path13.isAbsolute(entry.source) ? entry.source : path13.resolve(world.root, entry.source);
21538
+ const resolvedPath = path14.isAbsolute(entry.source) ? entry.source : path14.resolve(world.root, entry.source);
21530
21539
  const exists32 = await directoryExists(resolvedPath);
21531
- const hasManifest = exists32 ? await fileExists22(path13.join(resolvedPath, "shard.yaml")) : false;
21540
+ const hasManifest = exists32 ? await fileExists22(path14.join(resolvedPath, "shard.yaml")) : false;
21532
21541
  const { shardSpec, errors: manifestErrors } = hasManifest ? await readShardSpecAndErrors(resolvedPath) : { shardSpec: null, errors: [] };
21533
21542
  const missingDirs = [];
21534
21543
  const missingRootFiles = [];
21535
21544
  if (exists32) {
21536
21545
  for (const sub of SHARD_SPEC_DIRS_SOURCE) {
21537
- if (!await directoryExists(path13.join(resolvedPath, sub))) {
21546
+ if (!await directoryExists(path14.join(resolvedPath, sub))) {
21538
21547
  missingDirs.push(sub);
21539
21548
  }
21540
21549
  }
21541
21550
  for (const f of REQUIRED_ROOT_FILES) {
21542
- if (!await fileExists22(path13.join(resolvedPath, f))) {
21551
+ if (!await fileExists22(path14.join(resolvedPath, f))) {
21543
21552
  missingRootFiles.push(f);
21544
21553
  }
21545
21554
  }
@@ -21614,7 +21623,7 @@ var init_dist4 = __esm({
21614
21623
  payload: {
21615
21624
  kind: "orphan",
21616
21625
  name: folderName,
21617
- folderPath: path13.join(SHARDS_DIR, folderName)
21626
+ folderPath: path14.join(SHARDS_DIR, folderName)
21618
21627
  }
21619
21628
  });
21620
21629
  }
@@ -21654,7 +21663,7 @@ var init_dist4 = __esm({
21654
21663
  declared.push({ name: entry.name, folderPath: null, hasManifest: false, shardSpec: null, manifestErrors: [] });
21655
21664
  continue;
21656
21665
  }
21657
- const hasManifest = await fileExists3(path14.join(folderPath, "shard.yaml"));
21666
+ const hasManifest = await fileExists3(path15.join(folderPath, "shard.yaml"));
21658
21667
  const { shardSpec, errors: manifestErrors } = hasManifest ? await readShardSpecAndErrors2(folderPath) : { shardSpec: null, errors: [] };
21659
21668
  declared.push({ name: entry.name, folderPath, hasManifest, shardSpec, manifestErrors });
21660
21669
  }
@@ -21716,7 +21725,7 @@ var init_dist4 = __esm({
21716
21725
  payload: {
21717
21726
  kind: "orphan",
21718
21727
  name: folderName,
21719
- folderPath: path14.join(SHARDS_DIR2, folderName)
21728
+ folderPath: path15.join(SHARDS_DIR2, folderName)
21720
21729
  }
21721
21730
  });
21722
21731
  }
@@ -21754,13 +21763,13 @@ var init_dist4 = __esm({
21754
21763
  const intent = partitionIntent9(world).valid;
21755
21764
  const onDiskNames = [];
21756
21765
  const byKebab = /* @__PURE__ */ new Map();
21757
- const shardsDir = path15.join(world.root, SHARDS_DIR3);
21766
+ const shardsDir = path16.join(world.root, SHARDS_DIR3);
21758
21767
  try {
21759
21768
  const entries = await fs12.readdir(shardsDir, { withFileTypes: true });
21760
21769
  for (const entry of entries) {
21761
21770
  if (!entry.isDirectory()) continue;
21762
21771
  if (!isInstalledShapedFolder(entry.name)) continue;
21763
- const yaml = path15.join(shardsDir, entry.name, "shard.yaml");
21772
+ const yaml = path16.join(shardsDir, entry.name, "shard.yaml");
21764
21773
  if (!await fileExists4(yaml)) continue;
21765
21774
  onDiskNames.push(entry.name);
21766
21775
  byKebab.set(folderToKebab(entry.name), entry.name);
@@ -21777,7 +21786,7 @@ var init_dist4 = __esm({
21777
21786
  if (!folderName) {
21778
21787
  installed.push({
21779
21788
  name: entry.name,
21780
- folderPath: path15.join(shardsDir, entry.name),
21789
+ folderPath: path16.join(shardsDir, entry.name),
21781
21790
  manifestVersion: null,
21782
21791
  recordedVersion: null,
21783
21792
  manifestErrors: [],
@@ -21787,7 +21796,7 @@ var init_dist4 = __esm({
21787
21796
  });
21788
21797
  continue;
21789
21798
  }
21790
- const folderPath = path15.join(shardsDir, folderName);
21799
+ const folderPath = path16.join(shardsDir, folderName);
21791
21800
  const manifestRead = await readShardManifest(folderPath).catch(() => null);
21792
21801
  const manifestSnap = manifestRead?.manifest ?? await readShardManifestSnapshot(folderPath).catch(() => null);
21793
21802
  const manifestVersion = manifestSnap?.version ?? null;
@@ -21823,7 +21832,7 @@ var init_dist4 = __esm({
21823
21832
  driftOf6({
21824
21833
  kind: "not-installed",
21825
21834
  entry,
21826
- targetPath: path15.join(SHARDS_DIR3, entry.name)
21835
+ targetPath: path16.join(SHARDS_DIR3, entry.name)
21827
21836
  })
21828
21837
  );
21829
21838
  continue;
@@ -21868,7 +21877,7 @@ var init_dist4 = __esm({
21868
21877
  driftOf6({
21869
21878
  kind: "orphan",
21870
21879
  name: folderName,
21871
- folderPath: path15.join(SHARDS_DIR3, folderName)
21880
+ folderPath: path16.join(SHARDS_DIR3, folderName)
21872
21881
  })
21873
21882
  );
21874
21883
  }
@@ -21922,8 +21931,8 @@ var init_dist4 = __esm({
21922
21931
  }
21923
21932
  };
21924
21933
  FLINT_BUNDLES_FEATURE_ID = "flint-bundles";
21925
- FLINT_BUNDLES_DIR = path17.join("Sources", "Bundles");
21926
- FLINT_BUNDLES_MARKERS_DIR = path17.join(
21934
+ FLINT_BUNDLES_DIR = path18.join("Sources", "Bundles");
21935
+ FLINT_BUNDLES_MARKERS_DIR = path18.join(
21927
21936
  "Mesh",
21928
21937
  "Metadata",
21929
21938
  "Sources",
@@ -21950,10 +21959,10 @@ var init_dist4 = __esm({
21950
21959
  return { malformedDeclarations: partitionIntent10(world).malformed };
21951
21960
  },
21952
21961
  async readActual(world) {
21953
- const dir = path17.join(world.root, FLINT_BUNDLES_DIR);
21962
+ const dir = path18.join(world.root, FLINT_BUNDLES_DIR);
21954
21963
  try {
21955
21964
  const items = await fs14.readdir(dir, { withFileTypes: true });
21956
- return items.filter((d) => d.isDirectory()).map((d) => ({ name: d.name, path: path17.join(dir, d.name) }));
21965
+ return items.filter((d) => d.isDirectory()).map((d) => ({ name: d.name, path: path18.join(dir, d.name) }));
21957
21966
  } catch (err) {
21958
21967
  if (err.code === "ENOENT") return [];
21959
21968
  throw err;
@@ -21970,7 +21979,7 @@ var init_dist4 = __esm({
21970
21979
  driftOf7({
21971
21980
  kind: "missing",
21972
21981
  entry,
21973
- targetPath: path17.join(FLINT_BUNDLES_DIR, bundle)
21982
+ targetPath: path18.join(FLINT_BUNDLES_DIR, bundle)
21974
21983
  })
21975
21984
  );
21976
21985
  }
@@ -21981,7 +21990,7 @@ var init_dist4 = __esm({
21981
21990
  driftOf7({
21982
21991
  kind: "extra",
21983
21992
  bundleName: a.name,
21984
- targetPath: path17.join(FLINT_BUNDLES_DIR, a.name)
21993
+ targetPath: path18.join(FLINT_BUNDLES_DIR, a.name)
21985
21994
  })
21986
21995
  );
21987
21996
  }
@@ -21998,15 +22007,15 @@ var init_dist4 = __esm({
21998
22007
  `Cannot import bundle "${payload.entry.name}": producing flint "${flint}" not found in ~/.nuucognition/flint/registry.json. Run \`flint register\` inside that flint.`
21999
22008
  );
22000
22009
  }
22001
- const sourceDir = path17.join(producer.path, "Exports", `(Bundle) ${bundle}`);
22010
+ const sourceDir = path18.join(producer.path, "Exports", `(Bundle) ${bundle}`);
22002
22011
  if (!await isDir2(sourceDir)) {
22003
22012
  throw new Error(
22004
22013
  `Cannot import bundle "${payload.entry.name}": producer flint "${flint}" has no export at ${sourceDir}. Run \`flint export bundle ${bundle}\` inside that flint.`
22005
22014
  );
22006
22015
  }
22007
- const targetDir = path17.join(world.root, payload.targetPath);
22016
+ const targetDir = path18.join(world.root, payload.targetPath);
22008
22017
  await fs14.rm(targetDir, { recursive: true, force: true });
22009
- await fs14.mkdir(path17.dirname(targetDir), { recursive: true });
22018
+ await fs14.mkdir(path18.dirname(targetDir), { recursive: true });
22010
22019
  await copyDir3(sourceDir, targetDir);
22011
22020
  return [];
22012
22021
  },
@@ -22026,8 +22035,8 @@ var init_dist4 = __esm({
22026
22035
  };
22027
22036
  execAsync6 = promisify72(exec6);
22028
22037
  SOURCE_REPOS_FEATURE_ID = "source-repos";
22029
- SOURCE_REPOS_DIR = path18.join("Sources", "Repos");
22030
- SOURCE_REPOS_MARKERS_DIR = path18.join("Mesh", "Metadata", "Sources", "Repos");
22038
+ SOURCE_REPOS_DIR = path19.join("Sources", "Repos");
22039
+ SOURCE_REPOS_MARKERS_DIR = path19.join("Mesh", "Metadata", "Sources", "Repos");
22031
22040
  SourceRepoEntrySchema = external_exports.object({
22032
22041
  name: external_exports.string().min(1),
22033
22042
  url: external_exports.string().url()
@@ -22042,10 +22051,10 @@ var init_dist4 = __esm({
22042
22051
  return { malformedDeclarations: partitionIntent11(world).malformed };
22043
22052
  },
22044
22053
  async readActual(world) {
22045
- const dir = path18.join(world.root, SOURCE_REPOS_DIR);
22054
+ const dir = path19.join(world.root, SOURCE_REPOS_DIR);
22046
22055
  try {
22047
22056
  const items = await fs15.readdir(dir, { withFileTypes: true });
22048
- return items.filter((d) => d.isDirectory()).map((d) => ({ name: d.name, path: path18.join(dir, d.name) }));
22057
+ return items.filter((d) => d.isDirectory()).map((d) => ({ name: d.name, path: path19.join(dir, d.name) }));
22049
22058
  } catch (err) {
22050
22059
  if (err.code === "ENOENT") return [];
22051
22060
  throw err;
@@ -22063,7 +22072,7 @@ var init_dist4 = __esm({
22063
22072
  payload: {
22064
22073
  kind: "missing",
22065
22074
  entry,
22066
- targetPath: path18.join(SOURCE_REPOS_DIR, entry.name)
22075
+ targetPath: path19.join(SOURCE_REPOS_DIR, entry.name)
22067
22076
  }
22068
22077
  });
22069
22078
  }
@@ -22076,7 +22085,7 @@ var init_dist4 = __esm({
22076
22085
  payload: {
22077
22086
  kind: "extra",
22078
22087
  name: repo.name,
22079
- targetPath: path18.join(SOURCE_REPOS_DIR, repo.name)
22088
+ targetPath: path19.join(SOURCE_REPOS_DIR, repo.name)
22080
22089
  }
22081
22090
  });
22082
22091
  }
@@ -22086,12 +22095,12 @@ var init_dist4 = __esm({
22086
22095
  async apply(drift, world) {
22087
22096
  const payload = drift.payload;
22088
22097
  if (payload.kind !== "missing") return [];
22089
- const target = path18.join(world.root, payload.targetPath);
22090
- await fs15.mkdir(path18.dirname(target), { recursive: true });
22098
+ const target = path19.join(world.root, payload.targetPath);
22099
+ await fs15.mkdir(path19.dirname(target), { recursive: true });
22091
22100
  await execAsync6(
22092
22101
  `git clone --depth 1 ${shellQuote2(payload.entry.url)} ${shellQuote2(target)}`
22093
22102
  );
22094
- await fs15.rm(path18.join(target, ".git"), { recursive: true, force: true });
22103
+ await fs15.rm(path19.join(target, ".git"), { recursive: true, force: true });
22095
22104
  return [];
22096
22105
  },
22097
22106
  markers(intent) {
@@ -69672,15 +69681,15 @@ var require_route2 = __commonJS({
69672
69681
  };
69673
69682
  }
69674
69683
  function wrapConversion(toModel, graph) {
69675
- const path29 = [graph[toModel].parent, toModel];
69684
+ const path30 = [graph[toModel].parent, toModel];
69676
69685
  let fn = conversions[graph[toModel].parent][toModel];
69677
69686
  let cur = graph[toModel].parent;
69678
69687
  while (graph[cur].parent) {
69679
- path29.unshift(graph[cur].parent);
69688
+ path30.unshift(graph[cur].parent);
69680
69689
  fn = link5(conversions[graph[cur].parent][cur], fn);
69681
69690
  cur = graph[cur].parent;
69682
69691
  }
69683
- fn.conversion = path29;
69692
+ fn.conversion = path30;
69684
69693
  return fn;
69685
69694
  }
69686
69695
  module.exports = function(fromModel) {
@@ -83379,7 +83388,7 @@ var require_brace_expansion = __commonJS({
83379
83388
 
83380
83389
  // src/index.ts
83381
83390
  import { readFileSync as readFileSync18 } from "fs";
83382
- import { fileURLToPath as fileURLToPath7 } from "url";
83391
+ import { fileURLToPath as fileURLToPath8 } from "url";
83383
83392
  import { dirname as dirname13, join as join49 } from "path";
83384
83393
 
83385
83394
  // ../../../main/packages/cli-core/dist/index.js
@@ -84463,7 +84472,7 @@ var require_command = __commonJS2({
84463
84472
  "use strict";
84464
84473
  var EventEmitter3 = __require2("events").EventEmitter;
84465
84474
  var childProcess2 = __require2("child_process");
84466
- var path29 = __require2("path");
84475
+ var path210 = __require2("path");
84467
84476
  var fs62 = __require2("fs");
84468
84477
  var process112 = __require2("process");
84469
84478
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -85396,9 +85405,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
85396
85405
  let launchWithNode = false;
85397
85406
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
85398
85407
  function findFile(baseDir, baseName) {
85399
- const localBin = path29.resolve(baseDir, baseName);
85408
+ const localBin = path210.resolve(baseDir, baseName);
85400
85409
  if (fs62.existsSync(localBin)) return localBin;
85401
- if (sourceExt.includes(path29.extname(baseName))) return void 0;
85410
+ if (sourceExt.includes(path210.extname(baseName))) return void 0;
85402
85411
  const foundExt = sourceExt.find(
85403
85412
  (ext2) => fs62.existsSync(`${localBin}${ext2}`)
85404
85413
  );
@@ -85416,17 +85425,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
85416
85425
  } catch (err) {
85417
85426
  resolvedScriptPath = this._scriptPath;
85418
85427
  }
85419
- executableDir = path29.resolve(
85420
- path29.dirname(resolvedScriptPath),
85428
+ executableDir = path210.resolve(
85429
+ path210.dirname(resolvedScriptPath),
85421
85430
  executableDir
85422
85431
  );
85423
85432
  }
85424
85433
  if (executableDir) {
85425
85434
  let localFile = findFile(executableDir, executableFile);
85426
85435
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
85427
- const legacyName = path29.basename(
85436
+ const legacyName = path210.basename(
85428
85437
  this._scriptPath,
85429
- path29.extname(this._scriptPath)
85438
+ path210.extname(this._scriptPath)
85430
85439
  );
85431
85440
  if (legacyName !== this._name) {
85432
85441
  localFile = findFile(
@@ -85437,7 +85446,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
85437
85446
  }
85438
85447
  executableFile = localFile || executableFile;
85439
85448
  }
85440
- launchWithNode = sourceExt.includes(path29.extname(executableFile));
85449
+ launchWithNode = sourceExt.includes(path210.extname(executableFile));
85441
85450
  let proc;
85442
85451
  if (process112.platform !== "win32") {
85443
85452
  if (launchWithNode) {
@@ -86277,7 +86286,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
86277
86286
  * @return {Command}
86278
86287
  */
86279
86288
  nameFromFilename(filename) {
86280
- this._name = path29.basename(filename, path29.extname(filename));
86289
+ this._name = path210.basename(filename, path210.extname(filename));
86281
86290
  return this;
86282
86291
  }
86283
86292
  /**
@@ -129343,15 +129352,15 @@ var require_route = __commonJS2({
129343
129352
  };
129344
129353
  }
129345
129354
  function wrapConversion(toModel, graph) {
129346
- const path29 = [graph[toModel].parent, toModel];
129355
+ const path210 = [graph[toModel].parent, toModel];
129347
129356
  let fn = conversions[graph[toModel].parent][toModel];
129348
129357
  let cur = graph[toModel].parent;
129349
129358
  while (graph[cur].parent) {
129350
- path29.unshift(graph[cur].parent);
129359
+ path210.unshift(graph[cur].parent);
129351
129360
  fn = link32(conversions[graph[cur].parent][cur], fn);
129352
129361
  cur = graph[cur].parent;
129353
129362
  }
129354
- fn.conversion = path29;
129363
+ fn.conversion = path210;
129355
129364
  return fn;
129356
129365
  }
129357
129366
  module.exports = function(fromModel) {
@@ -150191,10 +150200,10 @@ async function loadAuth(env22 = "prod") {
150191
150200
  }
150192
150201
  function loadAuthSync(env22 = "prod") {
150193
150202
  ensureNuuDirSync();
150194
- const path29 = authPath(env22);
150195
- if (!existsSync(path29)) return null;
150203
+ const path210 = authPath(env22);
150204
+ if (!existsSync(path210)) return null;
150196
150205
  try {
150197
- return normalizeCredentials(JSON.parse(readFileSync(path29, "utf-8")));
150206
+ return normalizeCredentials(JSON.parse(readFileSync(path210, "utf-8")));
150198
150207
  } catch (error22) {
150199
150208
  if (error22.code === "ENOENT") {
150200
150209
  return null;
@@ -151284,9 +151293,9 @@ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
151284
151293
  return str + "\n";
151285
151294
  return str;
151286
151295
  }
151287
- async function readConfigFile(path29) {
151296
+ async function readConfigFile(path210) {
151288
151297
  try {
151289
- const content = await fsReadFile(path29, "utf-8");
151298
+ const content = await fsReadFile(path210, "utf-8");
151290
151299
  return parse(content);
151291
151300
  } catch (error22) {
151292
151301
  if (error22.code === "ENOENT") {
@@ -151295,9 +151304,9 @@ async function readConfigFile(path29) {
151295
151304
  throw error22;
151296
151305
  }
151297
151306
  }
151298
- function readConfigFileSync(path29) {
151307
+ function readConfigFileSync(path210) {
151299
151308
  try {
151300
- const content = fsReadFileSync(path29, "utf-8");
151309
+ const content = fsReadFileSync(path210, "utf-8");
151301
151310
  return parse(content);
151302
151311
  } catch (error22) {
151303
151312
  if (error22.code === "ENOENT") {
@@ -151306,15 +151315,15 @@ function readConfigFileSync(path29) {
151306
151315
  throw error22;
151307
151316
  }
151308
151317
  }
151309
- async function writeConfigFile(path29, data) {
151310
- await mkdir3(dirname2(path29), { recursive: true });
151311
- await fsWriteFile(path29, `${stringify(data)}
151318
+ async function writeConfigFile(path210, data) {
151319
+ await mkdir3(dirname2(path210), { recursive: true });
151320
+ await fsWriteFile(path210, `${stringify(data)}
151312
151321
  `, "utf-8");
151313
151322
  }
151314
- async function setConfigField(path29, key, value) {
151315
- const existing = await readConfigFile(path29) ?? {};
151323
+ async function setConfigField(path210, key, value) {
151324
+ const existing = await readConfigFile(path210) ?? {};
151316
151325
  existing[key] = value;
151317
- await writeConfigFile(path29, existing);
151326
+ await writeConfigFile(path210, existing);
151318
151327
  }
151319
151328
  var CONFIG_FILENAME = "config.toml";
151320
151329
  function getConfigDir(cliname, profile2) {
@@ -155730,9 +155739,9 @@ function compareVersions(left, right) {
155730
155739
  function sortMigrations(migrations3) {
155731
155740
  return [...migrations3].sort((left, right) => compareVersions(left.version, right.version));
155732
155741
  }
155733
- async function readMigrationState(path29) {
155742
+ async function readMigrationState(path210) {
155734
155743
  try {
155735
- const content = await readFile3(path29, "utf-8");
155744
+ const content = await readFile3(path210, "utf-8");
155736
155745
  return JSON.parse(content);
155737
155746
  } catch (error22) {
155738
155747
  if (error22.code === "ENOENT") {
@@ -155741,9 +155750,9 @@ async function readMigrationState(path29) {
155741
155750
  throw error22;
155742
155751
  }
155743
155752
  }
155744
- async function writeMigrationState(path29, state) {
155745
- await mkdir4(dirname3(path29), { recursive: true });
155746
- await writeFile3(path29, `${JSON.stringify(state, null, 2)}
155753
+ async function writeMigrationState(path210, state) {
155754
+ await mkdir4(dirname3(path210), { recursive: true });
155755
+ await writeFile3(path210, `${JSON.stringify(state, null, 2)}
155747
155756
  `, "utf-8");
155748
155757
  }
155749
155758
  async function backupAppDir(cliname, appDir, currentVersion, nextVersion) {
@@ -156134,25 +156143,25 @@ import { promisify as promisify9 } from "util";
156134
156143
  import { homedir as homedir4 } from "os";
156135
156144
  import { access as access6 } from "fs/promises";
156136
156145
  import { createInterface } from "readline";
156137
- function abbreviatePath(path29) {
156146
+ function abbreviatePath(path30) {
156138
156147
  const home = homedir4();
156139
- if (path29.startsWith(home)) {
156140
- return path29.replace(home, "~");
156148
+ if (path30.startsWith(home)) {
156149
+ return path30.replace(home, "~");
156141
156150
  }
156142
- return path29;
156151
+ return path30;
156143
156152
  }
156144
- function expandPath(path29) {
156145
- if (path29.startsWith("~/")) {
156146
- return path29.replace("~", homedir4());
156153
+ function expandPath(path30) {
156154
+ if (path30.startsWith("~/")) {
156155
+ return path30.replace("~", homedir4());
156147
156156
  }
156148
- return path29;
156157
+ return path30;
156149
156158
  }
156150
156159
  function padEnd(str, length) {
156151
156160
  return str.padEnd(length);
156152
156161
  }
156153
- async function checkPathExists(path29) {
156162
+ async function checkPathExists(path30) {
156154
156163
  try {
156155
- await access6(path29);
156164
+ await access6(path30);
156156
156165
  return true;
156157
156166
  } catch {
156158
156167
  return false;
@@ -156476,12 +156485,12 @@ function resolvePath2(flint, fullPath) {
156476
156485
  }
156477
156486
  function printFlint(flint, opts) {
156478
156487
  const { nameColWidth, showStatus, fullPath, indent = " " } = opts;
156479
- const path29 = resolvePath2(flint, fullPath);
156488
+ const path30 = resolvePath2(flint, fullPath);
156480
156489
  const isBroken = showStatus && !flint.valid;
156481
156490
  const tags = formatTags(flint.tags);
156482
156491
  const nameCell = tags ? `${export_pc.bold(flint.name)} ${tags}` : export_pc.bold(flint.name);
156483
156492
  const status = showStatus ? statusBadge(flint) + " " : "";
156484
- const pathColor = isBroken ? export_pc.red(path29) : export_pc.dim(path29);
156493
+ const pathColor = isBroken ? export_pc.red(path30) : export_pc.dim(path30);
156485
156494
  console.log(`${indent}${pad(nameCell, nameColWidth)}${status}${pathColor}`);
156486
156495
  if (flint.description) {
156487
156496
  console.log(`${indent} ${export_pc.dim(truncate2(flint.description, 65))}`);
@@ -156489,10 +156498,10 @@ function printFlint(flint, opts) {
156489
156498
  }
156490
156499
  function printGroupRow(flint, opts) {
156491
156500
  const { nameColWidth, showStatus, fullPath } = opts;
156492
- const path29 = resolvePath2(flint, fullPath);
156501
+ const path30 = resolvePath2(flint, fullPath);
156493
156502
  const isBroken = showStatus && !flint.valid;
156494
156503
  const status = showStatus ? statusBadge(flint) + " " : "";
156495
- const pathColor = isBroken ? export_pc.red(path29) : export_pc.dim(path29);
156504
+ const pathColor = isBroken ? export_pc.red(path30) : export_pc.dim(path30);
156496
156505
  console.log(` ${pad(flint.name, nameColWidth)}${status}${pathColor}`);
156497
156506
  }
156498
156507
  function measureNameCol(flints) {
@@ -156748,17 +156757,17 @@ import { promisify as promisify10 } from "util";
156748
156757
  import { resolve as resolve9 } from "path";
156749
156758
  import { platform as platform5 } from "os";
156750
156759
  var execAsync8 = promisify10(exec8);
156751
- async function openInObsidian(path29) {
156760
+ async function openInObsidian(path30) {
156752
156761
  const os7 = platform5();
156753
156762
  if (os7 === "darwin") {
156754
- await execAsync8(`open -a "Obsidian" "${path29}"`);
156763
+ await execAsync8(`open -a "Obsidian" "${path30}"`);
156755
156764
  } else if (os7 === "win32") {
156756
- await execAsync8(`start "" "${path29}"`);
156765
+ await execAsync8(`start "" "${path30}"`);
156757
156766
  } else {
156758
156767
  try {
156759
- await execAsync8(`obsidian "${path29}"`);
156768
+ await execAsync8(`obsidian "${path30}"`);
156760
156769
  } catch {
156761
- await execAsync8(`xdg-open "${path29}"`);
156770
+ await execAsync8(`xdg-open "${path30}"`);
156762
156771
  }
156763
156772
  }
156764
156773
  }
@@ -158187,11 +158196,11 @@ var resolveCommand = new Command("resolve").description("Resolve a reference to
158187
158196
  // src/commands/references/lattice.ts
158188
158197
  init_dist4();
158189
158198
  import fs16 from "fs";
158190
- import path19 from "path";
158199
+ import path20 from "path";
158191
158200
  import crypto2 from "crypto";
158192
158201
  import { spawn as spawn4 } from "child_process";
158193
158202
  function getRegistryPath() {
158194
- return path19.join(getConfigDir("lattice"), "registry.json");
158203
+ return path20.join(getConfigDir("lattice"), "registry.json");
158195
158204
  }
158196
158205
  function readRegistry() {
158197
158206
  const registryPath = getRegistryPath();
@@ -158205,7 +158214,7 @@ function resolveLattice(name) {
158205
158214
  return entry;
158206
158215
  }
158207
158216
  function readPinsToml(latticeRoot) {
158208
- const pinsPath = path19.join(latticeRoot, "pins.toml");
158217
+ const pinsPath = path20.join(latticeRoot, "pins.toml");
158209
158218
  if (!fs16.existsSync(pinsPath)) return [];
158210
158219
  const content = fs16.readFileSync(pinsPath, "utf-8");
158211
158220
  const records = [];
@@ -158220,7 +158229,7 @@ function readPinsToml(latticeRoot) {
158220
158229
  return records;
158221
158230
  }
158222
158231
  function addToPinsToml(latticeRoot, id, title) {
158223
- const pinsPath = path19.join(latticeRoot, "pins.toml");
158232
+ const pinsPath = path20.join(latticeRoot, "pins.toml");
158224
158233
  const existing = readPinsToml(latticeRoot);
158225
158234
  if (existing.some((p) => p.id === id)) return false;
158226
158235
  existing.push({ id, title });
@@ -158233,7 +158242,7 @@ ${records}
158233
158242
  return true;
158234
158243
  }
158235
158244
  function removeFromPinsToml(latticeRoot, id) {
158236
- const pinsPath = path19.join(latticeRoot, "pins.toml");
158245
+ const pinsPath = path20.join(latticeRoot, "pins.toml");
158237
158246
  const existing = readPinsToml(latticeRoot);
158238
158247
  const pin = existing.find((p) => p.id === id);
158239
158248
  if (!pin) return null;
@@ -158253,10 +158262,10 @@ ${records}
158253
158262
  return pin;
158254
158263
  }
158255
158264
  function generateBaseContextFile(flintRoot, latticeName, lang, sourcePath) {
158256
- const latticeDir = path19.join(flintRoot, "Mesh", "Lattice", latticeName);
158257
- const pinsDir = path19.join(latticeDir, "Pins");
158265
+ const latticeDir = path20.join(flintRoot, "Mesh", "Lattice", latticeName);
158266
+ const pinsDir = path20.join(latticeDir, "Pins");
158258
158267
  fs16.mkdirSync(pinsDir, { recursive: true });
158259
- const contextPath = path19.join(latticeDir, `(Lattice) ${latticeName}.md`);
158268
+ const contextPath = path20.join(latticeDir, `(Lattice) ${latticeName}.md`);
158260
158269
  if (fs16.existsSync(contextPath)) return;
158261
158270
  const id = crypto2.randomUUID();
158262
158271
  const content = `---
@@ -158312,27 +158321,27 @@ flint lattice run ${latticeName} get ${recordId}
158312
158321
  `;
158313
158322
  }
158314
158323
  function materializePin(flintRoot, latticeName, recordId, title) {
158315
- const pinsDir = path19.join(flintRoot, "Mesh", "Lattice", latticeName, "Pins");
158324
+ const pinsDir = path20.join(flintRoot, "Mesh", "Lattice", latticeName, "Pins");
158316
158325
  fs16.mkdirSync(pinsDir, { recursive: true });
158317
158326
  const pinFileName = `(Lattice) ${latticeName} . ${title}.md`;
158318
- const pinFilePath = path19.join(pinsDir, pinFileName);
158327
+ const pinFilePath = path20.join(pinsDir, pinFileName);
158319
158328
  if (fs16.existsSync(pinFilePath)) return false;
158320
158329
  fs16.writeFileSync(pinFilePath, generatePinFileContent(latticeName, recordId, title), "utf-8");
158321
158330
  updateBaseContextPins(flintRoot, latticeName, "add", title);
158322
158331
  return true;
158323
158332
  }
158324
158333
  function dematerializePin(flintRoot, latticeName, title) {
158325
- const pinsDir = path19.join(flintRoot, "Mesh", "Lattice", latticeName, "Pins");
158334
+ const pinsDir = path20.join(flintRoot, "Mesh", "Lattice", latticeName, "Pins");
158326
158335
  const pinFileName = `(Lattice) ${latticeName} . ${title}.md`;
158327
- const pinFilePath = path19.join(pinsDir, pinFileName);
158336
+ const pinFilePath = path20.join(pinsDir, pinFileName);
158328
158337
  if (!fs16.existsSync(pinFilePath)) return false;
158329
158338
  fs16.unlinkSync(pinFilePath);
158330
158339
  updateBaseContextPins(flintRoot, latticeName, "remove", title);
158331
158340
  return true;
158332
158341
  }
158333
158342
  function updateBaseContextPins(flintRoot, latticeName, action, title) {
158334
- const contextDir = path19.join(flintRoot, "Mesh", "Lattice", latticeName);
158335
- const contextPath = path19.join(contextDir, `(Lattice) ${latticeName}.md`);
158343
+ const contextDir = path20.join(flintRoot, "Mesh", "Lattice", latticeName);
158344
+ const contextPath = path20.join(contextDir, `(Lattice) ${latticeName}.md`);
158336
158345
  if (!fs16.existsSync(contextPath)) return;
158337
158346
  const content = fs16.readFileSync(contextPath, "utf-8");
158338
158347
  const wikilink = `- [[(Lattice) ${latticeName} . ${title}]]`;
@@ -158403,7 +158412,7 @@ var latticeCommand = new Command("lattice").description("Manage lattice connecti
158403
158412
  }
158404
158413
  const entry = { path: fulfillment.path, lang: fulfillment.lang, registered: fulfillment.fulfilled };
158405
158414
  const envLocal = {};
158406
- const envPath = path19.join(entry.path, ".env.local");
158415
+ const envPath = path20.join(entry.path, ".env.local");
158407
158416
  if (fs16.existsSync(envPath)) {
158408
158417
  for (const line of fs16.readFileSync(envPath, "utf-8").split("\n")) {
158409
158418
  const trimmed = line.trim();
@@ -158418,7 +158427,7 @@ var latticeCommand = new Command("lattice").description("Manage lattice connecti
158418
158427
  }
158419
158428
  }
158420
158429
  const entryFile = entry.lang === "python" ? "main.py" : "main.js";
158421
- const entryPoint = path19.join(entry.path, entryFile);
158430
+ const entryPoint = path20.join(entry.path, entryFile);
158422
158431
  const cmd = entry.lang === "python" ? "uv" : "node";
158423
158432
  const cmdArgs = entry.lang === "python" ? ["run", "python", entryPoint, fn, ...args] : [entryPoint, fn, ...args];
158424
158433
  const child = spawn4(cmd, cmdArgs, {
@@ -158521,7 +158530,7 @@ var latticeCommand = new Command("lattice").description("Manage lattice connecti
158521
158530
  process.exit(1);
158522
158531
  }
158523
158532
  const pins = readPinsToml(fulfillment.path);
158524
- const pinsDir = path19.join(flintPath, "Mesh", "Lattice", name, "Pins");
158533
+ const pinsDir = path20.join(flintPath, "Mesh", "Lattice", name, "Pins");
158525
158534
  let added = 0;
158526
158535
  let removed = 0;
158527
158536
  for (const pin of pins) {
@@ -158533,7 +158542,7 @@ var latticeCommand = new Command("lattice").description("Manage lattice connecti
158533
158542
  const declaredFiles = new Set(pins.map((p) => `(Lattice) ${name} . ${p.title}.md`));
158534
158543
  for (const file of fs16.readdirSync(pinsDir)) {
158535
158544
  if (file.endsWith(".md") && !declaredFiles.has(file)) {
158536
- fs16.unlinkSync(path19.join(pinsDir, file));
158545
+ fs16.unlinkSync(path20.join(pinsDir, file));
158537
158546
  removed++;
158538
158547
  }
158539
158548
  }
@@ -158552,9 +158561,9 @@ init_dist4();
158552
158561
  import { readFile as readFile13, stat as stat15 } from "fs/promises";
158553
158562
  import { join as join27, basename as basename7 } from "path";
158554
158563
  import { createInterface as createInterface5 } from "readline";
158555
- async function exists3(path29) {
158564
+ async function exists3(path30) {
158556
158565
  try {
158557
- await stat15(path29);
158566
+ await stat15(path30);
158558
158567
  return true;
158559
158568
  } catch {
158560
158569
  return false;
@@ -158835,9 +158844,9 @@ init_dist4();
158835
158844
  import { randomUUID as randomUUID6 } from "crypto";
158836
158845
  import { copyFile as copyFile4, mkdir as mkdir15, writeFile as writeFile11, unlink as unlink3, stat as stat16 } from "fs/promises";
158837
158846
  import { join as join28, basename as basename8, resolve as resolve16 } from "path";
158838
- async function exists4(path29) {
158847
+ async function exists4(path30) {
158839
158848
  try {
158840
- await stat16(path29);
158849
+ await stat16(path30);
158841
158850
  return true;
158842
158851
  } catch {
158843
158852
  return false;
@@ -161730,7 +161739,7 @@ import { createInterface as createInterface7 } from "readline";
161730
161739
  import { spawn as spawn8, spawnSync as spawnSync6 } from "child_process";
161731
161740
  import { existsSync as existsSync17, readFileSync as readFileSync14 } from "fs";
161732
161741
  import { dirname as dirname12, join as join36, resolve as resolvePath3 } from "path";
161733
- import { fileURLToPath as fileURLToPath5, pathToFileURL } from "url";
161742
+ import { fileURLToPath as fileURLToPath6, pathToFileURL } from "url";
161734
161743
 
161735
161744
  // ../../packages/orbh/dist/index.js
161736
161745
  import { existsSync as existsSync22, readFileSync as readFileSync22 } from "fs";
@@ -161775,7 +161784,8 @@ import { randomUUID as randomUUID33 } from "crypto";
161775
161784
  init_dist3();
161776
161785
  import { watch as watch3 } from "fs";
161777
161786
  import { access as access7 } from "fs/promises";
161778
- import path20 from "path";
161787
+ import path21 from "path";
161788
+ import { fileURLToPath as fileURLToPath5 } from "url";
161779
161789
  import { spawn as spawn32, spawnSync as spawnSync5 } from "child_process";
161780
161790
  import { spawn as spawn23, spawnSync as spawnSync4 } from "child_process";
161781
161791
  import { createWriteStream, existsSync as existsSync152, readdirSync as readdirSync7, readFileSync as readFileSync12, renameSync as renameSync2 } from "fs";
@@ -163066,8 +163076,8 @@ function diffEntries(previous, next) {
163066
163076
  newEntries: next.slice(index)
163067
163077
  };
163068
163078
  }
163069
- function loadJsonFile(path29) {
163070
- return JSON.parse(readFileSync32(path29, "utf-8"));
163079
+ function loadJsonFile(path210) {
163080
+ return JSON.parse(readFileSync32(path210, "utf-8"));
163071
163081
  }
163072
163082
  function isSessionInfo(value) {
163073
163083
  return isRecord6(value) && typeof value.id === "string";
@@ -164804,8 +164814,8 @@ function diffEntries2(previous, next) {
164804
164814
  }
164805
164815
  return previous.length === next.length && index === next.length ? [] : next.slice(index);
164806
164816
  }
164807
- function isStreamCapturePath(path29) {
164808
- return path29.endsWith(".jsonl");
164817
+ function isStreamCapturePath(path210) {
164818
+ return path210.endsWith(".jsonl");
164809
164819
  }
164810
164820
  function createOpencodeSessionWatcher(transcriptPath, options3) {
164811
164821
  return new OpencodeSessionWatcher(transcriptPath, options3);
@@ -164948,11 +164958,11 @@ var init_opencode_session_watcher = __esm2({
164948
164958
  };
164949
164959
  }
164950
164960
  });
164951
- function normalizePath(path29) {
164961
+ function normalizePath(path210) {
164952
164962
  try {
164953
- return realpathSync(path29);
164963
+ return realpathSync(path210);
164954
164964
  } catch {
164955
- return path29;
164965
+ return path210;
164956
164966
  }
164957
164967
  }
164958
164968
  function parseStartedAtMs3(startedAt) {
@@ -166428,7 +166438,14 @@ function createOrbhWatcher(sessionsDir, options3 = {}) {
166428
166438
  }
166429
166439
  };
166430
166440
  }
166431
- var PROMPTS_BASE_PATH2 = resolvePackageBasePath("@nuucognition/orbh", import.meta.url);
166441
+ function resolvePromptsBasePath2() {
166442
+ try {
166443
+ return resolvePackageBasePath("@nuucognition/orbh", import.meta.url);
166444
+ } catch {
166445
+ return path21.resolve(path21.dirname(fileURLToPath5(import.meta.url)), "_orbh");
166446
+ }
166447
+ }
166448
+ var PROMPTS_BASE_PATH2 = resolvePromptsBasePath2();
166432
166449
  var DEFAULT_ORBH_COMMAND_PATH = "orbh";
166433
166450
  function normalizePromptLayer(value) {
166434
166451
  return value.trim();
@@ -166440,7 +166457,7 @@ async function loadOrbhPrompt(name, variables = {}) {
166440
166457
  });
166441
166458
  }
166442
166459
  async function tryLoadHarnessPrompt(runtime2, variables) {
166443
- const harnessPath = path20.join(PROMPTS_BASE_PATH2, "prompts", "harness", `${runtime2}.md`);
166460
+ const harnessPath = path21.join(PROMPTS_BASE_PATH2, "prompts", "harness", `${runtime2}.md`);
166444
166461
  try {
166445
166462
  await access7(harnessPath);
166446
166463
  } catch {
@@ -167555,14 +167572,14 @@ init_registry();
167555
167572
  // ../../packages/orbh-server/dist/index.js
167556
167573
  init_dist();
167557
167574
  import { access as access8, readFile as readFile15 } from "fs/promises";
167558
- import path21 from "path";
167575
+ import path23 from "path";
167559
167576
  import { homedir as homedir9 } from "os";
167560
167577
  import { randomUUID as randomUUID8 } from "crypto";
167561
167578
  import { spawn as spawn7 } from "child_process";
167562
167579
  import { readFile as readFile26 } from "fs/promises";
167563
167580
  import Fastify from "fastify";
167564
167581
  import { readFile as readFile36, writeFile as writeFile12, mkdir as mkdir16, rm as rm13 } from "fs/promises";
167565
- import path23 from "path";
167582
+ import path24 from "path";
167566
167583
  var DEFAULT_HOST = "127.0.0.1";
167567
167584
  var DEFAULT_PORT = 13041;
167568
167585
  var DEFAULT_SESSIONS_DIR = ".orbh/sessions";
@@ -167575,7 +167592,7 @@ function expandHome(value) {
167575
167592
  return homedir9();
167576
167593
  }
167577
167594
  if (value.startsWith("~/")) {
167578
- return path21.join(homedir9(), value.slice(2));
167595
+ return path23.join(homedir9(), value.slice(2));
167579
167596
  }
167580
167597
  return value;
167581
167598
  }
@@ -167622,10 +167639,10 @@ async function maybeReadConfig(configPath) {
167622
167639
  return parsed;
167623
167640
  }
167624
167641
  async function loadOrbhConfig(options3 = {}) {
167625
- const cwd = path21.resolve(options3.cwd ?? process.cwd());
167626
- const configPath = options3.configPath ? path21.resolve(cwd, options3.configPath) : path21.join(cwd, DEFAULT_CONFIG_FILENAME);
167642
+ const cwd = path23.resolve(options3.cwd ?? process.cwd());
167643
+ const configPath = options3.configPath ? path23.resolve(cwd, options3.configPath) : path23.join(cwd, DEFAULT_CONFIG_FILENAME);
167627
167644
  const parsed = await maybeReadConfig(configPath);
167628
- const configDir = path21.dirname(configPath);
167645
+ const configDir = path23.dirname(configPath);
167629
167646
  const fileHost = normalizeHost(parsed?.server?.host);
167630
167647
  const filePort = normalizePort(parsed?.server?.port);
167631
167648
  const fileSessionsDir = normalizeSessionsDir(parsed?.sessions?.dir);
@@ -167636,7 +167653,7 @@ async function loadOrbhConfig(options3 = {}) {
167636
167653
  const overrideRuntimes = normalizeRuntimeOverrides(options3.overrides?.runtimes);
167637
167654
  const host = overrideHost ?? fileHost ?? DEFAULT_HOST;
167638
167655
  const port = overridePort ?? filePort ?? DEFAULT_PORT;
167639
- const sessionsDir = path21.resolve(
167656
+ const sessionsDir = path23.resolve(
167640
167657
  configDir,
167641
167658
  expandHome(overrideSessionsDir ?? fileSessionsDir ?? DEFAULT_SESSIONS_DIR)
167642
167659
  );
@@ -169261,15 +169278,15 @@ async function probeCompatibleServer(host, port) {
169261
169278
  return null;
169262
169279
  }
169263
169280
  function getOrbhServerStatePaths(cwd) {
169264
- const serverDir = path23.join(path23.resolve(cwd), SERVER_DIRNAME);
169281
+ const serverDir = path24.join(path24.resolve(cwd), SERVER_DIRNAME);
169265
169282
  return {
169266
- pidFilePath: path23.join(serverDir, PID_FILENAME),
169267
- stateFilePath: path23.join(serverDir, STATE_FILENAME2)
169283
+ pidFilePath: path24.join(serverDir, PID_FILENAME),
169284
+ stateFilePath: path24.join(serverDir, STATE_FILENAME2)
169268
169285
  };
169269
169286
  }
169270
169287
  async function writeOrbhServerState(config, state) {
169271
169288
  const paths = getOrbhServerStatePaths(config.cwd);
169272
- await mkdir16(path23.dirname(paths.pidFilePath), { recursive: true });
169289
+ await mkdir16(path24.dirname(paths.pidFilePath), { recursive: true });
169273
169290
  await writeFile12(paths.pidFilePath, `${state.pid}
169274
169291
  `, "utf-8");
169275
169292
  await writeFile12(paths.stateFilePath, JSON.stringify({
@@ -169375,25 +169392,25 @@ function isRecord9(value) {
169375
169392
  function normalizeKey(value) {
169376
169393
  return value.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
169377
169394
  }
169378
- function keyMatches(path29, key) {
169395
+ function keyMatches(path30, key) {
169379
169396
  const normalizedKey = normalizeKey(key);
169380
169397
  if (!normalizedKey) {
169381
169398
  return false;
169382
169399
  }
169383
- const normalizedPath = normalizeKey(path29);
169400
+ const normalizedPath = normalizeKey(path30);
169384
169401
  if (normalizedPath === normalizedKey || normalizedPath.endsWith(normalizedKey) || normalizedPath === `${normalizedKey}id`) {
169385
169402
  return true;
169386
169403
  }
169387
- return path29.split(".").map((part) => normalizeKey(part)).some((part) => part === normalizedKey || part === `${normalizedKey}id`);
169404
+ return path30.split(".").map((part) => normalizeKey(part)).some((part) => part === normalizedKey || part === `${normalizedKey}id`);
169388
169405
  }
169389
- function collectScalarMatches(value, path29, matches) {
169406
+ function collectScalarMatches(value, path30, matches) {
169390
169407
  if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
169391
- matches.push({ path: path29, value: String(value) });
169408
+ matches.push({ path: path30, value: String(value) });
169392
169409
  return;
169393
169410
  }
169394
169411
  if (Array.isArray(value)) {
169395
169412
  value.forEach((entry, index) => {
169396
- collectScalarMatches(entry, `${path29}.${index}`, matches);
169413
+ collectScalarMatches(entry, `${path30}.${index}`, matches);
169397
169414
  });
169398
169415
  return;
169399
169416
  }
@@ -169401,7 +169418,7 @@ function collectScalarMatches(value, path29, matches) {
169401
169418
  return;
169402
169419
  }
169403
169420
  for (const [key, entry] of Object.entries(value)) {
169404
- const nextPath = path29 ? `${path29}.${key}` : key;
169421
+ const nextPath = path30 ? `${path30}.${key}` : key;
169405
169422
  collectScalarMatches(entry, nextPath, matches);
169406
169423
  }
169407
169424
  }
@@ -172749,7 +172766,7 @@ function createStandaloneOrbhCommand() {
172749
172766
  });
172750
172767
  return command;
172751
172768
  }
172752
- var __dirname5 = dirname12(fileURLToPath5(import.meta.url));
172769
+ var __dirname5 = dirname12(fileURLToPath6(import.meta.url));
172753
172770
  var pkg2 = JSON.parse(readFileSync14(join36(__dirname5, "..", "package.json"), "utf-8"));
172754
172771
  function createStandaloneOrbhProgram() {
172755
172772
  return createStandaloneOrbhCommand().version(formatVersion(pkg2.version ?? "0.0.0", "orbh"));
@@ -173909,7 +173926,7 @@ var tinderboxCommand = new Command("tinderbox").description("Orchestrate operati
173909
173926
  // src/commands/server/server.ts
173910
173927
  init_dist4();
173911
173928
  import { createRequire as createRequire2 } from "module";
173912
- import path27 from "path";
173929
+ import path28 from "path";
173913
173930
  import { spawn as spawn11 } from "child_process";
173914
173931
  import { stat as stat21 } from "fs/promises";
173915
173932
 
@@ -174492,8 +174509,8 @@ var FlintServerClient = class {
174492
174509
  }
174493
174510
  return url;
174494
174511
  }
174495
- async requestRaw(method, path29, options3 = {}) {
174496
- const url = this.buildUrl(path29, options3.query);
174512
+ async requestRaw(method, path30, options3 = {}) {
174513
+ const url = this.buildUrl(path30, options3.query);
174497
174514
  const headers = new Headers(this.baseHeaders);
174498
174515
  if (options3.headers) {
174499
174516
  const extra = new Headers(options3.headers);
@@ -174514,8 +174531,8 @@ var FlintServerClient = class {
174514
174531
  }
174515
174532
  return response;
174516
174533
  }
174517
- async requestJson(method, path29, options3 = {}) {
174518
- const response = await this.requestRaw(method, path29, options3);
174534
+ async requestJson(method, path30, options3 = {}) {
174535
+ const response = await this.requestRaw(method, path30, options3);
174519
174536
  return response.json();
174520
174537
  }
174521
174538
  };
@@ -174579,14 +174596,14 @@ import fastifyCors from "@fastify/cors";
174579
174596
  import fastifyStatic from "@fastify/static";
174580
174597
  import { stat as stat53 } from "fs/promises";
174581
174598
  import path72 from "path";
174582
- import { fileURLToPath as fileURLToPath6 } from "url";
174599
+ import { fileURLToPath as fileURLToPath7 } from "url";
174583
174600
  import { join as join54 } from "path";
174584
174601
  import { readdirSync as readdirSync22, existsSync as existsSync43 } from "fs";
174585
174602
  import { randomUUID as randomUUID10, createHash as createHash3 } from "crypto";
174586
174603
  import { EventEmitter as EventEmitter2 } from "events";
174587
174604
  import { readFile as readFile18, stat as stat20 } from "fs/promises";
174588
174605
  import { spawn as spawn10 } from "child_process";
174589
- import path25 from "path";
174606
+ import path26 from "path";
174590
174607
  import chokidar from "chokidar";
174591
174608
  import { glob } from "glob";
174592
174609
 
@@ -175394,11 +175411,11 @@ var qmarksTestNoExtDot = ([$0]) => {
175394
175411
  return (f) => f.length === len && f !== "." && f !== "..";
175395
175412
  };
175396
175413
  var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
175397
- var path24 = {
175414
+ var path25 = {
175398
175415
  win32: { sep: "\\" },
175399
175416
  posix: { sep: "/" }
175400
175417
  };
175401
- var sep4 = defaultPlatform === "win32" ? path24.win32.sep : path24.posix.sep;
175418
+ var sep4 = defaultPlatform === "win32" ? path25.win32.sep : path25.posix.sep;
175402
175419
  minimatch.sep = sep4;
175403
175420
  var GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
175404
175421
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -176128,7 +176145,7 @@ init_dist();
176128
176145
  import { parse as parseYaml6 } from "yaml";
176129
176146
  import { existsSync as existsSync19, watch as watch4 } from "fs";
176130
176147
  import { stat as stat25 } from "fs/promises";
176131
- import path26 from "path";
176148
+ import path27 from "path";
176132
176149
  import { mkdir as mkdir19, readFile as readFile27, writeFile as writeFile15 } from "fs/promises";
176133
176150
  import { homedir as homedir12 } from "os";
176134
176151
  import { join as join41, resolve as resolve17 } from "path";
@@ -176151,7 +176168,7 @@ import { writeFile as writeFile35, mkdir as mkdir33, readdir as readdir43, readF
176151
176168
  import { join as join46 } from "path";
176152
176169
  var DEFAULT_EVENT_LOG_SIZE = 200;
176153
176170
  function computeRuntimeId(flintPath) {
176154
- const resolved = path25.resolve(flintPath);
176171
+ const resolved = path26.resolve(flintPath);
176155
176172
  return createHash3("sha1").update(resolved).digest("hex").slice(0, 10);
176156
176173
  }
176157
176174
  function createRuntime(options3) {
@@ -176171,8 +176188,8 @@ var FlintRuntimeImpl = class {
176171
176188
  sessionCache = /* @__PURE__ */ new Map();
176172
176189
  startedAt = null;
176173
176190
  constructor(options3) {
176174
- this.flintPath = path25.resolve(options3.flintPath);
176175
- this.hooksPath = options3.hooksPath ? path25.resolve(options3.hooksPath) : path25.join(this.flintPath, "flint-hooks.toml");
176191
+ this.flintPath = path26.resolve(options3.flintPath);
176192
+ this.hooksPath = options3.hooksPath ? path26.resolve(options3.hooksPath) : path26.join(this.flintPath, "flint-hooks.toml");
176176
176193
  this.id = computeRuntimeId(this.flintPath);
176177
176194
  this.eventLogSize = options3.eventLogSize ?? DEFAULT_EVENT_LOG_SIZE;
176178
176195
  this.logger = options3.logger ?? {
@@ -176194,7 +176211,7 @@ var FlintRuntimeImpl = class {
176194
176211
  }
176195
176212
  await this.reloadHooks();
176196
176213
  await this.seedCaches();
176197
- const relativeHooksPath = path25.relative(this.flintPath, this.hooksPath);
176214
+ const relativeHooksPath = path26.relative(this.flintPath, this.hooksPath);
176198
176215
  const watchPatterns = [
176199
176216
  "Mesh/**/*.md",
176200
176217
  ".orbh/sessions/*.json",
@@ -176263,7 +176280,7 @@ var FlintRuntimeImpl = class {
176263
176280
  sessionFiles.map(async (filePath) => {
176264
176281
  const snapshot = await this.readSessionSnapshot(filePath);
176265
176282
  if (snapshot) {
176266
- const sessionId = path25.basename(filePath, ".json");
176283
+ const sessionId = path26.basename(filePath, ".json");
176267
176284
  this.sessionCache.set(sessionId, snapshot);
176268
176285
  }
176269
176286
  })
@@ -176271,7 +176288,7 @@ var FlintRuntimeImpl = class {
176271
176288
  }
176272
176289
  async handleWatchEvent(event, filePath) {
176273
176290
  const normalized = normalizePath2(filePath);
176274
- if (normalized === normalizePath2(path25.relative(this.flintPath, this.hooksPath))) {
176291
+ if (normalized === normalizePath2(path26.relative(this.flintPath, this.hooksPath))) {
176275
176292
  if (event === "change") {
176276
176293
  this.logger.info?.("Reloading hooks config");
176277
176294
  await this.reloadHooks();
@@ -176288,7 +176305,7 @@ var FlintRuntimeImpl = class {
176288
176305
  }
176289
176306
  if (normalized.startsWith(".orbh/sessions/")) {
176290
176307
  if (event === "unlink") {
176291
- const sessionId = path25.basename(normalized, ".json");
176308
+ const sessionId = path26.basename(normalized, ".json");
176292
176309
  this.sessionCache.delete(sessionId);
176293
176310
  return;
176294
176311
  }
@@ -176305,7 +176322,7 @@ var FlintRuntimeImpl = class {
176305
176322
  this.frontmatterCache.set(relativePath, snapshot);
176306
176323
  await this.emitEvent("FileChanged", {
176307
176324
  path: relativePath,
176308
- absolutePath: path25.join(this.flintPath, relativePath),
176325
+ absolutePath: path26.join(this.flintPath, relativePath),
176309
176326
  frontmatter: snapshot,
176310
176327
  previousFrontmatter: previous ?? null
176311
176328
  });
@@ -176315,7 +176332,7 @@ var FlintRuntimeImpl = class {
176315
176332
  if (previous.status !== snapshot.status) {
176316
176333
  await this.emitEvent("StatusChanged", {
176317
176334
  path: relativePath,
176318
- absolutePath: path25.join(this.flintPath, relativePath),
176335
+ absolutePath: path26.join(this.flintPath, relativePath),
176319
176336
  field: "status",
176320
176337
  from: previous.status ?? null,
176321
176338
  to: snapshot.status ?? null,
@@ -176327,7 +176344,7 @@ var FlintRuntimeImpl = class {
176327
176344
  for (const tag3 of addedTags) {
176328
176345
  await this.emitEvent("TagAdded", {
176329
176346
  path: relativePath,
176330
- absolutePath: path25.join(this.flintPath, relativePath),
176347
+ absolutePath: path26.join(this.flintPath, relativePath),
176331
176348
  tag: tag3,
176332
176349
  tags: snapshot.tags
176333
176350
  });
@@ -176335,7 +176352,7 @@ var FlintRuntimeImpl = class {
176335
176352
  for (const tag3 of removedTags) {
176336
176353
  await this.emitEvent("TagRemoved", {
176337
176354
  path: relativePath,
176338
- absolutePath: path25.join(this.flintPath, relativePath),
176355
+ absolutePath: path26.join(this.flintPath, relativePath),
176339
176356
  tag: tag3,
176340
176357
  tags: snapshot.tags
176341
176358
  });
@@ -176346,7 +176363,7 @@ var FlintRuntimeImpl = class {
176346
176363
  if (!snapshot) {
176347
176364
  return;
176348
176365
  }
176349
- const sessionId = path25.basename(relativePath, ".json");
176366
+ const sessionId = path26.basename(relativePath, ".json");
176350
176367
  const previous = this.sessionCache.get(sessionId);
176351
176368
  this.sessionCache.set(sessionId, snapshot);
176352
176369
  if (!previous && snapshot.status === "active") {
@@ -176412,7 +176429,7 @@ var FlintRuntimeImpl = class {
176412
176429
  }
176413
176430
  }
176414
176431
  async readFrontmatterSnapshot(relativePath) {
176415
- const absolutePath = path25.join(this.flintPath, relativePath);
176432
+ const absolutePath = path26.join(this.flintPath, relativePath);
176416
176433
  const content = await safeReadFile(absolutePath);
176417
176434
  if (!content) {
176418
176435
  return null;
@@ -176423,7 +176440,7 @@ var FlintRuntimeImpl = class {
176423
176440
  return { status, tags };
176424
176441
  }
176425
176442
  async readSessionSnapshot(relativePath) {
176426
- const absolutePath = path25.join(this.flintPath, relativePath);
176443
+ const absolutePath = path26.join(this.flintPath, relativePath);
176427
176444
  const content = await safeReadFile(absolutePath);
176428
176445
  if (!content) {
176429
176446
  return null;
@@ -176541,15 +176558,15 @@ async function executeHook(options3) {
176541
176558
  logger.debug?.("Running hook", hook.command);
176542
176559
  await new Promise((resolve23, reject) => {
176543
176560
  const envPathEntries = [
176544
- path25.join(flintPath, "node_modules", ".bin"),
176545
- path25.join(process.cwd(), "node_modules", ".bin"),
176561
+ path26.join(flintPath, "node_modules", ".bin"),
176562
+ path26.join(process.cwd(), "node_modules", ".bin"),
176546
176563
  process.env.PATH
176547
176564
  ].filter(Boolean);
176548
176565
  const child = spawn10(command, {
176549
176566
  cwd: flintPath,
176550
176567
  env: {
176551
176568
  ...process.env,
176552
- PATH: envPathEntries.join(path25.delimiter)
176569
+ PATH: envPathEntries.join(path26.delimiter)
176553
176570
  },
176554
176571
  shell: true,
176555
176572
  stdio: ["pipe", "pipe", "pipe"],
@@ -176617,11 +176634,11 @@ function resolveHookCommand(command, flintPath) {
176617
176634
  const parts = trimmed.split(/\s+/);
176618
176635
  const target = parts[0] ?? "";
176619
176636
  const rest = parts.slice(1).join(" ");
176620
- const extension = path25.extname(target);
176637
+ const extension = path26.extname(target);
176621
176638
  if (!extension) {
176622
176639
  return trimmed;
176623
176640
  }
176624
- const resolvedTarget = path25.isAbsolute(target) ? target : path25.join(flintPath, target);
176641
+ const resolvedTarget = path26.isAbsolute(target) ? target : path26.join(flintPath, target);
176625
176642
  const quotedTarget = quoteIfNeeded(resolvedTarget);
176626
176643
  const suffix = rest ? ` ${rest}` : "";
176627
176644
  if (extension === ".ts") {
@@ -176659,15 +176676,15 @@ var CONTENT_TYPES = {
176659
176676
  ".woff2": "font/woff2"
176660
176677
  };
176661
176678
  function contentTypeFor(filePath) {
176662
- return CONTENT_TYPES[path26.extname(filePath).toLowerCase()] ?? "application/octet-stream";
176679
+ return CONTENT_TYPES[path27.extname(filePath).toLowerCase()] ?? "application/octet-stream";
176663
176680
  }
176664
176681
  function isImmutableAsset(filePath) {
176665
- return /\.[a-f0-9]{8,}\./i.test(path26.basename(filePath));
176682
+ return /\.[a-f0-9]{8,}\./i.test(path27.basename(filePath));
176666
176683
  }
176667
176684
  async function resolveFlintPath5(inputPath) {
176668
- const resolved = path26.resolve(inputPath);
176669
- const flintToml = path26.join(resolved, "flint.toml");
176670
- const flintState = path26.join(resolved, ".flint");
176685
+ const resolved = path27.resolve(inputPath);
176686
+ const flintToml = path27.join(resolved, "flint.toml");
176687
+ const flintState = path27.join(resolved, ".flint");
176671
176688
  const hasConfig = await exists5(flintToml);
176672
176689
  const hasState = await exists5(flintState);
176673
176690
  if (!hasConfig && !hasState) {
@@ -178302,7 +178319,7 @@ async function startFlintServer(options3 = {}) {
178302
178319
  suppressedPaths,
178303
178320
  suppressPath
178304
178321
  };
178305
- const __dirname7 = path72.dirname(fileURLToPath6(import.meta.url));
178322
+ const __dirname7 = path72.dirname(fileURLToPath7(import.meta.url));
178306
178323
  const dashboardDist = path72.resolve(__dirname7, "..", "..", "..", "apps", "flint-dashboard", "dist");
178307
178324
  try {
178308
178325
  await stat53(dashboardDist);
@@ -178610,12 +178627,12 @@ serverCommand.command("dev").description(
178610
178627
  const serverPkgJson = require3.resolve(
178611
178628
  `${FLINT_SERVER_PACKAGE}/package.json`
178612
178629
  );
178613
- serverPkgDir = path27.dirname(serverPkgJson);
178630
+ serverPkgDir = path28.dirname(serverPkgJson);
178614
178631
  } catch {
178615
178632
  console.error(export_pc.red("Error: flint-server package not found."));
178616
178633
  process.exit(1);
178617
178634
  }
178618
- const devEntry = path27.join(serverPkgDir, "src", "dev.ts");
178635
+ const devEntry = path28.join(serverPkgDir, "src", "dev.ts");
178619
178636
  try {
178620
178637
  await stat21(devEntry);
178621
178638
  } catch {
@@ -178737,10 +178754,10 @@ serverCommand.command("list").description("List all running Flint servers from t
178737
178754
  init_dist4();
178738
178755
  import { readFile as readFile19, readdir as readdir17, rm as rm14 } from "fs/promises";
178739
178756
  import { join as join47 } from "path";
178740
- async function exists6(path29) {
178757
+ async function exists6(path30) {
178741
178758
  try {
178742
178759
  const { stat: stat26 } = await import("fs/promises");
178743
- await stat26(path29);
178760
+ await stat26(path30);
178744
178761
  return true;
178745
178762
  } catch {
178746
178763
  return false;
@@ -179338,12 +179355,12 @@ var helperCommand = new Command("helper").description("Helper utilities for Flin
179338
179355
 
179339
179356
  // src/commands/system/runtime.ts
179340
179357
  init_dist4();
179341
- import path28 from "path";
179358
+ import path29 from "path";
179342
179359
  var runtimeCommand = new Command("runtime").description("Manage Flint runtimes");
179343
179360
  runtimeCommand.command("start [flintPath]").description("Start runtime for a Flint").option("--server <url>", "Server URL", "http://127.0.0.1:13040").action(async (flintPath, options3) => {
179344
179361
  const serverUrl = options3.server;
179345
179362
  const client = new FlintServerClient({ baseUrl: serverUrl });
179346
- const resolvedPath = flintPath ? path28.resolve(flintPath) : await findFlintRoot(process.cwd());
179363
+ const resolvedPath = flintPath ? path29.resolve(flintPath) : await findFlintRoot(process.cwd());
179347
179364
  if (!resolvedPath) {
179348
179365
  console.error(export_pc.red("Error: Not inside a Flint workspace. Provide a path or cd into one."));
179349
179366
  process.exit(1);
@@ -179367,7 +179384,7 @@ runtimeCommand.command("stop [runtimeId]").description("Stop a running runtime")
179367
179384
  let id = runtimeId;
179368
179385
  try {
179369
179386
  if (!id) {
179370
- const lookupPath = options3.path ? path28.resolve(options3.path) : await findFlintRoot(process.cwd());
179387
+ const lookupPath = options3.path ? path29.resolve(options3.path) : await findFlintRoot(process.cwd());
179371
179388
  if (!lookupPath) {
179372
179389
  console.error(export_pc.red("Error: Provide a runtime ID or Flint path."));
179373
179390
  process.exit(1);
@@ -179443,7 +179460,7 @@ var whoamiCommand = new Command("whoami").description("Show the current person i
179443
179460
 
179444
179461
  // src/index.ts
179445
179462
  registerAllFeatures();
179446
- var __dirname6 = dirname13(fileURLToPath7(import.meta.url));
179463
+ var __dirname6 = dirname13(fileURLToPath8(import.meta.url));
179447
179464
  var pkg3 = JSON.parse(readFileSync18(join49(__dirname6, "..", "package.json"), "utf-8"));
179448
179465
  var profile = getBuildMode("flint");
179449
179466
  await runCliMigrations({