@agents-at-scale/ark 0.1.36-rc1 → 0.1.37
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 +53 -70
- package/dist/arkServices.d.ts +3 -27
- package/dist/arkServices.js +31 -3
- package/dist/arkServices.spec.js +118 -10
- package/dist/commands/completion/index.js +0 -2
- package/dist/commands/install/index.js +49 -58
- package/dist/commands/models/create.d.ts +9 -1
- package/dist/commands/models/create.js +97 -90
- package/dist/commands/models/create.spec.js +9 -37
- package/dist/commands/models/index.js +8 -2
- package/dist/commands/models/index.spec.js +1 -1
- package/dist/commands/status/index.d.ts +3 -1
- package/dist/commands/status/index.js +54 -2
- package/dist/components/ChatUI.js +19 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/arkApiClient.d.ts +1 -2
- package/dist/lib/arkApiClient.js +5 -6
- package/dist/lib/config.d.ts +4 -0
- package/dist/lib/config.js +9 -0
- package/dist/lib/nextSteps.js +1 -1
- package/dist/lib/nextSteps.spec.js +1 -1
- package/dist/lib/security.js +4 -0
- package/dist/lib/startup.js +6 -2
- package/dist/lib/startup.spec.js +1 -1
- package/dist/lib/timeout.d.ts +1 -0
- package/dist/lib/timeout.js +20 -0
- package/dist/lib/timeout.spec.js +14 -0
- package/dist/lib/waitForReady.d.ts +8 -0
- package/dist/lib/waitForReady.js +32 -0
- package/dist/lib/waitForReady.spec.js +104 -0
- package/dist/types/arkService.d.ts +27 -0
- package/package.json +3 -3
- package/dist/charts/charts.d.ts +0 -5
- package/dist/charts/charts.js +0 -6
- package/dist/charts/dependencies.d.ts +0 -6
- package/dist/charts/dependencies.js +0 -50
- package/dist/charts/types.d.ts +0 -40
- package/dist/commands/agents/selector.d.ts +0 -8
- package/dist/commands/agents/selector.js +0 -53
- package/dist/commands/agents.d.ts +0 -2
- package/dist/commands/agents.js +0 -53
- package/dist/commands/chat.d.ts +0 -2
- package/dist/commands/chat.js +0 -45
- package/dist/commands/cluster/get-ip.d.ts +0 -2
- package/dist/commands/cluster/get-ip.js +0 -32
- package/dist/commands/cluster/get-type.d.ts +0 -2
- package/dist/commands/cluster/get-type.js +0 -26
- package/dist/commands/completion.d.ts +0 -2
- package/dist/commands/completion.js +0 -265
- package/dist/commands/config.d.ts +0 -2
- package/dist/commands/config.js +0 -44
- package/dist/commands/dashboard.d.ts +0 -3
- package/dist/commands/dashboard.js +0 -39
- package/dist/commands/dev/index.d.ts +0 -3
- package/dist/commands/dev/index.js +0 -9
- package/dist/commands/dev/tool/check.d.ts +0 -2
- package/dist/commands/dev/tool/check.js +0 -142
- package/dist/commands/dev/tool/clean.d.ts +0 -2
- package/dist/commands/dev/tool/clean.js +0 -153
- package/dist/commands/dev/tool/generate.d.ts +0 -2
- package/dist/commands/dev/tool/generate.js +0 -28
- package/dist/commands/dev/tool/index.d.ts +0 -2
- package/dist/commands/dev/tool/index.js +0 -14
- package/dist/commands/dev/tool/init.d.ts +0 -2
- package/dist/commands/dev/tool/init.js +0 -320
- package/dist/commands/dev/tool/shared.d.ts +0 -5
- package/dist/commands/dev/tool/shared.js +0 -258
- package/dist/commands/dev/tool/status.d.ts +0 -2
- package/dist/commands/dev/tool/status.js +0 -136
- package/dist/commands/dev/tool-generate.spec.js +0 -163
- package/dist/commands/dev/tool.d.ts +0 -2
- package/dist/commands/dev/tool.js +0 -559
- package/dist/commands/dev/tool.spec.js +0 -48
- package/dist/commands/install.d.ts +0 -3
- package/dist/commands/install.js +0 -147
- package/dist/commands/models/selector.d.ts +0 -8
- package/dist/commands/models/selector.js +0 -53
- package/dist/commands/routes.d.ts +0 -2
- package/dist/commands/routes.js +0 -101
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.js +0 -33
- package/dist/commands/targets.d.ts +0 -2
- package/dist/commands/targets.js +0 -65
- package/dist/commands/teams/selector.d.ts +0 -8
- package/dist/commands/teams/selector.js +0 -55
- package/dist/commands/tools/selector.d.ts +0 -8
- package/dist/commands/tools/selector.js +0 -53
- package/dist/commands/uninstall.d.ts +0 -2
- package/dist/commands/uninstall.js +0 -83
- package/dist/components/DashboardCLI.d.ts +0 -3
- package/dist/components/DashboardCLI.js +0 -149
- package/dist/components/StatusView.d.ts +0 -10
- package/dist/components/StatusView.js +0 -39
- package/dist/config.d.ts +0 -23
- package/dist/config.js +0 -92
- package/dist/lib/arkClient.d.ts +0 -32
- package/dist/lib/arkClient.js +0 -43
- package/dist/lib/commandUtils.d.ts +0 -4
- package/dist/lib/commandUtils.js +0 -18
- package/dist/lib/commandUtils.test.d.ts +0 -1
- package/dist/lib/commandUtils.test.js +0 -44
- package/dist/lib/config.test.d.ts +0 -1
- package/dist/lib/config.test.js +0 -93
- package/dist/lib/consts.d.ts +0 -9
- package/dist/lib/consts.js +0 -13
- package/dist/lib/consts.spec.d.ts +0 -1
- package/dist/lib/consts.spec.js +0 -15
- package/dist/lib/dev/tools/analyzer.d.ts +0 -30
- package/dist/lib/dev/tools/analyzer.js +0 -190
- package/dist/lib/dev/tools/discover_tools.py +0 -392
- package/dist/lib/dev/tools/mcp-types.d.ts +0 -28
- package/dist/lib/dev/tools/mcp-types.js +0 -86
- package/dist/lib/dev/tools/types.d.ts +0 -50
- package/dist/lib/dev/tools/types.js +0 -1
- package/dist/lib/exec.d.ts +0 -1
- package/dist/lib/exec.js +0 -9
- package/dist/lib/gatewayManager.d.ts +0 -24
- package/dist/lib/gatewayManager.js +0 -85
- package/dist/lib/kubernetes.d.ts +0 -28
- package/dist/lib/kubernetes.js +0 -122
- package/dist/lib/portUtils.d.ts +0 -8
- package/dist/lib/portUtils.js +0 -39
- package/dist/lib/progress.d.ts +0 -128
- package/dist/lib/progress.js +0 -273
- package/dist/lib/queryRunner.d.ts +0 -22
- package/dist/lib/queryRunner.js +0 -142
- package/dist/lib/wrappers/git.d.ts +0 -2
- package/dist/lib/wrappers/git.js +0 -43
- /package/dist/{charts/types.js → lib/timeout.spec.d.ts} +0 -0
- /package/dist/{commands/dev/tool-generate.spec.d.ts → lib/waitForReady.spec.d.ts} +0 -0
- /package/dist/{commands/dev/tool.spec.d.ts → types/arkService.js} +0 -0
package/dist/lib/progress.js
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Progress indicators and user experience utilities for ARK CLI
|
|
3
|
-
*/
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
export class ProgressIndicator {
|
|
6
|
-
constructor(title) {
|
|
7
|
-
this.title = title;
|
|
8
|
-
this.steps = [];
|
|
9
|
-
this.startTime = Date.now();
|
|
10
|
-
console.log(chalk.blue(`\n🚀 ${this.title}\n`));
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Add a step to the progress indicator
|
|
14
|
-
*/
|
|
15
|
-
addStep(name, message) {
|
|
16
|
-
this.steps.push({
|
|
17
|
-
name,
|
|
18
|
-
status: 'pending',
|
|
19
|
-
message,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Start a step
|
|
24
|
-
*/
|
|
25
|
-
startStep(name, message) {
|
|
26
|
-
const step = this.steps.find((s) => s.name === name);
|
|
27
|
-
if (step) {
|
|
28
|
-
step.status = 'running';
|
|
29
|
-
step.message = message;
|
|
30
|
-
this.renderProgress();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Complete a step
|
|
35
|
-
*/
|
|
36
|
-
completeStep(name, message) {
|
|
37
|
-
const step = this.steps.find((s) => s.name === name);
|
|
38
|
-
if (step) {
|
|
39
|
-
step.status = 'completed';
|
|
40
|
-
step.message = message;
|
|
41
|
-
this.renderProgress();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Fail a step
|
|
46
|
-
*/
|
|
47
|
-
failStep(name, message) {
|
|
48
|
-
const step = this.steps.find((s) => s.name === name);
|
|
49
|
-
if (step) {
|
|
50
|
-
step.status = 'failed';
|
|
51
|
-
step.message = message;
|
|
52
|
-
this.renderProgress();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Skip a step
|
|
57
|
-
*/
|
|
58
|
-
skipStep(name, message) {
|
|
59
|
-
const step = this.steps.find((s) => s.name === name);
|
|
60
|
-
if (step) {
|
|
61
|
-
step.status = 'skipped';
|
|
62
|
-
step.message = message;
|
|
63
|
-
this.renderProgress();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Render the current progress
|
|
68
|
-
*/
|
|
69
|
-
renderProgress() {
|
|
70
|
-
// Clear previous output (simple version)
|
|
71
|
-
process.stdout.write('\r\x1b[K');
|
|
72
|
-
for (const step of this.steps) {
|
|
73
|
-
const icon = this.getStatusIcon(step.status);
|
|
74
|
-
const color = this.getStatusColor(step.status);
|
|
75
|
-
const statusText = step.message || step.name;
|
|
76
|
-
console.log(`${icon} ${chalk[color](statusText)}`);
|
|
77
|
-
}
|
|
78
|
-
// Move cursor back up to overwrite on next update
|
|
79
|
-
if (this.steps.length > 1) {
|
|
80
|
-
process.stdout.write(`\x1b[${this.steps.length}A`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Complete the progress indicator
|
|
85
|
-
*/
|
|
86
|
-
complete(message) {
|
|
87
|
-
// Clear any remaining progress rendering
|
|
88
|
-
process.stdout.write('\r\x1b[K');
|
|
89
|
-
// Only print failed or skipped steps - hide successful validation
|
|
90
|
-
const importantSteps = this.steps.filter((step) => step.status === 'failed' || step.status === 'skipped');
|
|
91
|
-
for (const step of importantSteps) {
|
|
92
|
-
const icon = this.getStatusIcon(step.status);
|
|
93
|
-
const color = this.getStatusColor(step.status);
|
|
94
|
-
const statusText = step.message || step.name;
|
|
95
|
-
console.log(`${icon} ${chalk[color](statusText)}`);
|
|
96
|
-
}
|
|
97
|
-
const duration = Date.now() - this.startTime;
|
|
98
|
-
const durationText = duration > 1000 ? `${(duration / 1000).toFixed(1)}s` : `${duration}ms`;
|
|
99
|
-
// Only show completion message if there were issues or if verbose
|
|
100
|
-
if (importantSteps.length > 0) {
|
|
101
|
-
console.log(chalk.green(`\n✅ ${message || this.title} completed in ${durationText}\n`));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Get status icon for a step
|
|
106
|
-
*/
|
|
107
|
-
getStatusIcon(status) {
|
|
108
|
-
switch (status) {
|
|
109
|
-
case 'pending':
|
|
110
|
-
return chalk.gray('⏳');
|
|
111
|
-
case 'running':
|
|
112
|
-
return chalk.blue('🔄');
|
|
113
|
-
case 'completed':
|
|
114
|
-
return chalk.green('✅');
|
|
115
|
-
case 'failed':
|
|
116
|
-
return chalk.red('❌');
|
|
117
|
-
case 'skipped':
|
|
118
|
-
return chalk.yellow('⏭️');
|
|
119
|
-
default:
|
|
120
|
-
return '❓';
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Get status color for a step
|
|
125
|
-
*/
|
|
126
|
-
getStatusColor(status) {
|
|
127
|
-
switch (status) {
|
|
128
|
-
case 'pending':
|
|
129
|
-
return 'gray';
|
|
130
|
-
case 'running':
|
|
131
|
-
return 'blue';
|
|
132
|
-
case 'completed':
|
|
133
|
-
return 'green';
|
|
134
|
-
case 'failed':
|
|
135
|
-
return 'red';
|
|
136
|
-
case 'skipped':
|
|
137
|
-
return 'yellow';
|
|
138
|
-
default:
|
|
139
|
-
return 'gray';
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Simple spinner for long-running operations
|
|
145
|
-
*/
|
|
146
|
-
export class Spinner {
|
|
147
|
-
constructor(message) {
|
|
148
|
-
this.frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
149
|
-
this.index = 0;
|
|
150
|
-
this.interval = null;
|
|
151
|
-
this.message = message;
|
|
152
|
-
}
|
|
153
|
-
start() {
|
|
154
|
-
this.interval = setInterval(() => {
|
|
155
|
-
process.stdout.write(`\r${chalk.blue(this.frames[this.index])} ${this.message}`);
|
|
156
|
-
this.index = (this.index + 1) % this.frames.length;
|
|
157
|
-
}, 100);
|
|
158
|
-
}
|
|
159
|
-
stop(finalMessage) {
|
|
160
|
-
if (this.interval) {
|
|
161
|
-
clearInterval(this.interval);
|
|
162
|
-
this.interval = null;
|
|
163
|
-
}
|
|
164
|
-
process.stdout.write(`\r\x1b[K${finalMessage ? chalk.green(`✅ ${finalMessage}`) : ''}\n`);
|
|
165
|
-
}
|
|
166
|
-
fail(errorMessage) {
|
|
167
|
-
if (this.interval) {
|
|
168
|
-
clearInterval(this.interval);
|
|
169
|
-
this.interval = null;
|
|
170
|
-
}
|
|
171
|
-
process.stdout.write(`\r\x1b[K${errorMessage ? chalk.red(`❌ ${errorMessage}`) : ''}\n`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Enhanced prompts with better validation and user guidance
|
|
176
|
-
*/
|
|
177
|
-
export class EnhancedPrompts {
|
|
178
|
-
/**
|
|
179
|
-
* Show a helpful tip to the user
|
|
180
|
-
*/
|
|
181
|
-
static showTip(message) {
|
|
182
|
-
console.log(chalk.cyan(`💡 Tip: ${message}`));
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Show a warning to the user
|
|
186
|
-
*/
|
|
187
|
-
static showWarning(message) {
|
|
188
|
-
console.log(chalk.yellow(`⚠️ Warning: ${message}`));
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Show information to the user
|
|
192
|
-
*/
|
|
193
|
-
static showInfo(message) {
|
|
194
|
-
console.log(chalk.blue(`ℹ️ ${message}`));
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Show a success message
|
|
198
|
-
*/
|
|
199
|
-
static showSuccess(message) {
|
|
200
|
-
console.log(chalk.green(`✅ ${message}`));
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Show available options for a choice
|
|
204
|
-
*/
|
|
205
|
-
static showChoiceHelp(title, choices) {
|
|
206
|
-
console.log(chalk.cyan(`\n📋 ${title}:`));
|
|
207
|
-
choices.forEach((choice) => {
|
|
208
|
-
console.log(chalk.gray(` • ${chalk.white(choice.name)}: ${choice.description}`));
|
|
209
|
-
});
|
|
210
|
-
console.log();
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Show next steps after completion
|
|
214
|
-
*/
|
|
215
|
-
static showNextSteps(title, steps) {
|
|
216
|
-
console.log(chalk.cyan(`\n📋 ${title}:`));
|
|
217
|
-
steps.forEach((step, index) => {
|
|
218
|
-
console.log(chalk.gray(` ${index + 1}. ${step}`));
|
|
219
|
-
});
|
|
220
|
-
console.log();
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Show a separator for better visual organization
|
|
224
|
-
*/
|
|
225
|
-
static showSeparator(title) {
|
|
226
|
-
if (title) {
|
|
227
|
-
console.log(chalk.gray(`\n${'─'.repeat(50)}`));
|
|
228
|
-
console.log(chalk.cyan(`${title}`));
|
|
229
|
-
console.log(chalk.gray(`${'─'.repeat(50)}\n`));
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
console.log(chalk.gray(`${'─'.repeat(50)}`));
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Utility for consistent formatting of output
|
|
238
|
-
*/
|
|
239
|
-
export class OutputFormatter {
|
|
240
|
-
/**
|
|
241
|
-
* Format a list of key-value pairs
|
|
242
|
-
*/
|
|
243
|
-
static formatKeyValueList(items) {
|
|
244
|
-
const maxKeyLength = Math.max(...items.map((item) => item.key.length));
|
|
245
|
-
items.forEach((item) => {
|
|
246
|
-
const paddedKey = item.key.padEnd(maxKeyLength);
|
|
247
|
-
const color = item.highlight ? 'cyan' : 'gray';
|
|
248
|
-
console.log(` ${chalk[color](paddedKey)}: ${chalk.white(item.value)}`);
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Format a file list with icons
|
|
253
|
-
*/
|
|
254
|
-
static formatFileList(files) {
|
|
255
|
-
files.forEach((file) => {
|
|
256
|
-
const icon = file.type === 'directory' ? '📁' : '📄';
|
|
257
|
-
const description = file.description
|
|
258
|
-
? chalk.gray(` - ${file.description}`)
|
|
259
|
-
: '';
|
|
260
|
-
console.log(` ${icon} ${chalk.white(file.path)}${description}`);
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Format command examples
|
|
265
|
-
*/
|
|
266
|
-
static formatCommands(title, commands) {
|
|
267
|
-
console.log(chalk.cyan(`\n${title}:`));
|
|
268
|
-
commands.forEach((cmd) => {
|
|
269
|
-
console.log(` ${chalk.yellow(cmd.command)}`);
|
|
270
|
-
console.log(chalk.gray(` ${cmd.description}\n`));
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared query execution logic for both universal and resource-specific query commands
|
|
3
|
-
*/
|
|
4
|
-
export interface QueryOptions {
|
|
5
|
-
targetType: string;
|
|
6
|
-
targetName: string;
|
|
7
|
-
message: string;
|
|
8
|
-
verbose?: boolean;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Execute a query against any ARK target (model, agent, team)
|
|
12
|
-
* This is the shared implementation used by all query commands
|
|
13
|
-
*/
|
|
14
|
-
export declare function executeQuery(options: QueryOptions): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* Parse a target string like "model/default" or "agent/weather"
|
|
17
|
-
* Returns { targetType, targetName } or null if invalid
|
|
18
|
-
*/
|
|
19
|
-
export declare function parseTarget(target: string): {
|
|
20
|
-
targetType: string;
|
|
21
|
-
targetName: string;
|
|
22
|
-
} | null;
|
package/dist/lib/queryRunner.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared query execution logic for both universal and resource-specific query commands
|
|
3
|
-
*/
|
|
4
|
-
import { execa } from 'execa';
|
|
5
|
-
import ora from 'ora';
|
|
6
|
-
import output from './output.js';
|
|
7
|
-
/**
|
|
8
|
-
* Execute a query against any ARK target (model, agent, team)
|
|
9
|
-
* This is the shared implementation used by all query commands
|
|
10
|
-
*/
|
|
11
|
-
export async function executeQuery(options) {
|
|
12
|
-
const spinner = ora('Creating query...').start();
|
|
13
|
-
// Generate a unique query name
|
|
14
|
-
const timestamp = Date.now();
|
|
15
|
-
const queryName = `cli-query-${timestamp}`;
|
|
16
|
-
// Create the Query resource
|
|
17
|
-
const queryManifest = {
|
|
18
|
-
apiVersion: 'ark.mckinsey.com/v1alpha1',
|
|
19
|
-
kind: 'Query',
|
|
20
|
-
metadata: {
|
|
21
|
-
name: queryName,
|
|
22
|
-
},
|
|
23
|
-
spec: {
|
|
24
|
-
input: options.message,
|
|
25
|
-
targets: [
|
|
26
|
-
{
|
|
27
|
-
type: options.targetType,
|
|
28
|
-
name: options.targetName,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
try {
|
|
34
|
-
// Apply the query
|
|
35
|
-
spinner.text = 'Submitting query...';
|
|
36
|
-
await execa('kubectl', ['apply', '-f', '-'], {
|
|
37
|
-
input: JSON.stringify(queryManifest),
|
|
38
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
39
|
-
});
|
|
40
|
-
// Watch for query completion
|
|
41
|
-
spinner.text = 'Query status: initializing';
|
|
42
|
-
let queryComplete = false;
|
|
43
|
-
let attempts = 0;
|
|
44
|
-
const maxAttempts = 300; // 5 minutes with 1 second intervals
|
|
45
|
-
while (!queryComplete && attempts < maxAttempts) {
|
|
46
|
-
attempts++;
|
|
47
|
-
try {
|
|
48
|
-
const { stdout } = await execa('kubectl', [
|
|
49
|
-
'get',
|
|
50
|
-
'query',
|
|
51
|
-
queryName,
|
|
52
|
-
'-o',
|
|
53
|
-
'json',
|
|
54
|
-
], { stdio: 'pipe' });
|
|
55
|
-
const query = JSON.parse(stdout);
|
|
56
|
-
const phase = query.status?.phase;
|
|
57
|
-
// Update spinner with current phase
|
|
58
|
-
if (phase) {
|
|
59
|
-
spinner.text = `Query status: ${phase}`;
|
|
60
|
-
}
|
|
61
|
-
// Check if query is complete based on phase
|
|
62
|
-
if (phase === 'done') {
|
|
63
|
-
queryComplete = true;
|
|
64
|
-
spinner.succeed('Query completed');
|
|
65
|
-
// Extract and display the response from responses array
|
|
66
|
-
if (query.status?.responses && query.status.responses.length > 0) {
|
|
67
|
-
const response = query.status.responses[0];
|
|
68
|
-
console.log('\n' + (response.content || response));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
output.warning('No response received');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else if (phase === 'error') {
|
|
75
|
-
queryComplete = true;
|
|
76
|
-
spinner.fail('Query failed');
|
|
77
|
-
// Try to get error message from conditions or status
|
|
78
|
-
const errorCondition = query.status?.conditions?.find((c) => {
|
|
79
|
-
const condition = c;
|
|
80
|
-
return condition.type === 'Complete' && condition.status === 'False';
|
|
81
|
-
});
|
|
82
|
-
if (errorCondition?.message) {
|
|
83
|
-
output.error(errorCondition.message);
|
|
84
|
-
}
|
|
85
|
-
else if (query.status?.error) {
|
|
86
|
-
output.error(query.status.error);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
output.error('Query failed with unknown error');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else if (phase === 'canceled') {
|
|
93
|
-
queryComplete = true;
|
|
94
|
-
spinner.warn('Query canceled');
|
|
95
|
-
// Try to get cancellation reason if available
|
|
96
|
-
if (query.status?.message) {
|
|
97
|
-
output.warning(query.status.message);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
// Query might not exist yet, continue waiting
|
|
103
|
-
spinner.text = 'Query status: waiting for query to be created';
|
|
104
|
-
}
|
|
105
|
-
if (!queryComplete) {
|
|
106
|
-
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait 1 second
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
if (!queryComplete) {
|
|
110
|
-
spinner.fail('Query timed out');
|
|
111
|
-
output.error('Query did not complete within 5 minutes');
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
spinner.fail('Query failed');
|
|
116
|
-
output.error(error instanceof Error ? error.message : 'Unknown error');
|
|
117
|
-
process.exit(1);
|
|
118
|
-
}
|
|
119
|
-
finally {
|
|
120
|
-
// Clean up the query resource
|
|
121
|
-
try {
|
|
122
|
-
await execa('kubectl', ['delete', 'query', queryName], { stdio: 'pipe' });
|
|
123
|
-
}
|
|
124
|
-
catch {
|
|
125
|
-
// Ignore cleanup errors
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Parse a target string like "model/default" or "agent/weather"
|
|
131
|
-
* Returns { targetType, targetName } or null if invalid
|
|
132
|
-
*/
|
|
133
|
-
export function parseTarget(target) {
|
|
134
|
-
const parts = target.split('/');
|
|
135
|
-
if (parts.length !== 2) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
targetType: parts[0],
|
|
140
|
-
targetName: parts[1],
|
|
141
|
-
};
|
|
142
|
-
}
|
package/dist/lib/wrappers/git.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { simpleGit } from 'simple-git';
|
|
4
|
-
import { ARK_REPO_ERROR_MESSAGE } from '../consts.js';
|
|
5
|
-
// Initialize simple-git instance
|
|
6
|
-
const git = simpleGit();
|
|
7
|
-
export async function ensureInArkRepo(expectedRepoName, expectedRemoteSubstring) {
|
|
8
|
-
try {
|
|
9
|
-
// Get repository root
|
|
10
|
-
const gitRoot = await git.revparse(['--show-toplevel']);
|
|
11
|
-
if (path.basename(gitRoot) !== expectedRepoName) {
|
|
12
|
-
console.error(chalk.red(ARK_REPO_ERROR_MESSAGE));
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
if (expectedRemoteSubstring) {
|
|
16
|
-
try {
|
|
17
|
-
// Get remote URL
|
|
18
|
-
const remoteUrl = await git.remote(['get-url', 'origin']);
|
|
19
|
-
if (!remoteUrl || !remoteUrl.includes(expectedRemoteSubstring)) {
|
|
20
|
-
console.error(chalk.red(ARK_REPO_ERROR_MESSAGE));
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch (_error) {
|
|
25
|
-
console.error(chalk.red(ARK_REPO_ERROR_MESSAGE));
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
catch (_error) {
|
|
31
|
-
console.error(chalk.red(ARK_REPO_ERROR_MESSAGE));
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export async function getRepoProjectRoot() {
|
|
36
|
-
try {
|
|
37
|
-
return await git.revparse(['--show-toplevel']);
|
|
38
|
-
}
|
|
39
|
-
catch (_error) {
|
|
40
|
-
console.error(chalk.red('Failed to determine git repository root path'));
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|