sinapse-ai 8.0.1 → 9.0.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 (116) hide show
  1. package/.sinapse-ai/cli/commands/qa/audit.js +557 -0
  2. package/.sinapse-ai/cli/commands/qa/index.js +7 -0
  3. package/.sinapse-ai/data/entity-registry.yaml +846 -771
  4. package/.sinapse-ai/development/agent-teams/team-all.yaml +3 -3
  5. package/.sinapse-ai/development/agent-teams/team-fullstack.yaml +6 -6
  6. package/.sinapse-ai/development/agent-teams/team-ide-minimal.yaml +4 -4
  7. package/.sinapse-ai/development/agent-teams/team-no-ui.yaml +5 -5
  8. package/.sinapse-ai/development/agent-teams/team-qa-focused.yaml +9 -9
  9. package/.sinapse-ai/install-manifest.yaml +21 -17
  10. package/bin/sinapse.js +16 -0
  11. package/package.json +1 -1
  12. package/scripts/audit-tasks.cjs +256 -0
  13. package/squads/claude-code-mastery/tasks/audit-integration.md +6 -0
  14. package/squads/claude-code-mastery/tasks/audit-settings.md +6 -0
  15. package/squads/claude-code-mastery/tasks/audit-setup.md +6 -0
  16. package/squads/claude-code-mastery/tasks/brownfield-setup.md +6 -0
  17. package/squads/claude-code-mastery/tasks/ci-cd-setup.md +6 -0
  18. package/squads/claude-code-mastery/tasks/claude-md-engineer.md +6 -0
  19. package/squads/claude-code-mastery/tasks/configure-claude-code.md +6 -0
  20. package/squads/claude-code-mastery/tasks/context-rot-audit.md +6 -0
  21. package/squads/claude-code-mastery/tasks/create-agent-definition.md +6 -0
  22. package/squads/claude-code-mastery/tasks/create-rules.md +6 -0
  23. package/squads/claude-code-mastery/tasks/create-team-topology.md +6 -0
  24. package/squads/claude-code-mastery/tasks/diagnose.md +6 -0
  25. package/squads/claude-code-mastery/tasks/enterprise-config.md +6 -0
  26. package/squads/claude-code-mastery/tasks/hook-designer.md +6 -0
  27. package/squads/claude-code-mastery/tasks/integrate-project.md +6 -0
  28. package/squads/claude-code-mastery/tasks/mcp-integration-plan.md +6 -0
  29. package/squads/claude-code-mastery/tasks/mcp-workflow.md +6 -0
  30. package/squads/claude-code-mastery/tasks/multi-project-setup.md +6 -0
  31. package/squads/claude-code-mastery/tasks/optimize-context.md +6 -0
  32. package/squads/claude-code-mastery/tasks/optimize-workflow.md +6 -0
  33. package/squads/claude-code-mastery/tasks/parallel-decomposition.md +6 -0
  34. package/squads/claude-code-mastery/tasks/permission-strategy.md +6 -0
  35. package/squads/claude-code-mastery/tasks/sandbox-setup.md +6 -0
  36. package/squads/claude-code-mastery/tasks/setup-repository.md +6 -0
  37. package/squads/claude-code-mastery/tasks/setup-wizard.md +6 -0
  38. package/squads/claude-code-mastery/tasks/worktree-strategy.md +6 -0
  39. package/squads/squad-animations/workflows/3d-scene-creation-cycle.yaml +5 -0
  40. package/squads/squad-animations/workflows/animation-quality-review-cycle.yaml +5 -0
  41. package/squads/squad-animations/workflows/generative-art-creation-cycle.yaml +5 -0
  42. package/squads/squad-animations/workflows/prompt-to-animation-cycle.yaml +5 -0
  43. package/squads/squad-animations/workflows/scroll-experience-creation-cycle.yaml +5 -0
  44. package/squads/squad-brand/knowledge-base/routing-catalog.md +8 -0
  45. package/squads/squad-cloning/workflows/full-clone-pipeline.yaml +5 -0
  46. package/squads/squad-cloning/workflows/quality-validation-cycle.yaml +5 -0
  47. package/squads/squad-cloning/workflows/source-discovery-cycle.yaml +5 -0
  48. package/squads/squad-cloning/workflows/tier1-kb-only.yaml +5 -0
  49. package/squads/squad-cloning/workflows/tier2-consultant.yaml +5 -0
  50. package/squads/squad-cloning/workflows/tier3-full-clone.yaml +5 -0
  51. package/squads/squad-commercial/knowledge-base/routing-catalog.md +12 -0
  52. package/squads/squad-commercial/workflows/churn-prevention-protocol.yaml +5 -0
  53. package/squads/squad-commercial/workflows/client-onboarding-activation.yaml +5 -0
  54. package/squads/squad-commercial/workflows/expansion-revenue-cycle.yaml +5 -0
  55. package/squads/squad-commercial/workflows/new-offer-launch.yaml +5 -0
  56. package/squads/squad-commercial/workflows/quarterly-commercial-review.yaml +5 -0
  57. package/squads/squad-commercial/workflows/revenue-forecasting-cycle.yaml +5 -0
  58. package/squads/squad-content/knowledge-base/routing-catalog.md +12 -0
  59. package/squads/squad-content/workflows/content-audit-cycle.yaml +4 -0
  60. package/squads/squad-content/workflows/content-creation-cycle.yaml +4 -0
  61. package/squads/squad-content/workflows/editorial-planning-cycle.yaml +4 -0
  62. package/squads/squad-content/workflows/onboarding-content-cycle.yaml +4 -0
  63. package/squads/squad-content/workflows/performance-feedback-loop.yaml +4 -0
  64. package/squads/squad-content/workflows/signal-to-content-cycle.yaml +4 -0
  65. package/squads/squad-copy/knowledge-base/routing-catalog.md +12 -0
  66. package/squads/squad-copy/workflows/brand-voice-development.yaml +5 -0
  67. package/squads/squad-copy/workflows/campaign-copy-cycle.yaml +5 -0
  68. package/squads/squad-copy/workflows/content-copy-cycle.yaml +5 -0
  69. package/squads/squad-copy/workflows/conversion-copy-sprint.yaml +5 -0
  70. package/squads/squad-copy/workflows/full-copy-cycle.yaml +5 -0
  71. package/squads/squad-copy/workflows/sales-copy-pipeline.yaml +5 -0
  72. package/squads/squad-council/workflows/business-audit-cycle.yaml +1 -0
  73. package/squads/squad-council/workflows/strategic-advisory-session.yaml +1 -0
  74. package/squads/squad-courses/workflows/course-launch-cycle.yaml +1 -6
  75. package/squads/squad-courses/workflows/presentation-creation.yaml +2 -2
  76. package/squads/squad-design/knowledge-base/routing-catalog.md +12 -0
  77. package/squads/squad-design/workflows/a11y-compliance-cycle.yaml +1 -0
  78. package/squads/squad-design/workflows/design-system-build-cycle.yaml +1 -0
  79. package/squads/squad-design/workflows/landing-page-sprint.yaml +1 -0
  80. package/squads/squad-design/workflows/performance-remediation-cycle.yaml +1 -0
  81. package/squads/squad-design/workflows/ux-research-sprint.yaml +1 -0
  82. package/squads/squad-design/workflows/zero-to-digital-product-cycle.yaml +1 -0
  83. package/squads/squad-finance/knowledge-base/routing-catalog.md +12 -0
  84. package/squads/squad-finance/workflows/client-profitability-audit.yaml +5 -0
  85. package/squads/squad-finance/workflows/monthly-financial-cycle.yaml +5 -0
  86. package/squads/squad-finance/workflows/pricing-design-cycle.yaml +5 -0
  87. package/squads/squad-finance/workflows/quarterly-financial-review.yaml +5 -0
  88. package/squads/squad-growth/knowledge-base/routing-catalog.md +12 -0
  89. package/squads/squad-growth/workflows/analytics-instrumentation-pipeline.yaml +1 -0
  90. package/squads/squad-growth/workflows/campaign-performance-review.yaml +1 -0
  91. package/squads/squad-growth/workflows/cro-experimentation-sprint.yaml +1 -0
  92. package/squads/squad-growth/workflows/full-growth-analytics-cycle.yaml +1 -0
  93. package/squads/squad-growth/workflows/growth-experiment-loop.yaml +1 -0
  94. package/squads/squad-growth/workflows/seo-audit-optimization-cycle.yaml +1 -0
  95. package/squads/squad-paidmedia/knowledge-base/routing-catalog.md +12 -0
  96. package/squads/squad-paidmedia/workflows/account-audit-cycle.yaml +5 -0
  97. package/squads/squad-paidmedia/workflows/campaign-launch-cycle.yaml +5 -0
  98. package/squads/squad-paidmedia/workflows/creative-testing-cycle.yaml +5 -0
  99. package/squads/squad-paidmedia/workflows/cro-optimization-cycle.yaml +5 -0
  100. package/squads/squad-paidmedia/workflows/scaling-sprint.yaml +5 -0
  101. package/squads/squad-product/knowledge-base/routing-catalog.md +12 -0
  102. package/squads/squad-product/workflows/client-roadmap-alignment-cycle.yaml +4 -0
  103. package/squads/squad-product/workflows/product-discovery-cycle.yaml +4 -0
  104. package/squads/squad-product/workflows/product-handoff-cycle.yaml +4 -0
  105. package/squads/squad-product/workflows/product-launch-cycle.yaml +4 -0
  106. package/squads/squad-product/workflows/product-strategy-definition-cycle.yaml +4 -0
  107. package/squads/squad-product/workflows/story-development-delivery-cycle.yaml +4 -0
  108. package/squads/squad-research/knowledge-base/routing-catalog.md +12 -0
  109. package/squads/squad-research/workflows/audience-intelligence-cycle.yaml +4 -0
  110. package/squads/squad-research/workflows/competitive-intelligence-cycle.yaml +4 -0
  111. package/squads/squad-research/workflows/deep-research-cycle.yaml +4 -0
  112. package/squads/squad-research/workflows/full-research-sprint.yaml +4 -0
  113. package/squads/squad-research/workflows/market-analysis-cycle.yaml +4 -0
  114. package/squads/squad-research/workflows/trend-forecasting-cycle.yaml +4 -0
  115. package/squads/squad-storytelling/workflows/pitch-narrative-workflow.yaml +1 -0
  116. package/squads/squad-storytelling/workflows/story-development-cycle.yaml +1 -0
@@ -3,9 +3,9 @@ bundle:
3
3
  icon: 👥
4
4
  description: Includes every core system agent.
5
5
  agents:
6
- - sinapse-orchestrator
7
- - sinapse-developer
8
- - '*'
6
+ - sinapse-orqx # Imperator — master orchestrator
7
+ - developer # Pixel — code implementation
8
+ - '*' # All other agents
9
9
  workflows:
10
10
  - brownfield-fullstack.yaml
11
11
  - brownfield-service.yaml
@@ -3,12 +3,12 @@ bundle:
3
3
  icon: 🚀
4
4
  description: Team capable of full stack, front end only, or service development.
5
5
  agents:
6
- - sinapse-orchestrator
7
- - analyst
8
- - pm
9
- - ux-expert
10
- - architect
11
- - po
6
+ - sinapse-orqx # Imperator — master orchestrator
7
+ - analyst # Scope — research & analysis
8
+ - project-lead # Beacon — epic orchestration
9
+ - ux-design-expert # Mosaic — UX/UI design
10
+ - architect # Stratum — architecture
11
+ - product-lead # Axis — story validation
12
12
  workflows:
13
13
  - brownfield-fullstack.yaml
14
14
  - brownfield-service.yaml
@@ -3,8 +3,8 @@ bundle:
3
3
  icon: ⚡
4
4
  description: Only the bare minimum for the IDE PO SM dev qa cycle.
5
5
  agents:
6
- - po
7
- - sm
8
- - dev
9
- - qa
6
+ - product-lead # Axis — story validation
7
+ - sprint-lead # Sync — story creation
8
+ - developer # Pixel — code implementation
9
+ - quality-gate # Litmus — QA & testing
10
10
  workflows: null
@@ -3,11 +3,11 @@ bundle:
3
3
  icon: 🔧
4
4
  description: Team with no UX or UI Planning.
5
5
  agents:
6
- - sinapse-orchestrator
7
- - analyst
8
- - pm
9
- - architect
10
- - po
6
+ - sinapse-orqx # Imperator — master orchestrator
7
+ - analyst # Scope — research & analysis
8
+ - project-lead # Beacon — epic orchestration
9
+ - architect # Stratum — architecture
10
+ - product-lead # Axis — story validation
11
11
  workflows:
12
12
  - greenfield-service.yaml
13
13
  - brownfield-service.yaml
@@ -4,9 +4,9 @@ bundle:
4
4
  description: Quality-focused team that orchestrates code review, testing, and deployment validation using CodeRabbit integration. Ideal for pre-PR reviews, deployment gates, and comprehensive quality assurance.
5
5
 
6
6
  agents:
7
- - dev # Pre-commit CodeRabbit reviews, development quality
8
- - qa # Automated and manual QA, story validation
9
- - github-devops # PR quality gates, deployment safety checks
7
+ - developer # Pixel — pre-commit CodeRabbit reviews, development quality
8
+ - quality-gate # Litmus — automated and manual QA, story validation
9
+ - devops # Pipeline — PR quality gates, deployment safety checks
10
10
 
11
11
  workflows:
12
12
  - code-quality-gate.yaml # Unified quality validation (lint, tests, CodeRabbit)
@@ -31,13 +31,13 @@ purpose: |
31
31
  - Validate story acceptance criteria
32
32
  - Block completion on CRITICAL issues
33
33
 
34
- 3. **PR Phase** (@github-devops):
34
+ 3. **PR Phase** (@devops):
35
35
  - Pre-PR quality gate (0 CRITICAL issues required)
36
36
  - Automated PR validation workflow
37
37
  - Lint + Tests + CodeRabbit scan
38
38
  - Generate comprehensive PR validation report
39
39
 
40
- 4. **Deployment Phase** (@github-devops):
40
+ 4. **Deployment Phase** (@devops):
41
41
  - Deep security scan with CodeRabbit
42
42
  - Risk analysis and blocking issue detection
43
43
  - Environment configuration validation
@@ -133,16 +133,16 @@ usage_example: |
133
133
  → Validates acceptance criteria
134
134
  → Reports any quality gate failures
135
135
 
136
- ## 3. PR Creation (by @github-devops)
136
+ ## 3. PR Creation (by @devops)
137
137
  "Create PR for this feature"
138
- → @github-devops runs pr-validation workflow
138
+ → @devops runs pr-validation workflow
139
139
  → Checks: sync, CodeRabbit, lint, tests, coverage
140
140
  → Generates validation report
141
141
  → Creates PR with report link
142
142
 
143
- ## 4. Deployment (by @github-devops)
143
+ ## 4. Deployment (by @devops)
144
144
  "Run deployment safety check for production"
145
- → @github-devops runs deployment-safety-check workflow
145
+ → @devops runs deployment-safety-check workflow
146
146
  → Deep scan, risk analysis, env check, migrations, tests
147
147
  → Generates safety report with GO/NO-GO decision
148
148
  → Blocks if critical issues found
@@ -7,10 +7,10 @@
7
7
  # - SHA256 hashes for change detection
8
8
  # - File types for categorization
9
9
  #
10
- version: 8.0.1
11
- generated_at: "2026-04-03T17:40:56.685Z"
10
+ version: 9.0.0
11
+ generated_at: "2026-04-03T18:28:49.573Z"
12
12
  generator: scripts/generate-install-manifest.js
13
- file_count: 1119
13
+ file_count: 1120
14
14
  files:
15
15
  - path: cli/commands/config/index.js
16
16
  hash: sha256:66f111eceef0f60fa0a8904add783b615d55b01d5fe36408623c3dd828e702f6
@@ -112,10 +112,14 @@ files:
112
112
  hash: sha256:be706f637b3f54d882a8e1d3ee953a40c7ae7b94ca3bfcafdd4d6865d0526964
113
113
  type: cli
114
114
  size: 22145
115
+ - path: cli/commands/qa/audit.js
116
+ hash: sha256:e177f5eb9cbf3ce4b6decbc24b8c171633aa6cb8506d393a3d4b12d3cc475882
117
+ type: cli
118
+ size: 16661
115
119
  - path: cli/commands/qa/index.js
116
- hash: sha256:db24334e2ca26537a9848c9a3bc0179a2c7a36686e411de1e35406a14df28a55
120
+ hash: sha256:6712a9c6ae3a2c76c09281a0a63d0f0acea4c2359c607554ef8cfcd2def5804f
117
121
  type: cli
118
- size: 1528
122
+ size: 1891
119
123
  - path: cli/commands/qa/run.js
120
124
  hash: sha256:71877b9d4f1cd127eef2460a113176ed57a461b0f141b0a136106cff0d951f88
121
125
  type: cli
@@ -1237,9 +1241,9 @@ files:
1237
1241
  type: data
1238
1242
  size: 9586
1239
1243
  - path: data/entity-registry.yaml
1240
- hash: sha256:d2267093edc0e92ae5bb5cadaefa9e44ccd5d57d3395156d550e14bd335e6014
1244
+ hash: sha256:c7f791f44270dbcf2503e7deee3f6bf56ffa1a269436a287596abad3b6200e6e
1241
1245
  type: data
1242
- size: 514640
1246
+ size: 516464
1243
1247
  - path: data/learned-patterns.yaml
1244
1248
  hash: sha256:24ac0b160615583a0ff783d3da8af80b7f94191575d6db2054ec8e10a3f945dc
1245
1249
  type: data
@@ -1321,25 +1325,25 @@ files:
1321
1325
  type: data
1322
1326
  size: 5355
1323
1327
  - path: development/agent-teams/team-all.yaml
1324
- hash: sha256:c0772af6353862cb57256a88aa046905d2ab8fca9b1a6816ff4886806ee0f8b9
1328
+ hash: sha256:d97525ebf35bcddde38742e591e3f6a70fec87ba3eff48a92f474a9291fcced7
1325
1329
  type: development
1326
- size: 323
1330
+ size: 429
1327
1331
  - path: development/agent-teams/team-fullstack.yaml
1328
- hash: sha256:e12e3e5437b2a3a1790e53ca921719269de96576ce0fd5ee0076f3fcb63f1e09
1332
+ hash: sha256:be636a47d62b4c6dc47ba5a53bc6296caff74d613251c4f15be35ff13fcf55ab
1329
1333
  type: development
1330
- size: 387
1334
+ size: 639
1331
1335
  - path: development/agent-teams/team-ide-minimal.yaml
1332
- hash: sha256:600b6795116fd74e66f3544679667fa4b6a546c88eaf5e30b6182b77ba341692
1336
+ hash: sha256:ae1efa02a08e64fd095090704d9dc6a55a31d1a8745a9bbd79709626666efa24
1333
1337
  type: development
1334
- size: 167
1338
+ size: 350
1335
1339
  - path: development/agent-teams/team-no-ui.yaml
1336
- hash: sha256:a842b1fc3bc95634930cba476d7e06302bae2ba00ef45f5dee5e161005b05c9a
1340
+ hash: sha256:7f02daec22bdb1a59031ca343c5351f741cf948510fa73882ea5ae853ef790d2
1337
1341
  type: development
1338
- size: 227
1342
+ size: 442
1339
1343
  - path: development/agent-teams/team-qa-focused.yaml
1340
- hash: sha256:702c60934a2fe01253e35dce21acbd1a3e35b6ca28ba3307e165f32e19e0c83d
1344
+ hash: sha256:8ebf4dd8e791901c206b5368f39cbb55d21cc9e640698852c6e994e3256825c6
1341
1345
  type: development
1342
- size: 5066
1346
+ size: 5058
1343
1347
  - path: development/agents/analyst.md
1344
1348
  hash: sha256:16b6bf39b1208f44be26384308beace1fbc6fadd32e43bf8854ce695e9aabf26
1345
1349
  type: agent
package/bin/sinapse.js CHANGED
@@ -69,6 +69,10 @@ USAGE:
69
69
  sinapse validate # Validate installation integrity
70
70
  sinapse info # Show system info
71
71
  sinapse doctor # Run diagnostics
72
+ sinapse qa run # Run quality gate pipeline
73
+ sinapse qa run --layer=1 # Run specific layer
74
+ sinapse qa status # Show gate status
75
+ sinapse qa audit # Audit squad ecosystem quality
72
76
  sinapse --version # Show version
73
77
  sinapse --help # Show this help
74
78
 
@@ -1077,6 +1081,18 @@ async function main() {
1077
1081
  showHelp();
1078
1082
  break;
1079
1083
 
1084
+ case 'qa': {
1085
+ // Quality Gate Manager — sinapse qa run|status|audit
1086
+ try {
1087
+ const { run } = require('../.sinapse-ai/cli/index.js');
1088
+ await run(process.argv);
1089
+ } catch (error) {
1090
+ console.error(`❌ QA command error: ${error.message}`);
1091
+ process.exit(1);
1092
+ }
1093
+ break;
1094
+ }
1095
+
1080
1096
  case 'health': {
1081
1097
  // Framework health analytics
1082
1098
  const { runHealth } = require('../.sinapse-ai/cli/commands/health/index.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinapse-ai",
3
- "version": "8.0.1",
3
+ "version": "9.0.0",
4
4
  "description": "SINAPSE AI: Framework de orquestracao de IA — 18 squads, 175 agentes especializados",
5
5
  "bin": {
6
6
  "sinapse": "bin/sinapse.js",
@@ -0,0 +1,256 @@
1
+ /**
2
+ * SINAPSE Task Audit Script
3
+ * Audits all task markdown files across squads for structural compliance.
4
+ *
5
+ * Usage: node scripts/audit-tasks.cjs [--fix] [--json]
6
+ * --fix Add basic frontmatter to tasks missing it entirely
7
+ * --json Output raw JSON instead of summary
8
+ */
9
+
10
+ const fs = require('fs');
11
+ const path = require('path');
12
+ const { glob } = require('glob');
13
+
14
+ const ROOT = path.resolve(__dirname, '..');
15
+ const SQUADS_DIR = path.join(ROOT, 'squads');
16
+ const FIX_MODE = process.argv.includes('--fix');
17
+ const JSON_MODE = process.argv.includes('--json');
18
+
19
+ // ── Scoring weights ──────────────────────────────────────────────
20
+ const CHECKS = [
21
+ { id: 'has_frontmatter', weight: 20, label: 'Has YAML frontmatter' },
22
+ { id: 'has_task_field', weight: 15, label: 'Frontmatter has task: field' },
23
+ { id: 'has_responsavel', weight: 10, label: 'Frontmatter has responsavel/responsible' },
24
+ { id: 'has_entrada', weight: 10, label: 'Frontmatter has Entrada/input' },
25
+ { id: 'has_saida', weight: 10, label: 'Frontmatter has Saida/output' },
26
+ { id: 'has_title', weight: 10, label: 'Has # Task: or # title' },
27
+ { id: 'has_steps', weight: 10, label: 'Has ## Steps or ## Description' },
28
+ { id: 'has_metadata', weight: 5, label: 'Has ## Metadata section' },
29
+ { id: 'min_content_length', weight: 10, label: 'Content >= 200 chars' },
30
+ ];
31
+
32
+ const MAX_SCORE = CHECKS.reduce((s, c) => s + c.weight, 0);
33
+
34
+ // ── Parse frontmatter ────────────────────────────────────────────
35
+ function parseFrontmatter(content) {
36
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
37
+ if (!match) return null;
38
+ return match[1];
39
+ }
40
+
41
+ // ── Audit a single file ──────────────────────────────────────────
42
+ function auditFile(filePath) {
43
+ const content = fs.readFileSync(filePath, 'utf-8');
44
+ const filename = path.basename(filePath, '.md');
45
+ const fm = parseFrontmatter(content);
46
+ const body = fm ? content.slice(content.indexOf('---', 3) + 3).trim() : content;
47
+
48
+ const results = {};
49
+ const issues = [];
50
+
51
+ // 1. Has frontmatter
52
+ results.has_frontmatter = !!fm;
53
+ if (!fm) issues.push('Missing frontmatter entirely');
54
+
55
+ // 2. task: field
56
+ results.has_task_field = fm ? /^task:/m.test(fm) : false;
57
+ if (!results.has_task_field && fm) issues.push('Missing task: field in frontmatter');
58
+
59
+ // 3. responsavel / responsible
60
+ results.has_responsavel = fm ? /^(responsavel|responsible):/m.test(fm) : false;
61
+ if (!results.has_responsavel && fm) issues.push('Missing responsavel/responsible field');
62
+
63
+ // 4. Entrada / input
64
+ results.has_entrada = fm ? /^(Entrada|input):/m.test(fm) : false;
65
+ if (!results.has_entrada && fm) issues.push('Missing Entrada/input section');
66
+
67
+ // 5. Saida / output
68
+ results.has_saida = fm ? /^(Saida|output):/m.test(fm) : false;
69
+ if (!results.has_saida && fm) issues.push('Missing Saida/output section');
70
+
71
+ // 6. Title
72
+ results.has_title = /^#\s+.+/m.test(body);
73
+ if (!results.has_title) issues.push('Missing # title in body');
74
+
75
+ // 7. Steps / Description
76
+ results.has_steps = /^##\s+(Steps|Description|Etapas)/mi.test(body);
77
+ if (!results.has_steps) issues.push('Missing ## Steps or ## Description');
78
+
79
+ // 8. Metadata
80
+ results.has_metadata = /^##\s+Metadata/mi.test(body);
81
+ if (!results.has_metadata) issues.push('Missing ## Metadata section');
82
+
83
+ // 9. Content length
84
+ results.min_content_length = content.length >= 200;
85
+ if (!results.min_content_length) issues.push(`Content too short (${content.length} chars)`);
86
+
87
+ // Score
88
+ let score = 0;
89
+ for (const check of CHECKS) {
90
+ if (results[check.id]) score += check.weight;
91
+ }
92
+ const pct = Math.round((score / MAX_SCORE) * 100);
93
+
94
+ return { file: filename, path: filePath, score: pct, results, issues };
95
+ }
96
+
97
+ // ── Fix: add frontmatter to files missing it ─────────────────────
98
+ function fixFrontmatter(filePath) {
99
+ const content = fs.readFileSync(filePath, 'utf-8');
100
+ const filename = path.basename(filePath, '.md');
101
+
102
+ const frontmatter = [
103
+ '---',
104
+ `task: ${filename}`,
105
+ 'responsavel: "TBD"',
106
+ 'responsavel_type: Agent',
107
+ 'atomic_layer: Task',
108
+ '---',
109
+ '',
110
+ ].join('\n');
111
+
112
+ fs.writeFileSync(filePath, frontmatter + content, 'utf-8');
113
+ return true;
114
+ }
115
+
116
+ // ── Main ─────────────────────────────────────────────────────────
117
+ async function main() {
118
+ const pattern = path.join(SQUADS_DIR, '*/tasks/*.md').replace(/\\/g, '/');
119
+ const files = await glob(pattern);
120
+
121
+ if (files.length === 0) {
122
+ console.error('No task files found.');
123
+ process.exit(1);
124
+ }
125
+
126
+ const squadMap = {};
127
+ const allResults = [];
128
+ let fixedCount = 0;
129
+
130
+ for (const filePath of files) {
131
+ const rel = path.relative(SQUADS_DIR, filePath);
132
+ const squadName = rel.split(/[/\\]/)[0];
133
+
134
+ if (!squadMap[squadName]) {
135
+ squadMap[squadName] = { tasks: [], totalScore: 0, issues: [] };
136
+ }
137
+
138
+ // Fix mode: add frontmatter before auditing
139
+ if (FIX_MODE) {
140
+ const content = fs.readFileSync(filePath, 'utf-8');
141
+ if (!content.startsWith('---')) {
142
+ fixFrontmatter(filePath);
143
+ fixedCount++;
144
+ }
145
+ }
146
+
147
+ const result = auditFile(filePath);
148
+ squadMap[squadName].tasks.push(result);
149
+ squadMap[squadName].totalScore += result.score;
150
+ allResults.push(result);
151
+ }
152
+
153
+ // ── Build report ───────────────────────────────────────────────
154
+ const squadSummaries = [];
155
+ for (const [name, data] of Object.entries(squadMap).sort((a, b) => a[0].localeCompare(b[0]))) {
156
+ const avg = Math.round(data.totalScore / data.tasks.length);
157
+ const critical = data.tasks.filter(t => t.score < 50).length;
158
+ const warning = data.tasks.filter(t => t.score >= 50 && t.score < 70).length;
159
+ squadSummaries.push({
160
+ squad: name,
161
+ taskCount: data.tasks.length,
162
+ avgScore: avg,
163
+ critical,
164
+ warning,
165
+ passing: data.tasks.length - critical - warning,
166
+ });
167
+ }
168
+
169
+ // Issue frequency
170
+ const issueFreq = {};
171
+ for (const r of allResults) {
172
+ for (const iss of r.issues) {
173
+ issueFreq[iss] = (issueFreq[iss] || 0) + 1;
174
+ }
175
+ }
176
+ const commonIssues = Object.entries(issueFreq)
177
+ .sort((a, b) => b[1] - a[1])
178
+ .map(([issue, count]) => ({ issue, count, pct: Math.round((count / allResults.length) * 100) }));
179
+
180
+ const overallAvg = Math.round(allResults.reduce((s, r) => s + r.score, 0) / allResults.length);
181
+ const problemFiles = allResults.filter(r => r.score < 70).sort((a, b) => a.score - b.score);
182
+
183
+ const report = {
184
+ summary: {
185
+ totalFiles: allResults.length,
186
+ totalSquads: squadSummaries.length,
187
+ overallAvgScore: overallAvg,
188
+ passingFiles: allResults.filter(r => r.score >= 70).length,
189
+ warningFiles: allResults.filter(r => r.score >= 50 && r.score < 70).length,
190
+ criticalFiles: allResults.filter(r => r.score < 50).length,
191
+ fixedInThisRun: fixedCount,
192
+ },
193
+ squadSummaries,
194
+ commonIssues,
195
+ problemFiles: problemFiles.map(f => ({
196
+ file: f.file,
197
+ squad: path.relative(SQUADS_DIR, f.path).split(/[/\\]/)[0],
198
+ score: f.score,
199
+ issues: f.issues,
200
+ })),
201
+ };
202
+
203
+ if (JSON_MODE) {
204
+ console.log(JSON.stringify(report, null, 2));
205
+ } else {
206
+ // Human-readable output
207
+ console.log('\n=== SINAPSE Task Audit Report ===\n');
208
+ console.log(`Total files: ${report.summary.totalFiles}`);
209
+ console.log(`Total squads: ${report.summary.totalSquads}`);
210
+ console.log(`Overall avg score: ${report.summary.overallAvgScore}%`);
211
+ console.log(`Passing (>=70): ${report.summary.passingFiles}`);
212
+ console.log(`Warning (50-69): ${report.summary.warningFiles}`);
213
+ console.log(`Critical (<50): ${report.summary.criticalFiles}`);
214
+ if (fixedCount > 0) console.log(`Fixed (frontmatter added): ${fixedCount}`);
215
+
216
+ console.log('\n--- Squad Summary ---\n');
217
+ console.log('Squad'.padEnd(30) + 'Tasks'.padEnd(8) + 'Avg'.padEnd(6) + 'Crit'.padEnd(6) + 'Warn'.padEnd(6) + 'Pass');
218
+ console.log('-'.repeat(62));
219
+ for (const s of squadSummaries) {
220
+ console.log(
221
+ s.squad.padEnd(30) +
222
+ String(s.taskCount).padEnd(8) +
223
+ `${s.avgScore}%`.padEnd(6) +
224
+ String(s.critical).padEnd(6) +
225
+ String(s.warning).padEnd(6) +
226
+ String(s.passing)
227
+ );
228
+ }
229
+
230
+ console.log('\n--- Common Issues ---\n');
231
+ for (const iss of commonIssues) {
232
+ console.log(` ${iss.count} files (${iss.pct}%) — ${iss.issue}`);
233
+ }
234
+
235
+ if (problemFiles.length > 0) {
236
+ console.log(`\n--- Problem Files (score < 70): ${problemFiles.length} files ---\n`);
237
+ for (const f of problemFiles.slice(0, 50)) {
238
+ const squad = path.relative(SQUADS_DIR, f.path).split(/[/\\]/)[0];
239
+ console.log(` [${f.score}%] ${squad}/${f.file}: ${f.issues.join('; ')}`);
240
+ }
241
+ if (problemFiles.length > 50) {
242
+ console.log(` ... and ${problemFiles.length - 50} more`);
243
+ }
244
+ }
245
+ }
246
+
247
+ // Write JSON for report generation
248
+ const jsonPath = path.join(ROOT, 'docs', 'reports', '9.3-task-audit.json');
249
+ fs.writeFileSync(jsonPath, JSON.stringify(report, null, 2), 'utf-8');
250
+ console.log(`\nJSON saved to: ${jsonPath}`);
251
+ }
252
+
253
+ main().catch(err => {
254
+ console.error('Audit failed:', err);
255
+ process.exit(1);
256
+ });
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: audit-integration
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Audit Existing Claude Code Integration
2
8
 
3
9
  **Task ID:** CCM-PI-002
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: audit-settings
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Audit Claude Code Settings
2
8
 
3
9
  **Task ID:** CCM-CONFIG-002
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: audit-setup
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Audit Claude Code Setup
2
8
 
3
9
  **Task ID:** CCM-CHIEF-002
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: brownfield-setup
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Brownfield Project Claude Code Setup
2
8
 
3
9
  **Task ID:** brownfield-setup
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: ci-cd-setup
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Claude Code CI/CD Pipeline Setup
2
8
 
3
9
  **Task ID:** ci-cd-setup
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: claude-md-engineer
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Engineer Optimal CLAUDE.md
2
8
 
3
9
  **Task ID:** claude-md-engineer
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: configure-claude-code
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Configure Claude Code Settings
2
8
 
3
9
  **Task ID:** CCM-CONFIG-001
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: context-rot-audit
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Context Rot Audit
2
8
 
3
9
  **Task ID:** context-rot-audit
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: create-agent-definition
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Create Custom Subagent Definition
2
8
 
3
9
  **Task ID:** create-agent-definition
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: create-rules
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Create Conditional Rules
2
8
 
3
9
  **Task ID:** CCM-CONFIG-003
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: create-team-topology
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Design Agent Team Configuration
2
8
 
3
9
  **Task ID:** create-team-topology
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: diagnose
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Diagnose Claude Code Question
2
8
 
3
9
  **Task ID:** CCM-CHIEF-001
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: enterprise-config
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Enterprise Configuration
2
8
 
3
9
  **Task ID:** CCM-CONFIG-007
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: hook-designer
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Design Custom Hooks
2
8
 
3
9
  **Task ID:** CCM-PI-006
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: integrate-project
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Integrate Claude Code into Existing Project
2
8
 
3
9
  **Task ID:** integrate-project
@@ -1,3 +1,9 @@
1
+ ---
2
+ task: mcp-integration-plan
3
+ responsavel: "TBD"
4
+ responsavel_type: Agent
5
+ atomic_layer: Task
6
+ ---
1
7
  # Task: Plan MCP Server Integration
2
8
 
3
9
  **Task ID:** CCM-PI-005