trinity-method-sdk 2.0.9 → 2.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.
- package/CHANGELOG.md +702 -267
- package/README.md +550 -540
- package/dist/cli/commands/deploy/agents.js +1 -1
- package/dist/cli/commands/deploy/ci-cd.d.ts +4 -3
- package/dist/cli/commands/deploy/ci-cd.js +10 -9
- package/dist/cli/commands/deploy/claude-setup.js +28 -35
- package/dist/cli/commands/deploy/configuration.js +10 -11
- package/dist/cli/commands/deploy/directories.js +13 -14
- package/dist/cli/commands/deploy/gitignore.js +3 -5
- package/dist/cli/commands/deploy/index.d.ts +1 -1
- package/dist/cli/commands/deploy/index.js +7 -3
- package/dist/cli/commands/deploy/knowledge-base.js +3 -3
- package/dist/cli/commands/deploy/pre-flight.js +1 -1
- package/dist/cli/commands/deploy/root-files.js +3 -18
- package/dist/cli/commands/deploy/sdk-install.js +1 -1
- package/dist/cli/commands/deploy/summary.js +3 -3
- package/dist/cli/commands/deploy/templates.js +33 -20
- package/dist/cli/commands/update/agents.js +1 -1
- package/dist/cli/commands/update/backup.js +6 -12
- package/dist/cli/commands/update/commands.d.ts +1 -0
- package/dist/cli/commands/update/commands.js +18 -45
- package/dist/cli/commands/update/knowledge-base.js +2 -2
- package/dist/cli/commands/update/pre-flight.js +11 -11
- package/dist/cli/commands/update/summary.js +5 -5
- package/dist/cli/commands/update/templates.js +35 -13
- package/dist/cli/commands/update/verification.js +5 -5
- package/dist/cli/commands/update/version.js +1 -1
- package/dist/cli/utils/deploy-ci.d.ts +3 -2
- package/dist/cli/utils/deploy-ci.js +24 -24
- package/dist/cli/utils/deploy-linting.js +101 -6
- package/dist/cli/utils/error-classes.d.ts +2 -2
- package/dist/cli/utils/linting-tools.js +14 -6
- package/dist/cli/utils/template-processor.js +2 -4
- package/dist/templates/{claude → .claude}/EMPLOYEE-DIRECTORY.md.template +16 -22
- package/dist/templates/{agents → .claude/agents}/aj-team/apo-documentation-specialist.md.template +10 -10
- package/dist/templates/{agents → .claude/agents}/aj-team/bas-quality-gate.md.template +13 -15
- package/dist/templates/{agents → .claude/agents}/aj-team/bon-dependency-manager.md.template +4 -4
- package/dist/templates/{agents → .claude/agents}/aj-team/cap-configuration-specialist.md.template +3 -3
- package/dist/templates/{agents → .claude/agents}/aj-team/dra-code-reviewer.md.template +8 -10
- package/dist/templates/{agents → .claude/agents}/aj-team/kil-task-executor.md.template +11 -13
- package/dist/templates/{agents → .claude/agents}/aj-team/uro-refactoring-specialist.md.template +3 -3
- package/dist/templates/{agents → .claude/agents}/audit/juno-auditor.md.template +46 -42
- package/dist/templates/{agents → .claude/agents}/deployment/ein-cicd.md.template +59 -164
- package/dist/templates/{agents → .claude/agents}/deployment/ino-context.md.template +25 -22
- package/dist/templates/{agents → .claude/agents}/deployment/tan-structure.md.template +32 -30
- package/dist/templates/{agents → .claude/agents}/deployment/zen-knowledge.md.template +28 -23
- package/dist/templates/{agents → .claude/agents}/leadership/aj-maestro.md.template +10 -6
- package/dist/templates/{agents → .claude/agents}/leadership/aly-cto.md.template +22 -19
- package/dist/templates/{agents → .claude/agents}/planning/eus-decomposer.md.template +8 -4
- package/dist/templates/{agents → .claude/agents}/planning/mon-requirements.md.template +8 -4
- package/dist/templates/{agents → .claude/agents}/planning/ror-design.md.template +8 -4
- package/dist/templates/{agents → .claude/agents}/planning/tra-planner.md.template +10 -4
- package/dist/templates/{shared/claude-commands → .claude/commands/execution}/trinity-audit.md.template +15 -15
- package/dist/templates/.claude/commands/execution/trinity-breakdown.md.template +535 -0
- package/dist/templates/{shared/claude-commands → .claude/commands/execution}/trinity-orchestrate.md.template +48 -48
- package/dist/templates/{shared/claude-commands → .claude/commands/infrastructure}/trinity-init.md.template +32 -54
- package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-create-investigation.md.template +13 -7
- package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-investigate-templates.md.template +19 -15
- package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-plan-investigation.md.template +12 -6
- package/dist/templates/{shared/claude-commands → .claude/commands/maintenance}/trinity-changelog.md.template +9 -8
- package/dist/templates/.claude/commands/maintenance/trinity-docs-update.md.template +279 -0
- package/dist/templates/.claude/commands/maintenance/trinity-docs.md.template +2828 -0
- package/dist/templates/{shared/claude-commands → .claude/commands/maintenance}/trinity-readme.md.template +21 -20
- package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-decompose.md.template +6 -4
- package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-design.md.template +6 -4
- package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-plan.md.template +7 -5
- package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-requirements.md.template +6 -4
- package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-continue.md.template +30 -24
- package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-end.md.template +403 -397
- package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-start.md.template +9 -4
- package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-agents.md.template +11 -8
- package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-verify.md.template +56 -57
- package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-workorder.md.template +13 -9
- package/dist/templates/ci/ci.yml.template +2 -2
- package/dist/templates/root/CLAUDE.md.template +9 -9
- package/dist/templates/root/linting/nodejs/.husky-pre-commit.template +5 -0
- package/dist/templates/source/base-CLAUDE.md.template +310 -310
- package/dist/templates/source/flutter-CLAUDE.md.template +593 -593
- package/dist/templates/source/nodejs-CLAUDE.md.template +531 -531
- package/dist/templates/source/python-CLAUDE.md.template +510 -510
- package/dist/templates/source/react-CLAUDE.md.template +513 -513
- package/dist/templates/source/rust-CLAUDE.md.template +653 -653
- package/dist/templates/trinity/CLAUDE.md.template +14 -14
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/AI-DEVELOPMENT-GUIDE.md.template +1 -1
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/ARCHITECTURE.md.template +5 -5
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/CODING-PRINCIPLES.md.template +1 -1
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/DOCUMENTATION-CRITERIA.md.template +1 -1
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/ISSUES.md.template +9 -9
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/TESTING-PRINCIPLES.md.template +1 -1
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/Technical-Debt.md.template +2 -4
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/To-do.md.template +2 -2
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/Trinity.md.template +6 -6
- package/dist/templates/trinity/templates/documentation/api-docs/README.md.template +218 -0
- package/dist/templates/trinity/templates/documentation/configuration/documentation-structure.md.template +71 -0
- package/dist/templates/trinity/templates/documentation/configuration/env-example-generator.md.template +387 -0
- package/dist/templates/trinity/templates/documentation/discovery/api-endpoint-scanner.md.template +343 -0
- package/dist/templates/trinity/templates/documentation/discovery/component-discovery.md.template +254 -0
- package/dist/templates/trinity/templates/documentation/discovery/env-variable-extraction.md.template +316 -0
- package/dist/templates/trinity/templates/documentation/discovery/framework-detection.md.template +205 -0
- package/dist/templates/trinity/templates/documentation/guides/api-development.md.template +375 -0
- package/dist/templates/trinity/templates/documentation/guides/contributing.md.template +488 -0
- package/dist/templates/trinity/templates/documentation/guides/deployment.md.template +565 -0
- package/dist/templates/trinity/templates/documentation/guides/getting-started.md.template +118 -0
- package/dist/templates/trinity/templates/documentation/mermaid-diagrams/api-endpoint-map.md.template +56 -0
- package/dist/templates/trinity/templates/documentation/mermaid-diagrams/component-hierarchy.md.template +60 -0
- package/dist/templates/trinity/templates/documentation/mermaid-diagrams/database-er.md.template +49 -0
- package/dist/templates/trinity/templates/documentation/mermaid-diagrams/mvc-flow.md.template +41 -0
- package/dist/templates/trinity/templates/documentation/processes/error-handling-protocol.md.template +166 -0
- package/dist/templates/trinity/templates/documentation/processes/fallback-mechanism.md.template +88 -0
- package/dist/templates/trinity/templates/documentation/reports/apo-docs-update-checklist.md.template +343 -0
- package/dist/templates/trinity/templates/documentation/reports/juno-docs-update-checklist.md.template +1337 -0
- package/dist/templates/trinity/templates/documentation/reports/juno-final-report.md.template +237 -0
- package/dist/templates/trinity/templates/documentation/reports/juno-internal-report.md.template +461 -0
- package/dist/templates/trinity/templates/documentation/validation/documentation-verification-rules.md.template +379 -0
- package/dist/templates/trinity/templates/documentation/validation/juno-quality-gates.md.template +282 -0
- package/dist/templates/{investigations → trinity/templates/investigations}/bug.md.template +14 -14
- package/dist/templates/{investigations → trinity/templates/investigations}/feature.md.template +14 -14
- package/dist/templates/{investigations → trinity/templates/investigations}/performance.md.template +14 -14
- package/dist/templates/{investigations → trinity/templates/investigations}/security.md.template +14 -14
- package/dist/templates/{investigations → trinity/templates/investigations}/technical.md.template +14 -14
- package/dist/templates/{work-orders → trinity/templates/work-orders}/ANALYSIS-TEMPLATE.md.template +10 -13
- package/dist/templates/{work-orders → trinity/templates/work-orders}/AUDIT-TEMPLATE.md.template +10 -26
- package/dist/templates/{work-orders → trinity/templates/work-orders}/IMPLEMENTATION-TEMPLATE.md.template +10 -26
- package/dist/templates/{work-orders → trinity/templates/work-orders}/INVESTIGATION-TEMPLATE.md.template +10 -25
- package/dist/templates/{work-orders → trinity/templates/work-orders}/PATTERN-TEMPLATE.md.template +10 -26
- package/dist/templates/{work-orders → trinity/templates/work-orders}/VERIFICATION-TEMPLATE.md.template +10 -26
- package/package.json +99 -94
- package/dist/templates/agents/leadership/aj-cc.md.template +0 -462
- package/dist/templates/ci/cd.yml.template +0 -175
- package/dist/templates/ci/github-actions.yml +0 -86
- package/dist/templates/root/TRINITY.md.template +0 -52
- package/dist/templates/shared/claude-commands/trinity-docs.md.template +0 -2577
- /package/dist/templates/{linting → root/linting}/flutter/.pre-commit-config.yaml.template +0 -0
- /package/dist/templates/{linting → root/linting}/flutter/analysis_options.yaml.template +0 -0
- /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-commonjs.json.template +0 -0
- /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-esm.json.template +0 -0
- /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-typescript.json.template +0 -0
- /package/dist/templates/{linting → root/linting}/nodejs/.pre-commit-config.yaml.template +0 -0
- /package/dist/templates/{linting → root/linting}/nodejs/.prettierrc.json.template +0 -0
- /package/dist/templates/{linting → root/linting}/python/.flake8.template +0 -0
- /package/dist/templates/{linting → root/linting}/python/.pre-commit-config.yaml.template +0 -0
- /package/dist/templates/{linting → root/linting}/python/pyproject.toml.template +0 -0
- /package/dist/templates/{linting → root/linting}/rust/.pre-commit-config.yaml.template +0 -0
- /package/dist/templates/{linting → root/linting}/rust/clippy.toml.template +0 -0
- /package/dist/templates/{linting → root/linting}/rust/rustfmt.toml.template +0 -0
- /package/dist/templates/{documentation → trinity/templates/documentation}/ROOT-README.md.template +0 -0
- /package/dist/templates/{documentation → trinity/templates/documentation}/SUBDIRECTORY-README.md.template +0 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
# Documentation Verification Rules
|
|
2
|
+
**Category:** Validation
|
|
3
|
+
**Purpose:** Define Phase 3 verification rules for documentation quality assessment
|
|
4
|
+
**Used By:** Phase 3 Verification
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This template defines the 4-tier verification system used in Phase 3 to validate generated documentation quality and assign quality scores (0-100).
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Verification Tier System
|
|
15
|
+
|
|
16
|
+
### Tier 1: File Completion (30 points)
|
|
17
|
+
**Purpose:** Verify all required files were created
|
|
18
|
+
**Pass Criteria:** 100% of expected files exist
|
|
19
|
+
|
|
20
|
+
### Tier 2: Content Quality (30 points)
|
|
21
|
+
**Purpose:** Verify files have substantial content (not empty/minimal)
|
|
22
|
+
**Pass Criteria:** All files meet minimum content thresholds
|
|
23
|
+
|
|
24
|
+
### Tier 3: Content Accuracy (30 points)
|
|
25
|
+
**Purpose:** Verify content accuracy (no placeholders, valid links)
|
|
26
|
+
**Pass Criteria:** Zero placeholders, all internal links valid
|
|
27
|
+
|
|
28
|
+
### Tier 4: Excellence Bonus (10 points)
|
|
29
|
+
**Purpose:** Reward exceptional quality
|
|
30
|
+
**Pass Criteria:** Mermaid diagrams valid, comprehensive coverage
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Tier 1: File Completion Rules (30 points)
|
|
35
|
+
|
|
36
|
+
### Expected Files by Section
|
|
37
|
+
|
|
38
|
+
**Section A (Architecture & Visual):**
|
|
39
|
+
1. `docs/architecture/diagrams/mvc-flow.md` (if MVC framework)
|
|
40
|
+
2. `docs/architecture/diagrams/database-er.md` (if database exists)
|
|
41
|
+
3. `docs/architecture/diagrams/api-endpoint-map.md` (if API endpoints exist)
|
|
42
|
+
4. `docs/architecture/diagrams/component-hierarchy.md` (if frontend components exist)
|
|
43
|
+
|
|
44
|
+
**Section B (API Documentation & Guides):**
|
|
45
|
+
5. `docs/guides/getting-started.md` (required)
|
|
46
|
+
6. `docs/guides/api-development.md` (if API exists)
|
|
47
|
+
7. `docs/guides/deployment.md` (required)
|
|
48
|
+
8. `docs/guides/contributing.md` (required)
|
|
49
|
+
9. `docs/api/README.md` (if API exists)
|
|
50
|
+
|
|
51
|
+
**Section C (Configuration & Setup):**
|
|
52
|
+
10. `.env.example` (required)
|
|
53
|
+
11. `README.md` updates (verify modifications)
|
|
54
|
+
|
|
55
|
+
### Verification Logic
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
const expected_files = [
|
|
59
|
+
'docs/architecture/diagrams/mvc-flow.md',
|
|
60
|
+
'docs/architecture/diagrams/database-er.md',
|
|
61
|
+
'docs/architecture/diagrams/api-endpoint-map.md',
|
|
62
|
+
'docs/architecture/diagrams/component-hierarchy.md',
|
|
63
|
+
'docs/guides/getting-started.md',
|
|
64
|
+
'docs/guides/api-development.md',
|
|
65
|
+
'docs/guides/deployment.md',
|
|
66
|
+
'docs/guides/contributing.md',
|
|
67
|
+
'docs/api/README.md',
|
|
68
|
+
'.env.example',
|
|
69
|
+
'README.md'
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
let files_created = 0;
|
|
73
|
+
for (const file of expected_files) {
|
|
74
|
+
if (file_exists(file)) files_created++;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const tier1_score = (files_created / expected_files.length) * 30;
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Conditional Files
|
|
81
|
+
|
|
82
|
+
Some files are optional based on project type:
|
|
83
|
+
- **MVC Flow:** Only required if Express/NestJS/Fastify detected
|
|
84
|
+
- **Database ER:** Only required if Prisma/TypeORM/Mongoose detected
|
|
85
|
+
- **API Endpoint Map:** Only required if API endpoints discovered
|
|
86
|
+
- **Component Hierarchy:** Only required if React/Vue/Angular components exist
|
|
87
|
+
- **API Development Guide:** Only required if API exists
|
|
88
|
+
- **API README:** Only required if API exists
|
|
89
|
+
|
|
90
|
+
**Scoring Adjustment:**
|
|
91
|
+
```javascript
|
|
92
|
+
// If no database, remove database-er.md from expected count
|
|
93
|
+
if (!has_database) expected_files = expected_files.filter(f => !f.includes('database-er'));
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Tier 2: Content Quality Rules (30 points)
|
|
99
|
+
|
|
100
|
+
### Minimum Content Thresholds
|
|
101
|
+
|
|
102
|
+
**Diagrams (Mermaid):**
|
|
103
|
+
- Minimum 10 lines of content
|
|
104
|
+
- Must contain `\`\`\`mermaid` code block
|
|
105
|
+
- Must have diagram title and description
|
|
106
|
+
|
|
107
|
+
**Guides:**
|
|
108
|
+
- Minimum 50 lines of content
|
|
109
|
+
- Must have ## headings (structured content)
|
|
110
|
+
- Must contain code examples (at least 1 code block)
|
|
111
|
+
|
|
112
|
+
**Configuration Files:**
|
|
113
|
+
- `.env.example`: Minimum 5 environment variables
|
|
114
|
+
- `README.md`: Must have new sections added (verify diff)
|
|
115
|
+
|
|
116
|
+
### Verification Logic
|
|
117
|
+
|
|
118
|
+
```javascript
|
|
119
|
+
for (const file of created_files) {
|
|
120
|
+
const content = read_file(file);
|
|
121
|
+
const line_count = content.split('\n').length;
|
|
122
|
+
|
|
123
|
+
if (file.includes('/diagrams/')) {
|
|
124
|
+
// Diagram file
|
|
125
|
+
if (line_count < 10) {
|
|
126
|
+
deduct_points(3, `${file} too short (${line_count} lines < 10 minimum)`);
|
|
127
|
+
}
|
|
128
|
+
if (!content.includes('```mermaid')) {
|
|
129
|
+
deduct_points(5, `${file} missing Mermaid diagram`);
|
|
130
|
+
}
|
|
131
|
+
} else if (file.includes('/guides/')) {
|
|
132
|
+
// Guide file
|
|
133
|
+
if (line_count < 50) {
|
|
134
|
+
deduct_points(3, `${file} too short (${line_count} lines < 50 minimum)`);
|
|
135
|
+
}
|
|
136
|
+
if (!content.match(/##\s/)) {
|
|
137
|
+
deduct_points(2, `${file} missing structure (no ## headings)`);
|
|
138
|
+
}
|
|
139
|
+
if (!content.includes('```')) {
|
|
140
|
+
deduct_points(2, `${file} missing code examples`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Content Quality Score
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
let tier2_score = 30;
|
|
150
|
+
tier2_score -= total_deductions;
|
|
151
|
+
tier2_score = Math.max(tier2_score, 0);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Tier 3: Content Accuracy Rules (30 points)
|
|
157
|
+
|
|
158
|
+
### Rule 1: Zero Placeholders (20 points)
|
|
159
|
+
|
|
160
|
+
**Forbidden Content:**
|
|
161
|
+
- `{{VARIABLE_NAME}}` - Unreplaced template variables
|
|
162
|
+
- `[TODO]` - Incomplete sections
|
|
163
|
+
- `[PLACEHOLDER]` - Temporary content
|
|
164
|
+
- `Lorem ipsum` - Demo text
|
|
165
|
+
- `FIXME` - Known issues
|
|
166
|
+
|
|
167
|
+
**Detection:**
|
|
168
|
+
```javascript
|
|
169
|
+
const forbidden_patterns = [
|
|
170
|
+
/{{[A-Z_]+}}/g,
|
|
171
|
+
/\[TODO\]/gi,
|
|
172
|
+
/\[PLACEHOLDER\]/gi,
|
|
173
|
+
/lorem ipsum/gi,
|
|
174
|
+
/FIXME/gi
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
let placeholder_count = 0;
|
|
178
|
+
for (const file of created_files) {
|
|
179
|
+
const content = read_file(file);
|
|
180
|
+
for (const pattern of forbidden_patterns) {
|
|
181
|
+
const matches = content.match(pattern);
|
|
182
|
+
if (matches) placeholder_count += matches.length;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const placeholder_penalty = Math.min(placeholder_count * 2, 20);
|
|
187
|
+
tier3_score -= placeholder_penalty;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Penalty:** -2 points per placeholder (max -20 points)
|
|
191
|
+
|
|
192
|
+
### Rule 2: Valid Internal Links (10 points)
|
|
193
|
+
|
|
194
|
+
**Check:** All internal links resolve to existing files
|
|
195
|
+
|
|
196
|
+
```javascript
|
|
197
|
+
// Find all Markdown links: [text](path)
|
|
198
|
+
const link_pattern = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
199
|
+
|
|
200
|
+
let broken_links = 0;
|
|
201
|
+
for (const file of created_files) {
|
|
202
|
+
const content = read_file(file);
|
|
203
|
+
const links = [...content.matchAll(link_pattern)];
|
|
204
|
+
|
|
205
|
+
for (const link of links) {
|
|
206
|
+
const href = link[2];
|
|
207
|
+
if (!href.startsWith('http')) {
|
|
208
|
+
// Internal link - verify file exists
|
|
209
|
+
if (!file_exists(resolve_path(file, href))) {
|
|
210
|
+
broken_links++;
|
|
211
|
+
LOG(`⚠️ Broken link in ${file}: ${href}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const link_penalty = Math.min(broken_links * 2, 10);
|
|
218
|
+
tier3_score -= link_penalty;
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Penalty:** -2 points per broken link (max -10 points)
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Tier 4: Excellence Bonus (10 points)
|
|
226
|
+
|
|
227
|
+
### Bonus 1: Valid Mermaid Syntax (+3 points)
|
|
228
|
+
|
|
229
|
+
**Check:** All Mermaid diagrams are syntactically valid
|
|
230
|
+
|
|
231
|
+
```javascript
|
|
232
|
+
for (const diagram_file of diagram_files) {
|
|
233
|
+
const content = read_file(diagram_file);
|
|
234
|
+
const mermaid_blocks = extract_code_blocks(content, 'mermaid');
|
|
235
|
+
|
|
236
|
+
for (const block of mermaid_blocks) {
|
|
237
|
+
if (is_valid_mermaid(block)) {
|
|
238
|
+
bonus_points += 0.5;
|
|
239
|
+
} else {
|
|
240
|
+
LOG(`⚠️ Invalid Mermaid syntax in ${diagram_file}`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
bonus_points = Math.min(bonus_points, 3);
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Bonus 2: Comprehensive API Coverage (+3 points)
|
|
249
|
+
|
|
250
|
+
**Check:** API documentation covers all discovered endpoints
|
|
251
|
+
|
|
252
|
+
```javascript
|
|
253
|
+
const discovered_endpoints = get_endpoint_count_from_juno();
|
|
254
|
+
const documented_endpoints = count_endpoints_in_api_docs();
|
|
255
|
+
|
|
256
|
+
const coverage_ratio = documented_endpoints / discovered_endpoints;
|
|
257
|
+
if (coverage_ratio >= 0.9) bonus_points += 3; // ≥90% coverage
|
|
258
|
+
else if (coverage_ratio >= 0.75) bonus_points += 2; // ≥75% coverage
|
|
259
|
+
else if (coverage_ratio >= 0.5) bonus_points += 1; // ≥50% coverage
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Bonus 3: Complete Environment Variables (+2 points)
|
|
263
|
+
|
|
264
|
+
**Check:** `.env.example` documents all discovered variables
|
|
265
|
+
|
|
266
|
+
```javascript
|
|
267
|
+
const discovered_vars = get_env_vars_from_juno();
|
|
268
|
+
const documented_vars = parse_env_example('.env.example');
|
|
269
|
+
|
|
270
|
+
const var_coverage = documented_vars.length / discovered_vars.length;
|
|
271
|
+
if (var_coverage >= 1.0) bonus_points += 2; // 100% coverage
|
|
272
|
+
else if (var_coverage >= 0.8) bonus_points += 1; // ≥80% coverage
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Bonus 4: Rich Code Examples (+2 points)
|
|
276
|
+
|
|
277
|
+
**Check:** Guides contain diverse, realistic code examples
|
|
278
|
+
|
|
279
|
+
```javascript
|
|
280
|
+
for (const guide_file of guide_files) {
|
|
281
|
+
const content = read_file(guide_file);
|
|
282
|
+
const code_blocks = extract_code_blocks(content);
|
|
283
|
+
|
|
284
|
+
if (code_blocks.length >= 3) bonus_points += 0.5;
|
|
285
|
+
if (code_blocks.some(b => b.length > 100)) bonus_points += 0.5; // Substantial examples
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
bonus_points = Math.min(bonus_points, 2);
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Quality Score Calculation
|
|
294
|
+
|
|
295
|
+
### Final Score Formula
|
|
296
|
+
|
|
297
|
+
```javascript
|
|
298
|
+
let quality_score = 0;
|
|
299
|
+
|
|
300
|
+
// Tier 1: File Completion (0-30 points)
|
|
301
|
+
quality_score += tier1_score;
|
|
302
|
+
|
|
303
|
+
// Tier 2: Content Quality (0-30 points)
|
|
304
|
+
quality_score += tier2_score;
|
|
305
|
+
|
|
306
|
+
// Tier 3: Content Accuracy (0-30 points)
|
|
307
|
+
quality_score += tier3_score;
|
|
308
|
+
|
|
309
|
+
// Tier 4: Excellence Bonus (0-10 points)
|
|
310
|
+
quality_score += tier4_bonus;
|
|
311
|
+
|
|
312
|
+
// Clamp to 0-100 range
|
|
313
|
+
quality_score = Math.max(0, Math.min(100, quality_score));
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Quality Grades
|
|
317
|
+
|
|
318
|
+
- **100:** Perfect - All files, zero issues, excellent quality
|
|
319
|
+
- **95-99:** Excellent - Minor deductions only
|
|
320
|
+
- **90-94:** Very Good - High quality with few issues
|
|
321
|
+
- **85-89:** Good - Acceptable quality, some improvements possible
|
|
322
|
+
- **80-84:** Acceptable - Meets basic standards
|
|
323
|
+
- **70-79:** Fair - Significant issues, manual review recommended
|
|
324
|
+
- **<70:** Poor - Does not meet quality standards
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Verification Output Format
|
|
329
|
+
|
|
330
|
+
### Detailed Report
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
=== PHASE 3: DOCUMENTATION VERIFICATION ===
|
|
334
|
+
|
|
335
|
+
Tier 1: File Completion
|
|
336
|
+
✅ Expected files: 11/11 created (100%)
|
|
337
|
+
Score: 30/30 points
|
|
338
|
+
|
|
339
|
+
Tier 2: Content Quality
|
|
340
|
+
✅ Diagram files: 4/4 meet minimum length
|
|
341
|
+
✅ Guide files: 5/5 have proper structure
|
|
342
|
+
⚠️ Code examples: 4/5 guides have examples (-2 points)
|
|
343
|
+
Score: 28/30 points
|
|
344
|
+
|
|
345
|
+
Tier 3: Content Accuracy
|
|
346
|
+
✅ Placeholders: 0 found
|
|
347
|
+
✅ Internal links: 23/23 valid
|
|
348
|
+
Score: 30/30 points
|
|
349
|
+
|
|
350
|
+
Tier 4: Excellence Bonus
|
|
351
|
+
✅ Mermaid syntax: All diagrams valid (+3 points)
|
|
352
|
+
✅ API coverage: 15/15 endpoints documented (+3 points)
|
|
353
|
+
✅ Environment variables: 12/12 documented (+2 points)
|
|
354
|
+
⚠️ Code examples: Average quality (+1 point)
|
|
355
|
+
Score: 9/10 points
|
|
356
|
+
|
|
357
|
+
=== FINAL QUALITY SCORE: 97/100 (Excellent) ===
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Pass/Fail Determination
|
|
361
|
+
|
|
362
|
+
**Command Success Criteria:**
|
|
363
|
+
- Quality score ≥70 (Acceptable or better)
|
|
364
|
+
- Tier 1 score ≥20/30 (≥67% files created)
|
|
365
|
+
- Zero CRITICAL placeholders ({{VARIABLE}} in titles/headers)
|
|
366
|
+
|
|
367
|
+
**If score <70:**
|
|
368
|
+
```
|
|
369
|
+
❌ VERIFICATION FAILED
|
|
370
|
+
Quality score: 68/100 (Fair)
|
|
371
|
+
Issues:
|
|
372
|
+
- 2 files missing (Tier 1: -6 points)
|
|
373
|
+
- 3 placeholders found (Tier 3: -6 points)
|
|
374
|
+
- 5 broken links (Tier 3: -10 points)
|
|
375
|
+
|
|
376
|
+
Recommendation: Review APO outputs and re-generate documentation.
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
package/dist/templates/trinity/templates/documentation/validation/juno-quality-gates.md.template
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# JUNO Quality Gates
|
|
2
|
+
**Category:** Validation
|
|
3
|
+
**Purpose:** Define quality gate criteria for JUNO audit report validation
|
|
4
|
+
**Used By:** JUNO (Phase 1), Phase 3 Verification
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This template defines the quality gates JUNO uses to validate documentation audit reports before APO execution begins.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Quality Gate Levels
|
|
15
|
+
|
|
16
|
+
### CRITICAL (Abort Execution)
|
|
17
|
+
- **Trigger:** Missing required sections
|
|
18
|
+
- **Action:** Abort command, report failure to user
|
|
19
|
+
- **Examples:**
|
|
20
|
+
- JUNO report file doesn't exist
|
|
21
|
+
- Report is empty or <100 bytes
|
|
22
|
+
- Required template variables completely missing
|
|
23
|
+
|
|
24
|
+
### HIGH (Set Incomplete Flag)
|
|
25
|
+
- **Trigger:** Incomplete but present sections
|
|
26
|
+
- **Action:** Set `global.trinity_docs_session.juno_incomplete = true`, activate APO fallback
|
|
27
|
+
- **Examples:**
|
|
28
|
+
- Section A/B/C present but contains placeholders
|
|
29
|
+
- Variable values are empty strings
|
|
30
|
+
- Component list or endpoint list is empty
|
|
31
|
+
|
|
32
|
+
### MEDIUM (Warning Only)
|
|
33
|
+
- **Trigger:** Minor quality issues
|
|
34
|
+
- **Action:** Log warning, continue with APO execution
|
|
35
|
+
- **Examples:**
|
|
36
|
+
- Optional fields missing
|
|
37
|
+
- Formatting inconsistencies
|
|
38
|
+
- Timestamps missing
|
|
39
|
+
|
|
40
|
+
### LOW (Informational)
|
|
41
|
+
- **Trigger:** Suggestions for improvement
|
|
42
|
+
- **Action:** Log info message only
|
|
43
|
+
- **Examples:**
|
|
44
|
+
- Additional frameworks detected
|
|
45
|
+
- Large component counts (>50)
|
|
46
|
+
- Missing optional metadata
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Quality Gate Checks
|
|
51
|
+
|
|
52
|
+
### Gate 1: Report Existence
|
|
53
|
+
|
|
54
|
+
**Check:** JUNO report file exists in session state
|
|
55
|
+
```javascript
|
|
56
|
+
if (!global.trinity_docs_session.audit_report) {
|
|
57
|
+
ERROR: "CRITICAL - JUNO audit report missing";
|
|
58
|
+
ABORT_COMMAND();
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Pass Criteria:** Report object exists in global state
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### Gate 2: Report Size Validation
|
|
67
|
+
|
|
68
|
+
**Check:** Report has minimum required content
|
|
69
|
+
```javascript
|
|
70
|
+
const report_json = JSON.stringify(global.trinity_docs_session.audit_report);
|
|
71
|
+
if (report_json.length < 500) {
|
|
72
|
+
ERROR: "CRITICAL - JUNO report too small, likely incomplete";
|
|
73
|
+
ABORT_COMMAND();
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Pass Criteria:** Report JSON representation ≥500 characters
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### Gate 3: Section Completeness
|
|
82
|
+
|
|
83
|
+
**Check:** All three sections (A, B, C) present
|
|
84
|
+
|
|
85
|
+
**Required Sections:**
|
|
86
|
+
- **Section A:** Architecture & Visual Documentation
|
|
87
|
+
- **Section B:** API Documentation & Development Guides
|
|
88
|
+
- **Section C:** Configuration & Setup Documentation
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
if (!report.section_a || !report.section_b || !report.section_c) {
|
|
92
|
+
ERROR: "CRITICAL - Missing required sections";
|
|
93
|
+
ABORT_COMMAND();
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Pass Criteria:** All 3 sections exist as objects
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### Gate 4: Template Variable Validation
|
|
102
|
+
|
|
103
|
+
**Check:** Required template variables are populated
|
|
104
|
+
|
|
105
|
+
**Critical Variables (Section A):**
|
|
106
|
+
- `{{PROJECT_NAME}}` - Must not be empty
|
|
107
|
+
- `{{ARCHITECTURE_TYPE}}` - Must not be "Unknown"
|
|
108
|
+
- `{{DATABASE}}` or `{{DATABASE_SCHEMA}}` - At least one must exist
|
|
109
|
+
|
|
110
|
+
**Critical Variables (Section B):**
|
|
111
|
+
- `{{API_ENDPOINTS}}` or `{{FRAMEWORK}}` - At least one must exist
|
|
112
|
+
- `{{DEPLOYMENT_INSTRUCTIONS}}` - Should be present
|
|
113
|
+
|
|
114
|
+
**Critical Variables (Section C):**
|
|
115
|
+
- `{{ENV_VARIABLES}}` - Can be empty but must exist as field
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
// Example validation logic
|
|
119
|
+
const missing_critical = [];
|
|
120
|
+
if (!report.variables.PROJECT_NAME) missing_critical.push('PROJECT_NAME');
|
|
121
|
+
if (!report.variables.ARCHITECTURE_TYPE) missing_critical.push('ARCHITECTURE_TYPE');
|
|
122
|
+
|
|
123
|
+
if (missing_critical.length > 0) {
|
|
124
|
+
WARNING: `HIGH - Critical variables missing: ${missing_critical.join(', ')}`;
|
|
125
|
+
global.trinity_docs_session.juno_incomplete = true;
|
|
126
|
+
global.trinity_docs_session.juno_issues.push({
|
|
127
|
+
severity: 'HIGH',
|
|
128
|
+
variables: missing_critical
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Pass Criteria (CRITICAL):** PROJECT_NAME exists
|
|
134
|
+
**Pass Criteria (HIGH):** At least 70% of expected variables populated
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### Gate 5: Placeholder Detection
|
|
139
|
+
|
|
140
|
+
**Check:** Report doesn't contain placeholder values
|
|
141
|
+
|
|
142
|
+
**Forbidden Placeholders:**
|
|
143
|
+
- `"[TODO]"`
|
|
144
|
+
- `"[PLACEHOLDER]"`
|
|
145
|
+
- `"Unknown"`
|
|
146
|
+
- `"N/A"` (in critical fields)
|
|
147
|
+
- Empty strings for required fields
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
const report_str = JSON.stringify(report);
|
|
151
|
+
const placeholders = [
|
|
152
|
+
/\[TODO\]/gi,
|
|
153
|
+
/\[PLACEHOLDER\]/gi,
|
|
154
|
+
/{{[A-Z_]+}}/g // Unreplaced template variables
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
placeholders.forEach(pattern => {
|
|
158
|
+
if (pattern.test(report_str)) {
|
|
159
|
+
WARNING: `HIGH - Placeholder detected in JUNO report: ${pattern}`;
|
|
160
|
+
global.trinity_docs_session.juno_incomplete = true;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Pass Criteria:** Zero placeholders in critical sections
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### Gate 6: Component Verification
|
|
170
|
+
|
|
171
|
+
**Check:** All listed components exist in codebase
|
|
172
|
+
|
|
173
|
+
```javascript
|
|
174
|
+
// For each component in report.section_a.components
|
|
175
|
+
for (const component of report.section_a.components) {
|
|
176
|
+
const files = Glob(component.glob_pattern);
|
|
177
|
+
if (files.length === 0) {
|
|
178
|
+
ERROR: `CRITICAL - Component ${component.name} not found in codebase`;
|
|
179
|
+
ABORT_COMMAND();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Pass Criteria:** 100% of listed components verified via Glob
|
|
185
|
+
**Note:** This is ZERO TOLERANCE - fake components cause abort
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Quality Score Calculation
|
|
190
|
+
|
|
191
|
+
### Score Formula
|
|
192
|
+
|
|
193
|
+
```javascript
|
|
194
|
+
let score = 100;
|
|
195
|
+
|
|
196
|
+
// Deductions
|
|
197
|
+
if (juno_incomplete) score -= 15;
|
|
198
|
+
if (placeholders_found > 0) score -= (placeholders_found * 5);
|
|
199
|
+
if (missing_variables > 3) score -= ((missing_variables - 3) * 3);
|
|
200
|
+
if (section_quality < 70) score -= (70 - section_quality);
|
|
201
|
+
|
|
202
|
+
// Minimum score
|
|
203
|
+
score = Math.max(score, 0);
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Score Thresholds
|
|
207
|
+
|
|
208
|
+
- **100:** Perfect - All gates passed, zero issues
|
|
209
|
+
- **95-99:** Excellent - Minor warnings only
|
|
210
|
+
- **85-94:** Good - APO fallback will handle gaps
|
|
211
|
+
- **70-84:** Acceptable - Significant fallback usage expected
|
|
212
|
+
- **<70:** Poor - Consider manual JUNO report review
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Validation Output Format
|
|
217
|
+
|
|
218
|
+
### On Success (Score ≥85)
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
✅ JUNO Quality Gates: PASSED
|
|
222
|
+
- Report existence: ✅
|
|
223
|
+
- Section completeness: ✅
|
|
224
|
+
- Template variables: ✅ (42/45 populated)
|
|
225
|
+
- Placeholder detection: ✅ (0 found)
|
|
226
|
+
- Component verification: ✅ (15/15 verified)
|
|
227
|
+
|
|
228
|
+
Quality Score: 97/100 (Excellent)
|
|
229
|
+
Proceeding to APO execution...
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### On Incomplete (Score 70-84)
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
⚠️ JUNO Quality Gates: INCOMPLETE
|
|
236
|
+
- Report existence: ✅
|
|
237
|
+
- Section completeness: ✅
|
|
238
|
+
- Template variables: ⚠️ (38/45 populated)
|
|
239
|
+
- Placeholder detection: ⚠️ (2 placeholders found)
|
|
240
|
+
- Component verification: ✅
|
|
241
|
+
|
|
242
|
+
Quality Score: 82/100 (Good)
|
|
243
|
+
Status: juno_incomplete = true
|
|
244
|
+
APO agents will use fallback mechanisms for missing data.
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### On Failure (Score <70 or CRITICAL error)
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
❌ JUNO Quality Gates: FAILED
|
|
251
|
+
- Report existence: ❌ (Report missing)
|
|
252
|
+
|
|
253
|
+
Quality Score: 0/100
|
|
254
|
+
ABORTING COMMAND - Fix JUNO audit issues and retry.
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Error Handling
|
|
260
|
+
|
|
261
|
+
**CRITICAL Errors (Abort):**
|
|
262
|
+
- Report doesn't exist
|
|
263
|
+
- Report size <500 bytes
|
|
264
|
+
- Missing all 3 sections
|
|
265
|
+
- Zero components verified (when components expected)
|
|
266
|
+
|
|
267
|
+
**HIGH Errors (Fallback):**
|
|
268
|
+
- >30% variables missing
|
|
269
|
+
- >5 placeholders found
|
|
270
|
+
- Section quality <50%
|
|
271
|
+
|
|
272
|
+
**MEDIUM Warnings (Continue):**
|
|
273
|
+
- <30% variables missing
|
|
274
|
+
- 1-5 placeholders in non-critical sections
|
|
275
|
+
- Formatting inconsistencies
|
|
276
|
+
|
|
277
|
+
**LOW Info (Log only):**
|
|
278
|
+
- Optional fields missing
|
|
279
|
+
- Extra frameworks detected
|
|
280
|
+
- Large data counts
|
|
281
|
+
|
|
282
|
+
---
|