@termwire/cli 0.4.1 → 0.5.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.
@@ -0,0 +1,168 @@
1
+ export const layoutTemplateIds = ["default", "three-window", "focused", "full-stack"];
2
+ const header = `// Termwire layout, written by \`termwire install\`.
3
+ // Pane commands are examples; edit them for your project.
4
+ `;
5
+ const definitions = [
6
+ {
7
+ id: "default",
8
+ title: "Editor and shell",
9
+ hint: "the built-in two-window layout",
10
+ preview: [
11
+ "editor",
12
+ "┌────────────────┐",
13
+ "│ nvim │",
14
+ "└────────────────┘",
15
+ "shell",
16
+ "┌────────────────┐",
17
+ "│ $ │",
18
+ "└────────────────┘",
19
+ ],
20
+ contents: `${header}{
21
+ "version": 1,
22
+ "windows": [
23
+ {
24
+ "name": "editor",
25
+ "panes": [{ "id": "editor", "role": "editor" }],
26
+ },
27
+ {
28
+ "name": "shell",
29
+ "panes": [{ "id": "shell" }],
30
+ },
31
+ ],
32
+ }
33
+ `,
34
+ },
35
+ {
36
+ id: "three-window",
37
+ title: "Three windows",
38
+ hint: "editor, a shell for an agent, and a plain shell",
39
+ preview: [
40
+ "editor",
41
+ "┌────────────────┐",
42
+ "│ nvim │",
43
+ "└────────────────┘",
44
+ "ai",
45
+ "┌────────────────┐",
46
+ "│ $ │",
47
+ "└────────────────┘",
48
+ "shell",
49
+ "┌────────────────┐",
50
+ "│ $ │",
51
+ "└────────────────┘",
52
+ ],
53
+ contents: `${header}{
54
+ "version": 1,
55
+ "windows": [
56
+ {
57
+ "name": "editor",
58
+ "panes": [{ "id": "editor", "role": "editor" }],
59
+ },
60
+ {
61
+ "name": "ai",
62
+ "panes": [{ "id": "ai" }],
63
+ },
64
+ {
65
+ "name": "shell",
66
+ "panes": [{ "id": "shell" }],
67
+ },
68
+ ],
69
+ }
70
+ `,
71
+ },
72
+ {
73
+ id: "focused",
74
+ title: "Focused coding",
75
+ hint: "one window: editor, OpenCode, and watched tests side by side",
76
+ preview: [
77
+ "work",
78
+ "┌─────────┬──────┐",
79
+ "│ nvim │ ai │",
80
+ "│ ├──────┤",
81
+ "│ │ test │",
82
+ "└─────────┴──────┘",
83
+ " right side: 40%",
84
+ ],
85
+ contents: `${header}{
86
+ "version": 1,
87
+ "windows": [
88
+ {
89
+ "name": "work",
90
+ "panes": [
91
+ { "id": "editor", "role": "editor" },
92
+ {
93
+ "id": "ai",
94
+ "splitFrom": "editor",
95
+ "direction": "horizontal",
96
+ "sizePercent": 40,
97
+ "command": ["opencode"],
98
+ },
99
+ {
100
+ "id": "tests",
101
+ "splitFrom": "ai",
102
+ "direction": "vertical",
103
+ "sizePercent": 40,
104
+ "command": ["bun", "test", "--watch"],
105
+ },
106
+ ],
107
+ },
108
+ ],
109
+ }
110
+ `,
111
+ },
112
+ {
113
+ id: "full-stack",
114
+ title: "Full stack",
115
+ hint: "code with watched tests, a dev server window, and a spare shell",
116
+ preview: [
117
+ "code",
118
+ "┌────────────────┐",
119
+ "│ nvim │",
120
+ "├────────────────┤",
121
+ "│ tests (35%) │",
122
+ "└────────────────┘",
123
+ "server",
124
+ "┌────────────────┐",
125
+ "│ dev server │",
126
+ "└────────────────┘",
127
+ "shell",
128
+ "┌────────────────┐",
129
+ "│ $ │",
130
+ "└────────────────┘",
131
+ ],
132
+ contents: `${header}{
133
+ "version": 1,
134
+ "windows": [
135
+ {
136
+ "name": "code",
137
+ "panes": [
138
+ { "id": "editor", "role": "editor" },
139
+ {
140
+ "id": "tests",
141
+ "splitFrom": "editor",
142
+ "direction": "vertical",
143
+ "sizePercent": 35,
144
+ "command": ["bun", "test", "--watch"],
145
+ },
146
+ ],
147
+ },
148
+ {
149
+ "name": "server",
150
+ "panes": [{ "id": "server", "command": ["bun", "run", "dev"] }],
151
+ },
152
+ {
153
+ "name": "shell",
154
+ "panes": [{ "id": "shell" }],
155
+ },
156
+ ],
157
+ }
158
+ `,
159
+ },
160
+ ];
161
+ /** Copies, so a caller can never mutate the registry other callers read. */
162
+ export function layoutTemplates() {
163
+ return definitions.map((template) => ({ ...template }));
164
+ }
165
+ export function findLayoutTemplate(id) {
166
+ const template = definitions.find((candidate) => candidate.id === id);
167
+ return template === undefined ? undefined : { ...template };
168
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@termwire/cli",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
+ "skills",
19
20
  "README.md",
20
21
  "LICENSE",
21
22
  "CHANGELOG.md"
@@ -37,8 +38,10 @@
37
38
  "url": "https://github.com/max-konin/termwire/issues"
38
39
  },
39
40
  "dependencies": {
40
- "@termwire/nvim": "^0.4.1",
41
- "@termwire/tmux": "^0.4.1",
41
+ "@clack/core": "^1.5.1",
42
+ "@clack/prompts": "^1.8.1",
43
+ "@termwire/nvim": "^0.5.0",
44
+ "@termwire/tmux": "^0.5.0",
42
45
  "commander": "^15.0.0",
43
46
  "jsonc-parser": "^3.3.1",
44
47
  "zod": "^4.0.0"
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: termwire-open
3
+ description: Show the user a file in their editor instead of pasting its path. Use whenever you mention a file worth looking at — a plan, a diff, a failing test, a file you just wrote. Needs a shell created by `termwire up`.
4
+ ---
5
+
6
+ # Show a file in the user's editor
7
+
8
+ ```bash
9
+ termwire open <path>[:<line>]
10
+ ```
11
+
12
+ - A trailing `:42` selects the line, so `src/app.ts:42` opens line 42.
13
+ - `--line 42` does the same and leaves the path alone, which is how to open a file whose
14
+ name ends in a colon and digits.
15
+ - A relative path resolves from the working directory. The command prints the absolute
16
+ path it opened.
17
+
18
+ The file opens in the Neovim of the user's workspace and the editor pane takes focus, so
19
+ the user is looking at the file rather than at a path they have to find.
20
+
21
+ ## When it does not work
22
+
23
+ It needs `TERMWIRE_SOCKET`, which `termwire up` exports into every pane of the
24
+ workspace. Started anywhere else, it fails with `not inside a termwire workspace` — then
25
+ name the path in your answer instead and carry on.
26
+
27
+ <!-- managed by `termwire install`; delete this line to keep your own version -->