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,118 @@
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 ora from 'ora';
9
+ import chalk from 'chalk';
10
+ import inquirer from 'inquirer';
11
+ import { runUpdatePreflightChecks } from './pre-flight.js';
12
+ import { detectInstalledSDKVersion } from './version.js';
13
+ import { createUpdateBackup, restoreUserContent, rollbackFromBackup, cleanupBackup, } from './backup.js';
14
+ import { updateAgents } from './agents.js';
15
+ import { updateCommands } from './commands.js';
16
+ import { updateTemplates } from './templates.js';
17
+ import { updateKnowledgeBase } from './knowledge-base.js';
18
+ import { verifyUpdateDeployment, updateVersionFile } from './verification.js';
19
+ import { displayUpdateSummary, displayDryRunPreview } from './summary.js';
20
+ import { UpdateError } from '../../utils/error-classes.js';
21
+ import { errorHandler } from '../../utils/error-handler.js';
22
+ /**
23
+ * Update Trinity Method SDK deployment to latest version
24
+ * Orchestrates the update process with focused helper functions
25
+ * @param options - Update command options
26
+ */
27
+ export async function update(options) {
28
+ console.log(chalk.blue.bold('\n🔄 Trinity Method SDK - Update\n'));
29
+ const spinner = ora();
30
+ let backupDir = null;
31
+ const stats = {
32
+ agentsUpdated: 0,
33
+ templatesUpdated: 0,
34
+ knowledgeBaseUpdated: 0,
35
+ commandsUpdated: 0,
36
+ filesUpdated: 0,
37
+ };
38
+ try {
39
+ // STEP 1: Pre-flight checks
40
+ await runUpdatePreflightChecks(spinner);
41
+ // STEP 2: Version check
42
+ const versionInfo = await detectInstalledSDKVersion(spinner);
43
+ if (versionInfo.isUpToDate) {
44
+ console.log(chalk.green('✅ Already up to date\n'));
45
+ return;
46
+ }
47
+ // STEP 3: Dry-run preview or confirmation
48
+ if (options.dryRun) {
49
+ displayDryRunPreview(versionInfo.currentVersion, versionInfo.latestVersion);
50
+ return;
51
+ }
52
+ const { confirm } = await inquirer.prompt([
53
+ {
54
+ type: 'confirm',
55
+ name: 'confirm',
56
+ message: `Update Trinity Method from ${versionInfo.currentVersion} to ${versionInfo.latestVersion}?`,
57
+ default: true,
58
+ },
59
+ ]);
60
+ if (!confirm) {
61
+ console.log(chalk.yellow('Update cancelled\n'));
62
+ return;
63
+ }
64
+ // STEP 4: Create backup
65
+ backupDir = await createUpdateBackup(spinner);
66
+ // Register cleanup for backup directory
67
+ errorHandler.registerCleanup('Remove backup directory', async () => {
68
+ if (backupDir) {
69
+ await cleanupBackup(backupDir, ora());
70
+ }
71
+ });
72
+ // STEP 5-8: Update components
73
+ await updateAgents(spinner, stats);
74
+ await updateCommands(spinner, stats);
75
+ await updateTemplates(spinner, stats);
76
+ await updateKnowledgeBase(spinner, stats);
77
+ // STEP 9: Restore user content
78
+ await restoreUserContent(backupDir, spinner);
79
+ // STEP 10: Update VERSION file
80
+ await updateVersionFile(spinner, versionInfo.latestVersion);
81
+ // STEP 11: Verification
82
+ await verifyUpdateDeployment(spinner, versionInfo.latestVersion);
83
+ // STEP 12: Cleanup backup
84
+ await cleanupBackup(backupDir, spinner);
85
+ backupDir = null; // Mark as cleaned up
86
+ errorHandler.clearCleanup(); // Clear cleanup since we did it manually
87
+ // SUCCESS: Display summary
88
+ displayUpdateSummary(stats, versionInfo.currentVersion, versionInfo.latestVersion);
89
+ }
90
+ catch (error) {
91
+ // ROLLBACK on failure
92
+ if (spinner) {
93
+ spinner.fail('Update failed');
94
+ }
95
+ console.log('');
96
+ console.log(chalk.red.bold('❌ Update failed - Rolling back changes...\n'));
97
+ if (backupDir) {
98
+ try {
99
+ await rollbackFromBackup(backupDir);
100
+ }
101
+ catch {
102
+ // Rollback error already logged in rollbackFromBackup
103
+ }
104
+ }
105
+ // Import error utilities
106
+ const { displayInfo, getErrorMessage } = await import('../../utils/errors.js');
107
+ displayInfo('Try running: trinity deploy --force for a clean reinstall');
108
+ // Re-throw as UpdateError if it's not already a Trinity error
109
+ if (error instanceof UpdateError) {
110
+ throw error;
111
+ }
112
+ throw new UpdateError(`Update failed: ${getErrorMessage(error)}`, {
113
+ originalError: error,
114
+ backupDir: backupDir || 'none',
115
+ });
116
+ }
117
+ }
118
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Update Knowledge Base Module
3
+ * Handles updating SDK-managed knowledge base files
4
+ * @module cli/commands/update/knowledge-base
5
+ */
6
+ import { Ora } from 'ora';
7
+ import { UpdateStats } from './types.js';
8
+ /**
9
+ * Update SDK-managed knowledge base files (preserves user content)
10
+ * @param spinner - ora spinner instance for status display
11
+ * @param stats - update statistics to track progress
12
+ */
13
+ export declare function updateKnowledgeBase(spinner: Ora, stats: UpdateStats): Promise<void>;
14
+ //# sourceMappingURL=knowledge-base.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Update Knowledge Base Module
3
+ * Handles updating SDK-managed knowledge base files
4
+ * @module cli/commands/update/knowledge-base
5
+ */
6
+ import fs from 'fs-extra';
7
+ import path from 'path';
8
+ import { getSDKPath } from './utils.js';
9
+ /** SDK-managed knowledge base files (not user content) */
10
+ const SDK_MANAGED_KB_FILES = [
11
+ 'Trinity.md.template',
12
+ 'CODING-PRINCIPLES.md.template',
13
+ 'TESTING-PRINCIPLES.md.template',
14
+ 'AI-DEVELOPMENT-GUIDE.md.template',
15
+ 'DOCUMENTATION-CRITERIA.md.template',
16
+ ];
17
+ /**
18
+ * Update SDK-managed knowledge base files (preserves user content)
19
+ * @param spinner - ora spinner instance for status display
20
+ * @param stats - update statistics to track progress
21
+ */
22
+ export async function updateKnowledgeBase(spinner, stats) {
23
+ spinner.start('Updating knowledge base...');
24
+ const sdkPath = await getSDKPath();
25
+ const kbTemplatePath = path.join(sdkPath, 'dist/templates/knowledge-base');
26
+ for (const templateFile of SDK_MANAGED_KB_FILES) {
27
+ const sourcePath = path.join(kbTemplatePath, templateFile);
28
+ if (await fs.pathExists(sourcePath)) {
29
+ // Remove .template extension for target
30
+ const targetFile = templateFile.replace('.template', '');
31
+ const targetPath = path.join('trinity/knowledge-base', targetFile);
32
+ await fs.copy(sourcePath, targetPath, { overwrite: true });
33
+ stats.knowledgeBaseUpdated++;
34
+ }
35
+ }
36
+ spinner.succeed(`Knowledge base updated (${stats.knowledgeBaseUpdated} files)`);
37
+ }
38
+ //# sourceMappingURL=knowledge-base.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Update Pre-flight Checks Module
3
+ * Validates project state before performing update
4
+ * @module cli/commands/update/pre-flight
5
+ */
6
+ import { Ora } from 'ora';
7
+ /**
8
+ * Run pre-flight checks to ensure Trinity Method is deployed
9
+ * @param spinner - ora spinner instance for status display
10
+ * @throws {UpdateError} If pre-flight checks fail
11
+ */
12
+ export declare function runUpdatePreflightChecks(spinner: Ora): Promise<void>;
13
+ //# sourceMappingURL=pre-flight.d.ts.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Update Pre-flight Checks Module
3
+ * Validates project state before performing update
4
+ * @module cli/commands/update/pre-flight
5
+ */
6
+ import fs from 'fs-extra';
7
+ import { UpdateError } from '../../utils/error-classes.js';
8
+ /**
9
+ * Run pre-flight checks to ensure Trinity Method is deployed
10
+ * @param spinner - ora spinner instance for status display
11
+ * @throws {UpdateError} If pre-flight checks fail
12
+ */
13
+ export async function runUpdatePreflightChecks(spinner) {
14
+ spinner.start('Running pre-flight checks...');
15
+ // Check trinity directory exists
16
+ const trinityExists = await fs.pathExists('trinity');
17
+ if (!trinityExists) {
18
+ spinner.fail('Trinity Method not deployed');
19
+ const { displayInfo } = await import('../../utils/errors.js');
20
+ displayInfo('Use: trinity deploy to install');
21
+ throw new UpdateError('Trinity Method not deployed in this project', {
22
+ reason: 'trinity_directory_missing',
23
+ });
24
+ }
25
+ // Check .claude directory exists
26
+ const claudeExists = await fs.pathExists('.claude');
27
+ if (!claudeExists) {
28
+ spinner.fail('.claude directory not found');
29
+ const { displayInfo } = await import('../../utils/errors.js');
30
+ displayInfo('Trinity deployment appears incomplete');
31
+ throw new UpdateError('.claude directory not found', {
32
+ reason: 'claude_directory_missing',
33
+ });
34
+ }
35
+ spinner.succeed('Pre-flight checks passed');
36
+ }
37
+ //# sourceMappingURL=pre-flight.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Update Summary Module
3
+ * Displays update completion summary
4
+ * @module cli/commands/update/summary
5
+ */
6
+ import { UpdateStats } from './types.js';
7
+ /**
8
+ * Display update summary with statistics
9
+ * @param stats - Update statistics
10
+ * @param oldVersion - Version before update
11
+ * @param newVersion - Version after update
12
+ */
13
+ export declare function displayUpdateSummary(stats: UpdateStats, oldVersion: string, newVersion: string): void;
14
+ /**
15
+ * Display dry-run preview of update changes
16
+ * @param oldVersion - Current version
17
+ * @param newVersion - Target version
18
+ */
19
+ export declare function displayDryRunPreview(oldVersion: string, newVersion: string): void;
20
+ //# sourceMappingURL=summary.d.ts.map
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Update Summary Module
3
+ * Displays update completion summary
4
+ * @module cli/commands/update/summary
5
+ */
6
+ import chalk from 'chalk';
7
+ /**
8
+ * Display update summary with statistics
9
+ * @param stats - Update statistics
10
+ * @param oldVersion - Version before update
11
+ * @param newVersion - Version after update
12
+ */
13
+ export function displayUpdateSummary(stats, oldVersion, newVersion) {
14
+ console.log('');
15
+ console.log(chalk.green.bold('✅ Trinity Method updated successfully!\n'));
16
+ console.log(chalk.cyan('📊 Update Statistics:\n'));
17
+ console.log(chalk.white(` Agents Updated: ${stats.agentsUpdated}`));
18
+ console.log(chalk.white(` Commands Updated: ${stats.commandsUpdated}`));
19
+ console.log(chalk.white(` Templates Updated: ${stats.templatesUpdated}`));
20
+ console.log(chalk.white(` Knowledge Base Updated: ${stats.knowledgeBaseUpdated}`));
21
+ console.log(chalk.white(` Total Files Updated: ${stats.agentsUpdated + stats.commandsUpdated + stats.templatesUpdated + stats.knowledgeBaseUpdated}`));
22
+ console.log('');
23
+ console.log(chalk.gray(` Version: ${oldVersion} → ${newVersion}\n`));
24
+ }
25
+ /**
26
+ * Display dry-run preview of update changes
27
+ * @param oldVersion - Current version
28
+ * @param newVersion - Target version
29
+ */
30
+ export function displayDryRunPreview(oldVersion, newVersion) {
31
+ console.log(chalk.yellow('🔍 DRY RUN - Preview of changes:\n'));
32
+ console.log(chalk.white(' Would update:'));
33
+ console.log(chalk.gray(` • 18 agent files in .claude/agents/`));
34
+ console.log(chalk.gray(` • 16 slash commands in .claude/commands/`));
35
+ console.log(chalk.gray(` • 6 work order templates in trinity/templates/`));
36
+ console.log(chalk.gray(` • Knowledge base files (Trinity.md, CODING-PRINCIPLES.md, etc.)`));
37
+ console.log(chalk.gray(` • Version file: ${oldVersion} → ${newVersion}`));
38
+ console.log('');
39
+ console.log(chalk.white(' Would preserve:'));
40
+ console.log(chalk.gray(` • trinity/knowledge-base/ARCHITECTURE.md`));
41
+ console.log(chalk.gray(` • trinity/knowledge-base/To-do.md`));
42
+ console.log(chalk.gray(` • trinity/knowledge-base/ISSUES.md`));
43
+ console.log(chalk.gray(` • trinity/knowledge-base/Technical-Debt.md`));
44
+ console.log('');
45
+ console.log(chalk.blue('💡 Run without --dry-run to perform update\n'));
46
+ }
47
+ //# sourceMappingURL=summary.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Update Templates Module
3
+ * Handles updating work order template files
4
+ * @module cli/commands/update/templates
5
+ */
6
+ import { Ora } from 'ora';
7
+ import { UpdateStats } from './types.js';
8
+ /**
9
+ * Update work order templates from SDK to trinity/templates/
10
+ * @param spinner - ora spinner instance for status display
11
+ * @param stats - update statistics to track progress
12
+ */
13
+ export declare function updateTemplates(spinner: Ora, stats: UpdateStats): Promise<void>;
14
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Update Templates Module
3
+ * Handles updating work order template files
4
+ * @module cli/commands/update/templates
5
+ */
6
+ import fs from 'fs-extra';
7
+ import path from 'path';
8
+ import { getSDKPath } from './utils.js';
9
+ /**
10
+ * Update work order templates from SDK to trinity/templates/
11
+ * @param spinner - ora spinner instance for status display
12
+ * @param stats - update statistics to track progress
13
+ */
14
+ export async function updateTemplates(spinner, stats) {
15
+ spinner.start('Updating work order templates...');
16
+ const sdkPath = await getSDKPath();
17
+ const woTemplatePath = path.join(sdkPath, 'dist/templates/work-orders');
18
+ if (await fs.pathExists(woTemplatePath)) {
19
+ await fs.copy(woTemplatePath, 'trinity/templates', { overwrite: true });
20
+ const files = await fs.readdir(woTemplatePath);
21
+ stats.templatesUpdated = files.length;
22
+ }
23
+ spinner.succeed(`Work order templates updated (${stats.templatesUpdated} files)`);
24
+ }
25
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Update Command Types
3
+ * Shared type definitions for update command
4
+ * @module cli/commands/update/types
5
+ */
6
+ export interface UpdateStats {
7
+ agentsUpdated: number;
8
+ templatesUpdated: number;
9
+ knowledgeBaseUpdated: number;
10
+ commandsUpdated: number;
11
+ filesUpdated: number;
12
+ }
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Update Command Types
3
+ * Shared type definitions for update command
4
+ * @module cli/commands/update/types
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Update Utilities Module
3
+ * Shared utilities for update command
4
+ * @module cli/commands/update/utils
5
+ */
6
+ /**
7
+ * Get SDK path for reading template files
8
+ * @returns Path to SDK directory
9
+ */
10
+ export declare function getSDKPath(): Promise<string>;
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Update Utilities Module
3
+ * Shared utilities for update command
4
+ * @module cli/commands/update/utils
5
+ */
6
+ import fs from 'fs-extra';
7
+ import path from 'path';
8
+ /**
9
+ * Get SDK path for reading template files
10
+ * @returns Path to SDK directory
11
+ */
12
+ export async function getSDKPath() {
13
+ // In tests it's process.cwd(), in production it's node_modules/@trinity-method/sdk
14
+ const sdkPath = (await fs.pathExists(path.join(process.cwd(), 'dist/templates')))
15
+ ? process.cwd() // Running from SDK root (tests or dev)
16
+ : path.join(process.cwd(), 'node_modules', '@trinity-method', 'sdk'); // Installed package
17
+ return sdkPath;
18
+ }
19
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Update Verification Module
3
+ * Verifies update deployment is successful
4
+ * @module cli/commands/update/verification
5
+ */
6
+ import { Ora } from 'ora';
7
+ /**
8
+ * Verify update deployment is successful
9
+ * @param spinner - ora spinner instance for status display
10
+ * @param expectedVersion - Expected version after update
11
+ * @throws {Error} If verification fails
12
+ */
13
+ export declare function verifyUpdateDeployment(spinner: Ora, expectedVersion: string): Promise<void>;
14
+ /**
15
+ * Update VERSION file with latest version
16
+ * @param spinner - ora spinner instance for status display
17
+ * @param version - Version string to write
18
+ */
19
+ export declare function updateVersionFile(spinner: Ora, version: string): Promise<void>;
20
+ //# sourceMappingURL=verification.d.ts.map
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Update Verification Module
3
+ * Verifies update deployment is successful
4
+ * @module cli/commands/update/verification
5
+ */
6
+ import fs from 'fs-extra';
7
+ import { validatePath } from '../../utils/validate-path.js';
8
+ /** Verification checks to run after update */
9
+ const VERIFICATION_CHECKS = [
10
+ { path: 'trinity/VERSION', desc: 'Version file' },
11
+ { path: '.claude/agents/leadership', desc: 'Leadership agents' },
12
+ { path: '.claude/agents/planning', desc: 'Planning agents' },
13
+ { path: '.claude/agents/aj-team', desc: 'AJ team agents' },
14
+ { path: '.claude/commands', desc: 'Slash commands' },
15
+ { path: 'trinity/templates', desc: 'Work order templates' },
16
+ { path: 'trinity/knowledge-base/Trinity.md', desc: 'Trinity knowledge base' },
17
+ ];
18
+ /**
19
+ * Verify update deployment is successful
20
+ * @param spinner - ora spinner instance for status display
21
+ * @param expectedVersion - Expected version after update
22
+ * @throws {Error} If verification fails
23
+ */
24
+ export async function verifyUpdateDeployment(spinner, expectedVersion) {
25
+ spinner.start('Verifying update...');
26
+ // Check all required paths exist
27
+ for (const check of VERIFICATION_CHECKS) {
28
+ if (!(await fs.pathExists(check.path))) {
29
+ spinner.fail(`Verification failed: ${check.desc} missing`);
30
+ throw new Error(`Update verification failed: ${check.path} not found`);
31
+ }
32
+ }
33
+ // Verify version was actually updated
34
+ const versionPath = 'trinity/VERSION';
35
+ const updatedVersion = (await fs.readFile(versionPath, 'utf8')).trim();
36
+ if (updatedVersion !== expectedVersion) {
37
+ spinner.fail('Version file not updated correctly');
38
+ throw new Error(`Version verification failed: expected ${expectedVersion}, got ${updatedVersion}`);
39
+ }
40
+ spinner.succeed('Verification passed');
41
+ }
42
+ /**
43
+ * Update VERSION file with latest version
44
+ * @param spinner - ora spinner instance for status display
45
+ * @param version - Version string to write
46
+ */
47
+ export async function updateVersionFile(spinner, version) {
48
+ spinner.start('Updating version file...');
49
+ // Validate destination path for security
50
+ const destPath = validatePath('trinity/VERSION');
51
+ await fs.writeFile(destPath, version);
52
+ spinner.succeed('Version file updated');
53
+ }
54
+ //# sourceMappingURL=verification.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Update Version Detection Module
3
+ * Detects current and latest SDK versions
4
+ * @module cli/commands/update/version
5
+ */
6
+ import { Ora } from 'ora';
7
+ export interface VersionInfo {
8
+ currentVersion: string;
9
+ latestVersion: string;
10
+ isUpToDate: boolean;
11
+ }
12
+ /**
13
+ * Detect installed SDK version and compare with latest
14
+ * @param spinner - ora spinner instance for status display
15
+ * @returns Version information
16
+ */
17
+ export declare function detectInstalledSDKVersion(spinner: Ora): Promise<VersionInfo>;
18
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Update Version Detection Module
3
+ * Detects current and latest SDK versions
4
+ * @module cli/commands/update/version
5
+ */
6
+ import fs from 'fs-extra';
7
+ import chalk from 'chalk';
8
+ import { getPackageJsonPath } from '../../utils/get-sdk-path.js';
9
+ /**
10
+ * Detect installed SDK version and compare with latest
11
+ * @param spinner - ora spinner instance for status display
12
+ * @returns Version information
13
+ */
14
+ export async function detectInstalledSDKVersion(spinner) {
15
+ spinner.start('Checking versions...');
16
+ // Read current version from trinity/VERSION
17
+ const versionPath = 'trinity/VERSION';
18
+ let currentVersion = '0.0.0';
19
+ if (await fs.pathExists(versionPath)) {
20
+ currentVersion = (await fs.readFile(versionPath, 'utf8')).trim();
21
+ }
22
+ // Read latest version from SDK package.json
23
+ const sdkPkgPath = await getPackageJsonPath();
24
+ const sdkPkg = JSON.parse(await fs.readFile(sdkPkgPath, 'utf8'));
25
+ const latestVersion = sdkPkg.version;
26
+ spinner.succeed('Version check complete');
27
+ console.log(chalk.gray(` Current version: ${currentVersion}`));
28
+ console.log(chalk.gray(` Latest version: ${latestVersion}`));
29
+ console.log('');
30
+ return {
31
+ currentVersion,
32
+ latestVersion,
33
+ isUpToDate: currentVersion === latestVersion,
34
+ };
35
+ }
36
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Update Command - Re-export from modular implementation
3
+ * @see src/cli/commands/update/ for modular implementation
4
+ * @module cli/commands/update
5
+ */
6
+ export { update } from './update/index.js';
7
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Update Command - Re-export from modular implementation
3
+ * @see src/cli/commands/update/ for modular implementation
4
+ * @module cli/commands/update
5
+ */
6
+ export { update } from './update/index.js';
7
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import { program } from 'commander';
3
+ import { deploy } from './commands/deploy/index.js';
4
+ import { update } from './commands/update.js';
5
+ import { errorHandler } from './utils/error-handler.js';
6
+ import { readFileSync } from 'fs';
7
+ import { fileURLToPath } from 'url';
8
+ import { dirname, join } from 'path';
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+ const pkg = JSON.parse(readFileSync(join(__dirname, '../../package.json'), 'utf8'));
12
+ program
13
+ .name('trinity')
14
+ .description('Trinity Method SDK - Investigation-first development with AI agents')
15
+ .version(`${pkg.version} (Trinity Method SDK)`, '-v, --version', 'Output the current version');
16
+ // ========================================
17
+ // Setup Commands
18
+ // ========================================
19
+ program
20
+ .command('deploy')
21
+ .description('Deploy Trinity Method to current project')
22
+ .option('--name <name>', 'Project name (auto-detected if not specified)')
23
+ .option('--yes', 'Skip confirmation prompts')
24
+ .option('--dry-run', 'Preview changes without writing files')
25
+ .option('--force', 'Overwrite existing Trinity deployment')
26
+ .option('--skip-audit', 'Skip codebase metrics collection (faster, uses placeholders)')
27
+ .option('--ci-deploy', 'Deploy CI/CD workflow templates for automated testing')
28
+ .action(errorHandler.wrap(deploy));
29
+ program
30
+ .command('update')
31
+ .description('Update Trinity Method to latest version')
32
+ .option('--all', 'Update all registered Trinity projects')
33
+ .option('--dry-run', 'Preview changes without writing files')
34
+ .action(errorHandler.wrap(update));
35
+ program.parse();
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,77 @@
1
+ /**
2
+ * CLI Command Option Types
3
+ */
4
+ export interface DeployOptions {
5
+ name?: string;
6
+ yes?: boolean;
7
+ dryRun?: boolean;
8
+ force?: boolean;
9
+ skipAudit?: boolean;
10
+ ciDeploy?: boolean;
11
+ lintingTools?: LintingTool[];
12
+ lintingDependencies?: string[];
13
+ lintingScripts?: Record<string, string>;
14
+ postInstallInstructions?: PostInstallInstruction[];
15
+ }
16
+ export interface UpdateOptions {
17
+ all?: boolean;
18
+ dryRun?: boolean;
19
+ }
20
+ export interface LintingTool {
21
+ id: string;
22
+ name: string;
23
+ file: string;
24
+ description?: string;
25
+ template?: string;
26
+ framework?: string;
27
+ language?: string;
28
+ recommended?: boolean;
29
+ dependencies?: string[];
30
+ scripts?: Record<string, string>;
31
+ requiresTypeScript?: boolean;
32
+ postInstall?: string;
33
+ }
34
+ export interface PostInstallInstruction {
35
+ command: string;
36
+ description?: string;
37
+ }
38
+ export interface Stack {
39
+ framework: string;
40
+ language: string;
41
+ sourceDir: string;
42
+ sourceDirs: string[];
43
+ packageManager?: string;
44
+ }
45
+ export interface CodebaseMetrics {
46
+ todoCount: number;
47
+ todoComments: number;
48
+ fixmeComments: number;
49
+ hackComments: number;
50
+ consoleStatements: number;
51
+ commentedCodeBlocks: number;
52
+ totalFiles: number;
53
+ filesOver500: number;
54
+ filesOver1000: number;
55
+ filesOver3000: number;
56
+ avgFileLength: number;
57
+ largestFiles: Array<{
58
+ file: string;
59
+ lines: number;
60
+ }>;
61
+ dependencies: Record<string, string>;
62
+ dependencyCount: number;
63
+ devDependencies: Record<string, string>;
64
+ devDependencyCount: number;
65
+ commitCount: number;
66
+ contributors: number;
67
+ lastCommitDate: string;
68
+ frameworkVersion: string;
69
+ packageManager: string;
70
+ }
71
+ export interface DeploymentStats {
72
+ agents: number;
73
+ templates: number;
74
+ directories: number;
75
+ files: number;
76
+ }
77
+ //# sourceMappingURL=types.d.ts.map