weshop-cli 0.1.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 (45) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +142 -0
  3. package/dist/cache.d.ts +4 -0
  4. package/dist/cache.js +53 -0
  5. package/dist/cache.js.map +1 -0
  6. package/dist/client.d.ts +43 -0
  7. package/dist/client.js +82 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/commands/aimodel.d.ts +2 -0
  10. package/dist/commands/aimodel.js +65 -0
  11. package/dist/commands/aimodel.js.map +1 -0
  12. package/dist/commands/aipose.d.ts +2 -0
  13. package/dist/commands/aipose.js +31 -0
  14. package/dist/commands/aipose.js.map +1 -0
  15. package/dist/commands/aiproduct.d.ts +2 -0
  16. package/dist/commands/aiproduct.js +50 -0
  17. package/dist/commands/aiproduct.js.map +1 -0
  18. package/dist/commands/expandimage.d.ts +2 -0
  19. package/dist/commands/expandimage.js +36 -0
  20. package/dist/commands/expandimage.js.map +1 -0
  21. package/dist/commands/info.d.ts +2 -0
  22. package/dist/commands/info.js +66 -0
  23. package/dist/commands/info.js.map +1 -0
  24. package/dist/commands/removebg.d.ts +2 -0
  25. package/dist/commands/removebg.js +40 -0
  26. package/dist/commands/removebg.js.map +1 -0
  27. package/dist/commands/status.d.ts +2 -0
  28. package/dist/commands/status.js +17 -0
  29. package/dist/commands/status.js.map +1 -0
  30. package/dist/commands/upload.d.ts +2 -0
  31. package/dist/commands/upload.js +17 -0
  32. package/dist/commands/upload.js.map +1 -0
  33. package/dist/commands/virtualtryon.d.ts +2 -0
  34. package/dist/commands/virtualtryon.js +56 -0
  35. package/dist/commands/virtualtryon.js.map +1 -0
  36. package/dist/index.d.ts +2 -0
  37. package/dist/index.js +35 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/printer.d.ts +5 -0
  40. package/dist/printer.js +38 -0
  41. package/dist/printer.js.map +1 -0
  42. package/dist/run-helper.d.ts +5 -0
  43. package/dist/run-helper.js +29 -0
  44. package/dist/run-helper.js.map +1 -0
  45. package/package.json +43 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,142 @@
1
+ # weshop-cli
2
+
3
+ One command. Studio-quality images.
4
+
5
+ `weshop-cli` turns [WeShop AI](https://www.weshop.ai) into a command-line tool — virtual try-on, model swap, background replace, pose change, canvas expand, and more. Built for developers and AI agents who want to generate production-ready fashion & product images without touching a browser.
6
+
7
+ ```bash
8
+ # Virtual try-on: put a garment onto a model reference
9
+ weshop virtualtryon --image ./garment.png --model-image ./model-photo.png --gen-version weshopPro --prompt-mode auto --aspect-ratio 2:3
10
+
11
+ # Replace the background in a fashion photo, keep the clothing
12
+ weshop aimodel --image ./fashion.png --mask-type autoApparelSegment --generation-mode referToOrigin --location-id 6000372
13
+
14
+ # Remove background and replace with white
15
+ weshop removebg --image ./product.png --mask-type autoSubjectSegment --bg-hex '#ffffff'
16
+ ```
17
+
18
+ ## Why
19
+
20
+ - **One command = one image task.** No curl, no JSON, no polling loops.
21
+ - **Agent-friendly.** Structured `[key]: value` output that any LLM agent can parse. No colors, no spinners, no noise.
22
+ - **Local files just work.** Pass a local path to `--image` and it auto-uploads. Same file won't upload twice (cached by path + size + mtime).
23
+ - **Blocking or async.** Waits for results by default. Add `--no-wait` to get the execution ID and poll later with `weshop status`.
24
+
25
+ ## Quick start
26
+
27
+ Get your API key at [open.weshop.ai/authorization/apikey](https://open.weshop.ai/authorization/apikey), then:
28
+
29
+ ```bash
30
+ npm install -g weshop-cli
31
+ export WESHOP_API_KEY=<your-key>
32
+ weshop --help
33
+ ```
34
+
35
+ ### For developers
36
+
37
+ ```bash
38
+ git clone https://github.com/weshopai/weshop-cli.git
39
+ cd weshop-cli
40
+ npm install
41
+ export WESHOP_API_KEY=<your-key>
42
+ npx tsx src/index.ts --help
43
+ ```
44
+
45
+ ## Commands
46
+
47
+ Run `weshop <command> --help` to see each command's full parameters, enum values, and examples.
48
+
49
+ | Command | What it does |
50
+ |---|---|
51
+ | `virtualtryon` | Put a garment onto a generated model with optional model/background references |
52
+ | `aimodel` | Replace the model, swap the scene or background while keeping the garment |
53
+ | `aiproduct` | Replace or enhance the background around a product |
54
+ | `aipose` | Change the human pose while keeping the garment unchanged |
55
+ | `expandimage` | Expand the canvas — AI fills the new area to blend naturally |
56
+ | `removebg` | Remove the background or replace it with a solid color |
57
+ | `upload` | Upload a local image and get a reusable URL |
58
+ | `status` | Check the status of a run by execution ID |
59
+ | `info` | List available preset IDs (scenes, models, background colors) |
60
+
61
+ ## Example: virtual try-on
62
+
63
+ ```bash
64
+ weshop virtualtryon \
65
+ --image ./garment.png \
66
+ --model-image ./model-photo.png \
67
+ --gen-version weshopPro \
68
+ --prompt-mode auto \
69
+ --aspect-ratio 2:3 \
70
+ --batch 2
71
+ ```
72
+
73
+ Output:
74
+
75
+ ```
76
+ [image]
77
+ imageUrl: https://ai-global-image.weshop.com/...
78
+
79
+ [submitted]
80
+ executionId: abc123
81
+
82
+ [result]
83
+ agent: virtualtryon v1.0
84
+ executionId: abc123
85
+ status: Success
86
+ imageCount: 2
87
+ image[0]:
88
+ status: Success
89
+ url: https://ai-global-image.weshop.com/...
90
+ image[1]:
91
+ status: Success
92
+ url: https://ai-global-image.weshop.com/...
93
+ ```
94
+
95
+ ## Example: use preset IDs for best results
96
+
97
+ For `aimodel` and `aiproduct`, using preset scene/model IDs gives the best quality. List them with `info`:
98
+
99
+ ```bash
100
+ # See available scenes and models
101
+ weshop info aimodel
102
+
103
+ # Use a preset scene
104
+ weshop aimodel \
105
+ --image ./model.png \
106
+ --mask-type autoApparelSegment \
107
+ --generation-mode referToOrigin \
108
+ --location-id 6000372 \
109
+ --batch 2
110
+ ```
111
+
112
+ ## Async mode
113
+
114
+ Don't want to wait? Add `--no-wait` and poll later:
115
+
116
+ ```bash
117
+ weshop aipose --image ./model.png --prompt 'arms crossed' --batch 1 --no-wait
118
+ # [submitted]
119
+ # executionId: abc123
120
+ # [info]
121
+ # message: Use 'weshop status abc123' to check progress
122
+
123
+ weshop status abc123
124
+ # [result]
125
+ # agent: aipose v1.0
126
+ # status: Success
127
+ # ...
128
+ ```
129
+
130
+ ## For AI agents
131
+
132
+ The output is designed to be easily parsed by automated tools and AI agents:
133
+
134
+ - Structured `[section]` + `key: value` format — no ANSI colors, no progress bars
135
+ - Every field is labeled and parseable
136
+ - `--no-wait` + `weshop status` enables non-blocking workflows
137
+ - `--help` on each command documents every parameter, enum value, and constraint
138
+ - Local images are auto-uploaded and cached — no separate upload step needed
139
+
140
+ ## License
141
+
142
+ Apache-2.0
@@ -0,0 +1,4 @@
1
+ /** Look up a cached URL for a local file. Returns undefined on miss. */
2
+ export declare function getCachedUrl(absPath: string): string | undefined;
3
+ /** Store a URL for a local file. */
4
+ export declare function setCachedUrl(absPath: string, url: string): void;
package/dist/cache.js ADDED
@@ -0,0 +1,53 @@
1
+ import fs from "node:fs";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ const CACHE_DIR = path.join(os.homedir(), ".weshop-cli");
5
+ const CACHE_FILE = path.join(CACHE_DIR, "upload-cache.json");
6
+ function loadCache() {
7
+ try {
8
+ if (fs.existsSync(CACHE_FILE)) {
9
+ return JSON.parse(fs.readFileSync(CACHE_FILE, "utf-8"));
10
+ }
11
+ }
12
+ catch {
13
+ // corrupted cache, start fresh
14
+ }
15
+ return {};
16
+ }
17
+ function saveCache(data) {
18
+ if (!fs.existsSync(CACHE_DIR)) {
19
+ fs.mkdirSync(CACHE_DIR, { recursive: true });
20
+ }
21
+ fs.writeFileSync(CACHE_FILE, JSON.stringify(data, null, 2));
22
+ }
23
+ /**
24
+ * Build a cache key from absolute path.
25
+ * Match by path + file size + mtime so edits invalidate the cache.
26
+ */
27
+ function fileFingerprint(absPath) {
28
+ const stat = fs.statSync(absPath);
29
+ return { size: stat.size, mtimeMs: Math.floor(stat.mtimeMs) };
30
+ }
31
+ /** Look up a cached URL for a local file. Returns undefined on miss. */
32
+ export function getCachedUrl(absPath) {
33
+ const cache = loadCache();
34
+ const entry = cache[absPath];
35
+ if (!entry)
36
+ return undefined;
37
+ const fp = fileFingerprint(absPath);
38
+ if (entry.size === fp.size && entry.mtimeMs === fp.mtimeMs) {
39
+ return entry.url;
40
+ }
41
+ // file changed, invalidate
42
+ delete cache[absPath];
43
+ saveCache(cache);
44
+ return undefined;
45
+ }
46
+ /** Store a URL for a local file. */
47
+ export function setCachedUrl(absPath, url) {
48
+ const cache = loadCache();
49
+ const fp = fileFingerprint(absPath);
50
+ cache[absPath] = { url, ...fp };
51
+ saveCache(cache);
52
+ }
53
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAU7B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;AACzD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAE7D,SAAS,SAAS;IAChB,IAAI,CAAC;QACH,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAc,CAAC;QACvE,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,+BAA+B;IACjC,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,SAAS,CAAC,IAAe;IAChC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,EAAE,C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E,CAAC;IAChC,SAAS,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC"}
@@ -0,0 +1,43 @@
1
+ export interface UploadResult {
2
+ image: string;
3
+ }
4
+ export declare function uploadImage(filePath: string): Promise<UploadResult>;
5
+ export interface RunRequest {
6
+ agent: {
7
+ name: string;
8
+ version: string;
9
+ };
10
+ input: Record<string, unknown>;
11
+ params: Record<string, unknown>;
12
+ }
13
+ export interface RunResponse {
14
+ executionId: string;
15
+ taskId: string;
16
+ }
17
+ export declare function submitRun(body: RunRequest): Promise<RunResponse>;
18
+ export interface ExecutionResult {
19
+ status: string;
20
+ image?: string;
21
+ }
22
+ export interface Execution {
23
+ executionId: string;
24
+ status: string;
25
+ result: ExecutionResult[];
26
+ }
27
+ export interface PollResponse {
28
+ agentName: string;
29
+ agentVersion: string;
30
+ executions: Execution[];
31
+ }
32
+ export declare function pollRun(executionId: string): Promise<PollResponse>;
33
+ export declare function fetchAgentInfo(agentName: string, agentVersion: string): Promise<unknown>;
34
+ /** Poll until terminal status, calling `onTick` each iteration. */
35
+ export declare function waitForCompletion(executionId: string, intervalMs?: number): Promise<PollResponse>;
36
+ /**
37
+ * Resolve an image argument: if it looks like a URL pass through,
38
+ * otherwise check upload cache, and upload only if not cached.
39
+ */
40
+ export declare function resolveImage(imageArg: string): Promise<{
41
+ url: string;
42
+ cached: boolean;
43
+ }>;
package/dist/client.js ADDED
@@ -0,0 +1,82 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { getCachedUrl, setCachedUrl } from "./cache.js";
4
+ const BASE_URL = "https://openapi.weshop.ai/openapi";
5
+ // ── helpers ──────────────────────────────────────────────────────────
6
+ function getApiKey() {
7
+ const key = process.env.WESHOP_API_KEY;
8
+ if (!key) {
9
+ console.error("Error: API key not found.\n" +
10
+ "Set it via: export WESHOP_API_KEY=<your-key>\n" +
11
+ "Get one at: https://open.weshop.ai/authorization/apikey");
12
+ process.exit(1);
13
+ }
14
+ return key;
15
+ }
16
+ async function request(endpoint, init = {}) {
17
+ const url = `${BASE_URL}${endpoint}`;
18
+ const res = await fetch(url, {
19
+ ...init,
20
+ headers: {
21
+ Authorization: getApiKey(),
22
+ ...init.headers,
23
+ },
24
+ });
25
+ const json = (await res.json());
26
+ if (!json.success) {
27
+ throw new Error(`API error: ${json.error?.code} — ${json.error?.message}`);
28
+ }
29
+ return json.data;
30
+ }
31
+ export async function uploadImage(filePath) {
32
+ const abs = path.resolve(filePath);
33
+ if (!fs.existsSync(abs))
34
+ throw new Error(`File not found: ${abs}`);
35
+ const blob = new Blob([fs.readFileSync(abs)]);
36
+ const form = new FormData();
37
+ form.append("image", blob, path.basename(abs));
38
+ return request("/agent/assets/images", {
39
+ method: "POST",
40
+ body: form,
41
+ });
42
+ }
43
+ export async function submitRun(body) {
44
+ return request("/agent/runs", {
45
+ method: "POST",
46
+ headers: { "Content-Type": "application/json" },
47
+ body: JSON.stringify(body),
48
+ });
49
+ }
50
+ export async function pollRun(executionId) {
51
+ return request(`/agent/runs/${executionId}`);
52
+ }
53
+ export async function fetchAgentInfo(agentName, agentVersion) {
54
+ return request(`/v1/agent/info?agentName=${encodeURIComponent(agentName)}&agentVersion=${encodeURIComponent(agentVersion)}`);
55
+ }
56
+ /** Poll until terminal status, calling `onTick` each iteration. */
57
+ export async function waitForCompletion(executionId, intervalMs = 3000) {
58
+ // eslint-disable-next-line no-constant-condition
59
+ while (true) {
60
+ const data = await pollRun(executionId);
61
+ const latest = data.executions.at(-1);
62
+ if (latest && ["Success", "Failed"].includes(latest.status))
63
+ return data;
64
+ await new Promise((r) => setTimeout(r, intervalMs));
65
+ }
66
+ }
67
+ /**
68
+ * Resolve an image argument: if it looks like a URL pass through,
69
+ * otherwise check upload cache, and upload only if not cached.
70
+ */
71
+ export async function resolveImage(imageArg) {
72
+ if (/^https?:\/\//.test(imageArg))
73
+ return { url: imageArg, cached: false };
74
+ const abs = path.resolve(imageArg);
75
+ const cached = getCachedUrl(abs);
76
+ if (cached)
77
+ return { url: cached, cached: true };
78
+ const { image } = await uploadImage(abs);
79
+ setCachedUrl(abs, image);
80
+ return { url: image, cached: false };
81
+ }
82
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,QAAQ,GAAG,mCAAmC,CAAC;AAErD,wEAAwE;AAExE,SAAS,SAAS;IAChB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IACvC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CACX,6BAA6B;YAC3B,iDAAiD;YACjD,0DAA0D,CAC7D,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,KAAK,UAAU,OAAO,CACpB,QAAgB,EAChB,OAAoB,EAAE;IAEtB,MAAM,GAAG,GAAG,GAAG,QAAQ,GAAG,QAAQ,EAAE,CAAC;IACrC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,GAAG,IAAI;QACP,OAAO,EAAE;YACP,aAAa,EAAE,SAAS,EAAE;YAC1B,GAAG,IAAI,CAAC,OAAO;SAChB;KACF,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAA6E,CAAC;IAC5G,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,CAAC,KAAK,EAAE,IAAI,MAAM,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,CAAC,IAA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rC,WAAmB,EACnB,UAAU,GAAG,IAAI;IAEjB,iDAAiD;IACjD,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,IAAI,MAAM,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;QACzE,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;IACtD,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IACjD,IAAI,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAE3E,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,MAAM;QAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAEjD,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;IACzC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACzB,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const aimodelCmd: Command;
@@ -0,0 +1,65 @@
1
+ import { Command } from "commander";
2
+ import { executeRun } from "../run-helper.js";
3
+ import { resolveImage } from "../client.js";
4
+ export const aimodelCmd = new Command("aimodel")
5
+ .summary("Fashion model photos — replace the model, swap the scene or background while keeping the garment")
6
+ .description("Fashion model photos — replace the model, swap the scene or background while keeping the garment.\n\n" +
7
+ "Mask types (--mask-type):\n" +
8
+ " autoApparelSegment Preserve full-body clothing; replace model face, body, and background\n" +
9
+ " autoUpperApparelSegment Preserve upper garment only; replace everything else\n" +
10
+ " autoLowerApparelSegment Preserve lower garment only; replace everything else\n" +
11
+ " autoSubjectSegment Preserve the foreground subject; replace background only\n" +
12
+ " autoHumanSegment Preserve body + background; replace face/head only (face swap)\n" +
13
+ " inverseAutoHumanSegment Preserve face only; replace outfit and background\n" +
14
+ " custom Caller-defined region via --custom-mask (PNG, same size as source, transparent=editable)\n\n" +
15
+ "Generation mode (--generation-mode):\n" +
16
+ " freeCreation AI generates freely, less constrained by the source style\n" +
17
+ " referToOrigin AI stays close to the source image style\n\n" +
18
+ "Pose mode (--pose):\n" +
19
+ " originalImagePose Keep the same pose as the source image (default)\n" +
20
+ " referenceImagePose Adopt the pose from the --location-id reference image\n" +
21
+ " freePose Let AI decide the pose freely\n\n" +
22
+ "At least one of --prompt, --location-id, or --model-id must be provided.\n" +
23
+ "Recommended: use --location-id / --model-id for best results (run 'weshop info aimodel' to list).\n" +
24
+ "If using only --prompt without preset IDs, set --generation-mode freeCreation.\n\n" +
25
+ "Examples:\n" +
26
+ " weshop aimodel --image ./model.png --mask-type autoApparelSegment --generation-mode freeCreation --prompt 'street style photo'\n" +
27
+ " weshop aimodel --image ./model.png --mask-type autoSubjectSegment --generation-mode referToOrigin --location-id 42 --batch 2\n" +
28
+ " weshop aimodel --image ./model.png --mask-type custom --generation-mode freeCreation --custom-mask ./mask.png --prompt 'studio photo'")
29
+ .requiredOption("--image <path|url>", "Source image — local file path or public URL (local files are auto-uploaded)")
30
+ .requiredOption("--mask-type <type>", "Region to preserve (see mask types above)")
31
+ .requiredOption("--generation-mode <mode>", "Generation mode: freeCreation (free AI) or referToOrigin (stay close to source)")
32
+ .option("--prompt <text>", "Describe the desired look, style, or scene of the result")
33
+ .option("--location-id <id>", "Replace background with a preset scene by ID (use 'weshop info aimodel' to list)", parseInt)
34
+ .option("--model-id <id>", "Replace model face with a preset fashion model by ID (use 'weshop info aimodel' to list)", parseInt)
35
+ .option("--negative-prompt <text>", "Describe elements to avoid in the result, e.g. 'blurry, dark'")
36
+ .option("--pose <mode>", "Pose control: originalImagePose (default), referenceImagePose, or freePose")
37
+ .option("--custom-mask <path|url>", "PNG mask image defining the protected region. Masked area is preserved, transparent area is editable. Must match source image dimensions")
38
+ .option("--batch <count>", "Number of images to generate, 1-16 (default: 4)", parseInt)
39
+ .option("--task-name <name>", "Human-readable label for this run")
40
+ .option("--no-wait", "Return immediately after submission; use 'weshop status <id>' to check later")
41
+ .action(async (opts) => {
42
+ const params = {
43
+ generatedContent: opts.generationMode,
44
+ maskType: opts.maskType,
45
+ };
46
+ if (opts.prompt)
47
+ params.textDescription = opts.prompt;
48
+ if (opts.locationId)
49
+ params.locationId = opts.locationId;
50
+ if (opts.modelId)
51
+ params.fashionModelId = opts.modelId;
52
+ if (opts.negativePrompt)
53
+ params.negTextDescription = opts.negativePrompt;
54
+ if (opts.pose)
55
+ params.pose = opts.pose;
56
+ if (opts.customMask)
57
+ params.customMaskUrl = (await resolveImage(opts.customMask)).url;
58
+ if (opts.batch)
59
+ params.batchCount = opts.batch;
60
+ const extraInput = {};
61
+ if (opts.taskName)
62
+ extraInput.taskName = opts.taskName;
63
+ await executeRun("aimodel", "v1.0", opts, params, extraInput);
64
+ });
65
+ //# sourceMappingURL=aimodel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aimodel.js","sourceRoot":"","sources":["../../src/commands/aimodel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;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IAAI,CAAC,MAAM;QAAE,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC;IACtD,IAAI,IAAI,CAAC,UAAU;QAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACzD,IAAI,IAAI,CAAC,OAAO;QAAE,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC;IACvD,IAAI,IAAI,CAAC,cAAc;QAAE,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC;IACzE,IAAI,IAAI,CAAC,IAAI;QAAE,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACvC,IAAI,IAAI,CAAC,UAAU;QAAE,MAAM,CAAC,aAAa,GAAG,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;IACtF,IAAI,IAAI,CAAC,KAAK;QAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;IAE/C,MAAM,UAAU,GAA4B,EAAE,CAAC;IAC/C,IAAI,IAAI,CAAC,QAAQ;QAAE,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAEvD,MAAM,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAChE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const aiposeCmd: Command;
@@ -0,0 +1,31 @@
1
+ import { Command } from "commander";
2
+ import { executeRun } from "../run-helper.js";
3
+ export const aiposeCmd = new Command("aipose")
4
+ .summary("Change the human pose in a photo while keeping the garment unchanged")
5
+ .description("Change the human pose in a photo while keeping the garment unchanged.\n\n" +
6
+ "Generation version (--gen-version):\n" +
7
+ " lite Faster, lighter quality (default)\n" +
8
+ " pro Higher quality, slower\n\n" +
9
+ "Examples:\n" +
10
+ " weshop aipose --image ./model.png --prompt 'standing with hands on hips, facing camera'\n" +
11
+ " weshop aipose --image ./model.png --prompt 'walking pose, looking left' --gen-version pro --batch 2")
12
+ .requiredOption("--image <path|url>", "Source image — local file path or public URL (local files are auto-uploaded)")
13
+ .requiredOption("--prompt <text>", "Pose instruction describing the desired pose")
14
+ .option("--gen-version <ver>", "Generation quality: lite (default) or pro")
15
+ .option("--batch <count>", "Number of images to generate, 1-16 (default: 4)", parseInt)
16
+ .option("--task-name <name>", "Human-readable label for this run")
17
+ .option("--no-wait", "Return immediately after submission; use 'weshop status <id>' to check later")
18
+ .action(async (opts) => {
19
+ const params = {
20
+ textDescription: opts.prompt,
21
+ };
22
+ if (opts.genVersion)
23
+ params.generateVersion = opts.genVersion;
24
+ if (opts.batch)
25
+ params.batchCount = opts.batch;
26
+ const extraInput = {};
27
+ if (opts.taskName)
28
+ extraInput.taskName = opts.taskName;
29
+ await executeRun("aipose", "v1.0", opts, params, extraInput);
30
+ });
31
+ //# sourceMappingURL=aipose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aipose.js","sourceRoot":"","sources":["../../src/commands/aipose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC3C,OAAO,CAAC,sEAAsE,CAAC;KAC/E,WAAW,CACV,2EAA2E;IAC3E,uCAAuC;IACvC,8CAA8C;IAC9C,qCAAqC;IACrC,aAAa;IACb,6FAA6F;IAC7F,uGAAuG,CACxG;KACA,cAAc,CAAC,oBAAoB,EAAE,8EAA8E,CAAC;KACpH,cAAc,CAAC,iBAAiB,EAAE,8CAA8C,CAAC;KACjF,MAAM,CAAC,qBAAqB,EAAE,2CAA2C,CAAC;KAC1E,MAAM,CAAC,iBAAiB,EAAE,iDAAiD,EAAE,QAAQ,CAAC;KACtF,MAAM,CAAC,oBAAoB,EAAE,mCAAmC,CAAC;KACjE,MAAM,CAAC,WAAW,EAAE,8EAA8E,CAAC;KACnG,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,MAAM,GAA4B;QACtC,eAAe,EAAE,IAAI,CAAC,MAAM;KAC7B,CAAC;IACF,IAAI,IAAI,CAAC,UAAU;QAAE,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC;IAC9D,IAAI,IAAI,CAAC,KAAK;QAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;IAE/C,MAAM,UAAU,GAA4B,EAAE,CAAC;IAC/C,IAAI,IAAI,CAAC,QAAQ;QAAE,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAEvD,MAAM,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const aiproductCmd: Command;
@@ -0,0 +1,50 @@
1
+ import { Command } from "commander";
2
+ import { executeRun } from "../run-helper.js";
3
+ import { resolveImage } from "../client.js";
4
+ export const aiproductCmd = new Command("aiproduct")
5
+ .summary("Product still-life photos — replace or enhance the background around a product")
6
+ .description("Product still-life photos — replace or enhance the background around a product.\n\n" +
7
+ "Mask types (--mask-type):\n" +
8
+ " autoSubjectSegment Preserve the product; replace background\n" +
9
+ " custom Caller-defined region via --custom-mask (PNG, same size as source, transparent=editable)\n\n" +
10
+ "Generation mode (--generation-mode):\n" +
11
+ " freeCreation AI generates freely, less constrained by the source style\n" +
12
+ " referToOrigin AI stays close to the source image style\n\n" +
13
+ "At least one of --prompt or --location-id must be provided.\n" +
14
+ "Recommended: use --location-id for best results (run 'weshop info aiproduct' to list).\n" +
15
+ "If using only --prompt without preset IDs, set --generation-mode freeCreation.\n\n" +
16
+ "Examples:\n" +
17
+ " weshop aiproduct --image ./product.png --mask-type autoSubjectSegment --generation-mode freeCreation --prompt 'marble table, soft lighting'\n" +
18
+ " weshop aiproduct --image ./product.png --mask-type autoSubjectSegment --generation-mode referToOrigin --location-id 10 --batch 2\n" +
19
+ " weshop aiproduct --image ./product.png --mask-type custom --generation-mode freeCreation --custom-mask ./mask.png --prompt 'wooden desk'")
20
+ .requiredOption("--image <path|url>", "Source image — local file path or public URL (local files are auto-uploaded)")
21
+ .requiredOption("--mask-type <type>", "Region to preserve: autoSubjectSegment or custom")
22
+ .requiredOption("--generation-mode <mode>", "Generation mode: freeCreation (free AI) or referToOrigin (stay close to source)")
23
+ .option("--prompt <text>", "Describe the desired background or scene")
24
+ .option("--location-id <id>", "Replace background with a preset scene by ID (use 'weshop info aiproduct' to list)", parseInt)
25
+ .option("--negative-prompt <text>", "Describe elements to avoid in the result")
26
+ .option("--custom-mask <path|url>", "PNG mask image defining the protected region. Masked area is preserved, transparent area is editable. Must match source image dimensions")
27
+ .option("--batch <count>", "Number of images to generate, 1-16 (default: 4)", parseInt)
28
+ .option("--task-name <name>", "Human-readable label for this run")
29
+ .option("--no-wait", "Return immediately after submission; use 'weshop status <id>' to check later")
30
+ .action(async (opts) => {
31
+ const params = {
32
+ generatedContent: opts.generationMode,
33
+ maskType: opts.maskType,
34
+ };
35
+ if (opts.prompt)
36
+ params.textDescription = opts.prompt;
37
+ if (opts.locationId)
38
+ params.locationId = opts.locationId;
39
+ if (opts.negativePrompt)
40
+ params.negTextDescription = opts.negativePrompt;
41
+ if (opts.customMask)
42
+ params.customMaskUrl = (await resolveImage(opts.customMask)).url;
43
+ if (opts.batch)
44
+ params.batchCount = opts.batch;
45
+ const extraInput = {};
46
+ if (opts.taskName)
47
+ extraInput.taskName = opts.taskName;
48
+ await executeRun("aiproduct", "v1.0", opts, params, extraInput);
49
+ });
50
+ //# sourceMappingURL=aiproduct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aiproduct.js","sourceRoot":"","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I,CAAC,MAAM,CAAC;IACtD,IAAI,IAAI,CAAC,UAAU;QAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACzD,IAAI,IAAI,CAAC,cAAc;QAAE,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC;IACzE,IAAI,IAAI,CAAC,UAAU;QAAE,MAAM,CAAC,aAAa,GAAG,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;IACtF,IAAI,IAAI,CAAC,KAAK;QAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;IAE/C,MAAM,UAAU,GAA4B,EAAE,CAAC;IAC/C,IAAI,IAAI,CAAC,QAAQ;QAAE,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAEvD,MAAM,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAClE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const expandimageCmd: Command;
@@ -0,0 +1,36 @@
1
+ import { Command } from "commander";
2
+ import { executeRun } from "../run-helper.js";
3
+ export const expandimageCmd = new Command("expandimage")
4
+ .summary("Expand the canvas to a larger size — AI fills the new area to blend naturally")
5
+ .description("Expand the canvas to a larger size — AI fills the new area to blend naturally.\n\n" +
6
+ "The original image is placed within the larger canvas (not stretched).\n" +
7
+ "The added area is filled by AI to blend naturally with the original.\n" +
8
+ "By default the original is centered; use --fill-left / --fill-top to offset.\n\n" +
9
+ "Examples:\n" +
10
+ " weshop expandimage --image ./photo.png --width 2048 --height 2048\n" +
11
+ " weshop expandimage --image ./photo.png --width 2048 --height 2048 --fill-left 0 --fill-top 0 --batch 2")
12
+ .requiredOption("--image <path|url>", "Source image — local file path or public URL (local files are auto-uploaded)")
13
+ .requiredOption("--width <px>", "Target canvas width in pixels (max 4096)", parseInt)
14
+ .requiredOption("--height <px>", "Target canvas height in pixels (max 4096)", parseInt)
15
+ .option("--fill-left <px>", "Horizontal offset: distance from left edge of canvas to left edge of original (default: centered)", parseInt)
16
+ .option("--fill-top <px>", "Vertical offset: distance from top edge of canvas to top edge of original (default: centered)", parseInt)
17
+ .option("--batch <count>", "Number of images to generate, 1-16 (default: 4)", parseInt)
18
+ .option("--task-name <name>", "Human-readable label for this run")
19
+ .option("--no-wait", "Return immediately after submission; use 'weshop status <id>' to check later")
20
+ .action(async (opts) => {
21
+ const params = {
22
+ targetWidth: opts.width,
23
+ targetHeight: opts.height,
24
+ };
25
+ if (opts.fillLeft != null)
26
+ params.fillLeft = opts.fillLeft;
27
+ if (opts.fillTop != null)
28
+ params.fillTop = opts.fillTop;
29
+ if (opts.batch)
30
+ params.batchCount = opts.batch;
31
+ const extraInput = {};
32
+ if (opts.taskName)
33
+ extraInput.taskName = opts.taskName;
34
+ await executeRun("expandimage", "v1.0", opts, params, extraInput);
35
+ });
36
+ //# sourceMappingURL=expandimage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expandimage.js","sourceRoot":"","sources":["../../src/commands/expandimage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC;KACrD,OAAO,CAAC,+EAA+E,CAAC;KACxF,WAAW,CACV,oFAAoF;IACpF,0EAA0E;IAC1E,wEAAwE;IACxE,kFAAkF;IAClF,aAAa;IACb,uEAAuE;IACvE,0GAA0G,CAC3G;KACA,cAAc,CAAC,oBAAoB,EAAE,8EAA8E,CAAC;KACpH,cAAc,CAAC,cAAc,EAAE,0CAA0C,EAAE,QAAQ,CAAC;KACpF,cAAc,CAAC,eAAe,EAAE,2CAA2C,EAAE,QAAQ,CAAC;KACtF,MAAM,CAAC,kBAAkB,EAAE,mGAAmG,EAAE,QAAQ,CAAC;KACzI,MAAM,CAAC,iBAAiB,EAAE,+FAA+F,EAAE,QAAQ,CAAC;KACpI,MAAM,CAAC,iBAAiB,EAAE,iDAAiD,EAAE,QAAQ,CAAC;KACtF,MAAM,CAAC,oBAAoB,EAAE,mCAAmC,CAAC;KACjE,MAAM,CAAC,WAAW,EAAE,8EAA8E,CAAC;KACnG,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,MAAM,GAA4B;QACtC,WAAW,EAAE,IAAI,CAAC,KAAK;QACvB,YAAY,EAAE,IAAI,CAAC,MAAM;KAC1B,CAAC;IACF,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI;QAAE,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC3D,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI;QAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IACxD,IAAI,IAAI,CAAC,KAAK;QAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;IAE/C,MAAM,UAAU,GAA4B,EAAE,CAAC;IAC/C,IAAI,IAAI,CAAC,QAAQ;QAAE,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAEvD,MAAM,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AACpE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const infoCmd: Command;
@@ -0,0 +1,66 @@
1
+ import { Command } from "commander";
2
+ import { fetchAgentInfo } from "../client.js";
3
+ import { printError } from "../printer.js";
4
+ const AGENTS = ["aimodel", "aiproduct", "aipose", "expandimage", "removeBG", "virtualtryon"];
5
+ function printPresetList(label, items) {
6
+ console.log(` ${label}: (${items.length} items)`);
7
+ for (const item of items) {
8
+ const cats = item.categories?.length ? ` [${item.categories.join(", ")}]` : "";
9
+ const type = item.type ? ` (${item.type})` : "";
10
+ console.log(` id: ${item.id} name: ${item.name}${cats}${type}`);
11
+ }
12
+ }
13
+ export const infoCmd = new Command("info")
14
+ .summary("List available preset IDs for an agent")
15
+ .description("List available preset IDs for an agent (locationId, fashionModelId, backgroundId, etc.).\n\n" +
16
+ "Use these IDs with --location-id, --model-id, or --bg-id in agent commands.\n\n" +
17
+ "Agents: " + AGENTS.join(", ") + "\n\n" +
18
+ "Examples:\n" +
19
+ " weshop info aimodel\n" +
20
+ " weshop info removeBG\n" +
21
+ " weshop info aimodel --version v1.0\n" +
22
+ " weshop info aimodel --json")
23
+ .argument("<agent>", `Agent name: ${AGENTS.join(", ")}`)
24
+ .option("--version <ver>", "Agent version (default: v1.0)", "v1.0")
25
+ .option("--json", "Output raw JSON instead of formatted list")
26
+ .action(async (agent, opts) => {
27
+ try {
28
+ const data = (await fetchAgentInfo(agent, opts.version));
29
+ if (opts.json) {
30
+ console.log(JSON.stringify(data, null, 2));
31
+ return;
32
+ }
33
+ console.log("[info]");
34
+ console.log(` agent: ${agent} ${opts.version}`);
35
+ let hasPresets = false;
36
+ if (data.locations?.length) {
37
+ hasPresets = true;
38
+ printPresetList("locations (use with --location-id)", data.locations);
39
+ }
40
+ if (data.fashionModels?.length) {
41
+ hasPresets = true;
42
+ printPresetList("fashionModels (use with --model-id)", data.fashionModels);
43
+ }
44
+ if (data.backgrounds?.length) {
45
+ hasPresets = true;
46
+ printPresetList("backgrounds (use with --bg-id)", data.backgrounds);
47
+ }
48
+ // print any other array fields we didn't expect
49
+ for (const [key, val] of Object.entries(data)) {
50
+ if (["locations", "fashionModels", "backgrounds"].includes(key))
51
+ continue;
52
+ if (Array.isArray(val) && val.length) {
53
+ hasPresets = true;
54
+ printPresetList(key, val);
55
+ }
56
+ }
57
+ if (!hasPresets) {
58
+ console.log(" message: No preset IDs available for this agent");
59
+ }
60
+ }
61
+ catch (err) {
62
+ printError(err);
63
+ process.exit(1);
64
+ }
65
+ });
66
+ //# sourceMappingURL=info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;AAiB7F,SAAS,eAAe,CAAC,KAAa,EAAE,KAAmB;IACzD,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM,KAAK,CAAC,MAAM,SAAS,CAAC,CAAC;IACnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,EAAE,WAAW,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KACvC,OAAO,CAAC,wCAAwC,CAAC;KACjD,WAAW,CACV,8FAA8F;IAC9F,iFAAiF;IACjF,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM;IACvC,aAAa;IACb,yBAAyB;I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C;QAED,gDAAgD;QAChD,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,IAAI,CAAC,WAAW,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;gBAAE,SAAS;YAC1E,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;gBACrC,UAAU,GAAG,IAAI,CAAC;gBAClB,eAAe,CAAC,GAAG,EAAE,GAAmB,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QAED,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,UAAU,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const removebgCmd: Command;
@@ -0,0 +1,40 @@
1
+ import { Command } from "commander";
2
+ import { executeRun } from "../run-helper.js";
3
+ import { resolveImage } from "../client.js";
4
+ export const removebgCmd = new Command("removebg")
5
+ .summary("Remove the background or replace it with a solid color")
6
+ .description("Remove the background or replace it with a solid color.\n\n" +
7
+ "Mask types (--mask-type):\n" +
8
+ " autoSubjectSegment Preserve the foreground subject; remove/replace background\n" +
9
+ " custom Caller-defined region via --custom-mask (PNG, same size as source, transparent=editable)\n\n" +
10
+ "Provide at least one of --bg-hex or --bg-id to set the new background.\n\n" +
11
+ "Examples:\n" +
12
+ " weshop removebg --image ./photo.png --mask-type autoSubjectSegment --bg-hex '#ffffff'\n" +
13
+ " weshop removebg --image ./photo.png --mask-type autoSubjectSegment --bg-id 3 --batch 2\n" +
14
+ " weshop removebg --image ./photo.png --mask-type custom --custom-mask ./mask.png --bg-hex '#000000'")
15
+ .requiredOption("--image <path|url>", "Source image — local file path or public URL (local files are auto-uploaded)")
16
+ .requiredOption("--mask-type <type>", "Region to preserve: autoSubjectSegment or custom")
17
+ .option("--bg-hex <color>", "Replace background with this hex color, e.g. '#ffffff' for white, '#000000' for black")
18
+ .option("--bg-id <id>", "Replace background with a preset color by ID (use 'weshop info removeBG' to list)", parseInt)
19
+ .option("--custom-mask <path|url>", "PNG mask image defining the protected region. Masked area is preserved, transparent area is editable. Must match source image dimensions")
20
+ .option("--batch <count>", "Number of images to generate, 1-16 (default: 4)", parseInt)
21
+ .option("--task-name <name>", "Human-readable label for this run")
22
+ .option("--no-wait", "Return immediately after submission; use 'weshop status <id>' to check later")
23
+ .action(async (opts) => {
24
+ const params = {
25
+ maskType: opts.maskType,
26
+ };
27
+ if (opts.bgHex)
28
+ params.backgroundHex = opts.bgHex;
29
+ if (opts.bgId)
30
+ params.backgroundId = opts.bgId;
31
+ if (opts.customMask)
32
+ params.customMaskUrl = (await resolveImage(opts.customMask)).url;
33
+ if (opts.batch)
34
+ params.batchCount = opts.batch;
35
+ const extraInput = {};
36
+ if (opts.taskName)
37
+ extraInput.taskName = opts.taskName;
38
+ await executeRun("removeBG", "v1.0", opts, params, extraInput);
39
+ });
40
+ //# sourceMappingURL=removebg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removebg.js","sourceRoot":"","sources":["../../src/commands/removebg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;KAC/C,OAAO,CAAC,wDAAwD,CAAC;KACjE,WAAW,CACV,6DAA6D;IAC7D,6BAA6B;IAC7B,qFAAqF;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AC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const statusCmd: Command;
@@ -0,0 +1,17 @@
1
+ import { Command } from "commander";
2
+ import { pollRun } from "../client.js";
3
+ import { printPollResult, printError } from "../printer.js";
4
+ export const statusCmd = new Command("status")
5
+ .description("Check the status of a run by execution ID")
6
+ .argument("<executionId>", "The execution ID returned from a run")
7
+ .action(async (executionId) => {
8
+ try {
9
+ const data = await pollRun(executionId);
10
+ printPollResult(data);
11
+ }
12
+ catch (err) {
13
+ printError(err);
14
+ process.exit(1);
15
+ }
16
+ });
17
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC3C,WAAW,CAAC,2CAA2C,CAAC;KACxD,QAAQ,CAAC,eAAe,EAAE,sCAAsC,CAAC;KACjE,MAAM,CAAC,KAAK,EAAE,WAAmB,EAAE,EAAE;IACpC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;QACxC,eAAe,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,UAAU,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const uploadCmd: Command;
@@ -0,0 +1,17 @@
1
+ import { Command } from "commander";
2
+ import { uploadImage } from "../client.js";
3
+ import { printUpload, printError } from "../printer.js";
4
+ export const uploadCmd = new Command("upload")
5
+ .description("Upload a local image and get a reusable URL")
6
+ .argument("<file>", "Path to the image file")
7
+ .action(async (file) => {
8
+ try {
9
+ const { image } = await uploadImage(file);
10
+ printUpload(image);
11
+ }
12
+ catch (err) {
13
+ printError(err);
14
+ process.exit(1);
15
+ }
16
+ });
17
+ //# sourceMappingURL=upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/commands/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC3C,WAAW,CAAC,6CAA6C,CAAC;KAC1D,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;KAC5C,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;IAC7B,IAAI,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;QAC1C,WAAW,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,UAAU,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const virtualtryonCmd: Command;
@@ -0,0 +1,56 @@
1
+ import { Command } from "commander";
2
+ import { executeRun } from "../run-helper.js";
3
+ import { resolveImage } from "../client.js";
4
+ export const virtualtryonCmd = new Command("virtualtryon")
5
+ .summary("Virtual try-on — put a garment onto a generated model with optional model/background references")
6
+ .description("Virtual try-on — put a garment onto a generated model with optional model/background references.\n\n" +
7
+ "The --image is the garment to preserve in the result.\n\n" +
8
+ "Generation version (--gen-version):\n" +
9
+ " weshopFlash Fast generation\n" +
10
+ " weshopPro High quality (supports --aspect-ratio)\n" +
11
+ " bananaPro Banana engine (requires --image-size, supports --aspect-ratio)\n\n" +
12
+ "Prompt mode (--prompt-mode):\n" +
13
+ " auto System generates the prompt automatically\n" +
14
+ " custom You provide the prompt via --prompt (required)\n\n" +
15
+ "In --prompt text, use these references:\n" +
16
+ " Figure 1 = the garment image (--image)\n" +
17
+ " Figure 2 = the model reference (--model-image)\n" +
18
+ " Figure 3 = the background reference (--location-image)\n\n" +
19
+ "Examples:\n" +
20
+ " weshop virtualtryon --image ./dress.png --gen-version weshopPro --prompt-mode auto --aspect-ratio 2:3\n" +
21
+ " weshop virtualtryon --image ./shirt.png --gen-version weshopFlash --prompt-mode custom --prompt 'Figure 1 on Figure 2 in outdoor setting'\n" +
22
+ " weshop virtualtryon --image ./jacket.png --gen-version bananaPro --prompt-mode auto --image-size 2K --model-image ./model.png")
23
+ .requiredOption("--image <path|url>", "Garment image — local file path or public URL (local files are auto-uploaded)")
24
+ .requiredOption("--gen-version <ver>", "Generation engine: weshopFlash, weshopPro, or bananaPro")
25
+ .requiredOption("--prompt-mode <type>", "Prompt mode: auto (system generates) or custom (you provide --prompt)")
26
+ .option("--prompt <text>", "Text description of desired result (required when --prompt-mode=custom). Use Figure 1/2/3 to reference images")
27
+ .option("--model-image <path|url>", "Model reference image — the generated model will resemble this person")
28
+ .option("--location-image <path|url>", "Background reference image — the generated scene will use this background")
29
+ .option("--aspect-ratio <ratio>", "Output aspect ratio (weshopPro/bananaPro only): 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9")
30
+ .option("--image-size <size>", "Output resolution (bananaPro only): 1K, 2K, or 4K")
31
+ .option("--batch <count>", "Number of images to generate, 1-16 (default: 4)", parseInt)
32
+ .option("--task-name <name>", "Human-readable label for this run")
33
+ .option("--no-wait", "Return immediately after submission; use 'weshop status <id>' to check later")
34
+ .action(async (opts) => {
35
+ const params = {
36
+ generateVersion: opts.genVersion,
37
+ descriptionType: opts.promptMode,
38
+ };
39
+ if (opts.prompt)
40
+ params.textDescription = opts.prompt;
41
+ if (opts.aspectRatio)
42
+ params.aspectRatio = opts.aspectRatio;
43
+ if (opts.imageSize)
44
+ params.imageSize = opts.imageSize;
45
+ if (opts.batch)
46
+ params.batchCount = opts.batch;
47
+ const extraInput = {};
48
+ if (opts.modelImage)
49
+ extraInput.fashionModelImage = (await resolveImage(opts.modelImage)).url;
50
+ if (opts.locationImage)
51
+ extraInput.locationImage = (await resolveImage(opts.locationImage)).url;
52
+ if (opts.taskName)
53
+ extraInput.taskName = opts.taskName;
54
+ await executeRun("virtualtryon", "v1.0", opts, params, extraInput);
55
+ });
56
+ //# sourceMappingURL=virtualtryon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtualtryon.js","sourceRoot":"","sources":["../../src/commands/virtualtryon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC;KACvD,OAAO,CAAC,iGAAiG,CAAC;KAC1G,WAAW,CACV,sGAAsG;IACtG,2DAA2D;IAC3D,uCAAuC;IACvC,mCAAmC;IACnC,0DAA0D;IAC1D,oFAAoF;IACpF,gCAAgC;IAChC,wDAAwD;IACxD,+DAA+D;IAC/D,2CAA2C;IAC3C,4CAA4C;IAC5C,oDAAoD;IACpD,8DAA8D;IAC9D,aAAa;IACb,2GAA2G;IAC3G,+IAA+I;IAC/I,iIAAiI,CAClI;KACA,cAAc,CAAC,oBAAoB,EAAE,+EAA+E,CAAC;KACrH,cAAc,CAAC,qBAAqB,EAA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,CAAC,CAAC,GAAG,CAAC;IAChG,IAAI,IAAI,CAAC,QAAQ;QAAE,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAEvD,MAAM,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AACrE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { uploadCmd } from "./commands/upload.js";
4
+ import { statusCmd } from "./commands/status.js";
5
+ import { infoCmd } from "./commands/info.js";
6
+ import { aimodelCmd } from "./commands/aimodel.js";
7
+ import { aiproductCmd } from "./commands/aiproduct.js";
8
+ import { aiposeCmd } from "./commands/aipose.js";
9
+ import { expandimageCmd } from "./commands/expandimage.js";
10
+ import { removebgCmd } from "./commands/removebg.js";
11
+ import { virtualtryonCmd } from "./commands/virtualtryon.js";
12
+ const program = new Command()
13
+ .name("weshop")
14
+ .version("0.1.0")
15
+ .addHelpCommand(false)
16
+ .description("WeShop AI — generate, edit, and transform images from the command line.\n\n" +
17
+ "Set your API key: export WESHOP_API_KEY=<key>\n" +
18
+ "Get one at: https://open.weshop.ai/authorization/apikey\n\n" +
19
+ "Run 'weshop <command> --help' to see each agent's specific parameters and usage.\n\n" +
20
+ "Examples:\n" +
21
+ " weshop upload ./photo.png\n" +
22
+ " weshop aimodel --image ./model.png --mask-type autoApparelSegment --generation-mode freeCreation --prompt 'street style'\n" +
23
+ " weshop removebg --image ./product.png --mask-type autoSubjectSegment --bg-hex '#ffffff'\n" +
24
+ " weshop status <executionId>");
25
+ program.addCommand(uploadCmd);
26
+ program.addCommand(statusCmd);
27
+ program.addCommand(infoCmd);
28
+ program.addCommand(virtualtryonCmd);
29
+ program.addCommand(aimodelCmd);
30
+ program.addCommand(aiproductCmd);
31
+ program.addCommand(aiposeCmd);
32
+ program.addCommand(expandimageCmd);
33
+ program.addCommand(removebgCmd);
34
+ program.parse();
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;KAC1B,IAAI,CAAC,QAAQ,CAAC;KACd,OAAO,CAAC,OAAO,CAAC;KAChB,cAAc,CAAC,KAAK,CAAC;KACrB,WAAW,CACV,6EAA6E;IAC7E,kDAAkD;IAClD,oEAAoE;IACpE,sFAAsF;IACtF,aAAa;IACb,+BAA+B;IAC/B,8HAA8H;IAC9H,6FAA6F;IAC7F,+BAA+B,CAChC,CAAC;AAEJ,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC9B,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAC5B,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AACpC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC/B,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC9B,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;AACnC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAEhC,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { PollResponse } from "./client.js";
2
+ export declare function printSubmitted(executionId: string): void;
3
+ export declare function printPollResult(data: PollResponse): void;
4
+ export declare function printUpload(url: string): void;
5
+ export declare function printError(err: unknown): void;
@@ -0,0 +1,38 @@
1
+ export function printSubmitted(executionId) {
2
+ console.log("[submitted]");
3
+ console.log(` executionId: ${executionId}`);
4
+ }
5
+ export function printPollResult(data) {
6
+ const exec = data.executions.at(-1);
7
+ if (!exec) {
8
+ console.log("[result]");
9
+ console.log(" status: Unknown");
10
+ console.log(" message: No execution data available");
11
+ return;
12
+ }
13
+ console.log("[result]");
14
+ console.log(` agent: ${data.agentName} ${data.agentVersion}`);
15
+ console.log(` executionId: ${exec.executionId}`);
16
+ console.log(` status: ${exec.status}`);
17
+ if (exec.status === "Failed") {
18
+ console.log(" message: Generation failed");
19
+ }
20
+ if (exec.result.length) {
21
+ console.log(` imageCount: ${exec.result.length}`);
22
+ exec.result.forEach((r, i) => {
23
+ console.log(` image[${i}]:`);
24
+ console.log(` status: ${r.status}`);
25
+ console.log(` url: ${r.image ?? ""}`);
26
+ });
27
+ }
28
+ }
29
+ export function printUpload(url) {
30
+ console.log("[uploaded]");
31
+ console.log(` imageUrl: ${url}`);
32
+ }
33
+ export function printError(err) {
34
+ const msg = err instanceof Error ? err.message : String(err);
35
+ console.error("[error]");
36
+ console.error(` message: ${msg}`);
37
+ }
38
+ //# sourceMappingURL=printer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"printer.js","sourceRoot":"","sources":["../src/printer.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,OAAO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AC,YAAY,CAAC,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAY;IACrC,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACzB,OAAO,CAAC,KAAK,CAAC,cAAc,GAAG,EAAE,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface RunOptions {
2
+ image: string;
3
+ wait?: boolean;
4
+ }
5
+ export declare function executeRun(agentName: string, agentVersion: string, opts: RunOptions, params: Record<string, unknown>, extraInput?: Record<string, unknown>): Promise<void>;
@@ -0,0 +1,29 @@
1
+ import { resolveImage, submitRun, waitForCompletion } from "./client.js";
2
+ import { printSubmitted, printPollResult, printError } from "./printer.js";
3
+ export async function executeRun(agentName, agentVersion, opts, params, extraInput = {}) {
4
+ try {
5
+ const { url: imageUrl } = await resolveImage(opts.image);
6
+ console.log("[image]");
7
+ console.log(` imageUrl: ${imageUrl}`);
8
+ const body = {
9
+ agent: { name: agentName, version: agentVersion },
10
+ input: { originalImage: imageUrl, ...extraInput },
11
+ params,
12
+ };
13
+ const { executionId } = await submitRun(body);
14
+ printSubmitted(executionId);
15
+ if (opts.wait !== false) {
16
+ const data = await waitForCompletion(executionId);
17
+ printPollResult(data);
18
+ }
19
+ else {
20
+ console.log("[info]");
21
+ console.log(` message: Use 'weshop status ${executionId}' to check progress`);
22
+ }
23
+ }
24
+ catch (err) {
25
+ printError(err);
26
+ process.exit(1);
27
+ }
28
+ }
29
+ //# sourceMappingURL=run-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-helper.js","sourceRoot":"","sources":["../src/run-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAmB,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO3E,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,SAAiB,EACjB,YAAoB,EACpB,IAAgB,EAChB,MAA+B,EAC/B,aAAsC,EAAE;IAExC,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,eAAe,QAAQ,EAAE,CAAC,CAAC;QAEvC,MAAM,IAAI,GAAe;YACvB,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE;YACjD,KAAK,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE;YACjD,MAAM;SACP,CAAC;QAEF,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9C,cAAc,CAAC,WAAW,CAAC,CAAC;QAE5B,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,CAAC;YAClD,eAAe,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,iCAAiC,WAAW,qBAAqB,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,UAAU,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "weshop-cli",
3
+ "version": "0.1.0",
4
+ "description": "CLI & Agent tool for WeShop AI — virtual try-on, model swap, background replace, pose change, and more",
5
+ "type": "module",
6
+ "bin": {
7
+ "weshop": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "prepublishOnly": "npm run build",
17
+ "dev": "tsx src/index.ts",
18
+ "start": "node dist/index.js"
19
+ },
20
+ "keywords": [
21
+ "weshop",
22
+ "ai",
23
+ "image-generation",
24
+ "virtual-try-on",
25
+ "fashion",
26
+ "cli",
27
+ "agent"
28
+ ],
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/weshopai/weshop-cli.git"
32
+ },
33
+ "license": "Apache-2.0",
34
+ "dependencies": {
35
+ "commander": "^12.1.0",
36
+ "form-data": "^4.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^20.14.0",
40
+ "tsx": "^4.15.0",
41
+ "typescript": "^5.5.0"
42
+ }
43
+ }