project-cypher 0.0.0-stage → 0.1.0
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/cypher.js +17 -0
- package/package.json +8 -4
- package/README.md +0 -3
package/bin/cypher.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// project-cypher CLI. Server: $CYPHER_SERVER (default http://140.238.248.30:3300)
|
|
3
|
+
const SERVER = (process.env.CYPHER_SERVER || 'http://140.238.248.30:3300').replace(/\/$/, '');
|
|
4
|
+
const get = async p => { const r = await fetch(SERVER + p); if (!r.ok) throw new Error(`${p} returned ${r.status}`); return r.json(); };
|
|
5
|
+
const cmds = {
|
|
6
|
+
async status() { const [h, l] = await Promise.all([get('/health'), get('/latest')]); console.log(`server ${SERVER}: ${h.ok ? 'online' : 'down'}\nlatest build: ${l.versionName} (code ${l.versionCode})`); },
|
|
7
|
+
async latest() { const l = await get('/latest'); console.log(`${l.versionName} (code ${l.versionCode})\n${l.apkUrl}${l.notes ? '\n' + l.notes : ''}`); },
|
|
8
|
+
async download() {
|
|
9
|
+
const l = await get('/latest'), fs = require('fs'), out = `cypher-v${l.versionCode}.apk`;
|
|
10
|
+
const r = await fetch(l.apkUrl); if (!r.ok) throw new Error('download failed ' + r.status);
|
|
11
|
+
fs.writeFileSync(out, Buffer.from(await r.arrayBuffer())); console.log('saved ' + out);
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const help = () => console.log('Project Cypher\n\nUsage: cypher <command>\n\n status check the server and latest build\n latest show the latest version and APK link\n download save the latest APK here\n\nSet CYPHER_SERVER to use another server.');
|
|
15
|
+
const c = process.argv[2];
|
|
16
|
+
if (!c || c === '-h' || c === '--help' || !cmds[c]) { help(); process.exit(c && !['-h', '--help'].includes(c) ? 1 : 0); }
|
|
17
|
+
cmds[c]().catch(e => { console.error('error: ' + e.message); process.exit(1); });
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "project-cypher",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Command line for Project Cypher, the Claude Code command center.",
|
|
5
|
+
"bin": { "cypher": "bin/cypher.js" },
|
|
6
|
+
"files": ["bin"],
|
|
7
|
+
"engines": { "node": ">=18" },
|
|
8
|
+
"keywords": ["claude", "claude-code", "cypher", "cli"],
|
|
9
|
+
"license": "MIT"
|
|
10
|
+
}
|
package/README.md
DELETED