agent-rules-init 0.1.2 → 0.2.0
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/bin.d.ts +2 -0
- package/dist/bin.js +3 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +62 -30
- package/dist/core/prompt-engine.d.ts +1 -0
- package/dist/core/prompt-engine.js +7 -0
- package/dist/core/scanner.js +52 -5
- package/dist/core/types.d.ts +64 -1
- package/dist/core/types.js +1 -1
- package/dist/packs/cpp.d.ts +2 -0
- package/dist/packs/cpp.js +70 -0
- package/dist/packs/csharp.d.ts +2 -0
- package/dist/packs/csharp.js +59 -0
- package/dist/packs/dart.d.ts +2 -0
- package/dist/packs/dart.js +61 -0
- package/dist/packs/elixir.d.ts +2 -0
- package/dist/packs/elixir.js +52 -0
- package/dist/packs/go.d.ts +2 -0
- package/dist/packs/go.js +62 -0
- package/dist/packs/java.d.ts +2 -0
- package/dist/packs/java.js +55 -0
- package/dist/packs/js-ts.d.ts +2 -0
- package/dist/packs/js-ts.js +86 -0
- package/dist/packs/kotlin.d.ts +2 -0
- package/dist/packs/kotlin.js +62 -0
- package/dist/packs/php.d.ts +2 -0
- package/dist/packs/php.js +63 -0
- package/dist/packs/python.d.ts +2 -0
- package/dist/packs/python.js +68 -0
- package/dist/packs/r.d.ts +2 -0
- package/dist/packs/r.js +60 -0
- package/dist/packs/ruby.d.ts +2 -0
- package/dist/packs/ruby.js +59 -0
- package/dist/packs/rust.d.ts +2 -0
- package/dist/packs/rust.js +61 -0
- package/dist/packs/scala.d.ts +2 -0
- package/dist/packs/scala.js +72 -0
- package/dist/packs/swift.d.ts +2 -0
- package/dist/packs/swift.js +52 -0
- package/package.json +3 -8
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
function detect(signals) {
|
|
2
|
+
const source = signals.packageSwift;
|
|
3
|
+
if (!source)
|
|
4
|
+
return null;
|
|
5
|
+
const lower = source.toLowerCase();
|
|
6
|
+
const framework = lower.includes("vapor")
|
|
7
|
+
? { value: "vapor", confidence: "high" }
|
|
8
|
+
: { value: "none", confidence: "low" };
|
|
9
|
+
return {
|
|
10
|
+
packId: "swift",
|
|
11
|
+
language: "Swift",
|
|
12
|
+
framework,
|
|
13
|
+
testRunner: { value: "swift test", confidence: "high" },
|
|
14
|
+
packageManager: { value: "swift package manager", confidence: "high" },
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function rules(detection) {
|
|
18
|
+
const framework = detection.framework?.value ?? "none";
|
|
19
|
+
return {
|
|
20
|
+
summary: `Proyecto Swift${framework !== "none" ? ` con ${framework}` : ""} (Swift Package Manager).`,
|
|
21
|
+
conventions: [
|
|
22
|
+
"Sigue la guía de estilo de la API de Swift (swift.org/documentation/api-design-guidelines).",
|
|
23
|
+
"Ejecuta los tests con `swift test` antes de terminar una tarea.",
|
|
24
|
+
"Declara toda dependencia nueva en Package.swift, nunca la añadas solo en Xcode.",
|
|
25
|
+
],
|
|
26
|
+
architectureNotes: [
|
|
27
|
+
"Prefiere `struct` sobre `class` salvo que se necesite semántica de referencia.",
|
|
28
|
+
"Evita forzar el desenvuelto de opcionales (`!`) fuera de contextos donde la invariante esté garantizada.",
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function promptTemplates(detection) {
|
|
33
|
+
const framework = detection.framework?.value ?? "el framework del proyecto";
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
id: "review",
|
|
37
|
+
title: "Code Review (Swift)",
|
|
38
|
+
body: `Revisa el diff actual buscando bugs, desenvueltos forzados de opcionales y desviaciones de las convenciones de ${framework}. Señala solo problemas concretos con línea de archivo.`,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "refactor",
|
|
42
|
+
title: "Refactor (Swift)",
|
|
43
|
+
body: `Propón refactors que reduzcan duplicación y mejoren la legibilidad sin cambiar comportamiento observable.`,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "testing",
|
|
47
|
+
title: "Testing (Swift)",
|
|
48
|
+
body: `Escribe tests con \`swift test\` para el código señalado. Cubre el camino feliz y al menos un caso límite.`,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
export const swiftPack = { id: "swift", detect, rules, promptTemplates };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-rules-init",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Generates CLAUDE.md, AGENTS.md, copilot-instructions.md and prompt files from what your repo actually is.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/cli.js",
|
|
8
8
|
"types": "dist/cli.d.ts",
|
|
9
9
|
"bin": {
|
|
10
|
-
"agent-rules-init": "dist/
|
|
10
|
+
"agent-rules-init": "dist/bin.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist"
|
|
@@ -39,12 +39,7 @@
|
|
|
39
39
|
"lint": "tsc -p tsconfig.json --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@clack/prompts": "^0.9.1"
|
|
43
|
-
"agent-rules-pack-java": "0.1.1",
|
|
44
|
-
"agent-rules-pack-js-ts": "0.1.1",
|
|
45
|
-
"agent-rules-pack-php": "0.1.1",
|
|
46
|
-
"agent-rules-pack-python": "0.1.1",
|
|
47
|
-
"agent-rules-pack-types": "0.1.1"
|
|
42
|
+
"@clack/prompts": "^0.9.1"
|
|
48
43
|
},
|
|
49
44
|
"devDependencies": {
|
|
50
45
|
"typescript": "^5.6.0",
|