@xopcai/xopc 0.0.83 → 0.0.84
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/README.md +2 -0
- package/README.zh-CN.md +3 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agents-CrpYTHJS.js → agents-tR-nNP04.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-1mcKh5Rh.js → apps-page-BDw6SP-d.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-zd6QNKPx.js → channels-settings-DEFd-jj1.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-status-swr-uRAuhiUo.js → channels-status-swr-DI5FHdGe.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-api-O2Q_ruV6.js → cron-api-BSqY8LwW.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-page-By09AQD-.js → cron-page-D7lVDjcR.js} +1 -1
- package/dist/gateway/static/root/assets/{dist-BpQxde0t.js → dist-CqNMNhJM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CY27wj_p.js → extension-debug-page-gf2L0kY_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C-Ed5ZmP.js → extension-page-CQo2Xsmg.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-raLux7E7.js → extension-settings-page-CZf0WoZg.js} +1 -1
- package/dist/gateway/static/root/assets/{field-primitives-fa_hiQcX.js → field-primitives-DTtlp-l8.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-BVl5VHvL.js → heartbeat-config-api-B0drdQEJ.js} +1 -1
- package/dist/gateway/static/root/assets/{index-Y-iqo-gL.js → index-0Gt3TG4j.js} +3 -3
- package/dist/gateway/static/root/assets/{logs-page-BdH2n7ZW.js → logs-page-DMuORLfC.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-Vpchzdp-.js → sessions-page-_UO8g6NN.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-Kk1yAGBl.js → settings-form-section-DkmHkknc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-KBm0u6Dz.js → settings-page-Cz8FoW_A.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-BjeXXaOn.js → skills-page-HrUOxF7H.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-DpTxN4AF.js → utils-BFwcR6pL.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-CwO8Cf01.js → voice-api-key-field-JF8-aqc5.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/src/cli/command-catalog.js +110 -8
- package/dist/src/cli/command-catalog.js.map +1 -1
- package/dist/src/cli/command-loaders.js +2 -0
- package/dist/src/cli/command-loaders.js.map +1 -1
- package/dist/src/cli/command-manifest.js +9 -1
- package/dist/src/cli/command-manifest.js.map +1 -1
- package/dist/src/cli/commands/config.js +70 -19
- package/dist/src/cli/commands/config.js.map +1 -1
- package/dist/src/cli/commands/cron-cli.d.ts +2 -0
- package/dist/src/cli/commands/cron-cli.js +15 -0
- package/dist/src/cli/commands/cron-cli.js.map +1 -0
- package/dist/src/cli/commands/cron.d.ts +4 -1
- package/dist/src/cli/commands/cron.js +76 -41
- package/dist/src/cli/commands/cron.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/channel-config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/channel-config.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
- package/dist/src/cli/commands/doctor/checks/config-health.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/cron-health.js +1 -1
- package/dist/src/cli/commands/doctor/checks/cron-health.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/gateway-health.js +2 -2
- package/dist/src/cli/commands/doctor/checks/gateway-health.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/gateway-service.js +2 -2
- package/dist/src/cli/commands/doctor/checks/gateway-service.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/state-integrity.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +3 -3
- package/dist/src/cli/commands/doctor/checks/workspace-status.js.map +1 -1
- package/dist/src/cli/commands/gateway/index.d.ts +1 -1
- package/dist/src/cli/commands/gateway/index.js +2 -2
- package/dist/src/cli/commands/gateway/service.d.ts +4 -0
- package/dist/src/cli/commands/gateway/service.js +17 -2
- package/dist/src/cli/commands/gateway/service.js.map +1 -1
- package/dist/src/cli/commands/gateway/subcommands.js +1 -4
- package/dist/src/cli/commands/gateway/subcommands.js.map +1 -1
- package/dist/src/cli/commands/init.js +27 -0
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/models.d.ts +4 -1
- package/dist/src/cli/commands/models.js +86 -74
- package/dist/src/cli/commands/models.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +2 -0
- package/dist/src/cli/commands/onboard.js.map +1 -1
- package/dist/src/cli/commands/profile.d.ts +3 -5
- package/dist/src/cli/commands/profile.js +31 -31
- package/dist/src/cli/commands/profile.js.map +1 -1
- package/dist/src/cli/commands/setup.js +6 -1
- package/dist/src/cli/commands/setup.js.map +1 -1
- package/dist/src/cli/gateway-run-argv.js +15 -5
- package/dist/src/cli/gateway-run-argv.js.map +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/service.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
//#region src/cli/command-catalog.ts
|
|
2
2
|
const cliCommandCatalog = [
|
|
3
|
+
{
|
|
4
|
+
commandPath: ["init"],
|
|
5
|
+
policy: { loadExtensions: "never" }
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
commandPath: ["profile"],
|
|
9
|
+
policy: { loadExtensions: "never" }
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
commandPath: ["profile", "list"],
|
|
13
|
+
exact: true,
|
|
14
|
+
policy: { loadExtensions: "never" }
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
commandPath: ["profile", "create"],
|
|
18
|
+
exact: true,
|
|
19
|
+
policy: { loadExtensions: "never" }
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
commandPath: ["profile", "delete"],
|
|
23
|
+
exact: true,
|
|
24
|
+
policy: { loadExtensions: "never" }
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
commandPath: ["profile", "switch"],
|
|
28
|
+
exact: true,
|
|
29
|
+
policy: { loadExtensions: "never" }
|
|
30
|
+
},
|
|
3
31
|
{
|
|
4
32
|
commandPath: ["setup"],
|
|
5
33
|
policy: { loadExtensions: "never" }
|
|
@@ -8,6 +36,45 @@ const cliCommandCatalog = [
|
|
|
8
36
|
commandPath: ["onboard"],
|
|
9
37
|
policy: { loadExtensions: "never" }
|
|
10
38
|
},
|
|
39
|
+
{
|
|
40
|
+
commandPath: ["cron"],
|
|
41
|
+
policy: { loadExtensions: "never" }
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
commandPath: ["cron", "list"],
|
|
45
|
+
exact: true,
|
|
46
|
+
policy: { loadExtensions: "never" }
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
commandPath: ["cron", "add"],
|
|
50
|
+
exact: true,
|
|
51
|
+
policy: { loadExtensions: "never" }
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
commandPath: ["cron", "remove"],
|
|
55
|
+
exact: true,
|
|
56
|
+
policy: { loadExtensions: "never" }
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
commandPath: ["cron", "enable"],
|
|
60
|
+
exact: true,
|
|
61
|
+
policy: { loadExtensions: "never" }
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
commandPath: ["cron", "disable"],
|
|
65
|
+
exact: true,
|
|
66
|
+
policy: { loadExtensions: "never" }
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
commandPath: ["cron", "run"],
|
|
70
|
+
exact: true,
|
|
71
|
+
policy: { loadExtensions: "never" }
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
commandPath: ["cron", "trigger"],
|
|
75
|
+
exact: true,
|
|
76
|
+
policy: { loadExtensions: "never" }
|
|
77
|
+
},
|
|
11
78
|
{
|
|
12
79
|
commandPath: ["config"],
|
|
13
80
|
policy: { loadExtensions: "never" }
|
|
@@ -40,10 +107,6 @@ const cliCommandCatalog = [
|
|
|
40
107
|
commandPath: ["session"],
|
|
41
108
|
policy: { loadExtensions: "never" }
|
|
42
109
|
},
|
|
43
|
-
{
|
|
44
|
-
commandPath: ["cron"],
|
|
45
|
-
policy: { loadExtensions: "never" }
|
|
46
|
-
},
|
|
47
110
|
{
|
|
48
111
|
commandPath: ["mcp"],
|
|
49
112
|
policy: { loadExtensions: "never" }
|
|
@@ -145,22 +208,61 @@ const cliCommandCatalog = [
|
|
|
145
208
|
policy: { loadExtensions: "never" }
|
|
146
209
|
},
|
|
147
210
|
{
|
|
148
|
-
commandPath: ["gateway", "
|
|
211
|
+
commandPath: ["gateway", "service"],
|
|
212
|
+
exact: true,
|
|
213
|
+
policy: { loadExtensions: "never" }
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
commandPath: [
|
|
217
|
+
"gateway",
|
|
218
|
+
"service",
|
|
219
|
+
"install"
|
|
220
|
+
],
|
|
221
|
+
exact: true,
|
|
222
|
+
policy: { loadExtensions: "never" }
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
commandPath: [
|
|
226
|
+
"gateway",
|
|
227
|
+
"service",
|
|
228
|
+
"uninstall"
|
|
229
|
+
],
|
|
230
|
+
exact: true,
|
|
231
|
+
policy: { loadExtensions: "never" }
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
commandPath: [
|
|
235
|
+
"gateway",
|
|
236
|
+
"service",
|
|
237
|
+
"start"
|
|
238
|
+
],
|
|
149
239
|
exact: true,
|
|
150
240
|
policy: { loadExtensions: "never" }
|
|
151
241
|
},
|
|
152
242
|
{
|
|
153
|
-
commandPath: [
|
|
243
|
+
commandPath: [
|
|
244
|
+
"gateway",
|
|
245
|
+
"service",
|
|
246
|
+
"status"
|
|
247
|
+
],
|
|
154
248
|
exact: true,
|
|
155
249
|
policy: { loadExtensions: "never" }
|
|
156
250
|
},
|
|
157
251
|
{
|
|
158
|
-
commandPath: [
|
|
252
|
+
commandPath: [
|
|
253
|
+
"gateway",
|
|
254
|
+
"service",
|
|
255
|
+
"stop"
|
|
256
|
+
],
|
|
159
257
|
exact: true,
|
|
160
258
|
policy: { loadExtensions: "never" }
|
|
161
259
|
},
|
|
162
260
|
{
|
|
163
|
-
commandPath: [
|
|
261
|
+
commandPath: [
|
|
262
|
+
"gateway",
|
|
263
|
+
"service",
|
|
264
|
+
"restart"
|
|
265
|
+
],
|
|
164
266
|
exact: true,
|
|
165
267
|
policy: { loadExtensions: "never" }
|
|
166
268
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-catalog.js","names":[],"sources":["../../../src/cli/command-catalog.ts"],"sourcesContent":["export type CliExtensionLoadPolicy = 'never' | 'when-configured' | 'always';\nexport type CliGatewaySubcommandPolicy = 'lazy' | 'eager';\n\nexport type CliCommandPathPolicy = {\n loadExtensions: CliExtensionLoadPolicy;\n gatewaySubcommands: CliGatewaySubcommandPolicy;\n};\n\nexport type CliCommandCatalogEntry = {\n commandPath: readonly string[];\n exact?: boolean;\n policy?: Partial<CliCommandPathPolicy>;\n};\n\nexport const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [\n { commandPath: ['setup'], policy: { loadExtensions: 'never' } },\n { commandPath: ['onboard'], policy: { loadExtensions: 'never' } },\n { commandPath: ['
|
|
1
|
+
{"version":3,"file":"command-catalog.js","names":[],"sources":["../../../src/cli/command-catalog.ts"],"sourcesContent":["export type CliExtensionLoadPolicy = 'never' | 'when-configured' | 'always';\nexport type CliGatewaySubcommandPolicy = 'lazy' | 'eager';\n\nexport type CliCommandPathPolicy = {\n loadExtensions: CliExtensionLoadPolicy;\n gatewaySubcommands: CliGatewaySubcommandPolicy;\n};\n\nexport type CliCommandCatalogEntry = {\n commandPath: readonly string[];\n exact?: boolean;\n policy?: Partial<CliCommandPathPolicy>;\n};\n\nexport const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [\n { commandPath: ['init'], policy: { loadExtensions: 'never' } },\n { commandPath: ['profile'], policy: { loadExtensions: 'never' } },\n { commandPath: ['profile', 'list'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['profile', 'create'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['profile', 'delete'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['profile', 'switch'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['setup'], policy: { loadExtensions: 'never' } },\n { commandPath: ['onboard'], policy: { loadExtensions: 'never' } },\n { commandPath: ['cron'], policy: { loadExtensions: 'never' } },\n { commandPath: ['cron', 'list'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['cron', 'add'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['cron', 'remove'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['cron', 'enable'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['cron', 'disable'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['cron', 'run'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['cron', 'trigger'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['config'], policy: { loadExtensions: 'never' } },\n { commandPath: ['doctor'], policy: { loadExtensions: 'never' } },\n { commandPath: ['models'], policy: { loadExtensions: 'never' } },\n { commandPath: ['providers'], policy: { loadExtensions: 'never' } },\n { commandPath: ['auth'], policy: { loadExtensions: 'never' } },\n { commandPath: ['logs'], policy: { loadExtensions: 'never' } },\n { commandPath: ['update'], policy: { loadExtensions: 'never' } },\n { commandPath: ['session'], policy: { loadExtensions: 'never' } },\n { commandPath: ['mcp'], policy: { loadExtensions: 'never' } },\n { commandPath: ['search'], policy: { loadExtensions: 'never' } },\n { commandPath: ['voice'], policy: { loadExtensions: 'never' } },\n { commandPath: ['image'], policy: { loadExtensions: 'never' } },\n { commandPath: ['skills'], policy: { loadExtensions: 'never' } },\n { commandPath: ['tailscale'], policy: { loadExtensions: 'never' } },\n { commandPath: ['tunnel'], policy: { loadExtensions: 'never' } },\n { commandPath: ['browser'], policy: { loadExtensions: 'never' } },\n { commandPath: ['tui'], policy: { loadExtensions: 'when-configured' } },\n { commandPath: ['agent'], policy: { loadExtensions: 'when-configured' } },\n { commandPath: ['channels'], policy: { loadExtensions: 'always' } },\n { commandPath: ['extensions'], policy: { loadExtensions: 'always' } },\n { commandPath: ['agents'], policy: { loadExtensions: 'when-configured' } },\n {\n commandPath: ['gateway'],\n exact: true,\n policy: { loadExtensions: 'never', gatewaySubcommands: 'lazy' },\n },\n { commandPath: ['gateway', 'token'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'status'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'health'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'call'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'probe'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'stop'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'restart'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'logs'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'service'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'service', 'install'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'service', 'uninstall'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'service', 'start'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'service', 'status'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'service', 'stop'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'service', 'restart'], exact: true, policy: { loadExtensions: 'never' } },\n { commandPath: ['gateway', 'ssh-tunnel'], exact: true, policy: { loadExtensions: 'never' } },\n];\n"],"mappings":";AAcA,MAAa,oBAAuD;CAClE;EAAE,aAAa,CAAC,OAAO;EAAE,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CAC9D;EAAE,aAAa,CAAC,UAAU;EAAE,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACjE;EAAE,aAAa,CAAC,WAAW,OAAO;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACtF;EAAE,aAAa,CAAC,WAAW,SAAS;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACxF;EAAE,aAAa,CAAC,WAAW,SAAS;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACxF;EAAE,aAAa,CAAC,WAAW,SAAS;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACxF;EAAE,aAAa,CAAC,QAAQ;EAAE,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CAC/D;EAAE,aAAa,CAAC,UAAU;EAAE,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACjE;EAAE,aAAa,CAAC,OAAO;EAAE,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CAC9D;EAAE,aAAa,CAAC,QAAQ,OAAO;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACnF;EAAE,aAAa,CAAC,QAAQ,MAAM;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CAClF;EAAE,aAAa,CAAC,QAAQ,SAAS;EAAE,OAAO;EAAM,QAAQ,EAAE,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BAAgB,SAAS;EAAE;CACtF;EAAE,aAAa,CAAC,WAAW,UAAU;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACzF;EAAE,aAAa,CAAC,WAAW,OAAO;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACtF;EAAE,aAAa,CAAC,WAAW,UAAU;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACzF;EAAE,aAAa;GAAC;GAAW;GAAW;GAAU;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACpG;EAAE,aAAa;GAAC;GAAW;GAAW;GAAY;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACtG;EAAE,aAAa;GAAC;GAAW;GAAW;GAAQ;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CAClG;EAAE,aAAa;GAAC;GAAW;GAAW;GAAS;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACnG;EAAE,aAAa;GAAC;GAAW;GAAW;GAAO;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACjG;EAAE,aAAa;GAAC;GAAW;GAAW;GAAU;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CACpG;EAAE,aAAa,CAAC,WAAW,aAAa;EAAE,OAAO;EAAM,QAAQ,EAAE,gBAAgB,SAAS;EAAE;CAC7F"}
|
|
@@ -3,6 +3,8 @@ import { shouldLoadExtensionCliForCommandPath } from "./command-startup-policy.j
|
|
|
3
3
|
import { registry } from "./registry.js";
|
|
4
4
|
//#region src/cli/command-loaders.ts
|
|
5
5
|
const REGISTRY_COMMAND_MODULES = {
|
|
6
|
+
init: () => import("./commands/init.js"),
|
|
7
|
+
profile: () => import("./commands/profile.js"),
|
|
6
8
|
setup: () => import("./commands/setup.js"),
|
|
7
9
|
onboard: () => import("./commands/onboard.js"),
|
|
8
10
|
agent: () => import("./commands/agent.js"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-loaders.js","names":[],"sources":["../../../src/cli/command-loaders.ts"],"sourcesContent":["/**\n * Lazy command loaders.\n *\n * Modules here trigger their `register({...})` side effect on import; the\n * caller then mounts the requested command via `registry.installOne` (or via\n * the explicit registrar functions for non-registry commands).\n *\n * Keeping this map static-but-thunked means `bin.ts` short-circuits and\n * `runCli` can resolve a single subcommand without paying for unrelated\n * command modules.\n */\nimport type { Command } from 'commander';\nimport { resolveCliCatalogCommandPath } from './command-path-policy.js';\nimport { shouldLoadExtensionCliForCommandPath } from './command-startup-policy.js';\nimport { registry, type CLIContext } from './registry.js';\n\nexport type CommandLoader = () => Promise<unknown>;\n\nexport const REGISTRY_COMMAND_MODULES: Record<string, CommandLoader> = {\n setup: () => import('./commands/setup.js'),\n onboard: () => import('./commands/onboard.js'),\n agent: () => import('./commands/agent.js'),\n tui: () => import('./commands/tui.js'),\n gateway: () => import('./commands/gateway.js'),\n session: () => import('./commands/session.js'),\n cron: () => import('./commands/cron.js'),\n config: () => import('./commands/config.js'),\n doctor: () => import('./commands/doctor/index.js'),\n image: () => import('./commands/image.js'),\n channels: () => import('./commands/channels.js'),\n models: () => import('./commands/models.js'),\n providers: () => import('./commands/providers.js'),\n voice: () => import('./commands/voice.js'),\n search: () => import('./commands/search.js'),\n auth: () => import('./commands/auth.js'),\n skills: () => import('./commands/skills.js'),\n browser: () => import('./commands/browser.js'),\n update: () => import('./commands/update.js'),\n logs: () => import('./commands/logs.js'),\n tunnel: () => import('./commands/tunnel.js'),\n tailscale: () => import('./commands/tailscale.js'),\n mcp: () => import('./commands/mcp.js'),\n};\n\nexport interface NonRegistryMatcher {\n matches: (name: string) => boolean;\n load: (program: Command) => Promise<void>;\n}\n\nexport const NON_REGISTRY_COMMAND_MATCHERS: NonRegistryMatcher[] = [\n {\n matches: (name) => name === 'agents' || name.startsWith('agents:'),\n load: async (program) => {\n const { registerAgentsCli } = await import('./commands/agents.js');\n registerAgentsCli(program);\n },\n },\n {\n matches: (name) => name === 'extensions',\n load: async (program) => {\n const { registerExtensionCommands } = await import('./commands/extension.js');\n registerExtensionCommands(program);\n const commandPath = resolveCliCatalogCommandPath(process.argv);\n if (shouldLoadExtensionCliForCommandPath(commandPath)) {\n const { registerExtensionCliCommands } = await import('./extension-cli-register.js');\n await registerExtensionCliCommands(program);\n }\n },\n },\n];\n\nconst FLAGS_WITH_VALUE = new Set(['--config', '--workspace']);\n\n/**\n * Resolve which command module to load based on argv. Skips global flags\n * (`--verbose`/`--config <path>`/`--workspace <path>`) and treats\n * `help <cmd>` as if the user had typed `<cmd>`, so that `xopc help gateway`\n * loads only the gateway module.\n */\nexport function resolveCommandName(argv: string[]): string | undefined {\n let i = 2;\n let firstSubcommand: string | undefined;\n while (i < argv.length) {\n const arg = argv[i];\n if (!arg) {\n i += 1;\n continue;\n }\n if (arg.startsWith('-')) {\n i += FLAGS_WITH_VALUE.has(arg) ? 2 : 1;\n continue;\n }\n if (firstSubcommand === undefined) {\n firstSubcommand = arg;\n if (arg === 'help') {\n i += 1;\n continue;\n }\n return arg;\n }\n return arg;\n }\n return firstSubcommand;\n}\n\nexport async function tryLoadCommand(\n program: Command,\n ctx: CLIContext,\n name: string,\n getCtx?: () => CLIContext,\n): Promise<boolean> {\n const moduleLoader = REGISTRY_COMMAND_MODULES[name];\n if (moduleLoader) {\n await moduleLoader();\n const installed = registry.installOne(program, name, ctx, getCtx);\n if (installed && name === 'gateway') {\n const gatewayCmd = program.commands.find((command) => command.name() === 'gateway');\n if (gatewayCmd) {\n const { prepareGatewayCommandForArgv } = await import('./commands/gateway.js');\n await prepareGatewayCommandForArgv(gatewayCmd, ctx);\n }\n }\n return installed;\n }\n const matcher = NON_REGISTRY_COMMAND_MATCHERS.find((m) => m.matches(name));\n if (matcher) {\n await matcher.load(program);\n return true;\n }\n return false;\n}\n\nexport async function loadAllCommands(\n program: Command,\n ctx: CLIContext,\n getCtx?: () => CLIContext,\n): Promise<void> {\n // Sequential to keep registration order deterministic; registry.install\n // sorts by category and is stable within a category.\n for (const loader of Object.values(REGISTRY_COMMAND_MODULES)) {\n await loader();\n }\n registry.install(program, ctx, getCtx);\n for (const matcher of NON_REGISTRY_COMMAND_MATCHERS) {\n await matcher.load(program);\n }\n const gatewayCmd = program.commands.find((command) => command.name() === 'gateway');\n if (gatewayCmd) {\n const { prepareGatewayCommandForArgv } = await import('./commands/gateway.js');\n await prepareGatewayCommandForArgv(gatewayCmd, ctx);\n }\n}\n"],"mappings":";;;;AAkBA,MAAa,2BAA0D;CACrE,aAAa,OAAO;CACpB,eAAe,OAAO;CACtB,aAAa,OAAO;CACpB,WAAW,OAAO;CAClB,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,cAAc,OAAO;CACrB,aAAa,OAAO;CACpB,gBAAgB,OAAO;CACvB,cAAc,OAAO;CACrB,iBAAiB,OAAO;CACxB,aAAa,OAAO;CACpB,cAAc,OAAO;CACrB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,eAAe,OAAO;CACtB,cAAc,OAAO;CACrB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,iBAAiB,OAAO;CACxB,WAAW,OAAO;CACnB;AAOD,MAAa,gCAAsD,CACjE;CACE,UAAU,SAAS,SAAS,YAAY,KAAK,WAAW,UAAU;CAClE,MAAM,OAAO,YAAY;EACvB,MAAM,EAAE,sBAAsB,MAAM,OAAO;AAC3C,oBAAkB,QAAQ;;CAE7B,EACD;CACE,UAAU,SAAS,SAAS;CAC5B,MAAM,OAAO,YAAY;EACvB,MAAM,EAAE,8BAA8B,MAAM,OAAO;AACnD,4BAA0B,QAAQ;AAElC,MAAI,qCADgB,6BAA6B,QAAQ,KACL,CAAC,EAAE;GACrD,MAAM,EAAE,iCAAiC,MAAM,OAAO;AACtD,SAAM,6BAA6B,QAAQ;;;CAGhD,CACF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EAAE,iCAAiC,MAAM,OAAO;AACtD,QAAM,6BAA6B,YAAY,IAAI"}
|
|
1
|
+
{"version":3,"file":"command-loaders.js","names":[],"sources":["../../../src/cli/command-loaders.ts"],"sourcesContent":["/**\n * Lazy command loaders.\n *\n * Modules here trigger their `register({...})` side effect on import; the\n * caller then mounts the requested command via `registry.installOne` (or via\n * the explicit registrar functions for non-registry commands).\n *\n * Keeping this map static-but-thunked means `bin.ts` short-circuits and\n * `runCli` can resolve a single subcommand without paying for unrelated\n * command modules.\n */\nimport type { Command } from 'commander';\nimport { resolveCliCatalogCommandPath } from './command-path-policy.js';\nimport { shouldLoadExtensionCliForCommandPath } from './command-startup-policy.js';\nimport { registry, type CLIContext } from './registry.js';\n\nexport type CommandLoader = () => Promise<unknown>;\n\nexport const REGISTRY_COMMAND_MODULES: Record<string, CommandLoader> = {\n init: () => import('./commands/init.js'),\n profile: () => import('./commands/profile.js'),\n setup: () => import('./commands/setup.js'),\n onboard: () => import('./commands/onboard.js'),\n agent: () => import('./commands/agent.js'),\n tui: () => import('./commands/tui.js'),\n gateway: () => import('./commands/gateway.js'),\n session: () => import('./commands/session.js'),\n cron: () => import('./commands/cron.js'),\n config: () => import('./commands/config.js'),\n doctor: () => import('./commands/doctor/index.js'),\n image: () => import('./commands/image.js'),\n channels: () => import('./commands/channels.js'),\n models: () => import('./commands/models.js'),\n providers: () => import('./commands/providers.js'),\n voice: () => import('./commands/voice.js'),\n search: () => import('./commands/search.js'),\n auth: () => import('./commands/auth.js'),\n skills: () => import('./commands/skills.js'),\n browser: () => import('./commands/browser.js'),\n update: () => import('./commands/update.js'),\n logs: () => import('./commands/logs.js'),\n tunnel: () => import('./commands/tunnel.js'),\n tailscale: () => import('./commands/tailscale.js'),\n mcp: () => import('./commands/mcp.js'),\n};\n\nexport interface NonRegistryMatcher {\n matches: (name: string) => boolean;\n load: (program: Command) => Promise<void>;\n}\n\nexport const NON_REGISTRY_COMMAND_MATCHERS: NonRegistryMatcher[] = [\n {\n matches: (name) => name === 'agents' || name.startsWith('agents:'),\n load: async (program) => {\n const { registerAgentsCli } = await import('./commands/agents.js');\n registerAgentsCli(program);\n },\n },\n {\n matches: (name) => name === 'extensions',\n load: async (program) => {\n const { registerExtensionCommands } = await import('./commands/extension.js');\n registerExtensionCommands(program);\n const commandPath = resolveCliCatalogCommandPath(process.argv);\n if (shouldLoadExtensionCliForCommandPath(commandPath)) {\n const { registerExtensionCliCommands } = await import('./extension-cli-register.js');\n await registerExtensionCliCommands(program);\n }\n },\n },\n];\n\nconst FLAGS_WITH_VALUE = new Set(['--config', '--workspace']);\n\n/**\n * Resolve which command module to load based on argv. Skips global flags\n * (`--verbose`/`--config <path>`/`--workspace <path>`) and treats\n * `help <cmd>` as if the user had typed `<cmd>`, so that `xopc help gateway`\n * loads only the gateway module.\n */\nexport function resolveCommandName(argv: string[]): string | undefined {\n let i = 2;\n let firstSubcommand: string | undefined;\n while (i < argv.length) {\n const arg = argv[i];\n if (!arg) {\n i += 1;\n continue;\n }\n if (arg.startsWith('-')) {\n i += FLAGS_WITH_VALUE.has(arg) ? 2 : 1;\n continue;\n }\n if (firstSubcommand === undefined) {\n firstSubcommand = arg;\n if (arg === 'help') {\n i += 1;\n continue;\n }\n return arg;\n }\n return arg;\n }\n return firstSubcommand;\n}\n\nexport async function tryLoadCommand(\n program: Command,\n ctx: CLIContext,\n name: string,\n getCtx?: () => CLIContext,\n): Promise<boolean> {\n const moduleLoader = REGISTRY_COMMAND_MODULES[name];\n if (moduleLoader) {\n await moduleLoader();\n const installed = registry.installOne(program, name, ctx, getCtx);\n if (installed && name === 'gateway') {\n const gatewayCmd = program.commands.find((command) => command.name() === 'gateway');\n if (gatewayCmd) {\n const { prepareGatewayCommandForArgv } = await import('./commands/gateway.js');\n await prepareGatewayCommandForArgv(gatewayCmd, ctx);\n }\n }\n return installed;\n }\n const matcher = NON_REGISTRY_COMMAND_MATCHERS.find((m) => m.matches(name));\n if (matcher) {\n await matcher.load(program);\n return true;\n }\n return false;\n}\n\nexport async function loadAllCommands(\n program: Command,\n ctx: CLIContext,\n getCtx?: () => CLIContext,\n): Promise<void> {\n // Sequential to keep registration order deterministic; registry.install\n // sorts by category and is stable within a category.\n for (const loader of Object.values(REGISTRY_COMMAND_MODULES)) {\n await loader();\n }\n registry.install(program, ctx, getCtx);\n for (const matcher of NON_REGISTRY_COMMAND_MATCHERS) {\n await matcher.load(program);\n }\n const gatewayCmd = program.commands.find((command) => command.name() === 'gateway');\n if (gatewayCmd) {\n const { prepareGatewayCommandForArgv } = await import('./commands/gateway.js');\n await prepareGatewayCommandForArgv(gatewayCmd, ctx);\n }\n}\n"],"mappings":";;;;AAkBA,MAAa,2BAA0D;CACrE,YAAY,OAAO;CACnB,eAAe,OAAO;CACtB,aAAa,OAAO;CACpB,eAAe,OAAO;CACtB,aAAa,OAAO;CACpB,WAAW,OAAO;CAClB,eAAe,OAAO;CACtB,eAAe,OAAO;CACtB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,cAAc,OAAO;CACrB,aAAa,OAAO;CACpB,gBAAgB,OAAO;CACvB,cAAc,OAAO;CACrB,iBAAiB,OAAO;CACxB,aAAa,OAAO;CACpB,cAAc,OAAO;CACrB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,eAAe,OAAO;CACtB,cAAc,OAAO;CACrB,YAAY,OAAO;CACnB,cAAc,OAAO;CACrB,iBAAiB,OAAO;CACxB,WAAW,OAAO;CACnB;AAOD,MAAa,gCAAsD,CACjE;CACE,UAAU,SAAS,SAAS,YAAY,KAAK,WAAW,UAAU;CAClE,MAAM,OAAO,YAAY;EACvB,MAAM,EAAE,sBAAsB,MAAM,OAAO;AAC3C,oBAAkB,QAAQ;;CAE7B,EACD;CACE,UAAU,SAAS,SAAS;CAC5B,MAAM,OAAO,YAAY;EACvB,MAAM,EAAE,8BAA8B,MAAM,OAAO;AACnD,4BAA0B,QAAQ;AAElC,MAAI,qCADgB,6BAA6B,QAAQ,KACL,CAAC,EAAE;GACrD,M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SAAS,MAAM,YAAY,QAAQ,MAAM,KAAK,UAAU;AACnF,KAAI,YAAY;EACd,MAAM,EAAE,iCAAiC,MAAM,OAAO;AACtD,QAAM,6BAA6B,YAAY,IAAI"}
|
|
@@ -23,10 +23,18 @@ const ROOT_HELP_OPTIONS = [
|
|
|
23
23
|
}
|
|
24
24
|
];
|
|
25
25
|
const ROOT_HELP_COMMANDS = [
|
|
26
|
+
{
|
|
27
|
+
name: "init [options]",
|
|
28
|
+
description: "Initialize xopc state directories, config, and agent workspace"
|
|
29
|
+
},
|
|
26
30
|
{
|
|
27
31
|
name: "setup [options]",
|
|
28
32
|
description: "Initialize config file and workspace directory"
|
|
29
33
|
},
|
|
34
|
+
{
|
|
35
|
+
name: "profile",
|
|
36
|
+
description: "Manage xopc state profiles (~/.xopc vs ~/.xopc-<name>)"
|
|
37
|
+
},
|
|
30
38
|
{
|
|
31
39
|
name: "onboard [options]",
|
|
32
40
|
description: "Interactive setup wizard for xopc (gateway uses schema defaults)"
|
|
@@ -80,7 +88,7 @@ const ROOT_HELP_COMMANDS = [
|
|
|
80
88
|
description: "Manage scheduled tasks"
|
|
81
89
|
},
|
|
82
90
|
{
|
|
83
|
-
name: "config",
|
|
91
|
+
name: "config [options]",
|
|
84
92
|
description: "View and edit configuration"
|
|
85
93
|
},
|
|
86
94
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-manifest.js","names":[],"sources":["../../../src/cli/command-manifest.ts"],"sourcesContent":["export type RootHelpOption = {\n flags: string;\n description: string;\n};\n\nexport type RootHelpCommand = {\n name: string;\n description: string;\n};\n\nexport const ROOT_COMMAND_DESCRIPTION = 'Ultra-Lightweight Personal AI Assistant';\n\nexport const ROOT_HELP_OPTIONS: RootHelpOption[] = [\n { flags: '-V, --version', description: 'output the version number' },\n { flags: '--verbose', description: 'Enable verbose logging (default: false)' },\n { flags: '--config <path>', description: 'Config file path' },\n { flags: '--workspace <path>', description: 'Workspace directory' },\n { flags: '-h, --help', description: 'display help for command' },\n];\n\nexport const ROOT_HELP_COMMANDS: RootHelpCommand[] = [\n { name: 'setup [options]', description: 'Initialize config file and workspace directory' },\n { name: 'onboard [options]', description: 'Interactive setup wizard for xopc (gateway uses schema defaults)' },\n { name: 'channels', description: 'Messaging channel login and credentials' },\n { name: 'auth', description: 'Manage authentication credentials' },\n { name: 'agent [options]', description: 'Chat with the AI agent' },\n { name: 'tui [options]', description: 'Interactive terminal UI (pi-tui)' },\n { name: 'tunnel', description: 'Manage FRP remote access tunnel' },\n { name: 'gateway [options]', description: 'Start the xopc gateway server' },\n { name: 'session', description: 'Session management commands' },\n { name: 'doctor [options]', description: 'Check xopc installation health and diagnose common issues' },\n { name: 'update [options]', description: 'Check for and install xopc updates' },\n { name: 'logs', description: 'Manage and query logs' },\n { name: 'mcp', description: 'Manage xopc MCP config and channel bridge' },\n { name: 'cron', description: 'Manage scheduled tasks' },\n { name: 'config', description: 'View and edit configuration' },\n { name: 'image', description: 'Configure image generation and understanding models' },\n { name: 'models [options]', description: 'List and manage available models' },\n { name: 'providers', description: 'Manage LLM provider credentials (user-friendly hub over `xopc auth`)' },\n { name: 'voice', description: 'Configure text-to-speech (TTS) output' },\n { name: 'search', description: 'Manage web-search providers (brave / tavily / bing / searxng)' },\n { name: 'skills', description: 'Manage skills' },\n { name: 'tailscale', description: 'Tailscale status for gateway remote access' },\n { name: 'browser', description: 'Browser automation commands (uses Playwright)' },\n { name: 'agents', description: 'Manage agents (config + workspace)' },\n { name: 'extensions', description: 'Manage extensions' },\n { name: 'help [command]', description: 'display help for command' },\n];\n\nfunction formatRows(rows: Array<{ label: string; description: string }>): string {\n const labelWidth = Math.max(...rows.map((row) => row.label.length)) + 2;\n return rows.map((row) => ` ${row.label.padEnd(labelWidth)}${row.description}`).join('\\n');\n}\n\nexport function formatRootHelp(): string {\n const options = formatRows(ROOT_HELP_OPTIONS.map((option) => ({ label: option.flags, description: option.description })));\n const commands = formatRows(\n ROOT_HELP_COMMANDS.map((command) => ({ label: command.name, description: command.description })),\n );\n return `Usage: xopc [options] [command]\n\n${ROOT_COMMAND_DESCRIPTION}\n\nOptions:\n${options}\n\nCommands:\n${commands}`;\n}\n"],"mappings":";AAUA,MAAa,2BAA2B;AAExC,MAAa,oBAAsC;CACjD;EAAE,OAAO;EAAiB,aAAa;EAA6B;CACpE;EAAE,OAAO;EAAa,aAAa;EAA2C;CAC9E;EAAE,OAAO;EAAmB,aAAa;EAAoB;CAC7D;EAAE,OAAO;EAAsB,aAAa;EAAuB;CACnE;EAAE,OAAO;EAAc,aAAa;EAA4B;CACjE;AAED,MAAa,qBAAwC;CACnD;EAAE,MAAM;EAAmB,aAAa;EAAkD;CAC1F;EAAE,MAAM;EAAqB,aAAa;EAAoE;CAC9G;EAAE,MAAM;EAAY,aAAa;EAA2C;CAC5E;EAAE,MAAM;EAAQ,aAAa;EAAqC;CAClE;EAAE,MAAM;EAAmB,aAAa;EAA0B;CAClE;EAAE,MAAM;EAAiB,aAAa;EAAoC;CAC1E;EAAE,MAAM;EAAU,aAAa;EAAmC;CAClE;EAAE,MAAM;EAAqB,aAAa;EAAiC;CAC3E;EAAE,MAAM;EAAW,aAAa;EAA+B;CAC/D;EAAE,MAAM;EAAoB,aAAa;EAA6D;CACtG;EAAE,MAAM;EAAoB,aAAa;EAAsC;CAC/E;EAAE,MAAM;EAAQ,aAAa;EAAyB;CACtD;EAAE,MAAM;EAAO,aAAa;EAA6C;CACzE;EAAE,MAAM;EAAQ,aAAa;EAA0B;CACvD;EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"command-manifest.js","names":[],"sources":["../../../src/cli/command-manifest.ts"],"sourcesContent":["export type RootHelpOption = {\n flags: string;\n description: string;\n};\n\nexport type RootHelpCommand = {\n name: string;\n description: string;\n};\n\nexport const ROOT_COMMAND_DESCRIPTION = 'Ultra-Lightweight Personal AI Assistant';\n\nexport const ROOT_HELP_OPTIONS: RootHelpOption[] = [\n { flags: '-V, --version', description: 'output the version number' },\n { flags: '--verbose', description: 'Enable verbose logging (default: false)' },\n { flags: '--config <path>', description: 'Config file path' },\n { flags: '--workspace <path>', description: 'Workspace directory' },\n { flags: '-h, --help', description: 'display help for command' },\n];\n\nexport const ROOT_HELP_COMMANDS: RootHelpCommand[] = [\n { name: 'init [options]', description: 'Initialize xopc state directories, config, and agent workspace' },\n { name: 'setup [options]', description: 'Initialize config file and workspace directory' },\n { name: 'profile', description: 'Manage xopc state profiles (~/.xopc vs ~/.xopc-<name>)' },\n { name: 'onboard [options]', description: 'Interactive setup wizard for xopc (gateway uses schema defaults)' },\n { name: 'channels', description: 'Messaging channel login and credentials' },\n { name: 'auth', description: 'Manage authentication credentials' },\n { name: 'agent [options]', description: 'Chat with the AI agent' },\n { name: 'tui [options]', description: 'Interactive terminal UI (pi-tui)' },\n { name: 'tunnel', description: 'Manage FRP remote access tunnel' },\n { name: 'gateway [options]', description: 'Start the xopc gateway server' },\n { name: 'session', description: 'Session management commands' },\n { name: 'doctor [options]', description: 'Check xopc installation health and diagnose common issues' },\n { name: 'update [options]', description: 'Check for and install xopc updates' },\n { name: 'logs', description: 'Manage and query logs' },\n { name: 'mcp', description: 'Manage xopc MCP config and channel bridge' },\n { name: 'cron', description: 'Manage scheduled tasks' },\n { name: 'config [options]', description: 'View and edit configuration' },\n { name: 'image', description: 'Configure image generation and understanding models' },\n { name: 'models [options]', description: 'List and manage available models' },\n { name: 'providers', description: 'Manage LLM provider credentials (user-friendly hub over `xopc auth`)' },\n { name: 'voice', description: 'Configure text-to-speech (TTS) output' },\n { name: 'search', description: 'Manage web-search providers (brave / tavily / bing / searxng)' },\n { name: 'skills', description: 'Manage skills' },\n { name: 'tailscale', description: 'Tailscale status for gateway remote access' },\n { name: 'browser', description: 'Browser automation commands (uses Playwright)' },\n { name: 'agents', description: 'Manage agents (config + workspace)' },\n { name: 'extensions', description: 'Manage extensions' },\n { name: 'help [command]', description: 'display help for command' },\n];\n\nfunction formatRows(rows: Array<{ label: string; description: string }>): string {\n const labelWidth = Math.max(...rows.map((row) => row.label.length)) + 2;\n return rows.map((row) => ` ${row.label.padEnd(labelWidth)}${row.description}`).join('\\n');\n}\n\nexport function formatRootHelp(): string {\n const options = formatRows(ROOT_HELP_OPTIONS.map((option) => ({ label: option.flags, description: option.description })));\n const commands = formatRows(\n ROOT_HELP_COMMANDS.map((command) => ({ label: command.name, description: command.description })),\n );\n return `Usage: xopc [options] [command]\n\n${ROOT_COMMAND_DESCRIPTION}\n\nOptions:\n${options}\n\nCommands:\n${commands}`;\n}\n"],"mappings":";AAUA,MAAa,2BAA2B;AAExC,MAAa,oBAAsC;CACjD;EAAE,OAAO;EAAiB,aAAa;EAA6B;CACpE;EAAE,OAAO;EAAa,aAAa;EAA2C;CAC9E;EAAE,OAAO;EAAmB,aAAa;EAAoB;CAC7D;EAAE,OAAO;EAAsB,aAAa;EAAuB;CACnE;EAAE,OAAO;EAAc,aAAa;EAA4B;CACjE;AAED,MAAa,qBAAwC;CACnD;EAAE,MAAM;EAAkB,aAAa;EAAkE;CACzG;EAAE,MAAM;EAAmB,aAAa;EAAkD;CAC1F;EAAE,MAAM;EAAW,aAAa;EAA0D;CAC1F;EAAE,MAAM;EAAqB,aAAa;EAAoE;CAC9G;EAAE,MAAM;EAAY,aAAa;EAA2C;CAC5E;EAAE,MAAM;EAAQ,aAAa;EAAqC;CAClE;EAAE,MAAM;EAAmB,aAAa;EAA0B;CAClE;EAAE,MAAM;EAAiB,aAAa;EAAoC;CAC1E;EAAE,MAAM;EAAU,aAAa;EAAmC;CAClE;EAAE,MAAM;EAAqB,aAAa;EAAiC;CAC3E;EAAE,MAAM;EAAW,aAAa;EAA+B;CAC/D;EAAE,MAAM;EAAoB,aAAa;EAA6D;CACtG;EAAE,MAAM;EAAoB,aAAa;EAAsC;CAC/E;EAAE,MAAM;EAAQ,aAAa;EAAyB;CACtD;EAAE,MAAM;EAAO,aAAa;EAA6C;CACzE;EAAE,MAAM;EAAQ,aAAa;EAA0B;CACvD;EAAE,MAAM;EAAoB,aAAa;EAA+B;CACxE;EAAE,MAAM;EAAS,aAAa;EAAuD;CACrF;EAAE,MAAM;EAAoB,aAAa;EAAoC;CAC7E;EAAE,MAAM;EAAa,aAAa;EAAwE;CAC1G;EAAE,MAAM;EAAS,aAAa;EAAyC;CACvE;EAAE,MAAM;EAAU,aAAa;EAAiE;CAChG;EAAE,MAAM;EAAU,aAAa;EAAiB;CAChD;EAAE,MAAM;EAAa,aAAa;EAA8C;CAChF;EAAE,MAAM;EAAW,aAAa;EAAiD;CACjF;EAAE,MAAM;EAAU,aAAa;EAAsC;CACrE;EAAE,MAAM;EAAc,aAAa;EAAqB;CACxD;EAAE,MAAM;EAAkB,aAAa;EAA4B;CACpE;AAED,SAAS,WAAW,MAA6D;CAC/E,MAAM,aAAa,KAAK,IAAI,GAAG,KAAK,KAAK,QAAQ,IAAI,MAAM,OAAO,CAAC,GAAG;AACtE,QAAO,KAAK,KAAK,QAAQ,KAAK,IAAI,MAAM,OAAO,WAAW,GAAG,IAAI,cAAc,CAAC,KAAK,KAAK;;AAG5F,SAAgB,iBAAyB;AAKvC,QAAO;;EAEP,yBAAyB;;;EANT,WAAW,kBAAkB,KAAK,YAAY;EAAE,OAAO,OAAO;EAAO,aAAa,OAAO;EAAa,EAAE,CASjH,CAAC;;;EARS,WACf,mBAAmB,KAAK,aAAa;EAAE,OAAO,QAAQ;EAAM,aAAa,QAAQ;EAAa,EAAE,CAU1F"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
2
|
+
import { ConfigSchema, init_schema } from "../../config/schema.js";
|
|
2
3
|
import { formatExamples, register } from "../registry.js";
|
|
3
4
|
import { resolveGatewayLocalClientHost } from "../../config/gateway-bind.js";
|
|
4
|
-
import { existsSync } from "fs";
|
|
5
|
+
import { existsSync, readFileSync } from "fs";
|
|
5
6
|
import { Command } from "commander";
|
|
6
7
|
//#region src/cli/commands/config.ts
|
|
7
8
|
init_write_file_atomic();
|
|
9
|
+
init_schema();
|
|
10
|
+
const MISSING_CONFIG_HINT = "Run: xopc setup, xopc onboard, or xopc init";
|
|
8
11
|
async function loadConfigDeps() {
|
|
9
12
|
const [{ loadConfig }, { createLogger }] = await Promise.all([import("../../config/index.js"), import("../../utils/logger.js")]);
|
|
10
13
|
return {
|
|
@@ -12,6 +15,49 @@ async function loadConfigDeps() {
|
|
|
12
15
|
log: createLogger("ConfigCommand")
|
|
13
16
|
};
|
|
14
17
|
}
|
|
18
|
+
async function runConfigShow(configPath) {
|
|
19
|
+
const { loadConfig, log } = await loadConfigDeps();
|
|
20
|
+
if (!existsSync(configPath)) {
|
|
21
|
+
log.warn(`No config file found. ${MISSING_CONFIG_HINT}`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const config = loadConfig(configPath);
|
|
25
|
+
const maskedConfig = JSON.stringify(config, (key, value) => {
|
|
26
|
+
if (key === "api_key" || key === "token") return value ? "********" : value;
|
|
27
|
+
return value;
|
|
28
|
+
}, 2);
|
|
29
|
+
console.log(maskedConfig);
|
|
30
|
+
}
|
|
31
|
+
async function runConfigValidate(configPath) {
|
|
32
|
+
const { log } = await loadConfigDeps();
|
|
33
|
+
if (!existsSync(configPath)) {
|
|
34
|
+
log.error("Config file not found. Run: xopc onboard");
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
let json;
|
|
38
|
+
try {
|
|
39
|
+
json = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
40
|
+
} catch {
|
|
41
|
+
log.error("Config file is not valid JSON.");
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const parsed = ConfigSchema.safeParse(json);
|
|
45
|
+
if (!parsed.success) {
|
|
46
|
+
log.error("Config does not match the expected schema.");
|
|
47
|
+
for (const issue of parsed.error.issues) console.error(` - ${issue.path.join(".") || "(root)"}: ${issue.message}`);
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const { validateChannelPluginConfigs } = await import("../../config/validate-channel-configs.js");
|
|
51
|
+
const channelErrors = validateChannelPluginConfigs(parsed.data);
|
|
52
|
+
if (channelErrors.length > 0) {
|
|
53
|
+
log.error("Channel configuration failed validation.");
|
|
54
|
+
for (const err of channelErrors) console.error(` - ${err}`);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
log.info({ path: configPath }, "Config is valid");
|
|
58
|
+
console.log("✅ Configuration is valid");
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
15
61
|
function getNestedValue(obj, path) {
|
|
16
62
|
return path.split(".").reduce((current, key) => {
|
|
17
63
|
if (current && typeof current === "object" && key in current) return current[key];
|
|
@@ -28,19 +74,30 @@ function setNestedValue(obj, path, value) {
|
|
|
28
74
|
return obj;
|
|
29
75
|
}
|
|
30
76
|
function createConfigCommand(ctx) {
|
|
31
|
-
const cmd = new Command("config").description("View and edit configuration").addHelpText("after", formatExamples([
|
|
77
|
+
const cmd = new Command("config").description("View and edit configuration").option("--show", "Show full configuration (alias for `config show`)").option("--validate", "Validate configuration file (alias for `config validate`)").addHelpText("after", formatExamples([
|
|
32
78
|
"xopc config get agents.defaults.model",
|
|
33
79
|
"xopc config set agents.defaults.temperature 0.8",
|
|
34
80
|
"xopc config unset agents.defaults.max_tokens",
|
|
35
81
|
"xopc config show",
|
|
82
|
+
"xopc config validate",
|
|
36
83
|
"xopc config token # Show gateway token info",
|
|
37
84
|
"xopc config token --show # Show full token",
|
|
38
85
|
"xopc config token --generate # Generate new token"
|
|
39
|
-
]))
|
|
86
|
+
])).action(async (options) => {
|
|
87
|
+
if (options.show) {
|
|
88
|
+
await runConfigShow(ctx.configPath);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (options.validate) {
|
|
92
|
+
if (!await runConfigValidate(ctx.configPath)) process.exit(1);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
cmd.outputHelp();
|
|
96
|
+
});
|
|
40
97
|
cmd.command("get <path>").description("Get a config value by dot path").action(async (path) => {
|
|
41
98
|
const { loadConfig, log } = await loadConfigDeps();
|
|
42
99
|
if (!existsSync(ctx.configPath)) {
|
|
43
|
-
log.error(
|
|
100
|
+
log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);
|
|
44
101
|
process.exit(1);
|
|
45
102
|
}
|
|
46
103
|
const value = getNestedValue(loadConfig(ctx.configPath), path);
|
|
@@ -53,7 +110,7 @@ function createConfigCommand(ctx) {
|
|
|
53
110
|
cmd.command("set <path> <value>").description("Set a config value by dot path").action(async (path, value) => {
|
|
54
111
|
const { loadConfig, log } = await loadConfigDeps();
|
|
55
112
|
if (!existsSync(ctx.configPath)) {
|
|
56
|
-
log.error(
|
|
113
|
+
log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);
|
|
57
114
|
process.exit(1);
|
|
58
115
|
}
|
|
59
116
|
let parsedValue;
|
|
@@ -70,7 +127,7 @@ function createConfigCommand(ctx) {
|
|
|
70
127
|
cmd.command("unset <path>").description("Remove a config value by dot path").action(async (path) => {
|
|
71
128
|
const { loadConfig, log } = await loadConfigDeps();
|
|
72
129
|
if (!existsSync(ctx.configPath)) {
|
|
73
|
-
log.error(
|
|
130
|
+
log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);
|
|
74
131
|
process.exit(1);
|
|
75
132
|
}
|
|
76
133
|
const config = loadConfig(ctx.configPath);
|
|
@@ -89,22 +146,15 @@ function createConfigCommand(ctx) {
|
|
|
89
146
|
}
|
|
90
147
|
});
|
|
91
148
|
cmd.command("show").description("Show full configuration (sensitive values masked)").action(async () => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
const config = loadConfig(ctx.configPath);
|
|
98
|
-
const maskedConfig = JSON.stringify(config, (key, value) => {
|
|
99
|
-
if (key === "api_key" || key === "token") return value ? "********" : value;
|
|
100
|
-
return value;
|
|
101
|
-
}, 2);
|
|
102
|
-
console.log(maskedConfig);
|
|
149
|
+
await runConfigShow(ctx.configPath);
|
|
150
|
+
});
|
|
151
|
+
cmd.command("validate").description("Validate configuration file against schema and channel plugins").action(async () => {
|
|
152
|
+
if (!await runConfigValidate(ctx.configPath)) process.exit(1);
|
|
103
153
|
});
|
|
104
154
|
cmd.command("token").description("Generate or view the gateway auth token").option("--generate", "Generate a new token").option("--show", "Show the current token (unmasked)").action(async (options) => {
|
|
105
155
|
const { loadConfig, log } = await loadConfigDeps();
|
|
106
156
|
if (!existsSync(ctx.configPath)) {
|
|
107
|
-
log.error(
|
|
157
|
+
log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);
|
|
108
158
|
process.exit(1);
|
|
109
159
|
}
|
|
110
160
|
const config = loadConfig(ctx.configPath);
|
|
@@ -140,7 +190,7 @@ function createConfigCommand(ctx) {
|
|
|
140
190
|
console.log(` Token: ${token.slice(0, 8)}...${token.slice(-8)}`);
|
|
141
191
|
console.log("\nUse \"xopc config token --show\" to view the full token");
|
|
142
192
|
console.log("Use \"xopc config token --generate\" to generate a new token");
|
|
143
|
-
} else if (mode === "token") console.log(" Token: not set (will be auto-generated on first gateway
|
|
193
|
+
} else if (mode === "token") console.log(" Token: not set (will be auto-generated on first `xopc gateway` run)");
|
|
144
194
|
});
|
|
145
195
|
cmd.command("path").description("Show configuration file path").action(() => {
|
|
146
196
|
console.log(ctx.configPath);
|
|
@@ -158,6 +208,7 @@ register({
|
|
|
158
208
|
"xopc config get agents.defaults.model",
|
|
159
209
|
"xopc config set agents.defaults.temperature 0.8",
|
|
160
210
|
"xopc config show",
|
|
211
|
+
"xopc config validate",
|
|
161
212
|
"xopc config token",
|
|
162
213
|
"xopc config token --show",
|
|
163
214
|
"xopc config token --generate"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":[],"sources":["../../../../src/cli/commands/config.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { existsSync } from 'fs';\nimport { resolveGatewayLocalClientHost } from '../../config/gateway-bind.js';\nimport { writeTextAtomic } from '../../infra/write-file-atomic.js';\nimport { register, formatExamples, type CLIContext } from '../registry.js';\n\nasync function loadConfigDeps() {\n const [{ loadConfig }, { createLogger }] = await Promise.all([\n import('../../config/index.js'),\n import('../../utils/logger.js'),\n ]);\n return { loadConfig, log: createLogger('ConfigCommand') };\n}\n\nfunction getNestedValue(obj: any, path: string): any {\n return path.split('.').reduce((current: any, key: string) => {\n if (current && typeof current === 'object' && key in current) {\n return current[key];\n }\n return undefined;\n }, obj);\n}\n\nfunction setNestedValue(obj: any, path: string, value: any): any {\n const keys = path.split('.');\n const lastKey = keys.pop()!;\n const target = keys.reduce((current: any, key: string) => {\n if (!current[key] || typeof current[key] !== 'object') {\n current[key] = {};\n }\n return current[key];\n }, obj);\n target[lastKey] = value;\n return obj;\n}\n\nfunction createConfigCommand(ctx: CLIContext): Command {\n const cmd = new Command('config')\n .description('View and edit configuration')\n .addHelpText(\n 'after',\n formatExamples([\n 'xopc config get agents.defaults.model',\n 'xopc config set agents.defaults.temperature 0.8',\n 'xopc config unset agents.defaults.max_tokens',\n 'xopc config show',\n 'xopc config token # Show gateway token info',\n 'xopc config token --show # Show full token',\n 'xopc config token --generate # Generate new token',\n ])\n );\n\n cmd\n .command('get <path>')\n .description('Get a config value by dot path')\n .action(async (path: string) => {\n const { loadConfig, log } = await loadConfigDeps();\n if (!existsSync(ctx.configPath)) {\n log.error('Config file not found. Run: xopc onboard');\n process.exit(1);\n }\n\n const config = loadConfig(ctx.configPath);\n const value = getNestedValue(config, path);\n\n if (value === undefined) {\n log.error({ path }, `Config path not found`);\n process.exit(1);\n }\n\n console.log(typeof value === 'object' ? JSON.stringify(value, null, 2) : value);\n });\n\n cmd\n .command('set <path> <value>')\n .description('Set a config value by dot path')\n .action(async (path: string, value: string) => {\n const { loadConfig, log } = await loadConfigDeps();\n if (!existsSync(ctx.configPath)) {\n log.error('Config file not found. Run: xopc onboard');\n process.exit(1);\n }\n\n let parsedValue: any;\n try {\n parsedValue = JSON.parse(value);\n } catch {\n parsedValue = value;\n }\n\n const config = loadConfig(ctx.configPath);\n setNestedValue(config, path, parsedValue);\n\n await writeTextAtomic(ctx.configPath, JSON.stringify(config, null, 2));\n\n log.info({ path }, `Config updated`);\n });\n\n cmd\n .command('unset <path>')\n .description('Remove a config value by dot path')\n .action(async (path: string) => {\n const { loadConfig, log } = await loadConfigDeps();\n if (!existsSync(ctx.configPath)) {\n log.error('Config file not found. Run: xopc onboard');\n process.exit(1);\n }\n\n const config = loadConfig(ctx.configPath);\n const keys = path.split('.');\n const lastKey = keys.pop()!;\n const target = keys.reduce((current: any, key: string) => {\n return current && current[key];\n }, config);\n\n if (target && typeof target === 'object' && lastKey in target) {\n delete target[lastKey];\n await writeTextAtomic(ctx.configPath, JSON.stringify(config, null, 2));\n log.info({ path }, `Config removed`);\n } else {\n log.error({ path }, `Config path not found`);\n process.exit(1);\n }\n });\n\n cmd\n .command('show')\n .description('Show full configuration (sensitive values masked)')\n .action(async () => {\n const { loadConfig, log } = await loadConfigDeps();\n if (!existsSync(ctx.configPath)) {\n log.warn('No config file found. Run: xopc onboard');\n return;\n }\n\n const config = loadConfig(ctx.configPath);\n\n const maskedConfig = JSON.stringify(config, (key, value) => {\n if (key === 'api_key' || key === 'token') {\n return value ? '********' : value;\n }\n return value;\n }, 2);\n\n console.log(maskedConfig);\n });\n\n cmd\n .command('token')\n .description('Generate or view the gateway auth token')\n .option('--generate', 'Generate a new token')\n .option('--show', 'Show the current token (unmasked)')\n .action(async (options) => {\n const { loadConfig, log } = await loadConfigDeps();\n if (!existsSync(ctx.configPath)) {\n log.error('Config file not found. Run: xopc onboard');\n process.exit(1);\n }\n\n const config = loadConfig(ctx.configPath);\n\n if (options.show) {\n const token = config?.gateway?.auth?.token;\n if (token) {\n console.log(token);\n } else {\n console.log('No token configured. Gateway auth mode:', config?.gateway?.auth?.mode || 'not set');\n }\n return;\n }\n\n if (options.generate) {\n const crypto = await import('crypto');\n const newToken = crypto.randomBytes(24).toString('hex');\n\n config.gateway = config.gateway || {};\n config.gateway.auth = {\n mode: 'token',\n token: newToken,\n };\n\n await writeTextAtomic(ctx.configPath, JSON.stringify(config, null, 2));\n log.info('New gateway token generated');\n console.log(`Token: ${newToken.slice(0, 8)}...${newToken.slice(-8)}`);\n console.log('\\nUse \"xopc config token --show\" to view the full token');\n return;\n }\n\n // Default: show masked token info\n const token = config?.gateway?.auth?.token;\n const mode = config?.gateway?.auth?.mode;\n const bind = config?.gateway?.bind ?? 'loopback';\n const port = config?.gateway?.port || 18790;\n const clientHost = config ? resolveGatewayLocalClientHost(config) : '127.0.0.1';\n\n console.log('Gateway Configuration:');\n console.log(` Bind: ${bind}`);\n console.log(` Local URL: http://${clientHost}:${port}`);\n console.log(` Auth Mode: ${mode || 'not set'}`);\n if (token) {\n console.log(` Token: ${token.slice(0, 8)}...${token.slice(-8)}`);\n console.log('\\nUse \"xopc config token --show\" to view the full token');\n console.log('Use \"xopc config token --generate\" to generate a new token');\n } else if (mode === 'token') {\n console.log(' Token: not set (will be auto-generated on first gateway start)');\n }\n });\n\n cmd\n .command('path')\n .description('Show configuration file path')\n .action(() => {\n console.log(ctx.configPath);\n });\n\n return cmd;\n}\n\nregister({\n id: 'config',\n name: 'config',\n description: 'View and edit configuration',\n factory: createConfigCommand,\n metadata: {\n category: 'utility',\n examples: [\n 'xopc config get agents.defaults.model',\n 'xopc config set agents.defaults.temperature 0.8',\n 'xopc config show',\n 'xopc config token',\n 'xopc config token --show',\n 'xopc config token --generate',\n ],\n },\n});\n"],"mappings":";;;;;;wBAGmE;AAGnE,eAAe,iBAAiB;CAC9B,MAAM,CAAC,EAAE,cAAc,EAAE,kBAAkB,MAAM,QAAQ,IAAI,CAC3D,OAAO,0BACP,OAAO,yBACR,CAAC;AACF,QAAO;EAAE;EAAY,KAAK,aAAa,gBAAgB;EAAE;;AAG3D,SAAS,eAAe,KAAU,MAAmB;AACnD,QAAO,KAAK,MAAM,IAAI,CAAC,QAAQ,SAAc,QAAgB;AAC3D,MAAI,WAAW,OAAO,YAAY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,gBAAgB,QAAQ,YAAY;AAChD,MAAI,OAAO;AACT,WAAQ,IAAI,YAAY,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,MAAM,MAAM,GAAG,GAAG;AACjE,WAAQ,IAAI,4DAA0D;AACtE,WAAQ,IAAI,+DAA6D;aAChE,SAAS,QAClB,SAAQ,IAAI,mEAAmE;GAEjF;AAEJ,KACG,QAAQ,OAAO,CACf,YAAY,+BAA+B,CAC3C,aAAa;AACZ,UAAQ,IAAI,IAAI,WAAW;GAC3B;AAEJ,QAAO;;AAGT,SAAS;CACP,IAAI;CACJ,MAAM;CACN,aAAa;CACb,SAAS;CACT,UAAU;EACR,UAAU;EACV,UAAU;GACR;GACA;GACA;GACA;GACA;GACA;GACD;EACF;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../../../../src/cli/commands/config.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { existsSync, readFileSync } from 'fs';\nimport { resolveGatewayLocalClientHost } from '../../config/gateway-bind.js';\nimport { writeTextAtomic } from '../../infra/write-file-atomic.js';\nimport { ConfigSchema } from '../../config/schema.js';\nimport { register, formatExamples, type CLIContext } from '../registry.js';\n\nconst MISSING_CONFIG_HINT = 'Run: xopc setup, xopc onboard, or xopc init';\n\nasync function loadConfigDeps() {\n const [{ loadConfig }, { createLogger }] = await Promise.all([\n import('../../config/index.js'),\n import('../../utils/logger.js'),\n ]);\n return { loadConfig, log: createLogger('ConfigCommand') };\n}\n\nasync function runConfigShow(configPath: string): Promise<void> {\n const { loadConfig, log } = await loadConfigDeps();\n if (!existsSync(configPath)) {\n log.warn(`No config file found. ${MISSING_CONFIG_HINT}`);\n return;\n }\n\n const config = loadConfig(configPath);\n const maskedConfig = JSON.stringify(\n config,\n (key, value) => {\n if (key === 'api_key' || key === 'token') {\n return value ? '********' : value;\n }\n return value;\n },\n 2,\n );\n console.log(maskedConfig);\n}\n\nasync function runConfigValidate(configPath: string): Promise<boolean> {\n const { log } = await loadConfigDeps();\n if (!existsSync(configPath)) {\n log.error('Config file not found. Run: xopc onboard');\n return false;\n }\n\n let json: unknown;\n try {\n json = JSON.parse(readFileSync(configPath, 'utf-8'));\n } catch {\n log.error('Config file is not valid JSON.');\n return false;\n }\n\n const parsed = ConfigSchema.safeParse(json);\n if (!parsed.success) {\n log.error('Config does not match the expected schema.');\n for (const issue of parsed.error.issues) {\n console.error(` - ${issue.path.join('.') || '(root)'}: ${issue.message}`);\n }\n return false;\n }\n\n const { validateChannelPluginConfigs } = await import('../../config/validate-channel-configs.js');\n const channelErrors = validateChannelPluginConfigs(parsed.data);\n if (channelErrors.length > 0) {\n log.error('Channel configuration failed validation.');\n for (const err of channelErrors) {\n console.error(` - ${err}`);\n }\n return false;\n }\n\n log.info({ path: configPath }, 'Config is valid');\n console.log('✅ Configuration is valid');\n return true;\n}\n\nfunction getNestedValue(obj: any, path: string): any {\n return path.split('.').reduce((current: any, key: string) => {\n if (current && typeof current === 'object' && key in current) {\n return current[key];\n }\n return undefined;\n }, obj);\n}\n\nfunction setNestedValue(obj: any, path: string, value: any): any {\n const keys = path.split('.');\n const lastKey = keys.pop()!;\n const target = keys.reduce((current: any, key: string) => {\n if (!current[key] || typeof current[key] !== 'object') {\n current[key] = {};\n }\n return current[key];\n }, obj);\n target[lastKey] = value;\n return obj;\n}\n\nfunction createConfigCommand(ctx: CLIContext): Command {\n const cmd = new Command('config')\n .description('View and edit configuration')\n .option('--show', 'Show full configuration (alias for `config show`)')\n .option('--validate', 'Validate configuration file (alias for `config validate`)')\n .addHelpText(\n 'after',\n formatExamples([\n 'xopc config get agents.defaults.model',\n 'xopc config set agents.defaults.temperature 0.8',\n 'xopc config unset agents.defaults.max_tokens',\n 'xopc config show',\n 'xopc config validate',\n 'xopc config token # Show gateway token info',\n 'xopc config token --show # Show full token',\n 'xopc config token --generate # Generate new token',\n ]),\n )\n .action(async (options) => {\n if (options.show) {\n await runConfigShow(ctx.configPath);\n return;\n }\n if (options.validate) {\n const ok = await runConfigValidate(ctx.configPath);\n if (!ok) {\n process.exit(1);\n }\n return;\n }\n cmd.outputHelp();\n });\n\n cmd\n .command('get <path>')\n .description('Get a config value by dot path')\n .action(async (path: string) => {\n const { loadConfig, log } = await loadConfigDeps();\n if (!existsSync(ctx.configPath)) {\n log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);\n process.exit(1);\n }\n\n const config = loadConfig(ctx.configPath);\n const value = getNestedValue(config, path);\n\n if (value === undefined) {\n log.error({ path }, `Config path not found`);\n process.exit(1);\n }\n\n console.log(typeof value === 'object' ? JSON.stringify(value, null, 2) : value);\n });\n\n cmd\n .command('set <path> <value>')\n .description('Set a config value by dot path')\n .action(async (path: string, value: string) => {\n const { loadConfig, log } = await loadConfigDeps();\n if (!existsSync(ctx.configPath)) {\n log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);\n process.exit(1);\n }\n\n let parsedValue: any;\n try {\n parsedValue = JSON.parse(value);\n } catch {\n parsedValue = value;\n }\n\n const config = loadConfig(ctx.configPath);\n setNestedValue(config, path, parsedValue);\n\n await writeTextAtomic(ctx.configPath, JSON.stringify(config, null, 2));\n\n log.info({ path }, `Config updated`);\n });\n\n cmd\n .command('unset <path>')\n .description('Remove a config value by dot path')\n .action(async (path: string) => {\n const { loadConfig, log } = await loadConfigDeps();\n if (!existsSync(ctx.configPath)) {\n log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);\n process.exit(1);\n }\n\n const config = loadConfig(ctx.configPath);\n const keys = path.split('.');\n const lastKey = keys.pop()!;\n const target = keys.reduce((current: any, key: string) => {\n return current && current[key];\n }, config);\n\n if (target && typeof target === 'object' && lastKey in target) {\n delete target[lastKey];\n await writeTextAtomic(ctx.configPath, JSON.stringify(config, null, 2));\n log.info({ path }, `Config removed`);\n } else {\n log.error({ path }, `Config path not found`);\n process.exit(1);\n }\n });\n\n cmd\n .command('show')\n .description('Show full configuration (sensitive values masked)')\n .action(async () => {\n await runConfigShow(ctx.configPath);\n });\n\n cmd\n .command('validate')\n .description('Validate configuration file against schema and channel plugins')\n .action(async () => {\n const ok = await runConfigValidate(ctx.configPath);\n if (!ok) {\n process.exit(1);\n }\n });\n\n cmd\n .command('token')\n .description('Generate or view the gateway auth token')\n .option('--generate', 'Generate a new token')\n .option('--show', 'Show the current token (unmasked)')\n .action(async (options) => {\n const { loadConfig, log } = await loadConfigDeps();\n if (!existsSync(ctx.configPath)) {\n log.error(`Config file not found. ${MISSING_CONFIG_HINT}`);\n process.exit(1);\n }\n\n const config = loadConfig(ctx.configPath);\n\n if (options.show) {\n const token = config?.gateway?.auth?.token;\n if (token) {\n console.log(token);\n } else {\n console.log('No token configured. Gateway auth mode:', config?.gateway?.auth?.mode || 'not set');\n }\n return;\n }\n\n if (options.generate) {\n const crypto = await import('crypto');\n const newToken = crypto.randomBytes(24).toString('hex');\n\n config.gateway = config.gateway || {};\n config.gateway.auth = {\n mode: 'token',\n token: newToken,\n };\n\n await writeTextAtomic(ctx.configPath, JSON.stringify(config, null, 2));\n log.info('New gateway token generated');\n console.log(`Token: ${newToken.slice(0, 8)}...${newToken.slice(-8)}`);\n console.log('\\nUse \"xopc config token --show\" to view the full token');\n return;\n }\n\n // Default: show masked token info\n const token = config?.gateway?.auth?.token;\n const mode = config?.gateway?.auth?.mode;\n const bind = config?.gateway?.bind ?? 'loopback';\n const port = config?.gateway?.port || 18790;\n const clientHost = config ? resolveGatewayLocalClientHost(config) : '127.0.0.1';\n\n console.log('Gateway Configuration:');\n console.log(` Bind: ${bind}`);\n console.log(` Local URL: http://${clientHost}:${port}`);\n console.log(` Auth Mode: ${mode || 'not set'}`);\n if (token) {\n console.log(` Token: ${token.slice(0, 8)}...${token.slice(-8)}`);\n console.log('\\nUse \"xopc config token --show\" to view the full token');\n console.log('Use \"xopc config token --generate\" to generate a new token');\n } else if (mode === 'token') {\n console.log(' Token: not set (will be auto-generated on first `xopc gateway` run)');\n }\n });\n\n cmd\n .command('path')\n .description('Show configuration file path')\n .action(() => {\n console.log(ctx.configPath);\n });\n\n return cmd;\n}\n\nregister({\n id: 'config',\n name: 'config',\n description: 'View and edit configuration',\n factory: createConfigCommand,\n metadata: {\n category: 'utility',\n examples: [\n 'xopc config get agents.defaults.model',\n 'xopc config set agents.defaults.temperature 0.8',\n 'xopc config show',\n 'xopc config validate',\n 'xopc config token',\n 'xopc config token --show',\n 'xopc config token --generate',\n ],\n },\n});\n"],"mappings":";;;;;;;wBAGmE;aACb;AAGtD,MAAM,sBAAsB;AAE5B,eAAe,iBAAiB;CAC9B,MAAM,CAAC,EAAE,cAAc,EAAE,kBAAkB,MAAM,QAAQ,IAAI,CAC3D,OAAO,0BACP,OAAO,yBACR,CAAC;AACF,QAAO;EAAE;EAAY,KAAK,aAAa,gBAAgB;EAAE;;AAG3D,eAAe,cAAc,YAAmC;CAC9D,MAAM,EAAE,YAAY,QAAQ,MAAM,gBAAgB;AAClD,KAAI,CAAC,WAAW,WAAW,EAAE;AAC3B,MAAI,KAAK,yBAAyB,sBAAsB;AACxD;;CAGF,MAAM,SAAS,WAAW,WAAW;CACrC,MAAM,eAAe,KAAK,UACxB,SACC,KAAK,UAAU;AACd,MAAI,QAAQ,aAAa,QAAQ,QAC/B,QAAO,QAAQ,aAAa;AAE9B,SAAO;IAET,EACD;AACD,SAAQ,IAAI,aAAa;;AAG3B,eAAe,kBAAkB,YAAsC;CACrE,MAAM,EAAE,QAAQ,MAAM,gBAAgB;AACtC,KAAI,CAAC,WAAW,WAAW,EAAE;AAC3B,MAAI,MAAM,2CAA2C;AACrD,SAAO;;CAGT,IAAI;AACJ,KAAI;AACF,SAAO,KAAK,MAAM,aAAa,YAAY,QAAQ,CAAC;SAC9C;AACN,MAAI,MAAM,iCAAiC;AAC3C,SAAO;;CAGT,MAAM,SAAS,aAAa,UAAU,KAAK;AAC3C,KAAI,CAAC,OAAO,SAAS;AACnB,MAAI,MAAM,6CAA6C;AACvD,OAAK,MAAM,SAAS,OAAO,MAAM,OAC/B,SAAQ,MAAM,OAAO,MAAM,KAAK,K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await import("../../cron/index.js");
|
|
4
|
+
const cronService = new CronService();
|
|
5
|
+
await cronService.initialize();
|
|
6
|
+
try {
|
|
7
|
+
return await fn(cronService);
|
|
8
|
+
} finally {
|
|
9
|
+
await cronService.stop();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { withCronService };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=cron-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-cli.js","names":[],"sources":["../../../../src/cli/commands/cron-cli.ts"],"sourcesContent":["import type { CronService } from '../../cron/service.js';\n\nexport async function withCronService<T>(fn: (service: CronService) => Promise<T>): Promise<T> {\n const { CronService } = await import('../../cron/index.js');\n const cronService = new CronService();\n await cronService.initialize();\n try {\n return await fn(cronService);\n } finally {\n await cronService.stop();\n }\n}\n"],"mappings":";AAEA,eAAsB,gBAAmB,IAAsD;CAC7F,MAAM,EAAE,gBAAgB,MAAM,OAAO;CACrC,MAAM,cAAc,IAAI,aAAa;AACrC,OAAM,YAAY,YAAY;AAC9B,KAAI;AACF,SAAO,MAAM,GAAG,YAAY;WACpB;AACR,QAAM,YAAY,MAAM"}
|