fixmind 1.0.4 → 1.0.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/README.md +1 -2
- package/dist/dashboard/assets/index-DZSvzKoZ.js +16 -0
- package/dist/dashboard/assets/{index-WDmgeIrO.css → index-HSKQ7GzA.css} +63 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/src/cli-sync.d.ts +4 -0
- package/dist/src/cli-sync.js +199 -0
- package/dist/src/cli-sync.js.map +1 -0
- package/dist/src/cli-utils.d.ts +34 -0
- package/dist/src/cli-utils.js +119 -0
- package/dist/src/cli-utils.js.map +1 -0
- package/dist/src/cli.js +22 -229
- package/dist/src/cli.js.map +1 -1
- package/dist/src/dashboard.js +16 -0
- package/dist/src/dashboard.js.map +1 -1
- package/dist/src/sync-backend.d.ts +44 -0
- package/dist/src/sync-backend.js +279 -0
- package/dist/src/sync-backend.js.map +1 -0
- package/dist/src/sync.d.ts +2 -44
- package/dist/src/sync.js +36 -289
- package/dist/src/sync.js.map +1 -1
- package/package.json +1 -1
- package/dist/dashboard/assets/index-Bl0HIoQR.js +0 -14
|
@@ -78,12 +78,14 @@
|
|
|
78
78
|
--radius-2xl: 1rem;
|
|
79
79
|
--radius-3xl: 1.5rem;
|
|
80
80
|
--ease-out: cubic-bezier(0, 0, .2, 1);
|
|
81
|
+
--animate-spin: spin 1s linear infinite;
|
|
81
82
|
--default-transition-duration: .15s;
|
|
82
83
|
--default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);
|
|
83
84
|
--default-font-family: var(--font-sans);
|
|
84
85
|
--default-mono-font-family: var(--font-mono);
|
|
85
86
|
--color-page: #08090d;
|
|
86
87
|
--color-surface: #11141b;
|
|
88
|
+
--color-surface-2: #161a23;
|
|
87
89
|
--color-line: #232838;
|
|
88
90
|
--color-ink: #e9ecf4;
|
|
89
91
|
--color-muted: #828a9c;
|
|
@@ -757,6 +759,10 @@
|
|
|
757
759
|
rotate: 180deg;
|
|
758
760
|
}
|
|
759
761
|
|
|
762
|
+
.animate-spin {
|
|
763
|
+
animation: var(--animate-spin);
|
|
764
|
+
}
|
|
765
|
+
|
|
760
766
|
.cursor-pointer {
|
|
761
767
|
cursor: pointer;
|
|
762
768
|
}
|
|
@@ -845,6 +851,12 @@
|
|
|
845
851
|
gap: calc(var(--spacing) * 10);
|
|
846
852
|
}
|
|
847
853
|
|
|
854
|
+
:where(.space-y-1 > :not(:last-child)) {
|
|
855
|
+
--tw-space-y-reverse: 0;
|
|
856
|
+
margin-block-start: calc(var(--spacing) * var(--tw-space-y-reverse));
|
|
857
|
+
margin-block-end: calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)));
|
|
858
|
+
}
|
|
859
|
+
|
|
848
860
|
:where(.space-y-2 > :not(:last-child)) {
|
|
849
861
|
--tw-space-y-reverse: 0;
|
|
850
862
|
margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));
|
|
@@ -1032,6 +1044,10 @@
|
|
|
1032
1044
|
background-color: var(--color-surface);
|
|
1033
1045
|
}
|
|
1034
1046
|
|
|
1047
|
+
.bg-surface-2 {
|
|
1048
|
+
background-color: var(--color-surface-2);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1035
1051
|
.bg-transparent {
|
|
1036
1052
|
background-color: #0000;
|
|
1037
1053
|
}
|
|
@@ -1090,6 +1106,10 @@
|
|
|
1090
1106
|
padding-block: calc(var(--spacing) * .5);
|
|
1091
1107
|
}
|
|
1092
1108
|
|
|
1109
|
+
.py-1\.5 {
|
|
1110
|
+
padding-block: calc(var(--spacing) * 1.5);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1093
1113
|
.py-2 {
|
|
1094
1114
|
padding-block: calc(var(--spacing) * 2);
|
|
1095
1115
|
}
|
|
@@ -1170,6 +1190,10 @@
|
|
|
1170
1190
|
text-align: center;
|
|
1171
1191
|
}
|
|
1172
1192
|
|
|
1193
|
+
.text-right {
|
|
1194
|
+
text-align: right;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1173
1197
|
.font-mono {
|
|
1174
1198
|
font-family: var(--font-mono);
|
|
1175
1199
|
}
|
|
@@ -1288,11 +1312,20 @@
|
|
|
1288
1312
|
letter-spacing: .15em;
|
|
1289
1313
|
}
|
|
1290
1314
|
|
|
1315
|
+
.tracking-\[\.18em\] {
|
|
1316
|
+
--tw-tracking: .18em;
|
|
1317
|
+
letter-spacing: .18em;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1291
1320
|
.tracking-tight {
|
|
1292
1321
|
--tw-tracking: var(--tracking-tight);
|
|
1293
1322
|
letter-spacing: var(--tracking-tight);
|
|
1294
1323
|
}
|
|
1295
1324
|
|
|
1325
|
+
.whitespace-nowrap {
|
|
1326
|
+
white-space: nowrap;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1296
1329
|
.whitespace-pre-wrap {
|
|
1297
1330
|
white-space: pre-wrap;
|
|
1298
1331
|
}
|
|
@@ -1406,6 +1439,12 @@
|
|
|
1406
1439
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
1407
1440
|
}
|
|
1408
1441
|
|
|
1442
|
+
.transition-colors {
|
|
1443
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
1444
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
1445
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1409
1448
|
.transition-transform {
|
|
1410
1449
|
transition-property: transform, translate, scale, rotate;
|
|
1411
1450
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
@@ -1459,6 +1498,16 @@
|
|
|
1459
1498
|
border-color: var(--color-accent);
|
|
1460
1499
|
}
|
|
1461
1500
|
|
|
1501
|
+
.hover\:border-accent\/40:hover {
|
|
1502
|
+
border-color: #7c5cff66;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
1506
|
+
.hover\:border-accent\/40:hover {
|
|
1507
|
+
border-color: color-mix(in oklab, var(--color-accent) 40%, transparent);
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1462
1511
|
.hover\:text-accent:hover {
|
|
1463
1512
|
color: var(--color-accent);
|
|
1464
1513
|
}
|
|
@@ -1484,10 +1533,18 @@
|
|
|
1484
1533
|
cursor: default;
|
|
1485
1534
|
}
|
|
1486
1535
|
|
|
1536
|
+
.disabled\:cursor-not-allowed:disabled {
|
|
1537
|
+
cursor: not-allowed;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1487
1540
|
.disabled\:opacity-30:disabled {
|
|
1488
1541
|
opacity: .3;
|
|
1489
1542
|
}
|
|
1490
1543
|
|
|
1544
|
+
.disabled\:opacity-50:disabled {
|
|
1545
|
+
opacity: .5;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1491
1548
|
@media (hover: hover) {
|
|
1492
1549
|
.disabled\:hover\:text-muted:disabled:hover {
|
|
1493
1550
|
color: var(--color-muted);
|
|
@@ -1801,3 +1858,9 @@
|
|
|
1801
1858
|
syntax: "*";
|
|
1802
1859
|
inherits: false
|
|
1803
1860
|
}
|
|
1861
|
+
|
|
1862
|
+
@keyframes spin {
|
|
1863
|
+
to {
|
|
1864
|
+
transform: rotate(360deg);
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<title>Fixmind</title>
|
|
8
8
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
9
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap">
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-DZSvzKoZ.js"></script>
|
|
11
|
+
<link rel="stylesheet" crossorigin href="/assets/index-HSKQ7GzA.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
14
14
|
<div id="root"></div>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function setup(options: Record<string, string | boolean>): Promise<void>;
|
|
2
|
+
export declare function loginCommand(options: Record<string, string | boolean>): Promise<void>;
|
|
3
|
+
export declare function logoutCommand(): Promise<void>;
|
|
4
|
+
export declare function syncCommand(sub: string | undefined): Promise<void>;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { stdin, stdout } from "node:process";
|
|
2
|
+
import { log, outro, password } from "@clack/prompts";
|
|
3
|
+
import { createLessonStore, initializeDataDirectory } from "./storage.js";
|
|
4
|
+
import { createSyncEngine, PRICING_URL } from "./sync.js";
|
|
5
|
+
import { common, isAddressInUseError, intro, multiselect, note, optionalPort, optionString, parseList, select, startSpinner, supportedClientOptions, terminalLink, unwrap, validateClients, validateScope, text, } from "./cli-utils.js";
|
|
6
|
+
import { configureClients, configureInstructions, configurePermissions, detectClients, genericMcpConfiguration } from "./setup.js";
|
|
7
|
+
const DEFAULT_SUPABASE_URL = "https://jpczzgekindvuivnwjuw.supabase.co";
|
|
8
|
+
const DEFAULT_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpwY3p6Z2VraW5kdnVpdm53anV3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODIwNzEyMjEsImV4cCI6MjA5NzY0NzIyMX0.qG-9H5BZi3sKHVQrzL3iI9ALmJgoTizLCU4Bxzpw0Bo";
|
|
9
|
+
export async function setup(options) {
|
|
10
|
+
const paths = initializeDataDirectory();
|
|
11
|
+
const detected = detectClients();
|
|
12
|
+
const supplied = parseList(optionString(options.client));
|
|
13
|
+
let clients = supplied.length ? validateClients(supplied) : detected;
|
|
14
|
+
const suppliedScope = optionString(options.scope);
|
|
15
|
+
let scope = suppliedScope ? validateScope(suppliedScope) : "user";
|
|
16
|
+
const projectDirectory = process.cwd();
|
|
17
|
+
const interactive = stdin.isTTY && stdout.isTTY;
|
|
18
|
+
if (!supplied.length && interactive) {
|
|
19
|
+
intro("Configure Learning Lessons", common);
|
|
20
|
+
note("Pick the AI clients that should receive the MCP server configuration.", "Setup", common);
|
|
21
|
+
const selected = unwrap(await multiselect({
|
|
22
|
+
message: "Clients to configure",
|
|
23
|
+
options: supportedClientOptions(detected),
|
|
24
|
+
initialValues: detected,
|
|
25
|
+
required: false,
|
|
26
|
+
...common,
|
|
27
|
+
}));
|
|
28
|
+
clients = validateClients(selected);
|
|
29
|
+
}
|
|
30
|
+
if (!suppliedScope && interactive) {
|
|
31
|
+
const selectedScope = unwrap(await select({
|
|
32
|
+
message: "Where should fixmind be configured?",
|
|
33
|
+
options: [
|
|
34
|
+
{ value: "user", label: "This device", hint: "Available in every project (~/.claude, ~/.cursor, ...)" },
|
|
35
|
+
{ value: "project", label: "This project only", hint: `Stored inside ${projectDirectory}` },
|
|
36
|
+
],
|
|
37
|
+
initialValue: "user",
|
|
38
|
+
...common,
|
|
39
|
+
}));
|
|
40
|
+
scope = selectedScope;
|
|
41
|
+
}
|
|
42
|
+
if (clients.length === 0) {
|
|
43
|
+
console.log("No supported clients detected. Add this configuration to any stdio MCP client:");
|
|
44
|
+
console.log(JSON.stringify(genericMcpConfiguration(), null, 2));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const dryRun = Boolean(options["dry-run"]);
|
|
48
|
+
const setupOptions = { clients, scope, projectDirectory, dryRun };
|
|
49
|
+
const results = configureClients(setupOptions);
|
|
50
|
+
const instructions = configureInstructions(setupOptions);
|
|
51
|
+
const permissions = configurePermissions(setupOptions);
|
|
52
|
+
console.log(`Local data initialized at ${paths.directory}.`);
|
|
53
|
+
console.log(scope === "project" ? `Scope: this project only (${projectDirectory}).` : "Scope: this device (every project).");
|
|
54
|
+
for (const result of results)
|
|
55
|
+
console.log(`${result.client}: ${result.status} - ${result.detail}`);
|
|
56
|
+
for (const result of instructions)
|
|
57
|
+
console.log(`${result.client} instructions: ${result.status} - ${result.filePath}`);
|
|
58
|
+
for (const result of permissions)
|
|
59
|
+
console.log(`${result.client} permissions: ${result.status} - ${result.filePath}`);
|
|
60
|
+
console.log("Restart configured AI clients so they discover the MCP server.");
|
|
61
|
+
if (!dryRun && !options["no-dashboard"]) {
|
|
62
|
+
const { startDashboard } = await import("./dashboard.js");
|
|
63
|
+
try {
|
|
64
|
+
const handle = await startDashboard({ port: optionalPort(options.port), open: true });
|
|
65
|
+
console.log(`Fixmind dashboard: ${handle.url}`);
|
|
66
|
+
console.log("Press Ctrl+C to stop.");
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (isAddressInUseError(error)) {
|
|
70
|
+
const port = optionalPort(options.port) ?? 4317;
|
|
71
|
+
console.log(`Dashboard is already running on 127.0.0.1:${port}; skipping a second launch.`);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export async function loginCommand(options) {
|
|
80
|
+
initializeDataDirectory();
|
|
81
|
+
const store = createLessonStore();
|
|
82
|
+
const interactive = stdin.isTTY && stdout.isTTY;
|
|
83
|
+
try {
|
|
84
|
+
const engine = createSyncEngine(store);
|
|
85
|
+
const supabaseUrl = optionString(options.url) ?? process.env.FIXMIND_SUPABASE_URL ?? DEFAULT_SUPABASE_URL;
|
|
86
|
+
const supabaseAnonKey = optionString(options.key) ?? process.env.FIXMIND_SUPABASE_ANON_KEY ?? DEFAULT_SUPABASE_ANON_KEY;
|
|
87
|
+
if (interactive)
|
|
88
|
+
intro("Fixmind login", common);
|
|
89
|
+
const passphrase = optionString(options.passphrase) ?? (interactive
|
|
90
|
+
? unwrap(await password({ message: "Sync encryption passphrase (use the same one on every machine)", ...common }))
|
|
91
|
+
: (() => { throw new Error("--passphrase is required outside an interactive terminal."); })());
|
|
92
|
+
if (!passphrase.trim()) {
|
|
93
|
+
throw new Error("Sync encryption passphrase cannot be empty.");
|
|
94
|
+
}
|
|
95
|
+
const usePasswordLogin = Boolean(optionString(options.email) || options["password-login"]);
|
|
96
|
+
let result;
|
|
97
|
+
if (usePasswordLogin) {
|
|
98
|
+
const email = optionString(options.email) ?? (interactive
|
|
99
|
+
? unwrap(await text({ message: "Email", ...common }))
|
|
100
|
+
: (() => { throw new Error("Usage: fixmind login --email <email> --password <password> --passphrase <passphrase>"); })());
|
|
101
|
+
const userPassword = optionString(options.password) ?? (interactive
|
|
102
|
+
? unwrap(await password({ message: "Password", ...common }))
|
|
103
|
+
: (() => { throw new Error("--password is required outside an interactive terminal."); })());
|
|
104
|
+
result = await engine.login({ supabaseUrl, supabaseAnonKey, email, password: userPassword, passphrase });
|
|
105
|
+
}
|
|
106
|
+
else if (interactive) {
|
|
107
|
+
let s = startSpinner("Opening your browser to sign in with GitHub...");
|
|
108
|
+
let fallbackUrl;
|
|
109
|
+
try {
|
|
110
|
+
result = await engine.loginWithGithub({
|
|
111
|
+
supabaseUrl,
|
|
112
|
+
supabaseAnonKey,
|
|
113
|
+
passphrase,
|
|
114
|
+
onAuthUrl: (url) => {
|
|
115
|
+
fallbackUrl = url;
|
|
116
|
+
s.stop("Browser opened.");
|
|
117
|
+
log.message(`Didn't open? ${terminalLink("Click here to sign in", url)}`, common);
|
|
118
|
+
s = startSpinner("Waiting for sign in to finish in your browser...");
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
s.stop("Signed in with GitHub.");
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
s.stop("GitHub sign in failed.");
|
|
125
|
+
if (fallbackUrl)
|
|
126
|
+
log.message(`If the browser didn't open: ${terminalLink("Click here to sign in", fallbackUrl)}`, common);
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
result = await engine.loginWithGithub({
|
|
132
|
+
supabaseUrl,
|
|
133
|
+
supabaseAnonKey,
|
|
134
|
+
passphrase,
|
|
135
|
+
onAuthUrl: (url) => console.log(`Opening your browser to sign in with GitHub...\nIf it doesn't open, visit: ${url}`),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const message = result.entitled
|
|
139
|
+
? `Logged in as ${result.email}. Sync is active.`
|
|
140
|
+
: `Signed in as ${result.email}, but you don't have an active Pro or Team plan yet. ` +
|
|
141
|
+
`Subscribe at ${PRICING_URL} to start syncing - no need to log in again afterward, just run \`fixmind sync push\`.`;
|
|
142
|
+
if (interactive) {
|
|
143
|
+
outro(message, common);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
console.log(message);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
store.close();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export async function logoutCommand() {
|
|
154
|
+
initializeDataDirectory();
|
|
155
|
+
const store = createLessonStore();
|
|
156
|
+
try {
|
|
157
|
+
const engine = createSyncEngine(store);
|
|
158
|
+
engine.logout();
|
|
159
|
+
console.log("Logged out.");
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
store.close();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export async function syncCommand(sub) {
|
|
166
|
+
if (!sub || !["push", "pull", "status"].includes(sub)) {
|
|
167
|
+
throw new Error("Usage: fixmind sync <push|pull|status>");
|
|
168
|
+
}
|
|
169
|
+
initializeDataDirectory();
|
|
170
|
+
const store = createLessonStore();
|
|
171
|
+
try {
|
|
172
|
+
const engine = createSyncEngine(store);
|
|
173
|
+
if (sub === "status") {
|
|
174
|
+
const status = engine.status();
|
|
175
|
+
if (!status.loggedIn) {
|
|
176
|
+
console.log("Not logged in. Run `fixmind login`.");
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
console.log(`Logged in as ${status.email}.`);
|
|
180
|
+
console.log(`Last push: ${status.lastPushedAt ?? "never"}`);
|
|
181
|
+
console.log(`Last pull: ${status.lastPulledAt ?? "never"}`);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (sub === "push") {
|
|
185
|
+
const result = await engine.push();
|
|
186
|
+
console.log(`Pushed ${result.pushed} lesson(s).`);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (sub === "pull") {
|
|
190
|
+
const result = await engine.pull();
|
|
191
|
+
console.log(`Pulled ${result.pulled} change(s), applied ${result.applied} update(s) locally.`);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
finally {
|
|
196
|
+
store.close();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=cli-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-sync.js","sourceRoot":"","sources":["../../src/cli-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,sBAAsB,EACtB,YAAY,EACZ,MAAM,EACN,eAAe,EACf,aAAa,EACb,IAAI,GACL,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAEnI,MAAM,oBAA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M,MAAM,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,MAAM,uBAAuB,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;YAC/F,OAAO;QACT,CAAC;IACH,CAAC;YAAS,CAAC;QACT,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { intro, log, multiselect, note, password, select, text } from "@clack/prompts";
|
|
2
|
+
import type { Lesson } from "./types.js";
|
|
3
|
+
export declare const common: {
|
|
4
|
+
input: NodeJS.ReadStream & {
|
|
5
|
+
fd: 0;
|
|
6
|
+
};
|
|
7
|
+
output: NodeJS.WriteStream & {
|
|
8
|
+
fd: 1;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function unwrap<T>(value: T | symbol): T;
|
|
12
|
+
export declare function terminalLink(text: string, url: string): string;
|
|
13
|
+
export declare function optionString(value: string | boolean | undefined): string | undefined;
|
|
14
|
+
export declare function numberOption(value: string | boolean | undefined, fallback: number): number;
|
|
15
|
+
export declare function optionalPort(value: string | boolean | undefined): number | undefined;
|
|
16
|
+
export declare function parseList(value?: string): string[];
|
|
17
|
+
export declare function formatDate(value: string): string;
|
|
18
|
+
export declare function formatLessonList(lessons: Lesson[]): string;
|
|
19
|
+
export declare function supportedClientOptions(detected: Array<"codex" | "claude" | "cursor">): Array<{
|
|
20
|
+
value: "codex" | "claude" | "cursor";
|
|
21
|
+
label: string;
|
|
22
|
+
hint?: string;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function validateScope(value: string): "user" | "project";
|
|
25
|
+
export declare function validateClients(values: string[]): Array<"codex" | "claude" | "cursor">;
|
|
26
|
+
export declare function isAddressInUseError(error: unknown): boolean;
|
|
27
|
+
export declare function askText(message: string, fallback: string | undefined, interactive: boolean): Promise<string>;
|
|
28
|
+
export declare function startSpinner(message: string): import("@clack/prompts").SpinnerResult;
|
|
29
|
+
export { intro, log, multiselect, note, password, select, text };
|
|
30
|
+
export declare function parseArgs(argv: string[]): {
|
|
31
|
+
command: string;
|
|
32
|
+
positionals: string[];
|
|
33
|
+
options: Record<string, string | boolean>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { stdin, stdout } from "node:process";
|
|
2
|
+
import { parseArgs as nodeParseArgs } from "node:util";
|
|
3
|
+
import { cancel, isCancel, intro, log, multiselect, note, password, select, spinner, text, } from "@clack/prompts";
|
|
4
|
+
export const common = { input: stdin, output: stdout };
|
|
5
|
+
export function unwrap(value) {
|
|
6
|
+
if (isCancel(value)) {
|
|
7
|
+
cancel("Operation cancelled.");
|
|
8
|
+
process.exit(0);
|
|
9
|
+
}
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
export function terminalLink(text, url) {
|
|
13
|
+
const esc = "\x1b";
|
|
14
|
+
return `${esc}]8;;${url}\u0007${text}${esc}]8;;\u0007`;
|
|
15
|
+
}
|
|
16
|
+
export function optionString(value) {
|
|
17
|
+
return typeof value === "string" ? value : undefined;
|
|
18
|
+
}
|
|
19
|
+
export function numberOption(value, fallback) {
|
|
20
|
+
if (value === undefined)
|
|
21
|
+
return fallback;
|
|
22
|
+
const parsed = Number(value);
|
|
23
|
+
if (!Number.isInteger(parsed) || parsed <= 0)
|
|
24
|
+
throw new Error("--limit must be a positive integer.");
|
|
25
|
+
return parsed;
|
|
26
|
+
}
|
|
27
|
+
export function optionalPort(value) {
|
|
28
|
+
if (value === undefined)
|
|
29
|
+
return undefined;
|
|
30
|
+
const port = Number(value);
|
|
31
|
+
if (!Number.isInteger(port) || port < 0 || port > 65535) {
|
|
32
|
+
throw new Error("--port must be an integer from 0 to 65535.");
|
|
33
|
+
}
|
|
34
|
+
return port;
|
|
35
|
+
}
|
|
36
|
+
export function parseList(value) {
|
|
37
|
+
return value?.split(",").map((item) => item.trim()).filter(Boolean) ?? [];
|
|
38
|
+
}
|
|
39
|
+
export function formatDate(value) {
|
|
40
|
+
return new Intl.DateTimeFormat(undefined, { dateStyle: "medium" }).format(new Date(value));
|
|
41
|
+
}
|
|
42
|
+
export function formatLessonList(lessons) {
|
|
43
|
+
if (lessons.length === 0)
|
|
44
|
+
return "No lessons found.";
|
|
45
|
+
return lessons
|
|
46
|
+
.map((lesson) => {
|
|
47
|
+
const concepts = lesson.concepts.join(", ") || "none";
|
|
48
|
+
const suffix = lesson.status === "superseded" ? " [superseded]" : "";
|
|
49
|
+
return [
|
|
50
|
+
`${lesson.id.slice(0, 8)} ${lesson.title}${suffix}`,
|
|
51
|
+
` concepts: ${concepts}`,
|
|
52
|
+
` understanding: ${lesson.understanding} | next review: ${formatDate(lesson.nextReviewAt)}`,
|
|
53
|
+
].join("\n");
|
|
54
|
+
})
|
|
55
|
+
.join("\n\n");
|
|
56
|
+
}
|
|
57
|
+
export function supportedClientOptions(detected) {
|
|
58
|
+
const detectedSet = new Set(detected);
|
|
59
|
+
return [
|
|
60
|
+
{ value: "codex", label: "Codex", hint: detectedSet.has("codex") ? "detected" : undefined },
|
|
61
|
+
{ value: "claude", label: "Claude", hint: detectedSet.has("claude") ? "detected" : undefined },
|
|
62
|
+
{ value: "cursor", label: "Cursor", hint: detectedSet.has("cursor") ? "detected" : undefined },
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
export function validateScope(value) {
|
|
66
|
+
if (value !== "user" && value !== "project")
|
|
67
|
+
throw new Error(`Unsupported scope: ${value}. Use user or project.`);
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
export function validateClients(values) {
|
|
71
|
+
const supported = new Set(["codex", "claude", "cursor"]);
|
|
72
|
+
const invalid = values.filter((value) => !supported.has(value));
|
|
73
|
+
if (invalid.length) {
|
|
74
|
+
throw new Error(`Unsupported client(s): ${invalid.join(", ")}. Use codex, claude, or cursor.`);
|
|
75
|
+
}
|
|
76
|
+
return [...new Set(values)];
|
|
77
|
+
}
|
|
78
|
+
export function isAddressInUseError(error) {
|
|
79
|
+
if (error == null || typeof error !== "object")
|
|
80
|
+
return false;
|
|
81
|
+
if ("code" in error && error.code === "EADDRINUSE")
|
|
82
|
+
return true;
|
|
83
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
+
return /address already in use/i.test(message);
|
|
85
|
+
}
|
|
86
|
+
export async function askText(message, fallback, interactive) {
|
|
87
|
+
if (!interactive)
|
|
88
|
+
return fallback ?? "";
|
|
89
|
+
return unwrap(await text({ message, defaultValue: fallback || undefined, ...common }));
|
|
90
|
+
}
|
|
91
|
+
export function startSpinner(message) {
|
|
92
|
+
const state = spinner();
|
|
93
|
+
state.start(message);
|
|
94
|
+
return state;
|
|
95
|
+
}
|
|
96
|
+
export { intro, log, multiselect, note, password, select, text };
|
|
97
|
+
export function parseArgs(argv) {
|
|
98
|
+
const S = { type: "string" };
|
|
99
|
+
const B = { type: "boolean" };
|
|
100
|
+
const { values, positionals } = nodeParseArgs({
|
|
101
|
+
args: argv,
|
|
102
|
+
allowPositionals: true,
|
|
103
|
+
strict: false,
|
|
104
|
+
options: {
|
|
105
|
+
title: S, "original-prompt": S, problem: S, mistake: S, "root-cause": S,
|
|
106
|
+
"fix-summary": S, takeaway: S, "mistake-pattern": S, "when-not-applicable": S,
|
|
107
|
+
concepts: S, "files-changed": S, "code-example": S, "bad-code-example": S,
|
|
108
|
+
"good-code-example": S, "code-explanation": S, "practice-task": S,
|
|
109
|
+
"review-question": S, "expected-answer": S, tool: S, understanding: S,
|
|
110
|
+
tags: S, file: S, format: S, output: S, id: S, limit: S, port: S,
|
|
111
|
+
client: S, scope: S, reason: S, url: S, key: S, email: S, password: S,
|
|
112
|
+
passphrase: S, yes: { ...B, short: "y" }, "include-superseded": B, "no-open": B,
|
|
113
|
+
"dry-run": B, help: B, version: { ...B, short: "v" }, "password-login": B,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
const command = positionals[0];
|
|
117
|
+
return { command, positionals: positionals.slice(1), options: values };
|
|
118
|
+
}
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