@vee-stack/delta-cli 2.0.8 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/adapters/analysis.adapter.js +42 -0
  2. package/dist/analyzer/commands/analyze.js +74 -114
  3. package/dist/auth/device-auth.js +261 -0
  4. package/dist/auth/secure-auth.js +45 -16
  5. package/dist/commands/analyze.js +30 -27
  6. package/dist/commands/auth.js +13 -16
  7. package/dist/commands/status.js +2 -2
  8. package/dist/commands/whoami.js +6 -6
  9. package/dist/components/Dashboard.js +3 -5
  10. package/dist/components/DeltaApp.js +1 -1
  11. package/dist/components/UnifiedManager.js +48 -20
  12. package/dist/core/completion.js +14 -3
  13. package/dist/core/engine.js +10 -4
  14. package/dist/core/exit-codes.js +12 -4
  15. package/dist/core/wizard.js +1 -1
  16. package/dist/index.js +21 -5
  17. package/dist/providers/remote-provider.js +2 -2
  18. package/dist/telemetry/wrapper.js +114 -0
  19. package/dist/ui.js +9 -2
  20. package/dist/welcome.js +14 -4
  21. package/package.json +3 -1
  22. package/dist/apps/cli/src/analyzer/commands/analyze.js +0 -256
  23. package/dist/apps/cli/src/analyzer/commands/config.js +0 -83
  24. package/dist/apps/cli/src/analyzer/commands/report.js +0 -38
  25. package/dist/apps/cli/src/analyzer/generators/report.generator.js +0 -123
  26. package/dist/apps/cli/src/analyzer/index.js +0 -44
  27. package/dist/apps/cli/src/analyzer/scanners/project.scanner.js +0 -92
  28. package/dist/apps/cli/src/analyzer/validators/contracts.validator.js +0 -42
  29. package/dist/apps/cli/src/analyzer/validators/maintainability.validator.js +0 -40
  30. package/dist/apps/cli/src/analyzer/validators/observability.validator.js +0 -39
  31. package/dist/apps/cli/src/analyzer/validators/performance.validator.js +0 -42
  32. package/dist/apps/cli/src/analyzer/validators/security.validator.js +0 -66
  33. package/dist/apps/cli/src/analyzer/validators/soc.validator.js +0 -75
  34. package/dist/apps/cli/src/auth/secure-auth.js +0 -312
  35. package/dist/apps/cli/src/commands/analyze.js +0 -286
  36. package/dist/apps/cli/src/commands/auth-new.js +0 -37
  37. package/dist/apps/cli/src/commands/auth.js +0 -122
  38. package/dist/apps/cli/src/commands/config.js +0 -49
  39. package/dist/apps/cli/src/commands/deploy.js +0 -6
  40. package/dist/apps/cli/src/commands/init.js +0 -47
  41. package/dist/apps/cli/src/commands/logout.js +0 -23
  42. package/dist/apps/cli/src/commands/plugins.js +0 -21
  43. package/dist/apps/cli/src/commands/status.js +0 -80
  44. package/dist/apps/cli/src/commands/sync.js +0 -6
  45. package/dist/apps/cli/src/commands/whoami.js +0 -115
  46. package/dist/apps/cli/src/components/Dashboard.js +0 -168
  47. package/dist/apps/cli/src/components/DeltaApp.js +0 -56
  48. package/dist/apps/cli/src/components/UnifiedManager.js +0 -324
  49. package/dist/apps/cli/src/core/audit.js +0 -184
  50. package/dist/apps/cli/src/core/completion.js +0 -294
  51. package/dist/apps/cli/src/core/contracts.js +0 -6
  52. package/dist/apps/cli/src/core/engine.js +0 -124
  53. package/dist/apps/cli/src/core/exit-codes.js +0 -71
  54. package/dist/apps/cli/src/core/hooks.js +0 -181
  55. package/dist/apps/cli/src/core/index.js +0 -7
  56. package/dist/apps/cli/src/core/policy.js +0 -115
  57. package/dist/apps/cli/src/core/profiles.js +0 -161
  58. package/dist/apps/cli/src/core/wizard.js +0 -203
  59. package/dist/apps/cli/src/index.js +0 -636
  60. package/dist/apps/cli/src/interactive/index.js +0 -11
  61. package/dist/apps/cli/src/plugins/GitStatusPlugin.js +0 -99
  62. package/dist/apps/cli/src/providers/ai-provider.js +0 -74
  63. package/dist/apps/cli/src/providers/local-provider.js +0 -302
  64. package/dist/apps/cli/src/providers/remote-provider.js +0 -100
  65. package/dist/apps/cli/src/types/api.js +0 -3
  66. package/dist/apps/cli/src/ui.js +0 -219
  67. package/dist/apps/cli/src/welcome.js +0 -81
  68. package/dist/bundle.js +0 -504
  69. package/dist/packages/domain/src/constitution/contracts/index.js +0 -43
  70. package/dist/packages/domain/src/constitution/contracts/ts.rules.js +0 -268
  71. package/dist/packages/domain/src/constitution/index.js +0 -139
  72. package/dist/packages/domain/src/constitution/maintainability/index.js +0 -43
  73. package/dist/packages/domain/src/constitution/maintainability/ts.rules.js +0 -344
  74. package/dist/packages/domain/src/constitution/observability/index.js +0 -43
  75. package/dist/packages/domain/src/constitution/observability/ts.rules.js +0 -307
  76. package/dist/packages/domain/src/constitution/performance/index.js +0 -43
  77. package/dist/packages/domain/src/constitution/performance/ts.rules.js +0 -325
  78. package/dist/packages/domain/src/constitution/security/index.js +0 -50
  79. package/dist/packages/domain/src/constitution/security/ts.rules.js +0 -267
  80. package/dist/packages/domain/src/constitution/soc/index.js +0 -43
  81. package/dist/packages/domain/src/constitution/soc/ts.rules.js +0 -360
  82. package/dist/packages/domain/src/contracts/analysis.contract.js +0 -18
  83. package/dist/packages/domain/src/contracts/index.js +0 -7
  84. package/dist/packages/domain/src/contracts/projects.contract.js +0 -18
  85. package/dist/packages/domain/src/control/registry/rules.registry.js +0 -29
  86. package/dist/packages/domain/src/control/schemas/policies.js +0 -6
  87. package/dist/packages/domain/src/core/analysis/discovery.js +0 -163
  88. package/dist/packages/domain/src/core/analysis/engine.contract.js +0 -298
  89. package/dist/packages/domain/src/core/analysis/engine.js +0 -77
  90. package/dist/packages/domain/src/core/analysis/index.js +0 -14
  91. package/dist/packages/domain/src/core/analysis/orchestrator.js +0 -242
  92. package/dist/packages/domain/src/core/comparison/engine.js +0 -29
  93. package/dist/packages/domain/src/core/comparison/index.js +0 -5
  94. package/dist/packages/domain/src/core/documentation/index.js +0 -5
  95. package/dist/packages/domain/src/core/documentation/pipeline.js +0 -41
  96. package/dist/packages/domain/src/core/fs/adapter.js +0 -111
  97. package/dist/packages/domain/src/core/fs/index.js +0 -5
  98. package/dist/packages/domain/src/core/parser/unified-parser.js +0 -166
  99. package/dist/packages/domain/src/index.js +0 -33
  100. package/dist/packages/domain/src/plugin/registry.js +0 -195
  101. package/dist/packages/domain/src/plugin/types.js +0 -6
  102. package/dist/packages/domain/src/ports/analysis.engine.js +0 -7
  103. package/dist/packages/domain/src/ports/audit.logger.js +0 -7
  104. package/dist/packages/domain/src/ports/project.repository.js +0 -7
  105. package/dist/packages/domain/src/rules/index.js +0 -134
  106. package/dist/packages/domain/src/types/analysis.js +0 -6
  107. package/dist/packages/domain/src/types/errors.js +0 -53
  108. package/dist/packages/domain/src/types/fs.js +0 -6
  109. package/dist/packages/domain/src/types/index.js +0 -7
@@ -1,181 +0,0 @@
1
- /**
2
- * Hooks & Notifications System
3
- * Post-command hooks for Slack, Teams, Webhooks
4
- * Enterprise CI/CD integration
5
- */
6
- import { promises as fs } from 'fs';
7
- import { homedir } from 'os';
8
- import { join } from 'path';
9
- const HOOKS_FILE = join(homedir(), '.delta', 'hooks.json');
10
- export class HookManager {
11
- hooks = [];
12
- loaded = false;
13
- async load() {
14
- if (this.loaded)
15
- return;
16
- try {
17
- const data = await fs.readFile(HOOKS_FILE, 'utf-8');
18
- this.hooks = JSON.parse(data);
19
- }
20
- catch {
21
- this.hooks = [];
22
- }
23
- this.loaded = true;
24
- }
25
- async save() {
26
- await fs.mkdir(join(homedir(), '.delta'), { recursive: true });
27
- await fs.writeFile(HOOKS_FILE, JSON.stringify(this.hooks, null, 2), 'utf-8');
28
- }
29
- async addHook(hook) {
30
- const newHook = {
31
- ...hook,
32
- id: `hook-${Date.now()}`,
33
- };
34
- this.hooks.push(newHook);
35
- await this.save();
36
- return newHook;
37
- }
38
- async removeHook(id) {
39
- this.hooks = this.hooks.filter(h => h.id !== id);
40
- await this.save();
41
- }
42
- async listHooks() {
43
- await this.load();
44
- return this.hooks;
45
- }
46
- async toggleHook(id) {
47
- const hook = this.hooks.find(h => h.id === id);
48
- if (hook) {
49
- hook.enabled = !hook.enabled;
50
- await this.save();
51
- }
52
- }
53
- async executeHooks(type, command, response, startTime) {
54
- await this.load();
55
- const matchingHooks = this.hooks.filter(h => h.enabled && h.type === type && (!h.command || h.command === command));
56
- const payload = {
57
- command,
58
- success: response.success,
59
- exitCode: response.exitCode || (response.success ? 0 : 1),
60
- duration: Date.now() - startTime,
61
- timestamp: new Date().toISOString(),
62
- project: process.env.DELTA_PROJECT,
63
- user: process.env.USER || process.env.USERNAME,
64
- error: response.error?.message,
65
- summary: this.generateSummary(command, response),
66
- };
67
- // Execute hooks in parallel
68
- await Promise.all(matchingHooks.map(hook => this.sendNotification(hook, payload).catch(() => { })));
69
- }
70
- async sendNotification(hook, payload) {
71
- const body = hook.payload
72
- ? this.renderTemplate(hook.payload, payload)
73
- : JSON.stringify(payload);
74
- const response = await fetch(hook.url, {
75
- method: hook.method,
76
- headers: {
77
- 'Content-Type': 'application/json',
78
- ...hook.headers,
79
- },
80
- body: hook.method === 'POST' ? body : undefined,
81
- });
82
- if (!response.ok) {
83
- throw new Error(`Hook failed: ${response.status}`);
84
- }
85
- }
86
- renderTemplate(template, payload) {
87
- return template
88
- .replace(/\{\{command\}\}/g, payload.command)
89
- .replace(/\{\{success\}\}/g, payload.success ? 'success' : 'failed')
90
- .replace(/\{\{exitCode\}\}/g, String(payload.exitCode))
91
- .replace(/\{\{duration\}\}/g, String(payload.duration))
92
- .replace(/\{\{project\}\}/g, payload.project || 'unknown')
93
- .replace(/\{\{user\}\}/g, payload.user || 'unknown');
94
- }
95
- generateSummary(command, response) {
96
- switch (command) {
97
- case 'analyze':
98
- return response.success
99
- ? `Analyzed ${response.data?.filesAnalyzed || 0} files, found ${response.data?.findings || 0} issues`
100
- : 'Analysis failed';
101
- case 'deploy':
102
- return response.success ? 'Deployment successful' : 'Deployment failed';
103
- default:
104
- return response.success ? 'Command completed' : 'Command failed';
105
- }
106
- }
107
- }
108
- // Predefined templates for common services
109
- export const hookTemplates = {
110
- slack: (webhookUrl) => ({
111
- name: 'Slack Notifications',
112
- type: 'post-always',
113
- url: webhookUrl,
114
- method: 'POST',
115
- headers: {},
116
- payload: JSON.stringify({
117
- text: 'Delta CLI: {{command}} {{success}}',
118
- blocks: [
119
- {
120
- type: 'section',
121
- text: {
122
- type: 'mrkdwn',
123
- text: '*Delta CLI Notification*',
124
- },
125
- },
126
- {
127
- type: 'section',
128
- fields: [
129
- { type: 'mrkdwn', text: `*Command:*\n{{command}}` },
130
- { type: 'mrkdwn', text: `*Status:*\n{{success}}` },
131
- { type: 'mrkdwn', text: `*Duration:*\n{{duration}}ms` },
132
- { type: 'mrkdwn', text: `*Project:*\n{{project}}` },
133
- ],
134
- },
135
- ],
136
- }),
137
- enabled: true,
138
- }),
139
- teams: (webhookUrl) => ({
140
- name: 'Teams Notifications',
141
- type: 'post-always',
142
- url: webhookUrl,
143
- method: 'POST',
144
- headers: {},
145
- payload: JSON.stringify({
146
- '@type': 'MessageCard',
147
- '@context': 'https://schema.org/extensions',
148
- summary: 'Delta CLI {{command}}',
149
- themeColor: '{{#if success}}00FF00{{else}}FF0000{{/if}}',
150
- sections: [
151
- {
152
- activityTitle: 'Delta CLI Notification',
153
- facts: [
154
- { name: 'Command', value: '{{command}}' },
155
- { name: 'Status', value: '{{success}}' },
156
- { name: 'Duration', value: '{{duration}}ms' },
157
- { name: 'Project', value: '{{project}}' },
158
- ],
159
- },
160
- ],
161
- }),
162
- enabled: true,
163
- }),
164
- generic: (url) => ({
165
- name: 'Webhook',
166
- type: 'post-always',
167
- url,
168
- method: 'POST',
169
- headers: {},
170
- enabled: true,
171
- }),
172
- };
173
- // Singleton instance
174
- let hookManager = null;
175
- export function getHookManager() {
176
- if (!hookManager) {
177
- hookManager = new HookManager();
178
- }
179
- return hookManager;
180
- }
181
- //# sourceMappingURL=hooks.js.map
@@ -1,7 +0,0 @@
1
- /**
2
- * Core Module - Export all core components
3
- */
4
- export * from './contracts.js';
5
- export * from './engine.js';
6
- export * from './policy.js';
7
- //# sourceMappingURL=index.js.map
@@ -1,115 +0,0 @@
1
- /**
2
- * Default Execution Policy
3
- * Determines how tasks are executed and which provider to use
4
- */
5
- import { ExitCode } from './exit-codes.js';
6
- export class DefaultExecutionPolicy {
7
- config;
8
- constructor(config) {
9
- this.config = config;
10
- }
11
- // Validate if a task can be executed
12
- validate(request) {
13
- // Check if provider is specified and valid
14
- if (request.options.provider) {
15
- const allowedProviders = ['local', 'remote', 'ai'];
16
- if (!allowedProviders.includes(request.options.provider)) {
17
- return {
18
- valid: false,
19
- reason: `Invalid provider '${request.options.provider}'. Allowed: local, remote, ai`,
20
- exitCode: ExitCode.VALIDATION_ERROR,
21
- };
22
- }
23
- // Check if AI is requested but not available
24
- if (request.options.provider === 'ai' && !this.config.providers.ai?.enabled) {
25
- return {
26
- valid: false,
27
- reason: 'AI provider is not enabled. Use --provider=local or --provider=remote',
28
- exitCode: ExitCode.POLICY_BLOCKED,
29
- };
30
- }
31
- }
32
- // Validate task type
33
- const validTypes = ['analyze', 'init', 'status', 'sync', 'deploy', 'config', 'auth', 'plugin'];
34
- if (!validTypes.includes(request.type)) {
35
- return {
36
- valid: false,
37
- reason: `Invalid task type '${request.type}'`,
38
- exitCode: ExitCode.VALIDATION_ERROR,
39
- };
40
- }
41
- return { valid: true };
42
- }
43
- // Select appropriate provider for a task
44
- selectProvider(request, providers) {
45
- // If user explicitly specified a provider, use it
46
- if (request.options.provider) {
47
- const provider = providers.get(request.options.provider);
48
- if (provider && provider.capabilities.commands.includes(request.type)) {
49
- return provider;
50
- }
51
- return null;
52
- }
53
- // Auto-select based on task type and availability
54
- const preferredProvider = this.getPreferredProvider(request.type);
55
- const provider = providers.get(preferredProvider);
56
- if (provider && provider.capabilities.commands.includes(request.type)) {
57
- return provider;
58
- }
59
- // Fallback to any provider that supports this command
60
- for (const [, provider] of providers) {
61
- if (provider.capabilities.commands.includes(request.type)) {
62
- return provider;
63
- }
64
- }
65
- return null;
66
- }
67
- // Get preferred provider based on task type
68
- getPreferredProvider(taskType) {
69
- switch (taskType) {
70
- case 'analyze':
71
- // Prefer remote for heavy analysis if available
72
- if (this.config.providers.remote?.enabled) {
73
- return 'remote';
74
- }
75
- return 'local';
76
- case 'sync':
77
- case 'deploy':
78
- // These require remote/cloud
79
- if (this.config.providers.remote?.enabled) {
80
- return 'remote';
81
- }
82
- return 'local';
83
- case 'init':
84
- case 'status':
85
- case 'config':
86
- case 'auth':
87
- default:
88
- // Default to local for simple operations
89
- return 'local';
90
- }
91
- }
92
- // Transform request before execution
93
- transform(request) {
94
- // Add non-interactive mode detection
95
- const isNonTTY = !process.stdout.isTTY;
96
- if (isNonTTY && !request.options.json) {
97
- // Force JSON output in non-TTY mode for better piping
98
- return {
99
- ...request,
100
- options: {
101
- ...request.options,
102
- nonInteractive: true,
103
- json: true,
104
- },
105
- };
106
- }
107
- return request;
108
- }
109
- // Check if user has capability to execute (placeholder for future auth checks)
110
- checkCapabilities(_request) {
111
- // For now, always allow
112
- return { allowed: true };
113
- }
114
- }
115
- //# sourceMappingURL=policy.js.map
@@ -1,161 +0,0 @@
1
- /**
2
- * Profile Management System
3
- * Manage multiple environments: dev, staging, prod
4
- * Auto-select provider and settings based on active profile
5
- */
6
- import { promises as fs } from 'fs';
7
- import { homedir } from 'os';
8
- import { join } from 'path';
9
- const PROFILES_FILE = join(homedir(), '.delta', 'profiles.json');
10
- const DEFAULT_PROFILES = {
11
- dev: {
12
- name: 'dev',
13
- provider: 'local',
14
- timeout: 30000,
15
- retries: 1,
16
- features: {
17
- analytics: false,
18
- caching: false,
19
- autoSync: false,
20
- },
21
- env: {
22
- NODE_ENV: 'development',
23
- DELTA_LOG_LEVEL: 'debug',
24
- },
25
- },
26
- staging: {
27
- name: 'staging',
28
- provider: 'remote',
29
- apiUrl: 'https://api-staging.delta.dev',
30
- timeout: 60000,
31
- retries: 2,
32
- features: {
33
- analytics: true,
34
- caching: true,
35
- autoSync: true,
36
- },
37
- env: {
38
- NODE_ENV: 'staging',
39
- DELTA_LOG_LEVEL: 'info',
40
- },
41
- },
42
- prod: {
43
- name: 'prod',
44
- provider: 'remote',
45
- apiUrl: 'https://api.delta.dev',
46
- timeout: 120000,
47
- retries: 3,
48
- features: {
49
- analytics: true,
50
- caching: true,
51
- autoSync: true,
52
- },
53
- env: {
54
- NODE_ENV: 'production',
55
- DELTA_LOG_LEVEL: 'warn',
56
- },
57
- },
58
- };
59
- export class ProfileManager {
60
- data;
61
- loaded = false;
62
- constructor() {
63
- this.data = {
64
- activeProfile: 'dev',
65
- profiles: { ...DEFAULT_PROFILES },
66
- };
67
- }
68
- async load() {
69
- if (this.loaded)
70
- return;
71
- try {
72
- const data = await fs.readFile(PROFILES_FILE, 'utf-8');
73
- const parsed = JSON.parse(data);
74
- this.data = {
75
- activeProfile: parsed.activeProfile || 'dev',
76
- profiles: { ...DEFAULT_PROFILES, ...parsed.profiles },
77
- };
78
- }
79
- catch {
80
- // Use defaults
81
- await this.save();
82
- }
83
- this.loaded = true;
84
- }
85
- async save() {
86
- await fs.mkdir(join(homedir(), '.delta'), { recursive: true });
87
- await fs.writeFile(PROFILES_FILE, JSON.stringify(this.data, null, 2), 'utf-8');
88
- }
89
- getActiveProfile() {
90
- return this.data.profiles[this.data.activeProfile] || this.data.profiles.dev;
91
- }
92
- getProfile(name) {
93
- return this.data.profiles[name];
94
- }
95
- async setActiveProfile(name) {
96
- if (!this.data.profiles[name]) {
97
- throw new Error(`Profile '${name}' not found. Create it first.`);
98
- }
99
- this.data.activeProfile = name;
100
- await this.save();
101
- }
102
- async createProfile(name, config) {
103
- this.data.profiles[name] = {
104
- name,
105
- provider: config.provider || 'local',
106
- apiUrl: config.apiUrl,
107
- apiKey: config.apiKey,
108
- timeout: config.timeout || 30000,
109
- retries: config.retries || 1,
110
- features: config.features || { analytics: false, caching: false, autoSync: false },
111
- env: config.env || {},
112
- };
113
- await this.save();
114
- }
115
- async deleteProfile(name) {
116
- if (name === this.data.activeProfile) {
117
- throw new Error('Cannot delete active profile');
118
- }
119
- if (DEFAULT_PROFILES[name]) {
120
- throw new Error(`Cannot delete default profile '${name}'`);
121
- }
122
- delete this.data.profiles[name];
123
- await this.save();
124
- }
125
- listProfiles() {
126
- return Object.keys(this.data.profiles).map(name => ({
127
- name,
128
- active: name === this.data.activeProfile,
129
- provider: this.data.profiles[name].provider,
130
- }));
131
- }
132
- applyToEnvironment() {
133
- const profile = this.getActiveProfile();
134
- // Apply environment variables
135
- for (const [key, value] of Object.entries(profile.env)) {
136
- process.env[key] = value;
137
- }
138
- // Set provider preference
139
- process.env.DELTA_PROVIDER = profile.provider;
140
- if (profile.apiUrl) {
141
- process.env.DELTA_API_URL = profile.apiUrl;
142
- }
143
- }
144
- getProviderForCommand(command) {
145
- const profile = this.getActiveProfile();
146
- // Some commands should always use local in dev
147
- if (profile.name === 'dev' && ['init', 'config', 'status'].includes(command)) {
148
- return 'local';
149
- }
150
- return profile.provider;
151
- }
152
- }
153
- // Singleton instance
154
- let profileManager = null;
155
- export function getProfileManager() {
156
- if (!profileManager) {
157
- profileManager = new ProfileManager();
158
- }
159
- return profileManager;
160
- }
161
- //# sourceMappingURL=profiles.js.map
@@ -1,203 +0,0 @@
1
- /**
2
- * Interactive Wizard Mode
3
- * Step-by-step guided experience for complex commands
4
- */
5
- import prompts from 'prompts';
6
- import chalk from 'chalk';
7
- // Init Wizard Steps
8
- const initWizardSteps = [
9
- {
10
- name: 'projectName',
11
- message: 'What is your project name?',
12
- type: 'text',
13
- initial: 'my-delta-project',
14
- validate: (value) => value.length > 0 || 'Project name is required',
15
- },
16
- {
17
- name: 'template',
18
- message: 'Choose a project template:',
19
- type: 'select',
20
- choices: [
21
- { title: 'Default', value: 'default', description: 'Basic Delta project structure' },
22
- { title: 'Next.js', value: 'nextjs', description: 'Next.js app with Delta integration' },
23
- { title: 'React', value: 'react', description: 'React SPA with Delta support' },
24
- { title: 'Node.js', value: 'node', description: 'Node.js backend service' },
25
- { title: 'Python', value: 'python', description: 'Python project with Delta CLI' },
26
- ],
27
- },
28
- {
29
- name: 'features',
30
- message: 'Select features to enable:',
31
- type: 'multiselect',
32
- choices: [
33
- { title: 'Code Analysis', value: 'analysis', description: 'Auto-analyze on commits' },
34
- { title: 'Documentation', value: 'docs', description: 'Auto-generate docs' },
35
- { title: 'CI/CD Config', value: 'cicd', description: 'GitHub Actions workflow' },
36
- { title: 'Docker', value: 'docker', description: 'Docker configuration' },
37
- { title: 'TypeScript', value: 'typescript', description: 'TypeScript setup' },
38
- ],
39
- },
40
- {
41
- name: 'initializeGit',
42
- message: 'Initialize Git repository?',
43
- type: 'confirm',
44
- initial: true,
45
- },
46
- {
47
- name: 'installDependencies',
48
- message: 'Install dependencies now?',
49
- type: 'confirm',
50
- initial: true,
51
- },
52
- ];
53
- // Run Init Wizard
54
- export async function runInitWizard() {
55
- console.log(chalk.bold.cyan('\n🚀 Delta Project Wizard\n'));
56
- console.log(chalk.gray('Answer a few questions to set up your project.\n'));
57
- const answers = {};
58
- for (const step of initWizardSteps) {
59
- const response = await prompts({
60
- type: step.type,
61
- name: step.name,
62
- message: step.message,
63
- choices: step.choices,
64
- initial: step.initial,
65
- validate: step.validate,
66
- }, {
67
- onCancel: () => {
68
- console.log(chalk.yellow('\n⚠️ Wizard cancelled'));
69
- process.exit(0);
70
- },
71
- });
72
- answers[step.name] = response[step.name];
73
- }
74
- // Derive project path from name
75
- const projectPath = `./${answers.projectName}`;
76
- return {
77
- projectName: answers.projectName,
78
- projectPath,
79
- template: answers.template,
80
- initializeGit: answers.initializeGit,
81
- installDependencies: answers.installDependencies,
82
- features: answers.features || [],
83
- };
84
- }
85
- // Execute wizard actions
86
- export async function executeWizardActions(result) {
87
- console.log(chalk.bold.cyan('\n📦 Creating Project...\n'));
88
- const steps = [
89
- { name: 'Creating directory', action: () => `mkdir -p ${result.projectPath}` },
90
- { name: 'Writing config', action: () => 'config' },
91
- { name: 'Setting up template', action: () => result.template },
92
- ];
93
- if (result.initializeGit) {
94
- steps.push({ name: 'Initializing Git', action: () => 'git init' });
95
- }
96
- if (result.features.includes('docker')) {
97
- steps.push({ name: 'Creating Dockerfile', action: () => 'docker' });
98
- }
99
- if (result.features.includes('cicd')) {
100
- steps.push({ name: 'Creating CI/CD workflow', action: () => 'cicd' });
101
- }
102
- // Simulate progress
103
- for (let i = 0; i < steps.length; i++) {
104
- const step = steps[i];
105
- process.stdout.write(chalk.gray(` [${i + 1}/${steps.length}] ${step.name}... `));
106
- // Simulate work
107
- await new Promise(resolve => setTimeout(resolve, 300));
108
- console.log(chalk.green('✓'));
109
- }
110
- // Summary
111
- console.log(chalk.bold.green('\n✅ Project created successfully!\n'));
112
- console.log(chalk.cyan('Next steps:'));
113
- console.log(chalk.gray(` cd ${result.projectPath}`));
114
- console.log(chalk.gray(' delta /analyze # Analyze your code'));
115
- console.log(chalk.gray(' delta /status # Check project status'));
116
- console.log();
117
- }
118
- // Quick wizard for other commands
119
- export async function runQuickWizard(command) {
120
- switch (command) {
121
- case 'analyze':
122
- return runAnalyzeWizard();
123
- case 'deploy':
124
- return runDeployWizard();
125
- default:
126
- return null;
127
- }
128
- }
129
- async function runAnalyzeWizard() {
130
- console.log(chalk.bold.cyan('\n🔍 Analysis Wizard\n'));
131
- const response = await prompts([
132
- {
133
- type: 'text',
134
- name: 'path',
135
- message: 'Path to analyze?',
136
- initial: '.',
137
- },
138
- {
139
- type: 'multiselect',
140
- name: 'scans',
141
- message: 'Select scans to run:',
142
- choices: [
143
- { title: 'Security', value: 'security', selected: true },
144
- { title: 'Performance', value: 'performance', selected: true },
145
- { title: 'Code Quality', value: 'quality', selected: true },
146
- { title: 'AI Insights', value: 'ai', selected: false },
147
- ],
148
- hint: 'Space to select, Enter to confirm',
149
- },
150
- {
151
- type: 'select',
152
- name: 'format',
153
- message: 'Output format?',
154
- choices: [
155
- { title: 'JSON', value: 'json' },
156
- { title: 'HTML Report', value: 'html' },
157
- { title: 'Markdown', value: 'markdown' },
158
- ],
159
- initial: 0,
160
- },
161
- ], {
162
- onCancel: () => {
163
- console.log(chalk.yellow('\n⚠️ Wizard cancelled'));
164
- process.exit(0);
165
- },
166
- });
167
- return response;
168
- }
169
- async function runDeployWizard() {
170
- console.log(chalk.bold.cyan('\n🚀 Deploy Wizard\n'));
171
- const response = await prompts([
172
- {
173
- type: 'select',
174
- name: 'target',
175
- message: 'Deploy target?',
176
- choices: [
177
- { title: 'Delta Cloud', value: 'delta' },
178
- { title: 'Vercel', value: 'vercel' },
179
- { title: 'Netlify', value: 'netlify' },
180
- { title: 'Custom Server', value: 'custom' },
181
- ],
182
- },
183
- {
184
- type: 'confirm',
185
- name: 'buildFirst',
186
- message: 'Build before deploy?',
187
- initial: true,
188
- },
189
- {
190
- type: 'confirm',
191
- name: 'runTests',
192
- message: 'Run tests before deploy?',
193
- initial: true,
194
- },
195
- ], {
196
- onCancel: () => {
197
- console.log(chalk.yellow('\n⚠️ Wizard cancelled'));
198
- process.exit(0);
199
- },
200
- });
201
- return response;
202
- }
203
- //# sourceMappingURL=wizard.js.map