@agent-profile/cli 0.3.0 → 0.3.1

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/dist/index.js +30 -23
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -7360,6 +7360,34 @@ 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 `Which clients should this profile enable?
7387
+ ${summary}
7388
+ Select multiple with commas or semicolons, for example 2,3.
7389
+ Enter numbers or names, or press enter for defaults [${fallback}]: `;
7390
+ }
7363
7391
  function recommendStrategy(report) {
7364
7392
  const warnings = [];
7365
7393
  const rootFiles = report.files.filter(
@@ -7603,32 +7631,11 @@ Choose [1/2]: `,
7603
7631
  return def;
7604
7632
  },
7605
7633
  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
7634
  const raw = await ask(
7613
- `Which clients should this profile enable?
7614
- ${summary}
7615
- Enter comma-separated numbers or names, or press enter for defaults [${fallback}]: `,
7635
+ formatWizardClientSelectionQuestion(defaults),
7616
7636
  defaults.join(",")
7617
7637
  );
7618
- if (raw === "" || raw === "none") return [];
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));
7638
+ return parseWizardClientSelection(raw);
7632
7639
  },
7633
7640
  async confirmGitignore({ default: def }) {
7634
7641
  return confirm(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-profile/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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.0"
29
+ "@agent-profile/web": "0.3.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "esbuild": "^0.28.0"