nanocode 1.0.197
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/bin/nanocode +84 -0
- package/bin/opencode +84 -0
- package/package.json +34 -0
package/bin/nanocode
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const childProcess = require("child_process")
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const path = require("path")
|
|
6
|
+
const os = require("os")
|
|
7
|
+
|
|
8
|
+
function run(target) {
|
|
9
|
+
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
})
|
|
12
|
+
if (result.error) {
|
|
13
|
+
console.error(result.error.message)
|
|
14
|
+
process.exit(1)
|
|
15
|
+
}
|
|
16
|
+
const code = typeof result.status === "number" ? result.status : 0
|
|
17
|
+
process.exit(code)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const envPath = process.env.NANOCODE_BIN_PATH
|
|
21
|
+
if (envPath) {
|
|
22
|
+
run(envPath)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
26
|
+
const scriptDir = path.dirname(scriptPath)
|
|
27
|
+
|
|
28
|
+
const platformMap = {
|
|
29
|
+
darwin: "darwin",
|
|
30
|
+
linux: "linux",
|
|
31
|
+
win32: "windows",
|
|
32
|
+
}
|
|
33
|
+
const archMap = {
|
|
34
|
+
x64: "x64",
|
|
35
|
+
arm64: "arm64",
|
|
36
|
+
arm: "arm",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let platform = platformMap[os.platform()]
|
|
40
|
+
if (!platform) {
|
|
41
|
+
platform = os.platform()
|
|
42
|
+
}
|
|
43
|
+
let arch = archMap[os.arch()]
|
|
44
|
+
if (!arch) {
|
|
45
|
+
arch = os.arch()
|
|
46
|
+
}
|
|
47
|
+
const base = "nanocode-" + platform + "-" + arch
|
|
48
|
+
const binary = platform === "windows" ? "nanocode.exe" : "nanocode"
|
|
49
|
+
|
|
50
|
+
function findBinary(startDir) {
|
|
51
|
+
let current = startDir
|
|
52
|
+
for (; ;) {
|
|
53
|
+
const modules = path.join(current, "node_modules")
|
|
54
|
+
if (fs.existsSync(modules)) {
|
|
55
|
+
const entries = fs.readdirSync(modules)
|
|
56
|
+
for (const entry of entries) {
|
|
57
|
+
if (!entry.startsWith(base)) {
|
|
58
|
+
continue
|
|
59
|
+
}
|
|
60
|
+
const candidate = path.join(modules, entry, "bin", binary)
|
|
61
|
+
if (fs.existsSync(candidate)) {
|
|
62
|
+
return candidate
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const parent = path.dirname(current)
|
|
67
|
+
if (parent === current) {
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
current = parent
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const resolved = findBinary(scriptDir)
|
|
75
|
+
if (!resolved) {
|
|
76
|
+
console.error(
|
|
77
|
+
'It seems that your package manager failed to install the right version of the nanocode CLI for your platform. You can try manually installing the "' +
|
|
78
|
+
base +
|
|
79
|
+
'" package',
|
|
80
|
+
)
|
|
81
|
+
process.exit(1)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
run(resolved)
|
package/bin/opencode
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const childProcess = require("child_process")
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const path = require("path")
|
|
6
|
+
const os = require("os")
|
|
7
|
+
|
|
8
|
+
function run(target) {
|
|
9
|
+
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
})
|
|
12
|
+
if (result.error) {
|
|
13
|
+
console.error(result.error.message)
|
|
14
|
+
process.exit(1)
|
|
15
|
+
}
|
|
16
|
+
const code = typeof result.status === "number" ? result.status : 0
|
|
17
|
+
process.exit(code)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const envPath = process.env.OPENCODE_BIN_PATH
|
|
21
|
+
if (envPath) {
|
|
22
|
+
run(envPath)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
26
|
+
const scriptDir = path.dirname(scriptPath)
|
|
27
|
+
|
|
28
|
+
const platformMap = {
|
|
29
|
+
darwin: "darwin",
|
|
30
|
+
linux: "linux",
|
|
31
|
+
win32: "windows",
|
|
32
|
+
}
|
|
33
|
+
const archMap = {
|
|
34
|
+
x64: "x64",
|
|
35
|
+
arm64: "arm64",
|
|
36
|
+
arm: "arm",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let platform = platformMap[os.platform()]
|
|
40
|
+
if (!platform) {
|
|
41
|
+
platform = os.platform()
|
|
42
|
+
}
|
|
43
|
+
let arch = archMap[os.arch()]
|
|
44
|
+
if (!arch) {
|
|
45
|
+
arch = os.arch()
|
|
46
|
+
}
|
|
47
|
+
const base = "opencode-" + platform + "-" + arch
|
|
48
|
+
const binary = platform === "windows" ? "opencode.exe" : "opencode"
|
|
49
|
+
|
|
50
|
+
function findBinary(startDir) {
|
|
51
|
+
let current = startDir
|
|
52
|
+
for (;;) {
|
|
53
|
+
const modules = path.join(current, "node_modules")
|
|
54
|
+
if (fs.existsSync(modules)) {
|
|
55
|
+
const entries = fs.readdirSync(modules)
|
|
56
|
+
for (const entry of entries) {
|
|
57
|
+
if (!entry.startsWith(base)) {
|
|
58
|
+
continue
|
|
59
|
+
}
|
|
60
|
+
const candidate = path.join(modules, entry, "bin", binary)
|
|
61
|
+
if (fs.existsSync(candidate)) {
|
|
62
|
+
return candidate
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const parent = path.dirname(current)
|
|
67
|
+
if (parent === current) {
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
current = parent
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const resolved = findBinary(scriptDir)
|
|
75
|
+
if (!resolved) {
|
|
76
|
+
console.error(
|
|
77
|
+
'It seems that your package manager failed to install the right version of the opencode CLI for your platform. You can try manually installing the "' +
|
|
78
|
+
base +
|
|
79
|
+
'" package',
|
|
80
|
+
)
|
|
81
|
+
process.exit(1)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
run(resolved)
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nanocode",
|
|
3
|
+
"version": "1.0.197",
|
|
4
|
+
"description": "AI-powered coding agent using NanoGPT",
|
|
5
|
+
"author": "0xGingi",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/0xgingi/nanocode"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://nano-gpt.com",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"ai",
|
|
14
|
+
"coding",
|
|
15
|
+
"agent",
|
|
16
|
+
"nanogpt",
|
|
17
|
+
"nanocode",
|
|
18
|
+
"cli",
|
|
19
|
+
"llm"
|
|
20
|
+
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"nanocode": "./bin/nanocode"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin"
|
|
26
|
+
],
|
|
27
|
+
"optionalDependencies": {
|
|
28
|
+
"nanocode-linux-x64": "1.0.197",
|
|
29
|
+
"nanocode-linux-arm64": "1.0.197",
|
|
30
|
+
"nanocode-darwin-x64": "1.0.197",
|
|
31
|
+
"nanocode-darwin-arm64": "1.0.197",
|
|
32
|
+
"nanocode-windows-x64": "1.0.197"
|
|
33
|
+
}
|
|
34
|
+
}
|