create-op-node 0.10.1 → 0.10.3
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/README.md +2 -1
- package/dist/cli.js +61 -9
- package/dist/cli.js.map +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -532,7 +532,7 @@ The CLI itself never holds any credentials beyond the scope of a single command
|
|
|
532
532
|
- [`zod`](https://github.com/colinhacks/zod) for runtime validation
|
|
533
533
|
- [`vitest`](https://vitest.dev) for tests
|
|
534
534
|
- [`tsup`](https://tsup.egoist.dev) for the single-file ESM build
|
|
535
|
-
- `
|
|
535
|
+
- ESLint v9 flat config for linting: a base pass (`pnpm lint`) plus a separate SonarJS pass (`pnpm lint:sonar`) for cognitive-complexity and hot-spot rules, mirroring the `@opuspopuli/regions` setup
|
|
536
536
|
|
|
537
537
|
## Contributing
|
|
538
538
|
|
|
@@ -541,6 +541,7 @@ This is a young project against the still-stabilizing `opuspopuli-node` template
|
|
|
541
541
|
```bash
|
|
542
542
|
pnpm install
|
|
543
543
|
pnpm dev -- --help # run from source
|
|
544
|
+
pnpm lint # eslint base pass
|
|
544
545
|
pnpm test # vitest
|
|
545
546
|
pnpm build # tsup → dist/
|
|
546
547
|
node dist/cli.js --help # test the built binary
|
package/dist/cli.js
CHANGED
|
@@ -1143,7 +1143,7 @@ var TUNNEL_TOKEN_RE = /^[A-Za-z0-9_\-.=]+$/;
|
|
|
1143
1143
|
var SAFE_PATH_RE = /^[A-Za-z0-9_\-./ ]+$/;
|
|
1144
1144
|
var SAFE_LAUNCHCTL_VALUE_RE = /^[A-Za-z0-9+/=._-]+$/;
|
|
1145
1145
|
var URL_SAFE_PASSWORD_RE = /^[A-Za-z0-9_-]+$/;
|
|
1146
|
-
var SAFE_URL_RE = /^[A-Za-z0-9:/_
|
|
1146
|
+
var SAFE_URL_RE = /^[A-Za-z0-9:/_.-]+$/;
|
|
1147
1147
|
var VERIFY_NETWORK_TIMEOUT_MS = 1e4;
|
|
1148
1148
|
var BODY_PREVIEW_MAX = 200;
|
|
1149
1149
|
|
|
@@ -1493,20 +1493,72 @@ set -euo pipefail
|
|
|
1493
1493
|
|
|
1494
1494
|
SVC="org.opuspopuli.${input.region}"
|
|
1495
1495
|
|
|
1496
|
+
# macOS \`security\` exit codes:
|
|
1497
|
+
# 0 = success
|
|
1498
|
+
# 36 = errSecInteractionNotAllowed (keychain is locked)
|
|
1499
|
+
# 44 = errSecItemNotFound (entry doesn't exist)
|
|
1500
|
+
# Earlier wrapper versions conflated 36 and 44 into a generic "missing"
|
|
1501
|
+
# message, which sent operators down the wrong path (re-bootstrap when
|
|
1502
|
+
# the real fix was \`security unlock-keychain\`).
|
|
1496
1503
|
require_secret() {
|
|
1497
1504
|
local account="$1"
|
|
1498
1505
|
local value
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1506
|
+
local rc=0
|
|
1507
|
+
value=$(security find-generic-password -s "$SVC" -a "$account" -w 2>/dev/null) || rc=$?
|
|
1508
|
+
case "$rc" in
|
|
1509
|
+
0)
|
|
1510
|
+
printf '%s' "$value"
|
|
1511
|
+
return 0
|
|
1512
|
+
;;
|
|
1513
|
+
36)
|
|
1514
|
+
cat >&2 <<EOM
|
|
1515
|
+
op-compose: keychain is LOCKED \u2014 could not read entry '$account'.
|
|
1516
|
+
SSH sessions don't auto-unlock the login keychain. Unlock with:
|
|
1517
|
+
security unlock-keychain ~/Library/Keychains/login.keychain-db
|
|
1518
|
+
Then re-run this command.
|
|
1519
|
+
EOM
|
|
1520
|
+
exit 1
|
|
1521
|
+
;;
|
|
1522
|
+
44)
|
|
1523
|
+
cat >&2 <<EOM
|
|
1524
|
+
op-compose: keychain entry '$account' is MISSING under service '$SVC'.
|
|
1525
|
+
Run: create-op-node bootstrap --region ${input.region}
|
|
1526
|
+
EOM
|
|
1527
|
+
exit 1
|
|
1528
|
+
;;
|
|
1529
|
+
*)
|
|
1530
|
+
echo "op-compose: \`security\` failed reading '$account' (exit $rc)." >&2
|
|
1531
|
+
exit 1
|
|
1532
|
+
;;
|
|
1533
|
+
esac
|
|
1505
1534
|
}
|
|
1506
1535
|
|
|
1536
|
+
# Used for entries that may legitimately not exist (TUNNEL_TOKEN in
|
|
1537
|
+
# local-only mode, prompt-service secrets when colocation isn't active).
|
|
1538
|
+
# Treats exit 44 (missing) as a silent OK \u2014 returns empty string.
|
|
1539
|
+
# Treats exit 36 (locked) as a hard error, since the require_secret calls
|
|
1540
|
+
# at the top of the wrapper would have caught this first in normal use;
|
|
1541
|
+
# reaching this path means something else bypassed the lock check.
|
|
1507
1542
|
optional_secret() {
|
|
1508
1543
|
local account="$1"
|
|
1509
|
-
|
|
1544
|
+
local value
|
|
1545
|
+
local rc=0
|
|
1546
|
+
value=$(security find-generic-password -s "$SVC" -a "$account" -w 2>/dev/null) || rc=$?
|
|
1547
|
+
case "$rc" in
|
|
1548
|
+
0) printf '%s' "$value" ;;
|
|
1549
|
+
44) ;; # legitimately absent \u2014 empty string is correct
|
|
1550
|
+
36)
|
|
1551
|
+
cat >&2 <<EOM
|
|
1552
|
+
op-compose: keychain is LOCKED \u2014 could not probe optional entry '$account'.
|
|
1553
|
+
Unlock with: security unlock-keychain ~/Library/Keychains/login.keychain-db
|
|
1554
|
+
EOM
|
|
1555
|
+
exit 1
|
|
1556
|
+
;;
|
|
1557
|
+
*)
|
|
1558
|
+
echo "op-compose: \`security\` failed reading '$account' (exit $rc)." >&2
|
|
1559
|
+
exit 1
|
|
1560
|
+
;;
|
|
1561
|
+
esac
|
|
1510
1562
|
}
|
|
1511
1563
|
|
|
1512
1564
|
# Bootstrap-critical: Postgres + Supabase admin credentials.
|
|
@@ -4400,7 +4452,7 @@ async function looksLikeRegionsRepo(dir) {
|
|
|
4400
4452
|
}
|
|
4401
4453
|
|
|
4402
4454
|
// src/cli.ts
|
|
4403
|
-
var VERSION = "0.10.
|
|
4455
|
+
var VERSION = "0.10.3";
|
|
4404
4456
|
var program = new Command();
|
|
4405
4457
|
program.name("create-op-node").description(
|
|
4406
4458
|
"Interactive bootstrap for an Opus Populi federation node.\nCloudflare infrastructure \u2192 Mac Studio \u2192 live public API."
|