@lizard-build/cli 4.0.134 → 4.0.136

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 (51) hide show
  1. package/dist/commands/git-hosting.js +35 -33
  2. package/dist/commands/git-hosting.js.map +1 -1
  3. package/dist/commands/logs.js +15 -12
  4. package/dist/commands/logs.js.map +1 -1
  5. package/dist/commands/sandbox.js +24 -13
  6. package/dist/commands/sandbox.js.map +1 -1
  7. package/dist/commands/up.d.ts +9 -0
  8. package/dist/commands/up.js +43 -13
  9. package/dist/commands/up.js.map +1 -1
  10. package/dist/lib/checkout.d.ts +7 -0
  11. package/dist/lib/checkout.js +20 -1
  12. package/dist/lib/checkout.js.map +1 -1
  13. package/dist/lib/config.d.ts +6 -1
  14. package/dist/lib/config.js +16 -4
  15. package/dist/lib/config.js.map +1 -1
  16. package/dist/lib/env-guard.js +38 -2
  17. package/dist/lib/env-guard.js.map +1 -1
  18. package/dist/lib/signin.d.ts +9 -0
  19. package/dist/lib/signin.js +19 -2
  20. package/dist/lib/signin.js.map +1 -1
  21. package/dist/lib/skills-data.generated.js +2 -2
  22. package/dist/lib/skills-data.generated.js.map +1 -1
  23. package/dist/lib/terminal.d.ts +20 -0
  24. package/dist/lib/terminal.js +32 -0
  25. package/dist/lib/terminal.js.map +1 -0
  26. package/dist/lib/updater.d.ts +1 -1
  27. package/dist/lib/updater.js +1 -1
  28. package/dist/lib/upload-filter.d.ts +14 -0
  29. package/dist/lib/upload-filter.js +146 -0
  30. package/dist/lib/upload-filter.js.map +1 -0
  31. package/package.json +1 -1
  32. package/skill-data/core/references/deploys.md +1 -1
  33. package/skill-data/core/references/sandboxes.md +1 -1
  34. package/src/commands/git-hosting.ts +35 -33
  35. package/src/commands/logs.ts +16 -12
  36. package/src/commands/sandbox.ts +27 -12
  37. package/src/commands/up.ts +59 -9
  38. package/src/lib/checkout.ts +22 -1
  39. package/src/lib/config.ts +12 -5
  40. package/src/lib/env-guard.ts +37 -2
  41. package/src/lib/signin.ts +24 -2
  42. package/src/lib/terminal.ts +36 -0
  43. package/src/lib/updater.ts +1 -1
  44. package/src/lib/upload-filter.ts +141 -0
  45. package/test/unit/checkout-symlink.test.ts +19 -1
  46. package/test/unit/config.test.ts +21 -0
  47. package/test/unit/env-guard.test.ts +6 -2
  48. package/test/unit/login.test.ts +26 -1
  49. package/test/unit/terminal.test.ts +25 -0
  50. package/test/unit/upload-filter.test.ts +62 -0
  51. package/lizard-wrapper.sh +0 -2
@@ -0,0 +1,62 @@
1
+ import fs from "node:fs";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import { execSync } from "node:child_process";
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
6
+ import { isSensitivePath, parseIgnore } from "../../src/lib/upload-filter.js";
7
+ import { getUploadFiles } from "../../src/commands/up.js";
8
+
9
+ describe("files that look like secrets", () => {
10
+ it.each([".env", ".env.local", ".env.production", "app/.env", ".ssh/id_rsa", "x/.aws/credentials", ".gnupg/pubring.kbx", ".npmrc",
11
+ ".pypirc", ".netrc", ".docker/config.json", "id_rsa", "id_rsa.pub", "keys/id_ed25519", "id_ecdsa", "server.pem", "tls/server.KEY", ".ssh"])(
12
+ "%s is skipped", (p) => expect(isSensitivePath(p)).toBe(true));
13
+ it.each([".env.example", ".env.sample", "src/env.ts", "config.json", "docker/config.json", "keyboard.ts", "README.md", "environment.yml"])(
14
+ "%s is uploaded", (p) => expect(isSensitivePath(p)).toBe(false));
15
+ });
16
+
17
+ describe(".lizardignore (gitignore syntax)", () => {
18
+ const m = parseIgnore("# comment\n*.log\n/build\ndata/\n!keep.log\ndocs/**/*.pdf\nsecret?.txt\n");
19
+ it.each([["a.log", true], ["x/y/a.log", true], ["keep.log", false], ["build/out.js", true], ["src/build/x", false],
20
+ ["data/a.csv", true], ["a/data/b", true], ["docs/a/b/c.pdf", true], ["docs/c.pdf", true], ["secret1.txt", true], ["secret12.txt", false],
21
+ ["src/index.ts", false]] as const)("%s -> %s", (p, want) => expect(m(p)).toBe(want));
22
+ it("a folder-only rule does not match a file of that name", () => expect(m("data")).toBe(false));
23
+ });
24
+
25
+ describe("lizard up file selection", () => {
26
+ let dir: string;
27
+ beforeEach(() => {
28
+ dir = fs.mkdtempSync(path.join(os.tmpdir(), "lizard-up-files-"));
29
+ const w = (p: string, t = "x") => {
30
+ fs.mkdirSync(path.dirname(path.join(dir, p)), { recursive: true });
31
+ fs.writeFileSync(path.join(dir, p), t);
32
+ };
33
+ w("index.js"); w(".env"); w(".env.example"); w(".ssh/id_rsa"); w("certs/tls.pem"); w("tmp/big.bin"); w("notes.txt");
34
+ w(".lizardignore", "tmp/\nnotes.txt\n");
35
+ });
36
+ afterEach(() => {
37
+ vi.unstubAllEnvs();
38
+ fs.rmSync(dir, { recursive: true, force: true });
39
+ });
40
+
41
+ it("folder walk: secrets skipped and reported, .lizardignore honoured", () => {
42
+ const r = getUploadFiles(dir, false);
43
+ expect(r.files.sort()).toEqual([".env.example", ".lizardignore", "index.js"]);
44
+ expect(r.skipped.sort()).toEqual([".env", ".ssh/", "certs/tls.pem"]);
45
+ });
46
+
47
+ it("refuses the home folder", () => {
48
+ vi.stubEnv("HOME", dir);
49
+ expect(() => getUploadFiles(dir, false)).toThrow(/home folder/);
50
+ });
51
+
52
+ it("git listing: .lizardignore honoured, untracked .env warned about", () => {
53
+ const git = (c: string) => execSync(`git ${c}`, { cwd: dir, stdio: "pipe", env: { ...process.env, GIT_CONFIG_GLOBAL: "/dev/null" } });
54
+ git("init -q");
55
+ git("add index.js");
56
+ const r = getUploadFiles(dir, true);
57
+ expect(r.files).not.toContain("notes.txt");
58
+ expect(r.files).not.toContain("tmp/big.bin");
59
+ expect(r.files).toContain(".env");
60
+ expect(r.untrackedEnv).toEqual([".env"]);
61
+ });
62
+ });
package/lizard-wrapper.sh DELETED
@@ -1,2 +0,0 @@
1
- #!/bin/bash
2
- exec /home/ubuntu/.nvm/versions/node/v22.22.2/bin/node /home/ubuntu/Work/lizard-cli/dist/index.js "$@"