@fosenai/cord 0.1.0-alpha.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/bin/cord.js +34 -0
- package/package.json +42 -0
- package/scripts/install.js +34 -0
package/bin/cord.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Cord CLI shim — resolves the platform-specific native binary and execs it.
|
|
3
|
+
const { spawnSync } = require('node:child_process')
|
|
4
|
+
const path = require('node:path')
|
|
5
|
+
|
|
6
|
+
const map = {
|
|
7
|
+
'darwin-arm64': '@fosenai/cord-darwin-arm64',
|
|
8
|
+
'darwin-x64': '@fosenai/cord-darwin-x64',
|
|
9
|
+
'linux-x64': '@fosenai/cord-linux-x64',
|
|
10
|
+
'linux-arm64': '@fosenai/cord-linux-arm64',
|
|
11
|
+
'win32-x64': '@fosenai/cord-windows-x64',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const key = `${process.platform}-${process.arch}`
|
|
15
|
+
const pkg = map[key]
|
|
16
|
+
if (!pkg) {
|
|
17
|
+
console.error(`cord: no prebuilt binary for ${key}`)
|
|
18
|
+
console.error(`cord: supported platforms: ${Object.keys(map).join(', ')}`)
|
|
19
|
+
process.exit(1)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let binPath
|
|
23
|
+
try {
|
|
24
|
+
const root = path.dirname(require.resolve(`${pkg}/package.json`))
|
|
25
|
+
const ext = process.platform === 'win32' ? '.exe' : ''
|
|
26
|
+
binPath = path.join(root, `cord${ext}`)
|
|
27
|
+
} catch {
|
|
28
|
+
console.error(`cord: platform package ${pkg} not installed`)
|
|
29
|
+
console.error(`cord: try: npm install ${pkg}`)
|
|
30
|
+
process.exit(1)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const result = spawnSync(binPath, process.argv.slice(2), { stdio: 'inherit' })
|
|
34
|
+
process.exit(result.status ?? 1)
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fosenai/cord",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "Cord \u2014 a P2P agent network. Wraps any LLM CLI / HTTP backend / MCP server into a P2P capability.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"bin": {
|
|
7
|
+
"cord": "bin/cord.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"scripts/",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"postinstall": "node scripts/install.js"
|
|
16
|
+
},
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@fosenai/cord-darwin-arm64": "0.1.0-alpha.1",
|
|
19
|
+
"@fosenai/cord-darwin-x64": "0.1.0-alpha.1",
|
|
20
|
+
"@fosenai/cord-linux-x64": "0.1.0-alpha.1",
|
|
21
|
+
"@fosenai/cord-linux-arm64": "0.1.0-alpha.1",
|
|
22
|
+
"@fosenai/cord-windows-x64": "0.1.0-alpha.1"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/fosenai/cord.git"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/fosenai/cord",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/fosenai/cord/issues"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"p2p",
|
|
37
|
+
"agent",
|
|
38
|
+
"libp2p",
|
|
39
|
+
"decentralized",
|
|
40
|
+
"rust"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// postinstall: verify the platform binary made it through optionalDependencies.
|
|
3
|
+
const { existsSync } = require('node:fs')
|
|
4
|
+
const path = require('node:path')
|
|
5
|
+
|
|
6
|
+
const map = {
|
|
7
|
+
'darwin-arm64': '@fosenai/cord-darwin-arm64',
|
|
8
|
+
'darwin-x64': '@fosenai/cord-darwin-x64',
|
|
9
|
+
'linux-x64': '@fosenai/cord-linux-x64',
|
|
10
|
+
'linux-arm64': '@fosenai/cord-linux-arm64',
|
|
11
|
+
'win32-x64': '@fosenai/cord-windows-x64',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const key = `${process.platform}-${process.arch}`
|
|
15
|
+
const pkg = map[key]
|
|
16
|
+
if (!pkg) {
|
|
17
|
+
console.warn(`[cord] no prebuilt binary for ${key}; please file an issue at`)
|
|
18
|
+
console.warn(`[cord] https://github.com/fosenai/cord/issues`)
|
|
19
|
+
process.exit(0)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const root = path.dirname(require.resolve(`${pkg}/package.json`))
|
|
24
|
+
const ext = process.platform === 'win32' ? '.exe' : ''
|
|
25
|
+
const bin = path.join(root, `cord${ext}`)
|
|
26
|
+
if (existsSync(bin)) {
|
|
27
|
+
console.log(`[cord] ok: ${pkg}`)
|
|
28
|
+
} else {
|
|
29
|
+
console.warn(`[cord] ${pkg} installed but binary missing at ${bin}`)
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
console.warn(`[cord] platform package ${pkg} not installed (optional deps may be filtered)`)
|
|
33
|
+
console.warn(`[cord] try: npm install ${pkg}`)
|
|
34
|
+
}
|