@accio-ai/cli 0.1.6 → 0.1.7-rc.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/assets/workctl-skills.zip +0 -0
- package/bin/workctl.js +41 -3
- package/install.js +11 -83
- package/package.json +10 -2
- package/assets/workctl-darwin-amd64.tar.gz +0 -0
- package/assets/workctl-darwin-arm64.tar.gz +0 -0
- package/assets/workctl-linux-amd64.tar.gz +0 -0
- package/assets/workctl-linux-arm64.tar.gz +0 -0
- package/assets/workctl-windows-amd64.zip +0 -0
- package/assets/workctl-windows-arm64.zip +0 -0
|
Binary file
|
package/bin/workctl.js
CHANGED
|
@@ -6,10 +6,48 @@ const childProcess = require("child_process");
|
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const path = require("path");
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function getBinaryName() {
|
|
10
|
+
return process.platform === "win32" ? "workctl.exe" : "workctl";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function basePackageName() {
|
|
14
|
+
const pkgPath = path.join(__dirname, "..", "package.json");
|
|
15
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
16
|
+
return pkg.name;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function findBinaryPath() {
|
|
20
|
+
const binaryName = getBinaryName();
|
|
21
|
+
const suffix = `${process.platform}-${process.arch}`;
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const platformPackage = `${basePackageName()}-${suffix}`;
|
|
25
|
+
const platformDir = path.dirname(
|
|
26
|
+
require.resolve(`${platformPackage}/package.json`),
|
|
27
|
+
);
|
|
28
|
+
const candidate = path.join(platformDir, binaryName);
|
|
29
|
+
if (fs.existsSync(candidate)) {
|
|
30
|
+
return candidate;
|
|
31
|
+
}
|
|
32
|
+
} catch (e) {
|
|
33
|
+
// Platform sub-package not installed; fall through to vendor fallback.
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const vendorPath = path.join(__dirname, "..", "vendor", binaryName);
|
|
37
|
+
if (fs.existsSync(vendorPath)) {
|
|
38
|
+
return vendorPath;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
10
43
|
|
|
11
|
-
|
|
12
|
-
|
|
44
|
+
const binaryPath = findBinaryPath();
|
|
45
|
+
if (!binaryPath) {
|
|
46
|
+
const suffix = `${process.platform}-${process.arch}`;
|
|
47
|
+
console.error(
|
|
48
|
+
`workctl: could not find binary for platform ${suffix}.\n` +
|
|
49
|
+
`Reinstall the package, or check that your platform is supported.`,
|
|
50
|
+
);
|
|
13
51
|
process.exit(1);
|
|
14
52
|
}
|
|
15
53
|
|
package/install.js
CHANGED
|
@@ -14,14 +14,6 @@ const AGENT_DIRS = [
|
|
|
14
14
|
".codex/skills",
|
|
15
15
|
];
|
|
16
16
|
|
|
17
|
-
const PLATFORM_MAP = {
|
|
18
|
-
"darwin-x64": "workctl-darwin-amd64.tar.gz",
|
|
19
|
-
"darwin-arm64": "workctl-darwin-arm64.tar.gz",
|
|
20
|
-
"linux-x64": "workctl-linux-amd64.tar.gz",
|
|
21
|
-
"linux-arm64": "workctl-linux-arm64.tar.gz",
|
|
22
|
-
"win32-x64": "workctl-windows-amd64.zip",
|
|
23
|
-
"win32-arm64": "workctl-windows-arm64.zip",
|
|
24
|
-
};
|
|
25
17
|
function ensureDir(dir) {
|
|
26
18
|
fs.mkdirSync(dir, { recursive: true });
|
|
27
19
|
}
|
|
@@ -42,62 +34,6 @@ function copyChildren(srcDir, destDir) {
|
|
|
42
34
|
}
|
|
43
35
|
}
|
|
44
36
|
|
|
45
|
-
function findBinary(root, names) {
|
|
46
|
-
const entries = fs.readdirSync(root, { withFileTypes: true });
|
|
47
|
-
for (const entry of entries) {
|
|
48
|
-
const entryPath = path.join(root, entry.name);
|
|
49
|
-
if (entry.isDirectory()) {
|
|
50
|
-
const nested = findBinary(entryPath, names);
|
|
51
|
-
if (nested) {
|
|
52
|
-
return nested;
|
|
53
|
-
}
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (names.includes(entry.name)) {
|
|
57
|
-
return entryPath;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return "";
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function extractArchiveBinary(archivePath, names, destPath, cleanDestDir) {
|
|
64
|
-
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "workctl-npm-bin-"));
|
|
65
|
-
try {
|
|
66
|
-
if (archivePath.endsWith(".tar.gz")) {
|
|
67
|
-
run("tar", ["-xzf", archivePath, "-C", tmpDir]);
|
|
68
|
-
} else if (process.platform === "win32") {
|
|
69
|
-
run("powershell.exe", [
|
|
70
|
-
"-NoLogo",
|
|
71
|
-
"-NoProfile",
|
|
72
|
-
"-Command",
|
|
73
|
-
`Expand-Archive -Path '${archivePath.replace(/'/g, "''")}' -DestinationPath '${tmpDir.replace(/'/g, "''")}' -Force`,
|
|
74
|
-
]);
|
|
75
|
-
} else {
|
|
76
|
-
run("unzip", ["-q", archivePath, "-d", tmpDir]);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const binaryPath = findBinary(tmpDir, names);
|
|
80
|
-
if (!binaryPath) {
|
|
81
|
-
throw new Error(`expected binary not found in archive ${archivePath}`);
|
|
82
|
-
}
|
|
83
|
-
copyExecutable(binaryPath, destPath, cleanDestDir);
|
|
84
|
-
} finally {
|
|
85
|
-
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function copyExecutable(srcPath, destPath, cleanDestDir) {
|
|
90
|
-
if (cleanDestDir) {
|
|
91
|
-
ensureCleanDir(path.dirname(destPath));
|
|
92
|
-
} else {
|
|
93
|
-
ensureDir(path.dirname(destPath));
|
|
94
|
-
}
|
|
95
|
-
fs.copyFileSync(srcPath, destPath);
|
|
96
|
-
if (process.platform !== "win32") {
|
|
97
|
-
fs.chmodSync(destPath, 0o755);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
37
|
function extractSkills(zipPath, destDir) {
|
|
102
38
|
ensureCleanDir(destDir);
|
|
103
39
|
if (process.platform === "win32") {
|
|
@@ -121,31 +57,31 @@ function installSkillsToHomes(skillRoot) {
|
|
|
121
57
|
});
|
|
122
58
|
}
|
|
123
59
|
|
|
60
|
+
function clearWorkctlCache(configDir) {
|
|
61
|
+
const cacheDir = path.join(configDir, "cache");
|
|
62
|
+
if (fs.existsSync(cacheDir)) {
|
|
63
|
+
fs.rmSync(cacheDir, { recursive: true, force: true });
|
|
64
|
+
console.log("✓ Cleared cache for fresh command discovery");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
124
68
|
function main() {
|
|
125
69
|
const packageRoot = __dirname;
|
|
126
70
|
const assetsDir = path.join(packageRoot, "assets");
|
|
127
|
-
const vendorDir = path.join(packageRoot, "vendor");
|
|
128
71
|
const skillDir = path.join(packageRoot, "share", "skills", "workctl");
|
|
129
72
|
const homeDir = process.env.HOME || process.env.USERPROFILE || os.homedir();
|
|
130
73
|
const configDir = process.env.WORKCTL_CONFIG_DIR || path.join(homeDir, ".workctl");
|
|
131
|
-
|
|
132
|
-
if (!assetName) {
|
|
133
|
-
throw new Error(`unsupported platform: ${process.platform}/${process.arch}`);
|
|
134
|
-
}
|
|
74
|
+
|
|
135
75
|
if (!homeDir) {
|
|
136
76
|
throw new Error("home directory not available for installation");
|
|
137
77
|
}
|
|
138
78
|
|
|
139
|
-
const archivePath = path.join(assetsDir, assetName);
|
|
140
79
|
const skillsPath = path.join(assetsDir, "workctl-skills.zip");
|
|
141
|
-
if (!fs.existsSync(archivePath)) {
|
|
142
|
-
throw new Error(`missing platform archive: ${archivePath}`);
|
|
143
|
-
}
|
|
144
80
|
if (!fs.existsSync(skillsPath)) {
|
|
145
|
-
|
|
81
|
+
console.warn("warning: skills archive not found, skipping skills installation");
|
|
82
|
+
return;
|
|
146
83
|
}
|
|
147
84
|
|
|
148
|
-
extractArchiveBinary(archivePath, ["workctl", "workctl.exe"], path.join(vendorDir, process.platform === "win32" ? "workctl.exe" : "workctl"), true);
|
|
149
85
|
extractSkills(skillsPath, skillDir);
|
|
150
86
|
installSkillsToHomes(skillDir);
|
|
151
87
|
|
|
@@ -156,12 +92,4 @@ function main() {
|
|
|
156
92
|
console.log(" Run 'workctl --help' to get started");
|
|
157
93
|
}
|
|
158
94
|
|
|
159
|
-
function clearWorkctlCache(configDir) {
|
|
160
|
-
const cacheDir = path.join(configDir, "cache");
|
|
161
|
-
if (fs.existsSync(cacheDir)) {
|
|
162
|
-
fs.rmSync(cacheDir, { recursive: true, force: true });
|
|
163
|
-
console.log("✓ Cleared cache for fresh command discovery");
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
95
|
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@accio-ai/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7-rc.1",
|
|
4
4
|
"description": "Work Agent CLI - AI-native command line interface",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -17,6 +17,14 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"postinstall": "node install.js"
|
|
19
19
|
},
|
|
20
|
+
"optionalDependencies": {
|
|
21
|
+
"@accio-ai/cli-darwin-arm64": "0.1.7-rc.1",
|
|
22
|
+
"@accio-ai/cli-darwin-x64": "0.1.7-rc.1",
|
|
23
|
+
"@accio-ai/cli-linux-arm64": "0.1.7-rc.1",
|
|
24
|
+
"@accio-ai/cli-linux-x64": "0.1.7-rc.1",
|
|
25
|
+
"@accio-ai/cli-win32-arm64": "0.1.7-rc.1",
|
|
26
|
+
"@accio-ai/cli-win32-x64": "0.1.7-rc.1"
|
|
27
|
+
},
|
|
20
28
|
"publishConfig": {
|
|
21
29
|
"registry": "https://registry.npmjs.org"
|
|
22
30
|
},
|
|
@@ -27,6 +35,6 @@
|
|
|
27
35
|
"README.md"
|
|
28
36
|
],
|
|
29
37
|
"engines": {
|
|
30
|
-
"node": ">=16"
|
|
38
|
+
"node": ">=16.7"
|
|
31
39
|
}
|
|
32
40
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|