@miller-tech/uap 1.3.4 → 1.4.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.
Files changed (67) hide show
  1. package/dist/benchmarks/improved-benchmark.js +1 -1
  2. package/dist/benchmarks/improved-benchmark.js.map +1 -1
  3. package/dist/bin/cli.js +307 -148
  4. package/dist/bin/cli.js.map +1 -1
  5. package/dist/cli/agent.js +3 -3
  6. package/dist/cli/agent.js.map +1 -1
  7. package/dist/cli/analyze.js +1 -1
  8. package/dist/cli/analyze.js.map +1 -1
  9. package/dist/cli/compliance.js +2 -2
  10. package/dist/cli/compliance.js.map +1 -1
  11. package/dist/cli/dashboard.js +5 -5
  12. package/dist/cli/dashboard.js.map +1 -1
  13. package/dist/cli/deploy.js +5 -5
  14. package/dist/cli/deploy.js.map +1 -1
  15. package/dist/cli/droids.d.ts.map +1 -1
  16. package/dist/cli/droids.js +12 -1
  17. package/dist/cli/droids.js.map +1 -1
  18. package/dist/cli/init.d.ts.map +1 -1
  19. package/dist/cli/init.js +3 -3
  20. package/dist/cli/init.js.map +1 -1
  21. package/dist/cli/memory.d.ts.map +1 -1
  22. package/dist/cli/memory.js +107 -40
  23. package/dist/cli/memory.js.map +1 -1
  24. package/dist/cli/model.js +6 -6
  25. package/dist/cli/model.js.map +1 -1
  26. package/dist/cli/patterns.js +1 -1
  27. package/dist/cli/patterns.js.map +1 -1
  28. package/dist/cli/task.js +12 -6
  29. package/dist/cli/task.js.map +1 -1
  30. package/dist/cli/worktree.js +2 -2
  31. package/dist/cli/worktree.js.map +1 -1
  32. package/dist/coordination/service.d.ts.map +1 -1
  33. package/dist/coordination/service.js +4 -1
  34. package/dist/coordination/service.js.map +1 -1
  35. package/dist/dashboard/data-service.js +15 -15
  36. package/dist/dashboard/data-service.js.map +1 -1
  37. package/dist/mcp-router/executor/client.d.ts.map +1 -1
  38. package/dist/mcp-router/executor/client.js +21 -4
  39. package/dist/mcp-router/executor/client.js.map +1 -1
  40. package/dist/mcp-router/output-compressor.d.ts.map +1 -1
  41. package/dist/mcp-router/output-compressor.js +147 -26
  42. package/dist/mcp-router/output-compressor.js.map +1 -1
  43. package/dist/mcp-router/search/fuzzy.d.ts +1 -0
  44. package/dist/mcp-router/search/fuzzy.d.ts.map +1 -1
  45. package/dist/mcp-router/search/fuzzy.js +16 -6
  46. package/dist/mcp-router/search/fuzzy.js.map +1 -1
  47. package/dist/mcp-router/server.d.ts +5 -2
  48. package/dist/mcp-router/server.d.ts.map +1 -1
  49. package/dist/mcp-router/server.js +122 -29
  50. package/dist/mcp-router/server.js.map +1 -1
  51. package/dist/memory/knowledge-graph.d.ts +2 -1
  52. package/dist/memory/knowledge-graph.d.ts.map +1 -1
  53. package/dist/memory/knowledge-graph.js +56 -33
  54. package/dist/memory/knowledge-graph.js.map +1 -1
  55. package/dist/policies/policy-gate.d.ts +14 -1
  56. package/dist/policies/policy-gate.d.ts.map +1 -1
  57. package/dist/policies/policy-gate.js +129 -12
  58. package/dist/policies/policy-gate.js.map +1 -1
  59. package/dist/policies/schemas/policy.d.ts +2 -2
  60. package/dist/tasks/service.d.ts +7 -2
  61. package/dist/tasks/service.d.ts.map +1 -1
  62. package/dist/tasks/service.js +90 -18
  63. package/dist/tasks/service.js.map +1 -1
  64. package/dist/tasks/types.d.ts +8 -0
  65. package/dist/tasks/types.d.ts.map +1 -1
  66. package/dist/tasks/types.js.map +1 -1
  67. package/package.json +1 -1
package/dist/bin/cli.js CHANGED
@@ -1,30 +1,35 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command, Option } from 'commander';
3
- import { readFileSync } from 'fs';
3
+ import { existsSync, readFileSync } from 'fs';
4
+ import { execSync } from 'child_process';
4
5
  import { fileURLToPath } from 'url';
5
6
  import { dirname, join } from 'path';
6
- import { initCommand } from '../cli/init.js';
7
- import { analyzeCommand } from '../cli/analyze.js';
8
- import { generateCommand } from '../cli/generate.js';
9
- import { memoryCommand } from '../cli/memory.js';
10
- import { worktreeCommand } from '../cli/worktree.js';
11
- import { syncCommand } from '../cli/sync.js';
12
- import { droidsCommand } from '../cli/droids.js';
13
- import { coordCommand } from '../cli/coord.js';
14
- import { agentCommand } from '../cli/agent.js';
15
- import { deployCommand } from '../cli/deploy.js';
16
- import { taskCommand } from '../cli/task.js';
17
- import { registerModelCommands } from '../cli/model.js';
18
- import { mcpRouterCommand } from '../cli/mcp-router.js';
19
- import { dashboardCommand } from '../cli/dashboard.js';
20
- import { hooksCommand } from '../cli/hooks.js';
21
- import { patternsCommand } from '../cli/patterns.js';
22
- import { setupCommand } from '../cli/setup.js';
23
- import { setupMcpRouter } from '../cli/setup-mcp-router.js';
24
- import { complianceCommand } from '../cli/compliance.js';
25
- import { registerSchemaDiffCommand } from '../cli/schema-diff.js';
26
- import { installRTK, checkRTKStatus, showRTKHelp } from '../cli/rtk.js';
27
- import { toolCallsCommand } from '../cli/tool-calls.js';
7
+ // Lazy import helpers - commands are loaded on-demand to reduce startup time (~10x faster --help)
8
+ // Each command module is only imported when its action handler is invoked.
9
+ const lazy = {
10
+ init: () => import('../cli/init.js').then((m) => m.initCommand),
11
+ analyze: () => import('../cli/analyze.js').then((m) => m.analyzeCommand),
12
+ generate: () => import('../cli/generate.js').then((m) => m.generateCommand),
13
+ memory: () => import('../cli/memory.js').then((m) => m.memoryCommand),
14
+ worktree: () => import('../cli/worktree.js').then((m) => m.worktreeCommand),
15
+ sync: () => import('../cli/sync.js').then((m) => m.syncCommand),
16
+ droids: () => import('../cli/droids.js').then((m) => m.droidsCommand),
17
+ coord: () => import('../cli/coord.js').then((m) => m.coordCommand),
18
+ agent: () => import('../cli/agent.js').then((m) => m.agentCommand),
19
+ deploy: () => import('../cli/deploy.js').then((m) => m.deployCommand),
20
+ task: () => import('../cli/task.js').then((m) => m.taskCommand),
21
+ model: () => import('../cli/model.js').then((m) => m.registerModelCommands),
22
+ mcpRouter: () => import('../cli/mcp-router.js').then((m) => m.mcpRouterCommand),
23
+ dashboard: () => import('../cli/dashboard.js').then((m) => m.dashboardCommand),
24
+ hooks: () => import('../cli/hooks.js'),
25
+ patterns: () => import('../cli/patterns.js').then((m) => m.patternsCommand),
26
+ setup: () => import('../cli/setup.js').then((m) => m.setupCommand),
27
+ setupMcpRouter: () => import('../cli/setup-mcp-router.js').then((m) => m.setupMcpRouter),
28
+ compliance: () => import('../cli/compliance.js').then((m) => m.complianceCommand),
29
+ schemaDiff: () => import('../cli/schema-diff.js').then((m) => m.registerSchemaDiffCommand),
30
+ rtk: () => import('../cli/rtk.js'),
31
+ toolCalls: () => import('../cli/tool-calls.js').then((m) => m.toolCallsCommand),
32
+ };
28
33
  // Read version from package.json
29
34
  const __filename = fileURLToPath(import.meta.url);
30
35
  const __dirname = dirname(__filename);
@@ -45,7 +50,10 @@ program
45
50
  .option('--no-patterns', 'Skip pattern RAG setup')
46
51
  .option('--pipeline-only', 'Enforce pipeline-only infrastructure changes (no direct kubectl/terraform)')
47
52
  .option('-f, --force', 'Overwrite existing configuration')
48
- .action(initCommand);
53
+ .action(async (options) => {
54
+ const cmd = await lazy.init();
55
+ await cmd(options);
56
+ });
49
57
  program
50
58
  .command('setup')
51
59
  .description('Full one-command setup: init + start Qdrant + install Python deps + index patterns')
@@ -54,13 +62,17 @@ program
54
62
  .option('--no-memory', 'Skip memory system setup')
55
63
  .option('-d, --project-dir <path>', 'Target project directory (defaults to current working directory)')
56
64
  .option('-i, --interactive', 'Run interactive setup wizard with feature toggles')
57
- .action(setupCommand);
65
+ .action(async (options) => {
66
+ (await lazy.setup())(options);
67
+ });
58
68
  program
59
69
  .command('analyze')
60
70
  .description('Analyze project structure and generate metadata')
61
71
  .option('-o, --output <format>', 'Output format (json, yaml, md)', 'json')
62
72
  .option('--save', 'Save analysis to .uap.analysis.json')
63
- .action(analyzeCommand);
73
+ .action(async (options) => {
74
+ (await lazy.analyze())(options);
75
+ });
64
76
  program
65
77
  .command('generate')
66
78
  .description('Generate or update CLAUDE.md and related files')
@@ -69,29 +81,39 @@ program
69
81
  .option('-p, --platform <platform>', 'Generate for specific platform only')
70
82
  .option('--web', 'Generate AGENT.md for web platforms (claude.ai, factory.ai)')
71
83
  .option('--pipeline-only', 'Enforce pipeline-only infrastructure changes (no direct kubectl/terraform)')
72
- .action(generateCommand);
84
+ .action(async (options) => {
85
+ (await lazy.generate())(options);
86
+ });
73
87
  program
74
88
  .command('memory')
75
89
  .description('Manage agent memory system')
76
- .addCommand(new Command('status')
77
- .description('Show memory system status')
78
- .action(() => memoryCommand('status')))
90
+ .addCommand(new Command('status').description('Show memory system status').action(async () => {
91
+ (await lazy.memory())('status');
92
+ }))
79
93
  .addCommand(new Command('start')
80
94
  .description('Start memory services (Qdrant container)')
81
- .action(() => memoryCommand('start')))
82
- .addCommand(new Command('stop').description('Stop memory services').action(() => memoryCommand('stop')))
95
+ .action(async () => {
96
+ (await lazy.memory())('start');
97
+ }))
98
+ .addCommand(new Command('stop').description('Stop memory services').action(async () => {
99
+ (await lazy.memory())('stop');
100
+ }))
83
101
  .addCommand(new Command('query')
84
102
  .description('Query long-term memory')
85
103
  .argument('<search>', 'Search term')
86
104
  .option('-n, --limit <number>', 'Max results', '10')
87
- .action((search, options) => memoryCommand('query', { search, ...options })))
105
+ .action(async (search, options) => {
106
+ (await lazy.memory())('query', { search, ...options });
107
+ }))
88
108
  .addCommand(new Command('store')
89
109
  .description('Store a memory (applies write gate unless --force)')
90
110
  .argument('<content>', 'Memory content')
91
111
  .option('-t, --tags <tags>', 'Comma-separated tags')
92
112
  .option('-i, --importance <number>', 'Importance score (1-10)', '5')
93
113
  .option('-f, --force', 'Bypass write gate (store without quality check)')
94
- .action((content, options) => memoryCommand('store', { content, ...options })))
114
+ .action(async (content, options) => {
115
+ (await lazy.memory())('store', { content, ...options });
116
+ }))
95
117
  .addCommand(new Command('prepopulate')
96
118
  .description('Prepopulate memory from documentation and git history')
97
119
  .option('--docs', 'Import from documentation only')
@@ -99,79 +121,111 @@ program
99
121
  .option('-n, --limit <number>', 'Limit git commits to analyze', '500')
100
122
  .option('--since <date>', 'Only analyze commits since date (e.g., "2024-01-01")')
101
123
  .option('-v, --verbose', 'Show detailed output')
102
- .action((options) => memoryCommand('prepopulate', options)))
124
+ .action(async (options) => {
125
+ (await lazy.memory())('prepopulate', options);
126
+ }))
103
127
  .addCommand(new Command('promote')
104
128
  .description('Review and promote daily log entries to working/semantic memory')
105
- .action((options) => memoryCommand('promote', options)))
129
+ .action(async (options) => {
130
+ (await lazy.memory())('promote', options);
131
+ }))
106
132
  .addCommand(new Command('correct')
107
133
  .description('Correct a memory (propagates across all tiers, marks old as superseded)')
108
134
  .argument('<search>', 'Search term to find the memory to correct')
109
135
  .option('-c, --correction <text>', 'The corrected content')
110
136
  .option('-r, --reason <reason>', 'Reason for correction')
111
- .action((search, options) => memoryCommand('correct', { search, ...options })))
137
+ .action(async (search, options) => {
138
+ (await lazy.memory())('correct', { search, ...options });
139
+ }))
112
140
  .addCommand(new Command('maintain')
113
141
  .description('Run maintenance: decay, prune stale, archive old, remove duplicates')
114
142
  .option('-v, --verbose', 'Show detailed output')
115
- .action((options) => memoryCommand('maintain', options)));
143
+ .action(async (options) => {
144
+ (await lazy.memory())('maintain', options);
145
+ }));
116
146
  // Pattern RAG Commands
117
147
  program
118
148
  .command('patterns')
119
149
  .description('Manage pattern RAG (on-demand pattern retrieval via Qdrant)')
120
150
  .addCommand(new Command('status')
121
151
  .description('Show pattern RAG status and collection info')
122
- .action(() => patternsCommand('status')))
152
+ .action(async () => {
153
+ (await lazy.patterns())('status');
154
+ }))
123
155
  .addCommand(new Command('index')
124
156
  .description('Index patterns from CLAUDE.md into Qdrant')
125
157
  .option('-v, --verbose', 'Show detailed output')
126
- .action((options) => patternsCommand('index', options)))
158
+ .action(async (options) => {
159
+ (await lazy.patterns())('index', options);
160
+ }))
127
161
  .addCommand(new Command('query')
128
162
  .description('Query patterns by task description')
129
163
  .argument('<search>', 'Task description to match')
130
164
  .option('-n, --top <number>', 'Number of results', '2')
131
165
  .option('--min-score <number>', 'Minimum similarity score', '0.35')
132
166
  .option('--format <format>', 'Output format (text, json, context)', 'text')
133
- .action((search, options) => patternsCommand('query', { search, ...options })))
167
+ .action(async (search, options) => {
168
+ (await lazy.patterns())('query', { search, ...options });
169
+ }))
134
170
  .addCommand(new Command('generate')
135
171
  .description('Generate Python index/query scripts from config')
136
172
  .option('-f, --force', 'Overwrite existing scripts')
137
- .action((options) => patternsCommand('generate', options)));
173
+ .action(async (options) => {
174
+ (await lazy.patterns())('generate', options);
175
+ }));
138
176
  program
139
177
  .command('worktree')
140
178
  .description('Manage git worktrees')
141
179
  .addCommand(new Command('create')
142
180
  .description('Create a new worktree for a feature')
143
181
  .argument('<slug>', 'Feature slug (e.g., add-user-auth)')
144
- .action((slug) => worktreeCommand('create', { slug })))
145
- .addCommand(new Command('list').description('List all worktrees').action(() => worktreeCommand('list')))
182
+ .action(async (slug) => {
183
+ (await lazy.worktree())('create', { slug });
184
+ }))
185
+ .addCommand(new Command('list').description('List all worktrees').action(async () => {
186
+ (await lazy.worktree())('list');
187
+ }))
146
188
  .addCommand(new Command('pr')
147
189
  .description('Create PR from worktree')
148
190
  .argument('<id>', 'Worktree ID')
149
191
  .option('--draft', 'Create as draft PR')
150
- .action((id, options) => worktreeCommand('pr', { id, ...options })))
192
+ .action(async (id, options) => {
193
+ (await lazy.worktree())('pr', { id, ...options });
194
+ }))
151
195
  .addCommand(new Command('cleanup')
152
196
  .description('Remove worktree and delete branch')
153
197
  .argument('<id>', 'Worktree ID')
154
- .action((id) => worktreeCommand('cleanup', { id })));
198
+ .action(async (id) => {
199
+ (await lazy.worktree())('cleanup', { id });
200
+ }));
155
201
  program
156
202
  .command('sync')
157
203
  .description('Sync configuration between platforms')
158
204
  .option('--from <platform>', 'Source platform (claude, factory, vscode, opencode)')
159
205
  .option('--to <platform>', 'Target platform(s)')
160
206
  .option('--dry-run', 'Preview changes without writing files')
161
- .action(syncCommand);
207
+ .action(async (options) => {
208
+ (await lazy.sync())(options);
209
+ });
162
210
  program
163
211
  .command('droids')
164
212
  .description('Manage custom droids/agents')
165
- .addCommand(new Command('list').description('List all droids').action(() => droidsCommand('list')))
213
+ .addCommand(new Command('list').description('List all droids').action(async () => {
214
+ (await lazy.droids())('list');
215
+ }))
166
216
  .addCommand(new Command('add')
167
217
  .description('Add a new droid')
168
218
  .argument('<name>', 'Droid name')
169
219
  .option('-t, --template <template>', 'Use built-in template')
170
- .action((name, options) => droidsCommand('add', { name, ...options })))
220
+ .action(async (name, options) => {
221
+ (await lazy.droids())('add', { name, ...options });
222
+ }))
171
223
  .addCommand(new Command('import')
172
224
  .description('Import droids from another platform')
173
225
  .argument('<path>', 'Path to import from')
174
- .action((path) => droidsCommand('import', { path })));
226
+ .action(async (path) => {
227
+ (await lazy.droids())('import', { path });
228
+ }));
175
229
  // Agent Coordination Commands
176
230
  program
177
231
  .command('coord')
@@ -179,13 +233,19 @@ program
179
233
  .addCommand(new Command('status')
180
234
  .description('Show coordination status (agents, claims, deploys)')
181
235
  .option('-v, --verbose', 'Show detailed information')
182
- .action((options) => coordCommand('status', options)))
236
+ .action(async (options) => {
237
+ (await lazy.coord())('status', options);
238
+ }))
183
239
  .addCommand(new Command('flush')
184
240
  .description('Force execute all pending deploys')
185
- .action((options) => coordCommand('flush', options)))
241
+ .action(async (options) => {
242
+ (await lazy.coord())('flush', options);
243
+ }))
186
244
  .addCommand(new Command('cleanup')
187
245
  .description('Clean up stale agents and expired data')
188
- .action((options) => coordCommand('cleanup', options)));
246
+ .action(async (options) => {
247
+ (await lazy.coord())('cleanup', options);
248
+ }));
189
249
  program
190
250
  .command('agent')
191
251
  .description('Agent lifecycle, work coordination, and communication')
@@ -194,15 +254,21 @@ program
194
254
  .option('-n, --name <name>', 'Agent name (required)')
195
255
  .option('-c, --capabilities <caps>', 'Comma-separated capabilities')
196
256
  .option('-w, --worktree <branch>', 'Git worktree branch this agent is using')
197
- .action((options) => agentCommand('register', options)))
257
+ .action(async (options) => {
258
+ (await lazy.agent())('register', options);
259
+ }))
198
260
  .addCommand(new Command('heartbeat')
199
261
  .description('Send heartbeat for an agent')
200
262
  .option('-i, --id <id>', 'Agent ID (required)')
201
- .action((options) => agentCommand('heartbeat', options)))
263
+ .action(async (options) => {
264
+ (await lazy.agent())('heartbeat', options);
265
+ }))
202
266
  .addCommand(new Command('status')
203
267
  .description('Show agent status')
204
268
  .option('-i, --id <id>', 'Agent ID (optional, shows all if omitted)')
205
- .action((options) => agentCommand('status', options)))
269
+ .action(async (options) => {
270
+ (await lazy.agent())('status', options);
271
+ }))
206
272
  .addCommand(new Command('announce')
207
273
  .description('Announce intent to work on a resource (informational, enables overlap detection)')
208
274
  .option('-i, --id <id>', 'Agent ID (required)')
@@ -211,40 +277,54 @@ program
211
277
  .option('-d, --description <desc>', 'Description of planned changes')
212
278
  .option('-f, --files <files>', 'Comma-separated list of files that will be affected')
213
279
  .option('--minutes <minutes>', 'Estimated time to complete (in minutes)')
214
- .action((options) => agentCommand('announce', options)))
280
+ .action(async (options) => {
281
+ (await lazy.agent())('announce', options);
282
+ }))
215
283
  .addCommand(new Command('complete')
216
284
  .description('Mark work as complete on a resource (notifies other agents)')
217
285
  .option('-i, --id <id>', 'Agent ID (required)')
218
286
  .option('-r, --resource <resource>', 'Resource that work is complete on')
219
- .action((options) => agentCommand('complete', options)))
287
+ .action(async (options) => {
288
+ (await lazy.agent())('complete', options);
289
+ }))
220
290
  .addCommand(new Command('overlaps')
221
291
  .description('Check for overlapping work (merge conflict risk assessment)')
222
292
  .option('-r, --resource <resource>', 'Resource to check (omit to show all active work)')
223
- .action((options) => agentCommand('overlaps', options)))
293
+ .action(async (options) => {
294
+ (await lazy.agent())('overlaps', options);
295
+ }))
224
296
  .addCommand(new Command('broadcast')
225
297
  .description('Broadcast a message to all agents')
226
298
  .option('-i, --id <id>', 'Agent ID (required)')
227
299
  .option('-c, --channel <channel>', 'Channel: broadcast, deploy, review, coordination')
228
300
  .option('-m, --message <message>', 'Message payload (JSON or string)')
229
301
  .option('-p, --priority <priority>', 'Priority 1-10', '5')
230
- .action((options) => agentCommand('broadcast', options)))
302
+ .action(async (options) => {
303
+ (await lazy.agent())('broadcast', options);
304
+ }))
231
305
  .addCommand(new Command('send')
232
306
  .description('Send a direct message to another agent')
233
307
  .option('-i, --id <id>', 'Sender agent ID (required)')
234
308
  .option('-t, --to <to>', 'Recipient agent ID (required)')
235
309
  .option('-m, --message <message>', 'Message payload (JSON or string)')
236
310
  .option('-p, --priority <priority>', 'Priority 1-10', '5')
237
- .action((options) => agentCommand('send', options)))
311
+ .action(async (options) => {
312
+ (await lazy.agent())('send', options);
313
+ }))
238
314
  .addCommand(new Command('receive')
239
315
  .description('Receive pending messages')
240
316
  .option('-i, --id <id>', 'Agent ID (required)')
241
317
  .option('-c, --channel <channel>', 'Filter by channel')
242
318
  .option('--no-mark-read', 'Do not mark messages as read')
243
- .action((options) => agentCommand('receive', options)))
319
+ .action(async (options) => {
320
+ (await lazy.agent())('receive', options);
321
+ }))
244
322
  .addCommand(new Command('deregister')
245
323
  .description('Deregister an agent')
246
324
  .option('-i, --id <id>', 'Agent ID (required)')
247
- .action((options) => agentCommand('deregister', options)));
325
+ .action(async (options) => {
326
+ (await lazy.agent())('deregister', options);
327
+ }));
248
328
  program
249
329
  .command('deploy')
250
330
  .description('Deployment batching and execution')
@@ -260,37 +340,53 @@ program
260
340
  .option('--ref <ref>', 'Git ref (for workflow action)')
261
341
  .option('--inputs <inputs>', 'Workflow inputs as JSON (for workflow action)')
262
342
  .option('-p, --priority <priority>', 'Priority 1-10', '5')
263
- .action((options) => deployCommand('queue', options)))
343
+ .action(async (options) => {
344
+ (await lazy.deploy())('queue', options);
345
+ }))
264
346
  .addCommand(new Command('batch')
265
347
  .description('Create a batch from pending deploy actions')
266
348
  .option('-v, --verbose', 'Show detailed batch info')
267
- .action((options) => deployCommand('batch', options)))
349
+ .action(async (options) => {
350
+ (await lazy.deploy())('batch', options);
351
+ }))
268
352
  .addCommand(new Command('execute')
269
353
  .description('Execute a deploy batch')
270
354
  .option('-b, --batch-id <id>', 'Batch ID (required)')
271
355
  .option('--dry-run', 'Show what would be executed without running')
272
- .action((options) => deployCommand('execute', options)))
356
+ .action(async (options) => {
357
+ (await lazy.deploy())('execute', options);
358
+ }))
273
359
  .addCommand(new Command('status')
274
360
  .description('Show deploy queue status')
275
361
  .option('-v, --verbose', 'Show detailed status')
276
- .action((options) => deployCommand('status', options)))
362
+ .action(async (options) => {
363
+ (await lazy.deploy())('status', options);
364
+ }))
277
365
  .addCommand(new Command('flush')
278
366
  .description('Flush all pending deploys (batch and execute)')
279
367
  .option('-v, --verbose', 'Show detailed results')
280
368
  .option('--dry-run', 'Show what would be executed without running')
281
- .action((options) => deployCommand('flush', options)))
369
+ .action(async (options) => {
370
+ (await lazy.deploy())('flush', options);
371
+ }))
282
372
  .addCommand(new Command('config')
283
373
  .description('Show deploy batch configuration (window settings)')
284
- .action((options) => deployCommand('config', options)))
374
+ .action(async (options) => {
375
+ (await lazy.deploy())('config', options);
376
+ }))
285
377
  .addCommand(new Command('set-config')
286
378
  .description('Set deploy batch configuration (window settings)')
287
379
  .option('--message <json>', 'JSON object with window settings, e.g. {"commit":60000,"push":3000}')
288
- .action((options) => deployCommand('set-config', options)))
380
+ .action(async (options) => {
381
+ (await lazy.deploy())('set-config', options);
382
+ }))
289
383
  .addCommand(new Command('urgent')
290
384
  .description('Enable or disable urgent mode (fast batch windows)')
291
385
  .option('--on', 'Enable urgent mode')
292
386
  .option('--off', 'Disable urgent mode (default)')
293
- .action((options) => deployCommand('urgent', { force: options.on, remote: options.off })));
387
+ .action(async (options) => {
388
+ (await lazy.deploy())('urgent', { force: options.on, remote: options.off });
389
+ }));
294
390
  // Task Management
295
391
  program
296
392
  .command('task')
@@ -305,7 +401,9 @@ program
305
401
  .option('--parent <parent>', 'Parent task ID (for hierarchy)')
306
402
  .option('-n, --notes <notes>', 'Markdown notes')
307
403
  .option('--json', 'Output as JSON')
308
- .action((options) => taskCommand('create', options)))
404
+ .action(async (options) => {
405
+ (await lazy.task())('create', options);
406
+ }))
309
407
  .addCommand(new Command('list')
310
408
  .description('List tasks')
311
409
  .option('-s, --filter-status <status>', 'Filter by status (comma-separated)')
@@ -318,13 +416,17 @@ program
318
416
  .option('--show-ready', 'Show only ready tasks')
319
417
  .option('-v, --verbose', 'Show more details')
320
418
  .option('--json', 'Output as JSON')
321
- .action((options) => taskCommand('list', options)))
419
+ .action(async (options) => {
420
+ (await lazy.task())('list', options);
421
+ }))
322
422
  .addCommand(new Command('show')
323
423
  .description('Show task details')
324
424
  .argument('<id>', 'Task ID')
325
425
  .option('-v, --verbose', 'Show history')
326
426
  .option('--json', 'Output as JSON')
327
- .action((id, options) => taskCommand('show', { id, ...options })))
427
+ .action(async (id, options) => {
428
+ (await lazy.task())('show', { id, ...options });
429
+ }))
328
430
  .addCommand(new Command('update')
329
431
  .description('Update a task')
330
432
  .argument('<id>', 'Task ID')
@@ -337,56 +439,80 @@ program
337
439
  .option('-w, --worktree <worktree>', 'Set worktree branch')
338
440
  .option('-l, --labels <labels>', 'New labels (comma-separated)')
339
441
  .option('-n, --notes <notes>', 'New notes')
340
- .action((id, options) => taskCommand('update', { id, ...options })))
442
+ .action(async (id, options) => {
443
+ (await lazy.task())('update', { id, ...options });
444
+ }))
341
445
  .addCommand(new Command('close')
342
446
  .description('Close a task (mark as done)')
343
447
  .argument('<id>', 'Task ID')
344
448
  .option('-r, --reason <reason>', 'Closure reason')
345
- .action((id, options) => taskCommand('close', { id, ...options })))
449
+ .action(async (id, options) => {
450
+ (await lazy.task())('close', { id, ...options });
451
+ }))
346
452
  .addCommand(new Command('delete')
347
453
  .description('Delete a task')
348
454
  .argument('<id>', 'Task ID')
349
- .action((id) => taskCommand('delete', { id })))
455
+ .action(async (id) => {
456
+ (await lazy.task())('delete', { id });
457
+ }))
350
458
  .addCommand(new Command('ready')
351
459
  .description('List tasks ready to work on (no blockers)')
352
460
  .option('--json', 'Output as JSON')
353
- .action((options) => taskCommand('ready', options)))
461
+ .action(async (options) => {
462
+ (await lazy.task())('ready', options);
463
+ }))
354
464
  .addCommand(new Command('blocked')
355
465
  .description('List blocked tasks')
356
466
  .option('--json', 'Output as JSON')
357
- .action((options) => taskCommand('blocked', options)))
467
+ .action(async (options) => {
468
+ (await lazy.task())('blocked', options);
469
+ }))
358
470
  .addCommand(new Command('dep')
359
471
  .description('Add a dependency between tasks')
360
472
  .option('-f, --from <from>', 'Dependent task (the task that is blocked)')
361
473
  .option('-t, --to <to>', 'Blocking task (the task that must complete first)')
362
474
  .option('--dep-type <type>', 'Dependency type: blocks, related, discovered_from', 'blocks')
363
- .action((options) => taskCommand('dep', options)))
475
+ .action(async (options) => {
476
+ (await lazy.task())('dep', options);
477
+ }))
364
478
  .addCommand(new Command('undep')
365
479
  .description('Remove a dependency between tasks')
366
480
  .option('-f, --from <from>', 'Dependent task')
367
481
  .option('-t, --to <to>', 'Blocking task')
368
- .action((options) => taskCommand('undep', options)))
482
+ .action(async (options) => {
483
+ (await lazy.task())('undep', options);
484
+ }))
369
485
  .addCommand(new Command('claim')
370
486
  .description('Claim a task (assign + announce work + create worktree)')
371
487
  .argument('<id>', 'Task ID')
372
488
  .option('-b, --branch <branch>', 'Worktree branch name')
373
- .action((id, options) => taskCommand('claim', { id, ...options })))
489
+ .action(async (id, options) => {
490
+ (await lazy.task())('claim', { id, ...options });
491
+ }))
374
492
  .addCommand(new Command('release')
375
493
  .description('Release a task (mark complete + announce)')
376
494
  .argument('<id>', 'Task ID')
377
495
  .option('-r, --reason <reason>', 'Completion reason')
378
- .action((id, options) => taskCommand('release', { id, ...options })))
496
+ .action(async (id, options) => {
497
+ (await lazy.task())('release', { id, ...options });
498
+ }))
379
499
  .addCommand(new Command('stats')
380
500
  .description('Show task statistics')
381
501
  .option('--json', 'Output as JSON')
382
- .action((options) => taskCommand('stats', options)))
502
+ .action(async (options) => {
503
+ (await lazy.task())('stats', options);
504
+ }))
383
505
  .addCommand(new Command('sync')
384
506
  .description('Sync tasks with JSONL file (for git versioning)')
385
- .action((options) => taskCommand('sync', options)))
507
+ .action(async (options) => {
508
+ (await lazy.task())('sync', options);
509
+ }))
386
510
  .addCommand(new Command('compact')
387
511
  .description('Compact old closed tasks into summaries')
388
512
  .option('--days <days>', 'Compact tasks older than N days', '90')
389
- .action((options) => taskCommand('compact', options)));
513
+ .action(async (options) => {
514
+ (await lazy.task())('compact', options);
515
+ }));
390
516
  // Compliance - protocol verification and auto-fix
391
517
  program
392
518
  .command('compliance')
@@ -394,15 +520,21 @@ program
394
520
  .addCommand(new Command('check')
395
521
  .description('Run compliance check (schema, memory, Qdrant, worktrees, secrets)')
396
522
  .option('-v, --verbose', 'Show detailed information')
397
- .action((options) => complianceCommand('check', options)))
523
+ .action(async (options) => {
524
+ (await lazy.compliance())('check', options);
525
+ }))
398
526
  .addCommand(new Command('audit')
399
527
  .description('Deep compliance audit with verbose output')
400
528
  .option('-v, --verbose', 'Show detailed information')
401
- .action((options) => complianceCommand('audit', options)))
529
+ .action(async (options) => {
530
+ (await lazy.compliance())('audit', options);
531
+ }))
402
532
  .addCommand(new Command('fix')
403
533
  .description('Auto-fix compliance issues (schema migrations, Qdrant collections, worktree cleanup)')
404
534
  .option('-v, --verbose', 'Show detailed information')
405
- .action((options) => complianceCommand('fix', options)));
535
+ .action(async (options) => {
536
+ (await lazy.compliance())('fix', options);
537
+ }));
406
538
  program
407
539
  .command('update')
408
540
  .description('Update CLAUDE.md, memory system, and all related components')
@@ -424,35 +556,50 @@ program
424
556
  .description('Full system overview with charts and progress bars')
425
557
  .option('-v, --verbose', 'Show detailed information')
426
558
  .option('--compact', 'Compact output for narrow terminals')
427
- .action((options) => dashboardCommand('overview', options)))
559
+ .action(async (options) => {
560
+ (await lazy.dashboard())('overview', options);
561
+ }))
428
562
  .addCommand(new Command('tasks')
429
563
  .description('Task breakdown with charts, progress bars, and hierarchy trees')
430
564
  .option('-v, --verbose', 'Show detailed information')
431
565
  .option('--compact', 'Compact output')
432
- .action((options) => dashboardCommand('tasks', options)))
566
+ .action(async (options) => {
567
+ (await lazy.dashboard())('tasks', options);
568
+ }))
433
569
  .addCommand(new Command('agents')
434
570
  .description('Agent activity, resource claims, and coordination status')
435
571
  .option('-v, --verbose', 'Show detailed information')
436
- .action((options) => dashboardCommand('agents', options)))
572
+ .action(async (options) => {
573
+ (await lazy.dashboard())('agents', options);
574
+ }))
437
575
  .addCommand(new Command('memory')
438
576
  .description('Memory system health, capacity, and layer architecture')
439
577
  .option('-v, --verbose', 'Show detailed information')
440
- .action((options) => dashboardCommand('memory', options)))
578
+ .action(async (options) => {
579
+ (await lazy.dashboard())('memory', options);
580
+ }))
441
581
  .addCommand(new Command('progress')
442
582
  .description('Completion tracking with per-priority and per-type progress')
443
583
  .option('-v, --verbose', 'Show detailed information')
444
- .action((options) => dashboardCommand('progress', options)))
584
+ .action(async (options) => {
585
+ (await lazy.dashboard())('progress', options);
586
+ }))
445
587
  .addCommand(new Command('stats')
446
588
  .description('Session context consumption stats with per-tool breakdown')
447
589
  .option('-v, --verbose', 'Show detailed information')
448
- .action((options) => dashboardCommand('stats', options)))
590
+ .action(async (options) => {
591
+ (await lazy.dashboard())('stats', options);
592
+ }))
449
593
  .addCommand(new Command('session')
450
594
  .description('Live UAP session state: infrastructure, patterns, skills, git, policies')
451
595
  .option('-v, --verbose', 'Show detailed information')
452
596
  .option('--compact', 'Compact summary box (for post-task / pre-compact)')
453
- .action((options) => dashboardCommand('session', options)));
454
- // Multi-Model Architecture commands
455
- registerModelCommands(program);
597
+ .action(async (options) => {
598
+ (await lazy.dashboard())('session', options);
599
+ }));
600
+ // Multi-Model Architecture commands - registered lazily via top-level await
601
+ const registerModelFn = await lazy.model();
602
+ registerModelFn(program);
456
603
  // MCP Router - Lightweight hierarchical router for 98%+ token reduction
457
604
  program
458
605
  .command('mcp-router')
@@ -461,13 +608,17 @@ program
461
608
  .description('Start the MCP router as a stdio server')
462
609
  .option('-c, --config <path>', 'Path to mcp.json config file')
463
610
  .option('-v, --verbose', 'Enable verbose logging')
464
- .action((options) => mcpRouterCommand('start', options)))
611
+ .action(async (options) => {
612
+ (await lazy.mcpRouter())('start', options);
613
+ }))
465
614
  .addCommand(new Command('stats')
466
615
  .description('Show router statistics (servers, tools, token savings)')
467
616
  .option('-c, --config <path>', 'Path to mcp.json config file')
468
617
  .option('-v, --verbose', 'Enable verbose logging')
469
618
  .option('--json', 'Output as JSON')
470
- .action((options) => mcpRouterCommand('stats', options)))
619
+ .action(async (options) => {
620
+ (await lazy.mcpRouter())('stats', options);
621
+ }))
471
622
  .addCommand(new Command('discover')
472
623
  .description('Discover tools matching a query')
473
624
  .option('-q, --query <query>', 'Search query (required)')
@@ -476,12 +627,16 @@ program
476
627
  .option('-c, --config <path>', 'Path to mcp.json config file')
477
628
  .option('-v, --verbose', 'Enable verbose logging')
478
629
  .option('--json', 'Output as JSON')
479
- .action((options) => mcpRouterCommand('discover', options)))
630
+ .action(async (options) => {
631
+ (await lazy.mcpRouter())('discover', options);
632
+ }))
480
633
  .addCommand(new Command('list')
481
634
  .description('List configured MCP servers')
482
635
  .option('-c, --config <path>', 'Path to mcp.json config file')
483
636
  .option('--json', 'Output as JSON')
484
- .action((options) => mcpRouterCommand('list', options)));
637
+ .action(async (options) => {
638
+ (await lazy.mcpRouter())('list', options);
639
+ }));
485
640
  // Session Hooks - automatic memory injection and pre-compaction flush
486
641
  program
487
642
  .command('hooks')
@@ -489,27 +644,33 @@ program
489
644
  .addCommand(new Command('install')
490
645
  .description('Install UAP session hooks')
491
646
  .option('-t, --target <target>', 'Target platform: claude, factory, cursor, vscode, opencode, omp (default: all)')
492
- .action((options) => hooksCommand('install', { target: options.target })))
647
+ .action((options) => lazy
648
+ .hooks()
649
+ .then((m) => m.hooksCommand('install', { target: options.target }))))
493
650
  .addCommand(new Command('status')
494
651
  .description('Show hooks installation status')
495
652
  .option('-t, --target <target>', 'Target platform: claude, factory, cursor, vscode, opencode, omp (default: all)')
496
- .action((options) => hooksCommand('status', { target: options.target })));
653
+ .action((options) => lazy
654
+ .hooks()
655
+ .then((m) => m.hooksCommand('status', { target: options.target }))));
497
656
  // Qwen3.5 Tool Call Fixes - performance optimizations for tool calling
498
657
  const toolCallsCmd = new Command('tool-calls');
499
658
  toolCallsCmd.description('Manage Qwen3.5 tool call fixes and chat templates');
500
- toolCallsCmd.addCommand(new Command('setup')
501
- .description('Install chat templates and Python scripts')
502
- .action(() => toolCallsCommand('setup')));
659
+ toolCallsCmd.addCommand(new Command('setup').description('Install chat templates and Python scripts').action(async () => {
660
+ (await lazy.toolCalls())('setup');
661
+ }));
503
662
  toolCallsCmd.addCommand(new Command('test')
504
663
  .description('Run reliability test suite')
505
664
  .addOption(new Option('--verbose', 'Verbose output'))
506
- .action(() => toolCallsCommand('test')));
507
- toolCallsCmd.addCommand(new Command('status')
508
- .description('Check current configuration')
509
- .action(() => toolCallsCommand('status')));
510
- toolCallsCmd.addCommand(new Command('fix')
511
- .description('Apply template fixes to existing templates')
512
- .action(() => toolCallsCommand('fix')));
665
+ .action(async () => {
666
+ (await lazy.toolCalls())('test');
667
+ }));
668
+ toolCallsCmd.addCommand(new Command('status').description('Check current configuration').action(async () => {
669
+ (await lazy.toolCalls())('status');
670
+ }));
671
+ toolCallsCmd.addCommand(new Command('fix').description('Apply template fixes to existing templates').action(async () => {
672
+ (await lazy.toolCalls())('fix');
673
+ }));
513
674
  program.addCommand(toolCallsCmd);
514
675
  // RTK (Rust Token Killer) - CLI proxy for 60-90% token savings
515
676
  const rtkCmd = new Command('rtk');
@@ -519,16 +680,19 @@ rtkCmd.addCommand(new Command('install')
519
680
  .option('--force', 'Force reinstall')
520
681
  .option('--method <method>', 'Installation method (npm, cargo, binary)')
521
682
  .action(async (options) => {
522
- await installRTK({
683
+ const rtk = await lazy.rtk();
684
+ await rtk.installRTK({
523
685
  force: !!options.force,
524
686
  method: options.method,
525
687
  });
526
688
  }));
527
689
  rtkCmd.addCommand(new Command('status').description('Check RTK installation and token savings').action(async () => {
528
- await checkRTKStatus();
690
+ const rtk = await lazy.rtk();
691
+ await rtk.checkRTKStatus();
529
692
  }));
530
- rtkCmd.addCommand(new Command('help').description('Show RTK usage information').action(() => {
531
- showRTKHelp();
693
+ rtkCmd.addCommand(new Command('help').description('Show RTK usage information').action(async () => {
694
+ const rtk = await lazy.rtk();
695
+ rtk.showRTKHelp();
532
696
  }));
533
697
  program.addCommand(rtkCmd);
534
698
  // MCP Setup - Configure MCP Router for all platforms
@@ -538,10 +702,12 @@ program
538
702
  .option('--force', 'Force replace existing MCP configurations')
539
703
  .option('--verbose', 'Enable verbose output')
540
704
  .action(async (options) => {
541
- await setupMcpRouter({ force: !!options.force, verbose: !!options.verbose });
705
+ const fn = await lazy.setupMcpRouter();
706
+ await fn({ force: !!options.force, verbose: !!options.verbose });
542
707
  });
543
- // Register schema-diff command
544
- registerSchemaDiffCommand(program);
708
+ // Register schema-diff command lazily
709
+ const registerSchemaDiffFn = await lazy.schemaDiff();
710
+ registerSchemaDiffFn(program);
545
711
  // UAP for Oh-My-Pi - dashboard and controls for omp users
546
712
  const uapOmpCmd = new Command('uap-omp');
547
713
  uapOmpCmd.description('UAP integration commands for oh-my-pi (omp) users');
@@ -549,32 +715,30 @@ uapOmpCmd.description('UAP integration commands for oh-my-pi (omp) users');
549
715
  uapOmpCmd.addCommand(new Command('dashboard')
550
716
  .description('Show UAP dashboard with tasks, agents, memory, and worktrees')
551
717
  .action(async () => {
552
- const { execSync } = await import('child_process');
553
718
  try {
554
719
  const uapOmpDir = process.env.HOME + '/.uap/omp';
555
720
  const dashboardScript = `${uapOmpDir}/commands/uap-dashboard.sh`;
556
- if (require('fs').existsSync(dashboardScript)) {
721
+ if (existsSync(dashboardScript)) {
557
722
  execSync(`bash "${dashboardScript}"`, { stdio: 'inherit' });
558
723
  }
559
724
  else {
560
- console.error('UAP dashboard not installed. Run: uap-omp install');
725
+ console.error('UAP dashboard not installed. Run: uap-omp install');
561
726
  }
562
727
  }
563
728
  catch (error) {
564
729
  const err = error;
565
- console.error('Error showing dashboard:', err.message);
730
+ console.error('Error showing dashboard:', err.message);
566
731
  }
567
732
  }));
568
733
  // Memory command
569
734
  uapOmpCmd.addCommand(new Command('memory')
570
735
  .description('Manage UAP memory for oh-my-pi')
571
736
  .addCommand(new Command('status').description('Show memory status').action(() => {
572
- const { execSync } = require('child_process');
573
737
  try {
574
738
  const uapOmpDir = process.env.HOME + '/.uap/omp';
575
739
  const dbPath = `${uapOmpDir}/memory/short_term.db`;
576
- if (require('fs').existsSync(dbPath)) {
577
- execSync(`sqlite3 "${dbPath}" "SELECT COUNT(*) as total, COUNT(DISTINCT category) as categories FROM memories;"`, {
740
+ if (existsSync(dbPath)) {
741
+ execSync(`sqlite3 "${dbPath}" "SELECT COUNT(*) as total, COUNT(DISTINCT type) as types FROM memories;"`, {
578
742
  stdio: 'inherit',
579
743
  });
580
744
  }
@@ -584,7 +748,7 @@ uapOmpCmd.addCommand(new Command('memory')
584
748
  }
585
749
  catch (error) {
586
750
  const err = error;
587
- console.error('Error checking memory:', err.message);
751
+ console.error('Error checking memory:', err.message);
588
752
  }
589
753
  }))
590
754
  .addCommand(new Command('query')
@@ -592,15 +756,14 @@ uapOmpCmd.addCommand(new Command('memory')
592
756
  .argument('<search>', 'Search term')
593
757
  .option('-n, --limit <number>', 'Max results', '5')
594
758
  .action((search, options) => {
595
- const { execSync } = require('child_process');
596
759
  try {
597
760
  const uapOmpDir = process.env.HOME + '/.uap/omp';
598
761
  const dbPath = `${uapOmpDir}/memory/short_term.db`;
599
- if (require('fs').existsSync(dbPath)) {
762
+ if (existsSync(dbPath)) {
600
763
  // Sanitize search term to prevent SQL injection
601
764
  const sanitizedSearch = search.replace(/'/g, "''");
602
765
  const sanitizedLimit = parseInt(options.limit, 10) || 5;
603
- execSync(`sqlite3 "${dbPath}" "SELECT content, category, importance FROM memories WHERE content LIKE '%${sanitizedSearch}%' ORDER BY importance DESC LIMIT ${sanitizedLimit};"`, {
766
+ execSync(`sqlite3 "${dbPath}" "SELECT content, type, importance FROM memories WHERE content LIKE '%${sanitizedSearch}%' ORDER BY importance DESC LIMIT ${sanitizedLimit};"`, {
604
767
  stdio: 'inherit',
605
768
  });
606
769
  }
@@ -610,18 +773,17 @@ uapOmpCmd.addCommand(new Command('memory')
610
773
  }
611
774
  catch (error) {
612
775
  const err = error;
613
- console.error('Error querying memory:', err.message);
776
+ console.error('Error querying memory:', err.message);
614
777
  }
615
778
  })));
616
779
  // Worktree command
617
780
  uapOmpCmd.addCommand(new Command('worktree')
618
781
  .description('Manage UAP worktrees for oh-my-pi')
619
782
  .addCommand(new Command('list').description('List active worktrees').action(() => {
620
- const { execSync } = require('child_process');
621
783
  try {
622
784
  const uapOmpDir = process.env.HOME + '/.uap/omp';
623
785
  const worktreesFile = `${uapOmpDir}/worktrees.json`;
624
- if (require('fs').existsSync(worktreesFile)) {
786
+ if (existsSync(worktreesFile)) {
625
787
  execSync(`cat "${worktreesFile}" | jq '.'`, { stdio: 'inherit' });
626
788
  }
627
789
  else {
@@ -630,55 +792,52 @@ uapOmpCmd.addCommand(new Command('worktree')
630
792
  }
631
793
  catch (error) {
632
794
  const err = error;
633
- console.error('Error listing worktrees:', err.message);
795
+ console.error('Error listing worktrees:', err.message);
634
796
  }
635
797
  }))
636
798
  .addCommand(new Command('create')
637
799
  .description('Create a new worktree')
638
800
  .argument('<slug>', 'Worktree slug')
639
801
  .action((slug) => {
640
- const { execSync } = require('child_process');
641
802
  try {
642
803
  execSync(`uap worktree create ${slug}`, { stdio: 'inherit' });
643
804
  }
644
805
  catch (error) {
645
806
  const err = error;
646
- console.error('Error creating worktree:', err.message);
807
+ console.error('Error creating worktree:', err.message);
647
808
  }
648
809
  })));
649
810
  // Hooks command
650
811
  uapOmpCmd.addCommand(new Command('hooks')
651
812
  .description('Manage UAP hooks for oh-my-pi')
652
813
  .addCommand(new Command('install').description('Install UAP hooks for oh-my-pi').action(() => {
653
- const { execSync } = require('child_process');
654
814
  try {
655
- const scriptPath = require('path').join(__dirname, '../../scripts/omp/uap-omp.sh');
656
- if (require('fs').existsSync(scriptPath)) {
815
+ const scriptPath = join(__dirname, '../../scripts/omp/uap-omp.sh');
816
+ if (existsSync(scriptPath)) {
657
817
  execSync(`bash "${scriptPath}" install`, { stdio: 'inherit' });
658
818
  }
659
819
  else {
660
- console.error('UAP hooks script not found. Please rebuild with: npm run build');
820
+ console.error('UAP hooks script not found. Please rebuild with: npm run build');
661
821
  }
662
822
  }
663
823
  catch (error) {
664
824
  const err = error;
665
- console.error('Error installing hooks:', err.message);
825
+ console.error('Error installing hooks:', err.message);
666
826
  }
667
827
  }))
668
828
  .addCommand(new Command('status').description('Show hook installation status').action(() => {
669
- const { execSync } = require('child_process');
670
829
  try {
671
- const scriptPath = require('path').join(__dirname, '../../scripts/omp/uap-omp.sh');
672
- if (require('fs').existsSync(scriptPath)) {
830
+ const scriptPath = join(__dirname, '../../scripts/omp/uap-omp.sh');
831
+ if (existsSync(scriptPath)) {
673
832
  execSync(`bash "${scriptPath}" status`, { stdio: 'inherit' });
674
833
  }
675
834
  else {
676
- console.error('UAP hooks script not found. Please rebuild with: npm run build');
835
+ console.error('UAP hooks script not found. Please rebuild with: npm run build');
677
836
  }
678
837
  }
679
838
  catch (error) {
680
839
  const err = error;
681
- console.error('Error checking hook status:', err.message);
840
+ console.error('Error checking hook status:', err.message);
682
841
  }
683
842
  })));
684
843
  program.addCommand(uapOmpCmd);