@famgia/omnify-laravel 0.0.87 → 0.0.89
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/{chunk-YVVAJA3T.js → chunk-V7LWJ6OM.js} +178 -12
- package/dist/chunk-V7LWJ6OM.js.map +1 -0
- package/dist/index.cjs +180 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +5 -1
- package/dist/plugin.cjs +176 -11
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +5 -5
- package/scripts/postinstall.js +29 -36
- package/stubs/ai-guides/claude-agents/architect.md.stub +150 -0
- package/stubs/ai-guides/claude-agents/developer.md.stub +190 -0
- package/stubs/ai-guides/claude-agents/reviewer.md.stub +134 -0
- package/stubs/ai-guides/claude-agents/tester.md.stub +196 -0
- package/stubs/ai-guides/claude-checklists/backend.md.stub +112 -0
- package/stubs/ai-guides/claude-omnify/antdesign-guide.md.stub +401 -0
- package/stubs/ai-guides/claude-omnify/config-guide.md.stub +253 -0
- package/stubs/ai-guides/claude-omnify/japan-guide.md.stub +186 -0
- package/stubs/ai-guides/claude-omnify/laravel-guide.md.stub +61 -0
- package/stubs/ai-guides/claude-omnify/schema-guide.md.stub +115 -0
- package/stubs/ai-guides/claude-omnify/typescript-guide.md.stub +310 -0
- package/stubs/ai-guides/claude-rules/naming.md.stub +364 -0
- package/stubs/ai-guides/claude-rules/performance.md.stub +251 -0
- package/stubs/ai-guides/claude-rules/security.md.stub +159 -0
- package/stubs/ai-guides/claude-workflows/bug-fix.md.stub +201 -0
- package/stubs/ai-guides/claude-workflows/code-review.md.stub +164 -0
- package/stubs/ai-guides/claude-workflows/new-feature.md.stub +327 -0
- package/stubs/ai-guides/cursor/laravel-controller.mdc.stub +391 -0
- package/stubs/ai-guides/cursor/laravel-request.mdc.stub +112 -0
- package/stubs/ai-guides/cursor/laravel-resource.mdc.stub +73 -0
- package/stubs/ai-guides/cursor/laravel-review.mdc.stub +69 -0
- package/stubs/ai-guides/cursor/laravel-testing.mdc.stub +138 -0
- package/stubs/ai-guides/cursor/laravel.mdc.stub +82 -0
- package/stubs/ai-guides/laravel/README.md.stub +59 -0
- package/stubs/ai-guides/laravel/architecture.md.stub +424 -0
- package/stubs/ai-guides/laravel/controller.md.stub +484 -0
- package/stubs/ai-guides/laravel/datetime.md.stub +334 -0
- package/stubs/ai-guides/laravel/openapi.md.stub +369 -0
- package/stubs/ai-guides/laravel/request.md.stub +450 -0
- package/stubs/ai-guides/laravel/resource.md.stub +516 -0
- package/stubs/ai-guides/laravel/service.md.stub +503 -0
- package/stubs/ai-guides/laravel/testing.md.stub +1504 -0
- package/ai-guides/laravel-guide.md +0 -461
- package/dist/chunk-YVVAJA3T.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -382,4 +382,51 @@ declare function generateFactories(schemas: SchemaCollection, options?: FactoryG
|
|
|
382
382
|
*/
|
|
383
383
|
declare function getFactoryPath(factory: GeneratedFactory): string;
|
|
384
384
|
|
|
385
|
-
|
|
385
|
+
/**
|
|
386
|
+
* AI Guides Generator
|
|
387
|
+
*
|
|
388
|
+
* Generates AI assistant guides (Claude, Cursor) for Laravel projects.
|
|
389
|
+
* Simply copies .stub files, removes .stub extension, and replaces placeholders.
|
|
390
|
+
*/
|
|
391
|
+
/**
|
|
392
|
+
* Options for AI guides generation
|
|
393
|
+
*/
|
|
394
|
+
interface AIGuidesOptions {
|
|
395
|
+
/**
|
|
396
|
+
* Laravel models path from config (e.g., 'app/Models')
|
|
397
|
+
* Used to extract the base path for glob replacement
|
|
398
|
+
*/
|
|
399
|
+
modelsPath?: string;
|
|
400
|
+
/**
|
|
401
|
+
* Laravel migrations path from config
|
|
402
|
+
*/
|
|
403
|
+
migrationsPath?: string;
|
|
404
|
+
/**
|
|
405
|
+
* Base path for Laravel files (default: extracted from modelsPath or 'app')
|
|
406
|
+
* Used for placeholder replacement in Cursor rules
|
|
407
|
+
*/
|
|
408
|
+
laravelBasePath?: string;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Result of AI guides generation
|
|
412
|
+
*/
|
|
413
|
+
interface AIGuidesResult {
|
|
414
|
+
claudeGuides: number;
|
|
415
|
+
claudeRules: number;
|
|
416
|
+
claudeChecklists: number;
|
|
417
|
+
claudeWorkflows: number;
|
|
418
|
+
claudeAgents: number;
|
|
419
|
+
claudeOmnify: number;
|
|
420
|
+
cursorRules: number;
|
|
421
|
+
files: string[];
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Generate AI guides for Claude and Cursor
|
|
425
|
+
*/
|
|
426
|
+
declare function generateAIGuides(rootDir: string, options?: AIGuidesOptions): AIGuidesResult;
|
|
427
|
+
/**
|
|
428
|
+
* Check if AI guides need to be generated
|
|
429
|
+
*/
|
|
430
|
+
declare function shouldGenerateAIGuides(rootDir: string): boolean;
|
|
431
|
+
|
|
432
|
+
export { type AIGuidesOptions, type AIGuidesResult, type ColumnMethod, type ColumnModifier, type FactoryGeneratorOptions, type ForeignKeyDefinition, type GeneratedFactory, type GeneratedModel, type IndexDefinition, type MigrationDefinition, type MigrationFile, type MigrationOperation, type MigrationOptions, type ModelGeneratorOptions, type ProviderRegistrationResult, type TableBlueprint, formatColumnMethod, formatForeignKey, formatIndex, formatMigrationFile, generateAIGuides, generateAlterMigration, generateDropMigrationForTable, generateDropTableMigration, generateFactories, generateForeignKey, generateMigrationFromSchema, generateMigrations, generateMigrationsFromChanges, generateModels, generatePrimaryKeyColumn, generateProviderRegistration, generateSoftDeleteColumn, generateTimestampColumns, getFactoryPath, getMigrationPath, getModelPath, propertyToColumnMethod, schemaToBlueprint, shouldGenerateAIGuides, toColumnName, toTableName };
|
package/dist/index.d.ts
CHANGED
|
@@ -382,4 +382,51 @@ declare function generateFactories(schemas: SchemaCollection, options?: FactoryG
|
|
|
382
382
|
*/
|
|
383
383
|
declare function getFactoryPath(factory: GeneratedFactory): string;
|
|
384
384
|
|
|
385
|
-
|
|
385
|
+
/**
|
|
386
|
+
* AI Guides Generator
|
|
387
|
+
*
|
|
388
|
+
* Generates AI assistant guides (Claude, Cursor) for Laravel projects.
|
|
389
|
+
* Simply copies .stub files, removes .stub extension, and replaces placeholders.
|
|
390
|
+
*/
|
|
391
|
+
/**
|
|
392
|
+
* Options for AI guides generation
|
|
393
|
+
*/
|
|
394
|
+
interface AIGuidesOptions {
|
|
395
|
+
/**
|
|
396
|
+
* Laravel models path from config (e.g., 'app/Models')
|
|
397
|
+
* Used to extract the base path for glob replacement
|
|
398
|
+
*/
|
|
399
|
+
modelsPath?: string;
|
|
400
|
+
/**
|
|
401
|
+
* Laravel migrations path from config
|
|
402
|
+
*/
|
|
403
|
+
migrationsPath?: string;
|
|
404
|
+
/**
|
|
405
|
+
* Base path for Laravel files (default: extracted from modelsPath or 'app')
|
|
406
|
+
* Used for placeholder replacement in Cursor rules
|
|
407
|
+
*/
|
|
408
|
+
laravelBasePath?: string;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Result of AI guides generation
|
|
412
|
+
*/
|
|
413
|
+
interface AIGuidesResult {
|
|
414
|
+
claudeGuides: number;
|
|
415
|
+
claudeRules: number;
|
|
416
|
+
claudeChecklists: number;
|
|
417
|
+
claudeWorkflows: number;
|
|
418
|
+
claudeAgents: number;
|
|
419
|
+
claudeOmnify: number;
|
|
420
|
+
cursorRules: number;
|
|
421
|
+
files: string[];
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Generate AI guides for Claude and Cursor
|
|
425
|
+
*/
|
|
426
|
+
declare function generateAIGuides(rootDir: string, options?: AIGuidesOptions): AIGuidesResult;
|
|
427
|
+
/**
|
|
428
|
+
* Check if AI guides need to be generated
|
|
429
|
+
*/
|
|
430
|
+
declare function shouldGenerateAIGuides(rootDir: string): boolean;
|
|
431
|
+
|
|
432
|
+
export { type AIGuidesOptions, type AIGuidesResult, type ColumnMethod, type ColumnModifier, type FactoryGeneratorOptions, type ForeignKeyDefinition, type GeneratedFactory, type GeneratedModel, type IndexDefinition, type MigrationDefinition, type MigrationFile, type MigrationOperation, type MigrationOptions, type ModelGeneratorOptions, type ProviderRegistrationResult, type TableBlueprint, formatColumnMethod, formatForeignKey, formatIndex, formatMigrationFile, generateAIGuides, generateAlterMigration, generateDropMigrationForTable, generateDropTableMigration, generateFactories, generateForeignKey, generateMigrationFromSchema, generateMigrations, generateMigrationsFromChanges, generateModels, generatePrimaryKeyColumn, generateProviderRegistration, generateSoftDeleteColumn, generateTimestampColumns, getFactoryPath, getMigrationPath, getModelPath, propertyToColumnMethod, schemaToBlueprint, shouldGenerateAIGuides, toColumnName, toTableName };
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
formatForeignKey,
|
|
4
4
|
formatIndex,
|
|
5
5
|
formatMigrationFile,
|
|
6
|
+
generateAIGuides,
|
|
6
7
|
generateAlterMigration,
|
|
7
8
|
generateDropMigrationForTable,
|
|
8
9
|
generateDropTableMigration,
|
|
@@ -22,14 +23,16 @@ import {
|
|
|
22
23
|
laravelPlugin,
|
|
23
24
|
propertyToColumnMethod,
|
|
24
25
|
schemaToBlueprint,
|
|
26
|
+
shouldGenerateAIGuides,
|
|
25
27
|
toColumnName,
|
|
26
28
|
toTableName
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-V7LWJ6OM.js";
|
|
28
30
|
export {
|
|
29
31
|
formatColumnMethod,
|
|
30
32
|
formatForeignKey,
|
|
31
33
|
formatIndex,
|
|
32
34
|
formatMigrationFile,
|
|
35
|
+
generateAIGuides,
|
|
33
36
|
generateAlterMigration,
|
|
34
37
|
generateDropMigrationForTable,
|
|
35
38
|
generateDropTableMigration,
|
|
@@ -49,6 +52,7 @@ export {
|
|
|
49
52
|
laravelPlugin,
|
|
50
53
|
propertyToColumnMethod,
|
|
51
54
|
schemaToBlueprint,
|
|
55
|
+
shouldGenerateAIGuides,
|
|
52
56
|
toColumnName,
|
|
53
57
|
toTableName
|
|
54
58
|
};
|
package/dist/plugin.cjs
CHANGED
|
@@ -24,8 +24,8 @@ __export(plugin_exports, {
|
|
|
24
24
|
laravelPlugin: () => laravelPlugin
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(plugin_exports);
|
|
27
|
-
var
|
|
28
|
-
var
|
|
27
|
+
var import_node_fs2 = require("fs");
|
|
28
|
+
var import_node_path2 = require("path");
|
|
29
29
|
|
|
30
30
|
// src/migration/schema-builder.ts
|
|
31
31
|
var import_omnify_types = require("@famgia/omnify-types");
|
|
@@ -3896,6 +3896,152 @@ function getResourcePath(resource) {
|
|
|
3896
3896
|
return resource.path;
|
|
3897
3897
|
}
|
|
3898
3898
|
|
|
3899
|
+
// src/ai-guides/generator.ts
|
|
3900
|
+
var import_node_fs = require("fs");
|
|
3901
|
+
var import_node_path = require("path");
|
|
3902
|
+
var import_node_url = require("url");
|
|
3903
|
+
var import_meta = {};
|
|
3904
|
+
var __filename = (0, import_node_url.fileURLToPath)(import_meta.url);
|
|
3905
|
+
var __dirname = (0, import_node_path.dirname)(__filename);
|
|
3906
|
+
function getStubsDir() {
|
|
3907
|
+
const devPath = (0, import_node_path.resolve)(__dirname, "../../stubs/ai-guides");
|
|
3908
|
+
if ((0, import_node_fs.existsSync)(devPath)) {
|
|
3909
|
+
return devPath;
|
|
3910
|
+
}
|
|
3911
|
+
const distPath = (0, import_node_path.resolve)(__dirname, "../stubs/ai-guides");
|
|
3912
|
+
if ((0, import_node_fs.existsSync)(distPath)) {
|
|
3913
|
+
return distPath;
|
|
3914
|
+
}
|
|
3915
|
+
throw new Error("AI guides stubs not found");
|
|
3916
|
+
}
|
|
3917
|
+
function extractLaravelBasePath(modelsPath) {
|
|
3918
|
+
if (!modelsPath) return "app";
|
|
3919
|
+
const normalized = modelsPath.replace(/\\/g, "/");
|
|
3920
|
+
const match = normalized.match(/^(.+?)\/Models(?:\/.*)?$/);
|
|
3921
|
+
if (match && match[1]) {
|
|
3922
|
+
return match[1];
|
|
3923
|
+
}
|
|
3924
|
+
const parts = normalized.split("/").filter(Boolean);
|
|
3925
|
+
if (parts.length > 1) {
|
|
3926
|
+
return parts.slice(0, -1).join("/");
|
|
3927
|
+
}
|
|
3928
|
+
return "app";
|
|
3929
|
+
}
|
|
3930
|
+
function replacePlaceholders(content, basePath) {
|
|
3931
|
+
return content.replace(/\{\{LARAVEL_BASE\}\}/g, basePath);
|
|
3932
|
+
}
|
|
3933
|
+
function copyStubs(srcDir, destDir, transform) {
|
|
3934
|
+
const writtenFiles = [];
|
|
3935
|
+
if (!(0, import_node_fs.existsSync)(srcDir)) {
|
|
3936
|
+
return writtenFiles;
|
|
3937
|
+
}
|
|
3938
|
+
if (!(0, import_node_fs.existsSync)(destDir)) {
|
|
3939
|
+
(0, import_node_fs.mkdirSync)(destDir, { recursive: true });
|
|
3940
|
+
}
|
|
3941
|
+
const entries = (0, import_node_fs.readdirSync)(srcDir, { withFileTypes: true });
|
|
3942
|
+
for (const entry of entries) {
|
|
3943
|
+
const srcPath = (0, import_node_path.join)(srcDir, entry.name);
|
|
3944
|
+
if (entry.isDirectory()) {
|
|
3945
|
+
const subDestDir = (0, import_node_path.join)(destDir, entry.name);
|
|
3946
|
+
const subFiles = copyStubs(srcPath, subDestDir, transform);
|
|
3947
|
+
writtenFiles.push(...subFiles);
|
|
3948
|
+
} else if (entry.isFile() && entry.name.endsWith(".stub")) {
|
|
3949
|
+
const destName = entry.name.slice(0, -5);
|
|
3950
|
+
const destPath = (0, import_node_path.join)(destDir, destName);
|
|
3951
|
+
let content = (0, import_node_fs.readFileSync)(srcPath, "utf-8");
|
|
3952
|
+
if (transform) {
|
|
3953
|
+
content = transform(content);
|
|
3954
|
+
}
|
|
3955
|
+
(0, import_node_fs.writeFileSync)(destPath, content);
|
|
3956
|
+
writtenFiles.push(destPath);
|
|
3957
|
+
}
|
|
3958
|
+
}
|
|
3959
|
+
return writtenFiles;
|
|
3960
|
+
}
|
|
3961
|
+
function generateAIGuides(rootDir, options = {}) {
|
|
3962
|
+
const stubsDir = getStubsDir();
|
|
3963
|
+
const basePath = options.laravelBasePath || extractLaravelBasePath(options.modelsPath);
|
|
3964
|
+
const result = {
|
|
3965
|
+
claudeGuides: 0,
|
|
3966
|
+
claudeRules: 0,
|
|
3967
|
+
claudeChecklists: 0,
|
|
3968
|
+
claudeWorkflows: 0,
|
|
3969
|
+
claudeAgents: 0,
|
|
3970
|
+
claudeOmnify: 0,
|
|
3971
|
+
cursorRules: 0,
|
|
3972
|
+
files: []
|
|
3973
|
+
};
|
|
3974
|
+
const claudeSrcDir = (0, import_node_path.join)(stubsDir, "laravel");
|
|
3975
|
+
const claudeDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/guides/laravel");
|
|
3976
|
+
if ((0, import_node_fs.existsSync)(claudeSrcDir)) {
|
|
3977
|
+
const files = copyStubs(claudeSrcDir, claudeDestDir);
|
|
3978
|
+
result.claudeGuides = files.length;
|
|
3979
|
+
result.files.push(...files);
|
|
3980
|
+
}
|
|
3981
|
+
const claudeRulesSrcDir = (0, import_node_path.join)(stubsDir, "claude-rules");
|
|
3982
|
+
const claudeRulesDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/rules");
|
|
3983
|
+
if ((0, import_node_fs.existsSync)(claudeRulesSrcDir)) {
|
|
3984
|
+
const files = copyStubs(claudeRulesSrcDir, claudeRulesDestDir);
|
|
3985
|
+
result.claudeRules = files.length;
|
|
3986
|
+
result.files.push(...files);
|
|
3987
|
+
}
|
|
3988
|
+
const claudeChecklistsSrcDir = (0, import_node_path.join)(stubsDir, "claude-checklists");
|
|
3989
|
+
const claudeChecklistsDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/checklists");
|
|
3990
|
+
if ((0, import_node_fs.existsSync)(claudeChecklistsSrcDir)) {
|
|
3991
|
+
const files = copyStubs(claudeChecklistsSrcDir, claudeChecklistsDestDir);
|
|
3992
|
+
result.claudeChecklists = files.length;
|
|
3993
|
+
result.files.push(...files);
|
|
3994
|
+
}
|
|
3995
|
+
const claudeWorkflowsSrcDir = (0, import_node_path.join)(stubsDir, "claude-workflows");
|
|
3996
|
+
const claudeWorkflowsDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/workflows");
|
|
3997
|
+
if ((0, import_node_fs.existsSync)(claudeWorkflowsSrcDir)) {
|
|
3998
|
+
const files = copyStubs(claudeWorkflowsSrcDir, claudeWorkflowsDestDir);
|
|
3999
|
+
result.claudeWorkflows = files.length;
|
|
4000
|
+
result.files.push(...files);
|
|
4001
|
+
}
|
|
4002
|
+
const claudeAgentsSrcDir = (0, import_node_path.join)(stubsDir, "claude-agents");
|
|
4003
|
+
const claudeAgentsDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/agents");
|
|
4004
|
+
if ((0, import_node_fs.existsSync)(claudeAgentsSrcDir)) {
|
|
4005
|
+
const files = copyStubs(claudeAgentsSrcDir, claudeAgentsDestDir);
|
|
4006
|
+
result.claudeAgents = files.length;
|
|
4007
|
+
result.files.push(...files);
|
|
4008
|
+
}
|
|
4009
|
+
const claudeOmnifySrcDir = (0, import_node_path.join)(stubsDir, "claude-omnify");
|
|
4010
|
+
const claudeOmnifyDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/guides/omnify");
|
|
4011
|
+
if ((0, import_node_fs.existsSync)(claudeOmnifySrcDir)) {
|
|
4012
|
+
const files = copyStubs(claudeOmnifySrcDir, claudeOmnifyDestDir);
|
|
4013
|
+
result.claudeOmnify = files.length;
|
|
4014
|
+
result.files.push(...files);
|
|
4015
|
+
}
|
|
4016
|
+
const cursorSrcDir = (0, import_node_path.join)(stubsDir, "cursor");
|
|
4017
|
+
const cursorDestDir = (0, import_node_path.resolve)(rootDir, ".cursor/rules/omnify");
|
|
4018
|
+
if ((0, import_node_fs.existsSync)(cursorSrcDir)) {
|
|
4019
|
+
const files = copyStubs(
|
|
4020
|
+
cursorSrcDir,
|
|
4021
|
+
cursorDestDir,
|
|
4022
|
+
(content) => replacePlaceholders(content, basePath)
|
|
4023
|
+
);
|
|
4024
|
+
result.cursorRules = files.length;
|
|
4025
|
+
result.files.push(...files);
|
|
4026
|
+
}
|
|
4027
|
+
return result;
|
|
4028
|
+
}
|
|
4029
|
+
function shouldGenerateAIGuides(rootDir) {
|
|
4030
|
+
const claudeDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/guides/laravel");
|
|
4031
|
+
const cursorDir = (0, import_node_path.resolve)(rootDir, ".cursor/rules/omnify");
|
|
4032
|
+
if (!(0, import_node_fs.existsSync)(claudeDir) || !(0, import_node_fs.existsSync)(cursorDir)) {
|
|
4033
|
+
return true;
|
|
4034
|
+
}
|
|
4035
|
+
try {
|
|
4036
|
+
const claudeFiles = (0, import_node_fs.readdirSync)(claudeDir);
|
|
4037
|
+
const cursorFiles = (0, import_node_fs.readdirSync)(cursorDir);
|
|
4038
|
+
const hasLaravelRules = cursorFiles.some((f) => f.startsWith("laravel"));
|
|
4039
|
+
return claudeFiles.length === 0 || !hasLaravelRules;
|
|
4040
|
+
} catch {
|
|
4041
|
+
return true;
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
|
|
3899
4045
|
// src/plugin.ts
|
|
3900
4046
|
function inferLaravelRoot(providersPath) {
|
|
3901
4047
|
const normalized = providersPath.replace(/\\/g, "/");
|
|
@@ -3911,11 +4057,11 @@ function inferLaravelRoot(providersPath) {
|
|
|
3911
4057
|
}
|
|
3912
4058
|
function getExistingMigrationTables(migrationsDir) {
|
|
3913
4059
|
const existingTables = /* @__PURE__ */ new Set();
|
|
3914
|
-
if (!(0,
|
|
4060
|
+
if (!(0, import_node_fs2.existsSync)(migrationsDir)) {
|
|
3915
4061
|
return existingTables;
|
|
3916
4062
|
}
|
|
3917
4063
|
try {
|
|
3918
|
-
const files = (0,
|
|
4064
|
+
const files = (0, import_node_fs2.readdirSync)(migrationsDir);
|
|
3919
4065
|
const createMigrationPattern = /^\d{4}_\d{2}_\d{2}_\d{6}_create_(.+)_table\.php$/;
|
|
3920
4066
|
for (const file of files) {
|
|
3921
4067
|
const match = file.match(createMigrationPattern);
|
|
@@ -4081,7 +4227,7 @@ function laravelPlugin(options) {
|
|
|
4081
4227
|
customTypes: ctx.customTypes
|
|
4082
4228
|
};
|
|
4083
4229
|
const outputs = [];
|
|
4084
|
-
const migrationsDir = (0,
|
|
4230
|
+
const migrationsDir = (0, import_node_path2.join)(ctx.cwd, resolved.migrationsPath);
|
|
4085
4231
|
const existingTables = getExistingMigrationTables(migrationsDir);
|
|
4086
4232
|
if (ctx.changes !== void 0) {
|
|
4087
4233
|
if (ctx.changes.length === 0) {
|
|
@@ -4181,20 +4327,20 @@ function laravelPlugin(options) {
|
|
|
4181
4327
|
const laravelRoot = inferLaravelRoot(resolved.providersPath);
|
|
4182
4328
|
const bootstrapProvidersRelPath = laravelRoot ? `${laravelRoot}/bootstrap/providers.php` : "bootstrap/providers.php";
|
|
4183
4329
|
const configAppRelPath = laravelRoot ? `${laravelRoot}/config/app.php` : "config/app.php";
|
|
4184
|
-
const bootstrapProvidersPath = (0,
|
|
4185
|
-
const configAppPath = (0,
|
|
4330
|
+
const bootstrapProvidersPath = (0, import_node_path2.join)(ctx.cwd, bootstrapProvidersRelPath);
|
|
4331
|
+
const configAppPath = (0, import_node_path2.join)(ctx.cwd, configAppRelPath);
|
|
4186
4332
|
let existingContent = null;
|
|
4187
4333
|
let laravelVersion;
|
|
4188
|
-
if ((0,
|
|
4334
|
+
if ((0, import_node_fs2.existsSync)(bootstrapProvidersPath)) {
|
|
4189
4335
|
laravelVersion = "laravel11+";
|
|
4190
4336
|
try {
|
|
4191
|
-
existingContent = (0,
|
|
4337
|
+
existingContent = (0, import_node_fs2.readFileSync)(bootstrapProvidersPath, "utf-8");
|
|
4192
4338
|
} catch {
|
|
4193
4339
|
existingContent = null;
|
|
4194
4340
|
}
|
|
4195
|
-
} else if ((0,
|
|
4341
|
+
} else if ((0, import_node_fs2.existsSync)(configAppPath)) {
|
|
4196
4342
|
try {
|
|
4197
|
-
const configContent = (0,
|
|
4343
|
+
const configContent = (0, import_node_fs2.readFileSync)(configAppPath, "utf-8");
|
|
4198
4344
|
if (/'providers'\s*=>\s*\[/.test(configContent)) {
|
|
4199
4345
|
laravelVersion = "laravel10-";
|
|
4200
4346
|
existingContent = configContent;
|
|
@@ -4307,6 +4453,24 @@ function laravelPlugin(options) {
|
|
|
4307
4453
|
}));
|
|
4308
4454
|
}
|
|
4309
4455
|
};
|
|
4456
|
+
const aiGuidesGenerator = {
|
|
4457
|
+
name: "laravel-ai-guides",
|
|
4458
|
+
description: "Generate AI assistant guides (Claude, Cursor) for Laravel development",
|
|
4459
|
+
generate: async (ctx) => {
|
|
4460
|
+
if (!shouldGenerateAIGuides(ctx.cwd)) {
|
|
4461
|
+
ctx.logger.debug("AI guides already exist, skipping");
|
|
4462
|
+
return [];
|
|
4463
|
+
}
|
|
4464
|
+
const result = generateAIGuides(ctx.cwd, {
|
|
4465
|
+
modelsPath: resolved.modelsPath,
|
|
4466
|
+
migrationsPath: resolved.migrationsPath,
|
|
4467
|
+
laravelBasePath: "app"
|
|
4468
|
+
});
|
|
4469
|
+
const claudeTotal = result.claudeGuides + result.claudeRules + result.claudeChecklists + result.claudeWorkflows + result.claudeAgents + result.claudeOmnify;
|
|
4470
|
+
ctx.logger.info(`Generated ${claudeTotal} Claude files, ${result.cursorRules} Cursor rules`);
|
|
4471
|
+
return [];
|
|
4472
|
+
}
|
|
4473
|
+
};
|
|
4310
4474
|
const generators = [migrationGenerator];
|
|
4311
4475
|
if (resolved.generateModels) {
|
|
4312
4476
|
generators.push(modelGenerator);
|
|
@@ -4320,6 +4484,7 @@ function laravelPlugin(options) {
|
|
|
4320
4484
|
if (resolved.generateResources) {
|
|
4321
4485
|
generators.push(resourceGenerator);
|
|
4322
4486
|
}
|
|
4487
|
+
generators.push(aiGuidesGenerator);
|
|
4323
4488
|
return {
|
|
4324
4489
|
name: "@famgia/omnify-laravel",
|
|
4325
4490
|
version: "0.0.14",
|