@zeix/cause-effect 1.0.0 → 1.0.1
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/.github/copilot-instructions.md +2 -1
- package/.zed/settings.json +24 -1
- package/ARCHITECTURE.md +1 -1
- package/CHANGELOG.md +15 -0
- package/README.md +41 -0
- package/REQUIREMENTS.md +3 -3
- package/eslint.config.js +2 -1
- package/package.json +5 -4
- package/skills/cause-effect/SKILL.md +69 -0
- package/skills/cause-effect/agents/openai.yaml +4 -0
- package/skills/cause-effect/references/api-facts.md +179 -0
- package/skills/cause-effect/references/error-classes.md +153 -0
- package/skills/cause-effect/references/non-obvious-behaviors.md +173 -0
- package/skills/cause-effect/references/signal-types.md +288 -0
- package/skills/cause-effect/workflows/answer-question.md +54 -0
- package/skills/cause-effect/workflows/debug.md +71 -0
- package/skills/cause-effect/workflows/use-api.md +63 -0
- package/skills/cause-effect-dev/SKILL.md +61 -100
- package/skills/cause-effect-dev/references/api-facts.md +96 -0
- package/skills/cause-effect-dev/references/error-classes.md +97 -0
- package/skills/cause-effect-dev/references/internal-types.md +54 -0
- package/skills/cause-effect-dev/references/non-obvious-behaviors.md +146 -0
- package/skills/cause-effect-dev/references/source-map.md +45 -0
- package/skills/cause-effect-dev/workflows/answer-question.md +55 -0
- package/skills/cause-effect-dev/workflows/fix-bug.md +63 -0
- package/skills/cause-effect-dev/workflows/implement-feature.md +46 -0
- package/skills/cause-effect-dev/workflows/write-tests.md +64 -0
- package/skills/changelog-keeper/SKILL.md +47 -37
- package/skills/tech-writer/SKILL.md +94 -0
- package/skills/tech-writer/references/document-map.md +199 -0
- package/skills/tech-writer/references/tone-guide.md +189 -0
- package/skills/tech-writer/workflows/consistency-review.md +98 -0
- package/skills/tech-writer/workflows/update-after-change.md +65 -0
- package/skills/tech-writer/workflows/update-agent-docs.md +77 -0
- package/skills/tech-writer/workflows/update-architecture.md +61 -0
- package/skills/tech-writer/workflows/update-jsdoc.md +72 -0
- package/skills/tech-writer/workflows/update-public-api.md +59 -0
- package/skills/tech-writer/workflows/update-requirements.md +80 -0
- package/src/graph.ts +2 -0
- package/src/nodes/collection.ts +38 -0
- package/src/nodes/effect.ts +13 -1
- package/src/nodes/list.ts +23 -2
- package/src/nodes/memo.ts +0 -1
- package/src/nodes/sensor.ts +10 -4
- package/src/nodes/store.ts +11 -0
- package/src/signal.ts +6 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<overview>
|
|
2
|
+
Writing tone, register, and conciseness rules for each document maintained by the tech-writer
|
|
3
|
+
skill. Violating the tone is as wrong as a factual error — each document has a distinct
|
|
4
|
+
primary reader and serves a distinct purpose.
|
|
5
|
+
</overview>
|
|
6
|
+
|
|
7
|
+
<shared_rules>
|
|
8
|
+
These rules apply to every document without exception:
|
|
9
|
+
|
|
10
|
+
- **Concise over comprehensive.** Every sentence must add information the reader needs.
|
|
11
|
+
Cut throat-clearing, transitional padding, and restatements of what the code already
|
|
12
|
+
shows.
|
|
13
|
+
- **Technically accurate over reassuring.** Do not soften edge cases, paper over
|
|
14
|
+
constraints, or omit behavior that is surprising but correct.
|
|
15
|
+
- **No changelog language in documentation.** Documents state current truth. Never write
|
|
16
|
+
"previously", "as of version X", "we changed", or "now supports". Those belong in
|
|
17
|
+
CHANGELOG.md.
|
|
18
|
+
- **No meta-commentary.** Do not write "This section explains…" or "See below for…".
|
|
19
|
+
Say the thing directly.
|
|
20
|
+
- **Backtick all code.** Every API name, flag, file name, type name, option key, and
|
|
21
|
+
shell command is wrapped in backticks, even mid-sentence.
|
|
22
|
+
</shared_rules>
|
|
23
|
+
|
|
24
|
+
<README>
|
|
25
|
+
**Primary audience:** Developers integrating `@zeix/cause-effect` into a project.
|
|
26
|
+
They know TypeScript and have used reactive libraries before.
|
|
27
|
+
|
|
28
|
+
**Register:** Instructional. Direct address ("use `createTask` when…"). Present tense.
|
|
29
|
+
Active voice. Short sentences in prose; examples do the heavy lifting.
|
|
30
|
+
|
|
31
|
+
**Structure rules:**
|
|
32
|
+
- Each `### SignalType` section: one short paragraph describing what the signal is for,
|
|
33
|
+
then the signature, then options, then example(s). Description first — don't open with
|
|
34
|
+
the signature.
|
|
35
|
+
- Options tables: one row per option. "Description" column is one line; if it needs more,
|
|
36
|
+
the option is complex enough to warrant a prose sentence below the table instead.
|
|
37
|
+
- Examples: realistic, not trivial. Show actual usage patterns, not `const x = createState(0)`.
|
|
38
|
+
Prefer examples that demonstrate the signal's distinctive behavior.
|
|
39
|
+
|
|
40
|
+
**What to cut:**
|
|
41
|
+
- Explanations of TypeScript concepts the reader already knows
|
|
42
|
+
- Warnings about things the type system already prevents
|
|
43
|
+
- Motivational framing ("This is useful when you need to…")
|
|
44
|
+
</README>
|
|
45
|
+
|
|
46
|
+
<GUIDE>
|
|
47
|
+
**Primary audience:** Developers migrating from React, Vue, or Angular who want to
|
|
48
|
+
understand where this library's concepts map to — and diverge from — what they already know.
|
|
49
|
+
|
|
50
|
+
**Register:** Comparative and educational. Assumes framework fluency; never assumes
|
|
51
|
+
knowledge of this library. Uses "if you've used X, this is like Y, except…" framing.
|
|
52
|
+
Approachable but never condescending.
|
|
53
|
+
|
|
54
|
+
**Structure rules:**
|
|
55
|
+
- Comparisons must be specific. Name the exact React hook, Vue function, or Angular
|
|
56
|
+
decorator being compared. Vague comparisons ("like in other frameworks") add no value.
|
|
57
|
+
- Divergences get more space than similarities. The reader can infer the familiar parts;
|
|
58
|
+
the non-obvious differences are why this section exists.
|
|
59
|
+
- Code examples: show both the framework equivalent and the cause-effect version side by
|
|
60
|
+
side when it aids comparison. Otherwise, cause-effect only.
|
|
61
|
+
|
|
62
|
+
**What to cut:**
|
|
63
|
+
- Explanations of how React/Vue/Angular work internally — assume the reader knows
|
|
64
|
+
- Repetition of content already in README.md — GUIDE.md is conceptual, not a reference
|
|
65
|
+
- Sections that say "this is the same as in other frameworks" without adding nuance
|
|
66
|
+
</GUIDE>
|
|
67
|
+
|
|
68
|
+
<ARCHITECTURE>
|
|
69
|
+
**Primary audience:** Contributors to the library and AI agents that need to understand
|
|
70
|
+
internals to implement or review changes correctly.
|
|
71
|
+
|
|
72
|
+
**Register:** Technical and precise. Third person, present tense. Implementation details
|
|
73
|
+
are expected and welcome. Internal function names, type names, flag names, and field names
|
|
74
|
+
are used freely without definition — this document assumes the reader has the source open.
|
|
75
|
+
|
|
76
|
+
**Structure rules:**
|
|
77
|
+
- Describe mechanisms, not intentions. Not "this enables efficient updates" but "when
|
|
78
|
+
`propagate()` marks a node `FLAG_CHECK`, downstream nodes call `refresh()` before
|
|
79
|
+
deciding whether to recompute".
|
|
80
|
+
- Pseudocode and inline type definitions are appropriate when they make a structure clearer
|
|
81
|
+
than prose would. Match the actual source types exactly — do not simplify.
|
|
82
|
+
- Subsection depth: use the existing pattern (##, ###). Do not add new heading levels.
|
|
83
|
+
|
|
84
|
+
**What to cut:**
|
|
85
|
+
- Motivational framing ("The design optimizes for…") — state the mechanism, not the goal
|
|
86
|
+
- Public API description — that belongs in README.md
|
|
87
|
+
- Any sentence that could be replaced by reading the source directly
|
|
88
|
+
</ARCHITECTURE>
|
|
89
|
+
|
|
90
|
+
<CLAUDE_MD>
|
|
91
|
+
**Primary audience:** Claude (this model) at inference time. Every token has a cost.
|
|
92
|
+
|
|
93
|
+
**Register:** Terse, declarative, maximally dense. No hand-holding. No transitions.
|
|
94
|
+
Bold key terms. Bullet lists over prose. Code examples only when the correct pattern is
|
|
95
|
+
non-obvious from the statement.
|
|
96
|
+
|
|
97
|
+
**Structure rules:**
|
|
98
|
+
- Non-obvious behavior entries follow a strict three-part structure:
|
|
99
|
+
1. **Bold statement** of the behavior — one sentence, declarative, specific.
|
|
100
|
+
2. Implication or consequence — one or two sentences maximum.
|
|
101
|
+
3. Code example — only if the correct pattern cannot be inferred from the statement.
|
|
102
|
+
Use before/after style (bad comment + good comment) only when the contrast is the point.
|
|
103
|
+
- The bar for "non-obvious": an experienced reactive developer would not predict this
|
|
104
|
+
behavior from the public API alone. If they would, it does not belong here.
|
|
105
|
+
- Internal names (`FLAG_CHECK`, `activeSink`, `trimSources`) are appropriate — Claude
|
|
106
|
+
can cross-reference ARCHITECTURE.md.
|
|
107
|
+
|
|
108
|
+
**What to cut:**
|
|
109
|
+
- Any sentence that restates what the bold statement already said
|
|
110
|
+
- Explanations of standard reactive concepts (memoization, lazy evaluation, dependency tracking)
|
|
111
|
+
- "Note that…", "Keep in mind…", "Be aware that…" — state it directly
|
|
112
|
+
- Examples that illustrate obvious correct usage; examples only for non-obvious patterns
|
|
113
|
+
</CLAUDE_MD>
|
|
114
|
+
|
|
115
|
+
<copilot_instructions>
|
|
116
|
+
**Primary audience:** GitHub Copilot during code generation. The document drives what
|
|
117
|
+
Copilot suggests as it completes function calls, option objects, and type annotations.
|
|
118
|
+
|
|
119
|
+
**Register:** Structured and pattern-oriented. Headers create anchors Copilot uses to
|
|
120
|
+
locate relevant context. Code blocks are generation templates — they must be complete,
|
|
121
|
+
compilable, and idiomatic.
|
|
122
|
+
|
|
123
|
+
**Structure rules:**
|
|
124
|
+
- Code patterns must compile against the current `index.ts`. Copilot generates from these
|
|
125
|
+
literally — a wrong parameter name or stale option key will be reproduced in generated code.
|
|
126
|
+
- Signal type descriptions: one line each in the format
|
|
127
|
+
`**Name** (\`createName\`): what it is and its key behavioral trait.`
|
|
128
|
+
- Do not use narrative prose in list items — use fragments that complete a pattern, not
|
|
129
|
+
sentences that explain one.
|
|
130
|
+
|
|
131
|
+
**What to cut:**
|
|
132
|
+
- Explanatory prose around code patterns — the pattern is self-documenting
|
|
133
|
+
- Options or parameters that are rarely used and not needed for the common case
|
|
134
|
+
- Duplication between sections (e.g. do not describe `createTask` in both "Signal Types"
|
|
135
|
+
and again identically in "Common Code Patterns")
|
|
136
|
+
</copilot_instructions>
|
|
137
|
+
|
|
138
|
+
<REQUIREMENTS>
|
|
139
|
+
**Primary audience:** Stakeholders, contributors, and future maintainers who need to
|
|
140
|
+
understand the library's purpose and boundaries. This document is read infrequently and
|
|
141
|
+
must remain accurate over many versions.
|
|
142
|
+
|
|
143
|
+
**Register:** Formal, strategic, timeless. Third person. Noun phrases over verb phrases
|
|
144
|
+
where possible ("The library is deliberately not a framework" rather than "We decided not
|
|
145
|
+
to make this a framework"). No version-specific language except in "Stability".
|
|
146
|
+
|
|
147
|
+
**Structure rules:**
|
|
148
|
+
- Tables state facts as rows — they do not tell a story. Each row is self-contained.
|
|
149
|
+
- "Non-Goals" entries are one bold heading + one sentence. The heading names the thing
|
|
150
|
+
that is out of scope; the sentence says why or what to do instead. No more.
|
|
151
|
+
- "Stability" is the only section that may reference specific version numbers. All other
|
|
152
|
+
sections describe the library as it is, not how it got there.
|
|
153
|
+
|
|
154
|
+
**What to cut:**
|
|
155
|
+
- Rationale for decisions that were obvious or uncontroversial — if it needs defending,
|
|
156
|
+
add one sentence; otherwise state the fact
|
|
157
|
+
- Historical context ("this was added because…")
|
|
158
|
+
- Implementation detail — REQUIREMENTS.md describes goals, not mechanisms
|
|
159
|
+
</REQUIREMENTS>
|
|
160
|
+
|
|
161
|
+
<jsdoc>
|
|
162
|
+
**Primary audience:** Developers reading function signatures in an IDE or in generated
|
|
163
|
+
API documentation. They see the JSDoc in a tooltip or a docs page alongside the TypeScript
|
|
164
|
+
signature.
|
|
165
|
+
|
|
166
|
+
**Register:** Brief, typed, precise. One-line summaries. No narrative. Fragments are
|
|
167
|
+
acceptable if they read naturally as a tooltip.
|
|
168
|
+
|
|
169
|
+
**Structure rules:**
|
|
170
|
+
- Summary line: one line. Describes what the function does, not what it is.
|
|
171
|
+
"Creates a mutable reactive signal." not "A factory function for State signals."
|
|
172
|
+
- `@param` tags: one line each. Describe semantics and constraints, not the TypeScript
|
|
173
|
+
type (the type is already visible in the signature). For options objects, document only
|
|
174
|
+
options whose behavior is non-obvious.
|
|
175
|
+
- `@returns`: one line. What is returned and any non-obvious guarantee
|
|
176
|
+
(e.g. "Always non-nullish per `T extends {}`").
|
|
177
|
+
- `@throws`: only for errors that can occur in correct, non-erroneous usage. Do not
|
|
178
|
+
document programmer-error throws (`RequiredOwnerError`, `InvalidCallbackError`,
|
|
179
|
+
`CircularDependencyError`) — they indicate a coding mistake, not a handled condition.
|
|
180
|
+
- `@example`: only if the usage pattern is so non-obvious that a developer would misuse
|
|
181
|
+
the function without it. Examples live primarily in README.md.
|
|
182
|
+
|
|
183
|
+
**What to cut:**
|
|
184
|
+
- `@param type` annotations — TypeScript already shows the type
|
|
185
|
+
- JSDoc that restates the TypeScript signature in prose
|
|
186
|
+
- Generic descriptions that would apply to any function ("Creates and returns a…")
|
|
187
|
+
- Multi-paragraph descriptions — if it needs that much explanation, the API design may
|
|
188
|
+
need review
|
|
189
|
+
</jsdoc>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<required_reading>
|
|
2
|
+
1. references/document-map.md — full index of documents, their scope, and what to verify in each
|
|
3
|
+
</required_reading>
|
|
4
|
+
|
|
5
|
+
<process>
|
|
6
|
+
## Step 1: Read the source of truth
|
|
7
|
+
|
|
8
|
+
Read `index.ts` for the complete public API surface. Read `src/graph.ts` for the graph engine
|
|
9
|
+
and internal node shapes. Note the current version in `package.json`.
|
|
10
|
+
|
|
11
|
+
These are the ground truth. Every document is checked against them, not against each other.
|
|
12
|
+
|
|
13
|
+
## Step 2: Check each document in turn
|
|
14
|
+
|
|
15
|
+
Work through the documents in this order. For each one, read the current document alongside
|
|
16
|
+
the relevant source, then record findings before moving to the next.
|
|
17
|
+
|
|
18
|
+
### REQUIREMENTS.md
|
|
19
|
+
- Signal type table (9 types) matches the exports in `index.ts`
|
|
20
|
+
- Bundle size targets still reflect current library scope
|
|
21
|
+
- Non-goals do not contradict any feature that has since been added
|
|
22
|
+
- Stability section reflects the current version and release status
|
|
23
|
+
|
|
24
|
+
### ARCHITECTURE.md
|
|
25
|
+
- Concrete Node Types table matches the node shapes in `src/graph.ts`
|
|
26
|
+
- Node Field Mixins table matches `SourceFields`, `SinkFields`, `OwnerFields`, `AsyncFields`
|
|
27
|
+
as defined in `src/graph.ts`
|
|
28
|
+
- Flag names (`FLAG_CLEAN`, `FLAG_CHECK`, `FLAG_DIRTY`, `FLAG_RUNNING`) match `src/graph.ts`
|
|
29
|
+
- Each signal type subsection describes the correct internal composition and lifecycle
|
|
30
|
+
- No subsection references a removed node type, flag, or function
|
|
31
|
+
|
|
32
|
+
### CLAUDE.md
|
|
33
|
+
- Internal Node Shapes block matches `src/graph.ts`
|
|
34
|
+
- `activeOwner` / `activeSink` semantics description is accurate
|
|
35
|
+
- Each non-obvious behavior entry is still accurate for the current implementation
|
|
36
|
+
- Mental model analogy covers all 9 signal types
|
|
37
|
+
|
|
38
|
+
### .github/copilot-instructions.md
|
|
39
|
+
- Signal Types list covers all 9 signal types with accurate one-line descriptions
|
|
40
|
+
- Key Files Structure lists all current `src/` files
|
|
41
|
+
- Code patterns in "Common Code Patterns" compile against current `index.ts`
|
|
42
|
+
(check factory signatures, option names, parameter order)
|
|
43
|
+
- API Design Principles reflect current conventions
|
|
44
|
+
|
|
45
|
+
### README.md
|
|
46
|
+
- Every factory function exported from `index.ts` has a documented `### SignalType` section
|
|
47
|
+
- All option names, parameter names, and types match current signatures
|
|
48
|
+
- Code examples in the API section use current factory signatures
|
|
49
|
+
- "Choosing the Right Signal" table covers all 9 signal types
|
|
50
|
+
- "Advanced Usage" examples use current API
|
|
51
|
+
|
|
52
|
+
### GUIDE.md
|
|
53
|
+
- "The Familiar Core" table references current factory function names
|
|
54
|
+
- "What Works Differently" sections describe current behavior
|
|
55
|
+
- "Beyond the Basics" signal type sections are accurate and use current API
|
|
56
|
+
- Code examples compile against current `index.ts`
|
|
57
|
+
|
|
58
|
+
### JSDoc in src/ (spot-check)
|
|
59
|
+
- Read `src/nodes/state.ts`, `src/nodes/memo.ts`, and `src/nodes/effect.ts`
|
|
60
|
+
- Verify that `@param` tags match current parameter names and types
|
|
61
|
+
- Verify that `@returns` descriptions are accurate
|
|
62
|
+
- Flag any JSDoc that describes removed or renamed options
|
|
63
|
+
|
|
64
|
+
## Step 3: Compile findings
|
|
65
|
+
|
|
66
|
+
Produce a structured report before making any edits:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
## Consistency Review — [date]
|
|
70
|
+
|
|
71
|
+
### Accurate (no changes needed)
|
|
72
|
+
- REQUIREMENTS.md: consistent
|
|
73
|
+
- ...
|
|
74
|
+
|
|
75
|
+
### Gaps found
|
|
76
|
+
- ARCHITECTURE.md, "Concrete Node Types": [specific claim] is outdated — [what is correct]
|
|
77
|
+
- README.md, "### Task": option `abort` renamed to `signal` in current index.ts
|
|
78
|
+
- ...
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Be specific: name the document, section, and the exact discrepancy. Do not summarize vaguely.
|
|
82
|
+
|
|
83
|
+
## Step 4: Confirm before editing
|
|
84
|
+
|
|
85
|
+
Present the report and ask: **"Shall I apply all of these updates, or would you like to
|
|
86
|
+
review and select?"**
|
|
87
|
+
|
|
88
|
+
Do not make any edits until explicitly confirmed. If the user confirms all, follow the
|
|
89
|
+
relevant per-document workflow for each gap identified. If they select a subset, update
|
|
90
|
+
only those.
|
|
91
|
+
</process>
|
|
92
|
+
|
|
93
|
+
<success_criteria>
|
|
94
|
+
- All seven documents checked against current source (`index.ts`, `src/graph.ts`)
|
|
95
|
+
- Findings reported as a structured list with specific document, section, and discrepancy
|
|
96
|
+
- No edits made before confirmation
|
|
97
|
+
- After confirmation, each gap resolved using the appropriate per-document workflow
|
|
98
|
+
</success_criteria>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<required_reading>
|
|
2
|
+
1. references/document-map.md — map the change type to affected documents
|
|
3
|
+
</required_reading>
|
|
4
|
+
|
|
5
|
+
<process>
|
|
6
|
+
## Step 1: Understand the change
|
|
7
|
+
|
|
8
|
+
Inspect the diff against the main branch:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
git diff main..HEAD -- src/ index.ts
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
If no diff is available, ask the user to describe what changed.
|
|
15
|
+
|
|
16
|
+
## Step 2: Classify the change
|
|
17
|
+
|
|
18
|
+
Identify which of the following change types apply — more than one may apply:
|
|
19
|
+
|
|
20
|
+
| Change type | Examples |
|
|
21
|
+
|---|---|
|
|
22
|
+
| **New public API** | New factory function, new export, new type in `index.ts` |
|
|
23
|
+
| **Changed public API** | Modified signature, new option, renamed parameter, changed return type |
|
|
24
|
+
| **Removed public API** | Removed export, removed option, removed type |
|
|
25
|
+
| **New or changed non-obvious behavior** | Graph semantics, propagation edge case, ownership subtlety |
|
|
26
|
+
| **Internal implementation change** | Graph engine logic, flag values, node shapes, propagation algorithm |
|
|
27
|
+
| **Vision or scope change** | New design principle, changed audience, new constraint or non-goal |
|
|
28
|
+
|
|
29
|
+
## Step 3: Determine affected documents
|
|
30
|
+
|
|
31
|
+
Use this table to identify which documents need updating:
|
|
32
|
+
|
|
33
|
+
| Change type | JSDoc | ARCHITECTURE.md | CLAUDE.md + copilot | README.md | GUIDE.md | REQUIREMENTS.md |
|
|
34
|
+
|---|---|---|---|---|---|---|
|
|
35
|
+
| New public API | ✓ | ✓ | ✓ | ✓ | ✓ if conceptually new | ✓ signal type table only |
|
|
36
|
+
| Changed public API | ✓ | if node shape changed | ✓ if behavior changes | ✓ | ✓ if affects mental model | ✗ |
|
|
37
|
+
| Removed public API | ✓ | ✓ if structural | ✓ | ✓ | ✓ if was documented | ✗ |
|
|
38
|
+
| New/changed non-obvious behavior | ✗ | ✓ if graph-level | ✓ | ✓ if affects usage pattern | ✗ | ✗ |
|
|
39
|
+
| Internal implementation change | ✗ | ✓ | ✓ | ✗ | ✗ | ✗ |
|
|
40
|
+
| Vision or scope change | ✗ | ✗ | ✗ | ✗ | ✗ | ✓ |
|
|
41
|
+
|
|
42
|
+
## Step 4: Update affected documents in order
|
|
43
|
+
|
|
44
|
+
Follow the corresponding workflow for each affected document. Always work in this order — each layer informs the next:
|
|
45
|
+
|
|
46
|
+
1. **JSDoc** (`src/`) — closest to code; establishes precise wording
|
|
47
|
+
→ workflows/update-jsdoc.md
|
|
48
|
+
2. **ARCHITECTURE.md** — internal structure; must be consistent with source
|
|
49
|
+
→ workflows/update-architecture.md
|
|
50
|
+
3. **CLAUDE.md + copilot-instructions.md** — agent docs; must be consistent with architecture
|
|
51
|
+
→ workflows/update-agent-docs.md
|
|
52
|
+
4. **README.md + GUIDE.md** — public docs; must be consistent with API and agent docs
|
|
53
|
+
→ workflows/update-public-api.md
|
|
54
|
+
5. **REQUIREMENTS.md** — only if scope changed
|
|
55
|
+
→ workflows/update-requirements.md
|
|
56
|
+
|
|
57
|
+
Skip any document not identified as affected in Step 3.
|
|
58
|
+
</process>
|
|
59
|
+
|
|
60
|
+
<success_criteria>
|
|
61
|
+
- Change type(s) correctly identified from the diff or description
|
|
62
|
+
- Only affected documents updated — no speculative edits
|
|
63
|
+
- Documents updated in the prescribed order
|
|
64
|
+
- Each document follows its tone guide
|
|
65
|
+
</success_criteria>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<required_reading>
|
|
2
|
+
1. references/document-map.md — CLAUDE.md and copilot-instructions.md sections
|
|
3
|
+
2. references/tone-guide.md — agent-docs tone rules
|
|
4
|
+
</required_reading>
|
|
5
|
+
|
|
6
|
+
<process>
|
|
7
|
+
## Step 1: Read the source
|
|
8
|
+
|
|
9
|
+
Read the relevant `src/nodes/*.ts` file(s) and `src/graph.ts` if the change touches graph
|
|
10
|
+
semantics. Read the current `CLAUDE.md` and `.github/copilot-instructions.md` in full.
|
|
11
|
+
Never update agent docs from memory — subtle inaccuracies are worse than gaps.
|
|
12
|
+
|
|
13
|
+
## Step 2: Update CLAUDE.md
|
|
14
|
+
|
|
15
|
+
CLAUDE.md is the inference-time reference for Claude. It covers the mental model, internal
|
|
16
|
+
node shapes, and non-obvious behaviors. Token cost is real — every line must earn its place.
|
|
17
|
+
|
|
18
|
+
**Mental model section**
|
|
19
|
+
- Update the spreadsheet-cell analogy if a new signal type is added. One line per type,
|
|
20
|
+
consistent with the existing terse style.
|
|
21
|
+
|
|
22
|
+
**Internal Node Shapes section**
|
|
23
|
+
- Update the node shape table if `SourceFields`, `SinkFields`, `OwnerFields`, or `AsyncFields`
|
|
24
|
+
changed in `src/graph.ts`, or if a new node type was added.
|
|
25
|
+
- Update the `activeOwner` / `activeSink` description if their semantics changed.
|
|
26
|
+
|
|
27
|
+
**Non-Obvious Behaviors section**
|
|
28
|
+
- Add an entry when a behavior is counterintuitive enough that a competent developer would
|
|
29
|
+
not predict it from the public API alone.
|
|
30
|
+
- Remove or correct an entry when a previously non-obvious behavior has changed.
|
|
31
|
+
|
|
32
|
+
Each entry must follow this structure exactly:
|
|
33
|
+
1. **Bold statement** of the behavior — one sentence, declarative.
|
|
34
|
+
2. One or two sentences of implication. No padding.
|
|
35
|
+
3. A code example only if the correct pattern is non-obvious from the statement alone.
|
|
36
|
+
Use the existing before/after style where it adds clarity.
|
|
37
|
+
|
|
38
|
+
Do NOT add entries for behavior that is obvious from the type signatures or from standard
|
|
39
|
+
reactive library conventions. The bar is: would an experienced reactive developer be
|
|
40
|
+
surprised by this?
|
|
41
|
+
|
|
42
|
+
## Step 3: Update .github/copilot-instructions.md
|
|
43
|
+
|
|
44
|
+
copilot-instructions.md drives GitHub Copilot's code generation. Accuracy of the code
|
|
45
|
+
patterns is critical — Copilot uses these as generation templates.
|
|
46
|
+
|
|
47
|
+
**Core Architecture section**
|
|
48
|
+
- Update the node type list if a new node type was added or an existing one changed role.
|
|
49
|
+
- Update the flag list (`FLAG_CLEAN`, `FLAG_CHECK`, `FLAG_DIRTY`, `FLAG_RUNNING`) if flags
|
|
50
|
+
were added, renamed, or removed.
|
|
51
|
+
|
|
52
|
+
**Signal Types section**
|
|
53
|
+
- Add a one-line entry for each new signal type: `**Name** (\`createName\`): description`.
|
|
54
|
+
- Update the description of any signal type whose behavior or options changed.
|
|
55
|
+
|
|
56
|
+
**Key Files Structure section**
|
|
57
|
+
- Add a new line if a new source file was added.
|
|
58
|
+
|
|
59
|
+
**Common Code Patterns section**
|
|
60
|
+
- This is the highest-value section. Update the code block under "Creating Signals" to
|
|
61
|
+
reflect any changed factory signatures or new signal types.
|
|
62
|
+
- Patterns must compile against the current API. Verify each pattern against `index.ts`.
|
|
63
|
+
- Add a new pattern block only if the new usage cannot be inferred from existing patterns.
|
|
64
|
+
|
|
65
|
+
**Coding Conventions / API Design Principles sections**
|
|
66
|
+
- Update only if a new convention was established or an existing one changed.
|
|
67
|
+
</process>
|
|
68
|
+
|
|
69
|
+
<success_criteria>
|
|
70
|
+
- Source file(s) read before any edits
|
|
71
|
+
- CLAUDE.md non-obvious behavior entries accurate, terse, and consistently structured
|
|
72
|
+
- CLAUDE.md node shapes consistent with `src/graph.ts`
|
|
73
|
+
- copilot-instructions.md code patterns compile against the current `index.ts`
|
|
74
|
+
- Both documents remain concise — no explanatory padding
|
|
75
|
+
- Tone matches references/tone-guide.md: terse and direct for CLAUDE.md,
|
|
76
|
+
structured and pattern-focused for copilot-instructions.md
|
|
77
|
+
</success_criteria>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<required_reading>
|
|
2
|
+
1. references/document-map.md — ARCHITECTURE.md section
|
|
3
|
+
2. references/tone-guide.md — architecture tone rules
|
|
4
|
+
</required_reading>
|
|
5
|
+
|
|
6
|
+
<process>
|
|
7
|
+
## Step 1: Read the source of truth
|
|
8
|
+
|
|
9
|
+
Read `src/graph.ts` in full. Read any changed `src/nodes/*.ts` file(s). ARCHITECTURE.md
|
|
10
|
+
describes internals — accuracy requires reading the actual implementation, not inferring
|
|
11
|
+
from public API or documentation.
|
|
12
|
+
|
|
13
|
+
## Step 2: Identify what changed architecturally
|
|
14
|
+
|
|
15
|
+
Changes that warrant an ARCHITECTURE.md update:
|
|
16
|
+
|
|
17
|
+
| Changed | Section to update |
|
|
18
|
+
|---|---|
|
|
19
|
+
| Edge structure (`Edge` type fields) | Core Data Structures → Edges |
|
|
20
|
+
| Node field mixins (`SourceFields`, `SinkFields`, etc.) | Core Data Structures → Node Field Mixins |
|
|
21
|
+
| Concrete node types or their composition | Core Data Structures → Concrete Node Types |
|
|
22
|
+
| `activeSink` protocol or `link()`/`trimSources()`/`unlink()` | Automatic Dependency Tracking |
|
|
23
|
+
| Flag values or `propagate()`/`refresh()`/`setState()` | Change Propagation |
|
|
24
|
+
| `batch()`/`flush()` or effect scheduling | Effect Scheduling |
|
|
25
|
+
| `activeOwner`, cleanup storage, `createScope()` | Ownership and Cleanup |
|
|
26
|
+
| New or changed signal type | Signal Types → relevant subsection |
|
|
27
|
+
|
|
28
|
+
Do NOT update sections that remain accurate. If only `src/nodes/memo.ts` changed, only
|
|
29
|
+
the Memo subsection under "Signal Types" needs editing.
|
|
30
|
+
|
|
31
|
+
## Step 3: Update the affected section(s)
|
|
32
|
+
|
|
33
|
+
For each affected section:
|
|
34
|
+
|
|
35
|
+
1. Re-read the current section text alongside the new source.
|
|
36
|
+
2. Identify specific claims that are now wrong or incomplete.
|
|
37
|
+
3. Make the minimal edit that makes those claims accurate.
|
|
38
|
+
|
|
39
|
+
**Node shape changes:** Update the table in "Concrete Node Types" and the corresponding
|
|
40
|
+
mixin table if field composition changed. If a new field mixin was added, add a row.
|
|
41
|
+
|
|
42
|
+
**Propagation or flag changes:** Update the prose description and any pseudocode or
|
|
43
|
+
inline code that references the changed behavior. If flag names changed, update every
|
|
44
|
+
occurrence.
|
|
45
|
+
|
|
46
|
+
**New signal type:** Add a new subsection under "Signal Types" following the existing
|
|
47
|
+
pattern: one paragraph describing the node's role in the graph, its internal composition,
|
|
48
|
+
and any non-obvious lifecycle behavior (watched activation, ownership, async cancellation).
|
|
49
|
+
Do not duplicate the public API — describe the internal mechanics only.
|
|
50
|
+
|
|
51
|
+
**Removed signal type:** Remove its subsection. Check for cross-references in other
|
|
52
|
+
subsections.
|
|
53
|
+
</process>
|
|
54
|
+
|
|
55
|
+
<success_criteria>
|
|
56
|
+
- `src/graph.ts` read in full before any edits
|
|
57
|
+
- Only sections affected by the change were modified
|
|
58
|
+
- Node shapes, flag names, and function descriptions match the current source exactly
|
|
59
|
+
- New signal type subsection follows the structure and depth of existing subsections
|
|
60
|
+
- Tone is technical and internal-facing per references/tone-guide.md
|
|
61
|
+
</success_criteria>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<required_reading>
|
|
2
|
+
1. references/tone-guide.md — jsdoc tone rules
|
|
3
|
+
</required_reading>
|
|
4
|
+
|
|
5
|
+
<process>
|
|
6
|
+
## Step 1: Read the implementation first
|
|
7
|
+
|
|
8
|
+
Read the full source file being updated. JSDoc must describe what the code actually does —
|
|
9
|
+
not what it should do, not what the previous version did.
|
|
10
|
+
|
|
11
|
+
For public API changes, also read `index.ts` to confirm the exported signature matches
|
|
12
|
+
the implementation.
|
|
13
|
+
|
|
14
|
+
## Step 2: Identify which JSDoc blocks need updating
|
|
15
|
+
|
|
16
|
+
A JSDoc block needs updating when any of the following changed:
|
|
17
|
+
|
|
18
|
+
- The function signature (parameter added, removed, renamed, or retyped)
|
|
19
|
+
- The return type or return value semantics
|
|
20
|
+
- A thrown error condition that a caller must handle
|
|
21
|
+
- The function no longer exists (remove the block with the function)
|
|
22
|
+
|
|
23
|
+
Do NOT update JSDoc blocks that remain accurate. Read each existing block against the
|
|
24
|
+
current implementation before deciding whether to edit it.
|
|
25
|
+
|
|
26
|
+
## Step 3: Write or update the JSDoc block
|
|
27
|
+
|
|
28
|
+
Follow this structure for all public API functions:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
/**
|
|
32
|
+
* One-line summary. No period if it reads as a fragment; period if it reads as a sentence.
|
|
33
|
+
*
|
|
34
|
+
* Second paragraph only if the one-liner is genuinely insufficient — e.g. a non-obvious
|
|
35
|
+
* constraint or a behavioral guarantee that cannot fit on one line. Omit otherwise.
|
|
36
|
+
*
|
|
37
|
+
* @param name - What it is. Include constraints (`T extends {}`, valid range, allowed
|
|
38
|
+
* values). One line per param; wrap only if a constraint needs explaining.
|
|
39
|
+
* @param options - Options object, if present. Document only options that are non-obvious;
|
|
40
|
+
* skip `equals` and `guard` unless the signal's default behavior for them is unusual.
|
|
41
|
+
* @returns What is returned and any guarantee about its value (e.g. "Always non-nullish").
|
|
42
|
+
*/
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Constraints on length:**
|
|
46
|
+
- Summary line: one line, no exceptions.
|
|
47
|
+
- `@param` entries: one line each unless a constraint genuinely requires a second.
|
|
48
|
+
- No `@example` blocks — examples live in `README.md`. Add one only if the usage pattern
|
|
49
|
+
is so non-obvious that a developer would misuse the function without it.
|
|
50
|
+
- No `@throws` unless the error can occur in correct, non-erroneous usage (e.g.
|
|
51
|
+
`UnsetSignalValueError` on `Sensor.get()` before first value). Do not document
|
|
52
|
+
programmer-error throws (`RequiredOwnerError`, `InvalidCallbackError`, `CircularDependencyError`).
|
|
53
|
+
|
|
54
|
+
**Type annotations in JSDoc:**
|
|
55
|
+
- Do NOT repeat TypeScript types in `@param` or `@returns` tags. TypeScript already
|
|
56
|
+
enforces them. Only describe semantics, not types.
|
|
57
|
+
|
|
58
|
+
## Step 4: Check consistency across the file
|
|
59
|
+
|
|
60
|
+
After updating, scan the rest of the file for any JSDoc that cross-references the changed
|
|
61
|
+
function or type. Update those references if they are now stale.
|
|
62
|
+
</process>
|
|
63
|
+
|
|
64
|
+
<success_criteria>
|
|
65
|
+
- Source file read in full before any edits
|
|
66
|
+
- Every updated block has a one-line summary
|
|
67
|
+
- No `@example` blocks added unless usage is genuinely non-obvious
|
|
68
|
+
- No `@throws` for programmer-error conditions
|
|
69
|
+
- TypeScript types not duplicated in JSDoc prose
|
|
70
|
+
- Updated blocks compile without JSDoc-related errors
|
|
71
|
+
- Unchanged blocks left untouched
|
|
72
|
+
</success_criteria>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<required_reading>
|
|
2
|
+
1. references/document-map.md — README.md and GUIDE.md sections
|
|
3
|
+
2. references/tone-guide.md — public-api and guide tone rules
|
|
4
|
+
</required_reading>
|
|
5
|
+
|
|
6
|
+
<process>
|
|
7
|
+
## Step 1: Read the source of truth
|
|
8
|
+
|
|
9
|
+
Read `index.ts` for the current public API surface. Read the relevant `src/nodes/*.ts`
|
|
10
|
+
file(s) for any changed signal type. Do this before opening either document.
|
|
11
|
+
|
|
12
|
+
## Step 2: Update README.md
|
|
13
|
+
|
|
14
|
+
README.md is the authoritative public API reference. Make targeted edits only:
|
|
15
|
+
|
|
16
|
+
**New signal type**
|
|
17
|
+
- Add a `### SignalType` section under `## API` with: factory signature, all options, and
|
|
18
|
+
at least one realistic example showing normal usage.
|
|
19
|
+
- Add the type to the "Choosing the Right Signal" table with a one-line description.
|
|
20
|
+
- If the type participates in ownership or has a `watched` lifecycle, add an example to
|
|
21
|
+
"Advanced Usage → Resource Management".
|
|
22
|
+
|
|
23
|
+
**Changed option or signature**
|
|
24
|
+
- Update the relevant `### SignalType` section. Update the example if the old pattern no
|
|
25
|
+
longer compiles or no longer represents idiomatic usage.
|
|
26
|
+
- If the change is a rename or a breaking type change, note the migration inline under the
|
|
27
|
+
parameter description, not in a separate section.
|
|
28
|
+
|
|
29
|
+
**Removed API**
|
|
30
|
+
- Remove all mentions. Check: the API section, "Choosing the Right Signal", "Advanced Usage",
|
|
31
|
+
and any cross-references in other signal type sections.
|
|
32
|
+
|
|
33
|
+
**New or changed behavior**
|
|
34
|
+
- Update the description in the relevant section. If the behavior is subtle, add or update
|
|
35
|
+
an example. If it is an advanced pattern, add to "Advanced Usage".
|
|
36
|
+
|
|
37
|
+
## Step 3: Update GUIDE.md
|
|
38
|
+
|
|
39
|
+
GUIDE.md explains the library through the lens of developers migrating from React, Vue,
|
|
40
|
+
or Angular. Update it only when the change affects the conceptual picture:
|
|
41
|
+
|
|
42
|
+
- **"The Familiar Core" table** — update if a core factory name changes.
|
|
43
|
+
- **"What Works Differently"** — update if a fundamental behavioral contract changes
|
|
44
|
+
(e.g. synchronous vs. async execution, nullability rules, ownership model).
|
|
45
|
+
- **"Beyond the Basics"** — update if a new signal type is added, or if a major signal
|
|
46
|
+
type changes significantly enough that its comparative explanation is wrong.
|
|
47
|
+
|
|
48
|
+
Do NOT add every option change or minor signature tweak to GUIDE.md. Only update it when
|
|
49
|
+
a developer's existing mental model from another framework would now lead them astray.
|
|
50
|
+
</process>
|
|
51
|
+
|
|
52
|
+
<success_criteria>
|
|
53
|
+
- `index.ts` read before any edits were made
|
|
54
|
+
- README.md accurately reflects the current public API: all factories documented, all
|
|
55
|
+
options current, all examples valid
|
|
56
|
+
- GUIDE.md updated only where the conceptual picture for framework migrants changed
|
|
57
|
+
- Both documents follow their respective tones from references/tone-guide.md
|
|
58
|
+
- No sections rewritten beyond what the change requires
|
|
59
|
+
</success_criteria>
|