depicta 0.9.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/depicta.js +6 -0
- package/dist/client.d.ts +59 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +163 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/auth.d.ts +13 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +188 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/docs.d.ts +10 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +165 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/generate.d.ts +17 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +254 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/guidelines.d.ts +9 -0
- package/dist/commands/guidelines.d.ts.map +1 -0
- package/dist/commands/guidelines.js +58 -0
- package/dist/commands/guidelines.js.map +1 -0
- package/dist/commands/jobs.d.ts +9 -0
- package/dist/commands/jobs.d.ts.map +1 -0
- package/dist/commands/jobs.js +89 -0
- package/dist/commands/jobs.js.map +1 -0
- package/dist/commands/process.d.ts +16 -0
- package/dist/commands/process.d.ts.map +1 -0
- package/dist/commands/process.js +412 -0
- package/dist/commands/process.js.map +1 -0
- package/dist/commands/story.d.ts +18 -0
- package/dist/commands/story.d.ts.map +1 -0
- package/dist/commands/story.js +182 -0
- package/dist/commands/story.js.map +1 -0
- package/dist/commands/utility.d.ts +11 -0
- package/dist/commands/utility.d.ts.map +1 -0
- package/dist/commands/utility.js +118 -0
- package/dist/commands/utility.js.map +1 -0
- package/dist/config.d.ts +50 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +103 -0
- package/dist/config.js.map +1 -0
- package/dist/download.d.ts +38 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +98 -0
- package/dist/download.js.map +1 -0
- package/dist/errors.d.ts +41 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +62 -0
- package/dist/errors.js.map +1 -0
- package/dist/flags.d.ts +41 -0
- package/dist/flags.d.ts.map +1 -0
- package/dist/flags.js +40 -0
- package/dist/flags.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +44 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +125 -0
- package/dist/output.js.map +1 -0
- package/package.json +44 -0
package/bin/depicta.js
ADDED
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Depicta HTTP client — uses built-in fetch (Node 18+).
|
|
3
|
+
*
|
|
4
|
+
* All methods throw DepictaError on non-2xx responses.
|
|
5
|
+
* postJson returns a 3-tuple (body, status, headers) matching the Python
|
|
6
|
+
* reference so callers can read X-Depicta-Job-Id from headers.
|
|
7
|
+
*
|
|
8
|
+
* IMPORTANT: upload field name is "image" per contract.yaml spec.
|
|
9
|
+
*/
|
|
10
|
+
/** Response from postJson: [body, statusCode, headers]. */
|
|
11
|
+
export type PostJsonResult = [Record<string, unknown>, number, Record<string, string>];
|
|
12
|
+
/** Response from uploadFile. */
|
|
13
|
+
export interface UploadResult {
|
|
14
|
+
image_url: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* DepictaClient wraps the Depicta REST API with authentication.
|
|
18
|
+
* Uses Node 18+ global fetch. Timeout via AbortController.
|
|
19
|
+
*/
|
|
20
|
+
export declare class DepictaClient {
|
|
21
|
+
private readonly apiKey;
|
|
22
|
+
private readonly baseUrl;
|
|
23
|
+
private readonly timeoutMs;
|
|
24
|
+
constructor(apiKey: string, baseUrl: string, timeoutMs?: number);
|
|
25
|
+
/** Build Authorization header. */
|
|
26
|
+
private authHeaders;
|
|
27
|
+
/** Create an AbortController that times out after this.timeoutMs. */
|
|
28
|
+
private makeAbortController;
|
|
29
|
+
/**
|
|
30
|
+
* GET request. Returns parsed JSON body.
|
|
31
|
+
* Throws DepictaError on non-2xx status.
|
|
32
|
+
*/
|
|
33
|
+
get(path_: string): Promise<Record<string, unknown>>;
|
|
34
|
+
/**
|
|
35
|
+
* GET request with query parameters.
|
|
36
|
+
*/
|
|
37
|
+
getWithQuery(path_: string, params: Record<string, string>): Promise<Record<string, unknown>>;
|
|
38
|
+
/**
|
|
39
|
+
* POST JSON body. Returns [body, statusCode, headers].
|
|
40
|
+
* Headers map is lowercased. Throws DepictaError on non-2xx.
|
|
41
|
+
*/
|
|
42
|
+
postJson(path_: string, body: Record<string, unknown>): Promise<PostJsonResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Upload a local file via multipart/form-data.
|
|
45
|
+
* Field name MUST be "image" per contract.yaml spec.
|
|
46
|
+
* Returns the upload response with image_url.
|
|
47
|
+
*/
|
|
48
|
+
uploadFile(path_: string, filePath: string): Promise<UploadResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Download raw bytes from an absolute URL.
|
|
51
|
+
* Does not send auth headers — URLs are pre-signed.
|
|
52
|
+
*/
|
|
53
|
+
downloadBytes(url: string): Promise<Buffer>;
|
|
54
|
+
/** Parse API error response and throw DepictaError. */
|
|
55
|
+
private throwApiError;
|
|
56
|
+
/** Wrap a fetch network error as a DepictaError with exit code 1. */
|
|
57
|
+
private wrapNetworkError;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvF,gCAAgC;AAChC,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAE,MAAgB;IAMxE,kCAAkC;IAClC,OAAO,CAAC,WAAW;IAInB,qEAAqE;IACrE,OAAO,CAAC,mBAAmB;IAM3B;;;OAGG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAkB1D;;OAEG;IACG,YAAY,CAChB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAKnC;;;OAGG;IACG,QAAQ,CACZ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC;IA0B1B;;;;OAIG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IA6BxE;;;OAGG;IACG,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqBjD,uDAAuD;YACzC,aAAa;IAU3B,qEAAqE;IACrE,OAAO,CAAC,gBAAgB;CAIzB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Depicta HTTP client — uses built-in fetch (Node 18+).
|
|
3
|
+
*
|
|
4
|
+
* All methods throw DepictaError on non-2xx responses.
|
|
5
|
+
* postJson returns a 3-tuple (body, status, headers) matching the Python
|
|
6
|
+
* reference so callers can read X-Depicta-Job-Id from headers.
|
|
7
|
+
*
|
|
8
|
+
* IMPORTANT: upload field name is "image" per contract.yaml spec.
|
|
9
|
+
*/
|
|
10
|
+
import fs from 'fs';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import { DepictaError, errorFromResponse } from './errors.js';
|
|
13
|
+
/**
|
|
14
|
+
* DepictaClient wraps the Depicta REST API with authentication.
|
|
15
|
+
* Uses Node 18+ global fetch. Timeout via AbortController.
|
|
16
|
+
*/
|
|
17
|
+
export class DepictaClient {
|
|
18
|
+
apiKey;
|
|
19
|
+
baseUrl;
|
|
20
|
+
timeoutMs;
|
|
21
|
+
constructor(apiKey, baseUrl, timeoutMs = 120_000) {
|
|
22
|
+
this.apiKey = apiKey;
|
|
23
|
+
this.baseUrl = baseUrl.replace(/\/$/, '');
|
|
24
|
+
this.timeoutMs = timeoutMs;
|
|
25
|
+
}
|
|
26
|
+
/** Build Authorization header. */
|
|
27
|
+
authHeaders() {
|
|
28
|
+
return { Authorization: `Bearer ${this.apiKey}` };
|
|
29
|
+
}
|
|
30
|
+
/** Create an AbortController that times out after this.timeoutMs. */
|
|
31
|
+
makeAbortController() {
|
|
32
|
+
const ctrl = new AbortController();
|
|
33
|
+
setTimeout(() => ctrl.abort(), this.timeoutMs);
|
|
34
|
+
return ctrl;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* GET request. Returns parsed JSON body.
|
|
38
|
+
* Throws DepictaError on non-2xx status.
|
|
39
|
+
*/
|
|
40
|
+
async get(path_) {
|
|
41
|
+
const ctrl = this.makeAbortController();
|
|
42
|
+
let resp;
|
|
43
|
+
try {
|
|
44
|
+
resp = await fetch(this.baseUrl + path_, {
|
|
45
|
+
method: 'GET',
|
|
46
|
+
headers: this.authHeaders(),
|
|
47
|
+
signal: ctrl.signal,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
throw this.wrapNetworkError(err);
|
|
52
|
+
}
|
|
53
|
+
if (resp.status >= 400) {
|
|
54
|
+
await this.throwApiError(resp);
|
|
55
|
+
}
|
|
56
|
+
return (await resp.json());
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* GET request with query parameters.
|
|
60
|
+
*/
|
|
61
|
+
async getWithQuery(path_, params) {
|
|
62
|
+
const qs = new URLSearchParams(params).toString();
|
|
63
|
+
return this.get(`${path_}?${qs}`);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* POST JSON body. Returns [body, statusCode, headers].
|
|
67
|
+
* Headers map is lowercased. Throws DepictaError on non-2xx.
|
|
68
|
+
*/
|
|
69
|
+
async postJson(path_, body) {
|
|
70
|
+
const ctrl = this.makeAbortController();
|
|
71
|
+
let resp;
|
|
72
|
+
try {
|
|
73
|
+
resp = await fetch(this.baseUrl + path_, {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
headers: { ...this.authHeaders(), 'Content-Type': 'application/json' },
|
|
76
|
+
body: JSON.stringify(body),
|
|
77
|
+
signal: ctrl.signal,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
throw this.wrapNetworkError(err);
|
|
82
|
+
}
|
|
83
|
+
if (resp.status >= 400) {
|
|
84
|
+
await this.throwApiError(resp);
|
|
85
|
+
}
|
|
86
|
+
const responseBody = (await resp.json());
|
|
87
|
+
const statusCode = resp.status;
|
|
88
|
+
// Collect all response headers as a lowercased map.
|
|
89
|
+
const headers = {};
|
|
90
|
+
resp.headers.forEach((value, key) => {
|
|
91
|
+
headers[key.toLowerCase()] = value;
|
|
92
|
+
});
|
|
93
|
+
return [responseBody, statusCode, headers];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Upload a local file via multipart/form-data.
|
|
97
|
+
* Field name MUST be "image" per contract.yaml spec.
|
|
98
|
+
* Returns the upload response with image_url.
|
|
99
|
+
*/
|
|
100
|
+
async uploadFile(path_, filePath) {
|
|
101
|
+
const ctrl = new AbortController();
|
|
102
|
+
setTimeout(() => ctrl.abort(), 60_000);
|
|
103
|
+
const fileData = fs.readFileSync(filePath);
|
|
104
|
+
const filename = path.basename(filePath);
|
|
105
|
+
// Build multipart form data using FormData (available in Node 18+).
|
|
106
|
+
// CRITICAL: field name MUST be "image", not "file" — per contract.yaml upload.field_name.
|
|
107
|
+
const form = new FormData();
|
|
108
|
+
form.append('image', new Blob([fileData]), filename);
|
|
109
|
+
let resp;
|
|
110
|
+
try {
|
|
111
|
+
resp = await fetch(this.baseUrl + path_, {
|
|
112
|
+
method: 'POST',
|
|
113
|
+
headers: this.authHeaders(),
|
|
114
|
+
body: form,
|
|
115
|
+
signal: ctrl.signal,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
throw this.wrapNetworkError(err);
|
|
120
|
+
}
|
|
121
|
+
if (resp.status >= 400) {
|
|
122
|
+
await this.throwApiError(resp);
|
|
123
|
+
}
|
|
124
|
+
return (await resp.json());
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Download raw bytes from an absolute URL.
|
|
128
|
+
* Does not send auth headers — URLs are pre-signed.
|
|
129
|
+
*/
|
|
130
|
+
async downloadBytes(url) {
|
|
131
|
+
const ctrl = new AbortController();
|
|
132
|
+
setTimeout(() => ctrl.abort(), 60_000);
|
|
133
|
+
let resp;
|
|
134
|
+
try {
|
|
135
|
+
resp = await fetch(url, { signal: ctrl.signal });
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
throw this.wrapNetworkError(err);
|
|
139
|
+
}
|
|
140
|
+
if (!resp.ok) {
|
|
141
|
+
throw new DepictaError(`Download failed: ${resp.status} ${resp.statusText}`, 'general_error', 1);
|
|
142
|
+
}
|
|
143
|
+
const ab = await resp.arrayBuffer();
|
|
144
|
+
return Buffer.from(ab);
|
|
145
|
+
}
|
|
146
|
+
/** Parse API error response and throw DepictaError. */
|
|
147
|
+
async throwApiError(resp) {
|
|
148
|
+
let body;
|
|
149
|
+
try {
|
|
150
|
+
body = (await resp.json());
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
body = { error: 'general_error', message: await resp.text() };
|
|
154
|
+
}
|
|
155
|
+
throw errorFromResponse(resp.status, body);
|
|
156
|
+
}
|
|
157
|
+
/** Wrap a fetch network error as a DepictaError with exit code 1. */
|
|
158
|
+
wrapNetworkError(err) {
|
|
159
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
160
|
+
return new DepictaError(msg, 'general_error', 1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAU9D;;;GAGG;AACH,MAAM,OAAO,aAAa;IACP,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,SAAS,CAAS;IAEnC,YAAY,MAAc,EAAE,OAAe,EAAE,YAAoB,OAAO;QACtE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,kCAAkC;IAC1B,WAAW;QACjB,OAAO,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IACpD,CAAC;IAED,qEAAqE;IAC7D,mBAAmB;QACzB,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC;QACnC,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;Q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;QACJ,CAAC;QACD,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC;IAED,uDAAuD;IAC/C,KAAK,CAAC,aAAa,CAAC,IAAc;QACxC,IAAI,IAA6B,CAAC;QAClC,IAAI,CAAC;YACH,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAA4B,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAChE,CAAC;QACD,MAAM,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,qEAAqE;IAC7D,gBAAgB,CAAC,GAAY;QACnC,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,IAAI,YAAY,CAAC,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth commands: login, logout, status.
|
|
3
|
+
*
|
|
4
|
+
* login: prompt for API key, validate against /v1/account/profile, store in config.
|
|
5
|
+
* logout: remove api_key from config file.
|
|
6
|
+
* status: show auth method and masked key; optionally verify via API.
|
|
7
|
+
*
|
|
8
|
+
* Config file is written with 0600 permissions (contract requirement, tested in auth.bats).
|
|
9
|
+
*/
|
|
10
|
+
import { Command } from 'commander';
|
|
11
|
+
/** Register auth subcommands on the parent program. */
|
|
12
|
+
export declare function registerAuthCommands(program: Command): void;
|
|
13
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqEpC,uDAAuD;AACvD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0H3D"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth commands: login, logout, status.
|
|
3
|
+
*
|
|
4
|
+
* login: prompt for API key, validate against /v1/account/profile, store in config.
|
|
5
|
+
* logout: remove api_key from config file.
|
|
6
|
+
* status: show auth method and masked key; optionally verify via API.
|
|
7
|
+
*
|
|
8
|
+
* Config file is written with 0600 permissions (contract requirement, tested in auth.bats).
|
|
9
|
+
*/
|
|
10
|
+
import { Command } from 'commander';
|
|
11
|
+
import * as readline from 'readline';
|
|
12
|
+
import { DepictaClient } from '../client.js';
|
|
13
|
+
import { loadConfig, maskKey, resolveApiKey, resolveApiUrl, saveConfig, } from '../config.js';
|
|
14
|
+
import { DepictaError, EXIT_AUTH } from '../errors.js';
|
|
15
|
+
import { addGlobalFlags } from '../flags.js';
|
|
16
|
+
import { detectMode, printError } from '../output.js';
|
|
17
|
+
/** Prompt for a password-masked API key via readline. */
|
|
18
|
+
async function promptApiKey() {
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
const rl = readline.createInterface({
|
|
21
|
+
input: process.stdin,
|
|
22
|
+
output: process.stderr,
|
|
23
|
+
terminal: true,
|
|
24
|
+
});
|
|
25
|
+
// Write the prompt to stderr so it doesn't pollute stdout.
|
|
26
|
+
process.stderr.write('API key: ');
|
|
27
|
+
// Hide input if terminal supports it.
|
|
28
|
+
if (process.stdin.isTTY) {
|
|
29
|
+
process.stdin.setRawMode?.(true);
|
|
30
|
+
}
|
|
31
|
+
let key = '';
|
|
32
|
+
process.stdin.on('data', (chunk) => {
|
|
33
|
+
const char = chunk.toString('utf8');
|
|
34
|
+
if (char === '\n' || char === '\r') {
|
|
35
|
+
if (process.stdin.isTTY) {
|
|
36
|
+
process.stdin.setRawMode?.(false);
|
|
37
|
+
}
|
|
38
|
+
process.stderr.write('\n');
|
|
39
|
+
rl.close();
|
|
40
|
+
resolve(key);
|
|
41
|
+
}
|
|
42
|
+
else if (char === '\u0003') {
|
|
43
|
+
// Ctrl+C.
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
else if (char === '\u007f') {
|
|
47
|
+
// Backspace.
|
|
48
|
+
key = key.slice(0, -1);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
key += char;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** Read the API key: masked prompt if TTY, readline if piped (for tests). */
|
|
57
|
+
async function readApiKey() {
|
|
58
|
+
if (process.stdin.isTTY) {
|
|
59
|
+
return promptApiKey();
|
|
60
|
+
}
|
|
61
|
+
// Non-TTY (test): read one line from stdin.
|
|
62
|
+
return new Promise((resolve) => {
|
|
63
|
+
const rl = readline.createInterface({ input: process.stdin });
|
|
64
|
+
rl.once('line', (line) => {
|
|
65
|
+
rl.close();
|
|
66
|
+
resolve(line.trim());
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/** Register auth subcommands on the parent program. */
|
|
71
|
+
export function registerAuthCommands(program) {
|
|
72
|
+
const auth = new Command('auth')
|
|
73
|
+
.description('Manage authentication')
|
|
74
|
+
.addHelpCommand(false);
|
|
75
|
+
// --- auth login ---
|
|
76
|
+
const loginCmd = new Command('login').description('Configure API key');
|
|
77
|
+
addGlobalFlags(loginCmd);
|
|
78
|
+
loginCmd.action(async (opts) => {
|
|
79
|
+
const mode = detectMode({ forceJson: opts.json, forceHuman: opts.human });
|
|
80
|
+
process.stderr.write('Get your API key at https://depicta.ai/dashboard/api-keys\n');
|
|
81
|
+
const key = await readApiKey();
|
|
82
|
+
if (!key) {
|
|
83
|
+
const err = new DepictaError('No API key provided', 'authentication_error', EXIT_AUTH);
|
|
84
|
+
printError(err.toDict(), mode);
|
|
85
|
+
process.exit(EXIT_AUTH);
|
|
86
|
+
}
|
|
87
|
+
const url = resolveApiUrl(opts.apiUrl);
|
|
88
|
+
const client = new DepictaClient(key, url);
|
|
89
|
+
let profile;
|
|
90
|
+
try {
|
|
91
|
+
profile = await client.get('/v1/account/profile');
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
if (err instanceof DepictaError) {
|
|
95
|
+
printError(err.toDict(), mode);
|
|
96
|
+
process.exit(err.exitCode);
|
|
97
|
+
}
|
|
98
|
+
throw err;
|
|
99
|
+
}
|
|
100
|
+
// Extract email from nested user object.
|
|
101
|
+
const user = profile['user'];
|
|
102
|
+
const email = typeof user?.['email'] === 'string' ? user['email'] : 'unknown';
|
|
103
|
+
// Store in config (creates file with 0600 permissions).
|
|
104
|
+
const cfg = loadConfig();
|
|
105
|
+
cfg['api_key'] = key;
|
|
106
|
+
saveConfig(cfg);
|
|
107
|
+
if (mode === 'json') {
|
|
108
|
+
process.stdout.write(JSON.stringify({ status: 'authenticated', email }) + '\n');
|
|
109
|
+
}
|
|
110
|
+
else if (!(opts.quiet ?? false)) {
|
|
111
|
+
process.stderr.write(`Authenticated as ${email}\n`);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
// --- auth logout ---
|
|
115
|
+
const logoutCmd = new Command('logout').description('Remove stored credentials');
|
|
116
|
+
addGlobalFlags(logoutCmd);
|
|
117
|
+
logoutCmd.action(async (opts) => {
|
|
118
|
+
const mode = detectMode({ forceJson: opts.json, forceHuman: opts.human });
|
|
119
|
+
const cfg = loadConfig();
|
|
120
|
+
delete cfg['api_key'];
|
|
121
|
+
saveConfig(cfg);
|
|
122
|
+
if (mode === 'json') {
|
|
123
|
+
process.stdout.write(JSON.stringify({ status: 'logged_out' }) + '\n');
|
|
124
|
+
}
|
|
125
|
+
else if (!(opts.quiet ?? false)) {
|
|
126
|
+
process.stderr.write('Credentials removed.\n');
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
// --- auth status ---
|
|
130
|
+
const statusCmd = new Command('status').description('Show current auth state');
|
|
131
|
+
addGlobalFlags(statusCmd);
|
|
132
|
+
statusCmd.action(async (opts) => {
|
|
133
|
+
const mode = detectMode({ forceJson: opts.json, forceHuman: opts.human });
|
|
134
|
+
const key = resolveApiKey(opts.apiKey);
|
|
135
|
+
if (!key) {
|
|
136
|
+
if (mode === 'json') {
|
|
137
|
+
process.stdout.write(JSON.stringify({ method: 'none', authenticated: false }) + '\n');
|
|
138
|
+
}
|
|
139
|
+
else if (!(opts.quiet ?? false)) {
|
|
140
|
+
process.stderr.write('Not authenticated. Run depicta auth login\n');
|
|
141
|
+
}
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
// Determine which source provided the key.
|
|
145
|
+
let method = 'config';
|
|
146
|
+
if (opts.apiKey)
|
|
147
|
+
method = 'flag';
|
|
148
|
+
else if (process.env['DEPICTA_API_KEY'])
|
|
149
|
+
method = 'env';
|
|
150
|
+
const masked = maskKey(key);
|
|
151
|
+
const url = resolveApiUrl(opts.apiUrl);
|
|
152
|
+
const client = new DepictaClient(key, url);
|
|
153
|
+
let email = null;
|
|
154
|
+
try {
|
|
155
|
+
const profile = await client.get('/v1/account/profile');
|
|
156
|
+
const user = profile['user'];
|
|
157
|
+
email = typeof user?.['email'] === 'string' ? user['email'] : null;
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
email = null;
|
|
161
|
+
}
|
|
162
|
+
if (mode === 'json') {
|
|
163
|
+
const result = {
|
|
164
|
+
method,
|
|
165
|
+
key_prefix: masked,
|
|
166
|
+
authenticated: email !== null,
|
|
167
|
+
};
|
|
168
|
+
if (email)
|
|
169
|
+
result['email'] = email;
|
|
170
|
+
process.stdout.write(JSON.stringify(result) + '\n');
|
|
171
|
+
}
|
|
172
|
+
else if (!(opts.quiet ?? false)) {
|
|
173
|
+
process.stderr.write(`Auth method: ${method}\n`);
|
|
174
|
+
process.stderr.write(`Key: ${masked}\n`);
|
|
175
|
+
if (email) {
|
|
176
|
+
process.stderr.write(`Account: ${email}\n`);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
process.stderr.write('Key is invalid\n');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
auth.addCommand(loginCmd);
|
|
184
|
+
auth.addCommand(logoutCmd);
|
|
185
|
+
auth.addCommand(statusCmd);
|
|
186
|
+
program.addCommand(auth);
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,OAAO,EACP,aAAa,EACb,aAAa,EACb,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,cAAc,EAAc,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEtD,yDAAyD;AACzD,KAAK,UAAU,YAAY;IACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;YAClC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,2DAA2D;QAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAA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ACpB,MAAM,MAAM,GAA4B;gBACtC,MAAM;gBACN,UAAU,EAAE,MAAM;gBAClB,aAAa,EAAE,KAAK,KAAK,IAAI;aAC9B,CAAC;YACF,IAAI,KAAK;gBAAE,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACnC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QACtD,CAAC;aAAM,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,EAAE,CAAC;YAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,MAAM,IAAI,CAAC,CAAC;YACjD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,MAAM,IAAI,CAAC,CAAC;YACzC,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC;YAC9C,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC1B,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC3B,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC3B,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docs command: output full CLI reference for LLMs and humans.
|
|
3
|
+
*
|
|
4
|
+
* Outputs the complete CLI_REFERENCE as JSON (--json / pipe) or
|
|
5
|
+
* formatted human-readable text (human mode / TTY).
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
/** Register the docs command on the parent program. */
|
|
9
|
+
export declare function registerDocsCommand(program: Command): void;
|
|
10
|
+
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsJpC,uDAAuD;AACvD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAa1D"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docs command: output full CLI reference for LLMs and humans.
|
|
3
|
+
*
|
|
4
|
+
* Outputs the complete CLI_REFERENCE as JSON (--json / pipe) or
|
|
5
|
+
* formatted human-readable text (human mode / TTY).
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import { addGlobalFlags } from '../flags.js';
|
|
9
|
+
import { detectMode } from '../output.js';
|
|
10
|
+
/** Package version — kept in sync with package.json. */
|
|
11
|
+
const VERSION = '0.9.0';
|
|
12
|
+
/** Complete command reference — embedded so it works offline. */
|
|
13
|
+
const CLI_REFERENCE = {
|
|
14
|
+
name: 'depicta',
|
|
15
|
+
version: VERSION,
|
|
16
|
+
description: 'Depicta CLI — AI image generation and processing from the terminal',
|
|
17
|
+
api_base_url: 'https://api.depicta.ai',
|
|
18
|
+
auth: {
|
|
19
|
+
env_var: 'DEPICTA_API_KEY',
|
|
20
|
+
config_file: '~/.config/depicta/config.json',
|
|
21
|
+
precedence: ['--api-key flag', 'DEPICTA_API_KEY env var', 'config file'],
|
|
22
|
+
},
|
|
23
|
+
output_modes: {
|
|
24
|
+
human: 'TTY detected or --human: Rich output to stderr, file path to stdout',
|
|
25
|
+
json: '--json flag: full JSON object to stdout',
|
|
26
|
+
pipe: 'non-TTY without --json: file path only to stdout (for piping)',
|
|
27
|
+
},
|
|
28
|
+
global_flags: {
|
|
29
|
+
'--json': 'Force JSON output',
|
|
30
|
+
'--human': 'Force human-readable output',
|
|
31
|
+
'--api-key <key>': 'Override API key for this call',
|
|
32
|
+
'--quiet / -q': 'Suppress informational output on stderr',
|
|
33
|
+
},
|
|
34
|
+
commands: {
|
|
35
|
+
'image <prompt>': {
|
|
36
|
+
description: 'Generate image from text',
|
|
37
|
+
flags: '--model/-m, --size/-s, --image-size, --output/-o, --output-dir/-d, --format/-f, --quality, --strictness',
|
|
38
|
+
output: 'JSON: {file, cost_eur, balance_eur, image_hash, model, ai_generated}',
|
|
39
|
+
},
|
|
40
|
+
'edit <input> <prompt>': {
|
|
41
|
+
description: 'Edit an existing image with a text prompt',
|
|
42
|
+
flags: 'same as image',
|
|
43
|
+
note: 'Input can be a file path, - (stdin), or URL',
|
|
44
|
+
},
|
|
45
|
+
'graphic <prompt>': {
|
|
46
|
+
description: 'Generate icon, logo, or clipart',
|
|
47
|
+
flags: 'same as image',
|
|
48
|
+
},
|
|
49
|
+
'diagram <prompt>': {
|
|
50
|
+
description: 'Generate a diagram',
|
|
51
|
+
flags: 'same as image + --type/-t (flowchart|sequence|architecture|mindmap|er|class|timeline|org-chart)',
|
|
52
|
+
},
|
|
53
|
+
'combine <images...>': {
|
|
54
|
+
description: 'Combine 2-5 images into one composition',
|
|
55
|
+
flags: 'same as image + --prompt/-p',
|
|
56
|
+
},
|
|
57
|
+
'story run <storyboard.json>': {
|
|
58
|
+
description: 'Generate multi-scene story from storyboard JSON (async, polls until complete)',
|
|
59
|
+
flags: '--output-dir/-d, --format/-f, --quality, --timeout',
|
|
60
|
+
output: 'JSON: {job_id, title, scenes: [{file, cost_eur}], total_cost_eur, balance_eur}',
|
|
61
|
+
},
|
|
62
|
+
'story status <job_id>': {
|
|
63
|
+
description: 'Poll status of an async story job',
|
|
64
|
+
},
|
|
65
|
+
'process crop <input>': {
|
|
66
|
+
description: 'Crop image',
|
|
67
|
+
flags: '--x, --y, --width, --height, --output/-o, --output-dir/-d',
|
|
68
|
+
},
|
|
69
|
+
'process resize <input>': { description: 'Resize image', flags: '--width, --height' },
|
|
70
|
+
'process convert <input>': { description: 'Convert format', flags: '--format/-f (png|jpg|webp)' },
|
|
71
|
+
'process optimize <input>': { description: 'Optimize compression', flags: '--colors, --min-psnr' },
|
|
72
|
+
'process remove-bg <input>': { description: 'Remove background' },
|
|
73
|
+
'process blur <input>': { description: 'Apply Gaussian blur', flags: '--radius' },
|
|
74
|
+
'process sharpen <input>': { description: 'Sharpen image', flags: '--amount, --threshold' },
|
|
75
|
+
'process adjust <input>': {
|
|
76
|
+
description: 'Adjust brightness/contrast/saturation',
|
|
77
|
+
flags: '--brightness, --contrast, --saturation',
|
|
78
|
+
},
|
|
79
|
+
'process grayscale <input>': { description: 'Convert to grayscale' },
|
|
80
|
+
'process invert <input>': { description: 'Invert colors' },
|
|
81
|
+
'process flip <input>': { description: 'Flip image', flags: '--direction (horizontal|vertical)' },
|
|
82
|
+
'process auto-orient <input>': { description: 'Auto-orient from EXIF' },
|
|
83
|
+
'process alpha-to-color <input>': {
|
|
84
|
+
description: 'Replace transparency with color',
|
|
85
|
+
flags: '--color (#RRGGBB)',
|
|
86
|
+
},
|
|
87
|
+
'process color-to-alpha <input>': {
|
|
88
|
+
description: 'Make color transparent',
|
|
89
|
+
flags: '--color, --tolerance',
|
|
90
|
+
},
|
|
91
|
+
'process rotate <input>': {
|
|
92
|
+
description: 'Rotate by angle',
|
|
93
|
+
flags: '--angle, --expand, --fill-color',
|
|
94
|
+
},
|
|
95
|
+
'process trim <input>': { description: 'Auto-trim borders', flags: '--tolerance' },
|
|
96
|
+
'process pad <input>': {
|
|
97
|
+
description: 'Add padding',
|
|
98
|
+
flags: '--width, --height, --color, --gravity',
|
|
99
|
+
},
|
|
100
|
+
'process metadata-strip <input>': { description: 'Strip metadata', flags: '--keep-icc' },
|
|
101
|
+
'process overlay <input>': {
|
|
102
|
+
description: 'Overlay image',
|
|
103
|
+
flags: '--overlay, --x, --y, --opacity',
|
|
104
|
+
},
|
|
105
|
+
'auth login': { description: 'Configure API key (interactive or piped)' },
|
|
106
|
+
'auth logout': { description: 'Remove stored credentials' },
|
|
107
|
+
'auth status': { description: 'Show current auth state' },
|
|
108
|
+
'guidelines search <query>': { description: 'Search content guidelines by keyword' },
|
|
109
|
+
'jobs list': { description: 'List recent generation jobs' },
|
|
110
|
+
'jobs get <job_id>': { description: 'Get a specific job by ID' },
|
|
111
|
+
models: { description: 'List available models' },
|
|
112
|
+
balance: { description: 'Show credit balance (balance_eur, held_eur)' },
|
|
113
|
+
version: { description: 'Show CLI version (no auth required)' },
|
|
114
|
+
docs: { description: 'Show this command reference' },
|
|
115
|
+
},
|
|
116
|
+
piping: {
|
|
117
|
+
convention: 'stdout = file path (pipe mode) or JSON (--json). stderr = display output.',
|
|
118
|
+
stdin: 'Use - as input argument to read file path from stdin',
|
|
119
|
+
example: 'depicta image \'a cat\' | depicta process remove-bg - | depicta process resize - --width 1200',
|
|
120
|
+
},
|
|
121
|
+
exit_codes: {
|
|
122
|
+
'0': 'success',
|
|
123
|
+
'1': 'general error',
|
|
124
|
+
'2': 'authentication error',
|
|
125
|
+
'3': 'insufficient credits',
|
|
126
|
+
'4': 'content rejected',
|
|
127
|
+
'5': 'rate limited',
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
/** Print a human-readable command reference to stderr. */
|
|
131
|
+
function printHumanDocs() {
|
|
132
|
+
process.stderr.write(`Depicta CLI v${VERSION}\n\n`);
|
|
133
|
+
process.stderr.write('Commands:\n\n');
|
|
134
|
+
for (const [cmd, info] of Object.entries(CLI_REFERENCE.commands)) {
|
|
135
|
+
const desc = typeof info === 'object' && 'description' in info ? info.description : String(info);
|
|
136
|
+
process.stderr.write(` depicta ${cmd}\n`);
|
|
137
|
+
process.stderr.write(` ${desc}\n`);
|
|
138
|
+
if (typeof info === 'object' && 'flags' in info) {
|
|
139
|
+
process.stderr.write(` Flags: ${info.flags}\n`);
|
|
140
|
+
}
|
|
141
|
+
process.stderr.write('\n');
|
|
142
|
+
}
|
|
143
|
+
process.stderr.write('Piping:\n');
|
|
144
|
+
process.stderr.write(` ${CLI_REFERENCE.piping.example}\n\n`);
|
|
145
|
+
process.stderr.write('Exit codes:\n');
|
|
146
|
+
for (const [code, meaning] of Object.entries(CLI_REFERENCE.exit_codes)) {
|
|
147
|
+
process.stderr.write(` ${code}: ${meaning}\n`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/** Register the docs command on the parent program. */
|
|
151
|
+
export function registerDocsCommand(program) {
|
|
152
|
+
const docsCmd = new Command('docs').description('Show complete CLI command reference');
|
|
153
|
+
addGlobalFlags(docsCmd);
|
|
154
|
+
docsCmd.action((opts) => {
|
|
155
|
+
const mode = detectMode({ forceJson: opts.json, forceHuman: opts.human });
|
|
156
|
+
if (mode === 'json' || mode === 'pipe') {
|
|
157
|
+
process.stdout.write(JSON.stringify(CLI_REFERENCE, null, 2) + '\n');
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
printHumanDocs();
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
program.addCommand(docsCmd);
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAc,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,wDAAwD;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,iEAAiE;AACjE,MAAM,aAAa,GAAG;IACpB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,oEAAoE;IACjF,YAAY,EAAE,wBAAwB;IACtC,IAAI,EAAE;QACJ,OAAO,EAAE,iBAAiB;QAC1B,WAAW,EAAE,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