@xano/cli 0.0.21 → 0.0.22
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/dist/base-command.d.ts +1 -1
- package/dist/base-command.js +6 -6
- package/dist/commands/branch/create/index.d.ts +17 -0
- package/dist/commands/branch/create/index.js +164 -0
- package/dist/commands/branch/delete/index.d.ts +18 -0
- package/dist/commands/branch/delete/index.js +156 -0
- package/dist/commands/branch/edit/index.d.ts +19 -0
- package/dist/commands/branch/edit/index.js +166 -0
- package/dist/commands/branch/get/index.d.ts +16 -0
- package/dist/commands/branch/get/index.js +135 -0
- package/dist/commands/branch/list/index.d.ts +18 -0
- package/dist/commands/branch/list/index.js +138 -0
- package/dist/commands/branch/set-live/index.d.ts +18 -0
- package/dist/commands/branch/set-live/index.js +155 -0
- package/dist/commands/function/create/index.d.ts +6 -6
- package/dist/commands/function/create/index.js +55 -55
- package/dist/commands/function/edit/index.d.ts +10 -10
- package/dist/commands/function/edit/index.js +155 -162
- package/dist/commands/function/get/index.d.ts +5 -5
- package/dist/commands/function/get/index.js +55 -60
- package/dist/commands/function/list/index.d.ts +5 -5
- package/dist/commands/function/list/index.js +52 -52
- package/dist/commands/profile/create/index.d.ts +6 -6
- package/dist/commands/profile/create/index.js +37 -37
- package/dist/commands/profile/delete/index.d.ts +2 -2
- package/dist/commands/profile/delete/index.js +9 -9
- package/dist/commands/profile/edit/index.d.ts +7 -7
- package/dist/commands/profile/edit/index.js +47 -47
- package/dist/commands/profile/get-default/index.js +1 -1
- package/dist/commands/profile/list/index.d.ts +2 -2
- package/dist/commands/profile/list/index.js +9 -9
- package/dist/commands/profile/me/index.d.ts +3 -3
- package/dist/commands/profile/me/index.js +21 -21
- package/dist/commands/profile/project/index.js +1 -1
- package/dist/commands/profile/set-default/index.js +1 -1
- package/dist/commands/profile/token/index.js +1 -1
- package/dist/commands/profile/wizard/index.d.ts +4 -4
- package/dist/commands/profile/wizard/index.js +118 -122
- package/dist/commands/run/env/delete/index.d.ts +2 -2
- package/dist/commands/run/env/delete/index.js +9 -9
- package/dist/commands/run/env/get/index.d.ts +2 -2
- package/dist/commands/run/env/get/index.js +10 -10
- package/dist/commands/run/env/list/index.d.ts +2 -2
- package/dist/commands/run/env/list/index.js +16 -18
- package/dist/commands/run/env/set/index.d.ts +2 -2
- package/dist/commands/run/env/set/index.js +4 -4
- package/dist/commands/run/exec/index.d.ts +11 -11
- package/dist/commands/run/exec/index.js +109 -109
- package/dist/commands/run/info/index.d.ts +4 -4
- package/dist/commands/run/info/index.js +26 -26
- package/dist/commands/run/projects/create/index.d.ts +3 -3
- package/dist/commands/run/projects/create/index.js +22 -22
- package/dist/commands/run/projects/delete/index.d.ts +2 -2
- package/dist/commands/run/projects/delete/index.js +9 -9
- package/dist/commands/run/projects/list/index.d.ts +2 -2
- package/dist/commands/run/projects/list/index.js +11 -11
- package/dist/commands/run/projects/update/index.d.ts +3 -3
- package/dist/commands/run/projects/update/index.js +20 -20
- package/dist/commands/run/secrets/delete/index.d.ts +2 -2
- package/dist/commands/run/secrets/delete/index.js +9 -9
- package/dist/commands/run/secrets/get/index.d.ts +2 -2
- package/dist/commands/run/secrets/get/index.js +10 -10
- package/dist/commands/run/secrets/list/index.d.ts +2 -2
- package/dist/commands/run/secrets/list/index.js +21 -23
- package/dist/commands/run/secrets/set/index.d.ts +3 -3
- package/dist/commands/run/secrets/set/index.js +15 -15
- package/dist/commands/run/sessions/delete/index.d.ts +2 -2
- package/dist/commands/run/sessions/delete/index.js +9 -9
- package/dist/commands/run/sessions/get/index.d.ts +2 -2
- package/dist/commands/run/sessions/get/index.js +10 -10
- package/dist/commands/run/sessions/list/index.d.ts +2 -2
- package/dist/commands/run/sessions/list/index.js +10 -10
- package/dist/commands/run/sessions/start/index.d.ts +2 -2
- package/dist/commands/run/sessions/start/index.js +10 -10
- package/dist/commands/run/sessions/stop/index.d.ts +2 -2
- package/dist/commands/run/sessions/stop/index.js +10 -10
- package/dist/commands/run/sink/get/index.d.ts +2 -2
- package/dist/commands/run/sink/get/index.js +10 -10
- package/dist/commands/static_host/build/create/index.d.ts +4 -4
- package/dist/commands/static_host/build/create/index.js +33 -33
- package/dist/commands/static_host/build/get/index.d.ts +4 -4
- package/dist/commands/static_host/build/get/index.js +20 -20
- package/dist/commands/static_host/build/list/index.d.ts +3 -3
- package/dist/commands/static_host/build/list/index.js +31 -31
- package/dist/commands/static_host/list/index.d.ts +3 -3
- package/dist/commands/static_host/list/index.js +31 -31
- package/dist/commands/workspace/create/index.d.ts +3 -3
- package/dist/commands/workspace/create/index.js +24 -24
- package/dist/commands/workspace/delete/index.d.ts +2 -2
- package/dist/commands/workspace/delete/index.js +18 -18
- package/dist/commands/workspace/edit/index.d.ts +5 -5
- package/dist/commands/workspace/edit/index.js +34 -34
- package/dist/commands/workspace/get/index.d.ts +2 -2
- package/dist/commands/workspace/get/index.js +12 -12
- package/dist/commands/workspace/list/index.d.ts +2 -2
- package/dist/commands/workspace/list/index.js +15 -15
- package/dist/commands/workspace/pull/index.d.ts +4 -4
- package/dist/commands/workspace/pull/index.js +46 -51
- package/dist/commands/workspace/push/index.js +3 -3
- package/dist/help.d.ts +1 -1
- package/dist/lib/base-run-command.d.ts +4 -4
- package/dist/lib/base-run-command.js +3 -3
- package/dist/lib/run-http-client.d.ts +20 -20
- package/dist/lib/run-http-client.js +71 -71
- package/dist/lib/run-types.d.ts +80 -80
- package/oclif.manifest.json +1336 -815
- package/package.json +1 -1
|
@@ -2,16 +2,6 @@ import { Flags } from '@oclif/core';
|
|
|
2
2
|
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
3
3
|
export default class RunEnvList extends BaseRunCommand {
|
|
4
4
|
static args = {};
|
|
5
|
-
static flags = {
|
|
6
|
-
...BaseRunCommand.baseFlags,
|
|
7
|
-
output: Flags.string({
|
|
8
|
-
char: 'o',
|
|
9
|
-
description: 'Output format',
|
|
10
|
-
required: false,
|
|
11
|
-
default: 'list',
|
|
12
|
-
options: ['list', 'json'],
|
|
13
|
-
}),
|
|
14
|
-
};
|
|
15
5
|
static description = 'List all environment variable keys';
|
|
16
6
|
static examples = [
|
|
17
7
|
`$ xano run env list
|
|
@@ -24,6 +14,16 @@ Environment variables:
|
|
|
24
14
|
{ "env": ["API_KEY", "DATABASE_URL", "DEBUG"] }
|
|
25
15
|
`,
|
|
26
16
|
];
|
|
17
|
+
static flags = {
|
|
18
|
+
...BaseRunCommand.baseFlags,
|
|
19
|
+
output: Flags.string({
|
|
20
|
+
char: 'o',
|
|
21
|
+
default: 'list',
|
|
22
|
+
description: 'Output format',
|
|
23
|
+
options: ['list', 'json'],
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
27
|
async run() {
|
|
28
28
|
const { flags } = await this.parse(RunEnvList);
|
|
29
29
|
// Initialize with project required
|
|
@@ -34,15 +34,13 @@ Environment variables:
|
|
|
34
34
|
if (flags.output === 'json') {
|
|
35
35
|
this.outputJson(result);
|
|
36
36
|
}
|
|
37
|
+
else if (result.env.length === 0) {
|
|
38
|
+
this.log('No environment variables found.');
|
|
39
|
+
}
|
|
37
40
|
else {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
else {
|
|
42
|
-
this.log('Environment variables:');
|
|
43
|
-
for (const key of result.env) {
|
|
44
|
-
this.log(` - ${key}`);
|
|
45
|
-
}
|
|
41
|
+
this.log('Environment variables:');
|
|
42
|
+
for (const key of result.env) {
|
|
43
|
+
this.log(` - ${key}`);
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
46
|
}
|
|
@@ -4,11 +4,11 @@ export default class RunEnvSet extends BaseRunCommand {
|
|
|
4
4
|
name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
value: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
6
|
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
7
9
|
static flags: {
|
|
8
10
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
12
|
};
|
|
11
|
-
static description: string;
|
|
12
|
-
static examples: string[];
|
|
13
13
|
run(): Promise<void>;
|
|
14
14
|
}
|
|
@@ -11,9 +11,6 @@ export default class RunEnvSet extends BaseRunCommand {
|
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
|
-
static flags = {
|
|
15
|
-
...BaseRunCommand.baseFlags,
|
|
16
|
-
};
|
|
17
14
|
static description = 'Set an environment variable';
|
|
18
15
|
static examples = [
|
|
19
16
|
`$ xano run env set API_KEY my-secret-key
|
|
@@ -23,16 +20,19 @@ Environment variable 'API_KEY' set successfully!
|
|
|
23
20
|
Environment variable 'DATABASE_URL' set successfully!
|
|
24
21
|
`,
|
|
25
22
|
];
|
|
23
|
+
static flags = {
|
|
24
|
+
...BaseRunCommand.baseFlags,
|
|
25
|
+
};
|
|
26
26
|
async run() {
|
|
27
27
|
const { args, flags } = await this.parse(RunEnvSet);
|
|
28
28
|
// Initialize with project required
|
|
29
29
|
await this.initRunCommandWithProject(flags.profile, flags.verbose);
|
|
30
30
|
const input = {
|
|
31
|
-
name: args.name,
|
|
32
31
|
env: {
|
|
33
32
|
name: args.name,
|
|
34
33
|
value: args.value,
|
|
35
34
|
},
|
|
35
|
+
name: args.name,
|
|
36
36
|
};
|
|
37
37
|
try {
|
|
38
38
|
const url = this.httpClient.buildProjectUrl('/env');
|
|
@@ -3,29 +3,29 @@ export default class RunExec extends BaseRunCommand {
|
|
|
3
3
|
static args: {
|
|
4
4
|
path: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
6
8
|
static flags: {
|
|
7
|
-
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
-
stdin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
edit: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
9
|
args: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
edit: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
11
|
env: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
stdin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
15
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
16
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
17
|
};
|
|
16
|
-
static description: string;
|
|
17
|
-
static examples: string[];
|
|
18
18
|
run(): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Load all .xs files from a directory and combine them into a multidoc.
|
|
21
|
-
*/
|
|
22
|
-
private loadMultidocFromDirectory;
|
|
23
19
|
/**
|
|
24
20
|
* Recursively collect all .xs files from a directory, sorted for deterministic ordering.
|
|
25
21
|
*/
|
|
26
22
|
private collectFiles;
|
|
27
|
-
private outputSummary;
|
|
28
23
|
private editFile;
|
|
29
24
|
private isUrl;
|
|
25
|
+
/**
|
|
26
|
+
* Load all .xs files from a directory and combine them into a multidoc.
|
|
27
|
+
*/
|
|
28
|
+
private loadMultidocFromDirectory;
|
|
29
|
+
private outputSummary;
|
|
30
30
|
private readStdin;
|
|
31
31
|
}
|
|
@@ -11,45 +11,6 @@ export default class RunExec extends BaseRunCommand {
|
|
|
11
11
|
required: false,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
|
-
static flags = {
|
|
15
|
-
...BaseRunCommand.baseFlags,
|
|
16
|
-
file: Flags.string({
|
|
17
|
-
char: 'f',
|
|
18
|
-
description: 'Path or URL to file containing XanoScript code (deprecated: use path argument instead)',
|
|
19
|
-
required: false,
|
|
20
|
-
exclusive: ['stdin'],
|
|
21
|
-
}),
|
|
22
|
-
stdin: Flags.boolean({
|
|
23
|
-
char: 's',
|
|
24
|
-
description: 'Read XanoScript code from stdin',
|
|
25
|
-
required: false,
|
|
26
|
-
default: false,
|
|
27
|
-
exclusive: ['file'],
|
|
28
|
-
}),
|
|
29
|
-
edit: Flags.boolean({
|
|
30
|
-
char: 'e',
|
|
31
|
-
description: 'Open file in editor before running (requires path argument or --file)',
|
|
32
|
-
required: false,
|
|
33
|
-
default: false,
|
|
34
|
-
}),
|
|
35
|
-
output: Flags.string({
|
|
36
|
-
char: 'o',
|
|
37
|
-
description: 'Output format',
|
|
38
|
-
required: false,
|
|
39
|
-
default: 'summary',
|
|
40
|
-
options: ['summary', 'json'],
|
|
41
|
-
}),
|
|
42
|
-
args: Flags.string({
|
|
43
|
-
char: 'a',
|
|
44
|
-
description: 'Path or URL to JSON file containing input arguments',
|
|
45
|
-
required: false,
|
|
46
|
-
}),
|
|
47
|
-
env: Flags.string({
|
|
48
|
-
description: 'Environment variable override (key=value)',
|
|
49
|
-
required: false,
|
|
50
|
-
multiple: true,
|
|
51
|
-
}),
|
|
52
|
-
};
|
|
53
14
|
static description = 'Execute XanoScript code (job or service)';
|
|
54
15
|
static examples = [
|
|
55
16
|
`$ xano run exec script.xs
|
|
@@ -86,6 +47,45 @@ Executed successfully!
|
|
|
86
47
|
...
|
|
87
48
|
`,
|
|
88
49
|
];
|
|
50
|
+
static flags = {
|
|
51
|
+
...BaseRunCommand.baseFlags,
|
|
52
|
+
args: Flags.string({
|
|
53
|
+
char: 'a',
|
|
54
|
+
description: 'Path or URL to JSON file containing input arguments',
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
57
|
+
edit: Flags.boolean({
|
|
58
|
+
char: 'e',
|
|
59
|
+
default: false,
|
|
60
|
+
description: 'Open file in editor before running (requires path argument or --file)',
|
|
61
|
+
required: false,
|
|
62
|
+
}),
|
|
63
|
+
env: Flags.string({
|
|
64
|
+
description: 'Environment variable override (key=value)',
|
|
65
|
+
multiple: true,
|
|
66
|
+
required: false,
|
|
67
|
+
}),
|
|
68
|
+
file: Flags.string({
|
|
69
|
+
char: 'f',
|
|
70
|
+
description: 'Path or URL to file containing XanoScript code (deprecated: use path argument instead)',
|
|
71
|
+
exclusive: ['stdin'],
|
|
72
|
+
required: false,
|
|
73
|
+
}),
|
|
74
|
+
output: Flags.string({
|
|
75
|
+
char: 'o',
|
|
76
|
+
default: 'summary',
|
|
77
|
+
description: 'Output format',
|
|
78
|
+
options: ['summary', 'json'],
|
|
79
|
+
required: false,
|
|
80
|
+
}),
|
|
81
|
+
stdin: Flags.boolean({
|
|
82
|
+
char: 's',
|
|
83
|
+
default: false,
|
|
84
|
+
description: 'Read XanoScript code from stdin',
|
|
85
|
+
exclusive: ['file'],
|
|
86
|
+
required: false,
|
|
87
|
+
}),
|
|
88
|
+
};
|
|
89
89
|
async run() {
|
|
90
90
|
const { args, flags } = await this.parse(RunExec);
|
|
91
91
|
// Initialize with project required
|
|
@@ -238,6 +238,74 @@ Executed successfully!
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Recursively collect all .xs files from a directory, sorted for deterministic ordering.
|
|
243
|
+
*/
|
|
244
|
+
collectFiles(dir) {
|
|
245
|
+
const files = [];
|
|
246
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
247
|
+
for (const entry of entries) {
|
|
248
|
+
const fullPath = path.join(dir, entry.name);
|
|
249
|
+
if (entry.isDirectory()) {
|
|
250
|
+
files.push(...this.collectFiles(fullPath));
|
|
251
|
+
}
|
|
252
|
+
else if (entry.isFile() && entry.name.endsWith('.xs')) {
|
|
253
|
+
files.push(fullPath);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return files.sort();
|
|
257
|
+
}
|
|
258
|
+
// Editor value comes from EDITOR/VISUAL environment variables, not user input
|
|
259
|
+
async editFile(filePath) {
|
|
260
|
+
const editor = process.env.EDITOR || process.env.VISUAL;
|
|
261
|
+
if (!editor) {
|
|
262
|
+
this.error('No editor configured. Please set the EDITOR or VISUAL environment variable.\n' +
|
|
263
|
+
'Example: export EDITOR=vim');
|
|
264
|
+
}
|
|
265
|
+
// Validate editor executable exists
|
|
266
|
+
try {
|
|
267
|
+
execSync(`which ${editor.split(' ')[0]}`, { stdio: 'ignore' });
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
this.error(`Editor '${editor}' not found. Please set EDITOR to a valid editor.\n` +
|
|
271
|
+
'Example: export EDITOR=vim');
|
|
272
|
+
}
|
|
273
|
+
// Read the original file
|
|
274
|
+
let originalContent;
|
|
275
|
+
try {
|
|
276
|
+
originalContent = fs.readFileSync(filePath, 'utf8');
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
this.error(`Failed to read file '${filePath}': ${error}`);
|
|
280
|
+
}
|
|
281
|
+
// Create a temporary file with the same extension
|
|
282
|
+
const ext = path.extname(filePath);
|
|
283
|
+
const tmpFile = path.join(os.tmpdir(), `xano-edit-${Date.now()}${ext}`);
|
|
284
|
+
// Copy content to temp file
|
|
285
|
+
try {
|
|
286
|
+
fs.writeFileSync(tmpFile, originalContent, 'utf8');
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
this.error(`Failed to create temporary file: ${error}`);
|
|
290
|
+
}
|
|
291
|
+
// Open the editor
|
|
292
|
+
try {
|
|
293
|
+
execSync(`${editor} ${tmpFile}`, { stdio: 'inherit' });
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
try {
|
|
297
|
+
fs.unlinkSync(tmpFile);
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
// Ignore cleanup errors
|
|
301
|
+
}
|
|
302
|
+
this.error(`Editor exited with an error: ${error}`);
|
|
303
|
+
}
|
|
304
|
+
return tmpFile;
|
|
305
|
+
}
|
|
306
|
+
isUrl(str) {
|
|
307
|
+
return str.startsWith('http://') || str.startsWith('https://');
|
|
308
|
+
}
|
|
241
309
|
/**
|
|
242
310
|
* Load all .xs files from a directory and combine them into a multidoc.
|
|
243
311
|
*/
|
|
@@ -263,23 +331,6 @@ Executed successfully!
|
|
|
263
331
|
}
|
|
264
332
|
return documents.join('\n---\n');
|
|
265
333
|
}
|
|
266
|
-
/**
|
|
267
|
-
* Recursively collect all .xs files from a directory, sorted for deterministic ordering.
|
|
268
|
-
*/
|
|
269
|
-
collectFiles(dir) {
|
|
270
|
-
const files = [];
|
|
271
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
272
|
-
for (const entry of entries) {
|
|
273
|
-
const fullPath = path.join(dir, entry.name);
|
|
274
|
-
if (entry.isDirectory()) {
|
|
275
|
-
files.push(...this.collectFiles(fullPath));
|
|
276
|
-
}
|
|
277
|
-
else if (entry.isFile() && entry.name.endsWith('.xs')) {
|
|
278
|
-
files.push(fullPath);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
return files.sort();
|
|
282
|
-
}
|
|
283
334
|
outputSummary(result) {
|
|
284
335
|
this.log('Executed successfully!');
|
|
285
336
|
this.log('');
|
|
@@ -294,7 +345,7 @@ Executed successfully!
|
|
|
294
345
|
this.log(` Run ID: ${result.run.id}`);
|
|
295
346
|
}
|
|
296
347
|
if (result.run?.session) {
|
|
297
|
-
const session = result.run
|
|
348
|
+
const { session } = result.run;
|
|
298
349
|
this.log(` Session ID: ${session.id}`);
|
|
299
350
|
this.log(` State: ${session.state}`);
|
|
300
351
|
this.log('');
|
|
@@ -302,7 +353,7 @@ Executed successfully!
|
|
|
302
353
|
// Handle timing info
|
|
303
354
|
const timing = result.run?.result || result.run?.session || result.result;
|
|
304
355
|
if (timing) {
|
|
305
|
-
const formatTime = (time) => time
|
|
356
|
+
const formatTime = (time) => time === undefined ? undefined : `${(time * 1000).toFixed(2)}ms`;
|
|
306
357
|
const times = [
|
|
307
358
|
{ label: 'Total', value: formatTime(timing.total_time) },
|
|
308
359
|
{ label: 'Boot', value: formatTime(timing.boot_time) },
|
|
@@ -362,57 +413,6 @@ Executed successfully!
|
|
|
362
413
|
this.log(` Error: ${result.run.session.error_msg}`);
|
|
363
414
|
}
|
|
364
415
|
}
|
|
365
|
-
// Editor value comes from EDITOR/VISUAL environment variables, not user input
|
|
366
|
-
async editFile(filePath) {
|
|
367
|
-
const editor = process.env.EDITOR || process.env.VISUAL;
|
|
368
|
-
if (!editor) {
|
|
369
|
-
this.error('No editor configured. Please set the EDITOR or VISUAL environment variable.\n' +
|
|
370
|
-
'Example: export EDITOR=vim');
|
|
371
|
-
}
|
|
372
|
-
// Validate editor executable exists
|
|
373
|
-
try {
|
|
374
|
-
execSync(`which ${editor.split(' ')[0]}`, { stdio: 'ignore' });
|
|
375
|
-
}
|
|
376
|
-
catch {
|
|
377
|
-
this.error(`Editor '${editor}' not found. Please set EDITOR to a valid editor.\n` +
|
|
378
|
-
'Example: export EDITOR=vim');
|
|
379
|
-
}
|
|
380
|
-
// Read the original file
|
|
381
|
-
let originalContent;
|
|
382
|
-
try {
|
|
383
|
-
originalContent = fs.readFileSync(filePath, 'utf8');
|
|
384
|
-
}
|
|
385
|
-
catch (error) {
|
|
386
|
-
this.error(`Failed to read file '${filePath}': ${error}`);
|
|
387
|
-
}
|
|
388
|
-
// Create a temporary file with the same extension
|
|
389
|
-
const ext = path.extname(filePath);
|
|
390
|
-
const tmpFile = path.join(os.tmpdir(), `xano-edit-${Date.now()}${ext}`);
|
|
391
|
-
// Copy content to temp file
|
|
392
|
-
try {
|
|
393
|
-
fs.writeFileSync(tmpFile, originalContent, 'utf8');
|
|
394
|
-
}
|
|
395
|
-
catch (error) {
|
|
396
|
-
this.error(`Failed to create temporary file: ${error}`);
|
|
397
|
-
}
|
|
398
|
-
// Open the editor
|
|
399
|
-
try {
|
|
400
|
-
execSync(`${editor} ${tmpFile}`, { stdio: 'inherit' });
|
|
401
|
-
}
|
|
402
|
-
catch (error) {
|
|
403
|
-
try {
|
|
404
|
-
fs.unlinkSync(tmpFile);
|
|
405
|
-
}
|
|
406
|
-
catch {
|
|
407
|
-
// Ignore cleanup errors
|
|
408
|
-
}
|
|
409
|
-
this.error(`Editor exited with an error: ${error}`);
|
|
410
|
-
}
|
|
411
|
-
return tmpFile;
|
|
412
|
-
}
|
|
413
|
-
isUrl(str) {
|
|
414
|
-
return str.startsWith('http://') || str.startsWith('https://');
|
|
415
|
-
}
|
|
416
416
|
async readStdin() {
|
|
417
417
|
return new Promise((resolve, reject) => {
|
|
418
418
|
const chunks = [];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import BaseRunCommand from '../../../lib/base-run-command.js';
|
|
2
2
|
export default class RunInfo extends BaseRunCommand {
|
|
3
3
|
static args: {};
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
4
6
|
static flags: {
|
|
5
7
|
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
-
stdin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
8
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
stdin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
10
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
12
|
};
|
|
11
|
-
static description: string;
|
|
12
|
-
static examples: string[];
|
|
13
13
|
run(): Promise<void>;
|
|
14
|
-
private outputSummary;
|
|
15
14
|
private isUrl;
|
|
15
|
+
private outputSummary;
|
|
16
16
|
private readStdin;
|
|
17
17
|
}
|
|
@@ -3,29 +3,6 @@ import * as fs from 'node:fs';
|
|
|
3
3
|
import BaseRunCommand from '../../../lib/base-run-command.js';
|
|
4
4
|
export default class RunInfo extends BaseRunCommand {
|
|
5
5
|
static args = {};
|
|
6
|
-
static flags = {
|
|
7
|
-
...BaseRunCommand.baseFlags,
|
|
8
|
-
file: Flags.string({
|
|
9
|
-
char: 'f',
|
|
10
|
-
description: 'Path or URL to file containing XanoScript code',
|
|
11
|
-
required: false,
|
|
12
|
-
exclusive: ['stdin'],
|
|
13
|
-
}),
|
|
14
|
-
stdin: Flags.boolean({
|
|
15
|
-
char: 's',
|
|
16
|
-
description: 'Read XanoScript code from stdin',
|
|
17
|
-
required: false,
|
|
18
|
-
default: false,
|
|
19
|
-
exclusive: ['file'],
|
|
20
|
-
}),
|
|
21
|
-
output: Flags.string({
|
|
22
|
-
char: 'o',
|
|
23
|
-
description: 'Output format',
|
|
24
|
-
required: false,
|
|
25
|
-
default: 'summary',
|
|
26
|
-
options: ['summary', 'json'],
|
|
27
|
-
}),
|
|
28
|
-
};
|
|
29
6
|
static description = 'Get information about a XanoScript document (type, inputs, env vars)';
|
|
30
7
|
static examples = [
|
|
31
8
|
`$ xano run info -f script.xs
|
|
@@ -48,6 +25,29 @@ Document Info:
|
|
|
48
25
|
{ "type": "job", "input": { "name": {...} }, "env": ["API_KEY"] }
|
|
49
26
|
`,
|
|
50
27
|
];
|
|
28
|
+
static flags = {
|
|
29
|
+
...BaseRunCommand.baseFlags,
|
|
30
|
+
file: Flags.string({
|
|
31
|
+
char: 'f',
|
|
32
|
+
description: 'Path or URL to file containing XanoScript code',
|
|
33
|
+
exclusive: ['stdin'],
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
output: Flags.string({
|
|
37
|
+
char: 'o',
|
|
38
|
+
default: 'summary',
|
|
39
|
+
description: 'Output format',
|
|
40
|
+
options: ['summary', 'json'],
|
|
41
|
+
required: false,
|
|
42
|
+
}),
|
|
43
|
+
stdin: Flags.boolean({
|
|
44
|
+
char: 's',
|
|
45
|
+
default: false,
|
|
46
|
+
description: 'Read XanoScript code from stdin',
|
|
47
|
+
exclusive: ['file'],
|
|
48
|
+
required: false,
|
|
49
|
+
}),
|
|
50
|
+
};
|
|
51
51
|
async run() {
|
|
52
52
|
const { flags } = await this.parse(RunInfo);
|
|
53
53
|
// Initialize with project required
|
|
@@ -112,6 +112,9 @@ Document Info:
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
isUrl(str) {
|
|
116
|
+
return str.startsWith('http://') || str.startsWith('https://');
|
|
117
|
+
}
|
|
115
118
|
outputSummary(result) {
|
|
116
119
|
this.log('Document Info:');
|
|
117
120
|
this.log(` Type: ${result.type}`);
|
|
@@ -139,9 +142,6 @@ Document Info:
|
|
|
139
142
|
this.log(' (none)');
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
|
-
isUrl(str) {
|
|
143
|
-
return str.startsWith('http://') || str.startsWith('https://');
|
|
144
|
-
}
|
|
145
145
|
async readStdin() {
|
|
146
146
|
return new Promise((resolve, reject) => {
|
|
147
147
|
const chunks = [];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
2
2
|
export default class RunProjectsCreate extends BaseRunCommand {
|
|
3
3
|
static args: {};
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
4
6
|
static flags: {
|
|
5
|
-
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
7
|
description: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
9
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
10
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
12
|
};
|
|
11
|
-
static description: string;
|
|
12
|
-
static examples: string[];
|
|
13
13
|
run(): Promise<void>;
|
|
14
14
|
}
|
|
@@ -2,27 +2,6 @@ import { Flags } from '@oclif/core';
|
|
|
2
2
|
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
3
3
|
export default class RunProjectsCreate extends BaseRunCommand {
|
|
4
4
|
static args = {};
|
|
5
|
-
static flags = {
|
|
6
|
-
...BaseRunCommand.baseFlags,
|
|
7
|
-
name: Flags.string({
|
|
8
|
-
char: 'n',
|
|
9
|
-
description: 'Project name',
|
|
10
|
-
required: true,
|
|
11
|
-
}),
|
|
12
|
-
description: Flags.string({
|
|
13
|
-
char: 'd',
|
|
14
|
-
description: 'Project description',
|
|
15
|
-
required: false,
|
|
16
|
-
default: '',
|
|
17
|
-
}),
|
|
18
|
-
output: Flags.string({
|
|
19
|
-
char: 'o',
|
|
20
|
-
description: 'Output format',
|
|
21
|
-
required: false,
|
|
22
|
-
default: 'summary',
|
|
23
|
-
options: ['summary', 'json'],
|
|
24
|
-
}),
|
|
25
|
-
};
|
|
26
5
|
static description = 'Create a new project';
|
|
27
6
|
static examples = [
|
|
28
7
|
`$ xano run projects create -n "My Project"
|
|
@@ -39,13 +18,34 @@ Project created successfully!
|
|
|
39
18
|
{ "id": "abc123-def456-ghi789", "name": "My Project", ... }
|
|
40
19
|
`,
|
|
41
20
|
];
|
|
21
|
+
static flags = {
|
|
22
|
+
...BaseRunCommand.baseFlags,
|
|
23
|
+
description: Flags.string({
|
|
24
|
+
char: 'd',
|
|
25
|
+
default: '',
|
|
26
|
+
description: 'Project description',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
name: Flags.string({
|
|
30
|
+
char: 'n',
|
|
31
|
+
description: 'Project name',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
output: Flags.string({
|
|
35
|
+
char: 'o',
|
|
36
|
+
default: 'summary',
|
|
37
|
+
description: 'Output format',
|
|
38
|
+
options: ['summary', 'json'],
|
|
39
|
+
required: false,
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
42
|
async run() {
|
|
43
43
|
const { flags } = await this.parse(RunProjectsCreate);
|
|
44
44
|
// Initialize (no project required for creating projects)
|
|
45
45
|
await this.initRunCommand(flags.profile, flags.verbose);
|
|
46
46
|
const input = {
|
|
47
|
-
name: flags.name,
|
|
48
47
|
description: flags.description || '',
|
|
48
|
+
name: flags.name,
|
|
49
49
|
};
|
|
50
50
|
try {
|
|
51
51
|
const url = this.httpClient.buildUrl('/project');
|
|
@@ -3,12 +3,12 @@ export default class RunProjectsDelete extends BaseRunCommand {
|
|
|
3
3
|
static args: {
|
|
4
4
|
projectId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
6
8
|
static flags: {
|
|
7
9
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
10
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
12
|
};
|
|
11
|
-
static description: string;
|
|
12
|
-
static examples: string[];
|
|
13
13
|
run(): Promise<void>;
|
|
14
14
|
}
|
|
@@ -7,15 +7,6 @@ export default class RunProjectsDelete extends BaseRunCommand {
|
|
|
7
7
|
required: true,
|
|
8
8
|
}),
|
|
9
9
|
};
|
|
10
|
-
static flags = {
|
|
11
|
-
...BaseRunCommand.baseFlags,
|
|
12
|
-
force: Flags.boolean({
|
|
13
|
-
char: 'f',
|
|
14
|
-
description: 'Skip confirmation prompt',
|
|
15
|
-
required: false,
|
|
16
|
-
default: false,
|
|
17
|
-
}),
|
|
18
|
-
};
|
|
19
10
|
static description = 'Delete a project';
|
|
20
11
|
static examples = [
|
|
21
12
|
`$ xano run projects delete abc123-def456
|
|
@@ -26,6 +17,15 @@ Project deleted successfully!
|
|
|
26
17
|
Project deleted successfully!
|
|
27
18
|
`,
|
|
28
19
|
];
|
|
20
|
+
static flags = {
|
|
21
|
+
...BaseRunCommand.baseFlags,
|
|
22
|
+
force: Flags.boolean({
|
|
23
|
+
char: 'f',
|
|
24
|
+
default: false,
|
|
25
|
+
description: 'Skip confirmation prompt',
|
|
26
|
+
required: false,
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
29
|
async run() {
|
|
30
30
|
const { args, flags } = await this.parse(RunProjectsDelete);
|
|
31
31
|
// Initialize (no project required)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
2
2
|
export default class RunProjectsList extends BaseRunCommand {
|
|
3
3
|
static args: {};
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
4
6
|
static flags: {
|
|
5
7
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
8
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
9
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
10
|
};
|
|
9
|
-
static description: string;
|
|
10
|
-
static examples: string[];
|
|
11
11
|
run(): Promise<void>;
|
|
12
12
|
private outputTable;
|
|
13
13
|
}
|