impel-cli 0.18.15-beta.9 → 0.18.15

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.
@@ -1,121 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { spawnSync } from "node:child_process";
4
-
5
- import {
6
- environmentValue,
7
- findNativeBinary,
8
- resolveNativeBinary,
9
- } from "./nativeProcess.js";
10
- import { PINNED_VENDOR_CLI_VERSIONS } from "./vendorCliVersions.js";
11
-
12
- export const MAC_VENDOR_SIGNING_TEAMS = Object.freeze({
13
- claude: "Q6L2SF6YDW",
14
- codex: "2DC432GLL2",
15
- });
16
-
17
- const VERSION_RE = /\b\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?\b/u;
18
-
19
- function vendorOverrideName(tool, environmentPrefix = "IMPEL") {
20
- if (tool === "claude") return `${environmentPrefix}_CLAUDE_BIN`;
21
- if (tool === "codex") return `${environmentPrefix}_CODEX_BIN`;
22
- return null;
23
- }
24
-
25
- /** Extract the vendor release from `claude --version` or `codex --version`. */
26
- export function parseVendorCliVersion(output) {
27
- return String(output || "").match(VERSION_RE)?.[0] || null;
28
- }
29
-
30
- /**
31
- * Accept only the exact reviewed macOS release and its vendor signature.
32
- * Explicit binary overrides remain authoritative for development and recovery.
33
- */
34
- export function verifyReviewedMacVendorCli(
35
- tool,
36
- binary,
37
- environment = process.env,
38
- {
39
- run = spawnSync,
40
- realpath = fs.realpathSync,
41
- versions = PINNED_VENDOR_CLI_VERSIONS,
42
- signingTeams = MAC_VENDOR_SIGNING_TEAMS,
43
- environmentPrefix = "IMPEL",
44
- } = {},
45
- ) {
46
- if (!versions[tool] || !signingTeams[tool]) return false;
47
- try {
48
- const override = vendorOverrideName(tool, environmentPrefix);
49
- const overriddenBinary = override ? environmentValue(environment, override) : null;
50
- if (overriddenBinary && path.resolve(overriddenBinary) === path.resolve(binary)) return true;
51
-
52
- const result = run(binary, ["--version"], {
53
- encoding: "utf8",
54
- env: environment,
55
- stdio: ["ignore", "pipe", "pipe"],
56
- timeout: 15_000,
57
- });
58
- if (result?.status !== 0 || result?.error) return false;
59
-
60
- const version = parseVendorCliVersion(`${result.stdout || ""}\n${result.stderr || ""}`);
61
- if (version !== versions[tool]) return false;
62
-
63
- const resolved = realpath(binary);
64
- const verified = run("/usr/bin/codesign", ["--verify", "--strict", resolved], {
65
- encoding: "utf8",
66
- stdio: ["ignore", "pipe", "pipe"],
67
- timeout: 15_000,
68
- });
69
- if (verified?.status !== 0 || verified?.error) return false;
70
- const details = run("/usr/bin/codesign", ["-dv", "--verbose=4", resolved], {
71
- encoding: "utf8",
72
- stdio: ["ignore", "pipe", "pipe"],
73
- timeout: 15_000,
74
- });
75
- return details?.status === 0
76
- && String(details.stderr || details.stdout || "").includes(`TeamIdentifier=${signingTeams[tool]}`);
77
- } catch {
78
- return false;
79
- }
80
- }
81
-
82
- /**
83
- * Locate the reviewed macOS vendor CLI. On other platforms this intentionally
84
- * preserves the existing native resolution behavior.
85
- */
86
- export function findReviewedVendorCliBinary(
87
- tool,
88
- environment = process.env,
89
- platform = process.platform,
90
- environmentPrefix = "IMPEL",
91
- {
92
- find = findNativeBinary,
93
- verify = verifyReviewedMacVendorCli,
94
- } = {},
95
- ) {
96
- if (platform !== "darwin") return find(tool, environment, platform, environmentPrefix);
97
- return find(
98
- tool,
99
- environment,
100
- platform,
101
- environmentPrefix,
102
- (binary) => verify(tool, binary, environment, { environmentPrefix }),
103
- );
104
- }
105
-
106
- /**
107
- * Resolve a launch target. macOS deliberately returns null when only an
108
- * unreviewed or version-drifted binary exists so callers can request repair
109
- * instead of silently launching it.
110
- */
111
- export function resolveReviewedVendorCliBinary(
112
- tool,
113
- environment = process.env,
114
- platform = process.platform,
115
- environmentPrefix = "IMPEL",
116
- ) {
117
- if (platform !== "darwin") {
118
- return resolveNativeBinary(tool, environment, platform, environmentPrefix);
119
- }
120
- return findReviewedVendorCliBinary(tool, environment, platform, environmentPrefix);
121
- }
@@ -1,7 +0,0 @@
1
- // Exact vendor CLI releases reviewed for this impel-cli build. Keep macOS and
2
- // Windows installers on the same versions; do not replace these with moving
3
- // channels such as "stable" or "latest".
4
- export const PINNED_VENDOR_CLI_VERSIONS = Object.freeze({
5
- claude: "2.1.212",
6
- codex: "0.146.0",
7
- });