@vibe-validate/cli 0.9.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/dist/bin.d.ts +8 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +30 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/cleanup.d.ts +8 -0
- package/dist/commands/cleanup.d.ts.map +1 -0
- package/dist/commands/cleanup.js +97 -0
- package/dist/commands/cleanup.js.map +1 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +138 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +289 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/pre-commit.d.ts +9 -0
- package/dist/commands/pre-commit.d.ts.map +1 -0
- package/dist/commands/pre-commit.js +80 -0
- package/dist/commands/pre-commit.js.map +1 -0
- package/dist/commands/state.d.ts +8 -0
- package/dist/commands/state.d.ts.map +1 -0
- package/dist/commands/state.js +105 -0
- package/dist/commands/state.js.map +1 -0
- package/dist/commands/sync-check.d.ts +8 -0
- package/dist/commands/sync-check.d.ts.map +1 -0
- package/dist/commands/sync-check.js +78 -0
- package/dist/commands/sync-check.js.map +1 -0
- package/dist/commands/validate.d.ts +8 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +48 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/utils/config-loader.d.ts +36 -0
- package/dist/utils/config-loader.d.ts.map +1 -0
- package/dist/utils/config-loader.js +80 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/context-detector.d.ts +26 -0
- package/dist/utils/context-detector.d.ts.map +1 -0
- package/dist/utils/context-detector.js +80 -0
- package/dist/utils/context-detector.js.map +1 -0
- package/dist/utils/runner-adapter.d.ts +22 -0
- package/dist/utils/runner-adapter.d.ts.map +1 -0
- package/dist/utils/runner-adapter.js +99 -0
- package/dist/utils/runner-adapter.js.map +1 -0
- package/package.json +65 -0
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;GAIG"}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Vibe-Validate CLI Entry Point
|
|
4
|
+
*
|
|
5
|
+
* Main executable for the vibe-validate command-line tool.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import { validateCommand } from './commands/validate.js';
|
|
9
|
+
import { initCommand } from './commands/init.js';
|
|
10
|
+
import { preCommitCommand } from './commands/pre-commit.js';
|
|
11
|
+
import { stateCommand } from './commands/state.js';
|
|
12
|
+
import { syncCheckCommand } from './commands/sync-check.js';
|
|
13
|
+
import { cleanupCommand } from './commands/cleanup.js';
|
|
14
|
+
import { configCommand } from './commands/config.js';
|
|
15
|
+
const program = new Command();
|
|
16
|
+
program
|
|
17
|
+
.name('vibe-validate')
|
|
18
|
+
.description('Agent-friendly validation framework with git tree hash caching')
|
|
19
|
+
.version('0.1.0');
|
|
20
|
+
// Register commands
|
|
21
|
+
validateCommand(program); // vibe-validate validate
|
|
22
|
+
initCommand(program); // vibe-validate init
|
|
23
|
+
preCommitCommand(program); // vibe-validate pre-commit
|
|
24
|
+
stateCommand(program); // vibe-validate state
|
|
25
|
+
syncCheckCommand(program); // vibe-validate sync-check
|
|
26
|
+
cleanupCommand(program); // vibe-validate cleanup
|
|
27
|
+
configCommand(program); // vibe-validate config
|
|
28
|
+
// Parse command line arguments
|
|
29
|
+
program.parse();
|
|
30
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src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cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyCrD"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cleanup Command
|
|
3
|
+
*
|
|
4
|
+
* Post-merge branch cleanup - switches to main and deletes merged branches.
|
|
5
|
+
*/
|
|
6
|
+
import { cleanupMergedBranches } from '@vibe-validate/git';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
export function cleanupCommand(program) {
|
|
9
|
+
program
|
|
10
|
+
.command('cleanup')
|
|
11
|
+
.description('Post-merge cleanup (switch to main, delete merged branches)')
|
|
12
|
+
.option('--main-branch <branch>', 'Main branch name', 'main')
|
|
13
|
+
.option('--dry-run', 'Show what would be deleted without actually deleting')
|
|
14
|
+
.option('--format <format>', 'Output format (human|yaml|json)', 'human')
|
|
15
|
+
.action(async (options) => {
|
|
16
|
+
try {
|
|
17
|
+
// Run post-merge cleanup
|
|
18
|
+
const result = await cleanupMergedBranches({
|
|
19
|
+
mainBranch: options.mainBranch,
|
|
20
|
+
dryRun: options.dryRun,
|
|
21
|
+
});
|
|
22
|
+
// Output based on format
|
|
23
|
+
if (options.format === 'json') {
|
|
24
|
+
console.log(JSON.stringify(result, null, 2));
|
|
25
|
+
}
|
|
26
|
+
else if (options.format === 'yaml') {
|
|
27
|
+
console.log(`success: ${result.success}`);
|
|
28
|
+
console.log(`currentBranch: ${result.currentBranch}`);
|
|
29
|
+
console.log(`mainSynced: ${result.mainSynced}`);
|
|
30
|
+
console.log(`branchesDeleted:`);
|
|
31
|
+
result.branchesDeleted.forEach((branch) => {
|
|
32
|
+
console.log(` - ${branch}`);
|
|
33
|
+
});
|
|
34
|
+
if ('error' in result && result.error) {
|
|
35
|
+
console.log(`error: ${result.error}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// Human-friendly format
|
|
40
|
+
displayHumanCleanup(result, options.dryRun);
|
|
41
|
+
}
|
|
42
|
+
// Exit with error code if there was an error
|
|
43
|
+
process.exit(result.success ? 0 : 1);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error(chalk.red('❌ Cleanup failed with error:'), error);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Display cleanup results in human-friendly format
|
|
53
|
+
*/
|
|
54
|
+
function displayHumanCleanup(result, dryRun) {
|
|
55
|
+
if (dryRun) {
|
|
56
|
+
console.log(chalk.blue('🔍 Cleanup Preview (Dry Run)'));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
console.log(chalk.blue('🧹 Post-Merge Cleanup'));
|
|
60
|
+
}
|
|
61
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
62
|
+
// Current branch
|
|
63
|
+
if (result.currentBranch) {
|
|
64
|
+
const icon = dryRun ? '→' : '✅';
|
|
65
|
+
console.log(chalk.green(`${icon} Current branch: ${result.currentBranch}`));
|
|
66
|
+
}
|
|
67
|
+
// Synced with remote
|
|
68
|
+
if (result.mainSynced) {
|
|
69
|
+
const icon = dryRun ? '→' : '✅';
|
|
70
|
+
console.log(chalk.green(`${icon} Synced with remote`));
|
|
71
|
+
}
|
|
72
|
+
// Deleted branches
|
|
73
|
+
if (result.branchesDeleted.length > 0) {
|
|
74
|
+
const icon = dryRun ? '→' : '✅';
|
|
75
|
+
console.log(chalk.green(`\n${icon} Deleted branches:`));
|
|
76
|
+
result.branchesDeleted.forEach(branch => {
|
|
77
|
+
console.log(chalk.gray(` • ${branch}`));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
console.log(chalk.gray('\nℹ️ No merged branches to delete'));
|
|
82
|
+
}
|
|
83
|
+
// Error
|
|
84
|
+
if ('error' in result && result.error) {
|
|
85
|
+
console.log(chalk.red('\n❌ Error encountered:'));
|
|
86
|
+
console.log(chalk.red(` ${result.error}`));
|
|
87
|
+
}
|
|
88
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
89
|
+
if (dryRun) {
|
|
90
|
+
console.log(chalk.yellow('\n💡 This was a dry run. To actually clean up:'));
|
|
91
|
+
console.log(chalk.gray(' vibe-validate cleanup'));
|
|
92
|
+
}
|
|
93
|
+
else if (result.success && result.branchesDeleted.length > 0) {
|
|
94
|
+
console.log(chalk.green('\n✅ Cleanup complete!'));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=cleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../../src/commands/cleanup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,6DAA6D,CAAC;SAC1E,MAAM,CAAC,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,WAAW,EAAE,sDAAsD,CAAC;SAC3E,MAAM,CAAC,mBAAmB,EAAE,iCAAiC,EAAE,OAAO,CAAC;SACvE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,IAAI,CAAC;YACH,yBAAyB;YACzB,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC;gBACzC,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;YAEH,yBAAyB;YACzB,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAC9B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC/C,CAAC;iBAAM,IAAI,OAAO,CAAC,MA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,KAAK,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,QAAQ;IACR,IAAI,OAAO,IAAI,MAAM,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAExC,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,gDAAgD,CAAC,CAAC,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC;IACtD,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkDpD"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Command
|
|
3
|
+
*
|
|
4
|
+
* Show or validate vibe-validate configuration.
|
|
5
|
+
*/
|
|
6
|
+
import { loadConfig, findConfigPath } from '../utils/config-loader.js';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
export function configCommand(program) {
|
|
9
|
+
program
|
|
10
|
+
.command('config')
|
|
11
|
+
.description('Show or validate vibe-validate configuration')
|
|
12
|
+
.option('--validate', 'Validate configuration only (exit 0 if valid, 1 if invalid)')
|
|
13
|
+
.option('--format <format>', 'Output format (human|yaml|json)', 'human')
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
try {
|
|
16
|
+
// Find config file
|
|
17
|
+
const configPath = findConfigPath();
|
|
18
|
+
if (!configPath) {
|
|
19
|
+
console.error(chalk.red('❌ No configuration file found'));
|
|
20
|
+
console.error(chalk.gray(' Run: vibe-validate init'));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
// Load and validate config
|
|
24
|
+
const config = await loadConfig();
|
|
25
|
+
if (!config) {
|
|
26
|
+
console.error(chalk.red('❌ Configuration is invalid'));
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
// If validate-only mode, exit here
|
|
30
|
+
if (options.validate) {
|
|
31
|
+
console.log(chalk.green('✅ Configuration is valid'));
|
|
32
|
+
process.exit(0);
|
|
33
|
+
}
|
|
34
|
+
// Output based on format
|
|
35
|
+
if (options.format === 'json') {
|
|
36
|
+
console.log(JSON.stringify(config, null, 2));
|
|
37
|
+
}
|
|
38
|
+
else if (options.format === 'yaml') {
|
|
39
|
+
displayYamlConfig(config);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Human-friendly format
|
|
43
|
+
displayHumanConfig(config, configPath);
|
|
44
|
+
}
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.error(chalk.red('❌ Failed to load configuration:'), error instanceof Error ? error.message : error);
|
|
49
|
+
if (error instanceof Error && error.stack) {
|
|
50
|
+
console.error(chalk.gray('Stack trace:'));
|
|
51
|
+
console.error(chalk.gray(error.stack));
|
|
52
|
+
}
|
|
53
|
+
console.error(chalk.red('❌ Configuration is invalid'));
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Display configuration in human-friendly format
|
|
60
|
+
*/
|
|
61
|
+
function displayHumanConfig(config, configPath) {
|
|
62
|
+
console.log(chalk.blue('⚙️ Vibe-Validate Configuration'));
|
|
63
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
64
|
+
console.log(chalk.gray(`Config file: ${configPath}`));
|
|
65
|
+
console.log();
|
|
66
|
+
// Validation settings
|
|
67
|
+
if (config.validation) {
|
|
68
|
+
console.log(chalk.blue('Validation:'));
|
|
69
|
+
if (config.validation.phases) {
|
|
70
|
+
console.log(chalk.gray(` Phases: ${config.validation.phases.length}`));
|
|
71
|
+
config.validation.phases.forEach((phase, index) => {
|
|
72
|
+
const parallelIcon = phase.parallel ? '⚡' : '→';
|
|
73
|
+
console.log(chalk.gray(` ${index + 1}. ${parallelIcon} ${phase.name} (${phase.steps?.length || 0} steps)`));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (config.validation.caching) {
|
|
77
|
+
console.log(chalk.gray(` Caching: ${config.validation.caching.strategy} (${config.validation.caching.enabled ? 'enabled' : 'disabled'})`));
|
|
78
|
+
}
|
|
79
|
+
if (config.validation.failFast !== undefined) {
|
|
80
|
+
console.log(chalk.gray(` Fail Fast: ${config.validation.failFast ? 'enabled' : 'disabled'}`));
|
|
81
|
+
}
|
|
82
|
+
console.log();
|
|
83
|
+
}
|
|
84
|
+
// Git settings
|
|
85
|
+
if (config.git) {
|
|
86
|
+
console.log(chalk.blue('Git:'));
|
|
87
|
+
console.log(chalk.gray(` Main Branch: ${config.git.mainBranch || 'main'}`));
|
|
88
|
+
console.log(chalk.gray(` Auto Sync: ${config.git.autoSync ? 'enabled' : 'disabled'}`));
|
|
89
|
+
console.log();
|
|
90
|
+
}
|
|
91
|
+
// Output settings
|
|
92
|
+
if (config.output) {
|
|
93
|
+
console.log(chalk.blue('Output:'));
|
|
94
|
+
console.log(chalk.gray(` Format: ${config.output.format || 'auto'}`));
|
|
95
|
+
console.log();
|
|
96
|
+
}
|
|
97
|
+
// Preset info (if extended)
|
|
98
|
+
if (config.extends) {
|
|
99
|
+
console.log(chalk.blue('Extends:'));
|
|
100
|
+
console.log(chalk.gray(` Preset: ${config.extends}`));
|
|
101
|
+
console.log();
|
|
102
|
+
}
|
|
103
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
104
|
+
console.log(chalk.green('✅ Configuration is valid'));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Display configuration in YAML format (simplified)
|
|
108
|
+
*/
|
|
109
|
+
function displayYamlConfig(config) {
|
|
110
|
+
// Simple YAML-like output
|
|
111
|
+
console.log('validation:');
|
|
112
|
+
if (config.validation?.phases) {
|
|
113
|
+
console.log(' phases:');
|
|
114
|
+
config.validation.phases.forEach((phase) => {
|
|
115
|
+
console.log(` - name: ${phase.name}`);
|
|
116
|
+
console.log(` parallel: ${phase.parallel}`);
|
|
117
|
+
console.log(` steps: ${phase.steps?.length || 0}`);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (config.validation?.caching) {
|
|
121
|
+
console.log(' caching:');
|
|
122
|
+
console.log(` strategy: ${config.validation.caching.strategy}`);
|
|
123
|
+
console.log(` enabled: ${config.validation.caching.enabled}`);
|
|
124
|
+
}
|
|
125
|
+
if (config.validation?.failFast !== undefined) {
|
|
126
|
+
console.log(` failFast: ${config.validation.failFast}`);
|
|
127
|
+
}
|
|
128
|
+
if (config.git) {
|
|
129
|
+
console.log('git:');
|
|
130
|
+
console.log(` mainBranch: ${config.git.mainBranch || 'main'}`);
|
|
131
|
+
console.log(` autoSync: ${config.git.autoSync || false}`);
|
|
132
|
+
}
|
|
133
|
+
if (config.output) {
|
|
134
|
+
console.log('output:');
|
|
135
|
+
console.log(` format: ${config.output.format || 'auto'}`);
|
|
136
|
+
}
|
|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AAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,IAAI,MAAM,CAAC,UAAU,EAAE,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,iBAAiB,MAAM,CAAC,GAAG,CAAC,UAAU,IAAI,MAAM,EAAE,CAAC,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,EAAE,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmDlD"}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init Command
|
|
3
|
+
*
|
|
4
|
+
* Interactive setup wizard for vibe-validate configuration.
|
|
5
|
+
*/
|
|
6
|
+
import { writeFileSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import { configExists } from '../utils/config-loader.js';
|
|
10
|
+
export function initCommand(program) {
|
|
11
|
+
program
|
|
12
|
+
.command('init')
|
|
13
|
+
.description('Initialize vibe-validate configuration')
|
|
14
|
+
.option('-p, --preset <preset>', 'Use preset (typescript-library|typescript-nodejs|typescript-react)')
|
|
15
|
+
.option('-f, --force', 'Overwrite existing configuration')
|
|
16
|
+
.action(async (options) => {
|
|
17
|
+
try {
|
|
18
|
+
const cwd = process.cwd();
|
|
19
|
+
// Check if config already exists
|
|
20
|
+
if (configExists(cwd) && !options.force) {
|
|
21
|
+
console.error(chalk.red('❌ Configuration file already exists'));
|
|
22
|
+
console.error(chalk.gray(' Use --force to overwrite'));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const preset = options.preset || 'typescript-library';
|
|
26
|
+
// Validate preset
|
|
27
|
+
const validPresets = ['typescript-library', 'typescript-nodejs', 'typescript-react'];
|
|
28
|
+
if (!validPresets.includes(preset)) {
|
|
29
|
+
console.error(chalk.red(`❌ Invalid preset: ${preset}`));
|
|
30
|
+
console.error(chalk.gray(` Valid presets: ${validPresets.join(', ')}`));
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
// Generate config file content
|
|
34
|
+
const configContent = generateConfig(preset);
|
|
35
|
+
const configPath = join(cwd, 'vibe-validate.config.ts');
|
|
36
|
+
// Write config file
|
|
37
|
+
writeFileSync(configPath, configContent, 'utf-8');
|
|
38
|
+
console.log(chalk.green('✅ Configuration file created successfully'));
|
|
39
|
+
console.log(chalk.blue(`📋 Created: ${configPath}`));
|
|
40
|
+
console.log(chalk.gray(` Preset: ${preset}`));
|
|
41
|
+
console.log();
|
|
42
|
+
console.log(chalk.yellow('Next steps:'));
|
|
43
|
+
console.log(chalk.gray(' 1. Review and customize vibe-validate.config.ts'));
|
|
44
|
+
console.log(chalk.gray(' 2. Run: vibe-validate validate'));
|
|
45
|
+
console.log(chalk.gray(' 3. Add to package.json scripts:'));
|
|
46
|
+
console.log(chalk.gray(' "validate": "vibe-validate validate"'));
|
|
47
|
+
console.log(chalk.gray(' "pre-commit": "vibe-validate pre-commit"'));
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error(chalk.red('❌ Failed to initialize configuration:'), error);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Generate configuration content based on preset
|
|
58
|
+
*/
|
|
59
|
+
function generateConfig(preset) {
|
|
60
|
+
const configs = {
|
|
61
|
+
'typescript-library': `import { defineConfig } from '@vibe-validate/config';
|
|
62
|
+
|
|
63
|
+
export default defineConfig({
|
|
64
|
+
// Use TypeScript library preset as base
|
|
65
|
+
extends: 'typescript-library',
|
|
66
|
+
|
|
67
|
+
validation: {
|
|
68
|
+
phases: [
|
|
69
|
+
// Phase 1: Fast Pre-Qualification (parallel)
|
|
70
|
+
{
|
|
71
|
+
name: 'Pre-Qualification',
|
|
72
|
+
parallel: true,
|
|
73
|
+
steps: [
|
|
74
|
+
{
|
|
75
|
+
name: 'TypeScript Type Check',
|
|
76
|
+
command: 'tsc --noEmit',
|
|
77
|
+
description: 'Type-check TypeScript files',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'ESLint',
|
|
81
|
+
command: 'eslint src/',
|
|
82
|
+
description: 'Lint source code',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// Phase 2: Unit Tests
|
|
88
|
+
{
|
|
89
|
+
name: 'Testing',
|
|
90
|
+
parallel: false,
|
|
91
|
+
steps: [
|
|
92
|
+
{
|
|
93
|
+
name: 'Unit Tests',
|
|
94
|
+
command: 'npm test',
|
|
95
|
+
description: 'Run unit tests with coverage',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
// Phase 3: Build Verification
|
|
101
|
+
{
|
|
102
|
+
name: 'Build',
|
|
103
|
+
parallel: false,
|
|
104
|
+
steps: [
|
|
105
|
+
{
|
|
106
|
+
name: 'Build Package',
|
|
107
|
+
command: 'npm run build',
|
|
108
|
+
description: 'Build TypeScript to JavaScript',
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
|
|
114
|
+
// Use git tree hash caching for maximum performance
|
|
115
|
+
caching: {
|
|
116
|
+
strategy: 'git-tree-hash',
|
|
117
|
+
enabled: true,
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
// Fail fast on first error
|
|
121
|
+
failFast: true,
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
// Git integration settings
|
|
125
|
+
git: {
|
|
126
|
+
mainBranch: 'main',
|
|
127
|
+
autoSync: false, // Never auto-merge - safety first
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
// Output configuration
|
|
131
|
+
output: {
|
|
132
|
+
format: 'auto', // Auto-detect agent vs human context
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
`,
|
|
136
|
+
'typescript-nodejs': `import { defineConfig } from '@vibe-validate/config';
|
|
137
|
+
|
|
138
|
+
export default defineConfig({
|
|
139
|
+
// Use TypeScript Node.js preset as base
|
|
140
|
+
extends: 'typescript-nodejs',
|
|
141
|
+
|
|
142
|
+
validation: {
|
|
143
|
+
phases: [
|
|
144
|
+
// Phase 1: Fast Pre-Qualification (parallel)
|
|
145
|
+
{
|
|
146
|
+
name: 'Pre-Qualification',
|
|
147
|
+
parallel: true,
|
|
148
|
+
steps: [
|
|
149
|
+
{
|
|
150
|
+
name: 'TypeScript Type Check',
|
|
151
|
+
command: 'tsc --noEmit',
|
|
152
|
+
description: 'Type-check TypeScript files',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'ESLint',
|
|
156
|
+
command: 'eslint src/',
|
|
157
|
+
description: 'Lint source code',
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
// Phase 2: Unit Tests
|
|
163
|
+
{
|
|
164
|
+
name: 'Testing',
|
|
165
|
+
parallel: false,
|
|
166
|
+
steps: [
|
|
167
|
+
{
|
|
168
|
+
name: 'Unit Tests',
|
|
169
|
+
command: 'npm test',
|
|
170
|
+
description: 'Run unit tests with coverage',
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
// Phase 3: Build Verification
|
|
176
|
+
{
|
|
177
|
+
name: 'Build',
|
|
178
|
+
parallel: false,
|
|
179
|
+
steps: [
|
|
180
|
+
{
|
|
181
|
+
name: 'Build Application',
|
|
182
|
+
command: 'npm run build',
|
|
183
|
+
description: 'Build TypeScript to JavaScript',
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
|
|
189
|
+
// Use git tree hash caching for maximum performance
|
|
190
|
+
caching: {
|
|
191
|
+
strategy: 'git-tree-hash',
|
|
192
|
+
enabled: true,
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
// Fail fast on first error
|
|
196
|
+
failFast: true,
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
// Git integration settings
|
|
200
|
+
git: {
|
|
201
|
+
mainBranch: 'main',
|
|
202
|
+
autoSync: false, // Never auto-merge - safety first
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
// Output configuration
|
|
206
|
+
output: {
|
|
207
|
+
format: 'auto', // Auto-detect agent vs human context
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
`,
|
|
211
|
+
'typescript-react': `import { defineConfig } from '@vibe-validate/config';
|
|
212
|
+
|
|
213
|
+
export default defineConfig({
|
|
214
|
+
// Use TypeScript React preset as base
|
|
215
|
+
extends: 'typescript-react',
|
|
216
|
+
|
|
217
|
+
validation: {
|
|
218
|
+
phases: [
|
|
219
|
+
// Phase 1: Fast Pre-Qualification (parallel)
|
|
220
|
+
{
|
|
221
|
+
name: 'Pre-Qualification',
|
|
222
|
+
parallel: true,
|
|
223
|
+
steps: [
|
|
224
|
+
{
|
|
225
|
+
name: 'TypeScript Type Check',
|
|
226
|
+
command: 'tsc --noEmit',
|
|
227
|
+
description: 'Type-check TypeScript and React files',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'ESLint',
|
|
231
|
+
command: 'eslint src/',
|
|
232
|
+
description: 'Lint source code with React rules',
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
// Phase 2: Unit Tests
|
|
238
|
+
{
|
|
239
|
+
name: 'Testing',
|
|
240
|
+
parallel: false,
|
|
241
|
+
steps: [
|
|
242
|
+
{
|
|
243
|
+
name: 'Unit Tests',
|
|
244
|
+
command: 'npm test',
|
|
245
|
+
description: 'Run unit tests with coverage',
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
// Phase 3: Build Verification
|
|
251
|
+
{
|
|
252
|
+
name: 'Build',
|
|
253
|
+
parallel: false,
|
|
254
|
+
steps: [
|
|
255
|
+
{
|
|
256
|
+
name: 'Build Application',
|
|
257
|
+
command: 'npm run build',
|
|
258
|
+
description: 'Build React application for production',
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
|
|
264
|
+
// Use git tree hash caching for maximum performance
|
|
265
|
+
caching: {
|
|
266
|
+
strategy: 'git-tree-hash',
|
|
267
|
+
enabled: true,
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
// Fail fast on first error
|
|
271
|
+
failFast: true,
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
// Git integration settings
|
|
275
|
+
git: {
|
|
276
|
+
mainBranch: 'main',
|
|
277
|
+
autoSync: false, // Never auto-merge - safety first
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
// Output configuration
|
|
281
|
+
output: {
|
|
282
|
+
format: 'auto', // Auto-detect agent vs human context
|
|
283
|
+
},
|
|
284
|
+
});
|
|
285
|
+
`,
|
|
286
|
+
};
|
|
287
|
+
return configs[preset] || configs['typescript-library'];
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,wCAAwC,CAAC;SACrD,MAAM,CAAC,uBAAuB,EAAE,oEAAoE,CAAC;SACrG,MAAM,CAAC,aAAa,EAAE,kCAAkC,CAAC;SACzD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YAE1B,iCAAiC;YACjC,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACxC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC,CAAC;gBAChE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,CAAC;gBACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,oBAAoB,CAAC;YAEtD,kBAAkB;YAClB,MAAM,YAAY,GAAG,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;YACrF,IAAI,CAAC,YAA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,CAAC;YACrE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC,CAAC;YAEzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,uCAAuC,CAAC,EAAE,KAAK,CAAC,CAAC;YACzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,MAAc;IACpC,MAAM,OAAO,GAA2B;QACtC,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0EzB;QAEG,mBAAmB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0ExB;QAEG,kBAAkB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0EvB;KACE,CAAC;IAEF,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-Commit Command
|
|
3
|
+
*
|
|
4
|
+
* Runs branch sync check + validation before allowing commit.
|
|
5
|
+
* This is the recommended workflow before committing code.
|
|
6
|
+
*/
|
|
7
|
+
import type { Command } from 'commander';
|
|
8
|
+
export declare function preCommitCommand(program: Command): void;
|
|
9
|
+
//# sourceMappingURL=pre-commit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pre-commit.d.ts","sourceRoot":"","sources":["../../src/commands/pre-commit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyEvD"}
|