📝 Restore and rewrite the README entry point
The README collapsed to API-only prose once the old match/P surface was dropped. Rebuild its entry-point shape: a quick-start Synopsis walked through a Contact union, a dedicated Installation section, and a real-world Examples section (primitive-union dispatch, a fallback, a property union narrowed by the tagged-union matcher, and the widening variant). Set the tagline and Description to the library's identity — exhaustive, type-safe pattern matching for TypeScript — and state the goal Moose-style: type-safe pattern matching with a lean syntax, accomplished by exhaustive branches and typed per-branch handler parameters, backed by autocomplete and a tiny footprint. Drop the F#-style framing and the stale "matches method is a type guard" and "(not regex)" copy from the README, AGENTS.md and the package.json description. Every fence is a doc-test, so the examples cannot drift from the API.
This commit is contained in:
1 parent
28d87b3387
commit
8261759190
5 files changed
+146
-11
No files matched your search
@@ -7,7 +7,7 @@ first-action facts. Do not restate evolving prose here — it will drift.
|
||||
|
||||
## First action
|
||||
|
||||
- Project: F#-style pattern matching for TypeScript/ESM. Node `>=26` (pinned via `.node-version`), ESM-only (no CommonJS shim).
|
||||
- Project: pattern matching for TypeScript/ESM. Node `>=26` (pinned via `.node-version`), ESM-only (no CommonJS shim).
|
||||
- **While iterating:** `npm run test` (`check:tsc` + the unit suite) for fast feedback on the files you changed.
|
||||
- **Optional code intelligence:** this repo installs `@spences10/pi-lsp` (pinned in `.pi/settings.json`) as a project-local pi extension. It talks to the repo's own TypeScript 7 via `tsc --lsp --stdio` and exposes **read-only** tools — `lsp_hover`, `lsp_definition`, `lsp_references`, `lsp_find_symbol`, `lsp_document_symbols`, `lsp_diagnostics(_many)`. **When you are looking for a symbol, reach for the LSP before `rg`/`grep`** — `lsp_references` / `lsp_find_symbol` / `lsp_definition` / `lsp_document_symbols` are semantic and cross-file, so they see shadowing, imports and overloads that a text search cannot; use `lsp_hover` to read inferred types on generic-heavy code. Use `rg` for what the LSP cannot see — doc prose, string literals, config, task lists, file discovery — and reconcile the two sets before editing (symbols from the LSP, strings and prose from `rg`). It has no rename / code-action / apply-edit surface — the write side is pi's `edit` tool + `check:tsc`. Treat empty LSP output as _inconclusive_, not success: **`npm run test` / `npm run verify` remain the sole authoritative gate** (see the next bullet). The server keeps running across that gate with a ~5 min idle timeout and registers no file watchers, so if you change `tsconfig.json` / `package.json` mid-session its diagnostics can be stale — when LSP output disagrees with `check:tsc`, trust `check:tsc` and restart pi (or wait out the idle timeout) before concluding the LSP is wrong.
|
||||
- **Definition of done — run this before you call the work finished:** `npm run verify`. If all green, commit. If red, look at the output, fix the root cause, and re-run.
|
||||
|
||||
Reference in new issue
Block a user