facult 2.17.0 → 2.17.2

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/manage.ts +28 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "facult",
3
- "version": "2.17.0",
3
+ "version": "2.17.2",
4
4
  "description": "Manage canonical AI capabilities, sync surfaces, and evolution state.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/manage.ts CHANGED
@@ -157,6 +157,7 @@ export interface SetupCodexPluginOptions {
157
157
  export interface SetupCodexPluginResult {
158
158
  pluginDir: string;
159
159
  marketplacePath: string;
160
+ marketplaceName: string;
160
161
  changedPaths: string[];
161
162
  dryRun: boolean;
162
163
  codexInstall: {
@@ -367,7 +368,7 @@ function fcltCodexMarketplaceEntry(): Record<string, unknown> {
367
368
  },
368
369
  policy: {
369
370
  installation: "AVAILABLE",
370
- authentication: "NONE",
371
+ authentication: "ON_INSTALL",
371
372
  },
372
373
  category: "Productivity",
373
374
  };
@@ -409,6 +410,18 @@ function hackLocalCodexMarketplaceText(text: string | null): string {
409
410
  );
410
411
  }
411
412
 
413
+ function codexMarketplaceNameFromText(text: string): string {
414
+ const parsed = JSON.parse(text) as unknown;
415
+ if (
416
+ isPlainObject(parsed) &&
417
+ typeof parsed.name === "string" &&
418
+ parsed.name.trim()
419
+ ) {
420
+ return parsed.name;
421
+ }
422
+ return "hack-local";
423
+ }
424
+
412
425
  function withBuiltinFcltCodexMarketplaceEntry(text: string | null): string {
413
426
  const base =
414
427
  text == null
@@ -4662,8 +4675,15 @@ async function planCodexPluginFileChanges(args: {
4662
4675
  async function runCodexPluginAdd(args: {
4663
4676
  codexBin: string;
4664
4677
  cwd: string;
4678
+ marketplaceName: string;
4665
4679
  }): Promise<SetupCodexPluginResult["codexInstall"]> {
4666
- const command = [args.codexBin, "plugin", "add", "fclt@hack-local", "--json"];
4680
+ const command = [
4681
+ args.codexBin,
4682
+ "plugin",
4683
+ "add",
4684
+ `fclt@${args.marketplaceName}`,
4685
+ "--json",
4686
+ ];
4667
4687
  return await new Promise((resolve) => {
4668
4688
  const child = spawn(args.codexBin, command.slice(1), {
4669
4689
  cwd: args.cwd,
@@ -4726,6 +4746,7 @@ export async function setupCodexPlugin(
4726
4746
  }`
4727
4747
  );
4728
4748
  }
4749
+ const marketplaceName = codexMarketplaceNameFromText(marketplaceText);
4729
4750
  if (
4730
4751
  (await readTargetHash(marketplacePath, { normalizeText: false })) !==
4731
4752
  targetContentHash(marketplaceText, { normalizeText: false })
@@ -4752,7 +4773,7 @@ export async function setupCodexPlugin(
4752
4773
  const codexBin =
4753
4774
  opts.codexBin === undefined ? Bun.which("codex") : opts.codexBin;
4754
4775
  codexInstall = codexBin
4755
- ? await runCodexPluginAdd({ codexBin, cwd: home })
4776
+ ? await runCodexPluginAdd({ codexBin, cwd: home, marketplaceName })
4756
4777
  : {
4757
4778
  status: "skipped",
4758
4779
  reason: "codex command not found",
@@ -4763,6 +4784,7 @@ export async function setupCodexPlugin(
4763
4784
  return {
4764
4785
  pluginDir: pluginTargetDir,
4765
4786
  marketplacePath,
4787
+ marketplaceName,
4766
4788
  changedPaths: changedPaths.sort(),
4767
4789
  dryRun: Boolean(opts.dryRun),
4768
4790
  codexInstall,
@@ -5530,6 +5552,9 @@ Options:
5530
5552
  });
5531
5553
  if (json) {
5532
5554
  console.log(JSON.stringify(result, null, 2));
5555
+ if (result.codexInstall.status === "failed") {
5556
+ process.exitCode = 1;
5557
+ }
5533
5558
  return;
5534
5559
  }
5535
5560
  if (dryRun) {