@house365/comate 0.2.2 → 0.2.4
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/bin/init-run.mjs +28 -23
- package/package.json +1 -1
package/bin/init-run.mjs
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
MIN_OPENSPEC,
|
|
7
7
|
NPM_TIMEOUT_MS,
|
|
8
8
|
SKILLS_TIMEOUT_MS,
|
|
9
|
-
capture,
|
|
10
9
|
npmInvocation,
|
|
11
10
|
openSpecState,
|
|
12
11
|
run,
|
|
@@ -163,39 +162,45 @@ export function pkgVersion(root = resolve(import.meta.dirname, '..')) {
|
|
|
163
162
|
}
|
|
164
163
|
}
|
|
165
164
|
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
|
|
165
|
+
// Only CI gates the wordmark. Two earlier guards were both wrong and are worth
|
|
166
|
+
// naming so they don't come back:
|
|
167
|
+
//
|
|
168
|
+
// isTTY — npm's Windows global install resolves `comate` to a comate.ps1
|
|
169
|
+
// shim, and PowerShell calling node through a .ps1 wrapper takes over stdout,
|
|
170
|
+
// so isTTY is false in a real terminal — exactly where the logo belongs.
|
|
171
|
+
//
|
|
172
|
+
// chcp — reports the codepage the child process inherited, which the shim
|
|
173
|
+
// does not propagate (65001 outside, 936 inside). It also answers the wrong
|
|
174
|
+
// question: writing to a real Windows console goes through WriteConsoleW,
|
|
175
|
+
// which converts to UTF-16 and bypasses the codepage entirely.
|
|
176
|
+
export function banner(version, { ci = isCI() } = {}) {
|
|
172
177
|
const tag = `comate${version ? ` v${version}` : ''}`;
|
|
173
|
-
const plain = `\n ${tag}
|
|
174
|
-
if (
|
|
178
|
+
const plain = `\n ${tag} - AI coding almost there!\n`;
|
|
179
|
+
if (ci) return plain;
|
|
175
180
|
|
|
176
181
|
const art = [
|
|
177
|
-
'██████╗ ██████╗ ███╗ ███╗ █████╗
|
|
178
|
-
'
|
|
179
|
-
'██║ ██║ ██║██╔████╔██║███████║ ██║',
|
|
180
|
-
'██║ ██║ ██║██║╚██╔╝██║██╔══██║ ██║',
|
|
181
|
-
'╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ██║ ██║',
|
|
182
|
-
' ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝',
|
|
182
|
+
' ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗███████╗',
|
|
183
|
+
'██╔════╝██╔═══██╗████╗ ████║██╔══██╗╚══██╔══╝██╔════╝',
|
|
184
|
+
'██║ ██║ ██║██╔████╔██║███████║ ██║ █████╗ ',
|
|
185
|
+
'██║ ██║ ██║██║╚██╔╝██║██╔══██║ ██║ ██╔══╝ ',
|
|
186
|
+
'╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ███████╗',
|
|
187
|
+
' ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝',
|
|
183
188
|
];
|
|
184
189
|
const cyan = (s) => (process.env.NO_COLOR ? s : `\x1B[36m${s}\x1B[0m`);
|
|
185
190
|
const dim = (s) => (process.env.NO_COLOR ? s : `\x1B[2m${s}\x1B[0m`);
|
|
186
191
|
return [
|
|
187
192
|
'',
|
|
188
|
-
|
|
193
|
+
// Trailing padding keeps the source rows aligned; strip it so the colour
|
|
194
|
+
// reset doesn't sit behind spaces the terminal may highlight on select.
|
|
195
|
+
...art.map((line) => ` ${cyan(line.replace(/\s+$/, ''))}`),
|
|
189
196
|
'',
|
|
190
|
-
` ${dim(`${tag}
|
|
197
|
+
` ${dim(`${tag} - AI coding almost there!`)}`,
|
|
191
198
|
'',
|
|
192
199
|
].join('\n');
|
|
193
200
|
}
|
|
194
201
|
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (process.platform !== 'win32') return true;
|
|
200
|
-
return /65001/.test(capture('chcp', []) ?? '');
|
|
202
|
+
// Every major CI sets CI=true; GITHUB_ACTIONS covers the Actions runner even in
|
|
203
|
+
// the odd config that doesn't.
|
|
204
|
+
function isCI() {
|
|
205
|
+
return Boolean(process.env.CI || process.env.GITHUB_ACTIONS);
|
|
201
206
|
}
|