summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSzymon Szukalski <szymon@szymonszukalski.com>2026-04-09 11:22:48 +1000
committerSzymon Szukalski <szymon@szymonszukalski.com>2026-04-09 11:22:48 +1000
commit08d06ed00c9d6e98f0f8a02d243a2eb36ee4bff1 (patch)
treedad98d4ac64219e047223c82564d93c00ddf0501 /docs
parentbc75732b9d37b77945a977ee9f7892cf6efc79c3 (diff)
Improve CRM and journal workflows
Diffstat (limited to 'docs')
-rw-r--r--docs/plans/2026-04-09-crm-property-completion-implementation.md144
-rw-r--r--docs/plans/2026-04-09-journal-open-narrowing-implementation.md85
2 files changed, 229 insertions, 0 deletions
diff --git a/docs/plans/2026-04-09-crm-property-completion-implementation.md b/docs/plans/2026-04-09-crm-property-completion-implementation.md
new file mode 100644
index 0000000..88b3d01
--- /dev/null
+++ b/docs/plans/2026-04-09-crm-property-completion-implementation.md
@@ -0,0 +1,144 @@
+# CRM Property Completion Implementation Plan
+
+> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
+
+**Goal:** Add data-driven CRM property completion and inline value creation to `ss-crm-add` without introducing a second source of truth.
+
+**Architecture:** Extend `lisp/ss-crm.el` with small lookup helpers that build on the existing parsed CRM entry cache, plus a single generic choice reader that handles blank selection, optional freeform values, confirmation, and advisory duplicate warnings. Keep seeded vocabularies in code, wire field-specific readers into `ss-crm-add`, and verify with focused ERT coverage plus batch startup loading.
+
+**Tech Stack:** Emacs Lisp, Org, ERT, batch Emacs verification
+
+---
+
+### Task 1: Add failing CRM helper tests
+
+**Files:**
+- Create: `tests/ss-crm-tests.el`
+- Modify: `lisp/ss-crm.el`
+
+**Step 1: Write the failing test**
+
+```elisp
+(ert-deftest ss-crm-known-property-values-sorts-and-deduplicates ()
+ (cl-letf (((symbol-function 'ss-crm-entries)
+ (lambda ()
+ (list (list :role "Engineer")
+ (list :role " engineer ")
+ (list :role "Architect")
+ (list :role nil)))))
+ (should (equal (ss-crm-known-property-values "ROLE")
+ '("Architect" "Engineer" " engineer ")))))
+```
+
+**Step 2: Run test to verify it fails**
+
+Run: `emacs --batch -Q -L . -L lisp -l tests/ss-crm-tests.el -f ert-run-tests-batch-and-exit`
+Expected: FAIL because the new CRM helper functions do not exist yet.
+
+**Step 3: Write minimal implementation**
+
+```elisp
+(defun ss-crm-known-property-values (property)
+ ...)
+```
+
+**Step 4: Run test to verify it passes**
+
+Run: `emacs --batch -Q -L . -L lisp -l tests/ss-crm-tests.el -f ert-run-tests-batch-and-exit`
+Expected: PASS for the helper coverage.
+
+**Step 5: Commit**
+
+```bash
+git add tests/ss-crm-tests.el lisp/ss-crm.el
+git commit -m "Add CRM property completion helpers"
+```
+
+### Task 2: Add completion-reader tests and implement prompt behavior
+
+**Files:**
+- Modify: `tests/ss-crm-tests.el`
+- Modify: `lisp/ss-crm.el`
+
+**Step 1: Write the failing test**
+
+```elisp
+(ert-deftest ss-crm-read-choice-warns-on-new-case-insensitive-duplicate ()
+ (let (warning)
+ (cl-letf (((symbol-function 'completing-read) (lambda (&rest _) "sydney"))
+ ((symbol-function 'yes-or-no-p) (lambda (&rest _) t))
+ ((symbol-function 'display-warning)
+ (lambda (_type message &rest _) (setq warning message))))
+ (should (equal (ss-crm-read-choice "Location: " '("Sydney")
+ :allow-blank t
+ :allow-new t)
+ "sydney"))
+ (should (string-match-p "Sydney" warning))))
+```
+
+**Step 2: Run test to verify it fails**
+
+Run: `emacs --batch -Q -L . -L lisp -l tests/ss-crm-tests.el -f ert-run-tests-batch-and-exit`
+Expected: FAIL because `ss-crm-read-choice` does not support the new behavior yet.
+
+**Step 3: Write minimal implementation**
+
+```elisp
+(defun ss-crm-read-choice (prompt choices &rest plist)
+ ...)
+```
+
+**Step 4: Run test to verify it passes**
+
+Run: `emacs --batch -Q -L . -L lisp -l tests/ss-crm-tests.el -f ert-run-tests-batch-and-exit`
+Expected: PASS for blank selection, existing completion, and new-value confirmation coverage.
+
+**Step 5: Commit**
+
+```bash
+git add tests/ss-crm-tests.el lisp/ss-crm.el
+git commit -m "Add CRM completion prompts"
+```
+
+### Task 3: Integrate field readers into `ss-crm-add` and verify startup
+
+**Files:**
+- Modify: `lisp/ss-crm.el`
+- Review: `README.md`
+
+**Step 1: Write the failing test**
+
+```elisp
+(ert-deftest ss-crm-read-manager-uses-known-person-names ()
+ (cl-letf (((symbol-function 'ss-crm-known-person-names)
+ (lambda () '("Alice" "Bob")))
+ ((symbol-function 'ss-crm-read-choice)
+ (lambda (_prompt choices &rest _plist) choices)))
+ (should (equal (ss-crm-read-manager) '("Alice" "Bob")))))
+```
+
+**Step 2: Run test to verify it fails**
+
+Run: `emacs --batch -Q -L . -L lisp -l tests/ss-crm-tests.el -f ert-run-tests-batch-and-exit`
+Expected: FAIL until the field readers are wired up.
+
+**Step 3: Write minimal implementation**
+
+```elisp
+(defun ss-crm-read-manager ()
+ (ss-crm-read-choice "Manager: " (ss-crm-known-person-names)
+ :allow-blank t
+ :require-match t))
+```
+
+**Step 4: Run test to verify it passes**
+
+Run: `emacs --batch -Q -L . -L lisp -l tests/ss-crm-tests.el -f ert-run-tests-batch-and-exit`
+Expected: PASS, then run `emacs --batch -Q --load ./init.el` to confirm startup remains healthy.
+
+**Step 5: Commit**
+
+```bash
+git add tests/ss-crm-tests.el lisp/ss-crm.el README.md
+git commit -m "Guide CRM add-person property entry"
+```
diff --git a/docs/plans/2026-04-09-journal-open-narrowing-implementation.md b/docs/plans/2026-04-09-journal-open-narrowing-implementation.md
new file mode 100644
index 0000000..59a80de
--- /dev/null
+++ b/docs/plans/2026-04-09-journal-open-narrowing-implementation.md
@@ -0,0 +1,85 @@
+# Journal Open Narrowing Implementation Plan
+
+> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
+
+**Goal:** Make `ss-open-journal` narrow to today's subtree when today's journal entry exists, while preserving the current fallback when it does not.
+
+**Architecture:** Add focused ERT coverage for the journal-open helper in `tests/`, then update `lisp/ss-org.el` so it widens first, reuses the existing `ss-journal-goto-date` lookup, and narrows only on the successful path. Keep the missing-entry case unchanged by leaving point at the end of the journal buffer without creating new headings.
+
+**Tech Stack:** Emacs Lisp, ERT, batch Emacs verification
+
+---
+
+### Task 1: Add failing journal-open test
+
+**Files:**
+- Modify: `tests/ss-capture-tests.el`
+- Modify: `lisp/ss-org.el`
+
+**Step 1: Write the failing test**
+
+```elisp
+(ert-deftest ss-open-journal-narrows-to-today-when-entry-exists ()
+ ...)
+```
+
+**Step 2: Run test to verify it fails**
+
+Run: `emacs --batch -Q -L . -L lisp -l tests/ss-capture-tests.el -f ert-run-tests-batch-and-exit`
+Expected: FAIL because `ss-open-journal` currently widens and jumps, but does not narrow.
+
+**Step 3: Write minimal implementation**
+
+```elisp
+(when (ss-journal-goto-date)
+ (org-narrow-to-subtree))
+```
+
+**Step 4: Run test to verify it passes**
+
+Run: `emacs --batch -Q -L . -L lisp -l tests/ss-capture-tests.el -f ert-run-tests-batch-and-exit`
+Expected: PASS, with the fallback case still leaving the buffer widened at end of file.
+
+**Step 5: Commit**
+
+```bash
+git add tests/ss-capture-tests.el lisp/ss-org.el
+git commit -m "Narrow journal open to today"
+```
+
+### Task 2: Run regression verification
+
+**Files:**
+- Review: `README.md`
+- Verify: `lisp/ss-org.el`
+
+**Step 1: Write the failing test**
+
+```elisp
+(ert-deftest ss-open-journal-falls-back-to-end-when-today-missing ()
+ ...)
+```
+
+**Step 2: Run test to verify it fails**
+
+Run: `emacs --batch -Q -L . -L lisp -l tests/ss-capture-tests.el -f ert-run-tests-batch-and-exit`
+Expected: FAIL until the fallback remains explicitly covered.
+
+**Step 3: Write minimal implementation**
+
+```elisp
+(unless (ss-journal-goto-date)
+ (goto-char (point-max)))
+```
+
+**Step 4: Run test to verify it passes**
+
+Run: `emacs --batch -Q -L . -L lisp -l tests/ss-capture-tests.el -l tests/ss-crm-tests.el -f ert-run-tests-batch-and-exit`
+Expected: PASS, then run `emacs --batch -Q --load ./init.el` to confirm startup remains healthy.
+
+**Step 5: Commit**
+
+```bash
+git add tests/ss-capture-tests.el lisp/ss-org.el README.md
+git commit -m "Preserve journal open fallback"
+```