@respan/cli 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dev.js +3 -0
- package/bin/run.js +10 -0
- package/dist/commands/auth/login.d.ts +14 -0
- package/dist/commands/auth/login.js +26 -0
- package/dist/commands/auth/logout.d.ts +12 -0
- package/dist/commands/auth/logout.js +18 -0
- package/dist/commands/auth/status.d.ts +12 -0
- package/dist/commands/auth/status.js +24 -0
- package/dist/commands/config/get.d.ts +15 -0
- package/dist/commands/config/get.js +15 -0
- package/dist/commands/config/list.d.ts +12 -0
- package/dist/commands/config/list.js +18 -0
- package/dist/commands/config/set.d.ts +16 -0
- package/dist/commands/config/set.js +18 -0
- package/dist/commands/datasets/add-spans.d.ts +16 -0
- package/dist/commands/datasets/add-spans.js +24 -0
- package/dist/commands/datasets/create-span.d.ts +16 -0
- package/dist/commands/datasets/create-span.js +36 -0
- package/dist/commands/datasets/create.d.ts +14 -0
- package/dist/commands/datasets/create.js +26 -0
- package/dist/commands/datasets/get-span.d.ts +16 -0
- package/dist/commands/datasets/get-span.js +23 -0
- package/dist/commands/datasets/get.d.ts +15 -0
- package/dist/commands/datasets/get.js +20 -0
- package/dist/commands/datasets/list.d.ts +14 -0
- package/dist/commands/datasets/list.js +23 -0
- package/dist/commands/datasets/spans.d.ts +15 -0
- package/dist/commands/datasets/spans.js +20 -0
- package/dist/commands/datasets/update.d.ts +17 -0
- package/dist/commands/datasets/update.js +32 -0
- package/dist/commands/evaluators/create.d.ts +16 -0
- package/dist/commands/evaluators/create.js +38 -0
- package/dist/commands/evaluators/get.d.ts +15 -0
- package/dist/commands/evaluators/get.js +20 -0
- package/dist/commands/evaluators/list.d.ts +14 -0
- package/dist/commands/evaluators/list.js +26 -0
- package/dist/commands/evaluators/run.d.ts +18 -0
- package/dist/commands/evaluators/run.js +41 -0
- package/dist/commands/evaluators/update.d.ts +18 -0
- package/dist/commands/evaluators/update.js +41 -0
- package/dist/commands/experiments/create.d.ts +16 -0
- package/dist/commands/experiments/create.js +39 -0
- package/dist/commands/experiments/get.d.ts +15 -0
- package/dist/commands/experiments/get.js +20 -0
- package/dist/commands/experiments/list.d.ts +14 -0
- package/dist/commands/experiments/list.js +23 -0
- package/dist/commands/logs/create.d.ts +16 -0
- package/dist/commands/logs/create.js +38 -0
- package/dist/commands/logs/get.d.ts +15 -0
- package/dist/commands/logs/get.js +20 -0
- package/dist/commands/logs/list.d.ts +18 -0
- package/dist/commands/logs/list.js +51 -0
- package/dist/commands/logs/summary.d.ts +14 -0
- package/dist/commands/logs/summary.js +23 -0
- package/dist/commands/prompts/create-version.d.ts +19 -0
- package/dist/commands/prompts/create-version.js +44 -0
- package/dist/commands/prompts/create.d.ts +14 -0
- package/dist/commands/prompts/create.js +26 -0
- package/dist/commands/prompts/get.d.ts +15 -0
- package/dist/commands/prompts/get.js +20 -0
- package/dist/commands/prompts/list.d.ts +13 -0
- package/dist/commands/prompts/list.js +22 -0
- package/dist/commands/prompts/update.d.ts +17 -0
- package/dist/commands/prompts/update.js +32 -0
- package/dist/commands/prompts/versions.d.ts +15 -0
- package/dist/commands/prompts/versions.js +20 -0
- package/dist/commands/traces/get.d.ts +15 -0
- package/dist/commands/traces/get.js +20 -0
- package/dist/commands/traces/list.d.ts +19 -0
- package/dist/commands/traces/list.js +47 -0
- package/dist/commands/traces/summary.d.ts +14 -0
- package/dist/commands/traces/summary.js +23 -0
- package/dist/commands/users/create.d.ts +16 -0
- package/dist/commands/users/create.js +38 -0
- package/dist/commands/users/get.d.ts +15 -0
- package/dist/commands/users/get.js +20 -0
- package/dist/commands/users/list.d.ts +16 -0
- package/dist/commands/users/list.js +38 -0
- package/dist/commands/users/update.d.ts +18 -0
- package/dist/commands/users/update.js +38 -0
- package/dist/commands/whoami.d.ts +12 -0
- package/dist/commands/whoami.js +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/auth.d.ts +16 -0
- package/dist/lib/auth.js +40 -0
- package/dist/lib/banner.d.ts +2 -0
- package/dist/lib/banner.js +117 -0
- package/dist/lib/base-command.d.ts +20 -0
- package/dist/lib/base-command.js +74 -0
- package/dist/lib/config.d.ts +26 -0
- package/dist/lib/config.js +81 -0
- package/dist/lib/output.d.ts +6 -0
- package/dist/lib/output.js +95 -0
- package/dist/lib/pagination.d.ts +12 -0
- package/dist/lib/pagination.js +34 -0
- package/dist/lib/spinner.d.ts +11 -0
- package/dist/lib/spinner.js +56 -0
- package/oclif.manifest.json +2886 -0
- package/package.json +52 -0
package/bin/dev.js
ADDED
package/bin/run.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {execute} from '@oclif/core';
|
|
3
|
+
|
|
4
|
+
const args = process.argv.slice(2);
|
|
5
|
+
if (args.length === 0 || (args.length === 1 && args[0] === '--help')) {
|
|
6
|
+
const {printBanner} = await import('../dist/lib/banner.js');
|
|
7
|
+
printBanner();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
await execute({dir: import.meta.url});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class AuthLogin extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
'profile-name': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'base-url': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { password } from '@inquirer/prompts';
|
|
3
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
4
|
+
import { setCredential } from '../../lib/config.js';
|
|
5
|
+
import { printLoginSuccess } from '../../lib/banner.js';
|
|
6
|
+
class AuthLogin extends BaseCommand {
|
|
7
|
+
async run() {
|
|
8
|
+
const { flags } = await this.parse(AuthLogin);
|
|
9
|
+
this.globalFlags = flags;
|
|
10
|
+
let apiKey = flags['api-key'];
|
|
11
|
+
if (!apiKey) {
|
|
12
|
+
apiKey = await password({ message: 'Enter your Respan API key:' });
|
|
13
|
+
}
|
|
14
|
+
const profile = flags['profile-name'] || 'default';
|
|
15
|
+
setCredential(profile, { type: 'api_key', apiKey, baseUrl: flags['base-url'] });
|
|
16
|
+
await printLoginSuccess(undefined, profile);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
AuthLogin.description = 'Log in to Respan';
|
|
20
|
+
AuthLogin.flags = {
|
|
21
|
+
...BaseCommand.baseFlags,
|
|
22
|
+
'api-key': Flags.string({ description: 'API key to store' }),
|
|
23
|
+
'profile-name': Flags.string({ description: 'Profile name', default: 'default' }),
|
|
24
|
+
'base-url': Flags.string({ description: 'API base URL', default: 'https://api.respan.ai/api' }),
|
|
25
|
+
};
|
|
26
|
+
export default AuthLogin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class AuthLogout extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
import { deleteCredential, getActiveProfile } from '../../lib/config.js';
|
|
4
|
+
class AuthLogout extends BaseCommand {
|
|
5
|
+
async run() {
|
|
6
|
+
const { flags } = await this.parse(AuthLogout);
|
|
7
|
+
this.globalFlags = flags;
|
|
8
|
+
const profile = flags.profile || getActiveProfile();
|
|
9
|
+
deleteCredential(profile);
|
|
10
|
+
this.log(`Logged out of profile "${profile}".`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
AuthLogout.description = 'Log out and remove stored credentials';
|
|
14
|
+
AuthLogout.flags = {
|
|
15
|
+
...BaseCommand.baseFlags,
|
|
16
|
+
profile: Flags.string({ description: 'Profile to log out' }),
|
|
17
|
+
};
|
|
18
|
+
export default AuthLogout;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class AuthStatus extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
import { getActiveProfile, getCredential } from '../../lib/config.js';
|
|
3
|
+
class AuthStatus extends BaseCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
const { flags } = await this.parse(AuthStatus);
|
|
6
|
+
this.globalFlags = flags;
|
|
7
|
+
const profile = getActiveProfile();
|
|
8
|
+
const cred = getCredential(profile);
|
|
9
|
+
if (!cred) {
|
|
10
|
+
this.log('Not authenticated. Run `respan auth login`.');
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
this.log(`Profile: ${profile}`);
|
|
14
|
+
this.log(`Type: ${cred.type}`);
|
|
15
|
+
if (cred.type === 'api_key')
|
|
16
|
+
this.log(`API Key: ${cred.apiKey.slice(0, 8)}...`);
|
|
17
|
+
if (cred.type === 'jwt')
|
|
18
|
+
this.log(`Email: ${cred.email}`);
|
|
19
|
+
this.log(`Base URL: ${cred.baseUrl}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
AuthStatus.description = 'Show current authentication status';
|
|
23
|
+
AuthStatus.flags = { ...BaseCommand.baseFlags };
|
|
24
|
+
export default AuthStatus;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class ConfigGet extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
key: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
import { getConfigValue } from '../../lib/config.js';
|
|
4
|
+
class ConfigGet extends BaseCommand {
|
|
5
|
+
async run() {
|
|
6
|
+
const { args, flags } = await this.parse(ConfigGet);
|
|
7
|
+
this.globalFlags = flags;
|
|
8
|
+
const value = getConfigValue(args.key);
|
|
9
|
+
this.log(value !== undefined ? String(value) : `Key "${args.key}" not set.`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
ConfigGet.description = 'Get a configuration value';
|
|
13
|
+
ConfigGet.args = { key: Args.string({ description: 'Config key', required: true }) };
|
|
14
|
+
ConfigGet.flags = { ...BaseCommand.baseFlags };
|
|
15
|
+
export default ConfigGet;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class ConfigList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
import { getConfig, getAllCredentials, getActiveProfile } from '../../lib/config.js';
|
|
3
|
+
class ConfigList extends BaseCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
const { flags } = await this.parse(ConfigList);
|
|
6
|
+
this.globalFlags = flags;
|
|
7
|
+
const config = getConfig();
|
|
8
|
+
const creds = getAllCredentials();
|
|
9
|
+
const active = getActiveProfile();
|
|
10
|
+
this.log(`Active profile: ${active}`);
|
|
11
|
+
this.log(`Profiles: ${Object.keys(creds).join(', ') || '(none)'}`);
|
|
12
|
+
if (config.defaults)
|
|
13
|
+
this.log(`Defaults: ${JSON.stringify(config.defaults)}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
ConfigList.description = 'List all configuration';
|
|
17
|
+
ConfigList.flags = { ...BaseCommand.baseFlags };
|
|
18
|
+
export default ConfigList;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class ConfigSet extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
key: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
value: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
import { setConfigValue } from '../../lib/config.js';
|
|
4
|
+
class ConfigSet extends BaseCommand {
|
|
5
|
+
async run() {
|
|
6
|
+
const { args, flags } = await this.parse(ConfigSet);
|
|
7
|
+
this.globalFlags = flags;
|
|
8
|
+
setConfigValue(args.key, args.value);
|
|
9
|
+
this.log(`Set ${args.key} = ${args.value}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
ConfigSet.description = 'Set a configuration value';
|
|
13
|
+
ConfigSet.args = {
|
|
14
|
+
key: Args.string({ description: 'Config key', required: true }),
|
|
15
|
+
value: Args.string({ description: 'Config value', required: true }),
|
|
16
|
+
};
|
|
17
|
+
ConfigSet.flags = { ...BaseCommand.baseFlags };
|
|
18
|
+
export default ConfigSet;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class DatasetsAddSpans extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
'dataset-id': import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
'span-ids': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
class DatasetsAddSpans extends BaseCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
const { args, flags } = await this.parse(DatasetsAddSpans);
|
|
6
|
+
this.globalFlags = flags;
|
|
7
|
+
try {
|
|
8
|
+
const client = this.getClient();
|
|
9
|
+
const spanIds = flags['span-ids'].split(',').map((s) => s.trim());
|
|
10
|
+
const data = await this.spin('Adding spans to dataset', () => client.datasets.addSpansToDataset({ dataset_id: args['dataset-id'], body: { span_ids: spanIds } }));
|
|
11
|
+
this.log(JSON.stringify(data, null, 2));
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
this.handleError(error);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
DatasetsAddSpans.description = 'Add existing spans to a dataset';
|
|
19
|
+
DatasetsAddSpans.args = { 'dataset-id': Args.string({ description: 'Dataset ID', required: true }) };
|
|
20
|
+
DatasetsAddSpans.flags = {
|
|
21
|
+
...BaseCommand.baseFlags,
|
|
22
|
+
'span-ids': Flags.string({ description: 'Comma-separated span IDs', required: true }),
|
|
23
|
+
};
|
|
24
|
+
export default DatasetsAddSpans;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class DatasetsCreateSpan extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
'dataset-id': import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
body: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
class DatasetsCreateSpan extends BaseCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
const { args, flags } = await this.parse(DatasetsCreateSpan);
|
|
6
|
+
this.globalFlags = flags;
|
|
7
|
+
try {
|
|
8
|
+
const client = this.getClient();
|
|
9
|
+
let parsed;
|
|
10
|
+
try {
|
|
11
|
+
parsed = JSON.parse(flags.body);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
this.error('Invalid JSON for --body');
|
|
15
|
+
}
|
|
16
|
+
const spanData = parsed;
|
|
17
|
+
const data = await this.spin('Creating dataset span', () => client.datasets.createDatasetSpan({
|
|
18
|
+
dataset_id: args['dataset-id'],
|
|
19
|
+
input: String(spanData.input || ''),
|
|
20
|
+
output: String(spanData.output || ''),
|
|
21
|
+
...(spanData.metadata ? { metadata: spanData.metadata } : {}),
|
|
22
|
+
}));
|
|
23
|
+
this.log(JSON.stringify(data, null, 2));
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
this.handleError(error);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
DatasetsCreateSpan.description = 'Create a span in a dataset';
|
|
31
|
+
DatasetsCreateSpan.args = { 'dataset-id': Args.string({ description: 'Dataset ID', required: true }) };
|
|
32
|
+
DatasetsCreateSpan.flags = {
|
|
33
|
+
...BaseCommand.baseFlags,
|
|
34
|
+
body: Flags.string({ description: 'Span body as JSON string', required: true }),
|
|
35
|
+
};
|
|
36
|
+
export default DatasetsCreateSpan;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class DatasetsCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
class DatasetsCreate extends BaseCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
const { flags } = await this.parse(DatasetsCreate);
|
|
6
|
+
this.globalFlags = flags;
|
|
7
|
+
try {
|
|
8
|
+
const client = this.getClient();
|
|
9
|
+
const body = { name: flags.name };
|
|
10
|
+
if (flags.description)
|
|
11
|
+
body.description = flags.description;
|
|
12
|
+
const data = await this.spin('Creating dataset', () => client.datasets.createDataset(body));
|
|
13
|
+
this.log(JSON.stringify(data, null, 2));
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
this.handleError(error);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
DatasetsCreate.description = 'Create a new dataset';
|
|
21
|
+
DatasetsCreate.flags = {
|
|
22
|
+
...BaseCommand.baseFlags,
|
|
23
|
+
name: Flags.string({ description: 'Dataset name', required: true }),
|
|
24
|
+
description: Flags.string({ description: 'Dataset description' }),
|
|
25
|
+
};
|
|
26
|
+
export default DatasetsCreate;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class DatasetsGetSpan extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
'dataset-id': import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
'span-id': import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
class DatasetsGetSpan extends BaseCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
const { args, flags } = await this.parse(DatasetsGetSpan);
|
|
6
|
+
this.globalFlags = flags;
|
|
7
|
+
try {
|
|
8
|
+
const client = this.getClient();
|
|
9
|
+
const data = await this.spin('Fetching dataset span', () => client.datasets.retrievespan({ dataset_id: args['dataset-id'], log_id: args['span-id'] }));
|
|
10
|
+
this.log(JSON.stringify(data, null, 2));
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
this.handleError(error);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
DatasetsGetSpan.description = 'Get a specific span from a dataset';
|
|
18
|
+
DatasetsGetSpan.args = {
|
|
19
|
+
'dataset-id': Args.string({ description: 'Dataset ID', required: true }),
|
|
20
|
+
'span-id': Args.string({ description: 'Span ID', required: true }),
|
|
21
|
+
};
|
|
22
|
+
DatasetsGetSpan.flags = { ...BaseCommand.baseFlags };
|
|
23
|
+
export default DatasetsGetSpan;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class DatasetsGet extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
class DatasetsGet extends BaseCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
const { args, flags } = await this.parse(DatasetsGet);
|
|
6
|
+
this.globalFlags = flags;
|
|
7
|
+
try {
|
|
8
|
+
const client = this.getClient();
|
|
9
|
+
const data = await this.spin('Fetching dataset', () => client.datasets.retrieveDataset({ dataset_id: args.id }));
|
|
10
|
+
this.log(JSON.stringify(data, null, 2));
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
this.handleError(error);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
DatasetsGet.description = 'Get a specific dataset';
|
|
18
|
+
DatasetsGet.args = { id: Args.string({ description: 'Dataset ID', required: true }) };
|
|
19
|
+
DatasetsGet.flags = { ...BaseCommand.baseFlags };
|
|
20
|
+
export default DatasetsGet;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class DatasetsList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
class DatasetsList extends BaseCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
const { flags } = await this.parse(DatasetsList);
|
|
6
|
+
this.globalFlags = flags;
|
|
7
|
+
try {
|
|
8
|
+
const client = this.getClient();
|
|
9
|
+
const data = await this.spin('Fetching datasets', () => client.datasets.listDatasets());
|
|
10
|
+
this.outputResult(data, ['id', 'name', 'description', 'created_at']);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
this.handleError(error);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
DatasetsList.description = 'List datasets';
|
|
18
|
+
DatasetsList.flags = {
|
|
19
|
+
...BaseCommand.baseFlags,
|
|
20
|
+
limit: Flags.integer({ description: 'Number of results per page', default: 50 }),
|
|
21
|
+
page: Flags.integer({ description: 'Page number', default: 1 }),
|
|
22
|
+
};
|
|
23
|
+
export default DatasetsList;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class DatasetsSpans extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
'dataset-id': import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
class DatasetsSpans extends BaseCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
const { args, flags } = await this.parse(DatasetsSpans);
|
|
6
|
+
this.globalFlags = flags;
|
|
7
|
+
try {
|
|
8
|
+
const client = this.getClient();
|
|
9
|
+
const data = await this.spin('Fetching dataset spans', () => client.datasets.listspans({ dataset_id: args['dataset-id'] }));
|
|
10
|
+
this.outputResult(data, ['id', 'input', 'output', 'created_at']);
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
this.handleError(error);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
DatasetsSpans.description = 'List spans in a dataset';
|
|
18
|
+
DatasetsSpans.args = { 'dataset-id': Args.string({ description: 'Dataset ID', required: true }) };
|
|
19
|
+
DatasetsSpans.flags = { ...BaseCommand.baseFlags };
|
|
20
|
+
export default DatasetsSpans;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class DatasetsUpdate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
3
|
+
class DatasetsUpdate extends BaseCommand {
|
|
4
|
+
async run() {
|
|
5
|
+
const { args, flags } = await this.parse(DatasetsUpdate);
|
|
6
|
+
this.globalFlags = flags;
|
|
7
|
+
try {
|
|
8
|
+
const client = this.getClient();
|
|
9
|
+
const updateBody = {};
|
|
10
|
+
if (flags.name)
|
|
11
|
+
updateBody.name = flags.name;
|
|
12
|
+
if (flags.description)
|
|
13
|
+
updateBody.description = flags.description;
|
|
14
|
+
const data = await this.spin('Updating dataset', () => client.datasets.updateDataset({
|
|
15
|
+
dataset_id: args.id,
|
|
16
|
+
body: updateBody,
|
|
17
|
+
}));
|
|
18
|
+
this.log(JSON.stringify(data, null, 2));
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
this.handleError(error);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
DatasetsUpdate.description = 'Update a dataset';
|
|
26
|
+
DatasetsUpdate.args = { id: Args.string({ description: 'Dataset ID', required: true }) };
|
|
27
|
+
DatasetsUpdate.flags = {
|
|
28
|
+
...BaseCommand.baseFlags,
|
|
29
|
+
name: Flags.string({ description: 'Dataset name' }),
|
|
30
|
+
description: Flags.string({ description: 'Dataset description' }),
|
|
31
|
+
};
|
|
32
|
+
export default DatasetsUpdate;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
+
export default class EvaluatorsCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
type: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
csv: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|