@adhdev/ghostty-vt-node 1.0.83-rc.1 → 1.0.83-rc.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/ghostty-vt-node",
3
- "version": "1.0.83-rc.1",
3
+ "version": "1.0.83-rc.2",
4
4
  "description": "Native Node binding for libghostty-vt",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -19,16 +19,16 @@
19
19
  },
20
20
  "files": {
21
21
  "ghostty_vt_node.node": {
22
- "sha256": "dc33247d1de680b96e451a27e1103407e7ba9fb70a0a1fe3cba17c5aa34b458f",
23
- "size": 100536
22
+ "sha256": "f123534ed51344b5135fc2d16100ddba30e1a1d322c54bd7d14998cb63ead2a2",
23
+ "size": 118096
24
24
  },
25
25
  "libghostty-vt.0.1.0.dylib": {
26
- "sha256": "8b270a58ffd6125741f3d87d5e6e47be66129f9067236330c996e7c7cc24b547",
27
- "size": 1531560
26
+ "sha256": "24e5faa28c66ea03a2bc5de824ad2eb4532f1d49826c4047cfc93be45e0c15c7",
27
+ "size": 1418912
28
28
  },
29
29
  "libghostty-vt.dylib": {
30
- "sha256": "8b270a58ffd6125741f3d87d5e6e47be66129f9067236330c996e7c7cc24b547",
31
- "size": 1531560
30
+ "sha256": "24e5faa28c66ea03a2bc5de824ad2eb4532f1d49826c4047cfc93be45e0c15c7",
31
+ "size": 1418912
32
32
  }
33
33
  }
34
34
  }
@@ -16,6 +16,7 @@
16
16
  // the release job checks every committed prebuilt it is about to publish.
17
17
  // (d) host-paths every shipped native file is free of absolute home-directory
18
18
  // paths (ASCII and UTF-16LE), see scripts/host-path-scan.mjs.
19
+ // (e) gha-scrub reject hosted CI workspace prefixes in shipped native files.
19
20
  //
20
21
  // node scripts/check-prebuilts.mjs [--all-present]
21
22
  import { spawnSync } from 'node:child_process';
@@ -132,6 +133,15 @@ if (process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1
132
133
  results.nativeCi = existsSync(WORKFLOW_DIR) ? checkNativeCi() : (console.log('[ghostty-vt] no .github/workflows next to this package (npm install); skipped'), true);
133
134
  console.log('── (d) shipped native files carry no host paths');
134
135
  results.hostPaths = printHostPathReport(scanHostPaths());
136
+ console.log('── (e) official GHA runner /work/ prefixes scrubbed from shipped natives');
137
+ {
138
+ const check = spawnSync(process.execPath, [join(PACKAGE_DIR, 'scripts', 'scrub-gha-workspace-paths.mjs'), '--check'], {
139
+ cwd: PACKAGE_DIR, encoding: 'utf8', windowsHide: true,
140
+ });
141
+ const ok = check.status === 0;
142
+ console.log(` ${ok ? '✓' : '✗'} scrub-gha-workspace-paths --check: ${(check.stdout || check.stderr || '').trim().split('\n').pop()}`);
143
+ results.ghaScrub = ok;
144
+ }
135
145
  const failed = Object.entries(results).filter(([, ok]) => !ok).map(([name]) => name);
136
146
  if (failed.length) {
137
147
  console.error(`✗ ghostty-vt-node prebuilt gate failed: ${failed.join(', ')}`);
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env node
2
+ // Check shipped native files for hosted CI workspace prefixes. Binary changes
3
+ // need format-specific tooling and signature verification before promotion.
4
+ // node scripts/scrub-gha-workspace-paths.mjs --check [<file-or-dir>...]
5
+ import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
6
+ import { join, relative } from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ import { PACKAGE_DIR } from './binding-digest.mjs';
10
+ import { PREBUILT_ROOT, RUNTIME_FILE_PATTERN, SHIPPED_TRIPLETS } from './prebuilt-manifest.mjs';
11
+
12
+ // Equal-length neutral stand-ins (Mach-O/PE string tables stay aligned).
13
+ // Must NOT match personal-paths `/(Users|home)/<name>` or `X:\Users\<name>\`.
14
+ function equalLengthNeutral(from, posixStem) {
15
+ if (from.length < posixStem.length) {
16
+ throw new Error(`scrub stem too long for ${JSON.stringify(from)}`);
17
+ }
18
+ const to = posixStem + 'x'.repeat(from.length - posixStem.length);
19
+ if (to.length !== from.length) throw new Error('scrub pad failed');
20
+ return to;
21
+ }
22
+
23
+ export const GHA_WORKSPACE_SCRUBS = Object.freeze(
24
+ ['runner', 'runneradmin'].flatMap((account) =>
25
+ ['/Users/', '/home/', 'C:/Users/', 'C:\\Users\\'].map((root) => {
26
+ const separator = root.at(-1);
27
+ const from = root + account + separator + 'work' + separator;
28
+ const stem = separator === '\\' ? 'C:\\tmp\\gvn\\work\\'
29
+ : root.startsWith('C:') ? 'C:/tmp/gvn/work/' : '/tmp/gvn/work/';
30
+ return Object.freeze({ from, to: equalLengthNeutral(from, stem) });
31
+ })),
32
+ );
33
+
34
+ function utf16lePattern(ascii) {
35
+ const out = Buffer.alloc(ascii.length * 2);
36
+ for (let i = 0; i < ascii.length; i++) out[i * 2] = ascii.charCodeAt(i);
37
+ return out;
38
+ }
39
+
40
+ export function scrubGithubActionsWorkspacePaths(input) {
41
+ let bytes = Buffer.from(input);
42
+ let replacements = 0;
43
+ for (const { from, to } of GHA_WORKSPACE_SCRUBS) {
44
+ const needles = [Buffer.from(from, 'utf8'), utf16lePattern(from)];
45
+ const reps = [Buffer.from(to, 'utf8'), utf16lePattern(to)];
46
+ for (let n = 0; n < needles.length; n++) {
47
+ const needle = needles[n];
48
+ const rep = reps[n];
49
+ let offset = 0;
50
+ for (;;) {
51
+ const at = bytes.indexOf(needle, offset);
52
+ if (at < 0) break;
53
+ rep.copy(bytes, at);
54
+ replacements++;
55
+ offset = at + rep.length;
56
+ }
57
+ }
58
+ }
59
+ return { bytes, replacements };
60
+ }
61
+
62
+ function runtimeFilesUnder(root) {
63
+ const out = [];
64
+ const walk = (dir) => {
65
+ for (const name of readdirSync(dir)) {
66
+ const path = join(dir, name);
67
+ const st = statSync(path);
68
+ if (st.isDirectory()) walk(path);
69
+ else if (RUNTIME_FILE_PATTERN.test(name)) out.push(path);
70
+ }
71
+ };
72
+ walk(root);
73
+ return out.sort();
74
+ }
75
+
76
+ function defaultTargets() {
77
+ return SHIPPED_TRIPLETS.flatMap((triplet) => {
78
+ const dir = join(PREBUILT_ROOT, triplet);
79
+ return existsSync(dir) ? runtimeFilesUnder(dir) : [];
80
+ });
81
+ }
82
+
83
+ function checkFiles(paths) {
84
+ const results = [];
85
+ for (const path of paths) {
86
+ const before = readFileSync(path);
87
+ const { replacements } = scrubGithubActionsWorkspacePaths(before);
88
+ results.push({
89
+ path: relative(PACKAGE_DIR, path) || path,
90
+ replacements,
91
+ changed: replacements > 0,
92
+ });
93
+ }
94
+ return results;
95
+ }
96
+
97
+ function main(argv) {
98
+ if (!argv.includes('--check')) {
99
+ throw new Error('Only --check is supported for native files');
100
+ }
101
+ const targets = argv.filter((a) => a !== '--check');
102
+ const paths = targets.length
103
+ ? targets.flatMap((t) => (statSync(t).isDirectory() ? runtimeFilesUnder(t) : [t]))
104
+ : defaultTargets();
105
+ const results = checkFiles(paths);
106
+ const changed = results.filter((r) => r.changed);
107
+ for (const r of results) {
108
+ console.log(`${r.changed ? 'dirty' : 'clean'} ${r.replacements} ${r.path}`);
109
+ }
110
+ if (changed.length) {
111
+ console.error(`scrub-gha-workspace-paths: ${changed.length} file(s) still contain GHA /work/ prefixes`);
112
+ process.exit(1);
113
+ }
114
+ console.log(`scrub-gha-workspace-paths: ${changed.length} file(s) dirty, ${paths.length} scanned`);
115
+ }
116
+
117
+ if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
118
+ main(process.argv.slice(2));
119
+ }