@drawcall/market 0.1.49 → 0.1.51
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/README.md +4 -1
- package/dist/cli.js +46 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/generate-install.d.ts +6 -0
- package/dist/commands/generate-install.d.ts.map +1 -0
- package/dist/commands/generate-install.js +29 -0
- package/dist/commands/generate-install.js.map +1 -0
- package/dist/commands/generate.d.ts +13 -0
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +57 -20
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/pack.d.ts +14 -0
- package/dist/commands/pack.d.ts.map +1 -0
- package/dist/commands/pack.js +39 -0
- package/dist/commands/pack.js.map +1 -0
- package/dist/commands/upload.d.ts +0 -12
- package/dist/commands/upload.d.ts.map +1 -1
- package/dist/commands/upload.js +14 -187
- package/dist/commands/upload.js.map +1 -1
- package/dist/generate.d.ts +14 -6
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +30 -19
- package/dist/generate.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/output.d.ts +4 -0
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +34 -0
- package/dist/output.js.map +1 -1
- package/dist/pack.d.ts +48 -0
- package/dist/pack.d.ts.map +1 -0
- package/dist/pack.js +265 -0
- package/dist/pack.js.map +1 -0
- package/dist/skill.d.ts +1 -1
- package/dist/skill.d.ts.map +1 -1
- package/dist/skill.js +3 -2
- package/dist/skill.js.map +1 -1
- package/package.json +3 -2
- package/skills/market/SKILL.md +3 -2
- package/src/cli.ts +61 -4
- package/src/commands/agent.ts +1 -1
- package/src/commands/generate-install.ts +36 -0
- package/src/commands/generate.ts +77 -30
- package/src/commands/pack.ts +55 -0
- package/src/commands/upload.ts +14 -219
- package/src/generate.ts +43 -31
- package/src/index.ts +2 -2
- package/src/output.ts +38 -0
- package/src/pack.ts +348 -0
- package/src/skill.ts +3 -2
package/dist/pack.js
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { unzipSync, zipSync } from 'fflate';
|
|
4
|
+
import ignore from 'ignore';
|
|
5
|
+
import { findInstallRoot } from './install.js';
|
|
6
|
+
import { readMarketLock, sha256 } from './market-lock.js';
|
|
7
|
+
import { packageJsonAssetDependenciesFromFiles, packageJsonNpmDependenciesFromFiles, } from './package-json.js';
|
|
8
|
+
import { MAX_UPLOAD_ZIP_SIZE_BYTES } from './schemas.js';
|
|
9
|
+
export async function packAsset(zipFilter, opts) {
|
|
10
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
11
|
+
const zipFile = await resolveOneZipFile(cwd, zipFilter);
|
|
12
|
+
const zipStat = await fs.stat(zipFile);
|
|
13
|
+
if (zipStat.size >= MAX_UPLOAD_ZIP_SIZE_BYTES) {
|
|
14
|
+
throw new Error('Packed zip must be smaller than 1 GB');
|
|
15
|
+
}
|
|
16
|
+
const sourceZip = new Uint8Array(await fs.readFile(zipFile));
|
|
17
|
+
const sourceFiles = unzipSync(sourceZip);
|
|
18
|
+
const policy = opts.policy ?? inferPackPolicy(sourceFiles);
|
|
19
|
+
const packageJsonAssetDependencies = policy.readPackageJsonDependencies
|
|
20
|
+
? packageJsonAssetDependenciesFromFiles(sourceFiles)
|
|
21
|
+
: {};
|
|
22
|
+
const assetDependencies = mergeAssetDependencies(packageJsonAssetDependencies, opts.dependencies.assetDependencies);
|
|
23
|
+
const packageJsonNpmDependencies = policy.readPackageJsonDependencies
|
|
24
|
+
? packageJsonNpmDependenciesFromFiles(sourceFiles)
|
|
25
|
+
: {};
|
|
26
|
+
const npmDependencies = { ...packageJsonNpmDependencies, ...opts.dependencies.npmDependencies };
|
|
27
|
+
// Drop anything the zip's own .gitignore excludes (node_modules, build output, secrets…), then —
|
|
28
|
+
// for templates — omit unchanged installed dependency files. Only removals happen, so a smaller
|
|
29
|
+
// count means something was dropped; re-zip only then.
|
|
30
|
+
const withoutIgnored = applyGitignore(sourceFiles);
|
|
31
|
+
const files = policy.omitUnchangedInstalledFiles
|
|
32
|
+
? await withoutUnchangedInstalledFiles(withoutIgnored, assetDependencies, cwd)
|
|
33
|
+
: withoutIgnored;
|
|
34
|
+
const sourceCount = Object.keys(sourceFiles).length;
|
|
35
|
+
const afterIgnoreCount = Object.keys(withoutIgnored).length;
|
|
36
|
+
const finalCount = Object.keys(files).length;
|
|
37
|
+
return {
|
|
38
|
+
sourcePath: zipFile,
|
|
39
|
+
zip: finalCount < sourceCount ? zipSync(files) : sourceZip,
|
|
40
|
+
npmDependencies,
|
|
41
|
+
assetDependencies,
|
|
42
|
+
skillDependencies: opts.dependencies.skillDependencies,
|
|
43
|
+
omittedUnchangedInstalledFiles: finalCount < afterIgnoreCount,
|
|
44
|
+
gitignoredFiles: sourceCount - afterIgnoreCount,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const GITIGNORE_FILENAME = '.gitignore';
|
|
48
|
+
/**
|
|
49
|
+
* Drop every zip entry excluded by a `.gitignore` inside the zip. `.gitignore` files are applied
|
|
50
|
+
* per-directory (git semantics: a nested `.gitignore` only affects its own subtree), so a naively
|
|
51
|
+
* built asset zip never ships `node_modules`, build output, or secrets.
|
|
52
|
+
*/
|
|
53
|
+
function applyGitignore(files) {
|
|
54
|
+
const matchers = gitignoreMatchers(files);
|
|
55
|
+
if (matchers.length === 0)
|
|
56
|
+
return files;
|
|
57
|
+
const kept = {};
|
|
58
|
+
for (const [name, content] of Object.entries(files)) {
|
|
59
|
+
if (!isGitignored(name, matchers))
|
|
60
|
+
kept[name] = content;
|
|
61
|
+
}
|
|
62
|
+
return kept;
|
|
63
|
+
}
|
|
64
|
+
function gitignoreMatchers(files) {
|
|
65
|
+
const matchers = [];
|
|
66
|
+
for (const [name, content] of Object.entries(files)) {
|
|
67
|
+
if (path.posix.basename(name) !== GITIGNORE_FILENAME)
|
|
68
|
+
continue;
|
|
69
|
+
const dir = name.slice(0, name.length - GITIGNORE_FILENAME.length);
|
|
70
|
+
matchers.push({ dir, filter: ignore().add(new TextDecoder().decode(content)) });
|
|
71
|
+
}
|
|
72
|
+
return matchers;
|
|
73
|
+
}
|
|
74
|
+
function isGitignored(name, matchers) {
|
|
75
|
+
// fflate keeps directory entries with a trailing slash; the `ignore` lib matches directory patterns
|
|
76
|
+
// (`dist/`) against exactly that form, so the path is passed through unchanged.
|
|
77
|
+
return matchers.some((matcher) => {
|
|
78
|
+
if (!name.startsWith(matcher.dir))
|
|
79
|
+
return false;
|
|
80
|
+
const relative = name.slice(matcher.dir.length);
|
|
81
|
+
return relative.length > 0 && matcher.filter.ignores(relative);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export function parsePackDependencies(specs) {
|
|
85
|
+
return {
|
|
86
|
+
npmDependencies: parseVersionedDeps(specs.npm ?? [], 'npm'),
|
|
87
|
+
assetDependencies: parseVersionedDeps(specs.asset ?? [], 'asset'),
|
|
88
|
+
skillDependencies: parseSkillDeps(specs.skill ?? []),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export function packPolicyForType(type) {
|
|
92
|
+
if (!type)
|
|
93
|
+
return undefined;
|
|
94
|
+
return {
|
|
95
|
+
readPackageJsonDependencies: type === 'template',
|
|
96
|
+
omitUnchangedInstalledFiles: type === 'template',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export function packPolicyFromInstallMetadata(metadata) {
|
|
100
|
+
return {
|
|
101
|
+
readPackageJsonDependencies: metadata?.readAssetDependenciesFromPackageJson ?? false,
|
|
102
|
+
omitUnchangedInstalledFiles: metadata?.omitUnchangedInstalledFilesOnUpload ?? false,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Parse `name@range` specs (npm or asset deps) into a name→range record. The
|
|
107
|
+
* range is optional and defaults to `*`. A leading `@` is treated as a scope
|
|
108
|
+
* marker, so `@scope/pkg@^1.0.0` splits into `@scope/pkg` and `^1.0.0`.
|
|
109
|
+
*/
|
|
110
|
+
export function parseVersionedDeps(specs, kind) {
|
|
111
|
+
const out = {};
|
|
112
|
+
for (const spec of specs) {
|
|
113
|
+
const at = spec.lastIndexOf('@');
|
|
114
|
+
const hasRange = at > 0;
|
|
115
|
+
const name = hasRange ? spec.slice(0, at) : spec;
|
|
116
|
+
const range = hasRange ? spec.slice(at + 1) : '*';
|
|
117
|
+
if (!name || !range) {
|
|
118
|
+
throw new Error(`Invalid ${kind} dependency "${spec}". Use name@range (e.g. three@^0.178.0).`);
|
|
119
|
+
}
|
|
120
|
+
if (name in out) {
|
|
121
|
+
throw new Error(`Duplicate ${kind} dependency "${name}".`);
|
|
122
|
+
}
|
|
123
|
+
out[name] = range;
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Parse `label=source` specs into a label→source record. The source is passed
|
|
129
|
+
* verbatim to `skills add` (a GitHub/git ref or a local path), so only the
|
|
130
|
+
* first `=` is treated as the separator.
|
|
131
|
+
*/
|
|
132
|
+
export function parseSkillDeps(specs) {
|
|
133
|
+
const out = {};
|
|
134
|
+
for (const spec of specs) {
|
|
135
|
+
const eq = spec.indexOf('=');
|
|
136
|
+
if (eq <= 0 || eq === spec.length - 1) {
|
|
137
|
+
throw new Error(`Invalid skill dependency "${spec}". Use label=source ` +
|
|
138
|
+
`(e.g. web-design=vercel-labs/agent-skills).`);
|
|
139
|
+
}
|
|
140
|
+
const label = spec.slice(0, eq);
|
|
141
|
+
if (label in out) {
|
|
142
|
+
throw new Error(`Duplicate skill dependency "${label}".`);
|
|
143
|
+
}
|
|
144
|
+
out[label] = spec.slice(eq + 1);
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
function mergeAssetDependencies(fromPackageJson, explicit) {
|
|
149
|
+
const merged = { ...fromPackageJson };
|
|
150
|
+
for (const [name, range] of Object.entries(explicit)) {
|
|
151
|
+
if (name in merged && merged[name] !== range) {
|
|
152
|
+
throw new Error(`Conflicting asset dependency "${name}": package.json has ${merged[name]}, --asset has ${range}`);
|
|
153
|
+
}
|
|
154
|
+
merged[name] = range;
|
|
155
|
+
}
|
|
156
|
+
return merged;
|
|
157
|
+
}
|
|
158
|
+
function inferPackPolicy(files) {
|
|
159
|
+
const hasRootPackageJson = Boolean(files['package.json']);
|
|
160
|
+
return {
|
|
161
|
+
readPackageJsonDependencies: hasRootPackageJson,
|
|
162
|
+
omitUnchangedInstalledFiles: hasRootPackageJson,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
// Drop dependency files whose bytes still match what `.drawcall/market-lock.json` recorded as
|
|
166
|
+
// installed, so a template ships only its own (edited or new) files. Returns the surviving entries.
|
|
167
|
+
async function withoutUnchangedInstalledFiles(files, assetDependencies, cwd) {
|
|
168
|
+
const dependencyNames = new Set(Object.keys(assetDependencies));
|
|
169
|
+
if (dependencyNames.size === 0)
|
|
170
|
+
return files;
|
|
171
|
+
const installRoot = await findInstallRoot(cwd);
|
|
172
|
+
const lock = await readMarketLock(installRoot);
|
|
173
|
+
const hashesByPath = new Map();
|
|
174
|
+
for (const [name, asset] of Object.entries(lock.assets)) {
|
|
175
|
+
if (!dependencyNames.has(name))
|
|
176
|
+
continue;
|
|
177
|
+
for (const [file, metadata] of Object.entries(asset.files)) {
|
|
178
|
+
hashesByPath.set(file, metadata.sha256);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (hashesByPath.size === 0)
|
|
182
|
+
return files;
|
|
183
|
+
const kept = {};
|
|
184
|
+
for (const [file, content] of Object.entries(files)) {
|
|
185
|
+
const normalizedPath = normalizedZipPath(file);
|
|
186
|
+
const lockedHash = normalizedPath ? hashesByPath.get(normalizedPath) : undefined;
|
|
187
|
+
if (lockedHash && lockedHash === sha256(content))
|
|
188
|
+
continue;
|
|
189
|
+
kept[file] = content;
|
|
190
|
+
}
|
|
191
|
+
return kept;
|
|
192
|
+
}
|
|
193
|
+
function normalizedZipPath(file) {
|
|
194
|
+
const zipPath = file.replace(/\\/g, '/');
|
|
195
|
+
if (zipPath.split('/').includes('..') ||
|
|
196
|
+
path.posix.isAbsolute(zipPath) ||
|
|
197
|
+
path.win32.isAbsolute(zipPath)) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
return path.posix.normalize(zipPath);
|
|
201
|
+
}
|
|
202
|
+
async function resolveOneZipFile(cwd, zipFilter) {
|
|
203
|
+
const absolute = path.resolve(cwd, zipFilter);
|
|
204
|
+
const stat = await maybeStat(absolute);
|
|
205
|
+
if (stat?.isFile())
|
|
206
|
+
return assertZipFile(absolute);
|
|
207
|
+
const files = await listFiles(cwd);
|
|
208
|
+
const matches = files
|
|
209
|
+
.filter((file) => matchesFilter(path.relative(cwd, file), zipFilter))
|
|
210
|
+
.filter(isZipFile)
|
|
211
|
+
.sort();
|
|
212
|
+
if (matches.length === 0) {
|
|
213
|
+
throw new Error(`No .zip files matched "${zipFilter}"`);
|
|
214
|
+
}
|
|
215
|
+
if (matches.length > 1) {
|
|
216
|
+
throw new Error(`File filter matched ${matches.length} zips; pack one asset at a time`);
|
|
217
|
+
}
|
|
218
|
+
return matches[0];
|
|
219
|
+
}
|
|
220
|
+
function assertZipFile(file) {
|
|
221
|
+
if (!isZipFile(file))
|
|
222
|
+
throw new Error(`Pack source must be a .zip: ${file}`);
|
|
223
|
+
return file;
|
|
224
|
+
}
|
|
225
|
+
function isZipFile(file) {
|
|
226
|
+
return /\.zip$/i.test(file);
|
|
227
|
+
}
|
|
228
|
+
async function maybeStat(file) {
|
|
229
|
+
try {
|
|
230
|
+
return await fs.stat(file);
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
async function listFiles(dir) {
|
|
237
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
238
|
+
const files = [];
|
|
239
|
+
for (const entry of entries) {
|
|
240
|
+
if (entry.name === 'node_modules' || entry.name === '.git')
|
|
241
|
+
continue;
|
|
242
|
+
const fullPath = path.join(dir, entry.name);
|
|
243
|
+
if (entry.isDirectory()) {
|
|
244
|
+
files.push(...(await listFiles(fullPath)));
|
|
245
|
+
}
|
|
246
|
+
else if (entry.isFile()) {
|
|
247
|
+
files.push(fullPath);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return files;
|
|
251
|
+
}
|
|
252
|
+
function matchesFilter(file, filter) {
|
|
253
|
+
const normalizedFile = file.split(path.sep).join('/');
|
|
254
|
+
const normalizedFilter = filter.split(path.sep).join('/');
|
|
255
|
+
const pattern = '^' +
|
|
256
|
+
escapeRegExp(normalizedFilter)
|
|
257
|
+
.replace(/\\\*\\\*/g, '.*')
|
|
258
|
+
.replace(/\\\*/g, '[^/]*') +
|
|
259
|
+
'$';
|
|
260
|
+
return new RegExp(pattern).test(normalizedFile);
|
|
261
|
+
}
|
|
262
|
+
function escapeRegExp(s) {
|
|
263
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=pack.js.map
|
package/dist/pack.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.js","sourceRoot":"","sources":["../src/pack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EACL,qCAAqC,EACrC,mCAAmC,GACpC,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, and publish Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\nUse the `market` CLI. Keep commands short and read the summary lines.\n\n## Quick Start\n\n```sh\nmarket search \"wooden chair\" --type model --limit 3\nmarket install wooden-chair --cwd \"$PWD\"\nmarket list --cwd \"$PWD\"\nmarket preview wooden-chair --out /tmp/wooden-chair.png\n```\n\n## Workflow\n\n1. In an existing repo, run `list --cwd \"$PWD\"` first to see installed local assets from `.drawcall/market-lock.json`. Use the listed names with `preview <name>` when you want preview images.\n2. Search first unless the user already gave an exact asset name. `search` requires `--type`; use `model` unless the user names another supported type: `humanoid-model`, `texture`, `humanoid-animation`, `template`, `sound-effect`, `background-music`, `environment`, or `flipbook`.\n3. Use `--limit 1` for lookup, `--limit 3` for choice. Search caps at 5 and prints full descriptions.\n4. `install` takes zero or more exact asset names (optionally `name@range`). With names, it installs those assets; with no names, it installs `assetDependencies` from the nearest `package.json`. It does not search or generate. Find names with `search` first. No `--type` is needed \u2014 asset names are unique. Use `--force` only when the user agrees to overwrite changed local files.\n5. `preview <name>` saves the preview image; no `--type` is needed. Not every type has previews (e.g. `humanoid-animation`, `template`, `sound-effect`, `background-music`); the CLI reports when one is unavailable.\n6. Use `--unapproved` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.\n7. `generate --type <type> \"<prompt>\"` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are `sound-effect`, `background-music`, `flipbook`, `humanoid-model`, and `environment` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add `--access public` to publish the generated asset publicly, or `--access private` to keep it owner-only; when omitted the server defaults to private if you hold the `market:private` entitlement, else public (`--access private` requires that entitlement).\n8.
|
|
1
|
+
export declare const marketSkill = "---\nname: market\ndescription: Find, preview, install, generate, and publish Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\nUse the `market` CLI. Keep commands short and read the summary lines.\n\n## Quick Start\n\n```sh\nmarket search \"wooden chair\" --type model --limit 3\nmarket install wooden-chair --cwd \"$PWD\"\nmarket list --cwd \"$PWD\"\nmarket preview wooden-chair --out /tmp/wooden-chair.png\nmarket pack scene.zip --out scene.packed.zip\n```\n\n## Workflow\n\n1. In an existing repo, run `list --cwd \"$PWD\"` first to see installed local assets from `.drawcall/market-lock.json`. Use the listed names with `preview <name>` when you want preview images.\n2. Search first unless the user already gave an exact asset name. `search` requires `--type`; use `model` unless the user names another supported type: `humanoid-model`, `texture`, `humanoid-animation`, `template`, `sound-effect`, `background-music`, `environment`, or `flipbook`.\n3. Use `--limit 1` for lookup, `--limit 3` for choice. Search caps at 5 and prints full descriptions.\n4. `install` takes zero or more exact asset names (optionally `name@range`). With names, it installs those assets; with no names, it installs `assetDependencies` from the nearest `package.json`. It does not search or generate. Find names with `search` first. No `--type` is needed \u2014 asset names are unique. Use `--force` only when the user agrees to overwrite changed local files.\n5. `preview <name>` saves the preview image; no `--type` is needed. Not every type has previews (e.g. `humanoid-animation`, `template`, `sound-effect`, `background-music`); the CLI reports when one is unavailable.\n6. Use `--unapproved` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.\n7. `generate --type <type> \"<prompt>\"` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are `sound-effect`, `background-music`, `flipbook`, `humanoid-model`, and `environment` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add `--access public` to publish the generated asset publicly, or `--access private` to keep it owner-only; when omitted the server defaults to private if you hold the `market:private` entitlement, else public (`--access private` requires that entitlement). `generate` waits for the asset and installs it \u2014 one command for quick types. For a long one (e.g. `humanoid-model`, >2 min) the call returns after ~2 min with a job id instead of hanging your shell; run `market generate install <jobId>` to continue \u2014 it resumes the SAME job where the last call left off and installs when ready. Just re-run `generate install <jobId>` until it prints \"Generated and installed\" (it exits 0 while still generating, 1 on failure). No type is flagged \"slow\" \u2014 anything that outlasts one wait just continues on the next call.\n8. Use `pack <zip>` to create the same Market asset zip that `upload` sends. `pack` runs offline, infers template packing from a root `package.json`, and accepts `--type` only when you need to override that inference. `upload` runs the shared pack step internally, then publishes: `market upload <name> <zip> \"<description>\" --type <type>`. Declare dependencies with repeatable flags on either command: `--npm name@range`, `--asset name@range`, `--skill label=source`. Template pack/upload also reads root `package.json.assetDependencies`; `--asset` flags are additive and must not conflict. Template pack/upload omits installed dependency files whose hashes still match `.drawcall/market-lock.json`, so edited local files stay in the template. A skill source is a `skills add` argument: a whole repo (`owner/repo` or a git URL), a single skill via the full URL form `https://github.com/owner/repo/tree/<branch>/<subpath>` (the `tree/<branch>/<subpath>` shorthand needs the full URL, not `owner/repo`), or a local path to a skill directory inside the zip. Example: `market upload my-scene scene.zip \"A scene\" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines`.\n9. Installed `environment` assets contain `public/environment/<name>.hdr` for Three.js IBL lighting and `public/environment/<name>-background.webp` for the visible equirectangular background. Use `market preview` to fetch the preview image separately.\n10. Installed `flipbook` assets contain `public/flipbook/<name>.ktx2`. Render them with `@drawcall/flipbook`'s `Flipbook` class and Three.js `KTX2Loader` for Basis-compressed files; `market preview` fetches the middle frame from the flipbook.\n\n## Humanoid animations\n\n`humanoid-animation` assets are single-clip GLBs \u2014 one motion per asset (one idle, one walk-forward, one jump, one attack) on a normalized skeleton that retargets onto any humanoid, whatever its role. A behaving character is therefore a *set* of clips, not one asset: from what the character actually does, budget the clips it needs \u2014 an idle, its locomotion (walk/run, often split by direction: fwd/bwd/left/right), and one clip per distinct action and reaction it performs \u2014 then search for each separately.\n\n`humanoid-model` assets share that same normalized skeleton and are authored to a **consistent real-world scale** \u2014 they come in at roughly the same height as each other. So you do **not** need to rescale one humanoid to match another (player vs. enemy vs. NPC); dropped in as-is they already stand at a consistent size. Avoid the trap of measuring one character's height and scaling others to it \u2014 besides being unnecessary, measuring a rigged/animated character's bounding box is unreliable and produces giants (see the `math` skill on `Box3` and skinned meshes). If you ever do need a deliberate size difference (a boss, a child NPC), apply an explicit chosen multiplier, not a measured one.\n\nSearch one motion per query, named by the motion, because results rank by keyword overlap: a query naming several motions at once is dominated by whichever word matches the most assets and buries the others, so real clips look like a gap when they exist. Names describe the motion, not the character \u2014 so search the motion (`\"walk forward\"`, `\"reload\"`, `\"jump\"`), not the role (`\"player run\"`, `\"boss attack\"`). If a motion finds nothing, retry with synonyms (run/jog/sprint, attack/swing/strike).\n\n## Output\n\nCommands print concise, line-oriented summaries:\n\n```text\nResults: 2/8 query=\"wooden chair\" type=model approval=approved\n- wooden-chair@1.0.0 | model | approved | Low-poly wooden chair\nInstalled:\n- wooden-chair@1.0.0 (asset)\n description: Low-poly wooden chair\n files:\n public/model\n \u2514\u2500 wooden-chair.glb\n- three@^0.178.0 (npm)\n- web-design \u2190 https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines (skill)\nInstalled assets: 1\n- wooden-chair@1.0.0 (model)\n files:\n public/model\n \u2514\u2500 wooden-chair.glb\nSaved preview for wooden-chair@1.0.0: /tmp/wooden-chair.png\n```\n\nAssets may also declare `skill` dependencies, installed for you via the `skills` CLI (`skills add`) during `install`. Sources are either a GitHub/git ref or a local path to a skill directory shipped inside the asset. This requires `npx` to be available.\n\nInstalled non-template assets are saved to `package.json.assetDependencies`; templates are scaffolds and are not saved as project asset dependencies. Exact installed versions and file hashes are recorded in `.drawcall/market-lock.json`.\n\n`list` is offline: it reads `.drawcall/market-lock.json` from the nearest package root and prints exact installed names, versions, types, and installed file paths.\n\nIf search returns no results, try one broader noun phrase. If a command returns `Error: Not logged in...`, ask before running `market login`.\n";
|
|
2
2
|
//# sourceMappingURL=skill.d.ts.map
|
package/dist/skill.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,yhQAsEvB,CAAA"}
|
package/dist/skill.js
CHANGED
|
@@ -14,6 +14,7 @@ market search "wooden chair" --type model --limit 3
|
|
|
14
14
|
market install wooden-chair --cwd "$PWD"
|
|
15
15
|
market list --cwd "$PWD"
|
|
16
16
|
market preview wooden-chair --out /tmp/wooden-chair.png
|
|
17
|
+
market pack scene.zip --out scene.packed.zip
|
|
17
18
|
\`\`\`
|
|
18
19
|
|
|
19
20
|
## Workflow
|
|
@@ -24,8 +25,8 @@ market preview wooden-chair --out /tmp/wooden-chair.png
|
|
|
24
25
|
4. \`install\` takes zero or more exact asset names (optionally \`name@range\`). With names, it installs those assets; with no names, it installs \`assetDependencies\` from the nearest \`package.json\`. It does not search or generate. Find names with \`search\` first. No \`--type\` is needed — asset names are unique. Use \`--force\` only when the user agrees to overwrite changed local files.
|
|
25
26
|
5. \`preview <name>\` saves the preview image; no \`--type\` is needed. Not every type has previews (e.g. \`humanoid-animation\`, \`template\`, \`sound-effect\`, \`background-music\`); the CLI reports when one is unavailable.
|
|
26
27
|
6. Use \`--unapproved\` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.
|
|
27
|
-
7. \`generate --type <type> "<prompt>"\` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are \`sound-effect\`, \`background-music\`, \`flipbook\`, \`humanoid-model\`, and \`environment\` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add \`--access public\` to publish the generated asset publicly, or \`--access private\` to keep it owner-only; when omitted the server defaults to private if you hold the \`market:private\` entitlement, else public (\`--access private\` requires that entitlement).
|
|
28
|
-
8.
|
|
28
|
+
7. \`generate --type <type> "<prompt>"\` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are \`sound-effect\`, \`background-music\`, \`flipbook\`, \`humanoid-model\`, and \`environment\` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add \`--access public\` to publish the generated asset publicly, or \`--access private\` to keep it owner-only; when omitted the server defaults to private if you hold the \`market:private\` entitlement, else public (\`--access private\` requires that entitlement). \`generate\` waits for the asset and installs it — one command for quick types. For a long one (e.g. \`humanoid-model\`, >2 min) the call returns after ~2 min with a job id instead of hanging your shell; run \`market generate install <jobId>\` to continue — it resumes the SAME job where the last call left off and installs when ready. Just re-run \`generate install <jobId>\` until it prints "Generated and installed" (it exits 0 while still generating, 1 on failure). No type is flagged "slow" — anything that outlasts one wait just continues on the next call.
|
|
29
|
+
8. Use \`pack <zip>\` to create the same Market asset zip that \`upload\` sends. \`pack\` runs offline, infers template packing from a root \`package.json\`, and accepts \`--type\` only when you need to override that inference. \`upload\` runs the shared pack step internally, then publishes: \`market upload <name> <zip> "<description>" --type <type>\`. Declare dependencies with repeatable flags on either command: \`--npm name@range\`, \`--asset name@range\`, \`--skill label=source\`. Template pack/upload also reads root \`package.json.assetDependencies\`; \`--asset\` flags are additive and must not conflict. Template pack/upload omits installed dependency files whose hashes still match \`.drawcall/market-lock.json\`, so edited local files stay in the template. A skill source is a \`skills add\` argument: a whole repo (\`owner/repo\` or a git URL), a single skill via the full URL form \`https://github.com/owner/repo/tree/<branch>/<subpath>\` (the \`tree/<branch>/<subpath>\` shorthand needs the full URL, not \`owner/repo\`), or a local path to a skill directory inside the zip. Example: \`market upload my-scene scene.zip "A scene" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines\`.
|
|
29
30
|
9. Installed \`environment\` assets contain \`public/environment/<name>.hdr\` for Three.js IBL lighting and \`public/environment/<name>-background.webp\` for the visible equirectangular background. Use \`market preview\` to fetch the preview image separately.
|
|
30
31
|
10. Installed \`flipbook\` assets contain \`public/flipbook/<name>.ktx2\`. Render them with \`@drawcall/flipbook\`'s \`Flipbook\` class and Three.js \`KTX2Loader\` for Basis-compressed files; \`market preview\` fetches the middle frame from the flipbook.
|
|
31
32
|
|
package/dist/skill.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsE1B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawcall/market",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.51",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/drawcall-ai/market",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc",
|
|
38
38
|
"dev": "tsx src/cli.ts",
|
|
39
|
-
"test:install-layout": "tsx --test tests/install-layout.test.ts tests/install-command.test.ts tests/list-command.test.ts",
|
|
39
|
+
"test:install-layout": "tsx --test tests/install-layout.test.ts tests/install-command.test.ts tests/list-command.test.ts tests/pack.test.ts",
|
|
40
40
|
"typecheck": "tsc --noEmit"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"chalk": "^5.6.2",
|
|
46
46
|
"commander": "^14.0.3",
|
|
47
47
|
"fflate": "^0.8.2",
|
|
48
|
+
"ignore": "^7.0.5",
|
|
48
49
|
"nypm": "^0.6.0",
|
|
49
50
|
"open": "^10.1.0",
|
|
50
51
|
"openid-client": "^6.8.4",
|
package/skills/market/SKILL.md
CHANGED
|
@@ -14,6 +14,7 @@ npx @drawcall/market search "wooden chair" --type model --limit 3
|
|
|
14
14
|
npx @drawcall/market install wooden-chair --cwd "$PWD"
|
|
15
15
|
npx @drawcall/market list --cwd "$PWD"
|
|
16
16
|
npx @drawcall/market preview wooden-chair --out /tmp/wooden-chair.png
|
|
17
|
+
npx @drawcall/market pack scene.zip --out scene.packed.zip
|
|
17
18
|
```
|
|
18
19
|
|
|
19
20
|
## Workflow
|
|
@@ -24,8 +25,8 @@ npx @drawcall/market preview wooden-chair --out /tmp/wooden-chair.png
|
|
|
24
25
|
4. `install` takes zero or more exact asset names (optionally `name@range`). With names, it installs those assets; with no names, it installs `assetDependencies` from the nearest `package.json`. It does not search or generate. Find names with `search` first. No `--type` is needed — asset names are unique. Use `--force` only when the user agrees to overwrite changed local files.
|
|
25
26
|
5. `preview <name>` saves the preview image; no `--type` is needed. Not every type has previews (e.g. `humanoid-animation`, `template`, `sound-effect`, `background-music`); the CLI reports when one is unavailable.
|
|
26
27
|
6. Use `--unapproved` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.
|
|
27
|
-
7. `generate --type <type> "<prompt>"` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are `sound-effect`, `background-music`, `flipbook`, `humanoid-model`, and `environment` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add `--access public` to publish the generated asset publicly, or `--access private` to keep it owner-only; when omitted the server defaults to private if you hold the `market:private` entitlement, else public (`--access private` requires that entitlement).
|
|
28
|
-
8.
|
|
28
|
+
7. `generate --type <type> "<prompt>"` creates and installs a generated asset when that asset type has a generator; it requires login. Currently supported generated types are `sound-effect`, `background-music`, `flipbook`, `humanoid-model`, and `environment` (a fitting HDRI sky + equirectangular background, generated in ~1-2 min). Generation is provider-specific: prompt style, generated files, indexing fields, and install layout are owned by the asset type. If a type does not support generation yet, the CLI reports unsupported generation. Add `--access public` to publish the generated asset publicly, or `--access private` to keep it owner-only; when omitted the server defaults to private if you hold the `market:private` entitlement, else public (`--access private` requires that entitlement). `generate` waits for the asset and installs it — one command for quick types. For a long one (e.g. `humanoid-model`, >2 min) the call returns after ~2 min with a job id instead of hanging your shell; run `market generate install <jobId>` to continue — it resumes the SAME job where the last call left off and installs when ready. Just re-run `generate install <jobId>` until it prints "Generated and installed" (it exits 0 while still generating, 1 on failure). No type is flagged "slow" — anything that outlasts one wait just continues on the next call.
|
|
29
|
+
8. Use `pack <zip>` to create the same Market asset zip that `upload` sends. `pack` runs offline, infers template packing from a root `package.json`, and accepts `--type` only when you need to override that inference. `upload` runs the shared pack step internally, then publishes: `market upload <name> <zip> "<description>" --type <type>`. Declare dependencies with repeatable flags on either command: `--npm name@range`, `--asset name@range`, `--skill label=source`. Use `--access public|private` on upload to set visibility (same default rule as generate): a private asset is visible and installable only by you. Template pack/upload also reads root `package.json.assetDependencies`; `--asset` flags are additive and must not conflict. Template pack/upload omits installed dependency files whose hashes still match `.drawcall/market-lock.json`, so edited local files stay in the template. A skill source is a `skills add` argument: a whole repo (`owner/repo` or a git URL), a single skill via the full URL form `https://github.com/owner/repo/tree/<branch>/<subpath>` (the `tree/<branch>/<subpath>` shorthand needs the full URL, not `owner/repo`), or a local path to a skill directory inside the zip. Example: `market upload my-scene scene.zip "A scene" --type model --npm three@^0.178.0 --skill web-design=https://github.com/vercel-labs/agent-skills/tree/main/skills/web-design-guidelines`.
|
|
29
30
|
9. Installed `environment` assets contain `public/environment/<name>.hdr` for Three.js IBL lighting and `public/environment/<name>-background.webp` for the visible equirectangular background. Use `market preview` to fetch the preview image separately.
|
|
30
31
|
10. Installed `flipbook` assets contain `public/flipbook/<name>.ktx2`. Render them with `@drawcall/flipbook`'s `Flipbook` class and Three.js `KTX2Loader` for Basis-compressed files; `market preview` fetches the middle frame from the flipbook.
|
|
31
32
|
|
package/src/cli.ts
CHANGED
|
@@ -10,7 +10,9 @@ import { installCommand } from './commands/install.js'
|
|
|
10
10
|
import { searchCommand } from './commands/search.js'
|
|
11
11
|
import { agentCommand } from './commands/agent.js'
|
|
12
12
|
import { generateCommand } from './commands/generate.js'
|
|
13
|
+
import { generateInstallCommand } from './commands/generate-install.js'
|
|
13
14
|
import { listCommand } from './commands/list.js'
|
|
15
|
+
import { packCommand } from './commands/pack.js'
|
|
14
16
|
import { previewCommand } from './commands/preview.js'
|
|
15
17
|
import { uploadCommand } from './commands/upload.js'
|
|
16
18
|
import { logout } from './commands/logout.js'
|
|
@@ -113,6 +115,39 @@ program
|
|
|
113
115
|
})
|
|
114
116
|
})
|
|
115
117
|
|
|
118
|
+
program
|
|
119
|
+
.command('pack')
|
|
120
|
+
.description('Create a Market asset zip using the same packaging step as upload')
|
|
121
|
+
.argument('<zip-filter>', '.zip path or glob')
|
|
122
|
+
.addOption(typeOption)
|
|
123
|
+
.option('--out <file>', 'Output zip path')
|
|
124
|
+
.option('--cwd <dir>', 'Project directory')
|
|
125
|
+
.option('--npm <dep>', 'npm dependency name@range (repeatable)', collect, [])
|
|
126
|
+
.option('--asset <dep>', 'asset dependency name@range (repeatable)', collect, [])
|
|
127
|
+
.option('--skill <dep>', 'skill dependency label=source (repeatable)', collect, [])
|
|
128
|
+
.action(
|
|
129
|
+
async (
|
|
130
|
+
zipFilter: string,
|
|
131
|
+
opts: {
|
|
132
|
+
type?: AssetType
|
|
133
|
+
out?: string
|
|
134
|
+
cwd?: string
|
|
135
|
+
npm: string[]
|
|
136
|
+
asset: string[]
|
|
137
|
+
skill: string[]
|
|
138
|
+
},
|
|
139
|
+
) => {
|
|
140
|
+
await packCommand(zipFilter, {
|
|
141
|
+
type: opts.type,
|
|
142
|
+
out: opts.out,
|
|
143
|
+
cwd: opts.cwd,
|
|
144
|
+
npm: opts.npm,
|
|
145
|
+
asset: opts.asset,
|
|
146
|
+
skill: opts.skill,
|
|
147
|
+
})
|
|
148
|
+
},
|
|
149
|
+
)
|
|
150
|
+
|
|
116
151
|
program
|
|
117
152
|
.command('search')
|
|
118
153
|
.description('Find assets')
|
|
@@ -211,19 +246,23 @@ program
|
|
|
211
246
|
})
|
|
212
247
|
})
|
|
213
248
|
|
|
214
|
-
program
|
|
249
|
+
const generate = program
|
|
215
250
|
.command('generate')
|
|
216
|
-
.description('Generate and install')
|
|
217
|
-
.argument('
|
|
251
|
+
.description('Generate and install an asset, or check a generation job')
|
|
252
|
+
.argument('[description]', 'Asset prompt (omit when using a subcommand)')
|
|
218
253
|
.addOption(typeOption)
|
|
219
254
|
.addOption(apiOption)
|
|
220
255
|
.option('--cwd <dir>', 'Project directory')
|
|
221
256
|
.addOption(accessOption)
|
|
222
257
|
.action(
|
|
223
258
|
async (
|
|
224
|
-
description: string,
|
|
259
|
+
description: string | undefined,
|
|
225
260
|
opts: { type?: AssetType; api?: string; cwd?: string; access?: AssetAccess },
|
|
226
261
|
) => {
|
|
262
|
+
if (!description) {
|
|
263
|
+
generate.help({ error: true })
|
|
264
|
+
return
|
|
265
|
+
}
|
|
227
266
|
requireType(opts.type, 'Generate')
|
|
228
267
|
await generateCommand(description, {
|
|
229
268
|
type: opts.type,
|
|
@@ -234,6 +273,24 @@ program
|
|
|
234
273
|
},
|
|
235
274
|
)
|
|
236
275
|
|
|
276
|
+
// `generate install <jobId>` finishes a slow (job-based) generation: it checks the job once and, when
|
|
277
|
+
// it has completed, installs the produced asset into the project. Still running → prints a note and
|
|
278
|
+
// exits 0 (run again later); failed → exits 1. Fast asset types never need this — `generate` installs
|
|
279
|
+
// them inline. ("install" over "status": the command's job is to integrate the asset, not just report.)
|
|
280
|
+
generate
|
|
281
|
+
.command('install')
|
|
282
|
+
.description('Install the asset from a generation job once it has completed')
|
|
283
|
+
.argument('<jobId>', 'Job id printed by `market generate`')
|
|
284
|
+
.addOption(apiOption)
|
|
285
|
+
.option('--cwd <dir>', 'Project directory')
|
|
286
|
+
// Read merged options: `--cwd`/`--api` after `generate install` are otherwise captured by the
|
|
287
|
+
// parent `generate` command (which declares the same options), leaving this subcommand's own opts
|
|
288
|
+
// undefined. `optsWithGlobals()` surfaces whichever level parsed them.
|
|
289
|
+
.action(async (jobId: string, _options, command: Command) => {
|
|
290
|
+
const { api, cwd } = command.optsWithGlobals()
|
|
291
|
+
await generateInstallCommand(jobId, { baseUrl: api, cwd })
|
|
292
|
+
})
|
|
293
|
+
|
|
237
294
|
if (process.argv.length <= 2) {
|
|
238
295
|
program.outputHelp()
|
|
239
296
|
process.exit(0)
|
package/src/commands/agent.ts
CHANGED
|
@@ -4,7 +4,7 @@ import ora from 'ora'
|
|
|
4
4
|
import { getCliClient } from '../cli-client.js'
|
|
5
5
|
import { agentAndWait } from '../agent.js'
|
|
6
6
|
import { assetVersionRef } from '../output.js'
|
|
7
|
-
import type { AgentResult } from '../
|
|
7
|
+
import type { AgentResult } from '../schemas.js'
|
|
8
8
|
|
|
9
9
|
export interface AgentCommandOptions {
|
|
10
10
|
images?: string[]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getCliClient } from '../cli-client.js'
|
|
2
|
+
import { waitForGeneration } from '../generate.js'
|
|
3
|
+
import { generationRunningResult } from '../output.js'
|
|
4
|
+
import { finishGeneration, startSpinner } from './generate.js'
|
|
5
|
+
|
|
6
|
+
export interface GenerateInstallCommandOptions {
|
|
7
|
+
cwd?: string
|
|
8
|
+
baseUrl?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Install the asset from a generation job. Block-and-polls for a bounded window (the command waits,
|
|
12
|
+
// not the agent): installs on completion, fails loudly on error, or prints a note so the caller runs
|
|
13
|
+
// it again to continue the same job.
|
|
14
|
+
export async function generateInstallCommand(
|
|
15
|
+
jobId: string,
|
|
16
|
+
opts: GenerateInstallCommandOptions,
|
|
17
|
+
): Promise<void> {
|
|
18
|
+
const { client, baseUrl } = await getCliClient({ baseUrl: opts.baseUrl, requireAuth: true })
|
|
19
|
+
const spinner = startSpinner('Generating asset')
|
|
20
|
+
try {
|
|
21
|
+
const outcome = await waitForGeneration(client, jobId, {
|
|
22
|
+
onProgress: (message) => {
|
|
23
|
+
spinner.text = message
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
await finishGeneration(client, outcome, {
|
|
27
|
+
cwd: opts.cwd,
|
|
28
|
+
baseUrl,
|
|
29
|
+
spinner,
|
|
30
|
+
stillRunning: generationRunningResult(jobId),
|
|
31
|
+
})
|
|
32
|
+
} catch (err) {
|
|
33
|
+
spinner.stop()
|
|
34
|
+
throw err
|
|
35
|
+
}
|
|
36
|
+
}
|