sproutkit-code 1.5.0 → 1.5.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.
Files changed (2) hide show
  1. package/dist/index.js +61 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -94446,7 +94446,10 @@ Interested?`;
94446
94446
  const status = input.status;
94447
94447
  const city = input.city;
94448
94448
  const limit = Math.min(Number(input.limit ?? 25), 100);
94449
- let sql = "SELECT id, name, status, type, city, phone, site_url, website, lead_kind, booking_status, booking_platform, booking_url FROM leads";
94449
+ let sql = `SELECT id, name, status, type, city, phone, email, site_url, website, lead_kind,
94450
+ booking_status, booking_platform, booking_url, admin_url, custom_domain,
94451
+ handed_over_at
94452
+ FROM leads`;
94450
94453
  const conds = [];
94451
94454
  const params = [];
94452
94455
  if (status) {
@@ -95833,7 +95836,7 @@ var require_package2 = __commonJS({
95833
95836
  "package.json"(exports2, module2) {
95834
95837
  module2.exports = {
95835
95838
  name: "sproutkit-code",
95836
- version: "1.5.0",
95839
+ version: "1.5.1",
95837
95840
  description: "Sproutkit in your terminal \u2014 find leads, build sites, run outreach, all via chat.",
95838
95841
  bin: {
95839
95842
  sproutkit: "./dist/index.js"
@@ -96963,10 +96966,64 @@ async function cmdList(argv) {
96963
96966
  say(c.dim(' No leads yet. Try: sproutkit find "barbers in <area>"'));
96964
96967
  return;
96965
96968
  }
96969
+ renderLeadTable(rows);
96970
+ }
96971
+ var STAGE_LABEL = {
96972
+ discovered: "New",
96973
+ site_built: "Built",
96974
+ contacted: "Contacted",
96975
+ replied: "Replied",
96976
+ won: "Won",
96977
+ dead: "Dead"
96978
+ };
96979
+ function cell(text, width) {
96980
+ const t = text ?? "";
96981
+ if (t.length === width) return t;
96982
+ if (t.length < width) return t + " ".repeat(width - t.length);
96983
+ return width <= 1 ? t.slice(0, width) : t.slice(0, width - 1) + "\u2026";
96984
+ }
96985
+ function renderLeadTable(rows) {
96986
+ const term = process.stdout.columns && process.stdout.columns > 40 ? process.stdout.columns : 100;
96987
+ const idW = Math.max(3, ...rows.map((r) => String(r.id).length + 1));
96988
+ const stageW = Math.max(5, ...rows.map((r) => (STAGE_LABEL[r.status] ?? r.status).length));
96989
+ const placeW = Math.min(14, Math.max(5, ...rows.map((r) => (r.city || "").length)));
96990
+ const fixed = 2 + idW + 2 + stageW + 2 + placeW + 2;
96991
+ const nameW = Math.max(16, Math.min(34, term - fixed - 24));
96966
96992
  say();
96993
+ say(
96994
+ " " + c.dim(
96995
+ cell("ID", idW) + " " + cell("BUSINESS", nameW) + " " + cell("STAGE", stageW) + " " + cell("AREA", placeW) + " WHAT THEY HAVE"
96996
+ )
96997
+ );
96998
+ say(" " + c.dim("\u2500".repeat(Math.min(term - 4, idW + nameW + stageW + placeW + 23))));
96967
96999
  for (const r of rows) {
96968
- const site = r.site_url ? c.dim(` ${r.site_url}`) : "";
96969
- say(` ${c.greenBold("#" + r.id)} ${c.bold(r.name)} ${c.dim(`\xB7 ${r.status} \xB7 ${r.type}, ${r.city}`)}${site}`);
97000
+ const stage = STAGE_LABEL[r.status] ?? r.status;
97001
+ const stageColoured = r.status === "won" ? c.greenBold(cell(stage, stageW)) : r.status === "site_built" || r.status === "replied" ? c.green(cell(stage, stageW)) : r.status === "dead" ? c.dim(cell(stage, stageW)) : c.dim(cell(stage, stageW));
97002
+ const short = (u) => u.replace(/^https?:\/\//, "").replace(/\/$/, "");
97003
+ const assets = [];
97004
+ if (r.custom_domain) assets.push(c.cyan(r.custom_domain));
97005
+ else if (r.site_url) assets.push(short(r.site_url));
97006
+ if (r.booking_url) assets.push(r.site_url ? c.dim("+ booking") : short(r.booking_url));
97007
+ if (r.admin_url) assets.push(c.dim("+ admin"));
97008
+ if (!r.site_url && !r.booking_url && r.website) {
97009
+ assets.push(c.dim("own site: " + short(r.website)));
97010
+ }
97011
+ if (assets.length === 0) assets.push(c.dim("\u2014"));
97012
+ if (r.handed_over_at) assets.push(c.greenBold("\u2713 delivered"));
97013
+ say(
97014
+ " " + c.dim(cell("#" + r.id, idW)) + " " + c.bold(cell(r.name, nameW)) + " " + stageColoured + " " + c.dim(cell(r.city || "\u2014", placeW)) + " " + assets.join(c.dim(" \xB7 "))
97015
+ );
97016
+ }
97017
+ const counts = rows.reduce((acc, r) => {
97018
+ acc[r.status] = (acc[r.status] ?? 0) + 1;
97019
+ return acc;
97020
+ }, {});
97021
+ const order = ["discovered", "site_built", "contacted", "replied", "won", "dead"];
97022
+ const summary = order.filter((k) => counts[k]).map((k) => `${counts[k]} ${(STAGE_LABEL[k] ?? k).toLowerCase()}`).join(c.dim(" \xB7 "));
97023
+ say();
97024
+ say(" " + c.dim(`${rows.length} lead${rows.length === 1 ? "" : "s"} shown \u2014 `) + summary);
97025
+ if (rows.length >= 25) {
97026
+ say(c.dim(" More may exist \u2014 use --limit 100, or --status/--city to narrow."));
96970
97027
  }
96971
97028
  say();
96972
97029
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sproutkit-code",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Sproutkit in your terminal — find leads, build sites, run outreach, all via chat.",
5
5
  "bin": {
6
6
  "sproutkit": "./dist/index.js"