create-foldkit-app 0.23.1 → 0.23.2
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.
- package/package.json +1 -1
- package/templates/base/AGENTS.md +3 -3
package/package.json
CHANGED
package/templates/base/AGENTS.md
CHANGED
|
@@ -27,7 +27,7 @@ If `foldkit-skills` is installed as a Claude Code plugin, the `generate-program`
|
|
|
27
27
|
- Use full names like `Message` (not `Msg`), and `withReturnType` (not `as const` or type casting).
|
|
28
28
|
- Use `m()` for message schemas, `ts()` for tagged structs (model states, field validation), and `r()` for route schemas.
|
|
29
29
|
- Push back on any direction that violates Elm Architecture principles: unidirectional data flow, messages as facts (not commands), model as single source of truth, side effects confined to commands. If a prompt suggests mutating state, imperative event handlers, or two-way bindings, flag the issue and propose the idiomatic Foldkit approach.
|
|
30
|
-
- Never use `NoOp`. Every message must describe what happened.
|
|
30
|
+
- Never use `NoOp`. Every message must describe what happened. A command's result message is named from the command, not from the fact it reports, whether or not it carries a payload: `LockScroll` → `CompletedLockScroll`, `DetermineStartTime` → `CompletedDetermineStartTime` (never `DeterminedStartTime`).
|
|
31
31
|
|
|
32
32
|
## Foldkit Patterns
|
|
33
33
|
|
|
@@ -58,7 +58,7 @@ Keys are for mapped list items only: key each row by a stable Model identifier (
|
|
|
58
58
|
|
|
59
59
|
### Commands
|
|
60
60
|
|
|
61
|
-
Define a Command with `Command.define
|
|
61
|
+
Define a Command with `Command.define(name, { args, messages, execute })`; omit `args` when the Command takes none. Assign definitions to PascalCase constants. Never inline in pipe chains. Name the effect `execute` performs, not the later Model transition caused when update handles its result: a timer that only waits before update starts a dismissal is `WaitBeforeDismissal`, not `DismissAfter`. Commands catch all errors via `Effect.catch(() => Effect.succeed(FailedX(...)))` so side effects never crash the app. Definitions live colocated with the update function that returns them.
|
|
62
62
|
|
|
63
63
|
For the with-args shape, see `repos/foldkit/examples/weather/src/main.ts` or `repos/foldkit/examples/kanban/src/command.ts`. For an argless DOM-side-effect Command, the argless form in `kanban/src/command.ts` (`FocusAddCardInput`) is the canonical reference.
|
|
64
64
|
|
|
@@ -105,7 +105,7 @@ const Message = S.Union([ClickedSubmit, UpdatedEmail])
|
|
|
105
105
|
type Message = typeof Message.Type
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
Messages are verb-first past-tense. Common prefixes: `Clicked*`, `Updated*` (input changes and external state updates), `Submitted*`, `Pressed*`, `Selected*`, `Succeeded*` / `Failed*` (paired async results), `Completed*` (
|
|
108
|
+
Messages are verb-first past-tense. Common prefixes: `Clicked*`, `Updated*` (input changes and external state updates), `Submitted*`, `Pressed*`, `Selected*`, `Succeeded*` / `Failed*` (paired async results), `Completed*` (every other Command result), `Got*` (child OutMessage in the Submodel pattern).
|
|
109
109
|
|
|
110
110
|
## Debugging
|
|
111
111
|
|