codo-ai 2.23.5 → 2.23.7

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/codo.exe CHANGED
File without changes
Binary file
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
- {
2
- "os": [
3
- "darwin",
4
- "linux",
5
- "win32"
6
- ],
7
- "name": "codo-ai",
8
- "scripts": {
9
- "postinstall": "node ./postinstall.mjs"
10
- },
11
- "cpu": [
12
- "arm64",
13
- "x64"
14
- ],
15
- "bin": {
16
- "codo": "./bin/codo.exe"
17
- },
18
- "license": "MIT",
19
- "version": "2.23.5",
20
- "optionalDependencies": {
21
- "@codo-ai/codo-linux-x64": "2.23.5",
22
- "@codo-ai/codo-darwin-x64-baseline": "2.23.5",
23
- "@codo-ai/codo-darwin-x64": "2.23.5",
24
- "@codo-ai/codo-linux-x64-baseline": "2.23.5",
25
- "@codo-ai/codo-linux-arm64-musl": "2.23.5",
26
- "@codo-ai/codo-linux-x64-baseline-musl": "2.23.5",
27
- "@codo-ai/codo-windows-x64": "2.23.5",
28
- "@codo-ai/codo-linux-x64-musl": "2.23.5",
29
- "@codo-ai/codo-windows-x64-baseline": "2.23.5",
30
- "@codo-ai/codo-windows-arm64": "2.23.5",
31
- "@codo-ai/codo-darwin-arm64": "2.23.5",
32
- "@codo-ai/codo-linux-arm64": "2.23.5"
33
- }
34
- }
1
+ {
2
+ "os": [
3
+ "darwin",
4
+ "linux",
5
+ "win32"
6
+ ],
7
+ "name": "codo-ai",
8
+ "scripts": {
9
+ "postinstall": "node ./postinstall.mjs"
10
+ },
11
+ "cpu": [
12
+ "arm64",
13
+ "x64"
14
+ ],
15
+ "bin": {
16
+ "codo": "./bin/codo.exe"
17
+ },
18
+ "license": "MIT",
19
+ "version": "2.23.7",
20
+ "optionalDependencies": {
21
+ "@codo-ai/codo-linux-x64": "2.23.5",
22
+ "@codo-ai/codo-darwin-x64-baseline": "2.23.5",
23
+ "@codo-ai/codo-darwin-x64": "2.23.5",
24
+ "@codo-ai/codo-linux-x64-baseline": "2.23.5",
25
+ "@codo-ai/codo-linux-arm64-musl": "2.23.5",
26
+ "@codo-ai/codo-linux-x64-baseline-musl": "2.23.5",
27
+ "@codo-ai/codo-windows-x64": "2.23.5",
28
+ "@codo-ai/codo-linux-x64-musl": "2.23.5",
29
+ "@codo-ai/codo-windows-x64-baseline": "2.23.5",
30
+ "@codo-ai/codo-windows-arm64": "2.23.5",
31
+ "@codo-ai/codo-darwin-arm64": "2.23.5",
32
+ "@codo-ai/codo-linux-arm64": "2.23.5"
33
+ }
34
+ }
package/postinstall.mjs CHANGED
@@ -116,27 +116,43 @@ function packageNames() {
116
116
  return [base]
117
117
  }
118
118
 
119
+ // Published packages may name the binary exactly ("codo.exe" / "codo") or with
120
+ // a version suffix ("codo-2.23.5.exe"), so resolve by pattern rather than by
121
+ // a single hardcoded filename.
122
+ function findBinary(dir) {
123
+ const entries = fs.readdirSync(path.join(dir, "bin"))
124
+ const match =
125
+ entries.find((entry) => entry === sourceBinary) ??
126
+ (platform === "windows"
127
+ ? entries.find((entry) => entry.startsWith("codo") && entry.endsWith(".exe"))
128
+ : undefined) ??
129
+ entries.find((entry) => entry.startsWith("codo"))
130
+ if (!match) throw new Error(`Binary not found in ${path.join(dir, "bin")}`)
131
+ return path.join(dir, "bin", match)
132
+ }
133
+
134
+ // Platform binaries live in scoped packages (@codo-ai/codo-<platform>-<arch>),
135
+ // while packageNames() works with the unscoped suffix.
136
+ const scope = "@codo-ai/"
137
+
119
138
  function resolveBinary(name) {
120
- const packageJsonPath = require.resolve(`${name}/package.json`)
121
- const binaryPath = path.join(path.dirname(packageJsonPath), "bin", sourceBinary)
122
- if (!fs.existsSync(binaryPath)) throw new Error(`Binary not found at ${binaryPath}`)
123
- return binaryPath
139
+ return findBinary(path.dirname(require.resolve(`${scope}${name}/package.json`)))
124
140
  }
125
141
 
126
142
  function installPackage(name) {
127
- const version = packageJson.optionalDependencies?.[name]
143
+ const version = packageJson.optionalDependencies?.[`${scope}${name}`]
128
144
  if (!version) return
129
145
 
130
146
  const temp = fs.mkdtempSync(path.join(os.tmpdir(), "codo-install-"))
131
147
  try {
132
148
  const result = childProcess.spawnSync(
133
149
  "npm",
134
- ["install", "--ignore-scripts", "--no-save", "--loglevel=error", "--prefix", temp, `${name}@${version}`],
150
+ ["install", "--ignore-scripts", "--no-save", "--loglevel=error", "--prefix", temp, `${scope}${name}@${version}`],
135
151
  { stdio: "inherit", windowsHide: true },
136
152
  )
137
153
  if (result.status !== 0) return
138
- const packageDir = path.join(temp, "node_modules", name)
139
- copyBinary(path.join(packageDir, "bin", sourceBinary), targetBinary)
154
+ const packageDir = path.join(temp, "node_modules", scope, name)
155
+ copyBinary(findBinary(packageDir), targetBinary)
140
156
  return true
141
157
  } finally {
142
158
  fs.rmSync(temp, { recursive: true, force: true })
@@ -176,7 +192,7 @@ function main() {
176
192
 
177
193
  throw new Error(
178
194
  `It seems your package manager failed to install the right codo CLI package. Try manually installing ${packageNames()
179
- .map((name) => JSON.stringify(name))
195
+ .map((name) => JSON.stringify(`@codo-ai/${name}`))
180
196
  .join(" or ")}.`,
181
197
  )
182
198
  }