@creatok/cli 0.3.0-preview.1 → 0.3.0-preview.12
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/install.js +59 -8
- package/package.json +3 -3
package/install.js
CHANGED
|
@@ -1,16 +1,67 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// Best-effort postinstall
|
|
4
|
-
// resolvable,
|
|
5
|
-
//
|
|
3
|
+
// Best-effort postinstall: warn (do not fail) if no platform binary is
|
|
4
|
+
// resolvable, and opportunistically sync embedded skills into existing agent
|
|
5
|
+
// skill directories after npm updates the CLI binary.
|
|
6
|
+
const { spawnSync } = require('child_process');
|
|
7
|
+
|
|
6
8
|
const pkg = `@creatok/cli-${process.platform}-${process.arch}`;
|
|
7
9
|
const binName = process.platform === 'win32' ? 'creatok.exe' : 'creatok';
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
function warn(message) {
|
|
12
|
+
console.error(`[creatok] ${message}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function binaryPath() {
|
|
16
|
+
try {
|
|
17
|
+
return require.resolve(`${pkg}/bin/${binName}`);
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const bin = binaryPath();
|
|
24
|
+
if (!bin) {
|
|
25
|
+
warn(
|
|
26
|
+
`no prebuilt binary for ${process.platform}-${process.arch}. ` +
|
|
14
27
|
`If this platform should be supported, reinstall with: npm install -g @creatok/cli --force`
|
|
15
28
|
);
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (/^(1|true|yes)$/i.test(process.env.CREATOK_SKIP_SKILLS_INSTALL || '')) {
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const result = spawnSync(bin, ['skills', 'install', '--existing-only'], {
|
|
38
|
+
encoding: 'utf8',
|
|
39
|
+
windowsHide: true,
|
|
40
|
+
});
|
|
41
|
+
if (result.error) {
|
|
42
|
+
warn(`could not auto-sync agent skills: ${result.error.message}`);
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|
|
45
|
+
if (result.status !== 0) {
|
|
46
|
+
const detail = (result.stderr || result.stdout || '').trim();
|
|
47
|
+
warn(
|
|
48
|
+
`could not auto-sync agent skills${detail ? `: ${detail}` : ''}. ` +
|
|
49
|
+
`Run "creatok skills install --dir <agent-skills-dir>" manually if needed.`
|
|
50
|
+
);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const stdout = (result.stdout || '').trim();
|
|
55
|
+
if (!stdout) {
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
const envelope = JSON.parse(stdout);
|
|
59
|
+
const dirs = envelope && envelope.data && Array.isArray(envelope.data.dirs) ? envelope.data.dirs : [];
|
|
60
|
+
if (dirs.length > 0) {
|
|
61
|
+
warn(`synced embedded skills into existing agent skills dirs: ${dirs.join(', ')}`);
|
|
62
|
+
} else if (envelope && envelope.data && envelope.data.skipped) {
|
|
63
|
+
warn(`${envelope.data.skipped}. Run "creatok skills install --dir <agent-skills-dir>" manually if needed.`);
|
|
64
|
+
}
|
|
65
|
+
} catch (err) {
|
|
66
|
+
warn(`could not auto-sync agent skills: ${err.message}`);
|
|
16
67
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creatok/cli",
|
|
3
|
-
"version": "0.3.0-preview.
|
|
3
|
+
"version": "0.3.0-preview.12",
|
|
4
4
|
"description": "CreatOK CLI — drives CreatOK Open Skills (analyze, generate image/video) for TikTok creators and sellers.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"creatok": "run.js"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"node": ">=16"
|
|
19
19
|
},
|
|
20
20
|
"optionalDependencies": {
|
|
21
|
-
"@creatok/cli-darwin-arm64": "0.3.0-preview.
|
|
22
|
-
"@creatok/cli-win32-x64": "0.3.0-preview.
|
|
21
|
+
"@creatok/cli-darwin-arm64": "0.3.0-preview.12",
|
|
22
|
+
"@creatok/cli-win32-x64": "0.3.0-preview.12"
|
|
23
23
|
}
|
|
24
24
|
}
|