faces-cli 1.1.0 → 1.2.1
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/commands/face/create.d.ts +1 -0
- package/dist/commands/face/create.js +19 -10
- package/dist/commands/face/get.js +26 -2
- package/dist/commands/face/list.js +14 -2
- package/dist/commands/face/update.d.ts +1 -0
- package/dist/commands/face/update.js +3 -0
- package/oclif.manifest.json +426 -412
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ export default class FaceCreate extends BaseCommand {
|
|
|
4
4
|
static flags: {
|
|
5
5
|
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
6
|
username: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
formula: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
attr: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
tool: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -7,6 +7,7 @@ export default class FaceCreate extends BaseCommand {
|
|
|
7
7
|
...BaseCommand.baseFlags,
|
|
8
8
|
name: Flags.string({ description: 'Display name', required: true }),
|
|
9
9
|
username: Flags.string({ description: 'Unique username slug', required: true }),
|
|
10
|
+
formula: Flags.string({ description: 'Boolean formula over owned concrete face usernames (e.g. "a | b", "(a | b) - c"). Creates a composite face.' }),
|
|
10
11
|
attr: Flags.string({ description: 'Attribute KEY=VALUE (repeatable)', multiple: true }),
|
|
11
12
|
tool: Flags.string({ description: 'Tool name to enable (repeatable)', multiple: true }),
|
|
12
13
|
};
|
|
@@ -14,18 +15,26 @@ export default class FaceCreate extends BaseCommand {
|
|
|
14
15
|
async run() {
|
|
15
16
|
const { flags } = await this.parse(FaceCreate);
|
|
16
17
|
const client = this.makeClient(flags);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (!a.includes('='))
|
|
20
|
-
this.error(`Attributes must be KEY=VALUE, got: ${a}`);
|
|
21
|
-
const idx = a.indexOf('=');
|
|
22
|
-
parsedAttrs[a.slice(0, idx).trim()] = a.slice(idx + 1).trim();
|
|
18
|
+
if (flags.formula && (flags.attr?.length || flags.tool?.length)) {
|
|
19
|
+
this.error('--formula cannot be combined with --attr or --tool. Composite faces do not have compiled knowledge.');
|
|
23
20
|
}
|
|
24
21
|
const payload = { name: flags.name, username: flags.username };
|
|
25
|
-
if (
|
|
26
|
-
payload.
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
if (flags.formula) {
|
|
23
|
+
payload.formula = flags.formula;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const parsedAttrs = {};
|
|
27
|
+
for (const a of flags.attr ?? []) {
|
|
28
|
+
if (!a.includes('='))
|
|
29
|
+
this.error(`Attributes must be KEY=VALUE, got: ${a}`);
|
|
30
|
+
const idx = a.indexOf('=');
|
|
31
|
+
parsedAttrs[a.slice(0, idx).trim()] = a.slice(idx + 1).trim();
|
|
32
|
+
}
|
|
33
|
+
if (Object.keys(parsedAttrs).length > 0)
|
|
34
|
+
payload.facts = parsedAttrs;
|
|
35
|
+
if (flags.tool && flags.tool.length > 0)
|
|
36
|
+
payload.tools = flags.tool;
|
|
37
|
+
}
|
|
29
38
|
let data;
|
|
30
39
|
try {
|
|
31
40
|
data = await client.post('/v1/faces', { body: payload });
|
|
@@ -21,8 +21,32 @@ export default class FaceGet extends BaseCommand {
|
|
|
21
21
|
this.error(`Error (${err.statusCode}): ${err.message}`);
|
|
22
22
|
throw err;
|
|
23
23
|
}
|
|
24
|
-
if (!this.jsonEnabled())
|
|
25
|
-
|
|
24
|
+
if (!this.jsonEnabled()) {
|
|
25
|
+
const f = data;
|
|
26
|
+
this.log(`id: ${f.id}`);
|
|
27
|
+
this.log(`uid: ${f.uid}`);
|
|
28
|
+
this.log(`name: ${f.name}`);
|
|
29
|
+
this.log(`owned_by: ${f.owned_by}`);
|
|
30
|
+
this.log(`created: ${new Date(f.created * 1000).toISOString().slice(0, 10)}`);
|
|
31
|
+
if (f.formula) {
|
|
32
|
+
this.log(`formula: ${f.formula}`);
|
|
33
|
+
this.log(`type: composite`);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.log(`type: concrete`);
|
|
37
|
+
if (f.basic_facts && Object.keys(f.basic_facts).length > 0) {
|
|
38
|
+
this.log('basic_facts:');
|
|
39
|
+
for (const [k, v] of Object.entries(f.basic_facts)) {
|
|
40
|
+
const display = typeof v === 'object' ? JSON.stringify(v) : v;
|
|
41
|
+
this.log(` ${k}: ${display}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (f.default_tools && f.default_tools.length > 0)
|
|
45
|
+
this.log(`default_tools: ${f.default_tools.join(', ')}`);
|
|
46
|
+
if (f.default_model)
|
|
47
|
+
this.log(`default_model: ${f.default_model}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
26
50
|
return data;
|
|
27
51
|
}
|
|
28
52
|
}
|
|
@@ -17,8 +17,20 @@ export default class FaceList extends BaseCommand {
|
|
|
17
17
|
this.error(`Error (${err.statusCode}): ${err.message}`);
|
|
18
18
|
throw err;
|
|
19
19
|
}
|
|
20
|
-
if (!this.jsonEnabled())
|
|
21
|
-
|
|
20
|
+
if (!this.jsonEnabled()) {
|
|
21
|
+
const faces = (data.data) ?? data;
|
|
22
|
+
if (faces.length === 0) {
|
|
23
|
+
this.log('(no faces)');
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const idWidth = Math.max(...faces.map(f => f.id.length));
|
|
27
|
+
const nameWidth = Math.max(...faces.map(f => f.name.length));
|
|
28
|
+
for (const f of faces) {
|
|
29
|
+
const synthetic = f.formula ? ` [composite: ${f.formula}]` : '';
|
|
30
|
+
this.log(`${f.id.padEnd(idWidth)} ${f.name.padEnd(nameWidth)}${synthetic}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
22
34
|
return data;
|
|
23
35
|
}
|
|
24
36
|
}
|
|
@@ -3,6 +3,7 @@ export default class FaceUpdate extends BaseCommand {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
5
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
formula: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
7
|
attr: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
tool: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -6,6 +6,7 @@ export default class FaceUpdate extends BaseCommand {
|
|
|
6
6
|
static flags = {
|
|
7
7
|
...BaseCommand.baseFlags,
|
|
8
8
|
name: Flags.string({ description: 'New display name' }),
|
|
9
|
+
formula: Flags.string({ description: 'New boolean formula (synthetic faces only)' }),
|
|
9
10
|
attr: Flags.string({ description: 'Update attribute KEY=VALUE (repeatable)', multiple: true }),
|
|
10
11
|
tool: Flags.string({ description: 'Tool names to set (replaces list, repeatable)', multiple: true }),
|
|
11
12
|
};
|
|
@@ -18,6 +19,8 @@ export default class FaceUpdate extends BaseCommand {
|
|
|
18
19
|
const payload = {};
|
|
19
20
|
if (flags.name)
|
|
20
21
|
payload.name = flags.name;
|
|
22
|
+
if (flags.formula)
|
|
23
|
+
payload.formula = flags.formula;
|
|
21
24
|
if (flags.attr && flags.attr.length > 0) {
|
|
22
25
|
const parsed = {};
|
|
23
26
|
for (const a of flags.attr) {
|