@drawcall/market 0.8.30 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -1
- package/dist/auth.d.ts +4 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +32 -0
- package/dist/auth.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/command.d.ts +0 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +2 -36
- package/dist/command.js.map +1 -1
- package/dist/commands/preview.d.ts +1 -1
- package/dist/commands/preview.d.ts.map +1 -1
- package/dist/commands/preview.js +2 -2
- package/dist/commands/preview.js.map +1 -1
- package/dist/commands/urls.js +2 -2
- package/dist/commands/urls.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/agent.d.ts +4 -0
- package/dist/mcp/agent.d.ts.map +1 -0
- package/dist/mcp/agent.js +27 -0
- package/dist/mcp/agent.js.map +1 -0
- package/dist/mcp/asset.d.ts +4 -0
- package/dist/mcp/asset.d.ts.map +1 -0
- package/dist/mcp/asset.js +124 -0
- package/dist/mcp/asset.js.map +1 -0
- package/dist/mcp/generation.d.ts +4 -0
- package/dist/mcp/generation.d.ts.map +1 -0
- package/dist/mcp/generation.js +28 -0
- package/dist/mcp/generation.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/instructions.d.ts +3 -0
- package/dist/mcp/instructions.d.ts.map +1 -0
- package/dist/mcp/instructions.js +16 -0
- package/dist/mcp/instructions.js.map +1 -0
- package/dist/mcp/register.d.ts +4 -0
- package/dist/mcp/register.d.ts.map +1 -0
- package/dist/mcp/register.js +13 -0
- package/dist/mcp/register.js.map +1 -0
- package/dist/mcp/result.d.ts +4 -0
- package/dist/mcp/result.d.ts.map +1 -0
- package/dist/mcp/result.js +14 -0
- package/dist/mcp/result.js.map +1 -0
- package/dist/mcp/types.d.ts +39 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +2 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/refs.d.ts +6 -0
- package/dist/refs.d.ts.map +1 -1
- package/dist/refs.js +17 -1
- package/dist/refs.js.map +1 -1
- package/dist/skill.generated.d.ts +3 -0
- package/dist/skill.generated.d.ts.map +1 -0
- package/dist/skill.generated.js +4 -0
- package/dist/skill.generated.js.map +1 -0
- package/dist/standalone.d.ts +4 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/standalone.js +8 -0
- package/dist/standalone.js.map +1 -0
- package/package.json +14 -2
- package/skills/market/SKILL.md +34 -29
- package/src/auth.ts +42 -0
- package/src/cli.ts +2 -2
- package/src/command.ts +2 -43
- package/src/commands/preview.ts +2 -3
- package/src/commands/urls.ts +2 -2
- package/src/index.ts +10 -0
- package/src/mcp/agent.ts +39 -0
- package/src/mcp/asset.ts +158 -0
- package/src/mcp/generation.ts +41 -0
- package/src/mcp/index.ts +7 -0
- package/src/mcp/instructions.ts +22 -0
- package/src/mcp/register.ts +17 -0
- package/src/mcp/result.ts +18 -0
- package/src/mcp/types.ts +43 -0
- package/src/refs.ts +32 -1
- package/src/skill.generated.ts +5 -0
- package/src/standalone.ts +9 -0
- package/dist/commands/asset-ref.d.ts +0 -9
- package/dist/commands/asset-ref.d.ts.map +0 -1
- package/dist/commands/asset-ref.js +0 -19
- package/dist/commands/asset-ref.js.map +0 -1
- package/dist/skill.d.ts +0 -2
- package/dist/skill.d.ts.map +0 -1
- package/dist/skill.js +0 -60
- package/dist/skill.js.map +0 -1
- package/src/commands/asset-ref.ts +0 -35
- package/src/skill.ts +0 -59
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MarketV1Client } from '../v1/client.js';
|
|
2
|
+
import type { MarketMcpOptions, MarketMcpServer } from './types.js';
|
|
3
|
+
export declare function registerMarketTools(server: MarketMcpServer, client: MarketV1Client, options?: MarketMcpOptions): void;
|
|
4
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/mcp/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAKrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEnE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,gBAAqB,GAC7B,IAAI,CAKN"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { registerAgentTools } from './agent.js';
|
|
2
|
+
import { registerAssetTools } from './asset.js';
|
|
3
|
+
import { registerGenerationTools } from './generation.js';
|
|
4
|
+
import { registerInstructions } from './instructions.js';
|
|
5
|
+
export function registerMarketTools(server, client, options = {}) {
|
|
6
|
+
registerInstructions(server);
|
|
7
|
+
registerAssetTools(server, client, options.fetch ?? globalThis.fetch);
|
|
8
|
+
if (options.capabilities?.generate)
|
|
9
|
+
registerGenerationTools(server, client);
|
|
10
|
+
if (options.capabilities?.agent)
|
|
11
|
+
registerAgentTools(server, client);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/mcp/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAGxD,MAAM,UAAU,mBAAmB,CACjC,MAAuB,EACvB,MAAsB,EACtB,UAA4B,EAAE;IAE9B,oBAAoB,CAAC,MAAM,CAAC,CAAA;IAC5B,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;IACrE,IAAI,OAAO,CAAC,YAAY,EAAE,QAAQ;QAAE,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3E,IAAI,OAAO,CAAC,YAAY,EAAE,KAAK;QAAE,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACrE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MarketMcpToolResult } from './types.js';
|
|
2
|
+
export declare function result<Structured extends Record<string, unknown>>(structuredContent: Structured): MarketMcpToolResult;
|
|
3
|
+
export declare function base64(bytes: Uint8Array): string;
|
|
4
|
+
//# sourceMappingURL=result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/mcp/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,wBAAgB,MAAM,CAAC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,iBAAiB,EAAE,UAAU,GAC5B,mBAAmB,CAKrB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMhD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function result(structuredContent) {
|
|
2
|
+
return {
|
|
3
|
+
content: [{ type: 'text', text: JSON.stringify(structuredContent) }],
|
|
4
|
+
structuredContent,
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function base64(bytes) {
|
|
8
|
+
let binary = '';
|
|
9
|
+
for (let offset = 0; offset < bytes.length; offset += 32_768) {
|
|
10
|
+
binary += String.fromCharCode(...bytes.subarray(offset, offset + 32_768));
|
|
11
|
+
}
|
|
12
|
+
return btoa(binary);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/mcp/result.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,MAAM,CACpB,iBAA6B;IAE7B,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACpE,iBAAiB;KAClB,CAAA;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,KAAiB;IACtC,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,MAAM,IAAI,MAAM,EAAE,CAAC;QAC7D,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAA;IAC3E,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAA;AACrB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
export interface MarketMcpToolResult {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
content: Array<{
|
|
5
|
+
type: 'text';
|
|
6
|
+
text: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'image';
|
|
9
|
+
data: string;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
}>;
|
|
12
|
+
structuredContent?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
interface MarketMcpToolAnnotations {
|
|
15
|
+
readOnlyHint?: boolean;
|
|
16
|
+
destructiveHint?: boolean;
|
|
17
|
+
idempotentHint?: boolean;
|
|
18
|
+
openWorldHint?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface MarketMcpToolConfig<Input extends z.ZodType | undefined> {
|
|
21
|
+
title?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
inputSchema?: Input;
|
|
24
|
+
annotations?: MarketMcpToolAnnotations;
|
|
25
|
+
}
|
|
26
|
+
type MarketMcpToolHandler<Input extends z.ZodType | undefined> = Input extends z.ZodType ? (input: z.output<Input>) => Promise<MarketMcpToolResult> : () => Promise<MarketMcpToolResult>;
|
|
27
|
+
export interface MarketMcpServer {
|
|
28
|
+
registerTool<Input extends z.ZodType | undefined = undefined>(name: string, config: MarketMcpToolConfig<Input>, handler: MarketMcpToolHandler<Input>): unknown;
|
|
29
|
+
}
|
|
30
|
+
export interface MarketMcpCapabilities {
|
|
31
|
+
generate?: boolean;
|
|
32
|
+
agent?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface MarketMcpOptions {
|
|
35
|
+
fetch?: typeof globalThis.fetch;
|
|
36
|
+
capabilities?: MarketMcpCapabilities;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,WAAW,mBAAmB;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;IACtB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAClG,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC5C;AAED,UAAU,wB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@ export interface AssetRef {
|
|
|
8
8
|
export interface RefsReader {
|
|
9
9
|
search: MarketClient['asset']['search'];
|
|
10
10
|
}
|
|
11
|
+
export interface ResolveAssetOptions {
|
|
12
|
+
includeUnapproved?: boolean;
|
|
13
|
+
key?: string;
|
|
14
|
+
}
|
|
11
15
|
/**
|
|
12
16
|
* The collection read in refs mode: full entries (metadata, version history,
|
|
13
17
|
* files with data-plane URLs) for exactly the given refs — order-preserved,
|
|
@@ -17,4 +21,6 @@ export declare function lookupAssets(asset: RefsReader, refs: AssetRef[], opts?:
|
|
|
17
21
|
includeUnapproved?: boolean;
|
|
18
22
|
key?: string;
|
|
19
23
|
}): Promise<(AssetRefEntry | null)[]>;
|
|
24
|
+
/** Resolve a bare asset name or exact name@version without accepting semver ranges. */
|
|
25
|
+
export declare function resolveAsset(client: RefsReader, ref: string, opts?: ResolveAssetOptions): Promise<AssetRefEntry>;
|
|
20
26
|
//# sourceMappingURL=refs.d.ts.map
|
package/dist/refs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAA;CACxC;AAKD;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,QAAQ,EAAE,EAChB,IAAI,GAAE;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GACvD,OAAO,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,CAenC"}
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAA;CACxC;AAED,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAKD;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,QAAQ,EAAE,EAChB,IAAI,GAAE;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GACvD,OAAO,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,CAenC;AAED,uFAAuF;AACvF,wBAAsB,YAAY,CAChC,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,aAAa,CAAC,CAmBxB"}
|
package/dist/refs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MAX_ASSET_REFS_QUERY_LENGTH } from './schemas.js';
|
|
1
|
+
import { assetNameSchema, MAX_ASSET_REFS_QUERY_LENGTH, semverSchema } from './schemas.js';
|
|
2
2
|
/** The server accepts up to 100 refs and 4,000 characters per read. */
|
|
3
3
|
const MAX_REFS_PER_CALL = 100;
|
|
4
4
|
/**
|
|
@@ -20,6 +20,22 @@ export async function lookupAssets(asset, refs, opts = {}) {
|
|
|
20
20
|
}));
|
|
21
21
|
return results.flat();
|
|
22
22
|
}
|
|
23
|
+
/** Resolve a bare asset name or exact name@version without accepting semver ranges. */
|
|
24
|
+
export async function resolveAsset(client, ref, opts = {}) {
|
|
25
|
+
const separator = ref.indexOf('@');
|
|
26
|
+
const name = assetNameSchema.parse(separator === -1 ? ref : ref.slice(0, separator));
|
|
27
|
+
const requestedVersion = separator === -1 ? undefined : semverSchema.parse(ref.slice(separator + 1));
|
|
28
|
+
const [asset] = await lookupAssets(client, [{ name, ...(requestedVersion ? { version: requestedVersion } : {}) }], {
|
|
29
|
+
includeUnapproved: opts.includeUnapproved ?? false,
|
|
30
|
+
...(opts.key ? { key: opts.key } : {}),
|
|
31
|
+
});
|
|
32
|
+
if (!asset)
|
|
33
|
+
throw new Error(`Asset "${ref}" not found`);
|
|
34
|
+
if (requestedVersion && asset.version !== requestedVersion) {
|
|
35
|
+
throw new Error(`Market API did not return requested version "${ref}"`);
|
|
36
|
+
}
|
|
37
|
+
return asset;
|
|
38
|
+
}
|
|
23
39
|
function chunkRefs(refs) {
|
|
24
40
|
const chunks = [];
|
|
25
41
|
let chunk = [];
|
package/dist/refs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAkBzF,uEAAuE;AACvE,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAE7B;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAiB,EACjB,IAAgB,EAChB,OAAsD,EAAE;I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AU,GAAG,MAAM,GAAG,eAAe,GAAG,KAAK,CAAC,MAAM,CAAA;QAC1D,IAAI,KAAK,CAAC,MAAM,KAAK,iBAAiB,IAAI,UAAU,GAAG,2BAA2B,EAAE,CAAC;YACnF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YAC5B,KAAK,GAAG,EAAE,CAAA;YACV,MAAM,GAAG,CAAC,CAAA;QACZ,CAAC;QAED,MAAM,mBAAmB,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACpD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACjB,MAAM,IAAI,mBAAmB,GAAG,KAAK,CAAC,MAAM,CAAA;IAC9C,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IAClD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const cliMarketSkill = "---\nname: market\ndescription: Find, inspect, generate, and use Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\n## CLI transport\n\nRun commands as `npx @drawcall/market <command>`; do not assume a global `market` binary or switch to MCP after a CLI failure. Use `npx @drawcall/market skill` when these instructions are not already available.\n\nDiscover the current vocabulary and choose an asset:\n\n```sh\nnpx @drawcall/market types\nnpx @drawcall/market search \"<query>\" --type <type> --limit 3\nnpx @drawcall/market preview <name@version> --out /tmp/<name>.png\nnpx @drawcall/market urls <name@version>\n```\n\n`urls` prints one base URL, file subpaths, and a preview URL without changing the project. Install exact refs together when the project needs local files:\n\n```sh\nnpx @drawcall/market install <name@range...> --cwd \"$PWD\"\n```\n\nInstall records `assetDependencies` in the nearest `package.json`. `list --cwd \"$PWD\"` reads that inventory without network access. Run `sync --cwd \"$PWD\"` after moving installed files so aliases continue to resolve. Use `--force` only with permission to overwrite changed files.\n\nGenerate and install one asset with:\n\n```sh\nnpx @drawcall/market generate --type <type> \"<description>\"\n```\n\nIf it returns a continuation, run the printed `generate install <jobId>` command. The Market agent can source a coherent set of assets from a broader goal:\n\n```sh\nnpx @drawcall/market agent \"<goal>\"\n```\n\nPublish only when asked. `pack <source> --out <zip>` creates a Market archive and `upload <name> <source> \"<description>\" --type <type>` publishes it. Use command help for dependency and visibility options. If authentication is required, ask before running `npx @drawcall/market login`.\n\n## Choose assets\n\nSearch one concrete need at a time. Use one result for an exact lookup and up to three when the user should choose. If nothing fits, try one broader noun phrase before generating a replacement.\n\nThe exact `name@version` returned by Market is authoritative. Copy it verbatim. Generated identifiers can legitimately end mid-word at the catalog limit; never expand, normalize, or reconstruct one from its description.\n\nPreview a finalist when appearance determines whether it fits. File, preview, and zip URLs returned by Market are opaque. Capability-bearing private URLs are secrets; never derive a URL from an asset name or preview metadata.\n\n## Generate\n\nGeneration creates one Market asset from a description. The description is provider input, not the eventual asset name. A fast provider may return the asset immediately; a slow provider returns a continuation ID for the matching status operation. Resume that job instead of starting the same generation again.\n\nReference images must be direct fetchable image URLs or image data, never webpage URLs. The current asset-type metadata says which types support references and how many they accept.\n\nA generated humanoid model is one expressive, animation-ready biped: one head, two arms, two legs, open empty hands, and no companions or scene. Describe identity, theme, silhouette, clothing, colors, and materials. Express topology outside the shared skeleton as costume or body-surface design so the result remains riggable.\n\nRequest public or private access only when visibility matters. Private generation requires the account's `market:private` entitlement.\n\n## Failures\n\nAn error means the operation did not happen. Correct invalid inputs, refresh an exact reference after a not-found response, and retry one upstream failure once. Never repeat an unchanged failed generation. Use unapproved assets only when the user explicitly requests and accepts them.\n";
|
|
2
|
+
export declare const mcpMarketSkill = "---\nname: market\ndescription: Find, inspect, generate, and use Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\n## MCP transport\n\nMCP tools are the only Market transport in this environment. Do not invoke the CLI, make direct API requests, or switch transports after a failed call.\n\nUse the same conceptual workflow as the Market CLI:\n\n```text\nlist_market_asset_types\nsearch_market\nget_market_asset\nget_market_asset_preview\n```\n\n`search_market` requires an asset type and returns exact `name@version` references. Inspect the exact manifest with `get_market_asset`; request its preview only when visual evidence matters. Remote MCP tools return immutable references and fetch-ready URLs. They do not install files into the caller's local project.\n\nWhen generation is available, call `generate_market_asset`. If it returns a `jobId`, continue with `get_market_asset_generation`. Do not start the same generation again.\n\nWhen the Market agent is available, call `start_market_agent_run` with the full goal and continue its returned `runId` with `get_market_agent_run`.\n\nUse an exact Market reference with `create_design_frame` when the selected asset belongs in Drawcall Design.\n\n## Choose assets\n\nSearch one concrete need at a time. Use one result for an exact lookup and up to three when the user should choose. If nothing fits, try one broader noun phrase before generating a replacement.\n\nThe exact `name@version` returned by Market is authoritative. Copy it verbatim. Generated identifiers can legitimately end mid-word at the catalog limit; never expand, normalize, or reconstruct one from its description.\n\nPreview a finalist when appearance determines whether it fits. File, preview, and zip URLs returned by Market are opaque. Capability-bearing private URLs are secrets; never derive a URL from an asset name or preview metadata.\n\n## Generate\n\nGeneration creates one Market asset from a description. The description is provider input, not the eventual asset name. A fast provider may return the asset immediately; a slow provider returns a continuation ID for the matching status operation. Resume that job instead of starting the same generation again.\n\nReference images must be direct fetchable image URLs or image data, never webpage URLs. The current asset-type metadata says which types support references and how many they accept.\n\nA generated humanoid model is one expressive, animation-ready biped: one head, two arms, two legs, open empty hands, and no companions or scene. Describe identity, theme, silhouette, clothing, colors, and materials. Express topology outside the shared skeleton as costume or body-surface design so the result remains riggable.\n\nRequest public or private access only when visibility matters. Private generation requires the account's `market:private` entitlement.\n\n## Failures\n\nAn error means the operation did not happen. Correct invalid inputs, refresh an exact reference after a not-found response, and retry one upstream failure once. Never repeat an unchanged failed generation. Use unapproved assets only when the user explicitly requests and accepts them.\n";
|
|
3
|
+
//# sourceMappingURL=skill.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.generated.d.ts","sourceRoot":"","sources":["../src/skill.generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,6pHAConH,CAAA;AAC/oH,eAAO,MAAM,cAAc,4mGACglG,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Generated from skill/SKILL.template.md.
|
|
2
|
+
export const cliMarketSkill = '---\nname: market\ndescription: Find, inspect, generate, and use Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\n## CLI transport\n\nRun commands as `npx @drawcall/market <command>`; do not assume a global `market` binary or switch to MCP after a CLI failure. Use `npx @drawcall/market skill` when these instructions are not already available.\n\nDiscover the current vocabulary and choose an asset:\n\n```sh\nnpx @drawcall/market types\nnpx @drawcall/market search "<query>" --type <type> --limit 3\nnpx @drawcall/market preview <name@version> --out /tmp/<name>.png\nnpx @drawcall/market urls <name@version>\n```\n\n`urls` prints one base URL, file subpaths, and a preview URL without changing the project. Install exact refs together when the project needs local files:\n\n```sh\nnpx @drawcall/market install <name@range...> --cwd "$PWD"\n```\n\nInstall records `assetDependencies` in the nearest `package.json`. `list --cwd "$PWD"` reads that inventory without network access. Run `sync --cwd "$PWD"` after moving installed files so aliases continue to resolve. Use `--force` only with permission to overwrite changed files.\n\nGenerate and install one asset with:\n\n```sh\nnpx @drawcall/market generate --type <type> "<description>"\n```\n\nIf it returns a continuation, run the printed `generate install <jobId>` command. The Market agent can source a coherent set of assets from a broader goal:\n\n```sh\nnpx @drawcall/market agent "<goal>"\n```\n\nPublish only when asked. `pack <source> --out <zip>` creates a Market archive and `upload <name> <source> "<description>" --type <type>` publishes it. Use command help for dependency and visibility options. If authentication is required, ask before running `npx @drawcall/market login`.\n\n## Choose assets\n\nSearch one concrete need at a time. Use one result for an exact lookup and up to three when the user should choose. If nothing fits, try one broader noun phrase before generating a replacement.\n\nThe exact `name@version` returned by Market is authoritative. Copy it verbatim. Generated identifiers can legitimately end mid-word at the catalog limit; never expand, normalize, or reconstruct one from its description.\n\nPreview a finalist when appearance determines whether it fits. File, preview, and zip URLs returned by Market are opaque. Capability-bearing private URLs are secrets; never derive a URL from an asset name or preview metadata.\n\n## Generate\n\nGeneration creates one Market asset from a description. The description is provider input, not the eventual asset name. A fast provider may return the asset immediately; a slow provider returns a continuation ID for the matching status operation. Resume that job instead of starting the same generation again.\n\nReference images must be direct fetchable image URLs or image data, never webpage URLs. The current asset-type metadata says which types support references and how many they accept.\n\nA generated humanoid model is one expressive, animation-ready biped: one head, two arms, two legs, open empty hands, and no companions or scene. Describe identity, theme, silhouette, clothing, colors, and materials. Express topology outside the shared skeleton as costume or body-surface design so the result remains riggable.\n\nRequest public or private access only when visibility matters. Private generation requires the account\'s `market:private` entitlement.\n\n## Failures\n\nAn error means the operation did not happen. Correct invalid inputs, refresh an exact reference after a not-found response, and retry one upstream failure once. Never repeat an unchanged failed generation. Use unapproved assets only when the user explicitly requests and accepts them.\n';
|
|
3
|
+
export const mcpMarketSkill = "---\nname: market\ndescription: Find, inspect, generate, and use Drawcall Market assets from a coding agent.\n---\n\n# Drawcall Market\n\n## MCP transport\n\nMCP tools are the only Market transport in this environment. Do not invoke the CLI, make direct API requests, or switch transports after a failed call.\n\nUse the same conceptual workflow as the Market CLI:\n\n```text\nlist_market_asset_types\nsearch_market\nget_market_asset\nget_market_asset_preview\n```\n\n`search_market` requires an asset type and returns exact `name@version` references. Inspect the exact manifest with `get_market_asset`; request its preview only when visual evidence matters. Remote MCP tools return immutable references and fetch-ready URLs. They do not install files into the caller's local project.\n\nWhen generation is available, call `generate_market_asset`. If it returns a `jobId`, continue with `get_market_asset_generation`. Do not start the same generation again.\n\nWhen the Market agent is available, call `start_market_agent_run` with the full goal and continue its returned `runId` with `get_market_agent_run`.\n\nUse an exact Market reference with `create_design_frame` when the selected asset belongs in Drawcall Design.\n\n## Choose assets\n\nSearch one concrete need at a time. Use one result for an exact lookup and up to three when the user should choose. If nothing fits, try one broader noun phrase before generating a replacement.\n\nThe exact `name@version` returned by Market is authoritative. Copy it verbatim. Generated identifiers can legitimately end mid-word at the catalog limit; never expand, normalize, or reconstruct one from its description.\n\nPreview a finalist when appearance determines whether it fits. File, preview, and zip URLs returned by Market are opaque. Capability-bearing private URLs are secrets; never derive a URL from an asset name or preview metadata.\n\n## Generate\n\nGeneration creates one Market asset from a description. The description is provider input, not the eventual asset name. A fast provider may return the asset immediately; a slow provider returns a continuation ID for the matching status operation. Resume that job instead of starting the same generation again.\n\nReference images must be direct fetchable image URLs or image data, never webpage URLs. The current asset-type metadata says which types support references and how many they accept.\n\nA generated humanoid model is one expressive, animation-ready biped: one head, two arms, two legs, open empty hands, and no companions or scene. Describe identity, theme, silhouette, clothing, colors, and materials. Express topology outside the shared skeleton as costume or body-surface design so the result remains riggable.\n\nRequest public or private access only when visibility matters. Private generation requires the account's `market:private` entitlement.\n\n## Failures\n\nAn error means the operation did not happen. Correct invalid inputs, refresh an exact reference after a not-found response, and retry one upstream failure once. Never repeat an unchanged failed generation. Use unapproved assets only when the user explicitly requests and accepts them.\n";
|
|
4
|
+
//# sourceMappingURL=skill.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.generated.js","sourceRoot":"","sources":["../src/skill.generated.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,CAAC,MAAM,cAAc,GACzB,6oHAA6oH,CAAA;AAC/oH,MAAM,CAAC,MAAM,cAAc,GACzB,ymGAAymG,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAE7E,wBAAgB,eAAe,CAAC,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAI3E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createLoginCommand, createLogoutCommand } from './auth.js';
|
|
2
|
+
import { createMarketCommand } from './command.js';
|
|
3
|
+
export function createMarketCli(options = {}) {
|
|
4
|
+
return createMarketCommand(options)
|
|
5
|
+
.addCommand(createLoginCommand())
|
|
6
|
+
.addCommand(createLogoutCommand());
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=standalone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standalone.js","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAA6B,MAAM,cAAc,CAAA;AAE7E,MAAM,UAAU,eAAe,CAAC,UAAgC,EAAE;IAChE,OAAO,mBAAmB,CAAC,OAAO,CAAC;SAChC,UAAU,CAAC,kBAAkB,EAAE,CAAC;SAChC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAA;AACtC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawcall/market",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/drawcall-ai/market",
|
|
@@ -27,12 +27,15 @@
|
|
|
27
27
|
"market": "./dist/cli.js"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
-
"
|
|
30
|
+
"generate": "node scripts/generate-skill.mjs",
|
|
31
|
+
"build": "pnpm run generate && rm -rf dist && tsc -p tsconfig.build.json",
|
|
31
32
|
"prepack": "npm run build && node scripts/prepare-publish.mjs",
|
|
32
33
|
"postpack": "node scripts/restore-package.mjs",
|
|
33
34
|
"dev": "tsx src/cli.ts",
|
|
35
|
+
"pretest": "pnpm run generate",
|
|
34
36
|
"test": "tsx --test tests/*.test.ts",
|
|
35
37
|
"test:install-layout": "tsx --test tests/install-layout.test.ts tests/install-lock.test.ts tests/install-command.test.ts tests/list-command.test.ts tests/pack.test.ts",
|
|
38
|
+
"pretypecheck": "pnpm run generate",
|
|
36
39
|
"typecheck": "tsc --noEmit"
|
|
37
40
|
},
|
|
38
41
|
"dependencies": {
|
|
@@ -49,7 +52,16 @@
|
|
|
49
52
|
"semver": "^7.7.0",
|
|
50
53
|
"zod": "^4.3.6"
|
|
51
54
|
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@modelcontextprotocol/server": "^2.0.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"@modelcontextprotocol/server": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
52
63
|
"devDependencies": {
|
|
64
|
+
"@modelcontextprotocol/server": "^2.0.0",
|
|
53
65
|
"@types/node": "^25.6.0",
|
|
54
66
|
"@types/semver": "^7.5.0",
|
|
55
67
|
"tsx": "^4.19.0",
|
package/skills/market/SKILL.md
CHANGED
|
@@ -1,58 +1,63 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: market
|
|
3
|
-
description: Find,
|
|
3
|
+
description: Find, inspect, generate, and use Drawcall Market assets from a coding agent.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Drawcall Market
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## CLI transport
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Run commands as `npx @drawcall/market <command>`; do not assume a global `market` binary or switch to MCP after a CLI failure. Use `npx @drawcall/market skill` when these instructions are not already available.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Discover the current vocabulary and choose an asset:
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
```sh
|
|
15
|
+
npx @drawcall/market types
|
|
16
|
+
npx @drawcall/market search "<query>" --type <type> --limit 3
|
|
17
|
+
npx @drawcall/market preview <name@version> --out /tmp/<name>.png
|
|
18
|
+
npx @drawcall/market urls <name@version>
|
|
19
|
+
```
|
|
15
20
|
|
|
16
|
-
`
|
|
21
|
+
`urls` prints one base URL, file subpaths, and a preview URL without changing the project. Install exact refs together when the project needs local files:
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
```sh
|
|
24
|
+
npx @drawcall/market install <name@range...> --cwd "$PWD"
|
|
25
|
+
```
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
Install records `assetDependencies` in the nearest `package.json`. `list --cwd "$PWD"` reads that inventory without network access. Run `sync --cwd "$PWD"` after moving installed files so aliases continue to resolve. Use `--force` only with permission to overwrite changed files.
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
Generate and install one asset with:
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
```sh
|
|
32
|
+
npx @drawcall/market generate --type <type> "<description>"
|
|
33
|
+
```
|
|
25
34
|
|
|
26
|
-
`
|
|
35
|
+
If it returns a continuation, run the printed `generate install <jobId>` command. The Market agent can source a coherent set of assets from a broader goal:
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
```sh
|
|
38
|
+
npx @drawcall/market agent "<goal>"
|
|
39
|
+
```
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
Publish only when asked. `pack <source> --out <zip>` creates a Market archive and `upload <name> <source> "<description>" --type <type>` publishes it. Use command help for dependency and visibility options. If authentication is required, ask before running `npx @drawcall/market login`.
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
## Choose assets
|
|
33
44
|
|
|
34
|
-
|
|
45
|
+
Search one concrete need at a time. Use one result for an exact lookup and up to three when the user should choose. If nothing fits, try one broader noun phrase before generating a replacement.
|
|
35
46
|
|
|
36
|
-
|
|
47
|
+
The exact `name@version` returned by Market is authoritative. Copy it verbatim. Generated identifiers can legitimately end mid-word at the catalog limit; never expand, normalize, or reconstruct one from its description.
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
An `assetDependencies` entry is either a range string or `{ "version": "<range>", "alias": { "<canonical path>": "<current path>" } }`. An alias records where the project keeps a renamed installed file: install writes the file at the aliased path, and packing omits exactly that one copy (extra duplicates ship as project content). Run `sync --cwd "$PWD"` after renaming installed files to record aliases in `package.json`; template packing runs the same update automatically.
|
|
49
|
+
Preview a finalist when appearance determines whether it fits. File, preview, and zip URLs returned by Market are opaque. Capability-bearing private URLs are secrets; never derive a URL from an asset name or preview metadata.
|
|
41
50
|
|
|
42
51
|
## Generate
|
|
43
52
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
The description is provider input, not the installed filename. The command's successful output is the source of truth for consumer paths, so update a consumer with its exact printed browser path after success. If generation fails, leave the current path unchanged.
|
|
47
|
-
|
|
48
|
-
Add repeatable `--reference-image <file-or-url>` when the result should match given images; `types` shows which asset types accept reference images. A remote ref must be a direct fetchable image URL, never a webpage URL; use the page only to find its underlying image. An environment matches the look of the references (at most 4). Types without reference image support reject them.
|
|
53
|
+
Generation creates one Market asset from a description. The description is provider input, not the eventual asset name. A fast provider may return the asset immediately; a slow provider returns a continuation ID for the matching status operation. Resume that job instead of starting the same generation again.
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
Reference images must be direct fetchable image URLs or image data, never webpage URLs. The current asset-type metadata says which types support references and how many they accept.
|
|
51
56
|
|
|
52
|
-
|
|
57
|
+
A generated humanoid model is one expressive, animation-ready biped: one head, two arms, two legs, open empty hands, and no companions or scene. Describe identity, theme, silhouette, clothing, colors, and materials. Express topology outside the shared skeleton as costume or body-surface design so the result remains riggable.
|
|
53
58
|
|
|
54
|
-
|
|
59
|
+
Request public or private access only when visibility matters. Private generation requires the account's `market:private` entitlement.
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
## Failures
|
|
57
62
|
|
|
58
|
-
|
|
63
|
+
An error means the operation did not happen. Correct invalid inputs, refresh an exact reference after a not-found response, and retry one upstream failure once. Never repeat an unchanged failed generation. Use unapproved assets only when the user explicitly requests and accepts them.
|
package/src/auth.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfigPath as getAuthConfigPath,
|
|
3
|
+
runDeviceLogin,
|
|
4
|
+
saveAuthToken,
|
|
5
|
+
signOut,
|
|
6
|
+
} from '@drawcall/auth'
|
|
7
|
+
import { Command, Option } from 'commander'
|
|
8
|
+
import { logout } from './commands/logout.js'
|
|
9
|
+
import { clearConfig, saveConfig } from './config.js'
|
|
10
|
+
import { loginResult } from './output.js'
|
|
11
|
+
import { createClient } from './v1/client.js'
|
|
12
|
+
|
|
13
|
+
const DEFAULT_BASE_URL = 'https://market.drawcall.ai'
|
|
14
|
+
|
|
15
|
+
export function createLoginCommand(): Command {
|
|
16
|
+
return new Command('login')
|
|
17
|
+
.description('Sign in')
|
|
18
|
+
.addOption(
|
|
19
|
+
new Option('--api <url>', 'API URL').default(
|
|
20
|
+
process.env.MARKET_API_URL,
|
|
21
|
+
'from MARKET_API_URL / config / default',
|
|
22
|
+
),
|
|
23
|
+
)
|
|
24
|
+
.action(async (options: { api?: string }) => {
|
|
25
|
+
const baseUrl = options.api ?? DEFAULT_BASE_URL
|
|
26
|
+
const token = await runDeviceLogin()
|
|
27
|
+
const client = createClient({ baseUrl, authToken: token })
|
|
28
|
+
const profile = await client.user.getProfile()
|
|
29
|
+
if (!profile) throw new Error('The Market API did not accept the auth token.')
|
|
30
|
+
|
|
31
|
+
if (options.api) await saveConfig({ baseUrl: options.api })
|
|
32
|
+
else await clearConfig()
|
|
33
|
+
await saveAuthToken(token)
|
|
34
|
+
console.log(loginResult(profile.email, getAuthConfigPath()))
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function createLogoutCommand(): Command {
|
|
39
|
+
return new Command('logout').description('Sign out').action(async () => {
|
|
40
|
+
await logout(await signOut())
|
|
41
|
+
})
|
|
42
|
+
}
|
package/src/cli.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { createMarketCommand } from './command.js'
|
|
4
3
|
import { errorResult } from './output.js'
|
|
4
|
+
import { createMarketCli } from './standalone.js'
|
|
5
5
|
|
|
6
|
-
const program =
|
|
6
|
+
const program = createMarketCli()
|
|
7
7
|
|
|
8
8
|
if (process.argv.length <= 2) {
|
|
9
9
|
program.outputHelp()
|
package/src/command.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'
|
|
2
|
-
import {
|
|
3
|
-
getConfigPath as getAuthConfigPath,
|
|
4
|
-
runDeviceLogin,
|
|
5
|
-
saveAuthToken,
|
|
6
|
-
signOut,
|
|
7
|
-
} from '@drawcall/auth'
|
|
8
2
|
import { Command, Option } from 'commander'
|
|
9
3
|
import { ASSET_TYPES, type AssetAccess, type AssetType } from './schemas.js'
|
|
10
4
|
import { installCommand } from './commands/install.js'
|
|
@@ -19,19 +13,12 @@ import { previewCommand } from './commands/preview.js'
|
|
|
19
13
|
import { urlsCommand } from './commands/urls.js'
|
|
20
14
|
import { uploadCommand } from './commands/upload.js'
|
|
21
15
|
import { typesCommand } from './commands/types.js'
|
|
22
|
-
import {
|
|
23
|
-
import { clearConfig, saveConfig } from './config.js'
|
|
24
|
-
import { loginResult } from './output.js'
|
|
25
|
-
import { marketSkill } from './skill.js'
|
|
26
|
-
import { createClient } from './v1/client.js'
|
|
27
|
-
|
|
28
|
-
const DEFAULT_BASE_URL = 'https://market.drawcall.ai'
|
|
16
|
+
import { cliMarketSkill } from './skill.generated.js'
|
|
29
17
|
|
|
30
18
|
export interface MarketCommandOptions {
|
|
31
19
|
name?: string
|
|
32
20
|
invocation?: string
|
|
33
21
|
version?: string
|
|
34
|
-
includeAuthCommands?: boolean
|
|
35
22
|
}
|
|
36
23
|
|
|
37
24
|
export function createMarketCommand(options: MarketCommandOptions = {}): Command {
|
|
@@ -73,7 +60,7 @@ export function createMarketCommand(options: MarketCommandOptions = {}): Command
|
|
|
73
60
|
.command('skill')
|
|
74
61
|
.description('Print the Market agent skill')
|
|
75
62
|
.action(() => {
|
|
76
|
-
process.stdout.write(
|
|
63
|
+
process.stdout.write(cliMarketSkill)
|
|
77
64
|
})
|
|
78
65
|
|
|
79
66
|
program
|
|
@@ -84,8 +71,6 @@ export function createMarketCommand(options: MarketCommandOptions = {}): Command
|
|
|
84
71
|
await typesCommand(opts.api)
|
|
85
72
|
})
|
|
86
73
|
|
|
87
|
-
if (options.includeAuthCommands ?? true) addAuthCommands(program, apiOption)
|
|
88
|
-
|
|
89
74
|
program
|
|
90
75
|
.command('install')
|
|
91
76
|
.description(
|
|
@@ -368,32 +353,6 @@ export function createMarketCommand(options: MarketCommandOptions = {}): Command
|
|
|
368
353
|
return program
|
|
369
354
|
}
|
|
370
355
|
|
|
371
|
-
function addAuthCommands(program: Command, apiOption: Option): void {
|
|
372
|
-
program
|
|
373
|
-
.command('login')
|
|
374
|
-
.description('Sign in')
|
|
375
|
-
.addOption(apiOption)
|
|
376
|
-
.action(async (opts: { api?: string }) => {
|
|
377
|
-
const baseUrl = opts.api ?? DEFAULT_BASE_URL
|
|
378
|
-
const token = await runDeviceLogin()
|
|
379
|
-
const client = createClient({ baseUrl, authToken: token })
|
|
380
|
-
const profile = await client.user.getProfile()
|
|
381
|
-
if (!profile) throw new Error('The Market API did not accept the auth token.')
|
|
382
|
-
|
|
383
|
-
if (opts.api) await saveConfig({ baseUrl: opts.api })
|
|
384
|
-
else await clearConfig()
|
|
385
|
-
await saveAuthToken(token)
|
|
386
|
-
console.log(loginResult(profile.email, getAuthConfigPath()))
|
|
387
|
-
})
|
|
388
|
-
|
|
389
|
-
program
|
|
390
|
-
.command('logout')
|
|
391
|
-
.description('Sign out')
|
|
392
|
-
.action(async () => {
|
|
393
|
-
await logout(await signOut())
|
|
394
|
-
})
|
|
395
|
-
}
|
|
396
|
-
|
|
397
356
|
function requireType(type: AssetType | undefined, command: string): asserts type is AssetType {
|
|
398
357
|
if (!type) {
|
|
399
358
|
throw new Error(`${command} requires --type. Available types: ${ASSET_TYPES.join(', ')}`)
|
package/src/commands/preview.ts
CHANGED
|
@@ -2,9 +2,8 @@ import * as fs from 'fs/promises'
|
|
|
2
2
|
import * as path from 'path'
|
|
3
3
|
import ora from 'ora'
|
|
4
4
|
import { getCliClient } from '../cli-client.js'
|
|
5
|
-
import type
|
|
5
|
+
import { resolveAsset, type RefsReader } from '../refs.js'
|
|
6
6
|
import { previewResult } from '../output.js'
|
|
7
|
-
import { resolveAssetRef } from './asset-ref.js'
|
|
8
7
|
|
|
9
8
|
export interface PreviewCommandOptions {
|
|
10
9
|
unapproved?: boolean
|
|
@@ -17,7 +16,7 @@ export async function resolvePreviewRef(
|
|
|
17
16
|
ref: string,
|
|
18
17
|
includeUnapproved: boolean,
|
|
19
18
|
): Promise<{ name: string; version: string; previewUrl: string }> {
|
|
20
|
-
const asset = await
|
|
19
|
+
const asset = await resolveAsset(client, ref, { includeUnapproved })
|
|
21
20
|
if (!asset.previewUrl) {
|
|
22
21
|
throw new Error(`Asset "${ref}" has no preview image`)
|
|
23
22
|
}
|
package/src/commands/urls.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AssetFileEntry } from '../contract.js'
|
|
|
2
2
|
import { getCliClient } from '../cli-client.js'
|
|
3
3
|
import { assetUrlsResult } from '../output.js'
|
|
4
4
|
import type { RefsReader } from '../refs.js'
|
|
5
|
-
import {
|
|
5
|
+
import { resolveAsset } from '../refs.js'
|
|
6
6
|
|
|
7
7
|
export interface AssetUrls {
|
|
8
8
|
name: string
|
|
@@ -23,7 +23,7 @@ export async function resolveAssetUrls(
|
|
|
23
23
|
ref: string,
|
|
24
24
|
opts: Pick<UrlsCommandOptions, 'unapproved' | 'key'> = {},
|
|
25
25
|
): Promise<AssetUrls> {
|
|
26
|
-
const asset = await
|
|
26
|
+
const asset = await resolveAsset(client, ref, {
|
|
27
27
|
includeUnapproved: opts.unapproved,
|
|
28
28
|
key: opts.key,
|
|
29
29
|
})
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,16 @@ export async function createMarketCommand(options: MarketCommandModule.MarketCom
|
|
|
16
16
|
// The v1 REST surface (`/api/v1`): routed contract + typed client.
|
|
17
17
|
export * as v1 from './v1/index.js'
|
|
18
18
|
|
|
19
|
+
export {
|
|
20
|
+
registerMarketTools,
|
|
21
|
+
type MarketMcpCapabilities,
|
|
22
|
+
type MarketMcpOptions,
|
|
23
|
+
type MarketMcpServer,
|
|
24
|
+
type MarketMcpToolResult,
|
|
25
|
+
} from './mcp/index.js'
|
|
26
|
+
|
|
27
|
+
export { cliMarketSkill, mcpMarketSkill } from './skill.generated.js'
|
|
28
|
+
|
|
19
29
|
// Client (an alias of the v1 client)
|
|
20
30
|
export { downloadAssetZipBytes } from './client.js'
|
|
21
31
|
export type { MarketClient, MarketClientOptions } from './client.js'
|