tmux-ide 1.0.0 → 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/README.md +84 -35
- package/bin/cli.js +127 -85
- package/package.json +26 -5
- package/scripts/postinstall.js +46 -7
- package/skill/SKILL.md +28 -12
- package/src/attach.js +7 -10
- package/src/config.js +94 -7
- package/src/detect.js +77 -23
- package/src/doctor.js +23 -14
- package/src/init.js +16 -18
- package/src/inspect.js +127 -0
- package/src/launch.js +171 -177
- package/src/lib/launch-plan.js +83 -0
- package/src/lib/output.js +21 -4
- package/src/lib/tmux.js +200 -0
- package/src/ls.js +2 -4
- package/src/restart.js +5 -12
- package/src/status.js +4 -22
- package/src/stop.js +10 -9
- package/src/validate.js +0 -16
- package/src/detect.test.js +0 -115
- package/src/integration.test.js +0 -94
- package/src/lib/dot-path.test.js +0 -67
- package/src/lib/sizes.test.js +0 -74
- package/src/validate.test.js +0 -141
package/src/validate.test.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { describe, it } from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import { validateConfig } from "./validate.js";
|
|
4
|
-
|
|
5
|
-
describe("validateConfig", () => {
|
|
6
|
-
it("accepts a valid minimal config", () => {
|
|
7
|
-
const errors = validateConfig({ rows: [{ panes: [{}] }] });
|
|
8
|
-
assert.deepStrictEqual(errors, []);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("accepts a valid full config", () => {
|
|
12
|
-
const errors = validateConfig({
|
|
13
|
-
name: "my-project",
|
|
14
|
-
before: "pnpm install",
|
|
15
|
-
rows: [
|
|
16
|
-
{
|
|
17
|
-
size: "70%",
|
|
18
|
-
panes: [
|
|
19
|
-
{ title: "Editor", command: "vim", dir: "src", size: "60%", focus: true, env: { PORT: 3000, HOST: "localhost" } },
|
|
20
|
-
{ title: "Shell" },
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
panes: [{ title: "Dev", command: "pnpm dev" }],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
theme: { accent: "colour75", border: "colour238", bg: "colour235", fg: "colour248" },
|
|
28
|
-
});
|
|
29
|
-
assert.deepStrictEqual(errors, []);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("rejects null config", () => {
|
|
33
|
-
const errors = validateConfig(null);
|
|
34
|
-
assert.deepStrictEqual(errors, ["config must be an object"]);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("rejects string config", () => {
|
|
38
|
-
const errors = validateConfig("hello");
|
|
39
|
-
assert.deepStrictEqual(errors, ["config must be an object"]);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("rejects array config", () => {
|
|
43
|
-
const errors = validateConfig([]);
|
|
44
|
-
assert.deepStrictEqual(errors, ["config must be an object"]);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("requires rows to be an array", () => {
|
|
48
|
-
const errors = validateConfig({ rows: "nope" });
|
|
49
|
-
assert.ok(errors.includes("'rows' must be an array"));
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("requires rows to be non-empty", () => {
|
|
53
|
-
const errors = validateConfig({ rows: [] });
|
|
54
|
-
assert.ok(errors.includes("'rows' must not be empty"));
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("requires rows to have a panes array", () => {
|
|
58
|
-
const errors = validateConfig({ rows: [{}] });
|
|
59
|
-
assert.ok(errors.includes("rows[0].panes must be an array"));
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("requires panes to be non-empty", () => {
|
|
63
|
-
const errors = validateConfig({ rows: [{ panes: [] }] });
|
|
64
|
-
assert.ok(errors.includes("rows[0].panes must not be empty"));
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("rejects non-string name", () => {
|
|
68
|
-
const errors = validateConfig({ name: 123, rows: [{ panes: [{}] }] });
|
|
69
|
-
assert.ok(errors.includes("'name' must be a string"));
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it("rejects non-string before", () => {
|
|
73
|
-
const errors = validateConfig({ before: true, rows: [{ panes: [{}] }] });
|
|
74
|
-
assert.ok(errors.includes("'before' must be a string"));
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("rejects non-string pane.title", () => {
|
|
78
|
-
const errors = validateConfig({ rows: [{ panes: [{ title: 42 }] }] });
|
|
79
|
-
assert.ok(errors.includes("rows[0].panes[0].title must be a string"));
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it("rejects non-string pane.command", () => {
|
|
83
|
-
const errors = validateConfig({ rows: [{ panes: [{ command: false }] }] });
|
|
84
|
-
assert.ok(errors.includes("rows[0].panes[0].command must be a string"));
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it("rejects non-string pane.dir", () => {
|
|
88
|
-
const errors = validateConfig({ rows: [{ panes: [{ dir: [] }] }] });
|
|
89
|
-
assert.ok(errors.includes("rows[0].panes[0].dir must be a string"));
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("rejects non-boolean pane.focus", () => {
|
|
93
|
-
const errors = validateConfig({ rows: [{ panes: [{ focus: "yes" }] }] });
|
|
94
|
-
assert.ok(errors.includes("rows[0].panes[0].focus must be a boolean"));
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("rejects non-object pane.env", () => {
|
|
98
|
-
const errors = validateConfig({ rows: [{ panes: [{ env: "PORT=3000" }] }] });
|
|
99
|
-
assert.ok(errors.includes("rows[0].panes[0].env must be an object"));
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("rejects invalid env values", () => {
|
|
103
|
-
const errors = validateConfig({ rows: [{ panes: [{ env: { PORT: true } }] }] });
|
|
104
|
-
assert.ok(errors.includes("rows[0].panes[0].env.PORT must be a string or number"));
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it("rejects size without % suffix", () => {
|
|
108
|
-
const errors = validateConfig({ rows: [{ size: "70", panes: [{}] }] });
|
|
109
|
-
assert.ok(errors.some((e) => e.includes('must be a percentage')));
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it("rejects 0% size", () => {
|
|
113
|
-
const errors = validateConfig({ rows: [{ size: "0%", panes: [{}] }] });
|
|
114
|
-
assert.ok(errors.some((e) => e.includes("must not be 0%")));
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it("rejects >100% size", () => {
|
|
118
|
-
const errors = validateConfig({ rows: [{ panes: [{ size: "150%" }] }] });
|
|
119
|
-
assert.ok(errors.some((e) => e.includes("must not exceed 100%")));
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it("validates theme fields as strings", () => {
|
|
123
|
-
const errors = validateConfig({ rows: [{ panes: [{}] }], theme: { accent: 123 } });
|
|
124
|
-
assert.ok(errors.includes("theme.accent must be a string"));
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("rejects non-object theme", () => {
|
|
128
|
-
const errors = validateConfig({ rows: [{ panes: [{}] }], theme: "blue" });
|
|
129
|
-
assert.ok(errors.includes("'theme' must be an object"));
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("collects multiple errors at once", () => {
|
|
133
|
-
const errors = validateConfig({
|
|
134
|
-
name: 123,
|
|
135
|
-
before: [],
|
|
136
|
-
rows: [{ panes: [{ title: 42, focus: "yes", size: "0%" }] }],
|
|
137
|
-
theme: "nope",
|
|
138
|
-
});
|
|
139
|
-
assert.ok(errors.length >= 4);
|
|
140
|
-
});
|
|
141
|
-
});
|