trinity-method-sdk 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/LICENSE +21 -0
  3. package/README.md +555 -0
  4. package/dist/cli/commands/deploy/agents.d.ts +14 -0
  5. package/dist/cli/commands/deploy/agents.js +59 -0
  6. package/dist/cli/commands/deploy/ci-cd.d.ts +13 -0
  7. package/dist/cli/commands/deploy/ci-cd.js +50 -0
  8. package/dist/cli/commands/deploy/claude-setup.d.ts +17 -0
  9. package/dist/cli/commands/deploy/claude-setup.js +91 -0
  10. package/dist/cli/commands/deploy/configuration.d.ts +13 -0
  11. package/dist/cli/commands/deploy/configuration.js +215 -0
  12. package/dist/cli/commands/deploy/directories.d.ts +12 -0
  13. package/dist/cli/commands/deploy/directories.js +38 -0
  14. package/dist/cli/commands/deploy/gitignore.d.ts +12 -0
  15. package/dist/cli/commands/deploy/gitignore.js +53 -0
  16. package/dist/cli/commands/deploy/index.d.ts +38 -0
  17. package/dist/cli/commands/deploy/index.js +156 -0
  18. package/dist/cli/commands/deploy/knowledge-base.d.ts +16 -0
  19. package/dist/cli/commands/deploy/knowledge-base.js +75 -0
  20. package/dist/cli/commands/deploy/linting.d.ts +18 -0
  21. package/dist/cli/commands/deploy/linting.js +51 -0
  22. package/dist/cli/commands/deploy/metrics.d.ts +13 -0
  23. package/dist/cli/commands/deploy/metrics.js +34 -0
  24. package/dist/cli/commands/deploy/pre-flight.d.ts +13 -0
  25. package/dist/cli/commands/deploy/pre-flight.js +29 -0
  26. package/dist/cli/commands/deploy/root-files.d.ts +16 -0
  27. package/dist/cli/commands/deploy/root-files.js +178 -0
  28. package/dist/cli/commands/deploy/sdk-install.d.ts +12 -0
  29. package/dist/cli/commands/deploy/sdk-install.js +57 -0
  30. package/dist/cli/commands/deploy/summary.d.ts +14 -0
  31. package/dist/cli/commands/deploy/summary.js +130 -0
  32. package/dist/cli/commands/deploy/templates.d.ts +14 -0
  33. package/dist/cli/commands/deploy/templates.js +84 -0
  34. package/dist/cli/commands/deploy/types.d.ts +39 -0
  35. package/dist/cli/commands/deploy/types.js +5 -0
  36. package/dist/cli/commands/update/agents.d.ts +14 -0
  37. package/dist/cli/commands/update/agents.js +31 -0
  38. package/dist/cli/commands/update/backup.d.ts +31 -0
  39. package/dist/cli/commands/update/backup.js +97 -0
  40. package/dist/cli/commands/update/commands.d.ts +14 -0
  41. package/dist/cli/commands/update/commands.js +75 -0
  42. package/dist/cli/commands/update/index.d.ts +15 -0
  43. package/dist/cli/commands/update/index.js +118 -0
  44. package/dist/cli/commands/update/knowledge-base.d.ts +14 -0
  45. package/dist/cli/commands/update/knowledge-base.js +38 -0
  46. package/dist/cli/commands/update/pre-flight.d.ts +13 -0
  47. package/dist/cli/commands/update/pre-flight.js +37 -0
  48. package/dist/cli/commands/update/summary.d.ts +20 -0
  49. package/dist/cli/commands/update/summary.js +47 -0
  50. package/dist/cli/commands/update/templates.d.ts +14 -0
  51. package/dist/cli/commands/update/templates.js +25 -0
  52. package/dist/cli/commands/update/types.d.ts +13 -0
  53. package/dist/cli/commands/update/types.js +7 -0
  54. package/dist/cli/commands/update/utils.d.ts +11 -0
  55. package/dist/cli/commands/update/utils.js +19 -0
  56. package/dist/cli/commands/update/verification.d.ts +20 -0
  57. package/dist/cli/commands/update/verification.js +54 -0
  58. package/dist/cli/commands/update/version.d.ts +18 -0
  59. package/dist/cli/commands/update/version.js +36 -0
  60. package/dist/cli/commands/update.d.ts +7 -0
  61. package/dist/cli/commands/update.js +7 -0
  62. package/dist/cli/index.d.ts +3 -0
  63. package/dist/cli/index.js +36 -0
  64. package/dist/cli/types.d.ts +77 -0
  65. package/dist/cli/types.js +5 -0
  66. package/dist/cli/utils/deploy-ci.d.ts +22 -0
  67. package/dist/cli/utils/deploy-ci.js +138 -0
  68. package/dist/cli/utils/deploy-linting.d.ts +3 -0
  69. package/dist/cli/utils/deploy-linting.js +136 -0
  70. package/dist/cli/utils/detect-stack.d.ts +3 -0
  71. package/dist/cli/utils/detect-stack.js +270 -0
  72. package/dist/cli/utils/error-classes.d.ts +63 -0
  73. package/dist/cli/utils/error-classes.js +84 -0
  74. package/dist/cli/utils/error-handler.d.ts +59 -0
  75. package/dist/cli/utils/error-handler.js +127 -0
  76. package/dist/cli/utils/errors.d.ts +52 -0
  77. package/dist/cli/utils/errors.js +102 -0
  78. package/dist/cli/utils/get-sdk-path.d.ts +18 -0
  79. package/dist/cli/utils/get-sdk-path.js +31 -0
  80. package/dist/cli/utils/inject-dependencies.d.ts +2 -0
  81. package/dist/cli/utils/inject-dependencies.js +55 -0
  82. package/dist/cli/utils/linting-tools.d.ts +8 -0
  83. package/dist/cli/utils/linting-tools.js +206 -0
  84. package/dist/cli/utils/metrics/code-quality.d.ts +32 -0
  85. package/dist/cli/utils/metrics/code-quality.js +122 -0
  86. package/dist/cli/utils/metrics/dependency-parser.d.ts +21 -0
  87. package/dist/cli/utils/metrics/dependency-parser.js +153 -0
  88. package/dist/cli/utils/metrics/file-complexity.d.ts +26 -0
  89. package/dist/cli/utils/metrics/file-complexity.js +77 -0
  90. package/dist/cli/utils/metrics/framework-detector.d.ts +17 -0
  91. package/dist/cli/utils/metrics/framework-detector.js +120 -0
  92. package/dist/cli/utils/metrics/git-metrics.d.ts +30 -0
  93. package/dist/cli/utils/metrics/git-metrics.js +83 -0
  94. package/dist/cli/utils/metrics/index.d.ts +28 -0
  95. package/dist/cli/utils/metrics/index.js +100 -0
  96. package/dist/cli/utils/template-processor.d.ts +10 -0
  97. package/dist/cli/utils/template-processor.js +188 -0
  98. package/dist/cli/utils/validate-path.d.ts +80 -0
  99. package/dist/cli/utils/validate-path.js +180 -0
  100. package/dist/index.d.ts +6 -0
  101. package/dist/index.js +8 -0
  102. package/dist/templates/agents/aj-team/apo-documentation-specialist.md.template +572 -0
  103. package/dist/templates/agents/aj-team/bas-quality-gate.md.template +906 -0
  104. package/dist/templates/agents/aj-team/bon-dependency-manager.md.template +636 -0
  105. package/dist/templates/agents/aj-team/cap-configuration-specialist.md.template +670 -0
  106. package/dist/templates/agents/aj-team/dra-code-reviewer.md.template +768 -0
  107. package/dist/templates/agents/aj-team/kil-task-executor.md.template +764 -0
  108. package/dist/templates/agents/aj-team/uro-refactoring-specialist.md.template +759 -0
  109. package/dist/templates/agents/audit/juno-auditor.md.template +447 -0
  110. package/dist/templates/agents/deployment/ein-cicd.md.template +694 -0
  111. package/dist/templates/agents/deployment/ino-context.md.template +733 -0
  112. package/dist/templates/agents/deployment/tan-structure.md.template +661 -0
  113. package/dist/templates/agents/deployment/zen-knowledge.md.template +451 -0
  114. package/dist/templates/agents/leadership/aj-cc.md.template +462 -0
  115. package/dist/templates/agents/leadership/aj-maestro.md.template +943 -0
  116. package/dist/templates/agents/leadership/aly-cto.md.template +407 -0
  117. package/dist/templates/agents/planning/eus-decomposer.md.template +496 -0
  118. package/dist/templates/agents/planning/mon-requirements.md.template +323 -0
  119. package/dist/templates/agents/planning/ror-design.md.template +465 -0
  120. package/dist/templates/agents/planning/tra-planner.md.template +432 -0
  121. package/dist/templates/ci/cd.yml.template +175 -0
  122. package/dist/templates/ci/ci.yml.template +196 -0
  123. package/dist/templates/ci/generic-ci.yml +115 -0
  124. package/dist/templates/ci/github-actions.yml +86 -0
  125. package/dist/templates/ci/gitlab-ci.yml +103 -0
  126. package/dist/templates/claude/EMPLOYEE-DIRECTORY.md.template +545 -0
  127. package/dist/templates/documentation/ROOT-README.md.template +307 -0
  128. package/dist/templates/documentation/SUBDIRECTORY-README.md.template +261 -0
  129. package/dist/templates/investigations/bug.md.template +484 -0
  130. package/dist/templates/investigations/feature.md.template +564 -0
  131. package/dist/templates/investigations/performance.md.template +625 -0
  132. package/dist/templates/investigations/security.md.template +714 -0
  133. package/dist/templates/investigations/technical.md.template +433 -0
  134. package/dist/templates/knowledge-base/AI-DEVELOPMENT-GUIDE.md.template +957 -0
  135. package/dist/templates/knowledge-base/ARCHITECTURE.md.template +452 -0
  136. package/dist/templates/knowledge-base/CODING-PRINCIPLES.md.template +750 -0
  137. package/dist/templates/knowledge-base/DOCUMENTATION-CRITERIA.md.template +1118 -0
  138. package/dist/templates/knowledge-base/ISSUES.md.template +539 -0
  139. package/dist/templates/knowledge-base/TESTING-PRINCIPLES.md.template +894 -0
  140. package/dist/templates/knowledge-base/Technical-Debt.md.template +640 -0
  141. package/dist/templates/knowledge-base/To-do.md.template +407 -0
  142. package/dist/templates/knowledge-base/Trinity.md.template +464 -0
  143. package/dist/templates/linting/flutter/.pre-commit-config.yaml.template +27 -0
  144. package/dist/templates/linting/flutter/analysis_options.yaml.template +26 -0
  145. package/dist/templates/linting/nodejs/.eslintrc-commonjs.json.template +19 -0
  146. package/dist/templates/linting/nodejs/.eslintrc-esm.json.template +19 -0
  147. package/dist/templates/linting/nodejs/.eslintrc-typescript.json.template +22 -0
  148. package/dist/templates/linting/nodejs/.pre-commit-config.yaml.template +51 -0
  149. package/dist/templates/linting/nodejs/.prettierrc.json.template +10 -0
  150. package/dist/templates/linting/python/.flake8.template +16 -0
  151. package/dist/templates/linting/python/.pre-commit-config.yaml.template +30 -0
  152. package/dist/templates/linting/python/pyproject.toml.template +38 -0
  153. package/dist/templates/linting/rust/.pre-commit-config.yaml.template +28 -0
  154. package/dist/templates/linting/rust/clippy.toml.template +14 -0
  155. package/dist/templates/linting/rust/rustfmt.toml.template +12 -0
  156. package/dist/templates/root/CLAUDE.md.template +65 -0
  157. package/dist/templates/root/TRINITY.md.template +52 -0
  158. package/dist/templates/shared/claude-commands/trinity-agents.md.template +168 -0
  159. package/dist/templates/shared/claude-commands/trinity-audit.md.template +646 -0
  160. package/dist/templates/shared/claude-commands/trinity-changelog.md.template +624 -0
  161. package/dist/templates/shared/claude-commands/trinity-continue.md.template +549 -0
  162. package/dist/templates/shared/claude-commands/trinity-create-investigation.md.template +232 -0
  163. package/dist/templates/shared/claude-commands/trinity-decompose.md.template +181 -0
  164. package/dist/templates/shared/claude-commands/trinity-design.md.template +347 -0
  165. package/dist/templates/shared/claude-commands/trinity-docs.md.template +2093 -0
  166. package/dist/templates/shared/claude-commands/trinity-end.md.template +397 -0
  167. package/dist/templates/shared/claude-commands/trinity-init.md.template +606 -0
  168. package/dist/templates/shared/claude-commands/trinity-investigate-templates.md.template +725 -0
  169. package/dist/templates/shared/claude-commands/trinity-orchestrate.md.template +1061 -0
  170. package/dist/templates/shared/claude-commands/trinity-plan-investigation.md.template +135 -0
  171. package/dist/templates/shared/claude-commands/trinity-plan.md.template +201 -0
  172. package/dist/templates/shared/claude-commands/trinity-readme.md.template +1971 -0
  173. package/dist/templates/shared/claude-commands/trinity-requirements.md.template +148 -0
  174. package/dist/templates/shared/claude-commands/trinity-start.md.template +268 -0
  175. package/dist/templates/shared/claude-commands/trinity-verify.md.template +453 -0
  176. package/dist/templates/shared/claude-commands/trinity-workorder.md.template +249 -0
  177. package/dist/templates/source/base-CLAUDE.md.template +310 -0
  178. package/dist/templates/source/flutter-CLAUDE.md.template +593 -0
  179. package/dist/templates/source/nodejs-CLAUDE.md.template +531 -0
  180. package/dist/templates/source/python-CLAUDE.md.template +510 -0
  181. package/dist/templates/source/react-CLAUDE.md.template +513 -0
  182. package/dist/templates/source/rust-CLAUDE.md.template +653 -0
  183. package/dist/templates/source/tests-CLAUDE.md.template +432 -0
  184. package/dist/templates/trinity/CLAUDE.md.template +372 -0
  185. package/dist/templates/work-orders/ANALYSIS-TEMPLATE.md.template +276 -0
  186. package/dist/templates/work-orders/AUDIT-TEMPLATE.md.template +262 -0
  187. package/dist/templates/work-orders/IMPLEMENTATION-TEMPLATE.md.template +260 -0
  188. package/dist/templates/work-orders/INVESTIGATION-TEMPLATE.md.template +206 -0
  189. package/dist/templates/work-orders/PATTERN-TEMPLATE.md.template +320 -0
  190. package/dist/templates/work-orders/VERIFICATION-TEMPLATE.md.template +273 -0
  191. package/package.json +94 -0
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Trinity Method SDK installation
3
+ */
4
+ import fs from 'fs-extra';
5
+ import chalk from 'chalk';
6
+ /**
7
+ * Install Trinity Method SDK to the project
8
+ *
9
+ * @param spinner - Spinner instance for status updates
10
+ * @returns True if SDK was installed, false otherwise
11
+ */
12
+ export async function installSDK(spinner) {
13
+ spinner.start('Installing Trinity Method SDK...');
14
+ try {
15
+ const { execSync } = await import('child_process');
16
+ const packageJsonPath = 'package.json';
17
+ if (await fs.pathExists(packageJsonPath)) {
18
+ // Check if SDK is already installed
19
+ const packageJson = await fs.readJson(packageJsonPath);
20
+ const hasSDK = packageJson.dependencies?.['trinity-method-sdk'] ||
21
+ packageJson.devDependencies?.['trinity-method-sdk'];
22
+ if (!hasSDK) {
23
+ // Add SDK to package.json dependencies
24
+ if (!packageJson.dependencies) {
25
+ packageJson.dependencies = {};
26
+ }
27
+ packageJson.dependencies['trinity-method-sdk'] = '^2.0.0';
28
+ await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
29
+ spinner.text = 'Installing Trinity Method SDK (this may take a moment)...';
30
+ // Install dependencies
31
+ execSync('npm install', {
32
+ stdio: 'pipe',
33
+ cwd: process.cwd(),
34
+ });
35
+ spinner.succeed('Trinity Method SDK installed successfully');
36
+ return true;
37
+ }
38
+ else {
39
+ spinner.info('Trinity Method SDK already installed');
40
+ return false;
41
+ }
42
+ }
43
+ else {
44
+ spinner.warn('No package.json found - SDK not installed');
45
+ console.log(chalk.yellow(' Run: npm init -y && npm install trinity-method-sdk'));
46
+ return false;
47
+ }
48
+ }
49
+ catch (error) {
50
+ spinner.warn('SDK installation skipped');
51
+ const { getErrorMessage } = await import('../../utils/errors.js');
52
+ console.log(chalk.yellow(` Install manually: npm install trinity-method-sdk`));
53
+ console.log(chalk.gray(` Error: ${getErrorMessage(error)}`));
54
+ return false;
55
+ }
56
+ }
57
+ //# sourceMappingURL=sdk-install.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Deployment summary display
3
+ */
4
+ import type { DeployOptions, Stack, CodebaseMetrics, DeploymentProgress } from './types.js';
5
+ /**
6
+ * Display deployment summary with statistics and next steps
7
+ *
8
+ * @param stats - Deployment progress statistics
9
+ * @param options - Deploy command options
10
+ * @param stack - Detected technology stack
11
+ * @param metrics - Collected codebase metrics
12
+ */
13
+ export declare function displaySummary(stats: DeploymentProgress, options: DeployOptions, stack: Stack, metrics: CodebaseMetrics): Promise<void>;
14
+ //# sourceMappingURL=summary.d.ts.map
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Deployment summary display
3
+ */
4
+ import fs from 'fs-extra';
5
+ import chalk from 'chalk';
6
+ /**
7
+ * Display deployment statistics section
8
+ */
9
+ function displayStatistics(stats, stack, claudeMdCount, claudeMdSummary) {
10
+ console.log(chalk.cyan('📊 Deployment Statistics (v2.0):\n'));
11
+ console.log(chalk.white(` Directories Created: ${stats.directories || 17}`));
12
+ console.log(chalk.white(` Agents Deployed: ${stats.agentsDeployed} (v2.0: 2 leadership + 4 planning + 7 execution + 4 deployment + 1 audit)`));
13
+ console.log(chalk.white(` Best Practices: 4 documents (CODING, TESTING, AI-DEV, DOCS)`));
14
+ console.log(chalk.white(` Templates Deployed: ${stats.templatesDeployed} (6 work orders)`));
15
+ console.log(chalk.white(` Files Created: ${stats.rootFilesDeployed}`));
16
+ console.log(chalk.white(` CLAUDE.md Files: ${claudeMdCount} (${claudeMdSummary})`));
17
+ const totalComponents = (stats.directories || 17) +
18
+ stats.agentsDeployed +
19
+ stats.templatesDeployed +
20
+ stats.rootFilesDeployed;
21
+ console.log(chalk.white(` Total Components: ${totalComponents}`));
22
+ console.log('');
23
+ }
24
+ /**
25
+ * Display codebase metrics section
26
+ */
27
+ function displayMetrics(options, metrics) {
28
+ if (!options.skipAudit && metrics.totalFiles > 0) {
29
+ console.log(chalk.cyan('🔍 Codebase Metrics:'));
30
+ console.log(chalk.white(` Files Analyzed: ${metrics.totalFiles}`));
31
+ console.log(chalk.white(` Technical Debt Items: ${metrics.todoCount}`));
32
+ console.log(chalk.white(` Large Files (>500 lines): ${metrics.filesOver500}`));
33
+ console.log(chalk.white(` Dependencies: ${metrics.dependencyCount}`));
34
+ console.log(chalk.yellow('\n Note: Advanced metrics require agent analysis'));
35
+ console.log(chalk.blue(' Complete deployment with knowledge base agent:'));
36
+ console.log(chalk.white(' /trinity-zen'));
37
+ console.log(chalk.white(' (Completes ARCHITECTURE.md and Technical-Debt.md with semantic analysis)\n'));
38
+ }
39
+ else if (options.skipAudit) {
40
+ console.log(chalk.yellow('⚠️ Audit skipped - documents contain placeholders'));
41
+ console.log(chalk.blue(' Deploy agents to complete documentation\n'));
42
+ }
43
+ }
44
+ /**
45
+ * Display quick start commands section
46
+ */
47
+ function displayQuickStartCommands() {
48
+ console.log(chalk.cyan('📚 Quick Start Commands:\n'));
49
+ console.log(chalk.white(' /trinity-init ') +
50
+ chalk.gray('- Complete Trinity integration (run first!)'));
51
+ console.log(chalk.white(' /trinity-verify ') + chalk.gray('- Verify installation'));
52
+ console.log(chalk.white(' /trinity-start ') + chalk.gray('- Start a workflow'));
53
+ console.log(chalk.white('\n 🤖 v2.0 AI Orchestration:'));
54
+ console.log(chalk.white(' /trinity-orchestrate ') +
55
+ chalk.gray('- AI-orchestrated implementation (AJ MAESTRO)'));
56
+ console.log(chalk.white(' /trinity-requirements ') + chalk.gray('- Analyze requirements (MON)'));
57
+ console.log(chalk.white(' /trinity-design ') + chalk.gray('- Create technical design (ROR)'));
58
+ console.log(chalk.white(' /trinity-plan ') + chalk.gray('- Plan implementation (TRA)'));
59
+ console.log(chalk.white(' /trinity-decompose ') + chalk.gray('- Decompose into atomic tasks (EUS)'));
60
+ console.log(chalk.white('\n 📋 Legacy Commands:'));
61
+ console.log(chalk.white(' /trinity-workorder ') + chalk.gray('- Create a work order'));
62
+ console.log(chalk.white(' /trinity-agents ') + chalk.gray('- View agent directory'));
63
+ console.log(chalk.white(' /trinity-continue ') + chalk.gray('- Resume after interruption'));
64
+ console.log(chalk.white(' /trinity-end ') + chalk.gray('- End session & archive\n'));
65
+ console.log(chalk.yellow('💡 Tip: ') +
66
+ chalk.white('Run /trinity-init, then use /trinity-orchestrate for AI-powered implementation\n'));
67
+ }
68
+ /**
69
+ * Display next steps section
70
+ */
71
+ function displayNextSteps(options, stack) {
72
+ console.log(chalk.cyan('📚 Next Steps:\n'));
73
+ let step = 1;
74
+ // Linting dependencies installation
75
+ if (options.lintingDependencies && options.lintingDependencies.length > 0) {
76
+ console.log(chalk.white(` ${step}. Install linting dependencies:`));
77
+ const installCmd = stack.framework === 'Python' ? 'pip install -r requirements-dev.txt' : 'npm install';
78
+ console.log(chalk.yellow(` ${installCmd}\n`));
79
+ step++;
80
+ }
81
+ // Pre-commit hooks setup
82
+ if (options.postInstallInstructions && options.postInstallInstructions.length > 0) {
83
+ console.log(chalk.white(` ${step}. Setup pre-commit hooks (one-time):`));
84
+ options.postInstallInstructions.forEach((instruction) => {
85
+ console.log(chalk.yellow(` ${instruction.command}`));
86
+ });
87
+ console.log('');
88
+ step++;
89
+ }
90
+ // Standard next steps
91
+ console.log(chalk.white(` ${step}. Review trinity/knowledge-base/ARCHITECTURE.md`));
92
+ console.log(chalk.white(` ${step + 1}. Update trinity/knowledge-base/To-do.md`));
93
+ console.log(chalk.white(` ${step + 2}. Open Claude Code and start your first Trinity session`));
94
+ console.log(chalk.white(` ${step + 3}. Agents will be automatically invoked as needed\n`));
95
+ // Test linting command (if applicable)
96
+ if (options.lintingScripts && Object.keys(options.lintingScripts).length > 0) {
97
+ console.log(chalk.cyan('🧪 Test Linting:\n'));
98
+ console.log(chalk.white(' After installing dependencies, try:'));
99
+ Object.keys(options.lintingScripts).forEach((scriptName) => {
100
+ console.log(chalk.yellow(` npm run ${scriptName}`));
101
+ });
102
+ console.log('');
103
+ }
104
+ }
105
+ /**
106
+ * Display deployment summary with statistics and next steps
107
+ *
108
+ * @param stats - Deployment progress statistics
109
+ * @param options - Deploy command options
110
+ * @param stack - Detected technology stack
111
+ * @param metrics - Collected codebase metrics
112
+ */
113
+ export async function displaySummary(stats, options, stack, metrics) {
114
+ console.log(chalk.green.bold('\n✅ Trinity Method deployed successfully!\n'));
115
+ // Calculate CLAUDE.md deployment summary
116
+ const hasTests = await fs.pathExists('tests/CLAUDE.md');
117
+ const claudeMdCount = 2 + stack.sourceDirs.length + (hasTests ? 1 : 0);
118
+ const sourceDirsList = stack.sourceDirs.length > 3
119
+ ? `${stack.sourceDirs.slice(0, 3).join(', ')}... (${stack.sourceDirs.length} total)`
120
+ : stack.sourceDirs.join(', ');
121
+ const claudeMdSummary = hasTests
122
+ ? `root + trinity + tests + ${sourceDirsList}`
123
+ : `root + trinity + ${sourceDirsList}`;
124
+ // Display all sections
125
+ displayStatistics(stats, stack, claudeMdCount, claudeMdSummary);
126
+ displayMetrics(options, metrics);
127
+ displayQuickStartCommands();
128
+ displayNextSteps(options, stack);
129
+ }
130
+ //# sourceMappingURL=summary.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Template deployment (work orders, investigations, documentation)
3
+ */
4
+ import type { Spinner } from './types.js';
5
+ /**
6
+ * Deploy work order, investigation, and documentation templates
7
+ *
8
+ * @param templatesPath - Path to templates directory
9
+ * @param variables - Template variables for substitution
10
+ * @param spinner - Spinner instance for status updates
11
+ * @returns Number of templates deployed
12
+ */
13
+ export declare function deployTemplates(templatesPath: string, variables: Record<string, string>, spinner: Spinner): Promise<number>;
14
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Template deployment (work orders, investigations, documentation)
3
+ */
4
+ import fs from 'fs-extra';
5
+ import path from 'path';
6
+ import { processTemplate } from '../../utils/template-processor.js';
7
+ import { validatePath } from '../../utils/validate-path.js';
8
+ /**
9
+ * Deploy work order, investigation, and documentation templates
10
+ *
11
+ * @param templatesPath - Path to templates directory
12
+ * @param variables - Template variables for substitution
13
+ * @param spinner - Spinner instance for status updates
14
+ * @returns Number of templates deployed
15
+ */
16
+ export async function deployTemplates(templatesPath, variables, spinner) {
17
+ let templatesDeployed = 0;
18
+ // Deploy work order templates
19
+ spinner.start('Deploying work order templates...');
20
+ const woTemplates = [
21
+ 'INVESTIGATION-TEMPLATE.md.template',
22
+ 'IMPLEMENTATION-TEMPLATE.md.template',
23
+ 'ANALYSIS-TEMPLATE.md.template',
24
+ 'AUDIT-TEMPLATE.md.template',
25
+ 'PATTERN-TEMPLATE.md.template',
26
+ 'VERIFICATION-TEMPLATE.md.template',
27
+ ];
28
+ await fs.ensureDir('trinity/templates/work-orders');
29
+ for (const template of woTemplates) {
30
+ const templatePath = path.join(templatesPath, 'work-orders', template);
31
+ if (await fs.pathExists(templatePath)) {
32
+ const content = await fs.readFile(templatePath, 'utf8');
33
+ const processed = processTemplate(content, variables);
34
+ const deployedName = template.replace('.template', '');
35
+ // Validate destination path for security
36
+ const destPath = validatePath(`trinity/templates/work-orders/${deployedName}`);
37
+ await fs.writeFile(destPath, processed);
38
+ templatesDeployed++;
39
+ }
40
+ }
41
+ spinner.succeed(`Work order templates deployed (${woTemplates.length} templates)`);
42
+ // Deploy investigation templates
43
+ spinner.start('Deploying investigation templates...');
44
+ const investigationTemplates = [
45
+ 'bug.md.template',
46
+ 'feature.md.template',
47
+ 'performance.md.template',
48
+ 'security.md.template',
49
+ 'technical.md.template',
50
+ ];
51
+ await fs.ensureDir('trinity/templates/investigations');
52
+ for (const template of investigationTemplates) {
53
+ const templatePath = path.join(templatesPath, 'investigations', template);
54
+ if (await fs.pathExists(templatePath)) {
55
+ const content = await fs.readFile(templatePath, 'utf8');
56
+ const processed = processTemplate(content, variables);
57
+ const deployedName = template.replace('.template', '');
58
+ // Validate destination path for security
59
+ const destPath = validatePath(`trinity/templates/investigations/${deployedName}`);
60
+ await fs.writeFile(destPath, processed);
61
+ templatesDeployed++;
62
+ }
63
+ }
64
+ spinner.succeed(`Investigation templates deployed (${investigationTemplates.length} templates)`);
65
+ // Deploy documentation templates
66
+ spinner.start('Deploying documentation templates...');
67
+ const documentationTemplates = ['ROOT-README.md.template', 'SUBDIRECTORY-README.md.template'];
68
+ await fs.ensureDir('trinity/templates/documentation');
69
+ for (const template of documentationTemplates) {
70
+ const templatePath = path.join(templatesPath, 'documentation', template);
71
+ if (await fs.pathExists(templatePath)) {
72
+ const content = await fs.readFile(templatePath, 'utf8');
73
+ const processed = processTemplate(content, variables);
74
+ const deployedName = template.replace('.template', '');
75
+ // Validate destination path for security
76
+ const destPath = validatePath(`trinity/templates/documentation/${deployedName}`);
77
+ await fs.writeFile(destPath, processed);
78
+ templatesDeployed++;
79
+ }
80
+ }
81
+ spinner.succeed(`Documentation templates deployed (${documentationTemplates.length} templates)`);
82
+ return templatesDeployed;
83
+ }
84
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Shared types for deploy command modules
3
+ */
4
+ import type { Ora } from 'ora';
5
+ import type { DeployOptions, Stack, CodebaseMetrics, LintingTool, PostInstallInstruction } from '../../types.js';
6
+ export type { DeployOptions, Stack, CodebaseMetrics, LintingTool, PostInstallInstruction };
7
+ /**
8
+ * Configuration collected during deploy setup
9
+ */
10
+ export interface DeployConfig {
11
+ projectName: string;
12
+ stack: Stack;
13
+ metrics: CodebaseMetrics;
14
+ lintingTools: LintingTool[];
15
+ lintingDependencies: string[];
16
+ lintingScripts: Record<string, string>;
17
+ postInstallInstructions: PostInstallInstruction[];
18
+ enableLinting: boolean;
19
+ enableCICD: boolean;
20
+ enableWorkOrders: boolean;
21
+ enableInvestigations: boolean;
22
+ enableDocs: boolean;
23
+ }
24
+ /**
25
+ * Statistics tracked during deployment
26
+ */
27
+ export interface DeploymentProgress {
28
+ directories?: number;
29
+ agentsDeployed: number;
30
+ commandsDeployed: number;
31
+ knowledgeBaseFiles: number;
32
+ templatesDeployed: number;
33
+ rootFilesDeployed: number;
34
+ }
35
+ /**
36
+ * Shared spinner instance passed between modules
37
+ */
38
+ export type Spinner = Ora;
39
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Shared types for deploy command modules
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Update Agents Module
3
+ * Handles updating agent files in .claude/agents/
4
+ * @module cli/commands/update/agents
5
+ */
6
+ import { Ora } from 'ora';
7
+ import { UpdateStats } from './types.js';
8
+ /**
9
+ * Update agent files from SDK to .claude/agents/
10
+ * @param spinner - ora spinner instance for status display
11
+ * @param stats - update statistics to track progress
12
+ */
13
+ export declare function updateAgents(spinner: Ora, stats: UpdateStats): Promise<void>;
14
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Update Agents Module
3
+ * Handles updating agent files in .claude/agents/
4
+ * @module cli/commands/update/agents
5
+ */
6
+ import fs from 'fs-extra';
7
+ import path from 'path';
8
+ import { getSDKPath } from './utils.js';
9
+ /** Agent subdirectories to update */
10
+ const AGENT_DIRS = ['leadership', 'planning', 'aj-team', 'deployment', 'audit'];
11
+ /**
12
+ * Update agent files from SDK to .claude/agents/
13
+ * @param spinner - ora spinner instance for status display
14
+ * @param stats - update statistics to track progress
15
+ */
16
+ export async function updateAgents(spinner, stats) {
17
+ spinner.start('Updating agents...');
18
+ const sdkPath = await getSDKPath();
19
+ const agentsTemplatePath = path.join(sdkPath, 'dist/templates/agents');
20
+ for (const agentDir of AGENT_DIRS) {
21
+ const sourcePath = path.join(agentsTemplatePath, agentDir);
22
+ const targetPath = path.join('.claude/agents', agentDir);
23
+ if (await fs.pathExists(sourcePath)) {
24
+ await fs.copy(sourcePath, targetPath, { overwrite: true });
25
+ const files = await fs.readdir(sourcePath);
26
+ stats.agentsUpdated += files.length;
27
+ }
28
+ }
29
+ spinner.succeed(`Agents updated (${stats.agentsUpdated} files)`);
30
+ }
31
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Update Backup Module
3
+ * Handles backup creation and rollback operations
4
+ * @module cli/commands/update/backup
5
+ */
6
+ import { Ora } from 'ora';
7
+ /**
8
+ * Create backup of Trinity Method files before update
9
+ * @param spinner - ora spinner instance for status display
10
+ * @returns Path to backup directory
11
+ */
12
+ export declare function createUpdateBackup(spinner: Ora): Promise<string>;
13
+ /**
14
+ * Restore user-managed content from backup
15
+ * @param backupDir - Path to backup directory
16
+ * @param spinner - ora spinner instance for status display
17
+ */
18
+ export declare function restoreUserContent(backupDir: string, spinner: Ora): Promise<void>;
19
+ /**
20
+ * Rollback from backup in case of update failure
21
+ * @param backupDir - Path to backup directory
22
+ * @throws {Error} If rollback fails
23
+ */
24
+ export declare function rollbackFromBackup(backupDir: string): Promise<void>;
25
+ /**
26
+ * Cleanup backup directory after successful update
27
+ * @param backupDir - Path to backup directory
28
+ * @param spinner - ora spinner instance for status display
29
+ */
30
+ export declare function cleanupBackup(backupDir: string, spinner: Ora): Promise<void>;
31
+ //# sourceMappingURL=backup.d.ts.map
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Update Backup Module
3
+ * Handles backup creation and rollback operations
4
+ * @module cli/commands/update/backup
5
+ */
6
+ import fs from 'fs-extra';
7
+ import path from 'path';
8
+ /** User-managed files that need backup */
9
+ const USER_FILES = [
10
+ 'trinity/knowledge-base/ARCHITECTURE.md',
11
+ 'trinity/knowledge-base/To-do.md',
12
+ 'trinity/knowledge-base/ISSUES.md',
13
+ 'trinity/knowledge-base/Technical-Debt.md',
14
+ ];
15
+ /**
16
+ * Create backup of Trinity Method files before update
17
+ * @param spinner - ora spinner instance for status display
18
+ * @returns Path to backup directory
19
+ */
20
+ export async function createUpdateBackup(spinner) {
21
+ spinner.start('Creating backup...');
22
+ const backupDir = `.trinity-backup-${Date.now()}`;
23
+ await fs.ensureDir(backupDir);
24
+ // Backup user-managed files
25
+ for (const file of USER_FILES) {
26
+ if (await fs.pathExists(file)) {
27
+ const backupPath = path.join(backupDir, path.basename(file));
28
+ await fs.copy(file, backupPath);
29
+ }
30
+ }
31
+ // Backup entire trinity and .claude dirs for rollback safety
32
+ await fs.copy('trinity', path.join(backupDir, 'trinity'));
33
+ await fs.copy('.claude', path.join(backupDir, '.claude'));
34
+ spinner.succeed('Backup created');
35
+ return backupDir;
36
+ }
37
+ /**
38
+ * Restore user-managed content from backup
39
+ * @param backupDir - Path to backup directory
40
+ * @param spinner - ora spinner instance for status display
41
+ */
42
+ export async function restoreUserContent(backupDir, spinner) {
43
+ spinner.start('Restoring user content...');
44
+ for (const file of USER_FILES) {
45
+ const backupFile = path.join(backupDir, path.basename(file));
46
+ if (await fs.pathExists(backupFile)) {
47
+ await fs.copy(backupFile, file, { overwrite: true });
48
+ }
49
+ }
50
+ spinner.succeed('User content restored');
51
+ }
52
+ /**
53
+ * Rollback from backup in case of update failure
54
+ * @param backupDir - Path to backup directory
55
+ * @throws {Error} If rollback fails
56
+ */
57
+ export async function rollbackFromBackup(backupDir) {
58
+ if (!(await fs.pathExists(backupDir))) {
59
+ return; // No backup to rollback from
60
+ }
61
+ const rollbackSpinner = await import('ora').then((m) => m.default('Restoring from backup...').start());
62
+ try {
63
+ // Restore trinity directory
64
+ if (await fs.pathExists(path.join(backupDir, 'trinity'))) {
65
+ await fs.remove('trinity');
66
+ await fs.copy(path.join(backupDir, 'trinity'), 'trinity');
67
+ }
68
+ // Restore .claude directory
69
+ if (await fs.pathExists(path.join(backupDir, '.claude'))) {
70
+ await fs.remove('.claude');
71
+ await fs.copy(path.join(backupDir, '.claude'), '.claude');
72
+ }
73
+ // Cleanup backup
74
+ await fs.remove(backupDir);
75
+ rollbackSpinner.succeed('Rollback complete - Original state restored');
76
+ console.log('');
77
+ }
78
+ catch (rollbackError) {
79
+ rollbackSpinner.fail('Rollback failed');
80
+ const { displayError, displayWarning, displayInfo, getErrorMessage } = await import('../../utils/errors.js');
81
+ displayError(`CRITICAL: Rollback failed: ${getErrorMessage(rollbackError)}`);
82
+ displayWarning(`Backup preserved at: ${backupDir}`);
83
+ displayInfo('Manually restore from backup if needed');
84
+ throw rollbackError;
85
+ }
86
+ }
87
+ /**
88
+ * Cleanup backup directory after successful update
89
+ * @param backupDir - Path to backup directory
90
+ * @param spinner - ora spinner instance for status display
91
+ */
92
+ export async function cleanupBackup(backupDir, spinner) {
93
+ spinner.start('Cleaning up...');
94
+ await fs.remove(backupDir);
95
+ spinner.succeed('Cleanup complete');
96
+ }
97
+ //# sourceMappingURL=backup.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Update Commands Module
3
+ * Handles updating slash command files in .claude/commands/
4
+ * @module cli/commands/update/commands
5
+ */
6
+ import { Ora } from 'ora';
7
+ import { UpdateStats } from './types.js';
8
+ /**
9
+ * Update slash command files from SDK to .claude/commands/
10
+ * @param spinner - ora spinner instance for status display
11
+ * @param stats - update statistics to track progress
12
+ */
13
+ export declare function updateCommands(spinner: Ora, stats: UpdateStats): Promise<void>;
14
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Update Commands Module
3
+ * Handles updating slash command files in .claude/commands/
4
+ * @module cli/commands/update/commands
5
+ */
6
+ import fs from 'fs-extra';
7
+ import path from 'path';
8
+ import { getSDKPath } from './utils.js';
9
+ /** Command categories */
10
+ const COMMAND_CATEGORIES = [
11
+ 'session',
12
+ 'planning',
13
+ 'execution',
14
+ 'investigation',
15
+ 'infrastructure',
16
+ 'utility',
17
+ ];
18
+ /**
19
+ * Determine command category based on filename
20
+ * @param filename - Command file name
21
+ * @returns Category name
22
+ */
23
+ function determineCommandCategory(filename) {
24
+ if (filename.includes('start') || filename.includes('continue') || filename.includes('end')) {
25
+ return 'session';
26
+ }
27
+ else if (filename.includes('requirements') ||
28
+ filename.includes('design') ||
29
+ filename.includes('plan') ||
30
+ filename.includes('decompose')) {
31
+ return 'planning';
32
+ }
33
+ else if (filename.includes('orchestrate')) {
34
+ return 'execution';
35
+ }
36
+ else if (filename.includes('investigation')) {
37
+ return 'investigation';
38
+ }
39
+ else if (filename.includes('init')) {
40
+ return 'infrastructure';
41
+ }
42
+ return 'utility';
43
+ }
44
+ /**
45
+ * Update slash command files from SDK to .claude/commands/
46
+ * @param spinner - ora spinner instance for status display
47
+ * @param stats - update statistics to track progress
48
+ */
49
+ export async function updateCommands(spinner, stats) {
50
+ spinner.start('Updating slash commands...');
51
+ const sdkPath = await getSDKPath();
52
+ const commandsTemplatePath = path.join(sdkPath, 'dist/templates/shared/claude-commands');
53
+ if (!(await fs.pathExists(commandsTemplatePath))) {
54
+ spinner.warn('Commands template path not found, skipping');
55
+ return;
56
+ }
57
+ // Create command category directories
58
+ for (const category of COMMAND_CATEGORIES) {
59
+ const targetCategoryPath = path.join('.claude/commands', category);
60
+ await fs.ensureDir(targetCategoryPath);
61
+ }
62
+ // Copy all command files
63
+ const commandFiles = await fs.readdir(commandsTemplatePath);
64
+ for (const file of commandFiles) {
65
+ if (file.endsWith('.md')) {
66
+ const sourcePath = path.join(commandsTemplatePath, file);
67
+ const category = determineCommandCategory(file);
68
+ const targetPath = path.join('.claude/commands', category, file);
69
+ await fs.copy(sourcePath, targetPath, { overwrite: true });
70
+ stats.commandsUpdated++;
71
+ }
72
+ }
73
+ spinner.succeed(`Slash commands updated (${stats.commandsUpdated} files)`);
74
+ }
75
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Update Command - Orchestrator
3
+ * Coordinates update process with focused helper functions
4
+ * @see docs/workflows/update-workflow.md
5
+ * **Trinity Principle:** "Systematic Quality Assurance" - Keep deployment current
6
+ * @module cli/commands/update
7
+ */
8
+ import { UpdateOptions } from '../../types.js';
9
+ /**
10
+ * Update Trinity Method SDK deployment to latest version
11
+ * Orchestrates the update process with focused helper functions
12
+ * @param options - Update command options
13
+ */
14
+ export declare function update(options: UpdateOptions): Promise<void>;
15
+ //# sourceMappingURL=index.d.ts.map