codyx-ai 1.14.42

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 ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mufasa (M. Farid)
4
+
5
+ Portions of this repository are based on the upstream cody project and retain their original MIT-licensed notices where present.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
@@ -0,0 +1,76 @@
1
+ const childProcess = require("child_process")
2
+ const fs = require("fs")
3
+ const path = require("path")
4
+ const os = require("os")
5
+ const { binaryName, packageNames } = require("./_platform.cjs")
6
+
7
+ const forwardedSignals = ["SIGINT", "SIGTERM", "SIGHUP"]
8
+
9
+ function run(target) {
10
+ const child = childProcess.spawn(target, process.argv.slice(2), {
11
+ stdio: "inherit",
12
+ })
13
+
14
+ child.on("error", (error) => {
15
+ console.error(error.message)
16
+ process.exit(1)
17
+ })
18
+
19
+ const forwarders = {}
20
+ for (const signal of forwardedSignals) {
21
+ forwarders[signal] = () => {
22
+ try {
23
+ child.kill(signal)
24
+ } catch {
25
+ // The child may have already exited.
26
+ }
27
+ }
28
+ process.on(signal, forwarders[signal])
29
+ }
30
+
31
+ child.on("exit", (code, signal) => {
32
+ for (const forwardedSignal of forwardedSignals) {
33
+ process.removeListener(forwardedSignal, forwarders[forwardedSignal])
34
+ }
35
+
36
+ if (signal) {
37
+ process.kill(process.pid, signal)
38
+ return
39
+ }
40
+
41
+ process.exit(typeof code === "number" ? code : 0)
42
+ })
43
+ }
44
+
45
+ module.exports = function (name) {
46
+ const envPath = process.env.CODY_BIN_PATH
47
+ const scriptPath = fs.realpathSync(process.argv[1])
48
+ const scriptDir = path.dirname(scriptPath)
49
+ const cached = path.join(scriptDir, os.platform() === "win32" ? ".cody.exe" : ".cody")
50
+
51
+ const binary = binaryName()
52
+ const names = packageNames()
53
+
54
+ function findBinary(startDir) {
55
+ let current = startDir
56
+ for (;;) {
57
+ const modules = path.join(current, "node_modules")
58
+ if (fs.existsSync(modules)) {
59
+ for (const name of names) {
60
+ const candidate = path.join(modules, name, "bin", binary)
61
+ if (fs.existsSync(candidate)) return candidate
62
+ }
63
+ }
64
+ const parent = path.dirname(current)
65
+ if (parent === current) return
66
+ current = parent
67
+ }
68
+ }
69
+
70
+ const resolved = envPath || (fs.existsSync(cached) ? cached : findBinary(scriptDir))
71
+ if (!resolved) {
72
+ console.error(`It seems that your package manager failed to install the right version of the ${name} CLI for your platform. You can try manually installing ` + names.map((n) => `\"${n}\"`).join(" or ") + " package")
73
+ process.exit(1)
74
+ }
75
+ run(resolved)
76
+ }
@@ -0,0 +1,106 @@
1
+ const childProcess = require("child_process")
2
+ const fs = require("fs")
3
+ const os = require("os")
4
+
5
+ function platformName() {
6
+ return {
7
+ darwin: "darwin",
8
+ linux: "linux",
9
+ win32: "windows",
10
+ }[os.platform()] || os.platform()
11
+ }
12
+
13
+ function archName() {
14
+ return {
15
+ x64: "x64",
16
+ arm64: "arm64",
17
+ arm: "arm",
18
+ }[os.arch()] || os.arch()
19
+ }
20
+
21
+ function supportsAvx2(platform, arch) {
22
+ if (arch !== "x64") return false
23
+ if (platform === "linux") {
24
+ try {
25
+ return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
26
+ } catch {
27
+ return false
28
+ }
29
+ }
30
+ if (platform === "darwin") {
31
+ try {
32
+ const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
33
+ encoding: "utf8",
34
+ timeout: 1500,
35
+ })
36
+ return result.status === 0 && (result.stdout || "").trim() === "1"
37
+ } catch {
38
+ return false
39
+ }
40
+ }
41
+ if (platform === "windows") {
42
+ const cmd =
43
+ '(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
44
+ for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
45
+ try {
46
+ const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
47
+ encoding: "utf8",
48
+ timeout: 3000,
49
+ windowsHide: true,
50
+ })
51
+ if (result.status !== 0) continue
52
+ const out = (result.stdout || "").trim().toLowerCase()
53
+ if (out === "true" || out === "1") return true
54
+ } catch {
55
+ continue
56
+ }
57
+ }
58
+ }
59
+ return false
60
+ }
61
+
62
+ function usesMusl() {
63
+ try {
64
+ if (fs.existsSync("/etc/alpine-release")) return true
65
+ } catch {}
66
+ try {
67
+ const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
68
+ return ((result.stdout || "") + (result.stderr || "")).toLowerCase().includes("musl")
69
+ } catch {
70
+ return false
71
+ }
72
+ }
73
+
74
+ function packageNames() {
75
+ const platform = platformName()
76
+ const arch = archName()
77
+ const base = `codyx-ai-${platform}-${arch}`
78
+ const baseline = arch === "x64" && !supportsAvx2(platform, arch)
79
+
80
+ if (platform === "linux") {
81
+ if (usesMusl()) {
82
+ if (arch === "x64") {
83
+ if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
84
+ return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
85
+ }
86
+ return [`${base}-musl`, base]
87
+ }
88
+ if (arch === "x64") {
89
+ if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
90
+ return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
91
+ }
92
+ return [base, `${base}-musl`]
93
+ }
94
+
95
+ if (arch === "x64") {
96
+ if (baseline) return [`${base}-baseline`, base]
97
+ return [base, `${base}-baseline`]
98
+ }
99
+ return [base]
100
+ }
101
+
102
+ function binaryName() {
103
+ return platformName() === "windows" ? "codyx.exe" : "codyx"
104
+ }
105
+
106
+ module.exports = { binaryName, packageNames, platformName }
package/bin/cody ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require("./_launcher.js")("cody")
package/bin/codyx ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require("./_launcher.js")("codyx")
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "codyx-ai",
3
+ "description": "Codyx local-first coding agent CLI",
4
+ "bin": {
5
+ "codyx": "./bin/codyx",
6
+ "cody": "./bin/cody"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
10
+ },
11
+ "version": "1.14.42",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/mufasa1611/cody-orchestra.git"
16
+ },
17
+ "homepage": "https://github.com/mufasa1611/cody-orchestra",
18
+ "bugs": "https://github.com/mufasa1611/cody-orchestra/issues",
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "files": [
23
+ "bin/",
24
+ "postinstall.mjs",
25
+ "LICENSE"
26
+ ],
27
+ "optionalDependencies": {
28
+ "codyx-ai-linux-x64-baseline": "1.14.42",
29
+ "codyx-ai-windows-arm64": "1.14.42",
30
+ "codyx-ai-linux-arm64": "1.14.42",
31
+ "codyx-ai-linux-arm64-musl": "1.14.42",
32
+ "codyx-ai-linux-x64": "1.14.42",
33
+ "codyx-ai-windows-x64": "1.14.42",
34
+ "codyx-ai-linux-x64-baseline-musl": "1.14.42",
35
+ "codyx-ai-windows-x64-baseline": "1.14.42",
36
+ "codyx-ai-darwin-x64": "1.14.42",
37
+ "codyx-ai-darwin-arm64": "1.14.42",
38
+ "codyx-ai-darwin-x64-baseline": "1.14.42",
39
+ "codyx-ai-linux-x64-musl": "1.14.42"
40
+ }
41
+ }
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "fs"
4
+ import path from "path"
5
+ import os from "os"
6
+ import { fileURLToPath } from "url"
7
+ import { createRequire } from "module"
8
+
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
10
+ const require = createRequire(import.meta.url)
11
+ const { binaryName, packageNames } = require("./bin/_platform.cjs")
12
+
13
+ function findBinary() {
14
+ const binary = binaryName()
15
+ const errors = []
16
+ for (const packageName of packageNames()) {
17
+ try {
18
+ const packageJsonPath = require.resolve(`${packageName}/package.json`)
19
+ const binaryPath = path.join(path.dirname(packageJsonPath), "bin", binary)
20
+ if (fs.existsSync(binaryPath)) return binaryPath
21
+ errors.push(`Binary not found at ${binaryPath}`)
22
+ } catch (error) {
23
+ errors.push(`${packageName}: ${error.message}`)
24
+ }
25
+ }
26
+ throw new Error(errors.join("; "))
27
+ }
28
+
29
+ async function main() {
30
+ try {
31
+ const binaryPath = findBinary()
32
+ const target = path.join(__dirname, "bin", os.platform() === "win32" ? ".cody.exe" : ".cody")
33
+ if (fs.existsSync(target)) fs.unlinkSync(target)
34
+ try {
35
+ fs.linkSync(binaryPath, target)
36
+ } catch {
37
+ fs.copyFileSync(binaryPath, target)
38
+ }
39
+ if (os.platform() !== "win32") fs.chmodSync(target, 0o755)
40
+ } catch (error) {
41
+ console.error("Failed to setup codyx binary:", error.message)
42
+ process.exit(1)
43
+ }
44
+ }
45
+
46
+ main().catch((error) => {
47
+ console.error("Postinstall script error:", error)
48
+ process.exit(1)
49
+ })