@mudah-cli/mudah 0.8.0 → 0.9.2
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/LICENSE +21 -0
- package/README.md +70 -0
- package/dist/autocomplete.d.ts +8 -0
- package/dist/autocomplete.js +38 -0
- package/dist/autocomplete.js.map +1 -0
- package/dist/built-ins.d.ts +9 -0
- package/dist/built-ins.js +144 -0
- package/dist/built-ins.js.map +1 -0
- package/dist/commands/autocomplete.command.d.ts +11 -0
- package/dist/commands/autocomplete.command.js +16 -0
- package/dist/commands/autocomplete.command.js.map +1 -0
- package/dist/commands/build.command.d.ts +1 -0
- package/dist/commands/build.command.js +2 -1
- package/dist/commands/build.command.js.map +1 -1
- package/dist/commands/cache.command.d.ts +11 -0
- package/dist/commands/cache.command.js +47 -0
- package/dist/commands/cache.command.js.map +1 -0
- package/dist/commands/complete.command.d.ts +13 -0
- package/dist/commands/complete.command.js +23 -0
- package/dist/commands/complete.command.js.map +1 -0
- package/dist/commands/config.diff.command.d.ts +8 -0
- package/dist/commands/config.diff.command.js +96 -0
- package/dist/commands/config.diff.command.js.map +1 -0
- package/dist/commands/config.set.command.d.ts +8 -0
- package/dist/commands/config.set.command.js +66 -0
- package/dist/commands/config.set.command.js.map +1 -0
- package/dist/commands/config.show.command.d.ts +8 -0
- package/dist/commands/config.show.command.js +38 -0
- package/dist/commands/config.show.command.js.map +1 -0
- package/dist/commands/config.source.command.d.ts +8 -0
- package/dist/commands/config.source.command.js +42 -0
- package/dist/commands/config.source.command.js.map +1 -0
- package/dist/commands/config.validate.command.d.ts +14 -0
- package/dist/commands/config.validate.command.js +63 -0
- package/dist/commands/config.validate.command.js.map +1 -0
- package/dist/commands/dev.command.d.ts +1 -0
- package/dist/commands/dev.command.js +1 -0
- package/dist/commands/dev.command.js.map +1 -1
- package/dist/commands/docs.widgets.command.d.ts +11 -0
- package/dist/commands/docs.widgets.command.js +17 -0
- package/dist/commands/docs.widgets.command.js.map +1 -0
- package/dist/commands/doctor.command.d.ts +1 -0
- package/dist/commands/doctor.command.js +45 -11
- package/dist/commands/doctor.command.js.map +1 -1
- package/dist/commands/gallery.command.d.ts +11 -0
- package/dist/commands/gallery.command.js +84 -0
- package/dist/commands/gallery.command.js.map +1 -0
- package/dist/commands/graph.command.d.ts +10 -0
- package/dist/commands/graph.command.js +21 -0
- package/dist/commands/graph.command.js.map +1 -0
- package/dist/commands/help.command.d.ts +1 -0
- package/dist/commands/help.command.js +2 -2
- package/dist/commands/help.command.js.map +1 -1
- package/dist/commands/info.command.d.ts +8 -0
- package/dist/commands/info.command.js +61 -0
- package/dist/commands/info.command.js.map +1 -0
- package/dist/commands/lsp.command.d.ts +12 -0
- package/dist/commands/lsp.command.js +57 -0
- package/dist/commands/lsp.command.js.map +1 -0
- package/dist/commands/make.command.d.ts +5 -0
- package/dist/commands/make.command.js +270 -48
- package/dist/commands/make.command.js.map +1 -1
- package/dist/commands/plugins.list.command.d.ts +12 -0
- package/dist/commands/plugins.list.command.js +29 -0
- package/dist/commands/plugins.list.command.js.map +1 -0
- package/dist/commands/plugins.update.command.d.ts +29 -0
- package/dist/commands/plugins.update.command.js +78 -0
- package/dist/commands/plugins.update.command.js.map +1 -0
- package/dist/commands/plugins.watch.command.d.ts +10 -0
- package/dist/commands/plugins.watch.command.js +37 -0
- package/dist/commands/plugins.watch.command.js.map +1 -0
- package/dist/commands/replay.command.d.ts +10 -0
- package/dist/commands/replay.command.js +50 -0
- package/dist/commands/replay.command.js.map +1 -0
- package/dist/commands/telemetry.command.d.ts +12 -0
- package/dist/commands/telemetry.command.js +55 -0
- package/dist/commands/telemetry.command.js.map +1 -0
- package/dist/commands/test.command.d.ts +13 -0
- package/dist/commands/test.command.js +83 -0
- package/dist/commands/test.command.js.map +1 -0
- package/dist/commands/tutorial.command.d.ts +12 -0
- package/dist/commands/tutorial.command.js +57 -0
- package/dist/commands/tutorial.command.js.map +1 -0
- package/dist/commands/version.command.d.ts +1 -0
- package/dist/commands/version.command.js +1 -0
- package/dist/commands/version.command.js.map +1 -1
- package/dist/commands/watch.command.d.ts +13 -0
- package/dist/commands/watch.command.js +62 -0
- package/dist/commands/watch.command.js.map +1 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/lsp.d.ts +147 -0
- package/dist/lsp.js +506 -0
- package/dist/lsp.js.map +1 -0
- package/dist/run.d.ts +4 -2
- package/dist/run.js +355 -38
- package/dist/run.js.map +1 -1
- package/dist/watcher.d.ts +20 -1
- package/dist/watcher.js +41 -4
- package/dist/watcher.js.map +1 -1
- package/package.json +27 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make.command.js","sourceRoot":"","sources":["../../src/commands/make.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACnE,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,KAAK,CAAC,IAAI,CAAC;SACf,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3D,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,MAAM,
|
|
1
|
+
{"version":3,"file":"make.command.js","sourceRoot":"","sources":["../../src/commands/make.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAA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AE,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,MAAM,SAAS,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,MAAM,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `plugins:list` — discovered plugins and how many providers each
|
|
4
|
+
* registered. Alias: `plugins`.
|
|
5
|
+
*/
|
|
6
|
+
export default class PluginsListCommand extends Command {
|
|
7
|
+
signature: string;
|
|
8
|
+
description: string;
|
|
9
|
+
descriptionKey: string;
|
|
10
|
+
aliases: string[];
|
|
11
|
+
handle(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
import { t } from '@mudah-cli/core';
|
|
3
|
+
/**
|
|
4
|
+
* Built-in `plugins:list` — discovered plugins and how many providers each
|
|
5
|
+
* registered. Alias: `plugins`.
|
|
6
|
+
*/
|
|
7
|
+
export default class PluginsListCommand extends Command {
|
|
8
|
+
signature = 'plugins:list';
|
|
9
|
+
description = 'List discovered plugins';
|
|
10
|
+
descriptionKey = 'cmd.plugins.list.description';
|
|
11
|
+
aliases = ['plugins'];
|
|
12
|
+
async handle() {
|
|
13
|
+
const plugins = pluginsOf(this.app);
|
|
14
|
+
if (plugins.length === 0) {
|
|
15
|
+
this.output.info(t('plugins.none'));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
this.output.section('Plugins');
|
|
19
|
+
for (const plugin of plugins) {
|
|
20
|
+
this.output.keyValue(plugin.name, `${plugin.providers.length} provider(s)`);
|
|
21
|
+
}
|
|
22
|
+
this.output.line();
|
|
23
|
+
this.output.success(t('plugins.listed', { count: plugins.length }));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function pluginsOf(app) {
|
|
27
|
+
return typeof app.plugins === 'function' ? app.plugins() : [];
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=plugins.list.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.list.command.js","sourceRoot":"","sources":["../../src/commands/plugins.list.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAmB,CAAC,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,OAAO;IACrD,SAAS,GAAG,cAAc,CAAC;IAC3B,WAAW,GAAG,yBAAyB,CAAC;IACxC,cAAc,GAAG,8BAA8B,CAAC;IAChD,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC;IAEtB,KAAK,CAAC,MAAM;QACV,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;YACpC,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC/B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,cAAc,CAAC,CAAC;QAC9E,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC;CACF;AAED,SAAS,SAAS,CAAC,GAA8C;IAC/D,OAAO,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
export interface RegistryLatest {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly version: string;
|
|
5
|
+
}
|
|
6
|
+
export type PluginUpdateSpawn = (command: string, args: readonly string[], options: {
|
|
7
|
+
cwd: string;
|
|
8
|
+
encoding: 'utf8';
|
|
9
|
+
}) => {
|
|
10
|
+
status: number | null;
|
|
11
|
+
stdout: string;
|
|
12
|
+
stderr: string;
|
|
13
|
+
error?: Error;
|
|
14
|
+
};
|
|
15
|
+
export declare function fetchLatestVersion(name: string, doFetch?: typeof fetch): Promise<string | undefined>;
|
|
16
|
+
export declare function applyPluginUpdate(name: string, cwd: string, spawn?: PluginUpdateSpawn): {
|
|
17
|
+
ok: boolean;
|
|
18
|
+
detail: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Built-in `plugins:update` — compare installed plugin versions to the npm
|
|
22
|
+
* registry. `--apply` runs `npm install name@latest` for each outdated plugin.
|
|
23
|
+
*/
|
|
24
|
+
export default class PluginsUpdateCommand extends Command {
|
|
25
|
+
signature: string;
|
|
26
|
+
description: string;
|
|
27
|
+
descriptionKey: string;
|
|
28
|
+
handle(): Promise<0 | 1>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { Command } from '@mudah-cli/console';
|
|
3
|
+
import { t } from '@mudah-cli/core';
|
|
4
|
+
export async function fetchLatestVersion(name, doFetch = fetch) {
|
|
5
|
+
const url = `https://registry.npmjs.org/${encodeURIComponent(name)}/latest`;
|
|
6
|
+
try {
|
|
7
|
+
const response = await doFetch(url, { headers: { accept: 'application/json' } });
|
|
8
|
+
if (!response.ok)
|
|
9
|
+
return undefined;
|
|
10
|
+
const body = (await response.json());
|
|
11
|
+
return typeof body.version === 'string' ? body.version : undefined;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function applyPluginUpdate(name, cwd, spawn = (command, args, options) => spawnSync(command, [...args], options)) {
|
|
18
|
+
const result = spawn('npm', ['install', `${name}@latest`], { cwd, encoding: 'utf8' });
|
|
19
|
+
if (result.error)
|
|
20
|
+
return { ok: false, detail: result.error.message };
|
|
21
|
+
if (result.status !== 0) {
|
|
22
|
+
return {
|
|
23
|
+
ok: false,
|
|
24
|
+
detail: (result.stderr || result.stdout || `npm exit ${String(result.status)}`).trim(),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return { ok: true, detail: 'installed' };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Built-in `plugins:update` — compare installed plugin versions to the npm
|
|
31
|
+
* registry. `--apply` runs `npm install name@latest` for each outdated plugin.
|
|
32
|
+
*/
|
|
33
|
+
export default class PluginsUpdateCommand extends Command {
|
|
34
|
+
signature = 'plugins:update [--apply]';
|
|
35
|
+
description = 'Check the npm registry for plugin updates and optionally install them';
|
|
36
|
+
descriptionKey = 'cmd.plugins.update.description';
|
|
37
|
+
async handle() {
|
|
38
|
+
const plugins = await this.app.reloadPlugins();
|
|
39
|
+
const doFetch = this.app.has('plugins.fetch') ? this.app.make('plugins.fetch') : fetch;
|
|
40
|
+
const spawn = this.app.has('plugins.spawn')
|
|
41
|
+
? this.app.make('plugins.spawn')
|
|
42
|
+
: (command, args, options) => spawnSync(command, [...args], options);
|
|
43
|
+
const apply = this.option('apply') === true;
|
|
44
|
+
let outdated = 0;
|
|
45
|
+
let failed = 0;
|
|
46
|
+
this.output.section('Plugins');
|
|
47
|
+
for (const plugin of plugins) {
|
|
48
|
+
const latest = await fetchLatestVersion(plugin.name, doFetch);
|
|
49
|
+
const current = plugin.version ?? 'unknown';
|
|
50
|
+
if (latest !== undefined && current !== 'unknown' && latest !== current) {
|
|
51
|
+
this.output.warn(`${plugin.name} ${current} → ${latest}`);
|
|
52
|
+
outdated += 1;
|
|
53
|
+
if (apply) {
|
|
54
|
+
const result = applyPluginUpdate(plugin.name, this.app.basePath, spawn);
|
|
55
|
+
if (result.ok)
|
|
56
|
+
this.output.success(`${plugin.name} installed ${latest}`);
|
|
57
|
+
else {
|
|
58
|
+
this.output.error(`${plugin.name} ${result.detail}`);
|
|
59
|
+
failed += 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this.output.keyValue(plugin.name, latest ?? current);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (outdated === 0)
|
|
68
|
+
this.output.success(t('plugins.upToDate'));
|
|
69
|
+
else if (!apply)
|
|
70
|
+
this.output.warn(`${outdated} plugin(s) have a newer version on npm. Pass --apply to install.`);
|
|
71
|
+
this.output.keyValue('plugins', String(plugins.length));
|
|
72
|
+
for (const warning of this.app.pluginWarnings()) {
|
|
73
|
+
this.output.warn(warning);
|
|
74
|
+
}
|
|
75
|
+
return failed > 0 ? 1 : 0;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=plugins.update.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.update.command.js","sourceR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C;aAC1D,IAAI,CAAC,KAAK;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,kEAAkE,CAAC,CAAC;QAClG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QACxD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC;YAChD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `plugins:watch` — re-import providers when `node_modules` changes.
|
|
4
|
+
*/
|
|
5
|
+
export default class PluginsWatchCommand extends Command {
|
|
6
|
+
signature: string;
|
|
7
|
+
description: string;
|
|
8
|
+
descriptionKey: string;
|
|
9
|
+
handle(): Promise<number>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { Command } from '@mudah-cli/console';
|
|
3
|
+
import { t } from '@mudah-cli/core';
|
|
4
|
+
import { hotReloadPlugins } from '../watcher.js';
|
|
5
|
+
/**
|
|
6
|
+
* Built-in `plugins:watch` — re-import providers when `node_modules` changes.
|
|
7
|
+
*/
|
|
8
|
+
export default class PluginsWatchCommand extends Command {
|
|
9
|
+
signature = 'plugins:watch [--debounce=] [--once]';
|
|
10
|
+
description = 'Watch node_modules and reload plugin providers';
|
|
11
|
+
descriptionKey = 'cmd.plugins.watch.description';
|
|
12
|
+
async handle() {
|
|
13
|
+
const debounce = Number(this.option('debounce') ?? 200) || 200;
|
|
14
|
+
const dir = join(this.app.basePath, 'node_modules');
|
|
15
|
+
this.output.section('Plugin watch');
|
|
16
|
+
this.output.keyValue('dir', dir);
|
|
17
|
+
this.output.keyValue('debounce', `${debounce}ms`);
|
|
18
|
+
const plugins = await this.app.reloadPlugins();
|
|
19
|
+
this.output.muted(`reloaded ${plugins.length} plugin(s)`);
|
|
20
|
+
if (this.option('once') === true || process.stdin.isTTY !== true) {
|
|
21
|
+
this.output.success(t('plugins.reloaded'));
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
const stop = hotReloadPlugins(this.app, () => {
|
|
25
|
+
this.output.muted('change detected — reloading plugins…');
|
|
26
|
+
}, { debounceMs: debounce, dir });
|
|
27
|
+
this.output.muted('watching for plugin changes (ctrl+c to stop)');
|
|
28
|
+
await new Promise((resolve) => {
|
|
29
|
+
process.once('SIGINT', () => {
|
|
30
|
+
stop();
|
|
31
|
+
resolve();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=plugins.watch.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.watch.command.js","sourceRoot":"","sources":["../../src/commands/plugins.watch.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,OAAO;IACtD,SAAS,GAAG,sCAAsC,CAAC;IACnD,WAAW,GAAG,gDAAgD,CAAC;IAC/D,cAAc,GAAG,+BAA+B,CAAC;IAEjD,KAAK,CAAC,MAAM;QACV,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IA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AAC,CAAC;IACX,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `replay` command: print or apply a structured session tape.
|
|
4
|
+
*/
|
|
5
|
+
export default class ReplayCommand extends Command {
|
|
6
|
+
signature: string;
|
|
7
|
+
description: string;
|
|
8
|
+
descriptionKey: string;
|
|
9
|
+
handle(): Promise<number>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { Command } from '@mudah-cli/console';
|
|
3
|
+
/**
|
|
4
|
+
* Built-in `replay` command: print or apply a structured session tape.
|
|
5
|
+
*/
|
|
6
|
+
export default class ReplayCommand extends Command {
|
|
7
|
+
signature = 'replay {file?} [--play] [--speed=]';
|
|
8
|
+
description = 'Replay a structured TUI session JSON file';
|
|
9
|
+
descriptionKey = 'cmd.replay.description';
|
|
10
|
+
async handle() {
|
|
11
|
+
const file = this.arg('file');
|
|
12
|
+
if (file === undefined) {
|
|
13
|
+
this.output.info('Usage: replay {file} [--play]');
|
|
14
|
+
this.output.muted('JSON { version, events: [{ type, t?, key?, text? }] } or a bare event array');
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
const { parseSessionTape, replayTapeAsync, Column, Label } = await import('@mudah-cli/tui');
|
|
18
|
+
let tape;
|
|
19
|
+
try {
|
|
20
|
+
tape = parseSessionTape(JSON.parse(await readFile(file, 'utf8')));
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
24
|
+
throw this.usageError(`Cannot read session file "${file}".`, message);
|
|
25
|
+
}
|
|
26
|
+
this.output.section(`Replay ${file}`);
|
|
27
|
+
this.output.keyValue('events', String(tape.events.length));
|
|
28
|
+
this.output.keyValue('recorded', tape.recordedAt);
|
|
29
|
+
for (const [i, event] of tape.events.entries()) {
|
|
30
|
+
const extra = event.key ?? event.text ?? `${event.x ?? 0},${event.y ?? 0}`;
|
|
31
|
+
this.output.raw(` ${i + 1}. +${event.t ?? 0}ms ${event.type} ${extra}\n`);
|
|
32
|
+
}
|
|
33
|
+
if (this.option('play') === true) {
|
|
34
|
+
const { TestTui } = await import('@mudah-cli/testing');
|
|
35
|
+
const target = this.app.has('replay.target')
|
|
36
|
+
? this.app.make('replay.target')
|
|
37
|
+
: TestTui.mount(new Column().add(new Label('replay')), {
|
|
38
|
+
cols: tape.cols ?? 80,
|
|
39
|
+
rows: tape.rows ?? 24,
|
|
40
|
+
});
|
|
41
|
+
await replayTapeAsync(target, tape, { speed: Number(this.option('speed') ?? 1) || 1 });
|
|
42
|
+
if ('snapshot' in target && typeof target.snapshot === 'function') {
|
|
43
|
+
this.output.raw(`${target.snapshot()}\n`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
this.output.success('replay complete');
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=replay.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay.command.js","sourceRoot":"","sources":["../../src/commands/replay.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IAChD,SAAS,GAAG,oCAAoC,CAAC;IACjD,WAAW,GAAG,2CAA2C,CAAC;IAC1D,cAAc,GAAG,wBAAwB,CAAC;IAE1C,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;YAClD,IAAI,C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` (see `telemetry: true` in `mudah.json`), or clear
|
|
5
|
+
* the log. Under `--json` the summary is emitted as a data payload.
|
|
6
|
+
*/
|
|
7
|
+
export default class TelemetryCommand extends Command {
|
|
8
|
+
signature: string;
|
|
9
|
+
description: string;
|
|
10
|
+
descriptionKey: string;
|
|
11
|
+
handle(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { Command } from '@mudah-cli/console';
|
|
4
|
+
import { clearTelemetryLog, readTelemetryLog, TELEMETRY_FILE, t } from '@mudah-cli/core';
|
|
5
|
+
/**
|
|
6
|
+
* Built-in `telemetry` — summarize the events written to
|
|
7
|
+
* `.mudah/telemetry.jsonl` (see `telemetry: true` in `mudah.json`), or clear
|
|
8
|
+
* the log. Under `--json` the summary is emitted as a data payload.
|
|
9
|
+
*/
|
|
10
|
+
export default class TelemetryCommand extends Command {
|
|
11
|
+
signature = 'telemetry [--clear]';
|
|
12
|
+
description = 'Summarize or clear the local telemetry log';
|
|
13
|
+
descriptionKey = 'cmd.telemetry.description';
|
|
14
|
+
async handle() {
|
|
15
|
+
const file = join(this.app.basePath, TELEMETRY_FILE);
|
|
16
|
+
if (this.option('clear') === true) {
|
|
17
|
+
const removed = clearTelemetryLog(file);
|
|
18
|
+
this.output.success(removed ? `Cleared ${file}` : t('telemetry.empty'));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!existsSync(file)) {
|
|
22
|
+
this.output.info(t('telemetry.absent'));
|
|
23
|
+
this.output.hint('Set "telemetry": true in mudah.json (or MUDAH_TELEMETRY=1) and run a command.');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const summary = readTelemetryLog(file);
|
|
27
|
+
if (this.output.isMachineReadable) {
|
|
28
|
+
this.output.emit('data', 'telemetry', summary);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (summary.events === 0) {
|
|
32
|
+
this.output.info(t('telemetry.empty'));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this.output.section('Telemetry');
|
|
36
|
+
this.output.keyValue('file', file);
|
|
37
|
+
this.output.keyValue('events', String(summary.events));
|
|
38
|
+
this.output.keyValue('span', `${summary.spanMs}ms`);
|
|
39
|
+
this.output.line();
|
|
40
|
+
this.output.table([
|
|
41
|
+
{ header: 'name', align: 'left' },
|
|
42
|
+
{ header: 'count', align: 'right' },
|
|
43
|
+
{ header: 'total', align: 'right' },
|
|
44
|
+
{ header: 'max', align: 'right' },
|
|
45
|
+
{ header: 'mean', align: 'right' },
|
|
46
|
+
], summary.rows.map((row) => [
|
|
47
|
+
row.name,
|
|
48
|
+
String(row.count),
|
|
49
|
+
`${row.totalMs}ms`,
|
|
50
|
+
`${row.maxMs}ms`,
|
|
51
|
+
`${row.meanMs}ms`,
|
|
52
|
+
]));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=telemetry.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.command.js","sourceRoot":"","sources":["../../src/commands/telemetry.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AAEzF;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,OAAO;IACnD,SAAS,GAAG,qBAAqB,CAAC;IAClC,WAAW,GAAG,4CAA4C,CAAC;IAC3D,cAAc,GAAG,2BAA2B,CAAC;IAE7C,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CA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,MAAM,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,KAAK,CACf;YACE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;YACjC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;YACnC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;YACnC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE;YACjC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE;SACnC,EACD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;YACxB,GAAG,CAAC,IAAI;YACR,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;YACjB,GAAG,GAAG,CAAC,OAAO,IAAI;YAClB,GAAG,GAAG,CAAC,KAAK,IAAI;YAChB,GAAG,GAAG,CAAC,MAAM,IAAI;SAClB,CAAC,CACH,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `test` command: spawn vitest, or list matching `*.test.ts` files.
|
|
4
|
+
*/
|
|
5
|
+
export default class TestCommand extends Command {
|
|
6
|
+
signature: string;
|
|
7
|
+
description: string;
|
|
8
|
+
descriptionKey: string;
|
|
9
|
+
static exitCodes: {
|
|
10
|
+
1: string;
|
|
11
|
+
};
|
|
12
|
+
handle(): Promise<number>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { readdir } from 'node:fs/promises';
|
|
3
|
+
import { join, relative } from 'node:path';
|
|
4
|
+
import { Command } from '@mudah-cli/console';
|
|
5
|
+
async function walkTests(dir, pattern, acc) {
|
|
6
|
+
let entries;
|
|
7
|
+
try {
|
|
8
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
for (const entry of entries) {
|
|
14
|
+
if (entry.name === 'node_modules' || entry.name === 'dist' || entry.name === '.git')
|
|
15
|
+
continue;
|
|
16
|
+
const full = join(dir, entry.name);
|
|
17
|
+
if (entry.isDirectory()) {
|
|
18
|
+
await walkTests(full, pattern, acc);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (!entry.name.endsWith('.test.ts'))
|
|
22
|
+
continue;
|
|
23
|
+
if (pattern !== undefined && !full.includes(pattern) && !entry.name.includes(pattern))
|
|
24
|
+
continue;
|
|
25
|
+
acc.push(full);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function runVitest(cwd, pattern, flags) {
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
const args = ['vitest', flags.watch ? 'watch' : 'run'];
|
|
31
|
+
if (pattern !== undefined)
|
|
32
|
+
args.push(pattern);
|
|
33
|
+
if (flags.coverage)
|
|
34
|
+
args.push('--coverage');
|
|
35
|
+
if (process.env['UPDATE_SNAPSHOT'] === '1')
|
|
36
|
+
args.push('--update');
|
|
37
|
+
const child = spawn('npx', ['--no-install', ...args], {
|
|
38
|
+
cwd,
|
|
39
|
+
stdio: 'inherit',
|
|
40
|
+
env: process.env,
|
|
41
|
+
});
|
|
42
|
+
child.on('error', () => resolve(undefined));
|
|
43
|
+
child.on('close', (code) => resolve(code ?? 1));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Built-in `test` command: spawn vitest, or list matching `*.test.ts` files.
|
|
48
|
+
*/
|
|
49
|
+
export default class TestCommand extends Command {
|
|
50
|
+
signature = 'test {pattern?} [--watch] [--coverage] [--fail-empty] [--update]';
|
|
51
|
+
description = 'Discover *.test.ts files and run vitest';
|
|
52
|
+
descriptionKey = 'cmd.test.description';
|
|
53
|
+
static exitCodes = { 1: 'No tests found (--fail-empty) or vitest failed' };
|
|
54
|
+
async handle() {
|
|
55
|
+
const pattern = this.arg('pattern');
|
|
56
|
+
const base = this.app.basePath;
|
|
57
|
+
const files = [];
|
|
58
|
+
await walkTests(base, pattern, files);
|
|
59
|
+
this.output.section('Tests');
|
|
60
|
+
this.output.keyValue('files', String(files.length));
|
|
61
|
+
if (this.option('update') === true) {
|
|
62
|
+
process.env['UPDATE_SNAPSHOT'] = '1';
|
|
63
|
+
}
|
|
64
|
+
if (files.length === 0) {
|
|
65
|
+
this.output.warn('No *.test.ts files found.');
|
|
66
|
+
return this.option('fail-empty') === true ? 1 : 0;
|
|
67
|
+
}
|
|
68
|
+
if (process.env['VITEST'] === undefined) {
|
|
69
|
+
const code = await runVitest(base, pattern, {
|
|
70
|
+
watch: this.option('watch') === true,
|
|
71
|
+
coverage: this.option('coverage') === true,
|
|
72
|
+
});
|
|
73
|
+
if (code !== undefined)
|
|
74
|
+
return code;
|
|
75
|
+
}
|
|
76
|
+
for (const file of files) {
|
|
77
|
+
this.output.raw(` ${relative(base, file)}\n`);
|
|
78
|
+
}
|
|
79
|
+
this.output.muted(process.env['VITEST'] ? 'listed (already inside vitest)' : 'vitest not available — listed files');
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=test.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.command.js","sourceRoot":"","sources":["../../src/commands/test.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,KAAK,UAAU,SAAS,CAAC,GAAW,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walkthrough.
|
|
4
|
+
* Non-TTY or `--plain` prints every step and exits.
|
|
5
|
+
*/
|
|
6
|
+
export default class TutorialCommand extends Command {
|
|
7
|
+
signature: string;
|
|
8
|
+
description: string;
|
|
9
|
+
descriptionKey: string;
|
|
10
|
+
handle(): Promise<number>;
|
|
11
|
+
private printStep;
|
|
12
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
const STEPS = [
|
|
3
|
+
{
|
|
4
|
+
title: 'create app',
|
|
5
|
+
body: 'npm create @mudah-cli/mudah my-app && cd my-app && npm install',
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
title: 'make command',
|
|
9
|
+
body: 'node bin/my-app.js make command hello\n# or: make tui picker env | make plugin audit',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: 'TestTui',
|
|
13
|
+
body: "import { TestTui } from '@mudah-cli/mudah/testing';\nconst tui = TestTui.mount(screen.root, { cols: 80, rows: 24 });\ntui.send('down').send('enter');\nexpect(tui.snapshot()).toContain('title');",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
title: 'doctor',
|
|
17
|
+
body: 'node bin/my-app.js doctor\n# health report. doctor --a11y-tree adds a sample dumpTree JSON',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* Built-in `tutorial` command: an interactive walkthrough.
|
|
22
|
+
* Non-TTY or `--plain` prints every step and exits.
|
|
23
|
+
*/
|
|
24
|
+
export default class TutorialCommand extends Command {
|
|
25
|
+
signature = 'tutorial';
|
|
26
|
+
description = 'Interactive walkthrough: create app, make command, TestTui, doctor';
|
|
27
|
+
descriptionKey = 'cmd.tutorial.description';
|
|
28
|
+
async handle() {
|
|
29
|
+
const plain = this.output.mode === 'plain' || process.stdin.isTTY !== true;
|
|
30
|
+
this.output.section('Mudah tutorial');
|
|
31
|
+
if (plain) {
|
|
32
|
+
for (const [i, step] of STEPS.entries())
|
|
33
|
+
this.printStep(i, step);
|
|
34
|
+
this.output.success('tutorial complete');
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
for (const [i, step] of STEPS.entries()) {
|
|
38
|
+
this.printStep(i, step);
|
|
39
|
+
const more = i < STEPS.length - 1;
|
|
40
|
+
if (more) {
|
|
41
|
+
const ok = await this.confirm('Continue?', true);
|
|
42
|
+
if (!ok) {
|
|
43
|
+
this.output.muted('Stopped. Re-run tutorial to continue.');
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
this.output.success('tutorial complete');
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
printStep(index, step) {
|
|
52
|
+
this.output.line();
|
|
53
|
+
this.output.info(`${index + 1}. ${step.title}`);
|
|
54
|
+
this.output.raw(`${step.body}\n`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=tutorial.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tutorial.command.js","sourceRoot":"","sources":["../../src/commands/tutorial.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAO7C,MAAM,KAAK,GAA4B;IACrC;QACE,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,gEAAgE;KACvE;IACD;QACE,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,sFAAsF;KAC7F;IACD;QACE,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,mMAAmM;KAC1M;IACD;QACE,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,4FAA4F;KACnG;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,SAAS,GAAG,UAAU,CAAC;IACvB,WAAW,GAAG,oEAAoE,CAAC;IACnF,cAAc,GAAG,0BAA0B,CAAC;IAE5C,KAAK,CAAC,MAAM;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C;QAChD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -3,6 +3,7 @@ import { Command } from '@mudah-cli/console';
|
|
|
3
3
|
export default class VersionCommand extends Command {
|
|
4
4
|
signature = 'version';
|
|
5
5
|
description = 'Show the application version';
|
|
6
|
+
descriptionKey = 'cmd.version.description';
|
|
6
7
|
async handle() {
|
|
7
8
|
this.output.info(`${this.app.manifest.name} v${this.app.manifest.version}`);
|
|
8
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.command.js","sourceRoot":"","sources":["../../src/commands/version.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,kCAAkC;AAClC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,SAAS,GAAG,SAAS,CAAC;IACtB,WAAW,GAAG,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"version.command.js","sourceRoot":"","sources":["../../src/commands/version.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,kCAAkC;AAClC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,SAAS,GAAG,SAAS,CAAC;IACtB,WAAW,GAAG,8BAA8B,CAAC;IAC7C,cAAc,GAAG,yBAAyB,CAAC;IAE3C,KAAK,CAAC,MAAM;QACV,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command, type ConsoleKernel } from '@mudah-cli/console';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `watch` command: re-run a command when files change.
|
|
4
|
+
* Reads `mudah.json` `watch` defaults when args are omitted.
|
|
5
|
+
*/
|
|
6
|
+
export default class WatchCommand extends Command {
|
|
7
|
+
private readonly kernel;
|
|
8
|
+
signature: string;
|
|
9
|
+
description: string;
|
|
10
|
+
descriptionKey: string;
|
|
11
|
+
constructor(kernel: ConsoleKernel);
|
|
12
|
+
handle(): Promise<number>;
|
|
13
|
+
}
|