@rt-tools/agent-kit 0.24.0 → 0.27.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/assets/agents/business-analyst.md +51 -50
- package/assets/agents/cargo-writer.md +54 -0
- 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-epic-link.github.mjs +29 -0
- package/assets/checks/board-epics.github.mjs +286 -49
- 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 +29 -25
- package/assets/checks/board-paths.github.mjs +21 -16
- package/assets/checks/board-pull-state.github.mjs +168 -0
- package/assets/checks/board-runs.github.mjs +45 -43
- package/assets/checks/board-task-dirs.github.mjs +98 -0
- package/assets/checks/board-titles.github.mjs +19 -17
- package/assets/checks/board.github.mjs +133 -194
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +131 -263
- package/assets/checks/check-descriptions.mjs +30 -29
- package/assets/checks/check-doc-paths.mjs +91 -88
- package/assets/checks/check-dupes.mjs +84 -80
- package/assets/checks/check-file-size.mjs +74 -71
- 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 +138 -39
- package/assets/checks/check-push-gate.mjs +53 -50
- package/assets/checks/check-reuse.mjs +50 -40
- package/assets/checks/check-schema-drift.mjs +104 -84
- 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/epic-table.github.mjs +268 -0
- 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 +187 -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/specs-for.mjs +214 -0
- package/assets/checks/task-new.github.mjs +315 -61
- package/assets/commands/feedback.md +65 -59
- package/assets/commands/next-session.md +64 -57
- package/assets/commands/night.md +115 -0
- package/assets/commands/skill-curator.md +83 -79
- package/assets/defaults/gate-map.sh +108 -97
- package/assets/defaults/project.sh +232 -185
- package/assets/defaults/shell.sh +73 -68
- package/assets/defaults/turn-map.md +47 -44
- package/assets/docs/GLOSSARY.md +142 -65
- package/assets/hooks/browser-device-id.sh +16 -12
- package/assets/hooks/browser-guard-device-id.sh +34 -28
- 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 +14 -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 +50 -43
- package/assets/hooks/dispatch.sh +60 -46
- package/assets/hooks/docs-guard.sh +100 -91
- package/assets/hooks/epic-over.sh +49 -0
- package/assets/hooks/epic-stop-guard.sh +108 -0
- package/assets/hooks/exam-guard.sh +105 -93
- package/assets/hooks/git-guard-delivery-conflict.sh +41 -36
- package/assets/hooks/git-guard-delivery-draft.sh +48 -38
- package/assets/hooks/git-guard-delivery-epic.sh +167 -0
- package/assets/hooks/git-guard-delivery-folder.sh +50 -43
- package/assets/hooks/git-guard-delivery-signature.sh +119 -53
- package/assets/hooks/git-guard-delivery.sh +223 -183
- package/assets/hooks/git-guard-main.sh +38 -34
- package/assets/hooks/git-guard-push-tests.sh +99 -87
- 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 +45 -25
- package/assets/hooks/handoff-write.sh +74 -67
- package/assets/hooks/hook-input.sh +67 -58
- 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 +49 -24
- package/assets/hooks/qa-dataid-guard.sh +83 -58
- 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 +39 -34
- package/assets/hooks/rule-source-guard.sh +47 -42
- package/assets/hooks/skill-gate-layers.sh +63 -57
- package/assets/hooks/skill-gate-rearm.sh +15 -8
- package/assets/hooks/skill-gate.sh +89 -81
- package/assets/hooks/skill-loaded.sh +10 -6
- package/assets/hooks/sql-guard-parse.sh +71 -66
- package/assets/hooks/sql-guard-request.sh +51 -46
- package/assets/hooks/sql-guard-target.sh +60 -51
- package/assets/hooks/sql-guard-write.sh +87 -79
- package/assets/hooks/sql-guard.sh +52 -47
- package/assets/hooks/stand-login-guard.sh +43 -37
- 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 +260 -204
- package/assets/hooks/turn-exit-patterns.sh +63 -0
- package/assets/hooks/utf8.sh +14 -11
- package/assets/hooks/waiting-turn-guard.sh +104 -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 +99 -44
- package/assets/laws/autonomous-work.md +29 -27
- package/assets/laws/code-structure.md +31 -30
- package/assets/laws/delivery.md +170 -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 -124
- package/assets/laws/work-conduct.md +250 -244
- 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 +124 -88
- package/assets/patterns/browser-verification-stand.md +169 -157
- package/assets/patterns/component-structure-new.md +51 -42
- package/assets/patterns/dependencies-upgrade.md +55 -39
- package/assets/patterns/doc-style-human.md +55 -37
- 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 -87
- package/assets/patterns/git-workflow-commit.github.md +160 -142
- package/assets/patterns/git-workflow-commit.gitlab.md +96 -90
- 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 +102 -94
- 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 +127 -122
- package/assets/patterns/git-workflow-pr.github.md +186 -177
- package/assets/patterns/git-workflow-pr.gitlab.md +139 -132
- 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 +136 -107
- 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 +48 -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 +234 -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 +228 -202
- package/assets/patterns/testing-e2e.md +102 -101
- 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 +172 -142
- package/assets/pitfalls/doc-style.md +96 -91
- package/assets/pitfalls/git-workflow.azure.md +49 -46
- package/assets/pitfalls/git-workflow.github.md +270 -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 +87 -74
- package/assets/rules/browser-verification.md +223 -214
- 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 +201 -173
- 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 +268 -239
- 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 -143
- package/assets/rules/shared-code.md +82 -79
- package/assets/rules/spec-driven.md +279 -260
- package/assets/rules/status-report.md +62 -58
- package/assets/rules/styling-bem.md +81 -77
- package/assets/rules/task-flow.md +303 -270
- package/assets/rules/testing.md +224 -209
- package/assets/rules/turn-conduct.md +262 -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 +259 -233
- 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/bin/agent-kit.d.ts.map +1 -1
- package/bin/agent-kit.js +8 -1
- package/bin/agent-kit.js.map +1 -1
- package/lib/cargo-prose.d.ts +41 -0
- package/lib/cargo-prose.d.ts.map +1 -0
- package/lib/cargo-prose.js +88 -0
- package/lib/cargo-prose.js.map +1 -0
- package/lib/cargo.d.ts +12 -1
- package/lib/cargo.d.ts.map +1 -1
- package/lib/cargo.js +8 -2
- package/lib/cargo.js.map +1 -1
- 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 +5 -2
- 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 +12 -3
- package/lib/enroll.js.map +1 -1
- package/lib/fate.d.ts +29 -0
- package/lib/fate.d.ts.map +1 -0
- package/lib/fate.js +147 -0
- package/lib/fate.js.map +1 -0
- package/lib/override-marks.d.ts +7 -0
- package/lib/override-marks.d.ts.map +1 -1
- package/lib/override-marks.js +14 -0
- package/lib/override-marks.js.map +1 -1
- 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 +29 -9
- package/lib/ship.d.ts.map +1 -1
- package/lib/ship.js +44 -2
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.fixture.d.ts +8 -1
- package/lib/shipment.fixture.d.ts.map +1 -1
- package/lib/shipment.fixture.js +9 -0
- package/lib/shipment.fixture.js.map +1 -1
- package/lib/shipment.js +38 -5
- 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.27.0.tgz +0 -0
- package/rt-tools-agent-kit-0.24.0.tgz +0 -0
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
name: entity-models-new
|
|
3
3
|
kind: pattern
|
|
4
4
|
rule: entity-models
|
|
5
|
-
description:
|
|
5
|
+
description: Pattern of rule entity-models. Load when declaring a new entity model and its mapper — the ready-made I<Entity> namespace with Api, State and Draft, short and full levels, a BaseMapper heir with typeCast, what to do after editing .proto.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Declaring an entity model and its translation
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Pattern of the rule `entity-models`. What must be true — the law
|
|
11
11
|
`docs/constitution/entity-models.md`.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## When to use
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
15
|
+
- A new admin entity is created.
|
|
16
|
+
- An existing one gets a short level.
|
|
17
|
+
- The mapper or the contract of this entity is edited.
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## The model — a namespace in the domain's `util`
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
The file `libs/<family>/<domain>/util/src/lib/models/<entity>.model.ts`:
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
24
|
export namespace IPromoCode {
|
|
@@ -35,13 +35,13 @@ export namespace IPromoCode {
|
|
|
35
35
|
|
|
36
36
|
export interface State extends Short.State {
|
|
37
37
|
readonly usageCount: number;
|
|
38
|
-
/**
|
|
38
|
+
/** Empty = the code applies to any property of the owner */
|
|
39
39
|
readonly propertyId: string;
|
|
40
|
-
/** 0 =
|
|
40
|
+
/** 0 = no limit */
|
|
41
41
|
readonly usageLimit: number;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
/**
|
|
44
|
+
/** What goes to the server on save: an empty id — the code is new */
|
|
45
45
|
export interface Draft {
|
|
46
46
|
readonly id: string;
|
|
47
47
|
readonly code: string;
|
|
@@ -54,19 +54,19 @@ export enum EPromoDiscountKind {
|
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
The domain's enums lie in the same file, but **outside** the namespace. No deeper than two levels
|
|
58
|
+
of nesting: `IPromoCode.Short.State` reads, a third level no longer does.
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
The query aliases are declared in the same place:
|
|
61
61
|
|
|
62
62
|
```typescript
|
|
63
63
|
export type Query = IList.Query.State<EPromoCodeSortProperty, EPromoCodeFilterProperty>;
|
|
64
64
|
export type ListResult = IList.Result.State<IPromoCode.State, EPromoCodeSortProperty, EPromoCodeFilterProperty>;
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
##
|
|
67
|
+
## The mapper — in the domain's `api`, one per level
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
The file `libs/<family>/<domain>/api/src/lib/mappers/<entity>-model.mapper.ts`:
|
|
70
70
|
|
|
71
71
|
```typescript
|
|
72
72
|
export class PromoCodeModelMapper extends BaseMapper<IPromoCode.State> {
|
|
@@ -81,44 +81,44 @@ export class PromoCodeModelMapper extends BaseMapper<IPromoCode.State> {
|
|
|
81
81
|
}
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
The mapper has no state and no DI:
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
87
|
readonly #mapper: PromoCodeModelMapper = new PromoCodeModelMapper();
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
One class per level: `PromoCodeShortModelMapper` and `PromoCodeModelMapper`.
|
|
91
91
|
|
|
92
|
-
##
|
|
92
|
+
## A string field with a finite set is checked explicitly
|
|
93
93
|
|
|
94
|
-
`getAsType`
|
|
95
|
-
|
|
94
|
+
`getAsType` accepts no default: a value outside the set it writes to the console and returns as
|
|
95
|
+
the string `'unknown'`.
|
|
96
96
|
|
|
97
97
|
```typescript
|
|
98
98
|
kind: promoDiscountKindOf(raw?.kind) ?? EPromoDiscountKind.Percent,
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
##
|
|
101
|
+
## After editing the contract
|
|
102
102
|
|
|
103
103
|
```bash
|
|
104
104
|
cd libs/common/proto && npx buf lint
|
|
105
105
|
npm run proto:generate
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
Neither `buf lint` nor `buf breaking` is part of `check:all` or CI — they are run by hand. The
|
|
109
|
+
generated types lie in the repository, and without regeneration the divergence surfaces in the
|
|
110
|
+
build of another application.
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
A removed field is marked `reserved` with its number and name.
|
|
113
113
|
|
|
114
|
-
##
|
|
114
|
+
## Common misses
|
|
115
115
|
|
|
116
|
-
- `Api`
|
|
117
|
-
- `??`
|
|
118
|
-
|
|
119
|
-
- `as Type`
|
|
120
|
-
- `null`
|
|
121
|
-
|
|
122
|
-
- `readonly
|
|
123
|
-
|
|
124
|
-
-
|
|
116
|
+
- `Api` rewritten by hand instead of an alias — diverges from the contract silently.
|
|
117
|
+
- `??` instead of `typeCast` — the contract returns default values, and a check for `undefined`
|
|
118
|
+
catches nothing.
|
|
119
|
+
- `as Type` in a mapper — forbidden by rule `typescript-conventions`.
|
|
120
|
+
- `null` or `undefined` in `State` — empty is expressed by an empty string or zero, and the
|
|
121
|
+
meaning of zero is explained by a comment next to the field.
|
|
122
|
+
- A `readonly` array handed to a request: the message's init type demands a mutable one, the
|
|
123
|
+
model hands out a copy.
|
|
124
|
+
- A shared type for the admin and the site — the guest has its own short shape of the record.
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
name: entity-store
|
|
3
3
|
kind: pattern
|
|
4
4
|
rule: entity-conventions
|
|
5
|
-
description:
|
|
5
|
+
description: Pattern of rule entity-conventions. Load when creating or editing an admin store — the ready-made heir of the shared list store base, the mutate harness, method names from the action, an action with its own busy flag. Not for the panel — that is pattern entity-aside.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# The entity store
|
|
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
|
+
- An `<entity>.store.ts` is created.
|
|
16
|
+
- The load or save method of an existing store is edited.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## The heir declares its own in four lines
|
|
19
19
|
|
|
20
20
|
```typescript
|
|
21
21
|
@Injectable()
|
|
@@ -42,14 +42,15 @@ export class PromoCodesStore extends BaseListStoreService<
|
|
|
42
42
|
}
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
The config decides what goes into the query. With everything off there is no query at all, and
|
|
46
|
+
the server returns the whole list. From the base come loading and re-reading, changing the page,
|
|
47
|
+
the order, the filter conditions and the search string, loading the next page, editing one record
|
|
48
|
+
in the list and resetting the query.
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
The file is called `<entity>.store.ts`: the name `<entity>-store.service.ts` takes it out of both
|
|
51
|
+
the linter rule and the rule gate.
|
|
51
52
|
|
|
52
|
-
##
|
|
53
|
+
## The save method returns a stream
|
|
53
54
|
|
|
54
55
|
```typescript
|
|
55
56
|
public save(draft: IPromoCode.Draft): Observable<IPromoCode.State | null> {
|
|
@@ -57,12 +58,11 @@ public save(draft: IPromoCode.Draft): Observable<IPromoCode.State | null> {
|
|
|
57
58
|
}
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
`mutate`
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
значение.
|
|
61
|
+
`mutate` holds the busy state, clearing the previous error, re-reading the list after success
|
|
62
|
+
and the refusal key. A mutation ends with a **re-read list**, not with a sent request: the panel
|
|
63
|
+
closes on the stream's value, and a list re-read after closing would show the previous value.
|
|
64
64
|
|
|
65
|
-
##
|
|
65
|
+
## Names — from the action, not from the domain
|
|
66
66
|
|
|
67
67
|
| ✗ | ✓ |
|
|
68
68
|
| ------------------------------------ | ---------- |
|
|
@@ -70,22 +70,22 @@ public save(draft: IPromoCode.Draft): Observable<IPromoCode.State | null> {
|
|
|
70
70
|
| `deleteBooking()`, `removeFeed()` | `remove()` |
|
|
71
71
|
| `loadBookings()`, `fetchFeeds()` | `load()` |
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
The domain name is already in the store name and in its alias.
|
|
74
74
|
|
|
75
|
-
##
|
|
75
|
+
## An action with a busy state of its own
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
Goes past `mutate`: calendar subscription polling keeps `pollingId`, because the panel is not
|
|
78
|
+
frozen for the minute of polling, and the refusal key is put by `setErrorKey`.
|
|
79
79
|
|
|
80
|
-
##
|
|
80
|
+
## Common misses
|
|
81
81
|
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
|
|
82
|
+
- A boolean answer from the save method: it loses both the saved record and the reason of the
|
|
83
|
+
refusal — the panel learns only "it did not work".
|
|
84
|
+
- An own busy-and-error harness around the service call: all of that is in `mutate`.
|
|
85
|
+
- Own signals of records, busy state and refusal: they are in the shared base.
|
|
86
|
+
- A subscription to the load refusal signal: the signal is shared by the list and the panel, and
|
|
87
|
+
one refusal would show twice. The load refusal goes as a separate stream.
|
|
88
|
+
- A second sort field: the query has one order — neither the table, nor the contract, nor the
|
|
89
|
+
parsing on the server accepts a second one.
|
|
90
|
+
- A tail with `EMPTY` glued to a mutation: it is handled by `defaultIfEmpty`, otherwise a refusal
|
|
91
|
+
of the glued stream turns a successful save into an endless spinner.
|
|
@@ -2,136 +2,140 @@
|
|
|
2
2
|
name: git-workflow-commit
|
|
3
3
|
kind: pattern
|
|
4
4
|
rule: git-workflow
|
|
5
|
-
description:
|
|
5
|
+
description: Pattern of rule git-workflow. Load for creating a work item and a branch, commit and push — an item with area and iteration, state transition, merging two tasks into one, working as the machine account, skipping the document requirement. Opening a PR — pattern git-workflow-pr.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Task, branch and commit
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Pattern of the rule `git-workflow`. What must be true meanwhile — the law
|
|
11
11
|
`docs/constitution/delivery.md`.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## When to use
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
15
|
+
- A work item is being created, and the edit starts from it.
|
|
16
|
+
- A branch is being created for it.
|
|
17
|
+
- A commit or a push is being prepared.
|
|
18
|
+
- The work moved to the next step, and the item moves to another state.
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## First the work item, then the branch
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
Creation is four steps: the item, the number in its title, the assignee, the state `New`. Area and
|
|
23
|
+
iteration are set right there: an item without them lies in the project root and does not reach
|
|
24
|
+
the team board — created, but not in the work queue.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
All four are done by one tree command, not by hand: splitting them means forgetting the last.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
**A command that does not exist is not replaced by client calls in the pattern.** A tree that
|
|
29
|
+
takes the package for the first time gets the check files, but not the entries about them in its
|
|
30
|
+
manifest: the layout edits resources, and the consumer's manifest does not belong to it. Two ways
|
|
31
|
+
from here: create the command in the same turn, or repeat all its steps by name from the list
|
|
32
|
+
above. A bypass by client calls looks like execution up to the last step of the list: it is
|
|
33
|
+
forgotten first, because the previous ones have already given a visible result.
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
npm run task:new -- --title 'Письма владельцу не уходят молча' \
|
|
37
37
|
--type Bug --area '<проект>\<команда>' --slug mail-owner-silence < описание.md
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
The script under this command is created by the project — the package does not ship it. What it
|
|
41
|
+
does by `az` calls:
|
|
41
42
|
|
|
42
43
|
```bash
|
|
43
44
|
az boards work-item create --type Bug --title '[<номер>] …' \
|
|
44
45
|
--org https://dev.azure.com/<организация> --project <проект> \
|
|
45
46
|
--assigned-to <бот> --area '<проект>\<команда>' --iteration '<проект>\<итерация>'
|
|
46
|
-
az boards work-item update --id <номер> --title '[<номер>] …' #
|
|
47
|
+
az boards work-item update --id <номер> --title '[<номер>] …' # the number is known after creation
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
The number is not written into the title by hand — it is known only after creation, and the
|
|
51
|
+
command appends it itself.
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
Creation ends not with the command's output but with the work queue's answer. The command asks
|
|
54
|
+
it itself and prints what it read — presence on the board, the state, the assignee; absence ends
|
|
55
|
+
it with a non-zero code. That answer goes into the comment, the PR body and the plan, not the
|
|
56
|
+
printed number: the number says "the call went through", not "the work is visible to whoever
|
|
57
|
+
comes for it".
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
Creations that go one after another are checked not by the last one but by an audit of the whole
|
|
60
|
+
queue: their miss is shared, and by one item it is invisible.
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
What to check the work queue with:
|
|
61
63
|
|
|
62
64
|
```bash
|
|
63
65
|
npm run check:board
|
|
64
66
|
```
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
It looks only at what is open: the state, the area and the assignee of every open item, and for
|
|
69
|
+
every open PR — the number in the title, the attached item and that there is no second PR with
|
|
70
|
+
the same number. It does not judge the branch name: an open PR cannot have it renamed.
|
|
69
71
|
|
|
70
|
-
##
|
|
72
|
+
## Two tasks fixed by one edit
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
If it turned out along the way that the edit closes the neighbouring item too — that is one task,
|
|
75
|
+
not two. They can be merged while the edit has not reached the main branch:
|
|
74
76
|
|
|
75
77
|
```bash
|
|
76
|
-
#
|
|
78
|
+
# what the absorbing item lacked is appended to its description
|
|
77
79
|
az boards work-item update --id <поглотивший> --description "$(cat тело.md)"
|
|
78
|
-
#
|
|
80
|
+
# the absorbed one is linked to it as a duplicate and closed
|
|
79
81
|
az boards work-item relation add --id <поглощённый> --relation-type duplicate-of \
|
|
80
82
|
--target-id <поглотивший>
|
|
81
83
|
az boards work-item update --id <поглощённый> --state 'Removed'
|
|
82
84
|
```
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
The link is set before closing: an item closed without it reads as done, and it was not done. The
|
|
87
|
+
state of a removed item depends on the project process — `Removed` exists in Agile and Scrum, and
|
|
88
|
+
Basic does not have it; which one is here, `implementation.md` says.
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
After the branch is merged there is no absorbing: it went in, and it is reverted whole.
|
|
89
91
|
|
|
90
|
-
##
|
|
92
|
+
## The branch is created by a separate call
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
The main branch guard parses the command text and looks at the branch at launch, so a compound
|
|
95
|
+
command is rejected whole — the branch does not exist in it yet:
|
|
94
96
|
|
|
95
97
|
```bash
|
|
96
98
|
✗ git checkout -b 85-guest-token && git commit -m 'feat(admin): …'
|
|
97
|
-
✓ git checkout -b 85-guest-token
|
|
99
|
+
✓ git checkout -b 85-guest-token <ветка эпика>
|
|
98
100
|
✓ git commit -F -
|
|
99
101
|
```
|
|
100
102
|
|
|
101
|
-
|
|
102
|
-
`implementation.md`.
|
|
103
|
-
|
|
103
|
+
The name carries the item number, the slug in lowercase Latin letters joined by hyphens; the exact
|
|
104
|
+
form — in `implementation.md`. The delivery guard parses it on the spot and refuses a miss before
|
|
105
|
+
the first commit, and by the number it asks the board: the item must exist, be open and have an
|
|
106
|
+
assignee.
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
PR
|
|
108
|
+
A name without a number (`feat/…`, `fix/…`) is legitimate while the branch lives locally — for a
|
|
109
|
+
trial and an analysis. No PR opens from it: an edit that reaches the main branch starts with a
|
|
110
|
+
task.
|
|
107
111
|
|
|
108
|
-
##
|
|
112
|
+
## The item state moves together with the work
|
|
109
113
|
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
Branch created — the item is no longer `New` but `Active`. PR opened — it awaits review. Both
|
|
115
|
+
moves are done by one command, as a second call right after the one that caused it:
|
|
112
116
|
|
|
113
117
|
```bash
|
|
114
|
-
npm run task:move -- 86 in-progress #
|
|
115
|
-
npm run task:move -- 86 in-review #
|
|
118
|
+
npm run task:move -- 86 in-progress # right after git checkout -b 86-…
|
|
119
|
+
npm run task:move -- 86 in-review # right after az repos pr create
|
|
116
120
|
```
|
|
117
121
|
|
|
118
|
-
|
|
122
|
+
Under it — an edit of the state field:
|
|
119
123
|
|
|
120
124
|
```bash
|
|
121
125
|
az boards work-item update --id 86 --state 'Active'
|
|
122
126
|
```
|
|
123
127
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
State names are taken from the project process, not assigned by the rule: Agile, Scrum and Basic
|
|
129
|
+
call the same three steps differently, and a move to a state the process does not have answers
|
|
130
|
+
with a refusal on every task in a row.
|
|
127
131
|
|
|
128
|
-
|
|
132
|
+
The move is not put off for later: the work queue is read between steps, not after them.
|
|
129
133
|
|
|
130
|
-
##
|
|
134
|
+
## The commit is signed by the machine account
|
|
131
135
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
The token is read into a variable and not printed; author and committer are set by variables of
|
|
137
|
+
the same command. `git config` will not do — the config is shared with the main tree and would
|
|
138
|
+
rewrite the signature to the owner:
|
|
135
139
|
|
|
136
140
|
```bash
|
|
137
141
|
TOKEN=$(tr -d '\n' < ~/.config/<дерево>-bot-token)
|
|
@@ -141,33 +145,36 @@ GIT_COMMITTER_NAME="<бот>" GIT_COMMITTER_EMAIL="<почта бота>" \
|
|
|
141
145
|
git commit -F -
|
|
142
146
|
```
|
|
143
147
|
|
|
144
|
-
|
|
145
|
-
`test`, `chore`, `perf`.
|
|
146
|
-
|
|
148
|
+
The subject — `type(scope): description`. Types: `feat`, `fix`, `refactor`, `docs`, `style`,
|
|
149
|
+
`test`, `chore`, `perf`. Scopes are the tree's own, listed in `implementation.md`. A full stop
|
|
150
|
+
at the end of the subject is not accepted.
|
|
147
151
|
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
The line `AB#<номер>` in the commit body attaches it to the work item. It does not replace the
|
|
153
|
+
attachment of the PR itself: the commit is linked to the item, and the work queue reads the PR's
|
|
154
|
+
link.
|
|
150
155
|
|
|
151
|
-
##
|
|
156
|
+
## The document goes in the same commit
|
|
152
157
|
|
|
153
|
-
`docs-guard`
|
|
158
|
+
`docs-guard` demands the pair and names it itself. The bypass — a line in the body, the reason
|
|
159
|
+
is mandatory:
|
|
154
160
|
|
|
155
161
|
```
|
|
156
162
|
Docs-skip: правка только в тестах хука, зеркала у него нет
|
|
157
163
|
```
|
|
158
164
|
|
|
159
|
-
##
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
165
|
+
## Common misses
|
|
166
|
+
|
|
167
|
+
- **An audit right after adding answers "no" when the card already stands.** The work queue gives
|
|
168
|
+
out a new item not in the same second it was created, and the last step reads it by the next
|
|
169
|
+
call. The answer to this is to reread the whole queue, not to create the card a second time: two
|
|
170
|
+
records about one task are removed only by an administrator. The creation command itself needs
|
|
171
|
+
an edit here: the state is read right after the mutation, without a retry, and a false refusal
|
|
172
|
+
here costs more than a delay.
|
|
173
|
+
- Area and iteration are not set: the item is created, but it did not reach the team board.
|
|
174
|
+
- The state is not taken from the project process: the move answers with a refusal on every task,
|
|
175
|
+
and this reads as a broken command, not as a wrong state name.
|
|
176
|
+
- `git add` with several paths adds nothing if even one path does not exist: the command breaks
|
|
177
|
+
off whole at the first miss. The next `git commit --amend` then carries into the commit
|
|
178
|
+
everything left in the index. The commit contents are read by `git show --stat` right after it,
|
|
179
|
+
not at PR review.
|
|
180
|
+
- The owner's edit takes neither the token nor the variables — they are only for machine work.
|