faces-cli 1.0.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.
Files changed (94) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -0
  3. package/bin/dev.js +5 -0
  4. package/bin/run.js +5 -0
  5. package/dist/base.d.ts +16 -0
  6. package/dist/base.js +53 -0
  7. package/dist/client.d.ts +36 -0
  8. package/dist/client.js +191 -0
  9. package/dist/commands/account/state.d.ts +10 -0
  10. package/dist/commands/account/state.js +24 -0
  11. package/dist/commands/auth/login.d.ts +12 -0
  12. package/dist/commands/auth/login.js +40 -0
  13. package/dist/commands/auth/logout.d.ts +10 -0
  14. package/dist/commands/auth/logout.js +14 -0
  15. package/dist/commands/auth/refresh.d.ts +10 -0
  16. package/dist/commands/auth/refresh.js +30 -0
  17. package/dist/commands/auth/register.d.ts +15 -0
  18. package/dist/commands/auth/register.js +45 -0
  19. package/dist/commands/auth/whoami.d.ts +10 -0
  20. package/dist/commands/auth/whoami.js +24 -0
  21. package/dist/commands/billing/balance.d.ts +10 -0
  22. package/dist/commands/billing/balance.js +24 -0
  23. package/dist/commands/billing/card-setup.d.ts +10 -0
  24. package/dist/commands/billing/card-setup.js +24 -0
  25. package/dist/commands/billing/checkout.d.ts +11 -0
  26. package/dist/commands/billing/checkout.js +30 -0
  27. package/dist/commands/billing/llm-costs.d.ts +11 -0
  28. package/dist/commands/billing/llm-costs.js +29 -0
  29. package/dist/commands/billing/quota.d.ts +10 -0
  30. package/dist/commands/billing/quota.js +24 -0
  31. package/dist/commands/billing/subscription.d.ts +10 -0
  32. package/dist/commands/billing/subscription.js +24 -0
  33. package/dist/commands/billing/topup.d.ts +12 -0
  34. package/dist/commands/billing/topup.js +33 -0
  35. package/dist/commands/billing/usage.d.ts +13 -0
  36. package/dist/commands/billing/usage.js +38 -0
  37. package/dist/commands/chat/chat.d.ts +20 -0
  38. package/dist/commands/chat/chat.js +81 -0
  39. package/dist/commands/chat/messages.d.ts +17 -0
  40. package/dist/commands/chat/messages.js +68 -0
  41. package/dist/commands/chat/responses.d.ts +16 -0
  42. package/dist/commands/chat/responses.js +67 -0
  43. package/dist/commands/compile/doc/create.d.ts +16 -0
  44. package/dist/commands/compile/doc/create.js +43 -0
  45. package/dist/commands/compile/doc/delete.d.ts +13 -0
  46. package/dist/commands/compile/doc/delete.js +28 -0
  47. package/dist/commands/compile/doc/get.d.ts +13 -0
  48. package/dist/commands/compile/doc/get.js +28 -0
  49. package/dist/commands/compile/doc/list.d.ts +13 -0
  50. package/dist/commands/compile/doc/list.js +28 -0
  51. package/dist/commands/compile/doc/prepare.d.ts +13 -0
  52. package/dist/commands/compile/doc/prepare.js +28 -0
  53. package/dist/commands/compile/doc/sync.d.ts +15 -0
  54. package/dist/commands/compile/doc/sync.js +44 -0
  55. package/dist/commands/compile/thread/create.d.ts +14 -0
  56. package/dist/commands/compile/thread/create.js +32 -0
  57. package/dist/commands/compile/thread/list.d.ts +13 -0
  58. package/dist/commands/compile/thread/list.js +28 -0
  59. package/dist/commands/compile/thread/message.d.ts +14 -0
  60. package/dist/commands/compile/thread/message.js +31 -0
  61. package/dist/commands/compile/thread/sync.d.ts +13 -0
  62. package/dist/commands/compile/thread/sync.js +28 -0
  63. package/dist/commands/config/clear.d.ts +12 -0
  64. package/dist/commands/config/clear.js +31 -0
  65. package/dist/commands/config/set.d.ts +14 -0
  66. package/dist/commands/config/set.js +19 -0
  67. package/dist/commands/config/show.d.ts +10 -0
  68. package/dist/commands/config/show.js +19 -0
  69. package/dist/commands/face/create.d.ts +15 -0
  70. package/dist/commands/face/create.js +42 -0
  71. package/dist/commands/face/delete.d.ts +15 -0
  72. package/dist/commands/face/delete.js +44 -0
  73. package/dist/commands/face/get.d.ts +13 -0
  74. package/dist/commands/face/get.js +28 -0
  75. package/dist/commands/face/list.d.ts +10 -0
  76. package/dist/commands/face/list.js +24 -0
  77. package/dist/commands/face/stats.d.ts +10 -0
  78. package/dist/commands/face/stats.js +24 -0
  79. package/dist/commands/face/update.d.ts +16 -0
  80. package/dist/commands/face/update.js +48 -0
  81. package/dist/commands/face/upload.d.ts +15 -0
  82. package/dist/commands/face/upload.js +43 -0
  83. package/dist/commands/keys/create.d.ts +15 -0
  84. package/dist/commands/keys/create.js +39 -0
  85. package/dist/commands/keys/list.d.ts +10 -0
  86. package/dist/commands/keys/list.js +24 -0
  87. package/dist/commands/keys/revoke.d.ts +15 -0
  88. package/dist/commands/keys/revoke.js +44 -0
  89. package/dist/commands/keys/update.d.ts +16 -0
  90. package/dist/commands/keys/update.js +40 -0
  91. package/dist/config.d.ts +16 -0
  92. package/dist/config.js +65 -0
  93. package/oclif.manifest.json +2719 -0
  94. package/package.json +55 -0
@@ -0,0 +1,43 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import fs from 'node:fs';
3
+ import { BaseCommand } from '../../../base.js';
4
+ import { FacesAPIError } from '../../../client.js';
5
+ export default class CompileDocCreate extends BaseCommand {
6
+ static description = 'Submit a document to a face';
7
+ static flags = {
8
+ ...BaseCommand.baseFlags,
9
+ label: Flags.string({ description: 'Document label/title' }),
10
+ content: Flags.string({ description: 'Inline text content' }),
11
+ file: Flags.string({ description: 'Read content from file' }),
12
+ };
13
+ static args = {
14
+ face_id: Args.string({ description: 'Face ID or username', required: true }),
15
+ };
16
+ async run() {
17
+ const { args, flags } = await this.parse(CompileDocCreate);
18
+ const client = this.makeClient(flags);
19
+ let content = flags.content;
20
+ if (flags.file) {
21
+ if (!fs.existsSync(flags.file))
22
+ this.error(`File not found: ${flags.file}`);
23
+ content = fs.readFileSync(flags.file, 'utf8');
24
+ }
25
+ if (!content)
26
+ this.error('Provide --content or --file.');
27
+ const payload = { content };
28
+ if (flags.label)
29
+ payload.label = flags.label;
30
+ let data;
31
+ try {
32
+ data = await client.post(`/v1/faces/${args.face_id}/compile/documents`, { body: payload });
33
+ }
34
+ catch (err) {
35
+ if (err instanceof FacesAPIError)
36
+ this.error(`Error (${err.statusCode}): ${err.message}`);
37
+ throw err;
38
+ }
39
+ if (!this.jsonEnabled())
40
+ this.printHuman(data);
41
+ return data;
42
+ }
43
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class CompileDocDelete extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: 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
+ };
9
+ static args: {
10
+ doc_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<unknown>;
13
+ }
@@ -0,0 +1,28 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ export default class CompileDocDelete extends BaseCommand {
5
+ static description = 'Delete a document';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ };
9
+ static args = {
10
+ doc_id: Args.string({ description: 'Document ID', required: true }),
11
+ };
12
+ async run() {
13
+ const { args, flags } = await this.parse(CompileDocDelete);
14
+ const client = this.makeClient(flags);
15
+ let data;
16
+ try {
17
+ data = await client.delete(`/v1/compile/documents/${args.doc_id}`);
18
+ }
19
+ catch (err) {
20
+ if (err instanceof FacesAPIError)
21
+ this.error(`Error (${err.statusCode}): ${err.message}`);
22
+ throw err;
23
+ }
24
+ if (!this.jsonEnabled())
25
+ this.printHuman(data);
26
+ return data;
27
+ }
28
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class CompileDocGet extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: 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
+ };
9
+ static args: {
10
+ doc_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<unknown>;
13
+ }
@@ -0,0 +1,28 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ export default class CompileDocGet extends BaseCommand {
5
+ static description = 'Get a document by ID';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ };
9
+ static args = {
10
+ doc_id: Args.string({ description: 'Document ID', required: true }),
11
+ };
12
+ async run() {
13
+ const { args, flags } = await this.parse(CompileDocGet);
14
+ const client = this.makeClient(flags);
15
+ let data;
16
+ try {
17
+ data = await client.get(`/v1/compile/documents/${args.doc_id}`);
18
+ }
19
+ catch (err) {
20
+ if (err instanceof FacesAPIError)
21
+ this.error(`Error (${err.statusCode}): ${err.message}`);
22
+ throw err;
23
+ }
24
+ if (!this.jsonEnabled())
25
+ this.printHuman(data);
26
+ return data;
27
+ }
28
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class CompileDocList extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: 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
+ };
9
+ static args: {
10
+ face_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<unknown>;
13
+ }
@@ -0,0 +1,28 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ export default class CompileDocList extends BaseCommand {
5
+ static description = 'List documents for a face';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ };
9
+ static args = {
10
+ face_id: Args.string({ description: 'Face ID or username', required: true }),
11
+ };
12
+ async run() {
13
+ const { args, flags } = await this.parse(CompileDocList);
14
+ const client = this.makeClient(flags);
15
+ let data;
16
+ try {
17
+ data = await client.get(`/v1/faces/${args.face_id}/compile/documents`);
18
+ }
19
+ catch (err) {
20
+ if (err instanceof FacesAPIError)
21
+ this.error(`Error (${err.statusCode}): ${err.message}`);
22
+ throw err;
23
+ }
24
+ if (!this.jsonEnabled())
25
+ this.printHuman(data);
26
+ return data;
27
+ }
28
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class CompileDocPrepare extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: 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
+ };
9
+ static args: {
10
+ doc_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<unknown>;
13
+ }
@@ -0,0 +1,28 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ export default class CompileDocPrepare extends BaseCommand {
5
+ static description = 'Run LLM extraction pipeline on a document';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ };
9
+ static args = {
10
+ doc_id: Args.string({ description: 'Document ID', required: true }),
11
+ };
12
+ async run() {
13
+ const { args, flags } = await this.parse(CompileDocPrepare);
14
+ const client = this.makeClient(flags);
15
+ let data;
16
+ try {
17
+ data = await client.post(`/v1/compile/documents/${args.doc_id}/prepare`);
18
+ }
19
+ catch (err) {
20
+ if (err instanceof FacesAPIError)
21
+ this.error(`Error (${err.statusCode}): ${err.message}`);
22
+ throw err;
23
+ }
24
+ if (!this.jsonEnabled())
25
+ this.printHuman(data);
26
+ return data;
27
+ }
28
+ }
@@ -0,0 +1,15 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class CompileDocSync extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
6
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ };
10
+ static args: {
11
+ doc_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ };
13
+ run(): Promise<unknown>;
14
+ private confirm;
15
+ }
@@ -0,0 +1,44 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ import { createInterface } from 'node:readline';
5
+ export default class CompileDocSync extends BaseCommand {
6
+ static description = 'Sync a document into a face (charges compile quota)';
7
+ static flags = {
8
+ ...BaseCommand.baseFlags,
9
+ yes: Flags.boolean({ description: 'Skip confirmation (quota will be charged)', default: false }),
10
+ };
11
+ static args = {
12
+ doc_id: Args.string({ description: 'Document ID', required: true }),
13
+ };
14
+ async run() {
15
+ const { args, flags } = await this.parse(CompileDocSync);
16
+ const client = this.makeClient(flags);
17
+ if (!flags.yes) {
18
+ const confirmed = await this.confirm('Syncing into a face charges compile quota. Continue?');
19
+ if (!confirmed)
20
+ this.error('Aborted.');
21
+ }
22
+ let data;
23
+ try {
24
+ data = await client.post(`/v1/compile/documents/${args.doc_id}/sync`);
25
+ }
26
+ catch (err) {
27
+ if (err instanceof FacesAPIError)
28
+ this.error(`Error (${err.statusCode}): ${err.message}`);
29
+ throw err;
30
+ }
31
+ if (!this.jsonEnabled())
32
+ this.printHuman(data);
33
+ return data;
34
+ }
35
+ confirm(message) {
36
+ return new Promise((resolve) => {
37
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
38
+ rl.question(`${message} [y/N] `, (answer) => {
39
+ rl.close();
40
+ resolve(answer.toLowerCase() === 'y');
41
+ });
42
+ });
43
+ }
44
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class CompileThreadCreate extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ label: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ };
10
+ static args: {
11
+ face_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ };
13
+ run(): Promise<unknown>;
14
+ }
@@ -0,0 +1,32 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ export default class CompileThreadCreate extends BaseCommand {
5
+ static description = 'Start a new thread for a face';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ label: Flags.string({ description: 'Thread label' }),
9
+ };
10
+ static args = {
11
+ face_id: Args.string({ description: 'Face ID or username', required: true }),
12
+ };
13
+ async run() {
14
+ const { args, flags } = await this.parse(CompileThreadCreate);
15
+ const client = this.makeClient(flags);
16
+ const payload = {};
17
+ if (flags.label)
18
+ payload.label = flags.label;
19
+ let data;
20
+ try {
21
+ data = await client.post(`/v1/faces/${args.face_id}/compile/threads`, { body: payload });
22
+ }
23
+ catch (err) {
24
+ if (err instanceof FacesAPIError)
25
+ this.error(`Error (${err.statusCode}): ${err.message}`);
26
+ throw err;
27
+ }
28
+ if (!this.jsonEnabled())
29
+ this.printHuman(data);
30
+ return data;
31
+ }
32
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class CompileThreadList extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: 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
+ };
9
+ static args: {
10
+ face_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<unknown>;
13
+ }
@@ -0,0 +1,28 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ export default class CompileThreadList extends BaseCommand {
5
+ static description = 'List threads for a face';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ };
9
+ static args = {
10
+ face_id: Args.string({ description: 'Face ID or username', required: true }),
11
+ };
12
+ async run() {
13
+ const { args, flags } = await this.parse(CompileThreadList);
14
+ const client = this.makeClient(flags);
15
+ let data;
16
+ try {
17
+ data = await client.get(`/v1/faces/${args.face_id}/compile/threads`);
18
+ }
19
+ catch (err) {
20
+ if (err instanceof FacesAPIError)
21
+ this.error(`Error (${err.statusCode}): ${err.message}`);
22
+ throw err;
23
+ }
24
+ if (!this.jsonEnabled())
25
+ this.printHuman(data);
26
+ return data;
27
+ }
28
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class CompileThreadMessage extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ message: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
6
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ };
10
+ static args: {
11
+ thread_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ };
13
+ run(): Promise<unknown>;
14
+ }
@@ -0,0 +1,31 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ export default class CompileThreadMessage extends BaseCommand {
5
+ static description = 'Send a user message to a thread';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ message: Flags.string({ char: 'm', description: 'User message to append', required: true }),
9
+ };
10
+ static args = {
11
+ thread_id: Args.string({ description: 'Thread ID', required: true }),
12
+ };
13
+ async run() {
14
+ const { args, flags } = await this.parse(CompileThreadMessage);
15
+ const client = this.makeClient(flags);
16
+ let data;
17
+ try {
18
+ data = await client.post(`/v1/compile/threads/${args.thread_id}/messages`, {
19
+ body: { role: 'user', content: flags.message },
20
+ });
21
+ }
22
+ catch (err) {
23
+ if (err instanceof FacesAPIError)
24
+ this.error(`Error (${err.statusCode}): ${err.message}`);
25
+ throw err;
26
+ }
27
+ if (!this.jsonEnabled())
28
+ this.printHuman(data);
29
+ return data;
30
+ }
31
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../../base.js';
2
+ export default class CompileThreadSync extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: 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
+ };
9
+ static args: {
10
+ thread_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
11
+ };
12
+ run(): Promise<unknown>;
13
+ }
@@ -0,0 +1,28 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand } from '../../../base.js';
3
+ import { FacesAPIError } from '../../../client.js';
4
+ export default class CompileThreadSync extends BaseCommand {
5
+ static description = 'Archive and sync a thread into a face';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ };
9
+ static args = {
10
+ thread_id: Args.string({ description: 'Thread ID', required: true }),
11
+ };
12
+ async run() {
13
+ const { args, flags } = await this.parse(CompileThreadSync);
14
+ const client = this.makeClient(flags);
15
+ let data;
16
+ try {
17
+ data = await client.post(`/v1/compile/threads/${args.thread_id}/sync`);
18
+ }
19
+ catch (err) {
20
+ if (err instanceof FacesAPIError)
21
+ this.error(`Error (${err.statusCode}): ${err.message}`);
22
+ throw err;
23
+ }
24
+ if (!this.jsonEnabled())
25
+ this.printHuman(data);
26
+ return data;
27
+ }
28
+ }
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class ConfigClear extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
6
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ };
10
+ run(): Promise<unknown>;
11
+ private confirm;
12
+ }
@@ -0,0 +1,31 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base.js';
3
+ import { clearConfig } from '../../config.js';
4
+ import { createInterface } from 'node:readline';
5
+ export default class ConfigClear extends BaseCommand {
6
+ static description = 'Delete all saved credentials and config';
7
+ static flags = {
8
+ ...BaseCommand.baseFlags,
9
+ yes: Flags.boolean({ description: 'Skip confirmation', default: false }),
10
+ };
11
+ async run() {
12
+ const { flags } = await this.parse(ConfigClear);
13
+ if (!flags.yes) {
14
+ const confirmed = await this.confirm('Delete all saved credentials?');
15
+ if (!confirmed)
16
+ this.error('Aborted.');
17
+ }
18
+ clearConfig();
19
+ this.log('Config cleared.');
20
+ return { status: 'cleared' };
21
+ }
22
+ confirm(message) {
23
+ return new Promise((resolve) => {
24
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
25
+ rl.question(`${message} [y/N] `, (answer) => {
26
+ rl.close();
27
+ resolve(answer.toLowerCase() === 'y');
28
+ });
29
+ });
30
+ }
31
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class ConfigSet extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: 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
+ };
9
+ static args: {
10
+ key: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
11
+ value: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ };
13
+ run(): Promise<unknown>;
14
+ }
@@ -0,0 +1,19 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand } from '../../base.js';
3
+ import { setConfigKey } from '../../config.js';
4
+ export default class ConfigSet extends BaseCommand {
5
+ static description = 'Set a config value (e.g. base_url, api_key, token)';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ };
9
+ static args = {
10
+ key: Args.string({ description: 'Config key', required: true }),
11
+ value: Args.string({ description: 'Config value', required: true }),
12
+ };
13
+ async run() {
14
+ const { args } = await this.parse(ConfigSet);
15
+ setConfigKey(args.key, args.value);
16
+ this.log(`Set ${args.key}.`);
17
+ return { key: args.key, status: 'set' };
18
+ }
19
+ }
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class ConfigShow extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ token: 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
+ };
9
+ run(): Promise<unknown>;
10
+ }
@@ -0,0 +1,19 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ import { maskedConfig } from '../../config.js';
3
+ export default class ConfigShow extends BaseCommand {
4
+ static description = 'Print current config (credentials are masked)';
5
+ static flags = {
6
+ ...BaseCommand.baseFlags,
7
+ };
8
+ async run() {
9
+ await this.parse(ConfigShow);
10
+ const data = maskedConfig();
11
+ if (Object.keys(data).length === 0) {
12
+ this.log('No config found at ~/.faces/config.json');
13
+ return {};
14
+ }
15
+ if (!this.jsonEnabled())
16
+ this.log(JSON.stringify(data, null, 2));
17
+ return data;
18
+ }
19
+ }
@@ -0,0 +1,15 @@
1
+ import { BaseCommand } from '../../base.js';
2
+ export default class FaceCreate extends BaseCommand {
3
+ static description: string;
4
+ static flags: {
5
+ name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
6
+ username: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ attr: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ tool: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ 'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ };
13
+ static args: {};
14
+ run(): Promise<unknown>;
15
+ }
@@ -0,0 +1,42 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base.js';
3
+ import { FacesAPIError } from '../../client.js';
4
+ export default class FaceCreate extends BaseCommand {
5
+ static description = 'Create a new face';
6
+ static flags = {
7
+ ...BaseCommand.baseFlags,
8
+ name: Flags.string({ description: 'Display name', required: true }),
9
+ username: Flags.string({ description: 'Unique username slug', required: true }),
10
+ attr: Flags.string({ description: 'Attribute KEY=VALUE (repeatable)', multiple: true }),
11
+ tool: Flags.string({ description: 'Tool name to enable (repeatable)', multiple: true }),
12
+ };
13
+ static args = {};
14
+ async run() {
15
+ const { flags } = await this.parse(FaceCreate);
16
+ const client = this.makeClient(flags);
17
+ const parsedAttrs = {};
18
+ for (const a of flags.attr ?? []) {
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();
23
+ }
24
+ const payload = { name: flags.name, username: flags.username };
25
+ if (Object.keys(parsedAttrs).length > 0)
26
+ payload.facts = parsedAttrs;
27
+ if (flags.tool && flags.tool.length > 0)
28
+ payload.tools = flags.tool;
29
+ let data;
30
+ try {
31
+ data = await client.post('/v1/faces', { body: payload });
32
+ }
33
+ catch (err) {
34
+ if (err instanceof FacesAPIError)
35
+ this.error(`Error (${err.statusCode}): ${err.message}`);
36
+ throw err;
37
+ }
38
+ if (!this.jsonEnabled())
39
+ this.printHuman(data);
40
+ return data;
41
+ }
42
+ }