@famgia/omnify-cli 2.0.13 → 2.0.15

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
@@ -122,6 +122,58 @@ omnify generate --force
122
122
  omnify generate -v
123
123
  ```
124
124
 
125
+ ### `omnify ai-guides`
126
+
127
+ Generate AI assistant guides (Cursor rules, Claude guides/rules, Antigravity rules).
128
+
129
+ > This command loads `@famgia/omnify-ai-guides`. If it’s not installed, install it first:
130
+ >
131
+ > ```bash
132
+ > pnpm add -D @famgia/omnify-ai-guides
133
+ > ```
134
+
135
+ ```bash
136
+ omnify ai-guides [options]
137
+ ```
138
+
139
+ This command reads from `omnify.config.ts` (if present). Add `aiGuides` section:
140
+
141
+ ```typescript
142
+ export default defineConfig({
143
+ // ... other config
144
+ aiGuides: {
145
+ typescriptBase: 'resources/ts', // or 'resources/js', 'src', etc.
146
+ laravelBase: 'app',
147
+ categories: ['omnify', 'laravel', 'react'], // optional
148
+ adapters: ['cursor', 'claude', 'antigravity'], // optional
149
+ },
150
+ });
151
+ ```
152
+
153
+ Options (override config):
154
+
155
+ ```bash
156
+ -v, --verbose Enable verbose output
157
+ -c, --categories <categories> Categories to generate (comma-separated: omnify,laravel,react)
158
+ -a, --adapters <adapters> Adapters to use (comma-separated: cursor,claude,antigravity)
159
+ --laravel-base <path> Laravel base path for placeholders
160
+ --typescript-base <path> TypeScript base path for placeholders
161
+ --dry-run Show what would be generated without writing files
162
+ ```
163
+
164
+ Common examples:
165
+
166
+ ```bash
167
+ # API-only project (skip React)
168
+ omnify ai-guides --categories omnify,laravel
169
+
170
+ # Frontend-only (skip Laravel)
171
+ omnify ai-guides --categories omnify,react
172
+
173
+ # Only Cursor rules
174
+ omnify ai-guides --adapters cursor
175
+ ```
176
+
125
177
  ### `omnify create-laravel-project`
126
178
 
127
179
  Create a new Laravel project from the boilerplate template.
@@ -187,13 +239,13 @@ export default defineConfig({
187
239
 
188
240
  ### Configuration Options
189
241
 
190
- | Option | Type | Required | Description |
191
- |--------|------|----------|-------------|
192
- | `schemasDir` | `string` | Yes | Directory containing schema files |
193
- | `lockFilePath` | `string` | Yes | Path to lock file for change tracking |
194
- | `database.driver` | `string` | Yes | Database driver: `mysql`, `postgres`, `sqlite` |
195
- | `database.devUrl` | `string` | Yes* | Development database URL for Atlas (*required for generate) |
196
- | `plugins` | `Plugin[]` | No | Array of generator plugins |
242
+ | Option | Type | Required | Description |
243
+ | ----------------- | ---------- | -------- | ----------------------------------------------------------- |
244
+ | `schemasDir` | `string` | Yes | Directory containing schema files |
245
+ | `lockFilePath` | `string` | Yes | Path to lock file for change tracking |
246
+ | `database.driver` | `string` | Yes | Database driver: `mysql`, `postgres`, `sqlite` |
247
+ | `database.devUrl` | `string` | Yes* | Development database URL for Atlas (*required for generate) |
248
+ | `plugins` | `Plugin[]` | No | Array of generator plugins |
197
249
 
198
250
  ### Database URL Format
199
251
 
@@ -301,18 +353,18 @@ values:
301
353
 
302
354
  ## Exit Codes
303
355
 
304
- | Code | Meaning |
305
- |------|---------|
306
- | 0 | Success |
307
- | 1 | General error |
308
- | 2 | Validation error |
356
+ | Code | Meaning |
357
+ | ---- | ---------------- |
358
+ | 0 | Success |
359
+ | 1 | General error |
360
+ | 2 | Validation error |
309
361
 
310
362
  ## Environment Variables
311
363
 
312
- | Variable | Description |
313
- |----------|-------------|
364
+ | Variable | Description |
365
+ | ---------------- | ------------------------------------ |
314
366
  | `OMNIFY_DEV_URL` | Override database.devUrl from config |
315
- | `DEBUG` | Set to `omnify:*` for debug output |
367
+ | `DEBUG` | Set to `omnify:*` for debug output |
316
368
 
317
369
  ## Troubleshooting
318
370
 
package/dist/cli.js CHANGED
@@ -839,7 +839,8 @@ async function resolveConfig(userConfig, configPath2) {
839
839
  lockFilePath: userConfig.lockFilePath ?? ".omnify.lock",
840
840
  discovery,
841
841
  ...userConfig.locale && { locale: userConfig.locale },
842
- ...allSchemaPaths.length > 0 && { additionalSchemaPaths: allSchemaPaths }
842
+ ...allSchemaPaths.length > 0 && { additionalSchemaPaths: allSchemaPaths },
843
+ ...userConfig.aiGuides && { aiGuides: userConfig.aiGuides }
843
844
  };
844
845
  return result;
845
846
  }
@@ -3252,6 +3253,110 @@ function registerVerifyCommand(program2) {
3252
3253
  });
3253
3254
  }
3254
3255
 
3256
+ // src/commands/ai-guides.ts
3257
+ async function runAIGuides(options) {
3258
+ logger.setVerbose(options.verbose ?? false);
3259
+ logger.header("Generating AI Guides");
3260
+ let generateAIGuides2;
3261
+ let getAvailableCategories;
3262
+ try {
3263
+ const aiGuidesModule = await import("@famgia/omnify-ai-guides");
3264
+ generateAIGuides2 = aiGuidesModule.generateAIGuides;
3265
+ getAvailableCategories = aiGuidesModule.getAvailableCategories;
3266
+ } catch (error) {
3267
+ logger.error("Failed to load @famgia/omnify-ai-guides package");
3268
+ logger.error("Please install it: pnpm add @famgia/omnify-ai-guides");
3269
+ throw error;
3270
+ }
3271
+ const rootDir = process.cwd();
3272
+ let configAiGuides;
3273
+ try {
3274
+ const { config } = await loadConfig();
3275
+ configAiGuides = config.aiGuides;
3276
+ if (configAiGuides) {
3277
+ logger.debug("Loaded aiGuides config from omnify.config.ts");
3278
+ }
3279
+ } catch {
3280
+ logger.debug("No omnify.config.ts found, using defaults");
3281
+ }
3282
+ let categories = getAvailableCategories();
3283
+ if (options.categories) {
3284
+ categories = options.categories.split(",").map((c) => c.trim());
3285
+ logger.debug(`Categories (from CLI): ${categories.join(", ")}`);
3286
+ } else if (configAiGuides?.categories) {
3287
+ categories = [...configAiGuides.categories];
3288
+ logger.debug(`Categories (from config): ${categories.join(", ")}`);
3289
+ }
3290
+ let adapters;
3291
+ if (options.adapters) {
3292
+ adapters = options.adapters.split(",").map((a) => a.trim());
3293
+ logger.debug(`Adapters (from CLI): ${adapters.join(", ")}`);
3294
+ } else if (configAiGuides?.adapters) {
3295
+ adapters = [...configAiGuides.adapters];
3296
+ logger.debug(`Adapters (from config): ${adapters.join(", ")}`);
3297
+ }
3298
+ const placeholders = {
3299
+ LARAVEL_BASE: options.laravelBase ?? configAiGuides?.laravelBase ?? "app",
3300
+ LARAVEL_ROOT: "",
3301
+ TYPESCRIPT_BASE: options.typescriptBase ?? configAiGuides?.typescriptBase ?? "resources/ts"
3302
+ };
3303
+ logger.step("Generating guides...");
3304
+ logger.debug(`Root directory: ${rootDir}`);
3305
+ logger.debug(`Laravel base: ${placeholders.LARAVEL_BASE}`);
3306
+ logger.debug(`TypeScript base: ${placeholders.TYPESCRIPT_BASE}`);
3307
+ logger.debug(`Categories: ${JSON.stringify(categories)}`);
3308
+ logger.debug(`Adapters: ${JSON.stringify(adapters)}`);
3309
+ const result = generateAIGuides2(rootDir, {
3310
+ categories,
3311
+ adapters,
3312
+ placeholders,
3313
+ dryRun: options.dryRun
3314
+ });
3315
+ const claudeCount = result.counts["claude"] || 0;
3316
+ const cursorCount = result.counts["cursor"] || 0;
3317
+ const antigravityCount = result.counts["antigravity"] || 0;
3318
+ const totalCount = claudeCount + cursorCount + antigravityCount;
3319
+ if (options.dryRun) {
3320
+ logger.info("[DRY RUN] Would generate:");
3321
+ }
3322
+ if (claudeCount > 0) {
3323
+ logger.success(` ${claudeCount} Claude files (.claude/)`);
3324
+ }
3325
+ if (cursorCount > 0) {
3326
+ logger.success(` ${cursorCount} Cursor rules (.cursor/rules/)`);
3327
+ }
3328
+ if (antigravityCount > 0) {
3329
+ logger.success(` ${antigravityCount} Antigravity rules (.agent/rules/)`);
3330
+ }
3331
+ if (result.errors?.length) {
3332
+ logger.newline();
3333
+ logger.warn("Warnings:");
3334
+ for (const error of result.errors) {
3335
+ logger.warn(` ${error}`);
3336
+ }
3337
+ }
3338
+ logger.newline();
3339
+ logger.success(`Generated ${totalCount} AI guide files!`);
3340
+ }
3341
+ function registerAIGuidesCommand(program2) {
3342
+ program2.command("ai-guides").description("Generate AI assistant guides (Cursor, Claude, Antigravity). Reads from omnify.config.ts").option("-v, --verbose", "Enable verbose output").option(
3343
+ "-c, --categories <categories>",
3344
+ "Categories to generate (comma-separated: omnify,laravel,react). Overrides config"
3345
+ ).option(
3346
+ "-a, --adapters <adapters>",
3347
+ "Adapters to use (comma-separated: cursor,claude,antigravity). Overrides config"
3348
+ ).option("--laravel-base <path>", "Laravel base path for placeholders. Overrides config").option("--typescript-base <path>", "TypeScript base path for placeholders. Overrides config").option("--dry-run", "Show what would be generated without writing files").action(async (opts) => {
3349
+ try {
3350
+ await runAIGuides(opts);
3351
+ } catch (error) {
3352
+ if (error instanceof Error) {
3353
+ logger.error(error.message);
3354
+ }
3355
+ process.exit(1);
3356
+ }
3357
+ });
3358
+ }
3359
+
3255
3360
  // src/cli.ts
3256
3361
  var VERSION = "0.0.5";
3257
3362
  var program = new Command();
@@ -3264,6 +3369,7 @@ registerResetCommand(program);
3264
3369
  registerCreateProjectCommand(program);
3265
3370
  registerDeployCommand(program);
3266
3371
  registerVerifyCommand(program);
3372
+ registerAIGuidesCommand(program);
3267
3373
  process.on("uncaughtException", (error) => {
3268
3374
  if (error instanceof OmnifyError7) {
3269
3375
  logger.formatError(error);