dingtalk-workspace-cli 1.0.6
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/README.md +4 -0
- package/assets/dws-darwin-amd64.tar.gz +0 -0
- package/assets/dws-darwin-arm64.tar.gz +0 -0
- package/assets/dws-linux-amd64.tar.gz +0 -0
- package/assets/dws-linux-arm64.tar.gz +0 -0
- package/assets/dws-skills.zip +0 -0
- package/assets/dws-windows-amd64.zip +0 -0
- package/assets/dws-windows-arm64.zip +0 -0
- package/bin/dws.js +25 -0
- package/install.js +160 -0
- package/package.json +37 -0
package/README.md
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/dws.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const childProcess = require("child_process");
|
|
8
|
+
|
|
9
|
+
const binaryPath = path.join(__dirname, "..", "vendor", process.platform === "win32" ? "dws.exe" : "dws");
|
|
10
|
+
|
|
11
|
+
if (!fs.existsSync(binaryPath)) {
|
|
12
|
+
console.error(`dws binary not found at ${binaryPath}. Reinstall the package.`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const result = childProcess.spawnSync(binaryPath, process.argv.slice(2), {
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (result.error) {
|
|
21
|
+
console.error(result.error.message);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
process.exit(result.status === null ? 1 : result.status);
|
package/install.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const childProcess = require("child_process");
|
|
9
|
+
|
|
10
|
+
const AGENT_DIRS = [
|
|
11
|
+
".agents/skills",
|
|
12
|
+
".claude/skills",
|
|
13
|
+
".cursor/skills",
|
|
14
|
+
".gemini/skills",
|
|
15
|
+
".codex/skills",
|
|
16
|
+
".github/skills",
|
|
17
|
+
".windsurf/skills",
|
|
18
|
+
".augment/skills",
|
|
19
|
+
".cline/skills",
|
|
20
|
+
".amp/skills",
|
|
21
|
+
".kiro/skills",
|
|
22
|
+
".trae/skills",
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const PLATFORM_MAP = {
|
|
26
|
+
"darwin-x64": "dws-darwin-amd64.tar.gz",
|
|
27
|
+
"darwin-arm64": "dws-darwin-arm64.tar.gz",
|
|
28
|
+
"linux-x64": "dws-linux-amd64.tar.gz",
|
|
29
|
+
"linux-arm64": "dws-linux-arm64.tar.gz",
|
|
30
|
+
"win32-x64": "dws-windows-amd64.zip",
|
|
31
|
+
"win32-arm64": "dws-windows-arm64.zip",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function run(command, args) {
|
|
35
|
+
childProcess.execFileSync(command, args, { stdio: "inherit" });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function ensureCleanDir(dir) {
|
|
39
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
40
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function findBinary(root) {
|
|
44
|
+
const entries = fs.readdirSync(root, { withFileTypes: true });
|
|
45
|
+
for (const entry of entries) {
|
|
46
|
+
const entryPath = path.join(root, entry.name);
|
|
47
|
+
if (entry.isDirectory()) {
|
|
48
|
+
const nested = findBinary(entryPath);
|
|
49
|
+
if (nested) {
|
|
50
|
+
return nested;
|
|
51
|
+
}
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (entry.name === "dws" || entry.name === "dws.exe") {
|
|
55
|
+
return entryPath;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return "";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function extractArchive(archivePath, destDir) {
|
|
62
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "dws-npm-bin-"));
|
|
63
|
+
try {
|
|
64
|
+
if (archivePath.endsWith(".tar.gz")) {
|
|
65
|
+
run("tar", ["-xzf", archivePath, "-C", tmpDir]);
|
|
66
|
+
} else if (process.platform === "win32") {
|
|
67
|
+
run("powershell.exe", [
|
|
68
|
+
"-NoLogo",
|
|
69
|
+
"-NoProfile",
|
|
70
|
+
"-Command",
|
|
71
|
+
`Expand-Archive -Path '${archivePath.replace(/'/g, "''")}' -DestinationPath '${tmpDir.replace(/'/g, "''")}' -Force`,
|
|
72
|
+
]);
|
|
73
|
+
} else {
|
|
74
|
+
run("unzip", ["-q", archivePath, "-d", tmpDir]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const binaryPath = findBinary(tmpDir);
|
|
78
|
+
if (!binaryPath) {
|
|
79
|
+
throw new Error(`dws binary not found in archive ${archivePath}`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
ensureCleanDir(destDir);
|
|
83
|
+
const targetName = process.platform === "win32" ? "dws.exe" : "dws";
|
|
84
|
+
const targetPath = path.join(destDir, targetName);
|
|
85
|
+
fs.copyFileSync(binaryPath, targetPath);
|
|
86
|
+
if (process.platform !== "win32") {
|
|
87
|
+
fs.chmodSync(targetPath, 0o755);
|
|
88
|
+
}
|
|
89
|
+
} finally {
|
|
90
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function extractSkills(zipPath, destDir) {
|
|
95
|
+
ensureCleanDir(destDir);
|
|
96
|
+
if (process.platform === "win32") {
|
|
97
|
+
run("powershell.exe", [
|
|
98
|
+
"-NoLogo",
|
|
99
|
+
"-NoProfile",
|
|
100
|
+
"-Command",
|
|
101
|
+
`Expand-Archive -Path '${zipPath.replace(/'/g, "''")}' -DestinationPath '${destDir.replace(/'/g, "''")}' -Force`,
|
|
102
|
+
]);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
run("unzip", ["-q", zipPath, "-d", destDir]);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function copyChildren(srcDir, destDir) {
|
|
109
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
110
|
+
for (const entry of fs.readdirSync(srcDir)) {
|
|
111
|
+
fs.cpSync(path.join(srcDir, entry), path.join(destDir, entry), { recursive: true, force: true });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function installSkillsToHomes(skillRoot) {
|
|
116
|
+
const homeDir = os.homedir();
|
|
117
|
+
let installed = 0;
|
|
118
|
+
|
|
119
|
+
AGENT_DIRS.forEach((agentDir, index) => {
|
|
120
|
+
const baseDir = path.join(homeDir, agentDir);
|
|
121
|
+
const parentGate = path.dirname(baseDir);
|
|
122
|
+
if (index > 0 && !fs.existsSync(parentGate)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const destDir = path.join(baseDir, "dws");
|
|
126
|
+
fs.rmSync(destDir, { recursive: true, force: true });
|
|
127
|
+
copyChildren(skillRoot, destDir);
|
|
128
|
+
installed += 1;
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
if (installed === 0) {
|
|
132
|
+
copyChildren(skillRoot, path.join(homeDir, ".agents", "skills", "dws"));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function main() {
|
|
137
|
+
const packageRoot = __dirname;
|
|
138
|
+
const assetsDir = path.join(packageRoot, "assets");
|
|
139
|
+
const vendorDir = path.join(packageRoot, "vendor");
|
|
140
|
+
const skillDir = path.join(packageRoot, "share", "skills", "dws");
|
|
141
|
+
const assetName = PLATFORM_MAP[`${process.platform}-${process.arch}`];
|
|
142
|
+
if (!assetName) {
|
|
143
|
+
throw new Error(`unsupported platform: ${process.platform}/${process.arch}`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const archivePath = path.join(assetsDir, assetName);
|
|
147
|
+
const skillsPath = path.join(assetsDir, "dws-skills.zip");
|
|
148
|
+
if (!fs.existsSync(archivePath)) {
|
|
149
|
+
throw new Error(`missing platform archive: ${archivePath}`);
|
|
150
|
+
}
|
|
151
|
+
if (!fs.existsSync(skillsPath)) {
|
|
152
|
+
throw new Error(`missing skills archive: ${skillsPath}`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
extractArchive(archivePath, vendorDir);
|
|
156
|
+
extractSkills(skillsPath, skillDir);
|
|
157
|
+
installSkillsToHomes(skillDir);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dingtalk-workspace-cli",
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"description": "DingTalk Workspace CLI - AI-powered productivity tools",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/open-dingtalk/dingtalk-workspace-cli.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/open-dingtalk/dingtalk-workspace-cli",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/open-dingtalk/dingtalk-workspace-cli/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"dingtalk",
|
|
16
|
+
"dws",
|
|
17
|
+
"cli",
|
|
18
|
+
"workspace",
|
|
19
|
+
"ai",
|
|
20
|
+
"productivity"
|
|
21
|
+
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"dws": "./bin/dws.js"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"postinstall": "node install.js"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"assets",
|
|
30
|
+
"bin",
|
|
31
|
+
"install.js",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=16"
|
|
36
|
+
}
|
|
37
|
+
}
|