trinity-method-sdk 2.1.0 → 2.2.1
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 +728 -467
- package/README.md +550 -539
- package/dist/cli/commands/deploy/ci-cd.d.ts +4 -3
- package/dist/cli/commands/deploy/ci-cd.js +10 -9
- package/dist/cli/commands/deploy/configuration.js +10 -11
- package/dist/cli/commands/deploy/directories.js +13 -14
- package/dist/cli/commands/deploy/gitignore.js +3 -4
- package/dist/cli/commands/deploy/index.d.ts +1 -1
- package/dist/cli/commands/deploy/index.js +6 -2
- package/dist/cli/commands/deploy/knowledge-base.js +2 -2
- package/dist/cli/commands/deploy/pre-flight.js +1 -1
- package/dist/cli/commands/deploy/root-files.js +2 -17
- package/dist/cli/commands/deploy/summary.js +3 -3
- package/dist/cli/commands/deploy/templates.js +5 -5
- package/dist/cli/commands/update/backup.js +6 -12
- package/dist/cli/commands/update/index.js +15 -1
- package/dist/cli/commands/update/knowledge-base.js +1 -1
- package/dist/cli/commands/update/migration.d.ts +31 -0
- package/dist/cli/commands/update/migration.js +130 -0
- package/dist/cli/commands/update/pre-flight.d.ts +7 -2
- package/dist/cli/commands/update/pre-flight.js +21 -20
- package/dist/cli/commands/update/summary.js +11 -5
- package/dist/cli/commands/update/templates.js +1 -1
- package/dist/cli/commands/update/types.d.ts +2 -0
- package/dist/cli/commands/update/verification.js +5 -5
- package/dist/cli/commands/update/version.js +6 -4
- package/dist/cli/utils/deploy-ci.d.ts +3 -2
- package/dist/cli/utils/deploy-ci.js +24 -24
- package/dist/cli/utils/deploy-linting.js +100 -5
- package/dist/cli/utils/error-classes.d.ts +2 -2
- package/dist/cli/utils/linting-tools.js +14 -6
- package/dist/cli/utils/template-processor.js +1 -3
- package/dist/templates/.claude/EMPLOYEE-DIRECTORY.md.template +16 -22
- package/dist/templates/.claude/agents/aj-team/apo-documentation-specialist.md.template +7 -7
- package/dist/templates/.claude/agents/aj-team/bas-quality-gate.md.template +8 -8
- package/dist/templates/.claude/agents/aj-team/dra-code-reviewer.md.template +3 -3
- package/dist/templates/.claude/agents/aj-team/kil-task-executor.md.template +6 -6
- package/dist/templates/.claude/agents/audit/juno-auditor.md.template +39 -40
- package/dist/templates/.claude/agents/deployment/ein-cicd.md.template +56 -159
- package/dist/templates/.claude/agents/deployment/ino-context.md.template +21 -21
- package/dist/templates/.claude/agents/deployment/tan-structure.md.template +28 -29
- package/dist/templates/.claude/agents/deployment/zen-knowledge.md.template +22 -23
- package/dist/templates/.claude/agents/leadership/aj-maestro.md.template +6 -6
- package/dist/templates/.claude/agents/leadership/aly-cto.md.template +17 -18
- package/dist/templates/.claude/agents/planning/eus-decomposer.md.template +4 -4
- package/dist/templates/.claude/agents/planning/mon-requirements.md.template +4 -4
- package/dist/templates/.claude/agents/planning/ror-design.md.template +4 -4
- package/dist/templates/.claude/agents/planning/tra-planner.md.template +4 -4
- package/dist/templates/.claude/commands/execution/trinity-audit.md.template +9 -9
- package/dist/templates/.claude/commands/execution/trinity-breakdown.md.template +535 -0
- package/dist/templates/.claude/commands/execution/trinity-orchestrate.md.template +43 -43
- package/dist/templates/.claude/commands/infrastructure/trinity-init.md.template +20 -43
- package/dist/templates/.claude/commands/investigation/trinity-create-investigation.md.template +5 -5
- package/dist/templates/.claude/commands/investigation/trinity-investigate-templates.md.template +10 -10
- package/dist/templates/.claude/commands/investigation/trinity-plan-investigation.md.template +1 -1
- package/dist/templates/.claude/commands/maintenance/trinity-changelog.md.template +4 -4
- package/dist/templates/.claude/commands/maintenance/trinity-docs-update.md.template +10 -10
- package/dist/templates/.claude/commands/maintenance/trinity-docs.md.template +62 -62
- package/dist/templates/.claude/commands/maintenance/trinity-readme.md.template +16 -16
- package/dist/templates/.claude/commands/session/trinity-continue.md.template +22 -22
- package/dist/templates/.claude/commands/session/trinity-end.md.template +22 -22
- package/dist/templates/.claude/commands/session/trinity-start.md.template +1 -2
- package/dist/templates/.claude/commands/utility/trinity-agents.md.template +3 -6
- package/dist/templates/.claude/commands/utility/trinity-verify.md.template +48 -54
- package/dist/templates/.claude/commands/utility/trinity-workorder.md.template +5 -5
- package/dist/templates/ci/ci.yml.template +2 -2
- package/dist/templates/root/CLAUDE.md.template +9 -9
- package/dist/templates/root/linting/nodejs/.husky-pre-commit.template +5 -0
- package/dist/templates/source/base-CLAUDE.md.template +310 -310
- package/dist/templates/source/flutter-CLAUDE.md.template +593 -593
- package/dist/templates/source/nodejs-CLAUDE.md.template +531 -531
- package/dist/templates/source/python-CLAUDE.md.template +510 -510
- package/dist/templates/source/react-CLAUDE.md.template +513 -513
- package/dist/templates/source/rust-CLAUDE.md.template +653 -653
- package/dist/templates/trinity/CLAUDE.md.template +14 -14
- package/dist/templates/trinity/knowledge-base/ARCHITECTURE.md.template +4 -4
- package/dist/templates/trinity/knowledge-base/ISSUES.md.template +8 -8
- package/dist/templates/trinity/knowledge-base/Technical-Debt.md.template +1 -3
- package/dist/templates/trinity/knowledge-base/To-do.md.template +1 -1
- package/dist/templates/trinity/knowledge-base/Trinity.md.template +5 -5
- package/dist/templates/trinity/templates/documentation/configuration/env-example-generator.md.template +1 -1
- package/dist/templates/trinity/templates/documentation/processes/error-handling-protocol.md.template +2 -2
- package/dist/templates/trinity/templates/documentation/reports/apo-docs-update-checklist.md.template +7 -7
- package/dist/templates/trinity/templates/documentation/reports/juno-docs-update-checklist.md.template +4 -4
- package/dist/templates/trinity/templates/documentation/reports/juno-internal-report.md.template +10 -10
- package/dist/templates/trinity/templates/investigations/bug.md.template +14 -14
- package/dist/templates/trinity/templates/investigations/feature.md.template +14 -14
- package/dist/templates/trinity/templates/investigations/performance.md.template +14 -14
- package/dist/templates/trinity/templates/investigations/security.md.template +14 -14
- package/dist/templates/trinity/templates/investigations/technical.md.template +14 -14
- package/dist/templates/trinity/templates/work-orders/ANALYSIS-TEMPLATE.md.template +10 -10
- package/dist/templates/trinity/templates/work-orders/AUDIT-TEMPLATE.md.template +10 -10
- package/dist/templates/trinity/templates/work-orders/IMPLEMENTATION-TEMPLATE.md.template +10 -10
- package/dist/templates/trinity/templates/work-orders/INVESTIGATION-TEMPLATE.md.template +10 -10
- package/dist/templates/trinity/templates/work-orders/PATTERN-TEMPLATE.md.template +10 -10
- package/dist/templates/trinity/templates/work-orders/VERIFICATION-TEMPLATE.md.template +10 -10
- package/package.json +99 -94
- package/dist/templates/.claude/agents/leadership/aj-cc.md.template +0 -467
- package/dist/templates/ci/cd.yml.template +0 -175
- package/dist/templates/ci/github-actions.yml +0 -86
- package/dist/templates/root/TRINITY.md.template +0 -52
|
@@ -7,31 +7,32 @@ import fs from 'fs-extra';
|
|
|
7
7
|
import { UpdateError } from '../../utils/error-classes.js';
|
|
8
8
|
/**
|
|
9
9
|
* Run pre-flight checks to ensure Trinity Method is deployed
|
|
10
|
+
* Detects both current (.claude/trinity/) and legacy (trinity/) layouts
|
|
10
11
|
* @param spinner - ora spinner instance for status display
|
|
11
|
-
* @
|
|
12
|
+
* @returns Pre-flight result with migration flags
|
|
13
|
+
* @throws {UpdateError} If no Trinity deployment found at all
|
|
12
14
|
*/
|
|
13
15
|
export async function runUpdatePreflightChecks(spinner) {
|
|
14
16
|
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
17
|
const claudeExists = await fs.pathExists('.claude');
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
const trinityExists = await fs.pathExists('.claude/trinity');
|
|
19
|
+
const legacyExists = await fs.pathExists('trinity');
|
|
20
|
+
// Current structure found — no migration needed
|
|
21
|
+
if (claudeExists && trinityExists) {
|
|
22
|
+
spinner.succeed('Pre-flight checks passed');
|
|
23
|
+
return { needsLegacyMigration: false };
|
|
24
|
+
}
|
|
25
|
+
// Legacy structure found — migration needed
|
|
26
|
+
if (legacyExists) {
|
|
27
|
+
spinner.succeed('Pre-flight checks passed (legacy deployment detected)');
|
|
28
|
+
return { needsLegacyMigration: true };
|
|
34
29
|
}
|
|
35
|
-
|
|
30
|
+
// Neither found — not deployed
|
|
31
|
+
spinner.fail('Trinity Method not deployed');
|
|
32
|
+
const { displayInfo } = await import('../../utils/errors.js');
|
|
33
|
+
displayInfo('Use: trinity deploy to install');
|
|
34
|
+
throw new UpdateError('Trinity Method not deployed in this project', {
|
|
35
|
+
reason: 'trinity_directory_missing',
|
|
36
|
+
});
|
|
36
37
|
}
|
|
37
38
|
//# sourceMappingURL=pre-flight.js.map
|
|
@@ -18,6 +18,12 @@ export function displayUpdateSummary(stats, oldVersion, newVersion) {
|
|
|
18
18
|
console.log(chalk.white(` Commands Updated: ${stats.commandsUpdated}`));
|
|
19
19
|
console.log(chalk.white(` Templates Updated: ${stats.templatesUpdated}`));
|
|
20
20
|
console.log(chalk.white(` Knowledge Base Updated: ${stats.knowledgeBaseUpdated}`));
|
|
21
|
+
if (stats.legacyMigrated) {
|
|
22
|
+
console.log(chalk.yellow(` Legacy Migration: trinity/ → .claude/trinity/`));
|
|
23
|
+
}
|
|
24
|
+
if (stats.gitignoreUpdated) {
|
|
25
|
+
console.log(chalk.white(` .gitignore: Updated`));
|
|
26
|
+
}
|
|
21
27
|
console.log(chalk.white(` Total Files Updated: ${stats.agentsUpdated + stats.commandsUpdated + stats.templatesUpdated + stats.knowledgeBaseUpdated}`));
|
|
22
28
|
console.log('');
|
|
23
29
|
console.log(chalk.gray(` Version: ${oldVersion} → ${newVersion}\n`));
|
|
@@ -32,15 +38,15 @@ export function displayDryRunPreview(oldVersion, newVersion) {
|
|
|
32
38
|
console.log(chalk.white(' Would update:'));
|
|
33
39
|
console.log(chalk.gray(` • 18 agent files in .claude/agents/`));
|
|
34
40
|
console.log(chalk.gray(` • 16 slash commands in .claude/commands/`));
|
|
35
|
-
console.log(chalk.gray(` • 6 work order templates in trinity/templates/`));
|
|
41
|
+
console.log(chalk.gray(` • 6 work order templates in .claude/trinity/templates/`));
|
|
36
42
|
console.log(chalk.gray(` • Knowledge base files (Trinity.md, CODING-PRINCIPLES.md, etc.)`));
|
|
37
43
|
console.log(chalk.gray(` • Version file: ${oldVersion} → ${newVersion}`));
|
|
38
44
|
console.log('');
|
|
39
45
|
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`));
|
|
46
|
+
console.log(chalk.gray(` • .claude/trinity/knowledge-base/ARCHITECTURE.md`));
|
|
47
|
+
console.log(chalk.gray(` • .claude/trinity/knowledge-base/To-do.md`));
|
|
48
|
+
console.log(chalk.gray(` • .claude/trinity/knowledge-base/ISSUES.md`));
|
|
49
|
+
console.log(chalk.gray(` • .claude/trinity/knowledge-base/Technical-Debt.md`));
|
|
44
50
|
console.log('');
|
|
45
51
|
console.log(chalk.blue('💡 Run without --dry-run to perform update\n'));
|
|
46
52
|
}
|
|
@@ -51,7 +51,7 @@ export async function updateTemplates(spinner, stats) {
|
|
|
51
51
|
const sdkTemplatesPath = path.join(sdkPath, 'dist/templates/trinity/templates');
|
|
52
52
|
for (const templateDir of TEMPLATE_DIRS) {
|
|
53
53
|
const sourcePath = path.join(sdkTemplatesPath, templateDir);
|
|
54
|
-
const targetPath = path.join('trinity/templates', templateDir);
|
|
54
|
+
const targetPath = path.join('.claude/trinity/templates', templateDir);
|
|
55
55
|
if (await fs.pathExists(sourcePath)) {
|
|
56
56
|
await fs.ensureDir(targetPath);
|
|
57
57
|
await copyTemplatesRecursively(sourcePath, targetPath, stats);
|
|
@@ -7,13 +7,13 @@ import fs from 'fs-extra';
|
|
|
7
7
|
import { validatePath } from '../../utils/validate-path.js';
|
|
8
8
|
/** Verification checks to run after update */
|
|
9
9
|
const VERIFICATION_CHECKS = [
|
|
10
|
-
{ path: 'trinity/VERSION', desc: 'Version file' },
|
|
10
|
+
{ path: '.claude/trinity/VERSION', desc: 'Version file' },
|
|
11
11
|
{ path: '.claude/agents/leadership', desc: 'Leadership agents' },
|
|
12
12
|
{ path: '.claude/agents/planning', desc: 'Planning agents' },
|
|
13
13
|
{ path: '.claude/agents/aj-team', desc: 'AJ team agents' },
|
|
14
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' },
|
|
15
|
+
{ path: '.claude/trinity/templates', desc: 'Work order templates' },
|
|
16
|
+
{ path: '.claude/trinity/knowledge-base/Trinity.md', desc: 'Trinity knowledge base' },
|
|
17
17
|
];
|
|
18
18
|
/**
|
|
19
19
|
* Verify update deployment is successful
|
|
@@ -31,7 +31,7 @@ export async function verifyUpdateDeployment(spinner, expectedVersion) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
// Verify version was actually updated
|
|
34
|
-
const versionPath = 'trinity/VERSION';
|
|
34
|
+
const versionPath = '.claude/trinity/VERSION';
|
|
35
35
|
const updatedVersion = (await fs.readFile(versionPath, 'utf8')).trim();
|
|
36
36
|
if (updatedVersion !== expectedVersion) {
|
|
37
37
|
spinner.fail('Version file not updated correctly');
|
|
@@ -47,7 +47,7 @@ export async function verifyUpdateDeployment(spinner, expectedVersion) {
|
|
|
47
47
|
export async function updateVersionFile(spinner, version) {
|
|
48
48
|
spinner.start('Updating version file...');
|
|
49
49
|
// Validate destination path for security
|
|
50
|
-
const destPath = validatePath('trinity/VERSION');
|
|
50
|
+
const destPath = validatePath('.claude/trinity/VERSION');
|
|
51
51
|
await fs.writeFile(destPath, version);
|
|
52
52
|
spinner.succeed('Version file updated');
|
|
53
53
|
}
|
|
@@ -13,11 +13,13 @@ import { getPackageJsonPath } from '../../utils/get-sdk-path.js';
|
|
|
13
13
|
*/
|
|
14
14
|
export async function detectInstalledSDKVersion(spinner) {
|
|
15
15
|
spinner.start('Checking versions...');
|
|
16
|
-
// Read current version from trinity/VERSION
|
|
17
|
-
const versionPath = 'trinity/VERSION';
|
|
16
|
+
// Read current version from .claude/trinity/VERSION (or legacy trinity/VERSION)
|
|
18
17
|
let currentVersion = '0.0.0';
|
|
19
|
-
if (await fs.pathExists(
|
|
20
|
-
currentVersion = (await fs.readFile(
|
|
18
|
+
if (await fs.pathExists('.claude/trinity/VERSION')) {
|
|
19
|
+
currentVersion = (await fs.readFile('.claude/trinity/VERSION', 'utf8')).trim();
|
|
20
|
+
}
|
|
21
|
+
else if (await fs.pathExists('trinity/VERSION')) {
|
|
22
|
+
currentVersion = (await fs.readFile('trinity/VERSION', 'utf8')).trim();
|
|
21
23
|
}
|
|
22
24
|
// Read latest version from SDK package.json
|
|
23
25
|
const sdkPkgPath = await getPackageJsonPath();
|
|
@@ -12,11 +12,12 @@ interface CIDeployOptions {
|
|
|
12
12
|
force?: boolean;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Deploy CI
|
|
15
|
+
* Deploy CI workflow templates based on detected Git platform
|
|
16
16
|
*
|
|
17
17
|
* @param options - Deployment options
|
|
18
|
+
* @param variables - Template variables for processing
|
|
18
19
|
* @returns Deployment results with statistics
|
|
19
20
|
*/
|
|
20
|
-
export declare function deployCITemplates(options?: CIDeployOptions): Promise<CIDeploymentStats>;
|
|
21
|
+
export declare function deployCITemplates(options?: CIDeployOptions, variables?: Record<string, string>): Promise<CIDeploymentStats>;
|
|
21
22
|
export {};
|
|
22
23
|
//# sourceMappingURL=deploy-ci.d.ts.map
|
|
@@ -3,6 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { dirname } from 'path';
|
|
5
5
|
import { validatePath } from './validate-path.js';
|
|
6
|
+
import { processTemplate } from './template-processor.js';
|
|
6
7
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
8
|
const __dirname = dirname(__filename);
|
|
8
9
|
/**
|
|
@@ -20,7 +21,7 @@ async function deployGitLabCI(templatesPath, options, stats) {
|
|
|
20
21
|
const content = await fs.readFile(gitlabTemplate, 'utf8');
|
|
21
22
|
const gitlabCIExists = await fs.pathExists('.gitlab-ci.yml');
|
|
22
23
|
if (gitlabCIExists && !options.force) {
|
|
23
|
-
stats.skipped.push('.gitlab-ci.yml (already exists)');
|
|
24
|
+
stats.skipped.push('.gitlab-ci.yml (already exists, use --force to overwrite)');
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
27
|
// Validate destination path for security
|
|
@@ -34,12 +35,13 @@ async function deployGitLabCI(templatesPath, options, stats) {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
|
-
* Deploy CI
|
|
38
|
+
* Deploy CI workflow templates based on detected Git platform
|
|
38
39
|
*
|
|
39
40
|
* @param options - Deployment options
|
|
41
|
+
* @param variables - Template variables for processing
|
|
40
42
|
* @returns Deployment results with statistics
|
|
41
43
|
*/
|
|
42
|
-
export async function deployCITemplates(options = {}) {
|
|
44
|
+
export async function deployCITemplates(options = {}, variables = {}) {
|
|
43
45
|
const stats = {
|
|
44
46
|
deployed: [],
|
|
45
47
|
skipped: [],
|
|
@@ -49,33 +51,31 @@ export async function deployCITemplates(options = {}) {
|
|
|
49
51
|
// Detect Git platform
|
|
50
52
|
const platform = await detectGitPlatform();
|
|
51
53
|
const templatesPath = path.join(__dirname, '../../templates/ci');
|
|
52
|
-
// GitHub Actions - Deploy
|
|
54
|
+
// GitHub Actions - Deploy CI workflow
|
|
53
55
|
if (platform === 'github' || platform === 'unknown') {
|
|
54
56
|
try {
|
|
55
57
|
await fs.ensureDir('.github/workflows');
|
|
56
58
|
// Deploy CI workflow
|
|
57
59
|
const ciTemplate = path.join(templatesPath, 'ci.yml.template');
|
|
58
60
|
if (await fs.pathExists(ciTemplate)) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
await fs.writeFile(destPath, content);
|
|
72
|
-
stats.deployed.push('.github/workflows/cd.yml');
|
|
61
|
+
const ciExists = await fs.pathExists('.github/workflows/ci.yml');
|
|
62
|
+
if (ciExists && !options.force) {
|
|
63
|
+
stats.skipped.push('.github/workflows/ci.yml (already exists, use --force to overwrite)');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const content = await fs.readFile(ciTemplate, 'utf8');
|
|
67
|
+
const processed = processTemplate(content, variables);
|
|
68
|
+
// Validate destination path for security
|
|
69
|
+
const destPath = validatePath('.github/workflows/ci.yml');
|
|
70
|
+
await fs.writeFile(destPath, processed);
|
|
71
|
+
stats.deployed.push('.github/workflows/ci.yml');
|
|
72
|
+
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
catch (error) {
|
|
76
76
|
const { getErrorMessage } = await import('./errors.js');
|
|
77
77
|
stats.errors.push({
|
|
78
|
-
file: '.github/workflows/ci.yml
|
|
78
|
+
file: '.github/workflows/ci.yml',
|
|
79
79
|
error: getErrorMessage(error),
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -84,22 +84,22 @@ export async function deployCITemplates(options = {}) {
|
|
|
84
84
|
if (platform === 'gitlab') {
|
|
85
85
|
await deployGitLabCI(templatesPath, options, stats);
|
|
86
86
|
}
|
|
87
|
-
// Generic template (always deploy to trinity/templates/ci)
|
|
87
|
+
// Generic template (always deploy to .claude/trinity/templates/ci)
|
|
88
88
|
try {
|
|
89
|
-
await fs.ensureDir('trinity/templates/ci');
|
|
89
|
+
await fs.ensureDir('.claude/trinity/templates/ci');
|
|
90
90
|
const genericTemplate = path.join(templatesPath, 'generic-ci.yml');
|
|
91
91
|
if (await fs.pathExists(genericTemplate)) {
|
|
92
92
|
const content = await fs.readFile(genericTemplate, 'utf8');
|
|
93
93
|
// Validate destination path for security
|
|
94
|
-
const destPath = validatePath('trinity/templates/ci/generic-ci.yml');
|
|
94
|
+
const destPath = validatePath('.claude/trinity/templates/ci/generic-ci.yml');
|
|
95
95
|
await fs.writeFile(destPath, content);
|
|
96
|
-
stats.deployed.push('trinity/templates/ci/generic-ci.yml');
|
|
96
|
+
stats.deployed.push('.claude/trinity/templates/ci/generic-ci.yml');
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
100
100
|
const { getErrorMessage } = await import('./errors.js');
|
|
101
101
|
stats.errors.push({
|
|
102
|
-
file: 'trinity/templates/ci/generic-ci.yml',
|
|
102
|
+
file: '.claude/trinity/templates/ci/generic-ci.yml',
|
|
103
103
|
error: getErrorMessage(error),
|
|
104
104
|
});
|
|
105
105
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import chalk from 'chalk';
|
|
3
4
|
import { processTemplate } from './template-processor.js';
|
|
4
5
|
import { validatePath } from './validate-path.js';
|
|
5
6
|
export async function deployLintingTool(tool, stack, templatesPath, variables) {
|
|
@@ -14,7 +15,7 @@ export async function deployLintingTool(tool, stack, templatesPath, variables) {
|
|
|
14
15
|
await deployPrettier(tool, templateDir, variables);
|
|
15
16
|
break;
|
|
16
17
|
case 'precommit':
|
|
17
|
-
await deployPreCommit(tool, templateDir, variables);
|
|
18
|
+
await deployPreCommit(tool, stack, templateDir, variables);
|
|
18
19
|
break;
|
|
19
20
|
case 'typescript-eslint':
|
|
20
21
|
await deployTypeScriptESLint(tool, stack, templateDir, variables);
|
|
@@ -46,7 +47,22 @@ function getFrameworkDirectory(framework) {
|
|
|
46
47
|
};
|
|
47
48
|
return frameworkMap[framework] || 'nodejs';
|
|
48
49
|
}
|
|
49
|
-
async function deployESLint(
|
|
50
|
+
async function deployESLint(_tool, stack, templateDir, variables) {
|
|
51
|
+
// Skip if ESLint config already exists
|
|
52
|
+
const eslintConfigs = [
|
|
53
|
+
'.eslintrc.json',
|
|
54
|
+
'.eslintrc.js',
|
|
55
|
+
'.eslintrc.cjs',
|
|
56
|
+
'.eslintrc.yml',
|
|
57
|
+
'eslint.config.js',
|
|
58
|
+
'eslint.config.mjs',
|
|
59
|
+
];
|
|
60
|
+
for (const config of eslintConfigs) {
|
|
61
|
+
if (await fs.pathExists(config)) {
|
|
62
|
+
console.warn(chalk.yellow(` Skipped: .eslintrc.json (${config} already exists, use --force to overwrite)`));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
50
66
|
let templateFile;
|
|
51
67
|
if (stack.language === 'TypeScript') {
|
|
52
68
|
templateFile = '.eslintrc-typescript.json.template';
|
|
@@ -64,7 +80,22 @@ async function deployESLint(tool, stack, templateDir, variables) {
|
|
|
64
80
|
const destPath = validatePath('.eslintrc.json');
|
|
65
81
|
await fs.writeFile(destPath, processed);
|
|
66
82
|
}
|
|
67
|
-
async function deployPrettier(
|
|
83
|
+
async function deployPrettier(_tool, templateDir, variables) {
|
|
84
|
+
// Skip if Prettier config already exists
|
|
85
|
+
const prettierConfigs = [
|
|
86
|
+
'.prettierrc.json',
|
|
87
|
+
'.prettierrc',
|
|
88
|
+
'.prettierrc.js',
|
|
89
|
+
'.prettierrc.cjs',
|
|
90
|
+
'.prettierrc.yml',
|
|
91
|
+
'prettier.config.js',
|
|
92
|
+
];
|
|
93
|
+
for (const config of prettierConfigs) {
|
|
94
|
+
if (await fs.pathExists(config)) {
|
|
95
|
+
console.warn(chalk.yellow(` Skipped: .prettierrc.json (${config} already exists, use --force to overwrite)`));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
68
99
|
const templatePath = path.join(templateDir, '.prettierrc.json.template');
|
|
69
100
|
const content = await fs.readFile(templatePath, 'utf8');
|
|
70
101
|
const processed = processTemplate(content, variables);
|
|
@@ -72,7 +103,71 @@ async function deployPrettier(tool, templateDir, variables) {
|
|
|
72
103
|
const destPath = validatePath('.prettierrc.json');
|
|
73
104
|
await fs.writeFile(destPath, processed);
|
|
74
105
|
}
|
|
75
|
-
async function deployPreCommit(tool, templateDir, variables) {
|
|
106
|
+
async function deployPreCommit(tool, stack, templateDir, variables) {
|
|
107
|
+
// Skip if existing pre-commit setup detected
|
|
108
|
+
if (await hasExistingPreCommitSetup()) {
|
|
109
|
+
console.warn(chalk.yellow(' Existing pre-commit configuration detected, skipping deployment'));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const framework = stack.framework;
|
|
113
|
+
if (framework === 'Node.js' || framework === 'React' || framework === 'Next.js') {
|
|
114
|
+
await deployHuskyPreCommit(tool, templateDir, variables);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
await deployPythonPreCommit(tool, templateDir, variables);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function hasExistingPreCommitSetup() {
|
|
121
|
+
// Check for .husky/ directory
|
|
122
|
+
if (await fs.pathExists('.husky')) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
// Check for .pre-commit-config.yaml
|
|
126
|
+
if (await fs.pathExists('.pre-commit-config.yaml')) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
// Check package.json for husky or lint-staged
|
|
130
|
+
if (await fs.pathExists('package.json')) {
|
|
131
|
+
const pkg = await fs.readJson('package.json');
|
|
132
|
+
const allDeps = {
|
|
133
|
+
...pkg.dependencies,
|
|
134
|
+
...pkg.devDependencies,
|
|
135
|
+
};
|
|
136
|
+
if (allDeps.husky || allDeps['lint-staged']) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
async function deployHuskyPreCommit(_tool, templateDir, variables) {
|
|
143
|
+
// Create .husky directory
|
|
144
|
+
await fs.ensureDir('.husky');
|
|
145
|
+
// Deploy pre-commit hook from template
|
|
146
|
+
const templatePath = path.join(templateDir, '.husky-pre-commit.template');
|
|
147
|
+
const content = await fs.readFile(templatePath, 'utf8');
|
|
148
|
+
const processed = processTemplate(content, variables);
|
|
149
|
+
const destPath = validatePath('.husky/pre-commit');
|
|
150
|
+
await fs.writeFile(destPath, processed, { mode: 0o755 });
|
|
151
|
+
// Add lint-staged config to package.json
|
|
152
|
+
await addLintStagedConfig();
|
|
153
|
+
}
|
|
154
|
+
async function addLintStagedConfig() {
|
|
155
|
+
const packageJsonPath = 'package.json';
|
|
156
|
+
if (!(await fs.pathExists(packageJsonPath))) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const pkg = await fs.readJson(packageJsonPath);
|
|
160
|
+
if (pkg['lint-staged']) {
|
|
161
|
+
return; // Already has lint-staged config
|
|
162
|
+
}
|
|
163
|
+
pkg['lint-staged'] = {
|
|
164
|
+
'*.{ts,tsx}': ['eslint --fix', 'prettier --write'],
|
|
165
|
+
'*.{js,jsx}': ['eslint --fix', 'prettier --write'],
|
|
166
|
+
'*.{json,md,yml,yaml}': ['prettier --write'],
|
|
167
|
+
};
|
|
168
|
+
await fs.writeJson(packageJsonPath, pkg, { spaces: 2 });
|
|
169
|
+
}
|
|
170
|
+
async function deployPythonPreCommit(_tool, templateDir, variables) {
|
|
76
171
|
const templatePath = path.join(templateDir, '.pre-commit-config.yaml.template');
|
|
77
172
|
const content = await fs.readFile(templatePath, 'utf8');
|
|
78
173
|
const processed = processTemplate(content, variables);
|
|
@@ -116,7 +211,7 @@ async function deployPythonTool(tool, templateDir, variables) {
|
|
|
116
211
|
await fs.writeFile(destPath, processed);
|
|
117
212
|
}
|
|
118
213
|
}
|
|
119
|
-
async function deployDartAnalyzer(
|
|
214
|
+
async function deployDartAnalyzer(_tool, templateDir, variables) {
|
|
120
215
|
const templatePath = path.join(templateDir, 'analysis_options.yaml.template');
|
|
121
216
|
const content = await fs.readFile(templatePath, 'utf8');
|
|
122
217
|
const processed = processTemplate(content, variables);
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export declare class TrinityCLIError extends Error {
|
|
11
11
|
readonly code: string;
|
|
12
12
|
readonly exitCode: number;
|
|
13
|
-
readonly context?: Record<string, unknown
|
|
13
|
+
readonly context?: Record<string, unknown> | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* Create a Trinity CLI error
|
|
16
16
|
* @param message - Human-readable error message
|
|
@@ -18,7 +18,7 @@ export declare class TrinityCLIError extends Error {
|
|
|
18
18
|
* @param exitCode - Process exit code (default: 1)
|
|
19
19
|
* @param context - Additional context for debugging
|
|
20
20
|
*/
|
|
21
|
-
constructor(message: string, code: string, exitCode?: number, context?: Record<string, unknown>);
|
|
21
|
+
constructor(message: string, code: string, exitCode?: number, context?: Record<string, unknown> | undefined);
|
|
22
22
|
/**
|
|
23
23
|
* Format error for user display
|
|
24
24
|
* @returns Formatted error message with code
|
|
@@ -27,10 +27,14 @@ export const lintingTools = {
|
|
|
27
27
|
{
|
|
28
28
|
id: 'precommit',
|
|
29
29
|
name: 'Pre-commit hooks',
|
|
30
|
-
description: 'Git hooks for code quality',
|
|
31
|
-
file: '.pre-commit
|
|
30
|
+
description: 'Git hooks for code quality (husky + lint-staged)',
|
|
31
|
+
file: '.husky/pre-commit',
|
|
32
32
|
recommended: true,
|
|
33
|
-
dependencies: [],
|
|
33
|
+
dependencies: ['husky@^9.1.7', 'lint-staged@^16.2.0'],
|
|
34
|
+
scripts: {
|
|
35
|
+
prepare: 'husky',
|
|
36
|
+
},
|
|
37
|
+
postInstall: 'npm install',
|
|
34
38
|
},
|
|
35
39
|
{
|
|
36
40
|
id: 'typescript-eslint',
|
|
@@ -69,10 +73,14 @@ export const lintingTools = {
|
|
|
69
73
|
{
|
|
70
74
|
id: 'precommit',
|
|
71
75
|
name: 'Pre-commit hooks',
|
|
72
|
-
description: 'Git hooks for code quality',
|
|
73
|
-
file: '.pre-commit
|
|
76
|
+
description: 'Git hooks for code quality (husky + lint-staged)',
|
|
77
|
+
file: '.husky/pre-commit',
|
|
74
78
|
recommended: true,
|
|
75
|
-
dependencies: [],
|
|
79
|
+
dependencies: ['husky@^9.1.7', 'lint-staged@^16.2.0'],
|
|
80
|
+
scripts: {
|
|
81
|
+
prepare: 'husky',
|
|
82
|
+
},
|
|
83
|
+
postInstall: 'npm install',
|
|
76
84
|
},
|
|
77
85
|
{
|
|
78
86
|
id: 'typescript-eslint',
|
|
@@ -29,9 +29,7 @@ const VARIABLE_RESOLVERS = {
|
|
|
29
29
|
PRIMARY_FRAMEWORK: (v) => toString(v.PRIMARY_FRAMEWORK || v.FRAMEWORK || v.framework) || 'Generic',
|
|
30
30
|
CURRENT_DATE: (v) => toString(v.CURRENT_DATE) || new Date().toISOString().split('T')[0],
|
|
31
31
|
PROJECT_VAR_NAME: (v) => resolveProjectVarName(v),
|
|
32
|
-
TRINITY_HOME: (v) => toString(v.TRINITY_HOME) ||
|
|
33
|
-
process.env.TRINITY_HOME ||
|
|
34
|
-
'C:/Users/lukaf/Desktop/Dev Work/trinity-method',
|
|
32
|
+
TRINITY_HOME: (v) => toString(v.TRINITY_HOME) || process.env.TRINITY_HOME || process.cwd(),
|
|
35
33
|
};
|
|
36
34
|
export function processTemplate(content, variables) {
|
|
37
35
|
let processed = content;
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
|
|
28
28
|
### AJ MAESTRO (Implementation Orchestrator)
|
|
29
29
|
**File:** [.claude/agents/leadership/aj-maestro.md](.claude/agents/leadership/aj-maestro.md)
|
|
30
|
-
**Role:** Implementation coordination using
|
|
30
|
+
**Role:** Implementation coordination using 18-agent team (organized in 5 role-based subdirectories)
|
|
31
31
|
**Specialization:** Planning layer, execution layer, support layer coordination
|
|
32
32
|
|
|
33
33
|
**Agent Organization:**
|
|
34
|
-
- **Leadership:** ALY, AJ MAESTRO
|
|
34
|
+
- **Leadership:** ALY, AJ MAESTRO (2 agents)
|
|
35
35
|
- **Deployment:** TAN, ZEN, INO, EIN (4 agents)
|
|
36
36
|
- **Planning:** MON, ROR, TRA, EUS (4 agents)
|
|
37
37
|
- **Implementation:** KIL, BAS, DRA, APO, BON, CAP, URO (7 agents)
|
|
@@ -49,13 +49,6 @@
|
|
|
49
49
|
|
|
50
50
|
---
|
|
51
51
|
|
|
52
|
-
### AJ CC (Code Coordinator)
|
|
53
|
-
**File:** [.claude/agents/leadership/aj-cc.md](.claude/agents/leadership/aj-cc.md)
|
|
54
|
-
**Role:** Code quality and implementation oversight
|
|
55
|
-
**Specialization:** Tactical implementation coordination
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
52
|
## 🚀 DEPLOYMENT TEAM (4 Specialists)
|
|
60
53
|
|
|
61
54
|
### TAN (Structure Specialist)
|
|
@@ -371,7 +364,7 @@ npx trinity-method-sdk deploy --skip-audit
|
|
|
371
364
|
- Reference: "Please review `.claude/agents/leadership/aly-cto.md` to investigate [feature name] and create work order"
|
|
372
365
|
|
|
373
366
|
**2. Implementation phase (AJ):**
|
|
374
|
-
- Reference: "Please review `.claude/agents/leadership/aj-
|
|
367
|
+
- Reference: "Please review `.claude/agents/leadership/aj-maestro.md` to implement work order WO-XXX-[feature-name]"
|
|
375
368
|
|
|
376
369
|
**3. Quality review (JUNO):**
|
|
377
370
|
- Reference: "Please review `.claude/agents/audit/juno-auditor.md` to review implementation of WO-XXX"
|
|
@@ -381,7 +374,7 @@ npx trinity-method-sdk deploy --skip-audit
|
|
|
381
374
|
- Reference: "Please review `.claude/agents/leadership/aly-cto.md` to investigate bug: [description]"
|
|
382
375
|
|
|
383
376
|
**2. Implement fix (AJ):**
|
|
384
|
-
- Reference: "Please review `.claude/agents/leadership/aj-
|
|
377
|
+
- Reference: "Please review `.claude/agents/leadership/aj-maestro.md` to fix bug per investigation findings"
|
|
385
378
|
|
|
386
379
|
### Documentation Updates
|
|
387
380
|
**Update architecture docs (ZEN):**
|
|
@@ -429,6 +422,7 @@ npx trinity-method-sdk deploy --ci-deploy
|
|
|
429
422
|
|------|-------|-------|---------------|
|
|
430
423
|
| **Scale Determination** | ALY | Leadership | N/A (always first) |
|
|
431
424
|
| **AI Orchestration** | AJ MAESTRO | Leadership | `/trinity-orchestrate` |
|
|
425
|
+
| **Guided Implementation** | AJ MAESTRO | Leadership | `/trinity-breakdown` |
|
|
432
426
|
| **Requirements** | MON | Planning | `/trinity-requirements` |
|
|
433
427
|
| **Technical Design** | ROR | Planning | `/trinity-design` |
|
|
434
428
|
| **Work Planning** | TRA | Planning | `/trinity-plan` |
|
|
@@ -457,14 +451,14 @@ npx trinity-method-sdk deploy --ci-deploy
|
|
|
457
451
|
## 📚 ADDITIONAL RESOURCES
|
|
458
452
|
|
|
459
453
|
### Trinity Method Documentation
|
|
460
|
-
- [Trinity Methodology](
|
|
461
|
-
- [Project Architecture](
|
|
462
|
-
- [Current Tasks](
|
|
463
|
-
- [Known Issues](
|
|
464
|
-
- [Technical Debt](
|
|
454
|
+
- [Trinity Methodology](trinity/knowledge-base/Trinity.md)
|
|
455
|
+
- [Project Architecture](trinity/knowledge-base/ARCHITECTURE.md)
|
|
456
|
+
- [Current Tasks](trinity/knowledge-base/To-do.md)
|
|
457
|
+
- [Known Issues](trinity/knowledge-base/ISSUES.md)
|
|
458
|
+
- [Technical Debt](trinity/knowledge-base/Technical-Debt.md)
|
|
465
459
|
|
|
466
460
|
### Work Order Templates
|
|
467
|
-
Located in
|
|
461
|
+
Located in `.claude/trinity/templates/work-orders/`:
|
|
468
462
|
- INVESTIGATION-TEMPLATE.md
|
|
469
463
|
- IMPLEMENTATION-TEMPLATE.md
|
|
470
464
|
- ANALYSIS-TEMPLATE.md
|
|
@@ -473,7 +467,7 @@ Located in `trinity/templates/work-orders/`:
|
|
|
473
467
|
- VERIFICATION-TEMPLATE.md
|
|
474
468
|
|
|
475
469
|
### Investigation Templates
|
|
476
|
-
Located in
|
|
470
|
+
Located in `.claude/trinity/templates/investigations/`:
|
|
477
471
|
- bug.md - Bug investigation with Five Whys analysis
|
|
478
472
|
- feature.md - Feature analysis with epic breakdown
|
|
479
473
|
- technical.md - Technical investigation with ADR format
|
|
@@ -531,13 +525,13 @@ pre-commit install
|
|
|
531
525
|
|
|
532
526
|
**Trinity Method Context Files**:
|
|
533
527
|
- [../CLAUDE.md](../CLAUDE.md) - Project overview and global requirements
|
|
534
|
-
- [
|
|
528
|
+
- [trinity/CLAUDE.md](trinity/CLAUDE.md) - Trinity Method enforcement and protocols
|
|
535
529
|
- [../src/CLAUDE.md](../src/CLAUDE.md) - Framework-specific implementation rules
|
|
536
530
|
|
|
537
531
|
**Knowledge Base**:
|
|
538
|
-
- [Investigation Protocols](
|
|
539
|
-
- [Quality Gates](
|
|
540
|
-
- [Crisis Management](
|
|
532
|
+
- [Investigation Protocols](trinity/CLAUDE.md#investigation-protocols) - Investigation-first methodology
|
|
533
|
+
- [Quality Gates](trinity/CLAUDE.md#quality-standards) - BAS 6-phase quality gates
|
|
534
|
+
- [Crisis Management](trinity/CLAUDE.md#crisis-management) - Emergency escalation protocols
|
|
541
535
|
|
|
542
536
|
---
|
|
543
537
|
|
|
@@ -27,7 +27,7 @@ You are primarily invoked via three focused documentation slash commands for tar
|
|
|
27
27
|
/trinity-readme # Ensure all directories with CLAUDE.md have README.md
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
**Deliverable:**
|
|
30
|
+
**Deliverable:** `.claude/trinity/reports/README-AUDIT-{date}.md`
|
|
31
31
|
|
|
32
32
|
**Process:** 7-phase README management with validation checkpoints
|
|
33
33
|
|
|
@@ -41,7 +41,7 @@ You are primarily invoked via three focused documentation slash commands for tar
|
|
|
41
41
|
/trinity-docs # Create/organize docs/ directory structure
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
**Deliverable:**
|
|
44
|
+
**Deliverable:** `.claude/trinity/reports/DOCS-ORGANIZATION-{date}.md`
|
|
45
45
|
|
|
46
46
|
**Process:** 4-phase docs/ organization (discovery, structure, navigation, report)
|
|
47
47
|
|
|
@@ -55,15 +55,15 @@ You are primarily invoked via three focused documentation slash commands for tar
|
|
|
55
55
|
/trinity-changelog # Ensure CHANGELOG.md exists and is compliant
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
**Deliverable:**
|
|
58
|
+
**Deliverable:** `.claude/trinity/reports/CHANGELOG-AUDIT-{date}.md`
|
|
59
59
|
|
|
60
60
|
**Process:** 3-phase CHANGELOG management (discovery, validation, compliance)
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
64
64
|
**README Templates Available:**
|
|
65
|
-
-
|
|
66
|
-
-
|
|
65
|
+
- `.claude/trinity/templates/documentation/ROOT-README.md`
|
|
66
|
+
- `.claude/trinity/templates/documentation/SUBDIRECTORY-README.md`
|
|
67
67
|
|
|
68
68
|
**Workflow Integration:**
|
|
69
69
|
```
|
|
@@ -92,8 +92,8 @@ You are **APO**, the Documentation Specialist for Trinity Method SDK v2.0. You m
|
|
|
92
92
|
|
|
93
93
|
Read these Trinity documents:
|
|
94
94
|
|
|
95
|
-
1.
|
|
96
|
-
2.
|
|
95
|
+
1. **.claude/trinity/knowledge-base/DOCUMENTATION-CRITERIA.md** - Documentation standards
|
|
96
|
+
2. **.claude/trinity/knowledge-base/CODING-PRINCIPLES.md** - Code documentation requirements
|
|
97
97
|
3. **docs/plans/design/DESIGN-{feature}.md** - Feature specifications for context
|
|
98
98
|
|
|
99
99
|
---
|