@rt-tools/agent-kit 0.24.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/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 +149 -127
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +172 -164
- 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 +120 -37
- 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 +108 -97
- package/assets/defaults/project.sh +225 -185
- package/assets/defaults/shell.sh +73 -68
- 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 +30 -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 +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 +60 -46
- package/assets/hooks/docs-guard.sh +100 -91
- package/assets/hooks/exam-guard.sh +105 -93
- package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
- package/assets/hooks/git-guard-delivery-draft.sh +45 -38
- 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 +196 -180
- 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 +26 -24
- 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 +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 +47 -42
- 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 +40 -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 +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 +96 -44
- 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 -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 +93 -86
- package/assets/patterns/git-workflow-commit.github.md +152 -141
- package/assets/patterns/git-workflow-commit.gitlab.md +95 -89
- 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 +98 -93
- 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 +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 +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 -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 +198 -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 +250 -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 +272 -260
- package/assets/rules/status-report.md +55 -58
- package/assets/rules/styling-bem.md +81 -77
- package/assets/rules/task-flow.md +282 -270
- package/assets/rules/testing.md +224 -209
- 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 +235 -211
- 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 +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/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 +6 -2
- 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.24.0.tgz +0 -0
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
#
|
|
2
|
+
# Write targets named by the shell command outright: redirection, `tee`, an in-place edit, a copy
|
|
3
|
+
# over the top, and for an interpreter — the paths from its body. Prints one per line.
|
|
4
4
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
5
|
+
# There is deliberately no `# rt-hook:` line here: this is a helper, not a hook. It decides nothing
|
|
6
|
+
# by itself and is called from where an edit of a file is judged — by the guard of the place of the
|
|
7
|
+
# edit and by the exam guard. It is shared because the sign of a write is one and the same for both:
|
|
8
|
+
# having diverged, two copies would let through different forms of a write, and there would be
|
|
9
|
+
# nothing to notice it by.
|
|
9
10
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
11
|
+
# The shared sign of a write is deliberately not taken here — it is wide, it holds the name of the
|
|
12
|
+
# interpreter too, and running a laid-out check would read as an edit of the check itself. Taking a
|
|
13
|
+
# copy is not included either: a copied file is put in place again by the layout, and that is how a
|
|
14
|
+
# copy overwritten by the formatter is fixed.
|
|
13
15
|
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
16
|
+
# An interpreter with code in an argument or in a body is a special case, and without it the guards
|
|
17
|
+
# had a hole exactly in the direction in which edits are made most often. The write path stands
|
|
18
|
+
# there inside the code — in the call that writes the file — and is caught by none of the patterns
|
|
19
|
+
# above: from the outside the command looks like running an interpreter, not like a write. A
|
|
20
|
+
# laid-out copy was edited that way silently, and it was the layout that caught it — at the build,
|
|
21
|
+
# when the edit is written in full and has to be carried over by hand.
|
|
19
22
|
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
23
|
+
# There is nothing to parse someone else's language with, and it is not parsed here: everything
|
|
24
|
+
# path-like is taken from the body, and the caller decides by it — the guard of the place of the
|
|
25
|
+
# edit refuses only what carries the layout header. The price is named outright: reading a file by
|
|
26
|
+
# an interpreter is judged on a par with writing into it. In the shell one reads by other means —
|
|
27
|
+
# `cat`, `grep`, `sed -n` — while an interpreter given the path of a laid-out copy almost always
|
|
28
|
+
# edits it.
|
|
25
29
|
|
|
26
30
|
rt_write_targets() {
|
|
27
31
|
rt_wt_text="$(cat)"
|
|
28
32
|
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
33
|
+
# Redirection to the empty device and to the error stream is removed before parsing — by the
|
|
34
|
+
# same technique the shell write sign removes it. Without this a muted output inside the body of
|
|
35
|
+
# an interpreter reads as a sign of a write, and a body that writes nothing again gives away all
|
|
36
|
+
# its paths: a command with an edit of one file and a run of a check next to it was forbidden by
|
|
37
|
+
# the path of that check. A real write next to a muted stream stays visible: the redirection is
|
|
38
|
+
# removed, not the whole command.
|
|
35
39
|
rt_wt_text="$(printf '%s' "$rt_wt_text" \
|
|
36
40
|
| sed -E 's#(&|[0-9]*)>>?[[:space:]]*/dev/(null|stderr)##g; s#[0-9]*>&[0-9-]##g')"
|
|
37
41
|
|
|
@@ -46,11 +50,11 @@ rt_write_targets() {
|
|
|
46
50
|
s/(^|.*[[:space:]])(cp|mv|install)[[:space:]]+([^[:space:]]+[[:space:]]+)+([^[:space:]|&;]+).*/\4/p
|
|
47
51
|
'
|
|
48
52
|
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
53
|
+
# The body of the interpreter: the code comes as a `-c` argument, an `-e` argument or a
|
|
54
|
+
# heredoc body, and the write path stands inside it. It is exactly the body that is taken,
|
|
55
|
+
# not the whole command: a compound line in which a heredoc writes one file while a check is
|
|
56
|
+
# run next to it would give away the path of that check as a write target — and running a
|
|
57
|
+
# laid-out check would again read as an edit of the check itself.
|
|
54
58
|
printf '%s\n' "$rt_wt_text" | awk '
|
|
55
59
|
function emit(s, n, i, parts) {
|
|
56
60
|
n = split(s, parts, /[^A-Za-z0-9_.@\/-]+/)
|
|
@@ -58,11 +62,43 @@ rt_write_targets() {
|
|
|
58
62
|
if (parts[i] ~ /\// && parts[i] ~ /\.[A-Za-z0-9]+$/) { print parts[i] }
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
# A path assigned to a variable. It stands on a line separate from the write call, and
|
|
66
|
+
# without this pair a write through a variable cannot be caught at all.
|
|
67
|
+
function note_var(s, name, path) {
|
|
68
|
+
if (match(s, /[A-Za-z_][A-Za-z0-9_]*[ \t]*=[ \t]*[\047\"][^\047\"]*\/[^\047\"]*[\047\"]/)) {
|
|
69
|
+
path = substr(s, RSTART, RLENGTH)
|
|
70
|
+
name = path
|
|
71
|
+
sub(/[ \t]*=.*$/, "", name)
|
|
72
|
+
sub(/^[^=]*=[ \t]*[\047\"]/, "", path)
|
|
73
|
+
sub(/[\047\"].*$/, "", path)
|
|
74
|
+
if (path ~ /\.[A-Za-z0-9]+$/) { varpath[name] = path }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
# The write target is the first argument of the write call. It is the address the
|
|
78
|
+
# script opens; everything else on the same line is search patterns, substitutions and
|
|
79
|
+
# data.
|
|
80
|
+
function emit_calls(s, rest, arg, name) {
|
|
81
|
+
rest = s
|
|
82
|
+
while (match(rest, /(open|writeFileSync|writeFile|appendFileSync|appendFile|write_text|write_bytes|copyfile|copy2|rename|symlink|mkdir|makedirs)[ \t]*\(/)) {
|
|
83
|
+
rest = substr(rest, RSTART + RLENGTH)
|
|
84
|
+
arg = rest
|
|
85
|
+
sub(/[,)].*$/, "", arg)
|
|
86
|
+
gsub(/^[ \t]+|[ \t]+$/, "", arg)
|
|
87
|
+
if (arg ~ /^[\047\"]/) {
|
|
88
|
+
gsub(/^[\047\"]|[\047\"]$/, "", arg)
|
|
89
|
+
if (arg ~ /\// && arg ~ /\.[A-Za-z0-9]+$/) { print arg }
|
|
90
|
+
} else {
|
|
91
|
+
name = arg
|
|
92
|
+
gsub(/[^A-Za-z0-9_].*$/, "", name)
|
|
93
|
+
if (name in varpath) { print varpath[name] }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
# Whether the body writes anything at all. A body with not a single write call does
|
|
98
|
+
# not give away its paths: a command that sourced a laid-out helper and printed its
|
|
99
|
+
# answer was forbidden as an edit of that helper — three times in a row in one session.
|
|
100
|
+
# Inside a body that does write, all paths are still taken: the path and the write call
|
|
101
|
+
# stand there on different lines, and there is nothing to tie them together with.
|
|
66
102
|
function writes(s) {
|
|
67
103
|
return s ~ /open[ \t]*\([^)]*[\047\"](w|a|r\+|w\+|a\+)[\047\"]/ \
|
|
68
104
|
|| s ~ /writeFileSync|writeFile|appendFile|write_text|write_bytes|\.write\(|\.save\(|savefig|to_csv|json\.dump|\.dump\(/ \
|
|
@@ -71,34 +107,50 @@ rt_write_targets() {
|
|
|
71
107
|
|| s ~ /(^|[|;&(]|[ \t])(tee|cp|mv|rm|touch|install|truncate)([ \t]|$)/
|
|
72
108
|
}
|
|
73
109
|
function trim(s) { sub(/^[ \t]+/, "", s); sub(/[ \t]+$/, "", s); return s }
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
110
|
+
# Paths are taken from the write lines, not from the whole body.
|
|
111
|
+
#
|
|
112
|
+
# Before, a body that writes anything at all gave away all its path-like words at once:
|
|
113
|
+
# an address named in the body as a search pattern or a comparison string read as a
|
|
114
|
+
# write target, and an edit of one file was forbidden by the name of another, which the
|
|
115
|
+
# script did not even open. Such a refusal was bypassed by changing the form of the
|
|
116
|
+
# command, not the action — that is, it lifted the requirement instead of holding it.
|
|
117
|
+
#
|
|
118
|
+
# A path assigned to a variable is not lost by this: the pair "assignment — write line"
|
|
119
|
+
# is parsed separately.
|
|
120
|
+
function flush_body( i) {
|
|
121
|
+
if (wrote) {
|
|
122
|
+
for (i = 1; i <= lines; i++) { note_var(line[i]) }
|
|
123
|
+
for (i = 1; i <= lines; i++) {
|
|
124
|
+
if (writes(line[i])) { emit(line[i]); emit_calls(line[i]) }
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
for (i = 1; i <= lines; i++) { delete line[i] }
|
|
128
|
+
delete varpath
|
|
129
|
+
lines = 0
|
|
77
130
|
wrote = 0
|
|
78
131
|
}
|
|
79
132
|
tag != "" {
|
|
80
133
|
if (trim($0) == tag) { flush_body(); tag = ""; next }
|
|
81
134
|
if (keep) {
|
|
82
|
-
|
|
135
|
+
line[++lines] = $0
|
|
83
136
|
if (writes($0)) { wrote = 1 }
|
|
84
137
|
}
|
|
85
138
|
next
|
|
86
139
|
}
|
|
87
140
|
{
|
|
88
|
-
#
|
|
141
|
+
# Code as an argument: everything that stands after `-c` or `-e` of an interpreter.
|
|
89
142
|
if ($0 ~ /(^|[|;&(]|[ \t])(python3?|node|ruby|perl|php|deno|bun)([ \t]|$)/ \
|
|
90
143
|
&& match($0, /[ \t]-[ce][ \t]/)) {
|
|
91
144
|
rest = substr($0, RSTART + RLENGTH)
|
|
92
|
-
if (writes(rest)) { emit(rest) }
|
|
145
|
+
if (writes(rest)) { note_var(rest); emit(rest); emit_calls(rest) }
|
|
93
146
|
}
|
|
94
|
-
#
|
|
147
|
+
# The heredoc body: the write path of the interpreter stands exactly there.
|
|
95
148
|
if (match($0, /<<-?[ \t]*[\047\"]?[A-Za-z_][A-Za-z0-9_]*/)) {
|
|
96
149
|
t = substr($0, RSTART, RLENGTH)
|
|
97
150
|
sub(/^<<-?[ \t]*[\047\"]?/, "", t)
|
|
98
151
|
tag = t
|
|
99
152
|
keep = ($0 ~ /(^|[|;&(]|[ \t])(python3?|node|ruby|perl|php|deno|bun)([ \t]|$)/)
|
|
100
|
-
|
|
101
|
-
wrote = 0
|
|
153
|
+
flush_body()
|
|
102
154
|
}
|
|
103
155
|
}
|
|
104
156
|
END { if (tag != "") { flush_body() } }'
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Law on the autonomous session
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
A session with no owner nearby. They answer no questions, press no buttons and do not see the
|
|
4
|
+
work until morning: everything the executor did overnight, they read at once and as already
|
|
5
|
+
happened.
|
|
5
6
|
|
|
6
|
-
##
|
|
7
|
+
## Articles
|
|
7
8
|
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
9
|
+
- **The owner declares an autonomous session, and it ends by their word or at a named boundary.**
|
|
10
|
+
A session does not extend itself: work without an end is work the owner did not ask for.
|
|
11
|
+
- **A fork is closed by a default, not by waiting.** A question with nobody to ask does not stop
|
|
12
|
+
the work: the executor takes a default, writes it down together with the cost of being wrong,
|
|
13
|
+
and moves on. A standing session answers no question and costs exactly as much as one answered
|
|
14
|
+
wrong.
|
|
15
|
+
- **A task that runs into the owner's word is postponed whole.** A half-done one looks done: the
|
|
16
|
+
next session reads it as closed and does not come back to it.
|
|
17
|
+
- **An action visible from outside is not done in an autonomous session.** Sending to another
|
|
18
|
+
party, publishing, merging, mail: their consequences are undone by a person, and there is none.
|
|
19
|
+
Undoing costs more than waiting.
|
|
20
|
+
- **Work that cannot be confirmed by anything is not taken.** The readiness sign of an autonomous
|
|
21
|
+
session is a command with a known output, not the executor's glance: there is nobody to confirm
|
|
22
|
+
it.
|
|
23
|
+
- **Every step ends with a trace on disk.** A session breaks off without warning — on the window,
|
|
24
|
+
on a refusal, on the network — and everything not written vanishes with it.
|
|
25
|
+
- **Pieces of work go in a chain, not in a fan from one base.** Each next one branches from the
|
|
26
|
+
previous: a divergence then surfaces for whoever has both edits at hand, not for the owner,
|
|
27
|
+
who has neither.
|
|
28
|
+
- **A session ends with a list, not a summary.** The owner reads the night whole: for every piece
|
|
29
|
+
of work it shows what was done, where it lies, what confirms it and what it waits for. A
|
|
30
|
+
summary "a lot was done" says nothing about any of the four.
|
|
31
|
+
- **A guard's refusal does not end an autonomous session.** It names the skipped step, and the
|
|
32
|
+
step is done; a session that stopped on a refusal until morning loses the night whole.
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Law on code structure
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
What must be true about the code itself regardless of what it does. The law is needed because
|
|
4
|
+
code is read more often than written: a name that does not show the kind of the declaration, and
|
|
5
|
+
a type declared as fitting instead of checked, cost the reader a separate trip to a neighbouring
|
|
6
|
+
file.
|
|
6
7
|
|
|
7
|
-
##
|
|
8
|
+
## Articles
|
|
8
9
|
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
- **The name of a declaration says what kind it is.** Without that, the kind of a declaration is
|
|
11
|
+
found out by going to it, and anew at every reading.
|
|
12
|
+
- **A file name that promises a kind of declaration finds that declaration inside.** Listings,
|
|
13
|
+
directory trees and error messages show the name instead of the content, and a promise the file
|
|
14
|
+
does not keep costs more than no promise at all.
|
|
15
|
+
- **The source of a watched value is visible from its name.** Otherwise a subscription to it
|
|
16
|
+
looks like an ordinary read, and people forget to remove it.
|
|
17
|
+
- **A type is taken from the package where it is declared.** A copy of someone else's type drifts
|
|
18
|
+
from the original silently, and only one of them gets compiled.
|
|
19
|
+
- **A value is not declared as fitting around the type check.** A cast through an intermediate
|
|
20
|
+
"unknown" switches the check off on purpose and accepts anything; where there is no other way,
|
|
21
|
+
the reason is named next to it.
|
|
22
|
+
- **A deprecation mark is a reason to remove, not a reason to keep.** A deprecated declaration
|
|
23
|
+
that silently keeps working outlives whoever marked it.
|
|
24
|
+
- **A file is read whole.** The length at which it is read in parts is declared as one number for
|
|
25
|
+
all kinds of files, and what accumulated before the declaration is listed one by one: the list
|
|
26
|
+
marks a debt, it does not grant permission.
|
|
26
27
|
|
|
27
|
-
##
|
|
28
|
+
## Open questions
|
|
28
29
|
|
|
29
|
-
- **Q-CS-3 —
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- **Q-CS-4 —
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
- **Q-CS-3 — a file name without a promise of kind is judged by nothing.** The check asks a file
|
|
31
|
+
whose name names a kind; a name made of words about content alone says nothing, and a kind can
|
|
32
|
+
be made mandatory only by a product decision.
|
|
33
|
+
- **Q-CS-4 — a one-step cast stays unchecked.** Going around the check through an intermediate
|
|
34
|
+
"unknown" is banned, and an ordinary cast is accepted: part of it is mandatory, and the ban
|
|
35
|
+
would reject it along with the rest. The decision will change whether every remaining one
|
|
36
|
+
needs a reason.
|