retold 4.0.1 → 4.0.3

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 (78) hide show
  1. package/.claude/settings.local.json +38 -1
  2. package/README.md +92 -2
  3. package/docs/README.md +7 -6
  4. package/docs/_sidebar.md +36 -21
  5. package/docs/_topbar.md +2 -2
  6. package/docs/architecture/comprehensions.md +282 -0
  7. package/docs/architecture/fluid-models.md +355 -0
  8. package/docs/architecture/module-architecture.md +234 -0
  9. package/docs/{modules.md → architecture/modules.md} +25 -22
  10. package/docs/cover.md +2 -2
  11. package/docs/css/docuserve.css +6 -6
  12. package/docs/examples/examples.md +71 -0
  13. package/docs/examples/todolist/todo-list-cli-client.md +178 -0
  14. package/docs/examples/todolist/todo-list-console-client.md +152 -0
  15. package/docs/examples/todolist/todo-list-model.md +114 -0
  16. package/docs/examples/todolist/todo-list-server.md +128 -0
  17. package/docs/examples/todolist/todo-list-web-client.md +177 -0
  18. package/docs/examples/todolist/todo-list.md +162 -0
  19. package/docs/getting-started.md +8 -7
  20. package/docs/index.html +4 -4
  21. package/docs/{meadow.md → modules/meadow.md} +4 -6
  22. package/docs/{orator.md → modules/orator.md} +1 -0
  23. package/docs/{pict.md → modules/pict.md} +30 -8
  24. package/docs/{utility.md → modules/utility.md} +0 -9
  25. package/docs/retold-catalog.json +1792 -231
  26. package/docs/retold-keyword-index.json +136439 -64616
  27. package/examples/todo-list/Dockerfile +45 -0
  28. package/examples/todo-list/README.md +394 -0
  29. package/examples/todo-list/cli-client/package-lock.json +418 -0
  30. package/examples/todo-list/cli-client/package.json +19 -0
  31. package/examples/todo-list/cli-client/source/TodoCLI-CLIProgram.js +30 -0
  32. package/examples/todo-list/cli-client/source/TodoCLI-Run.js +3 -0
  33. package/examples/todo-list/cli-client/source/commands/add/TodoCLI-Command-Add.js +74 -0
  34. package/examples/todo-list/cli-client/source/commands/complete/TodoCLI-Command-Complete.js +84 -0
  35. package/examples/todo-list/cli-client/source/commands/list/TodoCLI-Command-List.js +110 -0
  36. package/examples/todo-list/cli-client/source/commands/remove/TodoCLI-Command-Remove.js +49 -0
  37. package/examples/todo-list/cli-client/source/services/TodoCLI-Service-API.js +92 -0
  38. package/examples/todo-list/console-client/console-client.cjs +913 -0
  39. package/examples/todo-list/console-client/package-lock.json +426 -0
  40. package/examples/todo-list/console-client/package.json +19 -0
  41. package/examples/todo-list/console-client/views/PictView-TUI-Header.cjs +43 -0
  42. package/examples/todo-list/console-client/views/PictView-TUI-Layout.cjs +58 -0
  43. package/examples/todo-list/console-client/views/PictView-TUI-StatusBar.cjs +41 -0
  44. package/examples/todo-list/console-client/views/PictView-TUI-TaskList.cjs +104 -0
  45. package/examples/todo-list/docker-motd.sh +36 -0
  46. package/examples/todo-list/docker-run.sh +2 -0
  47. package/examples/todo-list/docker-shell.sh +2 -0
  48. package/examples/todo-list/model/MeadowSchema-Task.json +152 -0
  49. package/examples/todo-list/model/Task-Compiled.json +25 -0
  50. package/examples/todo-list/model/Task.mddl +15 -0
  51. package/examples/todo-list/model/data/seeded_todo_events.csv +1001 -0
  52. package/examples/todo-list/server/database-initialization-service.cjs +273 -0
  53. package/examples/todo-list/server/package-lock.json +6113 -0
  54. package/examples/todo-list/server/package.json +19 -0
  55. package/examples/todo-list/server/server.cjs +138 -0
  56. package/examples/todo-list/web-client/css/todolist-theme.css +235 -0
  57. package/examples/todo-list/web-client/generate-build-config.cjs +18 -0
  58. package/examples/todo-list/web-client/html/index.html +18 -0
  59. package/examples/todo-list/web-client/package-lock.json +12030 -0
  60. package/examples/todo-list/web-client/package.json +43 -0
  61. package/examples/todo-list/web-client/source/TodoList-Application-Config.json +12 -0
  62. package/examples/todo-list/web-client/source/TodoList-Application.cjs +383 -0
  63. package/examples/todo-list/web-client/source/providers/Provider-TaskData.cjs +243 -0
  64. package/examples/todo-list/web-client/source/providers/Router-Config.json +32 -0
  65. package/examples/todo-list/web-client/source/views/View-Layout.cjs +75 -0
  66. package/examples/todo-list/web-client/source/views/View-TaskForm.cjs +87 -0
  67. package/examples/todo-list/web-client/source/views/View-TaskList.cjs +127 -0
  68. package/examples/todo-list/web-client/source/views/calendar/View-MonthView.cjs +293 -0
  69. package/examples/todo-list/web-client/source/views/calendar/View-WeekView.cjs +149 -0
  70. package/examples/todo-list/web-client/source/views/calendar/View-YearView.cjs +226 -0
  71. package/modules/Include-Retold-Module-List.sh +2 -2
  72. package/package.json +5 -5
  73. package/docs/js/pict.min.js +0 -12
  74. package/docs/js/pict.min.js.map +0 -1
  75. package/docs/pict-docuserve.min.js +0 -58
  76. package/docs/pict-docuserve.min.js.map +0 -1
  77. /package/docs/{architecture.md → architecture/architecture.md} +0 -0
  78. /package/docs/{fable.md → modules/fable.md} +0 -0
@@ -13,25 +13,24 @@ An exhaustive list of every repository in the Retold suite, organized by group.
13
13
  | [fable-uuid](/fable/fable-uuid/) | `fable-uuid` | UUID generator supporting RFC 4122 v4 and configurable random strings |
14
14
  | [fable-log-logger-bunyan](/fable/fable-log-logger-bunyan/) | `fable-log-logger-bunyan` | Bunyan structured logging provider for Fable-Log |
15
15
 
16
- ## Meadow — Data Access Layer (13 modules)
16
+ ## Meadow — Data Access Layer (12 modules)
17
17
 
18
18
  | Module | npm | Description |
19
19
  |--------|-----|-------------|
20
- | [meadow](/meadow/meadow/) | `meadow` | Provider-agnostic data broker with CRUD operations, audit tracking, and soft deletes |
21
- | [foxhound](/meadow/foxhound/) | `foxhound` | Fluent query DSL generating dialect-specific SQL for MySQL, MSSQL, SQLite, and ALASQL |
22
20
  | [stricture](/meadow/stricture/) | `stricture` | MicroDDL schema definition language generating JSON, SQL DDL, and documentation |
21
+ | [foxhound](/meadow/foxhound/) | `foxhound` | Fluent query DSL generating dialect-specific SQL for MySQL, MSSQL, SQLite, and ALASQL |
22
+ | [bibliograph](/meadow/bibliograph/) | `bibliograph` | Key-value record comprehension for change tracking in data ingestion pipelines |
23
+ | [meadow](/meadow/meadow/) | `meadow` | Provider-agnostic data broker with CRUD operations, audit tracking, and soft deletes |
24
+ | [parime](/meadow/parime/) | `parime` | Generic data lake behaviors and services |
23
25
  | [meadow-endpoints](/meadow/meadow-endpoints/) | `meadow-endpoints` | Automatic RESTful CRUD endpoint generation from Meadow entities with behavior injection |
24
26
  | [meadow-connection-mysql](/meadow/meadow-connection-mysql/) | `meadow-connection-mysql` | MySQL/MariaDB pooled connection provider for Meadow |
25
27
  | [meadow-connection-mssql](/meadow/meadow-connection-mssql/) | `meadow-connection-mssql` | Microsoft SQL Server connection provider for Meadow |
26
28
  | [meadow-connection-sqlite](/meadow/meadow-connection-sqlite/) | `meadow-connection-sqlite` | SQLite connection provider for Meadow via better-sqlite3 |
27
29
  | [retold-data-service](/meadow/retold-data-service/) | `retold-data-service` | All-in-one Fable service assembling schema → entity → endpoints → REST API |
28
30
  | [retold-harness](/meadow/retold-harness/) | `retold-harness` | Pre-built API harness with a bookstore demo (8 entities, 10,000+ records) |
29
- | [bibliograph](/meadow/bibliograph/) | `bibliograph` | Key-value record comprehension for change tracking in data ingestion pipelines |
30
- | [parime](/meadow/parime/) | `parime` | Generic data lake behaviors and services |
31
31
  | [meadow-integration](/meadow/meadow-integration/) | `meadow-integration` | Data integration tools for CSV import, schema mapping, and centralized formats |
32
- | [meadow-graph-client](/meadow/meadow-graph-client/) | `meadow-graph-client` | Client for pulling related record sets from relational database graphs |
33
32
 
34
- ## Orator — API Server (6 modules)
33
+ ## Orator — API Server (7 modules)
35
34
 
36
35
  | Module | npm | Description |
37
36
  |--------|-----|-------------|
@@ -41,35 +40,39 @@ An exhaustive list of every repository in the Retold suite, organized by group.
41
40
  | [orator-http-proxy](/orator/orator-http-proxy/) | `orator-http-proxy` | HTTP reverse proxy for forwarding requests to backend services |
42
41
  | [tidings](/orator/tidings/) | `tidings` | Extensible reporting system for generating HTML, PDF, and other format reports |
43
42
  | [orator-endpoint](/orator/orator-endpoint/) | `orator-endpoint` | Pluggable API endpoint base class for reusable route handlers |
43
+ | [orator-conversion](/orator/orator-conversion/) | `orator-conversion` | File format conversion endpoints for Orator service servers |
44
44
 
45
- ## Pict — MVC Tools (15 modules)
45
+ ## Pict — MVC Tools (19 modules)
46
46
 
47
47
  | Module | npm | Description |
48
48
  |--------|-----|-------------|
49
49
  | [pict](/pict/pict/) | `pict` | Non-opinionated MVC module with template expression engine for text-based UIs |
50
- | [pict-view](/pict/pict-view/) | `pict-view` | View base class with full lifecycle (init, render, solve, marshal), renderables, and CSS |
51
50
  | [pict-template](/pict/pict-template/) | `pict-template` | Template handler base class for custom expression types |
51
+ | [pict-view](/pict/pict-view/) | `pict-view` | View base class with full lifecycle (init, render, solve, marshal), renderables, and CSS |
52
52
  | [pict-provider](/pict/pict-provider/) | `pict-provider` | Data provider base class for delivering data to views |
53
53
  | [pict-application](/pict/pict-application/) | `pict-application` | Application base class coordinating views, state, and lifecycle |
54
- | [pict-section-form](/pict/pict-section-form/) | `pict-section-form` | Configuration-driven dynamic forms with 13+ input types and data marshaling |
54
+ | [pict-panel](/pict/pict-panel/) | `pict-panel` | Hot-loadable control panel component for browser applications |
55
+ | [pict-nonlinearconfig](/pict/pict-nonlinearconfig/) | `pict-nonlinearconfig` | Pict nonlinear configuration manager |
56
+ | [pict-section-flow](/pict/pict-section-flow/) | `pict-section-flow` | Pict section flow diagram |
57
+ | [pict-docuserve](/pict/pict-docuserve/) | `pict-docuserve` | Single-page documentation viewer built on Pict |
58
+ | [cryptbrau](/pict/cryptbrau/) | `cryptbrau` | Simple in-browser symmetric encryption |
59
+ | [informary](/pict/informary/) | `informary` | Dependency-free browser form marshaling with undo/redo and field-level deltas |
60
+ | [pict-service-commandlineutility](/pict/pict-service-commandlineutility/) | `pict-service-commandlineutility` | CLI utility module built on Commander for Pict-based command-line tools |
55
61
  | [pict-section-recordset](/pict/pict-section-recordset/) | `pict-section-recordset` | CRUD record management views from Meadow endpoint schemas |
62
+ | [pict-section-content](/pict/pict-section-content/) | `pict-section-content` | Markdown parsing and content rendering with Mermaid diagrams and KaTeX math |
63
+ | [pict-section-form](/pict/pict-section-form/) | `pict-section-form` | Configuration-driven dynamic forms with 13+ input types and data marshaling |
56
64
  | [pict-section-tuigrid](/pict/pict-section-tuigrid/) | `pict-section-tuigrid` | Toast UI Grid integration for tabular data display and editing |
57
- | [pict-section-content](/pict/pict-section-content/) | `pict-section-content` | Content display sections for static and dynamic content blocks |
58
- | [pict-panel](/pict/pict-panel/) | `pict-panel` | Hot-loadable control panel component for browser applications |
59
65
  | [pict-router](/pict/pict-router/) | `pict-router` | Hash-based URL routing via Navigo with template string route functions |
60
- | [informary](/pict/informary/) | `informary` | Dependency-free browser form marshaling with undo/redo and field-level deltas |
61
- | [cryptbrau](/pict/cryptbrau/) | `cryptbrau` | Simple in-browser symmetric encryption |
62
66
  | [pict-serviceproviderbase](/pict/pict-serviceproviderbase/) | `pict-serviceproviderbase` | Base classes for Pict services with pre-initialization support |
63
- | [pict-service-commandlineutility](/pict/pict-service-commandlineutility/) | `pict-service-commandlineutility` | CLI utility module built on Commander for Pict-based command-line tools |
67
+ | [pict-terminalui](/pict/pict-terminalui/) | `pict-terminalui` | Blessed-based terminal interface for Pict views |
64
68
 
65
- ## Utility — Build & Documentation Tools (5 modules)
69
+ ## Utility — Build & Documentation Tools (4 modules)
66
70
 
67
71
  | Module | npm | Description |
68
72
  |--------|-----|-------------|
69
73
  | [indoctrinate](/utility/indoctrinate/) | `indoctrinate` | Documentation scaffolding with content cataloging, label-based filtering, and multi-format output |
70
74
  | [manyfest](/utility/manyfest/) | `manyfest` | JSON manifest for consistent data description, validation, and address-based access across layers |
71
75
  | [quackage](/utility/quackage/) | `quackage` | Standardized build tool for browser bundles, transpilation, testing, and packaging |
72
- | [choreographic](/utility/choreographic/) | `choreographic` | Scaffolding for single-run data processing scripts with organized output |
73
76
  | [ultravisor](/utility/ultravisor/) | `ultravisor` | Process supervision with scheduled tasks, distributed nodes, and LLM integration |
74
77
 
75
78
  ## Summary
@@ -77,11 +80,11 @@ An exhaustive list of every repository in the Retold suite, organized by group.
77
80
  | Group | Count | Focus |
78
81
  |-------|-------|-------|
79
82
  | Fable | 6 | Core ecosystem, DI, configuration, logging |
80
- | Meadow | 13 | Data access, ORM, query DSL, schema, connectors |
81
- | Orator | 6 | API server, HTTP, static files, proxy, reporting |
82
- | Pict | 15 | MVC, views, templates, forms, grids, routing |
83
- | Utility | 5 | Build tools, manifests, docs, process supervision |
84
- | **Total** | **45** | |
83
+ | Meadow | 12 | Data access, ORM, query DSL, schema, connectors |
84
+ | Orator | 7 | API server, HTTP, static files, proxy, reporting, conversion |
85
+ | Pict | 19 | MVC, views, templates, forms, grids, routing, docs, TUI |
86
+ | Utility | 4 | Build tools, manifests, docs, process supervision |
87
+ | **Total** | **48** | |
85
88
 
86
89
  ## GitHub Repositories
87
90
 
package/docs/cover.md CHANGED
@@ -10,6 +10,6 @@
10
10
  - **Pict** — MVC tools, views, templates, forms
11
11
 
12
12
  [Get Started](getting-started.md)
13
- [Architecture](architecture.md)
14
- [All Modules](modules.md)
13
+ [Architecture](architecture/architecture.md)
14
+ [All Modules](modules/modules.md)
15
15
  [GitHub](https://github.com/stevenvelozo/retold)
@@ -13,7 +13,7 @@ html, body {
13
13
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
14
14
  font-size: 16px;
15
15
  line-height: 1.5;
16
- color: #333;
16
+ color: #423D37;
17
17
  background-color: #fff;
18
18
  -webkit-font-smoothing: antialiased;
19
19
  -moz-osx-font-smoothing: grayscale;
@@ -26,12 +26,12 @@ h1, h2, h3, h4, h5, h6 {
26
26
  }
27
27
 
28
28
  a {
29
- color: #42b983;
29
+ color: #2E7D74;
30
30
  text-decoration: none;
31
31
  }
32
32
 
33
33
  a:hover {
34
- color: #38a373;
34
+ color: #256861;
35
35
  }
36
36
 
37
37
  /* Application container */
@@ -45,16 +45,16 @@ a:hover {
45
45
  }
46
46
 
47
47
  ::-webkit-scrollbar-track {
48
- background: #f1f1f1;
48
+ background: #F5F0E8;
49
49
  }
50
50
 
51
51
  ::-webkit-scrollbar-thumb {
52
- background: #bdc3c7;
52
+ background: #D4CCBE;
53
53
  border-radius: 4px;
54
54
  }
55
55
 
56
56
  ::-webkit-scrollbar-thumb:hover {
57
- background: #95a5a6;
57
+ background: #B5AA9A;
58
58
  }
59
59
 
60
60
  /* Responsive adjustments */
@@ -0,0 +1,71 @@
1
+ # Examples
2
+
3
+ The `examples/` directory contains complete, runnable applications that demonstrate how Retold modules work together. Each example is self-contained with its own `package.json` and README.
4
+
5
+ ## Quickstart Layers
6
+
7
+ **Location:** `examples/quickstart/`
8
+
9
+ A five-step progression that builds up the Retold stack one layer at a time, from a bare Fable instance to a full API with a Pict browser UI. Each layer adds one concept and is referenced from the [Getting Started](../getting-started.md) guide.
10
+
11
+ | Layer | What it adds |
12
+ |-------|-------------|
13
+ | Layer 1 | Fable -- configuration, logging, dependency injection |
14
+ | Layer 2 | Meadow -- define a data entity and connect to a database |
15
+ | Layer 3 | Orator -- serve the entity over HTTP |
16
+ | Layer 4 | Meadow-Endpoints -- auto-generate the full REST API |
17
+ | Layer 5 | Pict + Manyfest -- add a browser UI and schema-driven data access |
18
+
19
+ ## Todo List Application
20
+
21
+ **Location:** `examples/todo-list/`
22
+
23
+ A complete full-stack application with four separate clients that all connect to the same REST API and SQLite database. This is the most comprehensive example in the repository and demonstrates nearly every major Retold pattern.
24
+
25
+ ```mermaid
26
+ graph LR
27
+ server["API Server<br/><i>Orator + Meadow + SQLite</i>"]
28
+ web["Web Client<br/><i>Pict Application</i>"]
29
+ console["Console Client<br/><i>blessed TUI</i>"]
30
+ cli["CLI Client<br/><i>pict-service-commandlineutility</i>"]
31
+
32
+ web -- "fetch()" --> server
33
+ console -- "http.request()" --> server
34
+ cli -- "http.request()" --> server
35
+
36
+ style server fill:#e3f2fd,stroke:#42a5f5,color:#333
37
+ style web fill:#e8f5e9,stroke:#43a047,color:#333
38
+ style console fill:#fff3e0,stroke:#ffa726,color:#333
39
+ style cli fill:#f3e5f5,stroke:#ab47bc,color:#333
40
+ ```
41
+
42
+ **Detailed documentation:**
43
+
44
+ - **[Todo List Application](examples/todolist/todo-list.md)** -- Architecture overview and quickstart
45
+ - **[Data Model](examples/todolist/todo-list-model.md)** -- Stricture MicroDDL, Meadow schema, seed data
46
+ - **[API Server](examples/todolist/todo-list-server.md)** -- Orator + Meadow + SQLite wiring
47
+ - **[Web Client](examples/todolist/todo-list-web-client.md)** -- Pict Application with views, providers, and routing
48
+ - **[Console Client](examples/todolist/todo-list-console-client.md)** -- blessed TUI with pict-terminalui
49
+ - **[CLI Client](examples/todolist/todo-list-cli-client.md)** -- Non-interactive command-line tool
50
+
51
+ ### Retold Patterns Demonstrated
52
+
53
+ | Pattern | Where |
54
+ |---------|-------|
55
+ | Fable service provider | All components |
56
+ | Stricture MicroDDL schema | `model/Task.mddl` |
57
+ | Meadow DAL + SQLite | API server |
58
+ | Meadow Endpoints (auto REST) | API server |
59
+ | Orator HTTP server | API server |
60
+ | CSV seeding through Meadow DAL | API server |
61
+ | Pict Application lifecycle | Web client |
62
+ | Pict Views + Templates | Web client |
63
+ | Pict Providers | Web client |
64
+ | Pict Router (hash routing) | Web client |
65
+ | View CSS injection | Web client |
66
+ | Quackage build system | Web client |
67
+ | pict-terminalui + blessed | Console client |
68
+ | ContentAssignment override | Console client |
69
+ | pict-service-commandlineutility | CLI client |
70
+ | Command-per-folder pattern | CLI client |
71
+ | Fable custom service | CLI client |
@@ -0,0 +1,178 @@
1
+ # Todo List: CLI Client
2
+
3
+ > Part of the [Todo List Application](examples/todolist/todo-list.md) example.
4
+ >
5
+ > **Source:** [`examples/todo-list/cli-client/`](../examples/todo-list/cli-client/)
6
+
7
+ The CLI client is a non-interactive command-line tool built on pict-service-commandlineutility. It demonstrates the command-per-folder pattern used by Quackage and other Retold CLI tools: each command lives in its own folder, shares a common API service, and registers itself with the Commander.js-based framework.
8
+
9
+ ## Running
10
+
11
+ ```bash
12
+ cd examples/todo-list/cli-client
13
+ npm install
14
+ npx todo --help
15
+ ```
16
+
17
+ The server must be running on port 8086 (or configure a different URL in `.todo-cli.json`).
18
+
19
+ ### Running with Docker
20
+
21
+ From the `examples/todo-list/` directory, run `./docker-shell.sh` for an interactive shell inside the container. Start the server in the background, then use the CLI:
22
+
23
+ ```bash
24
+ node server/server.cjs &
25
+ cd /app/cli-client && npx todo list
26
+ ```
27
+
28
+ See the [main quickstart](examples/todolist/todo-list.md) for details.
29
+
30
+ ## Commands
31
+
32
+ ### `todo list`
33
+
34
+ List tasks with optional search, sort, and filter.
35
+
36
+ ```bash
37
+ npx todo list # Default: newest first, up to 50
38
+ npx todo list --search garden --limit 10 # Search name + description
39
+ npx todo list --column Name --direction ASC # Sort alphabetically
40
+ npx todo list --status Pending # Client-side status filter
41
+ ```
42
+
43
+ | Option | Description | Default |
44
+ |--------|-------------|---------|
45
+ | `-s, --search [text]` | LIKE search across Name and Description | (none) |
46
+ | `-c, --column [column]` | Sort column: DueDate, Name, Status, LengthInHours, IDTask | DueDate |
47
+ | `-d, --direction [dir]` | Sort direction: ASC or DESC | DESC |
48
+ | `-n, --limit [count]` | Maximum records to return | 50 |
49
+ | `--status [status]` | Client-side filter by status (Pending, In Progress, Complete) | (none) |
50
+
51
+ **Aliases:** `ls`, `l`
52
+
53
+ ### `todo add`
54
+
55
+ Create a new task.
56
+
57
+ ```bash
58
+ npx todo add "Water the plants" --due 2026-03-15 --hours 0.5
59
+ npx todo add "Team standup" --status "In Progress" --description "Daily 9am sync"
60
+ ```
61
+
62
+ | Option | Description | Default |
63
+ |--------|-------------|---------|
64
+ | `-D, --description [text]` | Task description | (empty) |
65
+ | `-d, --due [date]` | Due date (YYYY-MM-DD) | (empty) |
66
+ | `-h, --hours [hours]` | Estimated hours | 0 |
67
+ | `-s, --status [status]` | Initial status | Pending |
68
+
69
+ **Aliases:** `new`, `create`
70
+
71
+ ### `todo complete`
72
+
73
+ Mark a task as complete by ID. Fetches the task first and skips if already complete.
74
+
75
+ ```bash
76
+ npx todo complete 42
77
+ ```
78
+
79
+ **Aliases:** `done`, `finish`
80
+
81
+ ### `todo remove`
82
+
83
+ Delete a task by ID.
84
+
85
+ ```bash
86
+ npx todo remove 42
87
+ ```
88
+
89
+ **Aliases:** `rm`, `delete`, `del`
90
+
91
+ ### `todo explain-config`
92
+
93
+ Built-in command from pict-service-commandlineutility. Shows the resolved configuration after merging defaults with any `.todo-cli.json` files found in the home directory or current working directory.
94
+
95
+ ## Architecture
96
+
97
+ ```mermaid
98
+ graph TB
99
+ subgraph cli["TodoCLI-CLIProgram"]
100
+ commander["Commander.js<br/><i>Argument parsing</i>"]
101
+ config["Configuration<br/><i>.todo-cli.json</i>"]
102
+ end
103
+
104
+ subgraph service["TodoCLI-Service-API"]
105
+ http["http.request()<br/><i>JSON over HTTP</i>"]
106
+ urlbuilder["buildFilteredPath()<br/><i>Meadow query URL construction</i>"]
107
+ end
108
+
109
+ subgraph commands["Commands"]
110
+ list["list<br/><i>Tabular output</i>"]
111
+ add["add<br/><i>POST /1.0/Task</i>"]
112
+ remove["remove<br/><i>DELETE /1.0/Task/:id</i>"]
113
+ complete["complete<br/><i>GET then PUT</i>"]
114
+ end
115
+
116
+ cli --> service
117
+ cli --> commands
118
+ commands --> service
119
+ service --> server["API Server<br/>http://localhost:8086"]
120
+ ```
121
+
122
+ ### Command-per-folder Pattern
123
+
124
+ Each command lives in its own folder under `source/commands/`:
125
+
126
+ ```
127
+ source/commands/
128
+ list/ TodoCLI-Command-List.js
129
+ add/ TodoCLI-Command-Add.js
130
+ remove/ TodoCLI-Command-Remove.js
131
+ complete/ TodoCLI-Command-Complete.js
132
+ ```
133
+
134
+ This is the same pattern used by Quackage and other Retold CLI tools. Each command file exports a class that extends `ServiceCommandLineCommand`, sets its keyword, description, arguments, and options in the constructor, and implements `onRunAsync(fCallback)` for the command logic.
135
+
136
+ ### Shared API Service
137
+
138
+ `TodoCLI-Service-API.js` extends `fable-serviceproviderbase` and provides two methods used by all commands:
139
+
140
+ - **`request(method, path, body, callback)`** -- makes an HTTP request to the API server, parses the JSON response, and returns it through the callback
141
+ - **`buildFilteredPath(sortColumn, sortDirection, searchText, limit)`** -- constructs a Meadow FilteredTo URL with sort stanzas and optional LIKE search filters (with `%` wildcards)
142
+
143
+ The service reads its base URL from `this.fable.settings.ApiBaseURL`, which defaults to `http://localhost:8086` and can be overridden in `.todo-cli.json`.
144
+
145
+ ### Bootstrap
146
+
147
+ `TodoCLI-CLIProgram.js` creates a `pict-service-commandlineutility` instance with settings and an array of command class prototypes. The framework iterates the array, instantiates each command, and registers it with Commander.js. The `TodoAPI` service is registered separately using `addAndInstantiateServiceType`.
148
+
149
+ `TodoCLI-Run.js` is the shebang entry point (`#!/usr/bin/env node`) that requires the program module and calls `.run()`.
150
+
151
+ ### Configuration
152
+
153
+ The framework automatically searches for `.todo-cli.json` in the user's home directory and the current working directory. Configuration from all sources is merged in order (defaults, home, CWD). The only setting is the API base URL:
154
+
155
+ ```json
156
+ {
157
+ "ApiBaseURL": "http://localhost:8086"
158
+ }
159
+ ```
160
+
161
+ ## Dependencies
162
+
163
+ | Module | Role |
164
+ |--------|------|
165
+ | `pict-service-commandlineutility` | CLI framework (Commander.js + Fable service container) |
166
+ | `fable-serviceproviderbase` | Base class for the API service (transitive dependency) |
167
+
168
+ ## Files
169
+
170
+ | File | Purpose |
171
+ |------|---------|
172
+ | `source/TodoCLI-Run.js` | Shebang entry point for the `todo` bin command |
173
+ | `source/TodoCLI-CLIProgram.js` | Bootstrap -- registers commands and the API service |
174
+ | `source/services/TodoCLI-Service-API.js` | Shared HTTP client with JSON parsing and FilteredTo URL builder |
175
+ | `source/commands/list/TodoCLI-Command-List.js` | `todo list` -- tabular output with search, sort, filter, limit |
176
+ | `source/commands/add/TodoCLI-Command-Add.js` | `todo add <name>` -- create a task with options |
177
+ | `source/commands/remove/TodoCLI-Command-Remove.js` | `todo remove <id>` -- delete a task |
178
+ | `source/commands/complete/TodoCLI-Command-Complete.js` | `todo complete <id>` -- mark a task as complete |
@@ -0,0 +1,152 @@
1
+ # Todo List: Console Client
2
+
3
+ > Part of the [Todo List Application](examples/todolist/todo-list.md) example.
4
+ >
5
+ > **Source:** [`examples/todo-list/console-client/`](../examples/todo-list/console-client/)
6
+
7
+ The console client is a full-screen terminal UI built on blessed, bridged to Pict views through pict-terminalui. It demonstrates how the same Pict view/template architecture that drives the browser UI can render into a terminal -- views write templates, and the ContentAssignment bridge sends the output to blessed widgets instead of the DOM.
8
+
9
+ ## Running
10
+
11
+ ```bash
12
+ cd examples/todo-list/console-client
13
+ npm install
14
+ npm start
15
+ ```
16
+
17
+ The server must be running on port 8086.
18
+
19
+ ### Running with Docker
20
+
21
+ From the `examples/todo-list/` directory, run `./docker-shell.sh` for an interactive shell inside the container. Start the server in the background, then launch the console client:
22
+
23
+ ```bash
24
+ node server/server.cjs &
25
+ node console-client/console-client.cjs
26
+ ```
27
+
28
+ See the [main quickstart](examples/todolist/todo-list.md) for details.
29
+
30
+ ## Keyboard Controls
31
+
32
+ | Key | Action |
33
+ |-----|--------|
34
+ | Up / Down | Navigate task selection |
35
+ | Enter | View selected task (read-only detail) |
36
+ | E | Edit selected task |
37
+ | A | Add a new task |
38
+ | D | Delete selected task |
39
+ | S | Open sort picker (10 sort options) |
40
+ | / | Search by name or description |
41
+ | R | Refresh from server |
42
+ | Q | Quit |
43
+
44
+ ## Architecture
45
+
46
+ ```mermaid
47
+ graph TB
48
+ subgraph app["TodoListConsoleApplication"]
49
+ state["AppData.TodoList<br/><i>Tasks, SelectedIndex, ListState</i>"]
50
+ http["httpRequest()<br/><i>Node.js http module</i>"]
51
+ modals["Modal dialogs<br/><i>View, Edit, Sort, Search</i>"]
52
+ end
53
+
54
+ subgraph tui["pict-terminalui"]
55
+ bridge["ContentAssignment bridge<br/><i>Pict views → blessed widgets</i>"]
56
+ end
57
+
58
+ subgraph blessed["blessed screen"]
59
+ header["TUI-Header<br/><i>Title + keybindings</i>"]
60
+ content["TUI-TaskList<br/><i>Scrollable task rows</i>"]
61
+ status["TUI-StatusBar<br/><i>Count, sort, message</i>"]
62
+ end
63
+
64
+ app --> tui
65
+ tui --> blessed
66
+ http -- "GET/POST/PUT/DELETE" --> server["API Server"]
67
+ ```
68
+
69
+ ## How It Works
70
+
71
+ The console client is a single `console-client.cjs` file that extends `pict-application`. On initialization it:
72
+
73
+ 1. **Creates a blessed screen** -- the terminal canvas managed by blessed
74
+ 2. **Builds the widget layout** -- header, content area, and status bar as blessed boxes
75
+ 3. **Registers widgets with pict-terminalui** -- the bridge maps CSS-style selectors (`#TUI-Header`, `#TUI-Content`, `#TUI-StatusBar`) to blessed widgets
76
+ 4. **Binds keyboard handlers** -- each key checks a `_modalOpen` flag to prevent conflicts between the main list and modal dialogs
77
+ 5. **Loads tasks** via HTTP and renders the initial view
78
+
79
+ ### pict-terminalui Bridge
80
+
81
+ The key architectural pattern is the ContentAssignment override. In a browser, Pict views render templates and write the result into DOM elements using `innerHTML`. The pict-terminalui module replaces this mechanism: when a view writes to `#TUI-Content`, the bridge sends the text to the corresponding blessed widget's `setContent()` method instead.
82
+
83
+ This means the four TUI view classes (`PictView-TUI-Layout`, `PictView-TUI-Header`, `PictView-TUI-TaskList`, `PictView-TUI-StatusBar`) use standard Pict templates with `{~Data:...~}` expressions. They don't know they're rendering into a terminal.
84
+
85
+ ### Modal System
86
+
87
+ The console client has four modal dialogs, each created as a temporary blessed widget that overlays the main screen:
88
+
89
+ - **View modal** (Enter) -- a `blessed.box` showing read-only task detail (name, status, due date, hours, description). Press Esc to close or E to jump to edit.
90
+ - **Edit modal** (E) -- a sequential chain of `blessed.prompt` dialogs for each field (Name, Description, DueDate, LengthInHours, Status). Pressing Escape at any point cancels the edit.
91
+ - **Sort modal** (S) -- a `blessed.list` with 10 sort options (DueDate, Name, Status, Hours, IDTask in both ASC and DESC). The current sort is pre-selected. Choosing an option reloads the task list from the API.
92
+ - **Search modal** (/) -- a `blessed.prompt` for entering a search string. The search filters across both Name and Description using a LIKE query with OR. An empty string clears the filter.
93
+
94
+ All modals set a `_modalOpen` flag on open and clear it on close. Every keyboard handler checks this flag before acting, preventing key conflicts (e.g., pressing Q in a modal closes the modal, not the application).
95
+
96
+ ### HTTP Communication
97
+
98
+ The client uses Node.js `http.request()` with a simple wrapper function. The `_buildFilteredPath()` method constructs the same Meadow FilteredTo URL syntax that the web client uses, including `%` wildcards for LIKE searches:
99
+
100
+ ```javascript
101
+ let tmpSearchEncoded = encodeURIComponent('%' + tmpState.SearchText + '%');
102
+ tmpFilter = 'FBV~Name~LK~' + tmpSearchEncoded
103
+ + '~FBVOR~Description~LK~' + tmpSearchEncoded
104
+ + '~' + tmpFilter;
105
+ ```
106
+
107
+ ## Views
108
+
109
+ ### PictView-TUI-Layout
110
+
111
+ Root container that triggers renders of the header, content, and status bar child views. Registered to `#TUI-Application-Container`.
112
+
113
+ ### PictView-TUI-Header
114
+
115
+ Renders the application title and keybinding reference bar into the top blessed box:
116
+
117
+ ```
118
+ Todo List Console Client
119
+ [Enter]View [E]dit [A]dd [D]elete [S]ort [/]Search [R]efresh [Q]uit
120
+ ```
121
+
122
+ ### PictView-TUI-TaskList
123
+
124
+ Builds a formatted text table from `AppData.TodoList.Tasks` with columns for index, name, status, due date, and hours. The currently selected row is highlighted with `{inverse}` blessed tags.
125
+
126
+ ### PictView-TUI-StatusBar
127
+
128
+ Shows the task count, status message, and current sort column/direction using a Pict template:
129
+
130
+ ```
131
+ Tasks: {~D:Record.Tasks.length~} | {~D:Record.StatusMessage~} | Sort: {~D:Record.ListState.SortColumn~} {~D:Record.ListState.SortDirection~}
132
+ ```
133
+
134
+ ## Dependencies
135
+
136
+ | Module | Role |
137
+ |--------|------|
138
+ | `blessed` | Terminal UI rendering (boxes, lists, prompts, key handling) |
139
+ | `pict` | Core view and template engine |
140
+ | `pict-application` | Application lifecycle |
141
+ | `pict-view` | View base class |
142
+ | `pict-terminalui` | ContentAssignment bridge from Pict views to blessed widgets |
143
+
144
+ ## Files
145
+
146
+ | File | Purpose |
147
+ |------|---------|
148
+ | `console-client.cjs` | Application class -- screen setup, keyboard bindings, modals, HTTP client |
149
+ | `views/PictView-TUI-Layout.cjs` | Root blessed layout (header + content + status bar) |
150
+ | `views/PictView-TUI-Header.cjs` | Title bar with keybinding reference |
151
+ | `views/PictView-TUI-TaskList.cjs` | Scrollable task list with selection highlighting |
152
+ | `views/PictView-TUI-StatusBar.cjs` | Status line showing count, message, and current sort |
@@ -0,0 +1,114 @@
1
+ # Todo List: System Model
2
+
3
+ > Part of the [Todo List Application](examples/todolist/todo-list.md) example.
4
+ >
5
+ > **Source:** [`examples/todo-list/model/`](../examples/todo-list/model/)
6
+
7
+ The Task entity is defined once and consumed by every component in the application. This is a core Retold pattern: the data model is the source of truth, and everything else -- table creation, API endpoints, query generation -- flows from it.
8
+
9
+ ## Stricture MicroDDL
10
+
11
+ The schema starts as a `.mddl` file -- Stricture's one-line-per-field notation:
12
+
13
+ ```
14
+ !Task
15
+ @IDTask
16
+ %GUIDTask
17
+ $Name 200
18
+ *Description
19
+ &DueDate
20
+ .LengthInHours 10,2
21
+ $Status 32
22
+ &CreateDate
23
+ #CreatingIDUser -> IDUser
24
+ &UpdateDate
25
+ #UpdatingIDUser -> IDUser
26
+ ^Deleted
27
+ &DeleteDate
28
+ #DeletingIDUser -> IDUser
29
+ ```
30
+
31
+ Each sigil declares the column type:
32
+
33
+ | Sigil | Meaning | Example |
34
+ |-------|---------|---------|
35
+ | `!` | Entity (table) name | `!Task` |
36
+ | `@` | Auto-increment identity | `@IDTask` |
37
+ | `%` | Auto-generated GUID | `%GUIDTask` |
38
+ | `$` | String with max length | `$Name 200` |
39
+ | `*` | Text (unlimited length) | `*Description` |
40
+ | `&` | DateTime | `&DueDate` |
41
+ | `.` | Decimal (precision, scale) | `.LengthInHours 10,2` |
42
+ | `#` | Integer (foreign key) | `#CreatingIDUser -> IDUser` |
43
+ | `^` | Boolean flag | `^Deleted` |
44
+
45
+ The audit columns (CreateDate, CreatingIDUser, UpdateDate, UpdatingIDUser, Deleted, DeleteDate, DeletingIDUser) follow the standard Meadow audit trail convention. Meadow manages these automatically -- you never set them in application code.
46
+
47
+ ## Compiled DDL
48
+
49
+ Running the Stricture compiler produces `Task-Compiled.json`, a JSON representation of the table structure that the SQLite provider uses to generate CREATE TABLE statements at startup:
50
+
51
+ ```json
52
+ {
53
+ "Tables": [
54
+ {
55
+ "TableName": "Task",
56
+ "Columns": [
57
+ { "Column": "IDTask", "DataType": "AutoIdentity" },
58
+ { "Column": "GUIDTask", "DataType": "AutoGUID" },
59
+ { "Column": "Name", "DataType": "String", "Size": "200" },
60
+ ...
61
+ ]
62
+ }
63
+ ]
64
+ }
65
+ ```
66
+
67
+ The server passes this to `meadow-connection-sqlite`'s `createTables()` method, which generates and executes the appropriate SQLite DDL. You never write CREATE TABLE statements by hand.
68
+
69
+ ## Meadow Schema
70
+
71
+ `MeadowSchema-Task.json` defines the ORM mapping that Meadow uses for all CRUD operations:
72
+
73
+ - **Column definitions** with types, sizes, and defaults
74
+ - **JSON Schema** for request validation
75
+ - **Default identifier** (`IDTask`) and GUID identifier (`GUIDTask`)
76
+ - **Default object** template for new records
77
+
78
+ The server loads this schema and passes it to Meadow when creating the Task DAL instance. Meadow Endpoints then uses the same schema to auto-generate REST routes with proper type handling.
79
+
80
+ ## Field Reference
81
+
82
+ | Field | Type | Description |
83
+ |-------|------|-------------|
84
+ | IDTask | AutoIdentity | Primary key (auto-increment) |
85
+ | GUIDTask | AutoGUID | UUID generated by Meadow on create |
86
+ | Name | String(200) | Task name |
87
+ | Description | Text | Task description (unlimited length) |
88
+ | DueDate | DateTime | When the task is due |
89
+ | LengthInHours | Decimal(10,2) | Estimated duration in hours |
90
+ | Status | String(32) | One of: Pending, In Progress, Complete |
91
+ | CreateDate | DateTime | Set automatically by Meadow on create |
92
+ | CreatingIDUser | Integer | Set automatically by Meadow on create |
93
+ | UpdateDate | DateTime | Set automatically by Meadow on update |
94
+ | UpdatingIDUser | Integer | Set automatically by Meadow on update |
95
+ | Deleted | Boolean | Soft-delete flag (Meadow never hard-deletes) |
96
+ | DeleteDate | DateTime | Set automatically by Meadow on delete |
97
+ | DeletingIDUser | Integer | Set automatically by Meadow on delete |
98
+
99
+ ## Seed Data
100
+
101
+ The file `model/data/seeded_todo_events.csv` contains 1,000 realistic task records spanning four years of family life: personal errands, work tasks, birthdays, holidays, bills, vet appointments, and more.
102
+
103
+ On first server start, the `DatabaseInitializationService` checks whether the Task table is empty. If it is, it reads the CSV and creates each record through the Meadow DAL using `doCreate()`. Because the records pass through Meadow, every row gets a proper GUID, audit timestamps, and default values -- exactly as if a user had created them through the API.
104
+
105
+ To re-seed the database, delete `server/data/todo.sqlite` and restart the server.
106
+
107
+ ## Files
108
+
109
+ | File | Purpose |
110
+ |------|---------|
111
+ | `Task.mddl` | Stricture MicroDDL source definition |
112
+ | `Task-Compiled.json` | Compiled DDL for SQLite table creation |
113
+ | `MeadowSchema-Task.json` | Meadow ORM schema (columns, types, defaults, JSON Schema) |
114
+ | `data/seeded_todo_events.csv` | 1,000 sample tasks for initial database population |