@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
|
@@ -1,81 +1,77 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Shared work with the work queue: the project board, the tasks and their state.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* без добавления на борду, и две задачи так и простояли вне очереди.
|
|
5
|
+
* One question — "is task N in order?" — is asked by three callers: the task creation command
|
|
6
|
+
* (tools/task-new.mjs), the queue audit (tools/check-board.mjs) and the delivery guard
|
|
7
|
+
* (.claude/hooks/git-guard-delivery.sh). While the answer stood as ready-made lines in a pattern,
|
|
8
|
+
* each answered its own way: two tasks were created outside the board that way.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* The board is not bound to the repository — its `projectsV2` is empty — so a task lands on it
|
|
11
|
+
* only by an explicit call. The guard calls this file as a command: `node tools/board.mjs task
|
|
12
|
+
* <number>` prints the task state as one line of JSON; `move <number> <column>` moves its column,
|
|
13
|
+
* also `npm run task:move`.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* `node tools/board.mjs move <номер> <колонка>`, он же `npm run task:move`.
|
|
17
|
-
*
|
|
18
|
-
* Нет сети или нет токена — это не расхождение, а невозможность проверить:
|
|
19
|
-
* функции возвращают `null`, командный режим печатает `{"offline":true}`.
|
|
15
|
+
* No network or no token is an inability to check, not a discrepancy: the functions return `null`,
|
|
16
|
+
* the command mode prints `{"offline":true}`.
|
|
20
17
|
*/
|
|
21
|
-
import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
22
|
-
import { join } from 'node:path';
|
|
23
|
-
|
|
24
18
|
import { OfflineError, botToken, gh, ghJson, graphql } from './board-gh.mjs';
|
|
25
|
-
import {
|
|
19
|
+
import { declaredEpicOf } from './board-epic-link.mjs';
|
|
20
|
+
export { numberFromTaskDir, taskDirs, unstampFolder } from './board-task-dirs.mjs';
|
|
21
|
+
import { CONFIG } from './rt-kit-checks.config.mjs';
|
|
26
22
|
|
|
27
|
-
//
|
|
28
|
-
//
|
|
23
|
+
// The client leaves here under its old name: three neighbouring modules and the tree's commands
|
|
24
|
+
// call it from the board module, and rewriting them would mean paying for the split twice.
|
|
29
25
|
export { OfflineError, botToken, gh, ghJson, graphql };
|
|
30
26
|
|
|
31
27
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
28
|
+
* The board address and its columns live in `.claude/rt-kit/checks.json`: the identifiers of the
|
|
29
|
+
* project, the fields and the options are issued by GitHub itself when the board is created, and
|
|
30
|
+
* they cannot be guessed. An empty value means the tree has not created a board — then work with
|
|
31
|
+
* it refuses out loud instead of silently editing someone else's.
|
|
36
32
|
*/
|
|
37
33
|
const BOARD = CONFIG.board ?? {};
|
|
38
34
|
|
|
39
35
|
export const OWNER = BOARD.owner ?? '';
|
|
40
36
|
export const REPO = BOARD.repo ?? '';
|
|
41
37
|
export const PROJECT_ID = BOARD.projectId ?? '';
|
|
42
|
-
/**
|
|
38
|
+
/** The board's "Status" field — the column the task stands in now */
|
|
43
39
|
export const STATUS_FIELD_ID = BOARD.statusFieldId ?? '';
|
|
44
40
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
41
|
+
* The board columns under their short names. The progress is read by them, not by whether the
|
|
42
|
+
* task has a branch: branches are not visible on the board at all.
|
|
47
43
|
*/
|
|
48
44
|
export const STATUS_OPTIONS = BOARD.statusOptions ?? {};
|
|
49
|
-
/**
|
|
45
|
+
/** The column of a newly created task */
|
|
50
46
|
export const BACKLOG_OPTION_ID = STATUS_OPTIONS.backlog?.id ?? '';
|
|
51
|
-
/**
|
|
47
|
+
/** The column of a task taken into work, and of a task whose PR waits for review */
|
|
52
48
|
export const IN_PROGRESS_STATUS = 'in-progress';
|
|
53
49
|
export const IN_REVIEW_STATUS = 'in-review';
|
|
54
|
-
/**
|
|
50
|
+
/** The machine account — the same one the commits come from */
|
|
55
51
|
export const BOT = BOARD.bot ?? '';
|
|
56
52
|
/**
|
|
57
|
-
*
|
|
53
|
+
* The task key: gives the branch `<KEY>-<number>-<slug>` and the title `[<KEY>-<number>]`.
|
|
58
54
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
55
|
+
* The only thing in the name form that the tree chooses itself — and so the only thing the
|
|
56
|
+
* delivery law allows to configure. The tree must name it: an empty key assembles into `[-317]`,
|
|
57
|
+
* and such a title matches nothing. The refusal is by name, because silence costs more here: the
|
|
58
|
+
* queue audit does not fail but marks every task as wrongly named, and the real discrepancy drowns
|
|
59
|
+
* among those lines.
|
|
64
60
|
*/
|
|
65
61
|
export const TASK_KEY = BOARD.taskKey ?? '';
|
|
66
62
|
if (PROJECT_ID && !TASK_KEY) {
|
|
67
63
|
console.error(
|
|
68
|
-
'board:
|
|
69
|
-
'
|
|
64
|
+
'board: the task key is not named — set it by the key `board.taskKey` in .claude/rt-kit/checks.json.\n' +
|
|
65
|
+
'The task title `[<KEY>-<number>]` and the branch name `<KEY>-<number>-<short-name>` are assembled from it.'
|
|
70
66
|
);
|
|
71
67
|
process.exit(1);
|
|
72
68
|
}
|
|
73
|
-
/**
|
|
69
|
+
/** Who is requested for review: without a reviewer the PR does not reach the owner's inbox. */
|
|
74
70
|
export const REVIEWER = BOARD.reviewer ?? '';
|
|
75
71
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
72
|
+
* Tasks standing on the board, and board items that are not tasks. Each task has its board item
|
|
73
|
+
* and column: a task can be moved only by the item identifier, not by the task number, and it is
|
|
74
|
+
* taken right here so as not to ask the board twice.
|
|
79
75
|
*/
|
|
80
76
|
export function fetchBoard(options) {
|
|
81
77
|
const items = new Map();
|
|
@@ -95,7 +91,7 @@ export function fetchBoard(options) {
|
|
|
95
91
|
if (content.__typename === 'Issue') {
|
|
96
92
|
items.set(content.number, { itemId: node.id, status: node.status?.name ?? null });
|
|
97
93
|
} else {
|
|
98
|
-
foreign.push(content.__typename === 'PullRequest' ? `PR #${content.number}` :
|
|
94
|
+
foreign.push(content.__typename === 'PullRequest' ? `PR #${content.number}` : `a draft «${content.title}»`);
|
|
99
95
|
}
|
|
100
96
|
}
|
|
101
97
|
if (!page.pageInfo.hasNextPage) {
|
|
@@ -106,17 +102,17 @@ export function fetchBoard(options) {
|
|
|
106
102
|
}
|
|
107
103
|
|
|
108
104
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
105
|
+
* Moving a task to another column. The task's state on the board is the only thing the progress
|
|
106
|
+
* is visible by: the board does not read the branch or the open PR itself.
|
|
111
107
|
*/
|
|
112
108
|
export function moveTask(number, status, options) {
|
|
113
109
|
const option = STATUS_OPTIONS[status];
|
|
114
110
|
if (!option) {
|
|
115
|
-
throw new Error(
|
|
111
|
+
throw new Error(`an unknown column «${status}» — there are ${Object.keys(STATUS_OPTIONS).join(', ')}`);
|
|
116
112
|
}
|
|
117
113
|
const item = fetchBoard(options).items.get(number);
|
|
118
114
|
if (!item) {
|
|
119
|
-
throw new Error(
|
|
115
|
+
throw new Error(`the task #${number} is not on the board — it is created by the command npm run task:new`);
|
|
120
116
|
}
|
|
121
117
|
graphql(
|
|
122
118
|
`mutation { updateProjectV2ItemFieldValue(input: {projectId: "${PROJECT_ID}", itemId: "${item.itemId}", fieldId: "${STATUS_FIELD_ID}", value: {singleSelectOptionId: "${option.id}"}}) { projectV2Item { id } } }`,
|
|
@@ -125,9 +121,22 @@ export function moveTask(number, status, options) {
|
|
|
125
121
|
return { from: item.status, to: option.name };
|
|
126
122
|
}
|
|
127
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Whose eyes the state was taken with: `machine` — the call went with the machine account's
|
|
126
|
+
* token, `client` — as whoever the hosting client is logged in as. A task is read with the token,
|
|
127
|
+
* a PR without it, and from the output alone this cannot be told apart: a tree whose machine
|
|
128
|
+
* account was restricted by the hosting got a person's picture and took it as checked. The login
|
|
129
|
+
* is not printed here — it would take a second network request, and the guards read the answer
|
|
130
|
+
* without it.
|
|
131
|
+
*/
|
|
132
|
+
export function viewerOf(options) {
|
|
133
|
+
return options?.token ? 'machine' : 'client';
|
|
134
|
+
}
|
|
135
|
+
|
|
128
136
|
export function fetchIssues(state, options) {
|
|
129
|
-
//
|
|
130
|
-
//
|
|
137
|
+
// The body is taken together with the list, not by a call per task: the link to an epic is
|
|
138
|
+
// read exactly there, and four hundred calls of the kind "show one task" would cost more than
|
|
139
|
+
// the whole audit.
|
|
131
140
|
return ghJson(
|
|
132
141
|
['issue', 'list', '--state', state, '--limit', '400', '--json', 'number,title,state,assignees,labels,body'],
|
|
133
142
|
options,
|
|
@@ -136,7 +145,7 @@ export function fetchIssues(state, options) {
|
|
|
136
145
|
|
|
137
146
|
export function fetchIssue(number, options) {
|
|
138
147
|
try {
|
|
139
|
-
return ghJson(['issue', 'view', String(number), '--json', 'number,title,state,assignees,labels'], options);
|
|
148
|
+
return ghJson(['issue', 'view', String(number), '--json', 'number,title,state,assignees,labels,body'], options);
|
|
140
149
|
} catch (error) {
|
|
141
150
|
if (error instanceof OfflineError) {
|
|
142
151
|
throw error;
|
|
@@ -146,16 +155,17 @@ export function fetchIssue(number, options) {
|
|
|
146
155
|
}
|
|
147
156
|
|
|
148
157
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
158
|
+
* The PR state in delivery terms: whether it exists, whether it is a draft and whether it has a
|
|
159
|
+
* review — a requested reviewer or a review already left.
|
|
151
160
|
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
161
|
+
* Before this edit nobody asked about the reviewer: it lived as prose in the pattern about the
|
|
162
|
+
* commit and the PR, and the hosting silently accepts a review request to oneself — the review
|
|
163
|
+
* then looks requested, and there is none.
|
|
155
164
|
*/
|
|
156
165
|
export function pullState(ref, options) {
|
|
157
|
-
//
|
|
158
|
-
//
|
|
166
|
+
// The PR reference is optional: without it the hosting client takes the PR of the current
|
|
167
|
+
// branch, and that is the shortest form of the call. Requiring a number would mean silently
|
|
168
|
+
// skipping it.
|
|
159
169
|
const target = ref === undefined || ref === null || `${ref}`.trim() === '' ? [] : [`${ref}`.trim()];
|
|
160
170
|
let pull;
|
|
161
171
|
try {
|
|
@@ -164,32 +174,34 @@ export function pullState(ref, options) {
|
|
|
164
174
|
if (error instanceof OfflineError) {
|
|
165
175
|
throw error;
|
|
166
176
|
}
|
|
167
|
-
return { exists: false };
|
|
177
|
+
return { exists: false, viewer: viewerOf(options) };
|
|
168
178
|
}
|
|
169
179
|
if (!pull) {
|
|
170
|
-
return { exists: false };
|
|
180
|
+
return { exists: false, viewer: viewerOf(options) };
|
|
171
181
|
}
|
|
172
182
|
const requested = (pull.reviewRequests ?? []).map((entry) => entry.login ?? entry.name ?? '').filter(Boolean);
|
|
173
183
|
const reviewed = (pull.latestReviews ?? []).map((entry) => entry.author?.login ?? '').filter(Boolean);
|
|
174
184
|
const reviewers = [...new Set([...requested, ...reviewed])];
|
|
175
185
|
return {
|
|
176
186
|
exists: true,
|
|
187
|
+
viewer: viewerOf(options),
|
|
177
188
|
number: pull.number ?? null,
|
|
178
189
|
draft: pull.isDraft === true,
|
|
179
190
|
author: pull.author?.login ?? null,
|
|
180
191
|
reviewers,
|
|
181
192
|
reviewed: reviewers.filter((login) => login !== (pull.author?.login ?? null)).length > 0,
|
|
182
|
-
//
|
|
183
|
-
//
|
|
184
|
-
//
|
|
193
|
+
// A conflict arrives through someone else's merge, without a single action by the PR
|
|
194
|
+
// author. Only a direct "conflicting" is judged: `UNKNOWN` means the hosting is still
|
|
195
|
+
// computing, and reading it as a conflict would mean refusing work on every fresh head.
|
|
185
196
|
conflicting: pull.mergeable === 'CONFLICTING',
|
|
186
197
|
};
|
|
187
198
|
}
|
|
188
199
|
|
|
189
200
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
201
|
+
* How many commits the PR branch is behind main. The guard judges the base at the minute of
|
|
202
|
+
* opening, and a PR stands for days: what was merged in that time is seen neither by it nor by a
|
|
203
|
+
* green run. Nothing to compare with — zero: an audit without access would refuse work instead
|
|
204
|
+
* of a miss; without network the refusal is thrown, as everywhere.
|
|
193
205
|
*/
|
|
194
206
|
export function behindMain(branch, mainBranch, options) {
|
|
195
207
|
if (!OWNER || !REPO || !branch || !mainBranch) {
|
|
@@ -209,8 +221,8 @@ export function behindMain(branch, mainBranch, options) {
|
|
|
209
221
|
}
|
|
210
222
|
}
|
|
211
223
|
|
|
212
|
-
/**
|
|
213
|
-
*
|
|
224
|
+
/** The head is taken together with the rest: both the task folder and the run are judged by it,
|
|
225
|
+
* and asking for it later would mean a second call per PR. */
|
|
214
226
|
export function fetchOpenPulls(options) {
|
|
215
227
|
return ghJson(
|
|
216
228
|
['pr', 'list', '--state', 'open', '--limit', '200', '--json', 'number,title,headRefName,headRefOid,isDraft,body,mergeable,baseRefName'],
|
|
@@ -219,17 +231,16 @@ export function fetchOpenPulls(options) {
|
|
|
219
231
|
}
|
|
220
232
|
|
|
221
233
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* заявка прибавляет к очереди ещё одну, которую придётся догонять.
|
|
234
|
+
* Own open PRs marked as conflicting. Asked at the minute new work is taken: while what was
|
|
235
|
+
* handed over conflicts, a person cannot merge it, and every next PR adds one more to the queue.
|
|
225
236
|
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
237
|
+
* Own means opened by the tree's machine account. A tree that has not named it is not asked at
|
|
238
|
+
* all: `@me` would answer with the account the hosting client is logged in as — most often the
|
|
239
|
+
* owner, whose PRs are not the executor's to fix.
|
|
229
240
|
*
|
|
230
|
-
*
|
|
231
|
-
* —
|
|
232
|
-
*
|
|
241
|
+
* Only a direct `CONFLICTING` is judged. `UNKNOWN` means the hosting is still computing
|
|
242
|
+
* mergeability — it recomputes it after every edit of the main branch — and reading it as a
|
|
243
|
+
* conflict would refuse work on every fresh head.
|
|
233
244
|
*/
|
|
234
245
|
export function conflictingPulls(options) {
|
|
235
246
|
if (!BOT) {
|
|
@@ -244,9 +255,9 @@ export function conflictingPulls(options) {
|
|
|
244
255
|
.map((pull) => ({ number: pull.number ?? null, branch: pull.headRefName ?? '' }));
|
|
245
256
|
}
|
|
246
257
|
|
|
247
|
-
/** `[
|
|
258
|
+
/** `[<KEY>-<number>]` at the start of the title — the only form of the number in names */
|
|
248
259
|
export const TITLE_NUMBER = new RegExp(`^\\[${TASK_KEY}-(\\d+)\\]\\s+\\S`);
|
|
249
|
-
/**
|
|
260
|
+
/** `<KEY>-<number>-<slug>` — the name of the branch set aside for the task */
|
|
250
261
|
export const BRANCH_NUMBER = new RegExp(`^${TASK_KEY}-(\\d+)-[a-z0-9][a-z0-9-]*$`);
|
|
251
262
|
|
|
252
263
|
export function numberFromTitle(title) {
|
|
@@ -254,89 +265,6 @@ export function numberFromTitle(title) {
|
|
|
254
265
|
return match ? Number(match[1]) : null;
|
|
255
266
|
}
|
|
256
267
|
|
|
257
|
-
/**
|
|
258
|
-
* Номер задачи по имени папки. Ключ впереди необязателен: имя ветки вида `chore/312-slug`
|
|
259
|
-
* тоже законно, и папка под ним называется голым числом. Если сверка не распознает в имени
|
|
260
|
-
* номер, папка будет лежать среди текущих сколько угодно — одну такую нашли грепом, а не
|
|
261
|
-
* проверкой.
|
|
262
|
-
*/
|
|
263
|
-
export function numberFromTaskDir(name) {
|
|
264
|
-
// Ключ подставляем, только если дерево его задало: из пустого получилось бы `^(?:-)?`, и
|
|
265
|
-
// папка с ключом в имени вообще перестала бы распознаваться.
|
|
266
|
-
const prefix = TASK_KEY ? `(?:${TASK_KEY}-)?` : '';
|
|
267
|
-
const match = new RegExp(`^${prefix}(\\d+)-`).exec(name ?? '');
|
|
268
|
-
return match ? Number(match[1]) : null;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Папки задач, включая вложенные. Путь повторяет имя ветки целиком, вместе с косой, поэтому
|
|
273
|
-
* папка ветки `chore/312-slug` лежит на втором уровне — обход только по верхнему её не видит.
|
|
274
|
-
*
|
|
275
|
-
* Вглубь спускаемся ровно на один уровень: в имени ветки одна косая, а всё, что глубже, папкой
|
|
276
|
-
* задачи уже не будет — зато туда попал бы архив, если дерево держит его внутри.
|
|
277
|
-
*/
|
|
278
|
-
/** Шапка раскладки: по ней разложенную копию узнаёт и гард места правки. */
|
|
279
|
-
const STAMP = /^<!-- rt-kit v[^\n]*-->\n/m;
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Снять с копий образца шапку раскладки.
|
|
283
|
-
*
|
|
284
|
-
* Образец разложен пакетом и шапку несёт по праву: его кладёт и обновляет раскладка. Копия под
|
|
285
|
-
* задачу — уже текст проекта, тем же доводом, каким пакет кладёт без шапки черновик компаньона:
|
|
286
|
-
* с первой правки сверять в ней нечего.
|
|
287
|
-
*
|
|
288
|
-
* Оставленная в копии, шапка отбивает первую же правку разбора просьбы — то есть первое движение
|
|
289
|
-
* любой работы, — и отказ уводит править образец пакета вместо копии под задачу. Снималась она
|
|
290
|
-
* тремя строками руками, каждой работой заново.
|
|
291
|
-
*
|
|
292
|
-
* Возвращает имена файлов, с которых шапка снята: по ним сценарий и судит, что снятие работает,
|
|
293
|
-
* а вызывающий — что папка собрана.
|
|
294
|
-
*/
|
|
295
|
-
export function unstampFolder(folder) {
|
|
296
|
-
const cleaned = [];
|
|
297
|
-
|
|
298
|
-
if (!existsSync(folder)) {
|
|
299
|
-
return cleaned;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
for (const name of readdirSync(folder)) {
|
|
303
|
-
if (!name.endsWith('.md')) {
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const path = join(folder, name);
|
|
308
|
-
const before = readFileSync(path, 'utf8');
|
|
309
|
-
const after = before.replace(STAMP, '');
|
|
310
|
-
|
|
311
|
-
if (after !== before) {
|
|
312
|
-
writeFileSync(path, after);
|
|
313
|
-
cleaned.push(name);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
return cleaned;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
export function taskDirs(dir = join(ROOT, CONFIG.tasksDir), prefix = '') {
|
|
321
|
-
if (!existsSync(dir)) {
|
|
322
|
-
return [];
|
|
323
|
-
}
|
|
324
|
-
const found = [];
|
|
325
|
-
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
326
|
-
if (!entry.isDirectory() || entry.name === '_template') {
|
|
327
|
-
continue;
|
|
328
|
-
}
|
|
329
|
-
const name = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
330
|
-
if (entry.name.startsWith('_draft-') || numberFromTaskDir(entry.name) !== null) {
|
|
331
|
-
found.push(name);
|
|
332
|
-
continue;
|
|
333
|
-
}
|
|
334
|
-
if (!prefix) {
|
|
335
|
-
found.push(...taskDirs(join(dir, entry.name), name));
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return found;
|
|
339
|
-
}
|
|
340
268
|
|
|
341
269
|
export function numberFromBranch(branch) {
|
|
342
270
|
const match = BRANCH_NUMBER.exec(branch ?? '');
|
|
@@ -344,18 +272,19 @@ export function numberFromBranch(branch) {
|
|
|
344
272
|
}
|
|
345
273
|
|
|
346
274
|
/**
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
275
|
+
* The task state in the law's terms: it exists, it stands in the work queue, it has an executor,
|
|
276
|
+
* it is not yet closed. Closed means the branch under it has already gone into main, and a task
|
|
277
|
+
* has one branch.
|
|
350
278
|
*/
|
|
351
279
|
export function taskState(number, options) {
|
|
352
280
|
const issue = fetchIssue(number, options);
|
|
353
281
|
if (!issue) {
|
|
354
|
-
return { exists: false };
|
|
282
|
+
return { exists: false, viewer: viewerOf(options) };
|
|
355
283
|
}
|
|
356
284
|
const item = fetchBoard(options).items.get(issue.number);
|
|
357
285
|
return {
|
|
358
286
|
exists: true,
|
|
287
|
+
viewer: viewerOf(options),
|
|
359
288
|
title: issue.title,
|
|
360
289
|
open: issue.state === 'OPEN',
|
|
361
290
|
onBoard: item !== undefined,
|
|
@@ -364,54 +293,60 @@ export function taskState(number, options) {
|
|
|
364
293
|
assignees: issue.assignees.map((assignee) => assignee.login),
|
|
365
294
|
numbered: numberFromTitle(issue.title) === issue.number,
|
|
366
295
|
labels: issue.labels.map((label) => label.name),
|
|
296
|
+
epic: declaredEpicOf(issue.body) ?? null,
|
|
367
297
|
};
|
|
368
298
|
}
|
|
369
299
|
|
|
370
300
|
/**
|
|
371
|
-
*
|
|
372
|
-
* или нет.
|
|
301
|
+
* The work queue's answer about a created task, folded into lines, and the verdict: secured or not.
|
|
373
302
|
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
303
|
+
* Separated from the network calls on purpose. Creation ends not with the command output but with
|
|
304
|
+
* the queue's answer, and the decision of what to print and how to end is exactly where sixteen
|
|
305
|
+
* tasks in a row passed as successful without one reaching the queue. Inside the network calls it
|
|
306
|
+
* is checked only by a live board, that is, never.
|
|
378
307
|
*
|
|
379
|
-
* `state` —
|
|
308
|
+
* `state` — what `taskState` returned, or `{ offline: <reason> }` if asking failed.
|
|
380
309
|
*/
|
|
381
310
|
export function describeTaskState(number, state) {
|
|
382
311
|
if (state?.offline) {
|
|
383
312
|
return {
|
|
384
313
|
ok: false,
|
|
385
314
|
lines: [
|
|
386
|
-
|
|
387
|
-
'
|
|
315
|
+
`in the work queue: could not be asked — ${state.offline}`,
|
|
316
|
+
'the state of the queue is unknown, and that does not count as created',
|
|
388
317
|
],
|
|
389
318
|
};
|
|
390
319
|
}
|
|
391
320
|
if (!state?.exists) {
|
|
392
|
-
return { ok: false, lines: [
|
|
321
|
+
return { ok: false, lines: [`the hosting has no task #${number} — the creation did not happen`] };
|
|
393
322
|
}
|
|
394
323
|
if (!state.onBoard) {
|
|
395
324
|
return {
|
|
396
325
|
ok: false,
|
|
397
|
-
lines: [
|
|
326
|
+
lines: [`in the work queue: NO`, 'a task that is not in the queue is backed by no work — nobody will come for it'],
|
|
398
327
|
};
|
|
399
328
|
}
|
|
400
329
|
|
|
401
|
-
const column = state.status ?
|
|
330
|
+
const column = state.status ? `the column «${state.status}»` : 'there is no column';
|
|
402
331
|
if (!state.assigned) {
|
|
403
332
|
return {
|
|
404
333
|
ok: false,
|
|
405
|
-
lines: [
|
|
334
|
+
lines: [`in the work queue: ${column}, no assignee`, 'a task belonging to nobody stands in the queue invisible to whoever does it'],
|
|
406
335
|
};
|
|
407
336
|
}
|
|
408
|
-
return { ok: true, lines: [
|
|
337
|
+
return { ok: true, lines: [`in the work queue: ${column}, assignee ${state.assignees.join(', ')}`] };
|
|
409
338
|
}
|
|
410
339
|
|
|
411
340
|
const isEntryPoint = process.argv[1] && import.meta.url === `file://${process.argv[1]}`;
|
|
341
|
+
// The machine account's token is substituted here too, as in the column move. Without it the
|
|
342
|
+
// client goes as whoever is logged in, and during a guard's turn nobody is logged in: the hosting
|
|
343
|
+
// answers that the repository does not exist at all, reading the task returns nothing, and "there
|
|
344
|
+
// was nothing to ask with" becomes indistinguishable from "the task does not exist". On such an
|
|
345
|
+
// answer the delivery guard refused opening a PR with five mutually exclusive reasons at once —
|
|
346
|
+
// no task, the task is closed, the task is not in the queue.
|
|
412
347
|
if (isEntryPoint && process.argv[2] === 'task') {
|
|
413
348
|
try {
|
|
414
|
-
process.stdout.write(`${JSON.stringify(taskState(Number(process.argv[3])))}\n`);
|
|
349
|
+
process.stdout.write(`${JSON.stringify(taskState(Number(process.argv[3]), { token: botToken() ?? undefined }))}\n`);
|
|
415
350
|
} catch (error) {
|
|
416
351
|
if (error instanceof OfflineError) {
|
|
417
352
|
process.stdout.write('{"offline":true}\n');
|
|
@@ -424,6 +359,10 @@ if (isEntryPoint && process.argv[2] === 'task') {
|
|
|
424
359
|
|
|
425
360
|
if (isEntryPoint && process.argv[2] === 'pr') {
|
|
426
361
|
try {
|
|
362
|
+
// There is no token here on purpose: the review fields need access to the organisation's
|
|
363
|
+
// accounts, which the machine account was not given, and a request with it is refused on
|
|
364
|
+
// rights entirely. A client without a token goes as whoever is logged in, and for a person
|
|
365
|
+
// it answers.
|
|
427
366
|
process.stdout.write(`${JSON.stringify(pullState(process.argv[3]))}\n`);
|
|
428
367
|
} catch (error) {
|
|
429
368
|
if (error instanceof OfflineError) {
|
|
@@ -435,12 +374,12 @@ if (isEntryPoint && process.argv[2] === 'pr') {
|
|
|
435
374
|
}
|
|
436
375
|
}
|
|
437
376
|
|
|
438
|
-
//
|
|
439
|
-
//
|
|
440
|
-
//
|
|
377
|
+
// Own conflicting PRs as one line of JSON: `{"conflicting":[{"number":…,"branch":…}]}`.
|
|
378
|
+
// The delivery guard calls it before letting new work be taken. A tree without a machine account
|
|
379
|
+
// answers with an empty list: there is nobody to ask about.
|
|
441
380
|
if (isEntryPoint && process.argv[2] === 'conflicts') {
|
|
442
381
|
try {
|
|
443
|
-
process.stdout.write(`${JSON.stringify({ conflicting: conflictingPulls() ?? [] })}\n`);
|
|
382
|
+
process.stdout.write(`${JSON.stringify({ conflicting: conflictingPulls({ token: botToken() ?? undefined }) ?? [] })}\n`);
|
|
444
383
|
} catch (error) {
|
|
445
384
|
if (error instanceof OfflineError) {
|
|
446
385
|
process.stdout.write('{"offline":true}\n');
|
|
@@ -451,26 +390,26 @@ if (isEntryPoint && process.argv[2] === 'conflicts') {
|
|
|
451
390
|
}
|
|
452
391
|
}
|
|
453
392
|
|
|
454
|
-
//
|
|
455
|
-
//
|
|
456
|
-
//
|
|
457
|
-
//
|
|
458
|
-
//
|
|
459
|
-
//
|
|
393
|
+
// The column move edits the board. The machine account's token is optional here: a tree that has
|
|
394
|
+
// not named it edits the board as the account the hosting client is logged in as. Requiring the
|
|
395
|
+
// token would hold the work queue back from a tree that created no machine account, and from a
|
|
396
|
+
// tree whose account the hosting restricted. No connection is still a refusal, not a skip: a task
|
|
397
|
+
// left unmoved silently stays in its old column, and the discrepancy surfaces only through the
|
|
398
|
+
// queue audit.
|
|
460
399
|
if (isEntryPoint && process.argv[2] === 'move') {
|
|
461
400
|
const number = Number(process.argv[3]);
|
|
462
401
|
const status = process.argv[4];
|
|
463
402
|
if (!Number.isInteger(number) || !status) {
|
|
464
|
-
console.error(`board:
|
|
403
|
+
console.error(`board: a task number and a column are needed — node tools/board.mjs move 263 ${IN_PROGRESS_STATUS}`);
|
|
465
404
|
process.exit(1);
|
|
466
405
|
}
|
|
467
406
|
const token = botToken() ?? undefined;
|
|
468
407
|
try {
|
|
469
408
|
const moved = moveTask(number, status, { token });
|
|
470
|
-
console.log(`#${number}: ${moved.from ?? '
|
|
409
|
+
console.log(`#${number}: ${moved.from ?? 'outside the columns'} → ${moved.to}`);
|
|
471
410
|
} catch (error) {
|
|
472
|
-
const reason = error instanceof OfflineError ?
|
|
473
|
-
console.error(`board:
|
|
411
|
+
const reason = error instanceof OfflineError ? `no connection to GitHub: ${error.message}` : String(error.message ?? error);
|
|
412
|
+
console.error(`board: the task #${number} stayed in its former place — ${reason}`);
|
|
474
413
|
process.exit(1);
|
|
475
414
|
}
|
|
476
415
|
}
|