@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
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { schemaAt, validateSchema } from '@mudah-cli/config';
|
|
2
|
+
import { Command } from '@mudah-cli/console';
|
|
3
|
+
/** Built-in `config:set {key} {value}` command. */
|
|
4
|
+
export default class ConfigSetCommand extends Command {
|
|
5
|
+
signature = 'config:set {key} {value}';
|
|
6
|
+
description = 'Set a config value (dotted key)';
|
|
7
|
+
descriptionKey = 'cmd.config.set.description';
|
|
8
|
+
async handle() {
|
|
9
|
+
const key = this.arg('key');
|
|
10
|
+
const value = this.arg('value');
|
|
11
|
+
if (!key || value === undefined) {
|
|
12
|
+
this.output.error('Usage: config:set {key} {value}');
|
|
13
|
+
return 1;
|
|
14
|
+
}
|
|
15
|
+
// Best-effort coercion: numbers/booleans/JSON literals become their typed
|
|
16
|
+
// form so `config:set app.port 8080` doesn't store the string "8080".
|
|
17
|
+
const coerced = coerceLiteral(value);
|
|
18
|
+
const schema = this.app.config().schema;
|
|
19
|
+
if (schema !== undefined) {
|
|
20
|
+
const node = schemaAt(schema, key);
|
|
21
|
+
if (node === undefined) {
|
|
22
|
+
this.output.error(`Unknown config key "${key}".`);
|
|
23
|
+
this.output.hint('Only keys declared in the bound schema can be set.');
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
26
|
+
const result = validateSchema(node, coerced, key);
|
|
27
|
+
if (!result.ok) {
|
|
28
|
+
this.output.error(`Invalid value for ${key}:`);
|
|
29
|
+
for (const issue of result.issues) {
|
|
30
|
+
this.output.hint(`${issue.path || key}: ${issue.message}`);
|
|
31
|
+
}
|
|
32
|
+
return 1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
this.app.config().set(key, coerced);
|
|
36
|
+
if (this.output.isMachineReadable) {
|
|
37
|
+
this.output.emit('data', 'config', { key, value: coerced });
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this.output.success(`Set ${key} = ${JSON.stringify(coerced)}`);
|
|
41
|
+
}
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function coerceLiteral(raw) {
|
|
46
|
+
if (raw === 'true')
|
|
47
|
+
return true;
|
|
48
|
+
if (raw === 'false')
|
|
49
|
+
return false;
|
|
50
|
+
if (raw === 'null')
|
|
51
|
+
return null;
|
|
52
|
+
if (raw === '')
|
|
53
|
+
return '';
|
|
54
|
+
if (/^-?\d+$/.test(raw)) {
|
|
55
|
+
const n = Number(raw);
|
|
56
|
+
if (Number.isSafeInteger(n))
|
|
57
|
+
return n;
|
|
58
|
+
}
|
|
59
|
+
if (/^-?\d+\.\d+$/.test(raw)) {
|
|
60
|
+
const n = Number(raw);
|
|
61
|
+
if (Number.isFinite(n))
|
|
62
|
+
return n;
|
|
63
|
+
}
|
|
64
|
+
return raw;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=config.set.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.set.command.js","sourceRoot":"","sources":["../../src/commands/config.set.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,mDAAmD;AACnD,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,OAAO;IACnD,SAAS,GAAG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
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { redactSecrets } from '@mudah-cli/config';
|
|
2
|
+
import { Command } from '@mudah-cli/console';
|
|
3
|
+
/** Built-in `config:show {key?}` command. */
|
|
4
|
+
export default class ConfigShowCommand extends Command {
|
|
5
|
+
signature = 'config:show {key?}';
|
|
6
|
+
description = 'Dump configuration (secrets are redacted by default)';
|
|
7
|
+
descriptionKey = 'cmd.config.show.description';
|
|
8
|
+
async handle() {
|
|
9
|
+
const cfg = this.app.config();
|
|
10
|
+
const key = this.arg('key');
|
|
11
|
+
const opts = {};
|
|
12
|
+
if (key) {
|
|
13
|
+
if (!cfg.has(key)) {
|
|
14
|
+
this.output.error(`No configuration at key "${key}".`);
|
|
15
|
+
return 1;
|
|
16
|
+
}
|
|
17
|
+
const leaf = key.split('.').pop();
|
|
18
|
+
const value = cfg.get(key);
|
|
19
|
+
const redacted = redactSecrets({ [leaf]: value }, opts);
|
|
20
|
+
const result = redacted[leaf];
|
|
21
|
+
if (this.output.isMachineReadable) {
|
|
22
|
+
this.output.emit('data', 'config', { key, value: result });
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.output.keyValue(key, JSON.stringify(result));
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const tree = redactSecrets(cfg.all(), opts);
|
|
30
|
+
if (this.output.isMachineReadable) {
|
|
31
|
+
this.output.emit('data', 'config', tree);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.output.raw(JSON.stringify(tree, null, 2));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=config.show.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.show.command.js","sourceRoot":"","sources":["../../src/commands/config.show.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE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AO;QACT,CAAC;QAED,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;QAC5C,IAAI,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { formatPrecedence, redactSecrets } from '@mudah-cli/config';
|
|
2
|
+
import { Command } from '@mudah-cli/console';
|
|
3
|
+
/** Built-in `config:source {key?}` command. */
|
|
4
|
+
export default class ConfigSourceCommand extends Command {
|
|
5
|
+
signature = 'config:source {key?}';
|
|
6
|
+
description = 'Show which layer a config key resolved from (secrets are redacted)';
|
|
7
|
+
descriptionKey = 'cmd.config.source.description';
|
|
8
|
+
async handle() {
|
|
9
|
+
const cfg = this.app.config();
|
|
10
|
+
const key = this.arg('key');
|
|
11
|
+
let rows;
|
|
12
|
+
if (key) {
|
|
13
|
+
const source = cfg.source(key);
|
|
14
|
+
if (source === undefined) {
|
|
15
|
+
this.output.error(`No configuration at key "${key}".`);
|
|
16
|
+
return 1;
|
|
17
|
+
}
|
|
18
|
+
rows = [{ key, layer: source.layer, value: source.value }];
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
rows = cfg.precedence();
|
|
22
|
+
}
|
|
23
|
+
const redacted = rows.map(redactRow);
|
|
24
|
+
if (this.output.isMachineReadable) {
|
|
25
|
+
this.output.emit('data', 'config', key ? redacted[0] : redacted);
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
const lines = formatPrecedence(redacted);
|
|
29
|
+
if (lines.length === 0) {
|
|
30
|
+
this.output.success('No configuration keys recorded.');
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
this.output.raw(lines.join('\n'));
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function redactRow(row) {
|
|
38
|
+
const leaf = row.key.split('.').pop();
|
|
39
|
+
const redacted = redactSecrets({ [leaf]: row.value });
|
|
40
|
+
return { key: row.key, layer: row.layer, value: redacted[leaf] };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=config.source.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.source.command.js","sourceRoot":"","sources":["../../src/commands/config.source.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,+CAA+C;AAC/C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,OAAO;IACtD,SAAS,GAAG,sBAAsB,CAAC;IACnC,WAAW,GAAG,oEAAoE,CAAC;IACnF,cAAc,GAAG,+BAA+B,CAAC;IAEjD,KAAK,CAAC,MAAM;QACV,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAE5B,IAAI,IAAqB,CAAC;QAC1B,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,GAAG,IAAI,CAAC,CAAC;gBACvD,OAAO,CAAC,CAAC;YACX,CAAC;YACD,IAAI,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CA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udah-cli/console';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `config:validate {key?}` command.
|
|
4
|
+
*
|
|
5
|
+
* When a schema is bound on `app.config()`, this runs `validateSchema` and
|
|
6
|
+
* reports every offending key. Without a schema the command falls back to a
|
|
7
|
+
* shallow walk that flags `undefined` values.
|
|
8
|
+
*/
|
|
9
|
+
export default class ConfigValidateCommand extends Command {
|
|
10
|
+
signature: string;
|
|
11
|
+
description: string;
|
|
12
|
+
descriptionKey: string;
|
|
13
|
+
handle(): Promise<0 | 1>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { schemaAt, validateSchema } from '@mudah-cli/config';
|
|
2
|
+
import { Command } from '@mudah-cli/console';
|
|
3
|
+
/**
|
|
4
|
+
* Built-in `config:validate {key?}` command.
|
|
5
|
+
*
|
|
6
|
+
* When a schema is bound on `app.config()`, this runs `validateSchema` and
|
|
7
|
+
* reports every offending key. Without a schema the command falls back to a
|
|
8
|
+
* shallow walk that flags `undefined` values.
|
|
9
|
+
*/
|
|
10
|
+
export default class ConfigValidateCommand extends Command {
|
|
11
|
+
signature = 'config:validate {key?}';
|
|
12
|
+
description = 'Run a schema check against the (current) config tree';
|
|
13
|
+
descriptionKey = 'cmd.config.validate.description';
|
|
14
|
+
async handle() {
|
|
15
|
+
const cfg = this.app.config();
|
|
16
|
+
const key = this.arg('key');
|
|
17
|
+
const issues = collectIssues(cfg.schema, cfg.all(), key, (k) => cfg.get(k));
|
|
18
|
+
if (this.output.isMachineReadable) {
|
|
19
|
+
this.output.emit('data', 'config', { ok: issues.length === 0, issues });
|
|
20
|
+
}
|
|
21
|
+
else if (issues.length === 0) {
|
|
22
|
+
this.output.success(`Config ${key ?? '(root)'} looks healthy.`);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.output.error(`Found ${issues.length} issue(s):`);
|
|
26
|
+
for (const issue of issues) {
|
|
27
|
+
this.output.hint(`${issue.path || '(root)'}: ${issue.message}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return issues.length === 0 ? 0 : 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function collectIssues(schema, root, key, get) {
|
|
34
|
+
if (schema !== undefined) {
|
|
35
|
+
if (key) {
|
|
36
|
+
const node = schemaAt(schema, key);
|
|
37
|
+
if (node === undefined)
|
|
38
|
+
return [{ path: key, message: 'is not a known key' }];
|
|
39
|
+
return [...validateSchema(node, get(key), key).issues];
|
|
40
|
+
}
|
|
41
|
+
return [...validateSchema(schema, root).issues];
|
|
42
|
+
}
|
|
43
|
+
const issues = [];
|
|
44
|
+
const target = key ? get(key) : root;
|
|
45
|
+
walk(valueFor(target), key ?? '', issues);
|
|
46
|
+
return issues;
|
|
47
|
+
}
|
|
48
|
+
function valueFor(value) {
|
|
49
|
+
return value !== null && typeof value === 'object' ? value : {};
|
|
50
|
+
}
|
|
51
|
+
function walk(value, prefix, issues) {
|
|
52
|
+
if (value === null || typeof value !== 'object')
|
|
53
|
+
return;
|
|
54
|
+
if (Array.isArray(value))
|
|
55
|
+
return;
|
|
56
|
+
for (const [key, v] of Object.entries(value)) {
|
|
57
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
58
|
+
if (v === undefined)
|
|
59
|
+
issues.push({ path, message: 'value is undefined' });
|
|
60
|
+
walk(v, path, issues);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=config.validate.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.validate.command.js","sourceRoot":"","sources":["../../src/commands/config.validate.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,QAAQ,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,OAAO;IACxD,SAAS,GAAG,wBAAwB,CAAC;IAC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I,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAC/C,IAAI,CAAC,KAAK,SAAS;YAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAC1E,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { Command, type ConsoleKernel } from '@mudah-cli/console';
|
|
|
6
6
|
export default class DevCommand extends Command {
|
|
7
7
|
signature: string;
|
|
8
8
|
description: string;
|
|
9
|
+
descriptionKey: string;
|
|
9
10
|
private kernel;
|
|
10
11
|
constructor(kernel: ConsoleKernel);
|
|
11
12
|
handle(): Promise<void>;
|
|
@@ -8,6 +8,7 @@ import { createWatcher } from '../watcher.js';
|
|
|
8
8
|
export default class DevCommand extends Command {
|
|
9
9
|
signature = 'dev {command}';
|
|
10
10
|
description = 'Watch mode: re-run a command when files change';
|
|
11
|
+
descriptionKey = 'cmd.dev.description';
|
|
11
12
|
kernel;
|
|
12
13
|
constructor(kernel) {
|
|
13
14
|
super();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.command.js","sourceRoot":"","sources":["../../src/commands/dev.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAsB,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,SAAS,GAAG,eAAe,CAAC;IAC5B,WAAW,GAAG,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"dev.command.js","sourceRoot":"","sources":["../../src/commands/dev.command.ts"],"names":[],"mappings":"AAAA,OAAO,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I,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE;YACnG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,KAAK,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAClC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;gBAC1B,IAAI,EAAE,CAAC;gBACP,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `docs:widgets` command: print the inspect()-generated
|
|
4
|
+
* component reference.
|
|
5
|
+
*/
|
|
6
|
+
export default class DocsWidgetsCommand extends Command {
|
|
7
|
+
signature: string;
|
|
8
|
+
description: string;
|
|
9
|
+
descriptionKey: string;
|
|
10
|
+
handle(): Promise<number>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `docs:widgets` command: print the inspect()-generated
|
|
4
|
+
* component reference.
|
|
5
|
+
*/
|
|
6
|
+
export default class DocsWidgetsCommand extends Command {
|
|
7
|
+
signature = 'docs:widgets';
|
|
8
|
+
description = 'Print the TUI widget reference generated from inspect()';
|
|
9
|
+
descriptionKey = 'cmd.docs.widgets.description';
|
|
10
|
+
async handle() {
|
|
11
|
+
const { widgetReference, widgetReferenceMarkdown } = await import('@mudah-cli/tui');
|
|
12
|
+
this.output.raw(`${widgetReferenceMarkdown()}\n`);
|
|
13
|
+
this.output.keyValue('widgets', String(widgetReference().length));
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=docs.widgets.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.widgets.command.js","sourceRoot":"","sources":["../../src/commands/docs.widgets.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,OAAO;IACrD,SAAS,GAAG,cAAc,CAAC;IAC3B,WAAW,GAAG,yDAAyD,CAAC;IACxE,cAAc,GAAG,8BAA8B,CAAC;IAEhD,KAAK,CAAC,MAAM;QACV,MAAM,EAAE,eAAe,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACpF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,uBAAuB,EAAE,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAClE,OAAO,CAAC,CAAC;IACX,CAAC;CACF"}
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { Command } from '@mudah-cli/console';
|
|
4
|
+
import { formatGraph, pluginGraph } from '@mudah-cli/core';
|
|
4
5
|
import { detectCapabilities } from '@mudah-cli/terminal';
|
|
5
|
-
|
|
6
|
+
function binStubPresent(basePath, bin) {
|
|
7
|
+
const dir = join(basePath, 'bin');
|
|
8
|
+
return existsSync(join(dir, `${bin}.js`)) || existsSync(join(dir, bin));
|
|
9
|
+
}
|
|
6
10
|
/**
|
|
7
11
|
* Built-in `doctor` command: a quick health check of the runtime, manifest,
|
|
8
12
|
* scaffolding, and terminal capabilities.
|
|
9
13
|
*/
|
|
10
14
|
export default class DoctorCommand extends Command {
|
|
11
|
-
signature = 'doctor';
|
|
15
|
+
signature = 'doctor [--deps] [--a11y-tree]';
|
|
12
16
|
description = 'Check the runtime, app, and terminal setup';
|
|
17
|
+
descriptionKey = 'cmd.doctor.description';
|
|
13
18
|
async handle() {
|
|
14
|
-
const
|
|
19
|
+
const headless = this.app.config().get('mudah.headless') === true;
|
|
20
|
+
const a11y = this.option('a11y-tree') === true;
|
|
21
|
+
const caps = detectCapabilities({
|
|
22
|
+
env: process.env,
|
|
23
|
+
isTty: headless ? false : undefined,
|
|
24
|
+
});
|
|
15
25
|
this.output.section('Runtime');
|
|
16
26
|
const nodeMajor = Number(process.versions.node.split('.')[0]);
|
|
17
27
|
if (nodeMajor >= 26) {
|
|
@@ -26,12 +36,12 @@ export default class DoctorCommand extends Command {
|
|
|
26
36
|
this.output.section('Application');
|
|
27
37
|
this.output.keyValue('name', this.app.manifest.name);
|
|
28
38
|
this.output.keyValue('version', this.app.manifest.version);
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
this.output.success(`bin/${
|
|
39
|
+
const bin = this.app.manifest.bin;
|
|
40
|
+
if (binStubPresent(this.app.basePath, bin)) {
|
|
41
|
+
this.output.success(`bin/${bin} present`);
|
|
32
42
|
}
|
|
33
43
|
else {
|
|
34
|
-
this.output.warn(`bin/${
|
|
44
|
+
this.output.warn(`bin/${bin}.js missing — add the bin stub`);
|
|
35
45
|
}
|
|
36
46
|
const modules = await this.app.discoverCommandModules();
|
|
37
47
|
if (modules.length > 0) {
|
|
@@ -40,6 +50,21 @@ export default class DoctorCommand extends Command {
|
|
|
40
50
|
else {
|
|
41
51
|
this.output.warn('no commands discovered in src/commands');
|
|
42
52
|
}
|
|
53
|
+
if (this.option('deps') === true) {
|
|
54
|
+
this.output.section('Dependencies');
|
|
55
|
+
const plugins = (typeof this.app.plugins === 'function' ? this.app.plugins() : []);
|
|
56
|
+
const extra = typeof this.app.providerNames === 'function' ? this.app.providerNames() : [];
|
|
57
|
+
this.output.raw(formatGraph(pluginGraph(plugins, extra), 'ascii'));
|
|
58
|
+
}
|
|
59
|
+
if (typeof this.app.health === 'function') {
|
|
60
|
+
const report = await this.app.health();
|
|
61
|
+
if (report.length > 0) {
|
|
62
|
+
this.output.section('Health');
|
|
63
|
+
for (const row of report) {
|
|
64
|
+
this.output.keyValue(row.provider, `${row.status} (${row.latencyMs}ms)`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
43
68
|
this.output.section('Terminal');
|
|
44
69
|
this.output.keyValue('brand', caps.brand);
|
|
45
70
|
this.output.keyValue('color', caps.trueColor ? 'truecolor' : caps.colorLevel === 8 ? '256' : caps.colorLevel === 1 ? '16' : 'off');
|
|
@@ -47,13 +72,22 @@ export default class DoctorCommand extends Command {
|
|
|
47
72
|
this.output.keyValue('animations', String(caps.animations));
|
|
48
73
|
this.output.keyValue('notifications', caps.osc9 ? 'osc 9' : 'none');
|
|
49
74
|
this.output.keyValue('semantic prompts', caps.osc133 ? 'osc 133' : 'none');
|
|
75
|
+
this.output.keyValue('cwd tracking', caps.osc7 ? 'osc 7' : 'none');
|
|
50
76
|
this.output.keyValue('graphics', caps.kittyGraphics ? 'kitty' : 'none');
|
|
51
77
|
this.output.keyValue('keyboard', caps.kittyKeyboard ? 'kitty key-up' : 'legacy');
|
|
52
78
|
this.output.section('TUI');
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
79
|
+
if (a11y) {
|
|
80
|
+
const { Column, Label, List, dumpTree } = await import('@mudah-cli/tui');
|
|
81
|
+
const demo = new Column().add(new Label('demo'), new List(['a', 'b']));
|
|
82
|
+
demo.resize(40, 8);
|
|
83
|
+
const tree = dumpTree(demo);
|
|
84
|
+
this.output.emit('data', 'a11y-tree', tree);
|
|
85
|
+
if (!this.output.isMachineReadable)
|
|
86
|
+
this.output.raw(JSON.stringify(tree));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.output.hint('Dump a live tree with doctor --a11y-tree, program.dump(), or TestTui.tree()');
|
|
90
|
+
}
|
|
57
91
|
this.output.line();
|
|
58
92
|
this.output.success('doctor complete');
|
|
59
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.command.js","sourceRoot":"","sources":["../../src/commands/doctor.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,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"doctor.command.js","sourceRoot":"","sources":["../../src/commands/doctor.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,WAAW,EAAmB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,SAAS,cAAc,CAAC,QAAgB,EAAE,GAAW;IACnD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAClC,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IAChD,SAAS,GAAG,+BAA+B,CAAC;IAC5C,WAAW,GAAG,4CAA4C,CAAC;IAC3D,cAA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,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB;gBAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5E,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;QAClG,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `gallery` command: widget gallery. Prints snapshots when not a
|
|
4
|
+
* TTY. On a TTY, opens a Program: left/right pick a widget, +/− resize.
|
|
5
|
+
*/
|
|
6
|
+
export default class GalleryCommand extends Command {
|
|
7
|
+
signature: string;
|
|
8
|
+
description: string;
|
|
9
|
+
descriptionKey: string;
|
|
10
|
+
handle(): Promise<number>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
async function widgets() {
|
|
3
|
+
const { Calendar, Chart, Checkbox, Column, DatePicker, Label, List, Pager, ProgressBar, Table, Toolbar } = await import('@mudah-cli/tui');
|
|
4
|
+
return [
|
|
5
|
+
{ name: 'label', build: () => new Column().add(new Label('Label story')) },
|
|
6
|
+
{ name: 'list', build: () => new Column().add(new Label('List story'), new List(['alpha', 'beta'])) },
|
|
7
|
+
{
|
|
8
|
+
name: 'toolbar',
|
|
9
|
+
build: () => new Column().add(new Label('Toolbar story'), new Toolbar({
|
|
10
|
+
items: [
|
|
11
|
+
{ id: 'run', label: 'Run' },
|
|
12
|
+
{ id: 'stop', label: 'Stop' },
|
|
13
|
+
],
|
|
14
|
+
})),
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'checkbox',
|
|
18
|
+
build: () => new Column().add(new Label('Checkbox story'), new Checkbox({ label: 'enabled', checked: true })),
|
|
19
|
+
},
|
|
20
|
+
{ name: 'progress', build: () => new Column().add(new Label('Progress story'), new ProgressBar(0.42)) },
|
|
21
|
+
{
|
|
22
|
+
name: 'table',
|
|
23
|
+
build: () => new Column().add(new Label('Table story'), new Table([{ header: 'Host' }, { header: 'State' }], [['db', 'up']])),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'pager',
|
|
27
|
+
build: () => new Column().add(new Pager({ title: 'Pager story', lines: ['alpha', 'beta', 'gamma'] })),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'calendar',
|
|
31
|
+
build: () => new Column().add(new Label('Calendar story'), new Calendar({ date: new Date('2026-09-01T00:00:00Z') })),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'datepicker',
|
|
35
|
+
build: () => new Column().add(new Label('DatePicker story'), new DatePicker({ date: new Date('2026-09-01T00:00:00Z') })),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'chart',
|
|
39
|
+
build: () => new Column().add(new Label('Chart story'), new Chart({
|
|
40
|
+
kind: 'bar',
|
|
41
|
+
entries: [
|
|
42
|
+
{ label: 'a', value: 3 },
|
|
43
|
+
{ label: 'b', value: 1 },
|
|
44
|
+
],
|
|
45
|
+
})),
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Built-in `gallery` command: widget gallery. Prints snapshots when not a
|
|
51
|
+
* TTY. On a TTY, opens a Program: left/right pick a widget, +/− resize.
|
|
52
|
+
*/
|
|
53
|
+
export default class GalleryCommand extends Command {
|
|
54
|
+
signature = 'gallery {widget?} [--cols=] [--rows=]';
|
|
55
|
+
description = 'Open a TUI widget gallery with live resize';
|
|
56
|
+
descriptionKey = 'cmd.gallery.description';
|
|
57
|
+
async handle() {
|
|
58
|
+
const cols = Number(this.option('cols') ?? 40) || 40;
|
|
59
|
+
const rows = Number(this.option('rows') ?? 8) || 8;
|
|
60
|
+
const filter = this.arg('widget');
|
|
61
|
+
const all = await widgets();
|
|
62
|
+
const shown = filter ? all.filter((entry) => entry.name === filter) : all;
|
|
63
|
+
if (shown.length === 0) {
|
|
64
|
+
throw this.usageError(`Unknown widget "${filter}".`, `Known: ${all.map((s) => s.name).join(', ')}`);
|
|
65
|
+
}
|
|
66
|
+
const tty = process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
67
|
+
if (tty && process.env['VITEST'] === undefined) {
|
|
68
|
+
const { Program, WidgetGallery } = await import('@mudah-cli/tui');
|
|
69
|
+
const gallery = new WidgetGallery(shown, cols, rows);
|
|
70
|
+
const program = new Program();
|
|
71
|
+
program.mount(gallery);
|
|
72
|
+
return program.run();
|
|
73
|
+
}
|
|
74
|
+
const { renderWidgetToText } = await import('@mudah-cli/tui');
|
|
75
|
+
this.output.section(`Gallery ${cols}x${rows}`);
|
|
76
|
+
for (const entry of shown) {
|
|
77
|
+
this.output.raw(renderWidgetToText(entry.build(cols, rows), cols, rows));
|
|
78
|
+
this.output.line();
|
|
79
|
+
}
|
|
80
|
+
this.output.success('gallery complete');
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=gallery.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gallery.command.js","sourceRoot":"","sources":["../../src/commands/gallery.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,KAAK,UAAU,OAAO;IACpB,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,GACtG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACjC,OAAO;QACL,E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,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YACrD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;YAC9B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACvB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;QACvB,CAAC;QAED,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC9D,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QAC/C,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YACzE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACxC,OAAO,CAAC,CAAC;IACX,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in `graph` — render the plugin/provider DAG as ASCII or DOT.
|
|
4
|
+
*/
|
|
5
|
+
export default class GraphCommand extends Command {
|
|
6
|
+
signature: string;
|
|
7
|
+
description: string;
|
|
8
|
+
descriptionKey: string;
|
|
9
|
+
handle(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from '@mudah-cli/console';
|
|
2
|
+
import { formatGraph, pluginGraph } from '@mudah-cli/core';
|
|
3
|
+
/**
|
|
4
|
+
* Built-in `graph` — render the plugin/provider DAG as ASCII or DOT.
|
|
5
|
+
*/
|
|
6
|
+
export default class GraphCommand extends Command {
|
|
7
|
+
signature = 'graph [--format=ascii]';
|
|
8
|
+
description = 'Render the provider dependency graph';
|
|
9
|
+
descriptionKey = 'cmd.graph.description';
|
|
10
|
+
async handle() {
|
|
11
|
+
const format = String(this.option('format') ?? 'ascii');
|
|
12
|
+
if (format !== 'ascii' && format !== 'dot') {
|
|
13
|
+
throw this.usageError(`Unknown graph format "${format}".`, 'Use ascii or dot.');
|
|
14
|
+
}
|
|
15
|
+
const plugins = (typeof this.app.plugins === 'function' ? this.app.plugins() : []);
|
|
16
|
+
const extra = typeof this.app.providerNames === 'function' ? this.app.providerNames() : [];
|
|
17
|
+
const graph = pluginGraph(plugins, extra);
|
|
18
|
+
this.output.raw(formatGraph(graph, format));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=graph.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.command.js","sourceRoot":"","sources":["../../src/commands/graph.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAmB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE5E;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAC/C,SAAS,GAAG,wBAAwB,CAAC;IACrC,WAAW,GAAG,sCAAsC,CAAC;IACrD,cAAc,GAAG,uBAAuB,CAAC;IAEzC,KAAK,CAAC,MAAM;QACV,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,CAAC;QACxD,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YAC3C,MAAM,IAAI,CAAC,UAAU,CAAC,yBAAyB,MAAM,IAAI,EAAE,mBAAmB,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAiB,CAAC;QACnG,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3F,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -5,6 +5,7 @@ import { Command, type ConsoleKernel } from '@mudah-cli/console';
|
|
|
5
5
|
export default class HelpCommand extends Command {
|
|
6
6
|
signature: string;
|
|
7
7
|
description: string;
|
|
8
|
+
descriptionKey: string;
|
|
8
9
|
private kernel;
|
|
9
10
|
constructor(kernel: ConsoleKernel);
|
|
10
11
|
handle(): Promise<void>;
|