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.
- package/CHANGELOG.md +116 -0
- package/LICENSE +21 -0
- package/README.md +555 -0
- package/dist/cli/commands/deploy/agents.d.ts +14 -0
- package/dist/cli/commands/deploy/agents.js +59 -0
- package/dist/cli/commands/deploy/ci-cd.d.ts +13 -0
- package/dist/cli/commands/deploy/ci-cd.js +50 -0
- package/dist/cli/commands/deploy/claude-setup.d.ts +17 -0
- package/dist/cli/commands/deploy/claude-setup.js +91 -0
- package/dist/cli/commands/deploy/configuration.d.ts +13 -0
- package/dist/cli/commands/deploy/configuration.js +215 -0
- package/dist/cli/commands/deploy/directories.d.ts +12 -0
- package/dist/cli/commands/deploy/directories.js +38 -0
- package/dist/cli/commands/deploy/gitignore.d.ts +12 -0
- package/dist/cli/commands/deploy/gitignore.js +53 -0
- package/dist/cli/commands/deploy/index.d.ts +38 -0
- package/dist/cli/commands/deploy/index.js +156 -0
- package/dist/cli/commands/deploy/knowledge-base.d.ts +16 -0
- package/dist/cli/commands/deploy/knowledge-base.js +75 -0
- package/dist/cli/commands/deploy/linting.d.ts +18 -0
- package/dist/cli/commands/deploy/linting.js +51 -0
- package/dist/cli/commands/deploy/metrics.d.ts +13 -0
- package/dist/cli/commands/deploy/metrics.js +34 -0
- package/dist/cli/commands/deploy/pre-flight.d.ts +13 -0
- package/dist/cli/commands/deploy/pre-flight.js +29 -0
- package/dist/cli/commands/deploy/root-files.d.ts +16 -0
- package/dist/cli/commands/deploy/root-files.js +178 -0
- package/dist/cli/commands/deploy/sdk-install.d.ts +12 -0
- package/dist/cli/commands/deploy/sdk-install.js +57 -0
- package/dist/cli/commands/deploy/summary.d.ts +14 -0
- package/dist/cli/commands/deploy/summary.js +130 -0
- package/dist/cli/commands/deploy/templates.d.ts +14 -0
- package/dist/cli/commands/deploy/templates.js +84 -0
- package/dist/cli/commands/deploy/types.d.ts +39 -0
- package/dist/cli/commands/deploy/types.js +5 -0
- package/dist/cli/commands/update/agents.d.ts +14 -0
- package/dist/cli/commands/update/agents.js +31 -0
- package/dist/cli/commands/update/backup.d.ts +31 -0
- package/dist/cli/commands/update/backup.js +97 -0
- package/dist/cli/commands/update/commands.d.ts +14 -0
- package/dist/cli/commands/update/commands.js +75 -0
- package/dist/cli/commands/update/index.d.ts +15 -0
- package/dist/cli/commands/update/index.js +118 -0
- package/dist/cli/commands/update/knowledge-base.d.ts +14 -0
- package/dist/cli/commands/update/knowledge-base.js +38 -0
- package/dist/cli/commands/update/pre-flight.d.ts +13 -0
- package/dist/cli/commands/update/pre-flight.js +37 -0
- package/dist/cli/commands/update/summary.d.ts +20 -0
- package/dist/cli/commands/update/summary.js +47 -0
- package/dist/cli/commands/update/templates.d.ts +14 -0
- package/dist/cli/commands/update/templates.js +25 -0
- package/dist/cli/commands/update/types.d.ts +13 -0
- package/dist/cli/commands/update/types.js +7 -0
- package/dist/cli/commands/update/utils.d.ts +11 -0
- package/dist/cli/commands/update/utils.js +19 -0
- package/dist/cli/commands/update/verification.d.ts +20 -0
- package/dist/cli/commands/update/verification.js +54 -0
- package/dist/cli/commands/update/version.d.ts +18 -0
- package/dist/cli/commands/update/version.js +36 -0
- package/dist/cli/commands/update.d.ts +7 -0
- package/dist/cli/commands/update.js +7 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +36 -0
- package/dist/cli/types.d.ts +77 -0
- package/dist/cli/types.js +5 -0
- package/dist/cli/utils/deploy-ci.d.ts +22 -0
- package/dist/cli/utils/deploy-ci.js +138 -0
- package/dist/cli/utils/deploy-linting.d.ts +3 -0
- package/dist/cli/utils/deploy-linting.js +136 -0
- package/dist/cli/utils/detect-stack.d.ts +3 -0
- package/dist/cli/utils/detect-stack.js +270 -0
- package/dist/cli/utils/error-classes.d.ts +63 -0
- package/dist/cli/utils/error-classes.js +84 -0
- package/dist/cli/utils/error-handler.d.ts +59 -0
- package/dist/cli/utils/error-handler.js +127 -0
- package/dist/cli/utils/errors.d.ts +52 -0
- package/dist/cli/utils/errors.js +102 -0
- package/dist/cli/utils/get-sdk-path.d.ts +18 -0
- package/dist/cli/utils/get-sdk-path.js +31 -0
- package/dist/cli/utils/inject-dependencies.d.ts +2 -0
- package/dist/cli/utils/inject-dependencies.js +55 -0
- package/dist/cli/utils/linting-tools.d.ts +8 -0
- package/dist/cli/utils/linting-tools.js +206 -0
- package/dist/cli/utils/metrics/code-quality.d.ts +32 -0
- package/dist/cli/utils/metrics/code-quality.js +122 -0
- package/dist/cli/utils/metrics/dependency-parser.d.ts +21 -0
- package/dist/cli/utils/metrics/dependency-parser.js +153 -0
- package/dist/cli/utils/metrics/file-complexity.d.ts +26 -0
- package/dist/cli/utils/metrics/file-complexity.js +77 -0
- package/dist/cli/utils/metrics/framework-detector.d.ts +17 -0
- package/dist/cli/utils/metrics/framework-detector.js +120 -0
- package/dist/cli/utils/metrics/git-metrics.d.ts +30 -0
- package/dist/cli/utils/metrics/git-metrics.js +83 -0
- package/dist/cli/utils/metrics/index.d.ts +28 -0
- package/dist/cli/utils/metrics/index.js +100 -0
- package/dist/cli/utils/template-processor.d.ts +10 -0
- package/dist/cli/utils/template-processor.js +188 -0
- package/dist/cli/utils/validate-path.d.ts +80 -0
- package/dist/cli/utils/validate-path.js +180 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/templates/agents/aj-team/apo-documentation-specialist.md.template +572 -0
- package/dist/templates/agents/aj-team/bas-quality-gate.md.template +906 -0
- package/dist/templates/agents/aj-team/bon-dependency-manager.md.template +636 -0
- package/dist/templates/agents/aj-team/cap-configuration-specialist.md.template +670 -0
- package/dist/templates/agents/aj-team/dra-code-reviewer.md.template +768 -0
- package/dist/templates/agents/aj-team/kil-task-executor.md.template +764 -0
- package/dist/templates/agents/aj-team/uro-refactoring-specialist.md.template +759 -0
- package/dist/templates/agents/audit/juno-auditor.md.template +447 -0
- package/dist/templates/agents/deployment/ein-cicd.md.template +694 -0
- package/dist/templates/agents/deployment/ino-context.md.template +733 -0
- package/dist/templates/agents/deployment/tan-structure.md.template +661 -0
- package/dist/templates/agents/deployment/zen-knowledge.md.template +451 -0
- package/dist/templates/agents/leadership/aj-cc.md.template +462 -0
- package/dist/templates/agents/leadership/aj-maestro.md.template +943 -0
- package/dist/templates/agents/leadership/aly-cto.md.template +407 -0
- package/dist/templates/agents/planning/eus-decomposer.md.template +496 -0
- package/dist/templates/agents/planning/mon-requirements.md.template +323 -0
- package/dist/templates/agents/planning/ror-design.md.template +465 -0
- package/dist/templates/agents/planning/tra-planner.md.template +432 -0
- package/dist/templates/ci/cd.yml.template +175 -0
- package/dist/templates/ci/ci.yml.template +196 -0
- package/dist/templates/ci/generic-ci.yml +115 -0
- package/dist/templates/ci/github-actions.yml +86 -0
- package/dist/templates/ci/gitlab-ci.yml +103 -0
- package/dist/templates/claude/EMPLOYEE-DIRECTORY.md.template +545 -0
- package/dist/templates/documentation/ROOT-README.md.template +307 -0
- package/dist/templates/documentation/SUBDIRECTORY-README.md.template +261 -0
- package/dist/templates/investigations/bug.md.template +484 -0
- package/dist/templates/investigations/feature.md.template +564 -0
- package/dist/templates/investigations/performance.md.template +625 -0
- package/dist/templates/investigations/security.md.template +714 -0
- package/dist/templates/investigations/technical.md.template +433 -0
- package/dist/templates/knowledge-base/AI-DEVELOPMENT-GUIDE.md.template +957 -0
- package/dist/templates/knowledge-base/ARCHITECTURE.md.template +452 -0
- package/dist/templates/knowledge-base/CODING-PRINCIPLES.md.template +750 -0
- package/dist/templates/knowledge-base/DOCUMENTATION-CRITERIA.md.template +1118 -0
- package/dist/templates/knowledge-base/ISSUES.md.template +539 -0
- package/dist/templates/knowledge-base/TESTING-PRINCIPLES.md.template +894 -0
- package/dist/templates/knowledge-base/Technical-Debt.md.template +640 -0
- package/dist/templates/knowledge-base/To-do.md.template +407 -0
- package/dist/templates/knowledge-base/Trinity.md.template +464 -0
- package/dist/templates/linting/flutter/.pre-commit-config.yaml.template +27 -0
- package/dist/templates/linting/flutter/analysis_options.yaml.template +26 -0
- package/dist/templates/linting/nodejs/.eslintrc-commonjs.json.template +19 -0
- package/dist/templates/linting/nodejs/.eslintrc-esm.json.template +19 -0
- package/dist/templates/linting/nodejs/.eslintrc-typescript.json.template +22 -0
- package/dist/templates/linting/nodejs/.pre-commit-config.yaml.template +51 -0
- package/dist/templates/linting/nodejs/.prettierrc.json.template +10 -0
- package/dist/templates/linting/python/.flake8.template +16 -0
- package/dist/templates/linting/python/.pre-commit-config.yaml.template +30 -0
- package/dist/templates/linting/python/pyproject.toml.template +38 -0
- package/dist/templates/linting/rust/.pre-commit-config.yaml.template +28 -0
- package/dist/templates/linting/rust/clippy.toml.template +14 -0
- package/dist/templates/linting/rust/rustfmt.toml.template +12 -0
- package/dist/templates/root/CLAUDE.md.template +65 -0
- package/dist/templates/root/TRINITY.md.template +52 -0
- package/dist/templates/shared/claude-commands/trinity-agents.md.template +168 -0
- package/dist/templates/shared/claude-commands/trinity-audit.md.template +646 -0
- package/dist/templates/shared/claude-commands/trinity-changelog.md.template +624 -0
- package/dist/templates/shared/claude-commands/trinity-continue.md.template +549 -0
- package/dist/templates/shared/claude-commands/trinity-create-investigation.md.template +232 -0
- package/dist/templates/shared/claude-commands/trinity-decompose.md.template +181 -0
- package/dist/templates/shared/claude-commands/trinity-design.md.template +347 -0
- package/dist/templates/shared/claude-commands/trinity-docs.md.template +2093 -0
- package/dist/templates/shared/claude-commands/trinity-end.md.template +397 -0
- package/dist/templates/shared/claude-commands/trinity-init.md.template +606 -0
- package/dist/templates/shared/claude-commands/trinity-investigate-templates.md.template +725 -0
- package/dist/templates/shared/claude-commands/trinity-orchestrate.md.template +1061 -0
- package/dist/templates/shared/claude-commands/trinity-plan-investigation.md.template +135 -0
- package/dist/templates/shared/claude-commands/trinity-plan.md.template +201 -0
- package/dist/templates/shared/claude-commands/trinity-readme.md.template +1971 -0
- package/dist/templates/shared/claude-commands/trinity-requirements.md.template +148 -0
- package/dist/templates/shared/claude-commands/trinity-start.md.template +268 -0
- package/dist/templates/shared/claude-commands/trinity-verify.md.template +453 -0
- package/dist/templates/shared/claude-commands/trinity-workorder.md.template +249 -0
- package/dist/templates/source/base-CLAUDE.md.template +310 -0
- package/dist/templates/source/flutter-CLAUDE.md.template +593 -0
- package/dist/templates/source/nodejs-CLAUDE.md.template +531 -0
- package/dist/templates/source/python-CLAUDE.md.template +510 -0
- package/dist/templates/source/react-CLAUDE.md.template +513 -0
- package/dist/templates/source/rust-CLAUDE.md.template +653 -0
- package/dist/templates/source/tests-CLAUDE.md.template +432 -0
- package/dist/templates/trinity/CLAUDE.md.template +372 -0
- package/dist/templates/work-orders/ANALYSIS-TEMPLATE.md.template +276 -0
- package/dist/templates/work-orders/AUDIT-TEMPLATE.md.template +262 -0
- package/dist/templates/work-orders/IMPLEMENTATION-TEMPLATE.md.template +260 -0
- package/dist/templates/work-orders/INVESTIGATION-TEMPLATE.md.template +206 -0
- package/dist/templates/work-orders/PATTERN-TEMPLATE.md.template +320 -0
- package/dist/templates/work-orders/VERIFICATION-TEMPLATE.md.template +273 -0
- package/package.json +94 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deploy Command - Complete Trinity Method SDK deployment to user projects
|
|
3
|
+
*
|
|
4
|
+
* @see docs/workflows/deploy-workflow.md - Complete deployment process
|
|
5
|
+
* @see docs/deployment/best-practices.md - Deployment best practices
|
|
6
|
+
*
|
|
7
|
+
* **Trinity Principle:** "Systematic Quality Assurance"
|
|
8
|
+
* Deploys complete Trinity Method infrastructure with interactive wizard: creates folder structure,
|
|
9
|
+
* deploys 18 agent templates, installs slash commands, configures quality tools (ESLint, Prettier),
|
|
10
|
+
* and sets up CI/CD templates. Ensures every Trinity project starts with proven, consistent foundation.
|
|
11
|
+
*
|
|
12
|
+
* **Why This Exists:**
|
|
13
|
+
* Manual setup is error-prone and inconsistent. Developers forget folders, skip quality tools, or
|
|
14
|
+
* misconfigure agents. This command orchestrates TAN (structure), ZEN (documentation), INO (context),
|
|
15
|
+
* and EIN (CI/CD) to deploy battle-tested Trinity infrastructure in minutes. Every project gets same
|
|
16
|
+
* high-quality foundation: 19 agents, 20 commands, quality gates, and documentation architecture.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```bash
|
|
20
|
+
* # Interactive deployment
|
|
21
|
+
* npx trinity deploy
|
|
22
|
+
*
|
|
23
|
+
* # Non-interactive with defaults
|
|
24
|
+
* npx trinity deploy --yes
|
|
25
|
+
*
|
|
26
|
+
* # Force redeployment
|
|
27
|
+
* npx trinity deploy --force
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @module cli/commands/deploy
|
|
31
|
+
*/
|
|
32
|
+
import ora from 'ora';
|
|
33
|
+
import chalk from 'chalk';
|
|
34
|
+
import path from 'path';
|
|
35
|
+
import { fileURLToPath } from 'url';
|
|
36
|
+
import { dirname } from 'path';
|
|
37
|
+
import { readFileSync } from 'fs';
|
|
38
|
+
import { detectStack } from '../../utils/detect-stack.js';
|
|
39
|
+
import { checkPreFlight } from './pre-flight.js';
|
|
40
|
+
import { promptConfiguration } from './configuration.js';
|
|
41
|
+
import { collectMetrics } from './metrics.js';
|
|
42
|
+
import { createDirectories } from './directories.js';
|
|
43
|
+
import { deployKnowledgeBase } from './knowledge-base.js';
|
|
44
|
+
import { deployRootFiles } from './root-files.js';
|
|
45
|
+
import { deployAgents } from './agents.js';
|
|
46
|
+
import { deployClaudeSetup } from './claude-setup.js';
|
|
47
|
+
import { deployLinting } from './linting.js';
|
|
48
|
+
import { deployTemplates } from './templates.js';
|
|
49
|
+
import { deployCICD } from './ci-cd.js';
|
|
50
|
+
import { updateGitignore } from './gitignore.js';
|
|
51
|
+
import { installSDK } from './sdk-install.js';
|
|
52
|
+
import { displaySummary } from './summary.js';
|
|
53
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
54
|
+
const __dirname = dirname(__filename);
|
|
55
|
+
/**
|
|
56
|
+
* Deploy Trinity Method SDK to project
|
|
57
|
+
* @param options - Deployment options
|
|
58
|
+
*/
|
|
59
|
+
export async function deploy(options) {
|
|
60
|
+
console.log(chalk.blue.bold('\n🔱 Trinity Method SDK - Deployment\n'));
|
|
61
|
+
const spinner = ora();
|
|
62
|
+
const progress = {
|
|
63
|
+
agentsDeployed: 0,
|
|
64
|
+
commandsDeployed: 0,
|
|
65
|
+
knowledgeBaseFiles: 0,
|
|
66
|
+
templatesDeployed: 0,
|
|
67
|
+
rootFilesDeployed: 0,
|
|
68
|
+
};
|
|
69
|
+
try {
|
|
70
|
+
// STEP 1: Pre-flight checks
|
|
71
|
+
await checkPreFlight(options, spinner);
|
|
72
|
+
// STEP 2: Detect technology stack
|
|
73
|
+
spinner.start('Detecting project technology stack...');
|
|
74
|
+
const stack = await detectStack();
|
|
75
|
+
spinner.succeed(`Detected: ${stack.framework} (${stack.language}) - Source: ${stack.sourceDir}`);
|
|
76
|
+
// STEP 3: Interactive configuration (or use defaults with --yes)
|
|
77
|
+
const config = await promptConfiguration(options, stack);
|
|
78
|
+
// STEP 3.5: Collect codebase metrics
|
|
79
|
+
let metrics;
|
|
80
|
+
if (!options.skipAudit) {
|
|
81
|
+
metrics = await collectMetrics(stack, spinner);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
const { createEmptyMetrics } = await import('../../utils/metrics/index.js');
|
|
85
|
+
metrics = createEmptyMetrics();
|
|
86
|
+
}
|
|
87
|
+
// Prepare template variables
|
|
88
|
+
// Note: In dist/, this file is at dist/cli/commands/deploy/index.js
|
|
89
|
+
// Templates are copied to dist/templates, so we go up 3 levels from deploy/
|
|
90
|
+
const templatesPath = path.join(__dirname, '../../../templates');
|
|
91
|
+
const pkgPath = path.join(__dirname, '../../../../package.json');
|
|
92
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
93
|
+
const variables = {
|
|
94
|
+
PROJECT_NAME: config.projectName || 'My Project',
|
|
95
|
+
FRAMEWORK: stack.framework,
|
|
96
|
+
LANGUAGE: stack.language,
|
|
97
|
+
SOURCE_DIR: stack.sourceDir,
|
|
98
|
+
PACKAGE_MANAGER: stack.packageManager || 'npm',
|
|
99
|
+
BACKEND_FRAMEWORK: stack.framework,
|
|
100
|
+
CURRENT_DATE: new Date().toISOString(),
|
|
101
|
+
TRINITY_VERSION: pkg.version || '2.0.0',
|
|
102
|
+
};
|
|
103
|
+
// STEP 4: Create directory structure
|
|
104
|
+
const directoriesCreated = await createDirectories(spinner);
|
|
105
|
+
progress.directories = directoriesCreated;
|
|
106
|
+
// STEP 5: Deploy knowledge base templates
|
|
107
|
+
const kbFiles = await deployKnowledgeBase(templatesPath, variables, stack, metrics, spinner);
|
|
108
|
+
progress.knowledgeBaseFiles = kbFiles;
|
|
109
|
+
progress.rootFilesDeployed += kbFiles;
|
|
110
|
+
// STEP 6: Deploy root files and CLAUDE.md hierarchy
|
|
111
|
+
const rootFiles = await deployRootFiles(templatesPath, variables, stack, pkg.version, spinner);
|
|
112
|
+
progress.rootFilesDeployed += rootFiles;
|
|
113
|
+
// STEP 7: Deploy agent configurations
|
|
114
|
+
const agentsDeployed = await deployAgents(templatesPath, variables, spinner);
|
|
115
|
+
progress.agentsDeployed = agentsDeployed;
|
|
116
|
+
// STEP 9: Deploy Claude Code setup (settings, employee directory, commands)
|
|
117
|
+
const claudeSetup = await deployClaudeSetup(templatesPath, variables, spinner);
|
|
118
|
+
progress.commandsDeployed = claudeSetup.commandsDeployed;
|
|
119
|
+
progress.rootFilesDeployed += claudeSetup.filesDeployed;
|
|
120
|
+
// STEP 9.7-9.8: Deploy linting configuration (if selected)
|
|
121
|
+
if (config.lintingTools && config.lintingTools.length > 0) {
|
|
122
|
+
const lintingFiles = await deployLinting(config.lintingTools, config.lintingDependencies || [], config.lintingScripts || {}, stack, templatesPath, variables, spinner);
|
|
123
|
+
progress.rootFilesDeployed += lintingFiles;
|
|
124
|
+
}
|
|
125
|
+
// STEP 10: Deploy templates (work orders, investigations, documentation)
|
|
126
|
+
const templatesDeployed = await deployTemplates(templatesPath, variables, spinner);
|
|
127
|
+
progress.templatesDeployed = templatesDeployed;
|
|
128
|
+
// STEP 11: Deploy CI/CD workflow templates (if enabled)
|
|
129
|
+
const cicdFiles = await deployCICD(options, spinner);
|
|
130
|
+
progress.rootFilesDeployed += cicdFiles;
|
|
131
|
+
// STEP 11.5: Update .gitignore
|
|
132
|
+
const gitignoreUpdated = await updateGitignore(spinner);
|
|
133
|
+
if (gitignoreUpdated) {
|
|
134
|
+
progress.rootFilesDeployed++;
|
|
135
|
+
}
|
|
136
|
+
// STEP 12: Install Trinity Method SDK
|
|
137
|
+
const sdkInstalled = await installSDK(spinner);
|
|
138
|
+
if (sdkInstalled) {
|
|
139
|
+
progress.rootFilesDeployed++;
|
|
140
|
+
}
|
|
141
|
+
// SUCCESS: Display deployment summary
|
|
142
|
+
await displaySummary(progress, options, stack, metrics);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
if (spinner)
|
|
146
|
+
spinner.fail();
|
|
147
|
+
const { displayError, getErrorMessage } = await import('../../utils/errors.js');
|
|
148
|
+
const message = getErrorMessage(error);
|
|
149
|
+
displayError(`Deployment failed: ${message}`);
|
|
150
|
+
if (message === 'Deployment cancelled by user') {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge base template deployment
|
|
3
|
+
*/
|
|
4
|
+
import type { Stack, CodebaseMetrics, Spinner } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Deploy and enrich knowledge base templates
|
|
7
|
+
*
|
|
8
|
+
* @param templatesPath - Path to templates directory
|
|
9
|
+
* @param variables - Template variables for substitution
|
|
10
|
+
* @param stack - Detected technology stack
|
|
11
|
+
* @param metrics - Collected codebase metrics
|
|
12
|
+
* @param spinner - Spinner instance for status updates
|
|
13
|
+
* @returns Number of files deployed
|
|
14
|
+
*/
|
|
15
|
+
export declare function deployKnowledgeBase(templatesPath: string, variables: Record<string, string>, stack: Stack, metrics: CodebaseMetrics, spinner: Spinner): Promise<number>;
|
|
16
|
+
//# sourceMappingURL=knowledge-base.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge base template deployment
|
|
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 and enrich knowledge base templates
|
|
10
|
+
*
|
|
11
|
+
* @param templatesPath - Path to templates directory
|
|
12
|
+
* @param variables - Template variables for substitution
|
|
13
|
+
* @param stack - Detected technology stack
|
|
14
|
+
* @param metrics - Collected codebase metrics
|
|
15
|
+
* @param spinner - Spinner instance for status updates
|
|
16
|
+
* @returns Number of files deployed
|
|
17
|
+
*/
|
|
18
|
+
export async function deployKnowledgeBase(templatesPath, variables, stack, metrics, spinner) {
|
|
19
|
+
spinner.start('Deploying knowledge base templates...');
|
|
20
|
+
let filesDeployed = 0;
|
|
21
|
+
const kbTemplates = [
|
|
22
|
+
'ARCHITECTURE.md',
|
|
23
|
+
'Trinity.md',
|
|
24
|
+
'To-do.md',
|
|
25
|
+
'ISSUES.md',
|
|
26
|
+
'Technical-Debt.md',
|
|
27
|
+
'CODING-PRINCIPLES.md',
|
|
28
|
+
'TESTING-PRINCIPLES.md',
|
|
29
|
+
'AI-DEVELOPMENT-GUIDE.md',
|
|
30
|
+
'DOCUMENTATION-CRITERIA.md',
|
|
31
|
+
];
|
|
32
|
+
for (const template of kbTemplates) {
|
|
33
|
+
const templatePath = path.join(templatesPath, 'knowledge-base', `${template}.template`);
|
|
34
|
+
if (await fs.pathExists(templatePath)) {
|
|
35
|
+
const content = await fs.readFile(templatePath, 'utf8');
|
|
36
|
+
const processed = processTemplate(content, variables);
|
|
37
|
+
// Validate destination path for security
|
|
38
|
+
const destPath = validatePath(`trinity/knowledge-base/${template}`);
|
|
39
|
+
await fs.writeFile(destPath, processed);
|
|
40
|
+
filesDeployed++;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
spinner.succeed('Knowledge base templates deployed');
|
|
44
|
+
// Enrich knowledge base with project metrics
|
|
45
|
+
try {
|
|
46
|
+
spinner.start('Enriching knowledge base with project metrics...');
|
|
47
|
+
const archPath = 'trinity/knowledge-base/ARCHITECTURE.md';
|
|
48
|
+
if (await fs.pathExists(archPath)) {
|
|
49
|
+
let archContent = await fs.readFile(archPath, 'utf8');
|
|
50
|
+
// Replace common placeholders with actual data
|
|
51
|
+
archContent = archContent
|
|
52
|
+
.replace(/\{\{PROJECT_NAME\}\}/g, variables.PROJECT_NAME)
|
|
53
|
+
.replace(/\{\{FRAMEWORK\}\}/g, stack.framework)
|
|
54
|
+
.replace(/\{\{LANGUAGE\}\}/g, stack.language)
|
|
55
|
+
.replace(/\{\{SOURCE_DIR\}\}/g, stack.sourceDir)
|
|
56
|
+
.replace(/\{\{PACKAGE_MANAGER\}\}/g, stack.packageManager || 'npm')
|
|
57
|
+
.replace(/\{\{BACKEND_FRAMEWORK\}\}/g, stack.framework)
|
|
58
|
+
.replace(/\{\{TODO_COUNT\}\}/g, String(metrics?.todoCount || 0))
|
|
59
|
+
.replace(/\{\{FILE_COUNT\}\}/g, String(metrics?.totalFiles || 0))
|
|
60
|
+
.replace(/\{\{DEPENDENCY_COUNT\}\}/g, String(metrics?.dependencyCount || 0));
|
|
61
|
+
// Validate path for security
|
|
62
|
+
const validatedArchPath = validatePath(archPath);
|
|
63
|
+
await fs.writeFile(validatedArchPath, archContent);
|
|
64
|
+
spinner.succeed('Knowledge base enriched with project data');
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
spinner.info('ARCHITECTURE.md not found - skipping enrichment');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
spinner.warn('Knowledge base enrichment skipped');
|
|
72
|
+
}
|
|
73
|
+
return filesDeployed;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=knowledge-base.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linting configuration deployment
|
|
3
|
+
*/
|
|
4
|
+
import type { LintingTool, Stack, Spinner } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Deploy linting tools and inject dependencies
|
|
7
|
+
*
|
|
8
|
+
* @param lintingTools - Selected linting tools to deploy
|
|
9
|
+
* @param lintingDependencies - Dependencies to inject
|
|
10
|
+
* @param lintingScripts - Scripts to add to package.json
|
|
11
|
+
* @param stack - Detected technology stack
|
|
12
|
+
* @param templatesPath - Path to templates directory
|
|
13
|
+
* @param variables - Template variables for substitution
|
|
14
|
+
* @param spinner - Spinner instance for status updates
|
|
15
|
+
* @returns Number of files deployed
|
|
16
|
+
*/
|
|
17
|
+
export declare function deployLinting(lintingTools: LintingTool[], lintingDependencies: string[], lintingScripts: Record<string, string>, stack: Stack, templatesPath: string, variables: Record<string, string>, spinner: Spinner): Promise<number>;
|
|
18
|
+
//# sourceMappingURL=linting.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linting configuration deployment
|
|
3
|
+
*/
|
|
4
|
+
import { deployLintingTool } from '../../utils/deploy-linting.js';
|
|
5
|
+
import { injectLintingDependencies } from '../../utils/inject-dependencies.js';
|
|
6
|
+
/**
|
|
7
|
+
* Deploy linting tools and inject dependencies
|
|
8
|
+
*
|
|
9
|
+
* @param lintingTools - Selected linting tools to deploy
|
|
10
|
+
* @param lintingDependencies - Dependencies to inject
|
|
11
|
+
* @param lintingScripts - Scripts to add to package.json
|
|
12
|
+
* @param stack - Detected technology stack
|
|
13
|
+
* @param templatesPath - Path to templates directory
|
|
14
|
+
* @param variables - Template variables for substitution
|
|
15
|
+
* @param spinner - Spinner instance for status updates
|
|
16
|
+
* @returns Number of files deployed
|
|
17
|
+
*/
|
|
18
|
+
export async function deployLinting(lintingTools, lintingDependencies, lintingScripts, stack, templatesPath, variables, spinner) {
|
|
19
|
+
let filesDeployed = 0;
|
|
20
|
+
// Deploy linting configuration files
|
|
21
|
+
if (lintingTools.length > 0) {
|
|
22
|
+
spinner.start('Deploying linting configuration...');
|
|
23
|
+
try {
|
|
24
|
+
for (const tool of lintingTools) {
|
|
25
|
+
await deployLintingTool(tool, stack, templatesPath, variables);
|
|
26
|
+
filesDeployed++;
|
|
27
|
+
}
|
|
28
|
+
spinner.succeed(`Linting configuration deployed (${lintingTools.length} tools)`);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
spinner.fail('Linting configuration deployment failed');
|
|
32
|
+
const { displayWarning, getErrorMessage } = await import('../../utils/errors.js');
|
|
33
|
+
displayWarning(getErrorMessage(error));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Inject linting dependencies
|
|
37
|
+
if (lintingDependencies.length > 0) {
|
|
38
|
+
spinner.start('Adding linting dependencies to project...');
|
|
39
|
+
try {
|
|
40
|
+
await injectLintingDependencies(lintingDependencies, lintingScripts, stack.framework);
|
|
41
|
+
spinner.succeed('Linting dependencies added to project configuration');
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
spinner.fail('Dependency injection failed');
|
|
45
|
+
const { displayWarning, getErrorMessage } = await import('../../utils/errors.js');
|
|
46
|
+
displayWarning(getErrorMessage(error));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return filesDeployed;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=linting.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codebase metrics collection for deployment
|
|
3
|
+
*/
|
|
4
|
+
import type { CodebaseMetrics, Stack, Spinner } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Collect codebase metrics for enriching templates
|
|
7
|
+
*
|
|
8
|
+
* @param stack - Detected technology stack
|
|
9
|
+
* @param spinner - Spinner instance for status updates
|
|
10
|
+
* @returns Collected codebase metrics
|
|
11
|
+
*/
|
|
12
|
+
export declare function collectMetrics(stack: Stack, spinner: Spinner): Promise<CodebaseMetrics>;
|
|
13
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codebase metrics collection for deployment
|
|
3
|
+
*/
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { collectCodebaseMetrics } from '../../utils/metrics/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Collect codebase metrics for enriching templates
|
|
8
|
+
*
|
|
9
|
+
* @param stack - Detected technology stack
|
|
10
|
+
* @param spinner - Spinner instance for status updates
|
|
11
|
+
* @returns Collected codebase metrics
|
|
12
|
+
*/
|
|
13
|
+
export async function collectMetrics(stack, spinner) {
|
|
14
|
+
spinner.start('Collecting codebase metrics...');
|
|
15
|
+
try {
|
|
16
|
+
const metrics = await collectCodebaseMetrics(stack.sourceDir, stack.framework);
|
|
17
|
+
spinner.succeed('Codebase metrics collected');
|
|
18
|
+
// Display metrics summary
|
|
19
|
+
console.log(chalk.cyan('\n📊 Codebase Metrics:'));
|
|
20
|
+
console.log(chalk.white(` Total Files: ${metrics.totalFiles}`));
|
|
21
|
+
console.log(chalk.white(` TODO Comments: ${metrics.todoCount}`));
|
|
22
|
+
console.log(chalk.white(` Large Files (>500 lines): ${metrics.filesOver500}`));
|
|
23
|
+
console.log(chalk.white(` Dependencies: ${metrics.dependencyCount}`));
|
|
24
|
+
return metrics;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
spinner.warn('Could not collect all metrics');
|
|
28
|
+
console.log(chalk.yellow(' Some metrics collection failed, continuing...'));
|
|
29
|
+
// Return minimal metrics
|
|
30
|
+
const { createEmptyMetrics } = await import('../../utils/metrics/index.js');
|
|
31
|
+
return createEmptyMetrics();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-flight checks for Trinity deployment
|
|
3
|
+
*/
|
|
4
|
+
import type { DeployOptions, Spinner } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Check if Trinity is already deployed and handle force flag
|
|
7
|
+
*
|
|
8
|
+
* @param options - Deploy command options
|
|
9
|
+
* @param spinner - Spinner instance for status updates
|
|
10
|
+
* @throws Error if Trinity already deployed and --force not used
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkPreFlight(options: DeployOptions, spinner: Spinner): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=pre-flight.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-flight checks for Trinity deployment
|
|
3
|
+
*/
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
/**
|
|
7
|
+
* Check if Trinity is already deployed and handle force flag
|
|
8
|
+
*
|
|
9
|
+
* @param options - Deploy command options
|
|
10
|
+
* @param spinner - Spinner instance for status updates
|
|
11
|
+
* @throws Error if Trinity already deployed and --force not used
|
|
12
|
+
*/
|
|
13
|
+
export async function checkPreFlight(options, spinner) {
|
|
14
|
+
spinner.start('Running pre-flight checks...');
|
|
15
|
+
// Check if Trinity is already deployed
|
|
16
|
+
const trinityExists = await fs.pathExists('trinity');
|
|
17
|
+
if (trinityExists && !options.force) {
|
|
18
|
+
spinner.fail();
|
|
19
|
+
console.log(chalk.yellow('\nTrinity Method is already deployed in this project.'));
|
|
20
|
+
console.log(chalk.cyan('\nUse --force flag to redeploy (this will overwrite existing files):'));
|
|
21
|
+
console.log(chalk.white(' npx trinity deploy --force\n'));
|
|
22
|
+
throw new Error('Trinity already deployed. Use --force to redeploy.');
|
|
23
|
+
}
|
|
24
|
+
if (trinityExists && options.force) {
|
|
25
|
+
spinner.text = 'Force flag detected - will overwrite existing deployment...';
|
|
26
|
+
}
|
|
27
|
+
spinner.succeed('Pre-flight checks passed');
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=pre-flight.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Root files and CLAUDE.md hierarchy deployment
|
|
3
|
+
*/
|
|
4
|
+
import type { Stack, Spinner } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Deploy root files and CLAUDE.md hierarchy
|
|
7
|
+
*
|
|
8
|
+
* @param templatesPath - Path to templates directory
|
|
9
|
+
* @param variables - Template variables for substitution
|
|
10
|
+
* @param stack - Detected technology stack
|
|
11
|
+
* @param pkgVersion - Package version for VERSION file
|
|
12
|
+
* @param spinner - Spinner instance for status updates
|
|
13
|
+
* @returns Number of files deployed
|
|
14
|
+
*/
|
|
15
|
+
export declare function deployRootFiles(templatesPath: string, variables: Record<string, string>, stack: Stack, pkgVersion: string, spinner: Spinner): Promise<number>;
|
|
16
|
+
//# sourceMappingURL=root-files.d.ts.map
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Root files and CLAUDE.md hierarchy deployment
|
|
3
|
+
*/
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { processTemplate } from '../../utils/template-processor.js';
|
|
8
|
+
import { validatePath } from '../../utils/validate-path.js';
|
|
9
|
+
/**
|
|
10
|
+
* Deploy TRINITY.md root file
|
|
11
|
+
*/
|
|
12
|
+
async function deployTrinityMarkdown(templatesPath, variables) {
|
|
13
|
+
const trinityRootTemplate = path.join(templatesPath, 'root', 'TRINITY.md.template');
|
|
14
|
+
if (await fs.pathExists(trinityRootTemplate)) {
|
|
15
|
+
const content = await fs.readFile(trinityRootTemplate, 'utf8');
|
|
16
|
+
const processed = processTemplate(content, variables);
|
|
17
|
+
const destPath = validatePath('TRINITY.md');
|
|
18
|
+
await fs.writeFile(destPath, processed);
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Deploy root CLAUDE.md file
|
|
25
|
+
*/
|
|
26
|
+
async function deployRootClaudeMarkdown(templatesPath, variables) {
|
|
27
|
+
const claudeRootTemplate = path.join(templatesPath, 'root', 'CLAUDE.md.template');
|
|
28
|
+
if (await fs.pathExists(claudeRootTemplate)) {
|
|
29
|
+
const content = await fs.readFile(claudeRootTemplate, 'utf8');
|
|
30
|
+
const processed = processTemplate(content, variables);
|
|
31
|
+
const destPath = validatePath('CLAUDE.md');
|
|
32
|
+
await fs.writeFile(destPath, processed);
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Deploy VERSION file
|
|
39
|
+
*/
|
|
40
|
+
async function deployVersionFile(pkgVersion) {
|
|
41
|
+
const versionPath = validatePath('trinity/VERSION');
|
|
42
|
+
await fs.writeFile(versionPath, pkgVersion || '2.0.0');
|
|
43
|
+
return 1;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Deploy trinity/CLAUDE.md file
|
|
47
|
+
*/
|
|
48
|
+
async function deployTrinityClaudeMarkdown(templatesPath, variables, spinner) {
|
|
49
|
+
spinner.start('Deploying Trinity CLAUDE.md...');
|
|
50
|
+
const trinityCLAUDETemplate = path.join(templatesPath, 'trinity', 'CLAUDE.md.template');
|
|
51
|
+
if (await fs.pathExists(trinityCLAUDETemplate)) {
|
|
52
|
+
const content = await fs.readFile(trinityCLAUDETemplate, 'utf8');
|
|
53
|
+
const processed = processTemplate(content, variables);
|
|
54
|
+
const destPath = validatePath('trinity/CLAUDE.md');
|
|
55
|
+
await fs.writeFile(destPath, processed);
|
|
56
|
+
spinner.succeed('Trinity CLAUDE.md deployed');
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
spinner.warn('Trinity CLAUDE.md template not found');
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Deploy source directory CLAUDE.md files
|
|
66
|
+
*/
|
|
67
|
+
async function deploySourceClaudeMarkdown(templatesPath, variables, stack, spinner) {
|
|
68
|
+
const frameworkMap = {
|
|
69
|
+
'Node.js': 'nodejs-CLAUDE.md.template',
|
|
70
|
+
Flutter: 'flutter-CLAUDE.md.template',
|
|
71
|
+
React: 'react-CLAUDE.md.template',
|
|
72
|
+
'Next.js': 'react-CLAUDE.md.template',
|
|
73
|
+
Python: 'python-CLAUDE.md.template',
|
|
74
|
+
Rust: 'rust-CLAUDE.md.template',
|
|
75
|
+
Unknown: 'base-CLAUDE.md.template',
|
|
76
|
+
};
|
|
77
|
+
const templateName = frameworkMap[stack.framework] || 'base-CLAUDE.md.template';
|
|
78
|
+
let sourceCLAUDETemplate = path.join(templatesPath, 'source', templateName);
|
|
79
|
+
if (!(await fs.pathExists(sourceCLAUDETemplate))) {
|
|
80
|
+
console.log(chalk.yellow(` Note: Using base template for ${stack.framework}`));
|
|
81
|
+
sourceCLAUDETemplate = path.join(templatesPath, 'source', 'base-CLAUDE.md.template');
|
|
82
|
+
}
|
|
83
|
+
if (!(await fs.pathExists(sourceCLAUDETemplate))) {
|
|
84
|
+
spinner.warn(`Source CLAUDE.md template not found for ${stack.framework}`);
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
const content = await fs.readFile(sourceCLAUDETemplate, 'utf8');
|
|
88
|
+
let deployedCount = 0;
|
|
89
|
+
for (const sourceDir of stack.sourceDirs) {
|
|
90
|
+
spinner.start(`Deploying ${sourceDir}/CLAUDE.md...`);
|
|
91
|
+
if (await fs.pathExists(sourceDir)) {
|
|
92
|
+
const processed = processTemplate(content, { ...variables, SOURCE_DIR: sourceDir });
|
|
93
|
+
const destPath = validatePath(`${sourceDir}/CLAUDE.md`);
|
|
94
|
+
await fs.writeFile(destPath, processed);
|
|
95
|
+
deployedCount++;
|
|
96
|
+
spinner.succeed(`${sourceDir}/CLAUDE.md deployed`);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
spinner.warn(`Directory ${sourceDir} not found, skipping`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (deployedCount === 0) {
|
|
103
|
+
spinner.warn('No source directories found for CLAUDE.md deployment');
|
|
104
|
+
}
|
|
105
|
+
return deployedCount;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Detect test framework from package.json
|
|
109
|
+
*/
|
|
110
|
+
async function detectTestFramework() {
|
|
111
|
+
if (!(await fs.pathExists('package.json'))) {
|
|
112
|
+
return 'Generic';
|
|
113
|
+
}
|
|
114
|
+
const pkg = JSON.parse(await fs.readFile('package.json', 'utf8'));
|
|
115
|
+
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
116
|
+
if (allDeps.jest)
|
|
117
|
+
return 'Jest';
|
|
118
|
+
if (allDeps.vitest)
|
|
119
|
+
return 'Vitest';
|
|
120
|
+
if (allDeps.mocha)
|
|
121
|
+
return 'Mocha';
|
|
122
|
+
if (allDeps.pytest)
|
|
123
|
+
return 'Pytest';
|
|
124
|
+
return 'Generic';
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Deploy tests/CLAUDE.md file
|
|
128
|
+
*/
|
|
129
|
+
async function deployTestsClaudeMarkdown(templatesPath, variables, spinner) {
|
|
130
|
+
const testsCLAUDETemplate = path.join(templatesPath, 'source', 'tests-CLAUDE.md.template');
|
|
131
|
+
if (!(await fs.pathExists(testsCLAUDETemplate))) {
|
|
132
|
+
if (await fs.pathExists('tests')) {
|
|
133
|
+
spinner.warn('tests/CLAUDE.md template not found');
|
|
134
|
+
}
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
if (!(await fs.pathExists('tests'))) {
|
|
138
|
+
return 0;
|
|
139
|
+
}
|
|
140
|
+
spinner.start('Deploying tests/CLAUDE.md...');
|
|
141
|
+
const testsContent = await fs.readFile(testsCLAUDETemplate, 'utf8');
|
|
142
|
+
const testFramework = await detectTestFramework();
|
|
143
|
+
const testsProcessed = processTemplate(testsContent, {
|
|
144
|
+
...variables,
|
|
145
|
+
TEST_FRAMEWORK: testFramework,
|
|
146
|
+
});
|
|
147
|
+
const destPath = validatePath('tests/CLAUDE.md');
|
|
148
|
+
await fs.writeFile(destPath, testsProcessed);
|
|
149
|
+
spinner.succeed('tests/CLAUDE.md deployed');
|
|
150
|
+
return 1;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Deploy root files and CLAUDE.md hierarchy
|
|
154
|
+
*
|
|
155
|
+
* @param templatesPath - Path to templates directory
|
|
156
|
+
* @param variables - Template variables for substitution
|
|
157
|
+
* @param stack - Detected technology stack
|
|
158
|
+
* @param pkgVersion - Package version for VERSION file
|
|
159
|
+
* @param spinner - Spinner instance for status updates
|
|
160
|
+
* @returns Number of files deployed
|
|
161
|
+
*/
|
|
162
|
+
export async function deployRootFiles(templatesPath, variables, stack, pkgVersion, spinner) {
|
|
163
|
+
let filesDeployed = 0;
|
|
164
|
+
// Deploy root files
|
|
165
|
+
spinner.start('Creating root files...');
|
|
166
|
+
filesDeployed += await deployTrinityMarkdown(templatesPath, variables);
|
|
167
|
+
filesDeployed += await deployRootClaudeMarkdown(templatesPath, variables);
|
|
168
|
+
filesDeployed += await deployVersionFile(pkgVersion);
|
|
169
|
+
spinner.succeed('Root files created');
|
|
170
|
+
// Deploy trinity/CLAUDE.md
|
|
171
|
+
filesDeployed += await deployTrinityClaudeMarkdown(templatesPath, variables, spinner);
|
|
172
|
+
// Deploy source directory CLAUDE.md files
|
|
173
|
+
filesDeployed += await deploySourceClaudeMarkdown(templatesPath, variables, stack, spinner);
|
|
174
|
+
// Deploy tests/CLAUDE.md
|
|
175
|
+
filesDeployed += await deployTestsClaudeMarkdown(templatesPath, variables, spinner);
|
|
176
|
+
return filesDeployed;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=root-files.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trinity Method SDK installation
|
|
3
|
+
*/
|
|
4
|
+
import type { Spinner } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Install Trinity Method SDK to the project
|
|
7
|
+
*
|
|
8
|
+
* @param spinner - Spinner instance for status updates
|
|
9
|
+
* @returns True if SDK was installed, false otherwise
|
|
10
|
+
*/
|
|
11
|
+
export declare function installSDK(spinner: Spinner): Promise<boolean>;
|
|
12
|
+
//# sourceMappingURL=sdk-install.d.ts.map
|