@krimto-labs/krimto 0.2.19 → 0.2.20
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/package.json +1 -1
- package/src/cli/wizard.ts +37 -10
- package/src/server/index.ts +1 -1
package/package.json
CHANGED
package/src/cli/wizard.ts
CHANGED
|
@@ -154,7 +154,12 @@ async function runFreshWizard(
|
|
|
154
154
|
printScan(envs, io);
|
|
155
155
|
|
|
156
156
|
const selectedEditors = await askEditors(envs, snapshot);
|
|
157
|
-
|
|
157
|
+
// v0.2.20 — smart default: stdio Krimto can only serve one editor at a time (single-writer
|
|
158
|
+
// lock on the data dir). When the user picks 2+ editors, recommend "Always running" so they
|
|
159
|
+
// can all use Krimto simultaneously over HTTP. Snapshot.runMode wins on reconfigure (respects
|
|
160
|
+
// the user's prior choice). First-run with one editor → "as-needed" (simplest).
|
|
161
|
+
const smartDefault: RunMode = selectedEditors.length >= 2 ? "always-running" : "as-needed";
|
|
162
|
+
const runMode = await askRunMode(snapshot?.runMode ?? smartDefault, selectedEditors.length);
|
|
158
163
|
const whoFor = await askWhoFor();
|
|
159
164
|
if (whoFor === "team") {
|
|
160
165
|
io.out("\nGreat — team mode is set up via `krimto team init` (Phase C). Run that next.\n");
|
|
@@ -199,22 +204,38 @@ async function askEditors(
|
|
|
199
204
|
});
|
|
200
205
|
}
|
|
201
206
|
|
|
202
|
-
async function askRunMode(
|
|
207
|
+
async function askRunMode(
|
|
208
|
+
defaultMode: RunMode = "as-needed",
|
|
209
|
+
editorCount = 1,
|
|
210
|
+
): Promise<RunMode> {
|
|
211
|
+
// v0.2.20 — when 2+ editors are selected, "as needed" is broken by Krimto's single-writer
|
|
212
|
+
// lock: only the first editor to call wins; the others fail. The choice descriptions reflect
|
|
213
|
+
// this so a user picking "as needed" with multiple editors sees the warning before they commit.
|
|
214
|
+
const multi = editorCount >= 2;
|
|
203
215
|
return select<RunMode>({
|
|
204
216
|
message: "How should Krimto run?",
|
|
205
217
|
default: defaultMode,
|
|
206
218
|
choices: [
|
|
207
219
|
{
|
|
208
220
|
value: "as-needed",
|
|
209
|
-
name: "As needed (recommended)",
|
|
210
|
-
description:
|
|
211
|
-
|
|
221
|
+
name: multi ? "As needed (⚠️ one editor at a time only)" : "As needed (recommended)",
|
|
222
|
+
description: multi
|
|
223
|
+
? `Your editor launches Krimto when it needs it. Simple — but Krimto's single-writer\n` +
|
|
224
|
+
`lock means only one of your ${editorCount} editors can use it at a time. The second one\n` +
|
|
225
|
+
`to call will fail until the first one exits. Pick "Always running" instead if you\n` +
|
|
226
|
+
`want all of them to work simultaneously.`
|
|
227
|
+
: "Your editor launches Krimto when it needs it. Simplest setup —\nno background process to manage. Works for solo use on one machine.",
|
|
212
228
|
},
|
|
213
229
|
{
|
|
214
230
|
value: "always-running",
|
|
215
|
-
name:
|
|
216
|
-
|
|
217
|
-
"
|
|
231
|
+
name: multi
|
|
232
|
+
? "Always running (recommended for multi-editor)"
|
|
233
|
+
: "Always running (background service)",
|
|
234
|
+
description: multi
|
|
235
|
+
? `ONE Krimto runs continuously in the background; ALL ${editorCount} of your editors connect\n` +
|
|
236
|
+
`to it over HTTP. No lock fights — they can all save and recall simultaneously.\n` +
|
|
237
|
+
`Installs launchd / systemd / schtasks on first use.`
|
|
238
|
+
: "Krimto runs continuously, even after you close your terminal.\nAuto-starts when you log in. Best if multiple editors talk to one Krimto\nor you want /ui always available.",
|
|
218
239
|
},
|
|
219
240
|
{
|
|
220
241
|
value: "manual",
|
|
@@ -396,7 +417,13 @@ export interface NonInteractiveOptions extends ApplyOptions {
|
|
|
396
417
|
|
|
397
418
|
/**
|
|
398
419
|
* Skip the prompts entirely and apply with sensible defaults. Used by CI and the `--yes` flag.
|
|
399
|
-
* Defaults: all detected editors, "
|
|
420
|
+
* Defaults: all detected editors, "just-me", keyword search.
|
|
421
|
+
*
|
|
422
|
+
* Run mode is "as-needed" for a single editor, "always-running" when 2+ editors are selected —
|
|
423
|
+
* mirrors the interactive wizard's smart default (v0.2.20). The stdio + lock combination only
|
|
424
|
+
* supports one editor at a time, so multi-editor `--yes` users should land on the HTTP-backed
|
|
425
|
+
* always-running mode by default. Tests that want the old behavior pass `runMode: "as-needed"`
|
|
426
|
+
* explicitly; CI runs that don't want a real service install pass `dryRun: true`.
|
|
400
427
|
*/
|
|
401
428
|
export async function runInitNonInteractive(
|
|
402
429
|
cwd: string,
|
|
@@ -405,7 +432,7 @@ export async function runInitNonInteractive(
|
|
|
405
432
|
const envs = await detectEditorEnvironments(cwd, opts.homeDir);
|
|
406
433
|
const detected = envs.filter((e) => e.present).map((e) => e.editor);
|
|
407
434
|
const editors = opts.editors ?? (detected.length > 0 ? detected : envs.map((e) => e.editor));
|
|
408
|
-
const runMode = opts.runMode ?? "as-needed";
|
|
435
|
+
const runMode = opts.runMode ?? (editors.length >= 2 ? "always-running" : "as-needed");
|
|
409
436
|
const search = opts.search ?? "keyword";
|
|
410
437
|
const identity = await defaultIdentity();
|
|
411
438
|
const answers: WizardAnswers = {
|
package/src/server/index.ts
CHANGED
|
@@ -48,7 +48,7 @@ import { type Requester } from "../access/scope";
|
|
|
48
48
|
|
|
49
49
|
export type RequesterResolver = (extra: { authInfo?: AuthInfo }) => Requester;
|
|
50
50
|
|
|
51
|
-
export const KRIMTO_VERSION = "0.2.
|
|
51
|
+
export const KRIMTO_VERSION = "0.2.20";
|
|
52
52
|
|
|
53
53
|
export function resolveDataDir(): string {
|
|
54
54
|
return process.env.KRIMTO_DATA ?? path.join(homedir(), ".krimto");
|