create-huenei-template 0.2.9 → 0.2.12

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.
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  import "../dist/index.js";
@@ -1,5 +1,5 @@
1
1
  import path from "path";
2
- import { mkdir, cp, rm, access } from "fs/promises";
2
+ import { mkdir, cp, rm, access, readdir, stat } from "fs/promises";
3
3
  import { constants } from "fs";
4
4
  export async function ensureDirectory(dirPath) {
5
5
  await mkdir(dirPath, { recursive: true });
@@ -26,7 +26,7 @@ export async function directoryExists(dirPath) {
26
26
  }
27
27
  export async function copyToExistingDir(source, dest) {
28
28
  await ensureDirectory(dest);
29
- await cp(source, dest, { recursive: true, force: true });
29
+ await robustCopyDir(source, dest);
30
30
  }
31
31
  export async function mergeSubdirectories(source, dest, subdirs) {
32
32
  for (const subdir of subdirs) {
@@ -34,7 +34,39 @@ export async function mergeSubdirectories(source, dest, subdirs) {
34
34
  const destPath = path.join(dest, subdir);
35
35
  if (await directoryExists(srcPath)) {
36
36
  await ensureDirectory(destPath);
37
- await cp(srcPath, destPath, { recursive: true, force: true });
37
+ await robustCopyDir(srcPath, destPath);
38
+ }
39
+ }
40
+ }
41
+ async function isDirectory(filePath) {
42
+ try {
43
+ const s = await stat(filePath);
44
+ return s.isDirectory();
45
+ }
46
+ catch {
47
+ return false;
48
+ }
49
+ }
50
+ async function robustCopyDir(source, dest) {
51
+ const entries = await readdir(source, { withFileTypes: true });
52
+ for (const entry of entries) {
53
+ const srcEntry = path.join(source, entry.name);
54
+ const destEntry = path.join(dest, entry.name);
55
+ if (await directoryExists(destEntry)) {
56
+ const destIsDir = await isDirectory(destEntry);
57
+ if (entry.isDirectory() && !destIsDir) {
58
+ await rm(destEntry, { force: true });
59
+ }
60
+ else if (!entry.isDirectory() && destIsDir) {
61
+ await rm(destEntry, { recursive: true, force: true });
62
+ }
63
+ }
64
+ if (entry.isDirectory()) {
65
+ await ensureDirectory(destEntry);
66
+ await robustCopyDir(srcEntry, destEntry);
67
+ }
68
+ else {
69
+ await cp(srcEntry, destEntry, { force: true });
38
70
  }
39
71
  }
40
72
  }
@@ -0,0 +1,176 @@
1
+ import pc from "picocolors";
2
+ function rgb(r, g, b, text) {
3
+ return `\x1b[38;2;${r};${g};${b}m${text}\x1b[39m`;
4
+ }
5
+ function orange(text) {
6
+ return rgb(255, 140, 0, text);
7
+ }
8
+ const RAINBOW_COLORS = [
9
+ [255, 56, 56],
10
+ [255, 140, 0],
11
+ [255, 210, 0],
12
+ [0, 200, 80],
13
+ [0, 160, 255],
14
+ [130, 80, 255],
15
+ [200, 50, 200],
16
+ ];
17
+ const BOX_WIDTH = 60;
18
+ const TOP_LEFT = "╔";
19
+ const TOP_RIGHT = "╗";
20
+ const BOTTOM_LEFT = "╚";
21
+ const BOTTOM_RIGHT = "╝";
22
+ const HORIZONTAL = "═";
23
+ const VERTICAL = "║";
24
+ const T_LEFT = "╠";
25
+ const T_RIGHT = "╣";
26
+ function pad(text, width) {
27
+ const visible = stripAnsi(text);
28
+ const diff = width - visible.length;
29
+ return diff > 0 ? text + " ".repeat(diff) : text;
30
+ }
31
+ function stripAnsi(str) {
32
+ return str.replace(/\x1B\[[0-9;]*m/g, "");
33
+ }
34
+ function hLine(left, right) {
35
+ return left + HORIZONTAL.repeat(BOX_WIDTH) + right;
36
+ }
37
+ function boxLine(text) {
38
+ return `${VERTICAL} ${pad(text, BOX_WIDTH - 2)} ${VERTICAL}`;
39
+ }
40
+ function emptyLine() {
41
+ return boxLine("");
42
+ }
43
+ export function banner() {
44
+ const title = "Official Huenei Template CLI";
45
+ const centered = centerText(pc.bold(orange(title)), BOX_WIDTH - 2);
46
+ console.log("");
47
+ console.log(orange(hLine(TOP_LEFT, TOP_RIGHT)));
48
+ console.log(orange(emptyLine()));
49
+ console.log(orange(VERTICAL) + " " + centered + " " + orange(VERTICAL));
50
+ console.log(orange(emptyLine()));
51
+ console.log(orange(hLine(BOTTOM_LEFT, BOTTOM_RIGHT)));
52
+ console.log("");
53
+ }
54
+ export function successBox(title, lines) {
55
+ const styledTitle = centerText(pc.bold(pc.green(title)), BOX_WIDTH - 2);
56
+ const maxContent = BOX_WIDTH - 2;
57
+ console.log("");
58
+ console.log(pc.green(hLine(TOP_LEFT, TOP_RIGHT)));
59
+ console.log(pc.green(emptyLine()));
60
+ console.log(pc.green(VERTICAL) + " " + styledTitle + " " + pc.green(VERTICAL));
61
+ console.log(pc.green(emptyLine()));
62
+ console.log(pc.green(hLine(T_LEFT, T_RIGHT)));
63
+ for (const line of lines) {
64
+ for (const wrapped of wrapText(line, maxContent)) {
65
+ console.log(pc.green(VERTICAL) + " " + pad(wrapped, maxContent) + " " + pc.green(VERTICAL));
66
+ }
67
+ }
68
+ console.log(pc.green(emptyLine()));
69
+ console.log(pc.green(hLine(BOTTOM_LEFT, BOTTOM_RIGHT)));
70
+ console.log("");
71
+ }
72
+ function rainbowColor(index) {
73
+ const [r, g, b] = RAINBOW_COLORS[index % RAINBOW_COLORS.length];
74
+ return (t) => rgb(r, g, b, t);
75
+ }
76
+ function rainbowLine() {
77
+ const total = BOX_WIDTH;
78
+ const count = RAINBOW_COLORS.length;
79
+ const base = Math.floor(total / count);
80
+ const extra = total % count;
81
+ let line = "";
82
+ for (let i = 0; i < count; i++) {
83
+ const len = base + (i < extra ? 1 : 0);
84
+ line += rainbowColor(i)(HORIZONTAL.repeat(len));
85
+ }
86
+ return line;
87
+ }
88
+ export function stepsBox(title, steps) {
89
+ const maxStep = BOX_WIDTH - 7;
90
+ const topLine = rainbowColor(0)(TOP_LEFT) + rainbowLine() + rainbowColor(6)(TOP_RIGHT);
91
+ const midLine = rainbowColor(0)(T_LEFT) + rainbowLine() + rainbowColor(6)(T_RIGHT);
92
+ const botLine = rainbowColor(0)(BOTTOM_LEFT) + rainbowLine() + rainbowColor(6)(BOTTOM_RIGHT);
93
+ const titleColor = rainbowColor(1);
94
+ const styledTitle = centerText(pc.bold(titleColor(title)), BOX_WIDTH - 2);
95
+ console.log(topLine);
96
+ console.log(rainbowColor(0)(VERTICAL) + " " + pad("", BOX_WIDTH - 2) + " " + rainbowColor(6)(VERTICAL));
97
+ console.log(rainbowColor(0)(VERTICAL) + " " + styledTitle + " " + rainbowColor(6)(VERTICAL));
98
+ console.log(rainbowColor(0)(VERTICAL) + " " + pad("", BOX_WIDTH - 2) + " " + rainbowColor(6)(VERTICAL));
99
+ console.log(midLine);
100
+ for (let i = 0; i < steps.length; i++) {
101
+ const color = rainbowColor(i);
102
+ const num = pc.bold(color(`${i + 1}.`));
103
+ const wrapped = wrapText(steps[i], maxStep);
104
+ const firstLine = color(wrapped[0]);
105
+ console.log(rainbowColor(0)(VERTICAL) + " " + pad(`${num} ${firstLine}`, BOX_WIDTH - 3) + " " + rainbowColor(6)(VERTICAL));
106
+ for (let j = 1; j < wrapped.length; j++) {
107
+ console.log(rainbowColor(0)(VERTICAL) + " " + pad(color(wrapped[j]), BOX_WIDTH - 6) + " " + rainbowColor(6)(VERTICAL));
108
+ }
109
+ }
110
+ console.log(rainbowColor(0)(VERTICAL) + " " + pad("", BOX_WIDTH - 2) + " " + rainbowColor(6)(VERTICAL));
111
+ console.log(botLine);
112
+ }
113
+ export function warnBox(lines) {
114
+ const styledTitle = centerText(pc.bold(pc.yellow("WARNING")), BOX_WIDTH - 2);
115
+ const maxContent = BOX_WIDTH - 2;
116
+ console.log("");
117
+ console.log(pc.yellow(hLine(TOP_LEFT, TOP_RIGHT)));
118
+ console.log(pc.yellow(VERTICAL) + " " + styledTitle + " " + pc.yellow(VERTICAL));
119
+ console.log(pc.yellow(hLine(T_LEFT, T_RIGHT)));
120
+ for (const line of lines) {
121
+ for (const wrapped of wrapText(line, maxContent)) {
122
+ console.log(pc.yellow(VERTICAL) + " " + pad(pc.yellow(wrapped), maxContent) + " " + pc.yellow(VERTICAL));
123
+ }
124
+ }
125
+ console.log(pc.yellow(hLine(BOTTOM_LEFT, BOTTOM_RIGHT)));
126
+ console.log("");
127
+ }
128
+ export function footer() {
129
+ console.log(pc.dim(" ✨ Thanks for using ") +
130
+ pc.bold(pc.cyan("create-huenei-template")));
131
+ console.log(pc.dim(" 🚀 Happy coding!\n"));
132
+ }
133
+ export function info(text) {
134
+ console.log(pc.cyan(" ℹ ") + text);
135
+ }
136
+ export function success(text) {
137
+ console.log(pc.green(" ✓ ") + text);
138
+ }
139
+ export function warn(text) {
140
+ console.log(pc.yellow(" ⚠ ") + text);
141
+ }
142
+ export function error(text) {
143
+ console.log(pc.red(" ✗ ") + text);
144
+ }
145
+ export function step(text) {
146
+ console.log(pc.blue(" → ") + pc.dim(text));
147
+ }
148
+ function centerText(text, width) {
149
+ const visible = stripAnsi(text);
150
+ const totalPad = width - visible.length;
151
+ if (totalPad <= 0)
152
+ return text;
153
+ const left = Math.floor(totalPad / 2);
154
+ const right = totalPad - left;
155
+ return " ".repeat(left) + text + " ".repeat(right);
156
+ }
157
+ function wrapText(text, maxWidth) {
158
+ const visible = stripAnsi(text);
159
+ if (visible.length <= maxWidth)
160
+ return [text];
161
+ const lines = [];
162
+ let remaining = text;
163
+ while (stripAnsi(remaining).length > maxWidth) {
164
+ let cutAt = maxWidth;
165
+ const vis = stripAnsi(remaining);
166
+ const spaceIdx = vis.lastIndexOf(" ", cutAt);
167
+ if (spaceIdx > maxWidth * 0.4) {
168
+ cutAt = spaceIdx;
169
+ }
170
+ lines.push(remaining.slice(0, cutAt));
171
+ remaining = remaining.slice(cutAt).trimStart();
172
+ }
173
+ if (remaining)
174
+ lines.push(remaining);
175
+ return lines;
176
+ }
package/dist/index.js CHANGED
@@ -9,10 +9,11 @@ import { ensurePnpm } from "./core/dependency-manager.js";
9
9
  import { resolveTemplatePath } from "./core/template-resolver.js";
10
10
  import { ensureDirectory, copyTemplate, cleanupOnError, copyToExistingDir, mergeSubdirectories, directoryExists, } from "./core/file-operations.js";
11
11
  import { formatError } from "./core/errors.js";
12
+ import { banner, successBox, stepsBox, warnBox, footer, success, warn, step, } from "./core/ui.js";
12
13
  const __filename = fileURLToPath(import.meta.url);
13
14
  const __dirname = path.dirname(__filename);
14
15
  const CURSOR_TEMPLATE_SOURCE = path.resolve(__dirname, "../templates/cursor/.cursor");
15
- const CURSOR_MERGE_SUBDIRS = ["skills", "commands"];
16
+ const CURSOR_MERGE_SUBDIRS = ["skills", "commands", "agents"];
16
17
  function hasCursorFlag() {
17
18
  return process.argv.includes("--cursor");
18
19
  }
@@ -22,64 +23,83 @@ function initializeGit(projectDir) {
22
23
  cwd: projectDir,
23
24
  stdio: "ignore",
24
25
  });
25
- console.log("✓ Git repository initialized");
26
+ success("Git repository initialized");
26
27
  return true;
27
28
  }
28
- catch (error) {
29
- console.log("⚠️ Could not initialize git repository");
29
+ catch {
30
+ warn("Could not initialize git repository");
30
31
  return false;
31
32
  }
32
33
  }
33
34
  function displaySuccessMessage(projectName, pnpmWasJustInstalled) {
34
- console.log("\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
35
- console.log("🎉 Project created successfully!");
36
- console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n");
35
+ successBox("PROJECT CREATED", [
36
+ ` Name: ${projectName}`,
37
+ ` Location: ./${projectName}`,
38
+ ]);
37
39
  if (pnpmWasJustInstalled) {
38
- console.log("⚠️ pnpm was just installed\n");
39
- console.log("Next steps:");
40
- console.log(" 1. Restart your terminal or open a new tab");
41
- console.log(` 2. cd ${projectName}`);
42
- console.log(" 3. pnpm install");
43
- console.log(" 4. pnpm dev");
40
+ warnBox([
41
+ "pnpm was just installed.",
42
+ "Restart your terminal before continuing.",
43
+ ]);
44
+ stepsBox("NEXT STEPS", [
45
+ "Restart your terminal or open a new tab",
46
+ `cd ${projectName}`,
47
+ "pnpm install",
48
+ "pnpm dev",
49
+ ]);
44
50
  }
45
51
  else {
46
- console.log("Next steps:");
47
- console.log(` 1. cd ${projectName}`);
48
- console.log(" 2. pnpm install");
49
- console.log(" 3. pnpm dev");
52
+ stepsBox("NEXT STEPS", [
53
+ `cd ${projectName}`,
54
+ "pnpm install",
55
+ "pnpm dev",
56
+ ]);
50
57
  }
51
- console.log("\n✨ Thanks for using create-huenei-template");
52
- console.log("🚀 Happy coding!\n");
58
+ footer();
53
59
  }
54
60
  function displayCursorSuccessMessage(scope, targetPath) {
55
- console.log("\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
56
- console.log("🎉 Cursor configuration installed!");
57
- console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n");
61
+ const shortPath = targetPath.length > 45
62
+ ? "..." + targetPath.slice(-42)
63
+ : targetPath;
58
64
  if (scope === "project") {
59
- console.log(` Installed in: ${targetPath}`);
60
- console.log(" Content: skills, commands");
65
+ successBox("CURSOR CONFIG INSTALLED", [
66
+ ` Location: ${shortPath}`,
67
+ ` Content: skills, commands, agents`,
68
+ ]);
61
69
  }
62
70
  else {
63
- console.log(` Installed in: ${targetPath}`);
64
- console.log(` Merged: ${CURSOR_MERGE_SUBDIRS.join(", ")}`);
71
+ successBox("CURSOR CONFIG MERGED", [
72
+ ` Location: ${shortPath}`,
73
+ ` Merged: ${CURSOR_MERGE_SUBDIRS.join(", ")}`,
74
+ ]);
65
75
  }
66
- console.log("\n✨ Thanks for using create-huenei-template");
67
- console.log("🚀 Happy coding!\n");
76
+ stepsBox("NEXT STEPS", [
77
+ "Open a new conversation in Cursor",
78
+ "Run /configurar-cursor in Plan mode",
79
+ "Review the plan and execute it",
80
+ "Verify files inside .cursor/ at project root",
81
+ ]);
82
+ footer();
68
83
  }
69
84
  async function handleCursorInstall(scope) {
70
85
  if (scope === "project") {
71
86
  const dest = path.join(process.cwd(), ".cursor");
72
87
  if (await directoryExists(dest)) {
73
- console.log(`\n⚠️ .cursor/ already exists in ${process.cwd()}`);
74
- console.log(" Existing files with the same name will be overwritten.\n");
88
+ const cwd = process.cwd();
89
+ const shortCwd = cwd.length > 40 ? "..." + cwd.slice(-37) : cwd;
90
+ warnBox([
91
+ `.cursor/ already exists in ${shortCwd}`,
92
+ "Existing files with the same name",
93
+ "will be overwritten.",
94
+ ]);
75
95
  }
76
- console.log("\n📦 Installing Cursor configuration...");
96
+ step("Installing Cursor configuration...");
77
97
  await copyToExistingDir(CURSOR_TEMPLATE_SOURCE, dest);
78
98
  displayCursorSuccessMessage("project", dest);
79
99
  }
80
100
  else {
81
101
  const userCursorDir = path.join(os.homedir(), ".cursor");
82
- console.log("\n📦 Merging Cursor configuration...");
102
+ step("Merging Cursor configuration...");
83
103
  await mergeSubdirectories(CURSOR_TEMPLATE_SOURCE, userCursorDir, CURSOR_MERGE_SUBDIRS);
84
104
  displayCursorSuccessMessage("user", userCursorDir);
85
105
  }
@@ -87,6 +107,7 @@ async function handleCursorInstall(scope) {
87
107
  async function main() {
88
108
  let targetDir = "";
89
109
  try {
110
+ banner();
90
111
  if (hasCursorFlag()) {
91
112
  const installScope = await askCursorInstallScope();
92
113
  await handleCursorInstall(installScope);
@@ -107,13 +128,14 @@ async function main() {
107
128
  await ensureDirectory(targetDir);
108
129
  const templatePath = resolveTemplatePath(templateId);
109
130
  await copyTemplate(templatePath, targetDir);
110
- console.log("\n📦 Setting up project...");
131
+ step("Setting up project...");
111
132
  initializeGit(targetDir);
112
133
  displaySuccessMessage(projectName, pnpmWasJustInstalled);
113
134
  }
114
135
  catch (error) {
115
136
  if (error instanceof Error && error.message === "USER_CANCELLED") {
116
- console.log("\n⚠️ Cancelled by user");
137
+ console.log("");
138
+ warn("Cancelled by user");
117
139
  if (targetDir) {
118
140
  await cleanupOnError(targetDir);
119
141
  }
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: cursor-config-auditor
3
+ description: "Cursor configuration quality auditor. Use after generating .cursor/ configuration (rules, skills, agents, hooks, commands) to validate correctness, detect inconsistencies, and verify file integrity. Use proactively at the end of /configurar-cursor before the cleanup phase."
4
+ model: fast
5
+ readonly: true
6
+ ---
7
+
8
+ You are a meticulous configuration auditor specializing in Cursor IDE setup. Your job is to verify the quality and correctness of a generated `.cursor/` configuration. You MUST check every file and report issues with specific evidence.
9
+
10
+ ## Audit checklist
11
+
12
+ ### 1. Rules audit (.cursor/rules/)
13
+
14
+ For each `.mdc` file:
15
+ - [ ] Has valid YAML frontmatter with `description`, and either `globs` or `alwaysApply`
16
+ - [ ] `globs` patterns reference file extensions or paths that actually exist in the project
17
+ - [ ] Content references real files, patterns, or conventions found in the project (not generic boilerplate)
18
+ - [ ] No duplicate rules covering the same concern
19
+ - [ ] Content is under 500 lines per rule
20
+
21
+ ### 2. Skills audit (.cursor/skills/)
22
+
23
+ For each skill directory:
24
+ - [ ] Contains a `SKILL.md` file
25
+ - [ ] Is located in `<project>/.cursor/skills/` (NOT in `~/.cursor/skills/`, `.agents/skills/`, `.claude/skills/`, or any other path)
26
+ - [ ] No orphaned skill directories (directories without SKILL.md)
27
+
28
+ ### 3. Agents audit (.cursor/agents/)
29
+
30
+ For each `.md` file:
31
+ - [ ] Has valid YAML frontmatter with `description`
32
+ - [ ] `description` includes activation triggers ("Use when...", "Use proactively...")
33
+ - [ ] `model` is set appropriately (fast for simple tasks, inherit for complex)
34
+ - [ ] `readonly` is true for agents that only read/analyze
35
+ - [ ] Prompt is concise (under 40 lines of content)
36
+ - [ ] Has a single clear responsibility — no overlap with other agents
37
+ - [ ] References tools and conventions that actually exist in the project
38
+
39
+ ### 4. Hooks audit (.cursor/hooks.json + .cursor/hooks/)
40
+
41
+ - [ ] `hooks.json` is valid JSON with `"version": 1`
42
+ - [ ] Every `command` path in hooks.json points to an existing script in `.cursor/hooks/`
43
+ - [ ] Hook scripts are the right format for the platform (TypeScript recommended for Windows compatibility)
44
+ - [ ] Each hook script reads stdin and writes valid JSON to stdout
45
+ - [ ] Matchers are appropriate for the event type
46
+ - [ ] Timeouts are set for hooks that might be slow
47
+
48
+ ### 5. Commands audit (.cursor/commands/)
49
+
50
+ For each `.md` file:
51
+ - [ ] Has a clear objective statement
52
+ - [ ] References real project paths, conventions, and patterns
53
+ - [ ] Does not duplicate functionality already covered by agents
54
+ - [ ] Steps are concrete and actionable
55
+
56
+ ### 6. Cross-cutting checks
57
+
58
+ - [ ] No files outside `.cursor/` that belong inside it
59
+ - [ ] No contamination folders from `npx skills add` (.agent, .agents, .augment, .claude, .codex, .commandcode, .continue, .crush, .factory, .goose, .junie, .kilocode, .kiro, .kode, .mcpjam, .mux, .neovate, .openhands, .pi, .pochi, .qoder, .qwen, .roo, .trae, .vibe, .windsurf, .zencoder, skills/)
60
+ - [ ] Rules and commands are consistent (commands reference rules that exist)
61
+ - [ ] Agents and skills don't duplicate the same functionality
62
+
63
+ ## Output format
64
+
65
+ Return your audit as a structured report:
66
+
67
+ ```
68
+ ## Audit Report
69
+
70
+ ### Summary
71
+ - Rules: [N] audited — [N] OK, [N] warnings, [N] errors
72
+ - Skills: [N] audited — [N] OK, [N] warnings, [N] errors
73
+ - Agents: [N] audited — [N] OK, [N] warnings, [N] errors
74
+ - Hooks: [configured/not configured] — [N] OK, [N] warnings, [N] errors
75
+ - Commands: [N] audited — [N] OK, [N] warnings, [N] errors
76
+ - Contamination: [CLEAN / N folders detected]
77
+
78
+ ### Errors (must fix)
79
+ 1. [ERROR] [file]: [description of the issue]
80
+ 2. ...
81
+
82
+ ### Warnings (should fix)
83
+ 1. [WARN] [file]: [description of the issue]
84
+ 2. ...
85
+
86
+ ### OK
87
+ 1. [OK] [file]: [brief confirmation]
88
+ 2. ...
89
+
90
+ ### Recommendations
91
+ - [Any suggestions for improvement that don't fit into errors/warnings]
92
+ ```
93
+
94
+ Be strict. If a rule references a file pattern that doesn't exist in the project, that is an ERROR. If an agent description is vague, that is a WARNING. Report everything you find.
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: project-analyzer
3
+ description: "Deep project analysis specialist. Use proactively during /configurar-cursor Phase 1 to analyze the project structure, detect technology stack, architecture patterns, business rules, and existing Cursor configuration. Returns a structured analysis document."
4
+ model: inherit
5
+ readonly: true
6
+ ---
7
+
8
+ You are a senior software architect specializing in codebase analysis. Your job is to perform a deep, evidence-based analysis of the current project and return a structured report. You MUST NOT invent or assume anything — every claim must cite the specific file (and line when possible) where you found the evidence.
9
+
10
+ ## What to analyze
11
+
12
+ ### 1. Project structure
13
+
14
+ - List root files (package.json, pyproject.toml, Cargo.toml, go.mod, pom.xml, build.gradle, Gemfile, composer.json, etc.)
15
+ - Map folder structure up to 5 levels deep
16
+ - Detect monorepo indicators (multiple package.json, workspaces, lerna.json, nx.json, turbo.json, pnpm-workspace.yaml)
17
+ - Find config files: tsconfig.json, .eslintrc*, .prettierrc*, jest.config*, vitest.config*, vite.config*, next.config*, angular.json, etc.
18
+ - Find CI/CD: Dockerfiles, docker-compose*, .github/workflows/*, .gitlab-ci.yml, Jenkinsfile
19
+ - Find auth files: auth.*, passport.*, keycloak.*, jwt.*, guard.*, middleware/auth*
20
+ - Find env files: .env.example, .env.sample, .env.local, .env.*
21
+
22
+ ### 2. Technology stack
23
+
24
+ For EACH detection, record the evidence (file and line):
25
+
26
+ | Dimension | What to look for |
27
+ |-----------|-----------------|
28
+ | Language | Dominant file extensions (.ts, .py, .java, .go, .rs, .rb, .php, .cs, .kt, .swift) |
29
+ | Backend framework | Express, Fastify, NestJS, Django, Flask, FastAPI, Spring Boot, Gin, Actix, Rails, Laravel, ASP.NET |
30
+ | Frontend framework | Next.js, React, Angular, Vue, Svelte, SvelteKit, Nuxt, Remix, Astro, Solid |
31
+ | ORM / DB client | TypeORM, Prisma, Sequelize, Drizzle, SQLAlchemy, Django ORM, Hibernate, GORM, ActiveRecord, Eloquent, Entity Framework |
32
+ | Database | MSSQL, PostgreSQL, MySQL, MongoDB, SQLite, Redis, DynamoDB (from configs, .env.example, docker-compose) |
33
+ | Testing | Jest, Vitest, Mocha, Pytest, JUnit, Go test, RSpec, PHPUnit, xUnit, Playwright, Cypress, Testing Library |
34
+ | Auth | NextAuth, Passport, Keycloak, Auth0, Firebase Auth, JWT, OAuth2, SAML, session-based |
35
+ | CSS / UI | Tailwind, DaisyUI, shadcn/ui, Material UI, Chakra, Bootstrap, Styled Components, CSS Modules, SASS |
36
+ | State management | Redux, Zustand, Jotai, Recoil, MobX, Pinia, Vuex, NgRx, Context API |
37
+ | Bundler | Webpack, Vite, Turbopack, esbuild, Rollup, Parcel, Rspack |
38
+ | CI/CD | GitHub Actions, GitLab CI, Jenkins, Azure DevOps, CircleCI, Bitbucket Pipelines |
39
+ | Containers | Docker, Docker Compose, Kubernetes, Podman |
40
+ | Linter/Formatter | ESLint, Prettier, Black, Ruff, Rubocop, Checkstyle, golangci-lint |
41
+
42
+ ### 3. Architecture
43
+
44
+ - Monolith vs Monorepo vs Microservices
45
+ - Layers: Controllers/Services/Repositories, Handlers/UseCases/Repositories, Routes/Models/Views
46
+ - Patterns: MVC, Clean Architecture, DDD, Hexagonal, CQRS, Event-driven, Serverless
47
+ - Naming conventions: PascalCase, camelCase, snake_case, kebab-case (for files, classes, functions, DB tables)
48
+ - Import patterns: barrel exports, path aliases, relative vs absolute
49
+
50
+ ### 4. Implicit business rules
51
+
52
+ Search for repeated patterns in code that reveal business rules:
53
+
54
+ - Repeated validations (if/throw, guard clauses, validators)
55
+ - Business constants (roles, statuses, limits, percentages)
56
+ - Authorization middleware and what they protect
57
+ - Conditional logic by role or state
58
+ - Transactions and atomic operations
59
+ - Soft deletes vs hard deletes
60
+ - Notification patterns (email, webhooks, events)
61
+ - Cache and invalidation patterns
62
+ - Rate limiting, throttling
63
+ - Entity relationships and cardinality
64
+
65
+ ### 5. Existing Cursor configuration
66
+
67
+ Inventory what already exists:
68
+
69
+ - .cursor/rules/ — list and summarize each rule
70
+ - .cursor/agents/ — list and summarize each agent
71
+ - .cursor/hooks.json — read current config
72
+ - .cursor/hooks/ — list hook scripts
73
+ - .cursor/skills/ — list installed skills
74
+ - .cursor/commands/ — list commands
75
+
76
+ ### 6. Dependencies inventory
77
+
78
+ Read all dependency files and extract the complete list of significant dependencies. In monorepos, read dependencies from EACH app/package.
79
+
80
+ ## Output format
81
+
82
+ Return your analysis as a single structured markdown document with exactly these sections:
83
+
84
+ ```
85
+ ## Stack detectado
86
+ - Lenguaje: [X] (evidencia: [archivo])
87
+ - Framework backend: [X] (evidencia: [archivo])
88
+ - Framework frontend: [X] (evidencia: [archivo])
89
+ - ORM: [X] (evidencia: [archivo])
90
+ - Base de datos: [X] (evidencia: [archivo])
91
+ - Testing: [X] (evidencia: [archivo])
92
+ - Auth: [X] (evidencia: [archivo])
93
+ - CSS/UI: [X] (evidencia: [archivo])
94
+ - Estado: [X] (evidencia: [archivo])
95
+ - Empaquetador: [X] (evidencia: [archivo])
96
+ - CI/CD: [X] (evidencia: [archivo])
97
+ - Contenedores: [X] (evidencia: [archivo])
98
+ - Linter/Formatter: [X] (evidencia: [archivo])
99
+
100
+ ## Arquitectura
101
+ - Tipo: [monorepo/monolito/microservicios]
102
+ - Patrón: [MVC/Clean/DDD/etc.]
103
+ - Capas detectadas: [listar]
104
+ - Convenciones de nombrado: [detallar]
105
+ - Patrón de imports: [detallar]
106
+
107
+ ## Reglas de negocio inferidas
108
+ 1. [Regla] (evidencia: [archivo:línea])
109
+ 2. [Regla] (evidencia: [archivo:línea])
110
+ ...
111
+
112
+ ## Dependencias significativas
113
+ | Dependencia | Categoría | Archivo |
114
+ |---|---|---|
115
+ | [nombre] | [framework/testing/orm/...] | [package.json/requirements.txt/...] |
116
+
117
+ ## Configuración .cursor existente
118
+ - Rules: [N existentes] — [listar nombres]
119
+ - Agents: [N existentes] — [listar nombres]
120
+ - Hooks: [configurados/no configurados] — [detallar]
121
+ - Skills: [N instaladas] — [listar nombres]
122
+ - Commands: [N existentes] — [listar nombres]
123
+
124
+ ## Ambigüedades y preguntas
125
+ - [Listar cualquier inferencia que no sea 100% clara y necesite confirmación del usuario]
126
+ ```
127
+
128
+ Be thorough. If the project has 30 significant dependencies, list all 30. If there are 10 business rules, list all 10. Do NOT truncate or summarize prematurely.