sinapse-ai 8.0.2 → 9.1.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 (118) 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/core/quality-gates/focus-area-recommender.js +105 -2
  4. package/.sinapse-ai/data/entity-registry.yaml +3 -3
  5. package/.sinapse-ai/data/registry-update-log.jsonl +1 -0
  6. package/.sinapse-ai/development/agent-teams/team-all.yaml +3 -3
  7. package/.sinapse-ai/development/agent-teams/team-fullstack.yaml +6 -6
  8. package/.sinapse-ai/development/agent-teams/team-ide-minimal.yaml +4 -4
  9. package/.sinapse-ai/development/agent-teams/team-no-ui.yaml +5 -5
  10. package/.sinapse-ai/development/agent-teams/team-qa-focused.yaml +9 -9
  11. package/.sinapse-ai/install-manifest.yaml +22 -18
  12. package/bin/sinapse.js +16 -0
  13. package/package.json +1 -1
  14. package/scripts/audit-tasks.cjs +256 -0
  15. package/squads/claude-code-mastery/tasks/audit-integration.md +6 -0
  16. package/squads/claude-code-mastery/tasks/audit-settings.md +6 -0
  17. package/squads/claude-code-mastery/tasks/audit-setup.md +6 -0
  18. package/squads/claude-code-mastery/tasks/brownfield-setup.md +6 -0
  19. package/squads/claude-code-mastery/tasks/ci-cd-setup.md +6 -0
  20. package/squads/claude-code-mastery/tasks/claude-md-engineer.md +6 -0
  21. package/squads/claude-code-mastery/tasks/configure-claude-code.md +6 -0
  22. package/squads/claude-code-mastery/tasks/context-rot-audit.md +6 -0
  23. package/squads/claude-code-mastery/tasks/create-agent-definition.md +6 -0
  24. package/squads/claude-code-mastery/tasks/create-rules.md +6 -0
  25. package/squads/claude-code-mastery/tasks/create-team-topology.md +6 -0
  26. package/squads/claude-code-mastery/tasks/diagnose.md +6 -0
  27. package/squads/claude-code-mastery/tasks/enterprise-config.md +6 -0
  28. package/squads/claude-code-mastery/tasks/hook-designer.md +6 -0
  29. package/squads/claude-code-mastery/tasks/integrate-project.md +6 -0
  30. package/squads/claude-code-mastery/tasks/mcp-integration-plan.md +6 -0
  31. package/squads/claude-code-mastery/tasks/mcp-workflow.md +6 -0
  32. package/squads/claude-code-mastery/tasks/multi-project-setup.md +6 -0
  33. package/squads/claude-code-mastery/tasks/optimize-context.md +6 -0
  34. package/squads/claude-code-mastery/tasks/optimize-workflow.md +6 -0
  35. package/squads/claude-code-mastery/tasks/parallel-decomposition.md +6 -0
  36. package/squads/claude-code-mastery/tasks/permission-strategy.md +6 -0
  37. package/squads/claude-code-mastery/tasks/sandbox-setup.md +6 -0
  38. package/squads/claude-code-mastery/tasks/setup-repository.md +6 -0
  39. package/squads/claude-code-mastery/tasks/setup-wizard.md +6 -0
  40. package/squads/claude-code-mastery/tasks/worktree-strategy.md +6 -0
  41. package/squads/squad-animations/workflows/3d-scene-creation-cycle.yaml +5 -0
  42. package/squads/squad-animations/workflows/animation-quality-review-cycle.yaml +5 -0
  43. package/squads/squad-animations/workflows/generative-art-creation-cycle.yaml +5 -0
  44. package/squads/squad-animations/workflows/prompt-to-animation-cycle.yaml +5 -0
  45. package/squads/squad-animations/workflows/scroll-experience-creation-cycle.yaml +5 -0
  46. package/squads/squad-brand/knowledge-base/routing-catalog.md +8 -0
  47. package/squads/squad-cloning/workflows/full-clone-pipeline.yaml +5 -0
  48. package/squads/squad-cloning/workflows/quality-validation-cycle.yaml +5 -0
  49. package/squads/squad-cloning/workflows/source-discovery-cycle.yaml +5 -0
  50. package/squads/squad-cloning/workflows/tier1-kb-only.yaml +5 -0
  51. package/squads/squad-cloning/workflows/tier2-consultant.yaml +5 -0
  52. package/squads/squad-cloning/workflows/tier3-full-clone.yaml +5 -0
  53. package/squads/squad-commercial/knowledge-base/routing-catalog.md +12 -0
  54. package/squads/squad-commercial/workflows/churn-prevention-protocol.yaml +5 -0
  55. package/squads/squad-commercial/workflows/client-onboarding-activation.yaml +5 -0
  56. package/squads/squad-commercial/workflows/expansion-revenue-cycle.yaml +5 -0
  57. package/squads/squad-commercial/workflows/new-offer-launch.yaml +5 -0
  58. package/squads/squad-commercial/workflows/quarterly-commercial-review.yaml +5 -0
  59. package/squads/squad-commercial/workflows/revenue-forecasting-cycle.yaml +5 -0
  60. package/squads/squad-content/knowledge-base/routing-catalog.md +12 -0
  61. package/squads/squad-content/workflows/content-audit-cycle.yaml +4 -0
  62. package/squads/squad-content/workflows/content-creation-cycle.yaml +4 -0
  63. package/squads/squad-content/workflows/editorial-planning-cycle.yaml +4 -0
  64. package/squads/squad-content/workflows/onboarding-content-cycle.yaml +4 -0
  65. package/squads/squad-content/workflows/performance-feedback-loop.yaml +4 -0
  66. package/squads/squad-content/workflows/signal-to-content-cycle.yaml +4 -0
  67. package/squads/squad-copy/knowledge-base/routing-catalog.md +12 -0
  68. package/squads/squad-copy/workflows/brand-voice-development.yaml +5 -0
  69. package/squads/squad-copy/workflows/campaign-copy-cycle.yaml +5 -0
  70. package/squads/squad-copy/workflows/content-copy-cycle.yaml +5 -0
  71. package/squads/squad-copy/workflows/conversion-copy-sprint.yaml +5 -0
  72. package/squads/squad-copy/workflows/full-copy-cycle.yaml +5 -0
  73. package/squads/squad-copy/workflows/sales-copy-pipeline.yaml +5 -0
  74. package/squads/squad-council/workflows/business-audit-cycle.yaml +1 -0
  75. package/squads/squad-council/workflows/strategic-advisory-session.yaml +1 -0
  76. package/squads/squad-courses/workflows/course-launch-cycle.yaml +1 -6
  77. package/squads/squad-courses/workflows/presentation-creation.yaml +2 -2
  78. package/squads/squad-design/knowledge-base/routing-catalog.md +12 -0
  79. package/squads/squad-design/workflows/a11y-compliance-cycle.yaml +1 -0
  80. package/squads/squad-design/workflows/design-system-build-cycle.yaml +1 -0
  81. package/squads/squad-design/workflows/landing-page-sprint.yaml +1 -0
  82. package/squads/squad-design/workflows/performance-remediation-cycle.yaml +1 -0
  83. package/squads/squad-design/workflows/ux-research-sprint.yaml +1 -0
  84. package/squads/squad-design/workflows/zero-to-digital-product-cycle.yaml +1 -0
  85. package/squads/squad-finance/knowledge-base/routing-catalog.md +12 -0
  86. package/squads/squad-finance/workflows/client-profitability-audit.yaml +5 -0
  87. package/squads/squad-finance/workflows/monthly-financial-cycle.yaml +5 -0
  88. package/squads/squad-finance/workflows/pricing-design-cycle.yaml +5 -0
  89. package/squads/squad-finance/workflows/quarterly-financial-review.yaml +5 -0
  90. package/squads/squad-growth/knowledge-base/routing-catalog.md +12 -0
  91. package/squads/squad-growth/workflows/analytics-instrumentation-pipeline.yaml +1 -0
  92. package/squads/squad-growth/workflows/campaign-performance-review.yaml +1 -0
  93. package/squads/squad-growth/workflows/cro-experimentation-sprint.yaml +1 -0
  94. package/squads/squad-growth/workflows/full-growth-analytics-cycle.yaml +1 -0
  95. package/squads/squad-growth/workflows/growth-experiment-loop.yaml +1 -0
  96. package/squads/squad-growth/workflows/seo-audit-optimization-cycle.yaml +1 -0
  97. package/squads/squad-paidmedia/knowledge-base/routing-catalog.md +12 -0
  98. package/squads/squad-paidmedia/workflows/account-audit-cycle.yaml +5 -0
  99. package/squads/squad-paidmedia/workflows/campaign-launch-cycle.yaml +5 -0
  100. package/squads/squad-paidmedia/workflows/creative-testing-cycle.yaml +5 -0
  101. package/squads/squad-paidmedia/workflows/cro-optimization-cycle.yaml +5 -0
  102. package/squads/squad-paidmedia/workflows/scaling-sprint.yaml +5 -0
  103. package/squads/squad-product/knowledge-base/routing-catalog.md +12 -0
  104. package/squads/squad-product/workflows/client-roadmap-alignment-cycle.yaml +4 -0
  105. package/squads/squad-product/workflows/product-discovery-cycle.yaml +4 -0
  106. package/squads/squad-product/workflows/product-handoff-cycle.yaml +4 -0
  107. package/squads/squad-product/workflows/product-launch-cycle.yaml +4 -0
  108. package/squads/squad-product/workflows/product-strategy-definition-cycle.yaml +4 -0
  109. package/squads/squad-product/workflows/story-development-delivery-cycle.yaml +4 -0
  110. package/squads/squad-research/knowledge-base/routing-catalog.md +12 -0
  111. package/squads/squad-research/workflows/audience-intelligence-cycle.yaml +4 -0
  112. package/squads/squad-research/workflows/competitive-intelligence-cycle.yaml +4 -0
  113. package/squads/squad-research/workflows/deep-research-cycle.yaml +4 -0
  114. package/squads/squad-research/workflows/full-research-sprint.yaml +4 -0
  115. package/squads/squad-research/workflows/market-analysis-cycle.yaml +4 -0
  116. package/squads/squad-research/workflows/trend-forecasting-cycle.yaml +4 -0
  117. package/squads/squad-storytelling/workflows/pitch-narrative-workflow.yaml +1 -0
  118. package/squads/squad-storytelling/workflows/story-development-cycle.yaml +1 -0
@@ -6,12 +6,16 @@
6
6
  * - Business logic
7
7
  * - Security considerations
8
8
  * - UX/UI implications
9
+ * - Git-blame hotspot analysis (v2.0)
9
10
  *
10
11
  * @module core/quality-gates/focus-area-recommender
11
- * @version 1.0.0
12
+ * @version 2.0.0
12
13
  * @story 3.5 - Human Review Orchestration (Layer 3)
14
+ * @story 9.0 - Ecosystem Quality (git-blame enrichment)
13
15
  */
14
16
 
17
+ const { execSync } = require('child_process');
18
+
15
19
  /**
16
20
  * Focus Area Recommender
17
21
  * Generates intelligent focus areas based on code changes and context
@@ -54,17 +58,48 @@ class FocusAreaRecommender {
54
58
  skip: this.skipAreas,
55
59
  summary: '',
56
60
  highlightedAspects: [],
61
+ hotspots: [],
57
62
  };
58
63
 
59
64
  // Analyze changed files
60
65
  const fileAnalysis = this.analyzeChangedFiles(prContext.changedFiles || []);
61
66
  recommendations.highlightedAspects.push(...fileAnalysis.highlights);
62
67
 
68
+ // Git-blame hotspot analysis (v2.0)
69
+ const blameInsights = this.getGitBlameInsights(prContext.changedFiles || []);
70
+ if (blameInsights.hotspots.length > 0) {
71
+ recommendations.hotspots = blameInsights.hotspots;
72
+ recommendations.highlightedAspects.push(...blameInsights.highlights);
73
+ }
74
+
63
75
  // Add primary focus areas
64
76
  recommendations.primary = this.determinePrimaryAreas(fileAnalysis, layer2Result);
65
77
 
78
+ // Boost priority for hotspot files
79
+ if (blameInsights.hotspots.length > 0) {
80
+ const hotspotArea = {
81
+ area: 'change-hotspot',
82
+ reason: `${blameInsights.hotspots.length} file(s) changed frequently (high churn)`,
83
+ files: blameInsights.hotspots.map((h) => h.file).slice(0, 5),
84
+ questions: [
85
+ 'Is this file changing too often? Consider refactoring.',
86
+ 'Are these changes addressing root cause or symptoms?',
87
+ 'Would a different architecture reduce churn here?',
88
+ ],
89
+ };
90
+ // Insert hotspot as secondary if not already critical
91
+ if (!recommendations.primary.some((p) => p.area === 'architecture')) {
92
+ recommendations.primary.push(hotspotArea);
93
+ recommendations.primary = recommendations.primary.slice(0, 3);
94
+ } else {
95
+ recommendations.secondary = [hotspotArea, ...recommendations.secondary].slice(0, 2);
96
+ }
97
+ }
98
+
66
99
  // Add secondary focus areas
67
- recommendations.secondary = this.determineSecondaryAreas(fileAnalysis, layer2Result);
100
+ if (recommendations.secondary.length === 0) {
101
+ recommendations.secondary = this.determineSecondaryAreas(fileAnalysis, layer2Result);
102
+ }
68
103
 
69
104
  // Generate summary
70
105
  recommendations.summary = this.generateSummary(recommendations);
@@ -72,6 +107,74 @@ class FocusAreaRecommender {
72
107
  return recommendations;
73
108
  }
74
109
 
110
+ /**
111
+ * Get git-blame insights for changed files
112
+ * Identifies hotspots (frequently changed files) and recent contributors
113
+ * @param {Array} changedFiles - List of changed file paths
114
+ * @returns {Object} Blame insights with hotspots and highlights
115
+ */
116
+ getGitBlameInsights(changedFiles = []) {
117
+ const insights = {
118
+ hotspots: [],
119
+ highlights: [],
120
+ contributors: new Map(),
121
+ };
122
+
123
+ if (changedFiles.length === 0) return insights;
124
+
125
+ for (const file of changedFiles.slice(0, 20)) {
126
+ try {
127
+ // Count commits touching this file in last 30 days
128
+ const commitCount = execSync(
129
+ `git log --oneline --since="30 days ago" -- "${file}" 2>/dev/null | wc -l`,
130
+ { encoding: 'utf8', timeout: 5000 },
131
+ ).trim();
132
+
133
+ const count = parseInt(commitCount, 10) || 0;
134
+
135
+ if (count >= 5) {
136
+ insights.hotspots.push({
137
+ file,
138
+ commits30d: count,
139
+ severity: count >= 10 ? 'critical' : 'high',
140
+ });
141
+ }
142
+
143
+ // Get unique contributors for this file
144
+ const authors = execSync(
145
+ `git log --format="%aN" --since="30 days ago" -- "${file}" 2>/dev/null | sort -u`,
146
+ { encoding: 'utf8', timeout: 5000 },
147
+ ).trim().split('\n').filter(Boolean);
148
+
149
+ for (const author of authors) {
150
+ insights.contributors.set(author, (insights.contributors.get(author) || 0) + 1);
151
+ }
152
+ } catch {
153
+ // Git not available or file not tracked — skip silently
154
+ continue;
155
+ }
156
+ }
157
+
158
+ // Sort hotspots by commit count
159
+ insights.hotspots.sort((a, b) => b.commits30d - a.commits30d);
160
+
161
+ // Generate highlights
162
+ if (insights.hotspots.length > 0) {
163
+ const topHotspot = insights.hotspots[0];
164
+ insights.highlights.push(
165
+ `Hotspot: ${topHotspot.file} changed ${topHotspot.commits30d}x in 30 days`,
166
+ );
167
+ }
168
+
169
+ if (insights.contributors.size > 1) {
170
+ insights.highlights.push(
171
+ `${insights.contributors.size} contributors touched these files recently`,
172
+ );
173
+ }
174
+
175
+ return insights;
176
+ }
177
+
75
178
  /**
76
179
  * Analyze changed files to determine focus areas
77
180
  * @param {Array} changedFiles - List of changed file paths
@@ -1,6 +1,6 @@
1
1
  metadata:
2
2
  version: 1.0.0
3
- lastUpdated: '2026-04-03T17:38:02.917Z'
3
+ lastUpdated: '2026-04-03T17:07:46.496Z'
4
4
  entityCount: 745
5
5
  checksumAlgorithm: sha256
6
6
  resolutionRate: 100
@@ -12988,8 +12988,8 @@ entities:
12988
12988
  score: 0.3
12989
12989
  constraints: []
12990
12990
  extensionPoints: []
12991
- checksum: sha256:27674e9afc69241626baceb6e64ecf48f1b0c7c34b5b07bf1daf5bc7cfa7a758
12992
- lastVerified: '2026-04-03T17:38:02.915Z'
12991
+ checksum: sha256:7241d004f82a1fa583311f9ca0b1a4fc287227bcb66bc2f2973d628914a89433
12992
+ lastVerified: '2026-04-03T07:16:38.860Z'
12993
12993
  sprint-lead:
12994
12994
  path: .sinapse-ai/development/agents/sprint-lead.md
12995
12995
  layer: L2
@@ -611,3 +611,4 @@
611
611
  {"timestamp":"2026-04-03T15:13:09.088Z","action":"change","path":".sinapse-ai/data/sinapse-kb.md","trigger":"watcher"}
612
612
  {"timestamp":"2026-04-03T17:07:46.494Z","action":"change","path":".sinapse-ai/infrastructure/scripts/validate-codex-delegation.js","trigger":"watcher"}
613
613
  {"timestamp":"2026-04-03T17:38:02.915Z","action":"change","path":".sinapse-ai/development/agents/sinapse-orqx.md","trigger":"watcher"}
614
+ {"timestamp":"2026-04-03T18:34:42.499Z","action":"change","path":".sinapse-ai/core/quality-gates/focus-area-recommender.js","trigger":"watcher"}
@@ -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.2
11
- generated_at: "2026-04-03T17:55:19.637Z"
10
+ version: 9.1.0
11
+ generated_at: "2026-04-03T18:36:11.847Z"
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
@@ -997,9 +1001,9 @@ files:
997
1001
  type: core
998
1002
  size: 9003
999
1003
  - path: core/quality-gates/focus-area-recommender.js
1000
- hash: sha256:d15cc7f200c4a60405f324123f0b9dd29995eda23177499c2a5285777b664075
1004
+ hash: sha256:4b2e7e432d2f491f339d30622c0f853b84bb4e6f4fa68876977c5c0807791f1a
1001
1005
  type: core
1002
- size: 10787
1006
+ size: 14346
1003
1007
  - path: core/quality-gates/human-review-orchestrator.js
1004
1008
  hash: sha256:caa61d8bc776eaff9d49ad75daff92039db8c2c04a72595f038ab1b2482fec8b
1005
1009
  type: core
@@ -1237,7 +1241,7 @@ files:
1237
1241
  type: data
1238
1242
  size: 9586
1239
1243
  - path: data/entity-registry.yaml
1240
- hash: sha256:d2267093edc0e92ae5bb5cadaefa9e44ccd5d57d3395156d550e14bd335e6014
1244
+ hash: sha256:92372ecd9b4c4450cabebb030021019ad3f561c7b7cafe93aac83dcde1d46b9f
1241
1245
  type: data
1242
1246
  size: 514640
1243
1247
  - path: data/learned-patterns.yaml
@@ -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.2",
3
+ "version": "9.1.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