@creatok/cli 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 (3) hide show
  1. package/install.js +16 -0
  2. package/package.json +24 -0
  3. package/run.js +33 -0
package/install.js ADDED
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ // Best-effort postinstall check: warn (do not fail) if no platform binary is
4
+ // resolvable, so unsupported platforms or skipped optionalDependencies surface
5
+ // a clear message instead of a confusing runtime error later.
6
+ const pkg = `@creatok/cli-${process.platform}-${process.arch}`;
7
+ const binName = process.platform === 'win32' ? 'creatok.exe' : 'creatok';
8
+
9
+ try {
10
+ require.resolve(`${pkg}/bin/${binName}`);
11
+ } catch {
12
+ console.error(
13
+ `[creatok] no prebuilt binary for ${process.platform}-${process.arch}. ` +
14
+ `If this platform should be supported, reinstall with: npm install -g @creatok/cli --force`
15
+ );
16
+ }
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@creatok/cli",
3
+ "version": "0.1.0",
4
+ "description": "CreatOK CLI — drives CreatOK Open Skills (analyze, generate image/video) for TikTok creators and sellers.",
5
+ "bin": {
6
+ "creatok": "run.js"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node install.js"
10
+ },
11
+ "files": [
12
+ "run.js",
13
+ "install.js"
14
+ ],
15
+ "license": "UNLICENSED",
16
+ "homepage": "https://github.com/EchoSell/creatok-skills",
17
+ "engines": {
18
+ "node": ">=16"
19
+ },
20
+ "optionalDependencies": {
21
+ "@creatok/cli-darwin-arm64": "0.1.0",
22
+ "@creatok/cli-win32-x64": "0.1.0"
23
+ }
24
+ }
package/run.js ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // Thin launcher: resolve the prebuilt binary for this platform (shipped as an
5
+ // optional dependency) and exec it, passing through args, stdio, and exit code.
6
+ const { spawnSync } = require('child_process');
7
+
8
+ function binaryPath() {
9
+ const pkg = `@creatok/cli-${process.platform}-${process.arch}`;
10
+ const binName = process.platform === 'win32' ? 'creatok.exe' : 'creatok';
11
+ try {
12
+ return require.resolve(`${pkg}/bin/${binName}`);
13
+ } catch {
14
+ return null;
15
+ }
16
+ }
17
+
18
+ const bin = binaryPath();
19
+ if (!bin) {
20
+ console.error(
21
+ `creatok: no prebuilt binary for ${process.platform}-${process.arch}.\n` +
22
+ `The platform may be unsupported, or the optional platform package failed to install.\n` +
23
+ `Try: npm install -g @creatok/cli --force`
24
+ );
25
+ process.exit(1);
26
+ }
27
+
28
+ const result = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' });
29
+ if (result.error) {
30
+ console.error('creatok: failed to launch binary:', result.error.message);
31
+ process.exit(1);
32
+ }
33
+ process.exit(result.status === null ? 1 : result.status);