Public: anyone can read this; the crew can change it.

A deal opened as a cash offer has no appraisal or financing dates and asks for no lender, and says "Cash" on the clock and its page #175

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/deal-clock:mason/166-a-deal-opened-as-a-cash-offer-has-no-app → main 5 commits fork 3 threads · 3 unresolved

  • Merged. mason/166-a-deal-opened-as-a-cash-offer-has-no-app was merged into main as 17ae8be.

Review

Sign in to review this change.
22 files changed +299 −30
README.md +3 −1
@@ -86,7 +86,9 @@ listing in the samples.
8686 date, and which side you are on. The standard lengths (earnest money deposit 3
8787 days, inspection 10, appraisal 21, financing 30, title 14, final walkthrough
8888 the day before closing) are filled in and you can change them; **Check the
89 dates** shows every date the deal would get without saving anything. On a deal's page
89 dates** shows every date the deal would get without saving anything. Tick
90 **Cash offer (no loan)** and the deal gets no appraisal or financing date and
91 no lender is asked for anything; "Cash" shows beside the side. On a deal's page
9092 you can add a party (**Use someone from your other deals** fills in a person
9193 you already have), fix a typo with Edit, add a date the contract added (an HOA
9294 review), waive a contingency the buyer gave up, change who owes a date, correct
contract/openapi.json +19
@@ -444,6 +444,11 @@
444444 "type": "boolean",
445445 "default": false
446446 },
447 "cash": {
448 "type": "boolean",
449 "default": false,
450 "description": "A cash purchase (no loan): the deal gets no Appraisal due or Financing contingency date and no lender is told. Anything but a boolean is a 422 naming cash."
451 },
447452 "sale_price": {
448453 "type": [
449454 "integer",
@@ -953,6 +958,13 @@
953958 1
954959 ]
955960 },
961 "cash": {
962 "enum": [
963 0,
964 1
965 ],
966 "description": "1 for a cash purchase: no appraisal or financing date, and no lender is told."
967 },
956968 "author_id": {
957969 "type": "string"
958970 },
@@ -3077,6 +3089,13 @@
30773089 1
30783090 ]
30793091 },
3092 "cash": {
3093 "enum": [
3094 0,
3095 1
3096 ],
3097 "description": "1 for a cash purchase: no appraisal or financing date, and no lender is told."
3098 },
30803099 "author_id": {
30813100 "type": "string"
30823101 },
docs/TECHNICAL.md +1
@@ -397,6 +397,7 @@ those of `src/terminal.ts`; the tools are those of `src/mcp.ts`.
397397 Both; enter is Buyer's agent, any other word is refused) and `Y` on a deal
398398 changes it. MCP `set_side`.
399399 - **Date note.** Terminal `T` on a date.
400 - **Cash deals.** `cash` (boolean, default false; `deal.cash` 0 or 1, migration appended to `src/db.ts`) on `POST /api/deals`, MCP `open_deal`, the New deal form (`cash=on`) and the terminal's new-deal prompt. `schedule()` then omits `appraisal` and `financing`; `recipients()` never tells a lender on a cash deal. Anything but a boolean is a 422 whose message names `cash`. An appraisal can still be added by hand.
400401 - **New deal preview.** Terminal `c` instead of `n` lists the dates without saving.
401402 - **Move to next business day.** `N` in the terminal.
402403 - **Restore the samples.** Terminal `R`; MCP `restore_samples` (admin only).
src/cash.test.ts added +127
@@ -0,0 +1,127 @@
1 import { afterAll, beforeEach, expect, test } from "bun:test";
2 import { Database } from "bun:sqlite";
3 import { mkdtempSync } from "node:fs";
4 import { tmpdir } from "node:os";
5 import { join } from "node:path";
6 import { openDb } from "./db.ts";
7 import { DEFAULT_LENGTHS, schedule } from "./deadlines.ts";
8 import { addDeadline, addParty, createDeal, getDeal, listDeals } from "./deals.ts";
9 import { recipients } from "./reminders.ts";
10 import { forgetRationing } from "./security.ts";
11 import { serve } from "./server.ts";
12 import { tools } from "./mcp.ts";
13 import { sign, type Who } from "./who.ts";
14
15 const KEY = "a-key-only-the-forge-holds";
16 const dir = mkdtempSync(join(tmpdir(), "app-cash-"));
17 const db = openDb(dir);
18 const alice: Who = { role: "user", id: "u1", name: "alice" };
19 const server = serve({ port: 0, dataDir: dir, identityKey: KEY });
20 const base = `http://${server.hostname}:${server.port}`;
21 afterAll(() => server.stop(true));
22 beforeEach(forgetRationing);
23 const identity = `u1|alice|user|${Date.now() + 600_000}`;
24 const user = { "x-forge-identity": identity, "x-forge-signature": sign(identity, KEY) };
25 const fields = { address: "1 Cash Way", buyer: "Ann Buyer", seller: "Sam Seller", contract_date: "2026-10-01", closing_date: "2026-12-01" };
26 const kinds = (id: number) => db.query<{ kind: string }, [number]>("SELECT kind FROM deadline WHERE deal_id = ?1 ORDER BY due").all(id).map((r) => r.kind);
27 const LOAN = ["appraisal", "financing"];
28
29 test("schedule() with cash omits the appraisal and financing dates, and without it keeps them", () => {
30 const input = { contractDate: "2026-10-01", closingDate: "2026-12-01", lengths: DEFAULT_LENGTHS, businessDays: false };
31 expect(schedule(input).map((p) => p.kind)).toEqual(expect.arrayContaining(LOAN));
32 const cash = schedule({ ...input, cash: true }).map((p) => p.kind).sort();
33 expect(cash).toEqual(["closing", "earnest", "inspection", "title", "walkthrough"]);
34 });
35
36 test("the form opens a cash deal with the flag and no lender dates; the check previews without them", async () => {
37 const form = (extra: Record<string, string>) => new URLSearchParams({ ...fields, ...extra });
38 const page = await fetch(base + "/deals/new", { headers: user }).then((r) => r.text());
39 expect(page).toContain("Cash offer (no loan)");
40 const check = await fetch(base + "/deals/check", { method: "POST", headers: { ...user, "content-type": "application/x-www-form-urlencoded" }, body: form({ cash: "on" }) }).then((r) => r.text());
41 expect(check).toContain("Final walkthrough");
42 expect(check).not.toContain("Appraisal due");
43 expect(check).not.toContain("Financing contingency");
44 expect(check).toMatch(/name="cash" checked/);
45 const res = await fetch(base + "/deals", { method: "POST", redirect: "manual", headers: { ...user, "content-type": "application/x-www-form-urlencoded" }, body: form({ cash: "on" }) });
46 expect(res.status).toBe(303);
47 const deal = db.query<{ id: number; cash: number }, []>("SELECT id, cash FROM deal WHERE address = '1 Cash Way'").get()!;
48 expect(deal.cash).toBe(1);
49 expect(kinds(deal.id).some((k) => LOAN.includes(k))).toBe(false);
50 const plain = await fetch(base + "/deals/check", { method: "POST", headers: { ...user, "content-type": "application/x-www-form-urlencoded" }, body: form({ address: "2 Loan Way" }) }).then((r) => r.text());
51 expect(plain).toContain("Appraisal due");
52 });
53
54 test("the API stores cash, refuses a non-boolean with 422 naming cash, and describes it", async () => {
55 const body = { address: "3 Cash Way", buyer: "A", seller: "B", contract_date: "2026-10-01", closing_date: "2026-12-01" };
56 const post = (extra: object) => fetch(base + "/api/deals", { method: "POST", headers: { ...user, "content-type": "application/json" }, body: JSON.stringify({ ...body, ...extra }) });
57 const ok = await post({ cash: true });
58 expect(ok.status).toBe(201);
59 const made = (await ok.json()) as { id: number; cash: number };
60 expect(made.cash).toBe(1);
61 expect(kinds(made.id).some((k) => LOAN.includes(k))).toBe(false);
62 const bad = await post({ cash: "maybe", address: "4 Cash Way" });
63 expect(bad.status).toBe(422);
64 expect(((await bad.json()) as { message: string }).message).toContain("cash");
65 expect((await post({ cash: 1, address: "5 Cash Way" })).status).toBe(422);
66 for (const [i, cash] of ["true", "on", "1", "0", "false"].entries()) {
67 const res = await post({ cash, address: `${10 + i} Strict Way` });
68 expect(res.status).toBe(422);
69 expect(((await res.json()) as { message: string }).message).toContain("cash");
70 }
71 const spec = await fetch(base + "/openapi.json", { headers: user }).then((r) => r.text());
72 expect(spec).toContain("A cash purchase (no loan)");
73 });
74
75 test("MCP's open_deal accepts cash", () => {
76 const open = tools.find((t) => t.name === "open_deal")!;
77 const r = open.run(db, alice, { address: "6 Cash Way", buyer: "A", seller: "B", contract_date: "2026-10-01", closing_date: "2026-12-01", cash: true }) as { ok: boolean; value: { id: number; cash: number } };
78 expect(r.ok && r.value.cash).toBe(1);
79 expect(kinds(r.value.id).some((k) => LOAN.includes(k))).toBe(false);
80 expect(open.run(db, alice, { address: "7 Cash Way", buyer: "A", seller: "B", contract_date: "2026-10-01", closing_date: "2026-12-01", cash: "yes" })).toMatchObject({ ok: false, field: "cash" });
81 });
82
83 test("no lender is told on a cash deal, even one added by hand, and an appraisal can be added", () => {
84 const made = createDeal(db, alice, { address: "8 Cash Way", buyer: "A", seller: "B", contractDate: "2026-10-01", closingDate: "2026-12-01", cash: true });
85 if (!made.ok) throw new Error(made.message);
86 expect(addParty(db, alice, { dealId: made.value.id, role: "lender", name: "Bank" }).ok).toBe(true);
87 const deal = getDeal(db, alice, { id: made.value.id });
88 if (!deal.ok) throw new Error(deal.message);
89 const closing = deal.value.deadlines.find((d) => d.kind === "closing")!;
90 expect(deal.value.parties.some((p) => p.role === "lender")).toBe(true);
91 for (const moment of ["before", "day_of", "moved"] as const)
92 expect(recipients(deal.value, closing, moment).some((p) => p.role === "lender")).toBe(false);
93 const loan = createDeal(db, alice, { address: "9 Loan Way", buyer: "A", seller: "B", contractDate: "2026-10-01", closingDate: "2026-12-01" });
94 if (!loan.ok) throw new Error(loan.message);
95 addParty(db, alice, { dealId: loan.value.id, role: "lender", name: "Bank" });
96 const l = getDeal(db, alice, { id: loan.value.id });
97 if (!l.ok) throw new Error(l.message);
98 expect(recipients(l.value, l.value.deadlines.find((d) => d.kind === "closing")!, "day_of").some((p) => p.role === "lender")).toBe(true);
99 expect(listDeals(db, alice).ok).toBe(true);
100 });
101
102 test("the clock, the deal page, the client timeline and the broker file say Cash", async () => {
103 const id = db.query<{ id: number }, []>("SELECT id FROM deal WHERE address = '1 Cash Way'").get()!.id;
104 const get = (p: string) => fetch(base + p, { headers: user }).then((r) => r.text());
105 expect(await get("/")).toContain('data-side="cash"');
106 expect(await get(`/deals/${id}`)).toContain('data-side="cash"');
107 expect(await get(`/deals/${id}/timeline`)).toContain("Cash purchase");
108 expect(await get(`/deals/${id}/file`)).toContain("Cash purchase");
109 });
110
111 test("MCP refuses the string forms of cash", () => {
112 const open = tools.find((t) => t.name === "open_deal")!;
113 for (const cash of ["true", "on", "1"])
114 expect(open.run(db, alice, { address: "8 Strict Way", buyer: "A", seller: "B", contract_date: "2026-10-01", closing_date: "2026-12-01", cash })).toMatchObject({ ok: false, field: "cash" });
115 });
116
117 test("a date added by hand to a cash deal, an appraisal, is kept", () => {
118 const made = createDeal(db, alice, { address: "11 Hand Way", buyer: "A", seller: "B", contractDate: "2026-10-01", closingDate: "2026-12-01", cash: true });
119 if (!made.ok) throw new Error(made.message);
120 expect(kinds(made.value.id)).not.toContain("appraisal");
121 const added = addDeadline(db, alice, { dealId: made.value.id, label: "Appraisal due", due: "2026-11-01", owes: "lender" });
122 expect(added.ok).toBe(true);
123 const got = getDeal(db, alice, { id: made.value.id });
124 if (!got.ok) throw new Error(got.message);
125 expect(got.value.cash).toBe(1);
126 expect(got.value.deadlines.some((d) => d.label === "Appraisal due")).toBe(true);
127 });
src/db.ts +2
@@ -501,6 +501,8 @@ export const migrations: string[] = [
501501 CREATE INDEX reminder_hold_deal ON reminder_hold (deal_id)`,
502502 // The agent's own time zone: "today" is their day, not the server's (src/dates.ts).
503503 `ALTER TABLE profile ADD COLUMN zone TEXT NOT NULL DEFAULT 'America/New_York' CHECK (length(zone) BETWEEN 1 AND 64)`,
504 // A cash purchase has no loan: its deal plans no appraisal or financing date and tells no lender.
505 `ALTER TABLE deal ADD COLUMN cash INTEGER NOT NULL DEFAULT 0 CHECK (cash IN (0, 1))`,
504506 ];
505507
506508 export function openDb(dir = dataDir): Database {
src/deadlines.ts +7 −3
@@ -173,14 +173,18 @@ export function schedule(input: {
173173 closingDate: string;
174174 lengths: Lengths;
175175 businessDays: boolean;
176 /** A cash purchase has no loan: no appraisal date, no financing date. */
177 cash?: boolean;
176178 }): Planned[] {
177 const { contractDate, closingDate, lengths, businessDays } = input;
179 const { contractDate, closingDate, lengths, businessDays, cash = false } = input;
178180 const add = businessDays ? addBusinessDays : addDays;
179181 const planned: Planned[] = [
180182 { kind: "earnest", due: add(contractDate, lengths.earnest) },
181183 { kind: "inspection", due: add(contractDate, lengths.inspection) },
182 { kind: "appraisal", due: add(contractDate, lengths.appraisal) },
183 { kind: "financing", due: add(contractDate, lengths.financing) },
184 ...(cash ? [] : [
185 { kind: "appraisal" as const, due: add(contractDate, lengths.appraisal) },
186 { kind: "financing" as const, due: add(contractDate, lengths.financing) },
187 ]),
184188 { kind: "title", due: add(contractDate, lengths.title) },
185189 { kind: "walkthrough", due: add(closingDate, -lengths.walkthrough) },
186190 { kind: "closing", due: closingDate },
src/deals.ts +14 −4
@@ -43,6 +43,8 @@ export interface Deal {
4343 readonly address: string;
4444 readonly contract_date: string;
4545 readonly business_days: 0 | 1;
46 /** A cash purchase: no loan, so no appraisal or financing date and no lender is told. */
47 readonly cash: 0 | 1;
4648 readonly author_id: string;
4749 readonly author_name: string;
4850 readonly created_at: string;
@@ -505,6 +507,8 @@ export interface NewDeal {
505507 readonly closingDate: unknown;
506508 readonly lengths?: Partial<Record<keyof Lengths, unknown>>;
507509 readonly businessDays?: unknown;
510 /** A cash purchase (no loan): a boolean; anything else but nothing is refused. */
511 readonly cash?: unknown;
508512 /** Optional whole dollars: nothing, or blank, is none set. */
509513 readonly salePrice?: unknown;
510514 readonly earnestAmount?: unknown;
@@ -525,12 +529,16 @@ export interface Plan {
525529 readonly closingDate: string;
526530 readonly lengths: Lengths;
527531 readonly businessDays: boolean;
532 readonly cash: boolean;
528533 readonly salePrice: number | null;
529534 readonly earnestAmount: number | null;
530535 readonly commissionRate?: number | null;
531536 readonly side: Side;
532537 }
533538
539 /** The cash flag: nothing is no, a real boolean is itself; anything else is undefined (a 422). The form's strings are turned into booleans at the form door. */
540 const cashOf = (v: unknown): boolean | undefined => (v === undefined ? false : typeof v === "boolean" ? v : undefined);
541
outdated

Accepts string forms for every door, so JSON cash:"true" is stored as cash. Issue: anything other than a boolean is a 422. Restrict string forms to the form door.

534542 export function plan(input: NewDeal): Result<Plan> {
535543 const address = line(input.address, 3, 200);
536544 if (address === undefined)
@@ -565,6 +573,8 @@ export function plan(input: NewDeal): Result<Plan> {
565573 input.businessDays === undefined
566574 ? standard.businessDays
567575 : input.businessDays === true || input.businessDays === "on" || input.businessDays === "1";
576 const cash = cashOf(input.cash);
577 if (cash === undefined) return fail("invalid", "The cash field is true or false.", "cash");
568578 const salePrice = amount(input.salePrice, "sale_price", "sale price");
569579 if (!salePrice.ok) return salePrice;
570580 const earnestAmount = amount(input.earnestAmount, "earnest_amount", "earnest money amount");
@@ -573,7 +583,7 @@ export function plan(input: NewDeal): Result<Plan> {
573583 if (!commissionRate.ok) return commissionRate;
574584 const side = sideOf(input.side);
575585 if (side === undefined) return fail("invalid", SIDE_REFUSAL, "side");
576 return ok({ address, buyer, seller, contractDate, closingDate, lengths, businessDays, salePrice: salePrice.value, earnestAmount: earnestAmount.value, commissionRate: commissionRate.value, side });
586 return ok({ address, buyer, seller, contractDate, closingDate, lengths, businessDays, cash, salePrice: salePrice.value, earnestAmount: earnestAmount.value, commissionRate: commissionRate.value, side });
577587 }
578588
579589 /** An address as two typings of one house agree on it: trimmed, spaces collapsed, lower case, no trailing period. */
@@ -629,10 +639,10 @@ export function insertDeal(
629639 ): Deal {
630640 return db.transaction(() => {
631641 const deal = db
632 .query<Deal, [string, string, number, string, string, number | null, number | null, string, number | null]>(
633 "INSERT INTO deal (address, contract_date, business_days, author_id, author_name, sale_price, earnest_amount, side, commission_rate) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9) RETURNING *",
642 .query<Deal, [string, string, number, string, string, number | null, number | null, string, number | null, number]>(
643 "INSERT INTO deal (address, contract_date, business_days, author_id, author_name, sale_price, earnest_amount, side, commission_rate, cash) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10) RETURNING *",
634644 )
635 .get(p.address, p.contractDate, p.businessDays ? 1 : 0, author.id, author.name, p.salePrice ?? null, p.earnestAmount ?? null, p.side ?? "buyer", p.commissionRate ?? null)!;
645 .get(p.address, p.contractDate, p.businessDays ? 1 : 0, author.id, author.name, p.salePrice ?? null, p.earnestAmount ?? null, p.side ?? "buyer", p.commissionRate ?? null, p.cash ? 1 : 0)!;
636646 const party = db.query(
637647 "INSERT INTO party (deal_id, role, name) VALUES (?1, ?2, ?3)",
638648 );
src/duplicate.test.ts +2 −2
@@ -48,11 +48,11 @@ test("a closed deal does not block: a house can sell again", () => {
4848 test("the terminal says so and opens a second deal only on a yes", () => {
4949 const t = terminal(db, alice, { title: "deal-clock", where: "test", agent: { name: "D", brokerage: "H", phone: "5", email: "[email protected]" } });
5050 const text = () => t.screen().join("\n").replace(/\x1b\[[0-9;]*m/g, "");
51 for (const c of ["n", "1418 Alder Court\r", "Ann\r", "Sam\r", "2026-10-01\r", "2026-11-01\r", "\r"]) t.press(c);
51 for (const c of ["n", "1418 Alder Court\r", "Ann\r", "Sam\r", "2026-10-01\r", "2026-11-01\r", "\r", "\r"]) t.press(c);
5252 expect(text()).toContain("1418 Alder Court is already open");
5353 t.press("no\r");
5454 expect(text()).toContain(`Kept: deal ${first.value.id}`);
55 for (const c of ["n", "1418 Alder Court\r", "Ann\r", "Sam\r", "2026-10-01\r", "2026-11-01\r", "\r", "yes\r"]) t.press(c);
55 for (const c of ["n", "1418 Alder Court\r", "Ann\r", "Sam\r", "2026-10-01\r", "2026-11-01\r", "\r", "\r", "yes\r"]) t.press(c);
5656 expect(text()).toContain("Opened 1418 Alder Court");
5757 });
5858
src/export.test.ts +13 −1
@@ -36,6 +36,7 @@ const AUDIT_WORDS = "zebra-secret-audit-words";
3636
3737 let dealId = 0;
3838 let fellId = 0;
39 let cashId = 0;
3940 let server: ReturnType<typeof serve>;
4041 let base = "";
4142 let headers: Record<string, string> = {};
@@ -58,6 +59,7 @@ beforeAll(() => {
5859 fellId = open(db, alice, input("3 Fell Court"));
5960 for (let i = 0; i < 200; i++) open(db, alice, input(`${100 + i} Bulk Lane`));
6061 open(db, bob, input("77 Bob's Own Road"));
62 cashId = open(db, alice, { ...input("5 Cash Export Row"), cash: true });
6163 db.query("UPDATE party SET phone = '555 0100', email = '[email protected]' WHERE deal_id = ?1 AND role = 'buyer'").run(dealId);
6264 const first = must(getDeal(db, alice, { id: dealId }));
6365 const insp = first.deadlines.find((d) => d.kind === "inspection")!;
@@ -89,13 +91,23 @@ test("the file holds every field, with moves, notes, state, parties and messages
8991 expect(date.note).toBe("Call the inspector");
9092 expect(date.moves[0]).toMatchObject({ to: "2026-10-20", reason: "Seller asked", by: "alice" });
9193 for (const key of ["due", "done", "waived", "owed_by"]) expect(key in date).toBe(true);
92 for (const key of ["side", "closing_time", "closing_place", "sale_price"]) expect(key in mine).toBe(true);
94 for (const key of ["side", "cash", "closing_time", "closing_place", "sale_price"]) expect(key in mine).toBe(true);
95 expect((mine as unknown as { cash: boolean }).cash).toBe(false);
9396 expect(mine.messages[0]).toMatchObject({ to: "Bea Buyer", subject: "Inspection soon", body: "Hi Bea, the inspection is near.", by: "alice" });
9497 const lost = file.deals.find((d) => d.id === fellId)!;
9598 expect(lost.state).toBe("fell_through");
9699 expect(lost.reason).toBe("Financing fell apart");
97100 });
98101
102 test("a cash deal is exported as cash, with no loan dates", () => {
103 const db = openDb(dir);
104 const file = JSON.parse(JSON.stringify(exportDeals(listed(db, alice), new Date()))) as { deals: { id: number; cash: boolean; dates: { kind: string }[] }[] };
105 db.close();
106 const cash = file.deals.find((d) => d.id === cashId)!;
107 expect(cash.cash).toBe(true);
108 expect(cash.dates.some((d) => d.kind === "appraisal" || d.kind === "financing")).toBe(false);
109 });
110
99111 test("another user gets exactly what listDeals gives them, and no audit content", async () => {
100112 const db = openDb(dir);
101113 const expected = listed(db, bob).map((d) => d.id);
src/export.ts +3 −2
@@ -5,7 +5,7 @@
55 * deal view already carries.
66 */
77
8 import { today } from "./dates.ts";
8 import { DEFAULT_ZONE, today } from "./dates.ts";
99 import type { DealView } from "./deals.ts";
1010
1111 export const EXPORT_VERSION = 1;
@@ -30,6 +30,7 @@ const dealOf = (deal: DealView): Record<string, unknown> => ({
3030 id: deal.id,
3131 address: deal.address,
3232 side: deal.side,
33 cash: deal.cash === 1,
3334 contract_date: deal.contract_date,
3435 closing: deal.closing,
3536 closing_time: deal.closing_time,
@@ -76,4 +77,4 @@ export function exportDeals(deals: readonly DealView[], now: Date): Export {
7677 };
7778 }
7879
outdated

Unrelated to the issue; and the export itself still omits cash, which loses data on a round trip.

79 export const exportName = (now: Date): string => `deal-clock-${today(now)}.json`;
80 export const exportName = (now: Date): string => `deal-clock-${today(DEFAULT_ZONE, now)}.json`;
src/mcp.ts +2
@@ -350,6 +350,7 @@ export const tools: readonly Tool[] = [
350350 title: { type: "integer", minimum: 0, maximum: LENGTH_MAX, default: DEFAULT_LENGTHS.title },
351351 walkthrough: { type: "integer", minimum: 0, maximum: LENGTH_MAX, default: DEFAULT_LENGTHS.walkthrough },
352352 business_days: { type: "boolean", default: standard.businessDays },
353 cash: { type: "boolean", default: false, description: "A cash purchase (no loan): no appraisal or financing date, no lender told." },
353354 sale_price: { type: "integer", minimum: 0, maximum: AMOUNT_MAX, description: "Optional sale price in whole dollars." },
354355 earnest_amount: { type: "integer", minimum: 0, maximum: AMOUNT_MAX, description: "Optional earnest money amount in whole dollars; the earnest money reminder says it." },
355356 commission_rate: { type: "integer", minimum: 0, maximum: RATE_MAX, description: "Optional commission rate in hundredths of a percent (250 is 2.5%), 0 to 1000." },
@@ -378,6 +379,7 @@ export const tools: readonly Tool[] = [
378379 walkthrough: a.walkthrough,
379380 },
380381 businessDays: a.business_days,
382 cash: a.cash,
381383 openAnyway: a.open_anyway,
382384 }),
383385 },
src/migrations.pin.json +2 −1
@@ -53,5 +53,6 @@
5353 "f836a1da11c1f51a255301c4ee62c441612baada0345c1310f4149e5d5ccf5b9",
5454 "72f67a8e8f06f9b9fcac58ff22eb3f4222c77a0968da5981d4e7dce8d4b8ce7d",
5555 "166c5e5ec18272d556b87786396c5c3a17da8b56185643e8efeeb83742cc2b5b",
56 "3fbd9e1851d9bc86a3a4c5adfc9f2300712c450b66a87d253cfcb91586cbbe25"
56 "3fbd9e1851d9bc86a3a4c5adfc9f2300712c450b66a87d253cfcb91586cbbe25",
57 "7e011fb3dab2123101aa981ef9050d8f8d2c34fb3ba137ecc832f86d464b98a2"
5758 ]
src/migrations.test.ts +27 −1
@@ -13,7 +13,7 @@ test("every migration is pinned by position; a pull may only append", () => {
1313 });
1414
1515 test("a database made before the Profile line gets the column and reads the agent", () => {
16 const before = migrations.filter((m) => !/profile ADD COLUMN line|commission_rate|profile ADD COLUMN zone/.test(m));
16 const before = migrations.filter((m) => !/profile ADD COLUMN line|commission_rate|profile ADD COLUMN zone|ADD COLUMN cash/.test(m));
1717 const db = new Database(":memory:");
1818 db.exec("CREATE TABLE schema_version (version INTEGER PRIMARY KEY, applied_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')))");
1919 before.forEach((sql, i) => {
@@ -26,3 +26,29 @@ test("a database made before the Profile line gets the column and reads the agen
2626 expect(db.query("SELECT line FROM profile").get()).toEqual({ line: "" });
2727 expect(db.query("SELECT commission_rate FROM deal").all()).toEqual([]);
2828 });
29
30 test("a database at every earlier version boots with its deals unchanged and cash = 0", () => {
31 const cashAt = migrations.findIndex((m) => /ADD COLUMN cash/.test(m));
32 expect(cashAt).toBeGreaterThan(0);
33 const dealAt = migrations.findIndex((m) => /CREATE TABLE (IF NOT EXISTS )?deal\b/.test(m));
34 expect(dealAt).toBeGreaterThanOrEqual(0);
35 for (let version = 1; version <= cashAt; version++) {
36 const db = new Database(":memory:");
37 db.exec("CREATE TABLE schema_version (version INTEGER PRIMARY KEY, applied_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')))");
38 migrations.slice(0, version).forEach((sql, i) => {
39 try {
40 db.exec(sql);
41 } catch (error) {
42 // Only what migrate() itself tolerates: a column an earlier migration already made.
43 if (!(/^ALTER TABLE \w+ ADD COLUMN/.test(sql) && String(error).includes("duplicate column name"))) throw error;
44 }
45 db.query("INSERT INTO schema_version (version) VALUES (?1)").run(i + 1);
46 });
47 // Where the deal table exists a deal is seeded (an insert that fails fails the test); where it does not, none can be.
48 const seeded = version > dealAt;
49 if (seeded) db.exec("INSERT INTO deal (address, contract_date, author_id, author_name) VALUES ('1 Old St', '2026-01-01', 'u', 'U')");
50 expect(migrate(db), `version ${version}`).toBe(migrations.length);
51 const rows = db.query("SELECT address, cash FROM deal").all();
52 expect(rows, `version ${version}`).toEqual(seeded ? [{ address: "1 Old St", cash: 0 }] : []);
53 }
54 });
src/pages/clock.ts +2 −2
@@ -18,7 +18,7 @@ import { mayRestore } from "../actions.ts";
1818 import { badge, draftLink, opens, owedBy, URGENCY_LABEL } from "./sheet.ts";
1919 import { find } from "../find.ts";
2020 import { onSide, type SideFilter } from "../side.ts";
21 import { sideFilterSelect, sideLabel } from "./side.ts";
21 import { dealSideLabel, sideFilterSelect, sideLabel } from "./side.ts";
2222 import { memoizer, print } from "../memo.ts";
2323 import { bookLine, tally } from "../book.ts";
2424 import { dollars } from "../money.ts";
@@ -70,7 +70,7 @@ function drawLane(deal: DealView, start: string, on: string): string {
7070 })
7171 .join("");
7272 return `<li class="lane">
73 <div class="lane-head"><a href="/deals/${deal.id}">${escape(deal.address)}</a> <small class="muted">${sideLabel(deal.side)} · ${deal.conflicts.length === 0 ? "" : `<b class="u-overdue">${deal.conflicts.length} out of order</b> · `}${progressLine(deal, on)}</small></div>
73 <div class="lane-head"><a href="/deals/${deal.id}">${escape(deal.address)}</a> <small class="muted">${dealSideLabel(deal)} · ${deal.conflicts.length === 0 ? "" : `<b class="u-overdue">${deal.conflicts.length} out of order</b> · `}${progressLine(deal, on)}</small></div>
7474 <div class="track" style="height:calc(${height} * 3rem)">${markers}</div>
7575 </li>`;
7676 }
src/pages/deal.ts +4 −2
@@ -19,7 +19,7 @@ import { partyContact } from "./contact.ts";
1919 import { confirmRemove } from "./confirm.ts";
2020 import { layout } from "./layout.ts";
2121 import { sideOf } from "../side.ts";
22 import { sideLabel, sideSelect } from "./side.ts";
22 import { dealSideLabel, sideLabel, sideSelect } from "./side.ts";
2323 import { progressLine } from "./progress.ts";
2424 import { badge, conflictLines, nonBusinessLine, noteLine, owesChangedLine, rollForm, draftItem, dueLine, outboxLine, owedBy, releaseForm, sheet, sheetId } from "./sheet.ts";
2525
@@ -337,7 +337,7 @@ export function dealPage(input: {
337337 <div>
338338 <h1>${escape(deal.address)}</h1>
339339 <p class="summary">${deal.fell_through ? `<b>Fell through on ${escape(spoken(fellOn(deal)))}</b> · ${escape(deal.fell_reason ?? "")}${deal.fell_by ? ` (${escape(deal.fell_by)})` : ""} · ` : ""}${deal.closed ? `<b>Closed on ${escape(spoken(closedOn(deal)))}</b> · ` : ""}Under contract ${escape(spoken(deal.contract_date))} · closes ${escape(spoken(deal.closing))}, ${escape(relative(deal.closing, on))}${deal.business_days ? " · business days" : ""}</p>
340 <p class="summary">${sideLabel(deal.side)}</p>
340 <p class="summary">${dealSideLabel(deal)}</p>
341341 ${figuresLine(deal)}
342342 ${closingWhenLine(deal)}
343343 ${editSide}
@@ -437,6 +437,7 @@ export function newDealPage(input: {
437437 const length = (name: keyof typeof DEFAULT_LENGTHS, label: string) =>
438438 `<label>${label}<input class="input" type="number" inputmode="numeric" name="${name}" min="0" max="180" value="${val(name, String(DEFAULT_LENGTHS[name]))}" required${bad(name)}>${why(name)}</label>`;
439439 const ticked = state === undefined ? standard.businessDays : values.business_days !== undefined;
440 const cashTicked = values.cash !== undefined && values.cash !== "0";
440441 const body =
441442 who.role === "anon"
442443 ? `<p class="crumb"><a href="/">← The clock</a></p><section class="card"><h1>New deal</h1><p><a href="/__forge/signin?to=/deals/new">Sign in</a> to open a deal.</p></section>`
@@ -459,6 +460,7 @@ export function newDealPage(input: {
459460 </div>
460461 ${figureFields((n) => values[n] ?? "", problem)}
461462 <label>Which side do you represent?${sideSelect(sideOf(values.side) ?? "buyer", "side")}${why("side")}</label>
463 <label class="check"><input type="checkbox" name="cash"${cashTicked ? " checked" : ""}> Cash offer (no loan)</label>${why("cash")}
462464 <fieldset>
463465 <legend>Contingency lengths, in days from the contract date</legend>
464466 <div class="lengths">
src/pages/file.ts +1
@@ -63,6 +63,7 @@ export function fileRecord(deal: DealView): FileRecord {
6363 facts: [
6464 ["Status", outcome],
6565 ["Side", SIDE_LABEL[deal.side]],
66 ...(deal.cash === 1 ? [["Purchase", "Cash purchase"] as [string, string]] : []),
6667 ["Sale price", deal.sale_price === null ? "not set" : dollars(deal.sale_price)],
6768 ["Earnest money", deal.earnest_amount === null ? "not set" : dollars(deal.earnest_amount)],
6869 ["Commission rate", deal.commission_rate === null ? "not set" : percent(deal.commission_rate)],
src/pages/side.ts +4
@@ -10,6 +10,10 @@ import { SIDES, SIDE_CHOICE, SIDE_LABEL, type Side, type SideFilter } from "../s
1010 /** The label, as text: a screen reader says it where it sits. */
1111 export const sideLabel = (side: Side): string => `<span class="side" data-side="${side}">${SIDE_LABEL[side]}</span>`;
1212
13 /** The side, and "Cash" beside it when the deal is a cash purchase. */
14 export const dealSideLabel = (deal: { side: Side; cash: 0 | 1 }): string =>
15 sideLabel(deal.side) + (deal.cash === 1 ? ` · <span class="side" data-side="cash">Cash</span>` : "");
16
1317 /** The choice of side as a select named `side`. */
1418 export const sideSelect = (selected: Side, id = "side"): string =>
1519 `<select class="input" id="${id}" name="side">${SIDES.map((s) => `<option value="${s}"${s === selected ? " selected" : ""}>${escape(SIDE_CHOICE[s])}</option>`).join("")}</select>`;
src/pages/timeline.ts +1
@@ -42,6 +42,7 @@ export function timelinePage(input: { who: Who; agent?: Agent | undefined; deal:
4242 const figures = [
4343 deal.sale_price === null ? "" : `Sale price ${dollars(deal.sale_price)}`,
4444 deal.earnest_amount === null ? "" : `Earnest money ${dollars(deal.earnest_amount)}`,
45 deal.cash === 1 ? "Cash purchase" : "",
4546 ].filter((p) => p !== "");
4647 const body = `<p class="crumb timeline-tools"><a href="/deals/${deal.id}">← Back to the deal</a> · <button type="button" class="button button-small" data-print hidden>Print</button> <span class="muted">or your browser's print (Ctrl/Cmd+P)</span></p>
4748 <section class="timeline">
src/reminders.ts +2
@@ -101,6 +101,8 @@ export function recipients(deal: DealView, deadline: DeadlineView, moment: Momen
101101 const roles = new Set<PartyRole>(
102102 moment === "late" ? [deadline.owes] : [deadline.owes, ...KIND[deadline.kind].notify],
103103 );
104 // A cash purchase has no loan, so a lender added by hand is not told.
105 if (deal.cash === 1) roles.delete("lender");
104106 return deal.parties.filter((p) => roles.has(p.role));
105107 }
106108
src/routes.ts +7
@@ -286,6 +286,7 @@ export const DEAL: Schema = {
286286 closing_time: CLOSING_TIME,
287287 closing_place: CLOSING_PLACE,
288288 business_days: { enum: [0, 1] },
289 cash: { enum: [0, 1], description: "1 for a cash purchase: no appraisal or financing date, and no lender is told." },
289290 author_id: { type: "string" },
290291 author_name: { type: "string" },
291292 created_at: { type: "string", format: "date-time" },
@@ -408,6 +409,7 @@ const NEW_DEAL: Schema = {
408409 title: { type: "integer", minimum: 0, maximum: 180, default: DEFAULT_LENGTHS.title },
409410 walkthrough: { type: "integer", minimum: 0, maximum: 180, default: DEFAULT_LENGTHS.walkthrough },
410411 business_days: { type: "boolean", default: standard.businessDays },
412 cash: { type: "boolean", default: false, description: "A cash purchase (no loan): the deal gets no Appraisal due or Financing contingency date and no lender is told. Anything but a boolean is a 422 naming cash." },
411413 sale_price: { ...FIGURE, description: "Optional, whole dollars." },
412414 earnest_amount: { ...FIGURE, description: "Optional, whole dollars; the earnest money reminder says it." },
413415 commission_rate: { ...RATE, description: "Optional, hundredths of a percent (250 is 2.5%), 0 to 1000." },
@@ -658,8 +660,12 @@ const HELD = "Held until tomorrow.";
658660 const fromForm = (f: Record<string, unknown>): Record<string, unknown> => ({
659661 ...f,
660662 business_days: f.business_days ?? "0",
663 cash: cashFromForm(f.cash),
661664 });
662665
666 /** A ticked box ("on", "1") is cash, an absent or "0" one is not; any other text stays as sent and is refused naming cash. */
667 const cashFromForm = (v: unknown): unknown => (v === undefined || v === "" || v === "0" ? false : v === "on" || v === "1" ? true : v);
668
663669 /** A new deal from a form or a JSON body: the same names either way. */
664670 const newDeal = (f: Record<string, unknown>): NewDeal => ({
665671 address: f.address,
@@ -676,6 +682,7 @@ const newDeal = (f: Record<string, unknown>): NewDeal => ({
676682 walkthrough: f.walkthrough,
677683 },
678684 businessDays: f.business_days,
685 cash: f.cash,
679686 salePrice: f.sale_price,
680687 earnestAmount: f.earnest_amount,
681688 commissionRate: f.commission_rate,
src/terminal.test.ts +49 −7
@@ -151,7 +151,7 @@ test("e with an empty answer keeps that part of the draft; too long a message is
151151
152152 test("n opens a deal from five answers, and shows it", () => {
153153 const t = terminal(db, alice, context);
154 press(t, "n", "31 Birch Row\r", "Kim Buyer\r", "Lou Seller\r", `${today(DEFAULT_ZONE)}\r`, `${addDays(today(DEFAULT_ZONE), 40)}\r`, "\r");
154 press(t, "n", "31 Birch Row\r", "Kim Buyer\r", "Lou Seller\r", `${today(DEFAULT_ZONE)}\r`, `${addDays(today(DEFAULT_ZONE), 40)}\r`, "\r", "\r");
155155 const listed = listDeals(db, alice);
156156 if (!listed.ok) throw new Error(listed.message);
157157 const made = listed.value.find((d) => d.address === "31 Birch Row");
@@ -160,7 +160,7 @@ test("n opens a deal from five answers, and shows it", () => {
160160 expect(lines(t).join("\n")).toContain("Opened 31 Birch Row");
161161 expect(lines(t)).toContain("31 Birch Row");
162162 // A bad answer is the action's to refuse, and nothing is opened.
163 press(t, "d", "n", "x\r", "A\r", "B\r", "soon\r", "later\r", "\r");
163 press(t, "d", "n", "x\r", "A\r", "B\r", "soon\r", "later\r", "\r", "\r");
164164 expect(lines(t).join("\n")).toContain("The address is 3 to 200 characters.");
165165 });
166166
@@ -168,7 +168,7 @@ test("c lists the dates n would create and writes nothing; a guest is asked to s
168168 const before = listDeals(db, alice);
169169 if (!before.ok) throw new Error(before.message);
170170 const t = terminal(db, alice, context);
171 press(t, "c", "44 Cedar Way\r", "Kim Buyer\r", "Lou Seller\r", "2026-10-02\r", "2026-11-20\r", "\r");
171 press(t, "c", "44 Cedar Way\r", "Kim Buyer\r", "Lou Seller\r", "2026-10-02\r", "2026-11-20\r", "\r", "\r");
172172 const shown = lines(t).join("\n");
173173 expect(shown).toContain("Dates for 44 Cedar Way");
174174 expect(shown).toContain("Mon, Oct 12");
@@ -177,7 +177,7 @@ test("c lists the dates n would create and writes nothing; a guest is asked to s
177177 const after = listDeals(db, alice);
178178 if (!after.ok) throw new Error(after.message);
179179 expect(after.value.length).toBe(before.value.length);
180 press(t, "c", "x\r", "A\r", "B\r", "soon\r", "later\r", "\r");
180 press(t, "c", "x\r", "A\r", "B\r", "soon\r", "later\r", "\r", "\r");
181181 expect(lines(t).join("\n")).toContain("The address is 3 to 200 characters.");
182182 const guest = terminal(db, { role: "anon" }, context);
183183 guest.press("c");
@@ -844,15 +844,15 @@ test("a signed-out terminal is not asked for a closing time", () => {
844844
845845 test("n asks which side, defaults to Buyer's agent, and refuses an unknown word", () => {
846846 const t = terminal(db, alice, context);
847 press(t, "n", "51 Side St\r", "Kim Buyer\r", "Lou Seller\r", `${today(DEFAULT_ZONE)}\r`, `${addDays(today(DEFAULT_ZONE), 40)}\r`, "Listing agent\r");
847 press(t, "n", "51 Side St\r", "Kim Buyer\r", "Lou Seller\r", `${today(DEFAULT_ZONE)}\r`, `${addDays(today(DEFAULT_ZONE), 40)}\r`, "Listing agent\r", "\r");
848848 const listed = listDeals(db, alice);
849849 if (!listed.ok) throw new Error(listed.message);
850850 expect(listed.value.find((d) => d.address === "51 Side St")?.side).toBe("listing");
851 press(t, "d", "n", "52 Side St\r", "Kim Buyer\r", "Lou Seller\r", `${today(DEFAULT_ZONE)}\r`, `${addDays(today(DEFAULT_ZONE), 40)}\r`, "\r");
851 press(t, "d", "n", "52 Side St\r", "Kim Buyer\r", "Lou Seller\r", `${today(DEFAULT_ZONE)}\r`, `${addDays(today(DEFAULT_ZONE), 40)}\r`, "\r", "\r");
852852 const again = listDeals(db, alice);
853853 if (!again.ok) throw new Error(again.message);
854854 expect(again.value.find((d) => d.address === "52 Side St")?.side).toBe("buyer");
855 press(t, "d", "n", "53 Side St\r", "Kim Buyer\r", "Lou Seller\r", `${today(DEFAULT_ZONE)}\r`, `${addDays(today(DEFAULT_ZONE), 40)}\r`, "seller\r");
855 press(t, "d", "n", "53 Side St\r", "Kim Buyer\r", "Lou Seller\r", `${today(DEFAULT_ZONE)}\r`, `${addDays(today(DEFAULT_ZONE), 40)}\r`, "seller\r", "\r");
856856 expect(lines(t).join("\n")).toContain("Side is buyer, listing or both.");
857857 const last = listDeals(db, alice);
858858 if (!last.ok) throw new Error(last.message);
@@ -877,3 +877,45 @@ test("the side is shown on the deal, the clock and the week, and Y changes it",
877877 press(t, "w");
878878 expect(lines(t).join("\n")).toContain("[Listing]");
879879 });
880
881 test("n asks if the offer is cash: yes opens a cash deal with no loan dates, no and enter stay financed, anything else is refused", () => {
882 const t = terminal(db, alice, context);
883 const answers = (address: string, cash: string) => ["n", `${address}\r`, "Kim Buyer\r", "Lou Seller\r", `${today(DEFAULT_ZONE)}\r`, `${addDays(today(DEFAULT_ZONE), 40)}\r`, "\r", cash];
884 const find = (address: string) => {
885 const listed = listDeals(db, alice);
886 if (!listed.ok) throw new Error(listed.message);
887 return listed.value.find((d) => d.address === address);
888 };
889 press(t, ...answers("61 Cash St", "yes\r"));
890 const cash = find("61 Cash St")!;
891 expect(cash.cash).toBe(1);
892 expect(cash.deadlines.some((d) => d.kind === "appraisal" || d.kind === "financing")).toBe(false);
893 press(t, "d", ...answers("62 Cash St", "no\r"));
894 expect(find("62 Cash St")?.cash).toBe(0);
895 press(t, "d", ...answers("63 Cash St", "\r"));
896 expect(find("63 Cash St")?.cash).toBe(0);
897 for (const word of ["y", "Yes please", "maybe"]) {
898 press(t, "d", ...answers("64 Cash St", `${word}\r`));
899 expect(lines(t).join("\n")).toContain("Cash is yes or no.");
900 expect(find("64 Cash St")).toBeUndefined();
901 }
902 });
903
904 test("c with yes lists no appraisal or financing date, and with enter lists them; nothing is written", () => {
905 const t = terminal(db, alice, context);
906 const preview = (cash: string) => {
907 press(t, "d", "c", "70 Preview Ln\r", "Kim Buyer\r", "Lou Seller\r", "2026-10-02\r", "2026-11-20\r", "\r", cash);
908 const screen = lines(t).join("\n");
909 return screen.slice(screen.lastIndexOf("Dates for 70 Preview Ln"));
910 };
911 const cashScreen = preview("yes\r");
912 expect(cashScreen).toContain("Dates for 70 Preview Ln");
913 expect(cashScreen).not.toContain("Appraisal");
914 expect(cashScreen).not.toContain("Financing");
915 const loanScreen = preview("\r");
916 expect(loanScreen).toContain("Appraisal");
917 expect(loanScreen).toContain("Financing");
918 const listed = listDeals(db, alice);
919 if (!listed.ok) throw new Error(listed.message);
920 expect(listed.value.some((d) => d.address === "70 Preview Ln")).toBe(false);
921 });
src/terminal.ts +7 −4
@@ -90,6 +90,7 @@ const esc = "\x1b[";
9090 const dim = (s: string): string => `${esc}2m${s}${esc}0m`;
9191 const bold = (s: string): string => `${esc}1m${s}${esc}0m`;
9292 /** Audit rows to a screen. */
93 const CASH_REFUSAL = "Cash is yes or no.";
9394 const ACTIVITY_ROWS = 20;
9495 const COLOUR: Readonly<Record<Urgency, string>> = { overdue: "31", soon: "33", later: "36", done: "2", waived: "2" };
9596 const tint = (u: Urgency, s: string): string => `${esc}${COLOUR[u]}m${s}${esc}0m`;
@@ -643,13 +644,15 @@ export function terminal(
643644 if (!may.ok) said = may.message;
644645 else
645646 prompt = {
outdated

Only yes is cash; every other answer silently means financed. Refuse unknown answers naming cash, and add a test for this prompt.

646 steps: ["Property address", "Buyer", "Seller", "Contract date (YYYY-MM-DD)", "Closing date (YYYY-MM-DD)", "Side: Buyer's agent, Listing agent or Both (enter for Buyer's agent)"],
647 steps: ["Property address", "Buyer", "Seller", "Contract date (YYYY-MM-DD)", "Closing date (YYYY-MM-DD)", "Side: Buyer's agent, Listing agent or Both (enter for Buyer's agent)", "Cash offer, no loan? Type yes or no (enter for no, a financed deal)"],
647648 answers: [],
648649 text: "",
649 finish: ([address, buyer, seller, contractDate, closingDate, typedSide]) => {
650 finish: ([address, buyer, seller, contractDate, closingDate, typedSide, typedCash]) => {
650651 const side = sideTyped(typedSide ?? "");
651652 if (side === undefined) return SIDE_REFUSAL;
652 const input: NewDeal = { address, buyer, seller, contractDate, closingDate, side };
653 const word = (typedCash ?? "").trim().toLowerCase();
654 if (word !== "" && word !== "yes" && word !== "no") return CASH_REFUSAL;
655 const input: NewDeal = { address, buyer, seller, contractDate, closingDate, side, cash: word === "yes" };
653656 if (key === "c") return previewDates(input);
654657 const made = createDeal(db, me, input);
655658 if (!made.ok && made.error === "conflict" && made.existing !== undefined) {
@@ -859,7 +862,7 @@ export function terminal(
859862 const deal = openDeal();
860863 if (deal === undefined) lines.push(dim("That deal is gone."));
861864 else {
862 lines.push(bold(deal.address), ...(deal.fell_through ? [bold(`Fell through on ${spoken(fellOn(deal))}: ${deal.fell_reason ?? ""}`)] : []), ...(deal.closed ? [bold(`Closed on ${spoken(closedOn(deal))}`)] : []), dim(`${SIDE_LABEL[deal.side]} · under contract ${spoken(deal.contract_date)} · closes ${spoken(deal.closing)}, ${relative(deal.closing, day)}`), ...(deal.closing_time === null && deal.closing_place === null ? [] : [dim(closingLine(deal))]), "");
865 lines.push(bold(deal.address), ...(deal.fell_through ? [bold(`Fell through on ${spoken(fellOn(deal))}: ${deal.fell_reason ?? ""}`)] : []), ...(deal.closed ? [bold(`Closed on ${spoken(closedOn(deal))}`)] : []), dim(`${SIDE_LABEL[deal.side]}${deal.cash === 1 ? " · Cash" : ""} · under contract ${spoken(deal.contract_date)} · closes ${spoken(deal.closing)}, ${relative(deal.closing, day)}`), ...(deal.closing_time === null && deal.closing_place === null ? [] : [dim(closingLine(deal))]), "");
863866 deal.deadlines.forEach((date, i) => lines.push(dateLine({ deal, date }, i, false)));
864867 if (deal.conflicts.length > 0) lines.push("", ...deal.conflicts.map((c) => tint("overdue", `! ${conflictLine(c)}`)));
865868 lines.push("", bold("Parties"));

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs