@bulkgrid/cli 0.2.0 → 0.4.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/dist/cli.js +28 -10
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -24,26 +24,44 @@ function registerSourceCommands(program, clientFactory = createSourceClient) {
|
|
|
24
24
|
const sources = program.command("sources").description("Inspect and manage sources with a scoped API key; outputs JSON");
|
|
25
25
|
const command = (name, description) => sources.command(name).description(description).option("--url <url>", "Bulkgrid origin; defaults to BULKGRID_URL or https://bulkgrid.com");
|
|
26
26
|
const print = (result) => console.log(JSON.stringify(result, null, 2));
|
|
27
|
-
command("find <query>", "Find existing sources before adding one").action(async (query, options) => print(await clientFactory(options).sources.search(query)));
|
|
28
|
-
command("analyze <sourceUrl>", "Start deeper analysis; may create a crawl run and consume resources").action(async (url, options) => print(await clientFactory(options).sources.analyze({ url })));
|
|
29
|
-
command("analysis-status <analysisId>", "Read analysis progress and warnings").action(async (analysisId, options) => print(await clientFactory(options).sources.getAnalysis(uuid.parse(analysisId))));
|
|
27
|
+
command("find <query>", "Find existing sources before adding one").action(async (query, options) => print(await clientFactory(options).index.sources.search(query)));
|
|
28
|
+
command("analyze <sourceUrl>", "Start deeper analysis; may create a crawl run and consume resources").action(async (url, options) => print(await clientFactory(options).index.sources.analyze({ url })));
|
|
29
|
+
command("analysis-status <analysisId>", "Read analysis progress and warnings").action(async (analysisId, options) => print(await clientFactory(options).index.sources.getAnalysis(uuid.parse(analysisId))));
|
|
30
30
|
command("add", "Create or subscribe to a source; may initiate ongoing ingestion").requiredOption("--input <json>", "Source configuration JSON including explicit visibility, boundaries and refresh interval").action(async (options) => {
|
|
31
31
|
const input = sourceInputSchemas.create.safeExtend({ visibility: z.enum(["public", "private"]) }).parse(JSON.parse(options.input ?? "{}"));
|
|
32
|
-
print(await clientFactory(options).sources.create(input));
|
|
32
|
+
print(await clientFactory(options).index.sources.create(input));
|
|
33
33
|
});
|
|
34
|
-
command("
|
|
35
|
-
command("
|
|
36
|
-
command("
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
command("github-connections", "List workspace GitHub connections and permitted repositories").action(async (options) => print(await clientFactory(options).index.sources.githubConnections()));
|
|
35
|
+
command("subscribe <sourceId>", "Subscribe to an existing public source without starting ingestion").action(async (sourceId, options) => print(await clientFactory(options).index.sources.subscribe(uuid.parse(sourceId))));
|
|
36
|
+
command("add-github", "Create a GitHub source; private repositories require a workspace connection").requiredOption("--input <json>", "Repository URL, explicit visibility, connection_id for private repositories and indexing settings").action(async (options) => {
|
|
37
|
+
const input = sourceInputSchemas.createGithub.extend({
|
|
38
|
+
repositoryUrl: z.url(),
|
|
39
|
+
visibility: z.enum(["public", "private"])
|
|
40
|
+
}).parse(JSON.parse(options.input ?? "{}"));
|
|
41
|
+
sourceInputSchemas.createGithub.parse(input);
|
|
42
|
+
print(await clientFactory(options).index.sources.createGithub(input));
|
|
43
|
+
});
|
|
44
|
+
command("analyze-github", "Analyze documentation paths in a permitted GitHub repository").requiredOption("--input <json>", "Repository URL and optional connection_id and ref").action(async (options) => {
|
|
45
|
+
const input = sourceInputSchemas.analyzeGithub.extend({ repositoryUrl: z.url() }).parse(JSON.parse(options.input ?? "{}"));
|
|
46
|
+
sourceInputSchemas.analyzeGithub.parse(input);
|
|
47
|
+
print(await clientFactory(options).index.sources.analyzeGithub(input));
|
|
48
|
+
});
|
|
49
|
+
command("status <sourceId>", "Read crawl status, errors, size and indexed item counts").action(async (sourceId, options) => print(await clientFactory(options).index.sources.status(uuid.parse(sourceId))));
|
|
50
|
+
command("recrawl <sourceId>", "Start a manual refresh using saved configuration; may consume credits").action(async (sourceId, options) => print(await clientFactory(options).index.sources.recrawl(uuid.parse(sourceId))));
|
|
51
|
+
command("collections", "List collections available for source management").action(async (options) => print(await clientFactory(options).index.collections.list()));
|
|
52
|
+
command("rules <collectionId>", "Inspect collection rules before changing membership").action(async (collectionId, options) => print(await clientFactory(options).index.collections.rules(uuid.parse(collectionId))));
|
|
53
|
+
command("include <sourceId> <collectionId>", "Include the entire source in a collection, broadening its retrieval coverage").action(async (sourceId, collectionId, options) => print(await clientFactory(options).index.collections.addSource({
|
|
39
54
|
sourceId: uuid.parse(sourceId),
|
|
40
55
|
collectionId: uuid.parse(collectionId)
|
|
41
56
|
})));
|
|
42
57
|
}
|
|
43
58
|
//#endregion
|
|
59
|
+
//#region package.json
|
|
60
|
+
var version = "0.4.0";
|
|
61
|
+
//#endregion
|
|
44
62
|
//#region src/cli.ts
|
|
45
63
|
const program = new Command();
|
|
46
|
-
program.name("bulkgrid").description("Bulkgrid developer tooling").version(
|
|
64
|
+
program.name("bulkgrid").description("Bulkgrid developer tooling").version(version);
|
|
47
65
|
const auth = new CliAuth();
|
|
48
66
|
program.command("login").description("Sign in to Bulkgrid in your browser").option("--url <url>", "Bulkgrid base URL; defaults to BULKGRID_URL or https://bulkgrid.com").option("--no-browser", "print the login URL without opening a browser").action(async (options) => {
|
|
49
67
|
const session = await auth.login(options);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","names":[],"sources":["../src/sources.ts","../src/cli.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { BulkgridClient, sourceInputSchemas } from '@bulkgrid/sdk';\nimport { z } from 'zod';\n\ninterface SourceCommandOptions {\n url?: string;\n input?: string;\n}\ntype ClientFactory = (options: SourceCommandOptions) => BulkgridClient;\nconst uuid = z.uuid();\n\nexport function createSourceClient(options: SourceCommandOptions): BulkgridClient {\n const apiKey = process.env.BULKGRID_API_KEY;\n if (!apiKey) {\n throw new Error(\n 'Source commands require BULKGRID_API_KEY with explicit source/collection scopes. CLI OAuth login remains search-only.',\n );\n }\n const baseUrl = new URL(options.url ?? process.env.BULKGRID_URL ?? 'https://bulkgrid.com');\n if (baseUrl.username || baseUrl.password || baseUrl.search || baseUrl.hash || baseUrl.pathname !== '/') {\n throw new Error('Use a Bulkgrid origin URL without credentials, a path, query, or fragment.');\n }\n if (\n baseUrl.protocol !== 'https:' &&\n !(baseUrl.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(baseUrl.hostname))\n ) {\n throw new Error('Remote Bulkgrid deployments require HTTPS.');\n }\n return new BulkgridClient({ apiKey, baseUrl: baseUrl.origin });\n}\n\nexport function registerSourceCommands(program: Command, clientFactory: ClientFactory = createSourceClient): void {\n const sources = program.command('sources').description('Inspect and manage sources with a scoped API key; outputs JSON');\n const command = (name: string, description: string) =>\n sources\n .command(name)\n .description(description)\n .option('--url <url>', 'Bulkgrid origin; defaults to BULKGRID_URL or https://bulkgrid.com');\n const print = (result: unknown) => console.log(JSON.stringify(result, null, 2));\n command('find <query>', 'Find existing sources before adding one').action(\n async (query: string, options: SourceCommandOptions) => print(await clientFactory(options).sources.search(query)),\n );\n command('analyze <sourceUrl>', 'Start deeper analysis; may create a crawl run and consume resources').action(\n async (url: string, options: SourceCommandOptions) => print(await clientFactory(options).sources.analyze({ url })),\n );\n command('analysis-status <analysisId>', 'Read analysis progress and warnings').action(\n async (analysisId: string, options: SourceCommandOptions) =>\n print(await clientFactory(options).sources.getAnalysis(uuid.parse(analysisId))),\n );\n command('add', 'Create or subscribe to a source; may initiate ongoing ingestion')\n .requiredOption('--input <json>', 'Source configuration JSON including explicit visibility, boundaries and refresh interval')\n .action(async (options: SourceCommandOptions) => {\n const input = sourceInputSchemas.create\n .safeExtend({ visibility: z.enum(['public', 'private']) })\n .parse(JSON.parse(options.input ?? '{}'));\n print(await clientFactory(options).sources.create(input));\n });\n command('status <sourceId>', 'Read crawl status, errors, size and indexed item counts').action(\n async (sourceId: string, options: SourceCommandOptions) =>\n print(await clientFactory(options).sources.status(uuid.parse(sourceId))),\n );\n command('recrawl <sourceId>', 'Start a manual refresh using saved configuration; may consume credits').action(\n async (sourceId: string, options: SourceCommandOptions) =>\n print(await clientFactory(options).sources.recrawl(uuid.parse(sourceId))),\n );\n command('collections', 'List collections available for source management').action(async (options: SourceCommandOptions) =>\n print(await clientFactory(options).collections.list()),\n );\n command('rules <collectionId>', 'Inspect collection rules before changing membership').action(\n async (collectionId: string, options: SourceCommandOptions) =>\n print(await clientFactory(options).collections.rules(uuid.parse(collectionId))),\n );\n command(\n 'include <sourceId> <collectionId>',\n 'Include the entire source in a collection, broadening its retrieval coverage',\n ).action(async (sourceId: string, collectionId: string, options: SourceCommandOptions) =>\n print(\n await clientFactory(options).collections.addSource({\n sourceId: uuid.parse(sourceId),\n collectionId: uuid.parse(collectionId),\n }),\n ),\n );\n}\n","#!/usr/bin/env node\nimport { registerSourceCommands } from './sources.js';\nimport { Command } from 'commander';\n\nimport { CliAuth } from './auth.js';\n\nimport { runInitCommand } from './init.js';\n\nconst program = new Command();\n\nprogram.name('bulkgrid').description('Bulkgrid developer tooling').version('0.1.0');\n\nconst auth = new CliAuth();\n\nprogram\n .command('login')\n .description('Sign in to Bulkgrid in your browser')\n .option('--url <url>', 'Bulkgrid base URL; defaults to BULKGRID_URL or https://bulkgrid.com')\n .option('--no-browser', 'print the login URL without opening a browser')\n .action(async options => {\n const session = await auth.login(options);\n console.log(`Logged in to workspace ${session.workspaceId}. Manage access in Settings → Connected Apps.`);\n });\n\nprogram\n .command('status')\n .description('Verify the saved CLI connection and show its access')\n .option('--url <url>', 'Bulkgrid base URL; defaults to BULKGRID_URL or https://bulkgrid.com')\n .action(async options => {\n const session = await auth.status(options.url);\n console.log(`Connected as ${session.userId} to workspace ${session.workspaceId}.`);\n console.log(`Permissions: ${session.scopes.join(', ')}; collections: ${session.collectionScope}.`);\n });\n\nprogram\n .command('logout')\n .description('Revoke this CLI connection and remove its saved tokens')\n .option('--url <url>', 'Bulkgrid base URL; defaults to BULKGRID_URL or https://bulkgrid.com')\n .option('--local', 'only remove local tokens; revoke access separately in Connected Apps')\n .action(async options => {\n await auth.logout(options);\n console.log(options.local ? 'Local credentials removed. Server access was not revoked.' : 'Logged out.');\n });\n\nprogram\n .command('init')\n .description('Configure the Bulkgrid MCP server')\n .option('--all', 'configure all supported agents')\n .option('--cursor', 'configure Cursor')\n .option('--vscode', 'configure VS Code')\n .option('--claude', 'configure Claude Code')\n .option('--codex', 'configure Codex')\n .option('--mcp-url <url>', 'Bulkgrid MCP server URL')\n .option('--api-key <key>', 'Bulkgrid API key; defaults to BULKGRID_API_KEY')\n .option('--global', 'write global user configuration where supported')\n .option('--project', 'write project configuration where supported')\n .option('--yes', 'do not prompt for missing values')\n .option('--write-api-key', 'write the API key into generated JSON config files')\n .option('--install-global', 'install @bulkgrid/cli globally before configuring agents')\n .option('--auth <mode>', 'authentication mode: browser, manual, or skip')\n .action(async options => {\n try {\n const results = await runInitCommand(options);\n if (results.length === 0) {\n console.log('No MCP clients configured.');\n return;\n }\n for (const result of results) {\n const marker = result.status === 'configured' ? 'configured' : 'skipped';\n console.log(`${result.agent}: ${marker} - ${result.message}`);\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error(`bulkgrid init failed: ${message}`);\n process.exitCode = 1;\n }\n });\n\nregisterSourceCommands(program);\n\nprogram.parseAsync().catch(error => {\n console.error(`bulkgrid: ${error instanceof Error ? error.message : 'Command failed'}`);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;AASA,MAAM,OAAO,EAAE,KAAK;AAEpB,SAAgB,mBAAmB,SAA+C;CAChF,MAAM,SAAS,QAAQ,IAAI;CAC3B,IAAI,CAAC,QACH,MAAM,IAAI,MACR,uHACF;CAEF,MAAM,UAAU,IAAI,IAAI,QAAQ,OAAO,QAAQ,IAAI,gBAAgB,sBAAsB;CACzF,IAAI,QAAQ,YAAY,QAAQ,YAAY,QAAQ,UAAU,QAAQ,QAAQ,QAAQ,aAAa,KACjG,MAAM,IAAI,MAAM,4EAA4E;CAE9F,IACE,QAAQ,aAAa,YACrB,EAAE,QAAQ,aAAa,WAAW;EAAC;EAAa;EAAa;CAAO,CAAC,CAAC,SAAS,QAAQ,QAAQ,IAE/F,MAAM,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SAAS,OAAO;EACd,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;EACzD,QAAQ,MAAM,yBAAyB,SAAS;EAChD,QAAQ,WAAW;CACrB;AACF,CAAC;AAEH,uBAAuB,OAAO;AAE9B,QAAQ,WAAW,CAAC,CAAC,OAAM,UAAS;CAClC,QAAQ,MAAM,aAAa,iBAAiB,QAAQ,MAAM,UAAU,kBAAkB;CACtF,QAAQ,WAAW;AACrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"cli.js","names":["packageMetadata.version"],"sources":["../src/sources.ts","../package.json","../src/cli.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { BulkgridClient, sourceInputSchemas } from '@bulkgrid/sdk';\nimport { z } from 'zod';\n\ninterface SourceCommandOptions {\n url?: string;\n input?: string;\n}\ntype ClientFactory = (options: SourceCommandOptions) => BulkgridClient;\nconst uuid = z.uuid();\n\nexport function createSourceClient(options: SourceCommandOptions): BulkgridClient {\n const apiKey = process.env.BULKGRID_API_KEY;\n if (!apiKey) {\n throw new Error(\n 'Source commands require BULKGRID_API_KEY with explicit source/collection scopes. CLI OAuth login remains search-only.',\n );\n }\n const baseUrl = new URL(options.url ?? process.env.BULKGRID_URL ?? 'https://bulkgrid.com');\n if (baseUrl.username || baseUrl.password || baseUrl.search || baseUrl.hash || baseUrl.pathname !== '/') {\n throw new Error('Use a Bulkgrid origin URL without credentials, a path, query, or fragment.');\n }\n if (\n baseUrl.protocol !== 'https:' &&\n !(baseUrl.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(baseUrl.hostname))\n ) {\n throw new Error('Remote Bulkgrid deployments require HTTPS.');\n }\n return new BulkgridClient({ apiKey, baseUrl: baseUrl.origin });\n}\n\nexport function registerSourceCommands(program: Command, clientFactory: ClientFactory = createSourceClient): void {\n const sources = program.command('sources').description('Inspect and manage sources with a scoped API key; outputs JSON');\n const command = (name: string, description: string) =>\n sources\n .command(name)\n .description(description)\n .option('--url <url>', 'Bulkgrid origin; defaults to BULKGRID_URL or https://bulkgrid.com');\n const print = (result: unknown) => console.log(JSON.stringify(result, null, 2));\n command('find <query>', 'Find existing sources before adding one').action(\n async (query: string, options: SourceCommandOptions) => print(await clientFactory(options).index.sources.search(query)),\n );\n command('analyze <sourceUrl>', 'Start deeper analysis; may create a crawl run and consume resources').action(\n async (url: string, options: SourceCommandOptions) => print(await clientFactory(options).index.sources.analyze({ url })),\n );\n command('analysis-status <analysisId>', 'Read analysis progress and warnings').action(\n async (analysisId: string, options: SourceCommandOptions) =>\n print(await clientFactory(options).index.sources.getAnalysis(uuid.parse(analysisId))),\n );\n command('add', 'Create or subscribe to a source; may initiate ongoing ingestion')\n .requiredOption('--input <json>', 'Source configuration JSON including explicit visibility, boundaries and refresh interval')\n .action(async (options: SourceCommandOptions) => {\n const input = sourceInputSchemas.create\n .safeExtend({ visibility: z.enum(['public', 'private']) })\n .parse(JSON.parse(options.input ?? '{}'));\n print(await clientFactory(options).index.sources.create(input));\n });\n command('github-connections', 'List workspace GitHub connections and permitted repositories').action(\n async (options: SourceCommandOptions) => print(await clientFactory(options).index.sources.githubConnections()),\n );\n command('subscribe <sourceId>', 'Subscribe to an existing public source without starting ingestion').action(\n async (sourceId: string, options: SourceCommandOptions) =>\n print(await clientFactory(options).index.sources.subscribe(uuid.parse(sourceId))),\n );\n command('add-github', 'Create a GitHub source; private repositories require a workspace connection')\n .requiredOption(\n '--input <json>',\n 'Repository URL, explicit visibility, connection_id for private repositories and indexing settings',\n )\n .action(async (options: SourceCommandOptions) => {\n const input = sourceInputSchemas.createGithub\n .extend({ repositoryUrl: z.url(), visibility: z.enum(['public', 'private']) })\n .parse(JSON.parse(options.input ?? '{}'));\n sourceInputSchemas.createGithub.parse(input);\n print(await clientFactory(options).index.sources.createGithub(input));\n });\n command('analyze-github', 'Analyze documentation paths in a permitted GitHub repository')\n .requiredOption('--input <json>', 'Repository URL and optional connection_id and ref')\n .action(async (options: SourceCommandOptions) => {\n const input = sourceInputSchemas.analyzeGithub.extend({ repositoryUrl: z.url() }).parse(JSON.parse(options.input ?? '{}'));\n sourceInputSchemas.analyzeGithub.parse(input);\n print(await clientFactory(options).index.sources.analyzeGithub(input));\n });\n command('status <sourceId>', 'Read crawl status, errors, size and indexed item counts').action(\n async (sourceId: string, options: SourceCommandOptions) =>\n print(await clientFactory(options).index.sources.status(uuid.parse(sourceId))),\n );\n command('recrawl <sourceId>', 'Start a manual refresh using saved configuration; may consume credits').action(\n async (sourceId: string, options: SourceCommandOptions) =>\n print(await clientFactory(options).index.sources.recrawl(uuid.parse(sourceId))),\n );\n command('collections', 'List collections available for source management').action(async (options: SourceCommandOptions) =>\n print(await clientFactory(options).index.collections.list()),\n );\n command('rules <collectionId>', 'Inspect collection rules before changing membership').action(\n async (collectionId: string, options: SourceCommandOptions) =>\n print(await clientFactory(options).index.collections.rules(uuid.parse(collectionId))),\n );\n command(\n 'include <sourceId> <collectionId>',\n 'Include the entire source in a collection, broadening its retrieval coverage',\n ).action(async (sourceId: string, collectionId: string, options: SourceCommandOptions) =>\n print(\n await clientFactory(options).index.collections.addSource({\n sourceId: uuid.parse(sourceId),\n collectionId: uuid.parse(collectionId),\n }),\n ),\n );\n}\n","","#!/usr/bin/env node\nimport { registerSourceCommands } from './sources.js';\nimport packageMetadata from '../package.json' with { type: 'json' };\nimport { Command } from 'commander';\n\nimport { CliAuth } from './auth.js';\n\nimport { runInitCommand } from './init.js';\n\nconst program = new Command();\n\nprogram.name('bulkgrid').description('Bulkgrid developer tooling').version(packageMetadata.version);\n\nconst auth = new CliAuth();\n\nprogram\n .command('login')\n .description('Sign in to Bulkgrid in your browser')\n .option('--url <url>', 'Bulkgrid base URL; defaults to BULKGRID_URL or https://bulkgrid.com')\n .option('--no-browser', 'print the login URL without opening a browser')\n .action(async options => {\n const session = await auth.login(options);\n console.log(`Logged in to workspace ${session.workspaceId}. Manage access in Settings → Connected Apps.`);\n });\n\nprogram\n .command('status')\n .description('Verify the saved CLI connection and show its access')\n .option('--url <url>', 'Bulkgrid base URL; defaults to BULKGRID_URL or https://bulkgrid.com')\n .action(async options => {\n const session = await auth.status(options.url);\n console.log(`Connected as ${session.userId} to workspace ${session.workspaceId}.`);\n console.log(`Permissions: ${session.scopes.join(', ')}; collections: ${session.collectionScope}.`);\n });\n\nprogram\n .command('logout')\n .description('Revoke this CLI connection and remove its saved tokens')\n .option('--url <url>', 'Bulkgrid base URL; defaults to BULKGRID_URL or https://bulkgrid.com')\n .option('--local', 'only remove local tokens; revoke access separately in Connected Apps')\n .action(async options => {\n await auth.logout(options);\n console.log(options.local ? 'Local credentials removed. Server access was not revoked.' : 'Logged out.');\n });\n\nprogram\n .command('init')\n .description('Configure the Bulkgrid MCP server')\n .option('--all', 'configure all supported agents')\n .option('--cursor', 'configure Cursor')\n .option('--vscode', 'configure VS Code')\n .option('--claude', 'configure Claude Code')\n .option('--codex', 'configure Codex')\n .option('--mcp-url <url>', 'Bulkgrid MCP server URL')\n .option('--api-key <key>', 'Bulkgrid API key; defaults to BULKGRID_API_KEY')\n .option('--global', 'write global user configuration where supported')\n .option('--project', 'write project configuration where supported')\n .option('--yes', 'do not prompt for missing values')\n .option('--write-api-key', 'write the API key into generated JSON config files')\n .option('--install-global', 'install @bulkgrid/cli globally before configuring agents')\n .option('--auth <mode>', 'authentication mode: browser, manual, or skip')\n .action(async options => {\n try {\n const results = await runInitCommand(options);\n if (results.length === 0) {\n console.log('No MCP clients configured.');\n return;\n }\n for (const result of results) {\n const marker = result.status === 'configured' ? 'configured' : 'skipped';\n console.log(`${result.agent}: ${marker} - ${result.message}`);\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error(`bulkgrid init failed: ${message}`);\n process.exitCode = 1;\n }\n });\n\nregisterSourceCommands(program);\n\nprogram.parseAsync().catch(error => {\n console.error(`bulkgrid: ${error instanceof Error ? error.message : 'Command failed'}`);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;AASA,MAAM,OAAO,EAAE,KAAK;AAEpB,SAAgB,mB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MAAM,UAAU,MAAM,eAAe,OAAO;EAC5C,IAAI,QAAQ,WAAW,GAAG;GACxB,QAAQ,IAAI,4BAA4B;GACxC;EACF;EACA,KAAK,MAAM,UAAU,SAAS;GAC5B,MAAM,SAAS,OAAO,WAAW,eAAe,eAAe;GAC/D,QAAQ,IAAI,GAAG,OAAO,MAAM,IAAI,OAAO,KAAK,OAAO,SAAS;EAC9D;CACF,SAAS,OAAO;EACd,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;EACzD,QAAQ,MAAM,yBAAyB,SAAS;EAChD,QAAQ,WAAW;CACrB;AACF,CAAC;AAEH,uBAAuB,OAAO;AAE9B,QAAQ,WAAW,CAAC,CAAC,OAAM,UAAS;CAClC,QAAQ,MAAM,aAAa,iBAAiB,QAAQ,MAAM,UAAU,kBAAkB;CACtF,QAAQ,WAAW;AACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bulkgrid/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@inquirer/prompts": "7.10.1",
|
|
29
29
|
"commander": "14.0.3",
|
|
30
30
|
"zod": "4.4.3",
|
|
31
|
-
"@bulkgrid/sdk": "^0.
|
|
31
|
+
"@bulkgrid/sdk": "^0.4.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@repo/eslint-config": "*",
|