nulu-code 0.0.0-stage → 1.0.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/NOTICE.md +13 -0
- package/README.md +47 -2
- package/bin/nulu.exe +11 -0
- package/package.json +44 -4
- package/postinstall.mjs +193 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 opencode
|
|
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/NOTICE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Notice
|
|
2
|
+
|
|
3
|
+
Nulu Harness is developed by World App Technologies (Nulu AI, a World App Technologies company).
|
|
4
|
+
|
|
5
|
+
It is based on **OpenCode** (https://github.com/anomalyco/opencode), release `v2.2.6`, commit
|
|
6
|
+
`dc2ffcf8bf26f9e669b6aa22b95f50e12be15e06`, Copyright (c) 2025 opencode, licensed under the MIT License.
|
|
7
|
+
The OpenCode license is kept unchanged in `LICENSE`. Upstream history is preserved in this repository, so
|
|
8
|
+
`git log` and `git blame` show which code comes from OpenCode and which was added or changed for Nulu Harness.
|
|
9
|
+
|
|
10
|
+
Third-party dependencies keep their own licenses; see `docs/architecture/dependency-licenses.md`.
|
|
11
|
+
Distributed builds include a generated third-party notices file.
|
|
12
|
+
|
|
13
|
+
This repository is private. Do not publish it, mirror it, or add workflows that publish it.
|
package/README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Nulu Code
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Nulu Code is the terminal AI coding agent powered by Nulu AI. It installs the command `nulu`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install --global nulu-code
|
|
9
|
+
nulu
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The first start connects your Nulu AI account: `nulu` shows a link, you approve in your browser and paste the code
|
|
13
|
+
the page shows. `nulu login` does the same at any time.
|
|
14
|
+
|
|
15
|
+
Requirements: Node.js 18 or newer for the installer (the agent itself is a self-contained executable), on Linux
|
|
16
|
+
(x64, arm64; glibc or musl), macOS (Apple Silicon, Intel) or Windows (x64, arm64). npm 12 and later skip
|
|
17
|
+
installation scripts by default: on Linux and macOS the first `nulu` then finishes the installation by itself; on
|
|
18
|
+
Windows install with `npm install --global --allow-scripts=nulu-code nulu-code`.
|
|
19
|
+
|
|
20
|
+
## Update
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
nulu update
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Updates are checked against a release manifest signed by Nulu AI and installed through npm only.
|
|
27
|
+
|
|
28
|
+
## Coming from Nulu Harness
|
|
29
|
+
|
|
30
|
+
Nulu Code replaces Nulu Harness (the `nulu-harness` package and the desktop application). Remove the old package
|
|
31
|
+
with `npm uninstall --global nulu-harness`, install `nulu-code`, and sign in with `nulu login`. Settings that Nulu
|
|
32
|
+
Harness kept in `~/.nulu` are not used and are left untouched.
|
|
33
|
+
|
|
34
|
+
## Uninstall
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
npm uninstall --global nulu-code
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Settings, sessions and the stored sign-in stay on disk until you remove them; `nulu logout` removes the sign-in.
|
|
41
|
+
|
|
42
|
+
## Account and billing
|
|
43
|
+
|
|
44
|
+
Usage is billed to your Nulu AI account at https://platform.nuluai.com. There is no separate Nulu Code account.
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
MIT. See `LICENSE` and `NOTICE.md`.
|
package/bin/nulu.exe
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
fix="npm install --global --allow-scripts=nulu-code nulu-code"
|
|
2
|
+
if [ -n "$NULU_FINISHING_INSTALL" ] || ! command -v node >/dev/null 2>&1; then
|
|
3
|
+
echo "Error: the Nulu Code installation is incomplete. Reinstall with: $fix" >&2
|
|
4
|
+
exit 1
|
|
5
|
+
fi
|
|
6
|
+
case "$0" in */*) self="$0" ;; *) self="$(command -v "$0")" ;; esac
|
|
7
|
+
self="$(node -e 'console.log(require("fs").realpathSync(process.argv[1]))' "$self")" || exit 1
|
|
8
|
+
echo "Nulu Code: finishing the installation..." >&2
|
|
9
|
+
if NULU_FINISHING_INSTALL=1 node "$(dirname "$self")/../postinstall.mjs" >&2; then exec "$self" "$@"; fi
|
|
10
|
+
echo "Error: the Nulu Code installation could not be finished. Reinstall with: $fix" >&2
|
|
11
|
+
exit 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nulu-code",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Nulu Code: the terminal AI coding agent powered by Nulu AI",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://nuluai.com",
|
|
7
|
+
"bin": {
|
|
8
|
+
"nulu": "./bin/nulu.exe"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"postinstall": "node ./postinstall.mjs"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18"
|
|
15
|
+
},
|
|
16
|
+
"os": [
|
|
17
|
+
"darwin",
|
|
18
|
+
"linux",
|
|
19
|
+
"win32"
|
|
20
|
+
],
|
|
21
|
+
"cpu": [
|
|
22
|
+
"arm64",
|
|
23
|
+
"x64"
|
|
24
|
+
],
|
|
25
|
+
"files": [
|
|
26
|
+
"bin",
|
|
27
|
+
"postinstall.mjs",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"NOTICE.md"
|
|
31
|
+
],
|
|
32
|
+
"optionalDependencies": {
|
|
33
|
+
"nulu-code-darwin-arm64": "1.0.1",
|
|
34
|
+
"nulu-code-darwin-x64": "1.0.1",
|
|
35
|
+
"nulu-code-darwin-x64-baseline": "1.0.1",
|
|
36
|
+
"nulu-code-linux-arm64": "1.0.1",
|
|
37
|
+
"nulu-code-linux-arm64-musl": "1.0.1",
|
|
38
|
+
"nulu-code-linux-x64": "1.0.1",
|
|
39
|
+
"nulu-code-linux-x64-baseline": "1.0.1",
|
|
40
|
+
"nulu-code-linux-x64-baseline-musl": "1.0.1",
|
|
41
|
+
"nulu-code-linux-x64-musl": "1.0.1",
|
|
42
|
+
"nulu-code-windows-arm64": "1.0.1",
|
|
43
|
+
"nulu-code-windows-x64": "1.0.1",
|
|
44
|
+
"nulu-code-windows-x64-baseline": "1.0.1"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import childProcess from "node:child_process"
|
|
4
|
+
import fs from "node:fs"
|
|
5
|
+
import os from "node:os"
|
|
6
|
+
import path from "node:path"
|
|
7
|
+
import { createRequire } from "node:module"
|
|
8
|
+
import { fileURLToPath } from "node:url"
|
|
9
|
+
|
|
10
|
+
const directory = path.dirname(fileURLToPath(import.meta.url))
|
|
11
|
+
const require = createRequire(import.meta.url)
|
|
12
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(directory, "package.json"), "utf8"))
|
|
13
|
+
const command = Object.keys(packageJson.bin ?? {})[0]
|
|
14
|
+
if (!command) throw new Error("Nulu Code package does not declare a binary")
|
|
15
|
+
const sourceCommand = packageJson.nuluSourceBinary ?? command
|
|
16
|
+
|
|
17
|
+
const platform = { darwin: "darwin", linux: "linux", win32: "windows" }[os.platform()] ?? os.platform()
|
|
18
|
+
const nodeArch = { x64: "x64", arm64: "arm64", arm: "arm" }[os.arch()] ?? os.arch()
|
|
19
|
+
// x64 Node runs emulated on Windows ARM64, but PROCESSOR_IDENTIFIER still names the host CPU.
|
|
20
|
+
const arch =
|
|
21
|
+
platform === "windows" && nodeArch === "x64" && process.env.PROCESSOR_IDENTIFIER?.startsWith("ARM")
|
|
22
|
+
? "arm64"
|
|
23
|
+
: nodeArch
|
|
24
|
+
// Windows cannot spawn npm's .cmd shim directly, so reuse the npm CLI that runs this script.
|
|
25
|
+
const npm = process.env.npm_execpath?.endsWith("npm-cli.js") ? [process.execPath, process.env.npm_execpath] : ["npm"]
|
|
26
|
+
const sourceBinary = platform === "windows" ? `${sourceCommand}.exe` : sourceCommand
|
|
27
|
+
const targetBinary = path.resolve(directory, packageJson.bin[command])
|
|
28
|
+
const dependencies = packageJson.optionalDependencies ?? {}
|
|
29
|
+
const base = Object.keys(dependencies).find((name) => name.endsWith(`-${platform}-${arch}`))
|
|
30
|
+
if (!base) throw new Error(`Nulu Code does not provide a binary for ${platform}-${arch}`)
|
|
31
|
+
|
|
32
|
+
function supportsAvx2() {
|
|
33
|
+
if (arch !== "x64") return false
|
|
34
|
+
if (platform === "linux") {
|
|
35
|
+
try {
|
|
36
|
+
return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
|
|
37
|
+
} catch {
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (platform === "darwin") {
|
|
42
|
+
try {
|
|
43
|
+
const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
|
|
44
|
+
encoding: "utf8",
|
|
45
|
+
timeout: 1500,
|
|
46
|
+
})
|
|
47
|
+
return result.status === 0 && (result.stdout || "").trim() === "1"
|
|
48
|
+
} catch {
|
|
49
|
+
return false
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (platform === "windows") {
|
|
53
|
+
const script =
|
|
54
|
+
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
55
|
+
for (const executable of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
56
|
+
try {
|
|
57
|
+
const result = childProcess.spawnSync(executable, ["-NoProfile", "-NonInteractive", "-Command", script], {
|
|
58
|
+
encoding: "utf8",
|
|
59
|
+
timeout: 3000,
|
|
60
|
+
windowsHide: true,
|
|
61
|
+
})
|
|
62
|
+
if (result.status !== 0) continue
|
|
63
|
+
const output = (result.stdout || "").trim().toLowerCase()
|
|
64
|
+
if (output === "true" || output === "1") return true
|
|
65
|
+
if (output === "false" || output === "0") return false
|
|
66
|
+
} catch {
|
|
67
|
+
continue
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return false
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function isMusl() {
|
|
75
|
+
if (platform !== "linux") return false
|
|
76
|
+
try {
|
|
77
|
+
if (fs.existsSync("/etc/alpine-release")) return true
|
|
78
|
+
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
79
|
+
return `${result.stdout || ""}${result.stderr || ""}`.toLowerCase().includes("musl")
|
|
80
|
+
} catch {
|
|
81
|
+
return false
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function packageNames() {
|
|
86
|
+
const baseline = arch === "x64" && !supportsAvx2()
|
|
87
|
+
const names =
|
|
88
|
+
platform === "linux"
|
|
89
|
+
? isMusl()
|
|
90
|
+
? arch === "x64"
|
|
91
|
+
? baseline
|
|
92
|
+
? [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
93
|
+
: [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
94
|
+
: [`${base}-musl`, base]
|
|
95
|
+
: arch === "x64"
|
|
96
|
+
? baseline
|
|
97
|
+
? [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
98
|
+
: [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
99
|
+
: [base, `${base}-musl`]
|
|
100
|
+
: arch === "x64"
|
|
101
|
+
? baseline
|
|
102
|
+
? [`${base}-baseline`, base]
|
|
103
|
+
: [base, `${base}-baseline`]
|
|
104
|
+
: [base]
|
|
105
|
+
// Windows 11 on ARM64 can still run the x64 binary under emulation when the native one fails.
|
|
106
|
+
const x64 = base.replace(/-arm64$/, "-x64")
|
|
107
|
+
const emulated = platform === "windows" && arch === "arm64" ? [`${x64}-baseline`, x64] : []
|
|
108
|
+
return [...names, ...emulated].filter((name) => dependencies[name])
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function copyBinary(source) {
|
|
112
|
+
if (!fs.existsSync(source)) throw new Error(`Binary not found at ${source}`)
|
|
113
|
+
fs.mkdirSync(path.dirname(targetBinary), { recursive: true })
|
|
114
|
+
if (fs.existsSync(targetBinary)) {
|
|
115
|
+
try {
|
|
116
|
+
fs.unlinkSync(targetBinary)
|
|
117
|
+
} catch {}
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
fs.linkSync(source, targetBinary)
|
|
121
|
+
} catch {
|
|
122
|
+
fs.copyFileSync(source, targetBinary)
|
|
123
|
+
}
|
|
124
|
+
fs.chmodSync(targetBinary, 0o755)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function resolveBinary(name) {
|
|
128
|
+
const packagePath = require.resolve(`${name}/package.json`)
|
|
129
|
+
// Package managers keep an older platform package when the matching version is not yet on the registry,
|
|
130
|
+
// which would silently install the previous release under the new launcher.
|
|
131
|
+
const version = JSON.parse(fs.readFileSync(packagePath, "utf8")).version
|
|
132
|
+
if (version !== dependencies[name]) throw new Error(`${name} is ${version}, expected ${dependencies[name]}`)
|
|
133
|
+
return path.join(path.dirname(packagePath), "bin", sourceBinary)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function installPackage(name) {
|
|
137
|
+
const temp = fs.mkdtempSync(path.join(os.tmpdir(), "nulu-harness-install-"))
|
|
138
|
+
try {
|
|
139
|
+
const result = childProcess.spawnSync(
|
|
140
|
+
npm[0],
|
|
141
|
+
[
|
|
142
|
+
...npm.slice(1),
|
|
143
|
+
"install",
|
|
144
|
+
"--ignore-scripts",
|
|
145
|
+
"--no-save",
|
|
146
|
+
"--loglevel=error",
|
|
147
|
+
// npm rejects a package built for another CPU, such as arm64 under emulated x64 Node, unless forced.
|
|
148
|
+
...(name.includes(`-${platform}-${nodeArch}`) ? [] : ["--force"]),
|
|
149
|
+
"--prefix",
|
|
150
|
+
temp,
|
|
151
|
+
`${name}@${dependencies[name]}`,
|
|
152
|
+
],
|
|
153
|
+
{ stdio: "inherit", windowsHide: true },
|
|
154
|
+
)
|
|
155
|
+
if (result.status !== 0) return false
|
|
156
|
+
copyBinary(path.join(temp, "node_modules", name, "bin", sourceBinary))
|
|
157
|
+
return true
|
|
158
|
+
} finally {
|
|
159
|
+
fs.rmSync(temp, { recursive: true, force: true })
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function verifyBinary() {
|
|
164
|
+
return (
|
|
165
|
+
childProcess.spawnSync(targetBinary, ["--version"], {
|
|
166
|
+
stdio: "ignore",
|
|
167
|
+
windowsHide: true,
|
|
168
|
+
}).status === 0
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function main() {
|
|
173
|
+
const names = packageNames()
|
|
174
|
+
for (const name of names) {
|
|
175
|
+
try {
|
|
176
|
+
copyBinary(resolveBinary(name))
|
|
177
|
+
if (verifyBinary()) return
|
|
178
|
+
} catch {
|
|
179
|
+
if (installPackage(name) && verifyBinary()) return
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
throw new Error(
|
|
184
|
+
`Failed to install Nulu Code. Try manually installing ${names.map((name) => JSON.stringify(name)).join(" or ")}.`,
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
try {
|
|
189
|
+
main()
|
|
190
|
+
} catch (error) {
|
|
191
|
+
console.error(error instanceof Error ? error.message : String(error))
|
|
192
|
+
process.exit(1)
|
|
193
|
+
}
|