facult 2.13.4 → 2.13.5

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/package.json +1 -1
  2. package/src/self-update.ts +35 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "facult",
3
- "version": "2.13.4",
3
+ "version": "2.13.5",
4
4
  "description": "Manage canonical AI capabilities, sync surfaces, and evolution state.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -187,10 +187,11 @@ export function looksLikeMiseShim(
187
187
  }
188
188
 
189
189
  async function activeFcltUsesMiseNpmFacult(): Promise<boolean> {
190
- if (!Bun.which("mise")) {
190
+ const misePath = Bun.which("mise") ?? (await resolveCommandPath("mise"));
191
+ if (!misePath) {
191
192
  return false;
192
193
  }
193
- const fcltPath = Bun.which("fclt");
194
+ const fcltPath = Bun.which("fclt") ?? (await resolveCommandPath("fclt"));
194
195
  if (looksLikeMiseNpmFacultExecutable(fcltPath ?? "")) {
195
196
  return true;
196
197
  }
@@ -228,6 +229,24 @@ async function miseHasCurrentFacultTool(): Promise<boolean> {
228
229
  return (await proc.exited) === 0;
229
230
  }
230
231
 
232
+ async function resolveCommandPath(command: string): Promise<string | null> {
233
+ const proc = Bun.spawn({
234
+ cmd: ["sh", "-lc", `command -v ${command}`],
235
+ stdin: "ignore",
236
+ stdout: "pipe",
237
+ stderr: "ignore",
238
+ env: process.env,
239
+ });
240
+ const [stdout, code] = await Promise.all([
241
+ new Response(proc.stdout).text(),
242
+ proc.exited,
243
+ ]);
244
+ if (code !== 0) {
245
+ return null;
246
+ }
247
+ return stdout.trim() || null;
248
+ }
249
+
231
250
  function resolvePlatformTarget(): {
232
251
  platform: string;
233
252
  arch: string;
@@ -292,6 +311,7 @@ async function writeInstallState(args: {
292
311
  method: InstallMethod;
293
312
  packageVersion?: string;
294
313
  binaryPath?: string;
314
+ packageManager?: string;
295
315
  }) {
296
316
  const dir = dirname(facultInstallStatePath(args.home));
297
317
  await mkdir(dir, { recursive: true });
@@ -300,7 +320,11 @@ async function writeInstallState(args: {
300
320
  method: args.method,
301
321
  packageVersion: args.packageVersion,
302
322
  binaryPath: args.binaryPath,
303
- source: args.method === "npm-binary-cache" ? "npm" : "direct",
323
+ packageManager: args.packageManager,
324
+ source:
325
+ args.method === "npm-binary-cache" || args.method === "mise-npm"
326
+ ? "npm"
327
+ : "direct",
304
328
  installedAt: new Date().toISOString(),
305
329
  };
306
330
  await Bun.write(
@@ -426,6 +450,7 @@ async function resolvePackageTargetVersion(requestedVersion?: string): Promise<{
426
450
  }
427
451
 
428
452
  async function selfUpdateViaPackageManager(args: {
453
+ home: string;
429
454
  requestedVersion?: string;
430
455
  dryRun: boolean;
431
456
  preferredPackageManager?: string;
@@ -464,6 +489,12 @@ async function selfUpdateViaPackageManager(args: {
464
489
  await runBestEffort(["mise", "reshim", `npm:${PACKAGE_NAME}`]);
465
490
  }
466
491
  await assertActiveFcltVersion(target.version, pm);
492
+ await writeInstallState({
493
+ home: args.home,
494
+ method: pm === "mise" ? "mise-npm" : "npm-binary-cache",
495
+ packageVersion: target.version,
496
+ packageManager: pm,
497
+ });
467
498
  console.log(`Updated fclt via ${pm}: ${PACKAGE_NAME}@${target.version}`);
468
499
  if (target.resolvedFromLatest) {
469
500
  console.log(`Resolved latest release to ${target.version}`);
@@ -617,6 +648,7 @@ export async function selfUpdateCommand(argv: string[]) {
617
648
  if (method === "npm-binary-cache" || method === "mise-npm") {
618
649
  await selfUpdateViaPackageManager({
619
650
  ...parsed,
651
+ home,
620
652
  method,
621
653
  preferredPackageManager:
622
654
  process.env.FACULT_INSTALL_PM?.trim() || state?.packageManager,