facult 2.17.11 → 2.17.13
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 +1 -1
- package/src/doctor.ts +5 -2
- package/src/remote.ts +49 -4
package/package.json
CHANGED
package/src/doctor.ts
CHANGED
|
@@ -614,10 +614,13 @@ function shellQuote(value: string): string {
|
|
|
614
614
|
}
|
|
615
615
|
|
|
616
616
|
function projectAiInitCommand(rootDir: string, flags: string[] = []): string {
|
|
617
|
+
const projectRoot = projectRootFromAiRoot(rootDir);
|
|
618
|
+
const rootFlag = projectRoot ? "--project-root" : "--root";
|
|
619
|
+
const rootValue = projectRoot ?? rootDir;
|
|
617
620
|
return [
|
|
618
621
|
"fclt templates init project-ai",
|
|
619
|
-
|
|
620
|
-
shellQuote(
|
|
622
|
+
rootFlag,
|
|
623
|
+
shellQuote(rootValue),
|
|
621
624
|
...flags,
|
|
622
625
|
].join(" ");
|
|
623
626
|
}
|
package/src/remote.ts
CHANGED
|
@@ -3048,7 +3048,7 @@ function printTemplatesHelp() {
|
|
|
3048
3048
|
"fclt templates init operating-model [--global|--project|--root PATH] [--update] [--force] [--dry-run]"
|
|
3049
3049
|
),
|
|
3050
3050
|
renderCode(
|
|
3051
|
-
"fclt templates init project-ai [--root PATH] [--update] [--force] [--dry-run]"
|
|
3051
|
+
"fclt templates init project-ai [--project-root PATH|--root PATH] [--update] [--force] [--dry-run]"
|
|
3052
3052
|
),
|
|
3053
3053
|
renderCode(
|
|
3054
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]"
|
|
@@ -3124,16 +3124,22 @@ const TEMPLATE_INIT_VALUE_FLAGS = new Set([
|
|
|
3124
3124
|
function parseTemplateInitArgs(argv: string[]): {
|
|
3125
3125
|
positional: string[];
|
|
3126
3126
|
rootArg?: string;
|
|
3127
|
+
projectRootArg?: string;
|
|
3127
3128
|
} {
|
|
3128
3129
|
const positional: string[] = [];
|
|
3129
3130
|
let rootArg: string | undefined;
|
|
3131
|
+
let projectRootArg: string | undefined;
|
|
3130
3132
|
for (let i = 0; i < argv.length; i += 1) {
|
|
3131
3133
|
const arg = argv[i];
|
|
3132
3134
|
if (!arg) {
|
|
3133
3135
|
continue;
|
|
3134
3136
|
}
|
|
3135
3137
|
if (arg === "--root") {
|
|
3136
|
-
|
|
3138
|
+
const value = argv[i + 1];
|
|
3139
|
+
if (!value || value.startsWith("-")) {
|
|
3140
|
+
throw new Error("--root requires a path value");
|
|
3141
|
+
}
|
|
3142
|
+
rootArg = value;
|
|
3137
3143
|
i += 1;
|
|
3138
3144
|
continue;
|
|
3139
3145
|
}
|
|
@@ -3141,6 +3147,19 @@ function parseTemplateInitArgs(argv: string[]): {
|
|
|
3141
3147
|
rootArg = arg.slice("--root=".length);
|
|
3142
3148
|
continue;
|
|
3143
3149
|
}
|
|
3150
|
+
if (arg === "--project-root") {
|
|
3151
|
+
const value = argv[i + 1];
|
|
3152
|
+
if (!value || value.startsWith("-")) {
|
|
3153
|
+
throw new Error("--project-root requires a path value");
|
|
3154
|
+
}
|
|
3155
|
+
projectRootArg = value;
|
|
3156
|
+
i += 1;
|
|
3157
|
+
continue;
|
|
3158
|
+
}
|
|
3159
|
+
if (arg.startsWith("--project-root=")) {
|
|
3160
|
+
projectRootArg = arg.slice("--project-root=".length);
|
|
3161
|
+
continue;
|
|
3162
|
+
}
|
|
3144
3163
|
if (TEMPLATE_INIT_VALUE_FLAGS.has(arg)) {
|
|
3145
3164
|
i += 1;
|
|
3146
3165
|
continue;
|
|
@@ -3154,7 +3173,22 @@ function parseTemplateInitArgs(argv: string[]): {
|
|
|
3154
3173
|
}
|
|
3155
3174
|
positional.push(arg);
|
|
3156
3175
|
}
|
|
3157
|
-
return { positional, rootArg };
|
|
3176
|
+
return { positional, rootArg, projectRootArg };
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
function expandHomePath(pathValue: string, homeDir: string): string {
|
|
3180
|
+
if (pathValue === "~") {
|
|
3181
|
+
return homeDir;
|
|
3182
|
+
}
|
|
3183
|
+
if (pathValue.startsWith("~/")) {
|
|
3184
|
+
return `${homeDir}/${pathValue.slice(2)}`;
|
|
3185
|
+
}
|
|
3186
|
+
return pathValue;
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3189
|
+
function projectAiRootFromProjectArg(value: string, homeDir?: string): string {
|
|
3190
|
+
const resolved = resolve(expandHomePath(value, homeDir ?? homedir()));
|
|
3191
|
+
return basename(resolved) === ".ai" ? resolved : join(resolved, ".ai");
|
|
3158
3192
|
}
|
|
3159
3193
|
|
|
3160
3194
|
export async function sourcesCommand(
|
|
@@ -3552,6 +3586,10 @@ export async function templatesCommand(
|
|
|
3552
3586
|
process.exitCode = 2;
|
|
3553
3587
|
return;
|
|
3554
3588
|
}
|
|
3589
|
+
if (args.includes("--help") || args.includes("-h") || args[0] === "help") {
|
|
3590
|
+
printTemplatesHelp();
|
|
3591
|
+
return;
|
|
3592
|
+
}
|
|
3555
3593
|
const dryRun = args.includes("--dry-run");
|
|
3556
3594
|
const force = args.includes("--force");
|
|
3557
3595
|
const update = args.includes("--update");
|
|
@@ -3563,7 +3601,14 @@ export async function templatesCommand(
|
|
|
3563
3601
|
try {
|
|
3564
3602
|
const result = await scaffoldBuiltinProjectAiPack({
|
|
3565
3603
|
cwd: ctx.cwd,
|
|
3566
|
-
rootDir:
|
|
3604
|
+
rootDir:
|
|
3605
|
+
parsedArgs.rootArg ??
|
|
3606
|
+
(parsedArgs.projectRootArg
|
|
3607
|
+
? projectAiRootFromProjectArg(
|
|
3608
|
+
parsedArgs.projectRootArg,
|
|
3609
|
+
ctx.homeDir
|
|
3610
|
+
)
|
|
3611
|
+
: ctx.rootDir),
|
|
3567
3612
|
homeDir: ctx.homeDir,
|
|
3568
3613
|
dryRun,
|
|
3569
3614
|
force,
|