trinity-method-sdk 2.0.7 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +267 -218
  2. package/README.md +540 -540
  3. package/dist/cli/commands/deploy/index.js +1 -1
  4. package/dist/cli/commands/deploy/root-files.js +1 -1
  5. package/dist/cli/commands/deploy/sdk-install.js +1 -1
  6. package/dist/cli/commands/update/index.js +4 -1
  7. package/dist/cli/index.js +1 -0
  8. package/dist/cli/types.d.ts +1 -0
  9. package/dist/cli/utils/detect-stack.js +6 -0
  10. package/dist/cli/utils/template-processor.js +1 -1
  11. package/dist/templates/agents/aj-team/apo-documentation-specialist.md.template +2 -2
  12. package/dist/templates/agents/aj-team/bas-quality-gate.md.template +3 -3
  13. package/dist/templates/agents/aj-team/bon-dependency-manager.md.template +636 -636
  14. package/dist/templates/agents/aj-team/cap-configuration-specialist.md.template +2 -2
  15. package/dist/templates/agents/aj-team/dra-code-reviewer.md.template +2 -2
  16. package/dist/templates/agents/aj-team/kil-task-executor.md.template +2 -2
  17. package/dist/templates/agents/aj-team/uro-refactoring-specialist.md.template +2 -2
  18. package/dist/templates/agents/audit/juno-auditor.md.template +1 -1
  19. package/dist/templates/agents/deployment/ein-cicd.md.template +3 -2
  20. package/dist/templates/agents/deployment/ino-context.md.template +3 -3
  21. package/dist/templates/agents/deployment/tan-structure.md.template +1 -1
  22. package/dist/templates/agents/deployment/zen-knowledge.md.template +5 -5
  23. package/dist/templates/agents/leadership/aj-cc.md.template +2 -2
  24. package/dist/templates/claude/EMPLOYEE-DIRECTORY.md.template +1 -1
  25. package/dist/templates/documentation/SUBDIRECTORY-README.md.template +1 -1
  26. package/dist/templates/investigations/bug.md.template +2 -2
  27. package/dist/templates/investigations/feature.md.template +2 -2
  28. package/dist/templates/investigations/performance.md.template +2 -2
  29. package/dist/templates/investigations/security.md.template +2 -2
  30. package/dist/templates/investigations/technical.md.template +2 -2
  31. package/dist/templates/knowledge-base/AI-DEVELOPMENT-GUIDE.md.template +1 -1
  32. package/dist/templates/knowledge-base/ARCHITECTURE.md.template +2 -2
  33. package/dist/templates/knowledge-base/CODING-PRINCIPLES.md.template +1 -1
  34. package/dist/templates/knowledge-base/DOCUMENTATION-CRITERIA.md.template +1 -1
  35. package/dist/templates/knowledge-base/ISSUES.md.template +2 -2
  36. package/dist/templates/knowledge-base/TESTING-PRINCIPLES.md.template +1 -1
  37. package/dist/templates/knowledge-base/Technical-Debt.md.template +2 -2
  38. package/dist/templates/knowledge-base/To-do.md.template +2 -2
  39. package/dist/templates/knowledge-base/Trinity.md.template +4 -3
  40. package/dist/templates/root/TRINITY.md.template +1 -1
  41. package/dist/templates/shared/claude-commands/trinity-changelog.md.template +2 -2
  42. package/dist/templates/shared/claude-commands/trinity-continue.md.template +1 -1
  43. package/dist/templates/shared/claude-commands/trinity-docs.md.template +376 -7
  44. package/dist/templates/shared/claude-commands/trinity-end.md.template +397 -397
  45. package/dist/templates/shared/claude-commands/trinity-readme.md.template +141 -33
  46. package/dist/templates/shared/claude-commands/trinity-verify.md.template +1 -1
  47. package/dist/templates/source/base-CLAUDE.md.template +310 -310
  48. package/dist/templates/source/flutter-CLAUDE.md.template +593 -593
  49. package/dist/templates/source/nodejs-CLAUDE.md.template +531 -531
  50. package/dist/templates/source/python-CLAUDE.md.template +510 -510
  51. package/dist/templates/source/react-CLAUDE.md.template +513 -513
  52. package/dist/templates/source/rust-CLAUDE.md.template +653 -653
  53. package/package.json +94 -94
@@ -78,6 +78,114 @@ The `/trinity-docs` command invokes APO (Documentation Specialist) to **create a
78
78
 
79
79
  **Why:** Trinity Method SDK is a tool for developers. The project's documentation should focus exclusively on the project's code, features, and usage - not on the development methodology used to create it.
80
80
 
81
+ #### Rule 1 Forbidden Patterns
82
+
83
+ **APO MUST scan for and REMOVE these patterns from ALL generated documentation:**
84
+
85
+ **Trinity Infrastructure References:**
86
+ - ❌ `trinity/` paths (e.g., `trinity/reports/`, `trinity/knowledge-base/`)
87
+ - ❌ `.claude/` paths (e.g., `.claude/agents/`, `.claude/commands/`)
88
+ - ❌ Links to CLAUDE.md files
89
+ - ❌ Links to Trinity reports or session files
90
+
91
+ **Trinity Agent Names:**
92
+ - ❌ APO, MON, ROR, KIL, BAS, DRA, URO, EUS, TRA, EIN, INO, TAN, ZEN, JUNO, BON, CAP (when referring to agents)
93
+ - ✅ OK if these are actual project variable/function names in code examples
94
+
95
+ **Trinity Commands:**
96
+ - ❌ `/trinity-start`, `/trinity-audit`, `/trinity-readme`, `/trinity-docs`, etc.
97
+ - ❌ Any slash commands starting with `/trinity-`
98
+
99
+ **Trinity Method Terminology:**
100
+ - ❌ "Trinity Method v2.0"
101
+ - ❌ "Trinity infrastructure"
102
+ - ❌ "Trinity SDK"
103
+ - ❌ "Trinity orchestration"
104
+ - ❌ "Trinity workflow"
105
+ - ❌ References to Trinity Method as a development tool
106
+
107
+ **Exceptions:**
108
+ - ✅ "Trinity" as a project name (e.g., "Trinity Healthcare App")
109
+ - ✅ "Trinity" in code comments if part of project code
110
+ - ✅ Database names, class names, or other project-specific uses of "Trinity"
111
+
112
+ **Verification Command:**
113
+ ```bash
114
+ # After generating all docs, run:
115
+ grep -rni "trinity\|/trinity-\|APO\|MON\|ROR\|KIL\|BAS" docs/
116
+
117
+ # Expected result: NO MATCHES (or only project-specific Trinity usage)
118
+ ```
119
+
120
+ **If Trinity references found:**
121
+ 1. Remove the reference from the documentation
122
+ 2. Log the violation in Phase 5 report
123
+ 3. Update templates to prevent future violations
124
+
125
+ ### Rule 2: Evidence-Based Documentation Only
126
+
127
+ **CRITICAL: Only document tools, libraries, and features that actually exist in this codebase.**
128
+
129
+ **Before documenting ANY tool, you MUST verify:**
130
+
131
+ 1. **Package Manager Verification**
132
+ - Node.js: Check `package.json` dependencies or devDependencies
133
+ - Python: Check `requirements.txt`, `pyproject.toml`, or `setup.py`
134
+ - Rust: Check `Cargo.toml` dependencies
135
+ - Go: Check `go.mod` require statements
136
+
137
+ 2. **Configuration File Verification**
138
+ - Check for tool config files (`.eslintrc.js`, `jest.config.js`, `.lighthouserc.json`, etc.)
139
+ - Check for tool-specific directories (`.github/workflows/`, `__tests__/`, etc.)
140
+
141
+ 3. **Usage Evidence**
142
+ - Search for tool imports/usage in code
143
+ - Check `package.json` scripts for tool commands
144
+ - Look for generated files/reports from the tool
145
+
146
+ **❌ DO NOT DOCUMENT:**
147
+ - Tools you "recognize" for this project type
148
+ - "Best practice" or "recommended" tools not actually installed
149
+ - Tools from your training data that "PWA projects typically use"
150
+ - Features without verified implementation code
151
+
152
+ **✅ ONLY DOCUMENT:**
153
+ - Tools explicitly listed in package manager files
154
+ - Tools with configuration files present
155
+ - Features with actual implementation code you can reference
156
+
157
+ **Example - Lighthouse:**
158
+ ```bash
159
+ # BEFORE documenting Lighthouse, verify:
160
+ 1. grep '"lighthouse"' package.json → NOT FOUND ❌
161
+ 2. Check for .lighthouserc.json → DOES NOT EXIST ❌
162
+ 3. Check for lighthouse-reports/ → DOES NOT EXIST ❌
163
+ CONCLUSION: Do NOT document Lighthouse
164
+
165
+ # Verification failed = Skip entirely
166
+ ```
167
+
168
+ **Example - Jest (Verified):**
169
+ ```bash
170
+ # BEFORE documenting Jest, verify:
171
+ 1. grep '"jest"' package.json → FOUND ✅
172
+ 2. Check for jest.config.js → EXISTS ✅
173
+ 3. Check for __tests__/ or *.test.js → EXISTS ✅
174
+ CONCLUSION: Document Jest
175
+
176
+ # Verification passed = Document with confidence
177
+ ```
178
+
179
+ **Why This Matters:**
180
+ This command is used globally across all stacks. Without verification:
181
+ - Node.js PWAs would document Lighthouse (assumed tool)
182
+ - Python projects would document Sphinx (assumed tool)
183
+ - Rust projects would document cargo-deny (assumed tool)
184
+
185
+ **Result:** Documentation describes an "ideal" project, not the actual project.
186
+
187
+ **With verification:** Documentation accurately reflects only installed tools and implemented features.
188
+
81
189
  ---
82
190
 
83
191
  ## When to Use `/trinity-docs`
@@ -345,7 +453,77 @@ if exists(".env.example"):
345
453
  project_metadata.has_env_example = true
346
454
  ```
347
455
 
348
- **Step 6: Detect Auto-Generated API Documentation (ENHANCEMENT 8)**
456
+ **Step 6: Tool & Feature Verification (CRITICAL)**
457
+
458
+ **Before creating any documentation content, verify what tools actually exist.**
459
+
460
+ **For Node.js/TypeScript Projects:**
461
+ ```bash
462
+ # Read package.json
463
+ package_json = read("package.json")
464
+ all_deps = {
465
+ ...package_json.dependencies,
466
+ ...package_json.devDependencies
467
+ }
468
+
469
+ # Verify common tools
470
+ verified_tools = {
471
+ typescript: "typescript" in all_deps,
472
+ jest: "jest" in all_deps && exists("jest.config.js" or "jest.config.ts"),
473
+ eslint: "eslint" in all_deps && exists(".eslintrc.*" or "eslint.config.js"),
474
+ prettier: "prettier" in all_deps && exists(".prettierrc*"),
475
+ lighthouse: "lighthouse" in all_deps && exists(".lighthouserc.json"),
476
+ webpack: "webpack" in all_deps && exists("webpack.config.js"),
477
+ vite: "vite" in all_deps && exists("vite.config.*"),
478
+ next: "next" in all_deps,
479
+ react: "react" in all_deps
480
+ }
481
+ ```
482
+
483
+ **For Python Projects:**
484
+ ```bash
485
+ # Check requirements files
486
+ deps = []
487
+ if exists("requirements.txt"):
488
+ deps += read("requirements.txt").lines
489
+ if exists("pyproject.toml"):
490
+ deps += extract_dependencies("pyproject.toml")
491
+
492
+ verified_tools = {
493
+ pytest: "pytest" in deps && exists("pytest.ini" or "pyproject.toml[tool.pytest]"),
494
+ black: "black" in deps && exists("pyproject.toml[tool.black]"),
495
+ mypy: "mypy" in deps && exists("mypy.ini" or "pyproject.toml[tool.mypy]"),
496
+ sphinx: "sphinx" in deps && exists("docs/conf.py")
497
+ }
498
+ ```
499
+
500
+ **For Rust Projects:**
501
+ ```bash
502
+ # Check Cargo.toml
503
+ cargo = read("Cargo.toml")
504
+ deps = extract_dependencies(cargo)
505
+
506
+ verified_tools = {
507
+ serde: "serde" in deps,
508
+ tokio: "tokio" in deps,
509
+ clippy: exists("clippy.toml"),
510
+ cargo_deny: exists("deny.toml")
511
+ }
512
+ ```
513
+
514
+ **Verification Report:**
515
+ Log what was verified for transparency:
516
+ ```
517
+ ✅ TypeScript: Found in package.json + tsconfig.json exists
518
+ ✅ Jest: Found in package.json + jest.config.js exists
519
+ ✅ ESLint: Found in package.json + .eslintrc.js exists
520
+ ❌ Lighthouse: NOT in package.json, no .lighthouserc.json → SKIP
521
+ ❌ Prettier: NOT in package.json, no .prettierrc → SKIP
522
+ ```
523
+
524
+ **CRITICAL:** Use this `verified_tools` object in Phase 2 to conditionally create documentation. **Do NOT document unverified tools.**
525
+
526
+ **Step 7: Detect Auto-Generated API Documentation (ENHANCEMENT 8)**
349
527
 
350
528
  ```bash
351
529
  # Detect TypeDoc (Node.js/TypeScript)
@@ -543,7 +721,7 @@ if (framework === "Django" || framework === "Flask") {
543
721
  # Getting Started with {{PROJECT_NAME}}
544
722
 
545
723
  **Version:** {{VERSION}}
546
- **Last Updated:** {{CURRENT_DATE}}
724
+ **Last Updated**: {{CURRENT_DATE}}
547
725
 
548
726
  ## Overview
549
727
 
@@ -821,7 +999,7 @@ Write("docs/architecture/overview.md", architecture_overview_content);
821
999
  **Type:** {project_metadata.type}
822
1000
  **Framework:** {project_metadata.framework}
823
1001
  **Version:** {project_metadata.version}
824
- **Last Updated:** {{CURRENT_DATE}}
1002
+ **Last Updated**: {{CURRENT_DATE}}
825
1003
 
826
1004
  ## System Overview
827
1005
 
@@ -1505,9 +1683,7 @@ To contribute to documentation:
1505
1683
 
1506
1684
  ---
1507
1685
 
1508
- **Documentation Coverage:** {coverage_score}/100 (see [Organization Report](../trinity/reports/DOCS-ORGANIZATION-{date}.md))
1509
-
1510
- *Last updated: {{CURRENT_DATE}}*
1686
+ ***Last Updated**: {{CURRENT_DATE}}*
1511
1687
  ```
1512
1688
 
1513
1689
  **Step 5: Build Complete Documentation Index**
@@ -1784,6 +1960,12 @@ if unfixable_links.length > 0:
1784
1960
  - **Auto-generated API docs:** {✅ {api_docs.type} | ❌ None}
1785
1961
  - **Duplicate docs:** {duplicates.length} potential duplicates
1786
1962
 
1963
+ **Tool Verification Report:**
1964
+ - ✅ **Verified & Documented:** {list verified tools that will be documented}
1965
+ - ❌ **Not Found (Skipped):** {list tools checked but not found}
1966
+ - **Total Tools Verified:** {verified_count}
1967
+ - **Tools Documented:** {documented_count}
1968
+
1787
1969
  ### Phase 2: Directory Structure & Content Seeding
1788
1970
  - **Directories created:** {created_dirs.length}
1789
1971
  - **Content files created:** {count}
@@ -1807,6 +1989,62 @@ if unfixable_links.length > 0:
1807
1989
  - **Unfixable links:** {unfixable_links.length}
1808
1990
  - **Files indexed:** {all_docs.length}
1809
1991
 
1992
+ ### Phase 4.5: Trinity Reference Sanitization
1993
+ - **Files scanned:** {all_docs.length}
1994
+ - **Trinity references found:** {trinity_references.length}
1995
+ - **Auto-fixed violations:** {violations_fixed.length}
1996
+ - **Manual review required:** {violations_remaining.length}
1997
+
1998
+ **Validation:** {✅ PASS | ❌ FAIL}
1999
+ {if PASS:}
2000
+ - ✅ Zero Trinity references in docs/ directory
2001
+ {if FAIL:}
2002
+ - ❌ {violations_remaining.length} Trinity references require manual removal
2003
+
2004
+ {if violations_remaining.length > 0:}
2005
+ **Violations Requiring Manual Removal:**
2006
+ {for each violation:}
2007
+ - ⚠️ **{violation.file}:{violation.line}**
2008
+ - Pattern: `{violation.pattern}`
2009
+ - Context: {violation.context}
2010
+ - **Action Required:** Remove Trinity reference manually
2011
+
2012
+ **Rule 1 Reminder:**
2013
+ Trinity Method is a development tool, not a project feature. User-facing documentation
2014
+ must focus exclusively on the project itself, not the methodology used to create it.
2015
+
2016
+ ---
2017
+
2018
+ ## Rule 1 Compliance (Trinity-Free Documentation)
2019
+
2020
+ **Verification:** Scanned all docs/ files for Trinity Method references
2021
+
2022
+ **Scan Results:**
2023
+ - Files scanned: {all_docs.length}
2024
+ - Trinity references found: {trinity_references.length}
2025
+ - Auto-fixed: {violations_fixed.length}
2026
+ - Manual review required: {violations_remaining.length}
2027
+
2028
+ {if violations_remaining.length === 0:}
2029
+ **✅ PASS: Zero Trinity references in user-facing documentation**
2030
+
2031
+ All generated documentation focuses exclusively on the project's code, features, and
2032
+ usage. No references to Trinity Method, Trinity agents, or Trinity infrastructure.
2033
+
2034
+ {else:}
2035
+ **❌ FAIL: Trinity references present in documentation**
2036
+
2037
+ **Violations Requiring Manual Removal:**
2038
+ {for each violation:}
2039
+ - ⚠️ **{file}:{line}**
2040
+ - Pattern: `{pattern}`
2041
+ - Context: {context}
2042
+ - **Action Required:** Remove Trinity reference manually
2043
+
2044
+ **Rule 1 Reminder:**
2045
+ Trinity Method is a development tool, not a project feature. User-facing documentation
2046
+ must focus exclusively on the project itself, not the methodology used to create it.
2047
+
1810
2048
  ---
1811
2049
 
1812
2050
  ## Directory Structure
@@ -2071,6 +2309,137 @@ docs/
2071
2309
  **Documentation Status:** {✅ Production-Ready | ⚠️ Needs Content Expansion | ❌ Incomplete}
2072
2310
  ```
2073
2311
 
2312
+ ---
2313
+
2314
+ ## Phase 4.5: Trinity Reference Sanitization
2315
+
2316
+ **CRITICAL: Remove all Trinity Method references from generated documentation**
2317
+
2318
+ **Goal:** Ensure zero Trinity references in user-facing docs/ directory
2319
+
2320
+ **Step 1: Scan Generated Documentation**
2321
+
2322
+ ```javascript
2323
+ // Search all generated docs for Trinity references
2324
+ trinity_references = []
2325
+
2326
+ all_docs = glob("docs/**/*.md")
2327
+
2328
+ for each doc in all_docs:
2329
+ content = read(doc)
2330
+
2331
+ // Search for Trinity patterns
2332
+ patterns = [
2333
+ "Trinity Method",
2334
+ "trinity/",
2335
+ ".claude/",
2336
+ "APO", "MON", "ROR", "KIL", "BAS", "DRA", "URO", "EUS", "TRA",
2337
+ "/trinity-",
2338
+ "CLAUDE.md",
2339
+ "Trinity infrastructure"
2340
+ ]
2341
+
2342
+ for each pattern in patterns:
2343
+ if content.includes(pattern):
2344
+ matches = find_all_matches(content, pattern)
2345
+ for each match in matches:
2346
+ trinity_references.push({
2347
+ file: doc,
2348
+ pattern: pattern,
2349
+ line: match.line,
2350
+ context: match.context
2351
+ })
2352
+ ```
2353
+
2354
+ **Step 2: Remove Trinity References**
2355
+
2356
+ ```javascript
2357
+ violations_fixed = []
2358
+ violations_remaining = []
2359
+
2360
+ for each reference in trinity_references:
2361
+ // Attempt automatic fix
2362
+ fixed = attempt_fix(reference)
2363
+
2364
+ if fixed:
2365
+ violations_fixed.push(reference)
2366
+ else:
2367
+ // Flag for manual review
2368
+ violations_remaining.push(reference)
2369
+
2370
+ // Common fixes:
2371
+ function attempt_fix(reference):
2372
+ content = read(reference.file)
2373
+
2374
+ // Fix 1: Remove Trinity report links
2375
+ if reference.pattern.includes("trinity/reports/"):
2376
+ content = remove_line_containing(content, "trinity/reports/")
2377
+ write(reference.file, content)
2378
+ return true
2379
+
2380
+ // Fix 2: Remove Trinity glossary entries
2381
+ if reference.file.endsWith("glossary.md") and reference.pattern == "Trinity Method":
2382
+ // Check if entire section is about Trinity
2383
+ section = extract_section(content, reference.line)
2384
+ if section_is_about_trinity(section):
2385
+ content = remove_section(content, section)
2386
+ write(reference.file, content)
2387
+ return true
2388
+
2389
+ // Fix 3: Remove Trinity agent mentions
2390
+ if reference.pattern in ["APO", "MON", "ROR", "KIL", "BAS"]:
2391
+ // Only remove if in context of Trinity Method (not project code)
2392
+ if context_is_methodology(reference.context):
2393
+ content = remove_sentence_containing(content, reference.pattern)
2394
+ write(reference.file, content)
2395
+ return true
2396
+
2397
+ // Cannot auto-fix
2398
+ return false
2399
+ ```
2400
+
2401
+ **Step 3: Validate Zero Trinity References**
2402
+
2403
+ ```javascript
2404
+ // Re-scan after fixes
2405
+ final_scan = scan_for_trinity_references("docs/")
2406
+
2407
+ if final_scan.length > 0:
2408
+ ERROR: "❌ Trinity references still present in docs/ after sanitization"
2409
+ LOG: "Violations requiring manual review: {final_scan.length}"
2410
+ for each violation in final_scan:
2411
+ LOG: " - {violation.file}:{violation.line}: {violation.pattern}"
2412
+ ```
2413
+
2414
+ **APO Output:**
2415
+
2416
+ ```markdown
2417
+ === PHASE 4.5: TRINITY REFERENCE SANITIZATION ===
2418
+
2419
+ **Scan Results:**
2420
+ - Total Trinity references found: {trinity_references.length}
2421
+ - Auto-fixed: {violations_fixed.length}
2422
+ - Manual review required: {violations_remaining.length}
2423
+
2424
+ **Auto-Fixed Violations:**
2425
+ {for each fixed:}
2426
+ - ✅ {file}:{line}: Removed "{pattern}"
2427
+
2428
+ {if violations_remaining.length > 0:}
2429
+ **Manual Review Required:**
2430
+ {for each violation:}
2431
+ - ⚠️ {file}:{line}: "{pattern}" in context: {context}
2432
+ - **Action Required:** Manually review and remove Trinity reference
2433
+
2434
+ **Validation:** {✅ PASS | ❌ FAIL}
2435
+ {if PASS:}
2436
+ - ✅ Zero Trinity references in docs/ directory
2437
+ {if FAIL:}
2438
+ - ❌ {violations_remaining.length} Trinity references require manual removal
2439
+ ```
2440
+
2441
+ ---
2442
+
2074
2443
  **APO Output:**
2075
2444
 
2076
2445
  ```markdown
@@ -2204,5 +2573,5 @@ docs/
2204
2573
  ---
2205
2574
 
2206
2575
  **Command Specification Version:** 3.0.0
2207
- **Last Updated:** {{CURRENT_DATE}}
2576
+ **Last Updated**: {{CURRENT_DATE}}
2208
2577
  **Enhancements:** Codebase analysis, content seeding, migration, auto-generation, link validation, coverage metrics, framework-specific content, duplicate detection, TypeDoc integration, actionable recommendations