sdg-agents 1.0.5

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 (130) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +161 -0
  3. package/package.json +88 -0
  4. package/src/assets/dev-guides/agent-deep-flow.md +139 -0
  5. package/src/assets/dev-guides/prompt-tracks/00-lite-mode/01-project-scope-and-mvp.md +45 -0
  6. package/src/assets/dev-guides/prompt-tracks/00-lite-mode/02-stack-and-data-model.md +56 -0
  7. package/src/assets/dev-guides/prompt-tracks/00-lite-mode/03-external-integrations.md +44 -0
  8. package/src/assets/dev-guides/prompt-tracks/00-lite-mode/04-launch-checklist.md +26 -0
  9. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/00-foundation/01-project-vision.md +77 -0
  10. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/00-foundation/02-problem-definition.md +63 -0
  11. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/00-foundation/03-success-metrics.md +48 -0
  12. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/00-foundation/05-engineering-culture-and-silos.md +41 -0
  13. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/00-foundation/06-foundation-approval.md +57 -0
  14. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/01-setup/01-tech-stack.md +62 -0
  15. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/01-setup/02-local-environment.md +50 -0
  16. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/01-setup/03-version-control-and-tracking.md +65 -0
  17. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/01-setup/04-hello-world-validation.md +37 -0
  18. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/01-setup/05-setup-approval.md +61 -0
  19. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/01-folder-structure.md +49 -0
  20. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/02-design-patterns.md +59 -0
  21. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/03-apis-and-communication.md +55 -0
  22. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/04-security-and-access.md +63 -0
  23. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/05-security-audit.md +64 -0
  24. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/06-design-system-ux.md +72 -0
  25. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/07-ai-strategy.md +72 -0
  26. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/08-observability.md +65 -0
  27. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/09-technical-documentation.md +64 -0
  28. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/10-infrastructure-and-costs.md +40 -0
  29. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/11-data-privacy-compliance.md +41 -0
  30. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/12-performance-and-scale.md +46 -0
  31. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/13-disaster-recovery.md +39 -0
  32. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/02-architecture/14-architecture-approval.md +81 -0
  33. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/03-delivery/01-ci-cd-pipeline.md +49 -0
  34. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/03-delivery/02-quality-standards.md +46 -0
  35. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/03-delivery/03-delivery-approval.md +58 -0
  36. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/00-feature-template.md +30 -0
  37. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/01-context-and-scope.md +46 -0
  38. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/02-business-rules.md +39 -0
  39. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/03-architecture-and-design.md +50 -0
  40. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/04-testing-strategy.md +48 -0
  41. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/05-implementation-plan.md +45 -0
  42. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/04-features/06-feature-approval.md +46 -0
  43. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/05-evolution/01-rfcs-and-changes.md +63 -0
  44. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/05-evolution/02-incident-postmortems.md +64 -0
  45. package/src/assets/dev-guides/prompt-tracks/01-new-evolution/05-evolution/03-adr-template.md +66 -0
  46. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/00-foundation/01-legacy-vision.md +73 -0
  47. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/00-foundation/02-foundation-approval.md +53 -0
  48. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/01-analysis/01-tech-debt-inventory.md +55 -0
  49. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/01-analysis/02-security-audit.md +63 -0
  50. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/01-analysis/03-regression-baseline.md +49 -0
  51. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/01-analysis/04-analysis-approval.md +65 -0
  52. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/02-strategy/01-modernization-approach.md +60 -0
  53. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/02-strategy/02-versioning-and-coexistence.md +57 -0
  54. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/02-strategy/03-new-demands-triage.md +41 -0
  55. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/02-strategy/04-strategy-approval.md +56 -0
  56. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/03-refactor/01-cleanup-backlog.md +45 -0
  57. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/03-refactor/02-refactor-approval.md +53 -0
  58. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/04-migration/01-migration-roadmap.md +47 -0
  59. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/04-migration/02-data-sync-strategy.md +56 -0
  60. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/04-migration/03-migration-approval.md +55 -0
  61. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/05-sunset/01-decommission-plan.md +47 -0
  62. package/src/assets/dev-guides/prompt-tracks/02-legacy-modernization/05-sunset/02-sunset-approval.md +60 -0
  63. package/src/assets/dev-guides/prompt-tracks/README.md +144 -0
  64. package/src/assets/dev-guides/software-development-lifecycle-sdlc.md +147 -0
  65. package/src/assets/dev-guides/spec-driven-dev-guide.md +81 -0
  66. package/src/assets/dev-guides/ui-prompt-guide.md +181 -0
  67. package/src/assets/img/sdg-agents-icon-dark.svg +55 -0
  68. package/src/assets/img/sdg-agents-icon-light.svg +55 -0
  69. package/src/assets/img/sdg-agents-menu-v1.png +0 -0
  70. package/src/assets/img/sdg-icon.svg +110 -0
  71. package/src/assets/instructions/commands/sdg-docs.md +69 -0
  72. package/src/assets/instructions/commands/sdg-feat.md +45 -0
  73. package/src/assets/instructions/commands/sdg-fix.md +41 -0
  74. package/src/assets/instructions/commands/sdg-land.md +128 -0
  75. package/src/assets/instructions/competencies/backend.md +353 -0
  76. package/src/assets/instructions/competencies/frontend.md +439 -0
  77. package/src/assets/instructions/core/agent-roles.md +104 -0
  78. package/src/assets/instructions/core/api-design.md +65 -0
  79. package/src/assets/instructions/core/ci-cd.md +144 -0
  80. package/src/assets/instructions/core/cloud.md +63 -0
  81. package/src/assets/instructions/core/code-style.md +144 -0
  82. package/src/assets/instructions/core/containers.md +115 -0
  83. package/src/assets/instructions/core/data-access.md +119 -0
  84. package/src/assets/instructions/core/engineering-standards.md +502 -0
  85. package/src/assets/instructions/core/naming.md +136 -0
  86. package/src/assets/instructions/core/observability.md +73 -0
  87. package/src/assets/instructions/core/security-pipeline.md +209 -0
  88. package/src/assets/instructions/core/security.md +45 -0
  89. package/src/assets/instructions/core/sql-style.md +138 -0
  90. package/src/assets/instructions/core/staff-dna.md +72 -0
  91. package/src/assets/instructions/core/testing-principles.md +212 -0
  92. package/src/assets/instructions/core/ui/architecture.md +171 -0
  93. package/src/assets/instructions/core/ui/design-thinking.md +319 -0
  94. package/src/assets/instructions/core/ui/presets.md +200 -0
  95. package/src/assets/instructions/core/ui/standards.md +144 -0
  96. package/src/assets/instructions/core/writing-soul.md +82 -0
  97. package/src/assets/instructions/flavors/legacy/principles.md +64 -0
  98. package/src/assets/instructions/flavors/lite/principles.md +39 -0
  99. package/src/assets/instructions/flavors/mvc/principles.md +124 -0
  100. package/src/assets/instructions/flavors/vertical-slice/principles.md +178 -0
  101. package/src/assets/instructions/idioms/csharp/patterns.md +367 -0
  102. package/src/assets/instructions/idioms/flutter/patterns.md +97 -0
  103. package/src/assets/instructions/idioms/go/patterns.md +193 -0
  104. package/src/assets/instructions/idioms/java/patterns.md +233 -0
  105. package/src/assets/instructions/idioms/javascript/patterns.md +223 -0
  106. package/src/assets/instructions/idioms/kotlin/patterns.md +94 -0
  107. package/src/assets/instructions/idioms/python/patterns.md +185 -0
  108. package/src/assets/instructions/idioms/rust/patterns.md +189 -0
  109. package/src/assets/instructions/idioms/scripts/patterns.md +81 -0
  110. package/src/assets/instructions/idioms/sql/patterns.md +109 -0
  111. package/src/assets/instructions/idioms/swift/patterns.md +97 -0
  112. package/src/assets/instructions/idioms/typescript/patterns.md +304 -0
  113. package/src/assets/instructions/idioms/vbnet/patterns.md +96 -0
  114. package/src/assets/instructions/idioms/vbnet-legacy/patterns.md +104 -0
  115. package/src/assets/instructions/templates/workflow.md +244 -0
  116. package/src/assets/instructions/workflows/governance.md +162 -0
  117. package/src/engine/bin/add-idiom.mjs +186 -0
  118. package/src/engine/bin/index.mjs +226 -0
  119. package/src/engine/config/stack-display.mjs +75 -0
  120. package/src/engine/config/stack-versions.mjs +76 -0
  121. package/src/engine/lib/cli-parser.mjs +80 -0
  122. package/src/engine/lib/display-utils.mjs +20 -0
  123. package/src/engine/lib/fs-utils.mjs +99 -0
  124. package/src/engine/lib/instruction-assembler.mjs +487 -0
  125. package/src/engine/lib/manifest-utils.mjs +128 -0
  126. package/src/engine/lib/prompt-utils.mjs +137 -0
  127. package/src/engine/lib/result-utils.mjs +14 -0
  128. package/src/engine/lib/ruleset-injector.mjs +183 -0
  129. package/src/engine/lib/ui-utils.mjs +216 -0
  130. package/src/engine/lib/wizard.mjs +472 -0
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026 thiagocajadev
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,161 @@
1
+ <div align="center">
2
+ <img src="https://raw.githubusercontent.com/thiagocajadev/sgd-agents-cli/main/src/assets/img/sdg-agents-icon-light.svg" alt="SDG Agents" width="480" height="480" style="border-radius: 1rem;">
3
+ <h1 align="center">Spec-Driven Guide — Agents</h1>
4
+ <p align="center">
5
+ A CLI that installs a structured instruction set for AI agents into your project.<br>
6
+ <a href="docs/README.pt-BR.md">Versão em Português (Brasil)</a>
7
+ </p>
8
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D22-brightgreen?style=flat-square&logo=nodedotjs" alt="Node" /></a>
9
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-ISC-blue?style=flat-square" alt="License: ISC" /></a>
10
+ </div>
11
+
12
+ <br>
13
+
14
+ <p align="center">
15
+ <kbd><img src="https://raw.githubusercontent.com/thiagocajadev/sgd-agents-cli/main/src/assets/img/sdg-agents-menu-v1.png" alt="Spec Driven Guide CLI in action" /></kbd>
16
+ </p>
17
+
18
+ `sdg-agents` installs a set of markdown instruction files into your project. AI agents (Claude Code, Cursor, Windsurf, Copilot, Codex, and others) read these files and follow the defined protocol for every task.
19
+
20
+ > **Note:** If your agent does not pick up the rules automatically, reference `.ai/skill/AGENTS.md` at the start of the session.
21
+
22
+ The instruction set covers:
23
+
24
+ - **Working protocol**: a 5-phase cycle (SPEC → PLAN → CODE → TEST → END) that structures how the agent handles any task
25
+ - **Engineering rules**: naming, code style, clean code standards, security boundaries
26
+ - **Language patterns**: idiomatic conventions for your specific stack
27
+ - **Architectural guidance**: rules for your project's structural pattern (vertical slice, MVC, etc.)
28
+ - **Session memory**: a `.ai-backlog/` folder that persists context and task state across sessions
29
+
30
+ ---
31
+
32
+ ## Quick Start
33
+
34
+ ```bash
35
+ npx sdg-agents
36
+ ```
37
+
38
+ The interactive wizard guides you through selecting an architectural flavor and one or more language idioms. For non-interactive use:
39
+
40
+ ```bash
41
+ # TypeScript + Vertical Slice
42
+ npx sdg-agents init --flavor vertical-slice --idiom typescript
43
+
44
+ # Multiple idioms
45
+ npx sdg-agents init --flavor mvc --idiom typescript,python
46
+
47
+ # Preview without writing files
48
+ npx sdg-agents init --flavor mvc --idiom python --dry-run
49
+ ```
50
+
51
+ ---
52
+
53
+ ## What Gets Installed
54
+
55
+ After running `init`, your project receives:
56
+
57
+ ```
58
+ your-project/
59
+ ├── .ai/ ← Instruction set (committed)
60
+ │ ├── skill/
61
+ │ │ └── AGENTS.md ← Main entry point — auto-loaded by agents
62
+ │ ├── instructions/
63
+ │ │ ├── core/ ← Engineering rules (style, naming, security, testing)
64
+ │ │ ├── flavors/ ← Architectural patterns (vertical-slice, mvc, etc.)
65
+ │ │ ├── idioms/ ← Language-specific conventions (TS, Python, Go, etc.)
66
+ │ │ └── competencies/ ← Layer-specific rules (frontend, backend)
67
+ │ ├── commands/ ← Context files for feat/fix/docs cycles
68
+ │ └── dev-guides/ ← Reference files, spec templates, and guides
69
+ └── .ai-backlog/ ← Session memory (gitignored)
70
+ ├── context.md ← Project brief, decisions, current state
71
+ └── tasks.md ← Task list (TODO / IN_PROGRESS / DONE)
72
+ ```
73
+
74
+ `dev-guides/` is always included. It contains the 5-phase cycle guide, the internal decision-gate flow, SDLC reference, UI prompt guide, and spec templates (`prompt-tracks/`) for authoring the SPEC phase of any task.
75
+
76
+ Agent-specific entry files (`CLAUDE.md`, `.cursorrules`, `.windsurfrules`, etc.) are also written to the project root.
77
+
78
+ > For a detailed breakdown of each file's role, see [Project Structure](docs/PROJECT-STRUCTURE.md).
79
+
80
+ ---
81
+
82
+ ## How the Protocol Works
83
+
84
+ When you prefix a message to the agent, it enters the corresponding cycle:
85
+
86
+ | Trigger | Cycle | What happens |
87
+ | :-------------------- | :------ | :------------------------------------------------------------------------------------------------------------ |
88
+ | `land: <description>` | Land | Agent turns a raw vision into a grounded backlog of sequenced `feat:` tasks — runs before any code is written |
89
+ | `feat: <description>` | Feature | Agent runs SPEC → PLAN → CODE → TEST → END |
90
+ | `fix: <description>` | Fix | Agent runs SPEC → PLAN → CODE → TEST → END with RCA focus |
91
+ | `docs: <description>` | Docs | Agent updates changelogs, ADRs, or specs |
92
+ | No prefix | — | Agent asks: "land, feat, fix, or docs?" — then proceeds |
93
+
94
+ The agent **stops and waits for your approval** at SPEC and PLAN before writing any code.
95
+
96
+ ```
97
+ SPEC → PLAN → CODE → TEST → END
98
+ ↑ ↑
99
+ Wait Wait (approval required)
100
+ ```
101
+
102
+ For a detailed walkthrough of each phase and its rules, see [Spec-Driven Development Guide](src/assets/dev-guides/spec-driven-dev-guide.md).
103
+ For a visual breakdown of the internal decision gates and loops, see [Agent Deep-Flow](src/assets/dev-guides/agent-deep-flow.md).
104
+
105
+ ---
106
+
107
+ ## Architectural Flavors
108
+
109
+ Select the flavor that matches your project's structure:
110
+
111
+ | Flavor | Pattern | Use when |
112
+ | :--------------- | :-------------------------------------- | :--------------------------- |
113
+ | `vertical-slice` | Feature-driven vertical cuts | Monorepo or domain-heavy API |
114
+ | `mvc` | Classic layered (Model-View-Controller) | Standard REST service |
115
+ | `lite` | Minimal scaffold | Scripts, CLIs, utilities |
116
+ | `legacy` | Refactor-safe bridge patterns | Migrating existing codebases |
117
+
118
+ For the data flow diagram of each flavor, see [Architectural Pipelines](docs/PIPELINES.md).
119
+
120
+ ---
121
+
122
+ ## Language Idioms
123
+
124
+ Install language-specific patterns alongside the protocol:
125
+
126
+ `typescript` · `javascript` · `python` · `csharp` · `java` · `kotlin` · `go` · `rust` · `swift` · `flutter` · `sql` · `vbnet`
127
+
128
+ ```bash
129
+ # Add an idiom to an existing project
130
+ npx sdg-agents add
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Maintenance
136
+
137
+ ```bash
138
+ npx sdg-agents review # Detect drift between local rules and source
139
+ npx sdg-agents sync # Update rulesets from source
140
+ npx sdg-agents update # Refresh the LTS version registry
141
+ npx sdg-agents clear # Remove the .ai/ folder
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Reference
147
+
148
+ - [Quick Reference (CHEATSHEET)](docs/CHEATSHEET.md) — all CLI flags and agent triggers
149
+ - [Project Structure](docs/PROJECT-STRUCTURE.md) — detailed breakdown of every generated file
150
+ - [Architectural Pipelines](docs/PIPELINES.md) — data flow diagrams for each flavor
151
+ - [Engineering Laws (CONSTITUTION)](docs/CONSTITUTION.md) — the principles behind the rules
152
+ - [Roadmap](docs/ROADMAP.md) — planned work
153
+ - [Changelog](CHANGELOG.md) — release history
154
+
155
+ ---
156
+
157
+ > **Warning:** This project is in early development. Review and adjust the installed rules to fit your team's standards before relying on them.
158
+
159
+ _Balance is the key._
160
+
161
+ SDG is in constant evolution. There is no perfect solution, only continuous improvement. Feel free to contribute, fork, and share.
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "sdg-agents",
3
+ "version": "1.0.5",
4
+ "description": "Agnostic Markdown specs for AI development. Transform your repository into a highly-disciplined environment for AI Agents.",
5
+ "type": "module",
6
+ "main": "./src/engine/bin/index.mjs",
7
+ "bin": {
8
+ "sdg-agents": "./src/engine/bin/index.mjs"
9
+ },
10
+ "engines": {
11
+ "node": ">=22.0.0"
12
+ },
13
+ "scripts": {
14
+ "dev": "node src/engine/bin/index.mjs",
15
+ "build": "node src/engine/bin/build-bundle.mjs",
16
+ "review": "node src/engine/bin/review-bundle.mjs",
17
+ "bump": "node src/engine/bin/auto-bump.mjs",
18
+ "add-idiom": "node src/engine/bin/add-idiom.mjs",
19
+ "clear": "node src/engine/bin/clear-bundle.mjs",
20
+ "test": "node --test src/engine/lib/*.test.mjs",
21
+ "test:watch": "node --test --watch src/engine/lib/*.test.mjs",
22
+ "lint": "eslint .",
23
+ "lint:fix": "eslint . --fix",
24
+ "format": "prettier --write .",
25
+ "prepare": "husky"
26
+ },
27
+ "keywords": [
28
+ "ai",
29
+ "agents",
30
+ "specs",
31
+ "markdown",
32
+ "claude",
33
+ "cursor",
34
+ "windsurf",
35
+ "copilot",
36
+ "codex",
37
+ "gemini",
38
+ "rules",
39
+ "architecture",
40
+ "cli",
41
+ "developer-tools"
42
+ ],
43
+ "author": "thiagocajadev",
44
+ "license": "ISC",
45
+ "files": [
46
+ "src/engine/bin/index.mjs",
47
+ "src/engine/bin/add-idiom.mjs",
48
+ "src/engine/config/",
49
+ "src/engine/lib/cli-parser.mjs",
50
+ "src/engine/lib/display-utils.mjs",
51
+ "src/engine/lib/fs-utils.mjs",
52
+ "src/engine/lib/instruction-assembler.mjs",
53
+ "src/engine/lib/manifest-utils.mjs",
54
+ "src/engine/lib/prompt-utils.mjs",
55
+ "src/engine/lib/result-utils.mjs",
56
+ "src/engine/lib/ruleset-injector.mjs",
57
+ "src/engine/lib/ui-utils.mjs",
58
+ "src/engine/lib/wizard.mjs",
59
+ "src/assets/"
60
+ ],
61
+ "repository": {
62
+ "type": "git",
63
+ "url": "git+https://github.com/thiagocajadev/sgd-agents-cli.git"
64
+ },
65
+ "bugs": {
66
+ "url": "https://github.com/thiagocajadev/sgd-agents-cli/issues"
67
+ },
68
+ "homepage": "https://github.com/thiagocajadev/sgd-agents-cli#readme",
69
+ "dependencies": {
70
+ "@inquirer/prompts": "^8.3.2",
71
+ "dedent": "^1.7.2"
72
+ },
73
+ "devDependencies": {
74
+ "@eslint/js": "^9.21.0",
75
+ "eslint": "^9.21.0",
76
+ "eslint-config-prettier": "^10.1.8",
77
+ "eslint-plugin-import": "^2.32.0",
78
+ "eslint-plugin-prettier": "^5.5.5",
79
+ "globals": "^17.4.0",
80
+ "husky": "^9.1.7",
81
+ "lint-staged": "^16.4.0",
82
+ "prettier": "^3.8.1"
83
+ },
84
+ "lint-staged": {
85
+ "**/*.mjs": "eslint --fix",
86
+ "**/*.{json,md}": "prettier --write"
87
+ }
88
+ }
@@ -0,0 +1,139 @@
1
+ # Agent Deep-Flow: Under the Hood
2
+
3
+ This guide provides a detailed visual and technical breakdown of the internal sub-steps that an **SDG-compliant AI Agent** executes during each phase of the task cycle.
4
+
5
+ ## Visualizing the Deep Flow
6
+
7
+ The following diagram illustrates the transitions, decision gates, and loops that ensure architectural integrity.
8
+
9
+ <details>
10
+ <summary>Click to visualise the Internal Deep-Flow</summary>
11
+
12
+ ```mermaid
13
+ graph TD
14
+ Trigger((Request)) --> SPEC
15
+
16
+ subgraph SPEC [1. SPEC: The Contract]
17
+ S1[Intent Classification] --> S2[Goal Definition]
18
+ S2 --> S3[Domain & Contracts]
19
+ S3 --> S4[Verification Checklist]
20
+ S4 --> S5{Approval Gate}
21
+ end
22
+
23
+ S5 -- Approved --> PLAN
24
+ S5 -- Denied --> SPEC
25
+
26
+ subgraph PLAN [2. PLAN: The Strategy]
27
+ P1[Task Decomposition] --> P2[Logical Sequencing]
28
+ P2 --> P3[Effort Tagging]
29
+ P3 --> P4[Sub-task Split]
30
+ P4 --> P5[Backlog Sync]
31
+ P5 --> P6{Approval Gate}
32
+ end
33
+
34
+ P6 -- Approved --> CODE
35
+ P6 -- Denied --> PLAN
36
+
37
+ subgraph CODE [3. CODE: The Execution]
38
+ C1[Context Load] --> C2[Narrative Gate]
39
+ C2 --> C3[Plan Adherence]
40
+ C3 --> C4[Blocker Surface]
41
+ end
42
+
43
+ C4 -- Loop / No Progress 3x --> Stop
44
+ C4 --> TEST
45
+
46
+ subgraph TEST [4. TEST: The Verification]
47
+ T1[Checklist Verification] --> T2[Regression Proof]
48
+ T2 --> T3{Fix Loop}
49
+ T3 -- Success --> T4[Lint Fix]
50
+ T4 --> T5[Report Status]
51
+ end
52
+
53
+ T3 -- Failure (Max 3x) --> CODE
54
+ T3 -- Blocked --> Stop((STOP & Report))
55
+
56
+ T5 --> END
57
+
58
+ subgraph END [5. END: The Delivery]
59
+ E1[Task Summary] --> E2[CHANGELOG]
60
+ E2 --> E3[Backlog Sync]
61
+ E3 --> E4[Context & Insights]
62
+ E4 --> E5[Final Lint]
63
+ E5 --> E6[Commit Suggestion]
64
+ E6 --> E7[Next Steps]
65
+ end
66
+
67
+ E7 --> Done((Done))
68
+
69
+ style S5 fill:#f96,stroke:#333
70
+ style P6 fill:#f96,stroke:#333
71
+ style T3 fill:#f96,stroke:#333
72
+ style C4 fill:#ffa,stroke:#333
73
+ style Stop fill:#f66,stroke:#333
74
+ ```
75
+
76
+ </details>
77
+
78
+ ---
79
+
80
+ ## Detailed Phase Breakdown
81
+
82
+ ### 1. Phase: SPEC
83
+
84
+ > **Role: Planning** _(Claude Code — multi-agent mode)_
85
+
86
+ The agent defines **what** to build before thinking about **how**.
87
+
88
+ - **Intent Identification**: Classification as `feat:`, `fix:`, or `docs:`.
89
+ - **Goal**: A one-sentence technical "North Star".
90
+ - **Verification Checklist**: Up to 5 binary criteria used to validate the final delivery.
91
+ - **Approval Gate**: Execution **must stop** here for **Developer verification**.
92
+
93
+ ### 2. Phase: PLAN
94
+
95
+ > **Role: Planning** _(Claude Code — multi-agent mode)_
96
+
97
+ The agent sequences the spec into atomic, estimable tasks.
98
+
99
+ - **Atomic Tasks**: Pattern: `Action Verb + Object`.
100
+ - **Effort Tagging**: Tasks are tagged by size — `[S]` (isolated), `[M]` (cross-layer), `[L]` (complex).
101
+ - **Sub-task Split**: Any `[L]` task is decomposed into smaller steps (`1.1`, `1.2`).
102
+ - **Approval Gate**: Execution **must stop** here to ensure the strategy is sound.
103
+
104
+ ### 3. Phase: CODE
105
+
106
+ > **Role: Fast** _(Claude Code — multi-agent mode)_
107
+
108
+ High-density execution following strict architectural standards.
109
+
110
+ - **Narrative Gate**: Self-check for **Stepdown Rule**, **SLA**, and **Lexical Scoping**.
111
+ - **Plan Adherence**: No "bonus" features or refactors (YAGNI).
112
+ - **Blocker Surface**: The agent flags issues immediately rather than working around them.
113
+ - **Circuit Breaker**: If the same error repeats 3 times, or no physical progress (file writes, commands) is made in 3 consecutive turns, the agent **stops and reports** rather than looping indefinitely.
114
+
115
+ ### 4. Phase: TEST
116
+
117
+ > **Role: Fast** _(Claude Code — multi-agent mode)_
118
+
119
+ Verification against the original Spec's checklist.
120
+
121
+ - **Regression Proof**: For bugs, the agent must prove the fix works without breaking existing logic.
122
+ - **Fix Loop**: A built-in resilience mechanism allowing up to **3 refactor attempts** if tests fail. On the third failure, the Circuit Breaker triggers — the agent stops and reports rather than continuing.
123
+ - **Lint Fix**: Automated resolution of style violations before reporting success.
124
+
125
+ ### 5. Phase: END
126
+
127
+ > **Role: Planning** _(Claude Code — multi-agent mode)_
128
+
129
+ Closing the loop and ensuring project observability.
130
+
131
+ - **Artifact Sync**: Automated updates to `tasks.md` (status DONE) and `context.md` (next objective).
132
+ - **Engineering Insights**: The agent logs research findings, rework patterns, and lessons learned into `context.md ## Engineering Insights`. Stale or irrelevant entries are curated out, keeping the file lean across sessions.
133
+ - **Changelog**: Consistent history following the [Keep a Changelog](https://keepachangelog.com/) standard.
134
+ - **Semantic Commit**: Proposing a commit message that reflects the actual intent and scope.
135
+
136
+ ---
137
+
138
+ > [!TIP]
139
+ > This deep-flow is the internal model the agent follows on every task cycle. Use it to understand why the agent stops where it does and what it checks at each gate.
@@ -0,0 +1,45 @@
1
+ # 01 - Scope and MVP (The Agile Contract / SPEC)
2
+
3
+ For short, fast-paced projects (MVPs) or Landing Pages, the biggest risk for the Freelancer or lean Squad is not technology, it is **Scope Creep** (the client asking for _just one more little thing_ at the end, consuming your profit margin).
4
+
5
+ This document establishes the exact boundaries of what will be - and what will NOT be - delivered in the paid project.
6
+
7
+ ## What We Will Do (In-Scope / MVP)
8
+
9
+ - Executive summary: What problem does the client want to solve? (e.g., "Create a page to collect emails for a digital product launch").
10
+ - Raw list of Features:
11
+ - Homepage with static copy.
12
+ - Form capturing Name and Email integrated with Mailchimp.
13
+ - Which Screens (UI) will actually be designed? (Page sizes).
14
+
15
+ ## Out-of-Scope
16
+
17
+ - What will be left for V2/V3 and charged separately in the future? (This shields you against falsely agreed-upon hours).
18
+ - Ex: "We will not build an Admin/Login system for the page right now."
19
+ - Ex: "We will not integrate automatic SMS sending at this time."
20
+
21
+ ---
22
+
23
+ ## Learn by Examples
24
+
25
+ ### ❌ Bad Example
26
+
27
+ ```markdown
28
+ # Scope
29
+
30
+ Build the institutional website for the dental clinic.
31
+ ```
32
+
33
+ > **Rationale**: Terrible. In the final week of delivery, the dentist asks: "What about the system to schedule patients on WhatsApp via the website like the competitor has? Didn't you build it?". Since the scope didn't exclude this (Out-of-Scope), the client thinks you failed or will do it for free.
34
+
35
+ ### ✅ Good Example
36
+
37
+ ```markdown
38
+ # Happy Smile Clinic Website Scope
39
+
40
+ - **Business Problem:** The clinic wants digital presence on Google Ads and to collect initial consultation Leads.
41
+ - **In-Scope (Deliverables):** Responsive Landing Page (One-page), email contact form, static clinic photo gallery, and dynamic Links that redirect to the Receptionist's Whatsapp with a pre-filled message.
42
+ - **Out-of-Scope (Deferred to V2):** We will not develop our own Database, we will not develop a CMS Panel (Admin to change photos), and we will not integrate with third-party Medical Scheduling Software in this phase.
43
+ ```
44
+
45
+ > **Rationale**: Absolute defense. The agency knows they will only need to use Netlify and Email. When the client brings up the Scheduling integration, it will be a new budget.
@@ -0,0 +1,56 @@
1
+ # 02 - Technical Stack and Essential Data
2
+
3
+ In fast-paced projects, you should not waste time justifying complex ADRs. Use whatever allows you to deliver quickly and document here only how the next programmer can run the code.
4
+
5
+ ## Main Technologies
6
+
7
+ - Frontend Framework / SSR: (Ex: Next.js, Vite + React).
8
+ - Styling: (Ex: TailwindCSS V3, Radix UI).
9
+ - CMS / Backend-As-A-Service (If applicable): (Ex: Supabase, Strapi, Sanity).
10
+
11
+ ## How to Run the Project (Developer Experience - DX)
12
+
13
+ 1. Install package `X`.
14
+ 2. Include `.env` (where to get a development one?).
15
+ 3. Run `npm run dev`.
16
+
17
+ ## Minimum Viable Data Model (DB Schema)
18
+
19
+ - If there's a database, paste only a minimalist Schema or text describing the essential collections so developers don't have to "fish blindfolded".
20
+ - If there's a _Headless_ CMS behind it, map the most critical _Types_.
21
+
22
+ ---
23
+
24
+ ## Learn by Examples
25
+
26
+ ### ❌ Bad Example
27
+
28
+ ```markdown
29
+ # Stack
30
+
31
+ Using React. To turn it on run npm start.
32
+ The database has a `leads` table.
33
+ ```
34
+
35
+ > **Rationale**: Omits dozens of secret libraries. A junior dev clones it, runs npm start, and the screen blinks white because they didn't set the Supabase `.env` and didn't even know you used Vercel.
36
+
37
+ ### ✅ Good Example
38
+
39
+ ```markdown
40
+ # Stack and Environment: Happy Smile LP
41
+
42
+ ## Local Setup
43
+
44
+ 1. `git clone` followed by `npm ci` (we are using `v18.x` in nvm).
45
+ 2. Request access to DevSupabase in the slack group.
46
+ 3. Copy the `.env.example` file to `.env.local` and run `npm run dev` on port 3000.
47
+ **Frontend:** Next.js (Pages Router) + TailwindCSS. Form built with `React Hook Form`.
48
+
49
+ ## Supabase Minimal Entities
50
+
51
+ To strictly focus on contacts, we have only 1 table managed in the Development Supabase Cloud:
52
+
53
+ - `leads (id: UUID, name: string, email: string, whatsapp: string, created_at: timestamp)`
54
+ ```
55
+
56
+ > **Rationale**: Straight to the point and practical. A second Frontend dev will enter the project, clone it, understand the forms, and run it in less than 10 minutes of reading.
@@ -0,0 +1,44 @@
1
+ # 03 - Third-Party Integrations and Sensitive Keys
2
+
3
+ Third-party APIs and services are the magical bricks that solve 80% of the business logic in Lite products. Instead of reinventing an email sending server or building a billing system in Java, the Landing Page or MVP will consume ready-made APIs (like Resend, Mailchimp, and Stripe).
4
+
5
+ ## Project Connectors and Environment Variables
6
+
7
+ - Will you send emails? Which provider? And how will React on Vercel call the API without leaking access data on the Frontend? (Hint: Next.js API Routes).
8
+ - Payment and Checkout: Which Gateway will we use that doesn't demand PCI compliance scope?
9
+ - Is Auth proprietary (e.g., Supabase, Auth0) or will we have Google Login?
10
+
11
+ ## Credentials Mapping (Vault/Env)
12
+
13
+ - Do NOT store or hardcode ANYTHING in Git. Integrations must use and declare the expected `.env` taxonomy for the project.
14
+
15
+ ---
16
+
17
+ ## Learn by Examples
18
+
19
+ ### ❌ Bad Example
20
+
21
+ ```markdown
22
+ # Integration
23
+
24
+ We fire the form to the company's mailchimp. The Front-end does a fetch with the token.
25
+ ```
26
+
27
+ > **Rationale**: Severe security danger and lack of maturity. Frontends should not carry Mailchimp keys on the Client-side, otherwise any visitor could grab your Newsletter token and freely delete your customer base.
28
+
29
+ ### ✅ Good Example
30
+
31
+ ```markdown
32
+ # Happy Smile API Integrations
33
+
34
+ ## Transactional Emails (Form to the Clinic)
35
+
36
+ - **Provider:** We will use the [Resend API](https://resend.com) on the client's domain `docs@sorrisofeliz.com`.
37
+ - **Secure Magic Routes:** We created a Serverless endpoint (Edge API On Vercel) at the `POST /api/leads` route. The React client form calls this endpoint without any tokens. The underlying Node.js will consume the shielded token via Vercel's `.env` and inject it into Resend: `RESEND_API_KEY`.
38
+
39
+ ## Checkout (Planned)
40
+
41
+ - **Gateway:** When clients pay for direct consultations (Stripe Hosted Checkout), the publishable variables will be inserted into NEXT*PUBLIC_PUBLISHABLE_KEY, but \_webhooks* will return with cryptographic signature `STRIPE_WEBHOOK_SECRET` validated at `/api/stripe-webhook`.
42
+ ```
43
+
44
+ > **Rationale**: Maps exactly which third-party fronts are used, how the keys will be called, and protects the Freelancer against chronic Cybersecurity flaws that could ruin the MVP.
@@ -0,0 +1,26 @@
1
+ # 04 - Launch Checklist
2
+
3
+ Launching an MVP/Landing Page quickly doesn't mean just throwing files onto the server. Your client expects polish, speed, and impeccable SEO on WhatsApp. This is the final gateway, your personal one-day Quality Assurance.
4
+
5
+ ## Domain Setup and Security
6
+
7
+ - [ ] Is the custom domain linked on Vercel/Netlify/Cloudflare?
8
+ - [ ] Is SSL (HTTPS) active (Green Padlock)?
9
+ - [ ] Did you try accessing without 'www' (e.g., `happy-smile.com`) and was the traffic correctly redirected to prevent Google penalties (Duplicate Content)?
10
+ - [ ] Reference: # 01 - Scope and MVP (The Agile Contract / SPEC)
11
+
12
+ ## SEO and Social Sharing (OpenGraph)
13
+
14
+ - [ ] Have basic `Meta Tags` (Title, Description) been declared for Google?
15
+ - [ ] Are `Og:Image` images hosted so that when the link is posted on WhatsApp or Instagram, the "site thumbnail" appears beautiful and resized?
16
+ - [ ] Is there a real `Favicon` or did you forget the default Vercel logo orbiting?
17
+
18
+ ## Live Integrations & Core Web Vitals Performance
19
+
20
+ - [ ] Have the Google Analytics (GA4) and Meta Pixel (Facebook) tags been injected so Marketing doesn't complain later?
21
+ - [ ] Does the Chrome Lighthouse score hit 90+ in Performance and Accessibility in a cold Mobile audit? (Use WebP, cut massive JS).
22
+ - [ ] Did the test with real form data ("Mr. John Smith, john@gmail.com") actually land in the client's inbox without a SPAM flag?
23
+
24
+ ---
25
+
26
+ > **Rationale**: Executing this checklist crowns the relentless quality of the Freelancer/Agency. Your project is only complete when all the boxes above have been checked positively. Nothing sells a fast sprint better than a link without loose error edges and a thumbnail that creates visual pride for the client.
@@ -0,0 +1,77 @@
1
+ # 01 - Project Vision
2
+
3
+ ## Description
4
+
5
+ - What is the primary goal of this project?
6
+ - What does it aim to become in the long term?
7
+
8
+ ## Scale and Magnitude
9
+
10
+ - What is the estimated number of users (Active/Concurrent)?
11
+ - What is the expected volume of data or transactions (TPS/RPS)?
12
+ - Is there any availability requirement (SLA)?
13
+
14
+ ## Budget and Resources
15
+
16
+ - What is the approximate available budget (Infra/Services)?
17
+ - What **Developer expertise** is required (Senior, Mid-level, Specialist)?
18
+
19
+ ## Deadlines and Expectations
20
+
21
+ - What are the main milestones?
22
+ - Is there a critical launch date (Hard deadline)?
23
+
24
+ ## Target Audience
25
+
26
+ - Who are the primary users?
27
+ - What value are we delivering to them?
28
+
29
+ ## Out of Scope
30
+
31
+ - What will this project definitely NOT do?
32
+
33
+ ---
34
+
35
+ ## Learn by Examples
36
+
37
+ ### ❌ Bad Example
38
+
39
+ ```markdown
40
+ # 01 - Project Vision
41
+
42
+ ## Description
43
+
44
+ The project aims to improve the sales system to satisfy the customer.
45
+
46
+ ## Budget and Resources
47
+
48
+ Whatever it takes to make it good.
49
+
50
+ ## Deadlines and Expectations
51
+
52
+ As soon as possible.
53
+ ```
54
+
55
+ > **Rationale**: Vague and lack of financial or temporal commitment. "As soon as possible" generates anxiety and lack of planning.
56
+
57
+ ### ✅ Good Example
58
+
59
+ ```markdown
60
+ # 01 - Project Vision
61
+
62
+ ## Description
63
+
64
+ To be the leading platform for rare automotive parts sales in Latin America by 2027.
65
+
66
+ ## Budget and Resources
67
+
68
+ - **Infra Budget**: Maximum of $15,000/month.
69
+ - **Team**: 2 Senior Engineers and 1 UX Designer.
70
+
71
+ ## Deadlines and Expectations
72
+
73
+ - **POC**: Until May 15th.
74
+ - **MVP**: Beta launch on September 1st (Hard deadline for the industry trade show).
75
+ ```
76
+
77
+ > **Rationale**: Defines clear cost limits and fixed dates that allow for team capacity planning.