@pylair/cli 0.1.0-rc.2 → 0.1.0-rc.20

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.
Files changed (65) hide show
  1. package/README.md +3 -2
  2. package/dist/bin.d.ts +3 -0
  3. package/dist/bin.d.ts.map +1 -0
  4. package/dist/bin.js +7 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/build/bytecode.d.ts +29 -0
  7. package/dist/build/bytecode.d.ts.map +1 -0
  8. package/dist/build/bytecode.js +64 -0
  9. package/dist/build/bytecode.js.map +1 -0
  10. package/dist/build/download.d.ts +53 -0
  11. package/dist/build/download.d.ts.map +1 -0
  12. package/dist/build/download.js +326 -0
  13. package/dist/build/download.js.map +1 -0
  14. package/dist/build/notices.d.ts +10 -0
  15. package/dist/build/notices.d.ts.map +1 -0
  16. package/dist/build/notices.js +108 -0
  17. package/dist/build/notices.js.map +1 -0
  18. package/dist/build/pbs.d.ts +12 -0
  19. package/dist/build/pbs.d.ts.map +1 -0
  20. package/dist/build/pbs.js +36 -0
  21. package/dist/build/pbs.js.map +1 -0
  22. package/dist/build/python.d.ts +19 -0
  23. package/dist/build/python.d.ts.map +1 -0
  24. package/dist/build/python.js +109 -0
  25. package/dist/build/python.js.map +1 -0
  26. package/dist/build/sign.d.ts +4 -0
  27. package/dist/build/sign.d.ts.map +1 -0
  28. package/dist/build/sign.js +108 -0
  29. package/dist/build/sign.js.map +1 -0
  30. package/dist/build/source.d.ts +16 -0
  31. package/dist/build/source.d.ts.map +1 -0
  32. package/dist/build/source.js +85 -0
  33. package/dist/build/source.js.map +1 -0
  34. package/dist/build/util.d.ts +4 -0
  35. package/dist/build/util.d.ts.map +1 -0
  36. package/dist/build/util.js +12 -0
  37. package/dist/build/util.js.map +1 -0
  38. package/dist/build.d.ts +6 -8
  39. package/dist/build.d.ts.map +1 -1
  40. package/dist/build.js +88 -227
  41. package/dist/build.js.map +1 -1
  42. package/dist/capabilities.d.ts +51 -0
  43. package/dist/capabilities.d.ts.map +1 -0
  44. package/dist/capabilities.js +232 -0
  45. package/dist/capabilities.js.map +1 -0
  46. package/dist/cli.d.ts +16 -1
  47. package/dist/cli.d.ts.map +1 -1
  48. package/dist/cli.js +77 -20
  49. package/dist/cli.js.map +1 -1
  50. package/dist/codegen.d.ts.map +1 -1
  51. package/dist/codegen.js +10 -1
  52. package/dist/codegen.js.map +1 -1
  53. package/dist/config.d.ts +14 -2
  54. package/dist/config.d.ts.map +1 -1
  55. package/dist/config.js +31 -11
  56. package/dist/config.js.map +1 -1
  57. package/dist/dev.d.ts +4 -0
  58. package/dist/dev.d.ts.map +1 -1
  59. package/dist/dev.js +15 -7
  60. package/dist/dev.js.map +1 -1
  61. package/dist/doctor.d.ts +3 -0
  62. package/dist/doctor.d.ts.map +1 -1
  63. package/dist/doctor.js +23 -3
  64. package/dist/doctor.js.map +1 -1
  65. package/package.json +6 -2
package/dist/build.js CHANGED
@@ -3,239 +3,56 @@
3
3
  * interpreter (native wheels only — no cross-compile) → stage app
4
4
  * source → prune → tauri build → unsigned warning.
5
5
  */
6
- import { createHash } from "node:crypto";
7
- import { execFileSync, spawnSync } from "node:child_process";
8
- import { cpSync, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync, } from "node:fs";
9
- import { get } from "node:https";
6
+ /*
7
+ * Where each step lives. build() below calls into them; this file also
8
+ * re-exports the helpers other modules and the tests import from here.
9
+ *
10
+ * build/pbs.ts python-build-standalone release, versions, host
11
+ * triples, committed SHA-256 table, hostTriple()
12
+ * build/download.ts the interpreter download: retry, resume, progress,
13
+ * timeout, cache and SHA-256 check (ensureTarball)
14
+ * build/python.ts fetchPython (unpack CPython), uv export and
15
+ * `uv pip install` into site-packages (stageEnv)
16
+ * build/source.ts stageSource: copy the app source, refuse secrets
17
+ * build/notices.ts stageNotices: THIRD-PARTY-NOTICES for the bundle
18
+ * build/bytecode.ts compileBytecode: checked-hash pycs for the bundle
19
+ * build/sign.ts macOS ad-hoc signing of the built .app (adHocSign)
20
+ * build/util.ts isWin and run(), shared by build() and the modules
21
+ * ./prune.ts pruning the staged tree (DEFAULT_PRUNE, prune)
22
+ * ./config.ts [tool.pylair] and tauri.conf.json loading
23
+ */
24
+ import { spawnSync } from "node:child_process";
25
+ import { existsSync, rmSync } from "node:fs";
10
26
  import { arch, platform, tmpdir } from "node:os";
11
27
  import { join } from "node:path";
12
28
  import { fileURLToPath } from "node:url";
13
- import { importRoot, loadConfig, loadTauriConfig, tauriCliEntry } from "./config.js";
29
+ import { importRoot, loadConfig, loadTauriConfig, tauriCliEntry, windowsSigningConfigured, } from "./config.js";
30
+ import { assertCapabilities, checkPatterns, formatFinding, loadCapabilities } from "./capabilities.js";
31
+ import { loadManifest } from "./manifest.js";
14
32
  import { DEFAULT_PRUNE, prune } from "./prune.js";
15
- const PBS_TAG = "20251120";
16
- const PBS_VERSIONS = { "3.12": "3.12.12", "3.13": "3.13.9" };
17
- const HOST_TRIPLES = {
18
- "darwin:arm64": "aarch64-apple-darwin",
19
- "darwin:x64": "x86_64-apple-darwin",
20
- "win32:x64": "x86_64-pc-windows-msvc",
21
- "linux:x64": "x86_64-unknown-linux-gnu",
22
- "linux:arm64": "aarch64-unknown-linux-gnu",
23
- };
24
- const isWin = platform() === "win32";
25
- /** Expected SHA256 per asset, committed in-repo — a hash fetched from the
26
- * same release as the tarball catches corruption but not a tampered
27
- * release. Bump together with PBS_TAG/PBS_VERSIONS; verify each value
28
- * against upstream SHA256SUMS before committing.
29
- */
30
- const PBS_SHA256 = {
31
- "3.12.12-aarch64-apple-darwin": "9955ac87eff0d561e64920dc46fd8625912d2c2be4a53c66ad80125d6d9fbdb7",
32
- "3.12.12-aarch64-unknown-linux-gnu": "4c4594cb38ddf6769f11f86818a4c6617652f4994e5a962eb4f8cf0ec977a1be",
33
- "3.12.12-x86_64-apple-darwin": "1b4d8eec597ff69a3b67946f30622a6c25c6612e6d15aa431b864ebff66ac8a1",
34
- "3.12.12-x86_64-pc-windows-msvc": "70ecfaf0bfc58298db11d6389be92c29ec4ef8cd93ebb6a7e54b41d9fc056b10",
35
- "3.12.12-x86_64-unknown-linux-gnu": "8d2cd1393c1aec9d701cebeccb83d1519951f71d3ecb42d5e70c70af4db9be34",
36
- "3.13.9-aarch64-apple-darwin": "29d38bd5fbe267b37cecac990015c662796edcf51c2f5e321d59ec06a1850816",
37
- "3.13.9-aarch64-unknown-linux-gnu": "fdc5d80488b64fcef3b99f297618f68e5374c13d89e888a66abeff4967afd308",
38
- "3.13.9-x86_64-apple-darwin": "9da51afb00480a8ccd4909bd302c80d9c104d633c5e865cf37dd5e587185e125",
39
- "3.13.9-x86_64-pc-windows-msvc": "f4c22b31ddbf8d7824cbcba2d8707621c2c8fab1fb6d2c1810c2bb0304d8e9a8",
40
- "3.13.9-x86_64-unknown-linux-gnu": "1bc9a94ab2425fb6ae58e45f69cab61647759b57895649701390822d976fa923",
41
- };
42
- export function hostTriple() {
43
- const t = HOST_TRIPLES[`${platform()}:${arch()}`];
44
- if (!t)
45
- throw new Error(`no standalone CPython build for ${platform()}/${arch()}`);
46
- return t;
47
- }
48
- function download(url, to) {
49
- return new Promise((res, rej) => {
50
- const follow = (u) => get(u, (r) => {
51
- if (r.statusCode >= 300 && r.statusCode < 400 && r.headers.location)
52
- return follow(r.headers.location);
53
- if (r.statusCode !== 200)
54
- return rej(new Error(`GET ${u} -> ${r.statusCode}`));
55
- const out = createWriteStream(to);
56
- r.pipe(out);
57
- out.on("finish", () => out.close(() => res()));
58
- out.on("error", rej);
59
- }).on("error", rej);
60
- follow(url);
61
- });
62
- }
63
- async function fetchPython(resources, cacheDir, versionClass) {
64
- const ver = PBS_VERSIONS[versionClass];
65
- if (!ver)
66
- throw new Error(`python-version "${versionClass}" not available — supported: ${Object.keys(PBS_VERSIONS).join(", ")}`);
67
- const triple = hostTriple();
68
- const asset = `cpython-${ver}+${PBS_TAG}-${triple}-install_only_stripped.tar.gz`;
69
- const base = `https://github.com/astral-sh/python-build-standalone/releases/download/${PBS_TAG}`;
70
- mkdirSync(resources, { recursive: true });
71
- mkdirSync(cacheDir, { recursive: true });
72
- const tarball = join(cacheDir, asset);
73
- if (!existsSync(tarball)) {
74
- console.log(`fetching ${asset}`);
75
- await download(`${base}/${asset}`, tarball);
76
- }
77
- else {
78
- console.log(`using cached ${asset}`);
79
- }
80
- // The interpreter ships to end users — verify against hashes committed
81
- // in-repo (see PBS_SHA256), not a checksum file from the same release.
82
- const want = PBS_SHA256[`${ver}-${triple}`];
83
- if (!want)
84
- throw new Error(`no committed SHA256 for ${ver}/${triple}`);
85
- const got = createHash("sha256").update(readFileSync(tarball)).digest("hex");
86
- if (got !== want)
87
- throw new Error(`SHA256 mismatch for ${asset}: got ${got}, want ${want} — refusing to bundle`);
88
- const dest = join(resources, "python");
89
- rmSync(dest, { recursive: true, force: true });
90
- mkdirSync(dest, { recursive: true });
91
- execFileSync("tar", ["-xzf", tarball, "-C", dest, "--strip-components=1"], { stdio: "inherit" });
92
- const py = join(dest, isWin ? "python.exe" : "bin/python3");
93
- if (!existsSync(py))
94
- throw new Error(`expected interpreter at ${py}`);
95
- return py;
96
- }
97
- function stageEnv(resources, python, appDir, reqs, cacheDir) {
98
- const target = join(resources, "site-packages");
99
- rmSync(target, { recursive: true, force: true });
100
- // dev uses `uv sync` (uv.lock) — build must install the SAME locked set,
101
- // hashed, or dev/prod parity is a fiction. requirements.txt is the
102
- // fallback for projects that don't lock.
103
- const lock = join(appDir, "uv.lock");
104
- let reqsFile = reqs;
105
- let exported;
106
- if (existsSync(lock)) {
107
- exported = join(cacheDir, "requirements.exported.txt");
108
- execFileSync("uv", ["export", "--frozen", "--format", "requirements-txt", "-o", exported], { cwd: appDir, stdio: "inherit" });
109
- reqsFile = exported;
110
- }
111
- else if (!existsSync(reqs)) {
112
- console.log(`no uv.lock and no ${reqs} — bundling stdlib only`);
113
- return;
114
- }
115
- else {
116
- console.warn("warning: no uv.lock — building from requirements.txt; " +
117
- "the bundled env may drift from `pylair dev`'s env");
118
- }
119
- execFileSync("uv", ["pip", "install", "--python", python, "--target", target, "-r", reqsFile], { cwd: appDir, stdio: "inherit" });
120
- }
121
- function run(cmd, args, cwd) {
122
- const r = spawnSync(cmd, args, { cwd, stdio: "inherit" });
123
- if (r.error)
124
- throw new Error(`${cmd} ${args.join(" ")} failed to start: ${r.error.message}`);
125
- if (r.status !== 0)
126
- throw new Error(`${cmd} ${args.join(" ")} exited ${r.status}`);
127
- }
128
- /** Shipped bundles must carry the licenses of what they embed. Collects:
129
- * pylair's own dual license, the interpreter's license tree (PSF license
130
- * requires LICENSE text with redistributed CPython), and each wheel's
131
- * dist-info license files. Runs before prune so nothing collected is
132
- * deleted afterwards. Returns the notice dir.
133
- */
134
- export function stageNotices(resources, pylairDir) {
135
- const out = join(resources, "THIRD-PARTY-NOTICES");
136
- rmSync(out, { recursive: true, force: true });
137
- mkdirSync(out, { recursive: true });
138
- const index = [];
139
- const copyInto = (subdir, src, dest) => {
140
- mkdirSync(join(out, subdir), { recursive: true });
141
- cpSync(src, join(out, subdir, dest));
142
- };
143
- const LICENSEISH = /^(licen[cs]e|copying|notice|authors|copyright)/i;
144
- for (const f of ["LICENSE-MIT", "LICENSE-APACHE"]) {
145
- const src = join(pylairDir, f);
146
- if (existsSync(src))
147
- copyInto("pylair", src, f);
148
- }
149
- index.push("pylair/ — pylair itself (MIT OR Apache-2.0)");
150
- // The interpreter: python-build-standalone ships a licenses/ dir holding
151
- // CPython's license plus every statically-linked dep (OpenSSL, libffi…).
152
- const pyRoot = join(resources, "python");
153
- let found = 0;
154
- const walkPy = (dir) => {
155
- for (const e of readdirSync(dir, { withFileTypes: true })) {
156
- const p = join(dir, e.name);
157
- if (e.isDirectory()) {
158
- if (e.name.toLowerCase() === "licenses") {
159
- cpSync(p, join(out, "python", "licenses"), { recursive: true });
160
- found++;
161
- }
162
- else
163
- walkPy(p);
164
- }
165
- else if (LICENSEISH.test(e.name)) {
166
- copyInto("python", p, e.name);
167
- found++;
168
- }
169
- }
170
- };
171
- if (existsSync(pyRoot))
172
- walkPy(pyRoot);
173
- if (!found) {
174
- mkdirSync(join(out, "python"), { recursive: true });
175
- writeFileSync(join(out, "python", "NOTICE.txt"), "This app bundles CPython (PSF-2.0 license) via python-build-standalone.\n" +
176
- "License texts were not located in the interpreter tree at build time;\n" +
177
- "they ship upstream in the python/licenses directory of each\n" +
178
- "python-build-standalone release.\n");
179
- console.warn("warning: no license files found under resources/python — wrote placeholder NOTICE");
180
- }
181
- index.push("python/ — bundled CPython interpreter (PSF-2.0) and its vendored deps");
182
- // Wheels: every installed dist-info/egg-info carries license files or
183
- // license metadata. Copy whichever exists.
184
- const sp = join(resources, "site-packages");
185
- let wheels = 0;
186
- if (existsSync(sp)) {
187
- for (const e of readdirSync(sp, { withFileTypes: true })) {
188
- if (!e.isDirectory())
189
- continue;
190
- const m = /^(.*?)-[\d.]+.*\.(dist-info|egg-info)$/.exec(e.name);
191
- if (!m)
192
- continue;
193
- const pkg = m[1].replace(/[^\w.-]/g, "_");
194
- const d = join(sp, e.name);
195
- let kept = false;
196
- for (const f of readdirSync(d, { withFileTypes: true })) {
197
- if (f.isDirectory() && f.name.toLowerCase() === "licenses") {
198
- cpSync(join(d, f.name), join(out, pkg, "licenses"), { recursive: true });
199
- kept = true;
200
- }
201
- else if (f.isFile() && LICENSEISH.test(f.name)) {
202
- copyInto(pkg, join(d, f.name), f.name);
203
- kept = true;
204
- }
205
- }
206
- const meta = join(d, "METADATA");
207
- if (existsSync(meta)) {
208
- const lines = readFileSync(meta, "utf-8")
209
- .split("\n")
210
- .filter((l) => /^(License|Classifier: License)/i.test(l));
211
- // Copyleft is legal to ship but app authors deserve to know they
212
- // bundled it — warn, never block.
213
- if (/\b(a?lgpl|gpl)[ -]?v?\d/i.test(lines.join(" ")))
214
- console.warn(`warning: bundled wheel ${e.name} declares a copyleft license`);
215
- if (lines.length) {
216
- mkdirSync(join(out, pkg), { recursive: true });
217
- writeFileSync(join(out, pkg, "METADATA-LICENSE.txt"), lines.join("\n") + "\n");
218
- kept = true;
219
- }
220
- }
221
- if (kept) {
222
- wheels++;
223
- index.push(`${pkg}/ — from ${e.name}`);
224
- }
225
- }
226
- }
227
- writeFileSync(join(out, "INDEX.txt"), index.join("\n") + "\n");
228
- console.log(`third-party notices: pylair, python interpreter, ${wheels} wheel(s)`);
229
- return out;
230
- }
33
+ import { compileBytecode } from "./build/bytecode.js";
34
+ import { stageNotices } from "./build/notices.js";
35
+ import { hostTriple } from "./build/pbs.js";
36
+ import { fetchPython, stageEnv } from "./build/python.js";
37
+ import { adHocSign } from "./build/sign.js";
38
+ import { stageSource } from "./build/source.js";
39
+ import { isWin, run } from "./build/util.js";
40
+ export { compileBytecode, PYC_INVALIDATION_MODE } from "./build/bytecode.js";
41
+ export { DownloadError, backoffMs, download, downloadTimeoutMs, downloadWithRetry, ensureTarball, } from "./build/download.js";
42
+ export { stageNotices } from "./build/notices.js";
43
+ export { hostTriple } from "./build/pbs.js";
44
+ export { stageSource } from "./build/source.js";
45
+ export { requirementsHaveHashes, uvExportArgs, uvPipInstallArgs } from "./build/python.js";
231
46
  export async function build(opts) {
232
47
  const { appDir } = opts;
233
48
  const tauriDir = join(appDir, "src-tauri");
234
49
  const resources = join(tauriDir, "resources");
235
50
  const tconf = loadTauriConfig(appDir);
236
- const py = spawnSync("python3", ["--version"], { encoding: "utf-8" });
237
- const python = py.status === 0 ? "python3" : "python";
238
- const cfg = loadConfig(appDir, python);
51
+ const cfg = loadConfig(appDir);
52
+ // Capability scopes are checked first: a bad `allow: []` or a half-scoped
53
+ // window is a configuration error, not worth a Python download to find out.
54
+ for (const w of assertCapabilities(appDir))
55
+ console.warn(formatFinding(w));
239
56
  const targetTriple = hostTriple(); // cross-compile refused by construction
240
57
  console.log(`building ${tconf.productName} ${tconf.version} for ${platform()}/${arch()} (${targetTriple})`);
241
58
  console.log("note: pylair builds native bundles only — run this on each target OS");
@@ -251,16 +68,21 @@ export async function build(opts) {
251
68
  if (!existsSync(srcDir))
252
69
  throw new Error(`source dir ${srcDir} missing`);
253
70
  rmSync(join(resources, cfg.source), { recursive: true, force: true });
254
- cpSync(srcDir, join(resources, cfg.source), { recursive: true });
71
+ stageSource(srcDir, join(resources, cfg.source), cfg.include);
255
72
  const res = prune(resources, [...DEFAULT_PRUNE, ...cfg.prune]);
256
73
  const mib = (res.bytesFreed / 2 ** 20).toFixed(1);
257
74
  console.log(`pruned ${res.removed} paths (${mib} MiB) from staged resources`);
75
+ // Precompile what survives the prune — read-only installs cannot
76
+ // write pycs at launch, so the bundle ships them ready-made.
77
+ compileBytecode(resources, bundled, ["site-packages", cfg.source]);
258
78
  // Over-pruning must fail at build time, not on the user's machine:
259
79
  // import the app module with the staged tree exactly as the bundle sees it.
260
80
  const sep = isWin ? ";" : ":";
261
81
  // The import root is the PARENT of the staged source dir ("backend.app"
262
82
  // resolves from resources/, not resources/backend/). Run from an unrelated
263
83
  // cwd so the project checkout can't satisfy the import by accident.
84
+ // PYTHONDONTWRITEBYTECODE: the check exercises the compiled pycs rather
85
+ // than writing a second, non-deterministic set into the staged tree.
264
86
  const check = spawnSync(bundled, ["-c", `import ${cfg.appModule}; print("staged import ok")`], {
265
87
  encoding: "utf-8",
266
88
  cwd: tmpdir(),
@@ -268,18 +90,57 @@ export async function build(opts) {
268
90
  ...process.env,
269
91
  PYTHONPATH: `${importRoot(resources, cfg.source)}${sep}${join(resources, "site-packages")}`,
270
92
  PYTHONNOUSERSITE: "1",
93
+ PYTHONDONTWRITEBYTECODE: "1",
271
94
  },
272
95
  });
273
96
  if (check.status !== 0)
274
97
  throw new Error(`staged bundle failed the import check (${cfg.appModule}) — ` +
275
98
  `pruning or missing deps? ${check.stderr?.trim()}`);
99
+ // With the app importable, ask it which functions it exposes and warn
100
+ // about scope patterns that match none. Best effort: a failure here only
101
+ // skips the warning, it never fails the build.
102
+ const caps = loadCapabilities(appDir).capabilities;
103
+ if (caps.length) {
104
+ try {
105
+ const m = loadManifest({
106
+ python: bundled,
107
+ module: cfg.appModule,
108
+ cwd: tmpdir(),
109
+ env: {
110
+ PYTHONPATH: `${importRoot(resources, cfg.source)}${sep}${join(resources, "site-packages")}`,
111
+ PYTHONNOUSERSITE: "1",
112
+ PYTHONDONTWRITEBYTECODE: "1",
113
+ },
114
+ });
115
+ const names = (m.functions ?? []).map((f) => f.name);
116
+ for (const w of checkPatterns(caps, names))
117
+ console.warn(formatFinding(w));
118
+ }
119
+ catch (e) {
120
+ console.log(`note: skipped the capability pattern check (could not list exposed functions: ${e.message.split("\n")[0]})`);
121
+ }
122
+ }
276
123
  // ── tauri build ────────────────────────────────────────────────────
124
+ // Signing is per-platform: only macOS creds (env OR tauri.conf
125
+ // signingIdentity) mean this Mac build gets a real signature — a Windows
126
+ // thumbprint on its own must not suppress the ad-hoc pass.
277
127
  // NOTE: TAURI_SIGNING_PRIVATE_KEY signs *updater* artifacts, not the app —
278
128
  // it must NOT silence the unsigned warning.
279
- const hasSigning = !!(process.env.APPLE_SIGNING_IDENTITY ||
129
+ const appleSigned = !!(process.env.APPLE_SIGNING_IDENTITY ||
280
130
  process.env.APPLE_CERTIFICATE ||
281
- process.env.WINDOWS_CERTIFICATE_THUMBPRINT);
131
+ tconf.macSigningIdentity);
132
+ const hasSigning = platform() === "darwin"
133
+ ? appleSigned
134
+ : platform() === "win32"
135
+ ? windowsSigningConfigured(appDir)
136
+ : true; // no signing concept on Linux — don't warn
282
137
  run(process.execPath, [tauriCliEntry(appDir), "build", ...(opts.tauriArgs ?? [])], appDir);
138
+ // Unsigned macOS builds get a full-bundle ad-hoc signature — better
139
+ // than the linker stub Tauri leaves on just the main binary. Skipped
140
+ // entirely when a real identity is configured: ad-hoc must never run
141
+ // over a proper signature.
142
+ if (platform() === "darwin" && !appleSigned)
143
+ adHocSign(tauriDir, tconf.productName);
283
144
  if (!hasSigning) {
284
145
  console.warn(`
285
146
  ╔══════════════════════════════════════════════════════════════════╗
package/dist/build.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file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,IAAI,QAAQ,EAAE,KAAK,QAAQ,IAAI,CAAC,WAAW;QAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACpF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC;;;;;;qEAMoD,CAAC,CAAC;IACrE,CAAC;AACH,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Static checks over `src-tauri/capabilities/*.json|toml` for the
3
+ * per-function permissions of `tauri-plugin-pylair` (docs/security.md,
4
+ * "Restricting functions per window"). Run by `pylair build` and
5
+ * `pylair doctor`.
6
+ *
7
+ * The plugin enforces the scopes at runtime and fails closed; these checks
8
+ * exist to catch the configurations that are legal but almost certainly not
9
+ * what the author meant, before an app ships:
10
+ *
11
+ * - `allow: []` on a pylair permission: Tauri treats an empty list as "no
12
+ * scope entries", which permits EVERY function. (error)
13
+ * - a window that scopes `python-call` but not `python-call-stream`, or the
14
+ * reverse: the unscoped command is an open side door. (error)
15
+ * - a malformed scope entry: the plugin refuses every call it covers. (error)
16
+ * - a pattern that matches no exposed function: a typo, or a function that
17
+ * was renamed. (warning, only when the exposed names are known)
18
+ * - different scopes on the two commands of one window. (warning)
19
+ */
20
+ export interface Finding {
21
+ level: "error" | "warn";
22
+ /** Path relative to the app dir, forward slashes. */
23
+ file: string;
24
+ /** Capability `identifier`; empty when the file did not parse. */
25
+ capability: string;
26
+ message: string;
27
+ }
28
+ export interface Capability {
29
+ file: string;
30
+ identifier: string;
31
+ windows: string[];
32
+ permissions: unknown[];
33
+ }
34
+ /** The plugin's matching rule: exact, or a single trailing `*` as a prefix
35
+ * wildcard. A `*` anywhere else is a literal character. Keep in step with
36
+ * `fn_scope::pattern_matches` in the plugin. */
37
+ export declare function patternMatches(pattern: string, name: string): boolean;
38
+ export declare function loadCapabilities(appDir: string): {
39
+ capabilities: Capability[];
40
+ findings: Finding[];
41
+ };
42
+ /** Warn for every pattern that matches no name in `exposed`. */
43
+ export declare function checkPatterns(caps: Capability[], exposed: string[]): Finding[];
44
+ export declare function checkCapabilities(caps: Capability[], exposed?: string[]): Finding[];
45
+ export declare function formatFinding(f: Finding): string;
46
+ /**
47
+ * The static checks `pylair build` runs before any slow work: throws,
48
+ * listing every error, if any; otherwise returns the warnings.
49
+ */
50
+ export declare function assertCapabilities(appDir: string, exposed?: string[]): Finding[];
51
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,OAAO,EAAE,CAAC;CACxB;AAYD;;gDAEgD;AAChD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAErE;AAQD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG;IAChD,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB,CAsCA;AAsED,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAgB9E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CA4DnF;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAGhD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAUhF"}