claudeup 6.6.0 → 6.8.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/package.json +4 -4
- package/src/__tests__/conventions-manager.test.ts +45 -45
- package/src/__tests__/enabled-not-installed.test.ts +1 -1
- package/src/__tests__/mate-availability.test.ts +156 -0
- package/src/__tests__/mate-catalog.test.ts +295 -0
- package/src/__tests__/model-visuals.test.tsx +1698 -25
- package/src/__tests__/models-adapter.test.ts +21 -6
- package/src/__tests__/models-cli.test.ts +100 -0
- package/src/__tests__/models-core.test.ts +273 -111
- package/src/__tests__/models-manager.test.ts +15 -12
- package/src/__tests__/models-presets-marketplace.test.ts +168 -0
- package/src/__tests__/models-screen-state.test.ts +57 -1
- package/src/__tests__/plugin-manager-fallback.test.ts +3 -5
- package/src/__tests__/resolver.test.ts +3 -3
- package/src/cli/doctor.ts +8 -13
- package/src/cli/models.ts +97 -13
- package/src/data/models-presets.ts +72 -13
- package/src/data/predefined-profiles.ts +7 -7
- package/src/services/claude-settings.ts +1 -1
- package/src/services/community-styles.ts +1 -1
- package/src/services/mate-availability.ts +133 -0
- package/src/services/mate-catalog.ts +265 -0
- package/src/services/models-core.ts +371 -30
- package/src/ui/adapters/modelsAdapter.ts +58 -15
- package/src/ui/components/layout/ScreenLayout.tsx +6 -1
- package/src/ui/renderers/modelRenderers.tsx +413 -108
- package/src/ui/renderers/modelVisuals.tsx +694 -145
- package/src/ui/screens/ModelsScreen.tsx +74 -10
- package/src/ui/state/reducer.ts +20 -0
- package/src/ui/state/types.ts +31 -0
- package/src/ui/theme-mode.ts +128 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudeup",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.0",
|
|
4
4
|
"description": "TUI tool for managing Claude Code plugins, MCPs, and configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.tsx",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"typescript": "^5.6.3"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"claudeup-darwin-arm64": "6.
|
|
68
|
-
"claudeup-darwin-x64": "6.
|
|
69
|
-
"claudeup-linux-x64": "6.
|
|
67
|
+
"claudeup-darwin-arm64": "6.8.0",
|
|
68
|
+
"claudeup-darwin-x64": "6.8.0",
|
|
69
|
+
"claudeup-linux-x64": "6.8.0"
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -240,11 +240,11 @@ describe("conventions-manager", () => {
|
|
|
240
240
|
const content = [
|
|
241
241
|
"# Project CLAUDE.md",
|
|
242
242
|
"",
|
|
243
|
-
"<!-- BEGIN magus:code-
|
|
243
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
244
244
|
"## Code Analysis Conventions",
|
|
245
245
|
"",
|
|
246
246
|
"> Managed by plugin",
|
|
247
|
-
"<!-- END magus:code-
|
|
247
|
+
"<!-- END magus:code-search -->",
|
|
248
248
|
"",
|
|
249
249
|
"Other content",
|
|
250
250
|
].join("\n");
|
|
@@ -253,7 +253,7 @@ describe("conventions-manager", () => {
|
|
|
253
253
|
|
|
254
254
|
expect(result.errors).toEqual([]);
|
|
255
255
|
expect(result.sections).toHaveLength(1);
|
|
256
|
-
expect(result.sections[0].section).toBe("code-
|
|
256
|
+
expect(result.sections[0].section).toBe("code-search");
|
|
257
257
|
expect(result.sections[0].version).toBe("1.0.0");
|
|
258
258
|
expect(result.sections[0].content).toContain("Code Analysis Conventions");
|
|
259
259
|
expect(result.sections[0].startLine).toBe(3);
|
|
@@ -262,9 +262,9 @@ describe("conventions-manager", () => {
|
|
|
262
262
|
|
|
263
263
|
it("should parse multiple sections", () => {
|
|
264
264
|
const content = [
|
|
265
|
-
"<!-- BEGIN magus:code-
|
|
265
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
266
266
|
"Section 1 content",
|
|
267
|
-
"<!-- END magus:code-
|
|
267
|
+
"<!-- END magus:code-search -->",
|
|
268
268
|
"",
|
|
269
269
|
"<!-- BEGIN magus:terminal v2.0.0 -->",
|
|
270
270
|
"Section 2 content",
|
|
@@ -275,13 +275,13 @@ describe("conventions-manager", () => {
|
|
|
275
275
|
|
|
276
276
|
expect(result.errors).toEqual([]);
|
|
277
277
|
expect(result.sections).toHaveLength(2);
|
|
278
|
-
expect(result.sections[0].section).toBe("code-
|
|
278
|
+
expect(result.sections[0].section).toBe("code-search");
|
|
279
279
|
expect(result.sections[1].section).toBe("terminal");
|
|
280
280
|
});
|
|
281
281
|
|
|
282
282
|
it("should detect missing END marker", () => {
|
|
283
283
|
const content = [
|
|
284
|
-
"<!-- BEGIN magus:code-
|
|
284
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
285
285
|
"Some content without an end marker",
|
|
286
286
|
].join("\n");
|
|
287
287
|
|
|
@@ -289,18 +289,18 @@ describe("conventions-manager", () => {
|
|
|
289
289
|
|
|
290
290
|
expect(result.errors).toHaveLength(1);
|
|
291
291
|
expect(result.errors[0].type).toBe("missing_end");
|
|
292
|
-
expect(result.errors[0]).toHaveProperty("section", "code-
|
|
292
|
+
expect(result.errors[0]).toHaveProperty("section", "code-search");
|
|
293
293
|
});
|
|
294
294
|
|
|
295
295
|
it("should detect duplicate sections", () => {
|
|
296
296
|
const content = [
|
|
297
|
-
"<!-- BEGIN magus:code-
|
|
297
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
298
298
|
"First",
|
|
299
|
-
"<!-- END magus:code-
|
|
299
|
+
"<!-- END magus:code-search -->",
|
|
300
300
|
"",
|
|
301
|
-
"<!-- BEGIN magus:code-
|
|
301
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
302
302
|
"Second",
|
|
303
|
-
"<!-- END magus:code-
|
|
303
|
+
"<!-- END magus:code-search -->",
|
|
304
304
|
].join("\n");
|
|
305
305
|
|
|
306
306
|
const result = parseClaudeMdContent(content);
|
|
@@ -309,7 +309,7 @@ describe("conventions-manager", () => {
|
|
|
309
309
|
(e) => e.type === "duplicate_section",
|
|
310
310
|
);
|
|
311
311
|
expect(dupError).toBeDefined();
|
|
312
|
-
expect(dupError).toHaveProperty("section", "code-
|
|
312
|
+
expect(dupError).toHaveProperty("section", "code-search");
|
|
313
313
|
});
|
|
314
314
|
|
|
315
315
|
it("should ignore markers inside code blocks", () => {
|
|
@@ -473,9 +473,9 @@ describe("conventions-manager", () => {
|
|
|
473
473
|
const content = [
|
|
474
474
|
"# Project",
|
|
475
475
|
"",
|
|
476
|
-
"<!-- BEGIN magus:code-
|
|
476
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
477
477
|
"Conventions here",
|
|
478
|
-
"<!-- END magus:code-
|
|
478
|
+
"<!-- END magus:code-search -->",
|
|
479
479
|
].join("\n");
|
|
480
480
|
await writeFile(claudeMdPath, content);
|
|
481
481
|
|
|
@@ -505,7 +505,7 @@ describe("conventions-manager", () => {
|
|
|
505
505
|
|
|
506
506
|
const result = await injectClaudeMdSection(
|
|
507
507
|
claudeMdPath,
|
|
508
|
-
"code-
|
|
508
|
+
"code-search",
|
|
509
509
|
"1.0.0",
|
|
510
510
|
"## Code Analysis\n\nPrivate paths here",
|
|
511
511
|
);
|
|
@@ -513,9 +513,9 @@ describe("conventions-manager", () => {
|
|
|
513
513
|
expect(result.action).toBe("inserted");
|
|
514
514
|
|
|
515
515
|
const content = await readFile(claudeMdPath, "utf-8");
|
|
516
|
-
expect(content).toContain("<!-- BEGIN magus:code-
|
|
516
|
+
expect(content).toContain("<!-- BEGIN magus:code-search v1.0.0 -->");
|
|
517
517
|
expect(content).toContain("## Code Analysis");
|
|
518
|
-
expect(content).toContain("<!-- END magus:code-
|
|
518
|
+
expect(content).toContain("<!-- END magus:code-search -->");
|
|
519
519
|
});
|
|
520
520
|
|
|
521
521
|
it("should insert new section into existing file", async () => {
|
|
@@ -524,7 +524,7 @@ describe("conventions-manager", () => {
|
|
|
524
524
|
|
|
525
525
|
const result = await injectClaudeMdSection(
|
|
526
526
|
claudeMdPath,
|
|
527
|
-
"code-
|
|
527
|
+
"code-search",
|
|
528
528
|
"1.0.0",
|
|
529
529
|
"New content",
|
|
530
530
|
);
|
|
@@ -534,7 +534,7 @@ describe("conventions-manager", () => {
|
|
|
534
534
|
const content = await readFile(claudeMdPath, "utf-8");
|
|
535
535
|
expect(content).toContain("# Project");
|
|
536
536
|
expect(content).toContain("Existing content");
|
|
537
|
-
expect(content).toContain("<!-- BEGIN magus:code-
|
|
537
|
+
expect(content).toContain("<!-- BEGIN magus:code-search v1.0.0 -->");
|
|
538
538
|
});
|
|
539
539
|
|
|
540
540
|
it("should update section when version changes", async () => {
|
|
@@ -542,15 +542,15 @@ describe("conventions-manager", () => {
|
|
|
542
542
|
const initial = [
|
|
543
543
|
"# Project",
|
|
544
544
|
"",
|
|
545
|
-
"<!-- BEGIN magus:code-
|
|
545
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
546
546
|
"Old content",
|
|
547
|
-
"<!-- END magus:code-
|
|
547
|
+
"<!-- END magus:code-search -->",
|
|
548
548
|
].join("\n");
|
|
549
549
|
await writeFile(claudeMdPath, initial);
|
|
550
550
|
|
|
551
551
|
const result = await injectClaudeMdSection(
|
|
552
552
|
claudeMdPath,
|
|
553
|
-
"code-
|
|
553
|
+
"code-search",
|
|
554
554
|
"2.0.0",
|
|
555
555
|
"New content",
|
|
556
556
|
);
|
|
@@ -568,15 +568,15 @@ describe("conventions-manager", () => {
|
|
|
568
568
|
it("should skip when version is unchanged", async () => {
|
|
569
569
|
const claudeMdPath = join(testDir, "CLAUDE.md");
|
|
570
570
|
const initial = [
|
|
571
|
-
"<!-- BEGIN magus:code-
|
|
571
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
572
572
|
"Current content",
|
|
573
|
-
"<!-- END magus:code-
|
|
573
|
+
"<!-- END magus:code-search -->",
|
|
574
574
|
].join("\n");
|
|
575
575
|
await writeFile(claudeMdPath, initial);
|
|
576
576
|
|
|
577
577
|
const result = await injectClaudeMdSection(
|
|
578
578
|
claudeMdPath,
|
|
579
|
-
"code-
|
|
579
|
+
"code-search",
|
|
580
580
|
"1.0.0",
|
|
581
581
|
"Different content but same version",
|
|
582
582
|
);
|
|
@@ -598,7 +598,7 @@ describe("conventions-manager", () => {
|
|
|
598
598
|
|
|
599
599
|
const result = await injectClaudeMdSection(
|
|
600
600
|
claudeMdPath,
|
|
601
|
-
"code-
|
|
601
|
+
"code-search",
|
|
602
602
|
"1.0.0",
|
|
603
603
|
"New content",
|
|
604
604
|
);
|
|
@@ -610,13 +610,13 @@ describe("conventions-manager", () => {
|
|
|
610
610
|
it("should refuse when file has duplicate sections", async () => {
|
|
611
611
|
const claudeMdPath = join(testDir, "CLAUDE.md");
|
|
612
612
|
const duplicate = [
|
|
613
|
-
"<!-- BEGIN magus:code-
|
|
613
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
614
614
|
"First",
|
|
615
|
-
"<!-- END magus:code-
|
|
615
|
+
"<!-- END magus:code-search -->",
|
|
616
616
|
"",
|
|
617
|
-
"<!-- BEGIN magus:code-
|
|
617
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
618
618
|
"Second",
|
|
619
|
-
"<!-- END magus:code-
|
|
619
|
+
"<!-- END magus:code-search -->",
|
|
620
620
|
].join("\n");
|
|
621
621
|
await writeFile(claudeMdPath, duplicate);
|
|
622
622
|
|
|
@@ -642,21 +642,21 @@ describe("conventions-manager", () => {
|
|
|
642
642
|
const content = [
|
|
643
643
|
"# Project",
|
|
644
644
|
"",
|
|
645
|
-
"<!-- BEGIN magus:code-
|
|
645
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
646
646
|
"Conventions here",
|
|
647
|
-
"<!-- END magus:code-
|
|
647
|
+
"<!-- END magus:code-search -->",
|
|
648
648
|
"",
|
|
649
649
|
"Other content",
|
|
650
650
|
].join("\n");
|
|
651
651
|
await writeFile(claudeMdPath, content);
|
|
652
652
|
|
|
653
|
-
const result = await removeClaudeMdSection(claudeMdPath, "code-
|
|
653
|
+
const result = await removeClaudeMdSection(claudeMdPath, "code-search");
|
|
654
654
|
|
|
655
655
|
expect(result.removed).toBe(true);
|
|
656
656
|
|
|
657
657
|
const newContent = await readFile(claudeMdPath, "utf-8");
|
|
658
|
-
expect(newContent).not.toContain("BEGIN magus:code-
|
|
659
|
-
expect(newContent).not.toContain("END magus:code-
|
|
658
|
+
expect(newContent).not.toContain("BEGIN magus:code-search");
|
|
659
|
+
expect(newContent).not.toContain("END magus:code-search");
|
|
660
660
|
expect(newContent).toContain("# Project");
|
|
661
661
|
expect(newContent).toContain("Other content");
|
|
662
662
|
});
|
|
@@ -665,7 +665,7 @@ describe("conventions-manager", () => {
|
|
|
665
665
|
const claudeMdPath = join(testDir, "CLAUDE.md");
|
|
666
666
|
await writeFile(claudeMdPath, "# Project\n\nSome content\n");
|
|
667
667
|
|
|
668
|
-
const result = await removeClaudeMdSection(claudeMdPath, "code-
|
|
668
|
+
const result = await removeClaudeMdSection(claudeMdPath, "code-search");
|
|
669
669
|
|
|
670
670
|
expect(result.removed).toBe(false);
|
|
671
671
|
});
|
|
@@ -673,7 +673,7 @@ describe("conventions-manager", () => {
|
|
|
673
673
|
it("should no-op for non-existent file", async () => {
|
|
674
674
|
const claudeMdPath = join(testDir, "CLAUDE.md");
|
|
675
675
|
|
|
676
|
-
const result = await removeClaudeMdSection(claudeMdPath, "code-
|
|
676
|
+
const result = await removeClaudeMdSection(claudeMdPath, "code-search");
|
|
677
677
|
|
|
678
678
|
expect(result.removed).toBe(false);
|
|
679
679
|
});
|
|
@@ -724,9 +724,9 @@ describe("conventions-manager", () => {
|
|
|
724
724
|
it("should preserve other sections when removing one", async () => {
|
|
725
725
|
const claudeMdPath = join(testDir, "CLAUDE.md");
|
|
726
726
|
const content = [
|
|
727
|
-
"<!-- BEGIN magus:code-
|
|
727
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
728
728
|
"First section",
|
|
729
|
-
"<!-- END magus:code-
|
|
729
|
+
"<!-- END magus:code-search -->",
|
|
730
730
|
"",
|
|
731
731
|
"<!-- BEGIN magus:terminal v2.0.0 -->",
|
|
732
732
|
"Second section",
|
|
@@ -734,10 +734,10 @@ describe("conventions-manager", () => {
|
|
|
734
734
|
].join("\n");
|
|
735
735
|
await writeFile(claudeMdPath, content);
|
|
736
736
|
|
|
737
|
-
await removeClaudeMdSection(claudeMdPath, "code-
|
|
737
|
+
await removeClaudeMdSection(claudeMdPath, "code-search");
|
|
738
738
|
|
|
739
739
|
const newContent = await readFile(claudeMdPath, "utf-8");
|
|
740
|
-
expect(newContent).not.toContain("code-
|
|
740
|
+
expect(newContent).not.toContain("code-search");
|
|
741
741
|
expect(newContent).toContain("<!-- BEGIN magus:terminal v2.0.0 -->");
|
|
742
742
|
expect(newContent).toContain("Second section");
|
|
743
743
|
});
|
|
@@ -751,9 +751,9 @@ describe("conventions-manager", () => {
|
|
|
751
751
|
it("should list all managed sections", async () => {
|
|
752
752
|
const claudeMdPath = join(testDir, "CLAUDE.md");
|
|
753
753
|
const content = [
|
|
754
|
-
"<!-- BEGIN magus:code-
|
|
754
|
+
"<!-- BEGIN magus:code-search v1.0.0 -->",
|
|
755
755
|
"First",
|
|
756
|
-
"<!-- END magus:code-
|
|
756
|
+
"<!-- END magus:code-search -->",
|
|
757
757
|
"",
|
|
758
758
|
"<!-- BEGIN magus:terminal v2.1.0 -->",
|
|
759
759
|
"Second",
|
|
@@ -764,7 +764,7 @@ describe("conventions-manager", () => {
|
|
|
764
764
|
const sections = await listClaudeMdSections(claudeMdPath);
|
|
765
765
|
|
|
766
766
|
expect(sections).toHaveLength(2);
|
|
767
|
-
expect(sections[0].section).toBe("code-
|
|
767
|
+
expect(sections[0].section).toBe("code-search");
|
|
768
768
|
expect(sections[0].version).toBe("1.0.0");
|
|
769
769
|
expect(sections[1].section).toBe("terminal");
|
|
770
770
|
expect(sections[1].version).toBe("2.1.0");
|
|
@@ -25,7 +25,7 @@ const plugin = (over: Partial<PluginInfo>): PluginInfo =>
|
|
|
25
25
|
|
|
26
26
|
describe("isEnabledButNotInstalled", () => {
|
|
27
27
|
test("enabled in project scope with no installed version is flagged", () => {
|
|
28
|
-
// The real case: terminal/code-
|
|
28
|
+
// The real case: terminal/code-search are in this project's enabledPlugins
|
|
29
29
|
// but have no registry entry for it and none at user scope.
|
|
30
30
|
expect(
|
|
31
31
|
isEnabledButNotInstalled(
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the mate slots are drawn, and what "installed" is allowed to mean.
|
|
3
|
+
*
|
|
4
|
+
* The question is asked of the plugin registry through `plugin-manager`, never of
|
|
5
|
+
* `installed_plugins.json` / `enabledPlugins` / `installedPluginVersions` directly — those
|
|
6
|
+
* are Claude Code's to own, and the last of them is maintained by nothing but claudeup, so it
|
|
7
|
+
* goes stale silently. What is tested here is the DECISION on top of that data, which is the
|
|
8
|
+
* part a real registry cannot exercise on demand.
|
|
9
|
+
*/
|
|
10
|
+
import { describe, expect, test } from "bun:test";
|
|
11
|
+
import {
|
|
12
|
+
MATE_FORCE_ENV,
|
|
13
|
+
MATE_PLUGIN_ID,
|
|
14
|
+
areMatesAvailable,
|
|
15
|
+
matesForced,
|
|
16
|
+
} from "../services/mate-availability.js";
|
|
17
|
+
import type { PluginInfo } from "../services/plugin-manager.js";
|
|
18
|
+
|
|
19
|
+
const plugin = (overrides: Partial<PluginInfo> = {}): PluginInfo => ({
|
|
20
|
+
id: MATE_PLUGIN_ID,
|
|
21
|
+
name: "multimodel",
|
|
22
|
+
version: "1.0.0",
|
|
23
|
+
description: "",
|
|
24
|
+
marketplace: "magus",
|
|
25
|
+
marketplaceDisplay: "Magus",
|
|
26
|
+
enabled: true,
|
|
27
|
+
...overrides,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const lister = (plugins: PluginInfo[]) => async () => plugins;
|
|
31
|
+
|
|
32
|
+
describe("areMatesAvailable", () => {
|
|
33
|
+
test("false when the plugin is nowhere in the list", async () => {
|
|
34
|
+
expect(await areMatesAvailable(undefined, lister([]))).toBe(false);
|
|
35
|
+
expect(
|
|
36
|
+
await areMatesAvailable(
|
|
37
|
+
undefined,
|
|
38
|
+
lister([plugin({ id: "dev@magus", name: "dev" })]),
|
|
39
|
+
),
|
|
40
|
+
).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("true when it is installed at ANY scope", async () => {
|
|
44
|
+
// Any scope, because a mate is served by whatever Claude Code has loaded when the
|
|
45
|
+
// agent spawns — the union of the three. A user-scope install serves a project that
|
|
46
|
+
// enables nothing of its own.
|
|
47
|
+
for (const scope of ["userScope", "projectScope", "localScope"] as const) {
|
|
48
|
+
const one = plugin({ [scope]: { enabled: true, version: "1.0.0" } });
|
|
49
|
+
expect({
|
|
50
|
+
scope,
|
|
51
|
+
available: await areMatesAvailable(undefined, lister([one])),
|
|
52
|
+
}).toEqual({ scope, available: true });
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The enabled-but-not-installed state is NOT installed.
|
|
58
|
+
*
|
|
59
|
+
* `enabledPlugins` is a flag only claudeup and the user maintain; the version comes from
|
|
60
|
+
* the registry, which is what Claude Code actually loaded. Flag set with no version is the
|
|
61
|
+
* broken state the plugin list already renders as "not installed" — and a mate row drawn
|
|
62
|
+
* on the strength of it would promise routing through a plugin that never loaded.
|
|
63
|
+
*/
|
|
64
|
+
test("false when it is enabled but never actually installed", async () => {
|
|
65
|
+
const flagged = plugin({ userScope: { enabled: true } });
|
|
66
|
+
expect(await areMatesAvailable(undefined, lister([flagged]))).toBe(false);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("false when it is installed but disabled", async () => {
|
|
70
|
+
const off = plugin({
|
|
71
|
+
userScope: { enabled: false, version: "1.0.0" },
|
|
72
|
+
});
|
|
73
|
+
expect(await areMatesAvailable(undefined, lister([off]))).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('a version of "0.0.0" still counts — that is how some plugins record themselves', async () => {
|
|
77
|
+
const zero = plugin({ userScope: { enabled: true, version: "0.0.0" } });
|
|
78
|
+
expect(await areMatesAvailable(undefined, lister([zero]))).toBe(true);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* FAILS CLOSED, and that is the load-bearing half.
|
|
83
|
+
*
|
|
84
|
+
* This reaches marketplace resolution, which does network work with its own timeouts. A
|
|
85
|
+
* failure means "we do not know", and the honest rendering of not knowing is the screen
|
|
86
|
+
* exactly as it was before mates existed — not three rows put on screen by an error.
|
|
87
|
+
*/
|
|
88
|
+
test("false when the lookup throws", async () => {
|
|
89
|
+
const throwing = async () => {
|
|
90
|
+
throw new Error("marketplace unreachable");
|
|
91
|
+
};
|
|
92
|
+
expect(await areMatesAvailable(undefined, throwing)).toBe(false);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* `CLAUDEUP_MATES=1` — draw the slots on a machine that cannot serve them.
|
|
98
|
+
*
|
|
99
|
+
* It exists because the three rows ARE the feature: without the plugin installed there is no
|
|
100
|
+
* way to put them on screen, which leaves `kangaroo`'s eight cells — the widest thing this
|
|
101
|
+
* layout ever has to fit — as the one part nobody can check by eye.
|
|
102
|
+
*/
|
|
103
|
+
describe("the mate-slot override", () => {
|
|
104
|
+
test("accepts the affirmative spellings, and nothing else", () => {
|
|
105
|
+
for (const on of ["1", "true", "on", "yes", "TRUE", " On "]) {
|
|
106
|
+
expect(matesForced({ [MATE_FORCE_ENV]: on })).toBe(true);
|
|
107
|
+
}
|
|
108
|
+
// "0" and "false" are not merely unrecognised, they are the common way to try to turn
|
|
109
|
+
// a flag OFF. Reading either as true would be the worst possible misparse.
|
|
110
|
+
for (const off of ["0", "false", "off", "no", "", "maybe"]) {
|
|
111
|
+
expect(matesForced({ [MATE_FORCE_ENV]: off })).toBe(false);
|
|
112
|
+
}
|
|
113
|
+
expect(matesForced({})).toBe(false);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The flag SHORT-CIRCUITS, and a throwing lister is how that is proved.
|
|
118
|
+
*
|
|
119
|
+
* A lister that throws returns false through every other path in this file, so if the
|
|
120
|
+
* answer here is true, the registry was genuinely never consulted — which is the point:
|
|
121
|
+
* the network work behind it is the slow part, and its result would be discarded anyway.
|
|
122
|
+
*/
|
|
123
|
+
test("returns true without consulting the registry at all", async () => {
|
|
124
|
+
const throwing = async () => {
|
|
125
|
+
throw new Error("the registry must not be reached");
|
|
126
|
+
};
|
|
127
|
+
const original = process.env[MATE_FORCE_ENV];
|
|
128
|
+
process.env[MATE_FORCE_ENV] = "1";
|
|
129
|
+
try {
|
|
130
|
+
expect(await areMatesAvailable(undefined, throwing)).toBe(true);
|
|
131
|
+
} finally {
|
|
132
|
+
if (original === undefined) delete process.env[MATE_FORCE_ENV];
|
|
133
|
+
else process.env[MATE_FORCE_ENV] = original;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Negative control for the test above.
|
|
139
|
+
*
|
|
140
|
+
* Same lister, same call, flag absent — false. Without this pair, a bug that made
|
|
141
|
+
* `areMatesAvailable` return true unconditionally would pass the short-circuit test and
|
|
142
|
+
* look like proof of the flag.
|
|
143
|
+
*/
|
|
144
|
+
test("the same call is false once the flag is gone", async () => {
|
|
145
|
+
const throwing = async () => {
|
|
146
|
+
throw new Error("the registry must not be reached");
|
|
147
|
+
};
|
|
148
|
+
const original = process.env[MATE_FORCE_ENV];
|
|
149
|
+
delete process.env[MATE_FORCE_ENV];
|
|
150
|
+
try {
|
|
151
|
+
expect(await areMatesAvailable(undefined, throwing)).toBe(false);
|
|
152
|
+
} finally {
|
|
153
|
+
if (original !== undefined) process.env[MATE_FORCE_ENV] = original;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|