create-fhevm-example 1.3.0 → 1.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/README.md CHANGED
@@ -1,5 +1,3 @@
1
- # create-fhevm-example
2
-
3
1
  <p align="center">
4
2
  <strong>Create FHEVM example projects with a single command</strong>
5
3
  </p>
@@ -66,14 +64,16 @@ npx create-fhevm-example --example fhe-counter --output ./my-project --install -
66
64
 
67
65
  ## šŸ“‹ CLI Options
68
66
 
69
- `--example <name>` - Create a single example project
70
- `--category <name>` - Create a category project
71
- `--add` - Add FHEVM to existing Hardhat project
72
- `--target <dir>` - Target directory for --add mode (default: current dir)
73
- `--output <dir>` - Output directory
74
- `--install` - Auto-install dependencies
75
- `--test` - Auto-run tests
76
- `--help` - Show help
67
+ | Option | Description |
68
+ | :--- | :--- |
69
+ | `--example <name>` | Create a single example project |
70
+ | `--category <name>` | Create a category project |
71
+ | `--add` | Add FHEVM to an existing Hardhat project |
72
+ | `--target <dir>` | Target directory for `--add` mode (default: current dir) |
73
+ | `--output <dir>` | Output directory for new projects |
74
+ | `--install` | Auto-install dependencies after scaffolding |
75
+ | `--test` | Auto-run tests (requires `--install`) |
76
+ | `--help`, `-h` | Show help information |
77
77
 
78
78
  ---
79
79
 
@@ -1,5 +1,8 @@
1
1
  /**
2
- * Add Mode - Add FHEVM to existing Hardhat projects
2
+ * Add Mode - Feature for adding FHEVM to existing Hardhat projects.
3
+ *
4
+ * Logic for managing configuration updates, dependency installations,
5
+ * and scaffolding example contracts into established projects.
3
6
  */
4
7
  /**
5
8
  * Main function to add FHEVM capabilities to an existing Hardhat project
@@ -1 +1 @@
1
- {"version":3,"file":"add-mode.d.ts","sourceRoot":"","sources":["../../scripts/add-mode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkRH;;GAEG;AACH,wBAAsB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8ElE"}
1
+ {"version":3,"file":"add-mode.d.ts","sourceRoot":"","sources":["../../scripts/add-mode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkRH;;GAEG;AACH,wBAAsB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8ElE"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * Add Mode - Add FHEVM to existing Hardhat projects
3
+ * Add Mode - Feature for adding FHEVM to existing Hardhat projects.
4
+ *
5
+ * Logic for managing configuration updates, dependency installations,
6
+ * and scaffolding example contracts into established projects.
4
7
  */
5
8
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
9
  if (k2 === undefined) k2 = k;
@@ -1,20 +1,19 @@
1
1
  /**
2
- * Project Builders
2
+ * Project Builders - Core logic for scaffolding FHEVM projects.
3
3
  *
4
- * Creates single example and category projects from templates.
4
+ * Handles the creation of single example projects, category-based
5
+ * project bundles, and specialized test environments.
5
6
  */
6
7
  /**
7
8
  * Creates a single example project from the template
8
- * @param exampleName - Name of the example to create
9
- * @param outputDir - Target directory for the project
10
- * @param tempRepoPath - Path to cloned template repository
11
9
  */
12
10
  export declare function createSingleExample(exampleName: string, outputDir: string, tempRepoPath: string): Promise<void>;
13
11
  /**
14
12
  * Creates a category project with multiple examples
15
- * @param categoryName - Name of the category to create
16
- * @param outputDir - Target directory for the project
17
- * @param tempRepoPath - Path to cloned template repository
18
13
  */
19
14
  export declare function createCategoryProject(categoryName: string, outputDir: string, tempRepoPath: string): Promise<void>;
15
+ /**
16
+ * Creates a temporary test project using LOCAL files (used by maintenance.ts)
17
+ */
18
+ export declare function createLocalTestProject(exampleNames: string[], outputDir: string): Promise<void>;
20
19
  //# sourceMappingURL=builders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../scripts/builders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuDH;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAgDf;AAMD;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CA4Df"}
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../scripts/builders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0DH;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CA8Cf;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAiEf;AAMD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,YAAY,EAAE,MAAM,EAAE,EACtB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAuEf"}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * Project Builders
3
+ * Project Builders - Core logic for scaffolding FHEVM projects.
4
4
  *
5
- * Creates single example and category projects from templates.
5
+ * Handles the creation of single example projects, category-based
6
+ * project bundles, and specialized test environments.
6
7
  */
7
8
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
9
  if (k2 === undefined) k2 = k;
@@ -40,6 +41,7 @@ var __importStar = (this && this.__importStar) || (function () {
40
41
  Object.defineProperty(exports, "__esModule", { value: true });
41
42
  exports.createSingleExample = createSingleExample;
42
43
  exports.createCategoryProject = createCategoryProject;
44
+ exports.createLocalTestProject = createLocalTestProject;
43
45
  const fs = __importStar(require("fs"));
44
46
  const path = __importStar(require("path"));
45
47
  const config_1 = require("./config");
@@ -73,13 +75,10 @@ async function initGitRepo(outputDir) {
73
75
  }
74
76
  }
75
77
  // =============================================================================
76
- // Single Example Builder
78
+ // Project Scaffolding
77
79
  // =============================================================================
78
80
  /**
79
81
  * Creates a single example project from the template
80
- * @param exampleName - Name of the example to create
81
- * @param outputDir - Target directory for the project
82
- * @param tempRepoPath - Path to cloned template repository
83
82
  */
84
83
  async function createSingleExample(exampleName, outputDir, tempRepoPath) {
85
84
  const example = config_1.EXAMPLES[exampleName];
@@ -91,31 +90,23 @@ async function createSingleExample(exampleName, outputDir, tempRepoPath) {
91
90
  if (!contractName) {
92
91
  throw new Error("Could not extract contract name");
93
92
  }
94
- // Step 1: Copy template and clean up
93
+ // 1. Copy template and clean up
95
94
  (0, utils_1.copyDirectoryRecursive)(templateDir, outputDir);
96
95
  (0, utils_1.cleanupTemplate)(outputDir);
97
- // Step 2: Download example contract
96
+ // 2. Download example contract and dependencies
98
97
  await (0, utils_1.downloadFileFromGitHub)(example.contract, path.join(outputDir, "contracts", `${contractName}.sol`));
99
- // Download contract dependencies if specified
100
98
  if (example.dependencies) {
101
99
  await downloadDependencies(example.dependencies, outputDir);
102
100
  }
103
- // Step 3: Download test file
101
+ // 3. Download test file
104
102
  await (0, utils_1.downloadFileFromGitHub)(example.test, path.join(outputDir, "test", path.basename(example.test)));
105
- // Step 4: Update deploy script and package.json
103
+ // 4. Update deploy script and package.json
106
104
  fs.writeFileSync(path.join(outputDir, "deploy", "deploy.ts"), (0, utils_1.generateDeployScript)(contractName));
107
105
  (0, utils_1.updateProjectPackageJson)(outputDir, `fhevm-example-${exampleName}`, example.description, example.npmDependencies);
108
- // Initialize git repository
109
106
  await initGitRepo(outputDir);
110
107
  }
111
- // =============================================================================
112
- // Category Project Builder
113
- // =============================================================================
114
108
  /**
115
109
  * Creates a category project with multiple examples
116
- * @param categoryName - Name of the category to create
117
- * @param outputDir - Target directory for the project
118
- * @param tempRepoPath - Path to cloned template repository
119
110
  */
120
111
  async function createCategoryProject(categoryName, outputDir, tempRepoPath) {
121
112
  const category = config_1.CATEGORIES[categoryName];
@@ -123,10 +114,10 @@ async function createCategoryProject(categoryName, outputDir, tempRepoPath) {
123
114
  throw new Error(`Unknown category: ${categoryName}`);
124
115
  }
125
116
  const templateDir = path.join(tempRepoPath, utils_1.TEMPLATE_DIR_NAME);
126
- // Step 1: Copy template and clean up
117
+ // 1. Copy template and clean up
127
118
  (0, utils_1.copyDirectoryRecursive)(templateDir, outputDir);
128
119
  (0, utils_1.cleanupTemplate)(outputDir);
129
- // Step 2: Download all contracts and tests
120
+ // 2. Download all contracts and tests
130
121
  for (const item of category.contracts) {
131
122
  const contractName = (0, utils_1.getContractName)(item.sol);
132
123
  if (contractName) {
@@ -136,11 +127,16 @@ async function createCategoryProject(categoryName, outputDir, tempRepoPath) {
136
127
  await (0, utils_1.downloadFileFromGitHub)(item.test, path.join(outputDir, "test", path.basename(item.test)));
137
128
  }
138
129
  }
139
- // Collect dependencies from all examples in this category
130
+ // 3. Collect and download dependencies
140
131
  const allDependencies = new Set();
141
132
  const allNpmDependencies = {};
142
133
  for (const [exampleName, exampleConfig] of Object.entries(config_1.EXAMPLES)) {
143
- if (exampleConfig.category === category.name.replace(" Examples", "")) {
134
+ // Check if example belongs to this category
135
+ const configCategoryLower = exampleConfig.category
136
+ .toLowerCase()
137
+ .replace(/\s+/g, "");
138
+ if (configCategoryLower === categoryName ||
139
+ exampleConfig.category === category.name.replace(" Examples", "")) {
144
140
  if (exampleConfig.dependencies) {
145
141
  exampleConfig.dependencies.forEach((dep) => allDependencies.add(dep));
146
142
  }
@@ -149,12 +145,67 @@ async function createCategoryProject(categoryName, outputDir, tempRepoPath) {
149
145
  }
150
146
  }
151
147
  }
152
- // Download all collected dependencies
153
148
  if (allDependencies.size > 0) {
154
149
  await downloadDependencies(Array.from(allDependencies), outputDir);
155
150
  }
156
- // Step 3: Update package.json
151
+ // 4. Update package.json
157
152
  (0, utils_1.updateProjectPackageJson)(outputDir, `fhevm-examples-${categoryName}`, undefined, allNpmDependencies);
158
- // Initialize git repository
159
153
  await initGitRepo(outputDir);
160
154
  }
155
+ // =============================================================================
156
+ // Specialized Builders
157
+ // =============================================================================
158
+ /**
159
+ * Creates a temporary test project using LOCAL files (used by maintenance.ts)
160
+ */
161
+ async function createLocalTestProject(exampleNames, outputDir) {
162
+ const rootDir = (0, utils_1.getRootDir)();
163
+ const templateDir = (0, utils_1.getTemplateDir)();
164
+ // 1. Setup base project from local template
165
+ (0, utils_1.copyDirectoryRecursive)(templateDir, outputDir);
166
+ (0, utils_1.cleanupTemplate)(outputDir);
167
+ const allNpmDeps = {};
168
+ const allContractDeps = new Set();
169
+ // 2. Copy local example files
170
+ for (const exampleName of exampleNames) {
171
+ const example = config_1.EXAMPLES[exampleName];
172
+ if (!example)
173
+ continue;
174
+ const contractPath = path.join(rootDir, example.contract);
175
+ const testPath = path.join(rootDir, example.test);
176
+ if (fs.existsSync(contractPath)) {
177
+ const contractName = (0, utils_1.getContractName)(example.contract);
178
+ if (contractName) {
179
+ fs.copyFileSync(contractPath, path.join(outputDir, "contracts", `${contractName}.sol`));
180
+ }
181
+ }
182
+ if (fs.existsSync(testPath)) {
183
+ fs.copyFileSync(testPath, path.join(outputDir, "test", path.basename(example.test)));
184
+ }
185
+ if (example.dependencies) {
186
+ example.dependencies.forEach((dep) => allContractDeps.add(dep));
187
+ }
188
+ if (example.npmDependencies) {
189
+ Object.assign(allNpmDeps, example.npmDependencies);
190
+ }
191
+ }
192
+ // 3. Copy dependencies
193
+ for (const depPath of allContractDeps) {
194
+ const depFullPath = path.join(rootDir, depPath);
195
+ if (fs.existsSync(depFullPath)) {
196
+ const relativePath = depPath.replace(/^contracts\//, "");
197
+ const depDestPath = path.join(outputDir, "contracts", relativePath);
198
+ const depDestDir = path.dirname(depDestPath);
199
+ if (!fs.existsSync(depDestDir)) {
200
+ fs.mkdirSync(depDestDir, { recursive: true });
201
+ }
202
+ fs.copyFileSync(depFullPath, depDestPath);
203
+ }
204
+ }
205
+ // 4. Finalize project
206
+ (0, utils_1.updateProjectPackageJson)(outputDir, "fhevm-test-project", `Testing ${exampleNames.length} examples`, Object.keys(allNpmDeps).length > 0 ? allNpmDeps : undefined);
207
+ const typesPath = path.join(outputDir, "test", "types.ts");
208
+ if (!fs.existsSync(typesPath)) {
209
+ fs.writeFileSync(typesPath, utils_1.TEST_TYPES_CONTENT);
210
+ }
211
+ }
@@ -1,3 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ /**
3
+ * FHEVM Doctor - Environment and project integrity validator
4
+ *
5
+ * Checks:
6
+ * - Node.js version compatibility
7
+ * - Git installation
8
+ * - Config.ts path integrity (validates all example paths)
9
+ */
2
10
  export {};
3
11
  //# sourceMappingURL=doctor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../scripts/doctor.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../scripts/doctor.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG"}
@@ -1,5 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ /**
4
+ * FHEVM Doctor - Environment and project integrity validator
5
+ *
6
+ * Checks:
7
+ * - Node.js version compatibility
8
+ * - Git installation
9
+ * - Config.ts path integrity (validates all example paths)
10
+ */
3
11
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
12
  if (k2 === undefined) k2 = k;
5
13
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Auto-Discovery Config Generator
3
+ * Auto-Discovery Config Generator - Automatically updates project configuration.
4
4
  *
5
- * Scans contracts/ directory and generates config.ts automatically
6
- * Extracts metadata from @notice tags and folder structure.
5
+ * Scans the contracts/ directory and generates scripts/config.ts.
6
+ * Extracts metadata from @notice tags and infers category structure.
7
7
  */
8
8
  export {};
9
9
  //# sourceMappingURL=generate-config.d.ts.map
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  /**
4
- * Auto-Discovery Config Generator
4
+ * Auto-Discovery Config Generator - Automatically updates project configuration.
5
5
  *
6
- * Scans contracts/ directory and generates config.ts automatically
7
- * Extracts metadata from @notice tags and folder structure.
6
+ * Scans the contracts/ directory and generates scripts/config.ts.
7
+ * Extracts metadata from @notice tags and infers category structure.
8
8
  */
9
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
10
  if (k2 === undefined) k2 = k;
@@ -39,10 +39,14 @@ var __importStar = (this && this.__importStar) || (function () {
39
39
  return result;
40
40
  };
41
41
  })();
42
+ var __importDefault = (this && this.__importDefault) || function (mod) {
43
+ return (mod && mod.__esModule) ? mod : { "default": mod };
44
+ };
42
45
  Object.defineProperty(exports, "__esModule", { value: true });
43
46
  const fs = __importStar(require("fs"));
44
47
  const path = __importStar(require("path"));
45
48
  const utils_1 = require("./utils");
49
+ const picocolors_1 = __importDefault(require("picocolors"));
46
50
  const ROOT_DIR = path.resolve(__dirname, "..");
47
51
  const CONTRACTS_DIR = path.join(ROOT_DIR, "contracts");
48
52
  const TEST_DIR = path.join(ROOT_DIR, "test");
@@ -293,21 +297,25 @@ export function getDocsFileName(exampleName: string): string {
293
297
  // Main
294
298
  // =============================================================================
295
299
  function main() {
296
- utils_1.log.info("šŸ” Scanning contracts...\n");
300
+ utils_1.log.info(`šŸ” Scanning examples in: ${picocolors_1.default.cyan("contracts/")}\n`);
297
301
  const contracts = scanContracts();
298
- utils_1.log.success(`āœ… Found ${contracts.length} contracts\n`);
302
+ if (contracts.length === 0) {
303
+ utils_1.log.error("āŒ No valid contracts discovered. Check for @notice tags.");
304
+ process.exit(1);
305
+ }
306
+ utils_1.log.success(`āœ… Found ${picocolors_1.default.bold(String(contracts.length))} contracts\n`);
299
307
  const categoryCount = {};
300
308
  for (const c of contracts) {
301
309
  categoryCount[c.category] = (categoryCount[c.category] || 0) + 1;
302
310
  }
303
- utils_1.log.message("šŸ“Š By category:");
311
+ utils_1.log.message(picocolors_1.default.bold("šŸ“Š Discovery Summary:"));
304
312
  for (const [category, count] of Object.entries(categoryCount)) {
305
- utils_1.log.message(` ${category}: ${count}`);
313
+ utils_1.log.message(` ${picocolors_1.default.dim("•")} ${picocolors_1.default.yellow(category.padEnd(25))} ${picocolors_1.default.cyan(String(count).padStart(2))} examples`);
306
314
  }
307
- utils_1.log.message("\nšŸ“ Generating config...");
315
+ utils_1.log.message(`\nšŸ“ Generating: ${picocolors_1.default.cyan(path.relative(ROOT_DIR, OUTPUT_FILE))}...`);
308
316
  const configContent = generateConfigFile(contracts);
309
317
  fs.writeFileSync(OUTPUT_FILE, configContent);
310
- utils_1.log.success(`āœ… Config generated: ${path.relative(ROOT_DIR, OUTPUT_FILE)}`);
318
+ utils_1.log.success(`\n✨ Configuration updated successfully!`);
311
319
  }
312
320
  const isMainModule = process.argv[1]?.includes("generate-config");
313
321
  if (isMainModule) {
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Generate Documentation - GitBook Documentation Generator
3
+ * Documentation Generator - Creates GitBook-compatible markdown docs.
4
4
  *
5
- * Generates GitBook-compatible markdown documentation for FHEVM examples.
5
+ * Processes FHEVM examples to produce structured documentation,
6
+ * including contract descriptions and automated index updates.
6
7
  */
7
8
  export declare function handleInteractiveDocs(): Promise<void>;
8
9
  export declare function handleDirect(args: string[]): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"generate-docs.d.ts","sourceRoot":"","sources":["../../scripts/generate-docs.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAuEH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAiE3D;AAMD,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhE"}
1
+ {"version":3,"file":"generate-docs.d.ts","sourceRoot":"","sources":["../../scripts/generate-docs.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAuEH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAiE3D;AAMD,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhE"}
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  /**
4
- * Generate Documentation - GitBook Documentation Generator
4
+ * Documentation Generator - Creates GitBook-compatible markdown docs.
5
5
  *
6
- * Generates GitBook-compatible markdown documentation for FHEVM examples.
6
+ * Processes FHEVM examples to produce structured documentation,
7
+ * including contract descriptions and automated index updates.
7
8
  */
8
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
10
  if (k2 === undefined) k2 = k;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Help Menu - CLI Usage and Documentation.
3
+ */
4
+ /**
5
+ * Displays the CLI help menu.
6
+ * Adapts content based on LOCAL_DEV environment variable.
7
+ */
8
+ export declare function showHelp(): void;
9
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../scripts/help.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,IAAI,CAgF/B"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ /**
3
+ * Help Menu - CLI Usage and Documentation.
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.showHelp = showHelp;
10
+ const picocolors_1 = __importDefault(require("picocolors"));
11
+ const config_1 = require("./config");
12
+ /**
13
+ * Displays the CLI help menu.
14
+ * Adapts content based on LOCAL_DEV environment variable.
15
+ */
16
+ function showHelp() {
17
+ const isDev = process.env.LOCAL_DEV === "1";
18
+ const cmd = isDev ? "npm run" : "npx";
19
+ const createCmd = isDev ? "create" : "create-fhevm-example";
20
+ console.log(`
21
+ ${picocolors_1.default.bgCyan(picocolors_1.default.black(picocolors_1.default.bold(" šŸ” create-fhevm-example ")))}
22
+ ${picocolors_1.default.dim("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")}
23
+
24
+ ${picocolors_1.default.cyan(picocolors_1.default.bold("šŸ“‹ USAGE"))}
25
+
26
+ ${picocolors_1.default.dim("$")} ${picocolors_1.default.white(`${cmd} ${createCmd}`)} ${picocolors_1.default.dim("→")} Interactive mode ${picocolors_1.default.yellow("(recommended)")}
27
+ ${picocolors_1.default.dim("$")} ${picocolors_1.default.white(`${cmd} ${createCmd}`)} ${picocolors_1.default.green("--example")} ${picocolors_1.default.yellow("<name>")} ${picocolors_1.default.dim("→")} Create single example
28
+ ${picocolors_1.default.dim("$")} ${picocolors_1.default.white(`${cmd} ${createCmd}`)} ${picocolors_1.default.green("--category")} ${picocolors_1.default.yellow("<name>")} ${picocolors_1.default.dim("→")} Create category project
29
+ ${picocolors_1.default.dim("$")} ${picocolors_1.default.white(`${cmd} ${createCmd}`)} ${picocolors_1.default.green("--add")} ${picocolors_1.default.dim("→")} Add to existing project
30
+
31
+ ${picocolors_1.default.cyan(picocolors_1.default.bold("āš™ļø OPTIONS"))}
32
+
33
+ ${picocolors_1.default.green("--example")} ${picocolors_1.default.dim("<name>")} Create a single example project
34
+ ${picocolors_1.default.green("--category")} ${picocolors_1.default.dim("<name>")} Create a category project
35
+ ${picocolors_1.default.green("--add")} Add FHEVM to existing Hardhat project
36
+ ${picocolors_1.default.green("--target")} ${picocolors_1.default.dim("<dir>")} Target directory for --add mode
37
+ ${picocolors_1.default.green("--output")} ${picocolors_1.default.dim("<dir>")} Output directory
38
+ ${picocolors_1.default.green("--install")} Auto-install dependencies
39
+ ${picocolors_1.default.green("--test")} Auto-run tests (requires --install)
40
+ ${picocolors_1.default.green("--help")}${picocolors_1.default.dim(", -h")} Show this help message
41
+
42
+ ${isDev
43
+ ? `
44
+ ${picocolors_1.default.cyan(picocolors_1.default.bold("šŸ› ļø DEVELOPER TOOLS"))}
45
+
46
+ ${picocolors_1.default.green("npm run create:docs")} Generate documentation
47
+ ${picocolors_1.default.green("npm run generate:config")} Update contract registry
48
+ ${picocolors_1.default.green("npm run doctor")} Run system health check
49
+ ${picocolors_1.default.green("npm run test:all")} Run bulk project tests
50
+ `
51
+ : ""}
52
+
53
+ ${picocolors_1.default.cyan(picocolors_1.default.bold("⚔ EXAMPLES"))}
54
+
55
+ ${picocolors_1.default.dim("$")} ${picocolors_1.default.white(`${cmd} ${createCmd}`)} ${picocolors_1.default.green("--example")} ${picocolors_1.default.yellow("fhe-counter")}
56
+ ${picocolors_1.default.dim("$")} ${picocolors_1.default.white(`${cmd} ${createCmd}`)} ${picocolors_1.default.green("--category")} ${picocolors_1.default.yellow("basic")} ${picocolors_1.default.green("--output")} ${picocolors_1.default.blue("./my-project")}
57
+ ${picocolors_1.default.dim("$")} ${picocolors_1.default.white(`${cmd} ${createCmd}`)} ${picocolors_1.default.green("--add")}
58
+
59
+ ${picocolors_1.default.cyan(picocolors_1.default.bold("šŸ“¦ AVAILABLE EXAMPLES"))}
60
+
61
+ ${picocolors_1.default.dim(Object.keys(config_1.EXAMPLES).slice(0, 10).join(", "))}
62
+ ${picocolors_1.default.dim("...")} and ${picocolors_1.default.yellow(String(Object.keys(config_1.EXAMPLES).length - 10))} more
63
+
64
+ ${picocolors_1.default.cyan(picocolors_1.default.bold("šŸ“ AVAILABLE CATEGORIES"))}
65
+
66
+ ${Object.keys(config_1.CATEGORIES)
67
+ .map((c) => picocolors_1.default.yellow(c))
68
+ .join(", ")}
69
+
70
+ ${picocolors_1.default.dim("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")}
71
+ ${picocolors_1.default.dim("šŸ“š Documentation:")} ${picocolors_1.default.blue("https://github.com/NecipAkgz/fhevm-example-factory")}
72
+ `);
73
+ }