@sebasgc0399/agents-md 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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +203 -0
  3. package/dist/cli.d.ts +6 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +128 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/detect/command-detector.d.ts +6 -0
  8. package/dist/detect/command-detector.d.ts.map +1 -0
  9. package/dist/detect/command-detector.js +62 -0
  10. package/dist/detect/command-detector.js.map +1 -0
  11. package/dist/detect/folder-detector.d.ts +6 -0
  12. package/dist/detect/folder-detector.d.ts.map +1 -0
  13. package/dist/detect/folder-detector.js +69 -0
  14. package/dist/detect/folder-detector.js.map +1 -0
  15. package/dist/detect/framework-detector.d.ts +10 -0
  16. package/dist/detect/framework-detector.d.ts.map +1 -0
  17. package/dist/detect/framework-detector.js +121 -0
  18. package/dist/detect/framework-detector.js.map +1 -0
  19. package/dist/detect/index.d.ts +11 -0
  20. package/dist/detect/index.d.ts.map +1 -0
  21. package/dist/detect/index.js +70 -0
  22. package/dist/detect/index.js.map +1 -0
  23. package/dist/detect/package-detector.d.ts +6 -0
  24. package/dist/detect/package-detector.d.ts.map +1 -0
  25. package/dist/detect/package-detector.js +34 -0
  26. package/dist/detect/package-detector.js.map +1 -0
  27. package/dist/detect/runtime-detector.d.ts +6 -0
  28. package/dist/detect/runtime-detector.d.ts.map +1 -0
  29. package/dist/detect/runtime-detector.js +35 -0
  30. package/dist/detect/runtime-detector.js.map +1 -0
  31. package/dist/index.d.ts +12 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +15 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/render/data-builder.d.ts +9 -0
  36. package/dist/render/data-builder.d.ts.map +1 -0
  37. package/dist/render/data-builder.js +138 -0
  38. package/dist/render/data-builder.js.map +1 -0
  39. package/dist/render/index.d.ts +12 -0
  40. package/dist/render/index.d.ts.map +1 -0
  41. package/dist/render/index.js +29 -0
  42. package/dist/render/index.js.map +1 -0
  43. package/dist/render/mustache-renderer.d.ts +13 -0
  44. package/dist/render/mustache-renderer.d.ts.map +1 -0
  45. package/dist/render/mustache-renderer.js +51 -0
  46. package/dist/render/mustache-renderer.js.map +1 -0
  47. package/dist/render/validators.d.ts +9 -0
  48. package/dist/render/validators.d.ts.map +1 -0
  49. package/dist/render/validators.js +107 -0
  50. package/dist/render/validators.js.map +1 -0
  51. package/dist/templates/base.mustache +296 -0
  52. package/dist/templates/firebase.mustache +236 -0
  53. package/dist/templates/monorepo.mustache +253 -0
  54. package/dist/templates/react.mustache +231 -0
  55. package/dist/types.d.ts +112 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/dist/types.js +5 -0
  58. package/dist/types.js.map +1 -0
  59. package/dist/utils/fs-utils.d.ts +20 -0
  60. package/dist/utils/fs-utils.d.ts.map +1 -0
  61. package/dist/utils/fs-utils.js +121 -0
  62. package/dist/utils/fs-utils.js.map +1 -0
  63. package/dist/utils/logger.d.ts +14 -0
  64. package/dist/utils/logger.d.ts.map +1 -0
  65. package/dist/utils/logger.js +32 -0
  66. package/dist/utils/logger.js.map +1 -0
  67. package/dist/utils/token-counter.d.ts +18 -0
  68. package/dist/utils/token-counter.d.ts.map +1 -0
  69. package/dist/utils/token-counter.js +45 -0
  70. package/dist/utils/token-counter.js.map +1 -0
  71. package/package.json +75 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mustache-renderer.js","sourceRoot":"","sources":["../../src/render/mustache-renderer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAGpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAA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validation
3
+ */
4
+ import { Profile, ValidationResult } from '../types.js';
5
+ /**
6
+ * Validate generated AGENTS.md content
7
+ */
8
+ export declare function validateOutput(content: string, profile?: Profile): ValidationResult;
9
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/render/validators.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA2BxD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,OAAmB,GAC3B,gBAAgB,CAgGlB"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Output validation
3
+ */
4
+ import { estimateTokens } from '../utils/token-counter.js';
5
+ const PROFILE_LIMITS = {
6
+ compact: {
7
+ minLines: 50,
8
+ maxLines: 110,
9
+ minTokens: 0,
10
+ maxTokens: 900,
11
+ },
12
+ standard: {
13
+ minLines: 150,
14
+ maxLines: 230,
15
+ minTokens: 0,
16
+ maxTokens: 1600,
17
+ },
18
+ full: {
19
+ minLines: 220,
20
+ maxLines: 360,
21
+ minTokens: 0,
22
+ maxTokens: 2400,
23
+ },
24
+ };
25
+ /**
26
+ * Validate generated AGENTS.md content
27
+ */
28
+ export function validateOutput(content, profile = 'compact') {
29
+ const normalized = content.replace(/\r\n/g, '\n');
30
+ const normalizedForCount = normalized.replace(/\n+$/g, '');
31
+ const lines = normalizedForCount.length ? normalizedForCount.split('\n') : [''];
32
+ const lineCount = lines.length;
33
+ const estimatedTokens = estimateTokens(normalized);
34
+ const limits = PROFILE_LIMITS[profile];
35
+ const warnings = [];
36
+ const errors = [];
37
+ // Line count validation (profile-specific targets)
38
+ if (lineCount < limits.minLines) {
39
+ warnings.push(`Output is quite short (${lineCount} lines). Target for ${profile}: ` +
40
+ `${limits.minLines}-${limits.maxLines} lines.`);
41
+ }
42
+ else if (lineCount > limits.maxLines) {
43
+ warnings.push(`Output is too long (${lineCount} lines). Target for ${profile}: ` +
44
+ `${limits.minLines}-${limits.maxLines} lines.`);
45
+ }
46
+ // Token count validation (profile-specific targets)
47
+ if (limits.minTokens > 0 && estimatedTokens < limits.minTokens) {
48
+ warnings.push(`Only ${estimatedTokens} tokens (target for ${profile}: ` +
49
+ `${limits.minTokens}-${limits.maxTokens}). Consider adding more details.`);
50
+ }
51
+ else if (estimatedTokens > limits.maxTokens) {
52
+ warnings.push(`${estimatedTokens} tokens exceeds budget for ${profile} (max: ${limits.maxTokens}). ` +
53
+ 'AI agents may not process it efficiently.');
54
+ }
55
+ // Check for placeholder tokens that shouldn't be in output
56
+ const forbiddenPlaceholders = [
57
+ { token: 'undefined', pattern: /\bundefined\b/ },
58
+ { token: 'null', pattern: /\bnull\b/ },
59
+ ];
60
+ for (const { token, pattern } of forbiddenPlaceholders) {
61
+ if (pattern.test(normalized)) {
62
+ errors.push(`Output contains forbidden placeholder string: "${token}"`);
63
+ }
64
+ }
65
+ // Check for N/A commands (should use conditional rendering instead)
66
+ const naCount = (normalized.match(/`N\/A`/g) || []).length;
67
+ if (naCount > 0) {
68
+ warnings.push(`Found ${naCount} N/A placeholder(s). Consider hiding missing commands.`);
69
+ }
70
+ // Check for empty level-2 sections (ignore level-3 headings as boundaries).
71
+ const headingRegex = /^##\s+.+$/gm;
72
+ const headings = Array.from(normalized.matchAll(headingRegex));
73
+ for (let i = 0; i < headings.length; i++) {
74
+ const heading = headings[i];
75
+ const headingIndex = heading.index;
76
+ if (headingIndex === undefined) {
77
+ continue;
78
+ }
79
+ const headingLine = heading[0];
80
+ const start = headingIndex;
81
+ const end = headings[i + 1]?.index ?? normalized.length;
82
+ const sectionBody = normalized.slice(start + headingLine.length, end);
83
+ const hasMeaningfulLine = sectionBody.split('\n').some(line => {
84
+ const trimmed = line.trim();
85
+ if (trimmed === '') {
86
+ return false;
87
+ }
88
+ if (/^<!--.*-->$/.test(trimmed)) {
89
+ return false;
90
+ }
91
+ return true;
92
+ });
93
+ if (!hasMeaningfulLine) {
94
+ warnings.push(`Section "${headingLine.trim()}" appears to be empty`);
95
+ }
96
+ }
97
+ // Warnings are soft limits and should not block generation.
98
+ const valid = errors.length === 0;
99
+ return {
100
+ valid,
101
+ warnings,
102
+ errors,
103
+ lineCount,
104
+ estimatedTokens,
105
+ };
106
+ }
107
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/render/validators.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,cAAc,GAGhB;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,GAAG;KACf;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,GAAG;QACb,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,IAAI;KAChB;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,GAAG;QACb,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,IAAI;KAChB;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,UAAmB,SAAS;IAE5B,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAChF,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;IAC/B,MAAM,eAAe,GAAG,c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CAAC,EAAE;YAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;gBACnB,OAAO,KAAK,CAAC;YACf,CAAC;YACD,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAChC,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACvB,QAAQ,CAAC,IAAI,CAAC,YAAY,WAAW,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED,4DAA4D;IAC5D,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IAElC,OAAO;QACL,KAAK;QACL,QAAQ;QACR,MAAM;QACN,SAAS;QACT,eAAe;KAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,296 @@
1
+ # AGENTS.md
2
+
3
+ ## Propósito del repositorio
4
+ {{project_description}}
5
+
6
+ ## Tech stack
7
+ {{#stacks}}
8
+ - {{.}}
9
+ {{/stacks}}
10
+
11
+ ## Comandos canónicos
12
+ - Instalar dependencias: `{{commands.install}}`
13
+ {{#has_dev}}
14
+ - Ejecutar en local: `{{commands.dev}}`
15
+ {{/has_dev}}
16
+ {{#has_build}}
17
+ - Build: `{{commands.build}}`
18
+ {{/has_build}}
19
+ {{#has_lint}}
20
+ - Lint: `{{commands.lint}}`
21
+ {{/has_lint}}
22
+ {{#has_format}}
23
+ - Format: `{{commands.format}}`
24
+ {{/has_format}}
25
+ {{#has_tests}}
26
+ - Tests: `{{commands.test}}`
27
+ {{/has_tests}}
28
+
29
+ ## Definition of Done
30
+ Antes de considerar una tarea completa:
31
+ {{#has_tests}}
32
+ - [ ] `{{commands.test}}` pasa sin errores
33
+ {{/has_tests}}
34
+ {{#has_lint}}
35
+ - [ ] `{{commands.lint}}` pasa sin errores
36
+ {{/has_lint}}
37
+ - [ ] No añadir dependencias nuevas sin confirmación
38
+ - [ ] Documentar cambios en APIs públicas
39
+
40
+ ## Estilo y convenciones
41
+ {{style_notes}}
42
+
43
+ {{#has_tests}}
44
+ ## Testing guidelines
45
+ {{testing_notes}}
46
+ {{/has_tests}}
47
+
48
+ {{#isStandardOrFull}}
49
+ ## How to work with AI agents
50
+
51
+ ### Task format
52
+ - Start with a clear goal in one sentence.
53
+ - State exact files that can be changed.
54
+ - Include constraints (no new deps, no feature creep, deterministic output).
55
+ - Define explicit acceptance criteria before implementation starts.
56
+
57
+ ### Requesting diffs and verification
58
+ - Ask for a file-by-file change summary with reasons.
59
+ - Request exact commands executed for validation.
60
+ - Ask for test output summary (passed/failed and counts).
61
+ - Require explicit mention of known risks or follow-up tasks.
62
+
63
+ ### Execution protocol
64
+ 1. Inspect relevant files first and summarize findings.
65
+ 2. Propose the smallest safe change.
66
+ 3. Implement incrementally and run tests after each meaningful step.
67
+ 4. Report what changed, what was validated, and what remains.
68
+
69
+ ## Expanded Definition of Done
70
+ - [ ] Scope is fully implemented with no unrelated changes.
71
+ - [ ] Output remains deterministic for same inputs.
72
+ - [ ] No placeholders leak into generated markdown.
73
+ - [ ] Error paths fail with clear messages.
74
+ - [ ] Documentation and tests are updated when behavior changes.
75
+
76
+ ## Debug checklist
77
+ - Reproduce with one deterministic command.
78
+ - Capture expected vs actual behavior.
79
+ - Confirm environment assumptions (Node version, package manager, cwd).
80
+ - Check module resolution and path normalization first.
81
+ - Validate generated content length and formatting.
82
+ - Re-run minimal targeted tests before full suite.
83
+
84
+ ## Testing strategy
85
+ - Prefer fast deterministic tests over broad flaky integration tests.
86
+ - Keep fixtures small and representative.
87
+ - Assert on stable output fragments, not volatile wording.
88
+ {{#has_tests}}
89
+ - Verify canonical test command: `{{commands.test}}`.
90
+ - Add regression tests for every bug fix in rendering or detection.
91
+ {{/has_tests}}
92
+ {{^has_tests}}
93
+ - If no test script exists, document manual verification steps.
94
+ {{/has_tests}}
95
+
96
+ {{#is_unknown_generic}}
97
+ ## Generic project execution playbook
98
+
99
+ ### Scope and boundaries
100
+ - Prefer minimal, reversible changes over broad refactors.
101
+ - Keep runtime and package-manager assumptions explicit.
102
+ - Reuse existing folder conventions before introducing new structure.
103
+ - Document any intentional tradeoff in the final handoff notes.
104
+ - Keep public behavior stable unless the task explicitly requires change.
105
+
106
+ ### Baseline repository map
107
+ - Confirm current source folders (`src`, `lib`, `app`, `scripts`) before editing.
108
+ - Confirm test locations (`tests`, `__tests__`, `spec`) before adding files.
109
+ - Confirm config entrypoints (`tsconfig`, linter, formatter, CI workflow) before updates.
110
+ - Keep generated output deterministic across Windows and Linux runners.
111
+ - Confirm output path and file ownership rules before writing AGENTS.md.
112
+
113
+ ### Change workflow
114
+ 1. Reproduce the issue with one deterministic command.
115
+ 2. Isolate the minimal layer to update (detect, render, validate, or cli).
116
+ 3. Add or update targeted tests before broad regression checks.
117
+ 4. Report changed files, commands run, and residual risks.
118
+
119
+ ### Validation when canonical scripts are missing
120
+ - Run every available canonical command and capture output.
121
+ {{^has_dev}}
122
+ - If no dev script exists, describe the manual startup path in PR notes.
123
+ {{/has_dev}}
124
+ {{^has_build}}
125
+ - If no build script exists, validate TypeScript or bundler config syntax directly.
126
+ {{/has_build}}
127
+ {{^has_tests}}
128
+ - If no test script exists, add manual verification steps with deterministic inputs.
129
+ {{/has_tests}}
130
+ {{^has_lint}}
131
+ - If no lint script exists, document style checks applied during review.
132
+ {{/has_lint}}
133
+ {{^has_format}}
134
+ - If no format script exists, keep formatting changes isolated and minimal.
135
+ {{/has_format}}
136
+
137
+ ### Generic PR checklist
138
+ - [ ] Scope and files changed match the original request.
139
+ - [ ] Validation evidence is attached for each claimed behavior change.
140
+ - [ ] Backward compatibility assumptions are explicit.
141
+ - [ ] Deterministic output is preserved for the same inputs.
142
+ - [ ] Follow-up tasks are listed when work is intentionally deferred.
143
+
144
+ ### Handoff notes to include (generic repos)
145
+ - What changed: list files and why.
146
+ - How to validate: exact commands and expected outputs.
147
+ - Risks: what could break and how to detect it fast.
148
+ - Rollback: safest revert path if needed.
149
+
150
+ ### Updating scripts and docs safely
151
+ - If a `package.json` script changes, update "Comandos canónicos".
152
+ - For build/test/lint edits, include before/after command output.
153
+ - Keep CI changes minimal and cross-platform.
154
+ - Prefer reversible config updates scoped to the task.
155
+
156
+ ### Pre-merge sanity checks
157
+ - Preview headings and checklist readability.
158
+ - Re-run command examples on a clean clone.
159
+ - Confirm profile output stays inside limits.
160
+ - Confirm no placeholder content leaked.
161
+ {{/is_unknown_generic}}
162
+
163
+ ## Do / Don't
164
+ ### Do
165
+ - Do preserve existing behavior unless a change is requested.
166
+ - Do keep commits minimal and reviewable.
167
+ - Do fail fast on invalid user input.
168
+ - Do prefer explicit conditions over hidden heuristics.
169
+
170
+ ### Don't
171
+ - Don't invent commands that do not exist in package scripts.
172
+ - Don't silently ignore validation errors.
173
+ - Don't mix unrelated refactors with feature work.
174
+ - Don't add dependencies unless strictly necessary.
175
+
176
+ ## Agent handoff template
177
+ ### Required fields
178
+ - Goal: one sentence describing expected final state.
179
+ - Scope: exact files or folders that can change.
180
+ - Constraints: what must not change.
181
+ - Validation: commands that prove the change.
182
+ - Risks: known uncertainty or follow-up items.
183
+
184
+ ### Status update format
185
+ - Completed: concrete items done.
186
+ - In progress: current active step.
187
+ - Next: immediate next action.
188
+ - Blockers: missing info or external dependency.
189
+
190
+ ### Review checklist
191
+ - [ ] File-level diff is easy to follow.
192
+ - [ ] Tests cover changed behavior.
193
+ - [ ] Output remains deterministic.
194
+ - [ ] No hidden behavior changes.
195
+ - [ ] Error handling is explicit.
196
+ - [ ] Documentation reflects new behavior.
197
+
198
+ ### Escalation rules
199
+ - Escalate when requirements conflict.
200
+ - Escalate before adding dependencies.
201
+ - Escalate before touching unrelated modules.
202
+ - Escalate on ambiguous security implications.
203
+ {{/isStandardOrFull}}
204
+
205
+ {{#isFull}}
206
+ ## Advanced agent protocol
207
+
208
+ ### Change risk matrix
209
+ - Low risk: copy updates, docs wording, isolated tests.
210
+ - Medium risk: template condition changes, validation thresholds.
211
+ - High risk: command detection logic, filesystem writes, CLI argument parsing.
212
+ - For medium/high risk, require explicit before/after examples.
213
+
214
+ ### PR handoff checklist
215
+ - Include rationale for each changed file.
216
+ - Include verification commands and outcomes.
217
+ - List backward-compatibility guarantees.
218
+ - List residual risks and mitigations.
219
+
220
+ ### Failure triage flow
221
+ 1. Confirm failing command and exact error text.
222
+ 2. Isolate if failure is detection, rendering, or validation.
223
+ 3. Reproduce with fixture before touching production paths.
224
+ 4. Add regression coverage before finalizing fix.
225
+
226
+ ### CI hardening notes
227
+ - Keep path handling platform neutral (`path.join`, no shell assumptions).
228
+ - Keep tests independent from local machine state.
229
+ - Avoid timing-sensitive assertions.
230
+ - Keep generated artifacts reproducible across OSes.
231
+
232
+ ### Verification matrix
233
+ | Layer | Check | Evidence |
234
+ |---|---|---|
235
+ | CLI | Arg parsing | command output |
236
+ | Detection | scripts/framework | fixture result |
237
+ | Rendering | profile sections | markdown preview |
238
+ | Validation | limits/placeholders | unit tests |
239
+ | E2E | dry-run command | test pass |
240
+
241
+ ### Rollback playbook
242
+ 1. Revert profile-specific template blocks first.
243
+ 2. Keep parser support only if backward compatible.
244
+ 3. Re-run compact profile tests and e2e.
245
+ 4. Re-introduce changes in smaller slices.
246
+
247
+ ### Communication protocol
248
+ - Summarize assumptions before coding.
249
+ - Report changed files immediately after edit step.
250
+ - Report executed commands and outcomes.
251
+ - Report unresolved risks before handoff.
252
+
253
+ ### Post-merge audit
254
+ - Verify README examples still run as documented.
255
+ - Verify SPEC and behavior remain aligned.
256
+ - Verify CI pass on at least one Windows runner.
257
+ - Verify default compact output remains unchanged.
258
+ - Verify standard/full remain within configured limits.
259
+
260
+ ### Minimal failure report template
261
+ - Command: exact failing command
262
+ - Expected: what should happen
263
+ - Actual: what happened
264
+ - Suspected layer: detect/render/validate/cli
265
+ - Reproduction fixture: path used
266
+
267
+ ### Final release gate
268
+ - Confirm profile-specific limits pass validator.
269
+ - Confirm placeholder checks remain strict.
270
+ - Confirm default compact output is unchanged.
271
+ - Confirm docs match implemented flags.
272
+ - Confirm test suite is green in CI mode.
273
+ - Confirm no unrelated files changed.
274
+ - Confirm generated markdown still starts with # AGENTS.
275
+ - Confirm profile ordering full > standard > compact.
276
+
277
+ {{#is_unknown_generic}}
278
+ ## Generic full-profile operations guide
279
+
280
+ ### CI and branching policy
281
+ - Require build, lint, and tests (or documented manual checks) before merge.
282
+ - Keep branch names tied to one task or issue identifier.
283
+ - Add rollback notes when behavior or templates change.
284
+
285
+ ### Extra verification for generic repos
286
+ - Verify command paths for npm/yarn/pnpm when scripts are touched.
287
+ - Capture before/after output for affected profile sections.
288
+ - Include one failure-path test for validator or CLI behavior changes.
289
+ {{/is_unknown_generic}}
290
+ {{/isFull}}
291
+
292
+ ## Seguridad
293
+ {{security_notes}}
294
+
295
+ ---
296
+ *Generated by agents-md v0.1.0*
@@ -0,0 +1,236 @@
1
+ # AGENTS.md
2
+
3
+ ## Propósito del repositorio
4
+ {{project_description}}
5
+
6
+ ## Tech stack
7
+ {{#stacks}}
8
+ - {{.}}
9
+ {{/stacks}}
10
+
11
+ ## Comandos canónicos
12
+ - Instalar dependencias: `{{commands.install}}`
13
+ {{#has_dev}}
14
+ - Ejecutar emuladores locales: `{{commands.dev}}`
15
+ {{/has_dev}}
16
+ - Deploy a Firebase: `firebase deploy --only functions`
17
+ {{#has_build}}
18
+ - Build: `{{commands.build}}`
19
+ {{/has_build}}
20
+ {{#has_lint}}
21
+ - Lint: `{{commands.lint}}`
22
+ {{/has_lint}}
23
+ {{#has_tests}}
24
+ - Tests: `{{commands.test}}`
25
+ {{/has_tests}}
26
+
27
+ ## Definition of Done
28
+ Antes de considerar una tarea completa:
29
+ {{#has_tests}}
30
+ - [ ] `{{commands.test}}` pasa sin errores
31
+ {{/has_tests}}
32
+ {{#has_lint}}
33
+ - [ ] `{{commands.lint}}` pasa sin errores
34
+ {{/has_lint}}
35
+ - [ ] Probado localmente con emuladores de Firebase
36
+ - [ ] No añadir dependencias nuevas sin confirmación
37
+ - [ ] Revisar quotas y límites de Firebase
38
+
39
+ ## Estilo y convenciones
40
+ {{style_notes}}
41
+
42
+ ### Funciones Firebase
43
+ - Funciones idempotentes (mismo input = mismo output)
44
+ - Manejar cold starts: minimizar dependencias globales
45
+ - Usar `onCall` para funciones HTTPS callable, `onRequest` para endpoints REST
46
+ - Timeout configurado según caso de uso (default 60s, max 540s)
47
+
48
+ ## Environment variables
49
+ - Variables de configuración en `.env` (local) y Firebase Config (producción)
50
+ - Secrets en Google Secret Manager, accedidos via `functions.config()`
51
+ - NO hardcodear API keys, tokens, o credenciales
52
+
53
+ {{#has_tests}}
54
+ ## Testing guidelines
55
+ {{testing_notes}}
56
+
57
+ ### Estrategia de testing
58
+ - Unit tests para lógica de negocio (sin Firebase)
59
+ - Integration tests con emuladores de Firebase
60
+ - Mocking de Firebase Admin SDK cuando sea necesario
61
+ {{/has_tests}}
62
+
63
+ {{#isStandardOrFull}}
64
+ ## How to work with AI agents
65
+
66
+ ### Task format
67
+ - Define objective, scope, and expected output up front.
68
+ - Include affected Firebase resources (Functions, Firestore, Storage).
69
+ - Keep changes minimal and deterministic.
70
+ - Request explicit validation steps before closing the task.
71
+
72
+ ### Requesting diffs and validation
73
+ - Ask for changed files and reason per file.
74
+ - Ask for command log used for local validation.
75
+ - Ask for test/emulator results with pass/fail summary.
76
+ - Ask for security impact notes when touching auth or data paths.
77
+
78
+ ### Firebase delivery checklist
79
+ - Confirm function triggers are correct and intentional.
80
+ - Confirm retries/idempotency assumptions are explicit.
81
+ - Confirm timeouts and resource usage are reasonable.
82
+ - Confirm no secrets are embedded in source code.
83
+
84
+ ## Expanded Definition of Done
85
+ - [ ] Scope complete with no unrelated refactors.
86
+ - [ ] Emulator checks or equivalent local validation completed.
87
+ - [ ] No placeholder values in generated markdown.
88
+ - [ ] Docs and runbooks updated for behavior changes.
89
+ - [ ] Backward compatibility confirmed for existing callers.
90
+
91
+ ## Debug checklist
92
+ - Reproduce with emulator or deterministic fixture.
93
+ - Verify environment variables and Firebase config source.
94
+ - Check command detection and generated command section.
95
+ - Validate output size and required sections by profile.
96
+ - Re-run focused tests before full suite.
97
+
98
+ ## Testing strategy
99
+ - Unit test pure business logic outside Firebase SDK wrappers.
100
+ - Use emulator-backed integration tests for boundary behavior.
101
+ - Keep assertions stable and deterministic.
102
+ {{#has_tests}}
103
+ - Keep command references aligned with `{{commands.test}}`.
104
+ {{/has_tests}}
105
+
106
+ ## Do / Don't
107
+ ### Do
108
+ - Do validate input and auth context on every entry point.
109
+ - Do keep function side effects explicit.
110
+ - Do document deploy and rollback expectations.
111
+ - Do preserve default compact behavior.
112
+
113
+ ### Don't
114
+ - Don't hardcode project ids, keys, or secrets.
115
+ - Don't rely on implicit global state across invocations.
116
+ - Don't skip validation on background triggers.
117
+ - Don't bundle unrelated changes in one patch.
118
+
119
+ ## Agent handoff template
120
+ ### Required fields
121
+ - Goal: one sentence describing expected final state.
122
+ - Scope: exact files or folders that can change.
123
+ - Constraints: what must not change.
124
+ - Validation: commands that prove the change.
125
+ - Risks: known uncertainty or follow-up items.
126
+
127
+ ### Status update format
128
+ - Completed: concrete items done.
129
+ - In progress: current active step.
130
+ - Next: immediate next action.
131
+ - Blockers: missing info or external dependency.
132
+
133
+ ### Review checklist
134
+ - [ ] File-level diff is easy to follow.
135
+ - [ ] Tests cover changed behavior.
136
+ - [ ] Output remains deterministic.
137
+ - [ ] No hidden behavior changes.
138
+ - [ ] Error handling is explicit.
139
+ - [ ] Documentation reflects new behavior.
140
+
141
+ ### Escalation rules
142
+ - Escalate when requirements conflict.
143
+ - Escalate before adding dependencies.
144
+ - Escalate before touching unrelated modules.
145
+ - Escalate on ambiguous security implications.
146
+ {{/isStandardOrFull}}
147
+
148
+ {{#isFull}}
149
+ ## Advanced agent protocol
150
+
151
+ ### Risk classification
152
+ - Low: docs/template copy adjustments.
153
+ - Medium: profile-dependent rendering and validation limits.
154
+ - High: CLI parsing, deploy commands, and filesystem writes.
155
+ - Medium/high changes require targeted regression tests.
156
+
157
+ ### PR handoff checklist
158
+ - Provide before/after output for each affected profile.
159
+ - Provide exact verification commands and outcomes.
160
+ - Provide compatibility notes for existing workflows.
161
+ - Provide residual risk and rollback guidance.
162
+
163
+ ### Failure triage flow
164
+ 1. Reproduce with fixture and explicit `--profile` flag.
165
+ 2. Isolate whether failure is detect/render/validate.
166
+ 3. Verify generated markdown includes required command set.
167
+ 4. Patch minimally and add regression coverage.
168
+
169
+ ### CI hardening notes
170
+ - Keep tests OS-neutral for paths and execution.
171
+ - Use non-shell process invocation in e2e tests.
172
+ - Avoid timing-dependent assertions.
173
+ - Keep fixtures small and deterministic.
174
+
175
+ ### Verification matrix
176
+ | Layer | Check | Evidence |
177
+ |---|---|---|
178
+ | CLI | Arg parsing | command output |
179
+ | Detection | scripts/framework | fixture result |
180
+ | Rendering | profile sections | markdown preview |
181
+ | Validation | limits/placeholders | unit tests |
182
+ | E2E | dry-run command | test pass |
183
+
184
+ ### Rollback playbook
185
+ 1. Revert profile-specific template blocks first.
186
+ 2. Keep parser support only if backward compatible.
187
+ 3. Re-run compact profile tests and e2e.
188
+ 4. Re-introduce changes in smaller slices.
189
+
190
+ ### Communication protocol
191
+ - Summarize assumptions before coding.
192
+ - Report changed files immediately after edit step.
193
+ - Report executed commands and outcomes.
194
+ - Report unresolved risks before handoff.
195
+
196
+ ### Post-merge audit
197
+ - Verify README examples still run as documented.
198
+ - Verify SPEC and behavior remain aligned.
199
+ - Verify CI pass on at least one Windows runner.
200
+ - Verify default compact output remains unchanged.
201
+ - Verify standard/full remain within configured limits.
202
+
203
+ ### Minimal failure report template
204
+ - Command: exact failing command
205
+ - Expected: what should happen
206
+ - Actual: what happened
207
+ - Suspected layer: detect/render/validate/cli
208
+ - Reproduction fixture: path used
209
+
210
+ ### Final release gate
211
+ - Confirm profile-specific limits pass validator.
212
+ - Confirm placeholder checks remain strict.
213
+ - Confirm default compact output is unchanged.
214
+ - Confirm docs match implemented flags.
215
+ - Confirm test suite is green in CI mode.
216
+ - Confirm no unrelated files changed.
217
+ - Confirm generated markdown still starts with # AGENTS.
218
+ - Confirm profile ordering full > standard > compact.
219
+ {{/isFull}}
220
+
221
+ ## Seguridad
222
+ {{security_notes}}
223
+
224
+ ### Firebase-specific
225
+ - Validar todos los inputs en funciones callable
226
+ - Usar Firebase Auth para autenticación
227
+ - Implementar Security Rules en Firestore/Storage
228
+ - Nunca exponer Service Account keys en código
229
+
230
+ ## Deployment
231
+ - Deploy staging: `firebase deploy --only functions --project staging`
232
+ - Deploy producción: `firebase deploy --only functions --project production`
233
+ - Rollback: `firebase functions:delete FUNCTION_NAME` + redeploy versión anterior
234
+
235
+ ---
236
+ *Generated by agents-md v0.1.0*