@empirical-gauzza/cli 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ const { warn } = require('../lib/ui');
6
+ const { showHelp } = require('../lib/help');
7
+ const { runInstallFlow } = require('../lib/installWizard');
8
+ const {
9
+ isHeadlessBootstrapCommand,
10
+ runHeadlessBootstrap,
11
+ isHeadlessRefreshCommand,
12
+ runHeadlessRefresh,
13
+ isOAuthClientCommand,
14
+ runOAuthClientCommand,
15
+ isAuthCommand,
16
+ runAuthCommand
17
+ } = require('../lib/auth');
18
+ const { isWorkspaceCommand, runWorkspaceCommand } = require('../lib/workspaceCommands');
19
+ const { runMemoryCommand } = require('../lib/memoryCommands');
20
+ const { runKitCommand, runSkillCommand, runDeviceCommand } = require('../lib/kitCommands');
21
+ const { runDoctor } = require('../lib/doctor');
22
+ const { runDoc } = require('../lib/doc');
23
+ const { showVersion } = require('../lib/help');
24
+ const { isPluginCommand, runPluginCommand } = require('../lib/pluginCommands');
25
+ const { runPolicyCommand } = require('../lib/policyCommands');
26
+ const { checkNativePluginUpdates } = require('../lib/pluginUpdateCheck');
27
+
28
+ async function main() {
29
+ const args = process.argv.slice(2);
30
+ if (args.includes('-v') || args.includes('--version')) {
31
+ showVersion();
32
+ return;
33
+ }
34
+
35
+ if (args.includes('-h') || args.includes('--help')) {
36
+ showHelp();
37
+ return;
38
+ }
39
+
40
+ if (args[0] === 'install' || args.includes('-install') || args.includes('--install')) {
41
+ await runInstallFlow();
42
+ return;
43
+ }
44
+
45
+ const updateCheckExcluded = new Set(['install', 'plugin', 'auth', 'oauth', 'policy', 'doctor']);
46
+ if (process.stdin.isTTY && !updateCheckExcluded.has(args[0])) {
47
+ try {
48
+ await checkNativePluginUpdates({ interactive: true });
49
+ } catch (_error) {
50
+ // Plugin discovery is advisory and must never block a CLI command.
51
+ }
52
+ }
53
+
54
+ if (isPluginCommand(args)) {
55
+ await runPluginCommand(args.slice(1));
56
+ return;
57
+ }
58
+
59
+ if (isHeadlessBootstrapCommand(args)) {
60
+ await runHeadlessBootstrap(args);
61
+ return;
62
+ }
63
+
64
+ if (isHeadlessRefreshCommand(args)) {
65
+ await runHeadlessRefresh(args);
66
+ return;
67
+ }
68
+
69
+ if (isOAuthClientCommand(args)) {
70
+ await runOAuthClientCommand(args);
71
+ return;
72
+ }
73
+
74
+ if (isWorkspaceCommand(args)) {
75
+ await runWorkspaceCommand(args);
76
+ return;
77
+ }
78
+
79
+ if (args[0] === 'memory') {
80
+ await runMemoryCommand(args.slice(1));
81
+ return;
82
+ }
83
+
84
+ if (args[0] === 'kit') {
85
+ await runKitCommand(args.slice(1));
86
+ return;
87
+ }
88
+
89
+ if (args[0] === 'skill') {
90
+ await runSkillCommand(args.slice(1));
91
+ return;
92
+ }
93
+
94
+ if (args[0] === 'policy') {
95
+ await runPolicyCommand(args.slice(1));
96
+ return;
97
+ }
98
+
99
+ if (isAuthCommand(args)) {
100
+ await runAuthCommand(args);
101
+ return;
102
+ }
103
+
104
+ if (args[0] === 'device') {
105
+ await runDeviceCommand(args.slice(1));
106
+ return;
107
+ }
108
+
109
+ if (args[0] === 'doctor') {
110
+ await runDoctor(args.slice(1));
111
+ return;
112
+ }
113
+
114
+ if (args[0] === 'doc') {
115
+ runDoc(args.slice(1));
116
+ return;
117
+ }
118
+
119
+ showHelp();
120
+ }
121
+
122
+ main().catch((error) => {
123
+ warn(`Installer failed: ${error.message}`);
124
+ process.exitCode = 1;
125
+ });