facult 2.17.10 → 2.17.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "facult",
3
- "version": "2.17.10",
3
+ "version": "2.17.11",
4
4
  "description": "Manage canonical AI capabilities, sync surfaces, and evolution state.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/doctor.ts CHANGED
@@ -609,6 +609,19 @@ const UNRESOLVED_REFS_TEMPLATE_RE = /\$\{refs\.([A-Za-z0-9_.-]+)\}/g;
609
609
  const FCLTY_BLOCK_RE =
610
610
  /<!--\s*fclty:([^>]+?)\s*-->([\s\S]*?)<!--\s*\/fclty:\1\s*-->/g;
611
611
 
612
+ function shellQuote(value: string): string {
613
+ return `'${value.replaceAll("'", "'\\''")}'`;
614
+ }
615
+
616
+ function projectAiInitCommand(rootDir: string, flags: string[] = []): string {
617
+ return [
618
+ "fclt templates init project-ai",
619
+ "--root",
620
+ shellQuote(rootDir),
621
+ ...flags,
622
+ ].join(" ");
623
+ }
624
+
612
625
  async function inspectCanonicalGlobalDocs(
613
626
  rootDir: string,
614
627
  opts: { projectRoot?: string | null } = {}
@@ -625,7 +638,7 @@ async function inspectCanonicalGlobalDocs(
625
638
  const text = await readFile(pathValue, "utf8");
626
639
  const issues: DoctorIssue[] = [];
627
640
  const refreshCommand = opts.projectRoot
628
- ? "fclt templates init project-ai --force"
641
+ ? projectAiInitCommand(rootDir, ["--force"])
629
642
  : "fclt templates init operating-model --global --force";
630
643
  const docLabel = opts.projectRoot
631
644
  ? "project AGENTS.global.md"
@@ -1025,7 +1038,7 @@ export async function buildDoctorReport(opts?: {
1025
1038
  message:
1026
1039
  "No canonical capability source was found in the selected .ai root.",
1027
1040
  fix: projectRoot
1028
- ? "Run fclt templates init project-ai from the repo or restore canonical project assets."
1041
+ ? `Run ${projectAiInitCommand(rootDir)} or restore canonical project assets.`
1029
1042
  : "Run fclt templates init operating-model --global.",
1030
1043
  });
1031
1044
  }
@@ -1042,7 +1055,7 @@ export async function buildDoctorReport(opts?: {
1042
1055
  ? "Refresh project operating model"
1043
1056
  : "Refresh global operating model",
1044
1057
  command: projectRoot
1045
- ? "fclt templates init project-ai --force"
1058
+ ? projectAiInitCommand(rootDir, ["--force"])
1046
1059
  : "fclt templates init operating-model --global --force",
1047
1060
  risk: "canonical_write",
1048
1061
  });
@@ -1076,7 +1089,7 @@ export async function buildDoctorReport(opts?: {
1076
1089
  actions.push({
1077
1090
  id: "init-project-ai",
1078
1091
  label: "Initialize project AI root",
1079
- command: "fclt templates init project-ai",
1092
+ command: projectAiInitCommand(rootDir),
1080
1093
  risk: "canonical_write",
1081
1094
  });
1082
1095
  }
package/src/remote.ts CHANGED
@@ -1576,14 +1576,23 @@ async function scaffoldBuiltinOperatingModelPack(args: {
1576
1576
 
1577
1577
  async function scaffoldBuiltinProjectAiPack(args: {
1578
1578
  cwd?: string;
1579
+ rootDir?: string;
1579
1580
  homeDir?: string;
1580
1581
  dryRun?: boolean;
1581
1582
  force?: boolean;
1582
1583
  update?: boolean;
1583
1584
  }): Promise<InstallResult> {
1584
1585
  const cwd = resolve(args.cwd ?? process.cwd());
1586
+ const rootDir = args.rootDir
1587
+ ? resolveCliContextRoot({
1588
+ rootArg: args.rootDir,
1589
+ scope: "project",
1590
+ cwd,
1591
+ homeDir: args.homeDir,
1592
+ })
1593
+ : join(cwd, ".ai");
1585
1594
  return await scaffoldBuiltinOperatingModelPack({
1586
- rootDir: join(cwd, ".ai"),
1595
+ rootDir,
1587
1596
  homeDir: args.homeDir,
1588
1597
  dryRun: args.dryRun,
1589
1598
  force: args.force,
@@ -3039,7 +3048,7 @@ function printTemplatesHelp() {
3039
3048
  "fclt templates init operating-model [--global|--project|--root PATH] [--update] [--force] [--dry-run]"
3040
3049
  ),
3041
3050
  renderCode(
3042
- "fclt templates init project-ai [--update] [--force] [--dry-run]"
3051
+ "fclt templates init project-ai [--root PATH] [--update] [--force] [--dry-run]"
3043
3052
  ),
3044
3053
  renderCode(
3045
3054
  "fclt templates init automation <template-id> [--scope global|project|wide] [--name <name>] [--project-root <path>] [--cwds <path1,path2>] [--rrule <RRULE>] [--status PAUSED|ACTIVE] [--yes] [--dry-run]"
@@ -3554,6 +3563,7 @@ export async function templatesCommand(
3554
3563
  try {
3555
3564
  const result = await scaffoldBuiltinProjectAiPack({
3556
3565
  cwd: ctx.cwd,
3566
+ rootDir: parsedArgs.rootArg,
3557
3567
  homeDir: ctx.homeDir,
3558
3568
  dryRun,
3559
3569
  force,