@drawcall/market 0.1.8 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-instructions.d.ts +2 -0
- package/dist/agent-instructions.d.ts.map +1 -0
- package/dist/agent-instructions.js +42 -0
- package/dist/agent-instructions.js.map +1 -0
- package/dist/asset-implementation.d.ts +7 -48
- package/dist/asset-implementation.d.ts.map +1 -1
- package/dist/cli.js +20 -5
- package/dist/cli.js.map +1 -1
- package/dist/commands/preview.d.ts.map +1 -1
- package/dist/commands/preview.js +3 -0
- package/dist/commands/preview.js.map +1 -1
- package/dist/commands/upload.d.ts +2 -2
- package/dist/commands/upload.d.ts.map +1 -1
- package/dist/commands/upload.js +25 -94
- package/dist/commands/upload.js.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/contract.d.ts +8 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.ts +11 -1
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +1 -1
- package/dist/schemas.js.map +1 -1
- package/package.json +22 -15
- package/src/agent-instructions.ts +41 -0
- package/src/asset-implementation.ts +7 -66
- package/src/cli.ts +23 -5
- package/src/commands/preview.ts +4 -0
- package/src/commands/upload.ts +26 -116
- package/src/constants.ts +4 -0
- package/src/index.ts +1 -6
- package/src/schemas.ts +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const agentInstructions = "---\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 line plus asset bullets.\n\n## Quick Start\n\n```sh\nmarket search \"wooden chair\" --type model --limit 3\nmarket install wooden-chair --type model --cwd \"$PWD\"\nmarket preview wooden-chair --out /tmp/wooden-chair.png\n```\n\n## Workflow\n\n1. Search first unless the user gave an exact asset name.\n2. Search requires `--type`; use `model` unless the user names another supported type.\n3. Use `--limit 1` for lookup, `--limit 3` for choice. Search caps at 5.\n4. Use `--verbose` only when the one-line descriptions are not enough.\n5. Use `--unapproved` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.\n6. Preview before installing when visual fit matters: `market preview <name> --out <file>`.\n7. Generate only when the user wants a new asset and auth is available.\n8. Upload only when publishing is requested.\n\n## Output\n\nCommands print concise 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 1 asset: wooden-chair@1.0.0\nSaved preview for wooden-chair@1.0.0: /tmp/wooden-chair.png\n```\n\nIf search returns no results, try one broader noun phrase before generating. If a command returns `Error: Not logged in...`, ask before running `market login`.\n";
|
|
2
|
+
//# sourceMappingURL=agent-instructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-instructions.d.ts","sourceRoot":"","sources":["../src/agent-instructions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,siDAwC7B,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const agentInstructions = `---
|
|
2
|
+
name: market
|
|
3
|
+
description: Find, preview, install, generate, and publish Drawcall Market assets from a coding agent.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Drawcall Market
|
|
7
|
+
|
|
8
|
+
Use the \`market\` CLI. Keep commands short and read the summary line plus asset bullets.
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
\`\`\`sh
|
|
13
|
+
market search "wooden chair" --type model --limit 3
|
|
14
|
+
market install wooden-chair --type model --cwd "$PWD"
|
|
15
|
+
market preview wooden-chair --out /tmp/wooden-chair.png
|
|
16
|
+
\`\`\`
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
1. Search first unless the user gave an exact asset name.
|
|
21
|
+
2. Search requires \`--type\`; use \`model\` unless the user names another supported type.
|
|
22
|
+
3. Use \`--limit 1\` for lookup, \`--limit 3\` for choice. Search caps at 5.
|
|
23
|
+
4. Use \`--verbose\` only when the one-line descriptions are not enough.
|
|
24
|
+
5. Use \`--unapproved\` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.
|
|
25
|
+
6. Preview before installing when visual fit matters: \`market preview <name> --out <file>\`.
|
|
26
|
+
7. Generate only when the user wants a new asset and auth is available.
|
|
27
|
+
8. Upload only when publishing is requested.
|
|
28
|
+
|
|
29
|
+
## Output
|
|
30
|
+
|
|
31
|
+
Commands print concise summaries:
|
|
32
|
+
|
|
33
|
+
\`\`\`text
|
|
34
|
+
Results: 2/8 query="wooden chair" type=model approval=approved
|
|
35
|
+
- wooden-chair@1.0.0 | model | approved | Low-poly wooden chair
|
|
36
|
+
Installed 1 asset: wooden-chair@1.0.0
|
|
37
|
+
Saved preview for wooden-chair@1.0.0: /tmp/wooden-chair.png
|
|
38
|
+
\`\`\`
|
|
39
|
+
|
|
40
|
+
If search returns no results, try one broader noun phrase before generating. If a command returns \`Error: Not logged in...\`, ask before running \`market login\`.
|
|
41
|
+
`;
|
|
42
|
+
//# sourceMappingURL=agent-instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-instructions.js","sourceRoot":"","sources":["../src/agent-instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwChC,CAAA"}
|
|
@@ -31,58 +31,17 @@ export interface AssetGenerateInput {
|
|
|
31
31
|
description: string;
|
|
32
32
|
type?: AssetType;
|
|
33
33
|
}
|
|
34
|
-
export interface
|
|
35
|
-
|
|
36
|
-
blobs: BlobStore;
|
|
37
|
-
searchIndex?: AssetSearchIndex;
|
|
38
|
-
renderModelPreview?: (files: Record<string, Uint8Array>, model: {
|
|
39
|
-
path: string;
|
|
40
|
-
bytes: Uint8Array;
|
|
41
|
-
}) => Promise<{
|
|
42
|
-
bytes: Uint8Array;
|
|
43
|
-
contentType: string;
|
|
44
|
-
}>;
|
|
45
|
-
}
|
|
46
|
-
export interface AssetCatalog {
|
|
34
|
+
export interface AssetProvider {
|
|
35
|
+
type: AssetType;
|
|
47
36
|
search(input: AssetSearchInput): Promise<PaginatedList<AssetSearchResult>>;
|
|
48
37
|
exact(input: AssetExactInput): Promise<AssetSearchResult | null>;
|
|
49
|
-
|
|
50
|
-
getVersion(input: AssetDownloadZipInput): Promise<AssetVersion | null>;
|
|
51
|
-
}
|
|
52
|
-
export interface SaveAssetVersionInput {
|
|
53
|
-
name: string;
|
|
54
|
-
type: AssetType;
|
|
55
|
-
version: string;
|
|
56
|
-
description?: string;
|
|
57
|
-
ownerId: string;
|
|
58
|
-
approved: boolean;
|
|
59
|
-
npmDependencies: Record<string, string>;
|
|
60
|
-
assetDependencies: Record<string, string>;
|
|
61
|
-
sourceKey: string;
|
|
62
|
-
}
|
|
63
|
-
export interface BlobStore {
|
|
64
|
-
put(key: string, data: ArrayBuffer, contentType?: string): Promise<void>;
|
|
65
|
-
get(key: string): Promise<Blob | null>;
|
|
66
|
-
}
|
|
67
|
-
export interface AssetSearchIndexEntry {
|
|
68
|
-
name: string;
|
|
69
|
-
description: string;
|
|
70
|
-
vector: number[];
|
|
71
|
-
}
|
|
72
|
-
export interface AssetSearchIndex {
|
|
73
|
-
list(type: AssetType): Promise<AssetSearchIndexEntry[]>;
|
|
74
|
-
upsert(type: AssetType, entry: AssetSearchIndexEntry): Promise<void>;
|
|
75
|
-
}
|
|
76
|
-
export interface AssetImplementation {
|
|
77
|
-
type: AssetType;
|
|
78
|
-
search(context: AssetImplementationContext, input: AssetSearchInput): Promise<PaginatedList<AssetSearchResult>>;
|
|
79
|
-
exact(context: AssetImplementationContext, input: AssetExactInput): Promise<AssetSearchResult | null>;
|
|
80
|
-
uploadZip(context: AssetImplementationContext, input: AssetUploadZipInput, owner: {
|
|
38
|
+
uploadZip(input: AssetUploadZipInput, owner: {
|
|
81
39
|
id: string;
|
|
82
40
|
role: string;
|
|
83
41
|
}): Promise<AssetVersion>;
|
|
84
|
-
downloadZip(
|
|
85
|
-
downloadPreviewImage?(
|
|
86
|
-
generate(
|
|
42
|
+
downloadZip(input: AssetDownloadZipInput): Promise<Blob>;
|
|
43
|
+
downloadPreviewImage?(input: AssetDownloadZipInput): Promise<Blob>;
|
|
44
|
+
generate(input: AssetGenerateInput): Promise<GenerateAssetResult>;
|
|
87
45
|
}
|
|
46
|
+
export type AssetImplementation = AssetProvider;
|
|
88
47
|
//# sourceMappingURL=asset-implementation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-implementation.d.ts","sourceRoot":"","sources":["../src/asset-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACd,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iBAAiB,EAAE,OAAO,CAAA;IAC1B,IAAI,EAAE,QAAQ,GAAG,cAAc,GAAG,WAAW,CAAA;CAC9C;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,iBAAiB,EAAE,OAAO,CAAA;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE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CAAA;IACvC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,GAAG,EAAE,IAAI,CAAA;CACV;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC1E,KAAK,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IAChE,SAAS,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;IACjG,WAAW,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACxD,oBAAoB,CAAC,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClE,QAAQ,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;CAClE;AAED,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAA"}
|
package/dist/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ import { logout } from './commands/logout.js';
|
|
|
14
14
|
import { createMarketClient } from './client.js';
|
|
15
15
|
import { saveConfig, getConfigPath } from './config.js';
|
|
16
16
|
import { errorResult, loginResult } from './output.js';
|
|
17
|
+
import { agentInstructions } from './agent-instructions.js';
|
|
17
18
|
const packageJson = createRequire(import.meta.url)('../package.json');
|
|
18
19
|
const program = new Command();
|
|
19
20
|
const DEFAULT_BASE_URL = 'https://api.market.drawcall.ai';
|
|
@@ -21,7 +22,17 @@ const AUTH_ISSUER_URL = 'https://auth.drawcall.ai/api/auth';
|
|
|
21
22
|
const DEVICE_CLIENT_ID = 'market-cli';
|
|
22
23
|
const typeOption = new Option('--type <type>', 'Asset type').choices([...ASSET_TYPES]);
|
|
23
24
|
const apiOption = new Option('--api <url>', 'API URL').default(process.env.MARKET_API_URL, 'from MARKET_API_URL / config / default');
|
|
24
|
-
program
|
|
25
|
+
program
|
|
26
|
+
.name('market')
|
|
27
|
+
.description('Find and install Drawcall Market assets')
|
|
28
|
+
.version(packageJson.version)
|
|
29
|
+
.addHelpText('after', '\nAI agents should run `market instructions` before using this CLI.');
|
|
30
|
+
program
|
|
31
|
+
.command('instructions')
|
|
32
|
+
.description('Print AI agent instructions for using this CLI')
|
|
33
|
+
.action(() => {
|
|
34
|
+
console.log(agentInstructions);
|
|
35
|
+
});
|
|
25
36
|
program
|
|
26
37
|
.command('login')
|
|
27
38
|
.description('Sign in')
|
|
@@ -82,16 +93,20 @@ program
|
|
|
82
93
|
});
|
|
83
94
|
program
|
|
84
95
|
.command('upload')
|
|
85
|
-
.description('Publish one
|
|
96
|
+
.description('Publish one asset')
|
|
86
97
|
.argument('<name>', 'Asset name')
|
|
87
|
-
.argument('<
|
|
98
|
+
.argument('<zip-filter>', '.zip path or glob')
|
|
88
99
|
.argument('<description>', 'Short description')
|
|
89
100
|
.addOption(typeOption)
|
|
90
101
|
.addOption(apiOption)
|
|
91
102
|
.option('--version <version>', 'Explicit semver version')
|
|
92
103
|
.option('--cwd <dir>', 'Project directory')
|
|
93
|
-
.action(async (name,
|
|
94
|
-
|
|
104
|
+
.action(async (name, zipFilter, description, opts) => {
|
|
105
|
+
if (!opts.type) {
|
|
106
|
+
console.error(errorResult(`Upload requires --type. Available types: ${ASSET_TYPES.join(', ')}`));
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
await uploadCommand(name, zipFilter, description, {
|
|
95
110
|
type: opts.type,
|
|
96
111
|
version: opts.version,
|
|
97
112
|
baseUrl: opts.api,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,WAAW,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAkB,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,IA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AW,CAAC,4BAA4B,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC3E,IAAI,CAAC,MAAM,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;IAC5F,OAAO,MAAM,CAAC,YAAY,CAAA;AAC5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/commands/preview.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,eAAe,CAAA;AAE7E,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/commands/preview.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,eAAe,CAAA;AAE7E,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAgDf"}
|
package/dist/commands/preview.js
CHANGED
|
@@ -7,6 +7,9 @@ import { assetNameSchema, semverSchema } from '../schemas.js';
|
|
|
7
7
|
export async function previewCommand(name, version, opts) {
|
|
8
8
|
const parsedName = assetNameSchema.parse(name);
|
|
9
9
|
const parsedVersion = version ? semverSchema.parse(version) : undefined;
|
|
10
|
+
if (opts.type === 'humanoid-animation') {
|
|
11
|
+
throw new Error('Preview images are not supported for humanoid-animation');
|
|
12
|
+
}
|
|
10
13
|
const spinner = ora({
|
|
11
14
|
text: `Resolving preview for ${parsedName}`,
|
|
12
15
|
isEnabled: Boolean(process.stderr.isTTY),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/commands/preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAkB,MAAM,eAAe,CAAA;AAS7E,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAY,EACZ,OAA2B,EAC3B,IAA2B;IAE3B,MAAM,UAAU,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC9C,MAAM,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACvE,MAAM,OAAO,GAAG,GAAG,CAAC;QAClB,IAAI,EAAE,yBAAyB,UAAU,EAAE;QAC3C,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QACxC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;KAChC,CAAC,CAAC,KAAK,EAAE,CAAA;IAEV,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,EAA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AAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,EAAE,CAAA;QACd,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,WAAmB;IAC3C,IAAI,WAAW,KAAK,YAAY;QAAE,OAAO,OAAO,CAAA;IAChD,IAAI,WAAW,KAAK,YAAY;QAAE,OAAO,MAAM,CAAA;IAC/C,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type AssetType } from '../schemas.js';
|
|
2
2
|
export interface UploadCommandOptions {
|
|
3
|
-
type
|
|
3
|
+
type: AssetType;
|
|
4
4
|
version?: string;
|
|
5
5
|
cwd?: string;
|
|
6
6
|
baseUrl?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function uploadCommand(name: string,
|
|
8
|
+
export declare function uploadCommand(name: string, zipFilter: string, description: string, opts: UploadCommandOptions): Promise<void>;
|
|
9
9
|
//# sourceMappingURL=upload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/commands/upload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/commands/upload.ts"],"names":[],"mappings":"AAMA,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,eAAe,CAAA;AAE7E,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,IAAI,CAAC,CA+Df"}
|
package/dist/commands/upload.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as fs from 'fs/promises';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import { zipSync } from 'fflate';
|
|
4
3
|
import ora from 'ora';
|
|
5
4
|
import semver from 'semver';
|
|
6
5
|
import { getCliClient } from '../cli-client.js';
|
|
7
6
|
import { unchangedUploadResult, uploadResult } from '../output.js';
|
|
8
7
|
import { assetNameSchema, semverSchema } from '../schemas.js';
|
|
9
|
-
export async function uploadCommand(name,
|
|
8
|
+
export async function uploadCommand(name, zipFilter, description, opts) {
|
|
10
9
|
const spinner = ora({
|
|
11
10
|
text: 'Preparing upload',
|
|
12
11
|
isEnabled: Boolean(process.stderr.isTTY),
|
|
@@ -16,8 +15,9 @@ export async function uploadCommand(name, fileFilter, description, opts) {
|
|
|
16
15
|
const parsedName = assetNameSchema.parse(name);
|
|
17
16
|
const parsedVersion = opts.version ? semverSchema.parse(opts.version) : undefined;
|
|
18
17
|
const cwd = opts.cwd ?? process.cwd();
|
|
19
|
-
const
|
|
20
|
-
const
|
|
18
|
+
const type = opts.type;
|
|
19
|
+
const zipFile = await resolveOneZipFile(cwd, zipFilter);
|
|
20
|
+
const zip = new Uint8Array(await fs.readFile(zipFile));
|
|
21
21
|
const { client } = await getCliClient({ baseUrl: opts.baseUrl, requireAuth: true });
|
|
22
22
|
const profile = await client.user.getProfile();
|
|
23
23
|
if (!profile) {
|
|
@@ -25,7 +25,7 @@ export async function uploadCommand(name, fileFilter, description, opts) {
|
|
|
25
25
|
}
|
|
26
26
|
const existing = await client.asset.exact({
|
|
27
27
|
name: parsedName,
|
|
28
|
-
type
|
|
28
|
+
type,
|
|
29
29
|
includeUnapproved: true,
|
|
30
30
|
});
|
|
31
31
|
if (existing && existing.ownerId !== profile.id) {
|
|
@@ -47,7 +47,7 @@ export async function uploadCommand(name, fileFilter, description, opts) {
|
|
|
47
47
|
spinner.text = `Uploading ${parsedName}@${version}`;
|
|
48
48
|
const uploaded = await client.asset.uploadZip({
|
|
49
49
|
name: parsedName,
|
|
50
|
-
type
|
|
50
|
+
type,
|
|
51
51
|
version,
|
|
52
52
|
description,
|
|
53
53
|
npmDependencies: {},
|
|
@@ -65,104 +65,32 @@ export async function uploadCommand(name, fileFilter, description, opts) {
|
|
|
65
65
|
throw err;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
async function
|
|
69
|
-
const
|
|
70
|
-
if (!/\.(glb|gltf)$/i.test(name)) {
|
|
71
|
-
throw new Error('Upload file filter must resolve to a .glb or .gltf file');
|
|
72
|
-
}
|
|
73
|
-
const files = {
|
|
74
|
-
[`public/${name}`]: new Uint8Array(await fs.readFile(file)),
|
|
75
|
-
'README.md': new TextEncoder().encode(description),
|
|
76
|
-
};
|
|
77
|
-
if (/\.gltf$/i.test(name)) {
|
|
78
|
-
for (const dependency of await gltfDependencies(file)) {
|
|
79
|
-
files[`public/${dependency.publicPath}`] = new Uint8Array(await fs.readFile(dependency.source));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return zipSync(files, { mtime: new Date('1980-01-01T00:00:00.000Z'), level: 0 });
|
|
83
|
-
}
|
|
84
|
-
async function gltfDependencies(file) {
|
|
85
|
-
const gltf = JSON.parse(await fs.readFile(file, 'utf-8'));
|
|
86
|
-
const uris = [...(gltf.buffers ?? []), ...(gltf.images ?? [])]
|
|
87
|
-
.map((entry) => entry.uri)
|
|
88
|
-
.filter((uri) => Boolean(uri && !uri.startsWith('data:')));
|
|
89
|
-
const dependencies = new Map();
|
|
90
|
-
for (const uri of uris) {
|
|
91
|
-
const decodedUri = decodeURIComponent(uri);
|
|
92
|
-
const publicPath = toPublicDependencyPath(decodedUri);
|
|
93
|
-
dependencies.set(publicPath, {
|
|
94
|
-
source: await resolveGltfDependency(file, decodedUri),
|
|
95
|
-
publicPath,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
return [...dependencies.values()];
|
|
99
|
-
}
|
|
100
|
-
async function resolveGltfDependency(file, uri) {
|
|
101
|
-
const dir = path.dirname(file);
|
|
102
|
-
const direct = path.resolve(dir, uri);
|
|
103
|
-
if (await isFile(direct))
|
|
104
|
-
return direct;
|
|
105
|
-
const basename = path.basename(uri);
|
|
106
|
-
const alternateBasenames = [basename];
|
|
107
|
-
const withoutBlenderSuffix = basename.replace(/_\d{3}(\.[^.]+)$/u, '$1');
|
|
108
|
-
if (withoutBlenderSuffix !== basename) {
|
|
109
|
-
alternateBasenames.push(withoutBlenderSuffix);
|
|
110
|
-
}
|
|
111
|
-
let current = dir;
|
|
112
|
-
for (let depth = 0; depth < 8; depth += 1) {
|
|
113
|
-
for (const candidateBasename of alternateBasenames) {
|
|
114
|
-
const candidates = [
|
|
115
|
-
path.join(current, 'Textures', candidateBasename),
|
|
116
|
-
path.join(current, 'textures', candidateBasename),
|
|
117
|
-
path.join(current, candidateBasename),
|
|
118
|
-
];
|
|
119
|
-
for (const candidate of candidates) {
|
|
120
|
-
if (await isFile(candidate))
|
|
121
|
-
return candidate;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
const parent = path.dirname(current);
|
|
125
|
-
if (parent === current)
|
|
126
|
-
break;
|
|
127
|
-
current = parent;
|
|
128
|
-
}
|
|
129
|
-
throw new Error(`Could not find glTF dependency "${uri}" for ${path.basename(file)}`);
|
|
130
|
-
}
|
|
131
|
-
async function isFile(file) {
|
|
132
|
-
return (await maybeStat(file))?.isFile() ?? false;
|
|
133
|
-
}
|
|
134
|
-
function toPublicDependencyPath(uri) {
|
|
135
|
-
if (/^[a-z]+:/i.test(uri) || path.isAbsolute(uri)) {
|
|
136
|
-
throw new Error(`Unsupported external glTF dependency "${uri}"`);
|
|
137
|
-
}
|
|
138
|
-
const normalized = path
|
|
139
|
-
.normalize(uri)
|
|
140
|
-
.split(path.sep)
|
|
141
|
-
.filter((part) => part.length > 0 && part !== '.')
|
|
142
|
-
.join('/');
|
|
143
|
-
if (!normalized || normalized.startsWith('../') || normalized === '..') {
|
|
144
|
-
throw new Error(`Unsupported glTF dependency path "${uri}"`);
|
|
145
|
-
}
|
|
146
|
-
return normalized;
|
|
147
|
-
}
|
|
148
|
-
async function resolveOneFile(cwd, fileFilter) {
|
|
149
|
-
const absolute = path.resolve(cwd, fileFilter);
|
|
68
|
+
async function resolveOneZipFile(cwd, zipFilter) {
|
|
69
|
+
const absolute = path.resolve(cwd, zipFilter);
|
|
150
70
|
const stat = await maybeStat(absolute);
|
|
151
71
|
if (stat?.isFile())
|
|
152
|
-
return absolute;
|
|
72
|
+
return assertZipFile(absolute);
|
|
153
73
|
const files = await listFiles(cwd);
|
|
154
74
|
const matches = files
|
|
155
|
-
.filter((file) => matchesFilter(path.relative(cwd, file),
|
|
156
|
-
.filter(
|
|
75
|
+
.filter((file) => matchesFilter(path.relative(cwd, file), zipFilter))
|
|
76
|
+
.filter(isZipFile)
|
|
157
77
|
.sort();
|
|
158
78
|
if (matches.length === 0) {
|
|
159
|
-
throw new Error(`No .
|
|
79
|
+
throw new Error(`No .zip files matched "${zipFilter}"`);
|
|
160
80
|
}
|
|
161
81
|
if (matches.length > 1) {
|
|
162
|
-
throw new Error(`File filter matched ${matches.length}
|
|
82
|
+
throw new Error(`File filter matched ${matches.length} zips; upload one asset at a time`);
|
|
163
83
|
}
|
|
164
84
|
return matches[0];
|
|
165
85
|
}
|
|
86
|
+
function assertZipFile(file) {
|
|
87
|
+
if (!isZipFile(file))
|
|
88
|
+
throw new Error(`Upload file must be a .zip: ${file}`);
|
|
89
|
+
return file;
|
|
90
|
+
}
|
|
91
|
+
function isZipFile(file) {
|
|
92
|
+
return /\.zip$/i.test(file);
|
|
93
|
+
}
|
|
166
94
|
async function maybeStat(file) {
|
|
167
95
|
try {
|
|
168
96
|
return await fs.stat(file);
|
|
@@ -200,7 +128,10 @@ function matchesFilter(file, filter) {
|
|
|
200
128
|
function nextVersion(latest) {
|
|
201
129
|
if (!latest)
|
|
202
130
|
return '1.0.0';
|
|
203
|
-
|
|
131
|
+
const version = semver.inc(latest, 'patch');
|
|
132
|
+
if (!version)
|
|
133
|
+
throw new Error(`Could not increment version "${latest}"`);
|
|
134
|
+
return version;
|
|
204
135
|
}
|
|
205
136
|
function bytesEqual(a, b) {
|
|
206
137
|
if (a.length !== b.length)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/commands/upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/commands/upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAkB,MAAM,eAAe,CAAA;AAS7E,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,SAAiB,EACjB,WAAmB,EACnB,IAA0B;IAE1B,MAAM,OAAO,GAAG,GAAG,CAAC;QAClB,IAAI,EAAE,kBAAkB;QACxB,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QACxC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;KAChC,CAAC,CAAC,KAAK,EAAE,CAAA;IAEV,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC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,CAAC,CAAA;IAC3C,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,MAAM,GAAG,CAAC,CAAA;IACxE,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,CAAa,EAAE,CAAa;IAC9C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAA;IACjC,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,aAAa,CAAC,KAAiB;IACtC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAA;AACrC,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA;AACrD,CAAC"}
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAO,MAAM,aAAa,QAAoB,CAAA;AAE9C,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAO,MAAM,aAAa,QAAoB,CAAA;AAE9C,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,CAI1D,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAIvD,CAAA"}
|
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export const MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
2
2
|
export const ALLOWED_EXTENSIONS = {
|
|
3
3
|
model: ['.zip'],
|
|
4
|
+
texture: ['.zip'],
|
|
5
|
+
'humanoid-animation': ['.zip'],
|
|
4
6
|
};
|
|
5
7
|
export const ASSET_TYPE_LABELS = {
|
|
6
8
|
model: 'Model',
|
|
9
|
+
texture: 'Texture',
|
|
10
|
+
'humanoid-animation': 'Humanoid Animation',
|
|
7
11
|
};
|
|
8
12
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,QAAQ;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAgC;IAC7D,KAAK,EAAE,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,QAAQ;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAgC;IAC7D,KAAK,EAAE,CAAC,MAAM,CAAC;IACf,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,oBAAoB,EAAE,CAAC,MAAM,CAAC;CAC/B,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAA8B;IAC1D,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,oBAAoB,EAAE,oBAAoB;CAC3C,CAAA"}
|
package/dist/contract.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export declare const contract: {
|
|
|
60
60
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
61
61
|
type: z.ZodOptional<z.ZodEnum<{
|
|
62
62
|
model: "model";
|
|
63
|
+
texture: "texture";
|
|
64
|
+
"humanoid-animation": "humanoid-animation";
|
|
63
65
|
}>>;
|
|
64
66
|
query: z.ZodOptional<z.ZodString>;
|
|
65
67
|
includeUnapproved: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -73,6 +75,8 @@ export declare const contract: {
|
|
|
73
75
|
name: z.ZodString;
|
|
74
76
|
type: z.ZodOptional<z.ZodEnum<{
|
|
75
77
|
model: "model";
|
|
78
|
+
texture: "texture";
|
|
79
|
+
"humanoid-animation": "humanoid-animation";
|
|
76
80
|
}>>;
|
|
77
81
|
includeUnapproved: z.ZodDefault<z.ZodBoolean>;
|
|
78
82
|
}, z.core.$strip>, z.ZodCustom<AssetSearchResult | null, AssetSearchResult | null>, Record<never, never>, Record<never, never>>;
|
|
@@ -80,6 +84,8 @@ export declare const contract: {
|
|
|
80
84
|
name: z.ZodString;
|
|
81
85
|
type: z.ZodEnum<{
|
|
82
86
|
model: "model";
|
|
87
|
+
texture: "texture";
|
|
88
|
+
"humanoid-animation": "humanoid-animation";
|
|
83
89
|
}>;
|
|
84
90
|
version: z.ZodString;
|
|
85
91
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -100,6 +106,8 @@ export declare const contract: {
|
|
|
100
106
|
description: z.ZodString;
|
|
101
107
|
type: z.ZodOptional<z.ZodEnum<{
|
|
102
108
|
model: "model";
|
|
109
|
+
texture: "texture";
|
|
110
|
+
"humanoid-animation": "humanoid-animation";
|
|
103
111
|
}>>;
|
|
104
112
|
}, z.core.$strip>, z.ZodCustom<GenerateAssetResult, GenerateAssetResult>, Record<never, never>, Record<never, never>>;
|
|
105
113
|
};
|
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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AE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,OAAO,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,OAAO,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAsB0B,MAAM;uBAAa,IAAI;;oBAAvB,MAAM;uBAAa,IAAI;;;;;;;CAIrE,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,QAAQ,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { MarketClient, MarketClientOptions } from './client.js';
|
|
|
3
3
|
export { contract } from './contract.js';
|
|
4
4
|
export type { AppContract } from './contract.js';
|
|
5
5
|
export type { Asset, AssetVersion, AssetSearchResult, PaginatedList, User, GenerateAssetResult, } from './contract.js';
|
|
6
|
-
export type {
|
|
6
|
+
export type { AssetDownloadZipInput, AssetExactInput, AssetGenerateInput, AssetImplementation, AssetProvider, AssetSearchInput, AssetUploadZipInput, } from './asset-implementation.js';
|
|
7
7
|
export { resolve, ResolutionError } from './resolve.js';
|
|
8
8
|
export type { ResolvedAsset, ResolveResult } from './resolve.js';
|
|
9
9
|
export { generateAndWait, GenerateError } from './generate.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAGpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAGhD,YAAY,EACV,KAAK,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,mBAAmB,GACpB,MAAM,eAAe,CAAA;AAEtB,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAGpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAGhD,YAAY,EACV,KAAK,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,mBAAmB,GACpB,MAAM,eAAe,CAAA;AAEtB,YAAY,EACV,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,2BAA2B,CAAA;AAGlC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAGhE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC9D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAGnF,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG7C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGhD,YAAY;AACZ,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGhD,YAAY;AACZ,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAuBxC,UAAU;AACV,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvD,WAAW;AACX,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAG9D,UAAU;AACV,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AAGrB,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const ASSET_TYPES: readonly ["model"];
|
|
2
|
+
export declare const ASSET_TYPES: readonly ["model", "texture", "humanoid-animation"];
|
|
3
3
|
export type AssetType = (typeof ASSET_TYPES)[number];
|
|
4
4
|
export declare const assetTypeSchema: z.ZodEnum<{
|
|
5
5
|
model: "model";
|
|
6
|
+
texture: "texture";
|
|
7
|
+
"humanoid-animation": "humanoid-animation";
|
|
6
8
|
}>;
|
|
7
9
|
export declare const semverSchema: z.ZodString;
|
|
8
10
|
export declare const assetNameSchema: z.ZodString;
|
|
@@ -17,6 +19,8 @@ export declare const listAssetsSchema: z.ZodObject<{
|
|
|
17
19
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
18
20
|
type: z.ZodOptional<z.ZodEnum<{
|
|
19
21
|
model: "model";
|
|
22
|
+
texture: "texture";
|
|
23
|
+
"humanoid-animation": "humanoid-animation";
|
|
20
24
|
}>>;
|
|
21
25
|
query: z.ZodOptional<z.ZodString>;
|
|
22
26
|
includeUnapproved: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -30,6 +34,8 @@ export declare const exactAssetSchema: z.ZodObject<{
|
|
|
30
34
|
name: z.ZodString;
|
|
31
35
|
type: z.ZodOptional<z.ZodEnum<{
|
|
32
36
|
model: "model";
|
|
37
|
+
texture: "texture";
|
|
38
|
+
"humanoid-animation": "humanoid-animation";
|
|
33
39
|
}>>;
|
|
34
40
|
includeUnapproved: z.ZodDefault<z.ZodBoolean>;
|
|
35
41
|
}, z.core.$strip>;
|
|
@@ -37,6 +43,8 @@ export declare const uploadZipSchema: z.ZodObject<{
|
|
|
37
43
|
name: z.ZodString;
|
|
38
44
|
type: z.ZodEnum<{
|
|
39
45
|
model: "model";
|
|
46
|
+
texture: "texture";
|
|
47
|
+
"humanoid-animation": "humanoid-animation";
|
|
40
48
|
}>;
|
|
41
49
|
version: z.ZodString;
|
|
42
50
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -52,6 +60,8 @@ export declare const generateAssetSchema: z.ZodObject<{
|
|
|
52
60
|
description: z.ZodString;
|
|
53
61
|
type: z.ZodOptional<z.ZodEnum<{
|
|
54
62
|
model: "model";
|
|
63
|
+
texture: "texture";
|
|
64
|
+
"humanoid-animation": "humanoid-animation";
|
|
55
65
|
}>>;
|
|
56
66
|
}, z.core.$strip>;
|
|
57
67
|
//# sourceMappingURL=schemas.d.ts.map
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,WAAW,qDAAsD,CAAA;AAC9E,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,eAAO,MAAM,eAAe;;;;EAAsB,CAAA;AAElD,eAAO,MAAM,YAAY,aAKtB,CAAA;AAEH,eAAO,MAAM,eAAe,aAUxB,CAAA;AAEJ,eAAO,MAAM,qBAAqB,qDAA+C,CAAA;AAEjF,eAAO,MAAM,uBAAuB,qDAA+C,CAAA;AAEnF,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;iBAO3B,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;iBAI3B,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;iBAQ1B,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;iBAG9B,CAAA"}
|
package/dist/schemas.js
CHANGED
package/dist/schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAO,CAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,oBAAoB,CAAU,CAAA;AAG9E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,EAAE;KACR,KAAK,CACJ,oDAAoD,EACpD,6CAA6C,CAC9C,CAAA;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CACJ,8BAA8B,EAC9B,0EAA0E,CAC3E;KACA,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;IAC5C,OAAO,EAAE,0EAA0E;CACpF,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CA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AC,CAAA;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe,CAAC,QAAQ,EAAE;IAChC,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CAC9C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,YAAY;IACrB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;IAC5C,eAAe,EAAE,qBAAqB;IACtC,iBAAiB,EAAE,uBAAuB;IAC1C,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACtC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,YAAY;CACtB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACxC,IAAI,EAAE,eAAe,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawcall/market",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/drawcall-ai/market",
|
|
7
7
|
"directory": "packages/market"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
-
"types": "
|
|
10
|
+
"types": "src/index.ts",
|
|
11
11
|
"exports": {
|
|
12
|
-
".":
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
".": "./src/index.ts",
|
|
13
|
+
"./install": "./src/install-entry.ts"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./install": {
|
|
22
|
+
"types": "./dist/install-entry.d.ts",
|
|
23
|
+
"import": "./dist/install-entry.js"
|
|
24
|
+
}
|
|
15
25
|
},
|
|
16
|
-
"
|
|
17
|
-
"types": "./dist/install-entry.d.ts",
|
|
18
|
-
"import": "./dist/install-entry.js"
|
|
19
|
-
}
|
|
26
|
+
"types": "dist/index.d.ts"
|
|
20
27
|
},
|
|
21
28
|
"bin": {
|
|
22
29
|
"market": "./dist/cli.js"
|
|
23
30
|
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc",
|
|
33
|
+
"dev": "tsx src/cli.ts",
|
|
34
|
+
"typecheck": "tsc --noEmit"
|
|
35
|
+
},
|
|
24
36
|
"dependencies": {
|
|
25
37
|
"@orpc/client": "^1.0.0",
|
|
26
38
|
"@orpc/contract": "^1.0.0",
|
|
@@ -39,10 +51,5 @@
|
|
|
39
51
|
"@types/semver": "^7.5.0",
|
|
40
52
|
"tsx": "^4.19.0",
|
|
41
53
|
"typescript": "^5.7.0"
|
|
42
|
-
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"build": "tsc",
|
|
45
|
-
"dev": "tsx src/cli.ts",
|
|
46
|
-
"typecheck": "tsc --noEmit"
|
|
47
54
|
}
|
|
48
|
-
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const agentInstructions = `---
|
|
2
|
+
name: market
|
|
3
|
+
description: Find, preview, install, generate, and publish Drawcall Market assets from a coding agent.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Drawcall Market
|
|
7
|
+
|
|
8
|
+
Use the \`market\` CLI. Keep commands short and read the summary line plus asset bullets.
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
\`\`\`sh
|
|
13
|
+
market search "wooden chair" --type model --limit 3
|
|
14
|
+
market install wooden-chair --type model --cwd "$PWD"
|
|
15
|
+
market preview wooden-chair --out /tmp/wooden-chair.png
|
|
16
|
+
\`\`\`
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
1. Search first unless the user gave an exact asset name.
|
|
21
|
+
2. Search requires \`--type\`; use \`model\` unless the user names another supported type.
|
|
22
|
+
3. Use \`--limit 1\` for lookup, \`--limit 3\` for choice. Search caps at 5.
|
|
23
|
+
4. Use \`--verbose\` only when the one-line descriptions are not enough.
|
|
24
|
+
5. Use \`--unapproved\` only when the user asks for unapproved/private/admin assets. Do not install unapproved assets without explicit acceptance.
|
|
25
|
+
6. Preview before installing when visual fit matters: \`market preview <name> --out <file>\`.
|
|
26
|
+
7. Generate only when the user wants a new asset and auth is available.
|
|
27
|
+
8. Upload only when publishing is requested.
|
|
28
|
+
|
|
29
|
+
## Output
|
|
30
|
+
|
|
31
|
+
Commands print concise summaries:
|
|
32
|
+
|
|
33
|
+
\`\`\`text
|
|
34
|
+
Results: 2/8 query="wooden chair" type=model approval=approved
|
|
35
|
+
- wooden-chair@1.0.0 | model | approved | Low-poly wooden chair
|
|
36
|
+
Installed 1 asset: wooden-chair@1.0.0
|
|
37
|
+
Saved preview for wooden-chair@1.0.0: /tmp/wooden-chair.png
|
|
38
|
+
\`\`\`
|
|
39
|
+
|
|
40
|
+
If search returns no results, try one broader noun phrase before generating. If a command returns \`Error: Not logged in...\`, ask before running \`market login\`.
|
|
41
|
+
`
|
|
@@ -42,73 +42,14 @@ export interface AssetGenerateInput {
|
|
|
42
42
|
type?: AssetType
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export interface
|
|
46
|
-
|
|
47
|
-
blobs: BlobStore
|
|
48
|
-
searchIndex?: AssetSearchIndex
|
|
49
|
-
renderModelPreview?: (
|
|
50
|
-
files: Record<string, Uint8Array>,
|
|
51
|
-
model: { path: string; bytes: Uint8Array },
|
|
52
|
-
) => Promise<{ bytes: Uint8Array; contentType: string }>
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface AssetCatalog {
|
|
45
|
+
export interface AssetProvider {
|
|
46
|
+
type: AssetType
|
|
56
47
|
search(input: AssetSearchInput): Promise<PaginatedList<AssetSearchResult>>
|
|
57
48
|
exact(input: AssetExactInput): Promise<AssetSearchResult | null>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
export interface SaveAssetVersionInput {
|
|
63
|
-
name: string
|
|
64
|
-
type: AssetType
|
|
65
|
-
version: string
|
|
66
|
-
description?: string
|
|
67
|
-
ownerId: string
|
|
68
|
-
approved: boolean
|
|
69
|
-
npmDependencies: Record<string, string>
|
|
70
|
-
assetDependencies: Record<string, string>
|
|
71
|
-
sourceKey: string
|
|
49
|
+
uploadZip(input: AssetUploadZipInput, owner: { id: string; role: string }): Promise<AssetVersion>
|
|
50
|
+
downloadZip(input: AssetDownloadZipInput): Promise<Blob>
|
|
51
|
+
downloadPreviewImage?(input: AssetDownloadZipInput): Promise<Blob>
|
|
52
|
+
generate(input: AssetGenerateInput): Promise<GenerateAssetResult>
|
|
72
53
|
}
|
|
73
54
|
|
|
74
|
-
export
|
|
75
|
-
put(key: string, data: ArrayBuffer, contentType?: string): Promise<void>
|
|
76
|
-
get(key: string): Promise<Blob | null>
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface AssetSearchIndexEntry {
|
|
80
|
-
name: string
|
|
81
|
-
description: string
|
|
82
|
-
vector: number[]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface AssetSearchIndex {
|
|
86
|
-
list(type: AssetType): Promise<AssetSearchIndexEntry[]>
|
|
87
|
-
upsert(type: AssetType, entry: AssetSearchIndexEntry): Promise<void>
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface AssetImplementation {
|
|
91
|
-
type: AssetType
|
|
92
|
-
search(
|
|
93
|
-
context: AssetImplementationContext,
|
|
94
|
-
input: AssetSearchInput,
|
|
95
|
-
): Promise<PaginatedList<AssetSearchResult>>
|
|
96
|
-
exact(
|
|
97
|
-
context: AssetImplementationContext,
|
|
98
|
-
input: AssetExactInput,
|
|
99
|
-
): Promise<AssetSearchResult | null>
|
|
100
|
-
uploadZip(
|
|
101
|
-
context: AssetImplementationContext,
|
|
102
|
-
input: AssetUploadZipInput,
|
|
103
|
-
owner: { id: string; role: string },
|
|
104
|
-
): Promise<AssetVersion>
|
|
105
|
-
downloadZip(context: AssetImplementationContext, input: AssetDownloadZipInput): Promise<Blob>
|
|
106
|
-
downloadPreviewImage?(
|
|
107
|
-
context: AssetImplementationContext,
|
|
108
|
-
input: AssetDownloadZipInput,
|
|
109
|
-
): Promise<Blob>
|
|
110
|
-
generate(
|
|
111
|
-
context: AssetImplementationContext,
|
|
112
|
-
input: AssetGenerateInput,
|
|
113
|
-
): Promise<GenerateAssetResult>
|
|
114
|
-
}
|
|
55
|
+
export type AssetImplementation = AssetProvider
|
package/src/cli.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { logout } from './commands/logout.js'
|
|
|
15
15
|
import { createMarketClient } from './client.js'
|
|
16
16
|
import { saveConfig, getConfigPath } from './config.js'
|
|
17
17
|
import { errorResult, loginResult } from './output.js'
|
|
18
|
+
import { agentInstructions } from './agent-instructions.js'
|
|
18
19
|
|
|
19
20
|
const packageJson = createRequire(import.meta.url)('../package.json') as { version: string }
|
|
20
21
|
const program = new Command()
|
|
@@ -29,7 +30,18 @@ const apiOption = new Option('--api <url>', 'API URL').default(
|
|
|
29
30
|
'from MARKET_API_URL / config / default',
|
|
30
31
|
)
|
|
31
32
|
|
|
32
|
-
program
|
|
33
|
+
program
|
|
34
|
+
.name('market')
|
|
35
|
+
.description('Find and install Drawcall Market assets')
|
|
36
|
+
.version(packageJson.version)
|
|
37
|
+
.addHelpText('after', '\nAI agents should run `market instructions` before using this CLI.')
|
|
38
|
+
|
|
39
|
+
program
|
|
40
|
+
.command('instructions')
|
|
41
|
+
.description('Print AI agent instructions for using this CLI')
|
|
42
|
+
.action(() => {
|
|
43
|
+
console.log(agentInstructions)
|
|
44
|
+
})
|
|
33
45
|
|
|
34
46
|
program
|
|
35
47
|
.command('login')
|
|
@@ -112,9 +124,9 @@ program
|
|
|
112
124
|
|
|
113
125
|
program
|
|
114
126
|
.command('upload')
|
|
115
|
-
.description('Publish one
|
|
127
|
+
.description('Publish one asset')
|
|
116
128
|
.argument('<name>', 'Asset name')
|
|
117
|
-
.argument('<
|
|
129
|
+
.argument('<zip-filter>', '.zip path or glob')
|
|
118
130
|
.argument('<description>', 'Short description')
|
|
119
131
|
.addOption(typeOption)
|
|
120
132
|
.addOption(apiOption)
|
|
@@ -123,11 +135,17 @@ program
|
|
|
123
135
|
.action(
|
|
124
136
|
async (
|
|
125
137
|
name: string,
|
|
126
|
-
|
|
138
|
+
zipFilter: string,
|
|
127
139
|
description: string,
|
|
128
140
|
opts: { type?: AssetType; api?: string; version?: string; cwd?: string },
|
|
129
141
|
) => {
|
|
130
|
-
|
|
142
|
+
if (!opts.type) {
|
|
143
|
+
console.error(
|
|
144
|
+
errorResult(`Upload requires --type. Available types: ${ASSET_TYPES.join(', ')}`),
|
|
145
|
+
)
|
|
146
|
+
process.exit(1)
|
|
147
|
+
}
|
|
148
|
+
await uploadCommand(name, zipFilter, description, {
|
|
131
149
|
type: opts.type,
|
|
132
150
|
version: opts.version,
|
|
133
151
|
baseUrl: opts.api,
|
package/src/commands/preview.ts
CHANGED
|
@@ -19,6 +19,10 @@ export async function previewCommand(
|
|
|
19
19
|
): Promise<void> {
|
|
20
20
|
const parsedName = assetNameSchema.parse(name)
|
|
21
21
|
const parsedVersion = version ? semverSchema.parse(version) : undefined
|
|
22
|
+
if (opts.type === 'humanoid-animation') {
|
|
23
|
+
throw new Error('Preview images are not supported for humanoid-animation')
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
const spinner = ora({
|
|
23
27
|
text: `Resolving preview for ${parsedName}`,
|
|
24
28
|
isEnabled: Boolean(process.stderr.isTTY),
|
package/src/commands/upload.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as fs from 'fs/promises'
|
|
2
2
|
import * as path from 'path'
|
|
3
|
-
import { zipSync } from 'fflate'
|
|
4
3
|
import ora from 'ora'
|
|
5
4
|
import semver from 'semver'
|
|
6
5
|
import { getCliClient } from '../cli-client.js'
|
|
@@ -8,7 +7,7 @@ import { unchangedUploadResult, uploadResult } from '../output.js'
|
|
|
8
7
|
import { assetNameSchema, semverSchema, type AssetType } from '../schemas.js'
|
|
9
8
|
|
|
10
9
|
export interface UploadCommandOptions {
|
|
11
|
-
type
|
|
10
|
+
type: AssetType
|
|
12
11
|
version?: string
|
|
13
12
|
cwd?: string
|
|
14
13
|
baseUrl?: string
|
|
@@ -16,7 +15,7 @@ export interface UploadCommandOptions {
|
|
|
16
15
|
|
|
17
16
|
export async function uploadCommand(
|
|
18
17
|
name: string,
|
|
19
|
-
|
|
18
|
+
zipFilter: string,
|
|
20
19
|
description: string,
|
|
21
20
|
opts: UploadCommandOptions,
|
|
22
21
|
): Promise<void> {
|
|
@@ -30,8 +29,9 @@ export async function uploadCommand(
|
|
|
30
29
|
const parsedName = assetNameSchema.parse(name)
|
|
31
30
|
const parsedVersion = opts.version ? semverSchema.parse(opts.version) : undefined
|
|
32
31
|
const cwd = opts.cwd ?? process.cwd()
|
|
33
|
-
const
|
|
34
|
-
const
|
|
32
|
+
const type = opts.type
|
|
33
|
+
const zipFile = await resolveOneZipFile(cwd, zipFilter)
|
|
34
|
+
const zip = new Uint8Array(await fs.readFile(zipFile))
|
|
35
35
|
const { client } = await getCliClient({ baseUrl: opts.baseUrl, requireAuth: true })
|
|
36
36
|
const profile = await client.user.getProfile()
|
|
37
37
|
if (!profile) {
|
|
@@ -39,7 +39,7 @@ export async function uploadCommand(
|
|
|
39
39
|
}
|
|
40
40
|
const existing = await client.asset.exact({
|
|
41
41
|
name: parsedName,
|
|
42
|
-
type
|
|
42
|
+
type,
|
|
43
43
|
includeUnapproved: true,
|
|
44
44
|
})
|
|
45
45
|
|
|
@@ -64,7 +64,7 @@ export async function uploadCommand(
|
|
|
64
64
|
spinner.text = `Uploading ${parsedName}@${version}`
|
|
65
65
|
const uploaded = await client.asset.uploadZip({
|
|
66
66
|
name: parsedName,
|
|
67
|
-
type
|
|
67
|
+
type,
|
|
68
68
|
version,
|
|
69
69
|
description,
|
|
70
70
|
npmDependencies: {},
|
|
@@ -83,128 +83,36 @@ export async function uploadCommand(
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
async function
|
|
87
|
-
const
|
|
88
|
-
if (!/\.(glb|gltf)$/i.test(name)) {
|
|
89
|
-
throw new Error('Upload file filter must resolve to a .glb or .gltf file')
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const files: Record<string, Uint8Array> = {
|
|
93
|
-
[`public/${name}`]: new Uint8Array(await fs.readFile(file)),
|
|
94
|
-
'README.md': new TextEncoder().encode(description),
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (/\.gltf$/i.test(name)) {
|
|
98
|
-
for (const dependency of await gltfDependencies(file)) {
|
|
99
|
-
files[`public/${dependency.publicPath}`] = new Uint8Array(
|
|
100
|
-
await fs.readFile(dependency.source),
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return zipSync(files, { mtime: new Date('1980-01-01T00:00:00.000Z'), level: 0 })
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
interface GltfDependency {
|
|
109
|
-
source: string
|
|
110
|
-
publicPath: string
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
async function gltfDependencies(file: string): Promise<GltfDependency[]> {
|
|
114
|
-
const gltf = JSON.parse(await fs.readFile(file, 'utf-8')) as {
|
|
115
|
-
buffers?: Array<{ uri?: string }>
|
|
116
|
-
images?: Array<{ uri?: string }>
|
|
117
|
-
}
|
|
118
|
-
const uris = [...(gltf.buffers ?? []), ...(gltf.images ?? [])]
|
|
119
|
-
.map((entry) => entry.uri)
|
|
120
|
-
.filter((uri): uri is string => Boolean(uri && !uri.startsWith('data:')))
|
|
121
|
-
const dependencies = new Map<string, GltfDependency>()
|
|
122
|
-
|
|
123
|
-
for (const uri of uris) {
|
|
124
|
-
const decodedUri = decodeURIComponent(uri)
|
|
125
|
-
const publicPath = toPublicDependencyPath(decodedUri)
|
|
126
|
-
dependencies.set(publicPath, {
|
|
127
|
-
source: await resolveGltfDependency(file, decodedUri),
|
|
128
|
-
publicPath,
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return [...dependencies.values()]
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
async function resolveGltfDependency(file: string, uri: string): Promise<string> {
|
|
136
|
-
const dir = path.dirname(file)
|
|
137
|
-
const direct = path.resolve(dir, uri)
|
|
138
|
-
if (await isFile(direct)) return direct
|
|
139
|
-
|
|
140
|
-
const basename = path.basename(uri)
|
|
141
|
-
const alternateBasenames = [basename]
|
|
142
|
-
const withoutBlenderSuffix = basename.replace(/_\d{3}(\.[^.]+)$/u, '$1')
|
|
143
|
-
if (withoutBlenderSuffix !== basename) {
|
|
144
|
-
alternateBasenames.push(withoutBlenderSuffix)
|
|
145
|
-
}
|
|
146
|
-
let current = dir
|
|
147
|
-
for (let depth = 0; depth < 8; depth += 1) {
|
|
148
|
-
for (const candidateBasename of alternateBasenames) {
|
|
149
|
-
const candidates = [
|
|
150
|
-
path.join(current, 'Textures', candidateBasename),
|
|
151
|
-
path.join(current, 'textures', candidateBasename),
|
|
152
|
-
path.join(current, candidateBasename),
|
|
153
|
-
]
|
|
154
|
-
for (const candidate of candidates) {
|
|
155
|
-
if (await isFile(candidate)) return candidate
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const parent = path.dirname(current)
|
|
160
|
-
if (parent === current) break
|
|
161
|
-
current = parent
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
throw new Error(`Could not find glTF dependency "${uri}" for ${path.basename(file)}`)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async function isFile(file: string): Promise<boolean> {
|
|
168
|
-
return (await maybeStat(file))?.isFile() ?? false
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function toPublicDependencyPath(uri: string): string {
|
|
172
|
-
if (/^[a-z]+:/i.test(uri) || path.isAbsolute(uri)) {
|
|
173
|
-
throw new Error(`Unsupported external glTF dependency "${uri}"`)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const normalized = path
|
|
177
|
-
.normalize(uri)
|
|
178
|
-
.split(path.sep)
|
|
179
|
-
.filter((part) => part.length > 0 && part !== '.')
|
|
180
|
-
.join('/')
|
|
181
|
-
if (!normalized || normalized.startsWith('../') || normalized === '..') {
|
|
182
|
-
throw new Error(`Unsupported glTF dependency path "${uri}"`)
|
|
183
|
-
}
|
|
184
|
-
return normalized
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
async function resolveOneFile(cwd: string, fileFilter: string): Promise<string> {
|
|
188
|
-
const absolute = path.resolve(cwd, fileFilter)
|
|
86
|
+
async function resolveOneZipFile(cwd: string, zipFilter: string): Promise<string> {
|
|
87
|
+
const absolute = path.resolve(cwd, zipFilter)
|
|
189
88
|
const stat = await maybeStat(absolute)
|
|
190
|
-
if (stat?.isFile()) return absolute
|
|
89
|
+
if (stat?.isFile()) return assertZipFile(absolute)
|
|
191
90
|
|
|
192
91
|
const files = await listFiles(cwd)
|
|
193
92
|
const matches = files
|
|
194
|
-
.filter((file) => matchesFilter(path.relative(cwd, file),
|
|
195
|
-
.filter(
|
|
93
|
+
.filter((file) => matchesFilter(path.relative(cwd, file), zipFilter))
|
|
94
|
+
.filter(isZipFile)
|
|
196
95
|
.sort()
|
|
197
96
|
|
|
198
97
|
if (matches.length === 0) {
|
|
199
|
-
throw new Error(`No .
|
|
98
|
+
throw new Error(`No .zip files matched "${zipFilter}"`)
|
|
200
99
|
}
|
|
201
100
|
if (matches.length > 1) {
|
|
202
|
-
throw new Error(`File filter matched ${matches.length}
|
|
101
|
+
throw new Error(`File filter matched ${matches.length} zips; upload one asset at a time`)
|
|
203
102
|
}
|
|
204
103
|
|
|
205
104
|
return matches[0]
|
|
206
105
|
}
|
|
207
106
|
|
|
107
|
+
function assertZipFile(file: string): string {
|
|
108
|
+
if (!isZipFile(file)) throw new Error(`Upload file must be a .zip: ${file}`)
|
|
109
|
+
return file
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isZipFile(file: string): boolean {
|
|
113
|
+
return /\.zip$/i.test(file)
|
|
114
|
+
}
|
|
115
|
+
|
|
208
116
|
async function maybeStat(file: string) {
|
|
209
117
|
try {
|
|
210
118
|
return await fs.stat(file)
|
|
@@ -242,7 +150,9 @@ function matchesFilter(file: string, filter: string): boolean {
|
|
|
242
150
|
|
|
243
151
|
function nextVersion(latest?: string): string {
|
|
244
152
|
if (!latest) return '1.0.0'
|
|
245
|
-
|
|
153
|
+
const version = semver.inc(latest, 'patch')
|
|
154
|
+
if (!version) throw new Error(`Could not increment version "${latest}"`)
|
|
155
|
+
return version
|
|
246
156
|
}
|
|
247
157
|
|
|
248
158
|
function bytesEqual(a: Uint8Array, b: Uint8Array): boolean {
|
package/src/constants.ts
CHANGED
|
@@ -4,8 +4,12 @@ export const MAX_FILE_SIZE = 100 * 1024 * 1024 // 100MB
|
|
|
4
4
|
|
|
5
5
|
export const ALLOWED_EXTENSIONS: Record<AssetType, string[]> = {
|
|
6
6
|
model: ['.zip'],
|
|
7
|
+
texture: ['.zip'],
|
|
8
|
+
'humanoid-animation': ['.zip'],
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export const ASSET_TYPE_LABELS: Record<AssetType, string> = {
|
|
10
12
|
model: 'Model',
|
|
13
|
+
texture: 'Texture',
|
|
14
|
+
'humanoid-animation': 'Humanoid Animation',
|
|
11
15
|
}
|
package/src/index.ts
CHANGED
|
@@ -17,18 +17,13 @@ export type {
|
|
|
17
17
|
} from './contract.js'
|
|
18
18
|
|
|
19
19
|
export type {
|
|
20
|
-
AssetCatalog,
|
|
21
20
|
AssetDownloadZipInput,
|
|
22
21
|
AssetExactInput,
|
|
23
22
|
AssetGenerateInput,
|
|
24
23
|
AssetImplementation,
|
|
25
|
-
|
|
26
|
-
AssetSearchIndex,
|
|
27
|
-
AssetSearchIndexEntry,
|
|
24
|
+
AssetProvider,
|
|
28
25
|
AssetSearchInput,
|
|
29
26
|
AssetUploadZipInput,
|
|
30
|
-
BlobStore,
|
|
31
|
-
SaveAssetVersionInput,
|
|
32
27
|
} from './asset-implementation.js'
|
|
33
28
|
|
|
34
29
|
// Resolve
|
package/src/schemas.ts
CHANGED