sakuraai 0.0.10 → 0.0.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/dist/index.js +1891 -320
- package/package.json +6 -3
- package/scripts/download-onboard.js +68 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sakuraai",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Sakura Agent CLI + local runtime for managing AI coding sessions (Claude Code, Codex, OpenCode) and reaching them privately from the Sakura mobile app over Tailscale",
|
|
3
|
+
"version": "0.0.12",
|
|
4
|
+
"description": "Sakura Agent CLI + local runtime for managing AI coding sessions (Claude Code, Codex, OpenCode, ZCode, DeepSeek) and reaching them privately from the Sakura mobile app over Tailscale",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"claude",
|
|
17
17
|
"codex",
|
|
18
18
|
"opencode",
|
|
19
|
+
"zcode",
|
|
20
|
+
"deepseek",
|
|
19
21
|
"remote-execution",
|
|
20
22
|
"tailscale"
|
|
21
23
|
],
|
|
@@ -28,6 +30,7 @@
|
|
|
28
30
|
"dist",
|
|
29
31
|
"!dist/**/*.map",
|
|
30
32
|
"scripts/download-tsnet.js",
|
|
33
|
+
"scripts/download-onboard.js",
|
|
31
34
|
"README.md"
|
|
32
35
|
],
|
|
33
36
|
"scripts": {
|
|
@@ -36,7 +39,7 @@
|
|
|
36
39
|
"dev": "tsx src/index.ts",
|
|
37
40
|
"clean": "rimraf dist",
|
|
38
41
|
"typecheck": "tsc --noEmit",
|
|
39
|
-
"postinstall": "node scripts/download-tsnet.js",
|
|
42
|
+
"postinstall": "node scripts/download-tsnet.js && node scripts/download-onboard.js",
|
|
40
43
|
"prepublishOnly": "npm run clean && npm run build"
|
|
41
44
|
},
|
|
42
45
|
"dependencies": {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// postinstall: fetch the prebuilt `sakura-onboard` bubbletea welcome UI for this
|
|
2
|
+
// OS/arch from the public Nishu0/sakura-tsnet Release matching this package
|
|
3
|
+
// version. Best-effort by design — if anything fails (offline, unsupported
|
|
4
|
+
// platform, missing asset) we exit 0 so `npm install` never breaks; the CLI just
|
|
5
|
+
// prints a plain-text guide instead of the interactive one.
|
|
6
|
+
//
|
|
7
|
+
// Skips: SAKURA_SKIP_ONBOARD_DOWNLOAD=1, SAKURA_ONBOARD_BIN set, or already present.
|
|
8
|
+
// Override source: SAKURA_ONBOARD_TAG, SAKURA_ONBOARD_BASE_URL.
|
|
9
|
+
|
|
10
|
+
import fs from "node:fs";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import https from "node:https";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
|
|
15
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(here, "..", "package.json"), "utf8"));
|
|
17
|
+
|
|
18
|
+
const PLAT = { darwin: "darwin", linux: "linux", win32: "windows" }[process.platform];
|
|
19
|
+
const ARCH = { x64: "amd64", arm64: "arm64" }[process.arch];
|
|
20
|
+
const isWin = process.platform === "win32";
|
|
21
|
+
|
|
22
|
+
const binDir = path.join(here, "..", "bin");
|
|
23
|
+
const outPath = path.join(binDir, isWin ? "sakura-onboard.exe" : "sakura-onboard");
|
|
24
|
+
|
|
25
|
+
if (process.env.SAKURA_SKIP_ONBOARD_DOWNLOAD === "1" || process.env.SAKURA_ONBOARD_BIN) process.exit(0);
|
|
26
|
+
if (fs.existsSync(outPath)) process.exit(0);
|
|
27
|
+
if (!PLAT || !ARCH) process.exit(0);
|
|
28
|
+
|
|
29
|
+
const asset = `sakura-onboard-${PLAT}-${ARCH}${isWin ? ".exe" : ""}`;
|
|
30
|
+
const tag = process.env.SAKURA_ONBOARD_TAG || `v${pkg.version}`;
|
|
31
|
+
const base = process.env.SAKURA_ONBOARD_BASE_URL || `https://github.com/Nishu0/sakura-tsnet/releases/download/${tag}`;
|
|
32
|
+
const url = `${base}/${asset}`;
|
|
33
|
+
|
|
34
|
+
function download(u, redirectsLeft = 5) {
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
https
|
|
37
|
+
.get(u, { headers: { "User-Agent": "sakuraai-postinstall" } }, (res) => {
|
|
38
|
+
if ([301, 302, 303, 307, 308].includes(res.statusCode) && res.headers.location) {
|
|
39
|
+
if (redirectsLeft <= 0) return reject(new Error("too many redirects"));
|
|
40
|
+
res.resume();
|
|
41
|
+
return resolve(download(res.headers.location, redirectsLeft - 1));
|
|
42
|
+
}
|
|
43
|
+
if (res.statusCode !== 200) {
|
|
44
|
+
res.resume();
|
|
45
|
+
return reject(new Error(`HTTP ${res.statusCode} for ${u}`));
|
|
46
|
+
}
|
|
47
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
48
|
+
const tmp = `${outPath}.download`;
|
|
49
|
+
const file = fs.createWriteStream(tmp);
|
|
50
|
+
res.pipe(file);
|
|
51
|
+
file.on("finish", () => file.close(() => {
|
|
52
|
+
fs.renameSync(tmp, outPath);
|
|
53
|
+
if (!isWin) fs.chmodSync(outPath, 0o755);
|
|
54
|
+
resolve();
|
|
55
|
+
}));
|
|
56
|
+
file.on("error", reject);
|
|
57
|
+
})
|
|
58
|
+
.on("error", reject);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
await download(url);
|
|
64
|
+
console.log(`[sakura] installed welcome guide (${asset}). Run \`sakura welcome\` any time.`);
|
|
65
|
+
} catch {
|
|
66
|
+
// Silent — the CLI falls back to a plain-text guide.
|
|
67
|
+
process.exit(0);
|
|
68
|
+
}
|