Skip to content

Commit cc4f7c2

Browse files
mr0blesmidudev
authored andcommitted
feat: add Laravel detection with multi-signal approach
- Detect Laravel via artisan file, bootstrap/app.php, or composer.json - Add jpcaparas/superpowers-laravel as the default skill - Add 6 test cases for Laravel detection Closes #55
1 parent 9f1330f commit cc4f7c2

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

packages/autoskills/skills-map.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,18 @@ export const SKILLS_MAP = [
824824
},
825825
skills: [],
826826
},
827+
{
828+
id: "laravel",
829+
name: "Laravel",
830+
detect: {
831+
configFiles: ["artisan", "bootstrap/app.php"],
832+
configFileContent: {
833+
files: ["composer.json"],
834+
patterns: ["laravel/framework", "illuminate/"],
835+
},
836+
},
837+
skills: ["jpcaparas/superpowers-laravel"],
838+
},
827839
{
828840
id: "fastapi",
829841
name: "FastAPI",

packages/autoskills/tests/detect.test.mjs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,56 @@ plugins {
745745
ok(!detected.some((t) => t.id === "php"));
746746
});
747747

748+
it("detects Laravel from artisan file", () => {
749+
writeFile(tmp.path, "artisan", "#!/usr/bin/env php\n<?php\ndefine('LARAVEL_START', microtime(true));");
750+
const { detected } = detectTechnologies(tmp.path);
751+
ok(detected.some((t) => t.id === "laravel"));
752+
});
753+
754+
it("detects Laravel from bootstrap/app.php", () => {
755+
writeFile(tmp.path, "bootstrap/app.php", "return $app;");
756+
const { detected } = detectTechnologies(tmp.path);
757+
ok(detected.some((t) => t.id === "laravel"));
758+
});
759+
760+
it("detects Laravel from composer.json with laravel/framework", () => {
761+
writeFile(
762+
tmp.path,
763+
"composer.json",
764+
JSON.stringify({ require: { "laravel/framework": "^11.0" } }),
765+
);
766+
const { detected } = detectTechnologies(tmp.path);
767+
ok(detected.some((t) => t.id === "laravel"));
768+
});
769+
770+
it("detects Laravel from composer.json with illuminate packages", () => {
771+
writeFile(
772+
tmp.path,
773+
"composer.json",
774+
JSON.stringify({ require: { "illuminate/support": "^11.0" } }),
775+
);
776+
const { detected } = detectTechnologies(tmp.path);
777+
ok(detected.some((t) => t.id === "laravel"));
778+
});
779+
780+
it("returns correct skills for Laravel detection", () => {
781+
writeFile(
782+
tmp.path,
783+
"composer.json",
784+
JSON.stringify({ require: { "laravel/framework": "^11.0" } }),
785+
);
786+
const { detected } = detectTechnologies(tmp.path);
787+
const laravel = detected.find((t) => t.id === "laravel");
788+
ok(laravel);
789+
ok(laravel.skills.includes("jpcaparas/superpowers-laravel"));
790+
});
791+
792+
it("does not detect Laravel without Laravel files or packages", () => {
793+
writePackageJson(tmp.path, { dependencies: { express: "^4.0.0" } });
794+
const { detected } = detectTechnologies(tmp.path);
795+
ok(!detected.some((t) => t.id === "laravel"));
796+
});
797+
748798
it("detects Chrome Extension from manifest.json with manifest_version", () => {
749799
writeFile(
750800
tmp.path,

0 commit comments

Comments
 (0)