@mudah-cli/core 0.7.0 → 0.9.0
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 +42 -0
- package/dist/application.d.ts +53 -5
- package/dist/application.js +142 -8
- package/dist/application.js.map +1 -1
- package/dist/events.d.ts +16 -0
- package/dist/events.js +15 -0
- package/dist/events.js.map +1 -1
- package/dist/graph.d.ts +17 -0
- package/dist/graph.js +53 -0
- package/dist/graph.js.map +1 -0
- package/dist/i18n.d.ts +46 -0
- package/dist/i18n.js +228 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +9 -0
- package/dist/manifest.js +13 -0
- package/dist/manifest.js.map +1 -1
- package/dist/plugins.d.ts +43 -0
- package/dist/plugins.js +151 -8
- package/dist/plugins.js.map +1 -1
- package/dist/service-provider.d.ts +25 -0
- package/dist/service-provider.js +21 -0
- package/dist/service-provider.js.map +1 -1
- package/dist/telemetry.d.ts +98 -0
- package/dist/telemetry.js +196 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/ts-js-hook.js +2 -0
- package/dist/ts-js-hook.js.map +1 -1
- package/dist/updates.d.ts +3 -1
- package/dist/updates.js +12 -3
- package/dist/updates.js.map +1 -1
- package/package.json +17 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mudah Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @mudah-cli/core
|
|
2
|
+
|
|
3
|
+
The Mudah application kernel: service providers, two-phase boot, events, plugins, and discovery.
|
|
4
|
+
|
|
5
|
+
Part of [Mudah](https://github.com/thesimonharms/mudah) — an ergonomic, animation-rich CLI
|
|
6
|
+
framework. `Application` extends the IoC `Container`.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @mudah-cli/core
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { Application, ServiceProvider, loadManifest } from '@mudah-cli/core';
|
|
18
|
+
|
|
19
|
+
const app = new Application(process.cwd(), loadManifest(process.cwd()));
|
|
20
|
+
|
|
21
|
+
class MetricsProvider extends ServiceProvider {
|
|
22
|
+
register(): void {
|
|
23
|
+
this.app.singleton('metrics', () => new Map<string, number>());
|
|
24
|
+
}
|
|
25
|
+
boot(): void {
|
|
26
|
+
this.app.events().on('command.after', ({ command, durationMs }) => {
|
|
27
|
+
// record timings
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
await app.boot();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Two-phase boot runs every `register()` first, then every `boot()`, so `boot()` can depend on
|
|
36
|
+
anything any provider registered. Both hooks are async-first. `registerLazy(Provider, { commands })`
|
|
37
|
+
defers expensive providers until a matching command runs.
|
|
38
|
+
|
|
39
|
+
## Links
|
|
40
|
+
|
|
41
|
+
- [Full documentation](https://github.com/thesimonharms/mudah#readme)
|
|
42
|
+
- [License: MIT](LICENSE)
|
package/dist/application.d.ts
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
import { ConfigRepository } from '@mudah-cli/config';
|
|
2
|
-
import {
|
|
2
|
+
import { type Abstract, type Constructor, Container } from '@mudah-cli/container';
|
|
3
3
|
import { EventBus } from './events.js';
|
|
4
4
|
import { type MudahManifest } from './manifest.js';
|
|
5
5
|
import { type PluginDiscoveryOptions, type PluginInfo } from './plugins.js';
|
|
6
|
-
import { ServiceProvider } from './service-provider.js';
|
|
6
|
+
import type { ServiceProvider } from './service-provider.js';
|
|
7
|
+
export interface IoStreams {
|
|
8
|
+
stdin?: {
|
|
9
|
+
read?: unknown;
|
|
10
|
+
};
|
|
11
|
+
stdout?: {
|
|
12
|
+
write(data: string): unknown;
|
|
13
|
+
};
|
|
14
|
+
stderr?: {
|
|
15
|
+
write(data: string): unknown;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface ProviderHealth {
|
|
19
|
+
readonly provider: string;
|
|
20
|
+
readonly status: 'ok' | 'error' | 'skipped';
|
|
21
|
+
readonly latencyMs: number;
|
|
22
|
+
readonly detail?: string;
|
|
23
|
+
}
|
|
7
24
|
export type ProviderClass = new (app: Application) => ServiceProvider;
|
|
8
25
|
export interface LazyProviderOptions {
|
|
9
26
|
/** Boot this provider when one of these commands is invoked. */
|
|
10
27
|
commands?: string[];
|
|
11
28
|
/** Boot this provider when one of these bindings is resolved. */
|
|
12
29
|
bindings?: readonly Abstract[];
|
|
13
|
-
/** Boot this provider when the predicate returns true (checked on demand). */
|
|
14
|
-
bootWhen?: (app: Application) => boolean
|
|
30
|
+
/** Boot this provider when the predicate returns true (checked on demand). May be async. */
|
|
31
|
+
bootWhen?: (app: Application) => boolean | Promise<boolean>;
|
|
15
32
|
}
|
|
16
33
|
export interface BootOptions {
|
|
17
34
|
/** Collect per-hook timings (default: honors `MUDAH_BOOT_PROFILE=1`). */
|
|
@@ -57,10 +74,21 @@ export declare class Application extends Container {
|
|
|
57
74
|
private readonly providers;
|
|
58
75
|
private readonly lazyProviders;
|
|
59
76
|
private readonly bootedLazy;
|
|
77
|
+
private readonly bootedInstances;
|
|
60
78
|
private booted;
|
|
79
|
+
private io;
|
|
80
|
+
private discoveredPlugins;
|
|
81
|
+
private pluginGateWarnings;
|
|
82
|
+
private readonly registeredPluginProviders;
|
|
61
83
|
constructor(basePath?: string, manifest?: MudahManifest);
|
|
62
84
|
config(): ConfigRepository;
|
|
63
85
|
events(): EventBus;
|
|
86
|
+
/** Plugins that passed compatibility gates on the last discovery pass. */
|
|
87
|
+
plugins(): readonly PluginInfo[];
|
|
88
|
+
/** Human-readable reasons plugins were skipped by {@link gatePlugin}. */
|
|
89
|
+
pluginWarnings(): readonly string[];
|
|
90
|
+
/** Class names of every registered (eager) service provider. */
|
|
91
|
+
providerNames(): string[];
|
|
64
92
|
/** Register a provider that always boots. */
|
|
65
93
|
register(provider: ProviderClass): this;
|
|
66
94
|
/**
|
|
@@ -82,9 +110,21 @@ export declare class Application extends Container {
|
|
|
82
110
|
bootLazyForCommand(command: string): Promise<void>;
|
|
83
111
|
/** Boot lazy providers that declared an interest in `abstract`. */
|
|
84
112
|
bootLazyForBinding(abstract: Abstract): Promise<void>;
|
|
85
|
-
/** Boot lazy providers whose `bootWhen` predicate currently returns true. */
|
|
113
|
+
/** Boot lazy providers whose `bootWhen` predicate currently returns true (awaited). */
|
|
86
114
|
evaluateLazy(): Promise<void>;
|
|
115
|
+
/** Redirect command I/O streams for this application (tests, pipes). */
|
|
116
|
+
redirect(streams: IoStreams): this;
|
|
117
|
+
/** Current redirected streams (empty keys fall through to process). */
|
|
118
|
+
streams(): IoStreams;
|
|
119
|
+
/** Per-provider health: status + latency. Providers may implement `health()`. */
|
|
120
|
+
health(): Promise<ProviderHealth[]>;
|
|
121
|
+
/** Notify providers of an error (lifecycle hook). */
|
|
122
|
+
notifyError(error: unknown): Promise<void>;
|
|
87
123
|
private bootLazy;
|
|
124
|
+
/** Notify providers that a config value was mutated. */
|
|
125
|
+
notifyConfigChanged(key: string): void;
|
|
126
|
+
/** Shut down all booted providers, dispose container instances, emit 'app.shutdown'. */
|
|
127
|
+
shutdown(): Promise<void>;
|
|
88
128
|
/**
|
|
89
129
|
* Discover and register every `*.provider.{ts,js}` in the given directory
|
|
90
130
|
* (sorted for determinism). Exports whose name ends in `Provider` win.
|
|
@@ -99,6 +139,14 @@ export declare class Application extends Container {
|
|
|
99
139
|
* must never be able to take down the host app at boot.
|
|
100
140
|
*/
|
|
101
141
|
discoverPlugins(options?: PluginDiscoveryOptions): Promise<PluginInfo[]>;
|
|
142
|
+
/**
|
|
143
|
+
* Re-scan plugins, cache-bust their modules, register any new providers,
|
|
144
|
+
* and boot providers that arrived after the original `boot()`. Emits
|
|
145
|
+
* `plugins.reloaded`.
|
|
146
|
+
*/
|
|
147
|
+
reloadPlugins(options?: PluginDiscoveryOptions): Promise<PluginInfo[]>;
|
|
148
|
+
/** Register+boot providers added after the initial two-phase boot. */
|
|
149
|
+
private bootPendingProviders;
|
|
102
150
|
/**
|
|
103
151
|
* Discover command modules in the given directory (sorted). A command
|
|
104
152
|
* module is any file whose default export is a class with `handle`.
|
package/dist/application.js
CHANGED
|
@@ -5,8 +5,7 @@ import { ConfigRepository } from '@mudah-cli/config';
|
|
|
5
5
|
import { Container, isClassLike } from '@mudah-cli/container';
|
|
6
6
|
import { EventBus } from './events.js';
|
|
7
7
|
import { loadManifest } from './manifest.js';
|
|
8
|
-
import { discoverPlugins } from './plugins.js';
|
|
9
|
-
import { ServiceProvider } from './service-provider.js';
|
|
8
|
+
import { CORE_VERSION, discoverPlugins, gatePlugin, } from './plugins.js';
|
|
10
9
|
import { installTsJsResolveHook } from './ts-js-hook.js';
|
|
11
10
|
/** Round to whole milliseconds — sub-ms noise tells us nothing here. */
|
|
12
11
|
function round(ms) {
|
|
@@ -31,7 +30,12 @@ export class Application extends Container {
|
|
|
31
30
|
providers = [];
|
|
32
31
|
lazyProviders = [];
|
|
33
32
|
bootedLazy = new Set();
|
|
33
|
+
bootedInstances = [];
|
|
34
34
|
booted = false;
|
|
35
|
+
io = {};
|
|
36
|
+
discoveredPlugins = [];
|
|
37
|
+
pluginGateWarnings = [];
|
|
38
|
+
registeredPluginProviders = new Set();
|
|
35
39
|
constructor(basePath = process.cwd(), manifest) {
|
|
36
40
|
super();
|
|
37
41
|
installTsJsResolveHook();
|
|
@@ -47,6 +51,18 @@ export class Application extends Container {
|
|
|
47
51
|
events() {
|
|
48
52
|
return this.make('events');
|
|
49
53
|
}
|
|
54
|
+
/** Plugins that passed compatibility gates on the last discovery pass. */
|
|
55
|
+
plugins() {
|
|
56
|
+
return this.discoveredPlugins;
|
|
57
|
+
}
|
|
58
|
+
/** Human-readable reasons plugins were skipped by {@link gatePlugin}. */
|
|
59
|
+
pluginWarnings() {
|
|
60
|
+
return this.pluginGateWarnings;
|
|
61
|
+
}
|
|
62
|
+
/** Class names of every registered (eager) service provider. */
|
|
63
|
+
providerNames() {
|
|
64
|
+
return this.providers.map((provider) => provider.name);
|
|
65
|
+
}
|
|
50
66
|
/** Register a provider that always boots. */
|
|
51
67
|
register(provider) {
|
|
52
68
|
this.providers.push(provider);
|
|
@@ -78,6 +94,7 @@ export class Application extends Container {
|
|
|
78
94
|
const started = performance.now();
|
|
79
95
|
for (const Provider of this.providers) {
|
|
80
96
|
const provider = new Provider(this);
|
|
97
|
+
this.bootedInstances.push(provider);
|
|
81
98
|
const t0 = profile ? performance.now() : 0;
|
|
82
99
|
await provider.register?.();
|
|
83
100
|
if (profile) {
|
|
@@ -85,7 +102,9 @@ export class Application extends Container {
|
|
|
85
102
|
}
|
|
86
103
|
}
|
|
87
104
|
for (const Provider of this.providers) {
|
|
88
|
-
const provider =
|
|
105
|
+
const provider = this.bootedInstances.find((p) => p.constructor === Provider);
|
|
106
|
+
if (!provider)
|
|
107
|
+
continue;
|
|
89
108
|
const t0 = profile ? performance.now() : 0;
|
|
90
109
|
await provider.boot?.();
|
|
91
110
|
if (profile) {
|
|
@@ -94,6 +113,10 @@ export class Application extends Container {
|
|
|
94
113
|
}
|
|
95
114
|
this.booted = true;
|
|
96
115
|
await this.events().emit('app.booted', { app: this });
|
|
116
|
+
this.config().onChangeNotification((key) => {
|
|
117
|
+
this.notifyConfigChanged(key);
|
|
118
|
+
void this.events().emit('config.changed', { key });
|
|
119
|
+
});
|
|
97
120
|
if (!profile)
|
|
98
121
|
return undefined;
|
|
99
122
|
const result = {
|
|
@@ -127,24 +150,84 @@ export class Application extends Container {
|
|
|
127
150
|
}
|
|
128
151
|
}
|
|
129
152
|
}
|
|
130
|
-
/** Boot lazy providers whose `bootWhen` predicate currently returns true. */
|
|
153
|
+
/** Boot lazy providers whose `bootWhen` predicate currently returns true (awaited). */
|
|
131
154
|
async evaluateLazy() {
|
|
132
155
|
for (const entry of this.lazyProviders) {
|
|
133
156
|
if (this.bootedLazy.has(entry.provider))
|
|
134
157
|
continue;
|
|
135
|
-
|
|
158
|
+
const predicate = entry.options.bootWhen;
|
|
159
|
+
if (!predicate)
|
|
160
|
+
continue;
|
|
161
|
+
if (await predicate(this)) {
|
|
136
162
|
await this.bootLazy(entry.provider);
|
|
137
163
|
}
|
|
138
164
|
}
|
|
139
165
|
}
|
|
166
|
+
/** Redirect command I/O streams for this application (tests, pipes). */
|
|
167
|
+
redirect(streams) {
|
|
168
|
+
this.io = { ...this.io, ...streams };
|
|
169
|
+
return this;
|
|
170
|
+
}
|
|
171
|
+
/** Current redirected streams (empty keys fall through to process). */
|
|
172
|
+
streams() {
|
|
173
|
+
return this.io;
|
|
174
|
+
}
|
|
175
|
+
/** Per-provider health: status + latency. Providers may implement `health()`. */
|
|
176
|
+
async health() {
|
|
177
|
+
const results = [];
|
|
178
|
+
for (const instance of this.bootedInstances) {
|
|
179
|
+
const name = instance.constructor.name;
|
|
180
|
+
const t0 = performance.now();
|
|
181
|
+
try {
|
|
182
|
+
const custom = await instance.health?.();
|
|
183
|
+
results.push({
|
|
184
|
+
provider: name,
|
|
185
|
+
status: custom?.status ?? 'ok',
|
|
186
|
+
latencyMs: Math.round(performance.now() - t0),
|
|
187
|
+
detail: custom?.detail,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
results.push({
|
|
192
|
+
provider: name,
|
|
193
|
+
status: 'error',
|
|
194
|
+
latencyMs: Math.round(performance.now() - t0),
|
|
195
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return results;
|
|
200
|
+
}
|
|
201
|
+
/** Notify providers of an error (lifecycle hook). */
|
|
202
|
+
async notifyError(error) {
|
|
203
|
+
for (const p of this.bootedInstances) {
|
|
204
|
+
await p.onError?.(error);
|
|
205
|
+
}
|
|
206
|
+
await this.events().emit('command.error', { command: '', error });
|
|
207
|
+
}
|
|
140
208
|
async bootLazy(provider) {
|
|
141
209
|
if (this.bootedLazy.has(provider))
|
|
142
210
|
return;
|
|
143
211
|
this.bootedLazy.add(provider);
|
|
144
212
|
const instance = new provider(this);
|
|
213
|
+
this.bootedInstances.push(instance);
|
|
145
214
|
await instance.register?.();
|
|
146
215
|
await instance.boot?.();
|
|
147
216
|
}
|
|
217
|
+
/** Notify providers that a config value was mutated. */
|
|
218
|
+
notifyConfigChanged(key) {
|
|
219
|
+
for (const p of this.bootedInstances) {
|
|
220
|
+
void p.onConfigChanged?.(key);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/** Shut down all booted providers, dispose container instances, emit 'app.shutdown'. */
|
|
224
|
+
async shutdown() {
|
|
225
|
+
for (const p of this.bootedInstances) {
|
|
226
|
+
await p.onShutdown?.();
|
|
227
|
+
}
|
|
228
|
+
await this.dispose();
|
|
229
|
+
await this.events().emit('app.shutdown', { app: this });
|
|
230
|
+
}
|
|
148
231
|
/**
|
|
149
232
|
* Discover and register every `*.provider.{ts,js}` in the given directory
|
|
150
233
|
* (sorted for determinism). Exports whose name ends in `Provider` win.
|
|
@@ -159,6 +242,13 @@ export class Application extends Container {
|
|
|
159
242
|
}
|
|
160
243
|
}
|
|
161
244
|
}
|
|
245
|
+
const providersFile = (await this.listFiles(dir)).find((file) => /(?:^|\/)providers\.(ts|mts|js|mjs)$/.test(file));
|
|
246
|
+
if (providersFile) {
|
|
247
|
+
const mod = await this.importFile(providersFile);
|
|
248
|
+
const declared = mod.providers;
|
|
249
|
+
if (Array.isArray(declared))
|
|
250
|
+
this.loadProviders(declared);
|
|
251
|
+
}
|
|
162
252
|
return this;
|
|
163
253
|
}
|
|
164
254
|
/**
|
|
@@ -170,13 +260,57 @@ export class Application extends Container {
|
|
|
170
260
|
* must never be able to take down the host app at boot.
|
|
171
261
|
*/
|
|
172
262
|
async discoverPlugins(options = {}) {
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
263
|
+
const found = await discoverPlugins(this.basePath, options);
|
|
264
|
+
const coreVersion = options.coreVersion ?? CORE_VERSION;
|
|
265
|
+
const accepted = [];
|
|
266
|
+
const warnings = [];
|
|
267
|
+
for (const plugin of found) {
|
|
268
|
+
const gate = gatePlugin(plugin, { coreVersion, features: options.features });
|
|
269
|
+
if (!gate.ok) {
|
|
270
|
+
warnings.push(gate.reason ?? `Skipping incompatible plugin ${plugin.name}`);
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
accepted.push(plugin);
|
|
274
|
+
for (const provider of plugin.providers) {
|
|
275
|
+
if (this.registeredPluginProviders.has(provider))
|
|
276
|
+
continue;
|
|
277
|
+
this.registeredPluginProviders.add(provider);
|
|
176
278
|
this.register(provider);
|
|
279
|
+
}
|
|
177
280
|
}
|
|
281
|
+
this.discoveredPlugins = accepted;
|
|
282
|
+
this.pluginGateWarnings = warnings;
|
|
283
|
+
return accepted;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Re-scan plugins, cache-bust their modules, register any new providers,
|
|
287
|
+
* and boot providers that arrived after the original `boot()`. Emits
|
|
288
|
+
* `plugins.reloaded`.
|
|
289
|
+
*/
|
|
290
|
+
async reloadPlugins(options = {}) {
|
|
291
|
+
const plugins = await this.discoverPlugins({
|
|
292
|
+
...options,
|
|
293
|
+
bustCache: options.bustCache ?? true,
|
|
294
|
+
});
|
|
295
|
+
if (this.booted)
|
|
296
|
+
await this.bootPendingProviders();
|
|
297
|
+
await this.events().emit('plugins.reloaded', { app: this, plugins });
|
|
178
298
|
return plugins;
|
|
179
299
|
}
|
|
300
|
+
/** Register+boot providers added after the initial two-phase boot. */
|
|
301
|
+
async bootPendingProviders() {
|
|
302
|
+
const pending = this.providers.filter((Provider) => !this.bootedInstances.some((instance) => instance.constructor === Provider));
|
|
303
|
+
const started = [];
|
|
304
|
+
for (const Provider of pending) {
|
|
305
|
+
const instance = new Provider(this);
|
|
306
|
+
this.bootedInstances.push(instance);
|
|
307
|
+
started.push(instance);
|
|
308
|
+
await instance.register?.();
|
|
309
|
+
}
|
|
310
|
+
for (const instance of started) {
|
|
311
|
+
await instance.boot?.();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
180
314
|
/**
|
|
181
315
|
* Discover command modules in the given directory (sorted). A command
|
|
182
316
|
* module is any file whose default export is a class with `handle`.
|
package/dist/application.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,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;QACjC,IAAI,OAAyB,CAAC;QAC9B,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,OAAO;aACX,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aAC1E,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;aACrC,IAAI,EAAE,CAAC;IACZ,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,IAAY;QACnC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,GAA8B,CAAC;IACxC,CAAC;CACF"}
|
package/dist/events.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export interface AppEvents {
|
|
|
4
4
|
'app.booted': {
|
|
5
5
|
app: Application;
|
|
6
6
|
};
|
|
7
|
+
'app.shutdown': {
|
|
8
|
+
app: Application;
|
|
9
|
+
};
|
|
7
10
|
'command.before': {
|
|
8
11
|
command: string;
|
|
9
12
|
argv: string[];
|
|
@@ -17,6 +20,13 @@ export interface AppEvents {
|
|
|
17
20
|
command: string;
|
|
18
21
|
error: unknown;
|
|
19
22
|
};
|
|
23
|
+
'config.changed': {
|
|
24
|
+
key: string;
|
|
25
|
+
};
|
|
26
|
+
'plugins.reloaded': {
|
|
27
|
+
app: Application;
|
|
28
|
+
plugins: import('./plugins.js').PluginInfo[];
|
|
29
|
+
};
|
|
20
30
|
}
|
|
21
31
|
export type EventHandler<E> = (payload: E) => void | Promise<void>;
|
|
22
32
|
/**
|
|
@@ -25,9 +35,15 @@ export type EventHandler<E> = (payload: E) => void | Promise<void>;
|
|
|
25
35
|
*/
|
|
26
36
|
export declare class EventBus {
|
|
27
37
|
private readonly listeners;
|
|
38
|
+
private tracer?;
|
|
28
39
|
/** Subscribe. Returns an unsubscribe function. */
|
|
29
40
|
on<K extends keyof AppEvents>(event: K, handler: EventHandler<AppEvents[K]>): () => void;
|
|
30
41
|
off<K extends keyof AppEvents>(event: K, handler: EventHandler<AppEvents[K]>): void;
|
|
42
|
+
/**
|
|
43
|
+
* Log every dispatch. Pass `true` to write to stderr, or a custom sink.
|
|
44
|
+
* Used by `--trace`.
|
|
45
|
+
*/
|
|
46
|
+
trace(enabled: boolean | ((event: string, payload: unknown) => void)): this;
|
|
31
47
|
/** Emit to all subscribers, awaiting each in order. */
|
|
32
48
|
emit<K extends keyof AppEvents>(event: K, payload: AppEvents[K]): Promise<void>;
|
|
33
49
|
}
|
package/dist/events.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export class EventBus {
|
|
6
6
|
listeners = new Map();
|
|
7
|
+
tracer;
|
|
7
8
|
/** Subscribe. Returns an unsubscribe function. */
|
|
8
9
|
on(event, handler) {
|
|
9
10
|
let set = this.listeners.get(event);
|
|
@@ -17,8 +18,22 @@ export class EventBus {
|
|
|
17
18
|
off(event, handler) {
|
|
18
19
|
this.listeners.get(event)?.delete(handler);
|
|
19
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Log every dispatch. Pass `true` to write to stderr, or a custom sink.
|
|
23
|
+
* Used by `--trace`.
|
|
24
|
+
*/
|
|
25
|
+
trace(enabled) {
|
|
26
|
+
if (enabled === false)
|
|
27
|
+
this.tracer = undefined;
|
|
28
|
+
else if (enabled === true)
|
|
29
|
+
this.tracer = (event, payload) => console.error(`[trace] ${event}`, payload);
|
|
30
|
+
else
|
|
31
|
+
this.tracer = enabled;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
20
34
|
/** Emit to all subscribers, awaiting each in order. */
|
|
21
35
|
async emit(event, payload) {
|
|
36
|
+
this.tracer?.(event, payload);
|
|
22
37
|
const set = this.listeners.get(event);
|
|
23
38
|
if (!set)
|
|
24
39
|
return;
|
package/dist/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,MAAM,OAAO,QAAQ;IACF,SAAS,GAAG,IAAI,GAAG,EAA6C,CAAC;IAC1E,MAAM,CAA6C;IAE3D,kDAAkD;IAClD,EAAE,CAA4B,KAAQ,EAAE,OAAmC;QACzE,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACjC,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,OAA8B,CAAC,CAAC;QACxC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,GAAG,CAA4B,KAAQ,EAAE,OAAmC;QAC1E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,OAA8B,CAAC,CAAC;IACpE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAA8D;QAClE,IAAI,OAAO,KAAK,KAAK;YAAE,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;aAC1C,IAAI,OAAO,KAAK,IAAI;YAAE,IAAI,CAAC,MAAM,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;;YACnG,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uDAAuD;IACvD,KAAK,CAAC,IAAI,CAA4B,KAAQ,EAAE,OAAqB;QACnE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,KAAK,MAAM,OAAO,IAAI,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;YAC/B,MAAO,OAAsC,CAAC,OAAO,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;CACF"}
|
package/dist/graph.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PluginInfo } from './plugins.js';
|
|
2
|
+
export interface GraphEdge {
|
|
3
|
+
readonly from: string;
|
|
4
|
+
readonly to: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ProviderGraph {
|
|
7
|
+
readonly nodes: string[];
|
|
8
|
+
readonly edges: GraphEdge[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build a DAG of plugin names (via `depends`) and the providers each
|
|
12
|
+
* plugin registers. Extra node names (app-local providers) are included
|
|
13
|
+
* as isolated vertices.
|
|
14
|
+
*/
|
|
15
|
+
export declare function pluginGraph(plugins: readonly PluginInfo[], extraNodes?: readonly string[]): ProviderGraph;
|
|
16
|
+
/** Render a graph as ASCII `a -> b` lines or Graphviz DOT. */
|
|
17
|
+
export declare function formatGraph(graph: ProviderGraph, format?: 'ascii' | 'dot'): string;
|
package/dist/graph.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a DAG of plugin names (via `depends`) and the providers each
|
|
3
|
+
* plugin registers. Extra node names (app-local providers) are included
|
|
4
|
+
* as isolated vertices.
|
|
5
|
+
*/
|
|
6
|
+
export function pluginGraph(plugins, extraNodes = []) {
|
|
7
|
+
const nodes = new Set(extraNodes);
|
|
8
|
+
const edges = [];
|
|
9
|
+
const seen = new Set();
|
|
10
|
+
for (const plugin of plugins) {
|
|
11
|
+
nodes.add(plugin.name);
|
|
12
|
+
for (const dep of plugin.depends ?? []) {
|
|
13
|
+
nodes.add(dep);
|
|
14
|
+
const key = `${dep}\0${plugin.name}`;
|
|
15
|
+
if (!seen.has(key)) {
|
|
16
|
+
seen.add(key);
|
|
17
|
+
edges.push({ from: dep, to: plugin.name });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
for (const provider of plugin.providers) {
|
|
21
|
+
nodes.add(provider.name);
|
|
22
|
+
const key = `${plugin.name}\0${provider.name}`;
|
|
23
|
+
if (!seen.has(key)) {
|
|
24
|
+
seen.add(key);
|
|
25
|
+
edges.push({ from: plugin.name, to: provider.name });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return { nodes: [...nodes].sort(), edges };
|
|
30
|
+
}
|
|
31
|
+
/** Render a graph as ASCII `a -> b` lines or Graphviz DOT. */
|
|
32
|
+
export function formatGraph(graph, format = 'ascii') {
|
|
33
|
+
if (format === 'dot') {
|
|
34
|
+
const lines = ['digraph {'];
|
|
35
|
+
const connected = new Set();
|
|
36
|
+
for (const edge of graph.edges) {
|
|
37
|
+
lines.push(` "${edge.from}" -> "${edge.to}";`);
|
|
38
|
+
connected.add(edge.from);
|
|
39
|
+
connected.add(edge.to);
|
|
40
|
+
}
|
|
41
|
+
for (const node of graph.nodes) {
|
|
42
|
+
if (!connected.has(node))
|
|
43
|
+
lines.push(` "${node}";`);
|
|
44
|
+
}
|
|
45
|
+
lines.push('}');
|
|
46
|
+
return lines.join('\n');
|
|
47
|
+
}
|
|
48
|
+
if (graph.edges.length === 0) {
|
|
49
|
+
return graph.nodes.length === 0 ? '(empty)' : graph.nodes.join('\n');
|
|
50
|
+
}
|
|
51
|
+
return graph.edges.map((edge) => `${edge.from} -> ${edge.to}`).join('\n');
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,OAA8B,EAC9B,UAAU,GAAsB,EAAE;IAElC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,UAAU,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACvB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;YACvC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACf,MAAM,GAAG,GAAG,GAAG,GAAG,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;YACrC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACd,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACxC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACzB,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC/C,IAAI,CAAC,IAAI,CAAC,GAAG,CA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,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC"}
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message catalogs for command descriptions and prompts.
|
|
3
|
+
*
|
|
4
|
+
* Lookups walk a fallback chain: the active locale, its base language
|
|
5
|
+
* (`de-AT` → `de`), then `en`, then the key itself. A `{count}` variable
|
|
6
|
+
* selects a plural form via `Intl.PluralRules` (`key.one`, `key.other`, …)
|
|
7
|
+
* before falling back to the singular key.
|
|
8
|
+
*
|
|
9
|
+
* Command descriptions can stay English; built-ins declare a `descriptionKey`
|
|
10
|
+
* so `setLocale()` changes what `--help` prints.
|
|
11
|
+
*/
|
|
12
|
+
export type MessageDict = Record<string, string>;
|
|
13
|
+
/** Merge `dict` into the catalog for `locale` (later keys win). */
|
|
14
|
+
export declare function addMessages(locale: string, dict: MessageDict): void;
|
|
15
|
+
/** True when a catalog exists for this exact locale tag. */
|
|
16
|
+
export declare function hasLocale(locale: string): boolean;
|
|
17
|
+
/** Every registered locale tag, sorted. */
|
|
18
|
+
export declare function locales(): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Load `<locale>.json` catalogs from a directory into the registry.
|
|
21
|
+
* Malformed files are skipped. Returns the locale tags that loaded.
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadMessages(dir: string): string[];
|
|
24
|
+
/** Switch the active locale. Unknown locales still fall back to `en`. */
|
|
25
|
+
export declare function setLocale(locale: string): void;
|
|
26
|
+
/** Current locale (last value passed to {@link setLocale}). */
|
|
27
|
+
export declare function getLocale(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve a locale tag from the environment. `MUDAH_LOCALE` wins, then
|
|
30
|
+
* `LC_ALL` / `LC_MESSAGES` / `LANG`. `de_DE.UTF-8` → `de-DE`. Returns
|
|
31
|
+
* undefined for unset, `C`, and `POSIX`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function localeFromEnv(env?: Record<string, string | undefined>): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Adopt the locale from the environment. Returns the locale that was set
|
|
36
|
+
* (`en` when the environment names none).
|
|
37
|
+
*/
|
|
38
|
+
export declare function setLocaleFromEnv(env?: Record<string, string | undefined>): string;
|
|
39
|
+
/** True when `key` resolves in the fallback chain for `locale`. */
|
|
40
|
+
export declare function hasMessage(key: string, locale?: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Look up `key` in the active locale, falling back to the base language and
|
|
43
|
+
* then `en`, and finally returning the key itself. `{name}` placeholders are
|
|
44
|
+
* replaced from `vars`; a numeric `count` selects a plural form first.
|
|
45
|
+
*/
|
|
46
|
+
export declare function t(key: string, vars?: Record<string, string | number>): string;
|