@agent-profile/cli 0.3.0 → 0.3.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.
- package/dist/index.js +71 -32
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7360,6 +7360,53 @@ function isNonInteractive(input) {
|
|
|
7360
7360
|
if (!input.stdout || input.stdout.isTTY !== true) return true;
|
|
7361
7361
|
return false;
|
|
7362
7362
|
}
|
|
7363
|
+
function parseWizardClientSelection(raw) {
|
|
7364
|
+
const normalized = raw.trim().toLowerCase();
|
|
7365
|
+
if (normalized === "" || normalized === "none") return [];
|
|
7366
|
+
const selected = [];
|
|
7367
|
+
for (const token of normalized.split(/[;,]/u).map((item) => item.trim()).filter((item) => item !== "")) {
|
|
7368
|
+
let client;
|
|
7369
|
+
if (/^[0-9]+$/u.test(token)) {
|
|
7370
|
+
client = WIZARD_CLIENT_IDS[Number.parseInt(token, 10) - 1];
|
|
7371
|
+
} else if (WIZARD_CLIENT_IDS.includes(token)) {
|
|
7372
|
+
client = token;
|
|
7373
|
+
}
|
|
7374
|
+
if (client && !selected.includes(client)) {
|
|
7375
|
+
selected.push(client);
|
|
7376
|
+
}
|
|
7377
|
+
}
|
|
7378
|
+
return WIZARD_CLIENT_IDS.filter((id) => selected.includes(id));
|
|
7379
|
+
}
|
|
7380
|
+
function formatWizardClientSelectionQuestion(defaults) {
|
|
7381
|
+
const summary = WIZARD_CLIENT_IDS.map((id, index) => {
|
|
7382
|
+
const enabled = defaults.includes(id);
|
|
7383
|
+
return ` ${index + 1}) ${id}${enabled ? " (default)" : ""}`;
|
|
7384
|
+
}).join("\n");
|
|
7385
|
+
const fallback = defaults.length > 0 ? defaults.join(",") : "none";
|
|
7386
|
+
return `${formatWizardSectionTitle("Choose clients")}
|
|
7387
|
+
Which clients should this profile enable?
|
|
7388
|
+
${summary}
|
|
7389
|
+
Select multiple with commas or semicolons, for example 2,3.
|
|
7390
|
+
Enter numbers or names, or press enter for defaults [${fallback}]: `;
|
|
7391
|
+
}
|
|
7392
|
+
function formatWizardStrategyQuestion(def) {
|
|
7393
|
+
return `${formatWizardSectionTitle("Choose strategy")}
|
|
7394
|
+
How should existing agent instruction files be handled?
|
|
7395
|
+
1) Preserve existing files${def === "preserve" ? " (default)" : ""}
|
|
7396
|
+
2) Add generated regions${def === "regions" ? " (default)" : ""}
|
|
7397
|
+
Choose [1/2]: `;
|
|
7398
|
+
}
|
|
7399
|
+
function formatWizardGitignoreQuestion() {
|
|
7400
|
+
return `${formatWizardSectionTitle("Optional .gitignore update")}
|
|
7401
|
+
Add recommended local-runtime ignore entries to .gitignore?`;
|
|
7402
|
+
}
|
|
7403
|
+
function formatWizardWriteConfirmationQuestion() {
|
|
7404
|
+
return `${formatWizardSectionTitle("Choose run mode")}
|
|
7405
|
+
How should this plan run?
|
|
7406
|
+
1) Dry run preview (default) - write nothing
|
|
7407
|
+
2) Write files now (--write)
|
|
7408
|
+
Choose [1/2]: `;
|
|
7409
|
+
}
|
|
7363
7410
|
function recommendStrategy(report) {
|
|
7364
7411
|
const warnings = [];
|
|
7365
7412
|
const rootFiles = report.files.filter(
|
|
@@ -7417,7 +7464,7 @@ function recommendStrategy(report) {
|
|
|
7417
7464
|
function formatWizardIntro(context, recommendation) {
|
|
7418
7465
|
const lines = [];
|
|
7419
7466
|
lines.push("Agent Profile Init", "");
|
|
7420
|
-
lines.push("Detected
|
|
7467
|
+
lines.push(formatWizardSectionTitle("Detected"));
|
|
7421
7468
|
lines.push(`- languages: ${formatList(context.stack.languages)}`);
|
|
7422
7469
|
lines.push(
|
|
7423
7470
|
`- package managers: ${formatList(context.stack.packageManagers)}`
|
|
@@ -7437,6 +7484,7 @@ function formatWizardIntro(context, recommendation) {
|
|
|
7437
7484
|
lines.push(`- foreign skills/subagents: ${formatList(foreign)}`);
|
|
7438
7485
|
}
|
|
7439
7486
|
lines.push("");
|
|
7487
|
+
lines.push(formatWizardSectionTitle("Recommendation"));
|
|
7440
7488
|
lines.push(`Recommended strategy: ${formatStrategyLabel(recommendation.strategy)}`);
|
|
7441
7489
|
lines.push(`Reason: ${recommendation.reason}`);
|
|
7442
7490
|
const conflictRows = context.report.files.filter(
|
|
@@ -7460,7 +7508,7 @@ function formatWizardIntro(context, recommendation) {
|
|
|
7460
7508
|
}
|
|
7461
7509
|
function formatWizardPlan(context, outcome) {
|
|
7462
7510
|
const lines = [];
|
|
7463
|
-
lines.push("Write plan
|
|
7511
|
+
lines.push(formatWizardSectionTitle("Write plan"));
|
|
7464
7512
|
if (!context.hasExistingProfile) {
|
|
7465
7513
|
lines.push("- create ai-profile.yaml");
|
|
7466
7514
|
} else {
|
|
@@ -7518,8 +7566,9 @@ function formatWizardPlan(context, outcome) {
|
|
|
7518
7566
|
}
|
|
7519
7567
|
function formatWizardDeclined() {
|
|
7520
7568
|
return [
|
|
7569
|
+
"Dry-run selected.",
|
|
7521
7570
|
"No files written.",
|
|
7522
|
-
"Re-run with --write or
|
|
7571
|
+
"Re-run with --write or choose 2 in the wizard to write.",
|
|
7523
7572
|
""
|
|
7524
7573
|
].join("\n");
|
|
7525
7574
|
}
|
|
@@ -7592,10 +7641,7 @@ function createDefaultPrompts(io) {
|
|
|
7592
7641
|
return {
|
|
7593
7642
|
async selectStrategy({ default: def }) {
|
|
7594
7643
|
const raw = await ask(
|
|
7595
|
-
|
|
7596
|
-
1) Preserve existing files${def === "preserve" ? " (default)" : ""}
|
|
7597
|
-
2) Add generated regions${def === "regions" ? " (default)" : ""}
|
|
7598
|
-
Choose [1/2]: `,
|
|
7644
|
+
formatWizardStrategyQuestion(def),
|
|
7599
7645
|
def === "preserve" ? "1" : "2"
|
|
7600
7646
|
);
|
|
7601
7647
|
if (raw === "2" || raw.toLowerCase().startsWith("r")) return "regions";
|
|
@@ -7603,42 +7649,32 @@ Choose [1/2]: `,
|
|
|
7603
7649
|
return def;
|
|
7604
7650
|
},
|
|
7605
7651
|
async selectClients({ defaults }) {
|
|
7606
|
-
const order = WIZARD_CLIENT_IDS;
|
|
7607
|
-
const summary = order.map((id, index) => {
|
|
7608
|
-
const enabled = defaults.includes(id);
|
|
7609
|
-
return ` ${index + 1}) ${id}${enabled ? " (default)" : ""}`;
|
|
7610
|
-
}).join("\n");
|
|
7611
|
-
const fallback = defaults.length > 0 ? defaults.join(",") : "none";
|
|
7612
7652
|
const raw = await ask(
|
|
7613
|
-
|
|
7614
|
-
${summary}
|
|
7615
|
-
Enter comma-separated numbers or names, or press enter for defaults [${fallback}]: `,
|
|
7653
|
+
formatWizardClientSelectionQuestion(defaults),
|
|
7616
7654
|
defaults.join(",")
|
|
7617
7655
|
);
|
|
7618
|
-
|
|
7619
|
-
const tokens = raw.split(",").map((token) => token.trim().toLowerCase()).filter((token) => token !== "");
|
|
7620
|
-
const selected = [];
|
|
7621
|
-
for (const token of tokens) {
|
|
7622
|
-
const byIndex = order[Number.parseInt(token, 10) - 1];
|
|
7623
|
-
if (byIndex !== void 0) {
|
|
7624
|
-
selected.push(byIndex);
|
|
7625
|
-
continue;
|
|
7626
|
-
}
|
|
7627
|
-
if (order.includes(token)) {
|
|
7628
|
-
selected.push(token);
|
|
7629
|
-
}
|
|
7630
|
-
}
|
|
7631
|
-
return order.filter((id) => selected.includes(id));
|
|
7656
|
+
return parseWizardClientSelection(raw);
|
|
7632
7657
|
},
|
|
7633
7658
|
async confirmGitignore({ default: def }) {
|
|
7634
7659
|
return confirm(
|
|
7635
|
-
|
|
7660
|
+
formatWizardGitignoreQuestion(),
|
|
7636
7661
|
def
|
|
7637
7662
|
);
|
|
7638
7663
|
},
|
|
7639
7664
|
async confirmWritePlan({ default: def }) {
|
|
7640
7665
|
try {
|
|
7641
|
-
|
|
7666
|
+
const raw = await ask(
|
|
7667
|
+
formatWizardWriteConfirmationQuestion(),
|
|
7668
|
+
def ? "2" : "1"
|
|
7669
|
+
);
|
|
7670
|
+
const normalized = raw.trim().toLowerCase();
|
|
7671
|
+
if (normalized === "2" || normalized === "write" || normalized === "--write" || normalized === "w" || normalized === "y" || normalized === "yes") {
|
|
7672
|
+
return true;
|
|
7673
|
+
}
|
|
7674
|
+
if (normalized === "1" || normalized === "dry-run" || normalized === "dryrun" || normalized === "dry run" || normalized === "preview" || normalized === "n" || normalized === "no") {
|
|
7675
|
+
return false;
|
|
7676
|
+
}
|
|
7677
|
+
return def;
|
|
7642
7678
|
} finally {
|
|
7643
7679
|
rl.close();
|
|
7644
7680
|
}
|
|
@@ -7651,6 +7687,9 @@ function formatList(values) {
|
|
|
7651
7687
|
function formatStrategyLabel(strategy) {
|
|
7652
7688
|
return strategy === "regions" ? "Add generated regions" : "Preserve existing files";
|
|
7653
7689
|
}
|
|
7690
|
+
function formatWizardSectionTitle(title) {
|
|
7691
|
+
return `== ${title} ==`;
|
|
7692
|
+
}
|
|
7654
7693
|
function existingRootInstructions(report) {
|
|
7655
7694
|
return report.files.filter((file) => file.kind === "root-instructions" && file.exists).map((file) => file.path);
|
|
7656
7695
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-profile/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Command-line interface for Agent Profile Compiler.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@agent-profile/core": "0.2.0",
|
|
27
27
|
"@agent-profile/doctor": "0.3.0",
|
|
28
28
|
"@agent-profile/scanner": "0.2.0",
|
|
29
|
-
"@agent-profile/web": "0.3.
|
|
29
|
+
"@agent-profile/web": "0.3.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"esbuild": "^0.28.0"
|