@eide/foir-cli 0.1.34 → 0.1.36
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/cli.js +7469 -81
- package/dist/config/types.d.ts +7 -6
- package/dist/config/types.js +6 -14
- package/dist/generated-CPsQ9jfu.d.ts +195 -0
- package/dist/lib/extension-helpers.d.ts +10 -7
- package/dist/lib/extension-helpers.js +15 -85
- package/dist/lib/hook-helpers.d.ts +9 -6
- package/dist/lib/hook-helpers.js +12 -105
- package/dist/lib/seed-helpers.d.ts +10 -8
- package/dist/lib/seed-helpers.js +18 -124
- package/package.json +9 -7
- package/dist/auth/credentials.d.ts +0 -31
- package/dist/auth/credentials.d.ts.map +0 -1
- package/dist/auth/credentials.js +0 -139
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/codegen/fetch-customer-profile-schema.d.ts +0 -12
- package/dist/codegen/fetch-customer-profile-schema.d.ts.map +0 -1
- package/dist/codegen/fetch-customer-profile-schema.js +0 -21
- package/dist/codegen/fetch-models.d.ts +0 -58
- package/dist/codegen/fetch-models.d.ts.map +0 -1
- package/dist/codegen/fetch-models.js +0 -96
- package/dist/codegen/field-mapping.d.ts +0 -34
- package/dist/codegen/field-mapping.d.ts.map +0 -1
- package/dist/codegen/field-mapping.js +0 -250
- package/dist/codegen/generators/config.d.ts +0 -5
- package/dist/codegen/generators/config.d.ts.map +0 -1
- package/dist/codegen/generators/config.js +0 -82
- package/dist/codegen/generators/customer-profile-documents.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-documents.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-documents.js +0 -42
- package/dist/codegen/generators/customer-profile-hooks.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-hooks.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-hooks.js +0 -78
- package/dist/codegen/generators/customer-profile-loaders.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-loaders.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-loaders.js +0 -67
- package/dist/codegen/generators/customer-profile-operations.d.ts +0 -5
- package/dist/codegen/generators/customer-profile-operations.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-operations.js +0 -126
- package/dist/codegen/generators/customer-profile-types.d.ts +0 -6
- package/dist/codegen/generators/customer-profile-types.d.ts.map +0 -1
- package/dist/codegen/generators/customer-profile-types.js +0 -45
- package/dist/codegen/generators/documents.d.ts +0 -12
- package/dist/codegen/generators/documents.d.ts.map +0 -1
- package/dist/codegen/generators/documents.js +0 -178
- package/dist/codegen/generators/field-types.d.ts +0 -5
- package/dist/codegen/generators/field-types.d.ts.map +0 -1
- package/dist/codegen/generators/field-types.js +0 -346
- package/dist/codegen/generators/model-index.d.ts +0 -6
- package/dist/codegen/generators/model-index.d.ts.map +0 -1
- package/dist/codegen/generators/model-index.js +0 -26
- package/dist/codegen/generators/model-types.d.ts +0 -12
- package/dist/codegen/generators/model-types.d.ts.map +0 -1
- package/dist/codegen/generators/model-types.js +0 -176
- package/dist/codegen/generators/public-schema-content.d.ts +0 -14
- package/dist/codegen/generators/public-schema-content.d.ts.map +0 -1
- package/dist/codegen/generators/public-schema-content.js +0 -22
- package/dist/codegen/generators/react-hooks-index.d.ts +0 -6
- package/dist/codegen/generators/react-hooks-index.d.ts.map +0 -1
- package/dist/codegen/generators/react-hooks-index.js +0 -20
- package/dist/codegen/generators/react-hooks.d.ts +0 -7
- package/dist/codegen/generators/react-hooks.d.ts.map +0 -1
- package/dist/codegen/generators/react-hooks.js +0 -139
- package/dist/codegen/generators/remix-loaders-index.d.ts +0 -6
- package/dist/codegen/generators/remix-loaders-index.d.ts.map +0 -1
- package/dist/codegen/generators/remix-loaders-index.js +0 -20
- package/dist/codegen/generators/remix-loaders.d.ts +0 -7
- package/dist/codegen/generators/remix-loaders.d.ts.map +0 -1
- package/dist/codegen/generators/remix-loaders.js +0 -107
- package/dist/codegen/generators/static-documents.d.ts +0 -14
- package/dist/codegen/generators/static-documents.d.ts.map +0 -1
- package/dist/codegen/generators/static-documents.js +0 -771
- package/dist/codegen/generators/swift-customer-profile.d.ts +0 -9
- package/dist/codegen/generators/swift-customer-profile.d.ts.map +0 -1
- package/dist/codegen/generators/swift-customer-profile.js +0 -152
- package/dist/codegen/generators/swift-field-types.d.ts +0 -5
- package/dist/codegen/generators/swift-field-types.d.ts.map +0 -1
- package/dist/codegen/generators/swift-field-types.js +0 -151
- package/dist/codegen/generators/swift-model-keys.d.ts +0 -6
- package/dist/codegen/generators/swift-model-keys.d.ts.map +0 -1
- package/dist/codegen/generators/swift-model-keys.js +0 -25
- package/dist/codegen/generators/swift-types.d.ts +0 -13
- package/dist/codegen/generators/swift-types.d.ts.map +0 -1
- package/dist/codegen/generators/swift-types.js +0 -188
- package/dist/codegen/generators/typed-operations-common.d.ts +0 -6
- package/dist/codegen/generators/typed-operations-common.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations-common.js +0 -84
- package/dist/codegen/generators/typed-operations-index.d.ts +0 -6
- package/dist/codegen/generators/typed-operations-index.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations-index.js +0 -22
- package/dist/codegen/generators/typed-operations.d.ts +0 -11
- package/dist/codegen/generators/typed-operations.d.ts.map +0 -1
- package/dist/codegen/generators/typed-operations.js +0 -263
- package/dist/codegen/swift-field-mapping.d.ts +0 -30
- package/dist/codegen/swift-field-mapping.d.ts.map +0 -1
- package/dist/codegen/swift-field-mapping.js +0 -150
- package/dist/codegen/write-files.d.ts +0 -15
- package/dist/codegen/write-files.d.ts.map +0 -1
- package/dist/codegen/write-files.js +0 -36
- package/dist/commands/api-keys.d.ts +0 -4
- package/dist/commands/api-keys.d.ts.map +0 -1
- package/dist/commands/api-keys.js +0 -129
- package/dist/commands/auth-config.d.ts +0 -4
- package/dist/commands/auth-config.d.ts.map +0 -1
- package/dist/commands/auth-config.js +0 -38
- package/dist/commands/auth-providers.d.ts +0 -4
- package/dist/commands/auth-providers.d.ts.map +0 -1
- package/dist/commands/auth-providers.js +0 -207
- package/dist/commands/context.d.ts +0 -4
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -91
- package/dist/commands/create-extension.d.ts +0 -4
- package/dist/commands/create-extension.d.ts.map +0 -1
- package/dist/commands/create-extension.js +0 -60
- package/dist/commands/customer-profiles.d.ts +0 -4
- package/dist/commands/customer-profiles.d.ts.map +0 -1
- package/dist/commands/customer-profiles.js +0 -99
- package/dist/commands/customers.d.ts +0 -4
- package/dist/commands/customers.d.ts.map +0 -1
- package/dist/commands/customers.js +0 -126
- package/dist/commands/embeddings.d.ts +0 -4
- package/dist/commands/embeddings.d.ts.map +0 -1
- package/dist/commands/embeddings.js +0 -145
- package/dist/commands/experiments.d.ts +0 -4
- package/dist/commands/experiments.d.ts.map +0 -1
- package/dist/commands/experiments.js +0 -196
- package/dist/commands/extensions.d.ts +0 -4
- package/dist/commands/extensions.d.ts.map +0 -1
- package/dist/commands/extensions.js +0 -210
- package/dist/commands/files.d.ts +0 -4
- package/dist/commands/files.d.ts.map +0 -1
- package/dist/commands/files.js +0 -143
- package/dist/commands/hooks.d.ts +0 -4
- package/dist/commands/hooks.d.ts.map +0 -1
- package/dist/commands/hooks.js +0 -228
- package/dist/commands/locales.d.ts +0 -4
- package/dist/commands/locales.d.ts.map +0 -1
- package/dist/commands/locales.js +0 -140
- package/dist/commands/login.d.ts +0 -4
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -124
- package/dist/commands/logout.d.ts +0 -4
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -16
- package/dist/commands/media.d.ts +0 -4
- package/dist/commands/media.d.ts.map +0 -1
- package/dist/commands/media.js +0 -44
- package/dist/commands/models.d.ts +0 -4
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js +0 -153
- package/dist/commands/notes.d.ts +0 -4
- package/dist/commands/notes.d.ts.map +0 -1
- package/dist/commands/notes.js +0 -132
- package/dist/commands/notifications.d.ts +0 -4
- package/dist/commands/notifications.d.ts.map +0 -1
- package/dist/commands/notifications.js +0 -73
- package/dist/commands/operations.d.ts +0 -4
- package/dist/commands/operations.d.ts.map +0 -1
- package/dist/commands/operations.js +0 -341
- package/dist/commands/pull.d.ts +0 -4
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -300
- package/dist/commands/records.d.ts +0 -4
- package/dist/commands/records.d.ts.map +0 -1
- package/dist/commands/records.js +0 -314
- package/dist/commands/schedules.d.ts +0 -4
- package/dist/commands/schedules.d.ts.map +0 -1
- package/dist/commands/schedules.js +0 -155
- package/dist/commands/search.d.ts +0 -4
- package/dist/commands/search.d.ts.map +0 -1
- package/dist/commands/search.js +0 -60
- package/dist/commands/segments.d.ts +0 -4
- package/dist/commands/segments.d.ts.map +0 -1
- package/dist/commands/segments.js +0 -155
- package/dist/commands/select-project.d.ts +0 -4
- package/dist/commands/select-project.d.ts.map +0 -1
- package/dist/commands/select-project.js +0 -144
- package/dist/commands/settings.d.ts +0 -4
- package/dist/commands/settings.d.ts.map +0 -1
- package/dist/commands/settings.js +0 -115
- package/dist/commands/variant-catalog.d.ts +0 -4
- package/dist/commands/variant-catalog.d.ts.map +0 -1
- package/dist/commands/variant-catalog.js +0 -118
- package/dist/commands/whoami.d.ts +0 -4
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -51
- package/dist/config/pull-config.d.ts +0 -33
- package/dist/config/pull-config.d.ts.map +0 -1
- package/dist/config/pull-config.js +0 -119
- package/dist/config/types.d.ts.map +0 -1
- package/dist/graphql/generated.d.ts +0 -8330
- package/dist/graphql/generated.d.ts.map +0 -1
- package/dist/graphql/generated.js +0 -135
- package/dist/lib/client.d.ts +0 -18
- package/dist/lib/client.d.ts.map +0 -1
- package/dist/lib/client.js +0 -64
- package/dist/lib/config-loader.d.ts +0 -28
- package/dist/lib/config-loader.d.ts.map +0 -1
- package/dist/lib/config-loader.js +0 -49
- package/dist/lib/config.d.ts +0 -12
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -8
- package/dist/lib/errors.d.ts +0 -6
- package/dist/lib/errors.d.ts.map +0 -1
- package/dist/lib/errors.js +0 -76
- package/dist/lib/extension-helpers.d.ts.map +0 -1
- package/dist/lib/hook-helpers.d.ts.map +0 -1
- package/dist/lib/input.d.ts +0 -38
- package/dist/lib/input.d.ts.map +0 -1
- package/dist/lib/input.js +0 -108
- package/dist/lib/output.d.ts +0 -31
- package/dist/lib/output.d.ts.map +0 -1
- package/dist/lib/output.js +0 -107
- package/dist/lib/seed-helpers.d.ts.map +0 -1
- package/dist/scaffold/package-manager.d.ts +0 -12
- package/dist/scaffold/package-manager.d.ts.map +0 -1
- package/dist/scaffold/package-manager.js +0 -51
- package/dist/scaffold/scaffold.d.ts +0 -4
- package/dist/scaffold/scaffold.d.ts.map +0 -1
- package/dist/scaffold/scaffold.js +0 -462
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { withErrorHandler } from '../lib/errors.js';
|
|
2
|
-
import { createClient } from '../lib/client.js';
|
|
3
|
-
import { formatOutput, formatList, timeAgo, success } from '../lib/output.js';
|
|
4
|
-
import { confirmAction } from '../lib/input.js';
|
|
5
|
-
import { ListCustomersDocument, GetCustomerDocument, GetCustomerByEmailDocument, CreateCustomerDocument, DeleteCustomerDocument, } from '../graphql/generated.js';
|
|
6
|
-
export function registerCustomersCommands(program, globalOpts) {
|
|
7
|
-
const customers = program
|
|
8
|
-
.command('customers')
|
|
9
|
-
.description('Manage customers');
|
|
10
|
-
// list
|
|
11
|
-
customers
|
|
12
|
-
.command('list')
|
|
13
|
-
.description('List customers')
|
|
14
|
-
.option('--status <status>', 'Filter by status (ACTIVE, PENDING, SUSPENDED)')
|
|
15
|
-
.option('--search <term>', 'Search by email')
|
|
16
|
-
.option('--limit <n>', 'Max results', '20')
|
|
17
|
-
.option('--offset <n>', 'Skip results', '0')
|
|
18
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
19
|
-
const opts = globalOpts();
|
|
20
|
-
const client = await createClient(opts);
|
|
21
|
-
const data = await client.request(ListCustomersDocument, {
|
|
22
|
-
status: cmdOpts.status,
|
|
23
|
-
search: cmdOpts.search,
|
|
24
|
-
limit: parseInt(cmdOpts.limit ?? '20', 10),
|
|
25
|
-
offset: parseInt(cmdOpts.offset ?? '0', 10),
|
|
26
|
-
});
|
|
27
|
-
formatList(data.customers.customers, opts, {
|
|
28
|
-
columns: [
|
|
29
|
-
{ key: 'id', header: 'ID', width: 28 },
|
|
30
|
-
{ key: 'email', header: 'Email', width: 30 },
|
|
31
|
-
{ key: 'status', header: 'Status', width: 12 },
|
|
32
|
-
{
|
|
33
|
-
key: 'lastLoginAt',
|
|
34
|
-
header: 'Last Login',
|
|
35
|
-
width: 12,
|
|
36
|
-
format: (v) => timeAgo(v),
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
key: 'createdAt',
|
|
40
|
-
header: 'Created',
|
|
41
|
-
width: 12,
|
|
42
|
-
format: (v) => timeAgo(v),
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
total: data.customers.total,
|
|
46
|
-
});
|
|
47
|
-
}));
|
|
48
|
-
// get
|
|
49
|
-
customers
|
|
50
|
-
.command('get <idOrEmail>')
|
|
51
|
-
.description('Get a customer by ID or email')
|
|
52
|
-
.action(withErrorHandler(globalOpts, async (idOrEmail) => {
|
|
53
|
-
const opts = globalOpts();
|
|
54
|
-
const client = await createClient(opts);
|
|
55
|
-
let result;
|
|
56
|
-
if (idOrEmail.includes('@')) {
|
|
57
|
-
const data = await client.request(GetCustomerByEmailDocument, {
|
|
58
|
-
email: idOrEmail,
|
|
59
|
-
});
|
|
60
|
-
result = data.customerByEmail;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
const data = await client.request(GetCustomerDocument, {
|
|
64
|
-
id: idOrEmail,
|
|
65
|
-
});
|
|
66
|
-
result = data.customer;
|
|
67
|
-
}
|
|
68
|
-
if (!result) {
|
|
69
|
-
throw new Error(`Customer "${idOrEmail}" not found.`);
|
|
70
|
-
}
|
|
71
|
-
formatOutput(result, opts);
|
|
72
|
-
}));
|
|
73
|
-
// create
|
|
74
|
-
customers
|
|
75
|
-
.command('create')
|
|
76
|
-
.description('Create a new customer')
|
|
77
|
-
.option('--email <email>', 'Customer email (required)')
|
|
78
|
-
.option('-d, --data <json>', 'Additional data as JSON')
|
|
79
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
80
|
-
const opts = globalOpts();
|
|
81
|
-
const client = await createClient(opts);
|
|
82
|
-
let input = {};
|
|
83
|
-
if (cmdOpts.data) {
|
|
84
|
-
try {
|
|
85
|
-
input = JSON.parse(cmdOpts.data);
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
throw new Error('Invalid JSON in --data. Provide valid JSON, e.g. --data \'{"name":"Jo"}\'');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (cmdOpts.email) {
|
|
92
|
-
input.email = cmdOpts.email;
|
|
93
|
-
}
|
|
94
|
-
if (!input.email) {
|
|
95
|
-
throw new Error('--email is required.');
|
|
96
|
-
}
|
|
97
|
-
const data = await client.request(CreateCustomerDocument, {
|
|
98
|
-
input,
|
|
99
|
-
});
|
|
100
|
-
formatOutput(data.createCustomer, opts);
|
|
101
|
-
if (!(opts.json || opts.jsonl || opts.quiet)) {
|
|
102
|
-
success(`Created customer ${data.createCustomer.email}`);
|
|
103
|
-
}
|
|
104
|
-
}));
|
|
105
|
-
// delete
|
|
106
|
-
customers
|
|
107
|
-
.command('delete <id>')
|
|
108
|
-
.description('Delete a customer (hard delete for GDPR)')
|
|
109
|
-
.option('--confirm', 'Skip confirmation prompt')
|
|
110
|
-
.action(withErrorHandler(globalOpts, async (id, cmdOpts) => {
|
|
111
|
-
const opts = globalOpts();
|
|
112
|
-
const confirmed = await confirmAction(`Delete customer ${id}? This cannot be undone.`, { confirm: !!cmdOpts.confirm });
|
|
113
|
-
if (!confirmed) {
|
|
114
|
-
console.log('Aborted.');
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const client = await createClient(opts);
|
|
118
|
-
const data = await client.request(DeleteCustomerDocument, { id });
|
|
119
|
-
if (opts.json || opts.jsonl) {
|
|
120
|
-
formatOutput(data.deleteCustomer, opts);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
success(`Deleted customer ${id}`);
|
|
124
|
-
}
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings.d.ts","sourceRoot":"","sources":["../../src/commands/embeddings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AActD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAqKN"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { withErrorHandler } from '../lib/errors.js';
|
|
2
|
-
import { createClient } from '../lib/client.js';
|
|
3
|
-
import { formatOutput, formatList, timeAgo, success } from '../lib/output.js';
|
|
4
|
-
import { parseInputData } from '../lib/input.js';
|
|
5
|
-
import { WriteEmbeddingsDocument, DeleteEmbeddingsDocument, SearchEmbeddingsDocument, EmbeddingsForRecordDocument, EmbeddingStatsDocument, FindSimilarRecordsDocument, } from '../graphql/generated.js';
|
|
6
|
-
export function registerEmbeddingsCommands(program, globalOpts) {
|
|
7
|
-
const embeddings = program
|
|
8
|
-
.command('embeddings')
|
|
9
|
-
.description('Manage vector embeddings');
|
|
10
|
-
// write
|
|
11
|
-
embeddings
|
|
12
|
-
.command('write')
|
|
13
|
-
.description('Write embeddings for records')
|
|
14
|
-
.option('-d, --data <json>', 'Embedding data as JSON')
|
|
15
|
-
.option('-f, --file <path>', 'Read input from file')
|
|
16
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
17
|
-
const opts = globalOpts();
|
|
18
|
-
const client = await createClient(opts);
|
|
19
|
-
const input = await parseInputData(cmdOpts);
|
|
20
|
-
const data = await client.request(WriteEmbeddingsDocument, {
|
|
21
|
-
input,
|
|
22
|
-
});
|
|
23
|
-
formatOutput(data.writeEmbeddings, opts);
|
|
24
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
25
|
-
success(`Wrote ${data.writeEmbeddings.written} embedding(s)`);
|
|
26
|
-
}));
|
|
27
|
-
// delete
|
|
28
|
-
embeddings
|
|
29
|
-
.command('delete')
|
|
30
|
-
.description('Delete embeddings')
|
|
31
|
-
.option('--record-id <id>', 'Delete by record ID')
|
|
32
|
-
.option('--key <key>', 'Delete by embedding key')
|
|
33
|
-
.option('--model-key <key>', 'Delete by model key')
|
|
34
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
35
|
-
const opts = globalOpts();
|
|
36
|
-
const client = await createClient(opts);
|
|
37
|
-
const input = {};
|
|
38
|
-
if (cmdOpts.recordId)
|
|
39
|
-
input.recordId = cmdOpts.recordId;
|
|
40
|
-
if (cmdOpts.key)
|
|
41
|
-
input.key = cmdOpts.key;
|
|
42
|
-
if (cmdOpts.modelKey)
|
|
43
|
-
input.modelKey = cmdOpts.modelKey;
|
|
44
|
-
const data = await client.request(DeleteEmbeddingsDocument, { input });
|
|
45
|
-
formatOutput(data.deleteEmbeddings, opts);
|
|
46
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
47
|
-
success(`Deleted ${data.deleteEmbeddings.deleted} embedding(s)`);
|
|
48
|
-
}));
|
|
49
|
-
// search
|
|
50
|
-
embeddings
|
|
51
|
-
.command('search')
|
|
52
|
-
.description('Search embeddings by vector or text')
|
|
53
|
-
.option('-d, --data <json>', 'Search input as JSON')
|
|
54
|
-
.option('-f, --file <path>', 'Read input from file')
|
|
55
|
-
.option('--limit <n>', 'Max results', '10')
|
|
56
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
57
|
-
const opts = globalOpts();
|
|
58
|
-
const client = await createClient(opts);
|
|
59
|
-
const input = await parseInputData(cmdOpts);
|
|
60
|
-
if (cmdOpts.limit && !input.limit) {
|
|
61
|
-
input.limit = parseInt(String(cmdOpts.limit), 10);
|
|
62
|
-
}
|
|
63
|
-
const data = await client.request(SearchEmbeddingsDocument, {
|
|
64
|
-
input,
|
|
65
|
-
});
|
|
66
|
-
formatList(data.searchEmbeddings, opts, {
|
|
67
|
-
columns: [
|
|
68
|
-
{ key: 'recordId', header: 'Record ID', width: 28 },
|
|
69
|
-
{ key: 'modelKey', header: 'Model', width: 16 },
|
|
70
|
-
{ key: 'naturalKey', header: 'Natural Key', width: 20 },
|
|
71
|
-
{ key: 'key', header: 'Key', width: 16 },
|
|
72
|
-
{
|
|
73
|
-
key: 'similarity',
|
|
74
|
-
header: 'Similarity',
|
|
75
|
-
width: 12,
|
|
76
|
-
format: (v) => v.toFixed(4),
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
});
|
|
80
|
-
}));
|
|
81
|
-
// list (embeddings for a record)
|
|
82
|
-
embeddings
|
|
83
|
-
.command('list <recordId>')
|
|
84
|
-
.description('List embeddings for a record')
|
|
85
|
-
.action(withErrorHandler(globalOpts, async (recordId) => {
|
|
86
|
-
const opts = globalOpts();
|
|
87
|
-
const client = await createClient(opts);
|
|
88
|
-
const data = await client.request(EmbeddingsForRecordDocument, {
|
|
89
|
-
recordId,
|
|
90
|
-
});
|
|
91
|
-
formatList(data.embeddingsForRecord, opts, {
|
|
92
|
-
columns: [
|
|
93
|
-
{ key: 'id', header: 'ID', width: 28 },
|
|
94
|
-
{ key: 'key', header: 'Key', width: 20 },
|
|
95
|
-
{ key: 'dimensions', header: 'Dims', width: 6 },
|
|
96
|
-
{ key: 'contentHash', header: 'Hash', width: 16 },
|
|
97
|
-
{
|
|
98
|
-
key: 'updatedAt',
|
|
99
|
-
header: 'Updated',
|
|
100
|
-
width: 12,
|
|
101
|
-
format: (v) => timeAgo(v),
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
});
|
|
105
|
-
}));
|
|
106
|
-
// stats
|
|
107
|
-
embeddings
|
|
108
|
-
.command('stats <modelKey>')
|
|
109
|
-
.description('Get embedding statistics for a model')
|
|
110
|
-
.action(withErrorHandler(globalOpts, async (modelKey) => {
|
|
111
|
-
const opts = globalOpts();
|
|
112
|
-
const client = await createClient(opts);
|
|
113
|
-
const data = await client.request(EmbeddingStatsDocument, { modelKey });
|
|
114
|
-
formatOutput(data.embeddingStats, opts);
|
|
115
|
-
}));
|
|
116
|
-
// similar
|
|
117
|
-
embeddings
|
|
118
|
-
.command('similar <recordId>')
|
|
119
|
-
.description('Find records similar to a given record')
|
|
120
|
-
.option('--key <key>', 'Embedding key to compare')
|
|
121
|
-
.option('--limit <n>', 'Max results', '10')
|
|
122
|
-
.action(withErrorHandler(globalOpts, async (recordId, cmdOpts) => {
|
|
123
|
-
const opts = globalOpts();
|
|
124
|
-
const client = await createClient(opts);
|
|
125
|
-
const data = await client.request(FindSimilarRecordsDocument, {
|
|
126
|
-
recordId,
|
|
127
|
-
key: cmdOpts.key,
|
|
128
|
-
limit: parseInt(String(cmdOpts.limit ?? '10'), 10),
|
|
129
|
-
});
|
|
130
|
-
formatList(data.findSimilarRecords, opts, {
|
|
131
|
-
columns: [
|
|
132
|
-
{ key: 'recordId', header: 'Record ID', width: 28 },
|
|
133
|
-
{ key: 'modelKey', header: 'Model', width: 16 },
|
|
134
|
-
{ key: 'naturalKey', header: 'Natural Key', width: 20 },
|
|
135
|
-
{ key: 'key', header: 'Key', width: 16 },
|
|
136
|
-
{
|
|
137
|
-
key: 'similarity',
|
|
138
|
-
header: 'Similarity',
|
|
139
|
-
width: 12,
|
|
140
|
-
format: (v) => v.toFixed(4),
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
});
|
|
144
|
-
}));
|
|
145
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"experiments.d.ts","sourceRoot":"","sources":["../../src/commands/experiments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmBtD,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAkON"}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { withErrorHandler } from '../lib/errors.js';
|
|
2
|
-
import { createClient } from '../lib/client.js';
|
|
3
|
-
import { formatOutput, formatList, timeAgo, success } from '../lib/output.js';
|
|
4
|
-
import { parseInputData, isUUID, confirmAction } from '../lib/input.js';
|
|
5
|
-
import { ListExperimentsDocument, GetExperimentDocument, GetExperimentByKeyDocument, CreateExperimentDocument, UpdateExperimentDocument, DeleteExperimentDocument, StartExperimentDocument, PauseExperimentDocument, ResumeExperimentDocument, EndExperimentDocument, ExperimentStatsDocument, } from '../graphql/generated.js';
|
|
6
|
-
export function registerExperimentsCommands(program, globalOpts) {
|
|
7
|
-
const experiments = program
|
|
8
|
-
.command('experiments')
|
|
9
|
-
.description('Manage experiments');
|
|
10
|
-
// list
|
|
11
|
-
experiments
|
|
12
|
-
.command('list')
|
|
13
|
-
.description('List experiments')
|
|
14
|
-
.option('--status <status>', 'Filter by status')
|
|
15
|
-
.option('--active', 'Only active experiments')
|
|
16
|
-
.option('--limit <n>', 'Max results', '50')
|
|
17
|
-
.option('--offset <n>', 'Skip results', '0')
|
|
18
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
19
|
-
const opts = globalOpts();
|
|
20
|
-
const client = await createClient(opts);
|
|
21
|
-
const data = await client.request(ListExperimentsDocument, {
|
|
22
|
-
status: cmdOpts.status,
|
|
23
|
-
isActive: cmdOpts.active ? true : undefined,
|
|
24
|
-
limit: parseInt(String(cmdOpts.limit ?? '50'), 10),
|
|
25
|
-
offset: parseInt(String(cmdOpts.offset ?? '0'), 10),
|
|
26
|
-
});
|
|
27
|
-
formatList(data.experiments, opts, {
|
|
28
|
-
columns: [
|
|
29
|
-
{ key: 'id', header: 'ID', width: 28 },
|
|
30
|
-
{ key: 'key', header: 'Key', width: 20 },
|
|
31
|
-
{ key: 'name', header: 'Name', width: 24 },
|
|
32
|
-
{ key: 'status', header: 'Status', width: 12 },
|
|
33
|
-
{
|
|
34
|
-
key: 'isActive',
|
|
35
|
-
header: 'Active',
|
|
36
|
-
width: 8,
|
|
37
|
-
format: (v) => (v ? 'yes' : 'no'),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
key: 'updatedAt',
|
|
41
|
-
header: 'Updated',
|
|
42
|
-
width: 12,
|
|
43
|
-
format: (v) => timeAgo(v),
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
});
|
|
47
|
-
}));
|
|
48
|
-
// get
|
|
49
|
-
experiments
|
|
50
|
-
.command('get <idOrKey>')
|
|
51
|
-
.description('Get an experiment by ID or key')
|
|
52
|
-
.action(withErrorHandler(globalOpts, async (idOrKey) => {
|
|
53
|
-
const opts = globalOpts();
|
|
54
|
-
const client = await createClient(opts);
|
|
55
|
-
let result;
|
|
56
|
-
if (isUUID(idOrKey)) {
|
|
57
|
-
const data = await client.request(GetExperimentDocument, {
|
|
58
|
-
id: idOrKey,
|
|
59
|
-
});
|
|
60
|
-
result = data.experiment;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
const data = await client.request(GetExperimentByKeyDocument, {
|
|
64
|
-
key: idOrKey,
|
|
65
|
-
});
|
|
66
|
-
result = data.experimentByKey;
|
|
67
|
-
}
|
|
68
|
-
if (!result)
|
|
69
|
-
throw new Error(`Experiment "${idOrKey}" not found.`);
|
|
70
|
-
formatOutput(result, opts);
|
|
71
|
-
}));
|
|
72
|
-
// create
|
|
73
|
-
experiments
|
|
74
|
-
.command('create')
|
|
75
|
-
.description('Create a new experiment')
|
|
76
|
-
.option('-d, --data <json>', 'Experiment data as JSON')
|
|
77
|
-
.option('-f, --file <path>', 'Read data from file')
|
|
78
|
-
.action(withErrorHandler(globalOpts, async (cmdOpts) => {
|
|
79
|
-
const opts = globalOpts();
|
|
80
|
-
const client = await createClient(opts);
|
|
81
|
-
const input = await parseInputData(cmdOpts);
|
|
82
|
-
const data = await client.request(CreateExperimentDocument, {
|
|
83
|
-
input,
|
|
84
|
-
});
|
|
85
|
-
formatOutput(data.createExperiment, opts);
|
|
86
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
87
|
-
success(`Created experiment ${data.createExperiment.key}`);
|
|
88
|
-
}));
|
|
89
|
-
// update
|
|
90
|
-
experiments
|
|
91
|
-
.command('update <id>')
|
|
92
|
-
.description('Update an experiment')
|
|
93
|
-
.option('-d, --data <json>', 'Experiment data as JSON')
|
|
94
|
-
.option('-f, --file <path>', 'Read data from file')
|
|
95
|
-
.action(withErrorHandler(globalOpts, async (id, cmdOpts) => {
|
|
96
|
-
const opts = globalOpts();
|
|
97
|
-
const client = await createClient(opts);
|
|
98
|
-
const input = await parseInputData(cmdOpts);
|
|
99
|
-
const data = await client.request(UpdateExperimentDocument, {
|
|
100
|
-
id,
|
|
101
|
-
input,
|
|
102
|
-
});
|
|
103
|
-
formatOutput(data.updateExperiment, opts);
|
|
104
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
105
|
-
success(`Updated experiment ${id}`);
|
|
106
|
-
}));
|
|
107
|
-
// delete
|
|
108
|
-
experiments
|
|
109
|
-
.command('delete <id>')
|
|
110
|
-
.description('Delete an experiment')
|
|
111
|
-
.option('--confirm', 'Skip confirmation prompt')
|
|
112
|
-
.action(withErrorHandler(globalOpts, async (id, cmdOpts) => {
|
|
113
|
-
const opts = globalOpts();
|
|
114
|
-
const confirmed = await confirmAction(`Delete experiment ${id}?`, {
|
|
115
|
-
confirm: !!cmdOpts.confirm,
|
|
116
|
-
});
|
|
117
|
-
if (!confirmed) {
|
|
118
|
-
console.log('Aborted.');
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const client = await createClient(opts);
|
|
122
|
-
await client.request(DeleteExperimentDocument, { id });
|
|
123
|
-
if (opts.json || opts.jsonl)
|
|
124
|
-
formatOutput({ deleted: true, id }, opts);
|
|
125
|
-
else
|
|
126
|
-
success(`Deleted experiment ${id}`);
|
|
127
|
-
}));
|
|
128
|
-
// start
|
|
129
|
-
experiments
|
|
130
|
-
.command('start <id>')
|
|
131
|
-
.description('Start an experiment')
|
|
132
|
-
.action(withErrorHandler(globalOpts, async (id) => {
|
|
133
|
-
const opts = globalOpts();
|
|
134
|
-
const client = await createClient(opts);
|
|
135
|
-
const data = await client.request(StartExperimentDocument, {
|
|
136
|
-
experimentId: id,
|
|
137
|
-
});
|
|
138
|
-
formatOutput(data.startExperiment, opts);
|
|
139
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
140
|
-
success('Experiment started');
|
|
141
|
-
}));
|
|
142
|
-
// pause
|
|
143
|
-
experiments
|
|
144
|
-
.command('pause <id>')
|
|
145
|
-
.description('Pause a running experiment')
|
|
146
|
-
.action(withErrorHandler(globalOpts, async (id) => {
|
|
147
|
-
const opts = globalOpts();
|
|
148
|
-
const client = await createClient(opts);
|
|
149
|
-
const data = await client.request(PauseExperimentDocument, {
|
|
150
|
-
experimentId: id,
|
|
151
|
-
});
|
|
152
|
-
formatOutput(data.pauseExperiment, opts);
|
|
153
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
154
|
-
success('Experiment paused');
|
|
155
|
-
}));
|
|
156
|
-
// resume
|
|
157
|
-
experiments
|
|
158
|
-
.command('resume <id>')
|
|
159
|
-
.description('Resume a paused experiment')
|
|
160
|
-
.action(withErrorHandler(globalOpts, async (id) => {
|
|
161
|
-
const opts = globalOpts();
|
|
162
|
-
const client = await createClient(opts);
|
|
163
|
-
const data = await client.request(ResumeExperimentDocument, {
|
|
164
|
-
experimentId: id,
|
|
165
|
-
});
|
|
166
|
-
formatOutput(data.resumeExperiment, opts);
|
|
167
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
168
|
-
success('Experiment resumed');
|
|
169
|
-
}));
|
|
170
|
-
// end
|
|
171
|
-
experiments
|
|
172
|
-
.command('end <id>')
|
|
173
|
-
.description('End an experiment')
|
|
174
|
-
.action(withErrorHandler(globalOpts, async (id) => {
|
|
175
|
-
const opts = globalOpts();
|
|
176
|
-
const client = await createClient(opts);
|
|
177
|
-
const data = await client.request(EndExperimentDocument, {
|
|
178
|
-
experimentId: id,
|
|
179
|
-
});
|
|
180
|
-
formatOutput(data.endExperiment, opts);
|
|
181
|
-
if (!(opts.json || opts.jsonl || opts.quiet))
|
|
182
|
-
success('Experiment ended');
|
|
183
|
-
}));
|
|
184
|
-
// stats
|
|
185
|
-
experiments
|
|
186
|
-
.command('stats <id>')
|
|
187
|
-
.description('Get experiment statistics')
|
|
188
|
-
.action(withErrorHandler(globalOpts, async (id) => {
|
|
189
|
-
const opts = globalOpts();
|
|
190
|
-
const client = await createClient(opts);
|
|
191
|
-
const data = await client.request(ExperimentStatsDocument, {
|
|
192
|
-
experimentId: id,
|
|
193
|
-
});
|
|
194
|
-
formatOutput(data.experimentStats, opts);
|
|
195
|
-
}));
|
|
196
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/commands/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAetD,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAoQN"}
|