faces-cli 1.5.4 → 1.5.6
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/auth/register.d.ts +1 -0
- package/dist/commands/auth/register.js +44 -5
- package/dist/commands/compile/doc/pause.d.ts +13 -0
- package/dist/commands/compile/doc/pause.js +29 -0
- package/dist/commands/compile/doc/reset.d.ts +14 -0
- package/dist/commands/compile/doc/reset.js +30 -0
- package/dist/commands/compile/thread/pause.d.ts +13 -0
- package/dist/commands/compile/thread/pause.js +29 -0
- package/dist/commands/compile/thread/reset.d.ts +14 -0
- package/dist/commands/compile/thread/reset.js +30 -0
- package/oclif.manifest.json +761 -497
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export default class AuthRegister extends BaseCommand {
|
|
|
7
7
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
username: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
'invite-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
plan: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
'api-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import { BaseCommand } from '../../base.js';
|
|
3
|
-
import { FacesAPIError } from '../../client.js';
|
|
3
|
+
import { FacesAPIError, FacesClient } from '../../client.js';
|
|
4
4
|
import { saveConfig, resolveBaseUrl } from '../../config.js';
|
|
5
5
|
export default class AuthRegister extends BaseCommand {
|
|
6
6
|
static description = 'Create a new Faces account';
|
|
@@ -11,11 +11,15 @@ export default class AuthRegister extends BaseCommand {
|
|
|
11
11
|
name: Flags.string({ description: 'Display name (defaults to username)' }),
|
|
12
12
|
username: Flags.string({ description: 'Username (lowercase, dashes, numbers)', required: true }),
|
|
13
13
|
'invite-key': Flags.string({ description: 'Invite key (if required)' }),
|
|
14
|
+
plan: Flags.string({
|
|
15
|
+
description: 'Plan to subscribe to: "free" ($5 activation) or "connect" ($17/mo, no activation fee)',
|
|
16
|
+
options: ['free', 'connect'],
|
|
17
|
+
default: 'free',
|
|
18
|
+
}),
|
|
14
19
|
};
|
|
15
20
|
async run() {
|
|
16
21
|
const { flags } = await this.parse(AuthRegister);
|
|
17
22
|
const baseUrl = resolveBaseUrl(flags['base-url']);
|
|
18
|
-
const { FacesClient } = await import('../../client.js');
|
|
19
23
|
const client = new FacesClient(baseUrl);
|
|
20
24
|
const payload = {
|
|
21
25
|
email: flags.email,
|
|
@@ -44,10 +48,45 @@ export default class AuthRegister extends BaseCommand {
|
|
|
44
48
|
const result = {
|
|
45
49
|
status: 'registered',
|
|
46
50
|
user_id: inner.user_id,
|
|
47
|
-
activation_required: inner.activation_required ?? false,
|
|
48
51
|
};
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
// Get the appropriate checkout URL based on plan
|
|
53
|
+
if (token) {
|
|
54
|
+
const authedClient = new FacesClient(baseUrl, token);
|
|
55
|
+
if (flags.plan === 'connect') {
|
|
56
|
+
// Connect plan: $17/mo subscription, no $5 activation needed
|
|
57
|
+
try {
|
|
58
|
+
const checkoutResp = await authedClient.post(`/v1/billing/checkout?plan=connect`);
|
|
59
|
+
result.checkout_url = checkoutResp.checkout_url;
|
|
60
|
+
result.plan = 'connect';
|
|
61
|
+
result.amount = '$17/mo';
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
if (err instanceof FacesAPIError) {
|
|
65
|
+
result.checkout_error = `Failed to get Connect checkout URL: ${err.message}`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// Free plan: $5 activation
|
|
71
|
+
if (inner.activation_checkout_url) {
|
|
72
|
+
result.checkout_url = inner.activation_checkout_url;
|
|
73
|
+
result.plan = 'free';
|
|
74
|
+
result.amount = '$5 (added as API credits)';
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
try {
|
|
78
|
+
const activate = await authedClient.post('/v1/billing/activate');
|
|
79
|
+
result.checkout_url = activate.checkout_url;
|
|
80
|
+
result.plan = 'free';
|
|
81
|
+
result.amount = '$5 (added as API credits)';
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
if (err instanceof FacesAPIError) {
|
|
85
|
+
result.checkout_error = `Failed to get activation URL: ${err.message}`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
51
90
|
}
|
|
52
91
|
if (!this.jsonEnabled())
|
|
53
92
|
this.printHuman(result);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base.js';
|
|
2
|
+
export default class CompileDocPause 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,29 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../../base.js';
|
|
3
|
+
import { FacesAPIError } from '../../../client.js';
|
|
4
|
+
export default class CompileDocPause extends BaseCommand {
|
|
5
|
+
static description = 'Pause a running document compilation (preserves progress, resume with make)';
|
|
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(CompileDocPause);
|
|
14
|
+
const client = this.makeClient(flags);
|
|
15
|
+
let data;
|
|
16
|
+
try {
|
|
17
|
+
data = await client.post(`/v1/compile/documents/${args.doc_id}/pause`);
|
|
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.log(`Paused. Resume with: faces compile:doc:make ${args.doc_id}`);
|
|
26
|
+
}
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base.js';
|
|
2
|
+
export default class CompileDocReset 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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../../base.js';
|
|
3
|
+
import { FacesAPIError } from '../../../client.js';
|
|
4
|
+
export default class CompileDocReset extends BaseCommand {
|
|
5
|
+
static description = 'Reset document compilation progress (wipe extraction, keep content)';
|
|
6
|
+
static flags = {
|
|
7
|
+
...BaseCommand.baseFlags,
|
|
8
|
+
yes: Flags.boolean({ description: 'Skip confirmation', default: false }),
|
|
9
|
+
};
|
|
10
|
+
static args = {
|
|
11
|
+
doc_id: Args.string({ description: 'Document ID', required: true }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(CompileDocReset);
|
|
15
|
+
const client = this.makeClient(flags);
|
|
16
|
+
let data;
|
|
17
|
+
try {
|
|
18
|
+
data = await client.post(`/v1/compile/documents/${args.doc_id}/reset`);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (err instanceof FacesAPIError)
|
|
22
|
+
this.error(`Error (${err.statusCode}): ${err.message}`);
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
if (!this.jsonEnabled()) {
|
|
26
|
+
this.log(`Reset. Recompile with: faces compile:doc:make ${args.doc_id}`);
|
|
27
|
+
}
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base.js';
|
|
2
|
+
export default class CompileThreadPause 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,29 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../../base.js';
|
|
3
|
+
import { FacesAPIError } from '../../../client.js';
|
|
4
|
+
export default class CompileThreadPause extends BaseCommand {
|
|
5
|
+
static description = 'Pause a running thread compilation (preserves progress, resume with make)';
|
|
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(CompileThreadPause);
|
|
14
|
+
const client = this.makeClient(flags);
|
|
15
|
+
let data;
|
|
16
|
+
try {
|
|
17
|
+
data = await client.post(`/v1/compile/threads/${args.thread_id}/pause`);
|
|
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.log(`Paused. Resume with: faces compile:thread:make ${args.thread_id}`);
|
|
26
|
+
}
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base.js';
|
|
2
|
+
export default class CompileThreadReset 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
|
+
thread_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<unknown>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../../base.js';
|
|
3
|
+
import { FacesAPIError } from '../../../client.js';
|
|
4
|
+
export default class CompileThreadReset extends BaseCommand {
|
|
5
|
+
static description = 'Reset thread compilation progress (wipe extraction, keep source messages)';
|
|
6
|
+
static flags = {
|
|
7
|
+
...BaseCommand.baseFlags,
|
|
8
|
+
yes: Flags.boolean({ description: 'Skip confirmation', default: false }),
|
|
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(CompileThreadReset);
|
|
15
|
+
const client = this.makeClient(flags);
|
|
16
|
+
let data;
|
|
17
|
+
try {
|
|
18
|
+
data = await client.post(`/v1/compile/threads/${args.thread_id}/reset`);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (err instanceof FacesAPIError)
|
|
22
|
+
this.error(`Error (${err.statusCode}): ${err.message}`);
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
if (!this.jsonEnabled()) {
|
|
26
|
+
this.log(`Reset. Recompile with: faces compile:thread:make ${args.thread_id}`);
|
|
27
|
+
}
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
}
|