@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* The scenarios of a domain and the level of their binding: what a scenario promises, by which test
|
|
3
|
+
* it is covered and whether the test is not switched off by an environment variable.
|
|
4
4
|
*/
|
|
5
5
|
import {
|
|
6
6
|
ACTOR,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
walk,
|
|
17
17
|
} from './spec-common.mjs';
|
|
18
18
|
|
|
19
|
-
// ── 4.
|
|
19
|
+
// ── 4. Scenarios and the level of binding ──────────────────────────────────────
|
|
20
20
|
|
|
21
21
|
function parseScenarios(file) {
|
|
22
22
|
const lines = read(file).split('\n');
|
|
@@ -36,6 +36,7 @@ function parseScenarios(file) {
|
|
|
36
36
|
uncovered: false,
|
|
37
37
|
partial: false,
|
|
38
38
|
promise: '',
|
|
39
|
+
body: '',
|
|
39
40
|
};
|
|
40
41
|
inPromise = false;
|
|
41
42
|
scenarios.push(current);
|
|
@@ -50,13 +51,16 @@ function parseScenarios(file) {
|
|
|
50
51
|
if (!current) {
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
54
|
+
// The body of the scenario whole: by it one sees whether a person is named in the scenario
|
|
55
|
+
// at all. A pronoun in the promise has nothing else to check itself against.
|
|
56
|
+
current.body += ` ${line.trim()}`;
|
|
53
57
|
if (UNCOVERED.test(line)) {
|
|
54
58
|
current.uncovered = true;
|
|
55
59
|
}
|
|
56
60
|
if (PARTIAL.test(line)) {
|
|
57
61
|
current.partial = true;
|
|
58
62
|
}
|
|
59
|
-
// «Тогда»
|
|
63
|
+
// «Тогда» and its continuations with an indent — what the scenario promises
|
|
60
64
|
if (PROMISE.test(line)) {
|
|
61
65
|
inPromise = true;
|
|
62
66
|
current.promise += ` ${line.trim()}`;
|
|
@@ -75,26 +79,45 @@ function parseScenarios(file) {
|
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
82
|
+
* A person named by a pronoun is the same person: «он видит тост об отказе» promises a screen
|
|
83
|
+
* exactly the same way as «гость видит тост об отказе». The pronoun is demanded as the subject at
|
|
84
|
+
* the verb of perception itself: a free link catches «он» about a request, a session and a counter
|
|
85
|
+
* as well, where the verb of perception stands in the other half of the line.
|
|
86
|
+
*/
|
|
87
|
+
const PRONOUN_PERCEIVES =
|
|
88
|
+
/(^|[^а-яё])(он|она|они)\s+(?:не\s+)?(?:вид(?:ит|ят)|чита(?:ет|ют)|смотр(?:ит|ят))|\b(?:he|she|they)\s+(?:does not |do not |never )?(?:sees?|reads?)\b/i;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Whether a screen is promised by the scenario. The sign is read only from «Тогда»: «Дано»
|
|
92
|
+
* describes the setting, «Когда» the occasion, and the promise to the user stands exactly here.
|
|
80
93
|
*
|
|
81
|
-
*
|
|
82
|
-
* «Показывается»
|
|
83
|
-
*
|
|
84
|
-
*
|
|
94
|
+
* A person and a verb of perception are demanded together, because apart both of them err.
|
|
95
|
+
* «Показывается» without a person stands where a record in the database is shown too, and a person
|
|
96
|
+
* without perception stands in every second scenario of taking in a request. The sign is silent on
|
|
97
|
+
* purpose: a scenario whose «Тогда» names no person does not fall under it at all.
|
|
98
|
+
*
|
|
99
|
+
* The second condition is a pronoun at the verb of perception, with a person named in the body of
|
|
100
|
+
* the scenario at that. Both are needed: a free link adds promises where «он» is about a request
|
|
101
|
+
* and a counter, and without the name of a person in the body the sign catches «домен решает, есть
|
|
102
|
+
* ли тревога; тогда он смотрит на прошлый час».
|
|
85
103
|
*/
|
|
86
|
-
function promisesScreen(promise) {
|
|
87
|
-
|
|
104
|
+
function promisesScreen(promise, body = '') {
|
|
105
|
+
if (ACTOR.test(promise) && PERCEIVES.test(promise)) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return ACTOR.test(body) && PRONOUN_PERCEIVES.test(promise);
|
|
88
110
|
}
|
|
89
111
|
|
|
90
112
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
113
|
+
* The constants assembled from the environment, together with those assembled from them. By them
|
|
114
|
+
* an end-to-end test is switched off whole: without `BASE_URL` or the sign-in pair it never runs.
|
|
115
|
+
* The chain is unfolded while there is something to unfold: `HAS_ADMIN_SESSION` is assembled from
|
|
116
|
+
* two other constants, not from `process.env` directly.
|
|
95
117
|
*/
|
|
96
118
|
function environmentSwitches(root) {
|
|
97
|
-
//
|
|
119
|
+
// A top-level declaration: the local ones stand with an indent, and they put out a case, not
|
|
120
|
+
// the test
|
|
98
121
|
const declaration = /^const\s+([A-Za-z_]\w*)\s*(?::[^=]+)?=\s*([^;]+);/gm;
|
|
99
122
|
const assignments = [];
|
|
100
123
|
for (const file of walk(root, (name) => name.endsWith('.ts'))) {
|
|
@@ -120,12 +143,12 @@ function environmentSwitches(root) {
|
|
|
120
143
|
}
|
|
121
144
|
|
|
122
145
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
146
|
+
* Mentions of the scenario in tests: where it stands, whether the test goes the way of the user and
|
|
147
|
+
* whether it is switched off by an environment variable.
|
|
125
148
|
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
149
|
+
* A switch by the state of the stand («the object has fewer than two rooms») is a skip of a case,
|
|
150
|
+
* and it does not cancel the coverage. A switch by a variable does cancel it: a test with one in an
|
|
151
|
+
* ordinary run counts as skipped, and without this the digest would read it as coverage.
|
|
129
152
|
*/
|
|
130
153
|
function collectReferences() {
|
|
131
154
|
const references = new Map();
|
|
@@ -175,15 +198,15 @@ function collectReferences() {
|
|
|
175
198
|
}
|
|
176
199
|
});
|
|
177
200
|
|
|
178
|
-
//
|
|
179
|
-
//
|
|
201
|
+
// The switch stands as the first line of the body, that is below the title of the test
|
|
202
|
+
// with the identifier: the state of the test is read when the file is taken apart whole
|
|
180
203
|
found.forEach(({ id, test: own, place }) => remember(id, { place, screen: Boolean(e2eRoot), off: Boolean(own?.off) }));
|
|
181
204
|
}
|
|
182
205
|
|
|
183
|
-
//
|
|
184
|
-
//
|
|
185
|
-
//
|
|
186
|
-
//
|
|
206
|
+
// Scenario suites in shell. That is how executable files are checked — guards, checks,
|
|
207
|
+
// defaults: they are not in TypeScript, and a suite for them is written in the same
|
|
208
|
+
// language as themselves. There are no switches here: there is nothing to skip a scenario
|
|
209
|
+
// with in such a suite, so finding the identifier is enough.
|
|
187
210
|
for (const file of walk(root, (name) => name.endsWith('.test.sh'))) {
|
|
188
211
|
read(file)
|
|
189
212
|
.split('\n')
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creating the task an edit starts with.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Creation is made of four steps, and the edit starts only after all four: the task, the number in
|
|
6
|
+
* its title, adding it to the board, the «Backlog» state. While the steps were rewritten by hand
|
|
7
|
+
* from a pattern, a miss on any of them gave a task that is not in the work queue: two such stood
|
|
8
|
+
* idle for a month.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* The command does not create the branch — it prints the ready line. Creating a branch by a call
|
|
11
|
+
* of its own is demanded by the main branch guard: the compound «create a branch and commit right
|
|
12
|
+
* away» it turns down whole.
|
|
13
13
|
*
|
|
14
|
-
* npm run task:new -- --title '
|
|
15
|
-
* npm run task:new -- --title '…' --slug mail-owner-silence <
|
|
14
|
+
* npm run task:new -- --title 'Letters to the owner are not sent' --label bug --label area:api
|
|
15
|
+
* npm run task:new -- --title '…' --slug mail-owner-silence < description.md
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* The body is read from standard input. The author and the assignee are the bot account, the same
|
|
18
|
+
* one the commits go from; `--assignee` overrides the assignee.
|
|
19
19
|
*/
|
|
20
20
|
import { cpSync, existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
21
21
|
import { dirname, join, resolve } from 'node:path';
|
|
@@ -63,7 +63,7 @@ function parseArgs(argv) {
|
|
|
63
63
|
index += 1;
|
|
64
64
|
break;
|
|
65
65
|
default:
|
|
66
|
-
fail(
|
|
66
|
+
fail(`unknown flag ${argv[index]}`);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
return args;
|
|
@@ -87,20 +87,21 @@ function readBody() {
|
|
|
87
87
|
|
|
88
88
|
const args = parseArgs(process.argv.slice(2));
|
|
89
89
|
if (!args.title) {
|
|
90
|
-
fail("
|
|
90
|
+
fail("--title '<Что не так>' is required");
|
|
91
91
|
}
|
|
92
92
|
if (numberFromTitle(args.title) !== null || args.title.startsWith(`[${TASK_KEY}-`)) {
|
|
93
|
-
fail('
|
|
93
|
+
fail('the number is not typed into the title by hand: it is known only after the creation and is appended by itself');
|
|
94
94
|
}
|
|
95
95
|
if (args.slug !== null && !/^[a-z0-9][a-z0-9-]*$/.test(args.slug)) {
|
|
96
|
-
fail('slug
|
|
96
|
+
fail('slug is lowercase latin letters, digits and dashes: the branch name is read in a list of fifty lines');
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
100
|
+
* The token of the machine account is optional: a tree that has not named it creates the task
|
|
101
|
+
* under the account the hosting client is logged in as. Demanding the token would hold task
|
|
102
|
+
* creation in a tree that has not created a machine account, and in a tree whose account the
|
|
103
|
+
* hosting has limited — and without creation no work starts at all. Who exactly created the task
|
|
104
|
+
* is read off the task itself.
|
|
104
105
|
*/
|
|
105
106
|
const token = botToken() ?? undefined;
|
|
106
107
|
|
|
@@ -124,10 +125,10 @@ try {
|
|
|
124
125
|
).trim();
|
|
125
126
|
number = Number(created.split('/').pop());
|
|
126
127
|
if (!Number.isInteger(number)) {
|
|
127
|
-
fail(
|
|
128
|
+
fail(`the number of the created task cannot be parsed in the answer: ${created}`);
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
//
|
|
131
|
+
// The number is known only now, so the title is appended by a second call.
|
|
131
132
|
gh(['api', '-X', 'PATCH', `repos/${OWNER}/${REPO}/issues/${number}`, '-f', `title=[${TASK_KEY}-${number}] ${args.title}`], {
|
|
132
133
|
token,
|
|
133
134
|
});
|
|
@@ -142,30 +143,30 @@ try {
|
|
|
142
143
|
{ token }
|
|
143
144
|
);
|
|
144
145
|
} catch (error) {
|
|
145
|
-
const reason = error instanceof OfflineError ?
|
|
146
|
+
const reason = error instanceof OfflineError ? `no connection to GitHub: ${error.message}` : String(error.message ?? error);
|
|
146
147
|
if (number === null) {
|
|
147
148
|
fail(reason);
|
|
148
149
|
}
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
console.error(`task-new:
|
|
152
|
-
console.error(`task-new:
|
|
150
|
+
// The task already exists, and it may not be on the board — exactly the state tasks were being
|
|
151
|
+
// lost by. Staying silent here is not allowed: the number is printed to finish it by hand.
|
|
152
|
+
console.error(`task-new: the task #${number} is created but not finished — ${reason}`);
|
|
153
|
+
console.error(`task-new: check it and finish it — npm run check:board`);
|
|
153
154
|
process.exit(1);
|
|
154
155
|
}
|
|
155
156
|
|
|
156
|
-
const branch = args.slug ? `${TASK_KEY}-${number}-${args.slug}` : `${TASK_KEY}-${number}
|
|
157
|
+
const branch = args.slug ? `${TASK_KEY}-${number}-${args.slug}` : `${TASK_KEY}-${number}-<short-slug>`;
|
|
157
158
|
|
|
158
159
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* `docs/tasks/_draft-<slug>`.
|
|
163
|
-
*
|
|
160
|
+
* The task folder is renamed here, because the number and the branch name are known at this moment
|
|
161
|
+
* for the only time in the whole work. The grill of the owner's request goes before the task is
|
|
162
|
+
* created — until the grill is over it is not even known how many tasks will come out of it — and
|
|
163
|
+
* lies in `docs/tasks/_draft-<slug>`. Left as a draft, it stays outside the history, and the next
|
|
164
|
+
* session does not find it: the startup hook looks for the folder by the branch name.
|
|
164
165
|
*/
|
|
165
166
|
|
|
166
167
|
function adoptDraft() {
|
|
167
168
|
if (!args.slug) {
|
|
168
|
-
console.log(`\
|
|
169
|
+
console.log(`\nThe task folder: --slug is not set, there is nothing to rename the draft by.`);
|
|
169
170
|
return;
|
|
170
171
|
}
|
|
171
172
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
@@ -173,36 +174,39 @@ function adoptDraft() {
|
|
|
173
174
|
const target = join(root, 'docs/tasks', branch);
|
|
174
175
|
|
|
175
176
|
if (existsSync(target)) {
|
|
176
|
-
console.log(`\
|
|
177
|
+
console.log(`\nThe task folder is already in place: docs/tasks/${branch}/`);
|
|
177
178
|
} else if (existsSync(draft)) {
|
|
178
179
|
renameSync(draft, target);
|
|
179
|
-
//
|
|
180
|
+
// The draft too is assembled from the sample, and the header in it is the same: it is
|
|
181
|
+
// taken off here as well.
|
|
180
182
|
unstampFolder(target);
|
|
181
|
-
console.log(`\
|
|
183
|
+
console.log(`\nThe task folder: docs/tasks/_draft-${args.slug}/ → docs/tasks/${branch}/`);
|
|
182
184
|
} else {
|
|
183
185
|
const template = join(root, 'docs/tasks/_template');
|
|
184
186
|
|
|
185
187
|
if (!existsSync(template)) {
|
|
186
|
-
console.log(`\
|
|
188
|
+
console.log(`\nThere is no task folder and nothing to assemble it from: the sample ${'docs/tasks/_template'} does not lie in the tree`);
|
|
187
189
|
return;
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
cpSync(template, target, { recursive: true });
|
|
191
193
|
unstampFolder(target);
|
|
192
|
-
console.log(`\
|
|
194
|
+
console.log(`\nThe task folder is assembled from the sample: docs/tasks/${branch}/`);
|
|
193
195
|
}
|
|
194
196
|
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
+
// The header of the plan is read by a guard: by it the guard finds the product agreement. The
|
|
198
|
+
// number in it is set right here — by hand it is copied over from a hint and mistyped.
|
|
197
199
|
const plan = join(target, 'plan.md');
|
|
198
200
|
if (!existsSync(plan)) {
|
|
199
201
|
return;
|
|
200
202
|
}
|
|
201
203
|
const before = readFileSync(plan, 'utf8');
|
|
202
|
-
|
|
204
|
+
// The key is read under two names: the package sample is English, and a tree folder created
|
|
205
|
+
// before the layer was translated is Russian. It is written in English.
|
|
206
|
+
const after = before.replace(/^\*\*(?:Task|Задача):\*\*.*$/m, `**Task:** ${TASK_KEY}-${number} · **Branch:** ${branch}`);
|
|
203
207
|
if (after !== before) {
|
|
204
208
|
writeFileSync(plan, after);
|
|
205
|
-
console.log(
|
|
209
|
+
console.log(`The header of the plan is filled in: docs/tasks/${branch}/plan.md`);
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
|
|
@@ -212,27 +216,52 @@ console.log(`[${TASK_KEY}-${number}] ${args.title}`);
|
|
|
212
216
|
console.log(`https://github.com/${OWNER}/${REPO}/issues/${number}`);
|
|
213
217
|
|
|
214
218
|
/**
|
|
215
|
-
*
|
|
219
|
+
* The fifth step: creation is confirmed by the answer of the work queue, not by the output of this
|
|
220
|
+
* command.
|
|
216
221
|
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
222
|
+
* All four steps above answer for their own calls and stay silent about whether the task is visible
|
|
223
|
+
* to whoever comes for it. Sixteen creations in a row printed the number with a link that way, and
|
|
224
|
+
* not one of them landed in the queue: the account was limited by the hosting, and the calls gave
|
|
225
|
+
* no refusal at that.
|
|
220
226
|
*/
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
+
/**
|
|
228
|
+
* This is read more than once. The queue does not hand back a new card the same second it was
|
|
229
|
+
* created, and the reading goes as the next call after the adding: two creations in a row printed
|
|
230
|
+
* that the task is not in the queue while the card was in place. A false refusal here costs more
|
|
231
|
+
* than a delay — it pushes to create the card a second time, and only an administrator can take it
|
|
232
|
+
* off the board.
|
|
233
|
+
*/
|
|
234
|
+
let unreachable = false;
|
|
235
|
+
|
|
236
|
+
function askQueue() {
|
|
237
|
+
try {
|
|
238
|
+
return describeTaskState(number, taskState(number, { token }));
|
|
239
|
+
} catch (error) {
|
|
240
|
+
// There was nothing to ask with — there is nothing to repeat: the answer is not late,
|
|
241
|
+
// there will be none at all.
|
|
242
|
+
unreachable = true;
|
|
243
|
+
const reason = error instanceof OfflineError ? error.message : String(error.message ?? error);
|
|
244
|
+
return describeTaskState(number, { offline: reason });
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** How long to wait between readings and how many times to re-read: the queue delay is seconds. */
|
|
249
|
+
const QUEUE_RETRIES = 3;
|
|
250
|
+
const QUEUE_PAUSE_MS = 1500;
|
|
251
|
+
|
|
252
|
+
let answer = askQueue();
|
|
253
|
+
for (let attempt = 1; !answer.ok && !unreachable && attempt < QUEUE_RETRIES; attempt += 1) {
|
|
254
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, QUEUE_PAUSE_MS);
|
|
255
|
+
answer = askQueue();
|
|
227
256
|
}
|
|
228
257
|
for (const line of answer.lines) {
|
|
229
258
|
(answer.ok ? console.log : console.error)(`task-new: ${line}`);
|
|
230
259
|
}
|
|
231
260
|
|
|
232
|
-
console.log(`\
|
|
233
|
-
console.log(
|
|
261
|
+
console.log(`\nThe branch is created by a separate call:\n git checkout -b ${branch}`);
|
|
262
|
+
console.log(`A task taken into work is moved on the board:\n npm run task:move -- ${number} ${IN_PROGRESS_STATUS}`);
|
|
234
263
|
|
|
235
264
|
if (!answer.ok) {
|
|
236
|
-
console.error(`task-new:
|
|
265
|
+
console.error(`task-new: check the whole work queue — npm run check:board`);
|
|
237
266
|
process.exit(1);
|
|
238
267
|
}
|
|
@@ -1,54 +1,57 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
3
|
-
argument-hint: '
|
|
2
|
+
description: A remark about the rules layer, made in the middle of work, lands as a block in the proposals file
|
|
3
|
+
argument-hint: '<what gets in the way, what was missing, what went wrong>'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Put the user's remark as a block into the proposals file. The remark: `$ARGUMENTS`
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
Called **in the middle of work**, not after it: what we stumbled on an hour ago is forgotten by
|
|
9
|
+
the review of the closed task, and the reply itself lives to the end of the session and dies
|
|
10
|
+
with it. The review of a closed task looks at what was loaded and at the progress; replies it
|
|
11
|
+
does not see at all.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
The command sends nothing. It puts a block on disk, and the ordinary send, called separately,
|
|
14
|
+
carries it away. Tell the user this in the last line — otherwise what was put is read as sent,
|
|
15
|
+
and they wait for a reply nobody sent.
|
|
15
16
|
|
|
16
|
-
## 1.
|
|
17
|
+
## 1. Understand what the remark is about
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
The user's remark is prose: "this rule gets in the way", "the gate demands the wrong thing",
|
|
20
|
+
"this is not in the rules at all". Your part is to turn it into three things:
|
|
20
21
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
22
|
+
- **the address** — where the edit goes;
|
|
23
|
+
- **the resource** — what exactly is edited;
|
|
24
|
+
- **the ready-made text** — exactly what to insert.
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
The address is one of three, and it is not chosen for convenience:
|
|
26
27
|
|
|
27
|
-
пакет —
|
|
28
|
-
компаньон — implementation.md
|
|
29
|
-
дерево —
|
|
28
|
+
пакет — an edit of a @rt-tools/agent-kit resource; true for any tree and goes outside
|
|
29
|
+
компаньон — implementation.md next to the rule: the names of this tree and the binding of articles
|
|
30
|
+
дерево — an override of this tree; never goes outside
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
`patterns/git-workflow-commit.md
|
|
32
|
+
The resource is named by the package identifier — `rules/styling-bem.md`, `hooks/skill-gate.sh`,
|
|
33
|
+
`patterns/git-workflow-commit.md` — and for the addresses "компаньон" and "дерево" by a path in
|
|
34
|
+
the tree.
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
**An unclear address is asked about, not assigned by guess.** A wrong address sends the edit to a
|
|
37
|
+
foreign repository: what was said about our tree goes to everyone, and what was said about
|
|
38
|
+
everyone stays lying at home. Until the user has answered, nothing is written to the file.
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
No need to ask when the address is visible from the remark itself: it is about a rule you have
|
|
41
|
+
just loaded — that is `пакет`; it is about the names, paths and commands of this tree —
|
|
42
|
+
`компаньон` or `дерево`.
|
|
40
43
|
|
|
41
|
-
## 2.
|
|
44
|
+
## 2. Find today's file
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
The block goes to the same place where the review of a closed task puts it: they have one
|
|
47
|
+
addressee and one format, and a second file next to it would mean that the send reads two
|
|
48
|
+
places, and the user does not remember in which one their remark lies.
|
|
46
49
|
|
|
47
50
|
```bash
|
|
48
51
|
ls .claude/rt-kit/proposals/$(date +%F)-*.md 2>/dev/null
|
|
49
52
|
```
|
|
50
53
|
|
|
51
|
-
|
|
54
|
+
Found — append to it. Not found — start one from the template, named by the branch:
|
|
52
55
|
|
|
53
56
|
```bash
|
|
54
57
|
mkdir -p .claude/rt-kit/proposals
|
|
@@ -56,48 +59,51 @@ cp .claude/rt-kit/templates/proposal.md \
|
|
|
56
59
|
".claude/rt-kit/proposals/$(date +%F)-$(git branch --show-current).md"
|
|
57
60
|
```
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
In a fresh file the template header stays, and the unfilled sample block — `rules/<правило>.md`
|
|
63
|
+
with the brackets — is replaced by your block: the send skips such a sample, but it lies there as
|
|
64
|
+
silent litter.
|
|
62
65
|
|
|
63
|
-
## 3.
|
|
66
|
+
## 3. Write the block
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
The heading form is not decoration: by it the send picks what goes outside. A block without an
|
|
69
|
+
address in the heading goes nowhere and stays lying silently.
|
|
67
70
|
|
|
68
71
|
```markdown
|
|
69
72
|
## <адрес> · <ресурс>
|
|
70
73
|
|
|
71
|
-
- **место:**
|
|
72
|
-
- **повод:**
|
|
73
|
-
- **ближайшее:**
|
|
74
|
+
- **место:** section «<heading>», at the end
|
|
75
|
+
- **повод:** what went wrong in this work without this rule
|
|
76
|
+
- **ближайшее:** «<the exact resource line this is closest to>» — <what it does not cover>
|
|
74
77
|
|
|
75
|
-
>
|
|
76
|
-
>
|
|
78
|
+
> The ready-made text of the edit — exactly what to insert, in the style of the neighbouring
|
|
79
|
+
> rules: in Russian, as a statement, without padding.
|
|
77
80
|
```
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
**The line «ближайшее» is mandatory, and it is the only one the machine checks.** The quote is
|
|
83
|
+
searched for in the resource, and one not found refuses the block: either the resource was not
|
|
84
|
+
read, or the statement has been rewritten since. There is nothing close at all — write exactly
|
|
85
|
+
that: «нет». It exists so that the resource gets read: a review ends with a proposal to add an
|
|
86
|
+
article to the very resource that already described the miss, and a second article about the
|
|
87
|
+
same thing costs more than its absence. A refused block stays lying with a mark and a reason — it
|
|
88
|
+
is visible that the review took place, and visible why it did not become an edit.
|
|
85
89
|
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
The reason is written from the case, not from a wish: "it was inconvenient here" does not become
|
|
91
|
+
a rule. The user's remark is retold by its meaning, not by your conclusions about how it should
|
|
92
|
+
have been.
|
|
88
93
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
**An address of this tree never appears in the block text** — no path, no root name, no name of a
|
|
95
|
+
foreign repository: the file goes to a foreign repository in full. A found address refuses the
|
|
96
|
+
send with the line number, and that is a check, not a reminder. Fix the text, do not bypass it.
|
|
92
97
|
|
|
93
|
-
## 4.
|
|
98
|
+
## 4. Say what came out
|
|
94
99
|
|
|
95
|
-
|
|
100
|
+
In one line: which file the block landed in, how many blocks it holds now and what will carry
|
|
101
|
+
it away.
|
|
96
102
|
|
|
97
103
|
```bash
|
|
98
|
-
npx agent-kit propose --dry-run #
|
|
99
|
-
npx agent-kit propose #
|
|
104
|
+
npx agent-kit propose --dry-run # what would have gone
|
|
105
|
+
npx agent-kit propose # send the cargo to the intake
|
|
100
106
|
```
|
|
101
107
|
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
The send carries away the blocks with the address «пакет» and marks them sent; the blocks
|
|
109
|
+
«компаньон» and «дерево» stay lying — they are edited by whoever works in this tree.
|