zidane-tui 4.1.3

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.
Files changed (2) hide show
  1. package/bin/zidane.mjs +83 -0
  2. package/package.json +58 -0
package/bin/zidane.mjs ADDED
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ // `zidane-tui` CLI launcher.
3
+ //
4
+ // This shim runs under Node (any Node ≥18) so the package installs cleanly on
5
+ // any machine that already has npm. It detects the host triple, resolves the
6
+ // platform-specific binary from the matching optional dependency
7
+ // (`zidane-tui-darwin-arm64`, …), and execs it. The binary itself is a
8
+ // self-contained Bun executable — end users do NOT need Bun installed.
9
+ //
10
+ // Keep this file dependency-free: it has to run before anything from
11
+ // `node_modules` is loaded other than the platform binary it resolves.
12
+
13
+ import { execSync, spawn } from 'node:child_process'
14
+ import { createRequire } from 'node:module'
15
+
16
+ const require = createRequire(import.meta.url)
17
+
18
+ /** glibc vs musl detection. `ldd --version` mentions "musl" on Alpine and similar. */
19
+ function detectLibc() {
20
+ try {
21
+ const out = execSync('ldd --version 2>&1', { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] })
22
+ return out.toLowerCase().includes('musl') ? 'musl' : 'glibc'
23
+ }
24
+ catch {
25
+ return 'musl'
26
+ }
27
+ }
28
+
29
+ /** Returns the platform key matching one of the `zidane-tui-<key>` packages, or `null` when unsupported. */
30
+ function platformKey() {
31
+ const { platform, arch } = process
32
+ if (platform === 'darwin')
33
+ return arch === 'arm64' ? 'darwin-arm64' : arch === 'x64' ? 'darwin-x64' : null
34
+ if (platform === 'linux') {
35
+ if (detectLibc() !== 'glibc')
36
+ return null
37
+ return arch === 'arm64' ? 'linux-arm64' : arch === 'x64' ? 'linux-x64' : null
38
+ }
39
+ return null
40
+ }
41
+
42
+ function resolveBinary() {
43
+ const key = platformKey()
44
+ if (!key) {
45
+ throw new Error(
46
+ `zidane has no prebuilt binary for ${process.platform}-${process.arch}.\n`
47
+ + `Supported targets: darwin/arm64, darwin/x64, linux/x64 (glibc), linux/arm64 (glibc).\n`
48
+ + `If you need another platform, please open an issue at https://github.com/Tahul/zidane/issues.`,
49
+ )
50
+ }
51
+ const pkg = `zidane-tui-${key}`
52
+ try {
53
+ return require.resolve(`${pkg}/bin/zidane`)
54
+ }
55
+ catch {
56
+ throw new Error(
57
+ `Could not find the ${pkg} binary in node_modules.\n`
58
+ + `It should have been installed automatically as an optional dependency of zidane-tui.\n`
59
+ + `Try reinstalling: \`npm install -g zidane-tui\` (or your package manager's equivalent).`,
60
+ )
61
+ }
62
+ }
63
+
64
+ try {
65
+ const bin = resolveBinary()
66
+ const child = spawn(bin, process.argv.slice(2), { stdio: 'inherit' })
67
+ child.on('exit', (code, signal) => {
68
+ if (signal) {
69
+ // Re-raise the signal so callers see the real cause of death (e.g. SIGINT).
70
+ process.kill(process.pid, signal)
71
+ return
72
+ }
73
+ process.exit(code ?? 1)
74
+ })
75
+ child.on('error', (err) => {
76
+ console.error(`zidane failed to launch: ${err instanceof Error ? err.message : err}`)
77
+ process.exit(1)
78
+ })
79
+ }
80
+ catch (err) {
81
+ console.error(err instanceof Error ? err.message : String(err))
82
+ process.exit(1)
83
+ }
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "zidane-tui",
3
+ "version": "4.1.3",
4
+ "description": "Terminal UI for the zidane agent. Ships as a self-contained binary — install globally and run `zidane`.",
5
+ "license": "MIT",
6
+ "author": "Yaël GUILLOUX <yael.guilloux@gmail.com>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Tahul/zidane",
10
+ "directory": "tui"
11
+ },
12
+ "homepage": "https://github.com/Tahul/zidane#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/Tahul/zidane/issues"
15
+ },
16
+ "keywords": [
17
+ "zidane",
18
+ "tui",
19
+ "agent",
20
+ "cli",
21
+ "terminal-ui",
22
+ "ai",
23
+ "anthropic",
24
+ "claude"
25
+ ],
26
+ "type": "module",
27
+ "bin": {
28
+ "zidane": "./bin/zidane.mjs"
29
+ },
30
+ "files": [
31
+ "bin"
32
+ ],
33
+ "engines": {
34
+ "node": ">=18"
35
+ },
36
+ "scripts": {
37
+ "start": "bun run src/cli.ts",
38
+ "dev": "bun --watch run src/cli.ts",
39
+ "build": "bun run ../scripts/build-executables.ts",
40
+ "typecheck": "tsc --noEmit"
41
+ },
42
+ "optionalDependencies": {
43
+ "zidane-tui-darwin-arm64": "4.1.0",
44
+ "zidane-tui-darwin-x64": "4.1.0",
45
+ "zidane-tui-linux-x64": "4.1.0",
46
+ "zidane-tui-linux-arm64": "4.1.0"
47
+ },
48
+ "devDependencies": {
49
+ "@anthropic-ai/sdk": "^0.90.0",
50
+ "@opentui/core": "^0.2.6",
51
+ "@opentui/react": "^0.2.6",
52
+ "@types/bun": "^1.3.13",
53
+ "@types/react": "^19.2.0",
54
+ "react": "^19.2.0",
55
+ "typescript": "~6.0.3",
56
+ "zidane": "file:.."
57
+ }
58
+ }