@silkweave/cli 1.3.0 → 1.3.1
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/.turbo/turbo-build.log +4 -4
- package/.turbo/turbo-check.log +14 -13
- package/.turbo/turbo-prepack.log +7 -7
- package/README.md +2 -2
- package/build/index.js +9 -2
- package/build/index.js.map +1 -1
- package/package.json +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
[34mCLI[39m Target: es2022
|
|
11
11
|
[34mCLI[39m Cleaning output folder
|
|
12
12
|
[34mESM[39m Build start
|
|
13
|
-
[32mESM[39m [1mbuild/index.js [22m[32m3.
|
|
14
|
-
[32mESM[39m [1mbuild/index.js.map [22m[
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
+
[32mESM[39m [1mbuild/index.js [22m[32m3.43 KB[39m
|
|
14
|
+
[32mESM[39m [1mbuild/index.js.map [22m[32m6.04 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 10ms
|
|
16
16
|
DTS Build start
|
|
17
|
-
DTS ⚡️ Build success in
|
|
17
|
+
DTS ⚡️ Build success in 730ms
|
|
18
18
|
DTS build/index.d.ts 103.00 B
|
package/.turbo/turbo-check.log
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
>
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
|
|
2
|
+
> @silkweave/cli@1.3.0 check /Users/atomic/projects/ai/silkweave/packages/cli
|
|
3
|
+
> pnpm lint && pnpm typecheck
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> @silkweave/cli@1.3.0 lint /Users/atomic/projects/ai/silkweave/packages/cli
|
|
7
|
+
> eslint
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
> @silkweave/cli@1.3.0 typecheck /Users/atomic/projects/ai/silkweave/packages/cli
|
|
11
|
+
> tsc --noEmit
|
|
12
|
+
|
|
13
|
+
ELIFECYCLE Command failed.
|
|
14
|
+
ELIFECYCLE Command failed.
|
package/.turbo/turbo-prepack.log
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @silkweave/cli@1.3.0 prepack /Users/atomic/projects/ai/
|
|
3
|
+
> @silkweave/cli@1.3.0 prepack /Users/atomic/projects/ai/silkweave/packages/cli
|
|
4
4
|
> pnpm clean && pnpm build
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @silkweave/cli@1.3.0 clean /Users/atomic/projects/ai/
|
|
7
|
+
> @silkweave/cli@1.3.0 clean /Users/atomic/projects/ai/silkweave/packages/cli
|
|
8
8
|
> rimraf build
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
> @silkweave/cli@1.3.0 build /Users/atomic/projects/ai/
|
|
11
|
+
> @silkweave/cli@1.3.0 build /Users/atomic/projects/ai/silkweave/packages/cli
|
|
12
12
|
> tsup
|
|
13
13
|
|
|
14
14
|
[34mCLI[39m Building entry: src/index.ts
|
|
15
15
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
16
16
|
[34mCLI[39m tsup v8.5.1
|
|
17
|
-
[34mCLI[39m Using tsup config: /Users/atomic/projects/ai/
|
|
17
|
+
[34mCLI[39m Using tsup config: /Users/atomic/projects/ai/silkweave/packages/cli/tsup.config.ts
|
|
18
18
|
[34mCLI[39m Target: es2022
|
|
19
19
|
[34mCLI[39m Cleaning output folder
|
|
20
20
|
[34mESM[39m Build start
|
|
21
|
-
[32mESM[39m [1mbuild/index.js [22m[32m3.
|
|
22
|
-
[32mESM[39m [1mbuild/index.js.map [22m[
|
|
21
|
+
[32mESM[39m [1mbuild/index.js [22m[32m3.43 KB[39m
|
|
22
|
+
[32mESM[39m [1mbuild/index.js.map [22m[32m6.04 KB[39m
|
|
23
23
|
[32mESM[39m ⚡️ Build success in 9ms
|
|
24
24
|
DTS Build start
|
|
25
|
-
DTS ⚡️ Build success in
|
|
25
|
+
DTS ⚡️ Build success in 612ms
|
|
26
26
|
DTS build/index.d.ts 103.00 B
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @silkweave/cli
|
|
2
2
|
|
|
3
|
-
CLI adapter for [Silkweave](https://github.com/
|
|
3
|
+
CLI adapter for [Silkweave](https://github.com/silkweave/silkweave) — turn your actions into a complete command-line application with help text, option parsing, and styled terminal output via clack.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -63,5 +63,5 @@ $ mytool deploy production --dry-run
|
|
|
63
63
|
|
|
64
64
|
## See Also
|
|
65
65
|
|
|
66
|
-
- [Silkweave README](https://github.com/
|
|
66
|
+
- [Silkweave README](https://github.com/silkweave/silkweave) — Full documentation
|
|
67
67
|
- [`@silkweave/core`](https://www.npmjs.com/package/@silkweave/core) — Core library
|
package/build/index.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
// src/adapter/cli.ts
|
|
2
2
|
import { intro, log } from "@clack/prompts";
|
|
3
|
-
import { unwrap } from "@silkweave/core";
|
|
3
|
+
import { SilkweaveError, unwrap } from "@silkweave/core";
|
|
4
4
|
import { createCLILogger } from "@silkweave/logger";
|
|
5
5
|
import { camelCase, kebabCase } from "change-case";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
import z from "zod";
|
|
8
8
|
function handleCLIError(error) {
|
|
9
|
-
if (error instanceof
|
|
9
|
+
if (error instanceof SilkweaveError) {
|
|
10
|
+
log.error(`[${error.code}] ${error.message}`);
|
|
11
|
+
process.exitCode = 1;
|
|
12
|
+
} else if (error instanceof z.ZodError) {
|
|
10
13
|
log.error("Validation Error", { withGuide: false });
|
|
11
14
|
for (const issue of error.issues) {
|
|
12
15
|
log.error(`${issue.path}: ${issue.message}`);
|
|
13
16
|
}
|
|
17
|
+
process.exitCode = 1;
|
|
14
18
|
} else if (error instanceof Error) {
|
|
15
19
|
log.error(error.message);
|
|
20
|
+
process.exitCode = 1;
|
|
16
21
|
} else if (typeof error === "string") {
|
|
17
22
|
log.error(error);
|
|
23
|
+
process.exitCode = 1;
|
|
18
24
|
} else {
|
|
19
25
|
log.error(JSON.stringify(error));
|
|
26
|
+
process.exitCode = 1;
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
29
|
function parseCLIInput(action, args) {
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/adapter/cli.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { intro, log } from '@clack/prompts'\nimport { Action, AdapterFactory, unwrap } from '@silkweave/core'\nimport { createCLILogger } from '@silkweave/logger'\nimport { camelCase, kebabCase } from 'change-case'\nimport { Command } from 'commander'\nimport z from 'zod'\n\nfunction handleCLIError(error: unknown) {\n if (error instanceof z.ZodError) {\n log.error('Validation Error', { withGuide: false })\n for (const issue of error.issues) {\n log.error(`${issue.path}: ${issue.message}`)\n }\n } else if (error instanceof Error) {\n log.error(error.message)\n } else if (typeof error === 'string') {\n log.error(error)\n } else {\n log.error(JSON.stringify(error))\n }\n}\n\nfunction parseCLIInput(action: Action, args: any[]) {\n const tmpArgs = args.slice(0, -1)\n const rawInput = tmpArgs.pop()\n action.args?.forEach((k, index) => { rawInput[k] = args[index] })\n const { error, data } = action.input.safeParse(rawInput)\n if (error || !data) {\n handleCLIError(error)\n process.exit()\n }\n\n return data\n}\n\nexport const cli: AdapterFactory = () => {\n return (options, baseContext) => {\n const context = baseContext.fork({ adapter: 'cli' })\n const program = new Command()\n .name(options.name)\n .description(options.description)\n .version(options.version)\n\n return {\n context,\n start: async (actions) => {\n for (const action of actions) {\n const name = kebabCase(action.name)\n const command = program.command(name).description(action.description)\n const shape = action.input.shape\n const keys = Object.keys(shape)\n for (const key of keys) {\n const [type, { defaultValue }] = unwrap(shape[key])\n const description = type.description\n const isArgument = action.args?.includes(key)\n if (isArgument) {\n command.argument(`[${camelCase(key)}]`, description, defaultValue)\n } else if (type instanceof z.ZodBoolean) {\n command.option(`--${kebabCase(key)}`, description, defaultValue)\n command.option(`--no-${kebabCase(key)}`)\n } else if (type instanceof z.ZodNumber) {\n command.option(`--${kebabCase(key)} <number>`, description, defaultValue)\n } else if (type instanceof z.ZodString || type instanceof z.ZodEnum) {\n command.option(`--${kebabCase(key)} <string>`, description, defaultValue)\n } else if (type instanceof z.ZodObject || type instanceof z.ZodRecord || type instanceof z.ZodArray) {\n command.option(`--${kebabCase(key)} <json>`, description ?? '', JSON.parse, defaultValue)\n } else {\n throw new Error(`Invalid zod type: ${type.def.type}`)\n }\n }\n command.action((...args) => {\n const logger = createCLILogger()\n const input = parseCLIInput(action, args)\n intro(`${options.name} - ${action.name}`)\n action.run(input, context.fork({ logger, command })).then((result) => {\n logger.info(JSON.stringify(result, null, 2))\n }).catch(handleCLIError)\n })\n }\n program.parse()\n },\n stop: async () => { }\n }\n }\n}\n"],"mappings":";AACA,SAAS,OAAO,WAAW;AAC3B,SAAiC,cAAc;AAC/
|
|
1
|
+
{"version":3,"sources":["../src/adapter/cli.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { intro, log } from '@clack/prompts'\nimport { Action, AdapterFactory, SilkweaveError, unwrap } from '@silkweave/core'\nimport { createCLILogger } from '@silkweave/logger'\nimport { camelCase, kebabCase } from 'change-case'\nimport { Command } from 'commander'\nimport z from 'zod'\n\nfunction handleCLIError(error: unknown) {\n if (error instanceof SilkweaveError) {\n log.error(`[${error.code}] ${error.message}`)\n process.exitCode = 1\n } else if (error instanceof z.ZodError) {\n log.error('Validation Error', { withGuide: false })\n for (const issue of error.issues) {\n log.error(`${issue.path}: ${issue.message}`)\n }\n process.exitCode = 1\n } else if (error instanceof Error) {\n log.error(error.message)\n process.exitCode = 1\n } else if (typeof error === 'string') {\n log.error(error)\n process.exitCode = 1\n } else {\n log.error(JSON.stringify(error))\n process.exitCode = 1\n }\n}\n\nfunction parseCLIInput(action: Action, args: any[]) {\n const tmpArgs = args.slice(0, -1)\n const rawInput = tmpArgs.pop()\n action.args?.forEach((k, index) => { rawInput[k] = args[index] })\n const { error, data } = action.input.safeParse(rawInput)\n if (error || !data) {\n handleCLIError(error)\n process.exit()\n }\n\n return data\n}\n\nexport const cli: AdapterFactory = () => {\n return (options, baseContext) => {\n const context = baseContext.fork({ adapter: 'cli' })\n const program = new Command()\n .name(options.name)\n .description(options.description)\n .version(options.version)\n\n return {\n context,\n start: async (actions) => {\n for (const action of actions) {\n const name = kebabCase(action.name)\n const command = program.command(name).description(action.description)\n const shape = action.input.shape\n const keys = Object.keys(shape)\n for (const key of keys) {\n const [type, { defaultValue }] = unwrap(shape[key])\n const description = type.description\n const isArgument = action.args?.includes(key)\n if (isArgument) {\n command.argument(`[${camelCase(key)}]`, description, defaultValue)\n } else if (type instanceof z.ZodBoolean) {\n command.option(`--${kebabCase(key)}`, description, defaultValue)\n command.option(`--no-${kebabCase(key)}`)\n } else if (type instanceof z.ZodNumber) {\n command.option(`--${kebabCase(key)} <number>`, description, defaultValue)\n } else if (type instanceof z.ZodString || type instanceof z.ZodEnum) {\n command.option(`--${kebabCase(key)} <string>`, description, defaultValue)\n } else if (type instanceof z.ZodObject || type instanceof z.ZodRecord || type instanceof z.ZodArray) {\n command.option(`--${kebabCase(key)} <json>`, description ?? '', JSON.parse, defaultValue)\n } else {\n throw new Error(`Invalid zod type: ${type.def.type}`)\n }\n }\n command.action((...args) => {\n const logger = createCLILogger()\n const input = parseCLIInput(action, args)\n intro(`${options.name} - ${action.name}`)\n action.run(input, context.fork({ logger, command })).then((result) => {\n logger.info(JSON.stringify(result, null, 2))\n }).catch(handleCLIError)\n })\n }\n program.parse()\n },\n stop: async () => { }\n }\n }\n}\n"],"mappings":";AACA,SAAS,OAAO,WAAW;AAC3B,SAAiC,gBAAgB,cAAc;AAC/D,SAAS,u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BAAM,QAAQ,cAAc,QAAQ,IAAI;AACxC,kBAAM,GAAG,QAAQ,IAAI,MAAM,OAAO,IAAI,EAAE;AACxC,mBAAO,IAAI,OAAO,QAAQ,KAAK,EAAE,QAAQ,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW;AACpE,qBAAO,KAAK,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAAA,YAC7C,CAAC,EAAE,MAAM,cAAc;AAAA,UACzB,CAAC;AAAA,QACH;AACA,gBAAQ,MAAM;AAAA,MAChB;AAAA,MACA,MAAM,YAAY;AAAA,MAAE;AAAA,IACtB;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silkweave/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Silkweave CLI Adapter",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+ssh://git@github.com/
|
|
7
|
+
"url": "git+ssh://git@github.com/silkweave/silkweave.git",
|
|
8
8
|
"directory": "packages/cli"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"change-case": "^5.4.4",
|
|
16
16
|
"commander": "^13.1.0",
|
|
17
17
|
"zod": "^4.3.6",
|
|
18
|
-
"@silkweave/core": "1.3.
|
|
19
|
-
"@silkweave/logger": "1.3.
|
|
18
|
+
"@silkweave/core": "1.3.1",
|
|
19
|
+
"@silkweave/logger": "1.3.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@eslint/js": "^10.0.1",
|