passcontrol 0.1.0 → 0.1.1

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.
@@ -265,6 +265,53 @@ function commandExists(command) {
265
265
  }
266
266
  }
267
267
 
268
+ function checkDockerInstalled() {
269
+ return commandExists("docker")
270
+ ? { ok: true, message: "Docker CLI: installed." }
271
+ : {
272
+ ok: false,
273
+ message: "Docker CLI: not installed. Fix: install Docker Desktop from https://docs.docker.com/desktop/.",
274
+ };
275
+ }
276
+
277
+ function checkDockerDaemon() {
278
+ if (!commandExists("docker")) {
279
+ return {
280
+ ok: false,
281
+ message: "Docker daemon: unavailable. Fix: install Docker Desktop, start it, and wait for the engine to become ready.",
282
+ };
283
+ }
284
+ try {
285
+ execFileSync("docker", ["info"], { stdio: "ignore" });
286
+ return { ok: true, message: "Docker daemon: running." };
287
+ } catch {
288
+ return {
289
+ ok: false,
290
+ message: "Docker daemon: not running. Fix: start Docker Desktop and wait for the engine to become ready.",
291
+ };
292
+ }
293
+ }
294
+
295
+ function checkSupabaseInstalled() {
296
+ return commandExists("supabase")
297
+ ? { ok: true, message: "Supabase CLI: installed." }
298
+ : {
299
+ ok: false,
300
+ message: "Supabase CLI: not installed. Fix: install it from https://supabase.com/docs/guides/local-development/cli/getting-started.",
301
+ };
302
+ }
303
+
304
+ function checkNodeVersion() {
305
+ const version = process.versions.node;
306
+ const major = Number(version.split(".")[0]);
307
+ return major >= 18
308
+ ? { ok: true, message: `Node.js: v${version} (supported).` }
309
+ : {
310
+ ok: false,
311
+ message: `Node.js: v${version} is unsupported. Fix: install Node.js 18 or newer from https://nodejs.org/.`,
312
+ };
313
+ }
314
+
268
315
  async function promptLine(question, fallback) {
269
316
  const rl = createInterface({ input: process.stdin, output: process.stdout });
270
317
  try {
@@ -435,8 +482,10 @@ async function waitForGateway(timeoutMs = 30000) {
435
482
  }
436
483
 
437
484
  function ownSupabaseDatabaseIsRunning(offset = 0) {
438
- const project = `${path.basename(appRoot)}${offset ? `-${offset}` : ""}`;
439
485
  try {
486
+ const root = appRoot ?? resolveAppRoot();
487
+ if (!root) return false;
488
+ const project = `${path.basename(root)}${offset ? `-${offset}` : ""}`;
440
489
  return Boolean(
441
490
  execFileSync("docker", ["ps", "-q", "--filter", `name=^/supabase_db_${project}$`], { encoding: "utf8" }).trim()
442
491
  );
@@ -458,6 +507,39 @@ async function assertLocalStackPortsAvailable(offset = 0) {
458
507
  }
459
508
  }
460
509
 
510
+ async function checkLocalStackPorts(offset = 0) {
511
+ try {
512
+ await assertLocalStackPortsAvailable(offset);
513
+ return { ok: true, message: "Local stack ports: available." };
514
+ } catch (error) {
515
+ return {
516
+ ok: false,
517
+ message: `Local stack ports: unavailable. Fix: stop the conflicting project or rerun setup with --port-offset N. Details: ${error.message}`,
518
+ };
519
+ }
520
+ }
521
+
522
+ async function runLocalPrerequisiteChecks({ offset = 0, report = false, enforce = false } = {}) {
523
+ const results = [
524
+ checkDockerInstalled(),
525
+ checkDockerDaemon(),
526
+ checkSupabaseInstalled(),
527
+ checkNodeVersion(),
528
+ await checkLocalStackPorts(offset),
529
+ ];
530
+
531
+ if (report) {
532
+ step("Local prerequisites");
533
+ for (const result of results) (result.ok ? ok : fail)(result.message);
534
+ }
535
+
536
+ if (enforce) {
537
+ const failure = results.find((result) => !result.ok);
538
+ if (failure) throw new Error(failure.message);
539
+ }
540
+ return results;
541
+ }
542
+
461
543
  async function startDashboard(opts = {}) {
462
544
  await ensureAppRoot({ clone: true, appDir: opts.appDir, yes: opts.yes });
463
545
  const dashboard = localDashboard();
@@ -609,8 +691,8 @@ async function setupLocal(opts = {}) {
609
691
  if (!Number.isInteger(offset) || offset < 0 || offset > 10000) {
610
692
  throw new Error("--port-offset must be an integer from 0 to 10000.");
611
693
  }
694
+ await runLocalPrerequisiteChecks({ offset, enforce: true });
612
695
  await ensureAppRoot({ clone: true, appDir: opts.appDir, yes: opts.yes });
613
- await assertLocalStackPortsAvailable(offset);
614
696
  step("Preparing the local Supabase, Redis, migrations, and dev user…");
615
697
  await runLocalCommand(process.platform === "win32" ? "npm.cmd" : "npm", ["run", "dev:stack"], {
616
698
  ...process.env,
@@ -1082,6 +1164,7 @@ async function doctorCommand(opts = {}) {
1082
1164
 
1083
1165
  console.log("");
1084
1166
  step("Deep checks");
1167
+ await runLocalPrerequisiteChecks({ report: true });
1085
1168
  if (config.passportId && config.passportSecret) {
1086
1169
  try {
1087
1170
  const visa = await mintVisa(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passcontrol",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Secure Agent Control Plane & Passport Vault — identity-aware reverse proxy for AI agent credentials.",
5
5
  "license": "BUSL-1.1",
6
6
  "homepage": "https://github.com/Vertias3u/PassControl#readme",