@famgia/omnify-laravel 0.0.88 → 0.0.90
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-2QSKZS63.js} +188 -12
- package/dist/chunk-2QSKZS63.js.map +1 -0
- package/dist/index.cjs +190 -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 +186 -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/README.md.stub +95 -0
- 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/react-form-guide.md.stub +259 -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/cursor/omnify.mdc.stub +58 -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-2QSKZS63.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,162 @@ 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 readmeSrcPath = (0, import_node_path.join)(stubsDir, "README.md.stub");
|
|
3975
|
+
if ((0, import_node_fs.existsSync)(readmeSrcPath)) {
|
|
3976
|
+
const readmeDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify");
|
|
3977
|
+
if (!(0, import_node_fs.existsSync)(readmeDestDir)) {
|
|
3978
|
+
(0, import_node_fs.mkdirSync)(readmeDestDir, { recursive: true });
|
|
3979
|
+
}
|
|
3980
|
+
const content = (0, import_node_fs.readFileSync)(readmeSrcPath, "utf-8");
|
|
3981
|
+
(0, import_node_fs.writeFileSync)((0, import_node_path.resolve)(readmeDestDir, "README.md"), content);
|
|
3982
|
+
result.files.push((0, import_node_path.resolve)(readmeDestDir, "README.md"));
|
|
3983
|
+
}
|
|
3984
|
+
const claudeSrcDir = (0, import_node_path.join)(stubsDir, "laravel");
|
|
3985
|
+
const claudeDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/guides/laravel");
|
|
3986
|
+
if ((0, import_node_fs.existsSync)(claudeSrcDir)) {
|
|
3987
|
+
const files = copyStubs(claudeSrcDir, claudeDestDir);
|
|
3988
|
+
result.claudeGuides = files.length;
|
|
3989
|
+
result.files.push(...files);
|
|
3990
|
+
}
|
|
3991
|
+
const claudeRulesSrcDir = (0, import_node_path.join)(stubsDir, "claude-rules");
|
|
3992
|
+
const claudeRulesDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/rules");
|
|
3993
|
+
if ((0, import_node_fs.existsSync)(claudeRulesSrcDir)) {
|
|
3994
|
+
const files = copyStubs(claudeRulesSrcDir, claudeRulesDestDir);
|
|
3995
|
+
result.claudeRules = files.length;
|
|
3996
|
+
result.files.push(...files);
|
|
3997
|
+
}
|
|
3998
|
+
const claudeChecklistsSrcDir = (0, import_node_path.join)(stubsDir, "claude-checklists");
|
|
3999
|
+
const claudeChecklistsDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/checklists");
|
|
4000
|
+
if ((0, import_node_fs.existsSync)(claudeChecklistsSrcDir)) {
|
|
4001
|
+
const files = copyStubs(claudeChecklistsSrcDir, claudeChecklistsDestDir);
|
|
4002
|
+
result.claudeChecklists = files.length;
|
|
4003
|
+
result.files.push(...files);
|
|
4004
|
+
}
|
|
4005
|
+
const claudeWorkflowsSrcDir = (0, import_node_path.join)(stubsDir, "claude-workflows");
|
|
4006
|
+
const claudeWorkflowsDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/workflows");
|
|
4007
|
+
if ((0, import_node_fs.existsSync)(claudeWorkflowsSrcDir)) {
|
|
4008
|
+
const files = copyStubs(claudeWorkflowsSrcDir, claudeWorkflowsDestDir);
|
|
4009
|
+
result.claudeWorkflows = files.length;
|
|
4010
|
+
result.files.push(...files);
|
|
4011
|
+
}
|
|
4012
|
+
const claudeAgentsSrcDir = (0, import_node_path.join)(stubsDir, "claude-agents");
|
|
4013
|
+
const claudeAgentsDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/agents");
|
|
4014
|
+
if ((0, import_node_fs.existsSync)(claudeAgentsSrcDir)) {
|
|
4015
|
+
const files = copyStubs(claudeAgentsSrcDir, claudeAgentsDestDir);
|
|
4016
|
+
result.claudeAgents = files.length;
|
|
4017
|
+
result.files.push(...files);
|
|
4018
|
+
}
|
|
4019
|
+
const claudeOmnifySrcDir = (0, import_node_path.join)(stubsDir, "claude-omnify");
|
|
4020
|
+
const claudeOmnifyDestDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/guides/omnify");
|
|
4021
|
+
if ((0, import_node_fs.existsSync)(claudeOmnifySrcDir)) {
|
|
4022
|
+
const files = copyStubs(claudeOmnifySrcDir, claudeOmnifyDestDir);
|
|
4023
|
+
result.claudeOmnify = files.length;
|
|
4024
|
+
result.files.push(...files);
|
|
4025
|
+
}
|
|
4026
|
+
const cursorSrcDir = (0, import_node_path.join)(stubsDir, "cursor");
|
|
4027
|
+
const cursorDestDir = (0, import_node_path.resolve)(rootDir, ".cursor/rules/omnify");
|
|
4028
|
+
if ((0, import_node_fs.existsSync)(cursorSrcDir)) {
|
|
4029
|
+
const files = copyStubs(
|
|
4030
|
+
cursorSrcDir,
|
|
4031
|
+
cursorDestDir,
|
|
4032
|
+
(content) => replacePlaceholders(content, basePath)
|
|
4033
|
+
);
|
|
4034
|
+
result.cursorRules = files.length;
|
|
4035
|
+
result.files.push(...files);
|
|
4036
|
+
}
|
|
4037
|
+
return result;
|
|
4038
|
+
}
|
|
4039
|
+
function shouldGenerateAIGuides(rootDir) {
|
|
4040
|
+
const claudeDir = (0, import_node_path.resolve)(rootDir, ".claude/omnify/guides/laravel");
|
|
4041
|
+
const cursorDir = (0, import_node_path.resolve)(rootDir, ".cursor/rules/omnify");
|
|
4042
|
+
if (!(0, import_node_fs.existsSync)(claudeDir) || !(0, import_node_fs.existsSync)(cursorDir)) {
|
|
4043
|
+
return true;
|
|
4044
|
+
}
|
|
4045
|
+
try {
|
|
4046
|
+
const claudeFiles = (0, import_node_fs.readdirSync)(claudeDir);
|
|
4047
|
+
const cursorFiles = (0, import_node_fs.readdirSync)(cursorDir);
|
|
4048
|
+
const hasLaravelRules = cursorFiles.some((f) => f.startsWith("laravel"));
|
|
4049
|
+
return claudeFiles.length === 0 || !hasLaravelRules;
|
|
4050
|
+
} catch {
|
|
4051
|
+
return true;
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
|
|
3899
4055
|
// src/plugin.ts
|
|
3900
4056
|
function inferLaravelRoot(providersPath) {
|
|
3901
4057
|
const normalized = providersPath.replace(/\\/g, "/");
|
|
@@ -3911,11 +4067,11 @@ function inferLaravelRoot(providersPath) {
|
|
|
3911
4067
|
}
|
|
3912
4068
|
function getExistingMigrationTables(migrationsDir) {
|
|
3913
4069
|
const existingTables = /* @__PURE__ */ new Set();
|
|
3914
|
-
if (!(0,
|
|
4070
|
+
if (!(0, import_node_fs2.existsSync)(migrationsDir)) {
|
|
3915
4071
|
return existingTables;
|
|
3916
4072
|
}
|
|
3917
4073
|
try {
|
|
3918
|
-
const files = (0,
|
|
4074
|
+
const files = (0, import_node_fs2.readdirSync)(migrationsDir);
|
|
3919
4075
|
const createMigrationPattern = /^\d{4}_\d{2}_\d{2}_\d{6}_create_(.+)_table\.php$/;
|
|
3920
4076
|
for (const file of files) {
|
|
3921
4077
|
const match = file.match(createMigrationPattern);
|
|
@@ -4081,7 +4237,7 @@ function laravelPlugin(options) {
|
|
|
4081
4237
|
customTypes: ctx.customTypes
|
|
4082
4238
|
};
|
|
4083
4239
|
const outputs = [];
|
|
4084
|
-
const migrationsDir = (0,
|
|
4240
|
+
const migrationsDir = (0, import_node_path2.join)(ctx.cwd, resolved.migrationsPath);
|
|
4085
4241
|
const existingTables = getExistingMigrationTables(migrationsDir);
|
|
4086
4242
|
if (ctx.changes !== void 0) {
|
|
4087
4243
|
if (ctx.changes.length === 0) {
|
|
@@ -4181,20 +4337,20 @@ function laravelPlugin(options) {
|
|
|
4181
4337
|
const laravelRoot = inferLaravelRoot(resolved.providersPath);
|
|
4182
4338
|
const bootstrapProvidersRelPath = laravelRoot ? `${laravelRoot}/bootstrap/providers.php` : "bootstrap/providers.php";
|
|
4183
4339
|
const configAppRelPath = laravelRoot ? `${laravelRoot}/config/app.php` : "config/app.php";
|
|
4184
|
-
const bootstrapProvidersPath = (0,
|
|
4185
|
-
const configAppPath = (0,
|
|
4340
|
+
const bootstrapProvidersPath = (0, import_node_path2.join)(ctx.cwd, bootstrapProvidersRelPath);
|
|
4341
|
+
const configAppPath = (0, import_node_path2.join)(ctx.cwd, configAppRelPath);
|
|
4186
4342
|
let existingContent = null;
|
|
4187
4343
|
let laravelVersion;
|
|
4188
|
-
if ((0,
|
|
4344
|
+
if ((0, import_node_fs2.existsSync)(bootstrapProvidersPath)) {
|
|
4189
4345
|
laravelVersion = "laravel11+";
|
|
4190
4346
|
try {
|
|
4191
|
-
existingContent = (0,
|
|
4347
|
+
existingContent = (0, import_node_fs2.readFileSync)(bootstrapProvidersPath, "utf-8");
|
|
4192
4348
|
} catch {
|
|
4193
4349
|
existingContent = null;
|
|
4194
4350
|
}
|
|
4195
|
-
} else if ((0,
|
|
4351
|
+
} else if ((0, import_node_fs2.existsSync)(configAppPath)) {
|
|
4196
4352
|
try {
|
|
4197
|
-
const configContent = (0,
|
|
4353
|
+
const configContent = (0, import_node_fs2.readFileSync)(configAppPath, "utf-8");
|
|
4198
4354
|
if (/'providers'\s*=>\s*\[/.test(configContent)) {
|
|
4199
4355
|
laravelVersion = "laravel10-";
|
|
4200
4356
|
existingContent = configContent;
|
|
@@ -4307,6 +4463,24 @@ function laravelPlugin(options) {
|
|
|
4307
4463
|
}));
|
|
4308
4464
|
}
|
|
4309
4465
|
};
|
|
4466
|
+
const aiGuidesGenerator = {
|
|
4467
|
+
name: "laravel-ai-guides",
|
|
4468
|
+
description: "Generate AI assistant guides (Claude, Cursor) for Laravel development",
|
|
4469
|
+
generate: async (ctx) => {
|
|
4470
|
+
if (!shouldGenerateAIGuides(ctx.cwd)) {
|
|
4471
|
+
ctx.logger.debug("AI guides already exist, skipping");
|
|
4472
|
+
return [];
|
|
4473
|
+
}
|
|
4474
|
+
const result = generateAIGuides(ctx.cwd, {
|
|
4475
|
+
modelsPath: resolved.modelsPath,
|
|
4476
|
+
migrationsPath: resolved.migrationsPath,
|
|
4477
|
+
laravelBasePath: "app"
|
|
4478
|
+
});
|
|
4479
|
+
const claudeTotal = result.claudeGuides + result.claudeRules + result.claudeChecklists + result.claudeWorkflows + result.claudeAgents + result.claudeOmnify;
|
|
4480
|
+
ctx.logger.info(`Generated ${claudeTotal} Claude files, ${result.cursorRules} Cursor rules`);
|
|
4481
|
+
return [];
|
|
4482
|
+
}
|
|
4483
|
+
};
|
|
4310
4484
|
const generators = [migrationGenerator];
|
|
4311
4485
|
if (resolved.generateModels) {
|
|
4312
4486
|
generators.push(modelGenerator);
|
|
@@ -4320,6 +4494,7 @@ function laravelPlugin(options) {
|
|
|
4320
4494
|
if (resolved.generateResources) {
|
|
4321
4495
|
generators.push(resourceGenerator);
|
|
4322
4496
|
}
|
|
4497
|
+
generators.push(aiGuidesGenerator);
|
|
4323
4498
|
return {
|
|
4324
4499
|
name: "@famgia/omnify-laravel",
|
|
4325
4500
|
version: "0.0.14",
|