dominds 1.26.0 → 1.26.1

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.
@@ -0,0 +1,349 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * Business CLI runner for dominds
5
+ *
6
+ * Usage:
7
+ * dominds [subcommand] [options]
8
+ *
9
+ * Subcommands:
10
+ * webui - Start WebUI server (default)
11
+ * tui - Start Text User Interface
12
+ * run - Run task dialog (alias for tui)
13
+ * read - Read team configuration
14
+ * man - Render toolset manual to stdout
15
+ * manual - Alias for man
16
+ * validate_team_def - Validate explicit team toolset declarations
17
+ * cert - Create and inspect local HTTPS certificates
18
+ * create - Create a new runtime workspace (rtws) from a template
19
+ * install - Install a Dominds App into this rtws
20
+ * doctor - Diagnose Dominds App state in this rtws
21
+ * enable - Enable an installed Dominds App in this rtws
22
+ * disable - Disable an installed Dominds App in this rtws
23
+ * uninstall- Uninstall a Dominds App from this rtws
24
+ * update - Update installed Dominds App(s)
25
+ * new - Alias for create
26
+ * help - Show help
27
+ *
28
+ * This file is launched by the top-level dominds supervisor.
29
+ */
30
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ var desc = Object.getOwnPropertyDescriptor(m, k);
33
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
34
+ desc = { enumerable: true, get: function() { return m[k]; } };
35
+ }
36
+ Object.defineProperty(o, k2, desc);
37
+ }) : (function(o, m, k, k2) {
38
+ if (k2 === undefined) k2 = k;
39
+ o[k2] = m[k];
40
+ }));
41
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
42
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
43
+ }) : function(o, v) {
44
+ o["default"] = v;
45
+ });
46
+ var __importStar = (this && this.__importStar) || (function () {
47
+ var ownKeys = function(o) {
48
+ ownKeys = Object.getOwnPropertyNames || function (o) {
49
+ var ar = [];
50
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
51
+ return ar;
52
+ };
53
+ return ownKeys(o);
54
+ };
55
+ return function (mod) {
56
+ if (mod && mod.__esModule) return mod;
57
+ var result = {};
58
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
59
+ __setModuleDefault(result, mod);
60
+ return result;
61
+ };
62
+ })();
63
+ Object.defineProperty(exports, "__esModule", { value: true });
64
+ exports.configureEnvProxySupport = configureEnvProxySupport;
65
+ exports.main = main;
66
+ const fs = __importStar(require("fs"));
67
+ const http = __importStar(require("node:http"));
68
+ const path = __importStar(require("path"));
69
+ const runtime_1 = require("./apps/runtime");
70
+ const dotenv_1 = require("./bootstrap/dotenv");
71
+ const cert_1 = require("./cli/cert");
72
+ const create_1 = require("./cli/create");
73
+ const disable_1 = require("./cli/disable");
74
+ const doctor_1 = require("./cli/doctor");
75
+ const enable_1 = require("./cli/enable");
76
+ const install_1 = require("./cli/install");
77
+ const manual_1 = require("./cli/manual");
78
+ const read_1 = require("./cli/read");
79
+ const tui_1 = require("./cli/tui");
80
+ const uninstall_1 = require("./cli/uninstall");
81
+ const update_1 = require("./cli/update");
82
+ const validate_team_def_1 = require("./cli/validate-team-def");
83
+ const webui_1 = require("./cli/webui");
84
+ const process_title_1 = require("./process-title");
85
+ require("./tools/builtins");
86
+ function configureEnvProxySupport() {
87
+ const domindsUseEnvProxy = process.env.DOMINDS_USE_ENV_PROXY?.trim();
88
+ if (domindsUseEnvProxy === '0') {
89
+ return;
90
+ }
91
+ try {
92
+ const setGlobalProxyFromEnv = http.setGlobalProxyFromEnv;
93
+ if (typeof setGlobalProxyFromEnv !== 'function') {
94
+ console.error('Error: DOMINDS_USE_ENV_PROXY requires Node.js 24.5+ because http.setGlobalProxyFromEnv() is unavailable.');
95
+ process.exit(1);
96
+ }
97
+ setGlobalProxyFromEnv(process.env);
98
+ }
99
+ catch (err) {
100
+ console.error('Error: invalid proxy environment configuration:', err instanceof Error ? err.message : String(err));
101
+ process.exit(1);
102
+ }
103
+ }
104
+ function printHelp() {
105
+ console.log(`
106
+ Dominds CLI - AI-driven DevOps framework with persistent memory
107
+
108
+ Usage:
109
+ dominds [-C <dir>] [subcommand] [options]
110
+
111
+ Global Options:
112
+ -C <dir> Change runtime workspace directory (handled by the dominds supervisor)
113
+
114
+ Subcommands:
115
+ webui [options] Start WebUI server (default)
116
+ tui [options] Start Text User Interface
117
+ run [options] Run task dialog (alias for tui)
118
+ read [options] Read team configuration
119
+ man [options] Render toolset manual to stdout
120
+ manual [options] Alias for man
121
+ validate_team_def [options] Validate explicit team toolset declarations
122
+ cert [options] Create and inspect local HTTPS certificates
123
+ create [options] Create a new runtime workspace (rtws) from a template
124
+ install [options] Install a Dominds App into this rtws
125
+ doctor [options] Read-only diagnosis across manifest/lock/configuration/resolution/handshake
126
+ enable [options] Enable an installed Dominds App in this rtws
127
+ disable [options] Disable an installed Dominds App in this rtws
128
+ uninstall [options] Uninstall a Dominds App from this rtws
129
+ update [options] Update installed Dominds App(s)
130
+ new [options] Alias for create
131
+ help Show this help message
132
+
133
+ Examples:
134
+ dominds # Start WebUI server (default)
135
+ dominds webui # Start WebUI server
136
+ dominds -C /path/to/my-ws webui # Start in specific rtws
137
+ dominds -C ux-rtws webui # Relative -C is resolved by the supervisor
138
+ dominds tui --help # Show TUI help
139
+ dominds run task.tsk # Run task dialog
140
+ dominds read # Read team configuration
141
+ dominds man ws_read --lang zh --all
142
+ dominds validate_team_def # Validate toolset references in .minds/team.yaml
143
+ dominds cert create --host 192.168.1.10
144
+ dominds cert status # Inspect detected LAN HTTPS certificate status
145
+ dominds create web-scaffold my-project # Create rtws from a template
146
+ dominds doctor @longrun-ai/web-dev # Diagnose a single app across all app-state layers
147
+
148
+ Installation:
149
+ pnpm add -g dominds
150
+
151
+ For detailed help on a specific subcommand:
152
+ dominds <subcommand> --help
153
+ `);
154
+ }
155
+ function printVersion() {
156
+ try {
157
+ const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
158
+ console.log(`dominds v${packageJson.version}`);
159
+ }
160
+ catch {
161
+ console.log('dominds (version unknown)');
162
+ }
163
+ }
164
+ async function main(argv = process.argv.slice(2)) {
165
+ const args = argv;
166
+ // Handle no arguments - default to webui
167
+ if (args.length === 0) {
168
+ (0, dotenv_1.loadRtwsDotenv)({ cwd: process.cwd() });
169
+ configureEnvProxySupport();
170
+ await runSubcommand('webui', []);
171
+ return;
172
+ }
173
+ const subcommand = args[0];
174
+ const subcommandArgs = args.slice(1);
175
+ // Handle help and version flags
176
+ if (subcommand === '-h' || subcommand === '--help' || subcommand === 'help') {
177
+ printHelp();
178
+ process.exit(0);
179
+ }
180
+ if (subcommand === '-v' || subcommand === '--version') {
181
+ printVersion();
182
+ process.exit(0);
183
+ }
184
+ const shouldSkipRtwsSetup = subcommand === 'cert' ||
185
+ subcommandArgs.includes('--help') ||
186
+ (subcommand === 'tui' && subcommandArgs.includes('-h')) ||
187
+ (subcommand === 'run' && subcommandArgs.includes('-h')) ||
188
+ (subcommand === 'read' && subcommandArgs.includes('-h')) ||
189
+ (subcommand === 'validate_team_def' && subcommandArgs.includes('-h')) ||
190
+ (subcommand === 'man' && subcommandArgs.includes('-h')) ||
191
+ (subcommand === 'manual' && subcommandArgs.includes('-h')) ||
192
+ ((subcommand === 'create' || subcommand === 'new') && subcommandArgs.includes('-h')) ||
193
+ (subcommand === 'install' &&
194
+ (subcommandArgs.includes('--help') || subcommandArgs.includes('-h'))) ||
195
+ (subcommand === 'doctor' &&
196
+ (subcommandArgs.includes('--help') || subcommandArgs.includes('-h'))) ||
197
+ (subcommand === 'enable' &&
198
+ (subcommandArgs.includes('--help') || subcommandArgs.includes('-h'))) ||
199
+ (subcommand === 'disable' &&
200
+ (subcommandArgs.includes('--help') || subcommandArgs.includes('-h'))) ||
201
+ (subcommand === 'uninstall' &&
202
+ (subcommandArgs.includes('--help') || subcommandArgs.includes('-h'))) ||
203
+ (subcommand === 'update' &&
204
+ (subcommandArgs.includes('--help') || subcommandArgs.includes('-h')));
205
+ if (!shouldSkipRtwsSetup) {
206
+ // Load runtime workspace env files into process.env once, in the main entry.
207
+ // Precedence: `.env` then `.env.local` (later overwrites earlier), and both
208
+ // overwrite any existing process.env values.
209
+ (0, dotenv_1.loadRtwsDotenv)({ cwd: process.cwd() });
210
+ configureEnvProxySupport();
211
+ }
212
+ const shouldLoadApps = subcommand !== 'webui' &&
213
+ subcommand !== 'cert' &&
214
+ subcommand !== 'create' &&
215
+ subcommand !== 'new' &&
216
+ subcommand !== 'install' &&
217
+ subcommand !== 'doctor' &&
218
+ subcommand !== 'enable' &&
219
+ subcommand !== 'disable' &&
220
+ subcommand !== 'uninstall' &&
221
+ subcommand !== 'update';
222
+ if (!shouldSkipRtwsSetup && shouldLoadApps) {
223
+ try {
224
+ // Register toolset proxies so Team.load() can validate toolset bindings (read/man/manual included).
225
+ await (0, runtime_1.registerEnabledAppsToolProxies)({ rtwsRootAbs: process.cwd() });
226
+ // Start apps-host only for interactive runtime commands (do not auto-start app frontends for read/man/manual).
227
+ const shouldStartAppsHost = subcommand === 'tui' || subcommand === 'run';
228
+ if (shouldStartAppsHost) {
229
+ await (0, runtime_1.initAppsRuntime)({
230
+ rtwsRootAbs: process.cwd(),
231
+ kernel: { scheme: 'http', host: '127.0.0.1', port: 0 },
232
+ });
233
+ }
234
+ }
235
+ catch (err) {
236
+ console.error('Error: failed to load enabled apps:', err instanceof Error ? err.message : String(err));
237
+ process.exit(1);
238
+ }
239
+ }
240
+ // Route to appropriate subcommand
241
+ switch (subcommand) {
242
+ case 'webui':
243
+ await runSubcommand('webui', subcommandArgs);
244
+ break;
245
+ case 'tui':
246
+ case 'run':
247
+ await runSubcommand('tui', subcommandArgs);
248
+ break;
249
+ case 'read':
250
+ await runSubcommand('read', subcommandArgs);
251
+ break;
252
+ case 'man':
253
+ await runSubcommand('manual', subcommandArgs);
254
+ break;
255
+ case 'manual':
256
+ await runSubcommand('manual', subcommandArgs);
257
+ break;
258
+ case 'validate_team_def':
259
+ await runSubcommand('validate_team_def', subcommandArgs);
260
+ break;
261
+ case 'cert':
262
+ await runSubcommand('cert', subcommandArgs);
263
+ break;
264
+ case 'create':
265
+ case 'new':
266
+ await runSubcommand('create', subcommandArgs);
267
+ break;
268
+ case 'install':
269
+ await runSubcommand('install', subcommandArgs);
270
+ break;
271
+ case 'doctor':
272
+ await runSubcommand('doctor', subcommandArgs);
273
+ break;
274
+ case 'enable':
275
+ await runSubcommand('enable', subcommandArgs);
276
+ break;
277
+ case 'disable':
278
+ await runSubcommand('disable', subcommandArgs);
279
+ break;
280
+ case 'uninstall':
281
+ await runSubcommand('uninstall', subcommandArgs);
282
+ break;
283
+ case 'update':
284
+ await runSubcommand('update', subcommandArgs);
285
+ break;
286
+ default:
287
+ console.error(`Error: Unknown subcommand '${subcommand}'`);
288
+ console.error(`Run 'dominds help' for usage information.`);
289
+ process.exit(1);
290
+ }
291
+ }
292
+ async function runSubcommand(subcommand, args) {
293
+ try {
294
+ (0, process_title_1.setRtwsProcessTitle)();
295
+ if (subcommand === 'webui') {
296
+ await (0, webui_1.main)(args);
297
+ }
298
+ else if (subcommand === 'tui') {
299
+ await (0, tui_1.main)(args);
300
+ }
301
+ else if (subcommand === 'read') {
302
+ await (0, read_1.main)(args);
303
+ }
304
+ else if (subcommand === 'manual') {
305
+ await (0, manual_1.main)(args);
306
+ }
307
+ else if (subcommand === 'validate_team_def') {
308
+ await (0, validate_team_def_1.main)(args);
309
+ }
310
+ else if (subcommand === 'cert') {
311
+ await (0, cert_1.main)(args);
312
+ }
313
+ else if (subcommand === 'create') {
314
+ await (0, create_1.main)(args);
315
+ }
316
+ else if (subcommand === 'install') {
317
+ await (0, install_1.main)(args);
318
+ }
319
+ else if (subcommand === 'doctor') {
320
+ await (0, doctor_1.main)(args);
321
+ }
322
+ else if (subcommand === 'enable') {
323
+ await (0, enable_1.main)(args);
324
+ }
325
+ else if (subcommand === 'disable') {
326
+ await (0, disable_1.main)(args);
327
+ }
328
+ else if (subcommand === 'uninstall') {
329
+ await (0, uninstall_1.main)(args);
330
+ }
331
+ else if (subcommand === 'update') {
332
+ await (0, update_1.main)(args);
333
+ }
334
+ else {
335
+ console.error(`Error: Subcommand '${subcommand}' not implemented`);
336
+ process.exit(1);
337
+ }
338
+ }
339
+ catch (err) {
340
+ console.error(`Failed to execute subcommand '${subcommand}': ${err instanceof Error ? err.message : String(err)}`);
341
+ process.exit(1);
342
+ }
343
+ }
344
+ if (require.main === module) {
345
+ main().catch((err) => {
346
+ console.error('Unhandled error:', err);
347
+ process.exit(1);
348
+ });
349
+ }
package/dist/cli.d.ts CHANGED
@@ -1,33 +1,2 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * Main CLI entry point for dominds
4
- *
5
- * Usage:
6
- * dominds [subcommand] [options]
7
- *
8
- * Subcommands:
9
- * webui - Start WebUI server (default)
10
- * tui - Start Text User Interface
11
- * run - Run task dialog (alias for tui)
12
- * read - Read team configuration
13
- * man - Render toolset manual to stdout
14
- * manual - Alias for man
15
- * validate_team_def - Validate explicit team toolset declarations
16
- * cert - Create and inspect local HTTPS certificates
17
- * create - Create a new runtime workspace (rtws) from a template
18
- * install - Install a Dominds App into this rtws
19
- * doctor - Diagnose Dominds App state in this rtws
20
- * enable - Enable an installed Dominds App in this rtws
21
- * disable - Disable an installed Dominds App in this rtws
22
- * uninstall- Uninstall a Dominds App from this rtws
23
- * update - Update installed Dominds App(s)
24
- * new - Alias for create
25
- * help - Show help
26
- *
27
- * Global installation:
28
- * pnpm add -g dominds
29
- * dominds webui
30
- */
31
- import './tools/builtins';
32
- export declare function configureEnvProxySupport(): void;
33
2
  export declare function main(argv?: readonly string[]): Promise<void>;