cartoon-wrap 0.1.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.
Files changed (2) hide show
  1. package/bin/cartoon.js +29 -0
  2. package/package.json +17 -0
package/bin/cartoon.js ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require("node:child_process");
3
+
4
+ const PLATFORMS = {
5
+ "darwin-arm64": "cartoon-wrap-darwin-arm64",
6
+ "darwin-x64": "cartoon-wrap-darwin-x64",
7
+ "linux-arm64": "cartoon-wrap-linux-arm64",
8
+ "linux-x64": "cartoon-wrap-linux-x64",
9
+ "win32-x64": "cartoon-wrap-win32-x64",
10
+ };
11
+
12
+ const key = `${process.platform}-${process.arch}`;
13
+ const pkg = PLATFORMS[key];
14
+ if (!pkg) {
15
+ console.error(`cartoon: unsupported platform ${key}`);
16
+ process.exit(1);
17
+ }
18
+ let bin;
19
+ try {
20
+ const exe = process.platform === "win32" ? "cartoon.exe" : "cartoon";
21
+ bin = require.resolve(`${pkg}/bin/${exe}`);
22
+ } catch {
23
+ console.error(
24
+ `cartoon: platform package ${pkg} missing — reinstall with optional deps enabled`
25
+ );
26
+ process.exit(1);
27
+ }
28
+ const result = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
29
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "cartoon-wrap",
3
+ "version": "0.1.0",
4
+ "description": "Token-optimized TOON output wrapper for any CLI (installs the `cartoon` binary)",
5
+ "license": "MIT",
6
+ "repository": "github:abhijitbansal/cartoon",
7
+ "bin": {
8
+ "cartoon": "bin/cartoon.js"
9
+ },
10
+ "optionalDependencies": {
11
+ "cartoon-wrap-darwin-arm64": "0.1.0",
12
+ "cartoon-wrap-darwin-x64": "0.1.0",
13
+ "cartoon-wrap-linux-arm64": "0.1.0",
14
+ "cartoon-wrap-linux-x64": "0.1.0",
15
+ "cartoon-wrap-win32-x64": "0.1.0"
16
+ }
17
+ }