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,1337 @@
|
|
|
1
|
+
# JUNO Documentation Update Checklist
|
|
2
|
+
|
|
3
|
+
**Purpose:** Comprehensive audit checklist for trinity-docs-update command
|
|
4
|
+
**Agent:** JUNO (Quality Auditor)
|
|
5
|
+
**Output:** Audit report saved to `.claude/trinity/reports/DOCS-UPDATE-AUDIT-{{DATE}}.md`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Instructions
|
|
10
|
+
|
|
11
|
+
This checklist contains ALL instructions for performing the Phase 1 audit. Follow each step in order.
|
|
12
|
+
|
|
13
|
+
At the end, generate a complete audit report with APO work assignments (APO-1, APO-2, APO-3 checklists).
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Step 1.1: Scan Existing Documentation
|
|
18
|
+
|
|
19
|
+
**Scan `docs/` directory recursively:**
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
find docs/ -type f -name "*.md" | sort
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Catalog all documentation files:**
|
|
26
|
+
- Architecture documentation (e.g., `docs/architecture/`, `docs/system-design/`)
|
|
27
|
+
- API documentation (e.g., `docs/api/`, `docs/endpoints/`)
|
|
28
|
+
- Guides and tutorials (e.g., `docs/guides/`, `docs/tutorials/`)
|
|
29
|
+
- Configuration documentation (e.g., `docs/configuration/`, `docs/setup/`)
|
|
30
|
+
- Component documentation (e.g., `docs/components/`, `docs/modules/`)
|
|
31
|
+
|
|
32
|
+
**For each file, analyze:**
|
|
33
|
+
- **Content type:** Architecture, API, guide, tutorial, reference, configuration
|
|
34
|
+
- **Accuracy:** Does content match codebase reality?
|
|
35
|
+
- **Completeness:** Are there gaps or missing information?
|
|
36
|
+
- **Staleness:** Does it reference outdated code, APIs, or structures?
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Step 1.2: Scan Codebase for Business Logic
|
|
41
|
+
|
|
42
|
+
**ALL-LEVEL GRANULARITY REQUIRED:**
|
|
43
|
+
- **Architecture Level:** System design, project structure, major components
|
|
44
|
+
- **Module Level:** Services, controllers, models, utilities, middleware
|
|
45
|
+
- **Function Level:** Individual functions, methods, APIs, endpoints
|
|
46
|
+
|
|
47
|
+
### Database Schema Discovery (If Database Present):
|
|
48
|
+
|
|
49
|
+
**STEP 1: DETECT IF PROJECT HAS A DATABASE**
|
|
50
|
+
|
|
51
|
+
**YOU MUST run this detection command FIRST:**
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Detect database presence
|
|
55
|
+
DB_DETECTED=false
|
|
56
|
+
|
|
57
|
+
# Check for database files/indicators
|
|
58
|
+
if [ -f "database/init.sql" ] || \
|
|
59
|
+
[ -f "database/schema.sql" ] || \
|
|
60
|
+
[ -f "prisma/schema.prisma" ] || \
|
|
61
|
+
[ -d "migrations" ] || \
|
|
62
|
+
[ -d "database/migrations" ] || \
|
|
63
|
+
grep -rq "DATABASE_URL" .env* 2>/dev/null || \
|
|
64
|
+
grep -rq "createConnection\|Pool\|Sequelize\|mongoose.connect" backend/ src/ 2>/dev/null; then
|
|
65
|
+
DB_DETECTED=true
|
|
66
|
+
echo "✅ DATABASE DETECTED - Production database verification REQUIRED"
|
|
67
|
+
else
|
|
68
|
+
DB_DETECTED=false
|
|
69
|
+
echo "ℹ️ NO DATABASE DETECTED - Skipping database verification"
|
|
70
|
+
fi
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Record the result in your audit report:**
|
|
74
|
+
- Database detected: YES / NO
|
|
75
|
+
- If NO: Skip to Step 1.2 (no database verification needed)
|
|
76
|
+
- If YES: YOU MUST PROCEED TO STEP 2 BELOW
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
**STEP 2: MANDATORY PRODUCTION DATABASE CONNECTION ATTEMPT (Only if database detected)**
|
|
81
|
+
|
|
82
|
+
**CRITICAL: If you detected a database in STEP 1, you MUST attempt production database connection.**
|
|
83
|
+
|
|
84
|
+
**YOU CANNOT SKIP THIS STEP. YOU MUST DOCUMENT YOUR CONNECTION ATTEMPT.**
|
|
85
|
+
|
|
86
|
+
**Discovery Priority Order:**
|
|
87
|
+
|
|
88
|
+
1. **PRIMARY SOURCE: Production Database (Live Connection) - MANDATORY FIRST ATTEMPT**
|
|
89
|
+
|
|
90
|
+
**Step 1: Look for database connection information:**
|
|
91
|
+
|
|
92
|
+
YOU MUST check ALL of these locations:
|
|
93
|
+
- [ ] `.env` file for DATABASE_URL or DB_* variables
|
|
94
|
+
- [ ] `.env.local` for local database config
|
|
95
|
+
- [ ] `docker-compose.yml` for database service configuration
|
|
96
|
+
- [ ] Application config files (config/database.js, database.config.ts, etc.)
|
|
97
|
+
- [ ] README.md for database setup instructions
|
|
98
|
+
|
|
99
|
+
**Document what you found:**
|
|
100
|
+
```markdown
|
|
101
|
+
Database Connection Info Search:
|
|
102
|
+
- .env: [FOUND/NOT FOUND] [if found: what variables?]
|
|
103
|
+
- docker-compose.yml: [FOUND/NOT FOUND] [if found: service name?]
|
|
104
|
+
- Config files: [FOUND/NOT FOUND] [if found: which file?]
|
|
105
|
+
- README: [CHECKED] [any connection instructions?]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Step 2: Attempt connection with discovered credentials:**
|
|
109
|
+
|
|
110
|
+
**YOU MUST EXECUTE AT LEAST ONE CONNECTION COMMAND:**
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# PostgreSQL example
|
|
114
|
+
psql -h <host> -U <user> -d <database> -c "\dt" # List tables
|
|
115
|
+
psql -h <host> -U <user> -d <database> -c "\d+ table_name" # Describe table
|
|
116
|
+
|
|
117
|
+
# MySQL example
|
|
118
|
+
mysql -h <host> -u <user> -p -D <database> -e "SHOW TABLES;"
|
|
119
|
+
mysql -h <host> -u <user> -p -D <database> -e "DESCRIBE table_name;"
|
|
120
|
+
|
|
121
|
+
# SQLite example (check for .db or .sqlite files)
|
|
122
|
+
find . -name "*.db" -o -name "*.sqlite" 2>/dev/null
|
|
123
|
+
sqlite3 database.db ".schema"
|
|
124
|
+
|
|
125
|
+
# Via Docker (if database is containerized)
|
|
126
|
+
docker ps # Check if database container is running
|
|
127
|
+
docker exec <container_name> psql -U <user> -d <database> -c "\dt"
|
|
128
|
+
docker exec <container_name> psql -U <user> -d <database> -c "\d+ table_name"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Step 3: Document your connection attempt result:**
|
|
132
|
+
|
|
133
|
+
**YOU MUST include this section in your audit report:**
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
## Database Verification
|
|
137
|
+
|
|
138
|
+
**Database Detected:** YES
|
|
139
|
+
|
|
140
|
+
**Connection Attempt:**
|
|
141
|
+
- Method attempted: [psql / mysql / sqlite3 / docker exec / other]
|
|
142
|
+
- Command executed: [exact command]
|
|
143
|
+
- Result: [SUCCESS / FAILED]
|
|
144
|
+
- If failed, error message: [exact error]
|
|
145
|
+
- If failed, reason: [database not running / credentials not found / network issue / etc.]
|
|
146
|
+
|
|
147
|
+
**Schema Data Source:** [Production Database / Schema Files (fallback)]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**If connection SUCCEEDED:**
|
|
151
|
+
- Extract: Exact table names, column names and types, constraints, indexes, relationships
|
|
152
|
+
- Mark in audit: "✅ Database schema verified (production database via [method])"
|
|
153
|
+
- Proceed to record schema in audit report
|
|
154
|
+
|
|
155
|
+
**If connection FAILED:**
|
|
156
|
+
- Document the failure reason
|
|
157
|
+
- Mark in audit: "❌ Production database connection failed: [reason]"
|
|
158
|
+
- **ONLY THEN proceed to option 2 (schema files)**
|
|
159
|
+
|
|
160
|
+
2. **SECONDARY SOURCE: Schema Files (ONLY if production database connection failed)**
|
|
161
|
+
|
|
162
|
+
**You may ONLY use this option if you:**
|
|
163
|
+
- ✅ Detected a database in STEP 1
|
|
164
|
+
- ✅ Attempted connection in STEP 2
|
|
165
|
+
- ✅ Documented the connection failure
|
|
166
|
+
- ✅ Recorded the failure reason
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Check for schema files (SQL, migration files, etc.)
|
|
170
|
+
find . -name "*.sql" -o -name "schema.prisma" -o -name "*migration*" 2>/dev/null
|
|
171
|
+
|
|
172
|
+
# Common locations:
|
|
173
|
+
# - database/init.sql
|
|
174
|
+
# - database/schema.sql
|
|
175
|
+
# - migrations/*.sql
|
|
176
|
+
# - prisma/schema.prisma
|
|
177
|
+
# - db/schema.rb (Rails)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Read schema files:**
|
|
181
|
+
- Parse CREATE TABLE statements for exact field names and types
|
|
182
|
+
- Note constraints, indexes, relationships
|
|
183
|
+
- Record schema version if documented
|
|
184
|
+
- **CRITICAL:** Mark as "⚠️ FROM SCHEMA FILES - production database not accessible - may be outdated"
|
|
185
|
+
- Reference the connection failure reason from STEP 2
|
|
186
|
+
|
|
187
|
+
3. **TERTIARY SOURCE: Existing Documentation (Last resort only)**
|
|
188
|
+
- Use docs/architecture/database-er.md as fallback ONLY if:
|
|
189
|
+
- Production database is inaccessible (connection failed)
|
|
190
|
+
- No schema files found in codebase
|
|
191
|
+
- Schema files exist but are unreadable
|
|
192
|
+
- Mark as "⚠️ UNVERIFIED - based on existing documentation only (production DB inaccessible, no schema files found)"
|
|
193
|
+
|
|
194
|
+
**CRITICAL CHECKLIST - VERIFY YOU COMPLETED ALL STEPS:**
|
|
195
|
+
|
|
196
|
+
Before moving to Step 1.3, verify:
|
|
197
|
+
- [ ] Ran database detection bash command
|
|
198
|
+
- [ ] Documented database detection result in audit
|
|
199
|
+
- [ ] If database detected: Searched for connection info in .env, docker-compose.yml, config files
|
|
200
|
+
- [ ] If database detected: Documented what connection info was found
|
|
201
|
+
- [ ] If database detected: Executed at least ONE connection attempt command
|
|
202
|
+
- [ ] If database detected: Documented connection attempt result (success/failure with reason)
|
|
203
|
+
- [ ] Included "Database Verification" section in audit report
|
|
204
|
+
- [ ] Recorded schema data source used (production DB / schema files / docs)
|
|
205
|
+
|
|
206
|
+
**If you cannot check ALL boxes above and a database was detected, you MUST go back and complete the missing steps.**
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
**Record in audit (MANDATORY section if database detected):**
|
|
211
|
+
|
|
212
|
+
```markdown
|
|
213
|
+
## Database Verification
|
|
214
|
+
|
|
215
|
+
**Database Detected:** [YES/NO]
|
|
216
|
+
|
|
217
|
+
**If YES, connection attempt REQUIRED:**
|
|
218
|
+
- Connection info search: [results from .env, docker-compose.yml, etc.]
|
|
219
|
+
- Connection method attempted: [psql / mysql / docker exec / etc.]
|
|
220
|
+
- Connection command executed: [exact command]
|
|
221
|
+
- Connection result: [SUCCESS / FAILED: reason]
|
|
222
|
+
- Schema data source: [Production Database / Schema Files (fallback) / Documentation (last resort)]
|
|
223
|
+
|
|
224
|
+
**Schema Information:**
|
|
225
|
+
- Source of schema information: [PRIMARY: Production DB / SECONDARY: Schema files / TERTIARY: Documentation]
|
|
226
|
+
- Exact table names: [list]
|
|
227
|
+
- Exact column names and types: [per table]
|
|
228
|
+
- Constraints, indexes, relationships: [describe]
|
|
229
|
+
- Schema version (if available): [version]
|
|
230
|
+
- Any discrepancies found between sources: [list]
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**CRITICAL: Schema Synchronization Requirement**
|
|
234
|
+
|
|
235
|
+
**If production database schema differs from init.sql (or other schema files):**
|
|
236
|
+
- ✅ Production database is the SOURCE OF TRUTH
|
|
237
|
+
- ✅ Include init.sql update in the APO checklist (to be executed in Phase 2)
|
|
238
|
+
- ✅ Flag this discrepancy in the audit report under APO work assignments
|
|
239
|
+
- ✅ Document both the current init.sql state and required changes
|
|
240
|
+
- ❌ DO NOT assume init.sql is correct if it conflicts with production database
|
|
241
|
+
|
|
242
|
+
**Example checklist item for schema file sync:**
|
|
243
|
+
```markdown
|
|
244
|
+
- [ ] `database/init.sql`
|
|
245
|
+
- Issue: Schema file outdated - missing `dealers` table and updated `equipment_items` columns
|
|
246
|
+
- Required: Update init.sql to match production database schema exactly
|
|
247
|
+
- Source: Production database (verified via psql connection)
|
|
248
|
+
- Priority: HIGH
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Business Logic Detection Patterns:
|
|
252
|
+
|
|
253
|
+
**Directory Patterns (varies by framework):**
|
|
254
|
+
```
|
|
255
|
+
Common patterns across frameworks:
|
|
256
|
+
- controllers/, routes/, handlers/ (Request handling)
|
|
257
|
+
- services/, business/, domain/ (Business logic)
|
|
258
|
+
- models/, entities/, schemas/ (Data models)
|
|
259
|
+
- repositories/, data-access/, dao/ (Data layer)
|
|
260
|
+
- middleware/, interceptors/, guards/ (Request processing)
|
|
261
|
+
- utils/, helpers/, lib/ (Utilities)
|
|
262
|
+
- config/, configuration/ (Configuration)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**File Naming Patterns:**
|
|
266
|
+
```
|
|
267
|
+
*Controller.ts, *Controller.js
|
|
268
|
+
*Service.ts, *Service.js
|
|
269
|
+
*Repository.ts, *Repository.js
|
|
270
|
+
*Model.ts, *Model.js
|
|
271
|
+
*Helper.ts, *Helper.js
|
|
272
|
+
*Util.ts, *Util.js
|
|
273
|
+
*Middleware.ts, *Middleware.js
|
|
274
|
+
*Handler.ts, *Handler.js
|
|
275
|
+
*Provider.ts, *Provider.js
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Code Structure Markers:**
|
|
279
|
+
```typescript
|
|
280
|
+
// Classes (business logic)
|
|
281
|
+
export class UserService { ... }
|
|
282
|
+
export class PaymentProcessor { ... }
|
|
283
|
+
|
|
284
|
+
// Interfaces (data contracts)
|
|
285
|
+
export interface User { ... }
|
|
286
|
+
export interface PaymentRequest { ... }
|
|
287
|
+
|
|
288
|
+
// Enums (business constants)
|
|
289
|
+
export enum OrderStatus { ... }
|
|
290
|
+
export enum PaymentMethod { ... }
|
|
291
|
+
|
|
292
|
+
// Custom functions (business rules)
|
|
293
|
+
export function calculateTax(...) { ... }
|
|
294
|
+
export function validateOrder(...) { ... }
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Framework-Specific Patterns:
|
|
298
|
+
|
|
299
|
+
**Express.js:**
|
|
300
|
+
```javascript
|
|
301
|
+
// Route handlers
|
|
302
|
+
app.get('/api/users', (req, res) => { ... })
|
|
303
|
+
router.post('/orders', orderController.create)
|
|
304
|
+
|
|
305
|
+
// Middleware
|
|
306
|
+
app.use(authMiddleware)
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**NestJS:**
|
|
310
|
+
```typescript
|
|
311
|
+
@Controller('users')
|
|
312
|
+
@Injectable()
|
|
313
|
+
@Module({ ... })
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**React/Next.js:**
|
|
317
|
+
```typescript
|
|
318
|
+
// Components
|
|
319
|
+
export function UserDashboard() { ... }
|
|
320
|
+
|
|
321
|
+
// Hooks
|
|
322
|
+
export function useAuth() { ... }
|
|
323
|
+
|
|
324
|
+
// API routes (Next.js)
|
|
325
|
+
export default function handler(req, res) { ... }
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**Django:**
|
|
329
|
+
```python
|
|
330
|
+
# Views
|
|
331
|
+
class UserViewSet(viewsets.ModelViewSet):
|
|
332
|
+
...
|
|
333
|
+
|
|
334
|
+
# Models
|
|
335
|
+
class User(models.Model):
|
|
336
|
+
...
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Ruby on Rails:**
|
|
340
|
+
```ruby
|
|
341
|
+
# Controllers
|
|
342
|
+
class UsersController < ApplicationController
|
|
343
|
+
...
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# Models
|
|
347
|
+
class User < ApplicationRecord
|
|
348
|
+
...
|
|
349
|
+
end
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### What Makes Code "Business Logic":
|
|
353
|
+
|
|
354
|
+
- **Unique to this repository:** Not generic framework boilerplate
|
|
355
|
+
- **Implements business rules:** Tax calculation, order validation, payment processing
|
|
356
|
+
- **Defines data models:** User schema, Order structure, Product catalog
|
|
357
|
+
- **Handles domain logic:** Authentication flow, authorization rules, workflow state machines
|
|
358
|
+
|
|
359
|
+
### Exclude:
|
|
360
|
+
|
|
361
|
+
- Generic framework setup (config/webpack.config.js, etc.)
|
|
362
|
+
- Node modules and dependencies
|
|
363
|
+
- Build artifacts and dist/
|
|
364
|
+
- Test fixtures and mocks (unless they define API contracts)
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Step 1.2A: Scope Boundary Enforcement
|
|
369
|
+
|
|
370
|
+
**CRITICAL: This command ONLY modifies files in the `docs/` directory.**
|
|
371
|
+
|
|
372
|
+
### Scope Rules:
|
|
373
|
+
|
|
374
|
+
1. **ALLOWED operations:**
|
|
375
|
+
- ✅ Read ANY file in project (for verification and analysis)
|
|
376
|
+
- ✅ Write files in `docs/` directory
|
|
377
|
+
- ✅ Edit files in `docs/` directory
|
|
378
|
+
- ✅ Create new files in `docs/` directory
|
|
379
|
+
|
|
380
|
+
2. **FORBIDDEN operations:**
|
|
381
|
+
- ❌ Write/Edit source code files in `src/`, `backend/`, `frontend/`, `app/` directories
|
|
382
|
+
- ❌ Modify database schemas (`database/`, `migrations/`, `*.sql`)
|
|
383
|
+
- ❌ Modify configuration (`package.json`, `tsconfig.json`, `*.config.js`)
|
|
384
|
+
- ❌ Modify build files (`Dockerfile`, `docker-compose.yml`, `.github/`)
|
|
385
|
+
- ❌ Modify test files (`*.test.js`, `*.spec.ts`)
|
|
386
|
+
- ❌ Modify any file outside `docs/` directory
|
|
387
|
+
|
|
388
|
+
**EXCEPTIONS (Simple consistency fixes only):**
|
|
389
|
+
- ✅ Fix hardcoded default values that contradict documented standards
|
|
390
|
+
- Example: Change `|| 4000` to `|| 3001` if 3001 is the documented standard
|
|
391
|
+
- ✅ Update `.env.example` template values to match documented standards
|
|
392
|
+
- ⚠️ ONLY for simple constant/default values (no logic changes)
|
|
393
|
+
- ⚠️ MUST verify against actual `.env` or running config first
|
|
394
|
+
- ⚠️ APO-1 ONLY - base documentation team handles consistency fixes
|
|
395
|
+
|
|
396
|
+
3. **Discrepancy Resolution Strategy:**
|
|
397
|
+
|
|
398
|
+
**When documentation is WRONG (doesn't match code):**
|
|
399
|
+
- ✅ Update documentation to match actual code
|
|
400
|
+
- ❌ DO NOT modify code to match documentation
|
|
401
|
+
|
|
402
|
+
**Example Scenarios:**
|
|
403
|
+
|
|
404
|
+
**Scenario A: Database Schema Mismatch**
|
|
405
|
+
```
|
|
406
|
+
Documentation: docs/architecture/database-er.md shows "dealers" table
|
|
407
|
+
Code: database/init.sql is Phase 1 schema (no dealers table)
|
|
408
|
+
Actual Runtime: Production uses Phase 2 with dealers table
|
|
409
|
+
|
|
410
|
+
❌ WRONG: Update database/init.sql to add dealers table
|
|
411
|
+
✅ RIGHT: Add note to database-er.md:
|
|
412
|
+
"Note: database/init.sql contains Phase 1 schema for backward compatibility.
|
|
413
|
+
Production database uses Phase 2 schema with dealers table as documented above."
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**Scenario B: API Endpoint Mismatch**
|
|
417
|
+
```
|
|
418
|
+
Documentation: docs/api/README.md shows GET /api/users
|
|
419
|
+
Code: backend/src/api/routes/users.js shows GET /api/v1/users
|
|
420
|
+
|
|
421
|
+
❌ WRONG: Modify routes/users.js to remove /v1 prefix
|
|
422
|
+
✅ RIGHT: Update docs/api/README.md to show GET /api/v1/users
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
**Scenario C: Configuration Default Mismatch**
|
|
426
|
+
```
|
|
427
|
+
Documentation: docs/guides/getting-started.md shows backend on port 3001
|
|
428
|
+
.env.example: Shows API_PORT=3001
|
|
429
|
+
Actual .env: Shows API_PORT=3001
|
|
430
|
+
Code Default: server.js shows `const PORT = process.env.API_PORT || 4000`
|
|
431
|
+
|
|
432
|
+
Analysis:
|
|
433
|
+
- Actual config: 3001 ✅
|
|
434
|
+
- Documentation: 3001 ✅
|
|
435
|
+
- .env.example: 3001 ✅
|
|
436
|
+
- Code default: 4000 ❌ (contradicts standard)
|
|
437
|
+
|
|
438
|
+
✅ RIGHT: Assign APO-1 to:
|
|
439
|
+
1. Verify documentation is correct (no update needed)
|
|
440
|
+
2. Fix backend/src/server.js line 8: Change `|| 4000` to `|| 3001`
|
|
441
|
+
3. Rationale: Align code default with documented standard
|
|
442
|
+
|
|
443
|
+
❌ WRONG: Update documentation to show port 4000
|
|
444
|
+
❌ WRONG: Leave discrepancy unresolved
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
4. **Pre-Write Validation:**
|
|
448
|
+
|
|
449
|
+
**Before EVERY Write or Edit operation, verify target path starts with `docs/`.**
|
|
450
|
+
|
|
451
|
+
5. **APO Assignment Restrictions:**
|
|
452
|
+
|
|
453
|
+
**JUNO must NOT assign APOs to:**
|
|
454
|
+
- Fix source code files
|
|
455
|
+
- Update database schemas
|
|
456
|
+
- Modify configuration files
|
|
457
|
+
|
|
458
|
+
**JUNO must ONLY assign APOs to:**
|
|
459
|
+
- Create documentation files in docs/
|
|
460
|
+
- Update existing documentation files in docs/
|
|
461
|
+
- Verify documentation accuracy against source code (read-only)
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## Step 1.2A: Environment Configuration Verification
|
|
466
|
+
|
|
467
|
+
**CRITICAL: Verify actual running configuration BEFORE making audit decisions.**
|
|
468
|
+
|
|
469
|
+
**ALL projects require environment configuration verification** to prevent false positives in audit findings.
|
|
470
|
+
|
|
471
|
+
### Priority 1: Check Actual Environment Files
|
|
472
|
+
|
|
473
|
+
**YOU MUST check for actual configuration files FIRST:**
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
# Priority 1: Check actual environment files
|
|
477
|
+
if [ -f ".env" ]; then
|
|
478
|
+
echo "✅ Found .env (ACTUAL CONFIG)"
|
|
479
|
+
grep -E "PORT|URL|HOST|DATABASE|API" .env 2>/dev/null || cat .env
|
|
480
|
+
elif [ -f ".env.local" ]; then
|
|
481
|
+
echo "✅ Found .env.local (ACTUAL CONFIG)"
|
|
482
|
+
grep -E "PORT|URL|HOST|DATABASE|API" .env.local 2>/dev/null || cat .env.local
|
|
483
|
+
else
|
|
484
|
+
echo "ℹ️ No actual environment files found (.env or .env.local)"
|
|
485
|
+
fi
|
|
486
|
+
|
|
487
|
+
# Priority 2: Check example/template files
|
|
488
|
+
if [ -f ".env.example" ]; then
|
|
489
|
+
echo "📋 Found .env.example (TEMPLATE)"
|
|
490
|
+
grep -E "PORT|URL|HOST|DATABASE|API" .env.example 2>/dev/null || cat .env.example
|
|
491
|
+
fi
|
|
492
|
+
|
|
493
|
+
# Priority 3: Check code for default values
|
|
494
|
+
echo "🔍 Checking code for default values..."
|
|
495
|
+
grep -rn "process.env.*||" backend/src/ src/ 2>/dev/null --include="*.js" --include="*.ts" | head -20
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### Document All Findings
|
|
499
|
+
|
|
500
|
+
**YOU MUST document what you found in your audit report:**
|
|
501
|
+
|
|
502
|
+
```markdown
|
|
503
|
+
### Environment Configuration Analysis
|
|
504
|
+
|
|
505
|
+
**Actual Config (.env or .env.local):**
|
|
506
|
+
[If found, list all relevant variables and values]
|
|
507
|
+
[If not found, state: "No actual environment files found"]
|
|
508
|
+
|
|
509
|
+
**Template Config (.env.example):**
|
|
510
|
+
[If found, list all relevant variables and values]
|
|
511
|
+
[If not found, state: "No .env.example found"]
|
|
512
|
+
|
|
513
|
+
**Code Defaults (fallback values):**
|
|
514
|
+
[List all found with format: File:Line: Variable || Default Value]
|
|
515
|
+
[If none found, state: "No code defaults found"]
|
|
516
|
+
|
|
517
|
+
**Discrepancies Found:**
|
|
518
|
+
[List any mismatches between actual config, template, and code defaults]
|
|
519
|
+
[If none, state: "No discrepancies found"]
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### Source of Truth Priority Order
|
|
523
|
+
|
|
524
|
+
**When verifying configuration values (ports, URLs, domains, etc.):**
|
|
525
|
+
|
|
526
|
+
1. **PRIMARY:** Actual running configuration
|
|
527
|
+
- Check `.env` or `.env.local` (actual config being used)
|
|
528
|
+
- Check running process/logs if available
|
|
529
|
+
|
|
530
|
+
2. **SECONDARY:** Environment template files
|
|
531
|
+
- `.env.example` (documented standard)
|
|
532
|
+
- `.env.production` (production config)
|
|
533
|
+
|
|
534
|
+
3. **TERTIARY:** Code defaults
|
|
535
|
+
- Fallback values in code (e.g., `|| 4000`)
|
|
536
|
+
|
|
537
|
+
### Resolution Rules
|
|
538
|
+
|
|
539
|
+
**CRITICAL: Apply these rules when discrepancies exist:**
|
|
540
|
+
|
|
541
|
+
1. **If `.env` exists and sets value X:**
|
|
542
|
+
- X is the correct value
|
|
543
|
+
- Documentation showing X is CORRECT
|
|
544
|
+
- Code defaults showing Y are WRONG (need fixing)
|
|
545
|
+
|
|
546
|
+
2. **If documentation matches actual config:**
|
|
547
|
+
- Documentation is CORRECT (no update needed)
|
|
548
|
+
- Assign APO to fix code if default contradicts standard
|
|
549
|
+
|
|
550
|
+
3. **If code default contradicts `.env.example` and docs:**
|
|
551
|
+
- Code default needs fixing
|
|
552
|
+
- Assign APO-1 to align code with documented standard
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
## Step 1.3: Cross-Reference Documentation with Codebase
|
|
557
|
+
|
|
558
|
+
**For each documentation file, verify:**
|
|
559
|
+
|
|
560
|
+
### Architecture-Level Verification:
|
|
561
|
+
- Does architecture diagram match actual directory structure?
|
|
562
|
+
- Are major components documented correctly?
|
|
563
|
+
- Are system boundaries accurate?
|
|
564
|
+
- Are data flows correct?
|
|
565
|
+
|
|
566
|
+
### Module-Level Verification:
|
|
567
|
+
- Does API documentation match actual API routes/endpoints?
|
|
568
|
+
- Are service responsibilities accurately described?
|
|
569
|
+
- Are controller actions documented correctly?
|
|
570
|
+
- Are model schemas up-to-date?
|
|
571
|
+
|
|
572
|
+
### Function-Level Verification:
|
|
573
|
+
- Do function signatures match documentation?
|
|
574
|
+
- Are parameters documented correctly?
|
|
575
|
+
- Are return types accurate?
|
|
576
|
+
- Are error cases covered?
|
|
577
|
+
- Are edge cases documented?
|
|
578
|
+
|
|
579
|
+
### Example Cross-Reference:
|
|
580
|
+
|
|
581
|
+
```typescript
|
|
582
|
+
// CODE: src/services/payment.service.ts
|
|
583
|
+
export class PaymentService {
|
|
584
|
+
async processPayment(
|
|
585
|
+
orderId: string,
|
|
586
|
+
amount: number,
|
|
587
|
+
method: PaymentMethod
|
|
588
|
+
): Promise<PaymentResult> {
|
|
589
|
+
// Implementation
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// DOCS: docs/api/payment.md
|
|
594
|
+
Should document:
|
|
595
|
+
✅ Function name: processPayment
|
|
596
|
+
✅ Parameters: orderId (string), amount (number), method (PaymentMethod)
|
|
597
|
+
✅ Return type: Promise<PaymentResult>
|
|
598
|
+
✅ Behavior: Processes payment for given order
|
|
599
|
+
✅ Error cases: InvalidAmount, PaymentDeclined, NetworkError
|
|
600
|
+
|
|
601
|
+
If docs say processPayment takes (userId, amount) → DISCREPANCY (wrong parameter)
|
|
602
|
+
If docs don't mention error cases → INCOMPLETENESS (missing info)
|
|
603
|
+
If docs reference deprecated processCreditCard method → STALENESS (outdated)
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
### Configuration Value Verification:
|
|
607
|
+
|
|
608
|
+
**When verifying configuration values (ports, URLs, domains, etc.):**
|
|
609
|
+
|
|
610
|
+
1. **Priority Order for Source of Truth:**
|
|
611
|
+
- **PRIMARY:** Actual running configuration (check process/logs if available)
|
|
612
|
+
- **SECONDARY:** Environment files in priority order:
|
|
613
|
+
- `.env` or `.env.local` (actual config being used)
|
|
614
|
+
- `.env.production` (production config)
|
|
615
|
+
- `.env.example` (template/documentation)
|
|
616
|
+
- **TERTIARY:** Code defaults (fallback values in code)
|
|
617
|
+
|
|
618
|
+
2. **Verification Process:**
|
|
619
|
+
```bash
|
|
620
|
+
# Check actual environment files (if accessible)
|
|
621
|
+
cat .env 2>/dev/null || cat .env.local 2>/dev/null
|
|
622
|
+
|
|
623
|
+
# Check example/template files
|
|
624
|
+
cat .env.example 2>/dev/null
|
|
625
|
+
|
|
626
|
+
# Search code for default values
|
|
627
|
+
grep -r "PORT.*||.*[0-9]" backend/ src/ 2>/dev/null
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
3. **Resolution Rules:**
|
|
631
|
+
- If `.env` exists and sets value X → **X is correct**
|
|
632
|
+
- If docs show X, code default is Y, but `.env` uses X → **docs are CORRECT**
|
|
633
|
+
- If code default contradicts `.env.example` and docs → **code default needs fixing**
|
|
634
|
+
|
|
635
|
+
4. **Assignment Logic:**
|
|
636
|
+
- If documentation matches actual config → **NO UPDATE NEEDED**
|
|
637
|
+
- If code default contradicts standard → **ASSIGN APO to fix code**
|
|
638
|
+
- If `.env.example` contradicts standard → **ASSIGN APO to fix .env.example**
|
|
639
|
+
|
|
640
|
+
---
|
|
641
|
+
|
|
642
|
+
## Step 1.3A: Service Module Discovery and API Documentation Requirement
|
|
643
|
+
|
|
644
|
+
**Purpose:** Identify service modules and require API reference documentation (distinct from guide-level docs).
|
|
645
|
+
|
|
646
|
+
### Execution Requirements:
|
|
647
|
+
|
|
648
|
+
1. Run the conditional discovery bash script below
|
|
649
|
+
2. Record results in audit report (Part 3: Missing Business Logic)
|
|
650
|
+
3. Assign discovered services to APO-2 or APO-3 based on coupling
|
|
651
|
+
4. If services found: Create assignment for each service (one service = one file)
|
|
652
|
+
5. If no services found: Log "No services detected - skipping service documentation" and continue
|
|
653
|
+
|
|
654
|
+
### Conditional Discovery (Graceful Degradation):
|
|
655
|
+
|
|
656
|
+
```bash
|
|
657
|
+
# Check if services directory exists
|
|
658
|
+
if [ ! -d "backend/src/services" ] && [ ! -d "src/services" ] && [ ! -d "services" ] && [ ! -d "server/services" ]; then
|
|
659
|
+
echo "ℹ️ No services directory detected - skipping service documentation"
|
|
660
|
+
# Continue to next step - NOT an error
|
|
661
|
+
else
|
|
662
|
+
echo "✅ Services detected - scanning for service modules"
|
|
663
|
+
|
|
664
|
+
# Scan for service files
|
|
665
|
+
SERVICE_FILES=$(find backend/src/services src/services services server/services -name "*.js" -o -name "*.ts" 2>/dev/null || true)
|
|
666
|
+
|
|
667
|
+
if [ -z "$SERVICE_FILES" ]; then
|
|
668
|
+
echo "ℹ️ Services directory exists but no service files found"
|
|
669
|
+
else
|
|
670
|
+
echo "Found service modules - documenting..."
|
|
671
|
+
fi
|
|
672
|
+
fi
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
### Service Module Identification:
|
|
676
|
+
|
|
677
|
+
For each service file discovered:
|
|
678
|
+
|
|
679
|
+
1. **Extract information:**
|
|
680
|
+
- Service name (emailService.js → EmailService)
|
|
681
|
+
- Methods exported (public API)
|
|
682
|
+
- Dependencies
|
|
683
|
+
|
|
684
|
+
2. **Documentation Requirements:**
|
|
685
|
+
|
|
686
|
+
**MANDATORY: API Reference Documentation**
|
|
687
|
+
- Location: `docs/services/{serviceName}.md`
|
|
688
|
+
- Content: Method signatures, parameters, return types, usage examples
|
|
689
|
+
|
|
690
|
+
**OPTIONAL: Guide-Level Documentation**
|
|
691
|
+
- Location: `docs/guides/{topic}.md`
|
|
692
|
+
- Content: Configuration, setup, troubleshooting
|
|
693
|
+
|
|
694
|
+
3. **Verification:**
|
|
695
|
+
```bash
|
|
696
|
+
# Count services in codebase
|
|
697
|
+
SERVICE_COUNT=$(find backend/src/services src/services services server/services -name "*.js" -o -name "*.ts" 2>/dev/null | wc -l || echo 0)
|
|
698
|
+
|
|
699
|
+
# Count service API docs
|
|
700
|
+
SERVICE_DOCS=$(find docs/services -name "*.md" ! -name "README.md" 2>/dev/null | wc -l || echo 0)
|
|
701
|
+
|
|
702
|
+
if [ $SERVICE_COUNT -gt 0 ] && [ $SERVICE_COUNT -ne $SERVICE_DOCS ]; then
|
|
703
|
+
echo "❌ Service documentation gap: $SERVICE_COUNT services, $SERVICE_DOCS API docs"
|
|
704
|
+
# Add to discrepancies
|
|
705
|
+
fi
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
### Assignment Specification for Services:
|
|
709
|
+
|
|
710
|
+
When assigning services to APO-2 or APO-3:
|
|
711
|
+
|
|
712
|
+
```json
|
|
713
|
+
{
|
|
714
|
+
"component": "emailService",
|
|
715
|
+
"type": "service",
|
|
716
|
+
"source_file": "backend/src/services/emailService.js",
|
|
717
|
+
"output_type": "API_REFERENCE",
|
|
718
|
+
"output_file": "docs/services/emailService.md",
|
|
719
|
+
"required_sections": [
|
|
720
|
+
"Class/Module Description",
|
|
721
|
+
"Dependencies",
|
|
722
|
+
"Public Methods (with signatures)",
|
|
723
|
+
"Parameter Documentation",
|
|
724
|
+
"Return Types",
|
|
725
|
+
"Usage Examples",
|
|
726
|
+
"Error Handling"
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
**DO NOT accept:**
|
|
732
|
+
- Guide-level docs as substitute for API reference
|
|
733
|
+
- Overview without method signatures
|
|
734
|
+
- "See docs/guides/email-notifications.md" as completion
|
|
735
|
+
|
|
736
|
+
**REQUIRE:**
|
|
737
|
+
- Individual file per service: `docs/services/{serviceName}.md`
|
|
738
|
+
- Complete method signatures
|
|
739
|
+
- Code examples
|
|
740
|
+
|
|
741
|
+
---
|
|
742
|
+
|
|
743
|
+
## Step 1.3B: Frontend Module Discovery and Component Documentation
|
|
744
|
+
|
|
745
|
+
**Purpose:** Identify frontend modules and document components, pages, hooks, utilities.
|
|
746
|
+
|
|
747
|
+
### Execution Requirements:
|
|
748
|
+
|
|
749
|
+
1. Run the conditional discovery bash script below
|
|
750
|
+
2. Record results in audit report (Part 3: Missing Business Logic)
|
|
751
|
+
3. Assign discovered frontend modules to APO-3 (modular components)
|
|
752
|
+
4. If frontend found: Create assignment for each component (one component = one file)
|
|
753
|
+
5. If no frontend found: Log "No frontend detected - skipping frontend documentation" and continue
|
|
754
|
+
|
|
755
|
+
### Conditional Discovery (Graceful Degradation):
|
|
756
|
+
|
|
757
|
+
```bash
|
|
758
|
+
# Check if frontend exists
|
|
759
|
+
if [ ! -d "frontend" ] && [ ! -d "src/app" ] && [ ! -d "client" ] && [ ! -d "src/components" ]; then
|
|
760
|
+
echo "ℹ️ No frontend detected - skipping frontend documentation"
|
|
761
|
+
# Continue to next step - NOT an error
|
|
762
|
+
else
|
|
763
|
+
echo "✅ Frontend detected - scanning for components"
|
|
764
|
+
|
|
765
|
+
# Scan for React/Next.js components
|
|
766
|
+
COMPONENT_FILES=$(find frontend src/app client src/components -name "*.jsx" -o -name "*.tsx" 2>/dev/null || true)
|
|
767
|
+
|
|
768
|
+
if [ -z "$COMPONENT_FILES" ]; then
|
|
769
|
+
echo "ℹ️ Frontend directory exists but no component files found"
|
|
770
|
+
else
|
|
771
|
+
echo "Found frontend modules - documenting..."
|
|
772
|
+
fi
|
|
773
|
+
fi
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
### Frontend Module Identification:
|
|
777
|
+
|
|
778
|
+
For each frontend module discovered:
|
|
779
|
+
|
|
780
|
+
1. **Module Categories:**
|
|
781
|
+
- **Components:** Reusable UI components (Button, Modal, Card)
|
|
782
|
+
- **Pages:** Route-level components (HomePage, DashboardPage)
|
|
783
|
+
- **Hooks:** Custom React hooks (useAuth, useFetch)
|
|
784
|
+
- **Utilities:** Frontend utility modules (formatters, validators)
|
|
785
|
+
|
|
786
|
+
2. **Documentation Requirements:**
|
|
787
|
+
|
|
788
|
+
**Location:** `docs/frontend/{category}/{moduleName}.md`
|
|
789
|
+
|
|
790
|
+
**Required Content:**
|
|
791
|
+
- Component props (name, type, required, description)
|
|
792
|
+
- State management
|
|
793
|
+
- Event handlers
|
|
794
|
+
- Usage examples
|
|
795
|
+
- Integration points
|
|
796
|
+
|
|
797
|
+
3. **Verification:**
|
|
798
|
+
```bash
|
|
799
|
+
# Count frontend modules
|
|
800
|
+
COMPONENT_COUNT=$(find frontend src/app client src/components -name "*.jsx" -o -name "*.tsx" 2>/dev/null | wc -l || echo 0)
|
|
801
|
+
|
|
802
|
+
# Count frontend docs
|
|
803
|
+
FRONTEND_DOCS=$(find docs/frontend -name "*.md" ! -name "README.md" 2>/dev/null | wc -l || echo 0)
|
|
804
|
+
|
|
805
|
+
if [ $COMPONENT_COUNT -gt 0 ] && [ $FRONTEND_DOCS -eq 0 ]; then
|
|
806
|
+
echo "❌ Frontend documentation missing: $COMPONENT_COUNT modules, 0 docs"
|
|
807
|
+
# Add to discrepancies
|
|
808
|
+
fi
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
### Assignment Specification for Frontend:
|
|
812
|
+
|
|
813
|
+
When assigning frontend modules to APO-3:
|
|
814
|
+
|
|
815
|
+
```json
|
|
816
|
+
{
|
|
817
|
+
"component": "UserProfile",
|
|
818
|
+
"type": "react_component",
|
|
819
|
+
"source_file": "frontend/src/components/UserProfile.tsx",
|
|
820
|
+
"output_file": "docs/frontend/components/UserProfile.md",
|
|
821
|
+
"required_sections": [
|
|
822
|
+
"Component Description",
|
|
823
|
+
"Props Documentation",
|
|
824
|
+
"State Management",
|
|
825
|
+
"Event Handlers",
|
|
826
|
+
"Usage Examples",
|
|
827
|
+
"Integration Points"
|
|
828
|
+
]
|
|
829
|
+
}
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
**Granularity:** One component = One file (same as backend services)
|
|
833
|
+
|
|
834
|
+
---
|
|
835
|
+
|
|
836
|
+
## Step 1.4: Generate 3-Part Audit Report
|
|
837
|
+
|
|
838
|
+
**Use template:** `.claude/trinity/templates/documentation/reports/docs-update-audit.md`
|
|
839
|
+
|
|
840
|
+
### Part 1: Base Documentation Updates Needed
|
|
841
|
+
|
|
842
|
+
List all documentation files requiring updates:
|
|
843
|
+
- **File:** `docs/architecture/system-design.md`
|
|
844
|
+
- **Current State:** References old monolith architecture
|
|
845
|
+
- **Required Update:** Update to reflect microservices migration
|
|
846
|
+
- **Reason:** Codebase now has services/users, services/orders, services/payments
|
|
847
|
+
- **Priority:** HIGH
|
|
848
|
+
|
|
849
|
+
### Part 2: Existing Business Logic Requiring Updates
|
|
850
|
+
|
|
851
|
+
List all business logic components with existing docs that need updates:
|
|
852
|
+
- **Component:** UserService (`src/services/user.service.ts`)
|
|
853
|
+
- **Current Documentation:** `docs/api/user-service.md`
|
|
854
|
+
- **Issues:** Missing new `suspendUser()` method, incorrect parameter for `updateUser()`
|
|
855
|
+
- **Required Updates:** Add suspendUser docs, fix updateUser signature
|
|
856
|
+
- **Dependency Analysis:**
|
|
857
|
+
- Tied systems: AuthService, EmailService, AuditLogService
|
|
858
|
+
- Routing: APO-2 (update existing docs - tightly coupled)
|
|
859
|
+
- **Priority:** HIGH
|
|
860
|
+
|
|
861
|
+
### Part 3: Missing Business Logic Requiring New Documentation
|
|
862
|
+
|
|
863
|
+
List all business logic components without documentation:
|
|
864
|
+
- **Component:** NotificationService (`src/services/notification.service.ts`)
|
|
865
|
+
- **Why Undocumented:** New feature added in recent sprint
|
|
866
|
+
- **Uniqueness:** Implements multi-channel notifications (email, SMS, push) with templating
|
|
867
|
+
- **Modularity Analysis:**
|
|
868
|
+
- Independent: Can be used standalone
|
|
869
|
+
- No tight coupling: Uses dependency injection
|
|
870
|
+
- Routing: APO-3 (create new docs - modular component)
|
|
871
|
+
- **Priority:** MEDIUM
|
|
872
|
+
|
|
873
|
+
---
|
|
874
|
+
|
|
875
|
+
## Step 1.5: APO Work Assignment
|
|
876
|
+
|
|
877
|
+
**Assign work to 3 parallel APOs:**
|
|
878
|
+
|
|
879
|
+
### APO-1: Base Documentation Updates
|
|
880
|
+
- Architecture docs
|
|
881
|
+
- Setup/configuration docs
|
|
882
|
+
- Guides and tutorials
|
|
883
|
+
- General repository documentation
|
|
884
|
+
- **Configuration consistency fixes:**
|
|
885
|
+
- Fix simple code defaults that contradict documented standards
|
|
886
|
+
- Update `.env.example` to match actual standards
|
|
887
|
+
- Align configuration values across codebase and docs
|
|
888
|
+
- **RESTRICTION:** Only simple constant/default changes (no logic modifications)
|
|
889
|
+
|
|
890
|
+
### APO-2: Update Existing Business Logic Documentation (OR Share APO-3's Workload)
|
|
891
|
+
|
|
892
|
+
**CRITICAL WORKLOAD ALLOCATION LOGIC:**
|
|
893
|
+
|
|
894
|
+
**IF existing business logic documentation found (from Step 1.3 Part 2):**
|
|
895
|
+
- APO-2 updates existing business logic documentation
|
|
896
|
+
- Components with DIRECT TIES to other systems
|
|
897
|
+
- Decision logic: "Is this component directly tied to X system?"
|
|
898
|
+
- YES → APO-2 updates existing documentation
|
|
899
|
+
- NO → Check if modular (APO-3)
|
|
900
|
+
|
|
901
|
+
**IF NO existing business logic documentation found:**
|
|
902
|
+
- **APO-2 and APO-3 split new documentation work 50/50**
|
|
903
|
+
- Take total undocumented components from Step 1.3 Part 3
|
|
904
|
+
- Divide into two roughly equal groups
|
|
905
|
+
- **APO-2 gets:** First half (prioritize HIGH priority items)
|
|
906
|
+
- **APO-3 gets:** Second half (MEDIUM and LOW priority items)
|
|
907
|
+
- Both agents create NEW documentation (not updates)
|
|
908
|
+
|
|
909
|
+
**Example Decision:**
|
|
910
|
+
```
|
|
911
|
+
Scenario 1 (Existing docs found):
|
|
912
|
+
- Step 1.3 Part 2: 5 components with existing docs needing updates
|
|
913
|
+
- Step 1.3 Part 3: 40 components without documentation
|
|
914
|
+
→ APO-2: Updates 5 existing docs
|
|
915
|
+
→ APO-3: Creates 40 new docs
|
|
916
|
+
|
|
917
|
+
Scenario 2 (No existing docs):
|
|
918
|
+
- Step 1.3 Part 2: 0 components with existing docs
|
|
919
|
+
- Step 1.3 Part 3: 40 components without documentation
|
|
920
|
+
→ APO-2: Creates 20 new docs (first half, HIGH priority)
|
|
921
|
+
→ APO-3: Creates 20 new docs (second half, MEDIUM/LOW priority)
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
**Example (APO-2 with existing docs):**
|
|
925
|
+
```
|
|
926
|
+
Q: Is RefundService directly tied to PaymentService?
|
|
927
|
+
A: YES - refunds can only happen after payments
|
|
928
|
+
→ APO-2 updates existing docs/api/refund-service.md
|
|
929
|
+
|
|
930
|
+
Q: Is AuthMiddleware directly tied to UserService?
|
|
931
|
+
A: YES - authentication requires user validation
|
|
932
|
+
→ APO-2 updates existing docs/middleware/auth.md
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
### APO-3: Create New Business Logic Documentation
|
|
936
|
+
- Components that are MODULAR and INDEPENDENT
|
|
937
|
+
- Decision logic: "Is this component modular and reusable?"
|
|
938
|
+
- YES → APO-3 creates new documentation
|
|
939
|
+
- NO → Check if tied (APO-2)
|
|
940
|
+
|
|
941
|
+
**Example (APO-3):**
|
|
942
|
+
```
|
|
943
|
+
Q: Is CacheHelper modular?
|
|
944
|
+
A: YES - can be used independently, no tight coupling
|
|
945
|
+
→ APO-3 creates new docs/utilities/cache-helper.md
|
|
946
|
+
|
|
947
|
+
Q: Is RateLimiter modular?
|
|
948
|
+
A: YES - middleware that works independently
|
|
949
|
+
→ APO-3 creates new docs/middleware/rate-limiter.md
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
---
|
|
953
|
+
|
|
954
|
+
### APO-3 Granularity Requirements
|
|
955
|
+
|
|
956
|
+
**For collections of similar components (scrapers, utilities, services):**
|
|
957
|
+
|
|
958
|
+
**REQUIRE BOTH:**
|
|
959
|
+
|
|
960
|
+
1. **Overview/Summary File** (Optional but recommended)
|
|
961
|
+
- Purpose: High-level comparison, shared patterns, getting started
|
|
962
|
+
- Example: `dealer-scrapers-overview.md`, `api-routes-overview.md`
|
|
963
|
+
- Content: Table of components, common patterns, architecture
|
|
964
|
+
|
|
965
|
+
2. **Individual Component Files** (MANDATORY)
|
|
966
|
+
- Purpose: Per-component implementation details
|
|
967
|
+
- Requirement: ONE file per component
|
|
968
|
+
- Content: Constructor, methods, configuration, examples, challenges
|
|
969
|
+
|
|
970
|
+
### Assignment Format:
|
|
971
|
+
|
|
972
|
+
When assigning collections to APO-3, specify:
|
|
973
|
+
|
|
974
|
+
❌ WRONG:
|
|
975
|
+
```json
|
|
976
|
+
{
|
|
977
|
+
"apo": "APO-3",
|
|
978
|
+
"components": ["19 dealer scrapers"],
|
|
979
|
+
"deliverables": ["dealer-scrapers documentation"]
|
|
980
|
+
}
|
|
981
|
+
```
|
|
982
|
+
|
|
983
|
+
✅ CORRECT:
|
|
984
|
+
```json
|
|
985
|
+
{
|
|
986
|
+
"apo": "APO-3",
|
|
987
|
+
"components": [
|
|
988
|
+
"LionMachineryScraper",
|
|
989
|
+
"PrestigeEquipmentScraper",
|
|
990
|
+
"EquipmentHubScraper"
|
|
991
|
+
// ... (list all 19 individually)
|
|
992
|
+
],
|
|
993
|
+
"deliverables": [
|
|
994
|
+
"docs/backend/scrapers/LionMachineryScraper.md",
|
|
995
|
+
"docs/backend/scrapers/PrestigeEquipmentScraper.md",
|
|
996
|
+
"docs/backend/scrapers/EquipmentHubScraper.md"
|
|
997
|
+
// ... (19 individual files)
|
|
998
|
+
],
|
|
999
|
+
"optional": ["docs/backend/scrapers/dealer-scrapers-overview.md"]
|
|
1000
|
+
}
|
|
1001
|
+
```
|
|
1002
|
+
|
|
1003
|
+
### Granularity Rules:
|
|
1004
|
+
|
|
1005
|
+
1. **One component = One file**
|
|
1006
|
+
- LionMachineryScraper.js → LionMachineryScraper.md
|
|
1007
|
+
- EmailService.js → email-service.md
|
|
1008
|
+
- Equipment.js → Equipment.md
|
|
1009
|
+
|
|
1010
|
+
2. **Collections get overview + individuals**
|
|
1011
|
+
- 19 scrapers → 1 overview.md + 19 individual .md files
|
|
1012
|
+
- 5 middleware → 1 overview.md + 5 individual .md files
|
|
1013
|
+
|
|
1014
|
+
3. **No "bulk documentation" accepted**
|
|
1015
|
+
- ❌ "scrapers.md" documenting all scrapers
|
|
1016
|
+
- ❌ "services-overview.md" as only service documentation
|
|
1017
|
+
- ✅ Individual file per service + optional overview
|
|
1018
|
+
|
|
1019
|
+
**APO-3 must create N files for N components (not 1 file for N components).**
|
|
1020
|
+
|
|
1021
|
+
---
|
|
1022
|
+
|
|
1023
|
+
## Step 1.6: Zero-Tolerance Policy Check
|
|
1024
|
+
|
|
1025
|
+
**ABORT immediately if any of these are found:**
|
|
1026
|
+
|
|
1027
|
+
1. **Fake Components in Documentation**
|
|
1028
|
+
- Documentation references components that don't exist in codebase
|
|
1029
|
+
- Action: ABORT with list of fake components
|
|
1030
|
+
|
|
1031
|
+
2. **Security Violations in Documentation**
|
|
1032
|
+
- Documentation exposes secrets, API keys, passwords
|
|
1033
|
+
- Documentation contains insecure code examples
|
|
1034
|
+
- Action: ABORT with security violation details
|
|
1035
|
+
|
|
1036
|
+
3. **Stub Content in Documentation**
|
|
1037
|
+
- Documentation has "TODO", "Coming soon", "To be implemented"
|
|
1038
|
+
- Placeholder sections without real content
|
|
1039
|
+
- Action: ABORT with list of stub sections
|
|
1040
|
+
|
|
1041
|
+
**If any zero-tolerance violation found:**
|
|
1042
|
+
```
|
|
1043
|
+
❌ ABORT: Zero-Tolerance Policy Violation
|
|
1044
|
+
|
|
1045
|
+
Violation Type: Fake Components
|
|
1046
|
+
Details:
|
|
1047
|
+
- docs/api/blockchain-service.md documents BlockchainService
|
|
1048
|
+
- BlockchainService does not exist in codebase
|
|
1049
|
+
- Located at: docs/api/blockchain-service.md:15-45
|
|
1050
|
+
|
|
1051
|
+
Action Required:
|
|
1052
|
+
1. Remove fake documentation or
|
|
1053
|
+
2. Implement the component
|
|
1054
|
+
3. Re-run trinity-docs-update
|
|
1055
|
+
|
|
1056
|
+
Aborting documentation update.
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
---
|
|
1060
|
+
|
|
1061
|
+
## Step 1.6A: Pre-Report Database Verification Enforcement
|
|
1062
|
+
|
|
1063
|
+
**CRITICAL: Before generating your audit report, verify you followed database requirements.**
|
|
1064
|
+
|
|
1065
|
+
**If the project has a database, you MUST verify you completed all database verification steps.**
|
|
1066
|
+
|
|
1067
|
+
**Self-Check Questions:**
|
|
1068
|
+
|
|
1069
|
+
1. **Did I detect if a database exists?**
|
|
1070
|
+
- [ ] YES - I ran the database detection bash command
|
|
1071
|
+
- [ ] YES - I documented the result (YES/NO) in my draft
|
|
1072
|
+
- If NO to either: GO BACK to STEP 1 and run detection
|
|
1073
|
+
|
|
1074
|
+
2. **If database detected, did I attempt connection?**
|
|
1075
|
+
- [ ] YES - I searched for connection info (.env, docker-compose.yml, config files, README)
|
|
1076
|
+
- [ ] YES - I documented what connection info I found
|
|
1077
|
+
- [ ] YES - I executed at least ONE connection command
|
|
1078
|
+
- [ ] YES - I documented the exact command, result, and error (if failed)
|
|
1079
|
+
- [ ] N/A - No database detected
|
|
1080
|
+
- If NO to any (and database detected): GO BACK to STEP 2 and attempt connection
|
|
1081
|
+
|
|
1082
|
+
3. **Did I document my database verification in the audit report?**
|
|
1083
|
+
- [ ] YES - My audit draft includes "Database Verification" section
|
|
1084
|
+
- [ ] YES - It documents detection result (YES/NO)
|
|
1085
|
+
- [ ] YES - It documents connection attempt (if database detected)
|
|
1086
|
+
- [ ] YES - It documents schema data source used
|
|
1087
|
+
- [ ] N/A - No database detected
|
|
1088
|
+
- If NO to any: ADD the "Database Verification" section to your audit draft
|
|
1089
|
+
|
|
1090
|
+
**ENFORCEMENT:**
|
|
1091
|
+
|
|
1092
|
+
**If ANY checks fail:**
|
|
1093
|
+
- ❌ DO NOT proceed to Step 1.7
|
|
1094
|
+
- ❌ DO NOT generate your final audit report
|
|
1095
|
+
- ✅ GO BACK to the failed step and complete it
|
|
1096
|
+
- ✅ Then return here and re-run self-check
|
|
1097
|
+
|
|
1098
|
+
**Only proceed to Step 1.7 if ALL applicable checks pass.**
|
|
1099
|
+
|
|
1100
|
+
---
|
|
1101
|
+
|
|
1102
|
+
## Step 1.7: Generate Audit Report with APO Checklists
|
|
1103
|
+
|
|
1104
|
+
**CRITICAL: Generate a single audit report with three UNCHECKED checklists.**
|
|
1105
|
+
|
|
1106
|
+
**All checkboxes MUST be unchecked (`- [ ]`) as this is only the audit/checklist generation phase.**
|
|
1107
|
+
|
|
1108
|
+
### Report Structure:
|
|
1109
|
+
|
|
1110
|
+
```markdown
|
|
1111
|
+
# Documentation Update Audit Report
|
|
1112
|
+
|
|
1113
|
+
**Date:** {{DATE}}
|
|
1114
|
+
**Project:** {{PROJECT_NAME}}
|
|
1115
|
+
**Status:** Audit Complete - Work Assignments Ready
|
|
1116
|
+
|
|
1117
|
+
---
|
|
1118
|
+
|
|
1119
|
+
## Executive Summary
|
|
1120
|
+
|
|
1121
|
+
- Total documentation files found: {{COUNT}}
|
|
1122
|
+
- Files needing updates: {{COUNT}}
|
|
1123
|
+
- Missing business logic documentation: {{COUNT}}
|
|
1124
|
+
- Total discrepancies identified: {{COUNT}}
|
|
1125
|
+
- **Database detected:** [YES/NO]
|
|
1126
|
+
- **Database verification:** [✅ Production DB verified / ⚠️ Schema files used / ℹ️ No database]
|
|
1127
|
+
|
|
1128
|
+
---
|
|
1129
|
+
|
|
1130
|
+
## Part 0: Database Verification (REQUIRED if database detected)
|
|
1131
|
+
|
|
1132
|
+
**This section is MANDATORY if the project has a database.**
|
|
1133
|
+
|
|
1134
|
+
### Database Detection
|
|
1135
|
+
|
|
1136
|
+
- **Database detected:** [YES/NO]
|
|
1137
|
+
- **Detection method:** [Checked for init.sql, schema files, DATABASE_URL, etc.]
|
|
1138
|
+
|
|
1139
|
+
**If NO database detected:**
|
|
1140
|
+
- No database verification required ℹ️
|
|
1141
|
+
|
|
1142
|
+
**If database detected, COMPLETE ALL SECTIONS BELOW:**
|
|
1143
|
+
|
|
1144
|
+
### Connection Information Search
|
|
1145
|
+
|
|
1146
|
+
- **`.env` file:** [FOUND/NOT FOUND] - [Variables found: DATABASE_URL=...]
|
|
1147
|
+
- **`docker-compose.yml`:** [FOUND/NOT FOUND] - [Service: postgres, port: 5432]
|
|
1148
|
+
- **Config files:** [FOUND/NOT FOUND] - [Files checked: config/database.js]
|
|
1149
|
+
- **README instructions:** [Connection instructions found: YES/NO]
|
|
1150
|
+
|
|
1151
|
+
### Production Database Connection Attempt
|
|
1152
|
+
|
|
1153
|
+
**YOU MUST DOCUMENT YOUR CONNECTION ATTEMPT:**
|
|
1154
|
+
|
|
1155
|
+
- **Method attempted:** [psql / mysql / sqlite3 / docker exec]
|
|
1156
|
+
- **Command executed:**
|
|
1157
|
+
```bash
|
|
1158
|
+
[exact command you ran]
|
|
1159
|
+
```
|
|
1160
|
+
- **Connection result:** [SUCCESS ✅ / FAILED ❌]
|
|
1161
|
+
- **If failed, error message:**
|
|
1162
|
+
```
|
|
1163
|
+
[exact error output]
|
|
1164
|
+
```
|
|
1165
|
+
- **If failed, reason:** [Database not running / Credentials not found / Network issue / Other]
|
|
1166
|
+
|
|
1167
|
+
### Schema Data Source Used
|
|
1168
|
+
|
|
1169
|
+
- **PRIMARY (Production Database):** [USED ✅ / NOT USED - connection failed]
|
|
1170
|
+
- **SECONDARY (Schema Files):** [USED ⚠️ - fallback / NOT USED]
|
|
1171
|
+
- **TERTIARY (Documentation):** [USED ⚠️ - last resort / NOT USED]
|
|
1172
|
+
|
|
1173
|
+
**If schema files or documentation used as fallback:**
|
|
1174
|
+
- Reason production DB not used: [connection failed because...]
|
|
1175
|
+
- Files consulted: [database/init.sql, prisma/schema.prisma, etc.]
|
|
1176
|
+
- Confidence level: [HIGH (recent schema files) / MEDIUM / LOW (may be outdated)]
|
|
1177
|
+
|
|
1178
|
+
### Schema Information Extracted
|
|
1179
|
+
|
|
1180
|
+
[List exact table names, column names and types, constraints, indexes, relationships]
|
|
1181
|
+
|
|
1182
|
+
---
|
|
1183
|
+
|
|
1184
|
+
## Part 1: Audit Findings
|
|
1185
|
+
|
|
1186
|
+
### Base Documentation Issues
|
|
1187
|
+
[List all base documentation files with issues found]
|
|
1188
|
+
|
|
1189
|
+
### Existing Business Logic Issues
|
|
1190
|
+
[List all business logic with existing docs needing updates]
|
|
1191
|
+
|
|
1192
|
+
### Missing Business Logic
|
|
1193
|
+
[List all business logic components without documentation]
|
|
1194
|
+
|
|
1195
|
+
---
|
|
1196
|
+
|
|
1197
|
+
## Part 2: APO-1 Checklist - Base Documentation Updates
|
|
1198
|
+
|
|
1199
|
+
**Assignment:** Update {{COUNT}} base documentation files
|
|
1200
|
+
|
|
1201
|
+
**IMPORTANT: All boxes below are UNCHECKED. These will be checked off during Phase 2 execution.**
|
|
1202
|
+
|
|
1203
|
+
**Files to Update:**
|
|
1204
|
+
|
|
1205
|
+
- [ ] `docs/architecture/system-design.md`
|
|
1206
|
+
- Issue: References old monolith architecture
|
|
1207
|
+
- Required: Update to reflect microservices migration
|
|
1208
|
+
- Priority: HIGH
|
|
1209
|
+
|
|
1210
|
+
- [ ] `docs/guides/getting-started.md`
|
|
1211
|
+
- Issue: Incorrect setup steps
|
|
1212
|
+
- Required: Update installation instructions
|
|
1213
|
+
- Priority: MEDIUM
|
|
1214
|
+
|
|
1215
|
+
[Continue for each file...]
|
|
1216
|
+
|
|
1217
|
+
---
|
|
1218
|
+
|
|
1219
|
+
## Part 3: APO-2 Checklist - Existing Business Logic Updates
|
|
1220
|
+
|
|
1221
|
+
**WORKLOAD ALLOCATION LOGIC:**
|
|
1222
|
+
|
|
1223
|
+
**IF existing business logic documentation found:**
|
|
1224
|
+
- APO-2 updates existing business logic documentation
|
|
1225
|
+
- APO-3 creates new business logic documentation
|
|
1226
|
+
|
|
1227
|
+
**IF NO existing business logic documentation found:**
|
|
1228
|
+
- APO-2 receives HALF of APO-3's new documentation tasks
|
|
1229
|
+
- APO-3 receives the other HALF of new documentation tasks
|
|
1230
|
+
- Split components as evenly as possible between APO-2 and APO-3
|
|
1231
|
+
- Prioritize giving HIGH priority items to APO-2, MEDIUM/LOW to APO-3
|
|
1232
|
+
|
|
1233
|
+
---
|
|
1234
|
+
|
|
1235
|
+
### Scenario A: Existing Business Logic Documentation Found
|
|
1236
|
+
|
|
1237
|
+
**Assignment:** Update {{COUNT}} existing business logic documentation files
|
|
1238
|
+
|
|
1239
|
+
**Components to Update:**
|
|
1240
|
+
|
|
1241
|
+
- [ ] `UserService` (docs/api/user-service.md)
|
|
1242
|
+
- Issue: Missing suspendUser() method
|
|
1243
|
+
- Required: Add suspendUser documentation
|
|
1244
|
+
- Source: src/services/user.service.ts
|
|
1245
|
+
- Priority: HIGH
|
|
1246
|
+
|
|
1247
|
+
[Continue for each component...]
|
|
1248
|
+
|
|
1249
|
+
---
|
|
1250
|
+
|
|
1251
|
+
### Scenario B: NO Existing Business Logic Documentation Found
|
|
1252
|
+
|
|
1253
|
+
**Assignment:** APO-2 will create {{HALF_COUNT}} new business logic documentation files (shared workload with APO-3)
|
|
1254
|
+
|
|
1255
|
+
**IMPORTANT:** Since no existing business logic documentation was found, APO-2 and APO-3 will split the new documentation creation work evenly.
|
|
1256
|
+
|
|
1257
|
+
**Components to Document (APO-2's half):**
|
|
1258
|
+
|
|
1259
|
+
[List approximately half of the undocumented components, prioritizing HIGH priority items]
|
|
1260
|
+
|
|
1261
|
+
- [ ] `ServiceName`
|
|
1262
|
+
- Output file: docs/services/service-name.md
|
|
1263
|
+
- Source: src/services/service-name.js
|
|
1264
|
+
- Purpose: [Description]
|
|
1265
|
+
- Priority: HIGH
|
|
1266
|
+
|
|
1267
|
+
[Continue for APO-2's half...]
|
|
1268
|
+
|
|
1269
|
+
---
|
|
1270
|
+
|
|
1271
|
+
## Part 4: APO-3 Checklist - New Business Logic Documentation
|
|
1272
|
+
|
|
1273
|
+
**Assignment:** Create {{COUNT}} new business logic documentation files
|
|
1274
|
+
|
|
1275
|
+
**NOTE:** If APO-2 had no existing documentation to update, this count represents APO-3's half of the total workload (see Part 3 for APO-2's assignments).
|
|
1276
|
+
|
|
1277
|
+
**Components to Document:**
|
|
1278
|
+
|
|
1279
|
+
- [ ] `NotificationService`
|
|
1280
|
+
- Output file: docs/services/notification-service.md
|
|
1281
|
+
- Source: src/services/notification.service.ts
|
|
1282
|
+
- Purpose: Multi-channel notification system
|
|
1283
|
+
- Priority: MEDIUM
|
|
1284
|
+
|
|
1285
|
+
- [ ] `CacheHelper`
|
|
1286
|
+
- Output file: docs/utilities/cache-helper.md
|
|
1287
|
+
- Source: src/utils/cache-helper.ts
|
|
1288
|
+
- Purpose: Redis caching utility
|
|
1289
|
+
- Priority: LOW
|
|
1290
|
+
|
|
1291
|
+
[Continue for each component...]
|
|
1292
|
+
|
|
1293
|
+
---
|
|
1294
|
+
|
|
1295
|
+
## Audit Summary
|
|
1296
|
+
|
|
1297
|
+
- **Phase:** Audit Complete
|
|
1298
|
+
- **Checklists Generated:** APO-1, APO-2, APO-3
|
|
1299
|
+
- **Total Items:** {{TOTAL_COUNT}}
|
|
1300
|
+
- **Report:** DOCS-UPDATE-AUDIT-{{DATE}}.md
|
|
1301
|
+
|
|
1302
|
+
---
|
|
1303
|
+
|
|
1304
|
+
**End of Audit Report**
|
|
1305
|
+
```
|
|
1306
|
+
|
|
1307
|
+
**CRITICAL: Use Task skill Write to save the report:**
|
|
1308
|
+
|
|
1309
|
+
```
|
|
1310
|
+
Use Task tool with subagent_type="APO (Documentation Specialist)" to write the file:
|
|
1311
|
+
- File path: .claude/trinity/reports/DOCS-UPDATE-AUDIT-{{DATE}}.md
|
|
1312
|
+
- Content: Complete audit report with all sections above
|
|
1313
|
+
```
|
|
1314
|
+
|
|
1315
|
+
**Key Requirements:**
|
|
1316
|
+
1. **CRITICAL:** Each checklist item must have an UNCHECKED checkbox: `- [ ]` (not `- [x]` or `- [X]`)
|
|
1317
|
+
2. Each item must specify the file/component name
|
|
1318
|
+
3. Each item must describe what needs to be done
|
|
1319
|
+
4. Each item must specify the output file location (for APO-3)
|
|
1320
|
+
5. Include source file references for verification
|
|
1321
|
+
6. For database schemas: Use production database as primary source (see Step 1.2 priority order)
|
|
1322
|
+
7. **CRITICAL:** Use Task skill Write to create the audit report file
|
|
1323
|
+
|
|
1324
|
+
---
|
|
1325
|
+
|
|
1326
|
+
## Completion
|
|
1327
|
+
|
|
1328
|
+
Once audit is complete:
|
|
1329
|
+
1. ✅ Audit report generated with three unchecked checklists
|
|
1330
|
+
2. ✅ Each checklist has clear, actionable work items
|
|
1331
|
+
3. ✅ Report saved to `.claude/trinity/reports/` using Task skill Write
|
|
1332
|
+
4. ✅ **Phase 1 complete**
|
|
1333
|
+
|
|
1334
|
+
**DO NOT execute any documentation updates.**
|
|
1335
|
+
**ONLY generate the audit report with checklists.**
|
|
1336
|
+
|
|
1337
|
+
**End of JUNO audit checklist.**
|