@wundr.io/cli 1.0.11 → 1.0.12
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/bin/wundr.js +8 -4
- package/package.json +23 -23
- package/src/ai/ai-service.ts +16 -17
- package/src/ai/claude-client.ts +16 -16
- package/src/ai/conversation-manager.ts +29 -29
- package/src/cli.ts +4 -4
- package/src/commands/ai.ts +246 -78
- package/src/commands/alignment.ts +74 -74
- package/src/commands/analyze-optimized.ts +111 -78
- package/src/commands/analyze.ts +14 -14
- package/src/commands/batch.ts +179 -42
- package/src/commands/chat.ts +37 -30
- package/src/commands/claude-init.ts +41 -45
- package/src/commands/claude-setup.ts +204 -119
- package/src/commands/computer-setup.ts +85 -43
- package/src/commands/create-command.ts +4 -4
- package/src/commands/create.ts +27 -27
- package/src/commands/dashboard.ts +24 -24
- package/src/commands/govern.ts +25 -25
- package/src/commands/governance.ts +34 -34
- package/src/commands/guardian.ts +56 -56
- package/src/commands/init.ts +25 -22
- package/src/commands/orchestrator.ts +68 -41
- package/src/commands/performance-optimizer.ts +34 -35
- package/src/commands/plugins.ts +27 -27
- package/src/commands/project-update.ts +175 -72
- package/src/commands/rag.ts +185 -78
- package/src/commands/session.ts +35 -35
- package/src/commands/setup.ts +40 -344
- package/src/commands/test-init.ts +3 -3
- package/src/commands/test.ts +4 -4
- package/src/commands/watch.ts +28 -29
- package/src/commands/worktree.ts +49 -49
- package/src/context/context-manager.ts +10 -10
- package/src/context/session-manager.ts +41 -41
- package/src/framework/command-interface.ts +520 -0
- package/src/framework/command-registry.ts +942 -0
- package/src/framework/completion-exporter.ts +383 -0
- package/src/framework/debug-logger.ts +519 -0
- package/src/framework/error-handler.ts +867 -0
- package/src/framework/help-generator.ts +540 -0
- package/src/framework/index.ts +169 -0
- package/src/framework/interactive-repl.ts +703 -0
- package/src/framework/output-formatter.ts +834 -0
- package/src/framework/progress-manager.ts +539 -0
- package/src/index.ts +4 -4
- package/src/interactive/interactive-mode.ts +16 -16
- package/src/lib/conflict-resolution.ts +799 -9
- package/src/lib/merge-strategy.ts +529 -7
- package/src/lib/safety-mechanisms.ts +422 -18
- package/src/lib/state-detection.ts +1015 -13
- package/src/nlp/command-mapper.ts +29 -29
- package/src/nlp/command-parser.ts +17 -17
- package/src/nlp/intent-classifier.ts +7 -7
- package/src/nlp/intent-parser.ts +54 -52
- package/src/plugins/plugin-manager.ts +61 -39
- package/src/tests/computer-setup-integration.test.ts +46 -15
- package/src/types/modules.d.ts +424 -1
- package/src/utils/backup-rollback-manager.ts +11 -8
- package/src/utils/config-manager.ts +3 -3
- package/src/utils/error-handler.ts +2 -2
- package/src/utils/logger.ts +22 -22
- package/templates/batch/ci-cd.yaml +7 -7
- package/test-suites/api/health.spec.ts +20 -23
- package/test-suites/helpers/test-config.ts +14 -13
- package/test-suites/ui/accessibility.spec.ts +27 -22
- package/test-suites/ui/smoke.spec.ts +26 -21
- package/LICENSE +0 -21
- package/dist/ai/ai-service.d.ts +0 -152
- package/dist/ai/ai-service.d.ts.map +0 -1
- package/dist/ai/ai-service.js +0 -430
- package/dist/ai/ai-service.js.map +0 -1
- package/dist/ai/claude-client.d.ts +0 -130
- package/dist/ai/claude-client.d.ts.map +0 -1
- package/dist/ai/claude-client.js +0 -340
- package/dist/ai/claude-client.js.map +0 -1
- package/dist/ai/conversation-manager.d.ts +0 -164
- package/dist/ai/conversation-manager.d.ts.map +0 -1
- package/dist/ai/conversation-manager.js +0 -614
- package/dist/ai/conversation-manager.js.map +0 -1
- package/dist/ai/index.d.ts +0 -5
- package/dist/ai/index.d.ts.map +0 -1
- package/dist/ai/index.js +0 -8
- package/dist/ai/index.js.map +0 -1
- package/dist/cli.d.ts +0 -36
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -192
- package/dist/cli.js.map +0 -1
- package/dist/commands/ai.d.ts +0 -89
- package/dist/commands/ai.d.ts.map +0 -1
- package/dist/commands/ai.js +0 -799
- package/dist/commands/ai.js.map +0 -1
- package/dist/commands/alignment.d.ts +0 -78
- package/dist/commands/alignment.d.ts.map +0 -1
- package/dist/commands/alignment.js +0 -817
- package/dist/commands/alignment.js.map +0 -1
- package/dist/commands/analyze-optimized.d.ts +0 -14
- package/dist/commands/analyze-optimized.d.ts.map +0 -1
- package/dist/commands/analyze-optimized.js +0 -600
- package/dist/commands/analyze-optimized.js.map +0 -1
- package/dist/commands/analyze.d.ts +0 -65
- package/dist/commands/analyze.d.ts.map +0 -1
- package/dist/commands/analyze.js +0 -435
- package/dist/commands/analyze.js.map +0 -1
- package/dist/commands/batch.d.ts +0 -71
- package/dist/commands/batch.d.ts.map +0 -1
- package/dist/commands/batch.js +0 -738
- package/dist/commands/batch.js.map +0 -1
- package/dist/commands/chat.d.ts +0 -71
- package/dist/commands/chat.d.ts.map +0 -1
- package/dist/commands/chat.js +0 -674
- package/dist/commands/chat.js.map +0 -1
- package/dist/commands/claude-init.d.ts +0 -28
- package/dist/commands/claude-init.d.ts.map +0 -1
- package/dist/commands/claude-init.js +0 -591
- package/dist/commands/claude-init.js.map +0 -1
- package/dist/commands/claude-setup.d.ts +0 -119
- package/dist/commands/claude-setup.d.ts.map +0 -1
- package/dist/commands/claude-setup.js +0 -1073
- package/dist/commands/claude-setup.js.map +0 -1
- package/dist/commands/computer-setup-commands.d.ts +0 -53
- package/dist/commands/computer-setup-commands.d.ts.map +0 -1
- package/dist/commands/computer-setup-commands.js +0 -705
- package/dist/commands/computer-setup-commands.js.map +0 -1
- package/dist/commands/computer-setup.d.ts +0 -7
- package/dist/commands/computer-setup.d.ts.map +0 -1
- package/dist/commands/computer-setup.js +0 -849
- package/dist/commands/computer-setup.js.map +0 -1
- package/dist/commands/create-command.d.ts +0 -7
- package/dist/commands/create-command.d.ts.map +0 -1
- package/dist/commands/create-command.js +0 -158
- package/dist/commands/create-command.js.map +0 -1
- package/dist/commands/create.d.ts +0 -74
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -556
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/dashboard.d.ts +0 -91
- package/dist/commands/dashboard.d.ts.map +0 -1
- package/dist/commands/dashboard.js +0 -538
- package/dist/commands/dashboard.js.map +0 -1
- package/dist/commands/govern.d.ts +0 -70
- package/dist/commands/govern.d.ts.map +0 -1
- package/dist/commands/govern.js +0 -481
- package/dist/commands/govern.js.map +0 -1
- package/dist/commands/governance.d.ts +0 -17
- package/dist/commands/governance.d.ts.map +0 -1
- package/dist/commands/governance.js +0 -703
- package/dist/commands/governance.js.map +0 -1
- package/dist/commands/guardian.d.ts +0 -20
- package/dist/commands/guardian.d.ts.map +0 -1
- package/dist/commands/guardian.js +0 -597
- package/dist/commands/guardian.js.map +0 -1
- package/dist/commands/init.d.ts +0 -59
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -650
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/orchestrator.d.ts +0 -7
- package/dist/commands/orchestrator.d.ts.map +0 -1
- package/dist/commands/orchestrator.js +0 -571
- package/dist/commands/orchestrator.js.map +0 -1
- package/dist/commands/performance-optimizer.d.ts +0 -30
- package/dist/commands/performance-optimizer.d.ts.map +0 -1
- package/dist/commands/performance-optimizer.js +0 -650
- package/dist/commands/performance-optimizer.js.map +0 -1
- package/dist/commands/plugins.d.ts +0 -87
- package/dist/commands/plugins.d.ts.map +0 -1
- package/dist/commands/plugins.js +0 -685
- package/dist/commands/plugins.js.map +0 -1
- package/dist/commands/rag.d.ts +0 -7
- package/dist/commands/rag.d.ts.map +0 -1
- package/dist/commands/rag.js +0 -748
- package/dist/commands/rag.js.map +0 -1
- package/dist/commands/session.d.ts +0 -41
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js +0 -441
- package/dist/commands/session.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -29
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/setup.js +0 -397
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/test-init.d.ts +0 -9
- package/dist/commands/test-init.d.ts.map +0 -1
- package/dist/commands/test-init.js +0 -222
- package/dist/commands/test-init.js.map +0 -1
- package/dist/commands/test.d.ts +0 -25
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js +0 -217
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/vp.d.ts +0 -7
- package/dist/commands/vp.d.ts.map +0 -1
- package/dist/commands/vp.js +0 -571
- package/dist/commands/vp.js.map +0 -1
- package/dist/commands/watch.d.ts +0 -76
- package/dist/commands/watch.d.ts.map +0 -1
- package/dist/commands/watch.js +0 -613
- package/dist/commands/watch.js.map +0 -1
- package/dist/commands/worktree.d.ts +0 -63
- package/dist/commands/worktree.d.ts.map +0 -1
- package/dist/commands/worktree.js +0 -774
- package/dist/commands/worktree.js.map +0 -1
- package/dist/context/context-manager.d.ts +0 -155
- package/dist/context/context-manager.d.ts.map +0 -1
- package/dist/context/context-manager.js +0 -383
- package/dist/context/context-manager.js.map +0 -1
- package/dist/context/index.d.ts +0 -3
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -6
- package/dist/context/index.js.map +0 -1
- package/dist/context/session-manager.d.ts +0 -207
- package/dist/context/session-manager.d.ts.map +0 -1
- package/dist/context/session-manager.js +0 -686
- package/dist/context/session-manager.js.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -51
- package/dist/index.js.map +0 -1
- package/dist/interactive/interactive-mode.d.ts +0 -76
- package/dist/interactive/interactive-mode.d.ts.map +0 -1
- package/dist/interactive/interactive-mode.js +0 -732
- package/dist/interactive/interactive-mode.js.map +0 -1
- package/dist/nlp/command-mapper.d.ts +0 -174
- package/dist/nlp/command-mapper.d.ts.map +0 -1
- package/dist/nlp/command-mapper.js +0 -624
- package/dist/nlp/command-mapper.js.map +0 -1
- package/dist/nlp/command-parser.d.ts +0 -106
- package/dist/nlp/command-parser.d.ts.map +0 -1
- package/dist/nlp/command-parser.js +0 -417
- package/dist/nlp/command-parser.js.map +0 -1
- package/dist/nlp/index.d.ts +0 -5
- package/dist/nlp/index.d.ts.map +0 -1
- package/dist/nlp/index.js +0 -8
- package/dist/nlp/index.js.map +0 -1
- package/dist/nlp/intent-classifier.d.ts +0 -59
- package/dist/nlp/intent-classifier.d.ts.map +0 -1
- package/dist/nlp/intent-classifier.js +0 -384
- package/dist/nlp/intent-classifier.js.map +0 -1
- package/dist/nlp/intent-parser.d.ts +0 -152
- package/dist/nlp/intent-parser.d.ts.map +0 -1
- package/dist/nlp/intent-parser.js +0 -744
- package/dist/nlp/intent-parser.js.map +0 -1
- package/dist/plugins/plugin-manager.d.ts +0 -120
- package/dist/plugins/plugin-manager.d.ts.map +0 -1
- package/dist/plugins/plugin-manager.js +0 -595
- package/dist/plugins/plugin-manager.js.map +0 -1
- package/dist/types/index.d.ts +0 -224
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/utils/backup-rollback-manager.d.ts +0 -72
- package/dist/utils/backup-rollback-manager.d.ts.map +0 -1
- package/dist/utils/backup-rollback-manager.js +0 -289
- package/dist/utils/backup-rollback-manager.js.map +0 -1
- package/dist/utils/claude-config-installer.d.ts +0 -98
- package/dist/utils/claude-config-installer.d.ts.map +0 -1
- package/dist/utils/claude-config-installer.js +0 -678
- package/dist/utils/claude-config-installer.js.map +0 -1
- package/dist/utils/config-manager.d.ts +0 -73
- package/dist/utils/config-manager.d.ts.map +0 -1
- package/dist/utils/config-manager.js +0 -339
- package/dist/utils/config-manager.js.map +0 -1
- package/dist/utils/error-handler.d.ts +0 -46
- package/dist/utils/error-handler.d.ts.map +0 -1
- package/dist/utils/error-handler.js +0 -169
- package/dist/utils/error-handler.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -25
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -105
- package/dist/utils/logger.js.map +0 -1
- package/src/commands/computer-setup-commands.ts +0 -872
package/dist/commands/watch.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { PluginManager } from '../plugins/plugin-manager';
|
|
2
|
-
import type { ConfigManager } from '../utils/config-manager';
|
|
3
|
-
import type { Command } from 'commander';
|
|
4
|
-
/**
|
|
5
|
-
* Watch commands for real-time monitoring
|
|
6
|
-
*/
|
|
7
|
-
export declare class WatchCommands {
|
|
8
|
-
private program;
|
|
9
|
-
private configManager;
|
|
10
|
-
private pluginManager;
|
|
11
|
-
private watchers;
|
|
12
|
-
private activeWatches;
|
|
13
|
-
constructor(program: Command, configManager: ConfigManager, pluginManager: PluginManager);
|
|
14
|
-
private registerCommands;
|
|
15
|
-
/**
|
|
16
|
-
* Start watching files or directories
|
|
17
|
-
*/
|
|
18
|
-
private startWatching;
|
|
19
|
-
/**
|
|
20
|
-
* Stop watching
|
|
21
|
-
*/
|
|
22
|
-
private stopWatching;
|
|
23
|
-
/**
|
|
24
|
-
* List active watches
|
|
25
|
-
*/
|
|
26
|
-
private listWatches;
|
|
27
|
-
/**
|
|
28
|
-
* Show watch status
|
|
29
|
-
*/
|
|
30
|
-
private showWatchStatus;
|
|
31
|
-
/**
|
|
32
|
-
* Create watch configuration
|
|
33
|
-
*/
|
|
34
|
-
private createWatchConfig;
|
|
35
|
-
/**
|
|
36
|
-
* Load watch configuration from file
|
|
37
|
-
*/
|
|
38
|
-
private loadWatchConfig;
|
|
39
|
-
/**
|
|
40
|
-
* Save watch configuration to file
|
|
41
|
-
*/
|
|
42
|
-
private saveWatchConfig;
|
|
43
|
-
/**
|
|
44
|
-
* Watch tests
|
|
45
|
-
*/
|
|
46
|
-
private watchTests;
|
|
47
|
-
/**
|
|
48
|
-
* Watch build
|
|
49
|
-
*/
|
|
50
|
-
private watchBuild;
|
|
51
|
-
/**
|
|
52
|
-
* Watch lint
|
|
53
|
-
*/
|
|
54
|
-
private watchLint;
|
|
55
|
-
/**
|
|
56
|
-
* Watch analysis
|
|
57
|
-
*/
|
|
58
|
-
private watchAnalysis;
|
|
59
|
-
/**
|
|
60
|
-
* Helper methods
|
|
61
|
-
*/
|
|
62
|
-
private setupWatchHandlers;
|
|
63
|
-
private shouldExecuteCommand;
|
|
64
|
-
private executeWatchCommand;
|
|
65
|
-
private createWatchConfigFromOptions;
|
|
66
|
-
private loadWatchConfigFile;
|
|
67
|
-
private startWatchingWithConfig;
|
|
68
|
-
private createInteractiveWatchConfig;
|
|
69
|
-
private parseWatchCommands;
|
|
70
|
-
private getTestPatterns;
|
|
71
|
-
private getTestCommand;
|
|
72
|
-
private getBuildCommand;
|
|
73
|
-
private getLintCommand;
|
|
74
|
-
private getAnalysisCommand;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,qBAAa,aAAa;IAKtB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,aAAa;IANvB,OAAO,CAAC,QAAQ,CAAqC;IACrD,OAAO,CAAC,aAAa,CAAuC;gBAGlD,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa;IAKtC,OAAO,CAAC,gBAAgB;IAwHxB;;OAEG;YACW,aAAa;IA0C3B;;OAEG;YACW,YAAY;IAgC1B;;OAEG;YACW,WAAW;IA6BzB;;OAEG;YACW,eAAe;IAqC7B;;OAEG;YACW,iBAAiB;IAqC/B;;OAEG;YACW,eAAe;IAiB7B;;OAEG;YACW,eAAe;IAuB7B;;OAEG;YACW,UAAU;IA4BxB;;OAEG;YACW,UAAU;IA4BxB;;OAEG;YACW,SAAS;IA4BvB;;OAEG;YACW,aAAa;IA4B3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAyC1B,OAAO,CAAC,oBAAoB;YAoBd,mBAAmB;IAoCjC,OAAO,CAAC,4BAA4B;YAoBtB,mBAAmB;YAiBnB,uBAAuB;YAqBvB,4BAA4B;IA4C1C,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;CAG3B"}
|
package/dist/commands/watch.js
DELETED
|
@@ -1,613 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WatchCommands = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
-
const chokidar_1 = require("chokidar");
|
|
8
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
9
|
-
const yaml_1 = tslib_1.__importDefault(require("yaml"));
|
|
10
|
-
const error_handler_1 = require("../utils/error-handler");
|
|
11
|
-
const logger_1 = require("../utils/logger");
|
|
12
|
-
/**
|
|
13
|
-
* Watch commands for real-time monitoring
|
|
14
|
-
*/
|
|
15
|
-
class WatchCommands {
|
|
16
|
-
program;
|
|
17
|
-
configManager;
|
|
18
|
-
pluginManager;
|
|
19
|
-
watchers = new Map();
|
|
20
|
-
activeWatches = new Map();
|
|
21
|
-
constructor(program, configManager, pluginManager) {
|
|
22
|
-
this.program = program;
|
|
23
|
-
this.configManager = configManager;
|
|
24
|
-
this.pluginManager = pluginManager;
|
|
25
|
-
this.registerCommands();
|
|
26
|
-
}
|
|
27
|
-
registerCommands() {
|
|
28
|
-
const watchCmd = this.program
|
|
29
|
-
.command('watch')
|
|
30
|
-
.description('real-time file and project monitoring');
|
|
31
|
-
// Start watching
|
|
32
|
-
watchCmd
|
|
33
|
-
.command('start [patterns...]')
|
|
34
|
-
.description('start watching files or directories')
|
|
35
|
-
.option('--config <config>', 'watch configuration file')
|
|
36
|
-
.option('--ignore <patterns>', 'patterns to ignore (comma-separated)')
|
|
37
|
-
.option('--command <command>', 'command to run on changes')
|
|
38
|
-
.option('--debounce <ms>', 'debounce delay in milliseconds', '300')
|
|
39
|
-
.option('--recursive', 'watch subdirectories recursively')
|
|
40
|
-
.action(async (patterns, options) => {
|
|
41
|
-
await this.startWatching(patterns, options);
|
|
42
|
-
});
|
|
43
|
-
// Stop watching
|
|
44
|
-
watchCmd
|
|
45
|
-
.command('stop [name]')
|
|
46
|
-
.description('stop specific watch or all watches')
|
|
47
|
-
.action(async (name) => {
|
|
48
|
-
await this.stopWatching(name);
|
|
49
|
-
});
|
|
50
|
-
// List active watches
|
|
51
|
-
watchCmd
|
|
52
|
-
.command('list')
|
|
53
|
-
.alias('ls')
|
|
54
|
-
.description('list active watches')
|
|
55
|
-
.action(async () => {
|
|
56
|
-
await this.listWatches();
|
|
57
|
-
});
|
|
58
|
-
// Watch status
|
|
59
|
-
watchCmd
|
|
60
|
-
.command('status [name]')
|
|
61
|
-
.description('show watch status')
|
|
62
|
-
.action(async (name) => {
|
|
63
|
-
await this.showWatchStatus(name);
|
|
64
|
-
});
|
|
65
|
-
// Create watch config
|
|
66
|
-
watchCmd
|
|
67
|
-
.command('config create <name>')
|
|
68
|
-
.description('create watch configuration')
|
|
69
|
-
.option('--patterns <patterns>', 'file patterns to watch')
|
|
70
|
-
.option('--commands <commands>', 'commands to run on changes')
|
|
71
|
-
.option('--interactive', 'create configuration interactively')
|
|
72
|
-
.action(async (name, options) => {
|
|
73
|
-
await this.createWatchConfig(name, options);
|
|
74
|
-
});
|
|
75
|
-
// Load watch config
|
|
76
|
-
watchCmd
|
|
77
|
-
.command('config load <file>')
|
|
78
|
-
.description('load watch configuration from file')
|
|
79
|
-
.action(async (file) => {
|
|
80
|
-
await this.loadWatchConfig(file);
|
|
81
|
-
});
|
|
82
|
-
// Save watch config
|
|
83
|
-
watchCmd
|
|
84
|
-
.command('config save <name> [file]')
|
|
85
|
-
.description('save watch configuration to file')
|
|
86
|
-
.action(async (name, file) => {
|
|
87
|
-
await this.saveWatchConfig(name, file);
|
|
88
|
-
});
|
|
89
|
-
// Watch tests
|
|
90
|
-
watchCmd
|
|
91
|
-
.command('test')
|
|
92
|
-
.description('watch and run tests on changes')
|
|
93
|
-
.option('--framework <framework>', 'test framework (jest, mocha, vitest)', 'jest')
|
|
94
|
-
.option('--coverage', 'run with coverage')
|
|
95
|
-
.option('--changed-only', 'run tests for changed files only')
|
|
96
|
-
.action(async (options) => {
|
|
97
|
-
await this.watchTests(options);
|
|
98
|
-
});
|
|
99
|
-
// Watch build
|
|
100
|
-
watchCmd
|
|
101
|
-
.command('build')
|
|
102
|
-
.description('watch and build on changes')
|
|
103
|
-
.option('--target <target>', 'build target')
|
|
104
|
-
.option('--incremental', 'enable incremental builds')
|
|
105
|
-
.action(async (options) => {
|
|
106
|
-
await this.watchBuild(options);
|
|
107
|
-
});
|
|
108
|
-
// Watch lint
|
|
109
|
-
watchCmd
|
|
110
|
-
.command('lint')
|
|
111
|
-
.description('watch and lint on changes')
|
|
112
|
-
.option('--fix', 'automatically fix linting issues')
|
|
113
|
-
.option('--staged-only', 'lint staged files only')
|
|
114
|
-
.action(async (options) => {
|
|
115
|
-
await this.watchLint(options);
|
|
116
|
-
});
|
|
117
|
-
// Watch analysis
|
|
118
|
-
watchCmd
|
|
119
|
-
.command('analyze')
|
|
120
|
-
.description('watch and analyze code quality')
|
|
121
|
-
.option('--type <type>', 'analysis type (quality, deps, security)', 'quality')
|
|
122
|
-
.option('--threshold <threshold>', 'quality threshold')
|
|
123
|
-
.action(async (options) => {
|
|
124
|
-
await this.watchAnalysis(options);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Start watching files or directories
|
|
129
|
-
*/
|
|
130
|
-
async startWatching(patterns, options) {
|
|
131
|
-
try {
|
|
132
|
-
let watchConfig;
|
|
133
|
-
if (options.config) {
|
|
134
|
-
watchConfig = await this.loadWatchConfigFile(options.config);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
watchConfig = this.createWatchConfigFromOptions(patterns, options);
|
|
138
|
-
}
|
|
139
|
-
const watchName = `watch-${Date.now()}`;
|
|
140
|
-
logger_1.logger.info(`Starting watch: ${chalk_1.default.cyan(watchName)}`);
|
|
141
|
-
const watcher = (0, chokidar_1.watch)(watchConfig.patterns, {
|
|
142
|
-
ignored: watchConfig.ignore || [],
|
|
143
|
-
persistent: true,
|
|
144
|
-
ignoreInitial: true,
|
|
145
|
-
awaitWriteFinish: {
|
|
146
|
-
stabilityThreshold: parseInt(options.debounce) || 300,
|
|
147
|
-
pollInterval: 100,
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
// Set up event handlers
|
|
151
|
-
this.setupWatchHandlers(watcher, watchConfig, watchName);
|
|
152
|
-
// Store watcher and config
|
|
153
|
-
this.watchers.set(watchName, watcher);
|
|
154
|
-
this.activeWatches.set(watchName, watchConfig);
|
|
155
|
-
logger_1.logger.success(`Watching ${watchConfig.patterns.join(', ')}`);
|
|
156
|
-
logger_1.logger.info('Press Ctrl+C to stop watching');
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_START_FAILED', 'Failed to start watching', { patterns, options }, true);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Stop watching
|
|
164
|
-
*/
|
|
165
|
-
async stopWatching(name) {
|
|
166
|
-
try {
|
|
167
|
-
if (name) {
|
|
168
|
-
const watcher = this.watchers.get(name);
|
|
169
|
-
if (watcher) {
|
|
170
|
-
await watcher.close();
|
|
171
|
-
this.watchers.delete(name);
|
|
172
|
-
this.activeWatches.delete(name);
|
|
173
|
-
logger_1.logger.success(`Stopped watch: ${name}`);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
logger_1.logger.warn(`Watch not found: ${name}`);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
// Stop all watches
|
|
181
|
-
for (const [watchName, watcher] of this.watchers) {
|
|
182
|
-
await watcher.close();
|
|
183
|
-
logger_1.logger.info(`Stopped watch: ${watchName}`);
|
|
184
|
-
}
|
|
185
|
-
this.watchers.clear();
|
|
186
|
-
this.activeWatches.clear();
|
|
187
|
-
logger_1.logger.success('Stopped all watches');
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
catch (error) {
|
|
191
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_STOP_FAILED', 'Failed to stop watching', { name }, true);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* List active watches
|
|
196
|
-
*/
|
|
197
|
-
async listWatches() {
|
|
198
|
-
try {
|
|
199
|
-
if (this.activeWatches.size === 0) {
|
|
200
|
-
logger_1.logger.info('No active watches');
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
logger_1.logger.info(`Active watches (${this.activeWatches.size}):`);
|
|
204
|
-
const watchData = Array.from(this.activeWatches.entries()).map(([name, config]) => ({
|
|
205
|
-
Name: name,
|
|
206
|
-
Patterns: config.patterns.join(', '),
|
|
207
|
-
Commands: config.commands.length,
|
|
208
|
-
Debounce: `${config.debounce || 300}ms`,
|
|
209
|
-
}));
|
|
210
|
-
console.table(watchData);
|
|
211
|
-
}
|
|
212
|
-
catch (error) {
|
|
213
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_LIST_FAILED', 'Failed to list watches', {}, true);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Show watch status
|
|
218
|
-
*/
|
|
219
|
-
async showWatchStatus(name) {
|
|
220
|
-
try {
|
|
221
|
-
if (name) {
|
|
222
|
-
const config = this.activeWatches.get(name);
|
|
223
|
-
const watcher = this.watchers.get(name);
|
|
224
|
-
if (!config || !watcher) {
|
|
225
|
-
logger_1.logger.warn(`Watch not found: ${name}`);
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
console.log(chalk_1.default.blue(`\nWatch Status: ${name}`));
|
|
229
|
-
console.log(`Patterns: ${config.patterns.join(', ')}`);
|
|
230
|
-
console.log(`Commands: ${config.commands.length}`);
|
|
231
|
-
console.log(`Debounce: ${config.debounce || 300}ms`);
|
|
232
|
-
console.log(`Watched Paths: ${Object.keys(watcher.getWatched()).length}`);
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
console.log(chalk_1.default.blue('\nAll Watches Status:'));
|
|
236
|
-
console.log(`Active Watches: ${this.activeWatches.size}`);
|
|
237
|
-
console.log(`Total Watchers: ${this.watchers.size}`);
|
|
238
|
-
for (const [watchName] of this.activeWatches) {
|
|
239
|
-
await this.showWatchStatus(watchName);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
catch (error) {
|
|
244
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_STATUS_FAILED', 'Failed to show watch status', { name }, true);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Create watch configuration
|
|
249
|
-
*/
|
|
250
|
-
async createWatchConfig(name, options) {
|
|
251
|
-
try {
|
|
252
|
-
let config;
|
|
253
|
-
if (options.interactive) {
|
|
254
|
-
config = await this.createInteractiveWatchConfig();
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
config = {
|
|
258
|
-
patterns: options.patterns ? options.patterns.split(',') : ['**/*'],
|
|
259
|
-
commands: options.commands
|
|
260
|
-
? this.parseWatchCommands(options.commands)
|
|
261
|
-
: [],
|
|
262
|
-
debounce: 300,
|
|
263
|
-
recursive: true,
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
const configPath = path_1.default.join(process.cwd(), '.wundr', 'watch', `${name}.yaml`);
|
|
267
|
-
await fs_extra_1.default.ensureDir(path_1.default.dirname(configPath));
|
|
268
|
-
await fs_extra_1.default.writeFile(configPath, yaml_1.default.stringify(config));
|
|
269
|
-
logger_1.logger.success(`Watch configuration created: ${configPath}`);
|
|
270
|
-
}
|
|
271
|
-
catch (error) {
|
|
272
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_CONFIG_CREATE_FAILED', 'Failed to create watch configuration', { name, options }, true);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Load watch configuration from file
|
|
277
|
-
*/
|
|
278
|
-
async loadWatchConfig(file) {
|
|
279
|
-
try {
|
|
280
|
-
const config = await this.loadWatchConfigFile(file);
|
|
281
|
-
const name = path_1.default.basename(file, path_1.default.extname(file));
|
|
282
|
-
await this.startWatchingWithConfig(name, config);
|
|
283
|
-
logger_1.logger.success(`Loaded watch configuration: ${file}`);
|
|
284
|
-
}
|
|
285
|
-
catch (error) {
|
|
286
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_CONFIG_LOAD_FAILED', 'Failed to load watch configuration', { file }, true);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Save watch configuration to file
|
|
291
|
-
*/
|
|
292
|
-
async saveWatchConfig(name, file) {
|
|
293
|
-
try {
|
|
294
|
-
const config = this.activeWatches.get(name);
|
|
295
|
-
if (!config) {
|
|
296
|
-
throw new Error(`Watch not found: ${name}`);
|
|
297
|
-
}
|
|
298
|
-
const outputPath = file || path_1.default.join(process.cwd(), '.wundr', 'watch', `${name}.yaml`);
|
|
299
|
-
await fs_extra_1.default.ensureDir(path_1.default.dirname(outputPath));
|
|
300
|
-
await fs_extra_1.default.writeFile(outputPath, yaml_1.default.stringify(config));
|
|
301
|
-
logger_1.logger.success(`Watch configuration saved: ${outputPath}`);
|
|
302
|
-
}
|
|
303
|
-
catch (error) {
|
|
304
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_CONFIG_SAVE_FAILED', 'Failed to save watch configuration', { name, file }, true);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Watch tests
|
|
309
|
-
*/
|
|
310
|
-
async watchTests(options) {
|
|
311
|
-
try {
|
|
312
|
-
logger_1.logger.info('Starting test watcher...');
|
|
313
|
-
const testPatterns = this.getTestPatterns(options.framework);
|
|
314
|
-
const watchConfig = {
|
|
315
|
-
patterns: testPatterns,
|
|
316
|
-
commands: [
|
|
317
|
-
{
|
|
318
|
-
trigger: 'change',
|
|
319
|
-
command: this.getTestCommand(options.framework, options),
|
|
320
|
-
condition: 'test-files',
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
debounce: 1000,
|
|
324
|
-
};
|
|
325
|
-
await this.startWatchingWithConfig('test-watch', watchConfig);
|
|
326
|
-
}
|
|
327
|
-
catch (error) {
|
|
328
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_TEST_FAILED', 'Failed to start test watcher', { options }, true);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Watch build
|
|
333
|
-
*/
|
|
334
|
-
async watchBuild(options) {
|
|
335
|
-
try {
|
|
336
|
-
logger_1.logger.info('Starting build watcher...');
|
|
337
|
-
const buildPatterns = ['src/**/*', 'lib/**/*', '*.config.*'];
|
|
338
|
-
const watchConfig = {
|
|
339
|
-
patterns: buildPatterns,
|
|
340
|
-
commands: [
|
|
341
|
-
{
|
|
342
|
-
trigger: 'change',
|
|
343
|
-
command: this.getBuildCommand(options),
|
|
344
|
-
condition: 'source-files',
|
|
345
|
-
},
|
|
346
|
-
],
|
|
347
|
-
debounce: 500,
|
|
348
|
-
};
|
|
349
|
-
await this.startWatchingWithConfig('build-watch', watchConfig);
|
|
350
|
-
}
|
|
351
|
-
catch (error) {
|
|
352
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_BUILD_FAILED', 'Failed to start build watcher', { options }, true);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Watch lint
|
|
357
|
-
*/
|
|
358
|
-
async watchLint(options) {
|
|
359
|
-
try {
|
|
360
|
-
logger_1.logger.info('Starting lint watcher...');
|
|
361
|
-
const lintPatterns = ['**/*.{ts,tsx,js,jsx}', '!node_modules/**'];
|
|
362
|
-
const watchConfig = {
|
|
363
|
-
patterns: lintPatterns,
|
|
364
|
-
commands: [
|
|
365
|
-
{
|
|
366
|
-
trigger: 'change',
|
|
367
|
-
command: this.getLintCommand(options),
|
|
368
|
-
condition: 'lint-files',
|
|
369
|
-
},
|
|
370
|
-
],
|
|
371
|
-
debounce: 300,
|
|
372
|
-
};
|
|
373
|
-
await this.startWatchingWithConfig('lint-watch', watchConfig);
|
|
374
|
-
}
|
|
375
|
-
catch (error) {
|
|
376
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_LINT_FAILED', 'Failed to start lint watcher', { options }, true);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Watch analysis
|
|
381
|
-
*/
|
|
382
|
-
async watchAnalysis(options) {
|
|
383
|
-
try {
|
|
384
|
-
logger_1.logger.info(`Starting ${options.type} analysis watcher...`);
|
|
385
|
-
const analysisPatterns = ['src/**/*', 'lib/**/*'];
|
|
386
|
-
const watchConfig = {
|
|
387
|
-
patterns: analysisPatterns,
|
|
388
|
-
commands: [
|
|
389
|
-
{
|
|
390
|
-
trigger: 'change',
|
|
391
|
-
command: this.getAnalysisCommand(options),
|
|
392
|
-
condition: 'analysis-files',
|
|
393
|
-
},
|
|
394
|
-
],
|
|
395
|
-
debounce: 2000,
|
|
396
|
-
};
|
|
397
|
-
await this.startWatchingWithConfig('analysis-watch', watchConfig);
|
|
398
|
-
}
|
|
399
|
-
catch (error) {
|
|
400
|
-
throw error_handler_1.errorHandler.createError('WUNDR_WATCH_ANALYSIS_FAILED', 'Failed to start analysis watcher', { options }, true);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Helper methods
|
|
405
|
-
*/
|
|
406
|
-
setupWatchHandlers(watcher, config, name) {
|
|
407
|
-
const executeCommands = async (eventType, filePath) => {
|
|
408
|
-
const relevantCommands = config.commands.filter(cmd => cmd.trigger === eventType || cmd.trigger === 'change');
|
|
409
|
-
for (const cmd of relevantCommands) {
|
|
410
|
-
if (this.shouldExecuteCommand(cmd, filePath)) {
|
|
411
|
-
await this.executeWatchCommand(cmd, filePath);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
watcher.on('add', filePath => {
|
|
416
|
-
logger_1.logger.debug(`File added: ${filePath}`);
|
|
417
|
-
executeCommands('add', filePath);
|
|
418
|
-
});
|
|
419
|
-
watcher.on('change', filePath => {
|
|
420
|
-
logger_1.logger.debug(`File changed: ${filePath}`);
|
|
421
|
-
executeCommands('change', filePath);
|
|
422
|
-
});
|
|
423
|
-
watcher.on('unlink', filePath => {
|
|
424
|
-
logger_1.logger.debug(`File deleted: ${filePath}`);
|
|
425
|
-
executeCommands('delete', filePath);
|
|
426
|
-
});
|
|
427
|
-
watcher.on('error', error => {
|
|
428
|
-
logger_1.logger.error(`Watch error in ${name}:`, error);
|
|
429
|
-
});
|
|
430
|
-
watcher.on('ready', () => {
|
|
431
|
-
logger_1.logger.debug(`Watch ready: ${name}`);
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
shouldExecuteCommand(cmd, filePath) {
|
|
435
|
-
if (!cmd.condition) {
|
|
436
|
-
return true;
|
|
437
|
-
}
|
|
438
|
-
// Implement condition checking logic
|
|
439
|
-
switch (cmd.condition) {
|
|
440
|
-
case 'test-files':
|
|
441
|
-
return filePath.includes('.test.') || filePath.includes('.spec.');
|
|
442
|
-
case 'source-files':
|
|
443
|
-
return !filePath.includes('.test.') && !filePath.includes('.spec.');
|
|
444
|
-
case 'lint-files':
|
|
445
|
-
return /\.(ts|tsx|js|jsx)$/.test(filePath);
|
|
446
|
-
case 'analysis-files':
|
|
447
|
-
return /\.(ts|tsx|js|jsx)$/.test(filePath);
|
|
448
|
-
default:
|
|
449
|
-
return true;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
async executeWatchCommand(cmd, filePath) {
|
|
453
|
-
try {
|
|
454
|
-
logger_1.logger.info(`Executing: ${cmd.command}`);
|
|
455
|
-
// Replace placeholders in command
|
|
456
|
-
const command = cmd.command.replace('{{file}}', filePath);
|
|
457
|
-
// Execute command
|
|
458
|
-
const { spawn } = await Promise.resolve().then(() => tslib_1.__importStar(require('child_process')));
|
|
459
|
-
const [cmdName, ...args] = command.split(' ');
|
|
460
|
-
if (!cmdName) {
|
|
461
|
-
logger_1.logger.error('Invalid command: empty command string');
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
const child = spawn(cmdName, args, {
|
|
465
|
-
stdio: 'inherit',
|
|
466
|
-
shell: true,
|
|
467
|
-
});
|
|
468
|
-
child.on('exit', code => {
|
|
469
|
-
if (code === 0) {
|
|
470
|
-
logger_1.logger.success(`Command completed: ${cmd.command}`);
|
|
471
|
-
}
|
|
472
|
-
else {
|
|
473
|
-
logger_1.logger.error(`Command failed with exit code ${code}: ${cmd.command}`);
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
catch (error) {
|
|
478
|
-
logger_1.logger.error(`Failed to execute command: ${cmd.command}`, error);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
createWatchConfigFromOptions(patterns, options) {
|
|
482
|
-
return {
|
|
483
|
-
patterns: patterns.length > 0 ? patterns : ['**/*'],
|
|
484
|
-
ignore: options.ignore ? options.ignore.split(',') : [],
|
|
485
|
-
commands: options.command
|
|
486
|
-
? [
|
|
487
|
-
{
|
|
488
|
-
trigger: 'change',
|
|
489
|
-
command: options.command,
|
|
490
|
-
},
|
|
491
|
-
]
|
|
492
|
-
: [],
|
|
493
|
-
debounce: parseInt(options.debounce) || 300,
|
|
494
|
-
recursive: options.recursive || true,
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
async loadWatchConfigFile(file) {
|
|
498
|
-
if (!(await fs_extra_1.default.pathExists(file))) {
|
|
499
|
-
throw new Error(`Configuration file not found: ${file}`);
|
|
500
|
-
}
|
|
501
|
-
const content = await fs_extra_1.default.readFile(file, 'utf8');
|
|
502
|
-
const ext = path_1.default.extname(file).toLowerCase();
|
|
503
|
-
if (ext === '.yaml' || ext === '.yml') {
|
|
504
|
-
return yaml_1.default.parse(content);
|
|
505
|
-
}
|
|
506
|
-
else if (ext === '.json') {
|
|
507
|
-
return JSON.parse(content);
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
throw new Error(`Unsupported configuration format: ${ext}`);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
async startWatchingWithConfig(name, config) {
|
|
514
|
-
const watcher = (0, chokidar_1.watch)(config.patterns, {
|
|
515
|
-
ignored: config.ignore || [],
|
|
516
|
-
persistent: true,
|
|
517
|
-
ignoreInitial: true,
|
|
518
|
-
awaitWriteFinish: {
|
|
519
|
-
stabilityThreshold: config.debounce || 300,
|
|
520
|
-
pollInterval: 100,
|
|
521
|
-
},
|
|
522
|
-
});
|
|
523
|
-
this.setupWatchHandlers(watcher, config, name);
|
|
524
|
-
this.watchers.set(name, watcher);
|
|
525
|
-
this.activeWatches.set(name, config);
|
|
526
|
-
logger_1.logger.success(`Started watch: ${name}`);
|
|
527
|
-
}
|
|
528
|
-
async createInteractiveWatchConfig() {
|
|
529
|
-
const inquirer = await Promise.resolve().then(() => tslib_1.__importStar(require('inquirer')));
|
|
530
|
-
const answers = await inquirer.default.prompt([
|
|
531
|
-
{
|
|
532
|
-
type: 'input',
|
|
533
|
-
name: 'patterns',
|
|
534
|
-
message: 'File patterns to watch (comma-separated):',
|
|
535
|
-
default: '**/*',
|
|
536
|
-
},
|
|
537
|
-
{
|
|
538
|
-
type: 'input',
|
|
539
|
-
name: 'ignore',
|
|
540
|
-
message: 'Patterns to ignore (comma-separated):',
|
|
541
|
-
default: 'node_modules/**,dist/**',
|
|
542
|
-
},
|
|
543
|
-
{
|
|
544
|
-
type: 'input',
|
|
545
|
-
name: 'command',
|
|
546
|
-
message: 'Command to run on changes:',
|
|
547
|
-
validate: input => input.length > 0 || 'Command is required',
|
|
548
|
-
},
|
|
549
|
-
{
|
|
550
|
-
type: 'number',
|
|
551
|
-
name: 'debounce',
|
|
552
|
-
message: 'Debounce delay (ms):',
|
|
553
|
-
default: 300,
|
|
554
|
-
},
|
|
555
|
-
]);
|
|
556
|
-
return {
|
|
557
|
-
patterns: answers.patterns.split(',').map(p => p.trim()),
|
|
558
|
-
ignore: answers.ignore.split(',').map(p => p.trim()),
|
|
559
|
-
commands: [
|
|
560
|
-
{
|
|
561
|
-
trigger: 'change',
|
|
562
|
-
command: answers.command,
|
|
563
|
-
},
|
|
564
|
-
],
|
|
565
|
-
debounce: answers.debounce,
|
|
566
|
-
recursive: true,
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
|
-
parseWatchCommands(commandsStr) {
|
|
570
|
-
return commandsStr.split(',').map(cmd => ({
|
|
571
|
-
trigger: 'change',
|
|
572
|
-
command: cmd.trim(),
|
|
573
|
-
}));
|
|
574
|
-
}
|
|
575
|
-
getTestPatterns(framework) {
|
|
576
|
-
switch (framework) {
|
|
577
|
-
case 'jest':
|
|
578
|
-
return ['**/*.{test,spec}.{js,jsx,ts,tsx}', 'src/**/*'];
|
|
579
|
-
case 'mocha':
|
|
580
|
-
return ['test/**/*.js', 'src/**/*'];
|
|
581
|
-
case 'vitest':
|
|
582
|
-
return ['**/*.{test,spec}.{js,ts}', 'src/**/*'];
|
|
583
|
-
default:
|
|
584
|
-
return ['**/*.{test,spec}.*', 'src/**/*'];
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
getTestCommand(framework, options) {
|
|
588
|
-
const baseCmd = framework === 'npm' ? 'npm test' : `npx ${framework}`;
|
|
589
|
-
const flags = [];
|
|
590
|
-
if (options.coverage) {
|
|
591
|
-
flags.push('--coverage');
|
|
592
|
-
}
|
|
593
|
-
if (options.changedOnly) {
|
|
594
|
-
flags.push('--changedSince=HEAD');
|
|
595
|
-
}
|
|
596
|
-
return `${baseCmd} ${flags.join(' ')}`;
|
|
597
|
-
}
|
|
598
|
-
getBuildCommand(options) {
|
|
599
|
-
const cmd = options.target
|
|
600
|
-
? `npm run build:${options.target}`
|
|
601
|
-
: 'npm run build';
|
|
602
|
-
return options.incremental ? `${cmd} --incremental` : cmd;
|
|
603
|
-
}
|
|
604
|
-
getLintCommand(options) {
|
|
605
|
-
const cmd = 'npx eslint {{file}}';
|
|
606
|
-
return options.fix ? `${cmd} --fix` : cmd;
|
|
607
|
-
}
|
|
608
|
-
getAnalysisCommand(options) {
|
|
609
|
-
return `wundr analyze ${options.type}`;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
exports.WatchCommands = WatchCommands;
|
|
613
|
-
//# sourceMappingURL=watch.js.map
|