aios-core 4.1.0 → 4.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 (145) hide show
  1. package/.aios-core/.session/current-session.json +14 -0
  2. package/.aios-core/core/registry/registry-schema.json +166 -166
  3. package/.aios-core/core/registry/service-registry.json +6585 -6585
  4. package/.aios-core/data/entity-registry.yaml +208 -8
  5. package/.aios-core/data/registry-update-log.jsonl +165 -0
  6. package/.aios-core/development/scripts/approval-workflow.js +642 -642
  7. package/.aios-core/development/scripts/backup-manager.js +606 -606
  8. package/.aios-core/development/scripts/branch-manager.js +389 -389
  9. package/.aios-core/development/scripts/code-quality-improver.js +1311 -1311
  10. package/.aios-core/development/scripts/commit-message-generator.js +849 -849
  11. package/.aios-core/development/scripts/conflict-resolver.js +674 -674
  12. package/.aios-core/development/scripts/dependency-analyzer.js +637 -637
  13. package/.aios-core/development/scripts/diff-generator.js +351 -351
  14. package/.aios-core/development/scripts/elicitation-engine.js +384 -384
  15. package/.aios-core/development/scripts/elicitation-session-manager.js +299 -299
  16. package/.aios-core/development/scripts/git-wrapper.js +461 -461
  17. package/.aios-core/development/scripts/manifest-preview.js +244 -244
  18. package/.aios-core/development/scripts/metrics-tracker.js +775 -775
  19. package/.aios-core/development/scripts/modification-validator.js +554 -554
  20. package/.aios-core/development/scripts/pattern-learner.js +1224 -1224
  21. package/.aios-core/development/scripts/performance-analyzer.js +757 -757
  22. package/.aios-core/development/scripts/refactoring-suggester.js +1138 -1138
  23. package/.aios-core/development/scripts/rollback-handler.js +530 -530
  24. package/.aios-core/development/scripts/security-checker.js +358 -358
  25. package/.aios-core/development/scripts/template-engine.js +239 -239
  26. package/.aios-core/development/scripts/template-validator.js +278 -278
  27. package/.aios-core/development/scripts/test-generator.js +843 -843
  28. package/.aios-core/development/scripts/transaction-manager.js +589 -589
  29. package/.aios-core/development/scripts/usage-tracker.js +673 -673
  30. package/.aios-core/development/scripts/validate-filenames.js +226 -226
  31. package/.aios-core/development/scripts/version-tracker.js +526 -526
  32. package/.aios-core/development/scripts/yaml-validator.js +396 -396
  33. package/.aios-core/development/tasks/validate-next-story.md +99 -2
  34. package/.aios-core/development/templates/service-template/README.md.hbs +158 -158
  35. package/.aios-core/development/templates/service-template/__tests__/index.test.ts.hbs +237 -237
  36. package/.aios-core/development/templates/service-template/client.ts.hbs +403 -403
  37. package/.aios-core/development/templates/service-template/errors.ts.hbs +182 -182
  38. package/.aios-core/development/templates/service-template/index.ts.hbs +120 -120
  39. package/.aios-core/development/templates/service-template/package.json.hbs +87 -87
  40. package/.aios-core/development/templates/service-template/types.ts.hbs +145 -145
  41. package/.aios-core/development/templates/squad-template/LICENSE +21 -21
  42. package/.aios-core/docs/SHARD-TRANSLATION-GUIDE.md +335 -0
  43. package/.aios-core/docs/component-creation-guide.md +458 -0
  44. package/.aios-core/docs/session-update-pattern.md +307 -0
  45. package/.aios-core/docs/standards/AIOS-FRAMEWORK-MASTER.md +1963 -0
  46. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.1-SUMMARY.md +1190 -0
  47. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO-V2.1.md +439 -0
  48. package/.aios-core/docs/standards/AIOS-LIVRO-DE-OURO.md +5398 -0
  49. package/.aios-core/docs/standards/V3-ARCHITECTURAL-DECISIONS.md +523 -0
  50. package/.aios-core/docs/template-syntax.md +267 -0
  51. package/.aios-core/docs/troubleshooting-guide.md +625 -0
  52. package/.aios-core/infrastructure/templates/aios-sync.yaml.template +193 -193
  53. package/.aios-core/infrastructure/templates/coderabbit.yaml.template +279 -279
  54. package/.aios-core/infrastructure/templates/github-workflows/ci.yml.template +169 -169
  55. package/.aios-core/infrastructure/templates/github-workflows/pr-automation.yml.template +330 -330
  56. package/.aios-core/infrastructure/templates/github-workflows/release.yml.template +196 -196
  57. package/.aios-core/infrastructure/templates/gitignore/gitignore-aios-base.tmpl +63 -63
  58. package/.aios-core/infrastructure/templates/gitignore/gitignore-brownfield-merge.tmpl +18 -18
  59. package/.aios-core/infrastructure/templates/gitignore/gitignore-node.tmpl +85 -85
  60. package/.aios-core/infrastructure/templates/gitignore/gitignore-python.tmpl +145 -145
  61. package/.aios-core/infrastructure/tests/utilities-audit-results.json +501 -0
  62. package/.aios-core/install-manifest.yaml +101 -101
  63. package/.aios-core/local-config.yaml.template +70 -70
  64. package/.aios-core/manifests/agents.csv +29 -0
  65. package/.aios-core/manifests/schema/manifest-schema.json +190 -190
  66. package/.aios-core/manifests/tasks.csv +198 -0
  67. package/.aios-core/manifests/workers.csv +204 -0
  68. package/.aios-core/monitor/hooks/lib/__init__.py +1 -1
  69. package/.aios-core/monitor/hooks/lib/enrich.py +58 -58
  70. package/.aios-core/monitor/hooks/lib/send_event.py +47 -47
  71. package/.aios-core/monitor/hooks/notification.py +29 -29
  72. package/.aios-core/monitor/hooks/post_tool_use.py +45 -45
  73. package/.aios-core/monitor/hooks/pre_compact.py +29 -29
  74. package/.aios-core/monitor/hooks/pre_tool_use.py +40 -40
  75. package/.aios-core/monitor/hooks/stop.py +29 -29
  76. package/.aios-core/monitor/hooks/subagent_stop.py +29 -29
  77. package/.aios-core/monitor/hooks/user_prompt_submit.py +38 -38
  78. package/.aios-core/product/templates/adr.hbs +125 -125
  79. package/.aios-core/product/templates/component-react-tmpl.tsx +98 -98
  80. package/.aios-core/product/templates/dbdr.hbs +241 -241
  81. package/.aios-core/product/templates/engine/schemas/adr.schema.json +102 -102
  82. package/.aios-core/product/templates/engine/schemas/dbdr.schema.json +205 -205
  83. package/.aios-core/product/templates/engine/schemas/epic.schema.json +175 -175
  84. package/.aios-core/product/templates/engine/schemas/pmdr.schema.json +175 -175
  85. package/.aios-core/product/templates/engine/schemas/prd-v2.schema.json +300 -300
  86. package/.aios-core/product/templates/engine/schemas/prd.schema.json +152 -152
  87. package/.aios-core/product/templates/engine/schemas/story.schema.json +222 -222
  88. package/.aios-core/product/templates/engine/schemas/task.schema.json +154 -154
  89. package/.aios-core/product/templates/epic.hbs +212 -212
  90. package/.aios-core/product/templates/eslintrc-security.json +32 -32
  91. package/.aios-core/product/templates/github-actions-cd.yml +212 -212
  92. package/.aios-core/product/templates/github-actions-ci.yml +172 -172
  93. package/.aios-core/product/templates/pmdr.hbs +186 -186
  94. package/.aios-core/product/templates/prd-v2.0.hbs +216 -216
  95. package/.aios-core/product/templates/prd.hbs +201 -201
  96. package/.aios-core/product/templates/shock-report-tmpl.html +502 -502
  97. package/.aios-core/product/templates/story.hbs +263 -263
  98. package/.aios-core/product/templates/task.hbs +170 -170
  99. package/.aios-core/product/templates/tmpl-comment-on-examples.sql +158 -158
  100. package/.aios-core/product/templates/tmpl-migration-script.sql +91 -91
  101. package/.aios-core/product/templates/tmpl-rls-granular-policies.sql +104 -104
  102. package/.aios-core/product/templates/tmpl-rls-kiss-policy.sql +10 -10
  103. package/.aios-core/product/templates/tmpl-rls-roles.sql +135 -135
  104. package/.aios-core/product/templates/tmpl-rls-simple.sql +77 -77
  105. package/.aios-core/product/templates/tmpl-rls-tenant.sql +152 -152
  106. package/.aios-core/product/templates/tmpl-rollback-script.sql +77 -77
  107. package/.aios-core/product/templates/tmpl-seed-data.sql +140 -140
  108. package/.aios-core/product/templates/tmpl-smoke-test.sql +16 -16
  109. package/.aios-core/product/templates/tmpl-staging-copy-merge.sql +139 -139
  110. package/.aios-core/product/templates/tmpl-stored-proc.sql +140 -140
  111. package/.aios-core/product/templates/tmpl-trigger.sql +152 -152
  112. package/.aios-core/product/templates/tmpl-view-materialized.sql +133 -133
  113. package/.aios-core/product/templates/tmpl-view.sql +177 -177
  114. package/.aios-core/product/templates/token-exports-css-tmpl.css +240 -240
  115. package/.aios-core/quality/schemas/quality-metrics.schema.json +233 -233
  116. package/.aios-core/scripts/migrate-framework-docs.sh +300 -300
  117. package/.aios-core/scripts/pm.sh +0 -0
  118. package/.claude/hooks/enforce-architecture-first.py +196 -196
  119. package/.claude/hooks/mind-clone-governance.py +192 -192
  120. package/.claude/hooks/read-protection.py +151 -151
  121. package/.claude/hooks/slug-validation.py +176 -176
  122. package/.claude/hooks/sql-governance.py +182 -182
  123. package/.claude/hooks/write-path-validation.py +194 -194
  124. package/.claude/rules/agent-authority.md +105 -0
  125. package/.claude/rules/coderabbit-integration.md +93 -0
  126. package/.claude/rules/ids-principles.md +112 -0
  127. package/.claude/rules/story-lifecycle.md +139 -0
  128. package/.claude/rules/workflow-execution.md +150 -0
  129. package/LICENSE +48 -48
  130. package/bin/aios-minimal.js +0 -0
  131. package/bin/aios.js +0 -0
  132. package/package.json +1 -1
  133. package/packages/aios-install/bin/aios-install.js +0 -0
  134. package/packages/aios-install/bin/edmcp.js +0 -0
  135. package/packages/aios-pro-cli/bin/aios-pro.js +0 -0
  136. package/packages/installer/src/wizard/pro-setup.js +433 -49
  137. package/scripts/check-markdown-links.py +352 -352
  138. package/scripts/code-intel-health-check.js +343 -0
  139. package/scripts/dashboard-parallel-dev.sh +0 -0
  140. package/scripts/dashboard-parallel-phase3.sh +0 -0
  141. package/scripts/dashboard-parallel-phase4.sh +0 -0
  142. package/scripts/glue/README.md +355 -0
  143. package/scripts/glue/compose-agent-prompt.cjs +362 -0
  144. package/scripts/install-monitor-hooks.sh +0 -0
  145. package/.aios-core/lib/build.json +0 -1
@@ -1,194 +1,194 @@
1
- #!/usr/bin/env python3
2
- """
3
- Hook: Write Path Validation
4
-
5
- REGRA: Documentos devem ir para os paths corretos conforme convenções.
6
-
7
- Este hook intercepta Write/Edit e AVISA (não bloqueia) quando o path
8
- parece violar as convenções de organização de documentos.
9
-
10
- Exit Codes:
11
- - 0: Sempre (apenas avisa, nunca bloqueia)
12
- """
13
-
14
- import json
15
- import sys
16
- import os
17
- import re
18
- from datetime import datetime
19
-
20
- # =============================================================================
21
- # CONFIGURAÇÃO: Regras de organização de documentos
22
- # =============================================================================
23
-
24
- PATH_RULES = [
25
- # (pattern no nome/conteúdo, path esperado, descrição)
26
- {
27
- "name_patterns": [r"session", r"handoff", r"^2\d{3}-\d{2}-\d{2}"],
28
- "expected_path": "docs/sessions/",
29
- "description": "Session logs e handoffs → docs/sessions/YYYY-MM/",
30
- },
31
- {
32
- "name_patterns": [r"architecture", r"system-design", r"infra"],
33
- "expected_path": "docs/architecture/",
34
- "description": "Docs de arquitetura → docs/architecture/",
35
- "exclude_patterns": [r"ARCHITECTURE_RULES"], # Exceção para MMOS
36
- },
37
- {
38
- "name_patterns": [r"guide", r"tutorial", r"how-to"],
39
- "expected_path": "docs/guides/",
40
- "description": "Guias e tutoriais → docs/guides/",
41
- },
42
- {
43
- "name_patterns": [r"prd\.md$", r"epic.*\.md$", r"story.*\.md$"],
44
- "expected_path": "docs/projects/",
45
- "description": "PRDs, Epics, Stories → docs/projects/{project}/",
46
- },
47
- {
48
- "name_patterns": [r"mind.*specific", r"mind.*validation"],
49
- "expected_path": "outputs/minds/",
50
- "description": "Docs específicos de mind → outputs/minds/{slug}/docs/",
51
- },
52
- ]
53
-
54
- # Paths que são sempre válidos (não avisar)
55
- ALWAYS_VALID_PATHS = [
56
- ".claude/",
57
- ".aios-core/",
58
- ".aios-upstream/",
59
- "squads/",
60
- "node_modules/",
61
- ".git/",
62
- "app/",
63
- "supabase/",
64
- "outputs/",
65
- ]
66
-
67
- # =============================================================================
68
- # LÓGICA DO HOOK
69
- # =============================================================================
70
-
71
- def get_project_root():
72
- """Obtém o root do projeto."""
73
- return os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd())
74
-
75
- def normalize_path(file_path: str, project_root: str) -> str:
76
- """Normaliza path para relativo."""
77
- if file_path.startswith(project_root):
78
- return file_path[len(project_root):].lstrip("/")
79
- return file_path
80
-
81
- def is_always_valid(relative_path: str) -> bool:
82
- """Verifica se o path está em área sempre válida."""
83
- for valid in ALWAYS_VALID_PATHS:
84
- if relative_path.startswith(valid):
85
- return True
86
- return False
87
-
88
- def is_documentation_file(relative_path: str) -> bool:
89
- """Verifica se é um arquivo de documentação."""
90
- doc_extensions = [".md", ".mdx", ".txt", ".rst"]
91
- return any(relative_path.endswith(ext) for ext in doc_extensions)
92
-
93
- def check_path_rules(relative_path: str) -> list[dict]:
94
- """
95
- Verifica se o path viola alguma regra.
96
-
97
- Returns:
98
- Lista de violações com sugestões
99
- """
100
- violations = []
101
- filename = os.path.basename(relative_path)
102
-
103
- for rule in PATH_RULES:
104
- # Verificar se o nome do arquivo corresponde ao pattern
105
- matches_name = False
106
- for pattern in rule["name_patterns"]:
107
- if re.search(pattern, filename, re.IGNORECASE):
108
- matches_name = True
109
- break
110
-
111
- if not matches_name:
112
- continue
113
-
114
- # Verificar exceções
115
- if "exclude_patterns" in rule:
116
- is_excluded = False
117
- for exc_pattern in rule["exclude_patterns"]:
118
- if re.search(exc_pattern, filename, re.IGNORECASE):
119
- is_excluded = True
120
- break
121
- if is_excluded:
122
- continue
123
-
124
- # Verificar se está no path esperado
125
- expected = rule["expected_path"]
126
- if not relative_path.startswith(expected):
127
- violations.append({
128
- "current_path": relative_path,
129
- "expected_path": expected,
130
- "description": rule["description"],
131
- })
132
-
133
- return violations
134
-
135
- def main():
136
- # Ler input do stdin
137
- try:
138
- input_data = json.load(sys.stdin)
139
- except json.JSONDecodeError:
140
- sys.exit(0)
141
-
142
- tool_name = input_data.get("tool_name", "")
143
- tool_input = input_data.get("tool_input", {})
144
-
145
- # Só processar Write e Edit
146
- if tool_name not in ["Write", "Edit"]:
147
- sys.exit(0)
148
-
149
- file_path = tool_input.get("file_path", "")
150
- if not file_path:
151
- sys.exit(0)
152
-
153
- # Normalizar path
154
- project_root = get_project_root()
155
- relative_path = normalize_path(file_path, project_root)
156
-
157
- # Verificar se é área sempre válida
158
- if is_always_valid(relative_path):
159
- sys.exit(0)
160
-
161
- # Só verificar arquivos de documentação
162
- if not is_documentation_file(relative_path):
163
- sys.exit(0)
164
-
165
- # Verificar regras
166
- violations = check_path_rules(relative_path)
167
-
168
- if not violations:
169
- sys.exit(0)
170
-
171
- # AVISAR (não bloquear)
172
- violation = violations[0] # Mostrar primeira violação
173
-
174
- warning_message = f"""
175
- ┌──────────────────────────────────────────────────────────────────────────────┐
176
- │ ⚠️ PATH WARNING: Documento pode estar no local errado │
177
- ├──────────────────────────────────────────────────────────────────────────────┤
178
- │ │
179
- │ Arquivo: {relative_path[:60]:<60} │
180
- │ │
181
- │ Convenção: {violation['description'][:56]:<56} │
182
- │ Esperado: {violation['expected_path']:<57} │
183
- │ │
184
- │ NOTA: Este é apenas um AVISO, a operação será executada. │
185
- │ Verifique se o path está correto antes de continuar. │
186
- │ │
187
- └──────────────────────────────────────────────────────────────────────────────┘
188
- """
189
- # Imprimir warning mas NÃO bloquear (exit 0)
190
- print(warning_message, file=sys.stderr)
191
- sys.exit(0)
192
-
193
- if __name__ == "__main__":
194
- main()
1
+ #!/usr/bin/env python3
2
+ """
3
+ Hook: Write Path Validation
4
+
5
+ REGRA: Documentos devem ir para os paths corretos conforme convenções.
6
+
7
+ Este hook intercepta Write/Edit e AVISA (não bloqueia) quando o path
8
+ parece violar as convenções de organização de documentos.
9
+
10
+ Exit Codes:
11
+ - 0: Sempre (apenas avisa, nunca bloqueia)
12
+ """
13
+
14
+ import json
15
+ import sys
16
+ import os
17
+ import re
18
+ from datetime import datetime
19
+
20
+ # =============================================================================
21
+ # CONFIGURAÇÃO: Regras de organização de documentos
22
+ # =============================================================================
23
+
24
+ PATH_RULES = [
25
+ # (pattern no nome/conteúdo, path esperado, descrição)
26
+ {
27
+ "name_patterns": [r"session", r"handoff", r"^2\d{3}-\d{2}-\d{2}"],
28
+ "expected_path": "docs/sessions/",
29
+ "description": "Session logs e handoffs → docs/sessions/YYYY-MM/",
30
+ },
31
+ {
32
+ "name_patterns": [r"architecture", r"system-design", r"infra"],
33
+ "expected_path": "docs/architecture/",
34
+ "description": "Docs de arquitetura → docs/architecture/",
35
+ "exclude_patterns": [r"ARCHITECTURE_RULES"], # Exceção para MMOS
36
+ },
37
+ {
38
+ "name_patterns": [r"guide", r"tutorial", r"how-to"],
39
+ "expected_path": "docs/guides/",
40
+ "description": "Guias e tutoriais → docs/guides/",
41
+ },
42
+ {
43
+ "name_patterns": [r"prd\.md$", r"epic.*\.md$", r"story.*\.md$"],
44
+ "expected_path": "docs/projects/",
45
+ "description": "PRDs, Epics, Stories → docs/projects/{project}/",
46
+ },
47
+ {
48
+ "name_patterns": [r"mind.*specific", r"mind.*validation"],
49
+ "expected_path": "outputs/minds/",
50
+ "description": "Docs específicos de mind → outputs/minds/{slug}/docs/",
51
+ },
52
+ ]
53
+
54
+ # Paths que são sempre válidos (não avisar)
55
+ ALWAYS_VALID_PATHS = [
56
+ ".claude/",
57
+ ".aios-core/",
58
+ ".aios-upstream/",
59
+ "squads/",
60
+ "node_modules/",
61
+ ".git/",
62
+ "app/",
63
+ "supabase/",
64
+ "outputs/",
65
+ ]
66
+
67
+ # =============================================================================
68
+ # LÓGICA DO HOOK
69
+ # =============================================================================
70
+
71
+ def get_project_root():
72
+ """Obtém o root do projeto."""
73
+ return os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd())
74
+
75
+ def normalize_path(file_path: str, project_root: str) -> str:
76
+ """Normaliza path para relativo."""
77
+ if file_path.startswith(project_root):
78
+ return file_path[len(project_root):].lstrip("/")
79
+ return file_path
80
+
81
+ def is_always_valid(relative_path: str) -> bool:
82
+ """Verifica se o path está em área sempre válida."""
83
+ for valid in ALWAYS_VALID_PATHS:
84
+ if relative_path.startswith(valid):
85
+ return True
86
+ return False
87
+
88
+ def is_documentation_file(relative_path: str) -> bool:
89
+ """Verifica se é um arquivo de documentação."""
90
+ doc_extensions = [".md", ".mdx", ".txt", ".rst"]
91
+ return any(relative_path.endswith(ext) for ext in doc_extensions)
92
+
93
+ def check_path_rules(relative_path: str) -> list[dict]:
94
+ """
95
+ Verifica se o path viola alguma regra.
96
+
97
+ Returns:
98
+ Lista de violações com sugestões
99
+ """
100
+ violations = []
101
+ filename = os.path.basename(relative_path)
102
+
103
+ for rule in PATH_RULES:
104
+ # Verificar se o nome do arquivo corresponde ao pattern
105
+ matches_name = False
106
+ for pattern in rule["name_patterns"]:
107
+ if re.search(pattern, filename, re.IGNORECASE):
108
+ matches_name = True
109
+ break
110
+
111
+ if not matches_name:
112
+ continue
113
+
114
+ # Verificar exceções
115
+ if "exclude_patterns" in rule:
116
+ is_excluded = False
117
+ for exc_pattern in rule["exclude_patterns"]:
118
+ if re.search(exc_pattern, filename, re.IGNORECASE):
119
+ is_excluded = True
120
+ break
121
+ if is_excluded:
122
+ continue
123
+
124
+ # Verificar se está no path esperado
125
+ expected = rule["expected_path"]
126
+ if not relative_path.startswith(expected):
127
+ violations.append({
128
+ "current_path": relative_path,
129
+ "expected_path": expected,
130
+ "description": rule["description"],
131
+ })
132
+
133
+ return violations
134
+
135
+ def main():
136
+ # Ler input do stdin
137
+ try:
138
+ input_data = json.load(sys.stdin)
139
+ except json.JSONDecodeError:
140
+ sys.exit(0)
141
+
142
+ tool_name = input_data.get("tool_name", "")
143
+ tool_input = input_data.get("tool_input", {})
144
+
145
+ # Só processar Write e Edit
146
+ if tool_name not in ["Write", "Edit"]:
147
+ sys.exit(0)
148
+
149
+ file_path = tool_input.get("file_path", "")
150
+ if not file_path:
151
+ sys.exit(0)
152
+
153
+ # Normalizar path
154
+ project_root = get_project_root()
155
+ relative_path = normalize_path(file_path, project_root)
156
+
157
+ # Verificar se é área sempre válida
158
+ if is_always_valid(relative_path):
159
+ sys.exit(0)
160
+
161
+ # Só verificar arquivos de documentação
162
+ if not is_documentation_file(relative_path):
163
+ sys.exit(0)
164
+
165
+ # Verificar regras
166
+ violations = check_path_rules(relative_path)
167
+
168
+ if not violations:
169
+ sys.exit(0)
170
+
171
+ # AVISAR (não bloquear)
172
+ violation = violations[0] # Mostrar primeira violação
173
+
174
+ warning_message = f"""
175
+ ┌──────────────────────────────────────────────────────────────────────────────┐
176
+ │ ⚠️ PATH WARNING: Documento pode estar no local errado │
177
+ ├──────────────────────────────────────────────────────────────────────────────┤
178
+ │ │
179
+ │ Arquivo: {relative_path[:60]:<60} │
180
+ │ │
181
+ │ Convenção: {violation['description'][:56]:<56} │
182
+ │ Esperado: {violation['expected_path']:<57} │
183
+ │ │
184
+ │ NOTA: Este é apenas um AVISO, a operação será executada. │
185
+ │ Verifique se o path está correto antes de continuar. │
186
+ │ │
187
+ └──────────────────────────────────────────────────────────────────────────────┘
188
+ """
189
+ # Imprimir warning mas NÃO bloquear (exit 0)
190
+ print(warning_message, file=sys.stderr)
191
+ sys.exit(0)
192
+
193
+ if __name__ == "__main__":
194
+ main()
@@ -0,0 +1,105 @@
1
+ # Agent Authority — Detailed Rules
2
+
3
+ ## Delegation Matrix
4
+
5
+ ### @devops (Gage) — EXCLUSIVE Authority
6
+
7
+ | Operation | Exclusive? | Other Agents |
8
+ |-----------|-----------|--------------|
9
+ | `git push` / `git push --force` | YES | BLOCKED |
10
+ | `gh pr create` / `gh pr merge` | YES | BLOCKED |
11
+ | MCP add/remove/configure | YES | BLOCKED |
12
+ | CI/CD pipeline management | YES | BLOCKED |
13
+ | Release management | YES | BLOCKED |
14
+
15
+ ### @pm (Morgan) — Epic Orchestration
16
+
17
+ | Operation | Exclusive? | Delegated From |
18
+ |-----------|-----------|---------------|
19
+ | `*execute-epic` | YES | — |
20
+ | `*create-epic` | YES | — |
21
+ | EPIC-{ID}-EXECUTION.yaml management | YES | — |
22
+ | Requirements gathering | YES | — |
23
+ | Spec writing (spec pipeline) | YES | — |
24
+
25
+ ### @po (Pax) — Story Validation
26
+
27
+ | Operation | Exclusive? | Details |
28
+ |-----------|-----------|---------|
29
+ | `*validate-story-draft` | YES | 10-point checklist |
30
+ | Story context tracking in epics | YES | — |
31
+ | Epic context management | YES | — |
32
+ | Backlog prioritization | YES | — |
33
+
34
+ ### @sm (River) — Story Creation
35
+
36
+ | Operation | Exclusive? | Details |
37
+ |-----------|-----------|---------|
38
+ | `*draft` / `*create-story` | YES | From epic/PRD |
39
+ | Story template selection | YES | — |
40
+
41
+ ### @dev (Dex) — Implementation
42
+
43
+ | Allowed | Blocked |
44
+ |---------|---------|
45
+ | `git add`, `git commit`, `git status` | `git push` (delegate to @devops) |
46
+ | `git branch`, `git checkout`, `git merge` (local) | `gh pr create/merge` (delegate to @devops) |
47
+ | `git stash`, `git diff`, `git log` | MCP management |
48
+ | Story file updates (File List, checkboxes) | Story file updates (AC, scope, title) |
49
+
50
+ ### @architect (Aria) — Design Authority
51
+
52
+ | Owns | Delegates To |
53
+ |------|-------------|
54
+ | System architecture decisions | — |
55
+ | Technology selection | — |
56
+ | High-level data architecture | @data-engineer (detailed DDL) |
57
+ | Integration patterns | @data-engineer (query optimization) |
58
+ | Complexity assessment | — |
59
+
60
+ ### @data-engineer (Dara) — Database
61
+
62
+ | Owns (delegated from @architect) | Does NOT Own |
63
+ |----------------------------------|-------------|
64
+ | Schema design (detailed DDL) | System architecture |
65
+ | Query optimization | Application code |
66
+ | RLS policies implementation | Git operations |
67
+ | Index strategy execution | Frontend/UI |
68
+ | Migration planning & execution | — |
69
+
70
+ ### @aios-master — Framework Governance
71
+
72
+ | Capability | Details |
73
+ |-----------|---------|
74
+ | Execute ANY task directly | No restrictions |
75
+ | Framework governance | Constitutional enforcement |
76
+ | Override agent boundaries | When necessary for framework health |
77
+
78
+ ## Cross-Agent Delegation Patterns
79
+
80
+ ### Git Push Flow
81
+ ```
82
+ ANY agent → @devops *push
83
+ ```
84
+
85
+ ### Schema Design Flow
86
+ ```
87
+ @architect (decides technology) → @data-engineer (implements DDL)
88
+ ```
89
+
90
+ ### Story Flow
91
+ ```
92
+ @sm *draft → @po *validate → @dev *develop → @qa *qa-gate → @devops *push
93
+ ```
94
+
95
+ ### Epic Flow
96
+ ```
97
+ @pm *create-epic → @pm *execute-epic → @sm *draft (per story)
98
+ ```
99
+
100
+ ## Escalation Rules
101
+
102
+ 1. Agent cannot complete task → Escalate to @aios-master
103
+ 2. Quality gate fails → Return to @dev with specific feedback
104
+ 3. Constitutional violation detected → BLOCK, require fix before proceed
105
+ 4. Agent boundary conflict → @aios-master mediates
@@ -0,0 +1,93 @@
1
+ # CodeRabbit Integration — Detailed Rules
2
+
3
+ ## Self-Healing Configuration
4
+
5
+ ### Dev Phase (@dev — Story Development Cycle Phase 3)
6
+
7
+ ```yaml
8
+ mode: light
9
+ max_iterations: 2
10
+ timeout_minutes: 30
11
+ severity_filter: [CRITICAL, HIGH]
12
+ behavior:
13
+ CRITICAL: auto_fix
14
+ HIGH: auto_fix (iteration < 2) else document_as_debt
15
+ MEDIUM: document_as_debt
16
+ LOW: ignore
17
+ ```
18
+
19
+ **Flow:**
20
+ ```
21
+ RUN CodeRabbit → CRITICAL found?
22
+ YES → auto-fix (iteration < 2) → Re-run
23
+ NO → Document HIGH as debt, proceed
24
+ After 2 iterations with CRITICAL → HALT, manual intervention
25
+ ```
26
+
27
+ ### QA Phase (@qa — QA Loop Pre-Review)
28
+
29
+ ```yaml
30
+ mode: full
31
+ max_iterations: 3
32
+ timeout_minutes: 30
33
+ severity_filter: [CRITICAL, HIGH]
34
+ behavior:
35
+ CRITICAL: auto_fix
36
+ HIGH: auto_fix
37
+ MEDIUM: document_as_debt
38
+ LOW: ignore
39
+ ```
40
+
41
+ **Flow:**
42
+ 1. Pre-commit review scan
43
+ 2. Self-healing loop (max 3 iterations)
44
+ 3. Manual QA analysis (architectural, traceability, NFR)
45
+ 4. Gate decision (verdict)
46
+
47
+ ## Severity Handling Summary
48
+
49
+ | Severity | Dev Phase | QA Phase |
50
+ |----------|-----------|----------|
51
+ | CRITICAL | auto_fix, block if persists | auto_fix, block if persists |
52
+ | HIGH | auto_fix, document if fails | auto_fix, document if fails |
53
+ | MEDIUM | document_as_tech_debt | document_as_tech_debt |
54
+ | LOW | ignore | ignore |
55
+
56
+ ## WSL Execution (Windows)
57
+
58
+ ```bash
59
+ # Self-healing mode (automatic in dev tasks)
60
+ wsl bash -c 'cd /mnt/c/.../aios-core && ~/.local/bin/coderabbit --severity CRITICAL,HIGH --auto-fix'
61
+
62
+ # Manual review
63
+ wsl bash -c 'cd /mnt/c/.../aios-core && ~/.local/bin/coderabbit -t uncommitted'
64
+
65
+ # Prompt-only mode
66
+ wsl bash -c 'cd /mnt/c/.../aios-core && ~/.local/bin/coderabbit --prompt-only -t uncommitted'
67
+ ```
68
+
69
+ ## Integration Points
70
+
71
+ | Workflow | Phase | Trigger | Agent |
72
+ |----------|-------|---------|-------|
73
+ | Story Development Cycle | 3 (Implement) | After task completion | @dev |
74
+ | QA Loop | 1 (Review) | At review start | @qa |
75
+ | Standalone | Any | `*coderabbit-review` command | Any |
76
+
77
+ ## Focus Areas by Story Type
78
+
79
+ | Story Type | Primary Focus |
80
+ |-----------|--------------|
81
+ | Feature | Code patterns, test coverage, API design |
82
+ | Bug Fix | Regression risk, root cause coverage |
83
+ | Refactor | Breaking changes, interface stability |
84
+ | Documentation | Markdown quality, reference validity |
85
+ | Database | SQL injection, RLS coverage, migration safety |
86
+
87
+ ## Report Location
88
+
89
+ CodeRabbit reports saved to: `docs/qa/coderabbit-reports/`
90
+
91
+ ## Configuration Reference
92
+
93
+ Full config in `.aios-core/core-config.yaml` under `coderabbit_integration` section.