@scania/tegel-lite 0.0.3-rules-beta.5 → 0.0.3-rules-beta.6
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/.github/copilot-instructions.md +1 -1
- package/AGENTS.md +1 -1
- package/CLAUDE.md +1 -1
- package/bin/setup-ai-rules.js +70 -40
- package/dist/components.css +3 -3
- package/dist/tl-message.css +3 -3
- package/package.json +1 -1
package/AGENTS.md
CHANGED
package/CLAUDE.md
CHANGED
package/bin/setup-ai-rules.js
CHANGED
|
@@ -47,6 +47,14 @@ const TOOLS = [
|
|
|
47
47
|
targetFile: path.join(projectRoot, '.github', 'copilot-instructions.md'),
|
|
48
48
|
mode: 'aggregated',
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
id: 'claude',
|
|
52
|
+
label: 'Claude',
|
|
53
|
+
description: 'CLAUDE.md',
|
|
54
|
+
sourceFile: path.join(packageRoot, 'CLAUDE.md'),
|
|
55
|
+
targetFile: path.join(projectRoot, 'CLAUDE.md'),
|
|
56
|
+
mode: 'aggregated',
|
|
57
|
+
},
|
|
50
58
|
];
|
|
51
59
|
|
|
52
60
|
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
@@ -95,6 +103,9 @@ function askYesNo(rl, question) {
|
|
|
95
103
|
/**
|
|
96
104
|
* Display an interactive checkbox list in the terminal.
|
|
97
105
|
* Arrow keys navigate, space toggles, enter confirms.
|
|
106
|
+
*
|
|
107
|
+
* Uses readline.emitKeypressEvents to correctly parse multi-byte
|
|
108
|
+
* escape sequences (arrow keys) across all platforms.
|
|
98
109
|
*/
|
|
99
110
|
function showCheckboxList(items) {
|
|
100
111
|
return new Promise((resolve) => {
|
|
@@ -103,17 +114,18 @@ function showCheckboxList(items) {
|
|
|
103
114
|
|
|
104
115
|
const { stdin, stdout } = process;
|
|
105
116
|
|
|
106
|
-
//
|
|
117
|
+
// Non-interactive fallback (e.g. CI, piped input)
|
|
107
118
|
if (!stdin.isTTY) {
|
|
108
119
|
console.log('Non-interactive terminal detected. Selecting all tools.');
|
|
109
120
|
resolve(items.map((_, i) => i));
|
|
110
121
|
return;
|
|
111
122
|
}
|
|
112
123
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
124
|
+
// ── Rendering ───────────────────────────────────────────────
|
|
125
|
+
|
|
126
|
+
let rendered = false;
|
|
116
127
|
|
|
128
|
+
function render() {
|
|
117
129
|
const lines = items.map((item, i) => {
|
|
118
130
|
const checkbox = selected[i] ? '\x1B[32m◉\x1B[0m' : '○';
|
|
119
131
|
const pointer = i === cursor ? '\x1B[36m❯\x1B[0m ' : ' ';
|
|
@@ -127,61 +139,79 @@ function showCheckboxList(items) {
|
|
|
127
139
|
return lines.join('\n');
|
|
128
140
|
}
|
|
129
141
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
142
|
+
function rerender() {
|
|
143
|
+
if (rendered) {
|
|
144
|
+
// Move up to overwrite previous output
|
|
145
|
+
// items.length + 1 (empty line) + 1 (help text) + 1 (trailing newline)
|
|
146
|
+
const lineCount = items.length + 3;
|
|
147
|
+
readline.moveCursor(stdout, 0, -lineCount);
|
|
148
|
+
readline.clearScreenDown(stdout);
|
|
149
|
+
}
|
|
135
150
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
stdout.write(render());
|
|
152
|
+
stdout.write('\n');
|
|
153
|
+
rendered = true;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// ── Cleanup ─────────────────────────────────────────────────
|
|
157
|
+
|
|
158
|
+
function cleanup() {
|
|
159
|
+
stdin.setRawMode(false);
|
|
160
|
+
stdin.removeAllListeners('keypress');
|
|
161
|
+
stdin.pause();
|
|
162
|
+
stdout.write('\x1B[?25h'); // Show cursor
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ── Keypress handler ────────────────────────────────────────
|
|
166
|
+
|
|
167
|
+
function onKeypress(_, key) {
|
|
168
|
+
if (!key) return;
|
|
169
|
+
|
|
170
|
+
// Ctrl+C → exit
|
|
171
|
+
if (key.ctrl && key.name === 'c') {
|
|
172
|
+
cleanup();
|
|
173
|
+
stdout.write('\n');
|
|
146
174
|
process.exit(0);
|
|
147
175
|
}
|
|
148
176
|
|
|
149
|
-
// Enter
|
|
150
|
-
if (key === '
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
stdout.write('\x1B[?25h\n'); // Show cursor
|
|
177
|
+
// Enter → confirm selection
|
|
178
|
+
if (key.name === 'return') {
|
|
179
|
+
cleanup();
|
|
180
|
+
stdout.write('\n');
|
|
154
181
|
resolve(selected.reduce((acc, sel, i) => (sel ? [...acc, i] : acc), []));
|
|
155
182
|
return;
|
|
156
183
|
}
|
|
157
184
|
|
|
158
|
-
// Space
|
|
159
|
-
if (key === '
|
|
185
|
+
// Space → toggle current item
|
|
186
|
+
if (key.name === 'space') {
|
|
160
187
|
selected[cursor] = !selected[cursor];
|
|
161
188
|
}
|
|
162
189
|
|
|
163
|
-
//
|
|
164
|
-
if (key === '
|
|
190
|
+
// Up arrow or k → move cursor up
|
|
191
|
+
if (key.name === 'up' || key.name === 'k') {
|
|
165
192
|
cursor = (cursor - 1 + items.length) % items.length;
|
|
166
193
|
}
|
|
167
194
|
|
|
168
|
-
//
|
|
169
|
-
if (key === '
|
|
195
|
+
// Down arrow or j → move cursor down
|
|
196
|
+
if (key.name === 'down' || key.name === 'j') {
|
|
170
197
|
cursor = (cursor + 1) % items.length;
|
|
171
198
|
}
|
|
172
199
|
|
|
173
|
-
|
|
174
|
-
// +3 because we have: items.length + empty line + help text + our newline
|
|
175
|
-
const lineCount = items.length + 3;
|
|
176
|
-
// Move to start of line, move up lineCount lines, clear from cursor to end of screen
|
|
177
|
-
stdout.write('\r');
|
|
178
|
-
stdout.write(`\x1B[${lineCount}A`);
|
|
179
|
-
stdout.write('\x1B[0J');
|
|
180
|
-
stdout.write(render());
|
|
181
|
-
stdout.write('\n');
|
|
200
|
+
rerender();
|
|
182
201
|
}
|
|
183
202
|
|
|
184
|
-
|
|
203
|
+
// ── Start listening ─────────────────────────────────────────
|
|
204
|
+
|
|
205
|
+
readline.emitKeypressEvents(stdin);
|
|
206
|
+
|
|
207
|
+
stdin.setRawMode(true);
|
|
208
|
+
stdin.resume();
|
|
209
|
+
|
|
210
|
+
stdin.on('keypress', onKeypress);
|
|
211
|
+
|
|
212
|
+
// Initial render
|
|
213
|
+
stdout.write('\x1B[?25l'); // Hide cursor
|
|
214
|
+
rerender();
|
|
185
215
|
});
|
|
186
216
|
}
|
|
187
217
|
|
package/dist/components.css
CHANGED
|
@@ -5053,7 +5053,7 @@ body {
|
|
|
5053
5053
|
display: none;
|
|
5054
5054
|
}
|
|
5055
5055
|
|
|
5056
|
-
.tl-
|
|
5056
|
+
.tl-message__text {
|
|
5057
5057
|
display: flex;
|
|
5058
5058
|
flex-direction: column;
|
|
5059
5059
|
gap: 4px;
|
|
@@ -5081,7 +5081,7 @@ body {
|
|
|
5081
5081
|
color: var(--message-error-header-text-color);
|
|
5082
5082
|
}
|
|
5083
5083
|
|
|
5084
|
-
.tl-
|
|
5084
|
+
.tl-message__subheader {
|
|
5085
5085
|
font-family: var(--detail-02-font-family);
|
|
5086
5086
|
font-size: var(--detail-02-font-size);
|
|
5087
5087
|
line-height: var(--detail-02-line-height);
|
|
@@ -5090,7 +5090,7 @@ body {
|
|
|
5090
5090
|
text-transform: var(--detail-02-text-transform);
|
|
5091
5091
|
color: var(--message-main-text-color);
|
|
5092
5092
|
}
|
|
5093
|
-
.tl-message--minimal .tl-
|
|
5093
|
+
.tl-message--minimal .tl-message__subheader {
|
|
5094
5094
|
display: none;
|
|
5095
5095
|
}
|
|
5096
5096
|
|
package/dist/tl-message.css
CHANGED
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
display: none;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
.tl-
|
|
91
|
+
.tl-message__text {
|
|
92
92
|
display: flex;
|
|
93
93
|
flex-direction: column;
|
|
94
94
|
gap: 4px;
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
color: var(--message-error-header-text-color);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
.tl-
|
|
119
|
+
.tl-message__subheader {
|
|
120
120
|
font-family: var(--detail-02-font-family);
|
|
121
121
|
font-size: var(--detail-02-font-size);
|
|
122
122
|
line-height: var(--detail-02-line-height);
|
|
@@ -125,6 +125,6 @@
|
|
|
125
125
|
text-transform: var(--detail-02-text-transform);
|
|
126
126
|
color: var(--message-main-text-color);
|
|
127
127
|
}
|
|
128
|
-
.tl-message--minimal .tl-
|
|
128
|
+
.tl-message--minimal .tl-message__subheader {
|
|
129
129
|
display: none;
|
|
130
130
|
}
|