@uniswap/ai-toolkit-nx-claude 0.5.10-next.21 → 0.5.10-next.4

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.
@@ -327,8 +327,8 @@ function isInAiToolkitRepo() {
327
327
  return isInAiToolkit;
328
328
  }
329
329
  var GENERATORS = {
330
- default: "Recommended setup with pre-selected components",
331
- custom: "Choose exactly what to install"
330
+ "default-install": "Recommended setup with pre-selected components",
331
+ "custom-install": "Choose exactly what to install"
332
332
  };
333
333
  var ALL_GENERATORS = isInAiToolkitRepo() ? {
334
334
  ...GENERATORS,
@@ -381,8 +381,8 @@ async function main() {
381
381
  console.log("\nUsage:");
382
382
  console.log(" npx @uniswap/ai-toolkit-nx-claude@latest [generator]");
383
383
  console.log("\nExamples:");
384
- console.log(" npx @uniswap/ai-toolkit-nx-claude@latest default");
385
- console.log(" npx @uniswap/ai-toolkit-nx-claude@latest custom");
384
+ console.log(" npx @uniswap/ai-toolkit-nx-claude@latest default-install");
385
+ console.log(" npx @uniswap/ai-toolkit-nx-claude@latest custom-install");
386
386
  process.exit(0);
387
387
  }
388
388
  if (processedArgs.includes("--help") || processedArgs.includes("-h")) {
@@ -408,12 +408,8 @@ This command runs the nx-claude ${generatorName} generator.`
408
408
  process.exit(0);
409
409
  }
410
410
  if (!generatorName && processedArgs.length === 0) {
411
- if (isInAiToolkitRepo()) {
412
- generatorName = await selectGeneratorInteractively();
413
- console.log("");
414
- } else {
415
- generatorName = "init";
416
- }
411
+ generatorName = await selectGeneratorInteractively();
412
+ console.log("");
417
413
  }
418
414
  if (!generatorName) {
419
415
  console.error("\n\u274C No generator specified.");
@@ -423,12 +419,12 @@ This command runs the nx-claude ${generatorName} generator.`
423
419
  console.error("\nRun with --list to see available generators.");
424
420
  process.exit(1);
425
421
  }
426
- if (generatorName === "default") {
422
+ if (generatorName === "default-install") {
427
423
  await handleNxExecution("init", [
428
424
  ...processedArgs,
429
425
  "--install-mode=default"
430
426
  ]);
431
- } else if (generatorName === "custom") {
427
+ } else if (generatorName === "custom-install") {
432
428
  await handleNxExecution("init", [
433
429
  ...processedArgs,
434
430
  "--install-mode=custom"
@@ -145,38 +145,9 @@ interface HooksGeneratorSchema {
145
145
  'dry-run'?: boolean; // Preview without changes
146
146
  force?: boolean; // Skip dependency checks
147
147
  verbose?: boolean; // Detailed output
148
- installMode?: 'default' | 'custom'; // Installation mode from parent generator (hidden)
149
148
  }
150
149
  ```
151
150
 
152
- ### installMode Parameter
153
-
154
- The `installMode` parameter is a **hidden** parameter designed for programmatic use only. It's passed from parent generators (like `init`) to control the prompting behavior:
155
-
156
- - **`'default'`**: Skips all interactive prompts and uses default values for all options. This provides a streamlined, non-interactive installation experience.
157
- - **`'custom'`**: (or undefined): Enables full interactive prompting, allowing users to configure all options through CLI prompts.
158
-
159
- **Usage Pattern**:
160
-
161
- ```typescript
162
- // Called programmatically from init generator in default mode
163
- await hooksGenerator(tree, {
164
- installMode: 'default', // Skips all prompts
165
- force: false,
166
- dry: false,
167
- backup: true,
168
- verbose: false,
169
- });
170
-
171
- // Called programmatically from init generator in custom mode (or standalone)
172
- await hooksGenerator(tree, {
173
- // installMode omitted or 'custom' - enables prompts
174
- force: false,
175
- });
176
- ```
177
-
178
- **Implementation**: When `installMode === 'default'`, the generator bypasses the entire `promptForMissingOptions()` flow and constructs the normalized options directly using default values.
179
-
180
151
  ### Input Handling
181
152
 
182
153
  The generator pipes input to the install-global.sh script based on options:
@@ -267,29 +238,6 @@ Manual testing checklist:
267
238
 
268
239
  ## Development Notes
269
240
 
270
- ### Programmatic Usage Pattern
271
-
272
- This generator implements the **installMode pattern** for sub-generators:
273
-
274
- **Purpose**: Prevent duplicate prompting when generators are called programmatically from parent generators.
275
-
276
- **Implementation**:
277
-
278
- 1. Add `installMode?: 'default' | 'custom'` to schema with `hidden: true`
279
- 2. Add `installMode?: 'default' | 'custom'` to TypeScript interface
280
- 3. In generator.ts, check `if (options.installMode === 'default')` before prompting
281
- 4. When 'default', construct normalized options with defaults instead of prompting
282
- 5. When undefined or 'custom', proceed with normal prompting flow
283
-
284
- **Why This Works**:
285
-
286
- - Hidden schema properties don't show up in CLI help or prompts
287
- - Parent generators can pass the mode to control child behavior
288
- - Avoids issues with `getExplicitlyProvidedOptions()` reading `process.argv`
289
- - Each generator maintains backward compatibility (works standalone or programmatically)
290
-
291
- **Pattern Applied**: This pattern is used across all sub-generators that are called from the `init` generator (hooks, addons, etc.).
292
-
293
241
  ### Adding New Features
294
242
 
295
243
  To extend the generator:
@@ -1119,43 +1119,32 @@ async function hooksGenerator(tree, options) {
1119
1119
  }
1120
1120
  const schemaPath = path3.join(__dirname, "schema.json");
1121
1121
  let normalizedOptions;
1122
- if (options.installMode === "default") {
1123
- normalizedOptions = {
1124
- backup: options.backup !== false,
1125
- // Default to true unless explicitly false
1126
- dry: options.dry || false,
1127
- force: options.force || false,
1128
- verbose: options.verbose || false,
1129
- installMode: "default"
1130
- };
1131
- } else {
1132
- const explicitlyProvided = getExplicitlyProvidedOptions(options);
1133
- const nxDryRunProvided = isNxDryRunProvided();
1134
- if (nxDryRunProvided) {
1135
- options.dry = true;
1136
- explicitlyProvided.set("dry", true);
1137
- }
1138
- const nxNoInteractiveProvided = isNxNoInteractiveProvided();
1139
- const optionsWithNoInteractive = {
1140
- ...options,
1141
- "no-interactive": nxNoInteractiveProvided
1142
- };
1143
- try {
1144
- normalizedOptions = await promptForMissingOptions(
1145
- optionsWithNoInteractive,
1146
- schemaPath,
1147
- {},
1148
- // context for multi-select (not used here)
1149
- explicitlyProvided
1150
- // pass the explicitly provided options
1151
- );
1152
- } catch (error) {
1153
- if (error.message?.includes("Installation cancelled")) {
1154
- import_devkit4.logger.warn(`\u274C ${error.message}`);
1155
- return;
1156
- }
1157
- throw error;
1122
+ const explicitlyProvided = getExplicitlyProvidedOptions(options);
1123
+ const nxDryRunProvided = isNxDryRunProvided();
1124
+ if (nxDryRunProvided) {
1125
+ options.dry = true;
1126
+ explicitlyProvided.set("dry", true);
1127
+ }
1128
+ const nxNoInteractiveProvided = isNxNoInteractiveProvided();
1129
+ const optionsWithNoInteractive = {
1130
+ ...options,
1131
+ "no-interactive": nxNoInteractiveProvided
1132
+ };
1133
+ try {
1134
+ normalizedOptions = await promptForMissingOptions(
1135
+ optionsWithNoInteractive,
1136
+ schemaPath,
1137
+ {},
1138
+ // context for multi-select (not used here)
1139
+ explicitlyProvided
1140
+ // pass the explicitly provided options
1141
+ );
1142
+ } catch (error) {
1143
+ if (error.message?.includes("Installation cancelled")) {
1144
+ import_devkit4.logger.warn(`\u274C ${error.message}`);
1145
+ return;
1158
1146
  }
1147
+ throw error;
1159
1148
  }
1160
1149
  const isDryRun = normalizedOptions.dry;
1161
1150
  if (isDryRun) {
@@ -32,12 +32,6 @@
32
32
  "type": "boolean",
33
33
  "description": "Skip confirmation prompts and overwrite existing configuration",
34
34
  "default": false
35
- },
36
- "installMode": {
37
- "type": "string",
38
- "description": "Installation mode from parent generator (default or custom). When set to 'default', skips all prompts and uses defaults.",
39
- "enum": ["default", "custom"],
40
- "hidden": true
41
35
  }
42
36
  },
43
37
  "required": []
@@ -1867,43 +1867,32 @@ async function hooksGenerator(tree, options) {
1867
1867
  }
1868
1868
  const schemaPath = path4.join(__dirname, "schema.json");
1869
1869
  let normalizedOptions;
1870
- if (options.installMode === "default") {
1871
- normalizedOptions = {
1872
- backup: options.backup !== false,
1873
- // Default to true unless explicitly false
1874
- dry: options.dry || false,
1875
- force: options.force || false,
1876
- verbose: options.verbose || false,
1877
- installMode: "default"
1878
- };
1879
- } else {
1880
- const explicitlyProvided = getExplicitlyProvidedOptions(options);
1881
- const nxDryRunProvided = isNxDryRunProvided();
1882
- if (nxDryRunProvided) {
1883
- options.dry = true;
1884
- explicitlyProvided.set("dry", true);
1885
- }
1886
- const nxNoInteractiveProvided = isNxNoInteractiveProvided();
1887
- const optionsWithNoInteractive = {
1888
- ...options,
1889
- "no-interactive": nxNoInteractiveProvided
1890
- };
1891
- try {
1892
- normalizedOptions = await promptForMissingOptions(
1893
- optionsWithNoInteractive,
1894
- schemaPath,
1895
- {},
1896
- // context for multi-select (not used here)
1897
- explicitlyProvided
1898
- // pass the explicitly provided options
1899
- );
1900
- } catch (error) {
1901
- if (error.message?.includes("Installation cancelled")) {
1902
- import_devkit5.logger.warn(`\u274C ${error.message}`);
1903
- return;
1904
- }
1905
- throw error;
1870
+ const explicitlyProvided = getExplicitlyProvidedOptions(options);
1871
+ const nxDryRunProvided = isNxDryRunProvided();
1872
+ if (nxDryRunProvided) {
1873
+ options.dry = true;
1874
+ explicitlyProvided.set("dry", true);
1875
+ }
1876
+ const nxNoInteractiveProvided = isNxNoInteractiveProvided();
1877
+ const optionsWithNoInteractive = {
1878
+ ...options,
1879
+ "no-interactive": nxNoInteractiveProvided
1880
+ };
1881
+ try {
1882
+ normalizedOptions = await promptForMissingOptions(
1883
+ optionsWithNoInteractive,
1884
+ schemaPath,
1885
+ {},
1886
+ // context for multi-select (not used here)
1887
+ explicitlyProvided
1888
+ // pass the explicitly provided options
1889
+ );
1890
+ } catch (error) {
1891
+ if (error.message?.includes("Installation cancelled")) {
1892
+ import_devkit5.logger.warn(`\u274C ${error.message}`);
1893
+ return;
1906
1894
  }
1895
+ throw error;
1907
1896
  }
1908
1897
  const isDryRun = normalizedOptions.dry;
1909
1898
  if (isDryRun) {
@@ -3118,8 +3107,7 @@ async function initGenerator(tree, options) {
3118
3107
  force: normalizedOptions.force || false,
3119
3108
  dry: false,
3120
3109
  backup: true,
3121
- verbose: false,
3122
- installMode: normalizedOptions.installMode
3110
+ verbose: false
3123
3111
  });
3124
3112
  import_devkit7.logger.info("\u2705 Notification hooks installed successfully");
3125
3113
  } catch (error) {
@@ -3161,8 +3149,7 @@ async function initGenerator(tree, options) {
3161
3149
  port: 0
3162
3150
  // Use default port
3163
3151
  } : {
3164
- // Custom mode - let addons generator prompt user for specific addon
3165
- installMode: "specific",
3152
+ // Custom mode - let addons generator prompt user
3166
3153
  force: normalizedOptions.force || false
3167
3154
  }
3168
3155
  );
package/dist/index.cjs CHANGED
@@ -1485,43 +1485,32 @@ async function hooksGenerator(tree, options) {
1485
1485
  }
1486
1486
  const schemaPath = path3.join(__dirname, "schema.json");
1487
1487
  let normalizedOptions;
1488
- if (options.installMode === "default") {
1489
- normalizedOptions = {
1490
- backup: options.backup !== false,
1491
- // Default to true unless explicitly false
1492
- dry: options.dry || false,
1493
- force: options.force || false,
1494
- verbose: options.verbose || false,
1495
- installMode: "default"
1496
- };
1497
- } else {
1498
- const explicitlyProvided = getExplicitlyProvidedOptions(options);
1499
- const nxDryRunProvided = isNxDryRunProvided();
1500
- if (nxDryRunProvided) {
1501
- options.dry = true;
1502
- explicitlyProvided.set("dry", true);
1503
- }
1504
- const nxNoInteractiveProvided = isNxNoInteractiveProvided();
1505
- const optionsWithNoInteractive = {
1506
- ...options,
1507
- "no-interactive": nxNoInteractiveProvided
1508
- };
1509
- try {
1510
- normalizedOptions = await promptForMissingOptions(
1511
- optionsWithNoInteractive,
1512
- schemaPath,
1513
- {},
1514
- // context for multi-select (not used here)
1515
- explicitlyProvided
1516
- // pass the explicitly provided options
1517
- );
1518
- } catch (error) {
1519
- if (error.message?.includes("Installation cancelled")) {
1520
- import_devkit4.logger.warn(`\u274C ${error.message}`);
1521
- return;
1522
- }
1523
- throw error;
1488
+ const explicitlyProvided = getExplicitlyProvidedOptions(options);
1489
+ const nxDryRunProvided = isNxDryRunProvided();
1490
+ if (nxDryRunProvided) {
1491
+ options.dry = true;
1492
+ explicitlyProvided.set("dry", true);
1493
+ }
1494
+ const nxNoInteractiveProvided = isNxNoInteractiveProvided();
1495
+ const optionsWithNoInteractive = {
1496
+ ...options,
1497
+ "no-interactive": nxNoInteractiveProvided
1498
+ };
1499
+ try {
1500
+ normalizedOptions = await promptForMissingOptions(
1501
+ optionsWithNoInteractive,
1502
+ schemaPath,
1503
+ {},
1504
+ // context for multi-select (not used here)
1505
+ explicitlyProvided
1506
+ // pass the explicitly provided options
1507
+ );
1508
+ } catch (error) {
1509
+ if (error.message?.includes("Installation cancelled")) {
1510
+ import_devkit4.logger.warn(`\u274C ${error.message}`);
1511
+ return;
1524
1512
  }
1513
+ throw error;
1525
1514
  }
1526
1515
  const isDryRun = normalizedOptions.dry;
1527
1516
  if (isDryRun) {
@@ -1,19 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * Unified CLI wrapper for all generators.
4
+ * Determines which generator to run based on the script name.
4
5
  *
5
- * External Usage (npx @uniswap/ai-toolkit-nx-claude@latest):
6
- * - No arguments -> runs init generator (prompts for installMode)
7
- * - default -> runs init with --install-mode=default
8
- * - custom -> runs init with --install-mode=custom
9
- *
10
- * Internal Usage (from within ai-toolkit repo):
11
- * - No arguments -> shows interactive menu of all generators
12
- * - Specific generator name -> runs that generator
13
- *
14
- * This design ensures external users get a streamlined experience (init generator
15
- * with its schema-driven installMode prompt) while developers get access to all
16
- * generators including internal ones (add-command, add-agent).
6
+ * This single file handles all generator invocations:
7
+ * - ai-toolkit-nx-claude -> defaults to init generator
8
+ * - ai-toolkit-nx-claude:init -> init generator
9
+ * - ai-toolkit-nx-claude:hooks -> hooks generator
10
+ * - ai-toolkit-nx-claude:addons -> addons generator
11
+ * - ai-toolkit-nx-claude:add-command -> add-command generator
12
+ * - ai-toolkit-nx-claude:add-agent -> add-agent generator
17
13
  */
18
14
  export {};
19
15
  //# sourceMappingURL=cli-generator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-generator.d.ts","sourceRoot":"","sources":["../../../../src/cli-generator.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;GAeG"}
1
+ {"version":3,"file":"cli-generator.d.ts","sourceRoot":"","sources":["../../../../src/cli-generator.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG"}
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../src/generators/hooks/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAWrD;;;GAGG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CA6Jf;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../src/generators/hooks/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAWrD;;;GAGG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAkJf;AAED,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../src/generators/init/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AA+DpD,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,iBA6jB3E;AAqJD,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../src/generators/init/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AA+DpD,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,iBA2jB3E;AAqJD,eAAe,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniswap/ai-toolkit-nx-claude",
3
- "version": "0.5.10-next.21",
3
+ "version": "0.5.10-next.4",
4
4
  "private": false,
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.cjs",
@@ -169,7 +169,7 @@
169
169
  "enquirer": "*"
170
170
  },
171
171
  "devDependencies": {
172
- "@ai-toolkit/commands-agnostic": "0.1.14-next.20",
173
- "@ai-toolkit/agents-agnostic": "0.2.10-next.20"
172
+ "@ai-toolkit/commands-agnostic": "0.1.14-next.4",
173
+ "@ai-toolkit/agents-agnostic": "0.2.10-next.4"
174
174
  }
175
175
  }