@hasna/domains 0.0.5 → 0.0.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqE5D"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2G5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgZ5D"}
1
+ {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8d5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8D9D"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuJ9D"}
package/dist/cli/index.js CHANGED
@@ -33944,11 +33944,14 @@ function listDomains(options = {}) {
33944
33944
  sql += " WHERE " + conditions.join(" AND ");
33945
33945
  }
33946
33946
  sql += " ORDER BY name";
33947
- if (options.limit) {
33947
+ if (options.limit !== undefined) {
33948
33948
  sql += " LIMIT ?";
33949
33949
  params.push(options.limit);
33950
33950
  }
33951
- if (options.offset) {
33951
+ if (options.offset !== undefined && options.offset > 0) {
33952
+ if (options.limit === undefined) {
33953
+ sql += " LIMIT -1";
33954
+ }
33952
33955
  sql += " OFFSET ?";
33953
33956
  params.push(options.offset);
33954
33957
  }
@@ -42353,10 +42356,25 @@ function resolveContact(opts) {
42353
42356
  // src/cli/commands/domain.ts
42354
42357
  function registerDomainCommand(program2) {
42355
42358
  const domain = program2.command("domain").description("Domain portfolio management");
42356
- domain.command("list").description("List all domains in the portfolio").option("--status <status>", "Filter by status (active/expired/transferring/redemption)").option("--registrar <name>", "Filter by registrar").option("--json", "Output JSON").action((opts) => {
42357
- const domains = listDomains({ status: opts.status, registrar: opts.registrar });
42359
+ domain.command("list").description("List all domains in the portfolio").option("--status <status>", "Filter by status (active/expired/transferring/redemption)").option("--registrar <name>", "Filter by registrar").option("--limit <n>", "Limit number of returned domains").option("--offset <n>", "Skip first N domains", "0").option("-j, --json", "Output JSON").action((opts) => {
42360
+ const limit = opts.limit ? parseInt(opts.limit, 10) : undefined;
42361
+ const offset = opts.offset ? parseInt(opts.offset, 10) : 0;
42362
+ if (limit !== undefined && (!Number.isInteger(limit) || limit < 0)) {
42363
+ console.error("--limit must be a non-negative integer");
42364
+ process.exit(1);
42365
+ }
42366
+ if (!Number.isInteger(offset) || offset < 0) {
42367
+ console.error("--offset must be a non-negative integer");
42368
+ process.exit(1);
42369
+ }
42370
+ const domains = listDomains({
42371
+ status: opts.status,
42372
+ registrar: opts.registrar,
42373
+ limit,
42374
+ offset
42375
+ });
42358
42376
  if (opts.json) {
42359
- console.log(JSON.stringify({ domains, count: domains.length }, null, 2));
42377
+ console.log(JSON.stringify({ domains, count: domains.length, limit: limit ?? null, offset }, null, 2));
42360
42378
  return;
42361
42379
  }
42362
42380
  if (domains.length === 0) {
@@ -42369,8 +42387,11 @@ function registerDomainCommand(program2) {
42369
42387
  }
42370
42388
  console.log(`
42371
42389
  ${domains.length} domain(s)`);
42390
+ if (limit !== undefined || offset > 0) {
42391
+ console.log(`Page: limit=${limit ?? "all"}, offset=${offset}`);
42392
+ }
42372
42393
  });
42373
- domain.command("get <id>").description("Get a domain by ID").option("--json", "Output JSON").action((id, opts) => {
42394
+ domain.command("get <id>").description("Get a domain by ID").option("-j, --json", "Output JSON").action((id, opts) => {
42374
42395
  const d3 = getDomain(id);
42375
42396
  if (!d3) {
42376
42397
  console.error(`Domain '${id}' not found.`);
@@ -42391,7 +42412,7 @@ ${d3.name} [${d3.status}]`);
42391
42412
  console.log(` Notes: ${d3.notes}`);
42392
42413
  console.log();
42393
42414
  });
42394
- domain.command("add").description("Add a domain to the portfolio").requiredOption("--name <name>", "Domain name").option("--registrar <name>", "Registrar name").option("--status <s>", "Status (active/expired/transferring/redemption)", "active").option("--expires <date>", "Expiry date (YYYY-MM-DD)").option("--notes <text>", "Notes").option("--json", "Output JSON").action((opts) => {
42415
+ domain.command("add").description("Add a domain to the portfolio").requiredOption("--name <name>", "Domain name").option("--registrar <name>", "Registrar name").option("--status <s>", "Status (active/expired/transferring/redemption)", "active").option("--expires <date>", "Expiry date (YYYY-MM-DD)").option("--notes <text>", "Notes").option("-j, --json", "Output JSON").action((opts) => {
42395
42416
  const d3 = createDomain({
42396
42417
  name: opts.name,
42397
42418
  registrar: opts.registrar,
@@ -42405,7 +42426,7 @@ ${d3.name} [${d3.status}]`);
42405
42426
  }
42406
42427
  console.log(`Created domain: ${d3.name} (${d3.id})`);
42407
42428
  });
42408
- domain.command("update <id>").description("Update a domain").option("--registrar <name>", "Registrar").option("--status <s>", "Status").option("--expires <date>", "Expiry date").option("--notes <text>", "Notes").option("--json", "Output JSON").action((id, opts) => {
42429
+ domain.command("update <id>").description("Update a domain").option("--registrar <name>", "Registrar").option("--status <s>", "Status").option("--expires <date>", "Expiry date").option("--notes <text>", "Notes").option("-j, --json", "Output JSON").action((id, opts) => {
42409
42430
  const d3 = updateDomain(id, {
42410
42431
  registrar: opts.registrar,
42411
42432
  status: opts.status,
@@ -42422,16 +42443,34 @@ ${d3.name} [${d3.status}]`);
42422
42443
  }
42423
42444
  console.log(`Updated: ${d3.name}`);
42424
42445
  });
42425
- domain.command("delete <id>").description("Delete a domain from the portfolio").action((id) => {
42446
+ domain.command("delete <id>").description("Delete a domain from the portfolio").option("-f, --force", "Required confirmation for destructive delete").option("-j, --json", "Output JSON").action((id, opts) => {
42447
+ if (!opts.force) {
42448
+ const message = `Refusing to delete domain '${id}' without --force.`;
42449
+ if (opts.json) {
42450
+ console.log(JSON.stringify({ deleted: false, id, error: message }, null, 2));
42451
+ } else {
42452
+ console.error(message);
42453
+ console.error("Re-run with --force to confirm deletion.");
42454
+ }
42455
+ process.exit(1);
42456
+ }
42426
42457
  const deleted = deleteDomain(id);
42427
- if (deleted)
42428
- console.log(`Deleted domain ${id}`);
42429
- else {
42430
- console.error(`Domain '${id}' not found.`);
42458
+ if (!deleted) {
42459
+ const message = `Domain '${id}' not found.`;
42460
+ if (opts.json) {
42461
+ console.log(JSON.stringify({ deleted: false, id, error: message }, null, 2));
42462
+ } else {
42463
+ console.error(message);
42464
+ }
42431
42465
  process.exit(1);
42432
42466
  }
42467
+ if (opts.json) {
42468
+ console.log(JSON.stringify({ deleted: true, id }, null, 2));
42469
+ return;
42470
+ }
42471
+ console.log(`Deleted domain ${id}`);
42433
42472
  });
42434
- domain.command("search <query>").description("Search domains by name, registrar, or notes").option("--json", "Output JSON").action((query, opts) => {
42473
+ domain.command("search <query>").description("Search domains by name, registrar, or notes").option("-j, --json", "Output JSON").action((query, opts) => {
42435
42474
  const results = searchDomains(query);
42436
42475
  if (opts.json) {
42437
42476
  console.log(JSON.stringify({ results, count: results.length }, null, 2));
@@ -42442,7 +42481,7 @@ ${d3.name} [${d3.status}]`);
42442
42481
  if (results.length === 0)
42443
42482
  console.log("No results.");
42444
42483
  });
42445
- domain.command("expiring").description("List domains expiring soon").option("--days <n>", "Days threshold", "30").option("--json", "Output JSON").action((opts) => {
42484
+ domain.command("expiring").description("List domains expiring soon").option("--days <n>", "Days threshold", "30").option("-j, --json", "Output JSON").action((opts) => {
42446
42485
  const domains = listExpiring(parseInt(opts.days));
42447
42486
  if (opts.json) {
42448
42487
  console.log(JSON.stringify(domains, null, 2));
@@ -42458,7 +42497,7 @@ Expiring within ${opts.days} days:`);
42458
42497
  console.log(` ${d3.name.padEnd(40)} expires ${(d3.expires_at ?? "").split("T")[0]}`);
42459
42498
  console.log();
42460
42499
  });
42461
- domain.command("stats").description("Show portfolio statistics").option("--json", "Output JSON").action((opts) => {
42500
+ domain.command("stats").description("Show portfolio statistics").option("-j, --json", "Output JSON").action((opts) => {
42462
42501
  const stats = getDomainStats();
42463
42502
  if (opts.json) {
42464
42503
  console.log(JSON.stringify(stats, null, 2));
@@ -42469,7 +42508,7 @@ Expiring within ${opts.days} days:`);
42469
42508
  console.log(` ${k3.replace(/_/g, " ")}: ${v3}`);
42470
42509
  }
42471
42510
  });
42472
- domain.command("whois <name>").description("Run WHOIS lookup and update local DB record").option("--json", "Output JSON").action((name, opts) => {
42511
+ domain.command("whois <name>").description("Run WHOIS lookup and update local DB record").option("-j, --json", "Output JSON").action((name, opts) => {
42473
42512
  const result = whoisLookup(name);
42474
42513
  if (opts.json) {
42475
42514
  console.log(JSON.stringify(result, null, 2));
@@ -42488,7 +42527,7 @@ WHOIS for ${result.domain}:`);
42488
42527
  const output = exportPortfolio(opts.format);
42489
42528
  console.log(output);
42490
42529
  });
42491
- domain.command("check <domains...>").description("Check domain availability via configured registrar").option("--provider <name>", "Registrar provider to use").action(async (domains, opts) => {
42530
+ domain.command("check <domains...>").description("Check domain availability via configured registrar").option("--provider <name>", "Registrar provider to use").option("-j, --json", "Output JSON").action(async (domains, opts) => {
42492
42531
  const cfg = loadConfig3();
42493
42532
  const providerName = opts.provider ?? cfg.default_registrar ?? "route53";
42494
42533
  const results = await Promise.allSettled(domains.map(async (d3) => {
@@ -42496,17 +42535,33 @@ WHOIS for ${result.domain}:`);
42496
42535
  return provider.checkAvailability(d3);
42497
42536
  }));
42498
42537
  let anyError = false;
42538
+ const output = [];
42499
42539
  for (let i3 = 0;i3 < domains.length; i3++) {
42500
42540
  const r3 = results[i3];
42501
42541
  if (r3.status === "rejected") {
42502
42542
  const reason = r3.reason;
42503
- console.error(`\u2717 ${domains[i3]}: ${reason instanceof Error ? reason.message : String(reason)}`);
42543
+ const error = reason instanceof Error ? reason.message : String(reason);
42544
+ output.push({ domain: domains[i3], error });
42545
+ if (!opts.json) {
42546
+ console.error(`\u2717 ${domains[i3]}: ${error}`);
42547
+ }
42504
42548
  anyError = true;
42505
42549
  } else {
42506
42550
  const result = r3.value;
42507
- console.log(`${result.available ? "\u2713" : "\u2717"} ${result.domain} is ${result.available ? "available" : "not available"}`);
42551
+ output.push({ domain: result.domain, available: result.available });
42552
+ if (!opts.json) {
42553
+ console.log(`${result.available ? "\u2713" : "\u2717"} ${result.domain} is ${result.available ? "available" : "not available"}`);
42554
+ }
42508
42555
  }
42509
42556
  }
42557
+ if (opts.json) {
42558
+ console.log(JSON.stringify({
42559
+ provider: providerName,
42560
+ count: output.length,
42561
+ ok: !anyError,
42562
+ results: output
42563
+ }, null, 2));
42564
+ }
42510
42565
  if (anyError)
42511
42566
  process.exit(1);
42512
42567
  });
@@ -43137,7 +43192,7 @@ function registerMonitorCommand(program2) {
43137
43192
  // src/cli/commands/provider.ts
43138
43193
  function registerProviderCommand(program2) {
43139
43194
  const provider = program2.command("provider").description("Configure and test registrar/DNS providers");
43140
- provider.command("list").description("Show all providers and their configuration status").option("--json", "Output JSON").action((opts) => {
43195
+ provider.command("list").description("Show all providers and their configuration status").option("-j, --json", "Output JSON").action((opts) => {
43141
43196
  const providers = getAvailableProviders();
43142
43197
  if (opts.json) {
43143
43198
  console.log(JSON.stringify(providers, null, 2));
@@ -43155,37 +43210,95 @@ Registrar / DNS Providers:`);
43155
43210
  }
43156
43211
  console.log();
43157
43212
  });
43158
- provider.command("test <name>").description("Live-test a provider's credentials").action(async (name) => {
43213
+ provider.command("test <name>").description("Live-test a provider's credentials").option("-j, --json", "Output JSON").action(async (name, opts) => {
43159
43214
  const providers = getAvailableProviders();
43160
43215
  const info = providers.find((p3) => p3.name === name);
43161
43216
  if (!info) {
43162
- console.error(`Unknown provider: ${name}`);
43217
+ const error = `Unknown provider: ${name}`;
43218
+ if (opts.json) {
43219
+ console.log(JSON.stringify({ provider: name, ok: false, error }, null, 2));
43220
+ } else {
43221
+ console.error(error);
43222
+ }
43163
43223
  process.exit(1);
43164
43224
  }
43165
43225
  if (!info.configured) {
43166
- console.error(`\u2717 ${name} is not configured. Set: ${info.envVars.join(", ")}`);
43226
+ const error = `${name} is not configured. Set: ${info.envVars.join(", ")}`;
43227
+ if (opts.json) {
43228
+ console.log(JSON.stringify({
43229
+ provider: name,
43230
+ ok: false,
43231
+ configured: false,
43232
+ required_env: info.envVars,
43233
+ error
43234
+ }, null, 2));
43235
+ } else {
43236
+ console.error(`\u2717 ${error}`);
43237
+ }
43167
43238
  process.exit(1);
43168
43239
  }
43169
- console.log(`Testing ${name}...`);
43240
+ if (!opts.json) {
43241
+ console.log(`Testing ${name}...`);
43242
+ }
43243
+ let registrarOk = null;
43244
+ let dnsOk = null;
43170
43245
  try {
43171
43246
  if (info.type === "registrar" || info.type === "full") {
43172
43247
  const reg = getRegistrarProvider(name);
43173
43248
  await reg.listDomains();
43174
- console.log(`\u2713 Registrar connection OK`);
43249
+ registrarOk = true;
43250
+ if (!opts.json)
43251
+ console.log("\u2713 Registrar connection OK");
43175
43252
  }
43176
43253
  if (info.type === "dns" || info.type === "full") {
43177
43254
  const dns = getDnsProvider(name);
43178
43255
  await dns.getDnsRecords("__test_nonexistent_domain__.invalid");
43179
- console.log(`\u2713 DNS connection OK`);
43256
+ dnsOk = true;
43257
+ if (!opts.json)
43258
+ console.log("\u2713 DNS connection OK");
43259
+ }
43260
+ if (opts.json) {
43261
+ console.log(JSON.stringify({
43262
+ provider: name,
43263
+ ok: true,
43264
+ configured: true,
43265
+ type: info.type,
43266
+ registrar_ok: registrarOk,
43267
+ dns_ok: dnsOk
43268
+ }, null, 2));
43180
43269
  }
43181
43270
  } catch (e3) {
43182
43271
  const msg = e3 instanceof Error ? e3.message : String(e3);
43183
43272
  if (msg.includes("not found") || msg.includes("No hosted zone") || msg.includes("NXDOMAIN")) {
43184
- console.log(`\u2713 Connection OK (no domains yet)`);
43273
+ if (opts.json) {
43274
+ console.log(JSON.stringify({
43275
+ provider: name,
43276
+ ok: true,
43277
+ configured: true,
43278
+ type: info.type,
43279
+ registrar_ok: registrarOk,
43280
+ dns_ok: true,
43281
+ note: "connection-ok-no-domains-yet"
43282
+ }, null, 2));
43283
+ } else {
43284
+ console.log("\u2713 Connection OK (no domains yet)");
43285
+ }
43286
+ return;
43287
+ }
43288
+ if (opts.json) {
43289
+ console.log(JSON.stringify({
43290
+ provider: name,
43291
+ ok: false,
43292
+ configured: true,
43293
+ type: info.type,
43294
+ registrar_ok: registrarOk,
43295
+ dns_ok: dnsOk,
43296
+ error: msg
43297
+ }, null, 2));
43185
43298
  } else {
43186
43299
  console.error(`\u2717 ${name} test failed: ${msg}`);
43187
- process.exit(1);
43188
43300
  }
43301
+ process.exit(1);
43189
43302
  }
43190
43303
  });
43191
43304
  }
@@ -43256,29 +43369,41 @@ Configuration (~/.hasna/domains/config.json):`);
43256
43369
  // src/cli/commands/doctor.ts
43257
43370
  import { execSync as execSync2 } from "child_process";
43258
43371
  function registerDoctorCommand(program2) {
43259
- program2.command("doctor").description("Run diagnostics \u2014 check credentials, DB, and provider connectivity").action(async () => {
43372
+ program2.command("doctor").description("Run diagnostics \u2014 check credentials, DB, and provider connectivity").option("--json", "Output structured JSON").action(async (opts) => {
43260
43373
  let passed = 0;
43261
43374
  let failed = 0;
43375
+ const checks = [];
43376
+ let currentSection = "general";
43377
+ function section(name) {
43378
+ currentSection = name;
43379
+ if (!opts.json) {
43380
+ console.log(`
43381
+ \u2500\u2500 ${name} \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
43382
+ }
43383
+ }
43262
43384
  function ok(msg) {
43263
- console.log(` \u2713 ${msg}`);
43385
+ checks.push({ section: currentSection, status: "pass", message: msg });
43386
+ if (!opts.json)
43387
+ console.log(` \u2713 ${msg}`);
43264
43388
  passed++;
43265
43389
  }
43266
43390
  function fail(msg, fix) {
43267
- console.log(` \u2717 ${msg}`);
43268
- if (fix)
43269
- console.log(` \u2192 ${fix}`);
43391
+ checks.push({ section: currentSection, status: "fail", message: msg, fix });
43392
+ if (!opts.json) {
43393
+ console.log(` \u2717 ${msg}`);
43394
+ if (fix)
43395
+ console.log(` \u2192 ${fix}`);
43396
+ }
43270
43397
  failed++;
43271
43398
  }
43272
- console.log(`
43273
- \u2500\u2500 Database \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
43399
+ section("Database");
43274
43400
  try {
43275
43401
  const count = countDomains();
43276
43402
  ok(`Local DB accessible (${count} domain${count !== 1 ? "s" : ""})`);
43277
- } catch (e3) {
43278
- fail("Local DB not accessible", `Check ~/.hasna/domains/domains.db`);
43403
+ } catch {
43404
+ fail("Local DB not accessible", "Check ~/.hasna/domains/domains.db");
43279
43405
  }
43280
- console.log(`
43281
- \u2500\u2500 Config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
43406
+ section("Config");
43282
43407
  const cfg = loadConfig3();
43283
43408
  if (cfg.default_registrar)
43284
43409
  ok(`default-registrar: ${cfg.default_registrar}`);
@@ -43294,8 +43419,7 @@ function registerDoctorCommand(program2) {
43294
43419
  ok("Registrant contact info complete");
43295
43420
  else
43296
43421
  fail(`Missing contact fields: ${missingContact.join(", ")}`, "domains config set contact.<field> <value>");
43297
- console.log(`
43298
- \u2500\u2500 Providers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
43422
+ section("Providers");
43299
43423
  const providers = getAvailableProviders().filter((p3) => p3.name !== "brandsight");
43300
43424
  for (const p3 of providers) {
43301
43425
  if (!p3.configured) {
@@ -43320,18 +43444,26 @@ function registerDoctorCommand(program2) {
43320
43444
  }
43321
43445
  }
43322
43446
  }
43323
- console.log(`
43324
- \u2500\u2500 Tools \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
43447
+ section("Tools");
43325
43448
  try {
43326
43449
  execSync2("whois --version 2>/dev/null || whois example.com 2>/dev/null", { timeout: 3000 });
43327
43450
  ok("whois binary found");
43328
43451
  } catch {
43329
43452
  fail("whois not installed", "apt install whois / brew install whois");
43330
43453
  }
43331
- console.log(`
43454
+ if (opts.json) {
43455
+ console.log(JSON.stringify({
43456
+ passed,
43457
+ failed,
43458
+ healthy: failed === 0,
43459
+ checks
43460
+ }, null, 2));
43461
+ } else {
43462
+ console.log(`
43332
43463
  ${"\u2500".repeat(45)}`);
43333
- console.log(` ${passed} passed / ${failed} failed
43464
+ console.log(` ${passed} passed / ${failed} failed
43334
43465
  `);
43466
+ }
43335
43467
  if (failed > 0)
43336
43468
  process.exit(1);
43337
43469
  });
@@ -1 +1 @@
1
- {"version":3,"file":"domain-records.d.ts","sourceRoot":"","sources":["../../src/db/domain-records.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,cAAc,GAAG,YAAY,CAAC;IAC7D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAA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AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAYtD;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,cAAc,IAAI,WAAW,CAwC5C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI3D"}
package/dist/index.js CHANGED
@@ -31899,11 +31899,14 @@ function listDomains(options = {}) {
31899
31899
  sql += " WHERE " + conditions.join(" AND ");
31900
31900
  }
31901
31901
  sql += " ORDER BY name";
31902
- if (options.limit) {
31902
+ if (options.limit !== undefined) {
31903
31903
  sql += " LIMIT ?";
31904
31904
  params.push(options.limit);
31905
31905
  }
31906
- if (options.offset) {
31906
+ if (options.offset !== undefined && options.offset > 0) {
31907
+ if (options.limit === undefined) {
31908
+ sql += " LIMIT -1";
31909
+ }
31907
31910
  sql += " OFFSET ?";
31908
31911
  params.push(options.offset);
31909
31912
  }
package/dist/mcp/index.js CHANGED
@@ -44845,11 +44845,14 @@ function listDomains(options = {}) {
44845
44845
  sql += " WHERE " + conditions.join(" AND ");
44846
44846
  }
44847
44847
  sql += " ORDER BY name";
44848
- if (options.limit) {
44848
+ if (options.limit !== undefined) {
44849
44849
  sql += " LIMIT ?";
44850
44850
  params.push(options.limit);
44851
44851
  }
44852
- if (options.offset) {
44852
+ if (options.offset !== undefined && options.offset > 0) {
44853
+ if (options.limit === undefined) {
44854
+ sql += " LIMIT -1";
44855
+ }
44853
44856
  sql += " OFFSET ?";
44854
44857
  params.push(options.offset);
44855
44858
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/domains",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Domain portfolio and DNS management for AI agents — CLI + MCP server with SQLite",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",