@nexiq/cli 1.0.2 → 1.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/dist/cli.js +151 -31561
- package/dist/devtools-3T2XQNYQ.js +5 -0
- package/package.json +17 -3
- package/dist/devtools-Q4CVL4MR.js +0 -72
- package/src/cli.tsx +0 -107
- package/src/components/CacheApp.tsx +0 -187
- package/src/components/HelpApp.tsx +0 -90
- package/src/components/StartApp.tsx +0 -125
- package/src/components/StatusApp.tsx +0 -116
- package/src/components/StopApp.tsx +0 -90
- package/src/components/ui.tsx +0 -128
- package/src/server-process.ts +0 -392
- package/tsconfig.json +0 -16
- package/tsup.config.ts +0 -45
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import { Box, Text, useApp } from "ink";
|
|
3
|
-
import Spinner from "ink-spinner";
|
|
4
|
-
import {
|
|
5
|
-
getServerStatus,
|
|
6
|
-
resolveServerDist,
|
|
7
|
-
BACKEND_PORT,
|
|
8
|
-
formatDuration,
|
|
9
|
-
type ServerStatus,
|
|
10
|
-
} from "../server-process.js";
|
|
11
|
-
import {
|
|
12
|
-
COLORS,
|
|
13
|
-
NexiqBanner,
|
|
14
|
-
KvRow,
|
|
15
|
-
StatusDot,
|
|
16
|
-
Divider,
|
|
17
|
-
SectionTitle,
|
|
18
|
-
} from "./ui.js";
|
|
19
|
-
|
|
20
|
-
interface StatusAppProps {
|
|
21
|
-
port?: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function StatusApp({ port = BACKEND_PORT }: StatusAppProps) {
|
|
25
|
-
const { exit } = useApp();
|
|
26
|
-
|
|
27
|
-
const [status, setStatus] = useState<ServerStatus | null>(null);
|
|
28
|
-
const [loading, setLoading] = useState(true);
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
let cancelled = false;
|
|
32
|
-
|
|
33
|
-
getServerStatus(port).then((s) => {
|
|
34
|
-
if (!cancelled) {
|
|
35
|
-
setStatus(s);
|
|
36
|
-
setLoading(false);
|
|
37
|
-
setTimeout(() => exit(), 800);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return () => {
|
|
42
|
-
cancelled = true;
|
|
43
|
-
};
|
|
44
|
-
}, []);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<Box flexDirection="column" padding={1}>
|
|
48
|
-
<NexiqBanner />
|
|
49
|
-
<SectionTitle title="Server Status" />
|
|
50
|
-
|
|
51
|
-
{loading && (
|
|
52
|
-
<Box gap={1}>
|
|
53
|
-
<Text color={COLORS.cyan}>
|
|
54
|
-
<Spinner type="dots" />
|
|
55
|
-
</Text>
|
|
56
|
-
<Text> Checking…</Text>
|
|
57
|
-
</Box>
|
|
58
|
-
)}
|
|
59
|
-
|
|
60
|
-
{!loading && status && (
|
|
61
|
-
<Box flexDirection="column" marginTop={1}>
|
|
62
|
-
{/* Running indicator */}
|
|
63
|
-
<Box gap={1} marginBottom={1}>
|
|
64
|
-
<StatusDot running={status.running} />
|
|
65
|
-
<Text color={status.running ? COLORS.green : COLORS.red} bold>
|
|
66
|
-
{status.running ? "Running" : "Stopped"}
|
|
67
|
-
</Text>
|
|
68
|
-
</Box>
|
|
69
|
-
|
|
70
|
-
<Divider />
|
|
71
|
-
|
|
72
|
-
{status.running && (
|
|
73
|
-
<>
|
|
74
|
-
{status.port !== undefined && (
|
|
75
|
-
<KvRow
|
|
76
|
-
label="Port"
|
|
77
|
-
value={String(status.port)}
|
|
78
|
-
valueColor={COLORS.cyan}
|
|
79
|
-
/>
|
|
80
|
-
)}
|
|
81
|
-
{status.pid !== undefined && (
|
|
82
|
-
<KvRow label="PID" value={String(status.pid)} />
|
|
83
|
-
)}
|
|
84
|
-
{status.uptimeMs !== undefined && (
|
|
85
|
-
<KvRow
|
|
86
|
-
label="Uptime"
|
|
87
|
-
value={formatDuration(status.uptimeMs)}
|
|
88
|
-
valueColor={COLORS.green}
|
|
89
|
-
/>
|
|
90
|
-
)}
|
|
91
|
-
</>
|
|
92
|
-
)}
|
|
93
|
-
|
|
94
|
-
<KvRow
|
|
95
|
-
label="Server dist"
|
|
96
|
-
value={status.serverDist ?? "(not found)"}
|
|
97
|
-
valueColor={status.serverDist ? COLORS.muted : COLORS.red}
|
|
98
|
-
/>
|
|
99
|
-
<KvRow label="Log file" value={status.logFile} valueColor={COLORS.muted} />
|
|
100
|
-
|
|
101
|
-
{!status.running && (
|
|
102
|
-
<Box marginTop={1}>
|
|
103
|
-
<Text color={COLORS.muted}>
|
|
104
|
-
Run{" "}
|
|
105
|
-
<Text color={COLORS.accent} bold>
|
|
106
|
-
nexiq start
|
|
107
|
-
</Text>{" "}
|
|
108
|
-
to launch the server.
|
|
109
|
-
</Text>
|
|
110
|
-
</Box>
|
|
111
|
-
)}
|
|
112
|
-
</Box>
|
|
113
|
-
)}
|
|
114
|
-
</Box>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import { Box, Text, useApp } from "ink";
|
|
3
|
-
import Spinner from "ink-spinner";
|
|
4
|
-
import { stopServer, BACKEND_PORT } from "../server-process.js";
|
|
5
|
-
import { COLORS, NexiqBanner, StatusDot } from "./ui.js";
|
|
6
|
-
|
|
7
|
-
interface StopAppProps {
|
|
8
|
-
port?: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type Phase = "stopping" | "done" | "error";
|
|
12
|
-
|
|
13
|
-
export function StopApp({ port = BACKEND_PORT }: StopAppProps) {
|
|
14
|
-
const { exit } = useApp();
|
|
15
|
-
|
|
16
|
-
const [phase, setPhase] = useState<Phase>("stopping");
|
|
17
|
-
const [message, setMessage] = useState("");
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
let cancelled = false;
|
|
21
|
-
|
|
22
|
-
async function run() {
|
|
23
|
-
const result = await stopServer();
|
|
24
|
-
if (cancelled) return;
|
|
25
|
-
|
|
26
|
-
if (result.ok) {
|
|
27
|
-
setPhase("done");
|
|
28
|
-
} else {
|
|
29
|
-
setPhase("error");
|
|
30
|
-
}
|
|
31
|
-
setMessage(result.message);
|
|
32
|
-
setTimeout(() => exit(), 800);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
run().catch((e) => {
|
|
36
|
-
if (!cancelled) {
|
|
37
|
-
setPhase("error");
|
|
38
|
-
setMessage(e instanceof Error ? e.message : String(e));
|
|
39
|
-
setTimeout(() => exit(), 1000);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return () => {
|
|
44
|
-
cancelled = true;
|
|
45
|
-
};
|
|
46
|
-
}, []);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<Box flexDirection="column" padding={1}>
|
|
50
|
-
<NexiqBanner />
|
|
51
|
-
|
|
52
|
-
{phase === "stopping" && (
|
|
53
|
-
<Box>
|
|
54
|
-
<Text color={COLORS.cyan}>
|
|
55
|
-
<Spinner type="dots" />
|
|
56
|
-
</Text>
|
|
57
|
-
<Text> Stopping server…</Text>
|
|
58
|
-
</Box>
|
|
59
|
-
)}
|
|
60
|
-
|
|
61
|
-
{phase === "done" && (
|
|
62
|
-
<Box flexDirection="column">
|
|
63
|
-
<Box gap={1}>
|
|
64
|
-
<StatusDot running={false} />
|
|
65
|
-
<Text color={COLORS.green} bold>
|
|
66
|
-
Stopped
|
|
67
|
-
</Text>
|
|
68
|
-
</Box>
|
|
69
|
-
<Box marginTop={1}>
|
|
70
|
-
<Text color={COLORS.muted}>{message}</Text>
|
|
71
|
-
</Box>
|
|
72
|
-
</Box>
|
|
73
|
-
)}
|
|
74
|
-
|
|
75
|
-
{phase === "error" && (
|
|
76
|
-
<Box flexDirection="column">
|
|
77
|
-
<Box gap={1}>
|
|
78
|
-
<StatusDot running={false} />
|
|
79
|
-
<Text color={COLORS.red} bold>
|
|
80
|
-
Error
|
|
81
|
-
</Text>
|
|
82
|
-
</Box>
|
|
83
|
-
<Box marginTop={1}>
|
|
84
|
-
<Text color={COLORS.red}>{message}</Text>
|
|
85
|
-
</Box>
|
|
86
|
-
</Box>
|
|
87
|
-
)}
|
|
88
|
-
</Box>
|
|
89
|
-
);
|
|
90
|
-
}
|
package/src/components/ui.tsx
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Ink UI primitives — colours, badges, borders.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { Box, Text } from "ink";
|
|
7
|
-
|
|
8
|
-
// ---------------------------------------------------------------------------
|
|
9
|
-
// Colour palette
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
|
-
export const COLORS = {
|
|
12
|
-
green: "#22c55e",
|
|
13
|
-
red: "#ef4444",
|
|
14
|
-
yellow: "#eab308",
|
|
15
|
-
blue: "#3b82f6",
|
|
16
|
-
cyan: "#06b6d4",
|
|
17
|
-
muted: "#6b7280",
|
|
18
|
-
white: "#f9fafb",
|
|
19
|
-
accent: "#a855f7",
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
// Badge
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
|
|
26
|
-
interface BadgeProps {
|
|
27
|
-
label: string;
|
|
28
|
-
color: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function Badge({ label, color }: BadgeProps) {
|
|
32
|
-
return (
|
|
33
|
-
<Box>
|
|
34
|
-
<Text color={color} bold>
|
|
35
|
-
{" "}
|
|
36
|
-
{label}{" "}
|
|
37
|
-
</Text>
|
|
38
|
-
</Box>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// ---------------------------------------------------------------------------
|
|
43
|
-
// Status dot
|
|
44
|
-
// ---------------------------------------------------------------------------
|
|
45
|
-
|
|
46
|
-
interface StatusDotProps {
|
|
47
|
-
running: boolean;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function StatusDot({ running }: StatusDotProps) {
|
|
51
|
-
return (
|
|
52
|
-
<Text color={running ? COLORS.green : COLORS.red} bold>
|
|
53
|
-
{running ? "●" : "○"}
|
|
54
|
-
</Text>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// ---------------------------------------------------------------------------
|
|
59
|
-
// Section title
|
|
60
|
-
// ---------------------------------------------------------------------------
|
|
61
|
-
|
|
62
|
-
interface SectionTitleProps {
|
|
63
|
-
title: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function SectionTitle({ title }: SectionTitleProps) {
|
|
67
|
-
return (
|
|
68
|
-
<Box marginTop={1} marginBottom={0}>
|
|
69
|
-
<Text color={COLORS.cyan} bold>
|
|
70
|
-
── {title} ──
|
|
71
|
-
</Text>
|
|
72
|
-
</Box>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// ---------------------------------------------------------------------------
|
|
77
|
-
// Key-value row
|
|
78
|
-
// ---------------------------------------------------------------------------
|
|
79
|
-
|
|
80
|
-
interface KvRowProps {
|
|
81
|
-
label: string;
|
|
82
|
-
value: string;
|
|
83
|
-
labelWidth?: number;
|
|
84
|
-
valueColor?: string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function KvRow({ label, value, labelWidth = 14, valueColor = COLORS.white }: KvRowProps) {
|
|
88
|
-
return (
|
|
89
|
-
<Box>
|
|
90
|
-
<Box width={labelWidth}>
|
|
91
|
-
<Text color={COLORS.muted}>{label}</Text>
|
|
92
|
-
</Box>
|
|
93
|
-
<Text color={valueColor}>{value}</Text>
|
|
94
|
-
</Box>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// ---------------------------------------------------------------------------
|
|
99
|
-
// Header banner
|
|
100
|
-
// ---------------------------------------------------------------------------
|
|
101
|
-
|
|
102
|
-
export function NexiqBanner() {
|
|
103
|
-
return (
|
|
104
|
-
<Box flexDirection="column" marginBottom={1}>
|
|
105
|
-
<Text color={COLORS.accent} bold>
|
|
106
|
-
╔══════════════════════════╗
|
|
107
|
-
</Text>
|
|
108
|
-
<Text color={COLORS.accent} bold>
|
|
109
|
-
║ nexiq server CLI ║
|
|
110
|
-
</Text>
|
|
111
|
-
<Text color={COLORS.accent} bold>
|
|
112
|
-
╚══════════════════════════╝
|
|
113
|
-
</Text>
|
|
114
|
-
</Box>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// ---------------------------------------------------------------------------
|
|
119
|
-
// Divider
|
|
120
|
-
// ---------------------------------------------------------------------------
|
|
121
|
-
|
|
122
|
-
export function Divider() {
|
|
123
|
-
return (
|
|
124
|
-
<Box marginY={0}>
|
|
125
|
-
<Text color={COLORS.muted}>{"─".repeat(36)}</Text>
|
|
126
|
-
</Box>
|
|
127
|
-
);
|
|
128
|
-
}
|