@rt-tools/agent-kit 0.23.0 → 0.26.0
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/README.md +8 -2
- package/assets/agents/business-analyst.md +51 -50
- package/assets/agents/conscience.md +37 -35
- package/assets/agents/project-manager.md +49 -48
- package/assets/agents/prose-editor.md +31 -29
- package/assets/agents/qa-engineer.md +50 -48
- package/assets/agents/rules-reviewer.md +63 -58
- package/assets/agents/skill-curator.md +83 -78
- package/assets/agents/spec-critic.md +34 -29
- package/assets/agents/spec-writer.md +35 -32
- package/assets/agents/strict-teacher.md +39 -37
- package/assets/checks/archive-age.mjs +48 -28
- package/assets/checks/archive-prune.mjs +16 -14
- package/assets/checks/board-epics.github.mjs +75 -41
- package/assets/checks/board-folders.mjs +61 -0
- package/assets/checks/board-gh.github.mjs +35 -26
- package/assets/checks/board-long-work.github.mjs +24 -24
- package/assets/checks/board-paths.github.mjs +21 -16
- package/assets/checks/board-runs.github.mjs +45 -43
- package/assets/checks/board-titles.github.mjs +19 -17
- package/assets/checks/board.github.mjs +150 -128
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +179 -157
- package/assets/checks/check-descriptions.mjs +30 -29
- package/assets/checks/check-doc-paths.mjs +104 -82
- package/assets/checks/check-dupes.mjs +84 -80
- package/assets/checks/check-file-size.mjs +79 -70
- package/assets/checks/check-glossary.mjs +47 -37
- package/assets/checks/check-hook-scope.mjs +30 -27
- package/assets/checks/check-lib-layers.mjs +22 -21
- package/assets/checks/check-profile-drift.mjs +48 -43
- package/assets/checks/check-prose-style.mjs +125 -33
- package/assets/checks/check-push-gate.mjs +53 -50
- package/assets/checks/check-reuse.mjs +50 -40
- package/assets/checks/check-schema-drift.mjs +87 -83
- package/assets/checks/check-specs.mjs +155 -134
- package/assets/checks/check-state-next.mjs +66 -52
- package/assets/checks/check-states.mjs +32 -30
- package/assets/checks/check-styles.mjs +52 -51
- package/assets/checks/check-turn-map.mjs +54 -46
- package/assets/checks/lib-boundaries.mjs +32 -30
- package/assets/checks/lib-common.mjs +30 -29
- package/assets/checks/lib-domains.mjs +34 -34
- package/assets/checks/lib-manifests.mjs +17 -15
- package/assets/checks/lib-reexports.mjs +18 -18
- package/assets/checks/rt-kit-checks.config.mjs +174 -142
- package/assets/checks/signals.mjs +43 -39
- package/assets/checks/spec-anchors.mjs +114 -87
- package/assets/checks/spec-common.mjs +128 -84
- package/assets/checks/spec-contract.mjs +30 -30
- package/assets/checks/spec-proposed.mjs +27 -24
- package/assets/checks/spec-scenarios.mjs +51 -28
- package/assets/checks/task-new.github.mjs +85 -56
- package/assets/commands/feedback.md +65 -59
- package/assets/commands/next-session.md +64 -57
- package/assets/commands/skill-curator.md +83 -79
- package/assets/defaults/gate-map.sh +115 -91
- package/assets/defaults/project.sh +228 -178
- package/assets/defaults/shell.sh +85 -65
- package/assets/defaults/turn-map.md +45 -44
- package/assets/docs/GLOSSARY.md +142 -65
- package/assets/hooks/browser-device-id.sh +12 -12
- package/assets/hooks/browser-guard-device-id.sh +46 -14
- package/assets/hooks/browser-guard-no-asking.sh +5 -4
- package/assets/hooks/browser-guard-no-listing.sh +12 -11
- package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
- package/assets/hooks/browser-guard-require-select.sh +34 -23
- package/assets/hooks/claim-guard.sh +62 -56
- package/assets/hooks/commit-msg.sh +11 -10
- package/assets/hooks/conscience-guard.sh +91 -45
- package/assets/hooks/constitution-index.sh +16 -16
- package/assets/hooks/deny-tail.sh +28 -26
- package/assets/hooks/dev-server-guard.sh +46 -43
- package/assets/hooks/dispatch.sh +84 -39
- package/assets/hooks/docs-guard.sh +105 -86
- package/assets/hooks/exam-guard.sh +146 -84
- package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
- package/assets/hooks/git-guard-delivery-draft.sh +85 -0
- package/assets/hooks/git-guard-delivery-folder.sh +50 -43
- package/assets/hooks/git-guard-delivery-signature.sh +88 -52
- package/assets/hooks/git-guard-delivery.sh +207 -253
- package/assets/hooks/git-guard-main.sh +65 -26
- package/assets/hooks/git-guard-push-tests.sh +133 -75
- package/assets/hooks/glossary-load.sh +23 -22
- package/assets/hooks/grill-gate-ask.sh +12 -11
- package/assets/hooks/grill-gate.sh +94 -87
- package/assets/hooks/guard-note.sh +20 -19
- package/assets/hooks/handoff-entry-guard.sh +26 -24
- package/assets/hooks/handoff-write.sh +74 -67
- package/assets/hooks/hook-input.sh +70 -50
- package/assets/hooks/lint-after-edit.sh +95 -61
- package/assets/hooks/observe.sh +28 -26
- package/assets/hooks/override-write-guard.sh +23 -21
- package/assets/hooks/postmortem-guard.sh +42 -39
- package/assets/hooks/profile-check.sh +22 -20
- package/assets/hooks/proposal-guard.sh +57 -49
- package/assets/hooks/prose-style-guard.sh +19 -17
- package/assets/hooks/qa-dataid-guard.sh +52 -49
- package/assets/hooks/rerun-guard.sh +31 -30
- package/assets/hooks/reuse-first-guard.sh +108 -87
- package/assets/hooks/roles.sh +14 -14
- package/assets/hooks/rule-article.sh +36 -34
- package/assets/hooks/rule-source-guard.sh +52 -36
- package/assets/hooks/skill-gate-layers.sh +59 -57
- package/assets/hooks/skill-gate-rearm.sh +15 -8
- package/assets/hooks/skill-gate.sh +89 -81
- package/assets/hooks/skill-loaded.sh +6 -6
- package/assets/hooks/sql-guard-parse.sh +68 -66
- package/assets/hooks/sql-guard-request.sh +48 -46
- package/assets/hooks/sql-guard-target.sh +57 -51
- package/assets/hooks/sql-guard-write.sh +84 -79
- package/assets/hooks/sql-guard.sh +52 -47
- package/assets/hooks/stand-login-guard.sh +104 -0
- package/assets/hooks/task-context-load.sh +60 -55
- package/assets/hooks/task-flow-context.sh +87 -69
- package/assets/hooks/task-flow-draft-guard.sh +55 -48
- package/assets/hooks/task-flow-guard.sh +67 -64
- package/assets/hooks/turn-entry-load.sh +39 -32
- package/assets/hooks/turn-exit-guard.sh +256 -204
- package/assets/hooks/turn-exit-patterns.sh +53 -0
- package/assets/hooks/utf8.sh +11 -11
- package/assets/hooks/waiting-turn-guard.sh +94 -94
- package/assets/hooks/window-fill-guard.sh +70 -62
- package/assets/hooks/work-start-guard.sh +52 -49
- package/assets/hooks/write-targets.sh +115 -30
- package/assets/laws/autonomous-work.md +29 -27
- package/assets/laws/code-structure.md +31 -30
- package/assets/laws/delivery.md +148 -137
- package/assets/laws/entity-editing.md +52 -50
- package/assets/laws/entity-models.md +14 -13
- package/assets/laws/frontend-application.md +39 -38
- package/assets/laws/lib-imports.md +27 -27
- package/assets/laws/lists.md +31 -29
- package/assets/laws/navigation.md +37 -37
- package/assets/laws/observability.md +41 -40
- package/assets/laws/project-documentation.md +106 -99
- package/assets/laws/reuse-first.md +31 -29
- package/assets/laws/shared-code.md +27 -27
- package/assets/laws/verifiability.md +131 -114
- package/assets/laws/work-conduct.md +250 -250
- package/assets/patterns/admin-lists-screen.md +72 -69
- package/assets/patterns/admin-nav-item.md +51 -46
- package/assets/patterns/angular-patterns-state.md +32 -31
- package/assets/patterns/api-layer-pair.md +33 -31
- package/assets/patterns/autonomous-work-run.md +50 -49
- package/assets/patterns/browser-verification-measure.md +143 -67
- package/assets/patterns/browser-verification-stand.md +181 -128
- package/assets/patterns/component-structure-new.md +51 -42
- package/assets/patterns/dependencies-upgrade.md +55 -39
- package/assets/patterns/doc-style-human.md +93 -0
- package/assets/patterns/doc-style-sweep.md +82 -79
- package/assets/patterns/doc-style-trace.md +87 -81
- package/assets/patterns/doc-style-write.md +130 -122
- package/assets/patterns/entity-aside.md +77 -63
- package/assets/patterns/entity-models-new.md +37 -37
- package/assets/patterns/entity-store.md +33 -33
- package/assets/patterns/git-workflow-commit.azure.md +94 -75
- package/assets/patterns/git-workflow-commit.github.md +153 -129
- package/assets/patterns/git-workflow-commit.gitlab.md +96 -78
- package/assets/patterns/git-workflow-docker.md +165 -147
- package/assets/patterns/git-workflow-freshness.md +45 -45
- package/assets/patterns/git-workflow-merge.md +99 -86
- package/assets/patterns/git-workflow-migration.md +54 -52
- package/assets/patterns/git-workflow-pr-ready.md +57 -56
- package/assets/patterns/git-workflow-pr.azure.md +126 -121
- package/assets/patterns/git-workflow-pr.github.md +179 -175
- package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
- package/assets/patterns/git-workflow-restart.md +35 -31
- package/assets/patterns/git-workflow-secrets.md +80 -73
- package/assets/patterns/git-workflow-stack.md +131 -106
- package/assets/patterns/lib-layers-move.md +62 -53
- package/assets/patterns/lib-layers-new.md +59 -45
- package/assets/patterns/observability-record.md +72 -67
- package/assets/patterns/platform-access-di.md +31 -29
- package/assets/patterns/reuse-first-extend.md +66 -61
- package/assets/patterns/shared-code-new.md +39 -38
- package/assets/patterns/spec-driven-domain.md +161 -151
- package/assets/patterns/spec-driven-rule.md +179 -168
- package/assets/patterns/spec-driven-sweep.md +41 -39
- package/assets/patterns/status-report-table.github.md +37 -36
- package/assets/patterns/styling-bem-component.md +42 -42
- package/assets/patterns/styling-bem-layout.md +39 -34
- package/assets/patterns/styling-bem-sheet.md +59 -58
- package/assets/patterns/task-flow-archive.md +222 -215
- package/assets/patterns/task-flow-close.md +215 -203
- package/assets/patterns/task-flow-handoff.md +154 -145
- package/assets/patterns/task-flow-resume.md +138 -133
- package/assets/patterns/task-flow-start.md +204 -192
- package/assets/patterns/testing-e2e.md +103 -92
- package/assets/patterns/testing-unit.md +77 -70
- package/assets/patterns/ts-procedure.md +32 -29
- package/assets/patterns/turn-entry-map.md +50 -48
- package/assets/pitfalls/agent-kit.md +152 -141
- package/assets/pitfalls/doc-style.md +96 -91
- package/assets/pitfalls/git-workflow.azure.md +49 -46
- package/assets/pitfalls/git-workflow.github.md +264 -234
- package/assets/pitfalls/git-workflow.gitlab.md +49 -45
- package/assets/pitfalls/spec-driven.md +73 -71
- package/assets/pitfalls/styling-bem.md +46 -40
- package/assets/pitfalls/task-flow.md +262 -246
- package/assets/pitfalls/testing.md +99 -92
- package/assets/pitfalls/turn-conduct.md +96 -81
- package/assets/rules/angular-patterns.md +81 -80
- package/assets/rules/api-layer.md +77 -74
- package/assets/rules/autonomous-work.md +75 -74
- package/assets/rules/browser-verification.md +223 -188
- package/assets/rules/component-structure.md +72 -69
- package/assets/rules/dependencies.md +74 -67
- package/assets/rules/deploy-flow.azure.md +118 -108
- package/assets/rules/deploy-flow.github.md +145 -135
- package/assets/rules/deploy-flow.gitlab.md +120 -110
- package/assets/rules/doc-style.md +209 -148
- package/assets/rules/entity-conventions.needs-admin.md +81 -79
- package/assets/rules/entity-models.md +73 -70
- package/assets/rules/git-workflow.azure.md +224 -228
- package/assets/rules/git-workflow.github.md +250 -242
- package/assets/rules/git-workflow.gitlab.md +218 -217
- package/assets/rules/lib-layers.md +85 -86
- package/assets/rules/lists.md +101 -97
- package/assets/rules/navigation.md +78 -78
- package/assets/rules/observability.needs-app.md +165 -153
- package/assets/rules/platform-access.md +76 -75
- package/assets/rules/reuse-first.md +153 -137
- package/assets/rules/shared-code.md +82 -79
- package/assets/rules/spec-driven.md +272 -260
- package/assets/rules/status-report.md +55 -58
- package/assets/rules/styling-bem.md +83 -72
- package/assets/rules/task-flow.md +282 -270
- package/assets/rules/testing.md +224 -188
- package/assets/rules/turn-conduct.md +255 -258
- package/assets/rules/turn-entry.md +92 -87
- package/assets/rules/typescript-conventions.md +94 -88
- package/assets/samples/specs/_template/spec.md +47 -47
- package/assets/samples/tasks/_template/grill.md +20 -20
- package/assets/samples/tasks/_template/plan.md +32 -30
- package/assets/samples/tasks/_template/progress.md +16 -16
- package/assets/skills/agent-kit-extend.md +129 -113
- package/assets/skills/agent-kit.md +236 -222
- package/assets/skills/write-a-skill.md +76 -71
- package/assets/templates/findings.md +19 -19
- package/assets/templates/gate-map.sh +16 -14
- package/assets/templates/implementation.md +28 -27
- package/assets/templates/pattern.md +17 -17
- package/assets/templates/pitfalls.md +6 -6
- package/assets/templates/postmortem.md +24 -23
- package/assets/templates/project.sh +24 -24
- package/assets/templates/proposal.md +62 -60
- package/assets/templates/rule.md +38 -38
- package/assets/workflows/feature.js +46 -46
- package/assets/workflows/plan.js +54 -54
- package/lib/catalog.d.ts +2 -0
- package/lib/catalog.d.ts.map +1 -1
- package/lib/catalog.js +4 -3
- package/lib/catalog.js.map +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +68 -4
- package/lib/commands.js.map +1 -1
- package/lib/companion.js +3 -2
- package/lib/companion.js.map +1 -1
- package/lib/enroll.d.ts +7 -1
- package/lib/enroll.d.ts.map +1 -1
- package/lib/enroll.js +13 -4
- package/lib/enroll.js.map +1 -1
- package/lib/observations.d.ts +10 -1
- package/lib/observations.d.ts.map +1 -1
- package/lib/observations.js +1 -0
- package/lib/observations.js.map +1 -1
- package/lib/override-marks.d.ts +24 -0
- package/lib/override-marks.d.ts.map +1 -0
- package/lib/override-marks.js +98 -0
- package/lib/override-marks.js.map +1 -0
- package/lib/plan.d.ts +11 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +10 -1
- package/lib/plan.js.map +1 -1
- package/lib/ship.d.ts +0 -7
- package/lib/ship.d.ts.map +1 -1
- package/lib/ship.js +10 -2
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.js +7 -3
- package/lib/shipment.js.map +1 -1
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +45 -11
- package/lib/sync.js.map +1 -1
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.26.0.tgz +0 -0
- package/rt-tools-agent-kit-0.23.0.tgz +0 -0
|
@@ -2,184 +2,192 @@
|
|
|
2
2
|
name: doc-style-write
|
|
3
3
|
kind: pattern
|
|
4
4
|
rule: doc-style
|
|
5
|
-
description:
|
|
5
|
+
description: Pattern of rule doc-style. Load when writing any project prose — rules, specs, README, code comments, commit bodies, PR descriptions. Samples of "so" and "not so" for each wording convention. Not for the structure of a spec — that is rule spec-driven.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# How to word
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Pattern of the rule `doc-style`. What must be true — the law
|
|
11
11
|
`docs/constitution/project-documentation.md`.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## When to use
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
15
|
+
- A rule, an article of a law, a spec item or a README is being written.
|
|
16
|
+
- A code comment, a commit body, a PR description is being written.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## A rule is one sentence
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
The rule itself fits in one sentence. After it — at most two sentences about what breaks
|
|
21
|
+
otherwise, and only if the sentence itself does not show it. A justification that had an
|
|
22
|
+
alternative goes into the pitfalls — the cold part of the rule — not into the law itself: a
|
|
23
|
+
bloated bullet is skimmed, and a law says what is true — not why it was once chosen so.
|
|
24
24
|
|
|
25
25
|
```
|
|
26
|
-
✗
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
✗ **A booking has at least one adult — on every write path, no exceptions.** The lower
|
|
27
|
+
bound is held by the database: there are three write paths, and a check in one of them
|
|
28
|
+
does not cover all. The upper bound (the property's capacity) cannot be expressed as a
|
|
29
|
+
database constraint — it lives in the property row and is changed by the owner.
|
|
30
30
|
|
|
31
|
-
✓
|
|
32
|
-
✓
|
|
31
|
+
✓ **A booking has at least one adult.** No exceptions: there is no check-in without adults.
|
|
32
|
+
✓ **Adults and children do not exceed the property's capacity.**
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## What is true, not where it is held
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
"The database holds it, not the service", "checked inside the transaction", "column default",
|
|
38
|
+
"on three write paths out of four", function and column names inside the sentence — that is the
|
|
39
|
+
structure of the code. The reader needs to know **what** is true.
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
The place of enforcement changes at the first refactoring, and a document naming it goes stale
|
|
42
|
+
silently. It has a separate file — `implementation.md` next to it.
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
The exception is the pitfalls in the rule's cold part: there the structure of the code is named
|
|
45
|
+
directly, because the pitfall is the very place where people step on it.
|
|
46
46
|
|
|
47
|
-
##
|
|
47
|
+
## No claims about the future
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
"Not planned", "will not be", "a separate feature on request" — that is the owner's intention,
|
|
50
|
+
not a property of the system. What is not done — yes; why not — yes; what will never be done —
|
|
51
|
+
no. Instead of a verdict — an open question `Q-<law letter>-<number>` with what the decision would
|
|
52
|
+
change.
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
The error is silent: a claim about the future has nothing to be checked against, it passes any
|
|
55
|
+
check. That is how "there is no online payment and none is planned" got into the first live spec,
|
|
56
|
+
while payment was in the plans.
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
Hence also: what is not in `docs/PRD.md`, the product document does not claim. A guess made while
|
|
59
|
+
retelling sounds more convincing than the source — it is shorter and more categorical.
|
|
58
60
|
|
|
59
|
-
##
|
|
61
|
+
## In plain words
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
Aphorisms, metaphors and inversions make reading harder and add nothing.
|
|
62
64
|
|
|
63
65
|
```
|
|
64
|
-
✗
|
|
65
|
-
✗
|
|
66
|
-
✗
|
|
66
|
+
✗ a record of the past must not run into a rule that appeared later
|
|
67
|
+
✗ the owner's own record must not be erased on the platform's silence
|
|
68
|
+
✗ an empty list without text and a failure without a button look the same — like a broken page
|
|
67
69
|
|
|
68
|
-
✓
|
|
69
|
-
✓
|
|
70
|
+
✓ a booking the owner entered by hand is not removed when the event disappears from the feed
|
|
71
|
+
✓ an empty list must have a text, a failure must have a retry button
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
The test: read the sentence aloud. If people do not talk like that — rewrite. The ear catches it
|
|
75
|
+
in the sentence being read and does not catch it in an eight-hundred-line file: the turn of
|
|
76
|
+
phrase surfaces throughout the text, and eyes do not count it.
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
A borrowed turn of phrase comes from what the writer has just read, and it hits hardest when
|
|
79
|
+
writing in the same genre: not a single word in such a sentence is outside the glossary, each
|
|
80
|
+
passes proofreading on its own, and it is the sentence as a whole that turns out to be
|
|
81
|
+
unintelligible. So the introductory paragraph is written last — once the source has faded.
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
`checks/check-prose-style.mjs`,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
The second half of the test is counting, and where the tree has laid out the prose check
|
|
84
|
+
`checks/check-prose-style.mjs`, the set of turns of phrase is accumulated in it: every marker is
|
|
85
|
+
named together with its replacement, and a find is printed with file and line. A turn of phrase
|
|
86
|
+
found by proofreading is added to the set in the same turn — otherwise the next writer starts
|
|
87
|
+
from scratch and rebuilds it from their own memory.
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
Not only the word is read, but also whether the sentence has one reading. Three causes of
|
|
90
|
+
unreadability come in turn, and fixing one starts the next — an article of a law was rewritten
|
|
91
|
+
three times, and each time the owner failed to understand it for a new reason:
|
|
90
92
|
|
|
91
93
|
```text
|
|
92
|
-
✗
|
|
93
|
-
✗
|
|
94
|
-
✗
|
|
94
|
+
✗ not telling them apart is not allowed — a double negative reads as the opposite of what was said
|
|
95
|
+
✗ each one shows where it came from — a pronoun without an owner, and "came from" names no action
|
|
96
|
+
✗ either lifted by the role, or kept forever — two outcomes joined by "or" with no rule for which one occurs
|
|
95
97
|
|
|
96
|
-
✓
|
|
98
|
+
✓ what was granted personally is revoked only personally: the role does not touch it
|
|
97
99
|
```
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
The argument "without this arrangement it would be so" does not go into the text at all: it
|
|
102
|
+
argues with what does not exist and reads as "what is this about?".
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
What neither the ear nor the check sees: repetition of a legitimate turn of phrase. Each
|
|
105
|
+
occurrence is legitimate on its own, but standing in the text by the dozen it is no longer a
|
|
106
|
+
device but a tic — the reader stops noticing it along with the meaning. This is counted by grep
|
|
107
|
+
over the text, and the number by itself is never a rejection: it is judged by whoever edits next.
|
|
106
108
|
|
|
107
|
-
##
|
|
109
|
+
## A new word in the glossary
|
|
108
110
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
A word that means something specific in the tree lives in the glossary. The order is four steps,
|
|
112
|
+
and the first is not skipped: the glossary is read before the text is written, not checked
|
|
113
|
+
afterwards.
|
|
111
114
|
|
|
112
|
-
1.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
1. **A search over the whole assembled glossary**, including the section of rejected words. A
|
|
116
|
+
word the tree has dropped stands right there — and introducing it anew means silently
|
|
117
|
+
overturning someone else's decision.
|
|
118
|
+
2. **Choosing your own section.** An override section replaces the package section of the same
|
|
119
|
+
name entirely: pick a name the set does not have.
|
|
120
|
+
3. **A line as a pair — the word and what it is.** Without the second half the word is not
|
|
121
|
+
introduced: it is merely named.
|
|
122
|
+
4. **Layout by the same change**, with the check green. A word entered into the override and not
|
|
123
|
+
laid out has not yet appeared for the reader.
|
|
119
124
|
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
A word the tree drops is filed in the same place with its replacement on the same line: a
|
|
126
|
+
rejection without a replacement cannot be acted on — the writer sees the ban and does not see
|
|
127
|
+
what closes it.
|
|
122
128
|
|
|
123
|
-
##
|
|
129
|
+
## A fact is checked, not recalled
|
|
124
130
|
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
Before writing that the code does X — open the code and look. A retelling from memory looks as
|
|
132
|
+
confident as a verified statement, and afterwards there is no way to tell them apart.
|
|
127
133
|
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
This applies to failures above all: "it will return `value out of range`" held on in two
|
|
135
|
+
documents although such a failure is unreachable — the contract and the column have the same
|
|
136
|
+
width.
|
|
130
137
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
**A statement about the state of another branch is read from it, not from your own copy.** The
|
|
139
|
+
copy taken at branching answers any question about a file's contents and shows by no sign how
|
|
140
|
+
far behind it is. Three times in one session the state of the shared branch was inferred from a
|
|
141
|
+
file on one's own branch, seven commits behind; all three inferences were wrong, one reached the
|
|
142
|
+
task document and was reported to the owner as fact. Caught by a rebase, that is, by accident.
|
|
136
143
|
|
|
137
144
|
```bash
|
|
138
145
|
git fetch origin
|
|
139
|
-
git show origin/main
|
|
146
|
+
git show origin/main:<path to file>
|
|
140
147
|
```
|
|
141
148
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
**A statement "all N such-and-such" is written after listing the routes by which a value reaches
|
|
150
|
+
a place, not after a scan by one sample.** A scan confirms exactly the route built into it and
|
|
151
|
+
is silent about all others — the more confidently, the more precise the sample. Places were
|
|
152
|
+
counted by the pattern of the call itself, 22 were found and written into the plan and the PR
|
|
153
|
+
description as "the order is held by the structure"; ten calls of a wrapper that takes the value
|
|
154
|
+
as an argument were missed. There were 32 places, and in ten the value stood as a literal.
|
|
148
155
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
**The command a number was obtained with is checked for measuring what was asked.** Command
|
|
157
|
+
output is no confirmation by itself: the tool answers the question it understood and is silent
|
|
158
|
+
about the part of the pattern it did not. Three numbers in a row in one session: a word boundary
|
|
159
|
+
not implemented in this build of the tool and not declared a failure gave 278 occurrences instead
|
|
160
|
+
of 79; counting calls by regular expression gave 32 and 42 on the same input, while by the syntax
|
|
161
|
+
tree there are 27.
|
|
154
162
|
|
|
155
|
-
|
|
156
|
-
|
|
163
|
+
**A number that came from a previous session does not count as a measurement.** It is
|
|
164
|
+
indistinguishable from a measured one and looks just as confident in a document; it is recomputed
|
|
165
|
+
in the same turn the text is written.
|
|
157
166
|
|
|
158
|
-
##
|
|
167
|
+
## Do not retell what has a source
|
|
159
168
|
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
|
|
164
|
-
- слои и имена классов — правило `lib-layers` и сам код.
|
|
169
|
+
- contract types and fields — `libs/common/proto/proto/<area>/v1/`, by link;
|
|
170
|
+
- columns and indexes — `prisma/schema.prisma`;
|
|
171
|
+
- numbers the owner edits (base price, min-nights, capacity) — only how they are applied;
|
|
172
|
+
- layers and class names — the rule `lib-layers` and the code itself.
|
|
165
173
|
|
|
166
|
-
##
|
|
174
|
+
## Code comments
|
|
167
175
|
|
|
168
|
-
|
|
169
|
-
|
|
176
|
+
The same rules. A comment answers "why so and not otherwise" — if the answer is not obvious.
|
|
177
|
+
What a line does is visible from the line.
|
|
170
178
|
|
|
171
|
-
|
|
172
|
-
|
|
179
|
+
A multi-line comment above every function is a sign that explanation has replaced naming. Rename
|
|
180
|
+
first, then write the comment.
|
|
173
181
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
182
|
+
A comment justifying a deviation from a rule holds that deviation up: as long as the explanation
|
|
183
|
+
looks convincing, the deviation is left alone. The fact in it is checked when the comment is
|
|
184
|
+
written and rechecked when the deviation is lifted.
|
|
177
185
|
|
|
178
|
-
##
|
|
186
|
+
## Common misses
|
|
179
187
|
|
|
180
|
-
-
|
|
181
|
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
185
|
-
|
|
188
|
+
- Another project named in a commit, a PR, a comment or a document. Neither the repository
|
|
189
|
+
name, nor "ported from", nor links to its files — anywhere.
|
|
190
|
+
- A number written from memory rather than recomputed by a command in the same commit.
|
|
191
|
+
- A plan item struck out from memory of the work rather than from the tree.
|
|
192
|
+
- Wording that sounds like a heading rather than a rule: "discount handling" cannot be violated,
|
|
193
|
+
"one maximum discount is applied" can.
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
name: entity-aside
|
|
3
3
|
kind: pattern
|
|
4
4
|
rule: entity-conventions
|
|
5
|
-
description:
|
|
5
|
+
description: Pattern of rule entity-conventions. Load when assembling or editing the record create-and-edit panel — the ready-made route in the ro outlet, inheriting the shared base, runMutation, the unsaved edits guard, header and footer, leaving for a linked record. Not for the store — pattern entity-store.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# The record edit panel
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Pattern of the rule `entity-conventions`. What must be true — the law
|
|
11
11
|
`docs/constitution/entity-editing.md`.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## When to use
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
15
|
+
- A panel that creates and edits a record is created or edited.
|
|
16
|
+
- A panel without a record appears — table settings, an event feed.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## The panel is declared by a route in the `ro` outlet
|
|
19
19
|
|
|
20
20
|
```typescript
|
|
21
21
|
{
|
|
@@ -25,24 +25,37 @@ description: Паттерн правила entity-conventions. Брать при
|
|
|
25
25
|
}
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
This way the panel survives a reload, is passed by link and lands in the browser history. There
|
|
29
|
+
is no programmatic opening through a service in the admin.
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
**The opening command goes from the current route, not from the root.** The outlet is declared
|
|
32
|
+
inside the domain's routes, so the screen calls the opening relative to itself:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
void this.#router.navigate([{ outlets: { ro: [EDIT_PATH, id] } }], { relativeTo: this.#route });
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Without the current route the command goes to the application root: the panel does not open,
|
|
39
|
+
there is no exception, the browser output is clean — the miss is seen only by eye and only by
|
|
40
|
+
whoever opened this screen. Its second half is quieter: the panel base closes it against the
|
|
41
|
+
parent of the current route, and a panel opened from the root does not close at all.
|
|
42
|
+
|
|
43
|
+
A panel opened from the header is declared as a constant and mixed into the `children` of every
|
|
44
|
+
domain branch — the outlet stands in the chrome template, and the chrome is put on by the
|
|
45
|
+
`shell` of every domain:
|
|
33
46
|
|
|
34
47
|
```typescript
|
|
35
48
|
export const ACTIVITY_ASIDE_ROUTES: Route[] = [{ path: 'activity', outlet: 'ro', component: ActivityFeedAsideComponent }];
|
|
36
49
|
```
|
|
37
50
|
|
|
38
|
-
##
|
|
51
|
+
## The screen inherits the shared base
|
|
39
52
|
|
|
40
|
-
`RtRouteAsideComponent<T>`
|
|
41
|
-
`resolving`, `submitError`,
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
`RtRouteAsideComponent<T>` holds `entity`, `entityId`, `isCreateMode`, `submitting`,
|
|
54
|
+
`resolving`, `submitError`, opening the panel by route, leaving the address and the whole
|
|
55
|
+
mechanics of saving. Names from the base are not renamed: `booking`, `feed`, `slug` instead of
|
|
56
|
+
`entity` break the very uniformity the base was set up for.
|
|
44
57
|
|
|
45
|
-
##
|
|
58
|
+
## Saving goes through `runMutation`
|
|
46
59
|
|
|
47
60
|
```typescript
|
|
48
61
|
protected save(): void {
|
|
@@ -58,14 +71,14 @@ protected save(): void {
|
|
|
58
71
|
}
|
|
59
72
|
```
|
|
60
73
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
The busy state, clearing the previous error, the success toast and closing the panel are held by
|
|
75
|
+
the base. `errorText` is a function: the reason of the refusal is known only after it. The
|
|
76
|
+
mutation stream must give a value or an error — an empty stream freezes the panel forever.
|
|
64
77
|
|
|
65
|
-
##
|
|
78
|
+
## The unsaved-edits guard
|
|
66
79
|
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
Set by the panel itself, and it stands on all four closing paths: the button in the header, the
|
|
81
|
+
button in the footer, a press outside the panel and Esc.
|
|
69
82
|
|
|
70
83
|
```typescript
|
|
71
84
|
protected readonly panelForm: Signal<NgForm | undefined> = viewChild(NgForm);
|
|
@@ -79,60 +92,61 @@ constructor() {
|
|
|
79
92
|
}
|
|
80
93
|
```
|
|
81
94
|
|
|
82
|
-
`viewChild`
|
|
95
|
+
Angular does not accept `viewChild` on a `#` field — the field is declared `protected`.
|
|
83
96
|
|
|
84
|
-
##
|
|
97
|
+
## Header and footer
|
|
85
98
|
|
|
86
99
|
```html
|
|
87
|
-
|
|
100
|
+
<<prefix>-aside-header [title]="title()" [overline]="overline()" [loading]="resolving()" (dismiss)="onClose()">
|
|
88
101
|
<ng-container asideActions>
|
|
89
|
-
<!--
|
|
102
|
+
<!-- domain actions as icons; more than two — under one menu button -->
|
|
90
103
|
</ng-container>
|
|
91
|
-
|
|
104
|
+
</<prefix>-aside-header>
|
|
92
105
|
```
|
|
93
106
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
107
|
+
The title names the action, the record name goes as the overline. The footer has two zones and no
|
|
108
|
+
more than two buttons: `asideDismiss` — closing, `asidePrimary` — saving. Domain verbs do not go
|
|
109
|
+
into the footer: confirming, rejecting, unpublishing — icons in the header.
|
|
97
110
|
|
|
98
|
-
|
|
111
|
+
The button captions are fixed, the panel does not choose them:
|
|
99
112
|
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
113
|
+
| Button | Caption |
|
|
114
|
+
| ---------------------------------- | ------------------------------------------------- |
|
|
115
|
+
| saving on create | «Создать» |
|
|
116
|
+
| saving on edit | «Сохранить» |
|
|
117
|
+
| closing a panel that saves | «Закрыть и не сохранять» (`uiCloseWithoutSaving`) |
|
|
118
|
+
| closing a view-only panel | «Закрыть» |
|
|
106
119
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
120
|
+
The save button stands at the edge opposite the close button, and while the request runs it
|
|
121
|
+
shows a spinner and cannot be pressed: the busy state comes from the base's `submitting()`, the
|
|
122
|
+
panel keeps no flag of its own. The header and the footer stay in place on scroll — only the
|
|
123
|
+
content zone scrolls.
|
|
111
124
|
|
|
112
|
-
##
|
|
125
|
+
## Leaving for a related record
|
|
113
126
|
|
|
114
127
|
```html
|
|
115
128
|
<a rtElem="related" qa-dataid="promo-code-property-link" [href]="propertyHref()" (click)="openProperty($event)">
|
|
116
|
-
{{ 'propertyOpenLink' | transloco }}
|
|
129
|
+
{{ 'propertyOpenLink' | transloco }} <<prefix>-icon name="arrow-right" size="sm" />
|
|
117
130
|
</a>
|
|
118
131
|
```
|
|
119
132
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
##
|
|
125
|
-
|
|
126
|
-
-
|
|
127
|
-
|
|
128
|
-
-
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
The address is given by `relatedUrl(commands)`, the leaving — by `openRelated(commands)`.
|
|
134
|
+
`routerLink` is no good here: the directive navigates itself, `preventDefault` does not stop it,
|
|
135
|
+
and it bypasses the question about unsaved edits.
|
|
136
|
+
|
|
137
|
+
## Common misses
|
|
138
|
+
|
|
139
|
+
- An own `router.navigate` in the panel: absolute commands change only the primary branch, the
|
|
140
|
+
outlet stays in the address, and the router rejects the navigation silently.
|
|
141
|
+
- Skeletons by `busy()`, not by `resolving()`: `busy` includes saving too, and on save the fields
|
|
142
|
+
would turn into skeletons.
|
|
143
|
+
- An own "not found" on the panel: a record that is not found leaves the address by the base's
|
|
144
|
+
own means.
|
|
145
|
+
- Own spacing on top of the shared base: it gives different field widths on different panels and
|
|
146
|
+
cuts off the focus outline at the edge of the scroll area.
|
|
147
|
+
- A panel that stays open after success did not reset pristineness (`markAsPristine`) — the
|
|
148
|
+
question about edits is asked right after saving.
|
|
149
|
+
- Disabled inputs instead of data: a record that is only viewed is shown by the kit's ready-made
|
|
150
|
+
property list — `<prefix>-detail-list`, `<prefix>-info-item`. Own markup on `<dl>` goes last
|
|
151
|
+
and only as a one-off deviation: it is the departure from the shared look, and the owner
|
|
152
|
+
decides it — a list that puts it first teaches to bypass the ready-made before asking.
|