@zabuti/tools 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +14 -3
- package/dist/installer/src/index.js +43 -0
- package/dist/installer/src/skills.js +78 -0
- package/package.json +33 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zabuti
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @zabuti/tools
|
|
2
|
+
|
|
3
|
+
Installs the licensed Zabuti developer tools (Logic Map, Logic Optimizer) as Claude Code
|
|
4
|
+
skills. Needs a Zabuti license and a download token from zabuti.com/account (CLI access).
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
npx @zabuti/tools login zct_…
|
|
8
|
+
npx @zabuti/tools add logic-map
|
|
9
|
+
npx @zabuti/tools add logic-optimizer
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The skill is written to `~/.claude/skills/<name>/`. The server checks your token and your
|
|
13
|
+
organization's license on every download. Nothing from your project is sent. The free
|
|
14
|
+
`zabuti` CLI (components and icons) is a separate package and makes no network calls.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* zabuti-tools: installs the licensed Zabuti developer tools as Claude Code skills.
|
|
4
|
+
* Kept separate from the free `zabuti` CLI so that one never touches the network.
|
|
5
|
+
*/
|
|
6
|
+
import { cmdAddSkill, cmdLogin, SKILL_NAMES } from "./skills.js";
|
|
7
|
+
const USAGE = `zabuti-tools: install the licensed Zabuti developer tools
|
|
8
|
+
|
|
9
|
+
zabuti-tools login <token> save your download token (make one at zabuti.com/account)
|
|
10
|
+
zabuti-tools add <skill> install a skill into ~/.claude/skills/
|
|
11
|
+
skills: ${SKILL_NAMES.join(", ")}
|
|
12
|
+
|
|
13
|
+
Options: --dry-run (list the files without writing)`;
|
|
14
|
+
function die(msg) {
|
|
15
|
+
console.error(`zabuti-tools: ${msg}`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
const args = process.argv.slice(2);
|
|
19
|
+
const flags = new Set(args.filter((a) => a.startsWith("--")));
|
|
20
|
+
const positionals = args.filter((a) => !a.startsWith("--"));
|
|
21
|
+
const [command, name] = positionals;
|
|
22
|
+
try {
|
|
23
|
+
switch (command) {
|
|
24
|
+
case "login":
|
|
25
|
+
cmdLogin(name);
|
|
26
|
+
break;
|
|
27
|
+
case "add":
|
|
28
|
+
if (!name || !SKILL_NAMES.includes(name) || positionals.length > 2) {
|
|
29
|
+
die(`add: name one skill (${SKILL_NAMES.join(" or ")}), e.g. \`zabuti-tools add logic-map\`.`);
|
|
30
|
+
}
|
|
31
|
+
await cmdAddSkill(name, flags.has("--dry-run"));
|
|
32
|
+
break;
|
|
33
|
+
case undefined:
|
|
34
|
+
case "help":
|
|
35
|
+
console.log(USAGE);
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
die(`unknown command "${command}".\n\n${USAGE}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
die(e.message);
|
|
43
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gated skills (Logic Map, Logic Optimizer): `zabuti-tools login <token>` stores a download
|
|
3
|
+
* token minted at zabuti.com/account; `zabuti-tools add logic-map` downloads the skill from
|
|
4
|
+
* the site and writes it to ~/.claude/skills/<name>/. The server checks the token and
|
|
5
|
+
* the account's license on every download. Nothing else is sent: no project files.
|
|
6
|
+
*/
|
|
7
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { homedir } from "node:os";
|
|
9
|
+
import { dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
10
|
+
export const SKILL_NAMES = ["logic-map", "logic-optimizer"];
|
|
11
|
+
const BASE_URL = (process.env.ZABUTI_URL ?? "https://zabuti.com").replace(/\/+$/, "");
|
|
12
|
+
const CONFIG_DIR = join(homedir(), ".zabuti");
|
|
13
|
+
const CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
14
|
+
const TOKEN_PREFIX = "zct_";
|
|
15
|
+
function storedToken() {
|
|
16
|
+
if (process.env.ZABUTI_TOKEN)
|
|
17
|
+
return process.env.ZABUTI_TOKEN.trim();
|
|
18
|
+
try {
|
|
19
|
+
const t = JSON.parse(readFileSync(CONFIG_FILE, "utf8")).token;
|
|
20
|
+
return typeof t === "string" ? t : null;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function cmdLogin(token) {
|
|
27
|
+
if (!token || !token.startsWith(TOKEN_PREFIX)) {
|
|
28
|
+
throw new Error(`login: give the token from zabuti.com/account (starts with ${TOKEN_PREFIX}), e.g. \`zabuti-tools login ${TOKEN_PREFIX}…\`.`);
|
|
29
|
+
}
|
|
30
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
31
|
+
writeFileSync(CONFIG_FILE, JSON.stringify({ token }, null, 2) + "\n", { mode: 0o600 });
|
|
32
|
+
try {
|
|
33
|
+
chmodSync(CONFIG_FILE, 0o600);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
/* Windows: the home folder's ACL applies */
|
|
37
|
+
}
|
|
38
|
+
console.log(`✓ Saved to ${CONFIG_FILE}. Now: zabuti-tools add logic-map or zabuti-tools add logic-optimizer`);
|
|
39
|
+
}
|
|
40
|
+
/** A path from the server must stay inside the skill folder. */
|
|
41
|
+
function safeJoin(root, rel) {
|
|
42
|
+
const full = resolve(root, rel);
|
|
43
|
+
if (isAbsolute(rel) || rel.includes("\0") || !(full + sep).startsWith(resolve(root) + sep)) {
|
|
44
|
+
throw new Error(`the server sent an unsafe file path (${rel}); nothing was written.`);
|
|
45
|
+
}
|
|
46
|
+
return full;
|
|
47
|
+
}
|
|
48
|
+
export async function cmdAddSkill(name, dryRun, outDir) {
|
|
49
|
+
const token = storedToken();
|
|
50
|
+
if (!token)
|
|
51
|
+
throw new Error("not signed in. Make a token at zabuti.com/account, then run `zabuti-tools login <token>`.");
|
|
52
|
+
let res;
|
|
53
|
+
try {
|
|
54
|
+
res = await fetch(`${BASE_URL}/api/cli/skills/${encodeURIComponent(name)}`, { headers: { authorization: `Bearer ${token}` } });
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
throw new Error(`couldn't reach ${BASE_URL} (${e.message}).`);
|
|
58
|
+
}
|
|
59
|
+
const body = (await res.json().catch(() => null));
|
|
60
|
+
if (!res.ok || !body?.files)
|
|
61
|
+
throw new Error(body?.error ?? `the server answered ${res.status}.`);
|
|
62
|
+
const root = outDir ? resolve(outDir) : join(homedir(), ".claude", "skills", name);
|
|
63
|
+
const files = body.files.map((f) => ({ full: safeJoin(root, f.path), rel: f.path, content: f.content }));
|
|
64
|
+
if (dryRun) {
|
|
65
|
+
console.log(`Would write ${files.length} files to ${root}:`);
|
|
66
|
+
for (const f of files)
|
|
67
|
+
console.log(` ${f.rel}`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (existsSync(root))
|
|
71
|
+
rmSync(root, { recursive: true, force: true });
|
|
72
|
+
for (const f of files) {
|
|
73
|
+
mkdirSync(dirname(f.full), { recursive: true });
|
|
74
|
+
writeFileSync(f.full, f.content);
|
|
75
|
+
}
|
|
76
|
+
console.log(`✓ Installed ${name} (${files.length} files) → ${root}`);
|
|
77
|
+
console.log(" Open Claude Code in your project and ask it to use the skill.");
|
|
78
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@zabuti/tools",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@zabuti/tools",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Installs the licensed Zabuti developer tools (Logic Map, Logic Optimizer) as Claude Code skills. Needs a license and a download token from zabuti.com.",
|
|
5
|
+
"homepage": "https://zabuti.com",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"zabuti-tools": "dist/installer/src/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=20"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"claude-code",
|
|
20
|
+
"skills",
|
|
21
|
+
"zabuti"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc -p tsconfig.json",
|
|
25
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
26
|
+
"smoke": "node scripts/smoke.mjs",
|
|
27
|
+
"prepack": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.0.0",
|
|
31
|
+
"typescript": "^5.6.0"
|
|
32
|
+
}
|
|
33
|
+
}
|