@ethlete/agent-rules 0.1.0-next.5 → 0.1.0-next.51
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/AGENTS.md +28 -0
- package/CHANGELOG.md +759 -0
- package/CLAUDE.md +1 -0
- package/README.md +434 -25
- package/THIRD-PARTY-LICENSES.md +35 -0
- package/content/defaults.json +1 -1
- package/content/git-hooks/post-checkout.sh +10 -0
- package/content/git-hooks/pre-push.sh +5 -0
- package/content/hooks/away-mode.py +327 -0
- package/content/hooks/background-design-commands.py +228 -0
- package/content/hooks/builder-idle-check.py +397 -0
- package/content/hooks/context-warning.py +694 -134
- package/content/hooks/design-live-check.py +136 -0
- package/content/hooks/git-safety.py +213 -0
- package/content/hooks/human-wait-check.py +167 -0
- package/content/hooks/subagent-model-policy.py +261 -0
- package/content/mods/.claude-plugin/marketplace.json +26 -0
- package/content/mods/plugins/codex-runs/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/codex-runs/hooks/hooks.json +1 -0
- package/content/mods/plugins/codex-runs/hooks/progress.ts +130 -0
- package/content/mods/plugins/codex-runs/hooks/register.tsx +103 -0
- package/content/mods/plugins/codex-runs/tsconfig.json +4 -0
- package/content/mods/plugins/codex-runs/types/index.d.ts +19 -0
- package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/e2e-progress/hooks/hooks.json +1 -0
- package/content/mods/plugins/e2e-progress/hooks/progress.ts +160 -0
- package/content/mods/plugins/e2e-progress/hooks/register.tsx +442 -0
- package/content/mods/plugins/e2e-progress/tsconfig.json +3 -0
- package/content/mods/plugins/e2e-progress/types/index.d.ts +26 -0
- package/content/mods/plugins/status-line/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/status-line/hooks/hooks.json +1 -0
- package/content/mods/plugins/status-line/hooks/line.ts +74 -0
- package/content/mods/plugins/status-line/hooks/register.tsx +141 -0
- package/content/mods/plugins/status-line/types/index.d.ts +5 -0
- package/content/mods/plugins/usage-line/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/usage-line/hooks/codex.ts +52 -0
- package/content/mods/plugins/usage-line/hooks/format.ts +24 -0
- package/content/mods/plugins/usage-line/hooks/hooks.json +1 -0
- package/content/mods/plugins/usage-line/hooks/register.tsx +67 -0
- package/content/mods/plugins/usage-line/tsconfig.json +4 -0
- package/content/mods/plugins/usage-line/types/index.d.ts +5 -0
- package/content/output-styles/ste-clarity.md +131 -0
- package/content/rules/agent-sessions-wake-up.md +11 -0
- package/content/rules/app-styling.md +66 -0
- package/content/rules/comments.md +4 -1
- package/content/rules/lint-and-format.md +7 -5
- package/content/rules/nx-layout.md +53 -0
- package/content/rules/reactive-state.md +1 -1
- package/content/rules/styling.md +19 -10
- package/content/rules/subagent-models.md +42 -0
- package/content/rules/waiting-on-the-human.md +17 -0
- package/content/skills/agent-sessions/SKILL.md +100 -0
- package/content/skills/agent-sessions/agent-sessions.mjs +1420 -0
- package/content/skills/angular-patterns/SKILL.md +31 -7
- package/content/skills/api-source/SKILL.md +156 -0
- package/content/skills/app-testing/SKILL.md +141 -0
- package/content/skills/codex-subagent/SKILL.md +96 -0
- package/content/skills/codex-subagent/codex-agent.mjs +229 -0
- package/content/skills/codex-subagent/codex-limit.mjs +106 -0
- package/content/skills/design-exploration/SKILL.md +203 -0
- package/content/skills/design-exploration/check-story.mjs +139 -0
- package/content/skills/design-exploration/reference-check-and-notes.md +101 -0
- package/content/skills/design-exploration/reference-flows.md +38 -0
- package/content/skills/design-exploration/reference-inbox-and-mcp.md +54 -0
- package/content/skills/design-exploration/reference-order-and-design-system.md +120 -0
- package/content/skills/design-exploration/reference-products-and-sketches.md +250 -0
- package/content/skills/design-exploration/reference-shots.md +25 -0
- package/content/skills/design-exploration/shoot-template.mjs +61 -0
- package/content/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/content/skills/domain-modeling/SKILL.md +71 -0
- package/content/skills/e2e-triage/SKILL.md +80 -0
- package/content/skills/figma-export/SKILL.md +16 -18
- package/content/skills/git-commit/SKILL.md +21 -7
- package/content/skills/git-flow/SKILL.md +87 -0
- package/content/skills/grill-with-docs/SKILL.md +13 -0
- package/content/skills/grilling/SKILL.md +52 -0
- package/content/skills/handoff/SKILL.md +29 -69
- package/content/skills/handoff/save.md +187 -0
- package/content/skills/query/SKILL.md +165 -70
- package/content/skills/report/SKILL.md +26 -0
- package/content/skills/rxjs-signals/SKILL.md +33 -4
- package/content/skills/sdk-docs/SKILL.md +50 -14
- package/content/skills/sdk-local-build/SKILL.md +26 -8
- package/content/skills/sdk-local-build/sdk-local-baseline.mjs +64 -0
- package/content/skills/sdk-source/SKILL.md +37 -34
- package/content/skills/sdk-update/SKILL.md +103 -0
- package/content/skills/story-styling/SKILL.md +12 -10
- package/content/skills/styleguide/SKILL.md +13 -8
- package/content/skills/styleguide/assets.md +54 -0
- package/content/skills/styleguide/changesets.md +17 -0
- package/content/skills/styleguide/file-structure.md +73 -0
- package/content/skills/styleguide/lint-rule-lookup.md +52 -0
- package/content/skills/styleguide/storybook-structure.md +25 -0
- package/content/skills/theming/SKILL.md +76 -49
- package/content/skills/timetrack/SKILL.md +324 -0
- package/content/skills/verify-in-app/SKILL.md +107 -0
- package/content/skills/verify-in-storybook/SKILL.md +1 -1
- package/migrations/list-state-query-form.md +20 -0
- package/migrations/nx-layout.md +29 -0
- package/migrations/sdk-components-over-hand-built-ui.md +27 -0
- package/migrations/search-query-field.md +52 -0
- package/migrations.json +39 -0
- package/package.json +19 -3
- package/src/index.js +99 -32
- package/src/index.js.map +1 -1
- package/src/lib/cli-args.d.ts +9 -0
- package/src/lib/cli-args.js +48 -0
- package/src/lib/cli-args.js.map +1 -0
- package/src/lib/commitlint.d.ts +10 -0
- package/src/lib/commitlint.js +51 -0
- package/src/lib/commitlint.js.map +1 -0
- package/src/lib/config.d.ts +68 -6
- package/src/lib/config.js +141 -11
- package/src/lib/config.js.map +1 -1
- package/src/lib/filter.d.ts +2 -0
- package/src/lib/filter.js +4 -4
- package/src/lib/filter.js.map +1 -1
- package/src/lib/frontmatter.d.ts +2 -0
- package/src/lib/frontmatter.js +33 -5
- package/src/lib/frontmatter.js.map +1 -1
- package/src/lib/git-flow/build.d.ts +35 -0
- package/src/lib/git-flow/build.js +24 -0
- package/src/lib/git-flow/build.js.map +1 -0
- package/src/lib/git-flow/config.d.ts +59 -0
- package/src/lib/git-flow/config.js +50 -0
- package/src/lib/git-flow/config.js.map +1 -0
- package/src/lib/git-flow/index.d.ts +6 -0
- package/src/lib/git-flow/index.js +23 -0
- package/src/lib/git-flow/index.js.map +1 -0
- package/src/lib/git-flow/parse.d.ts +49 -0
- package/src/lib/git-flow/parse.js +300 -0
- package/src/lib/git-flow/parse.js.map +1 -0
- package/src/lib/git-flow/rename.d.ts +24 -0
- package/src/lib/git-flow/rename.js +70 -0
- package/src/lib/git-flow/rename.js.map +1 -0
- package/src/lib/git-flow/start.d.ts +49 -0
- package/src/lib/git-flow/start.js +57 -0
- package/src/lib/git-flow/start.js.map +1 -0
- package/src/lib/git-flow/validate.d.ts +34 -0
- package/src/lib/git-flow/validate.js +72 -0
- package/src/lib/git-flow/validate.js.map +1 -0
- package/src/lib/git-flow-command.d.ts +4 -0
- package/src/lib/git-flow-command.js +165 -0
- package/src/lib/git-flow-command.js.map +1 -0
- package/src/lib/git-flow-repair.d.ts +17 -0
- package/src/lib/git-flow-repair.js +165 -0
- package/src/lib/git-flow-repair.js.map +1 -0
- package/src/lib/git-flow-start.d.ts +20 -0
- package/src/lib/git-flow-start.js +140 -0
- package/src/lib/git-flow-start.js.map +1 -0
- package/src/lib/git-test-env.fixtures.d.ts +11 -0
- package/src/lib/git-test-env.fixtures.js +31 -0
- package/src/lib/git-test-env.fixtures.js.map +1 -0
- package/src/lib/git.d.ts +64 -0
- package/src/lib/git.js +131 -0
- package/src/lib/git.js.map +1 -0
- package/src/lib/gitlab.d.ts +35 -0
- package/src/lib/gitlab.js +116 -0
- package/src/lib/gitlab.js.map +1 -0
- package/src/lib/index.d.ts +2 -0
- package/src/lib/index.js +26 -11
- package/src/lib/index.js.map +1 -1
- package/src/lib/migrate.js +8 -2
- package/src/lib/migrate.js.map +1 -1
- package/src/lib/output-style-command.d.ts +3 -0
- package/src/lib/output-style-command.js +69 -0
- package/src/lib/output-style-command.js.map +1 -0
- package/src/lib/output-style.d.ts +38 -0
- package/src/lib/output-style.js +134 -0
- package/src/lib/output-style.js.map +1 -0
- package/src/lib/owned-paths.js +8 -2
- package/src/lib/owned-paths.js.map +1 -1
- package/src/lib/package-runner.d.ts +4 -0
- package/src/lib/package-runner.js +86 -0
- package/src/lib/package-runner.js.map +1 -0
- package/src/lib/peer-path.d.ts +12 -0
- package/src/lib/peer-path.js +39 -0
- package/src/lib/peer-path.js.map +1 -0
- package/src/lib/plain-text.d.ts +9 -0
- package/src/lib/plain-text.js +22 -0
- package/src/lib/plain-text.js.map +1 -0
- package/src/lib/plan.d.ts +6 -6
- package/src/lib/plan.js +167 -39
- package/src/lib/plan.js.map +1 -1
- package/src/lib/prettier.d.ts +21 -0
- package/src/lib/prettier.js +51 -0
- package/src/lib/prettier.js.map +1 -0
- package/src/lib/prompt.d.ts +8 -0
- package/src/lib/prompt.js +35 -0
- package/src/lib/prompt.js.map +1 -0
- package/src/lib/render.d.ts +26 -2
- package/src/lib/render.js +45 -10
- package/src/lib/render.js.map +1 -1
- package/src/lib/report-command.d.ts +34 -0
- package/src/lib/report-command.js +316 -0
- package/src/lib/report-command.js.map +1 -0
- package/src/lib/sessions-command.d.ts +4 -0
- package/src/lib/sessions-command.js +16 -0
- package/src/lib/sessions-command.js.map +1 -0
- package/src/lib/sync.d.ts +1 -2
- package/src/lib/sync.js +37 -17
- package/src/lib/sync.js.map +1 -1
- package/src/lib/targets/agents-skills.js +1 -1
- package/src/lib/targets/agents-skills.js.map +1 -1
- package/src/lib/targets/claude-hooks.d.ts +5 -0
- package/src/lib/targets/claude-hooks.js +27 -4
- package/src/lib/targets/claude-hooks.js.map +1 -1
- package/src/lib/targets/claude-mods.d.ts +20 -0
- package/src/lib/targets/claude-mods.js +47 -0
- package/src/lib/targets/claude-mods.js.map +1 -0
- package/src/lib/targets/claude.js +2 -3
- package/src/lib/targets/claude.js.map +1 -1
- package/src/lib/targets/codex-hooks.js +4 -2
- package/src/lib/targets/codex-hooks.js.map +1 -1
- package/src/lib/targets/codex.js +4 -4
- package/src/lib/targets/codex.js.map +1 -1
- package/src/lib/targets/copilot.js +4 -4
- package/src/lib/targets/copilot.js.map +1 -1
- package/src/lib/targets/cursor.js +3 -3
- package/src/lib/targets/cursor.js.map +1 -1
- package/src/lib/targets/git-hooks.d.ts +25 -0
- package/src/lib/targets/git-hooks.js +71 -0
- package/src/lib/targets/git-hooks.js.map +1 -0
- package/src/lib/targets/hooks-shared.d.ts +29 -5
- package/src/lib/targets/hooks-shared.js +130 -36
- package/src/lib/targets/hooks-shared.js.map +1 -1
- package/src/lib/targets/mcp.d.ts +16 -0
- package/src/lib/targets/mcp.js +72 -0
- package/src/lib/targets/mcp.js.map +1 -0
- package/src/lib/targets/shared.d.ts +1 -9
- package/src/lib/targets/shared.js +4 -8
- package/src/lib/targets/shared.js.map +1 -1
- package/src/lib/timetrack-command.d.ts +11 -0
- package/src/lib/timetrack-command.js +1262 -0
- package/src/lib/timetrack-command.js.map +1 -0
- package/src/lib/timetrack-snapshot.d.ts +66 -0
- package/src/lib/timetrack-snapshot.js +146 -0
- package/src/lib/timetrack-snapshot.js.map +1 -0
- package/src/lib/timetrack.d.ts +607 -0
- package/src/lib/timetrack.js +285 -0
- package/src/lib/timetrack.js.map +1 -0
- package/content/skills/styleguide/STYLEGUIDE.md +0 -520
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: handoff
|
|
3
|
-
description: Save the current work state to a handoff file so a fresh session can continue
|
|
3
|
+
description: Save the current work state to a handoff file so a fresh session can continue, or resume from one. Use when context is large, a work chunk is done, or on "handoff", "wrap up", "continue in a new session".
|
|
4
4
|
kind: skill
|
|
5
5
|
scope: both
|
|
6
6
|
vars: [handoffDir]
|
|
@@ -15,84 +15,44 @@ continue in a fresh session. Two modes:
|
|
|
15
15
|
- **save** ("handoff", "wrap up") - write a handoff file.
|
|
16
16
|
- **resume** ("continue from the handoff") - read one and continue the work.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Save mode
|
|
22
|
-
|
|
23
|
-
Write `{%handoffDir%}/<slug>.md` where `<slug>` is a short kebab-case name for
|
|
24
|
-
the task (use the user-provided slug if they gave one). If the file exists,
|
|
25
|
-
overwrite it - a handoff always describes the _current_ state.
|
|
26
|
-
|
|
27
|
-
**Write for a reader with zero context.** The next session sees none of this
|
|
28
|
-
conversation. No "as discussed above", no shorthand invented mid-session. Every
|
|
29
|
-
claim must be verifiable from the repo: exact file paths, exact commands.
|
|
30
|
-
|
|
31
|
-
Template:
|
|
32
|
-
|
|
33
|
-
```markdown
|
|
34
|
-
# Handoff: <task title>
|
|
35
|
-
|
|
36
|
-
Branch: <git branch> · Last commit: <short sha> <subject>
|
|
37
|
-
Working tree: <clean | summary of uncommitted changes>
|
|
38
|
-
|
|
39
|
-
## Goal
|
|
40
|
-
|
|
41
|
-
What the overall task is and why. One paragraph max.
|
|
42
|
-
|
|
43
|
-
## State
|
|
44
|
-
|
|
45
|
-
- Done: <what is finished and verified, with file paths>
|
|
46
|
-
- In progress: <what is half-done, and exactly where it stands>
|
|
47
|
-
- Not started: <known remaining work>
|
|
18
|
+
Text after the slug or the name is an instruction from the user, in both modes. In save mode it is
|
|
19
|
+
for the session that resumes, so it must reach that session word for word. In resume mode it wins
|
|
20
|
+
over the Next steps of the file where the two conflict. A trailing `[typed by agent-sessions]` is the restart's marker, not an instruction.
|
|
48
21
|
|
|
49
|
-
|
|
22
|
+
Name one invocation form to the user - your own - and never both. The skill is
|
|
23
|
+
installed as `ethlete-handoff`, so under Claude Code the commands are
|
|
24
|
+
`/ethlete-handoff` and `/ethlete-handoff resume [name]`; there is no `/handoff`.
|
|
25
|
+
Codex has no slash commands, so there the same two are plain prompts without the
|
|
26
|
+
leading `/`.
|
|
50
27
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
## Decisions & constraints
|
|
54
|
-
|
|
55
|
-
Choices already made (and why) that the next session must not re-litigate.
|
|
56
|
-
User-stated constraints verbatim.
|
|
57
|
-
|
|
58
|
-
## Gotchas / dead ends
|
|
59
|
-
|
|
60
|
-
Things that looked right but weren't. Approaches already tried and rejected,
|
|
61
|
-
and why - this is the most valuable section, don't skip it.
|
|
62
|
-
|
|
63
|
-
## Next steps
|
|
64
|
-
|
|
65
|
-
1. Concrete, ordered, actionable steps. Each should name files/commands.
|
|
66
|
-
|
|
67
|
-
## Verify
|
|
68
|
-
|
|
69
|
-
Commands to check the work (lint, storybook story ids, test commands).
|
|
70
|
-
|
|
71
|
-
## Follow-ups owed
|
|
72
|
-
|
|
73
|
-
Changeset written? Docs page updated? Whatever this repo treats as part of a
|
|
74
|
-
change rather than optional.
|
|
75
|
-
```
|
|
28
|
+
Handoff files live in `{%handoffDir%}/` (gitignored - they are personal,
|
|
29
|
+
ephemeral working state, not team docs).
|
|
76
30
|
|
|
77
|
-
|
|
78
|
-
not describe state from memory. Keep the file under ~150 lines; a handoff is a
|
|
79
|
-
map, not a transcript.
|
|
31
|
+
## Save and handoff mode
|
|
80
32
|
|
|
81
|
-
|
|
82
|
-
resume from it.
|
|
33
|
+
Before you save, or when the `context-warning` hook names handoff mode, read {%resource:save.md%}: it holds save mode, handoff mode (the budget tiers), ending a turn over the budget, and clearing and resuming on your own. A resume needs none of it.
|
|
83
34
|
|
|
84
35
|
## Resume mode
|
|
85
36
|
|
|
86
37
|
1. List `{%handoffDir%}/`. Pick the file matching the given name, or the most
|
|
87
38
|
recently modified one if no name was given. If the directory is empty, say so
|
|
88
39
|
and stop.
|
|
89
|
-
2. Read the file fully.
|
|
40
|
+
2. Read the file fully. If its first line starts with `Restarted because:`, show that line to the
|
|
41
|
+
user first, then delete it from the file.
|
|
90
42
|
3. Verify reality still matches: current branch, `git status`, last commit. If
|
|
91
43
|
they diverge from the handoff (e.g. someone committed in between), say what
|
|
92
|
-
changed and adapt - the repo is the truth, the handoff is the guide.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
44
|
+
changed and adapt - the repo is the truth, the handoff is the guide. Read each
|
|
45
|
+
result file in `.claude/handoffs/agent-results/` that the handoff names, act on it,
|
|
46
|
+
then delete it. A named agent without a result file still runs.
|
|
47
|
+
4. **Read only what you are about to change.** The handoff already carries the decisions,
|
|
48
|
+
the constraints and the dead ends, so do not re-read the plan files it summarises, and do
|
|
49
|
+
not survey the directory. Open a source file when you are going to edit it, and load a
|
|
50
|
+
focused guidance file only when the work needs one.
|
|
51
|
+
5. If the handoff name starts with a role prefix (`builder-`, `doc-agent-`) and a skill
|
|
52
|
+
of that name exists (`builder-agent`, `doc-agent`), load that skill now. Do it yourself;
|
|
53
|
+
do not wait for a line in the handoff that asks for it.
|
|
54
|
+
6. Continue with the **Next steps** section. Don't redo work listed under
|
|
96
55
|
_Done_; don't re-open questions under _Decisions_.
|
|
97
|
-
|
|
98
|
-
|
|
56
|
+
7. When every next step is complete, decide whether the handoff can be removed. Delete it
|
|
57
|
+
only if this workflow created it and the save workflow or user authorized cleanup.
|
|
58
|
+
Otherwise report that it is no longer needed and let the user decide.
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# Save and handoff mode
|
|
2
|
+
|
|
3
|
+
## Handoff mode
|
|
4
|
+
|
|
5
|
+
Where this repo installs the `context-warning` hook, it names the budget at session start,
|
|
6
|
+
turns handoff mode on at 70% of it, and warns once more at each later tier. It reaches you at three points, not only when the user types: at
|
|
7
|
+
the start of the session, after a batch of your own tool calls, and as a turn ends. So a
|
|
8
|
+
long autonomous run learns its token count while it works.
|
|
9
|
+
|
|
10
|
+
Handoff mode is not an order to stop. It is the signal to change how you work, so that
|
|
11
|
+
either ending - you finish, or a fresh session takes over - stays cheap:
|
|
12
|
+
|
|
13
|
+
- Work in slices that each end in a committable state. Never leave two half-finished edits
|
|
14
|
+
in the tree.
|
|
15
|
+
- Send bulky reads, searches and test runs to a sub-agent. Its output stays out of your
|
|
16
|
+
context; its answer does not.
|
|
17
|
+
- Write down each decision and dead end as you reach it, in the commit message or in the
|
|
18
|
+
handoff file. Do not save them for a final summary you may have no room for.
|
|
19
|
+
- Start nothing you cannot finish or hand off inside the remaining budget.
|
|
20
|
+
- Spawn no new sub-agent. Sub-agents that already run finish their work.
|
|
21
|
+
|
|
22
|
+
At the critical tier (85%), stop a sub-agent only if it surely hangs: it made no new step
|
|
23
|
+
for more than 30 minutes. Write its remaining work into the handoff file. Never stop a
|
|
24
|
+
sub-agent that still works.
|
|
25
|
+
|
|
26
|
+
At the critical tier the hook also asks you to choose one of two, and to tell the user
|
|
27
|
+
which you chose:
|
|
28
|
+
|
|
29
|
+
1. **Finish the task.** Only when you can name every step that is left, and they plainly
|
|
30
|
+
fit the remaining budget. Finish it, commit, then apply the save test below - the answer
|
|
31
|
+
is then usually that no file is needed at all.
|
|
32
|
+
2. **Hand off.** Everything else. Finish the in-flight atomic edit, nothing new, then save.
|
|
33
|
+
|
|
34
|
+
"Nearly done" means you can name the last steps now. It does not mean the end feels close.
|
|
35
|
+
At the last tier (95%) the hook takes option 1 away, because a budget that small covers no
|
|
36
|
+
task.
|
|
37
|
+
|
|
38
|
+
### Ending a turn over the budget
|
|
39
|
+
|
|
40
|
+
From 85% on, the hook also fires as you try to end the turn, and the turn then continues so
|
|
41
|
+
you can act. It adds a third option to the two above:
|
|
42
|
+
|
|
43
|
+
3. **Cross the boundary on purpose.** Some sessions are worth the premium rate: the task is
|
|
44
|
+
one step from done, or this session holds reasoning that no handoff file survives. Take
|
|
45
|
+
it only for a reason you can name in one sentence right now. Say the reason, say what it
|
|
46
|
+
costs, and keep working.
|
|
47
|
+
|
|
48
|
+
Option 3 is a judgment call, not a way out of the other two. Naming a reason you cannot
|
|
49
|
+
state plainly is the same as taking option 2 late and expensively. The hook asks once per
|
|
50
|
+
tier, so it will not block the end of a turn twice for the same budget. It stays quiet while a
|
|
51
|
+
handoff is being saved, until the user's next prompt.
|
|
52
|
+
|
|
53
|
+
## Save mode
|
|
54
|
+
|
|
55
|
+
**Decide first whether a handoff is needed at all.** One exists so work can resume, so
|
|
56
|
+
write one only when at least one of these holds:
|
|
57
|
+
|
|
58
|
+
- Uncommitted work from this session sits in the tree.
|
|
59
|
+
- A step the user asked for is unfinished, blocked, or waiting on a result.
|
|
60
|
+
- A decision, dead end, or user constraint from this session is written down nowhere else -
|
|
61
|
+
not in a commit message, a changeset, a docs page, or a plan file.
|
|
62
|
+
|
|
63
|
+
Check it, never assume it: `git status`, `git log`, and the task as the user stated it. A
|
|
64
|
+
context warning is a token count, not evidence that work is left.
|
|
65
|
+
|
|
66
|
+
If none of them holds, write no file. Tell the user in two or three lines what landed, name
|
|
67
|
+
the commits, and say a fresh session needs nothing from this one. A handoff nobody resumes is
|
|
68
|
+
noise, and it costs the next session the tokens to read it.
|
|
69
|
+
|
|
70
|
+
Then give a prompt the user can copy into the fresh session, in a code block: the next task, the
|
|
71
|
+
plan file or finding it lives in, and any rule of this session that the repo does not record. Keep
|
|
72
|
+
it to a few lines.
|
|
73
|
+
|
|
74
|
+
An open item counts as the next task: a known gap, an open finding, or an unbuilt step in the plan,
|
|
75
|
+
in the task, or in your own report of this session. "Everything waits for the user" is true only
|
|
76
|
+
when every open item needs a decision of the user. Then name each decision; do not stop silently.
|
|
77
|
+
In a `tmux` session, restart yourself with the next task as the prompt (see the next section) instead
|
|
78
|
+
of handing the prompt to the user.
|
|
79
|
+
|
|
80
|
+
Write `{%handoffDir%}/<slug>.md` where `<slug>` is a short kebab-case name for
|
|
81
|
+
the task (use the user-provided slug if they gave one). If the file exists,
|
|
82
|
+
overwrite it - a handoff always describes the _current_ state.
|
|
83
|
+
|
|
84
|
+
**Write for a reader with zero context.** The next session sees none of this
|
|
85
|
+
conversation. No "as discussed above", no shorthand invented mid-session. Every
|
|
86
|
+
claim must be verifiable from the repo: exact file paths, exact commands.
|
|
87
|
+
|
|
88
|
+
Template:
|
|
89
|
+
|
|
90
|
+
```markdown
|
|
91
|
+
# Handoff: <task title>
|
|
92
|
+
|
|
93
|
+
Branch: <git branch> · Last commit: <short sha> <subject>
|
|
94
|
+
Working tree: <clean | summary of uncommitted changes>
|
|
95
|
+
|
|
96
|
+
## Goal
|
|
97
|
+
|
|
98
|
+
What the overall task is and why. One paragraph max.
|
|
99
|
+
|
|
100
|
+
## State
|
|
101
|
+
|
|
102
|
+
- Done: <what is finished and verified, with file paths>
|
|
103
|
+
- In progress: <what is half-done, and exactly where it stands>
|
|
104
|
+
- Not started: <known remaining work>
|
|
105
|
+
|
|
106
|
+
## Key files
|
|
107
|
+
|
|
108
|
+
- `path/to/file.ts` - why it matters here
|
|
109
|
+
|
|
110
|
+
## Decisions & constraints
|
|
111
|
+
|
|
112
|
+
Choices already made (and why) that the next session must not re-litigate.
|
|
113
|
+
User-stated constraints verbatim.
|
|
114
|
+
|
|
115
|
+
## Gotchas / dead ends
|
|
116
|
+
|
|
117
|
+
Things that looked right but weren't. Approaches already tried and rejected,
|
|
118
|
+
and why - this is the most valuable section, don't skip it.
|
|
119
|
+
|
|
120
|
+
## Next steps
|
|
121
|
+
|
|
122
|
+
1. Concrete, ordered, actionable steps. Each should name files/commands.
|
|
123
|
+
|
|
124
|
+
## Verify
|
|
125
|
+
|
|
126
|
+
Commands to check the work (lint, storybook story ids, test commands).
|
|
127
|
+
|
|
128
|
+
## Follow-ups owed
|
|
129
|
+
|
|
130
|
+
Changeset written? Docs page updated? Whatever this repo treats as part of a
|
|
131
|
+
change rather than optional.
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Before writing, actually check `git status`, `git log -1`, and the branch - do
|
|
135
|
+
not describe state from memory. Keep the file under ~150 lines; a handoff is a
|
|
136
|
+
map, not a transcript.
|
|
137
|
+
|
|
138
|
+
After writing, tell the user where it landed and that a fresh session should
|
|
139
|
+
resume from it.
|
|
140
|
+
|
|
141
|
+
## Clear and resume on your own
|
|
142
|
+
|
|
143
|
+
Run inside a `tmux` session started with the agent-sessions `run` command or the shell functions from `shell-install` (`echo $TMUX` is not empty and
|
|
144
|
+
the agent-sessions script `restart` finds the session)? Then you may clear and
|
|
145
|
+
resume yourself after the save, instead of asking the user to. You decide. Do it only if every line
|
|
146
|
+
is true:
|
|
147
|
+
|
|
148
|
+
- No sub-agent whose answer you need still runs, and no workflow or background command. A
|
|
149
|
+
background command from the old session reports back into the new one.
|
|
150
|
+
- Each self-reporting sub-agent that still runs is named in the handoff file, with its result
|
|
151
|
+
file.
|
|
152
|
+
- No answer you wait for is open: a peer session, a mailbox reply, a CI run.
|
|
153
|
+
- The tree is committed, or the handoff file names every uncommitted change.
|
|
154
|
+
- The handoff file is saved and its Next steps are concrete.
|
|
155
|
+
|
|
156
|
+
When you spawn a sub-agent, decide which kind it is:
|
|
157
|
+
|
|
158
|
+
- **Answer needed.** You act on its answer. A restart waits for it.
|
|
159
|
+
- **Self-reporting.** It commits its own slice and writes its result to
|
|
160
|
+
`.claude/handoffs/agent-results/<name>.md`. Tell it so in its prompt. A restart does not wait
|
|
161
|
+
for it: the resumed session reads the result file.
|
|
162
|
+
|
|
163
|
+
If one line is false, finish or collect that first. If you cannot, hand the prompt to the user as
|
|
164
|
+
before. Then run, with the slug of the file you saved:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
node <sessions-skill-dir>/agent-sessions.mjs restart <name> '<resume command> <slug> [<text after the slug>]'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Add `--process` after `restart` when the session changed a plugin, a settings file, an MCP server or `PATH`.
|
|
171
|
+
A plain restart keeps the old process, so the change reaches only a new one.
|
|
172
|
+
Before `--process`, write the command line of each background job of the session into the handoff file. The exit stops these jobs, so the new process starts them again.
|
|
173
|
+
|
|
174
|
+
If the user wrote text after the slug of the save command, append it to the prompt word for word.
|
|
175
|
+
Escape each `'` in it as `'\''`. The restart drops anything you leave out, and the fresh session has
|
|
176
|
+
no other way to see it.
|
|
177
|
+
|
|
178
|
+
`<resume command>` is your own resume form from the top of this guide, with the name this repo
|
|
179
|
+
installed the skill under: `/ethlete-handoff resume` under Claude Code, `ethlete-handoff resume`
|
|
180
|
+
under Codex. A repo that ships its own copy can name it `handoff`, so check the skill directory
|
|
181
|
+
name. A wrong name runs no skill, and the fresh session starts without the file.
|
|
182
|
+
|
|
183
|
+
`<name>` is the sender name of your own session. Read it first with `tmux display-message -p -t "$TMUX_PANE" '#{session_name}'` and drop the `@<repo>` part: `claude-2@ethlete-sdk` gives `claude-2`. Never take the name from an example: a second Claude session is `claude-2`, not `claude`. The command refuses a session you do not run in. It returns at once. It
|
|
184
|
+
types `/clear` (`/new` for a `codex` name) and the prompt into your pane a few seconds later, so
|
|
185
|
+
end your turn after you run it and do not start another tool call. The `/clear` wipes the pane, so
|
|
186
|
+
the user never sees text you write after the command. Before you run it, put the reason as the
|
|
187
|
+
first line of the handoff file: `Restarted because: <one line>`. End the turn with no text.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: query
|
|
3
|
-
description: The signals-first @ethlete/query data-fetching system
|
|
3
|
+
description: 'The signals-first @ethlete/query data-fetching system. Read BEFORE writing or reviewing code that fetches data: query forms, search/autocomplete, auth, polling, pagination, bridging a query into UI or RxJS.'
|
|
4
4
|
kind: skill
|
|
5
5
|
scope: consumer
|
|
6
6
|
requires: ['@ethlete/query']
|
|
@@ -13,38 +13,109 @@ Signals-first, typesafe data fetching for Angular: request dedup, caching, polli
|
|
|
13
13
|
paged queries, bearer auth, GraphQL, and a socket.io realtime client.
|
|
14
14
|
|
|
15
15
|
**The written docs are the source of truth - read the relevant page before
|
|
16
|
-
non-trivial query work.** This guide
|
|
17
|
-
don't re-derive them from source.
|
|
18
|
-
|
|
19
|
-
| Page
|
|
20
|
-
|
|
|
21
|
-
| {%docsBaseUrl%}/query/
|
|
22
|
-
| {%docsBaseUrl%}/query/queries
|
|
23
|
-
| {%docsBaseUrl%}/query/features
|
|
24
|
-
| {%docsBaseUrl%}/query/http
|
|
25
|
-
| {%docsBaseUrl%}/query/auth
|
|
26
|
-
| {%docsBaseUrl%}/query/caching
|
|
27
|
-
| {%docsBaseUrl%}/query/multi-tab
|
|
28
|
-
| {%docsBaseUrl%}/query/
|
|
29
|
-
| {%docsBaseUrl%}/query/
|
|
16
|
+
non-trivial query work.** This guide maps every need to its API and page, plus the
|
|
17
|
+
load-bearing facts, so you don't re-derive them from source or hand-build what ships.
|
|
18
|
+
|
|
19
|
+
| Page | Covers |
|
|
20
|
+
| ------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
|
21
|
+
| {%docsBaseUrl%}/query/ | Overview, the two generations, what else the package ships |
|
|
22
|
+
| {%docsBaseUrl%}/query/queries | **Start here** - client, creators, the query object's signals, auto-execution |
|
|
23
|
+
| {%docsBaseUrl%}/query/features | `withArgs`, polling, auto-refresh, side-effect handlers, custom features |
|
|
24
|
+
| {%docsBaseUrl%}/query/http | REST creators, typing requests, response transforms, upload progress |
|
|
25
|
+
| {%docsBaseUrl%}/query/auth | Bearer auth provider, guards, token refresh, auth features |
|
|
26
|
+
| {%docsBaseUrl%}/query/caching | Cache keys, dedup, `keepUnusedFor`, freshness, refresh and invalidation |
|
|
27
|
+
| {%docsBaseUrl%}/query/multi-tab | Cross-tab response sharing, one poller per key, mutation fan-out |
|
|
28
|
+
| {%docsBaseUrl%}/query/persistence | Successful reads kept in IndexedDB for reloads and offline cold starts |
|
|
29
|
+
| {%docsBaseUrl%}/query/stacks | Many queries of one creator, infinite lists, paged data |
|
|
30
|
+
| {%docsBaseUrl%}/query/dependent-queries | GET → GET dependencies and ordered mutation chains |
|
|
31
|
+
| {%docsBaseUrl%}/query/groups | Several queries behind one state: loading, error and retry follow the one that ran last |
|
|
32
|
+
| {%docsBaseUrl%}/query/batching | Bulk writes with bounded concurrency, per-item results, retry |
|
|
33
|
+
| {%docsBaseUrl%}/query/errors | Error object, opt-in parsers, form submission, violations, retries |
|
|
34
|
+
| {%docsBaseUrl%}/query/testing | Specs: answering requests, `@ethlete/query/testing` helpers and fakes |
|
|
35
|
+
| {%docsBaseUrl%}/query/query-forms | **Any filtered, searched, sorted or paged list** - `defineQueryForm` |
|
|
36
|
+
| {%docsBaseUrl%}/query/gql | GraphQL creators over GET/POST |
|
|
37
|
+
| {%docsBaseUrl%}/query/ws | socket.io rooms and live-updating responses |
|
|
38
|
+
| {%docsBaseUrl%}/query/legacy | The maintenance-mode `V2QueryClient` and its replacements |
|
|
39
|
+
| {%docsBaseUrl%}/query/migrating-from-v2 | Codemods and the screen-by-screen move off the legacy client |
|
|
40
|
+
| {%docsBaseUrl%}/query/migrating-from-ngrx-toolkit | The generator and interop that move a store off `@tomtomb/ngrx-toolkit` |
|
|
41
|
+
| {%docsBaseUrl%}/query-devtools/ | The devtools panel and `provideQueryDevtools()` |
|
|
42
|
+
|
|
43
|
+
## You need → use → read
|
|
44
|
+
|
|
45
|
+
Before writing a helper, find your need here. Pages are under `{%docsBaseUrl%}/query/`.
|
|
46
|
+
|
|
47
|
+
| You need | Use | Read |
|
|
48
|
+
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
|
|
49
|
+
| One client per API | `createQueryClient`, `injectApi()` | `queries` |
|
|
50
|
+
| REST reads (auto-executing) | `createGetQuery`, `createHeadQuery`, `createOptionsQuery` | `http` |
|
|
51
|
+
| REST writes (manual) | `createPostQuery`, `createPutQuery`, `createPatchQuery`, `createDeleteQuery` | `http` |
|
|
52
|
+
| The same behind a bearer token | `createSecureGetQuery`, `createSecureHeadQuery`, `createSecureOptionsQuery`, `createSecurePostQuery`, `createSecurePutQuery`, `createSecurePatchQuery`, `createSecureDeleteQuery` | `http`, `auth` |
|
|
53
|
+
| Upload/download progress bar | creator option `reportProgress: true`, then `loading().progress` | `http` |
|
|
54
|
+
| Args that follow signals (route params, inputs, filters) | `withArgs` | `features` |
|
|
55
|
+
| A filtered / searched / sorted / paged list synced to the URL | `defineQueryForm`, `queryField`, `searchQueryField`, `sortQueryField` | `query-forms` |
|
|
56
|
+
| Refetch on an interval | `withPolling` | `features` |
|
|
57
|
+
| Next request once the previous settled, with a cursor from it | `withLongPolling` | `features` |
|
|
58
|
+
| Refetch when some other signal changes | `withAutoRefresh` | `features` |
|
|
59
|
+
| Toast / log / react on success or failure | `withSuccessHandling`, `withErrorHandling`, `withLogging` | `features` |
|
|
60
|
+
| Patch a loaded response in place (e.g. from a socket message) | `withResponseUpdate` | `features`, `ws` |
|
|
61
|
+
| Page falls out of range after a filter shrinks the results | `withPageResetOnError`, `isPageOutOfRangeError` | `features` |
|
|
62
|
+
| Package your own reusable query behavior | `createQueryFeature` | `features` |
|
|
63
|
+
| Refresh reads after a mutation (here and in other tabs) | `injectApi().invalidateQueries({ url })` | `caching` |
|
|
64
|
+
| Show a mutation's result in cached reads before the server answers | `withOptimisticUpdate` | `caching` |
|
|
65
|
+
| One loading, error and retry state for whichever of several mutations ran last | `createQueryGroup` | `groups` |
|
|
66
|
+
| Refetch everything after a client-wide header changed | `injectApi().refreshQueriesInUse()` | `caching` |
|
|
67
|
+
| Show the previous data instantly on back navigation | `keepUnusedFor` + `executionState().cachedResponse` | `caching` |
|
|
68
|
+
| Last known data after a reload or offline | `withQueryPersistence`, `createIndexedDbQueryPersistenceAdapter`, `createNoopQueryPersistenceAdapter` | `persistence` |
|
|
69
|
+
| Tabs share responses, poll once, see each other's mutations | `withMultiTabSync` | `multi-tab` |
|
|
70
|
+
| Parallel detail requests for a list of ids | `createQueryStack`, `transformArrayResponse` | `stacks` |
|
|
71
|
+
| Load more / infinite scroll / classic paging | `createPagedQueryStack`, `ethletePaginationAdapter` (and other adapters) | `stacks` |
|
|
72
|
+
| A GET whose args come from another GET's response | `withArgs` reading the first query's `response()` | `dependent-queries` |
|
|
73
|
+
| Run mutations in order, each using the previous result | `querySequence` | `dependent-queries` |
|
|
74
|
+
| Many edits with progress, time remaining and retry of failures | `createQueryBatch` | `batching` |
|
|
75
|
+
| Submit a signal form through a mutation, violations on fields | `createQuerySubmission` | `errors` |
|
|
76
|
+
| Own submit handler, or server-side validation while typing | `executeUntilSettled`, `executeUntilSettled$`, `mapViolationsToFormErrors`, `validateWithQuery` | `errors` |
|
|
77
|
+
| Understand the error shapes your API returns | `withEthleteApiErrors` (all), `withSymfonyErrors`, `withHtmlErrorParsing` | `errors` |
|
|
78
|
+
| Error text for display, or an error built by hand (tests) | `queryErrorMessage`, `queryErrorMessages`, `createQueryErrorResponse`, `<et-query-error>` | `errors` |
|
|
79
|
+
| Retry failed requests | `withDefaultRetry`, `createDefaultRetryFn` | `errors` |
|
|
80
|
+
| Login / refresh / logout with bearer tokens | `createBearerAuthProvider`, `withAuthenticationQuery`, `withRefreshQuery` | `auth` |
|
|
81
|
+
| Protect routes, check roles or permissions | `createAuthGuard`, `canMatchWith` | `auth` |
|
|
82
|
+
| "Remember me" auto-login | `withPersistentAuth` | `auth` |
|
|
83
|
+
| Log out idle users | `withInactivityLogout` | `auth` |
|
|
84
|
+
| Warn before the session expires | `withTokenExpirationWarning` | `auth` |
|
|
85
|
+
| Revoke the token on logout | `withTokenRevocation` | `auth` |
|
|
86
|
+
| Share login/logout across tabs | `withBearerAuthMultiTabSync` | `auth` |
|
|
87
|
+
| Auth telemetry events | `withTracking` | `auth` |
|
|
88
|
+
| Tokens from SSO or a native shell | `provider.setTokens(access, refresh)` | `auth` |
|
|
89
|
+
| Which of several queries is busy (v2 query collections) | each query's `executionState()` in a `computed`; auth: `provider.executionState()` | `migrating-from-v2` |
|
|
90
|
+
| GraphQL | `createGqlQueryViaGet`, `createGqlQueryViaPost`, `createGqlMutationViaGet`, `createGqlMutationViaPost`, `createSecureGqlQueryViaGet`, `createSecureGqlQueryViaPost`, `createSecureGqlMutationViaGet`, `createSecureGqlMutationViaPost` | `gql` |
|
|
91
|
+
| Realtime rooms over socket.io | `createWebSocketClient` | `ws` |
|
|
92
|
+
| Inspect queries, stacks, auth and cache at runtime | `provideQueryDevtools()` + `@ethlete/query-devtools` | `/query-devtools/` |
|
|
30
93
|
|
|
31
94
|
## Two generations - use the current one
|
|
32
95
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- **Legacy (maintenance mode):** class-based `V2QueryClient`, `.prepare().execute()`,
|
|
37
|
-
`queryComputed`. Don't write new code against it.
|
|
96
|
+
Write new code against the signals-first system (`createQueryClient`, `createGetQuery`, …,
|
|
97
|
+
`withArgs`), all from the single entry `@ethlete/query`. The class-based `V2QueryClient`
|
|
98
|
+
(`.prepare().execute()`, `queryComputed`) is in maintenance mode.
|
|
38
99
|
|
|
39
100
|
## Core usage
|
|
40
101
|
|
|
41
|
-
One client per API, one creator per
|
|
102
|
+
One client per API, one bound creator per method, one query per endpoint, one live query
|
|
103
|
+
per component instance:
|
|
42
104
|
|
|
43
105
|
```ts
|
|
44
106
|
import { createQueryClient, createGetQuery, withArgs } from '@ethlete/query';
|
|
45
107
|
|
|
108
|
+
// api.ts
|
|
46
109
|
export const apiClient = createQueryClient({ name: 'api', baseUrl: API_URL });
|
|
47
|
-
export const
|
|
110
|
+
export const getQuery = createGetQuery(apiClient);
|
|
111
|
+
|
|
112
|
+
// posts.queries.ts
|
|
113
|
+
export type GetPostQueryArgs = {
|
|
114
|
+
response: Post;
|
|
115
|
+
pathParams: { postId: string };
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const getPost = getQuery<GetPostQueryArgs>((p) => `/posts/${p.postId}`);
|
|
48
119
|
|
|
49
120
|
// in a component (injection context):
|
|
50
121
|
postId = input.required<string>();
|
|
@@ -54,67 +125,91 @@ post = computed(() => this.postQuery.response());
|
|
|
54
125
|
|
|
55
126
|
- `GET`/`HEAD`/`OPTIONS` **auto-execute** - immediately when static/argless, or
|
|
56
127
|
whenever `withArgs` produces new args. Mutations (`POST`/`PUT`/`PATCH`/`DELETE`)
|
|
57
|
-
never auto-execute; call `.execute(
|
|
58
|
-
requires `withArgs` (dev-mode error
|
|
128
|
+
never auto-execute; declare their args with `withArgs` too and call `.execute()`. A function route (`pathParams`)
|
|
129
|
+
requires `withArgs` (a type error, and a dev-mode error).
|
|
130
|
+
- A route function receives the path params themselves: `(p) => \`/posts/${p.postId}\``.
|
|
131
|
+
- With bearer auth, bind the secure creators the same way:
|
|
132
|
+
`const secureGetQuery = createSecureGetQuery(apiClient, authProviderRef)`.
|
|
59
133
|
- Queries live in a child injector tied to the creating component; destroyed with it.
|
|
60
134
|
|
|
61
|
-
##
|
|
135
|
+
## Lists with filters, search, sort or paging: `defineQueryForm`
|
|
62
136
|
|
|
63
|
-
|
|
64
|
-
|
|
137
|
+
Never wire list controls to the URL by hand (`injectQueryParams` + `router.navigate` +
|
|
138
|
+
drafts + effects). `defineQueryForm` does URL sync, debounce, defaults and page resets:
|
|
65
139
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
140
|
+
```ts
|
|
141
|
+
qf = defineQueryForm({
|
|
142
|
+
fields: {
|
|
143
|
+
search: searchQueryField(),
|
|
144
|
+
sort: sortQueryField(),
|
|
145
|
+
page: queryField<number>({ defaultValue: 1, isResetBy: ['search', 'sort'] }),
|
|
146
|
+
},
|
|
147
|
+
}).observe();
|
|
148
|
+
|
|
149
|
+
users = getUsers(
|
|
150
|
+
withArgs(() => {
|
|
151
|
+
const { search, sort, page } = this.qf.value();
|
|
152
|
+
|
|
153
|
+
return { queryParams: { query: search, sortBy: sort?.active, sortOrder: sort?.direction, page } };
|
|
154
|
+
}),
|
|
155
|
+
);
|
|
156
|
+
```
|
|
74
157
|
|
|
75
|
-
|
|
158
|
+
Bind form controls with `[formField]="qf.fields.search"`. `et-pagination` and
|
|
159
|
+
`et-page-size-select` are not form controls: bind their `model` to the field's value signal,
|
|
160
|
+
`[(page)]="qf.fields.page().value"`; an `et-table` sort binds the same way to a
|
|
161
|
+
`tableSortQueryField()`, `[(sort)]="qf.fields.sort().value"`, with no mapping. `qf.value()` is the committed, debounced value. Each
|
|
162
|
+
change pushes a history entry; pass `observe({ replaceUrl: true })` to replace it instead. See {%docsBaseUrl%}/query/query-forms for the other field creators,
|
|
163
|
+
filter overlays and `activeFilterCount`.
|
|
76
164
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
stay reactive: a `GET` re-executes itself when they change, and `withPolling` /
|
|
84
|
-
`withAutoRefresh` restart off the same signal - none of which happens for args handed
|
|
85
|
-
to `execute()`. A function route additionally throws without it. With `withArgs` in
|
|
86
|
-
place a mutation is just `.execute()`, which reuses the current `args()`. Reserve
|
|
87
|
-
`execute({ args })` for a one-off payload no signal holds (a form submit).
|
|
88
|
-
- `withPolling({ interval })`, `withAutoRefresh({ onSignalChanges: [...] })`.
|
|
89
|
-
- Side-effects: `withSuccessHandling`, `withErrorHandling`, `withLogging`.
|
|
165
|
+
When you move a list that syncs its params by hand, keep the param names the URL already uses, so
|
|
166
|
+
saved links keep working (`queryParamPrefix` when two lists share a route). Keep each old default as
|
|
167
|
+
the field's `defaultValue`. A URL with sort and direction in two params (`?sort=name&dir=asc`)
|
|
168
|
+
keeps two `queryField`s, `dir` with `skipInFilterCount: true`; `sortQueryField()` writes one
|
|
169
|
+
`name:asc` param, so it breaks old links. A date field bound to `et-date-input`,
|
|
170
|
+
`et-date-time-input` or `et-time-input` needs `dateQueryField({ as: 'string' })`.
|
|
90
171
|
|
|
91
|
-
|
|
92
|
-
requests; debounce at the input if you need it.
|
|
172
|
+
## The query object
|
|
93
173
|
|
|
94
|
-
|
|
174
|
+
Every state member is an **`ObservableSignal`** - call it, or `.asObservable()` it without an
|
|
175
|
+
injection context of your own (it emits `null` first).
|
|
95
176
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
177
|
+
- `response()` → `TResponse | null` (kept while re-executing; cleared on a failed re-exec).
|
|
178
|
+
To keep showing the last good data after a failure, read `cachedResponse` from the
|
|
179
|
+
`loading` or `failure` variant of `executionState()` - do not copy responses into a signal.
|
|
180
|
+
- `loading()`, `error()` (normalized `QueryErrorResponse`), `args()`,
|
|
181
|
+
`executionState()` (`{ type: 'loading' | 'success' | 'failure', … } | null`, great for `@switch`).
|
|
182
|
+
- Methods: `execute({ args?, options? })`, `reset()`, `createSnapshot()`, `asReadonly()`.
|
|
99
183
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
184
|
+
## Reactive args
|
|
185
|
+
|
|
186
|
+
- **`withArgs(() => ({ pathParams, queryParams, body }))`** runs like a `computed` and
|
|
187
|
+
re-executes on change. Return `null` to park the query (pauses polling/auto-refresh).
|
|
188
|
+
Calling `.execute()` on a parked query is ignored and warns in dev mode
|
|
189
|
+
(`queryExecutedWhileParkedMessage`); pass `execute({ args })` or let the source return args.
|
|
190
|
+
- **Prefer `withArgs` over `execute({ args })`.** Declared args keep a `GET` re-executing and
|
|
191
|
+
polling/auto-refresh restarting off the same signal; a function route throws without it. A
|
|
192
|
+
mutation with `withArgs` is just `.execute()`. Reserve `execute({ args })` for a one-off
|
|
193
|
+
payload no signal holds.
|
|
194
|
+
- Search-as-you-type: read a debounced value (`searchQueryField()` debounces 300ms; every
|
|
195
|
+
query field takes `debounce`) - a raw input signal sends one request per keystroke.
|
|
196
|
+
- `withLongPolling` and `withPolling` throw when combined.
|
|
197
|
+
|
|
198
|
+
## Bridging into RxJS or callbacks
|
|
199
|
+
|
|
200
|
+
For a callback that must return one correlated result, run a manual query
|
|
201
|
+
(`{ onlyManualExecution: true }`) through `executeUntilSettled$(query, { args })` - cold, its
|
|
202
|
+
snapshot is frozen to that execution, and unsubscribing aborts the request. Keep the Promise
|
|
203
|
+
`executeUntilSettled` for an `async` signal-forms `submit()`. Never set a signal and return the shared `response`
|
|
204
|
+
stream: the retained previous response can be the first non-null emission. See
|
|
205
|
+
{%docsBaseUrl%}/query/queries#the-query-object.
|
|
112
206
|
|
|
113
207
|
## Gotchas
|
|
114
208
|
|
|
115
|
-
-
|
|
116
|
-
(`?? []` / `filter(Boolean)` as needed).
|
|
117
|
-
- Don't reach for the legacy client for new code.
|
|
209
|
+
- `query.response()` is **nullable** (`?? []` / `filter(Boolean)` as needed).
|
|
118
210
|
- `.execute()` defaults `args` to the current `args()` when omitted.
|
|
119
211
|
- Anything under a query's `subtle` namespace is an unsupported escape hatch - never
|
|
120
212
|
treat it as public API.
|
|
213
|
+
- Use `withArgs` for mutations too. Never reach for `execute({ args })` plus
|
|
214
|
+
`silenceMissingWithArgsFeatureError` unless the args really exist only at call time - the
|
|
215
|
+
flag is an escape hatch, not the mutation pattern.
|