@nuucognition/flint-cli 0.6.0-dev.10 → 0.6.0-dev.11

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.
Files changed (2) hide show
  1. package/dist/index.js +375 -150
  2. package/package.json +3 -4
package/dist/index.js CHANGED
@@ -452,7 +452,7 @@ async function startLoginFlow(config) {
452
452
  const codeChallenge = createHash("sha256").update(codeVerifier).digest("base64url");
453
453
  const cliLabel = config.cliname ?? "nuu";
454
454
  step(`Logging in to ${import_picocolors.default.bold(config.accountUrl)}`);
455
- return new Promise((resolve19, reject) => {
455
+ return new Promise((resolve20, reject) => {
456
456
  let settled = false;
457
457
  const finish = (fn) => {
458
458
  if (settled) return;
@@ -499,7 +499,7 @@ async function startLoginFlow(config) {
499
499
  };
500
500
  res.writeHead(200, { "Content-Type": "text/html" });
501
501
  res.end(resultHtml(true, "Login successful", "You can close this tab and return to the terminal."));
502
- void saveAuth(credentials, authEnv).then(() => finish(() => resolve19(credentials))).catch((cause) => {
502
+ void saveAuth(credentials, authEnv).then(() => finish(() => resolve20(credentials))).catch((cause) => {
503
503
  const message = cause instanceof Error ? cause.message : String(cause);
504
504
  finish(() => {
505
505
  stepFail(`Failed to save credentials: ${message}`);
@@ -537,7 +537,7 @@ async function startLoginFlow(config) {
537
537
  step("Exchanging authorization code for session token...");
538
538
  void exchangeCode(config.accountUrl, code, codeVerifier).then(async (credentials) => {
539
539
  await saveAuth(credentials, authEnv);
540
- finish(() => resolve19(credentials));
540
+ finish(() => resolve20(credentials));
541
541
  }).catch((cause) => {
542
542
  const message = cause instanceof Error ? cause.message : String(cause);
543
543
  finish(() => {
@@ -68038,14 +68038,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
68038
68038
  };
68039
68039
  }
68040
68040
  function readAndResolve(iter) {
68041
- var resolve19 = iter[kLastResolve];
68042
- if (resolve19 !== null) {
68041
+ var resolve20 = iter[kLastResolve];
68042
+ if (resolve20 !== null) {
68043
68043
  var data = iter[kStream].read();
68044
68044
  if (data !== null) {
68045
68045
  iter[kLastPromise] = null;
68046
68046
  iter[kLastResolve] = null;
68047
68047
  iter[kLastReject] = null;
68048
- resolve19(createIterResult(data, false));
68048
+ resolve20(createIterResult(data, false));
68049
68049
  }
68050
68050
  }
68051
68051
  }
@@ -68053,13 +68053,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
68053
68053
  process.nextTick(readAndResolve, iter);
68054
68054
  }
68055
68055
  function wrapForNext(lastPromise, iter) {
68056
- return function(resolve19, reject) {
68056
+ return function(resolve20, reject) {
68057
68057
  lastPromise.then(function() {
68058
68058
  if (iter[kEnded]) {
68059
- resolve19(createIterResult(void 0, true));
68059
+ resolve20(createIterResult(void 0, true));
68060
68060
  return;
68061
68061
  }
68062
- iter[kHandlePromise](resolve19, reject);
68062
+ iter[kHandlePromise](resolve20, reject);
68063
68063
  }, reject);
68064
68064
  };
68065
68065
  }
@@ -68079,12 +68079,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
68079
68079
  return Promise.resolve(createIterResult(void 0, true));
68080
68080
  }
68081
68081
  if (this[kStream].destroyed) {
68082
- return new Promise(function(resolve19, reject) {
68082
+ return new Promise(function(resolve20, reject) {
68083
68083
  process.nextTick(function() {
68084
68084
  if (_this[kError]) {
68085
68085
  reject(_this[kError]);
68086
68086
  } else {
68087
- resolve19(createIterResult(void 0, true));
68087
+ resolve20(createIterResult(void 0, true));
68088
68088
  }
68089
68089
  });
68090
68090
  });
@@ -68107,13 +68107,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
68107
68107
  return this;
68108
68108
  }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
68109
68109
  var _this2 = this;
68110
- return new Promise(function(resolve19, reject) {
68110
+ return new Promise(function(resolve20, reject) {
68111
68111
  _this2[kStream].destroy(null, function(err) {
68112
68112
  if (err) {
68113
68113
  reject(err);
68114
68114
  return;
68115
68115
  }
68116
- resolve19(createIterResult(void 0, true));
68116
+ resolve20(createIterResult(void 0, true));
68117
68117
  });
68118
68118
  });
68119
68119
  }), _Object$setPrototypeO), AsyncIteratorPrototype);
@@ -68135,15 +68135,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
68135
68135
  value: stream._readableState.endEmitted,
68136
68136
  writable: true
68137
68137
  }), _defineProperty(_Object$create, kHandlePromise, {
68138
- value: function value(resolve19, reject) {
68138
+ value: function value(resolve20, reject) {
68139
68139
  var data = iterator[kStream].read();
68140
68140
  if (data) {
68141
68141
  iterator[kLastPromise] = null;
68142
68142
  iterator[kLastResolve] = null;
68143
68143
  iterator[kLastReject] = null;
68144
- resolve19(createIterResult(data, false));
68144
+ resolve20(createIterResult(data, false));
68145
68145
  } else {
68146
- iterator[kLastResolve] = resolve19;
68146
+ iterator[kLastResolve] = resolve20;
68147
68147
  iterator[kLastReject] = reject;
68148
68148
  }
68149
68149
  },
@@ -68162,12 +68162,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
68162
68162
  iterator[kError] = err;
68163
68163
  return;
68164
68164
  }
68165
- var resolve19 = iterator[kLastResolve];
68166
- if (resolve19 !== null) {
68165
+ var resolve20 = iterator[kLastResolve];
68166
+ if (resolve20 !== null) {
68167
68167
  iterator[kLastPromise] = null;
68168
68168
  iterator[kLastResolve] = null;
68169
68169
  iterator[kLastReject] = null;
68170
- resolve19(createIterResult(void 0, true));
68170
+ resolve20(createIterResult(void 0, true));
68171
68171
  }
68172
68172
  iterator[kEnded] = true;
68173
68173
  });
@@ -68180,7 +68180,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
68180
68180
  require_from = __commonJS2({
68181
68181
  "../../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js"(exports, module) {
68182
68182
  "use strict";
68183
- function asyncGeneratorStep(gen, resolve19, reject, _next, _throw, key, arg) {
68183
+ function asyncGeneratorStep(gen, resolve20, reject, _next, _throw, key, arg) {
68184
68184
  try {
68185
68185
  var info2 = gen[key](arg);
68186
68186
  var value = info2.value;
@@ -68189,7 +68189,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
68189
68189
  return;
68190
68190
  }
68191
68191
  if (info2.done) {
68192
- resolve19(value);
68192
+ resolve20(value);
68193
68193
  } else {
68194
68194
  Promise.resolve(value).then(_next, _throw);
68195
68195
  }
@@ -68197,13 +68197,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
68197
68197
  function _asyncToGenerator(fn) {
68198
68198
  return function() {
68199
68199
  var self2 = this, args = arguments;
68200
- return new Promise(function(resolve19, reject) {
68200
+ return new Promise(function(resolve20, reject) {
68201
68201
  var gen = fn.apply(self2, args);
68202
68202
  function _next(value) {
68203
- asyncGeneratorStep(gen, resolve19, reject, _next, _throw, "next", value);
68203
+ asyncGeneratorStep(gen, resolve20, reject, _next, _throw, "next", value);
68204
68204
  }
68205
68205
  function _throw(err) {
68206
- asyncGeneratorStep(gen, resolve19, reject, _next, _throw, "throw", err);
68206
+ asyncGeneratorStep(gen, resolve20, reject, _next, _throw, "throw", err);
68207
68207
  }
68208
68208
  _next(void 0);
68209
68209
  });
@@ -70184,14 +70184,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
70184
70184
  }
70185
70185
  const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
70186
70186
  if (options22.wait) {
70187
- return new Promise((resolve19, reject) => {
70187
+ return new Promise((resolve20, reject) => {
70188
70188
  subprocess.once("error", reject);
70189
70189
  subprocess.once("close", (exitCode) => {
70190
70190
  if (!options22.allowNonzeroExitCode && exitCode > 0) {
70191
70191
  reject(new Error(`Exited with code ${exitCode}`));
70192
70192
  return;
70193
70193
  }
70194
- resolve19(subprocess);
70194
+ resolve20(subprocess);
70195
70195
  });
70196
70196
  });
70197
70197
  }
@@ -79744,7 +79744,7 @@ function createMigrationContext(flintPath, options3 = {}) {
79744
79744
  });
79745
79745
  const error3 = options3.error || (() => {
79746
79746
  });
79747
- const resolve19 = (p) => join12(flintPath, p);
79747
+ const resolve20 = (p) => join12(flintPath, p);
79748
79748
  return {
79749
79749
  flintPath,
79750
79750
  log,
@@ -79752,34 +79752,34 @@ function createMigrationContext(flintPath, options3 = {}) {
79752
79752
  error: error3,
79753
79753
  async exists(path31) {
79754
79754
  try {
79755
- await access2(resolve19(path31));
79755
+ await access2(resolve20(path31));
79756
79756
  return true;
79757
79757
  } catch {
79758
79758
  return false;
79759
79759
  }
79760
79760
  },
79761
79761
  async read(path31) {
79762
- return readFile6(resolve19(path31), "utf-8");
79762
+ return readFile6(resolve20(path31), "utf-8");
79763
79763
  },
79764
79764
  async write(path31, content) {
79765
- const fullPath = resolve19(path31);
79765
+ const fullPath = resolve20(path31);
79766
79766
  await mkdir6(dirname22(fullPath), { recursive: true });
79767
79767
  await writeFile5(fullPath, content, "utf-8");
79768
79768
  },
79769
79769
  async delete(path31) {
79770
- await unlink2(resolve19(path31));
79770
+ await unlink2(resolve20(path31));
79771
79771
  },
79772
79772
  // ── Intent (flint.toml) ──────────────────────────────────────────────
79773
79773
  async readIntentText() {
79774
79774
  try {
79775
- return await readFile6(resolve19("flint.toml"), "utf-8");
79775
+ return await readFile6(resolve20("flint.toml"), "utf-8");
79776
79776
  } catch (err) {
79777
79777
  if (err.code === "ENOENT") return null;
79778
79778
  throw err;
79779
79779
  }
79780
79780
  },
79781
79781
  async writeIntentText(text) {
79782
- await writeFile5(resolve19("flint.toml"), text, "utf-8");
79782
+ await writeFile5(resolve20("flint.toml"), text, "utf-8");
79783
79783
  },
79784
79784
  async readIntent() {
79785
79785
  const text = await this.readIntentText();
@@ -79788,7 +79788,7 @@ function createMigrationContext(flintPath, options3 = {}) {
79788
79788
  // ── Lockfile (flint.json) ────────────────────────────────────────────
79789
79789
  async readLockfile() {
79790
79790
  try {
79791
- const text = await readFile6(resolve19("flint.json"), "utf-8");
79791
+ const text = await readFile6(resolve20("flint.json"), "utf-8");
79792
79792
  return JSON.parse(text);
79793
79793
  } catch (err) {
79794
79794
  if (err.code === "ENOENT") return null;
@@ -79796,23 +79796,23 @@ function createMigrationContext(flintPath, options3 = {}) {
79796
79796
  }
79797
79797
  },
79798
79798
  async writeLockfile(next) {
79799
- await writeFile5(resolve19("flint.json"), JSON.stringify(next, null, 2) + "\n", "utf-8");
79799
+ await writeFile5(resolve20("flint.json"), JSON.stringify(next, null, 2) + "\n", "utf-8");
79800
79800
  },
79801
79801
  // ── Filesystem ───────────────────────────────────────────────────────
79802
79802
  fs: {
79803
79803
  async mv(from, to) {
79804
- const dest = resolve19(to);
79804
+ const dest = resolve20(to);
79805
79805
  await mkdir6(dirname22(dest), { recursive: true });
79806
- await rename6(resolve19(from), dest);
79806
+ await rename6(resolve20(from), dest);
79807
79807
  },
79808
79808
  async rm(path31, options22) {
79809
- await fsRm(resolve19(path31), { recursive: options22?.recursive ?? false, force: true });
79809
+ await fsRm(resolve20(path31), { recursive: options22?.recursive ?? false, force: true });
79810
79810
  },
79811
79811
  async mkdir(path31, options22) {
79812
- await mkdir6(resolve19(path31), { recursive: options22?.recursive ?? true });
79812
+ await mkdir6(resolve20(path31), { recursive: options22?.recursive ?? true });
79813
79813
  },
79814
79814
  async readDir(path31) {
79815
- return readdir9(resolve19(path31));
79815
+ return readdir9(resolve20(path31));
79816
79816
  }
79817
79817
  }
79818
79818
  };
@@ -87332,6 +87332,7 @@ __export(dist_exports, {
87332
87332
  parseTinderboxToml: () => parseTinderboxToml,
87333
87333
  personExists: () => personExists,
87334
87334
  postOpenVault: () => postOpenVault,
87335
+ postOrbhLaunch: () => postOrbhLaunch,
87335
87336
  prepareShardStart: () => prepareShardStart,
87336
87337
  propagateRepoToFlint: () => propagateRepoToFlint,
87337
87338
  pullShard: () => pullShard,
@@ -90158,6 +90159,58 @@ async function postOpenVault(port, absPath, timeoutMs = 2e3) {
90158
90159
  req.end();
90159
90160
  });
90160
90161
  }
90162
+ async function postOrbhLaunch(port, profile2, prompt6 = "", timeoutMs = 1e4) {
90163
+ return new Promise((resolvePromise) => {
90164
+ const body = JSON.stringify({ profile: profile2, prompt: prompt6 });
90165
+ const req = request(
90166
+ {
90167
+ hostname: "127.0.0.1",
90168
+ port,
90169
+ path: "/workspace/orbh/launch",
90170
+ method: "POST",
90171
+ headers: {
90172
+ "Content-Type": "application/json",
90173
+ "Content-Length": Buffer.byteLength(body)
90174
+ },
90175
+ timeout: timeoutMs
90176
+ },
90177
+ (res) => {
90178
+ const chunks = [];
90179
+ res.on("data", (chunk) => chunks.push(chunk));
90180
+ res.on("end", () => {
90181
+ const text = Buffer.concat(chunks).toString("utf-8");
90182
+ try {
90183
+ const parsed = JSON.parse(text);
90184
+ if (parsed.ok === true && typeof parsed.leafId === "string") {
90185
+ resolvePromise({
90186
+ ok: true,
90187
+ leafId: parsed.leafId,
90188
+ pid: typeof parsed.pid === "number" ? parsed.pid : null
90189
+ });
90190
+ return;
90191
+ }
90192
+ const errorMessage = typeof parsed.error === "string" ? parsed.error : `unexpected response (status ${res.statusCode ?? "unknown"})`;
90193
+ resolvePromise({ ok: false, error: errorMessage });
90194
+ } catch {
90195
+ resolvePromise({ ok: false, error: `invalid JSON response (status ${res.statusCode ?? "unknown"})` });
90196
+ }
90197
+ });
90198
+ res.on("error", (err) => {
90199
+ resolvePromise({ ok: false, error: err.message });
90200
+ });
90201
+ }
90202
+ );
90203
+ req.on("timeout", () => {
90204
+ req.destroy();
90205
+ resolvePromise({ ok: false, error: `request timed out after ${timeoutMs}ms` });
90206
+ });
90207
+ req.on("error", (err) => {
90208
+ resolvePromise({ ok: false, error: err.message });
90209
+ });
90210
+ req.write(body);
90211
+ req.end();
90212
+ });
90213
+ }
90161
90214
  function isRecord3(value) {
90162
90215
  return !!value && typeof value === "object" && !Array.isArray(value);
90163
90216
  }
@@ -159639,21 +159692,21 @@ var require_react_development = __commonJS({
159639
159692
  );
159640
159693
  actScopeDepth = prevActScopeDepth;
159641
159694
  }
159642
- function recursivelyFlushAsyncActWork(returnValue, resolve19, reject) {
159695
+ function recursivelyFlushAsyncActWork(returnValue, resolve20, reject) {
159643
159696
  var queue = ReactSharedInternals.actQueue;
159644
159697
  if (null !== queue)
159645
159698
  if (0 !== queue.length)
159646
159699
  try {
159647
159700
  flushActQueue(queue);
159648
159701
  enqueueTask(function() {
159649
- return recursivelyFlushAsyncActWork(returnValue, resolve19, reject);
159702
+ return recursivelyFlushAsyncActWork(returnValue, resolve20, reject);
159650
159703
  });
159651
159704
  return;
159652
159705
  } catch (error3) {
159653
159706
  ReactSharedInternals.thrownErrors.push(error3);
159654
159707
  }
159655
159708
  else ReactSharedInternals.actQueue = null;
159656
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve19(returnValue);
159709
+ 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve20(returnValue);
159657
159710
  }
159658
159711
  function flushActQueue(queue) {
159659
159712
  if (!isFlushing) {
@@ -159840,7 +159893,7 @@ var require_react_development = __commonJS({
159840
159893
  ));
159841
159894
  });
159842
159895
  return {
159843
- then: function(resolve19, reject) {
159896
+ then: function(resolve20, reject) {
159844
159897
  didAwaitActCall = true;
159845
159898
  thenable.then(
159846
159899
  function(returnValue) {
@@ -159850,7 +159903,7 @@ var require_react_development = __commonJS({
159850
159903
  flushActQueue(queue), enqueueTask(function() {
159851
159904
  return recursivelyFlushAsyncActWork(
159852
159905
  returnValue,
159853
- resolve19,
159906
+ resolve20,
159854
159907
  reject
159855
159908
  );
159856
159909
  });
@@ -159864,7 +159917,7 @@ var require_react_development = __commonJS({
159864
159917
  ReactSharedInternals.thrownErrors.length = 0;
159865
159918
  reject(_thrownError);
159866
159919
  }
159867
- } else resolve19(returnValue);
159920
+ } else resolve20(returnValue);
159868
159921
  },
159869
159922
  function(error3) {
159870
159923
  popActScope(prevActQueue, prevActScopeDepth);
@@ -159886,15 +159939,15 @@ var require_react_development = __commonJS({
159886
159939
  if (0 < ReactSharedInternals.thrownErrors.length)
159887
159940
  throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
159888
159941
  return {
159889
- then: function(resolve19, reject) {
159942
+ then: function(resolve20, reject) {
159890
159943
  didAwaitActCall = true;
159891
159944
  0 === prevActScopeDepth ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
159892
159945
  return recursivelyFlushAsyncActWork(
159893
159946
  returnValue$jscomp$0,
159894
- resolve19,
159947
+ resolve20,
159895
159948
  reject
159896
159949
  );
159897
- })) : resolve19(returnValue$jscomp$0);
159950
+ })) : resolve20(returnValue$jscomp$0);
159898
159951
  }
159899
159952
  };
159900
159953
  };
@@ -164704,8 +164757,8 @@ var require_react_reconciler_production = __commonJS({
164704
164757
  currentEntangledActionThenable = {
164705
164758
  status: "pending",
164706
164759
  value: void 0,
164707
- then: function(resolve19) {
164708
- entangledListeners.push(resolve19);
164760
+ then: function(resolve20) {
164761
+ entangledListeners.push(resolve20);
164709
164762
  }
164710
164763
  };
164711
164764
  }
@@ -164728,8 +164781,8 @@ var require_react_reconciler_production = __commonJS({
164728
164781
  status: "pending",
164729
164782
  value: null,
164730
164783
  reason: null,
164731
- then: function(resolve19) {
164732
- listeners.push(resolve19);
164784
+ then: function(resolve20) {
164785
+ listeners.push(resolve20);
164733
164786
  }
164734
164787
  };
164735
164788
  thenable.then(
@@ -174328,8 +174381,8 @@ var require_react_reconciler_development = __commonJS({
174328
174381
  currentEntangledActionThenable = {
174329
174382
  status: "pending",
174330
174383
  value: void 0,
174331
- then: function(resolve19) {
174332
- entangledListeners.push(resolve19);
174384
+ then: function(resolve20) {
174385
+ entangledListeners.push(resolve20);
174333
174386
  }
174334
174387
  };
174335
174388
  }
@@ -174352,8 +174405,8 @@ var require_react_reconciler_development = __commonJS({
174352
174405
  status: "pending",
174353
174406
  value: null,
174354
174407
  reason: null,
174355
- then: function(resolve19) {
174356
- listeners.push(resolve19);
174408
+ then: function(resolve20) {
174409
+ listeners.push(resolve20);
174357
174410
  }
174358
174411
  };
174359
174412
  thenable.then(
@@ -195249,8 +195302,8 @@ var init_ink = __esm({
195249
195302
  }
195250
195303
  }
195251
195304
  async waitUntilExit() {
195252
- this.exitPromise ||= new Promise((resolve19, reject) => {
195253
- this.resolveExitPromise = resolve19;
195305
+ this.exitPromise ||= new Promise((resolve20, reject) => {
195306
+ this.resolveExitPromise = resolve20;
195254
195307
  this.rejectExitPromise = reject;
195255
195308
  });
195256
195309
  if (!this.beforeExitHandler) {
@@ -196280,12 +196333,12 @@ async function pickSession(options3) {
196280
196333
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
196281
196334
  throw new Error("orbh continue requires an interactive TTY.");
196282
196335
  }
196283
- return new Promise((resolve19) => {
196336
+ return new Promise((resolve20) => {
196284
196337
  let resolved = false;
196285
196338
  const handle = (session) => {
196286
196339
  if (resolved) return;
196287
196340
  resolved = true;
196288
- resolve19(session);
196341
+ resolve20(session);
196289
196342
  };
196290
196343
  const instance = render_default(
196291
196344
  (0, import_react29.createElement)(SessionPicker, {
@@ -196564,6 +196617,7 @@ var FEATURES = createFeatureRegistry([
196564
196617
  { id: "helper", tier: "prod", type: "command", description: "Helper utilities for workflows", requiresAuth: false },
196565
196618
  { id: "delete", tier: "prod", type: "command", description: "Permanently delete a flint", requiresAuth: false },
196566
196619
  { id: "open", tier: "prod", type: "command", description: "Open flint in applications", requiresAuth: false },
196620
+ { id: "obshn", tier: "prod", type: "command", description: "Open a new Obsidian terminal tab and launch an Orbh interactive session", requiresAuth: false },
196567
196621
  { id: "reference", tier: "prod", type: "command", description: "Manage references to codebases and Flints", requiresAuth: false },
196568
196622
  { id: "resolve", tier: "prod", type: "command", description: "Resolve external resources to local paths", requiresAuth: false },
196569
196623
  { id: "fulfill", tier: "prod", type: "command", description: "Fulfill external resources with local paths", requiresAuth: false },
@@ -196682,10 +196736,10 @@ async function confirm(message) {
196682
196736
  input: process.stdin,
196683
196737
  output: process.stdout
196684
196738
  });
196685
- return new Promise((resolve19) => {
196739
+ return new Promise((resolve20) => {
196686
196740
  rl.question(`${message} (y/N) `, (answer) => {
196687
196741
  rl.close();
196688
- resolve19(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
196742
+ resolve20(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
196689
196743
  });
196690
196744
  });
196691
196745
  }
@@ -197355,15 +197409,49 @@ var openCommand = new Command("open").argument("[flint-name]", "Name of the flin
197355
197409
  }
197356
197410
  });
197357
197411
 
197412
+ // src/commands/flint/obshn.ts
197413
+ init_dist();
197414
+ init_dist5();
197415
+ import { resolve as resolve11 } from "path";
197416
+ var obshnCommand = new Command("obshn").argument("<profile>", "Orbh profile target (e.g. claude/o47h)").argument("[prompt]", "Optional initial prompt for the agent").option("-p, --path <dir>", "Path to flint (default: auto-detect)").description("Open a new terminal tab in Obsidian and launch `flint orbh i <profile>`").action(async (profile2, prompt6, options3) => {
197417
+ try {
197418
+ const flintPath = options3.path ? resolve11(options3.path) : await findFlintRoot(process.cwd());
197419
+ if (!flintPath) {
197420
+ console.error(export_pc.red("Error: Not inside a flint. Use --path or cd into a flint folder."));
197421
+ process.exit(1);
197422
+ }
197423
+ const plugin = await findLivePluginForVault(flintPath);
197424
+ if (!plugin) {
197425
+ console.error(export_pc.red("Error: NUU Obsidian plugin is not running for this flint."));
197426
+ console.log(export_pc.dim("Open the flint in Obsidian first (`flint open`) and try again."));
197427
+ process.exit(1);
197428
+ }
197429
+ const result = await postOrbhLaunch(plugin.port, profile2, prompt6 ?? "");
197430
+ if (!result.ok) {
197431
+ console.error(export_pc.red(`Error: ${result.error}`));
197432
+ process.exit(1);
197433
+ }
197434
+ console.log(export_pc.green(`Launched orbh in Obsidian (profile: ${profile2})`));
197435
+ console.log(export_pc.dim(` leaf: ${result.leafId}`));
197436
+ if (result.pid !== null) {
197437
+ console.log(export_pc.dim(` pid: ${result.pid}`));
197438
+ }
197439
+ } catch (err) {
197440
+ const message = err instanceof Error ? err.message : String(err);
197441
+ console.error(export_pc.red(`Error: ${message}`));
197442
+ process.exit(1);
197443
+ }
197444
+ });
197445
+
197358
197446
  // src/commands/flint/register.ts
197359
197447
  init_dist5();
197360
197448
  init_dist();
197361
- import { resolve as resolve11 } from "path";
197449
+ import { resolve as resolve12 } from "path";
197362
197450
  var registerCommand = new Command("register").description("Register a flint in the global registry").argument("[path]", "Path to a flint to register (defaults to current directory)").option("-f, --force", "Re-register even if already registered (updates entry)").action(async (pathArg, options3) => {
197363
197451
  try {
197364
197452
  let targetPath;
197365
197453
  if (pathArg) {
197366
- targetPath = resolve11(expandPath(pathArg));
197454
+ targetPath = resolve12(expandPath(pathArg));
197367
197455
  } else {
197368
197456
  const detected = await findFlintRoot(process.cwd());
197369
197457
  targetPath = detected ?? process.cwd();
@@ -197392,12 +197480,12 @@ var registerCommand = new Command("register").description("Register a flint in t
197392
197480
  // src/commands/flint/unregister.ts
197393
197481
  init_dist5();
197394
197482
  init_dist();
197395
- import { resolve as resolve12 } from "path";
197483
+ import { resolve as resolve13 } from "path";
197396
197484
  var unregisterCommand = new Command("unregister").description("Unregister a flint from the global registry").argument("[path]", "Path to the flint (defaults to current directory)").option("-f, --force", "Skip confirmation prompt").action(async (pathArg, options3) => {
197397
197485
  try {
197398
197486
  let targetPath;
197399
197487
  if (pathArg) {
197400
- targetPath = resolve12(expandPath(pathArg));
197488
+ targetPath = resolve13(expandPath(pathArg));
197401
197489
  } else {
197402
197490
  const flintRoot = await findFlintRoot(process.cwd());
197403
197491
  if (!flintRoot) {
@@ -197442,17 +197530,17 @@ Flint to unregister:`);
197442
197530
  init_dist();
197443
197531
  init_dist5();
197444
197532
  import { rm as rm10 } from "fs/promises";
197445
- import { resolve as resolve13 } from "path";
197533
+ import { resolve as resolve14 } from "path";
197446
197534
  import { createInterface as createInterface2 } from "readline";
197447
197535
  async function prompt(question) {
197448
197536
  const rl = createInterface2({
197449
197537
  input: process.stdin,
197450
197538
  output: process.stdout
197451
197539
  });
197452
- return new Promise((resolve19) => {
197540
+ return new Promise((resolve20) => {
197453
197541
  rl.question(question, (answer) => {
197454
197542
  rl.close();
197455
- resolve19(answer.trim());
197543
+ resolve20(answer.trim());
197456
197544
  });
197457
197545
  });
197458
197546
  }
@@ -197462,7 +197550,7 @@ var deleteCommand = new Command("delete").description("Permanently delete a flin
197462
197550
  if (nameOrPath) {
197463
197551
  entry = await findFlintByName(nameOrPath);
197464
197552
  if (!entry) {
197465
- const resolved = resolve13(expandPath(nameOrPath));
197553
+ const resolved = resolve14(expandPath(nameOrPath));
197466
197554
  entry = await findFlintByPath(resolved);
197467
197555
  }
197468
197556
  if (!entry) {
@@ -197512,10 +197600,10 @@ var deleteCommand = new Command("delete").description("Permanently delete a flin
197512
197600
  // src/commands/flint/move.ts
197513
197601
  init_dist();
197514
197602
  init_dist5();
197515
- import { resolve as resolve14 } from "path";
197603
+ import { resolve as resolve15 } from "path";
197516
197604
  var moveCommand = new Command("move").description("Move a Flint and update the registry").argument("<name-or-path>", "Flint name from registry or a direct path to a Flint").argument("<destination>", "Destination path").option("-f, --force", "Overwrite destination if it already exists").action(async (nameOrPath, destination, options3) => {
197517
197605
  try {
197518
- const result = await moveFlint(nameOrPath, resolve14(expandPath(destination)), { force: options3.force });
197606
+ const result = await moveFlint(nameOrPath, resolve15(expandPath(destination)), { force: options3.force });
197519
197607
  if (result.crossDevice) {
197520
197608
  console.log(export_pc.yellow(`Cross-device move: copying ${abbreviatePath(result.from)} -> ${abbreviatePath(result.to)}`));
197521
197609
  }
@@ -197813,7 +197901,7 @@ var LiveRender = class {
197813
197901
  async function runStep(entry, step2, index, total, live) {
197814
197902
  const cols = Math.max(40, process.stdout.columns ?? 80);
197815
197903
  const tailMax = Math.max(20, cols - 6);
197816
- return new Promise((resolve19) => {
197904
+ return new Promise((resolve20) => {
197817
197905
  const child = spawn4(process.execPath, [entry, ...step2.args], {
197818
197906
  stdio: ["ignore", "pipe", "pipe"],
197819
197907
  windowsHide: true
@@ -197854,7 +197942,7 @@ async function runStep(entry, step2, index, total, live) {
197854
197942
  child.on("close", (code) => {
197855
197943
  done = true;
197856
197944
  clearInterval(ticker);
197857
- resolve19({ code: code ?? 1, tail: captured });
197945
+ resolve20({ code: code ?? 1, tail: captured });
197858
197946
  });
197859
197947
  });
197860
197948
  }
@@ -198069,14 +198157,14 @@ function readPkgVersion() {
198069
198157
  }
198070
198158
  var PACKAGE_NAME = "@nuucognition/flint-cli";
198071
198159
  function fetchLatestVersion() {
198072
- return new Promise((resolve19, reject) => {
198160
+ return new Promise((resolve20, reject) => {
198073
198161
  https.get(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`, (res) => {
198074
198162
  let data = "";
198075
198163
  res.on("data", (chunk) => data += chunk);
198076
198164
  res.on("end", () => {
198077
198165
  try {
198078
198166
  const json = JSON.parse(data);
198079
- resolve19(json.version);
198167
+ resolve20(json.version);
198080
198168
  } catch {
198081
198169
  reject(new Error("Failed to parse registry response"));
198082
198170
  }
@@ -198137,16 +198225,17 @@ var updateCommand = new Command("update").description("Update flint-cli to the l
198137
198225
  init_dist();
198138
198226
  init_dist5();
198139
198227
  import { join as join28 } from "path";
198228
+ import { stat as stat13 } from "fs/promises";
198140
198229
  import * as readline from "readline";
198141
198230
  async function prompt2(question) {
198142
198231
  const rl = readline.createInterface({
198143
198232
  input: process.stdin,
198144
198233
  output: process.stdout
198145
198234
  });
198146
- return new Promise((resolve19) => {
198235
+ return new Promise((resolve20) => {
198147
198236
  rl.question(question, (answer) => {
198148
198237
  rl.close();
198149
- resolve19(answer.trim());
198238
+ resolve20(answer.trim());
198150
198239
  });
198151
198240
  });
198152
198241
  }
@@ -198210,6 +198299,63 @@ Cloned repository: ${export_pc.bold(name)}`));
198210
198299
  process.exit(1);
198211
198300
  }
198212
198301
  })
198302
+ ).addCommand(
198303
+ new Command("register").description(
198304
+ "Register an existing folder under Workspace/Repos/ in flint.toml, using its git origin remote"
198305
+ ).argument("<name>", "Name of the folder under Workspace/Repos/").option("-p, --path <dir>", "Path to flint (default: auto-detect)").action(async (name, options3) => {
198306
+ try {
198307
+ const flintPath = options3.path || await findFlintRoot(process.cwd());
198308
+ if (!flintPath) {
198309
+ console.error(export_pc.red("Error: Not inside a Flint. Use --path or cd into a Flint."));
198310
+ process.exit(1);
198311
+ }
198312
+ const existing = await getWorkspaceRepository(flintPath, name);
198313
+ if (existing) {
198314
+ console.error(export_pc.red(`Error: Repository "${name}" already exists in flint.toml.`));
198315
+ process.exit(1);
198316
+ }
198317
+ const repoPath = join28(flintPath, "Workspace", "Repos", name);
198318
+ try {
198319
+ const s = await stat13(repoPath);
198320
+ if (!s.isDirectory()) {
198321
+ console.error(export_pc.red(`Error: ${abbreviatePath(repoPath)} is not a directory.`));
198322
+ process.exit(1);
198323
+ }
198324
+ } catch {
198325
+ console.error(export_pc.red(`Error: Folder not found: ${abbreviatePath(repoPath)}`));
198326
+ process.exit(1);
198327
+ }
198328
+ try {
198329
+ await stat13(join28(repoPath, ".git"));
198330
+ } catch {
198331
+ console.error(
198332
+ export_pc.red(`Error: ${abbreviatePath(repoPath)} is not a git repository (no .git found).`)
198333
+ );
198334
+ process.exit(1);
198335
+ }
198336
+ const remote = await getRemoteUrl(repoPath);
198337
+ if (!remote) {
198338
+ console.error(
198339
+ export_pc.red(`Error: No 'origin' remote set on ${abbreviatePath(repoPath)}.`)
198340
+ );
198341
+ process.exit(1);
198342
+ }
198343
+ console.log(export_pc.dim(`
198344
+ Registering ${name}...`));
198345
+ await addWorkspaceRepository(flintPath, name, remote);
198346
+ await updateGitignore(flintPath);
198347
+ console.log(export_pc.green(`
198348
+ Registered repository: ${export_pc.bold(name)}`));
198349
+ console.log(export_pc.dim(` Remote: ${remote}`));
198350
+ console.log(export_pc.dim(` Path: ${abbreviatePath(repoPath)}`));
198351
+ console.log(export_pc.dim(" Added to flint.toml [workspace] section"));
198352
+ console.log();
198353
+ } catch (err) {
198354
+ const message = err instanceof Error ? err.message : String(err);
198355
+ console.error(export_pc.red(`Error: ${message}`));
198356
+ process.exit(1);
198357
+ }
198358
+ })
198213
198359
  ).addCommand(
198214
198360
  new Command("remove").description("Remove a workspace repository").argument("<name>", "Name of the repository to remove").option("-f, --force", "Skip confirmation prompt").option("-p, --path <dir>", "Path to flint (default: auto-detect)").action(async (name, options3) => {
198215
198361
  try {
@@ -198319,7 +198465,7 @@ Updated repository: ${export_pc.bold(name)}`));
198319
198465
  // src/commands/sources/source.ts
198320
198466
  init_dist();
198321
198467
  init_dist5();
198322
- import { stat as stat13 } from "fs/promises";
198468
+ import { stat as stat14 } from "fs/promises";
198323
198469
  import { join as join29, basename as basename6 } from "path";
198324
198470
  import { rm as rm11, readdir as readdir14, mkdir as mkdir15, copyFile as copyFile3 } from "fs/promises";
198325
198471
  import * as readline2 from "readline";
@@ -198328,10 +198474,10 @@ async function prompt3(question) {
198328
198474
  input: process.stdin,
198329
198475
  output: process.stdout
198330
198476
  });
198331
- return new Promise((resolve19) => {
198477
+ return new Promise((resolve20) => {
198332
198478
  rl.question(question, (answer) => {
198333
198479
  rl.close();
198334
- resolve19(answer.trim());
198480
+ resolve20(answer.trim());
198335
198481
  });
198336
198482
  });
198337
198483
  }
@@ -198682,11 +198828,11 @@ var sourceCommand = new Command("source").description("Manage external sources (
198682
198828
  // src/commands/references/reference.ts
198683
198829
  init_dist();
198684
198830
  init_dist5();
198685
- import { resolve as resolve15 } from "path";
198831
+ import { resolve as resolve16 } from "path";
198686
198832
  import { homedir as homedir6 } from "os";
198687
198833
  function expandPath2(p) {
198688
- if (p.startsWith("~/")) return resolve15(homedir6(), p.slice(2));
198689
- return resolve15(p);
198834
+ if (p.startsWith("~/")) return resolve16(homedir6(), p.slice(2));
198835
+ return resolve16(p);
198690
198836
  }
198691
198837
  var referenceCommand = new Command("reference").description("Manage references to codebases and other Flints").addCommand(
198692
198838
  new Command("codebase").description("Add a codebase reference").argument("<name>", "Name of the codebase (Proper Case)").argument("<path>", "Path to the codebase directory").action(async (name, codebasePath) => {
@@ -198829,16 +198975,16 @@ function printRefStatus(ref) {
198829
198975
  // src/commands/references/fulfill.ts
198830
198976
  init_dist();
198831
198977
  init_dist5();
198832
- import { stat as stat14 } from "fs/promises";
198833
- import { resolve as resolve16 } from "path";
198978
+ import { stat as stat15 } from "fs/promises";
198979
+ import { resolve as resolve17 } from "path";
198834
198980
  import { homedir as homedir7 } from "os";
198835
198981
  function expandPath3(p) {
198836
- if (p.startsWith("~/")) return resolve16(homedir7(), p.slice(2));
198837
- return resolve16(p);
198982
+ if (p.startsWith("~/")) return resolve17(homedir7(), p.slice(2));
198983
+ return resolve17(p);
198838
198984
  }
198839
198985
  async function pathExists5(p) {
198840
198986
  try {
198841
- await stat14(p);
198987
+ await stat15(p);
198842
198988
  return true;
198843
198989
  } catch {
198844
198990
  return false;
@@ -198938,7 +199084,7 @@ ${unfulfilled.length} unfulfilled codebase reference(s):
198938
199084
  console.log(export_pc.dim(` \u2192 ${resolvedPath}`));
198939
199085
  }
198940
199086
  function prompt4(message) {
198941
- return new Promise((resolve19) => {
199087
+ return new Promise((resolve20) => {
198942
199088
  process.stdout.write(message);
198943
199089
  let data = "";
198944
199090
  process.stdin.setEncoding("utf-8");
@@ -198946,7 +199092,7 @@ function prompt4(message) {
198946
199092
  process.stdin.once("data", (chunk) => {
198947
199093
  data = chunk.toString().trim();
198948
199094
  process.stdin.pause();
198949
- resolve19(data);
199095
+ resolve20(data);
198950
199096
  });
198951
199097
  });
198952
199098
  }
@@ -199368,12 +199514,12 @@ var latticeCommand = new Command("lattice").description("Manage lattice connecti
199368
199514
  // src/commands/outputs/export.ts
199369
199515
  init_dist();
199370
199516
  init_dist5();
199371
- import { readFile as readFile13, stat as stat15 } from "fs/promises";
199517
+ import { readFile as readFile13, stat as stat16 } from "fs/promises";
199372
199518
  import { join as join30, basename as basename7 } from "path";
199373
199519
  import { createInterface as createInterface5 } from "readline";
199374
199520
  async function exists3(path31) {
199375
199521
  try {
199376
- await stat15(path31);
199522
+ await stat16(path31);
199377
199523
  return true;
199378
199524
  } catch {
199379
199525
  return false;
@@ -199381,10 +199527,10 @@ async function exists3(path31) {
199381
199527
  }
199382
199528
  function prompt5(question) {
199383
199529
  const rl = createInterface5({ input: process.stdin, output: process.stdout });
199384
- return new Promise((resolve19) => {
199530
+ return new Promise((resolve20) => {
199385
199531
  rl.question(question, (answer) => {
199386
199532
  rl.close();
199387
- resolve19(answer.trim());
199533
+ resolve20(answer.trim());
199388
199534
  });
199389
199535
  });
199390
199536
  }
@@ -199653,11 +199799,11 @@ var exportCommand = new Command("export").description("Manage exports").addComma
199653
199799
  init_dist();
199654
199800
  init_dist5();
199655
199801
  import { randomUUID as randomUUID6 } from "crypto";
199656
- import { copyFile as copyFile4, mkdir as mkdir16, writeFile as writeFile12, unlink as unlink3, stat as stat16 } from "fs/promises";
199657
- import { join as join31, basename as basename8, resolve as resolve17 } from "path";
199802
+ import { copyFile as copyFile4, mkdir as mkdir16, writeFile as writeFile12, unlink as unlink3, stat as stat17 } from "fs/promises";
199803
+ import { join as join31, basename as basename8, resolve as resolve18 } from "path";
199658
199804
  async function exists4(path31) {
199659
199805
  try {
199660
- await stat16(path31);
199806
+ await stat17(path31);
199661
199807
  return true;
199662
199808
  } catch {
199663
199809
  return false;
@@ -199686,13 +199832,13 @@ var sendCommand = new Command("send").description("Send files to another Flint's
199686
199832
  const copyFileNames = /* @__PURE__ */ new Set();
199687
199833
  if (options3.copy) {
199688
199834
  for (const cf of options3.copy) {
199689
- copyFileNames.add(basename8(resolve17(cf)));
199835
+ copyFileNames.add(basename8(resolve18(cf)));
199690
199836
  }
199691
199837
  }
199692
199838
  const moveFiles = [];
199693
199839
  const copyFiles = [];
199694
199840
  for (const file of files) {
199695
- const sourcePath = resolve17(file);
199841
+ const sourcePath = resolve18(file);
199696
199842
  if (!await exists4(sourcePath)) {
199697
199843
  console.error(export_pc.red(`Error: File not found: ${file}`));
199698
199844
  process.exit(1);
@@ -199707,9 +199853,9 @@ var sendCommand = new Command("send").description("Send files to another Flint's
199707
199853
  }
199708
199854
  if (options3.copy) {
199709
199855
  for (const cf of options3.copy) {
199710
- const sourcePath = resolve17(cf);
199856
+ const sourcePath = resolve18(cf);
199711
199857
  const fileName = basename8(cf);
199712
- if (files.some((f) => basename8(resolve17(f)) === fileName)) continue;
199858
+ if (files.some((f) => basename8(resolve18(f)) === fileName)) continue;
199713
199859
  if (!await exists4(sourcePath)) {
199714
199860
  console.error(export_pc.red(`Error: Copy file not found: ${cf}`));
199715
199861
  process.exit(1);
@@ -201922,14 +202068,14 @@ init_dist5();
201922
202068
  init_dist();
201923
202069
  import { execSync as execSync4, spawnSync } from "child_process";
201924
202070
  import { join as join36 } from "path";
201925
- import { stat as stat17, rm as rm12 } from "fs/promises";
202071
+ import { stat as stat18, rm as rm12 } from "fs/promises";
201926
202072
  import { platform as platform5 } from "os";
201927
202073
  import { request as httpRequest } from "http";
201928
202074
  function getExpectedRepoUrl() {
201929
202075
  return platform5() === "win32" ? OBSIDIAN_WINDOWS_REPO_URL : OBSIDIAN_REPO_URL;
201930
202076
  }
201931
202077
  function postReload(port) {
201932
- return new Promise((resolve19, reject) => {
202078
+ return new Promise((resolve20, reject) => {
201933
202079
  const req = httpRequest({
201934
202080
  hostname: "127.0.0.1",
201935
202081
  port,
@@ -201938,7 +202084,7 @@ function postReload(port) {
201938
202084
  timeout: 2e3
201939
202085
  }, (res) => {
201940
202086
  res.resume();
201941
- res.on("end", () => resolve19());
202087
+ res.on("end", () => resolve20());
201942
202088
  });
201943
202089
  req.on("error", reject);
201944
202090
  req.on("timeout", () => req.destroy(new Error("timeout")));
@@ -201969,7 +202115,7 @@ obsidianCommand.command("update").description("Force pull latest .obsidian from
201969
202115
  }
201970
202116
  const obsidianDir = join36(flintPath, ".obsidian");
201971
202117
  try {
201972
- await stat17(obsidianDir);
202118
+ await stat18(obsidianDir);
201973
202119
  } catch {
201974
202120
  console.error(export_pc.red("Error: .obsidian directory not found."));
201975
202121
  console.log(export_pc.dim("Run `flint init` to create a new flint with .obsidian."));
@@ -202059,7 +202205,7 @@ if (isFeatureEnabled(FEATURES, "obsidian.push", resolveRuntimeSync({ cliname: "f
202059
202205
  }
202060
202206
  const obsidianDir = join36(flintPath, ".obsidian");
202061
202207
  try {
202062
- await stat17(obsidianDir);
202208
+ await stat18(obsidianDir);
202063
202209
  } catch {
202064
202210
  console.error(export_pc.red("Error: .obsidian directory not found."));
202065
202211
  process.exit(1);
@@ -202097,7 +202243,7 @@ obsidianCommand.command("reset").description("Delete and re-clone .obsidian from
202097
202243
  const obsidianDir = join36(flintPath, ".obsidian");
202098
202244
  let exists7 = false;
202099
202245
  try {
202100
- await stat17(obsidianDir);
202246
+ await stat18(obsidianDir);
202101
202247
  exists7 = true;
202102
202248
  } catch {
202103
202249
  }
@@ -205031,7 +205177,7 @@ function buildCodexAppServerArgs(options3 = {}) {
205031
205177
  return args;
205032
205178
  }
205033
205179
  async function bootstrapCodexSession(cwd2, initPrompt, options3 = {}) {
205034
- return new Promise((resolve19, reject) => {
205180
+ return new Promise((resolve20, reject) => {
205035
205181
  const start = async () => {
205036
205182
  const executable = await getExecutable("codex");
205037
205183
  const spawnCmd = executable.resolvedCommand.cmd;
@@ -205077,7 +205223,7 @@ async function bootstrapCodexSession(cwd2, initPrompt, options3 = {}) {
205077
205223
  if (message.id === 3 && message.result) {
205078
205224
  cleanup();
205079
205225
  proc.kill();
205080
- resolve19(threadId);
205226
+ resolve20(threadId);
205081
205227
  return;
205082
205228
  }
205083
205229
  if (message.error && (message.id ?? 0) <= 3) {
@@ -205541,7 +205687,7 @@ async function waitForGeminiNativeSession(cwd2, timeoutMs, pollMs, options3) {
205541
205687
  if (discovered) {
205542
205688
  return discovered;
205543
205689
  }
205544
- await new Promise((resolve19) => setTimeout(resolve19, pollMs));
205690
+ await new Promise((resolve20) => setTimeout(resolve20, pollMs));
205545
205691
  }
205546
205692
  return null;
205547
205693
  }
@@ -205837,7 +205983,7 @@ async function bootstrapGrokSession(cwd2, initPrompt, options3 = {}) {
205837
205983
  if (options3.extraArgs) {
205838
205984
  args.push(...options3.extraArgs);
205839
205985
  }
205840
- return new Promise((resolve19, reject) => {
205986
+ return new Promise((resolve20, reject) => {
205841
205987
  const proc = spawn23(executable.resolvedCommand.cmd, args, {
205842
205988
  stdio: ["ignore", "pipe", "pipe"],
205843
205989
  cwd: cwd2,
@@ -205872,7 +206018,7 @@ async function bootstrapGrokSession(cwd2, initPrompt, options3 = {}) {
205872
206018
  reject(new Error(`Grok bootstrap completed but no sessionId in output: ${stdout.slice(-400)}`));
205873
206019
  return;
205874
206020
  }
205875
- resolve19(sessionId);
206021
+ resolve20(sessionId);
205876
206022
  });
205877
206023
  });
205878
206024
  }
@@ -206423,7 +206569,7 @@ async function waitForOpencodeNativeSessionByOrbhSessionId(cwd2, orbhSessionId,
206423
206569
  if (discovered) {
206424
206570
  return discovered;
206425
206571
  }
206426
- await new Promise((resolve19) => setTimeout(resolve19, pollMs));
206572
+ await new Promise((resolve20) => setTimeout(resolve20, pollMs));
206427
206573
  }
206428
206574
  return null;
206429
206575
  }
@@ -207870,7 +208016,7 @@ async function waitForCodexNativeSession(cwd2, timeoutMs, pollMs, options3) {
207870
208016
  if (discovered) {
207871
208017
  return discovered;
207872
208018
  }
207873
- await new Promise((resolve19) => setTimeout(resolve19, pollMs));
208019
+ await new Promise((resolve20) => setTimeout(resolve20, pollMs));
207874
208020
  }
207875
208021
  return null;
207876
208022
  }
@@ -208390,7 +208536,7 @@ var READY_TIMEOUT_MS = 1e4;
208390
208536
  var COMPLETION_TIMEOUT_MS = 30 * 60 * 1e3;
208391
208537
  var POLL_INTERVAL_MS = 250;
208392
208538
  function sleep2(ms) {
208393
- return new Promise((resolve19) => setTimeout(resolve19, ms));
208539
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
208394
208540
  }
208395
208541
  async function waitForSession(sessionsDir, sessionId, predicate, timeoutMs) {
208396
208542
  const deadline = Date.now() + timeoutMs;
@@ -208725,7 +208871,7 @@ async function waitForInteractiveResult(child, options3, session, runtime2) {
208725
208871
  stderrStream?.on("data", (chunk) => {
208726
208872
  stderr += chunk.toString();
208727
208873
  });
208728
- return new Promise((resolve19, reject) => {
208874
+ return new Promise((resolve20, reject) => {
208729
208875
  const onSigHup = () => {
208730
208876
  const latest = readSession(options3.sessionsDir, session.id) ?? session;
208731
208877
  const run2 = getCurrentRun(latest);
@@ -208751,7 +208897,7 @@ async function waitForInteractiveResult(child, options3, session, runtime2) {
208751
208897
  const latest = readSession(options3.sessionsDir, session.id) ?? session;
208752
208898
  finalizeSessionRun(latest, exitCode ?? null, signal ?? null, stderr);
208753
208899
  writeSession(options3.sessionsDir, latest);
208754
- resolve19({ session: latest, exitCode: exitCode ?? 0 });
208900
+ resolve20({ session: latest, exitCode: exitCode ?? 0 });
208755
208901
  });
208756
208902
  });
208757
208903
  }
@@ -211291,7 +211437,7 @@ async function defaultResumeDeferredSession(resumeContext) {
211291
211437
  var REQUEST_SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
211292
211438
  var REQUEST_LAUNCH_OPTION_KEYS = ["runtime", "stream", "continues", "maxTurns", "budget", "model", "title", "description", "timeout"];
211293
211439
  function sleep3(ms) {
211294
- return new Promise((resolve19) => setTimeout(resolve19, ms));
211440
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
211295
211441
  }
211296
211442
  function getStringOption(options3, key) {
211297
211443
  if (typeof options3 !== "object" || options3 === null || !(key in options3)) {
@@ -212147,7 +212293,7 @@ ${export_pc.bold("Orbh Session Stats")} ${export_pc.dim("\xB7")} ${export_pc.cya
212147
212293
  const deadline = Date.now() + 3e4;
212148
212294
  process.stdout.write(export_pc.dim("Waiting for transcript path resolution..."));
212149
212295
  while (Date.now() <= deadline) {
212150
- await new Promise((resolve19) => setTimeout(resolve19, 500));
212296
+ await new Promise((resolve20) => setTimeout(resolve20, 500));
212151
212297
  const fresh = resolveSession(sessionsDir, id);
212152
212298
  if (!fresh) {
212153
212299
  break;
@@ -212241,7 +212387,7 @@ ${export_pc.bold("Orbh Session Stats")} ${export_pc.dim("\xB7")} ${export_pc.cya
212241
212387
  });
212242
212388
  watcher.start();
212243
212389
  if (isTerminalStatus(session.status)) {
212244
- await new Promise((resolve19) => setTimeout(resolve19, 500));
212390
+ await new Promise((resolve20) => setTimeout(resolve20, 500));
212245
212391
  watcher.stop();
212246
212392
  if (entryCount > 0) {
212247
212393
  process.stdout.write("\r\x1B[2K");
@@ -212644,7 +212790,7 @@ ${export_pc.bold("Orbh Session Stats")} ${export_pc.dim("\xB7")} ${export_pc.cya
212644
212790
  deliverPendingMessagesToStdout(sessionsDir, session.id);
212645
212791
  return;
212646
212792
  }
212647
- await new Promise((resolve19) => setTimeout(resolve19, 2e3));
212793
+ await new Promise((resolve20) => setTimeout(resolve20, 2e3));
212648
212794
  }
212649
212795
  updateSession(sessionsDir, session.id, { status: "in-progress" });
212650
212796
  console.error("Timeout: no response received");
@@ -213514,11 +213660,11 @@ ${export_pc.bold("Requests")} ${export_pc.dim(`\u2014 session ${shortId(session.
213514
213660
  // src/commands/agent/tinderbox.ts
213515
213661
  init_dist();
213516
213662
  init_dist5();
213517
- import { stat as stat18 } from "fs/promises";
213663
+ import { stat as stat19 } from "fs/promises";
213518
213664
  import { join as join46 } from "path";
213519
213665
  async function pathExists6(path31) {
213520
213666
  try {
213521
- await stat18(path31);
213667
+ await stat19(path31);
213522
213668
  return true;
213523
213669
  } catch {
213524
213670
  return false;
@@ -214307,7 +214453,7 @@ init_dist5();
214307
214453
  import { createRequire as createRequire2 } from "module";
214308
214454
  import path28 from "path";
214309
214455
  import { spawn as spawn11 } from "child_process";
214310
- import { stat as stat20 } from "fs/promises";
214456
+ import { stat as stat21 } from "fs/promises";
214311
214457
 
214312
214458
  // ../../packages/flint-sdk/src/common.ts
214313
214459
  function isRecord11(value) {
@@ -214918,12 +215064,12 @@ var FlintServerClient = class {
214918
215064
 
214919
215065
  // ../../packages/flint-sdk/src/discovery.ts
214920
215066
  async function loadNodeModules() {
214921
- const [{ readFile: readFile21 }, { homedir: homedir14 }, { join: join56, resolve: resolve19 }] = await Promise.all([
215067
+ const [{ readFile: readFile21 }, { homedir: homedir14 }, { join: join56, resolve: resolve20 }] = await Promise.all([
214922
215068
  import("fs/promises"),
214923
215069
  import("os"),
214924
215070
  import("path")
214925
215071
  ]);
214926
- return { readFile: readFile21, homedir: homedir14, join: join56, resolve: resolve19 };
215072
+ return { readFile: readFile21, homedir: homedir14, join: join56, resolve: resolve20 };
214927
215073
  }
214928
215074
  function normalizeRegistryFile(value) {
214929
215075
  if (!value || typeof value !== "object" || !("servers" in value) || !Array.isArray(value.servers)) {
@@ -214980,7 +215126,7 @@ import { join as join54 } from "path";
214980
215126
  import { readdirSync as readdirSync22, existsSync as existsSync43 } from "fs";
214981
215127
  import { randomUUID as randomUUID9, createHash as createHash3 } from "crypto";
214982
215128
  import { EventEmitter as EventEmitter5 } from "events";
214983
- import { readFile as readFile17, stat as stat19 } from "fs/promises";
215129
+ import { readFile as readFile17, stat as stat20 } from "fs/promises";
214984
215130
  import { spawn as spawn10 } from "child_process";
214985
215131
  import path26 from "path";
214986
215132
  import chokidar from "chokidar";
@@ -216527,7 +216673,7 @@ import { stat as stat25 } from "fs/promises";
216527
216673
  import path27 from "path";
216528
216674
  import { mkdir as mkdir18, readFile as readFile27, writeFile as writeFile14 } from "fs/promises";
216529
216675
  import { homedir as homedir12 } from "os";
216530
- import { join as join47, resolve as resolve18 } from "path";
216676
+ import { join as join47, resolve as resolve19 } from "path";
216531
216677
  init_dist5();
216532
216678
  init_dist5();
216533
216679
  init_dist5();
@@ -216841,7 +216987,7 @@ function normalizePath2(filePath) {
216841
216987
  }
216842
216988
  async function safeReadFile(filePath) {
216843
216989
  try {
216844
- const fileStats = await stat19(filePath);
216990
+ const fileStats = await stat20(filePath);
216845
216991
  if (!fileStats.isFile()) {
216846
216992
  return null;
216847
216993
  }
@@ -217208,8 +217354,8 @@ async function writeServerRegistry(servers) {
217208
217354
  }
217209
217355
  async function registerServer(entry) {
217210
217356
  const servers = await readServerRegistry();
217211
- const resolvedPath = resolve18(entry.flintPath);
217212
- const filtered = servers.filter((s) => resolve18(s.flintPath) !== resolvedPath);
217357
+ const resolvedPath = resolve19(entry.flintPath);
217358
+ const filtered = servers.filter((s) => resolve19(s.flintPath) !== resolvedPath);
217213
217359
  filtered.push({
217214
217360
  ...entry,
217215
217361
  flintPath: resolvedPath
@@ -217218,9 +217364,9 @@ async function registerServer(entry) {
217218
217364
  }
217219
217365
  async function deregisterServer(flintPath, pid) {
217220
217366
  const servers = await readServerRegistry();
217221
- const resolvedPath = resolve18(flintPath);
217367
+ const resolvedPath = resolve19(flintPath);
217222
217368
  const filtered = servers.filter(
217223
- (s) => !(resolve18(s.flintPath) === resolvedPath && s.pid === pid)
217369
+ (s) => !(resolve19(s.flintPath) === resolvedPath && s.pid === pid)
217224
217370
  );
217225
217371
  await writeServerRegistry(filtered);
217226
217372
  }
@@ -217253,7 +217399,7 @@ async function identityCheck(url, expectedPath, expectedId) {
217253
217399
  return identity4.flintId === expectedId;
217254
217400
  }
217255
217401
  if (identity4.flintPath) {
217256
- return resolve18(identity4.flintPath) === resolve18(expectedPath);
217402
+ return resolve19(identity4.flintPath) === resolve19(expectedPath);
217257
217403
  }
217258
217404
  return false;
217259
217405
  } catch {
@@ -219013,7 +219159,7 @@ serverCommand.command("dev").description(
219013
219159
  }
219014
219160
  const devEntry = path28.join(serverPkgDir, "src", "dev.ts");
219015
219161
  try {
219016
- await stat20(devEntry);
219162
+ await stat21(devEntry);
219017
219163
  } catch {
219018
219164
  console.error(export_pc.red("Dev mode requires the server source directory."));
219019
219165
  console.log(
@@ -219136,8 +219282,8 @@ import { readFile as readFile18, readdir as readdir17, rm as rm14 } from "fs/pro
219136
219282
  import { join as join49 } from "path";
219137
219283
  async function exists6(path31) {
219138
219284
  try {
219139
- const { stat: stat21 } = await import("fs/promises");
219140
- await stat21(path31);
219285
+ const { stat: stat26 } = await import("fs/promises");
219286
+ await stat26(path31);
219141
219287
  return true;
219142
219288
  } catch {
219143
219289
  return false;
@@ -219714,9 +219860,9 @@ function collectFilesRecursively(dirPath) {
219714
219860
  for (const entry of readdirSync10(dirPath)) {
219715
219861
  const fullPath = join50(dirPath, entry);
219716
219862
  try {
219717
- const stat21 = statSync8(fullPath);
219718
- if (stat21.isDirectory()) files.push(...collectFilesRecursively(fullPath));
219719
- else if (stat21.isFile()) files.push(basename10(fullPath));
219863
+ const stat26 = statSync8(fullPath);
219864
+ if (stat26.isDirectory()) files.push(...collectFilesRecursively(fullPath));
219865
+ else if (stat26.isFile()) files.push(basename10(fullPath));
219720
219866
  } catch {
219721
219867
  continue;
219722
219868
  }
@@ -219868,16 +220014,16 @@ function matchVault(records, name) {
219868
220014
  return null;
219869
220015
  }
219870
220016
  function readBody(req) {
219871
- return new Promise((resolve19, reject) => {
220017
+ return new Promise((resolve20, reject) => {
219872
220018
  let data = "";
219873
220019
  req.on("data", (chunk) => data += chunk);
219874
- req.on("end", () => resolve19(data));
220020
+ req.on("end", () => resolve20(data));
219875
220021
  req.on("error", reject);
219876
220022
  });
219877
220023
  }
219878
220024
  async function proxyLaunch(record, body) {
219879
220025
  const payload = JSON.stringify({ profile: body.profile, prompt: body.prompt });
219880
- return new Promise((resolve19, reject) => {
220026
+ return new Promise((resolve20, reject) => {
219881
220027
  const req = http.request(
219882
220028
  {
219883
220029
  host: "127.0.0.1",
@@ -219892,7 +220038,7 @@ async function proxyLaunch(record, body) {
219892
220038
  (res) => {
219893
220039
  let data = "";
219894
220040
  res.on("data", (chunk) => data += chunk);
219895
- res.on("end", () => resolve19({ status: res.statusCode ?? 502, body: data }));
220041
+ res.on("end", () => resolve20({ status: res.statusCode ?? 502, body: data }));
219896
220042
  res.on("error", reject);
219897
220043
  }
219898
220044
  );
@@ -220020,12 +220166,65 @@ var routerCommand = new Command("router").description("Local HTTP broker that pr
220020
220166
  init_dist();
220021
220167
  init_dist5();
220022
220168
  import { readFile as readFile20 } from "fs/promises";
220023
- import { resolve as resolvePath4, basename as basename11 } from "path";
220169
+ import { resolve as resolvePath4, basename as basename11, extname as extname3 } from "path";
220024
220170
  import { spawn as spawn12 } from "child_process";
220025
220171
  import { platform as platform8 } from "os";
220026
220172
  var WIKILINK_RE = /!?\[\[([^\]|#]+?)(?:#[^\]|]*)?(?:\|[^\]]*)?\]\]/g;
220027
220173
  var FENCED_CODE_RE = /^```[\s\S]*?^```/gm;
220028
220174
  var INLINE_CODE_RE = /`[^`\n]*`/g;
220175
+ var EXT_TO_LANG = {
220176
+ ".ts": "typescript",
220177
+ ".tsx": "tsx",
220178
+ ".js": "javascript",
220179
+ ".jsx": "jsx",
220180
+ ".mjs": "javascript",
220181
+ ".cjs": "javascript",
220182
+ ".py": "python",
220183
+ ".rs": "rust",
220184
+ ".go": "go",
220185
+ ".java": "java",
220186
+ ".kt": "kotlin",
220187
+ ".swift": "swift",
220188
+ ".c": "c",
220189
+ ".h": "c",
220190
+ ".cpp": "cpp",
220191
+ ".hpp": "cpp",
220192
+ ".cc": "cpp",
220193
+ ".cs": "csharp",
220194
+ ".rb": "ruby",
220195
+ ".php": "php",
220196
+ ".lua": "lua",
220197
+ ".r": "r",
220198
+ ".sh": "bash",
220199
+ ".bash": "bash",
220200
+ ".zsh": "bash",
220201
+ ".fish": "fish",
220202
+ ".yaml": "yaml",
220203
+ ".yml": "yaml",
220204
+ ".json": "json",
220205
+ ".toml": "toml",
220206
+ ".xml": "xml",
220207
+ ".html": "html",
220208
+ ".htm": "html",
220209
+ ".css": "css",
220210
+ ".scss": "scss",
220211
+ ".sass": "sass",
220212
+ ".sql": "sql",
220213
+ ".tex": "latex",
220214
+ ".bib": "bibtex",
220215
+ ".vim": "vim",
220216
+ ".dockerfile": "dockerfile"
220217
+ };
220218
+ function languageFor(filePath) {
220219
+ const base = basename11(filePath).toLowerCase();
220220
+ if (base === "dockerfile") return "dockerfile";
220221
+ if (base === "makefile") return "makefile";
220222
+ const ext2 = extname3(filePath).toLowerCase();
220223
+ return EXT_TO_LANG[ext2] ?? "";
220224
+ }
220225
+ function isPathRef(target) {
220226
+ return target.includes("/");
220227
+ }
220029
220228
  function extractWikilinks(body) {
220030
220229
  const stripped = body.replace(FENCED_CODE_RE, "").replace(INLINE_CODE_RE, "");
220031
220230
  const seen = /* @__PURE__ */ new Set();
@@ -220061,13 +220260,13 @@ async function copyToClipboard(text) {
220061
220260
  cmd = process.env.WAYLAND_DISPLAY ? "wl-copy" : "xclip";
220062
220261
  if (cmd === "xclip") args = ["-selection", "clipboard"];
220063
220262
  }
220064
- await new Promise((resolve19, reject) => {
220263
+ await new Promise((resolve20, reject) => {
220065
220264
  const child = spawn12(cmd, args, { stdio: ["pipe", "ignore", "pipe"] });
220066
220265
  let stderr = "";
220067
220266
  child.stderr.on("data", (chunk) => stderr += chunk.toString());
220068
220267
  child.on("error", (err) => reject(new Error(`failed to launch ${cmd}: ${err.message}`)));
220069
220268
  child.on("close", (code) => {
220070
- if (code === 0) resolve19();
220269
+ if (code === 0) resolve20();
220071
220270
  else reject(new Error(`${cmd} exited with code ${code}: ${stderr.trim()}`));
220072
220271
  });
220073
220272
  child.stdin.end(text, "utf8");
@@ -220098,6 +220297,31 @@ ${mainBody}`];
220098
220297
  const resolved = [];
220099
220298
  const unresolved = [];
220100
220299
  for (const target2 of links) {
220300
+ if (isPathRef(target2)) {
220301
+ const absolute = resolvePath4(flintPath, target2);
220302
+ let content;
220303
+ try {
220304
+ content = await readFile20(absolute, "utf8");
220305
+ } catch {
220306
+ unresolved.push(target2);
220307
+ continue;
220308
+ }
220309
+ if (/\.md$/i.test(target2)) {
220310
+ const body2 = stripFrontmatter3(content).trim();
220311
+ sections.push(`# ${target2}
220312
+
220313
+ ${body2}`);
220314
+ } else {
220315
+ const lang = languageFor(target2);
220316
+ sections.push(`# ${target2}
220317
+
220318
+ \`\`\`${lang}
220319
+ ${content.replace(/\n+$/, "")}
220320
+ \`\`\``);
220321
+ }
220322
+ resolved.push(target2);
220323
+ continue;
220324
+ }
220101
220325
  const found = await getArtifactByTitle(flintPath, target2);
220102
220326
  if (!found) {
220103
220327
  unresolved.push(target2);
@@ -220289,7 +220513,7 @@ program2.name("flint").description("Flint cognitive workspace CLI").version(form
220289
220513
  setCommandGroups(program2, [
220290
220514
  {
220291
220515
  label: "Flint",
220292
- commands: ["init", "list", "status", "open", "register", "unregister", "delete", "move", "sync", "gigasync", "plan", "registry", "update"]
220516
+ commands: ["init", "list", "status", "open", "obshn", "register", "unregister", "delete", "move", "sync", "gigasync", "plan", "registry", "update"]
220293
220517
  },
220294
220518
  {
220295
220519
  label: "Related Entities",
@@ -220336,6 +220560,7 @@ var COMMAND_MAP = [
220336
220560
  { featureId: "gigasync", command: gigasyncCommand },
220337
220561
  { featureId: "git", command: gitCommand },
220338
220562
  { featureId: "open", command: openCommand },
220563
+ { featureId: "obshn", command: obshnCommand },
220339
220564
  { featureId: "register", command: registerCommand },
220340
220565
  { featureId: "unregister", command: unregisterCommand },
220341
220566
  { featureId: "iam", command: iamCommand },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuucognition/flint-cli",
3
- "version": "0.6.0-dev.10",
3
+ "version": "0.6.0-dev.11",
4
4
  "type": "module",
5
5
  "description": "Flint cognitive workspace CLI",
6
6
  "license": "PROPRIETARY",
@@ -17,7 +17,6 @@
17
17
  "dependencies": {
18
18
  "@fastify/cors": "^11.2.0",
19
19
  "@fastify/static": "^8.1.0",
20
- "@nuucognition/flint-cli": "link:",
21
20
  "cfonts": "^3.3.1",
22
21
  "chokidar": "^3.6.0",
23
22
  "fastify": "^5.0.0",
@@ -37,9 +36,9 @@
37
36
  "tsup": "^8.3.5",
38
37
  "tsx": "^4.19.2",
39
38
  "typescript": "^5.9.2",
40
- "@nuucognition/flint": "0.1.0",
41
- "@nuucognition/flint-migrations": "0.1.0",
42
39
  "@nuucognition/flint-sdk": "0.0.1",
40
+ "@nuucognition/flint-migrations": "0.1.0",
41
+ "@nuucognition/flint": "0.1.0",
43
42
  "@nuucognition/flint-server": "0.0.1",
44
43
  "@nuucognition/orbh": "0.0.1-dev.0",
45
44
  "@nuucognition/orbh-cli": "0.1.0-dev.1",