claude-simple 0.2.5 → 0.2.6
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/edge-ctl.js
CHANGED
|
@@ -10,6 +10,7 @@ import { spawn, spawnSync } from 'child_process';
|
|
|
10
10
|
import fs from 'fs';
|
|
11
11
|
import os from 'os';
|
|
12
12
|
import path from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
13
14
|
|
|
14
15
|
const LAUNCHD_LABEL = 'system/com.claude-simple.edge';
|
|
15
16
|
const LAUNCHD_PLIST = '/Library/LaunchDaemons/com.claude-simple.edge.plist';
|
|
@@ -63,15 +64,31 @@ function detectBackend() {
|
|
|
63
64
|
return null;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
function isRoot() {
|
|
68
|
+
return typeof process.getuid === 'function' && process.getuid() === 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Re-exec this CLI via sudo so launchctl/systemctl can touch the system unit. */
|
|
72
|
+
function ensureRoot() {
|
|
73
|
+
if (isRoot()) return;
|
|
74
|
+
if (!hasCmd('sudo')) return;
|
|
75
|
+
const script = fileURLToPath(import.meta.url);
|
|
76
|
+
const args = process.argv.slice(2);
|
|
77
|
+
const candidates = ['/usr/local/bin/claude-edge', process.argv[1], script].filter(Boolean);
|
|
78
|
+
const seen = new Set();
|
|
79
|
+
for (const entry of candidates) {
|
|
80
|
+
const resolved = path.resolve(entry);
|
|
81
|
+
if (seen.has(resolved) || !fs.existsSync(resolved)) continue;
|
|
82
|
+
seen.add(resolved);
|
|
83
|
+
const r = spawnSync('sudo', ['-n', resolved, ...args], { stdio: 'inherit' });
|
|
84
|
+
if (r.status === 0) process.exit(0);
|
|
85
|
+
}
|
|
86
|
+
const r = spawnSync('sudo', [process.execPath, script, ...args], { stdio: 'inherit' });
|
|
87
|
+
process.exit(r.status ?? 1);
|
|
70
88
|
}
|
|
71
89
|
|
|
72
90
|
function runRoot(cmd, args, opts = {}) {
|
|
73
|
-
|
|
74
|
-
return run(t.cmd, t.args, opts);
|
|
91
|
+
return run(cmd, args, opts);
|
|
75
92
|
}
|
|
76
93
|
|
|
77
94
|
function fail(msg, extra) {
|
|
@@ -108,6 +125,7 @@ function tailFile(file, n) {
|
|
|
108
125
|
}
|
|
109
126
|
|
|
110
127
|
function cmdStatus(backend) {
|
|
128
|
+
ensureRoot();
|
|
111
129
|
if (backend === 'launchd') {
|
|
112
130
|
const r = runRoot('launchctl', ['print', LAUNCHD_LABEL]);
|
|
113
131
|
if (r.status !== 0) {
|
|
@@ -156,6 +174,7 @@ function cmdStatus(backend) {
|
|
|
156
174
|
}
|
|
157
175
|
|
|
158
176
|
function cmdStart(backend) {
|
|
177
|
+
ensureRoot();
|
|
159
178
|
if (backend === 'launchd') {
|
|
160
179
|
runRoot('launchctl', ['enable', LAUNCHD_LABEL]);
|
|
161
180
|
const loaded = runRoot('launchctl', ['print', LAUNCHD_LABEL]);
|
|
@@ -174,6 +193,7 @@ function cmdStart(backend) {
|
|
|
174
193
|
}
|
|
175
194
|
|
|
176
195
|
function cmdStop(backend) {
|
|
196
|
+
ensureRoot();
|
|
177
197
|
if (backend === 'launchd') {
|
|
178
198
|
runRoot('launchctl', ['disable', LAUNCHD_LABEL]);
|
|
179
199
|
runRoot('launchctl', ['bootout', LAUNCHD_LABEL]);
|
|
@@ -186,6 +206,7 @@ function cmdStop(backend) {
|
|
|
186
206
|
}
|
|
187
207
|
|
|
188
208
|
function cmdRestart(backend) {
|
|
209
|
+
ensureRoot();
|
|
189
210
|
if (backend === 'launchd') {
|
|
190
211
|
runRoot('launchctl', ['enable', LAUNCHD_LABEL]);
|
|
191
212
|
const loaded = runRoot('launchctl', ['print', LAUNCHD_LABEL]);
|
|
@@ -204,6 +225,7 @@ function cmdRestart(backend) {
|
|
|
204
225
|
}
|
|
205
226
|
|
|
206
227
|
function cmdLogs(backend, mode) {
|
|
228
|
+
if (backend === 'systemd') ensureRoot();
|
|
207
229
|
if (backend === 'launchd') {
|
|
208
230
|
if (mode === '-f' || mode === '--follow') {
|
|
209
231
|
const child = spawn('tail', ['-n', '50', '-F', MAC_OUT, MAC_ERR], { stdio: 'inherit' });
|
package/dist/index.html
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
|
6
6
|
<title>Claude Code</title>
|
|
7
|
-
<link rel="stylesheet" href="/style.0.2.
|
|
7
|
+
<link rel="stylesheet" href="/style.0.2.6.min.css">
|
|
8
8
|
<link rel="stylesheet" href="/highlight.min.css">
|
|
9
9
|
<script src="/marked.min.js"></script>
|
|
10
10
|
<script src="/highlight.min.js"></script>
|
|
11
11
|
</head>
|
|
12
12
|
<body class="h-dvh overflow-hidden flex flex-col bg-base-100 text-base-content">
|
|
13
13
|
<div id="root" class="flex flex-col flex-1 overflow-hidden"></div>
|
|
14
|
-
<script type="module" src="/app.0.2.
|
|
14
|
+
<script type="module" src="/app.0.2.6.min.js"></script>
|
|
15
15
|
</body>
|
|
16
16
|
</html>
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|