@vee-stack/delta-cli 2.0.4 ā 2.0.5
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/analyzer/commands/analyze.js +260 -0
- package/dist/analyzer/commands/config.js +83 -0
- package/dist/analyzer/commands/report.js +38 -0
- package/dist/analyzer/generators/report.generator.js +123 -0
- package/dist/analyzer/index.js +44 -0
- package/dist/analyzer/scanners/project.scanner.js +92 -0
- package/dist/analyzer/validators/contracts.validator.js +42 -0
- package/dist/analyzer/validators/maintainability.validator.js +40 -0
- package/dist/analyzer/validators/observability.validator.js +39 -0
- package/dist/analyzer/validators/performance.validator.js +42 -0
- package/dist/analyzer/validators/security.validator.js +66 -0
- package/dist/analyzer/validators/soc.validator.js +75 -0
- package/dist/apps/cli/src/analyzer/commands/analyze.js +256 -0
- package/dist/apps/cli/src/analyzer/commands/config.js +83 -0
- package/dist/apps/cli/src/analyzer/commands/report.js +38 -0
- package/dist/apps/cli/src/analyzer/generators/report.generator.js +123 -0
- package/dist/apps/cli/src/analyzer/index.js +44 -0
- package/dist/apps/cli/src/analyzer/scanners/project.scanner.js +92 -0
- package/dist/apps/cli/src/analyzer/validators/contracts.validator.js +42 -0
- package/dist/apps/cli/src/analyzer/validators/maintainability.validator.js +40 -0
- package/dist/apps/cli/src/analyzer/validators/observability.validator.js +39 -0
- package/dist/apps/cli/src/analyzer/validators/performance.validator.js +42 -0
- package/dist/apps/cli/src/analyzer/validators/security.validator.js +66 -0
- package/dist/apps/cli/src/analyzer/validators/soc.validator.js +75 -0
- package/dist/apps/cli/src/auth/secure-auth.js +312 -0
- package/dist/apps/cli/src/commands/analyze.js +286 -0
- package/dist/apps/cli/src/commands/auth-new.js +37 -0
- package/dist/apps/cli/src/commands/auth.js +122 -0
- package/dist/apps/cli/src/commands/config.js +49 -0
- package/dist/apps/cli/src/commands/deploy.js +6 -0
- package/dist/apps/cli/src/commands/init.js +47 -0
- package/dist/apps/cli/src/commands/logout.js +23 -0
- package/dist/apps/cli/src/commands/plugins.js +21 -0
- package/dist/apps/cli/src/commands/status.js +80 -0
- package/dist/apps/cli/src/commands/sync.js +6 -0
- package/dist/apps/cli/src/commands/whoami.js +115 -0
- package/dist/apps/cli/src/components/Dashboard.js +168 -0
- package/dist/apps/cli/src/components/DeltaApp.js +56 -0
- package/dist/apps/cli/src/components/UnifiedManager.js +324 -0
- package/dist/apps/cli/src/core/audit.js +184 -0
- package/dist/apps/cli/src/core/completion.js +294 -0
- package/dist/apps/cli/src/core/contracts.js +6 -0
- package/dist/apps/cli/src/core/engine.js +124 -0
- package/dist/apps/cli/src/core/exit-codes.js +71 -0
- package/dist/apps/cli/src/core/hooks.js +181 -0
- package/dist/apps/cli/src/core/index.js +7 -0
- package/dist/apps/cli/src/core/policy.js +115 -0
- package/dist/apps/cli/src/core/profiles.js +161 -0
- package/dist/apps/cli/src/core/wizard.js +203 -0
- package/dist/apps/cli/src/index.js +636 -0
- package/dist/apps/cli/src/interactive/index.js +11 -0
- package/dist/apps/cli/src/plugins/GitStatusPlugin.js +99 -0
- package/dist/apps/cli/src/providers/ai-provider.js +74 -0
- package/dist/apps/cli/src/providers/local-provider.js +302 -0
- package/dist/apps/cli/src/providers/remote-provider.js +100 -0
- package/dist/apps/cli/src/types/api.js +3 -0
- package/dist/apps/cli/src/ui.js +219 -0
- package/dist/apps/cli/src/welcome.js +81 -0
- package/dist/auth/secure-auth.js +418 -0
- package/dist/bundle.js +45 -45
- package/dist/commands/analyze.js +363 -0
- package/dist/commands/auth-new.js +37 -0
- package/dist/commands/auth.js +133 -0
- package/dist/commands/config.js +50 -0
- package/dist/commands/deploy.js +6 -0
- package/dist/commands/init.js +47 -0
- package/dist/commands/logout.js +30 -0
- package/dist/commands/plugins.js +21 -0
- package/dist/commands/status.js +82 -0
- package/dist/commands/sync.js +6 -0
- package/dist/commands/whoami.js +71 -0
- package/dist/components/Dashboard.js +169 -0
- package/dist/components/DeltaApp.js +57 -0
- package/dist/components/UnifiedManager.js +344 -0
- package/dist/core/audit.js +184 -0
- package/dist/core/completion.js +294 -0
- package/dist/core/contracts.js +6 -0
- package/dist/core/engine.js +124 -0
- package/dist/core/exit-codes.js +71 -0
- package/dist/core/hooks.js +181 -0
- package/dist/core/index.js +7 -0
- package/dist/core/policy.js +115 -0
- package/dist/core/profiles.js +161 -0
- package/dist/core/wizard.js +203 -0
- package/dist/index.js +387 -0
- package/dist/interactive/index.js +11 -0
- package/dist/packages/domain/src/constitution/contracts/index.js +43 -0
- package/dist/packages/domain/src/constitution/contracts/ts.rules.js +268 -0
- package/dist/packages/domain/src/constitution/index.js +139 -0
- package/dist/packages/domain/src/constitution/maintainability/index.js +43 -0
- package/dist/packages/domain/src/constitution/maintainability/ts.rules.js +344 -0
- package/dist/packages/domain/src/constitution/observability/index.js +43 -0
- package/dist/packages/domain/src/constitution/observability/ts.rules.js +307 -0
- package/dist/packages/domain/src/constitution/performance/index.js +43 -0
- package/dist/packages/domain/src/constitution/performance/ts.rules.js +325 -0
- package/dist/packages/domain/src/constitution/security/index.js +50 -0
- package/dist/packages/domain/src/constitution/security/ts.rules.js +267 -0
- package/dist/packages/domain/src/constitution/soc/index.js +43 -0
- package/dist/packages/domain/src/constitution/soc/ts.rules.js +360 -0
- package/dist/packages/domain/src/contracts/analysis.contract.js +18 -0
- package/dist/packages/domain/src/contracts/index.js +7 -0
- package/dist/packages/domain/src/contracts/projects.contract.js +18 -0
- package/dist/packages/domain/src/control/registry/rules.registry.js +29 -0
- package/dist/packages/domain/src/control/schemas/policies.js +6 -0
- package/dist/packages/domain/src/core/analysis/discovery.js +163 -0
- package/dist/packages/domain/src/core/analysis/engine.contract.js +298 -0
- package/dist/packages/domain/src/core/analysis/engine.js +77 -0
- package/dist/packages/domain/src/core/analysis/index.js +14 -0
- package/dist/packages/domain/src/core/analysis/orchestrator.js +242 -0
- package/dist/packages/domain/src/core/comparison/engine.js +29 -0
- package/dist/packages/domain/src/core/comparison/index.js +5 -0
- package/dist/packages/domain/src/core/documentation/index.js +5 -0
- package/dist/packages/domain/src/core/documentation/pipeline.js +41 -0
- package/dist/packages/domain/src/core/fs/adapter.js +111 -0
- package/dist/packages/domain/src/core/fs/index.js +5 -0
- package/dist/packages/domain/src/core/parser/unified-parser.js +166 -0
- package/dist/packages/domain/src/index.js +33 -0
- package/dist/packages/domain/src/plugin/registry.js +195 -0
- package/dist/packages/domain/src/plugin/types.js +6 -0
- package/dist/packages/domain/src/ports/analysis.engine.js +7 -0
- package/dist/packages/domain/src/ports/audit.logger.js +7 -0
- package/dist/packages/domain/src/ports/project.repository.js +7 -0
- package/dist/packages/domain/src/rules/index.js +134 -0
- package/dist/packages/domain/src/types/analysis.js +6 -0
- package/dist/packages/domain/src/types/errors.js +53 -0
- package/dist/packages/domain/src/types/fs.js +6 -0
- package/dist/packages/domain/src/types/index.js +7 -0
- package/dist/plugins/GitStatusPlugin.js +93 -0
- package/dist/providers/ai-provider.js +74 -0
- package/dist/providers/local-provider.js +304 -0
- package/dist/providers/remote-provider.js +100 -0
- package/dist/types/api.js +3 -0
- package/dist/ui.js +219 -0
- package/dist/welcome.js +81 -0
- package/package.json +18 -18
package/dist/index.js
ADDED
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import gradient from 'gradient-string';
|
|
4
|
+
import figlet from 'figlet';
|
|
5
|
+
import updateNotifier from 'update-notifier';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { readFileSync } from 'fs';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
import { dirname, join } from 'path';
|
|
10
|
+
// Core Engine Imports
|
|
11
|
+
import { createEngine } from './core/engine.js';
|
|
12
|
+
import { DefaultExecutionPolicy } from './core/policy.js';
|
|
13
|
+
import { LocalProvider } from './providers/local-provider.js';
|
|
14
|
+
import { RemoteProvider } from './providers/remote-provider.js';
|
|
15
|
+
import { AIProviderPlaceholder } from './providers/ai-provider.js';
|
|
16
|
+
import { installCompletion, generateCompletionScript } from './core/completion.js';
|
|
17
|
+
import { runInitWizard, executeWizardActions } from './core/wizard.js';
|
|
18
|
+
import { loadConfig } from './commands/auth.js';
|
|
19
|
+
import { SecureTokenStore } from './auth/secure-auth.js';
|
|
20
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
+
const __dirname = dirname(__filename);
|
|
22
|
+
// Read package.json for version info
|
|
23
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'));
|
|
24
|
+
// Check for updates
|
|
25
|
+
const notifier = updateNotifier({
|
|
26
|
+
pkg,
|
|
27
|
+
updateCheckInterval: 1000 * 60 * 60 // 1 hour
|
|
28
|
+
});
|
|
29
|
+
// Define gradient themes
|
|
30
|
+
export const gradients = {
|
|
31
|
+
delta: gradient(['#00d4ff', '#7b2cbf', '#ff006e']),
|
|
32
|
+
cyber: gradient(['#00f5ff', '#0080ff', '#8000ff']),
|
|
33
|
+
sunset: gradient(['#ff4e50', '#fca311', '#e85d04']),
|
|
34
|
+
neon: gradient(['#39ff14', '#00ffff', '#ff00ff']),
|
|
35
|
+
ocean: gradient(['#0066ff', '#00ccff', '#66ffff']),
|
|
36
|
+
fire: gradient(['#ff4e00', '#ff9500', '#ffcc00']),
|
|
37
|
+
};
|
|
38
|
+
// Print animated logo
|
|
39
|
+
export function printLogo(variant = 'delta') {
|
|
40
|
+
const text = figlet.textSync('DELTA', {
|
|
41
|
+
font: 'Big Money-nw',
|
|
42
|
+
horizontalLayout: 'default',
|
|
43
|
+
verticalLayout: 'default',
|
|
44
|
+
});
|
|
45
|
+
console.log('\n' + gradients[variant](text) + '\n');
|
|
46
|
+
}
|
|
47
|
+
// Print minimal logo
|
|
48
|
+
export function printMinimalLogo() {
|
|
49
|
+
const text = figlet.textSync('Ī', {
|
|
50
|
+
font: 'ANSI Shadow',
|
|
51
|
+
horizontalLayout: 'default',
|
|
52
|
+
});
|
|
53
|
+
console.log(gradients.delta(text));
|
|
54
|
+
}
|
|
55
|
+
// Print welcome screen
|
|
56
|
+
export function printWelcome() {
|
|
57
|
+
console.clear();
|
|
58
|
+
printLogo();
|
|
59
|
+
console.log(chalk.dim(' āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
60
|
+
console.log();
|
|
61
|
+
console.log(chalk.white.bold(' š Delta CLI v2.0') + chalk.gray(' ā Next-gen code analysis & documentation'));
|
|
62
|
+
console.log();
|
|
63
|
+
console.log(chalk.gray(' Local-first architecture with ') + chalk.cyan('cloud power') + chalk.gray(' & ') + chalk.magenta('AI intelligence'));
|
|
64
|
+
console.log();
|
|
65
|
+
console.log(chalk.dim(' āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā'));
|
|
66
|
+
console.log();
|
|
67
|
+
// Update notification
|
|
68
|
+
if (notifier.update) {
|
|
69
|
+
console.log(chalk.yellow.bold(' ā” Update Available!'));
|
|
70
|
+
console.log(chalk.gray(` ${notifier.update.current} ā ${notifier.update.latest}`));
|
|
71
|
+
console.log(chalk.cyan(` Run: npm install -g ${pkg.name}`));
|
|
72
|
+
console.log();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Print tips
|
|
76
|
+
export function printTips() {
|
|
77
|
+
const tips = [
|
|
78
|
+
{ cmd: 'delta /help', desc: 'Quick help with slash commands' },
|
|
79
|
+
{ cmd: 'delta /analyze', desc: 'Run analysis with / command' },
|
|
80
|
+
{ cmd: 'delta /status', desc: 'Check project status' },
|
|
81
|
+
{ cmd: 'delta --interactive', desc: 'Open interactive dashboard' },
|
|
82
|
+
];
|
|
83
|
+
console.log(chalk.bold.cyan(' Quick Start (Slash Commands Available):'));
|
|
84
|
+
console.log();
|
|
85
|
+
tips.forEach(({ cmd, desc }) => {
|
|
86
|
+
console.log(chalk.gray(' ⢠') + chalk.cyan(cmd) + chalk.gray(` ā ${desc}`));
|
|
87
|
+
});
|
|
88
|
+
console.log();
|
|
89
|
+
console.log(chalk.dim(' Try ') + chalk.cyan('/help') + chalk.dim(', ') + chalk.cyan('/analyze') + chalk.dim(', ') + chalk.cyan('/status') + chalk.dim(' for quick access'));
|
|
90
|
+
console.log(chalk.dim(' Press ') + chalk.bold('Ctrl+T') + chalk.dim(' for variants ⢠') + chalk.bold('Tab') + chalk.dim(' for agents ⢠') + chalk.bold('Ctrl+P') + chalk.dim(' for commands'));
|
|
91
|
+
console.log();
|
|
92
|
+
}
|
|
93
|
+
// Initialize Core Engine
|
|
94
|
+
let engine = null;
|
|
95
|
+
async function initializeEngine() {
|
|
96
|
+
if (engine)
|
|
97
|
+
return engine;
|
|
98
|
+
const auth = await loadConfig();
|
|
99
|
+
const hasPat = await SecureTokenStore.hasTokens();
|
|
100
|
+
const config = {
|
|
101
|
+
defaultProvider: 'local',
|
|
102
|
+
providers: {
|
|
103
|
+
local: {
|
|
104
|
+
enabled: true,
|
|
105
|
+
maxFileSize: 10 * 1024 * 1024, // 10MB
|
|
106
|
+
excludePatterns: ['node_modules', 'dist', '.git', 'coverage'],
|
|
107
|
+
},
|
|
108
|
+
remote: {
|
|
109
|
+
enabled: hasPat,
|
|
110
|
+
apiUrl: auth.apiUrl || 'http://localhost:3000',
|
|
111
|
+
timeout: 30000,
|
|
112
|
+
retryAttempts: 3,
|
|
113
|
+
},
|
|
114
|
+
ai: {
|
|
115
|
+
enabled: false, // Reserved for future
|
|
116
|
+
provider: 'openai',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
features: {
|
|
120
|
+
cache: true,
|
|
121
|
+
offlineMode: !hasPat,
|
|
122
|
+
autoUpdate: true,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
const policy = new DefaultExecutionPolicy(config);
|
|
126
|
+
engine = createEngine(config, policy);
|
|
127
|
+
// Register providers
|
|
128
|
+
engine.registerProvider(new LocalProvider(config.providers.local));
|
|
129
|
+
if (config.providers.remote.enabled) {
|
|
130
|
+
engine.registerProvider(new RemoteProvider(config.providers.remote));
|
|
131
|
+
}
|
|
132
|
+
engine.registerProvider(new AIProviderPlaceholder(config.providers.ai));
|
|
133
|
+
return engine;
|
|
134
|
+
}
|
|
135
|
+
// JSON Output Helper
|
|
136
|
+
function outputJSON(response) {
|
|
137
|
+
console.log(JSON.stringify(response, null, 2));
|
|
138
|
+
}
|
|
139
|
+
// Non-TTY Detection
|
|
140
|
+
function isNonTTY() {
|
|
141
|
+
return !process.stdout.isTTY || process.env.CI === 'true' || process.env.NO_COLOR === 'true';
|
|
142
|
+
}
|
|
143
|
+
// CLI Program Setup
|
|
144
|
+
const program = new Command();
|
|
145
|
+
program
|
|
146
|
+
.name('delta')
|
|
147
|
+
.description('Delta Platform - Next-gen code analysis and documentation')
|
|
148
|
+
.version(pkg.version, '-v, --version', 'Display version number')
|
|
149
|
+
.usage('<command> [options]')
|
|
150
|
+
.helpOption('-h, --help', 'Display help for command')
|
|
151
|
+
.addHelpCommand('help [command]', 'Display help for command');
|
|
152
|
+
// Global options - Simplified (no --interactive)
|
|
153
|
+
program
|
|
154
|
+
.option('--no-color', 'Disable colored output', false)
|
|
155
|
+
.option('--verbose', 'Enable verbose logging', false);
|
|
156
|
+
// Auth commands
|
|
157
|
+
program
|
|
158
|
+
.command('login')
|
|
159
|
+
.description('š Authenticate with Delta cloud (OAuth2 + secure keychain storage)')
|
|
160
|
+
.option('--method <type>', 'Auth method: oauth, pat, github, google', 'oauth')
|
|
161
|
+
.option('--token <token>', 'Personal Access Token (for CI/CD)')
|
|
162
|
+
.action(async (options) => {
|
|
163
|
+
printWelcome();
|
|
164
|
+
const { loginCommand } = await import('./commands/auth.js');
|
|
165
|
+
await loginCommand(options);
|
|
166
|
+
});
|
|
167
|
+
program
|
|
168
|
+
.command('logout')
|
|
169
|
+
.description('š Remove stored authentication and clear credentials')
|
|
170
|
+
.action(async () => {
|
|
171
|
+
const { logoutCommand } = await import('./commands/logout.js');
|
|
172
|
+
await logoutCommand();
|
|
173
|
+
});
|
|
174
|
+
program
|
|
175
|
+
.command('whoami')
|
|
176
|
+
.alias('me')
|
|
177
|
+
.description('š¤ Show current user, plan, quota, and session info')
|
|
178
|
+
.option('--format <type>', 'Output format: table, json, compact', 'table')
|
|
179
|
+
.action(async (options) => {
|
|
180
|
+
const { whoamiCommand } = await import('./commands/whoami.js');
|
|
181
|
+
await whoamiCommand(options);
|
|
182
|
+
});
|
|
183
|
+
// Main commands - Simplified CLI (no TUI)
|
|
184
|
+
program
|
|
185
|
+
.command('analyze [path]')
|
|
186
|
+
.alias('a')
|
|
187
|
+
.description('š Run code analysis and optionally upload to cloud')
|
|
188
|
+
.option('-f, --format <type>', 'Output format: json, html, markdown', 'json')
|
|
189
|
+
.option('-o, --output <dir>', 'Output directory', './delta-reports')
|
|
190
|
+
.option('-i, --include <patterns...>', 'Include file patterns')
|
|
191
|
+
.option('-e, --exclude <patterns...>', 'Exclude file patterns')
|
|
192
|
+
.option('--max-size <bytes>', 'Max file size', '10485760')
|
|
193
|
+
.option('--upload', 'Upload report to Delta cloud', false)
|
|
194
|
+
.option('--project-name <name>', 'Project name for the report')
|
|
195
|
+
.option('--json', 'Output results as JSON', false)
|
|
196
|
+
.action(async (path, options) => {
|
|
197
|
+
const { analyzeCommand } = await import('./commands/analyze.js');
|
|
198
|
+
await analyzeCommand(path || '.', {
|
|
199
|
+
format: options.format,
|
|
200
|
+
output: options.output,
|
|
201
|
+
include: options.include?.join(','),
|
|
202
|
+
exclude: options.exclude?.join(','),
|
|
203
|
+
maxSize: options.maxSize,
|
|
204
|
+
upload: options.upload,
|
|
205
|
+
projectName: options.projectName,
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
program
|
|
209
|
+
.command('init [path]')
|
|
210
|
+
.description('š Initialize a new Delta project with wizard')
|
|
211
|
+
.option('-t, --template <name>', 'Project template: default, nextjs, react, node, python', 'default')
|
|
212
|
+
.option('-f, --force', 'Overwrite existing config', false)
|
|
213
|
+
.option('--git', 'Initialize git repository', false)
|
|
214
|
+
.option('--json', 'Output results as JSON', false)
|
|
215
|
+
.option('--provider <name>', 'Execution provider: local, remote', 'local')
|
|
216
|
+
.option('-w, --wizard', 'Run interactive wizard', false)
|
|
217
|
+
.action(async (path, options) => {
|
|
218
|
+
// Run wizard if requested or no path provided
|
|
219
|
+
if (options.wizard || !path) {
|
|
220
|
+
const wizardResult = await runInitWizard();
|
|
221
|
+
await executeWizardActions(wizardResult);
|
|
222
|
+
// Then run engine init with wizard results
|
|
223
|
+
const engine = await initializeEngine();
|
|
224
|
+
const response = await engine.execute({
|
|
225
|
+
type: 'init',
|
|
226
|
+
command: 'init',
|
|
227
|
+
payload: {
|
|
228
|
+
projectPath: wizardResult.projectPath,
|
|
229
|
+
template: wizardResult.template,
|
|
230
|
+
force: options.force,
|
|
231
|
+
git: wizardResult.initializeGit,
|
|
232
|
+
},
|
|
233
|
+
options: {
|
|
234
|
+
json: options.json || isNonTTY(),
|
|
235
|
+
provider: options.provider,
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
if (options.json || isNonTTY()) {
|
|
239
|
+
outputJSON(response);
|
|
240
|
+
}
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
// Standard init flow
|
|
244
|
+
const engine = await initializeEngine();
|
|
245
|
+
const projectPath = path || '.';
|
|
246
|
+
const response = await engine.execute({
|
|
247
|
+
type: 'init',
|
|
248
|
+
command: 'init',
|
|
249
|
+
payload: {
|
|
250
|
+
projectPath,
|
|
251
|
+
template: options.template,
|
|
252
|
+
force: options.force,
|
|
253
|
+
git: options.git,
|
|
254
|
+
},
|
|
255
|
+
options: {
|
|
256
|
+
json: options.json || isNonTTY(),
|
|
257
|
+
provider: options.provider,
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
if (options.json || isNonTTY()) {
|
|
261
|
+
outputJSON(response);
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
printWelcome();
|
|
265
|
+
if (response.success) {
|
|
266
|
+
console.log('\nš Project initialized');
|
|
267
|
+
console.log(` Path: ${response.data?.projectPath}`);
|
|
268
|
+
console.log(` Config: ${response.data?.configPath}`);
|
|
269
|
+
console.log(` Template: ${response.data?.template}`);
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
console.error('\nā Init failed:', response.error?.message);
|
|
273
|
+
process.exit(1);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
program
|
|
278
|
+
.command('config')
|
|
279
|
+
.description('āļø Manage CLI configuration with schema validation')
|
|
280
|
+
.option('-g, --get <key>', 'Get config value')
|
|
281
|
+
.option('-s, --set <key=value>', 'Set config value')
|
|
282
|
+
.option('-l, --list', 'List all config')
|
|
283
|
+
.option('--reset', 'Reset to default configuration')
|
|
284
|
+
.action(async (options) => {
|
|
285
|
+
const { configCommand } = await import('./commands/config.js');
|
|
286
|
+
await configCommand(options);
|
|
287
|
+
});
|
|
288
|
+
program
|
|
289
|
+
.command('status [path]')
|
|
290
|
+
.alias('st')
|
|
291
|
+
.description('š Check project health, connection status, and diagnostics')
|
|
292
|
+
.option('--diagnostics', 'Run full diagnostics', false)
|
|
293
|
+
.option('--fix', 'Auto-fix issues where possible', false)
|
|
294
|
+
.option('--json', 'Output results as JSON', false)
|
|
295
|
+
.action(async (path, options) => {
|
|
296
|
+
const engine = await initializeEngine();
|
|
297
|
+
const projectPath = path || '.';
|
|
298
|
+
const response = await engine.execute({
|
|
299
|
+
type: 'status',
|
|
300
|
+
command: 'status',
|
|
301
|
+
payload: {
|
|
302
|
+
projectPath,
|
|
303
|
+
diagnostics: options.diagnostics,
|
|
304
|
+
fix: options.fix,
|
|
305
|
+
},
|
|
306
|
+
options: {
|
|
307
|
+
json: options.json || isNonTTY(),
|
|
308
|
+
},
|
|
309
|
+
});
|
|
310
|
+
if (options.json || isNonTTY()) {
|
|
311
|
+
outputJSON(response);
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
if (response.success) {
|
|
315
|
+
const data = response.data;
|
|
316
|
+
console.log('\nš Project Status');
|
|
317
|
+
console.log(` Path: ${data?.project?.path || 'N/A'}`);
|
|
318
|
+
console.log(` Config: ${data?.project?.hasConfig ? 'ā
' : 'ā'}`);
|
|
319
|
+
console.log(` Auth: ${data?.auth?.authenticated ? 'ā
' : 'ā'}`);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
console.error('\nā Status check failed:', response.error?.message);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
program
|
|
327
|
+
.command('completion [shell]')
|
|
328
|
+
.description('š§ Generate shell completion script')
|
|
329
|
+
.option('--install', 'Install completion for current shell', false)
|
|
330
|
+
.action(async (shell, options) => {
|
|
331
|
+
const targetShell = shell || 'bash';
|
|
332
|
+
if (options.install) {
|
|
333
|
+
await installCompletion(targetShell);
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
console.log(generateCompletionScript(targetShell));
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
// Parse arguments
|
|
340
|
+
const args = process.argv.slice(2);
|
|
341
|
+
// Handle slash commands (simplified)
|
|
342
|
+
const slashCommandMap = {
|
|
343
|
+
'/help': 'help',
|
|
344
|
+
'/h': 'help',
|
|
345
|
+
'/analyze': 'analyze',
|
|
346
|
+
'/a': 'analyze',
|
|
347
|
+
'/status': 'status',
|
|
348
|
+
'/st': 'status',
|
|
349
|
+
'/init': 'init',
|
|
350
|
+
'/i': 'init',
|
|
351
|
+
'/login': 'login',
|
|
352
|
+
'/logout': 'logout',
|
|
353
|
+
'/whoami': 'whoami',
|
|
354
|
+
'/me': 'whoami',
|
|
355
|
+
'/config': 'config',
|
|
356
|
+
'/version': '--version',
|
|
357
|
+
'/v': '--version',
|
|
358
|
+
};
|
|
359
|
+
// Convert slash commands to regular commands
|
|
360
|
+
if (args.length > 0 && args[0].startsWith('/')) {
|
|
361
|
+
const slashCmd = args[0].toLowerCase();
|
|
362
|
+
const mappedCmd = slashCommandMap[slashCmd];
|
|
363
|
+
if (mappedCmd) {
|
|
364
|
+
if (mappedCmd.startsWith('--')) {
|
|
365
|
+
// It's a flag like --version
|
|
366
|
+
args[0] = mappedCmd;
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
// It's a command
|
|
370
|
+
args[0] = mappedCmd;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
// Unknown slash command
|
|
375
|
+
console.error(chalk.red(`ā Unknown command: ${slashCmd}`));
|
|
376
|
+
console.log(chalk.gray('Run /help to see available commands'));
|
|
377
|
+
process.exit(1);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
program.parse(['node', 'delta', ...args]);
|
|
381
|
+
// If no command provided, show welcome and help
|
|
382
|
+
if (process.argv.length <= 2) {
|
|
383
|
+
printWelcome();
|
|
384
|
+
printTips();
|
|
385
|
+
program.help();
|
|
386
|
+
}
|
|
387
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from 'ink';
|
|
3
|
+
import { DeltaApp } from '../components/DeltaApp.js';
|
|
4
|
+
import { UnifiedManager } from '../components/UnifiedManager.js';
|
|
5
|
+
export async function runInteractiveMode(options) {
|
|
6
|
+
// Render the React Ink app
|
|
7
|
+
const Component = options.mode === 'manager' ? UnifiedManager : DeltaApp;
|
|
8
|
+
const { waitUntilExit } = render(_jsx(Component, {}));
|
|
9
|
+
await waitUntilExit();
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delta Constitution - Contracts Rules Index
|
|
3
|
+
* @description Contract rules for all supported languages
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
// TypeScript / Node.js Rules
|
|
7
|
+
export { default as ts, ContractsRules as TSContractsRules } from './ts.rules';
|
|
8
|
+
// Language-agnostic exports
|
|
9
|
+
export const ContractsAxis = {
|
|
10
|
+
name: 'Contracts',
|
|
11
|
+
description: 'Type-safe, versioned interfaces between layers',
|
|
12
|
+
weight: 15,
|
|
13
|
+
languages: ['typescript', 'javascript', 'node'],
|
|
14
|
+
principles: [
|
|
15
|
+
{
|
|
16
|
+
id: 'CONTRACT-001',
|
|
17
|
+
name: 'One Contract Per Module',
|
|
18
|
+
description: 'Every module must export a corresponding contract',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'CONTRACT-002',
|
|
22
|
+
name: 'Features Use Contracts Only',
|
|
23
|
+
description: 'Features can only import from Contracts, not Modules directly',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'CONTRACT-003',
|
|
27
|
+
name: 'Semantic Versioning',
|
|
28
|
+
description: 'Contracts follow semver: major.breaking, minor.feature, patch.fix',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'CONTRACT-004',
|
|
32
|
+
name: 'Interface Design',
|
|
33
|
+
description: 'Clear naming, required/optional fields, documentation',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'CONTRACT-005',
|
|
37
|
+
name: 'Validation',
|
|
38
|
+
description: 'Runtime validation with Zod schemas',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
export default ContractsAxis;
|
|
43
|
+
//# sourceMappingURL=index.js.map
|