agent-rules-init 0.1.3 → 0.2.1

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.
@@ -0,0 +1,61 @@
1
+ const FRAMEWORKS = [
2
+ ["actix-web", "actix-web"],
3
+ ["axum", "axum"],
4
+ ["rocket", "rocket"],
5
+ ];
6
+ function detect(signals) {
7
+ const source = signals.cargoToml;
8
+ if (!source)
9
+ return null;
10
+ const lower = source.toLowerCase();
11
+ let framework = { value: "none", confidence: "low" };
12
+ for (const [needle, label] of FRAMEWORKS) {
13
+ if (lower.includes(needle)) {
14
+ framework = { value: label, confidence: "high" };
15
+ break;
16
+ }
17
+ }
18
+ return {
19
+ packId: "rust",
20
+ language: "Rust",
21
+ framework,
22
+ testRunner: { value: "cargo test", confidence: "high" },
23
+ packageManager: { value: "cargo", confidence: "high" },
24
+ };
25
+ }
26
+ function rules(detection) {
27
+ const framework = detection.framework?.value ?? "none";
28
+ return {
29
+ summary: `Proyecto Rust${framework !== "none" ? ` con ${framework}` : ""} (cargo).`,
30
+ conventions: [
31
+ "Sigue el formato estándar de `rustfmt`; corre `cargo clippy` para detectar problemas idiomáticos.",
32
+ "Ejecuta los tests con `cargo test` antes de terminar una tarea.",
33
+ "Evita `unwrap()`/`expect()` en código de producción salvo que la invariante esté justificada.",
34
+ ],
35
+ architectureNotes: [
36
+ "Mantén los módulos con una responsabilidad clara; usa `mod.rs` o archivos de módulo con nombre explícito según lo que ya use el repo.",
37
+ "Declara toda dependencia nueva en Cargo.toml y mantén Cargo.lock sincronizado.",
38
+ ],
39
+ };
40
+ }
41
+ function promptTemplates(detection) {
42
+ const framework = detection.framework?.value ?? "el framework del proyecto";
43
+ return [
44
+ {
45
+ id: "review",
46
+ title: "Code Review (Rust)",
47
+ body: `Revisa el diff actual buscando bugs, usos innecesarios de \`unwrap()\`/\`clone()\` y desviaciones de las convenciones de ${framework}. Señala solo problemas concretos con línea de archivo.`,
48
+ },
49
+ {
50
+ id: "refactor",
51
+ title: "Refactor (Rust)",
52
+ body: `Propón refactors que reduzcan duplicación y mejoren la legibilidad sin cambiar comportamiento observable. Respeta el sistema de ownership existente.`,
53
+ },
54
+ {
55
+ id: "testing",
56
+ title: "Testing (Rust)",
57
+ body: `Escribe tests con \`cargo test\` para el código señalado. Cubre el camino feliz y al menos un caso límite.`,
58
+ },
59
+ ];
60
+ }
61
+ export const rustPack = { id: "rust", detect, rules, promptTemplates };
@@ -0,0 +1,2 @@
1
+ import type { Pack } from "../core/types.js";
2
+ export declare const scalaPack: Pack;
@@ -0,0 +1,74 @@
1
+ const FRAMEWORKS = [
2
+ ["playframework", "play"],
3
+ ["akka-http", "akka"],
4
+ ["akka.actor", "akka"],
5
+ ["scalatra", "scalatra"],
6
+ ];
7
+ const TEST_RUNNERS = [
8
+ ["scalatest", "scalatest"],
9
+ ["munit", "munit"],
10
+ ["specs2", "specs2"],
11
+ ];
12
+ function detect(signals) {
13
+ const source = signals.buildSbt;
14
+ if (!source)
15
+ return null;
16
+ const lower = source.toLowerCase();
17
+ let framework = { value: "none", confidence: "low" };
18
+ for (const [needle, label] of FRAMEWORKS) {
19
+ if (lower.includes(needle)) {
20
+ framework = { value: label, confidence: "high" };
21
+ break;
22
+ }
23
+ }
24
+ let testRunner = { value: "unknown", confidence: "low" };
25
+ for (const [needle, label] of TEST_RUNNERS) {
26
+ if (lower.includes(needle)) {
27
+ testRunner = { value: label, confidence: "high" };
28
+ break;
29
+ }
30
+ }
31
+ return {
32
+ packId: "scala",
33
+ language: "Scala",
34
+ framework,
35
+ testRunner,
36
+ packageManager: { value: "sbt", confidence: "high" },
37
+ };
38
+ }
39
+ function rules(detection) {
40
+ const framework = detection.framework?.value ?? "none";
41
+ return {
42
+ summary: `Proyecto Scala${framework !== "none" ? ` con ${framework}` : ""} (sbt).`,
43
+ conventions: [
44
+ "Sigue la guía de estilo oficial de Scala; ejecuta `scalafmt` si el proyecto ya lo usa.",
45
+ `Ejecuta los tests con \`sbt test\` antes de terminar una tarea.`,
46
+ "Prefiere estructuras inmutables y funciones puras cuando el proyecto ya siga ese estilo.",
47
+ ],
48
+ architectureNotes: [
49
+ "Mantén los módulos con una responsabilidad clara; usa `case class` para modelos de datos.",
50
+ "Declara toda dependencia nueva en `build.sbt`.",
51
+ ],
52
+ };
53
+ }
54
+ function promptTemplates(detection) {
55
+ const framework = detection.framework?.value ?? "el framework del proyecto";
56
+ return [
57
+ {
58
+ id: "review",
59
+ title: "Code Review (Scala)",
60
+ body: `Revisa el diff actual buscando bugs, usos innecesarios de mutabilidad y desviaciones de las convenciones de ${framework}. Señala solo problemas concretos con línea de archivo.`,
61
+ },
62
+ {
63
+ id: "refactor",
64
+ title: "Refactor (Scala)",
65
+ body: `Propón refactors que reduzcan duplicación y mejoren la legibilidad sin cambiar comportamiento observable.`,
66
+ },
67
+ {
68
+ id: "testing",
69
+ title: "Testing (Scala)",
70
+ body: `Escribe tests con ${detection.testRunner?.value !== "unknown" ? detection.testRunner?.value : "el test runner del proyecto"} para el código señalado. Cubre el camino feliz y al menos un caso límite.`,
71
+ },
72
+ ];
73
+ }
74
+ export const scalaPack = { id: "scala", detect, rules, promptTemplates };
@@ -0,0 +1,2 @@
1
+ import type { Pack } from "../core/types.js";
2
+ export declare const swiftPack: Pack;
@@ -0,0 +1,58 @@
1
+ function detect(signals) {
2
+ const source = signals.packageSwift;
3
+ if (!source)
4
+ return null;
5
+ // A Package.swift alone doesn't guarantee a Swift project: some C/C++ libraries (e.g.
6
+ // nlohmann/json) ship one purely so Swift Package Manager users can link the library,
7
+ // with zero actual Swift source. Require at least one other .swift file to be present.
8
+ const hasSwiftSource = signals.files.some((f) => f.toLowerCase().endsWith(".swift") && !f.endsWith("Package.swift"));
9
+ if (!hasSwiftSource)
10
+ return null;
11
+ const lower = source.toLowerCase();
12
+ const framework = lower.includes("vapor")
13
+ ? { value: "vapor", confidence: "high" }
14
+ : { value: "none", confidence: "low" };
15
+ return {
16
+ packId: "swift",
17
+ language: "Swift",
18
+ framework,
19
+ testRunner: { value: "swift test", confidence: "high" },
20
+ packageManager: { value: "swift package manager", confidence: "high" },
21
+ };
22
+ }
23
+ function rules(detection) {
24
+ const framework = detection.framework?.value ?? "none";
25
+ return {
26
+ summary: `Proyecto Swift${framework !== "none" ? ` con ${framework}` : ""} (Swift Package Manager).`,
27
+ conventions: [
28
+ "Sigue la guía de estilo de la API de Swift (swift.org/documentation/api-design-guidelines).",
29
+ "Ejecuta los tests con `swift test` antes de terminar una tarea.",
30
+ "Declara toda dependencia nueva en Package.swift, nunca la añadas solo en Xcode.",
31
+ ],
32
+ architectureNotes: [
33
+ "Prefiere `struct` sobre `class` salvo que se necesite semántica de referencia.",
34
+ "Evita forzar el desenvuelto de opcionales (`!`) fuera de contextos donde la invariante esté garantizada.",
35
+ ],
36
+ };
37
+ }
38
+ function promptTemplates(detection) {
39
+ const framework = detection.framework?.value ?? "el framework del proyecto";
40
+ return [
41
+ {
42
+ id: "review",
43
+ title: "Code Review (Swift)",
44
+ 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.`,
45
+ },
46
+ {
47
+ id: "refactor",
48
+ title: "Refactor (Swift)",
49
+ body: `Propón refactors que reduzcan duplicación y mejoren la legibilidad sin cambiar comportamiento observable.`,
50
+ },
51
+ {
52
+ id: "testing",
53
+ title: "Testing (Swift)",
54
+ body: `Escribe tests con \`swift test\` para el código señalado. Cubre el camino feliz y al menos un caso límite.`,
55
+ },
56
+ ];
57
+ }
58
+ 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.1.3",
3
+ "version": "0.2.1",
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/cli.js"
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",
@@ -1 +0,0 @@
1
- export declare function renderAssistantGreeting(assistantName: string): string;
@@ -1,9 +0,0 @@
1
- export function renderAssistantGreeting(assistantName) {
2
- return [
3
- " ╭───────╮",
4
- " │ ◕ ◕ │ ノ)ノ",
5
- " │ ‿ │",
6
- " ╰───────╯",
7
- ` ¡${assistantName} está por aquí!`,
8
- ].join("\n");
9
- }