lockpicks 0.7.1 → 0.8.0-go.10

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.
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env node
2
+ // The `lockpicks` npm shim for the Go build of the Lockpick CLI: it finds the
3
+ // platform package npm installed (`@lockpicks/cli-<os>-<cpu>`, an optional
4
+ // dependency) and runs its binary.
5
+ // It has no install scripts. LOCKPICK_LAUNCH tells the binary how it was
6
+ // launched, decided from this script's path exactly as the TypeScript CLI's
7
+ // launchKind decides it from its own.
8
+ 'use strict';
9
+
10
+ const { spawn } = require('node:child_process');
11
+ const { realpathSync } = require('node:fs');
12
+ const { delimiter, join, sep } = require('node:path');
13
+
14
+ const PACKAGE_DIR = `${sep}lockpicks${sep}`;
15
+
16
+ function real(path) {
17
+ try {
18
+ return realpathSync(path);
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+
24
+ function launchKind(script, pathEnv) {
25
+ const self = real(script) ?? script;
26
+ const parts = self.split(sep);
27
+ const installed = parts.includes('node_modules');
28
+ const onPath = pathEnv.split(delimiter).some((dir) => {
29
+ const found =
30
+ dir && !dir.split(sep).includes('node_modules')
31
+ ? real(join(dir, 'lockpick'))
32
+ : null;
33
+ return (
34
+ found !== null &&
35
+ (found === self || (installed && found.includes(PACKAGE_DIR)))
36
+ );
37
+ });
38
+ if (onPath) return 'path';
39
+ if (parts.includes('_npx')) return 'npx';
40
+ return installed ? 'package' : 'checkout';
41
+ }
42
+
43
+ // Node itself reads `--env-file` and `--env-file-if-exists` from every
44
+ // argument up to a literal `--`, this script's own included, and loads the
45
+ // file into its environment before any JavaScript runs: a `NODE_OPTIONS` in
46
+ // it has already run its preloads by now, and its other variables would
47
+ // reach the binary. That is Node's behaviour, met by every Node launcher, and
48
+ // nothing here can undo it; the CLI's flag for a repository's env file is
49
+ // `--dotenv` so no one is told to pass it. Refuse the old name rather than
50
+ // hand the binary an environment the file chose.
51
+ const args = process.argv.slice(2);
52
+ const end = args.indexOf('--');
53
+ const nodeEnvFile = (end === -1 ? args : args.slice(0, end)).find((arg) =>
54
+ /^--env-file(?:-if-exists)?(?:=|$)/.test(arg)
55
+ );
56
+ if (nodeEnvFile !== undefined) {
57
+ process.stderr.write(
58
+ `✖ ${nodeEnvFile.split('=')[0]} is read by Node.js itself, before Lockpick starts, and loads that file into Node's own environment.\n` +
59
+ 'Name the file with --dotenv instead, for example: lockpick deep local . --dotenv .env\n'
60
+ );
61
+ process.exit(2);
62
+ }
63
+
64
+ const target = `@lockpicks/cli-${process.platform}-${process.arch}`;
65
+ let binary;
66
+ try {
67
+ binary = join(
68
+ require.resolve(`${target}/package.json`).slice(0, -'package.json'.length),
69
+ 'bin',
70
+ process.platform === 'win32' ? 'lockpick.exe' : 'lockpick'
71
+ );
72
+ } catch {
73
+ // npm installs the binary as an optional dependency. `--omit=optional`,
74
+ // `--no-optional`, an `omit=optional` npmrc or a mirror without the
75
+ // platform package skip it; anything else has no build at all.
76
+ const { version, optionalDependencies } = require('../package.json');
77
+ process.stderr.write(
78
+ target in (optionalDependencies ?? {})
79
+ ? `✖ Lockpick's binary for ${process.platform}-${process.arch} (the npm package ${target}) is not installed.\n` +
80
+ 'npm skips it when optional dependencies are turned off (--omit=optional, --no-optional or omit=optional in an npmrc),\n' +
81
+ 'or when a registry mirror does not carry it. Reinstall with optional dependencies:\n' +
82
+ ` npm install -g lockpicks@${version} --include=optional (a global install)\n` +
83
+ ` npm install lockpicks@${version} --include=optional (in a project)\n` +
84
+ `If it is still missing, check \`npm config get omit\` and that your registry serves ${target}.\n`
85
+ : `✖ Lockpick has no build for ${process.platform}-${process.arch}.\n` +
86
+ 'The Node.js build of the CLI runs anywhere Node.js does: npm install -g lockpicks@0.7\n'
87
+ );
88
+ process.exit(1);
89
+ }
90
+
91
+ // The binary runs as a child so this launcher can pass on what reaches it:
92
+ // SIGINT, SIGTERM and SIGHUP (and Ctrl+Break on Windows) go to the binary,
93
+ // this process exits with the binary's code or signal, and the binary is
94
+ // killed if this process exits first. LOCKPICK_LAUNCHER_PID lets the binary
95
+ // stop on its own when this process is killed outright (SIGKILL, taskkill /F).
96
+ const child = spawn(binary, args, {
97
+ stdio: 'inherit',
98
+ env: {
99
+ ...process.env,
100
+ LOCKPICK_LAUNCH: launchKind(process.argv[1] ?? '', process.env.PATH ?? ''),
101
+ LOCKPICK_LAUNCHER_PID: String(process.pid),
102
+ },
103
+ });
104
+ const forwarded = ['SIGINT', 'SIGTERM', 'SIGHUP'];
105
+ if (process.platform === 'win32') forwarded.push('SIGBREAK');
106
+ for (const signal of forwarded)
107
+ process.on(signal, () => {
108
+ if (child.exitCode === null && child.signalCode === null)
109
+ child.kill(signal);
110
+ });
111
+ process.on('exit', () => {
112
+ if (child.exitCode === null && child.signalCode === null) child.kill();
113
+ });
114
+ child.on('error', (error) => {
115
+ process.stderr.write(`✖ Could not start ${binary}: ${error.message}\n`);
116
+ process.exit(1);
117
+ });
118
+ child.on('exit', (code, signal) => {
119
+ if (signal) {
120
+ // Die of the same signal, so the shell sees what the binary saw.
121
+ for (const name of forwarded) process.removeAllListeners(name);
122
+ process.kill(process.pid, signal);
123
+ return;
124
+ }
125
+ process.exit(code ?? 1);
126
+ });
package/package.json CHANGED
@@ -1,7 +1,18 @@
1
1
  {
2
- "name": "lockpicks",
3
- "version": "0.7.1",
2
+ "bin": {
3
+ "lockpick": "bin/lockpick.cjs",
4
+ "lockpicks": "bin/lockpick.cjs"
5
+ },
4
6
  "description": "Lockpick from the terminal: device login, project status, findings, repair briefs, Pulse scans and an MCP server for coding agents",
7
+ "engines": {
8
+ "node": "\u003e=20.9.0"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "README.md",
13
+ "LICENSE",
14
+ "THIRD-PARTY-NOTICES.txt"
15
+ ],
5
16
  "keywords": [
6
17
  "lockpick",
7
18
  "security",
@@ -9,22 +20,24 @@
9
20
  "cli",
10
21
  "box"
11
22
  ],
12
- "type": "module",
13
- "bin": {
14
- "lockpick": "./dist/lockpick.mjs",
15
- "lockpicks": "./dist/lockpick.mjs"
23
+ "license": "SEE LICENSE IN LICENSE",
24
+ "name": "lockpicks",
25
+ "optionalDependencies": {
26
+ "@lockpicks/cli-darwin-arm64": "0.8.0-go.10",
27
+ "@lockpicks/cli-darwin-x64": "0.8.0-go.10",
28
+ "@lockpicks/cli-linux-arm": "0.8.0-go.10",
29
+ "@lockpicks/cli-linux-arm64": "0.8.0-go.10",
30
+ "@lockpicks/cli-linux-x64": "0.8.0-go.10",
31
+ "@lockpicks/cli-win32-arm64": "0.8.0-go.10",
32
+ "@lockpicks/cli-win32-x64": "0.8.0-go.10"
16
33
  },
17
- "files": [
18
- "dist",
19
- "README.md",
20
- "LICENSE",
21
- "THIRD-PARTY-NOTICES.txt"
22
- ],
23
- "dependencies": {
24
- "@napi-rs/keyring": "^2.1.0"
34
+ "publishConfig": {
35
+ "access": "public"
25
36
  },
26
- "engines": {
27
- "node": ">=20.9.0"
37
+ "repository": {
38
+ "directory": "apps/cli-go",
39
+ "type": "git",
40
+ "url": "git+https://github.com/promptadvisers/lockpick.git"
28
41
  },
29
- "license": "SEE LICENSE IN LICENSE"
30
- }
42
+ "version": "0.8.0-go.10"
43
+ }
@@ -1,37 +0,0 @@
1
- {
2
- "schemaVersion": 1,
3
- "platform": "darwin",
4
- "arch": "arm64",
5
- "nodeApiVersion": 8,
6
- "nodeHeadersVersion": "20.9.0",
7
- "compiler": "Apple clang version 17.0.0 (clang-1700.0.13.5)",
8
- "compilerSha256": "7f30f076d0e9c38f772a76449fca9da8cf97f6a3d43b94c90a00e4f9ce7ad39e",
9
- "compilerArguments": [
10
- "-std=c11",
11
- "-O2",
12
- "-Wall",
13
- "-Wextra",
14
- "-Werror",
15
- "-fPIC",
16
- "-D_POSIX_C_SOURCE=200809L",
17
- "-D_DARWIN_C_SOURCE=1",
18
- "-D_DEFAULT_SOURCE=1",
19
- "-DNAPI_VERSION=8",
20
- "-I<node-headers>",
21
- "-bundle",
22
- "-undefined",
23
- "dynamic_lookup",
24
- "<safe-io.c>",
25
- "-o",
26
- "<native-artifact>"
27
- ],
28
- "sourceSha256": "90cccce979b991f5c0c33e6c286dc76bcb4e69b85c3c89156e9ec29a3dc606e4",
29
- "headers": {
30
- "node_api.h": "a5a3e1ff20963d44d92587376202d727d1daf2606dca96c082c876d3a322b5c5",
31
- "node_api_types.h": "8d5d854088d5725fec9775510e0aeeeb790a41ad083c49bb721d950b86e6bd61",
32
- "js_native_api.h": "94c40b848fca067b0f2bade48ee5cf162fbe379ea6edf6087f94faf41d827461",
33
- "js_native_api_types.h": "7d805521f313d58ab00395b55019dbee8fa71cee21ef89e09521998e879a97b4",
34
- "node_version.h": "5f8e3f33a99a8a220c3d56409e1e4b4a6143e43b3dff184b78828536b11b9ab8"
35
- },
36
- "binarySha256": "2d5efe59b1845a66a4516440d900f0fe6c0db7d9c471ddaed941d49071f16f26"
37
- }
Binary file
@@ -1,37 +0,0 @@
1
- {
2
- "schemaVersion": 1,
3
- "platform": "darwin",
4
- "arch": "x64",
5
- "nodeApiVersion": 8,
6
- "nodeHeadersVersion": "20.9.0",
7
- "compiler": "Apple clang version 17.0.0 (clang-1700.0.13.5)",
8
- "compilerSha256": "7f30f076d0e9c38f772a76449fca9da8cf97f6a3d43b94c90a00e4f9ce7ad39e",
9
- "compilerArguments": [
10
- "-std=c11",
11
- "-O2",
12
- "-Wall",
13
- "-Wextra",
14
- "-Werror",
15
- "-fPIC",
16
- "-D_POSIX_C_SOURCE=200809L",
17
- "-D_DARWIN_C_SOURCE=1",
18
- "-D_DEFAULT_SOURCE=1",
19
- "-DNAPI_VERSION=8",
20
- "-I<node-headers>",
21
- "-bundle",
22
- "-undefined",
23
- "dynamic_lookup",
24
- "<safe-io.c>",
25
- "-o",
26
- "<native-artifact>"
27
- ],
28
- "sourceSha256": "90cccce979b991f5c0c33e6c286dc76bcb4e69b85c3c89156e9ec29a3dc606e4",
29
- "headers": {
30
- "node_api.h": "a5a3e1ff20963d44d92587376202d727d1daf2606dca96c082c876d3a322b5c5",
31
- "node_api_types.h": "8d5d854088d5725fec9775510e0aeeeb790a41ad083c49bb721d950b86e6bd61",
32
- "js_native_api.h": "94c40b848fca067b0f2bade48ee5cf162fbe379ea6edf6087f94faf41d827461",
33
- "js_native_api_types.h": "7d805521f313d58ab00395b55019dbee8fa71cee21ef89e09521998e879a97b4",
34
- "node_version.h": "5f8e3f33a99a8a220c3d56409e1e4b4a6143e43b3dff184b78828536b11b9ab8"
35
- },
36
- "binarySha256": "5d8f57fc535c3beb540e622affc0acd2ce7a383c98355b8f7493534b03d0d984"
37
- }
Binary file
@@ -1,35 +0,0 @@
1
- {
2
- "schemaVersion": 1,
3
- "platform": "linux",
4
- "arch": "arm64",
5
- "nodeApiVersion": 8,
6
- "nodeHeadersVersion": "20.9.0",
7
- "compiler": "cc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0",
8
- "compilerSha256": "6c3baa3d21eea32b960de4ad2d366d484ce1dd837eb85f4904e656758bfa1a6b",
9
- "compilerArguments": [
10
- "-std=c11",
11
- "-O2",
12
- "-Wall",
13
- "-Wextra",
14
- "-Werror",
15
- "-fPIC",
16
- "-D_POSIX_C_SOURCE=200809L",
17
- "-D_DARWIN_C_SOURCE=1",
18
- "-D_DEFAULT_SOURCE=1",
19
- "-DNAPI_VERSION=8",
20
- "-I<node-headers>",
21
- "-shared",
22
- "<safe-io.c>",
23
- "-o",
24
- "<native-artifact>"
25
- ],
26
- "sourceSha256": "90cccce979b991f5c0c33e6c286dc76bcb4e69b85c3c89156e9ec29a3dc606e4",
27
- "headers": {
28
- "node_api.h": "a5a3e1ff20963d44d92587376202d727d1daf2606dca96c082c876d3a322b5c5",
29
- "node_api_types.h": "8d5d854088d5725fec9775510e0aeeeb790a41ad083c49bb721d950b86e6bd61",
30
- "js_native_api.h": "94c40b848fca067b0f2bade48ee5cf162fbe379ea6edf6087f94faf41d827461",
31
- "js_native_api_types.h": "7d805521f313d58ab00395b55019dbee8fa71cee21ef89e09521998e879a97b4",
32
- "node_version.h": "5f8e3f33a99a8a220c3d56409e1e4b4a6143e43b3dff184b78828536b11b9ab8"
33
- },
34
- "binarySha256": "5b4d74de3d5227b85ee1c3d19afc97c5f216c754dd74242d57e8c17869f13c5f"
35
- }
Binary file
@@ -1,35 +0,0 @@
1
- {
2
- "schemaVersion": 1,
3
- "platform": "linux",
4
- "arch": "x64",
5
- "nodeApiVersion": 8,
6
- "nodeHeadersVersion": "20.9.0",
7
- "compiler": "cc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0",
8
- "compilerSha256": "821af3c74506283c179ca413bb33e6b528805a4dd8a5c09df125e5ad560a9e89",
9
- "compilerArguments": [
10
- "-std=c11",
11
- "-O2",
12
- "-Wall",
13
- "-Wextra",
14
- "-Werror",
15
- "-fPIC",
16
- "-D_POSIX_C_SOURCE=200809L",
17
- "-D_DARWIN_C_SOURCE=1",
18
- "-D_DEFAULT_SOURCE=1",
19
- "-DNAPI_VERSION=8",
20
- "-I<node-headers>",
21
- "-shared",
22
- "<safe-io.c>",
23
- "-o",
24
- "<native-artifact>"
25
- ],
26
- "sourceSha256": "90cccce979b991f5c0c33e6c286dc76bcb4e69b85c3c89156e9ec29a3dc606e4",
27
- "headers": {
28
- "node_api.h": "a5a3e1ff20963d44d92587376202d727d1daf2606dca96c082c876d3a322b5c5",
29
- "node_api_types.h": "8d5d854088d5725fec9775510e0aeeeb790a41ad083c49bb721d950b86e6bd61",
30
- "js_native_api.h": "94c40b848fca067b0f2bade48ee5cf162fbe379ea6edf6087f94faf41d827461",
31
- "js_native_api_types.h": "7d805521f313d58ab00395b55019dbee8fa71cee21ef89e09521998e879a97b4",
32
- "node_version.h": "5f8e3f33a99a8a220c3d56409e1e4b4a6143e43b3dff184b78828536b11b9ab8"
33
- },
34
- "binarySha256": "4f497e60ffabb4f7c089a054fd086b815a827dbac7071aab6f662ce18dfda264"
35
- }