@nuucognition/flint-cli 0.5.5 → 0.5.6-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -218,7 +218,7 @@ function getDisambiguatedExportName(flintPath, sourcePath, baseName) {
218
218
  return `${baseName} (${dirLabel})`;
219
219
  }
220
220
  async function scanExports(flintPath) {
221
- const { readFlintToml: readFlintToml2 } = await import("./mesh-config-BAIYF4KD-W2RGZQ2V.js");
221
+ const { readFlintToml: readFlintToml2 } = await import("./mesh-config-BAIYF4KD-Q3ZCQOCZ.js");
222
222
  const config = await readFlintToml2(flintPath);
223
223
  const declarations = config?.exports?.required;
224
224
  if (!declarations || declarations.length === 0) {
@@ -245,7 +245,7 @@ async function scanExportsFromConfig(flintPath, declarations) {
245
245
  async function scanExportEligible(flintPath) {
246
246
  const meshDir = join(flintPath, "Mesh");
247
247
  if (!await exists(meshDir)) return [];
248
- const { readFlintToml: readFlintToml2 } = await import("./mesh-config-BAIYF4KD-W2RGZQ2V.js");
248
+ const { readFlintToml: readFlintToml2 } = await import("./mesh-config-BAIYF4KD-Q3ZCQOCZ.js");
249
249
  const config = await readFlintToml2(flintPath);
250
250
  const declared = new Set(
251
251
  (config?.exports?.required || []).map((d) => d.file.replace(/\.md$/, "").toLowerCase())
@@ -0,0 +1,30 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ export {
28
+ __commonJS,
29
+ __toESM
30
+ };
@@ -7,7 +7,7 @@ import {
7
7
  registerFlint,
8
8
  registerFlintByPath,
9
9
  updateFlintEntry
10
- } from "./chunk-C66KJDI7.js";
10
+ } from "./chunk-X6OG5PEE.js";
11
11
  import {
12
12
  exists,
13
13
  runConcurrent
@@ -50,6 +50,7 @@ import { mkdir as mkdir22, writeFile as writeFile5 } from "fs/promises";
50
50
  import { join as join32 } from "path";
51
51
  import { exec } from "child_process";
52
52
  import { promisify } from "util";
53
+ import { platform } from "os";
53
54
  import { readdir as readdir8, stat as stat32, access as access2 } from "fs/promises";
54
55
  import { join as join42, resolve } from "path";
55
56
  import { homedir } from "os";
@@ -2478,9 +2479,11 @@ async function isInsideFlint(path) {
2478
2479
  }
2479
2480
  var execAsync = promisify(exec);
2480
2481
  var OBSIDIAN_REPO_URL = "https://github.com/NUU-Cognition/flint-dot-obsidian.git";
2482
+ var OBSIDIAN_WINDOWS_REPO_URL = "https://github.com/NUU-Cognition/flint-dot-obsidian-windows.git";
2481
2483
  async function cloneObsidian(flintPath) {
2482
2484
  const obsidianDir = join32(flintPath, ".obsidian");
2483
- await execAsync(`git clone ${OBSIDIAN_REPO_URL} "${obsidianDir}"`, { timeout: 6e4 });
2485
+ const repoUrl = platform() === "win32" ? OBSIDIAN_WINDOWS_REPO_URL : OBSIDIAN_REPO_URL;
2486
+ await execAsync(`git clone ${repoUrl} "${obsidianDir}"`, { timeout: 6e4 });
2484
2487
  }
2485
2488
  async function createIndexMd(flintPath) {
2486
2489
  const meshDir = join32(flintPath, "Mesh");
@@ -2746,6 +2749,37 @@ function validateManifest(manifest, manifestPath) {
2746
2749
  }
2747
2750
  return { name: toolName, command, description };
2748
2751
  }) : void 0;
2752
+ const handles = Array.isArray(record.handles) ? record.handles.map((handle) => {
2753
+ if (!handle || typeof handle !== "object") {
2754
+ throw new Error(`Invalid handle declaration in ${manifestPath}`);
2755
+ }
2756
+ const handleRecord = handle;
2757
+ const tag = typeof handleRecord.tag === "string" ? handleRecord.tag.trim() : "";
2758
+ if (!tag) {
2759
+ throw new Error(`Handle declaration is missing required tag in ${manifestPath}`);
2760
+ }
2761
+ return {
2762
+ tag,
2763
+ default: handleRecord.default === true
2764
+ };
2765
+ }) : void 0;
2766
+ const actions = Array.isArray(record.actions) ? record.actions.map((action) => {
2767
+ if (!action || typeof action !== "object") {
2768
+ throw new Error(`Invalid action declaration in ${manifestPath}`);
2769
+ }
2770
+ const actionRecord = action;
2771
+ const id = typeof actionRecord.id === "string" ? actionRecord.id.trim() : "";
2772
+ const label = typeof actionRecord.label === "string" ? actionRecord.label.trim() : "";
2773
+ if (!id || !label) {
2774
+ throw new Error(`Action declaration is missing required fields in ${manifestPath}`);
2775
+ }
2776
+ return {
2777
+ id,
2778
+ label,
2779
+ description: typeof actionRecord.description === "string" ? actionRecord.description : void 0,
2780
+ icon: typeof actionRecord.icon === "string" ? actionRecord.icon : void 0
2781
+ };
2782
+ }) : void 0;
2749
2783
  return {
2750
2784
  name,
2751
2785
  title,
@@ -2756,6 +2790,8 @@ function validateManifest(manifest, manifestPath) {
2756
2790
  shard: typeof record.shard === "string" ? record.shard : void 0,
2757
2791
  dev: typeof record.dev === "string" ? record.dev : void 0,
2758
2792
  api: Array.isArray(record.api) ? record.api.filter((value) => typeof value === "string") : void 0,
2793
+ handles,
2794
+ actions,
2759
2795
  tools
2760
2796
  };
2761
2797
  }
@@ -3777,6 +3813,27 @@ async function createProposalArtifact(flintPath, data) {
3777
3813
  }
3778
3814
  return created;
3779
3815
  }
3816
+ async function writeStubExclusive(basePath, content) {
3817
+ await mkdir6(dirname22(basePath), { recursive: true });
3818
+ try {
3819
+ await writeFile52(basePath, content, { flag: "wx" });
3820
+ return basePath;
3821
+ } catch (err) {
3822
+ if (err.code !== "EEXIST") throw err;
3823
+ }
3824
+ const ext = ".md";
3825
+ const stem = basePath.slice(0, -ext.length);
3826
+ for (let n = 2; n < 1e4; n++) {
3827
+ const candidate = `${stem} ${n}${ext}`;
3828
+ try {
3829
+ await writeFile52(candidate, content, { flag: "wx" });
3830
+ return candidate;
3831
+ } catch (err) {
3832
+ if (err.code !== "EEXIST") throw err;
3833
+ }
3834
+ }
3835
+ throw new Error(`Could not find available stub number for ${basePath}`);
3836
+ }
3780
3837
  async function createStubArtifact(flintPath, data) {
3781
3838
  const relativePath = typeof data.path === "string" ? data.path : "";
3782
3839
  if (!relativePath) {
@@ -3798,9 +3855,8 @@ async function createStubArtifact(flintPath, data) {
3798
3855
 
3799
3856
  This artifact is being created by an agent session. Content will replace this stub shortly.
3800
3857
  `;
3801
- const filePath = join82(flintPath, relativePath);
3802
- await mkdir6(dirname22(filePath), { recursive: true });
3803
- await writeFile52(filePath, stringifyArtifact(frontmatter, body), "utf8");
3858
+ const basePath = join82(flintPath, relativePath);
3859
+ const filePath = await writeStubExclusive(basePath, stringifyArtifact(frontmatter, body));
3804
3860
  const created = await readArtifactAtPath(flintPath, filePath);
3805
3861
  if (!created) {
3806
3862
  throw new Error("Failed to create stub artifact");
@@ -5165,7 +5221,7 @@ async function moveFlint(nameOrPath, destination, options = {}) {
5165
5221
  async function removeTinderboxFlint(flint) {
5166
5222
  const entry = await findFlintByPath(flint.path);
5167
5223
  if (entry) {
5168
- const { unregisterFlint: unregisterFlint2 } = await import("./registry-YN5W7EY7-SZNXPBV5.js");
5224
+ const { unregisterFlint: unregisterFlint2 } = await import("./registry-YN5W7EY7-J52KXGG5.js");
5169
5225
  await unregisterFlint2(entry.path);
5170
5226
  }
5171
5227
  await rm52(flint.path, { recursive: true, force: true });
@@ -5741,7 +5797,7 @@ async function updateShards(flintPath, options = {}) {
5741
5797
  }
5742
5798
  }
5743
5799
  }));
5744
- const { runConcurrent: runConcurrent2 } = await import("./utils-BBA2XQZO-YU5SL3JY.js");
5800
+ const { runConcurrent: runConcurrent2 } = await import("./utils-BBA2XQZO-ETTV2PHU.js");
5745
5801
  const concurrentResults = await runConcurrent2(updateTasks, {
5746
5802
  concurrency: 5,
5747
5803
  onStart: options.onStart,
@@ -6737,7 +6793,7 @@ async function buildGitignoreEntries(flintPath) {
6737
6793
  const sections = [];
6738
6794
  sections.push({
6739
6795
  label: "Flint internals",
6740
- entries: [".flint/", ".obsidian/", ".mesh/", ".orbh/"]
6796
+ entries: [".flint/", ".steel/", ".obsidian/", ".mesh/", ".orbh/"]
6741
6797
  });
6742
6798
  const shardEntries = await buildShardEntries(flintPath);
6743
6799
  if (shardEntries.length > 0) {
@@ -7236,9 +7292,9 @@ async function syncFlint(flintPath, progress) {
7236
7292
  }
7237
7293
  }
7238
7294
  const requiredMeshExports = config.sources?.meshexports || [];
7239
- const { getFlintRegistry: getFlintRegistry2 } = await import("./registry-YN5W7EY7-SZNXPBV5.js");
7295
+ const { getFlintRegistry: getFlintRegistry2 } = await import("./registry-YN5W7EY7-J52KXGG5.js");
7240
7296
  const { readdir: readdir10, readFile: fsReadFile, rm: rm8, stat: fsStat, mkdir: fsMkdir, copyFile: fsCopyFile } = await import("fs/promises");
7241
- const { syncSourceMeshExportMetadata: syncSourceMeshExportMetadata2 } = await import("./metadata-SJT4H53O-7W2752ZT.js");
7297
+ const { syncSourceMeshExportMetadata: syncSourceMeshExportMetadata2 } = await import("./metadata-SJT4H53O-LEFHYM5Q.js");
7242
7298
  const requiredMeshExportSet = new Set(requiredMeshExports);
7243
7299
  const sourcesFlintDir = join17(flintPath, "Sources", "Flints");
7244
7300
  try {
@@ -7280,7 +7336,7 @@ async function syncFlint(flintPath, progress) {
7280
7336
  }
7281
7337
  if (requiredMeshExports.length > 0) {
7282
7338
  const registry = await getFlintRegistry2();
7283
- const { buildExportByName: buildExportByName2, scanExports: scanExports2 } = await import("./exports-FO5IMLM7-EN6H3N2A.js");
7339
+ const { buildExportByName: buildExportByName2, scanExports: scanExports2 } = await import("./exports-FO5IMLM7-4DUGQDXH.js");
7284
7340
  for (const ref of requiredMeshExports) {
7285
7341
  const parts = ref.split("/");
7286
7342
  if (parts.length !== 2) {
@@ -7424,7 +7480,7 @@ async function syncFlint(flintPath, progress) {
7424
7480
  error: `Failed to sync source repo metadata: ${err instanceof Error ? err.message : String(err)}`
7425
7481
  });
7426
7482
  }
7427
- const { getPlateDeclarationsFromConfig } = await import("./mesh-config-BAIYF4KD-W2RGZQ2V.js");
7483
+ const { getPlateDeclarationsFromConfig } = await import("./mesh-config-BAIYF4KD-Q3ZCQOCZ.js");
7428
7484
  const plateDeclarations = getPlateDeclarationsFromConfig(config);
7429
7485
  const hasRepoPlates = Object.values(plateDeclarations).some((d) => d.repo);
7430
7486
  if (hasRepoPlates) {
@@ -8309,6 +8365,8 @@ export {
8309
8365
  createFlint,
8310
8366
  findFlintRoot,
8311
8367
  isInsideFlint,
8368
+ OBSIDIAN_REPO_URL,
8369
+ OBSIDIAN_WINDOWS_REPO_URL,
8312
8370
  cloneObsidian,
8313
8371
  createIndexMd,
8314
8372
  createMediaDir,
@@ -182,7 +182,7 @@ async function cleanRegistryFile() {
182
182
  return result;
183
183
  }
184
184
  async function registerFlintByPath(path, options) {
185
- const { readFlintToml, hasFlintToml } = await import("./mesh-config-BAIYF4KD-W2RGZQ2V.js");
185
+ const { readFlintToml, hasFlintToml } = await import("./mesh-config-BAIYF4KD-Q3ZCQOCZ.js");
186
186
  const isFlint = await hasFlintToml(path);
187
187
  if (!isFlint) {
188
188
  throw new Error(`Not a valid flint: ${path}
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  GLOBAL_CONFIG_FILENAME,
3
3
  LiveSessionManager,
4
+ OBSIDIAN_REPO_URL,
5
+ OBSIDIAN_WINDOWS_REPO_URL,
4
6
  STANDARD_DIRECTORIES,
5
7
  TranscriptWatcher,
6
8
  addCodebaseDeclaration,
@@ -191,7 +193,7 @@ import {
191
193
  writeReferencesState,
192
194
  writeSession,
193
195
  writeTinderboxToml
194
- } from "./chunk-XWUP7WHQ.js";
196
+ } from "./chunk-WMXC6KO6.js";
195
197
  import {
196
198
  cleanRegistryFile,
197
199
  findFlintByName,
@@ -206,7 +208,7 @@ import {
206
208
  unregisterFlint,
207
209
  updateFlintEntry,
208
210
  upsertFlintEntry
209
- } from "./chunk-C66KJDI7.js";
211
+ } from "./chunk-X6OG5PEE.js";
210
212
  import {
211
213
  runConcurrent
212
214
  } from "./chunk-V7YA5RXL.js";
@@ -232,7 +234,7 @@ import {
232
234
  resolveDocument,
233
235
  scanExportEligible,
234
236
  scanExports
235
- } from "./chunk-VAJMJ47E.js";
237
+ } from "./chunk-6MPRSFXI.js";
236
238
  import {
237
239
  FLINT_CONFIG_FILENAME,
238
240
  FLINT_JSON_FILENAME,
@@ -295,12 +297,15 @@ import {
295
297
  writeFlintJson,
296
298
  writeFlintToml
297
299
  } from "./chunk-CBGQBE6C.js";
300
+ import "./chunk-JSBRDJBE.js";
298
301
  export {
299
302
  FLINT_CONFIG_FILENAME,
300
303
  FLINT_JSON_FILENAME,
301
304
  FLINT_VERSION,
302
305
  GLOBAL_CONFIG_FILENAME,
303
306
  LiveSessionManager,
307
+ OBSIDIAN_REPO_URL,
308
+ OBSIDIAN_WINDOWS_REPO_URL,
304
309
  STANDARD_DIRECTORIES,
305
310
  TranscriptWatcher,
306
311
  addCodebaseDeclaration,
@@ -6,8 +6,9 @@ import {
6
6
  resolveDocument,
7
7
  scanExportEligible,
8
8
  scanExports
9
- } from "./chunk-VAJMJ47E.js";
9
+ } from "./chunk-6MPRSFXI.js";
10
10
  import "./chunk-CBGQBE6C.js";
11
+ import "./chunk-JSBRDJBE.js";
11
12
  export {
12
13
  buildAllExports,
13
14
  buildExport,