dkitchen 0.6.2__tar.gz → 0.6.4__tar.gz

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.
Files changed (32) hide show
  1. {dkitchen-0.6.2/src/dkitchen.egg-info → dkitchen-0.6.4}/PKG-INFO +10 -4
  2. {dkitchen-0.6.2 → dkitchen-0.6.4}/README.md +9 -3
  3. {dkitchen-0.6.2 → dkitchen-0.6.4}/pyproject.toml +1 -1
  4. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen/check.py +87 -35
  5. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen/config.py +231 -43
  6. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen/ding.py +558 -100
  7. dkitchen-0.6.4/src/dkitchen/inbox.py +412 -0
  8. dkitchen-0.6.4/src/dkitchen/kitchens.py +169 -0
  9. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen/orchestrate.py +113 -11
  10. dkitchen-0.6.4/src/dkitchen/outbound.py +312 -0
  11. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen/refs.py +23 -5
  12. dkitchen-0.6.4/src/dkitchen/roles.py +159 -0
  13. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen/rule.py +42 -14
  14. dkitchen-0.6.4/src/dkitchen/verdict.py +99 -0
  15. dkitchen-0.6.4/src/dkitchen/watch.py +1356 -0
  16. {dkitchen-0.6.2 → dkitchen-0.6.4/src/dkitchen.egg-info}/PKG-INFO +10 -4
  17. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen.egg-info/SOURCES.txt +6 -0
  18. {dkitchen-0.6.2 → dkitchen-0.6.4}/tests/test_check.py +99 -0
  19. dkitchen-0.6.4/tests/test_claude_executor.py +520 -0
  20. {dkitchen-0.6.2 → dkitchen-0.6.4}/tests/test_codex_session.py +18 -21
  21. {dkitchen-0.6.2 → dkitchen-0.6.4}/tests/test_kitchen.py +2227 -273
  22. {dkitchen-0.6.2 → dkitchen-0.6.4}/tests/test_reference_scripts.py +49 -3
  23. dkitchen-0.6.2/src/dkitchen/watch.py +0 -741
  24. {dkitchen-0.6.2 → dkitchen-0.6.4}/LICENSE +0 -0
  25. {dkitchen-0.6.2 → dkitchen-0.6.4}/setup.cfg +0 -0
  26. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen/__init__.py +0 -0
  27. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen/night.py +0 -0
  28. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen.egg-info/dependency_links.txt +0 -0
  29. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen.egg-info/entry_points.txt +0 -0
  30. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen.egg-info/requires.txt +0 -0
  31. {dkitchen-0.6.2 → dkitchen-0.6.4}/src/dkitchen.egg-info/top_level.txt +0 -0
  32. {dkitchen-0.6.2 → dkitchen-0.6.4}/tests/test_records.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dkitchen
3
- Version: 0.6.2
3
+ Version: 0.6.4
4
4
  Summary: DIY your own multi-agent workflow with Claude Code and Codex; includes the ding CLI for messaging and waking agent sessions
5
5
  Author: 917Dhj
6
6
  License-Expression: MIT
@@ -139,11 +139,13 @@ The roles' everyday steps are `ding` commands too, so they run the same careful
139
139
  - `ding relay` sends a message to a ticket's executor, and records it on the ticket only once delivery is confirmed.
140
140
  - `ding review` records a verdict on the current PR HEAD. With `[merge] review_check`, `ding merge`, `ding watch`, and `ding waits` share PR readiness checks; every merge requires the default target branch. See [the review and merge guide](docs/ding.md).
141
141
  - `ding watch` waits in each role's background and wakes it when a ticket needs it.
142
- - `ding waits` lists overdue unanswered waits, including ones still pending after a prior watch batch.
142
+ - `ding role take NAME` records which session holds a role, by session id; `ding role NAME` prints it, so peers stop finding each other by name.
143
+ - `ding waits` lists overdue unanswered waits, including ones still pending after a prior watch batch, and the stalled lines that name no wait.
143
144
  - `ding log` keeps the orchestrator's log of what it did while you were away.
144
145
  - `ding night` opens, shows, and closes time-limited night orders on that log. Run `/goodnight` and `/goodmorning` in the orchestrator session to collect the orders and report their use.
145
146
  - `ding check-refs` checks every file, line, and digest the verifier cites.
146
147
  - `ding check` runs the repo's checks on every PR, and `ding map` lists the library's modules, so a change goes to the module that already exists.
148
+ - `ding pr` and `ding code-issue` open a PR or an issue in the code repo and record it on the ticket. When the kitchen lives in its own repo, they refuse text that carries the kitchen's internals, and in a repo other people work in they need your approval. `ding kitchen link` tells a machine where the kitchen and the code repo are checked out.
147
149
 
148
150
  ### 📜 The house rules
149
151
 
@@ -151,7 +153,7 @@ The rules every role follows live in [kitchen/](https://github.com/917Dhj/dkitch
151
153
 
152
154
  ### 🧩 The skills
153
155
 
154
- The plugin installs ten skills. The build skills set up one part of the kitchen each and can run again to update it:
156
+ The plugin installs eleven skills. The build skills set up one part of the kitchen each and can run again to update it:
155
157
 
156
158
  | Skill | What it does |
157
159
  | --- | --- |
@@ -166,6 +168,7 @@ The everyday skills run while the kitchen works:
166
168
  | Skill | When |
167
169
  | --- | --- |
168
170
  | `write-ticket` | Every time a role writes a ticket; the model reaches for it on its own |
171
+ | `write-contribution` | Every time a role writes a PR, a code issue, or a reply in the code repo, in that repo's own conventions |
169
172
  | `/shift-change` | When a role's session is replaced by a fresh one |
170
173
  | `/improve-kitchen` | Every couple of weeks: turns what keeps going wrong into checks, tools, or rules, and retires the text they replace |
171
174
  | `/goodnight`, `/goodmorning` | Before you leave and when you are back |
@@ -200,7 +203,7 @@ In Claude Code, inside your repo, run:
200
203
  /setup-dkitchen
201
204
  ```
202
205
 
203
- The skill reads your repo to learn what you work on and what you already have: agent instructions, tests, GPUs, model calls, long jobs. It checks the prerequisites, settles the language, and asks which parts you need: the team, the code rules, the runner, the night shift. Then it walks through each part's build skill, which asks its own questions one at a time and shows you every rule, script, and GitHub change before writing anything. Run it again any time to change the setup.
206
+ The skill reads your repo to learn what you work on and what you already have: agent instructions, tests, GPUs, model calls, long jobs. It checks the prerequisites, settles the language, asks where the kitchen lives, in your repo or in a private repo of its own, and asks which parts you need: the team, the code rules, the runner, the night shift. Then it walks through each part's build skill, which asks its own questions one at a time and shows you every rule, script, and GitHub change before writing anything. Run it again any time to change the setup.
204
207
 
205
208
  Upgrading from 0.5? Read *Upgrading* in the [changelog](https://github.com/917Dhj/dkitchen/blob/main/CHANGELOG.md) first.
206
209
 
@@ -212,6 +215,9 @@ They stop for anything that changes direction, results, or spending, and approva
212
215
  **Will it fit my repo?**
213
216
  The rules were written for computational research, and most of them carry over to any repo with long-running jobs. The setup skill adapts them to your repo. The team and the night shift fit a repo in any programming language; the code checks and the runner are for Python repos.
214
217
 
218
+ **Can I use it in a repo other people work in?**
219
+ Yes, with the kitchen in a private repo of its own. The rules, the tickets, and `.dkitchen.toml` stay there; your team's repo receives only PRs and issues, written in your name and in its own conventions, with nothing of the kitchen in them. In a shared repo, a PR goes ready for review and an issue goes out only with your approval, verdicts stay on your tickets, and the team merges. Comments from your teammates wake the orchestrator but never count as your words. `/setup-dkitchen` recommends this setup when it finds other people in the repo; see [A kitchen in its own repo](https://github.com/917Dhj/dkitchen/blob/main/docs/ding.md#a-kitchen-in-its-own-repo).
220
+
215
221
  **Do I need both Claude Code and Codex?**
216
222
  For now, yes. That is the combination I run every day.
217
223
 
@@ -105,11 +105,13 @@ The roles' everyday steps are `ding` commands too, so they run the same careful
105
105
  - `ding relay` sends a message to a ticket's executor, and records it on the ticket only once delivery is confirmed.
106
106
  - `ding review` records a verdict on the current PR HEAD. With `[merge] review_check`, `ding merge`, `ding watch`, and `ding waits` share PR readiness checks; every merge requires the default target branch. See [the review and merge guide](docs/ding.md).
107
107
  - `ding watch` waits in each role's background and wakes it when a ticket needs it.
108
- - `ding waits` lists overdue unanswered waits, including ones still pending after a prior watch batch.
108
+ - `ding role take NAME` records which session holds a role, by session id; `ding role NAME` prints it, so peers stop finding each other by name.
109
+ - `ding waits` lists overdue unanswered waits, including ones still pending after a prior watch batch, and the stalled lines that name no wait.
109
110
  - `ding log` keeps the orchestrator's log of what it did while you were away.
110
111
  - `ding night` opens, shows, and closes time-limited night orders on that log. Run `/goodnight` and `/goodmorning` in the orchestrator session to collect the orders and report their use.
111
112
  - `ding check-refs` checks every file, line, and digest the verifier cites.
112
113
  - `ding check` runs the repo's checks on every PR, and `ding map` lists the library's modules, so a change goes to the module that already exists.
114
+ - `ding pr` and `ding code-issue` open a PR or an issue in the code repo and record it on the ticket. When the kitchen lives in its own repo, they refuse text that carries the kitchen's internals, and in a repo other people work in they need your approval. `ding kitchen link` tells a machine where the kitchen and the code repo are checked out.
113
115
 
114
116
  ### 📜 The house rules
115
117
 
@@ -117,7 +119,7 @@ The rules every role follows live in [kitchen/](https://github.com/917Dhj/dkitch
117
119
 
118
120
  ### 🧩 The skills
119
121
 
120
- The plugin installs ten skills. The build skills set up one part of the kitchen each and can run again to update it:
122
+ The plugin installs eleven skills. The build skills set up one part of the kitchen each and can run again to update it:
121
123
 
122
124
  | Skill | What it does |
123
125
  | --- | --- |
@@ -132,6 +134,7 @@ The everyday skills run while the kitchen works:
132
134
  | Skill | When |
133
135
  | --- | --- |
134
136
  | `write-ticket` | Every time a role writes a ticket; the model reaches for it on its own |
137
+ | `write-contribution` | Every time a role writes a PR, a code issue, or a reply in the code repo, in that repo's own conventions |
135
138
  | `/shift-change` | When a role's session is replaced by a fresh one |
136
139
  | `/improve-kitchen` | Every couple of weeks: turns what keeps going wrong into checks, tools, or rules, and retires the text they replace |
137
140
  | `/goodnight`, `/goodmorning` | Before you leave and when you are back |
@@ -166,7 +169,7 @@ In Claude Code, inside your repo, run:
166
169
  /setup-dkitchen
167
170
  ```
168
171
 
169
- The skill reads your repo to learn what you work on and what you already have: agent instructions, tests, GPUs, model calls, long jobs. It checks the prerequisites, settles the language, and asks which parts you need: the team, the code rules, the runner, the night shift. Then it walks through each part's build skill, which asks its own questions one at a time and shows you every rule, script, and GitHub change before writing anything. Run it again any time to change the setup.
172
+ The skill reads your repo to learn what you work on and what you already have: agent instructions, tests, GPUs, model calls, long jobs. It checks the prerequisites, settles the language, asks where the kitchen lives, in your repo or in a private repo of its own, and asks which parts you need: the team, the code rules, the runner, the night shift. Then it walks through each part's build skill, which asks its own questions one at a time and shows you every rule, script, and GitHub change before writing anything. Run it again any time to change the setup.
170
173
 
171
174
  Upgrading from 0.5? Read *Upgrading* in the [changelog](https://github.com/917Dhj/dkitchen/blob/main/CHANGELOG.md) first.
172
175
 
@@ -178,6 +181,9 @@ They stop for anything that changes direction, results, or spending, and approva
178
181
  **Will it fit my repo?**
179
182
  The rules were written for computational research, and most of them carry over to any repo with long-running jobs. The setup skill adapts them to your repo. The team and the night shift fit a repo in any programming language; the code checks and the runner are for Python repos.
180
183
 
184
+ **Can I use it in a repo other people work in?**
185
+ Yes, with the kitchen in a private repo of its own. The rules, the tickets, and `.dkitchen.toml` stay there; your team's repo receives only PRs and issues, written in your name and in its own conventions, with nothing of the kitchen in them. In a shared repo, a PR goes ready for review and an issue goes out only with your approval, verdicts stay on your tickets, and the team merges. Comments from your teammates wake the orchestrator but never count as your words. `/setup-dkitchen` recommends this setup when it finds other people in the repo; see [A kitchen in its own repo](https://github.com/917Dhj/dkitchen/blob/main/docs/ding.md#a-kitchen-in-its-own-repo).
186
+
181
187
  **Do I need both Claude Code and Codex?**
182
188
  For now, yes. That is the combination I run every day.
183
189
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dkitchen"
7
- version = "0.6.2"
7
+ version = "0.6.4"
8
8
  description = "DIY your own multi-agent workflow with Claude Code and Codex; includes the ding CLI for messaging and waking agent sessions"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -4,7 +4,8 @@
4
4
  apply to added files only; Ruff, the import contracts, and the repo's own commands look at the whole tree; a change
5
5
  to a check needs a Guard-change trailer. Exits 1 on any problem, 2 when the check cannot run.
6
6
  - map: each Python module under an area, with the first line of its docstring.
7
- The areas and switches come from the [check] table of .dkitchen.toml.
7
+ The areas and switches come from [tool.dkitchen.check] in the code repo's pyproject.toml when it has one, else from
8
+ the [check] table of .dkitchen.toml.
8
9
  """
9
10
  from __future__ import annotations
10
11
 
@@ -22,7 +23,8 @@ if sys.version_info >= (3, 11):
22
23
  else:
23
24
  import tomli as tomllib
24
25
 
25
- from dkitchen.config import FILE, Check, Config
26
+ from dkitchen import kitchens
27
+ from dkitchen.config import FILE, Check, Config, check_section
26
28
 
27
29
  ROOT_FILES = ("README*", "LICENSE*", "COPYING*", "NOTICE*", "CHANGELOG*", "CONTRIBUTING*", "CODE_OF_CONDUCT*",
28
30
  "SECURITY*", "CITATION*", "AGENTS.md", "CLAUDE.md", "GLOSSARY.md", "GLOSSARY-MAP.md", "pyproject.toml",
@@ -35,6 +37,9 @@ VERSION = re.compile(r"(?i)(?:^|[_-])v\d+(?=$|[_.-])")
35
37
  SNAKE = re.compile(r"[a-z][a-z0-9]*(?:_[a-z0-9]+)*")
36
38
  TRAILER = re.compile(r"#?\d+\s+\S")
37
39
  STANDARD = "docs/agents/code.md"
40
+ PYPROJECT_TABLE = "[tool.dkitchen.check]"
41
+ NO_TABLE = f"{FILE} has no [check] table and pyproject.toml has no [tool.dkitchen.check] table"
42
+ IGNORED_WARNED: set[Path] = set() # code checkouts already told that the kitchen's [check] is ignored
38
43
 
39
44
 
40
45
  class CheckError(RuntimeError):
@@ -79,7 +84,7 @@ def docstring_line(source: str) -> str | None:
79
84
  return docstring.strip().splitlines()[0].strip() if docstring and docstring.strip() else None
80
85
 
81
86
 
82
- def layout(root: Path, base: str, check: Check) -> list[dict]:
87
+ def layout(root: Path, base: str, check: Check, table: str = "[check]") -> list[dict]:
83
88
  """Layout rules on every file the working tree adds against `base`."""
84
89
  added = sorted(set(paths(git(root, "diff", "--name-only", "-z", "--no-renames", "--diff-filter=A", base, "--")))
85
90
  | set(untracked(root)))
@@ -97,16 +102,16 @@ def layout(root: Path, base: str, check: Check) -> list[dict]:
97
102
  if len(parts) == 1:
98
103
  if not any(fnmatch(name, pattern) for pattern in allowed):
99
104
  findings.append(finding(path, "root-file", "a new top-level file; put it in an area, or list it in "
100
- f"[check] root_files"))
105
+ f"{table} root_files"))
101
106
  continue
102
107
  area = area_of(path, areas)
103
108
  if area is None:
104
109
  if parts[0] not in tops:
105
110
  findings.append(finding(path, "top-level-dir", f"{parts[0]}/ is in no area; use an existing area, or "
106
- f"add the folder to one in [check]"))
111
+ f"add the folder to one in {table}"))
107
112
  else:
108
113
  findings.append(finding(path, "no-area", "in no area; move it into one, or add its folder to an area "
109
- "in [check]"))
114
+ f"in {table}"))
110
115
  continue
111
116
  kind = areas[area]
112
117
  relative = PurePosixPath(path).relative_to(area).parts
@@ -158,13 +163,51 @@ def toml_at(root: Path, revision: str | None, name: str) -> dict:
158
163
  raise CheckError(f"{name} at {revision or 'the working tree'}: {exc}") from exc
159
164
 
160
165
 
161
- def guard_changes(root: Path, base: str, check: Check) -> list[str]:
162
- """What this change does to the checks: their settings, CI, and the repo's own check scripts."""
163
- before, after = toml_at(root, base, FILE), toml_at(root, None, FILE)
164
- if "check" not in before:
165
- return [] # the checks are being installed
166
- changes = [f"{FILE} [{name}]" for name in ("check", "merge") if before.get(name) != after.get(name)]
166
+ def settings(config: Config, root: Path) -> tuple[Check | None, bool]:
167
+ """The check settings in force and whether they came from the code repo's pyproject.toml.
168
+
169
+ A [tool.dkitchen.check] table in `root`'s pyproject.toml wins over the kitchen's [check], so a repo can run the
170
+ same checks without the kitchen. Raises ValueError when that table is malformed."""
171
+ path = root / "pyproject.toml"
172
+ if path.is_file():
173
+ try:
174
+ data = tomllib.loads(path.read_text(encoding="utf-8"))
175
+ except tomllib.TOMLDecodeError as exc:
176
+ raise ValueError(f"{path}: {exc}") from exc
177
+ table = pyproject_check(data)
178
+ if table is not None:
179
+ if config.check is not None and root not in IGNORED_WARNED:
180
+ IGNORED_WARNED.add(root)
181
+ print(f"ding: {config.root / FILE} [check] is ignored: {path} has [tool.dkitchen.check]",
182
+ file=sys.stderr)
183
+ return check_section(table, "pyproject.toml", PYPROJECT_TABLE), True
184
+ return config.check, False
185
+
186
+
187
+ def pyproject_check(data: dict) -> object:
188
+ table = data.get("tool", {})
189
+ table = table.get("dkitchen", {}) if isinstance(table, dict) else {}
190
+ return table.get("check") if isinstance(table, dict) else None
191
+
192
+
193
+ def guard_changes(root: Path, base: str, check: Check, *, own_config: bool = True, from_pyproject: bool = False,
194
+ kitchen_check: bool = False) -> list[str]:
195
+ """What this change does to the checks: their settings, CI, and the repo's own check scripts.
196
+
197
+ `own_config` is false when the checks' settings live in a kitchen repo apart from the code repo; changes to
198
+ them are that repo's business, and the code repo's tools and CI are still guarded. `from_pyproject` is true when the
199
+ settings in use are the code repo's own [tool.dkitchen.check]; the kitchen's [check] is then not a check.
200
+ `kitchen_check` says a kitchen apart from the code repo has a [check], so checks were already in force at `base`."""
201
+ changes = []
167
202
  old, new = toml_at(root, base, "pyproject.toml"), toml_at(root, None, "pyproject.toml")
203
+ before, after = (toml_at(root, base, FILE), toml_at(root, None, FILE)) if own_config else ({}, {})
204
+ if pyproject_check(old) is None and "check" not in before and not (kitchen_check and not own_config):
205
+ return [] # no checks were in force at base: they are being installed
206
+ if own_config:
207
+ names = ("merge",) if from_pyproject else ("check", "merge")
208
+ changes = [f"{FILE} [{name}]" for name in names if before.get(name) != after.get(name)]
209
+ if pyproject_check(old) != pyproject_check(new):
210
+ changes.append(f"pyproject.toml {PYPROJECT_TABLE}")
168
211
  changes += [f"pyproject.toml [tool.{name}]" for name in ("ruff", "importlinter")
169
212
  if old.get("tool", {}).get(name) != new.get("tool", {}).get(name)]
170
213
  changed = set(paths(git(root, "diff", "--name-only", "-z", "--no-renames", base, "--"))) | set(untracked(root))
@@ -179,9 +222,9 @@ def guard_trailers(root: Path, base: str) -> list[str]:
179
222
  return [value.strip() for value in log.split("\0") if TRAILER.match(value.strip())]
180
223
 
181
224
 
182
- def run_tool(root: Path, rule: str, argv: list[str]) -> dict | None:
225
+ def run_tool(root: Path, rule: str, argv: list[str], table: str = "[check]") -> dict | None:
183
226
  if shutil.which(argv[0]) is None:
184
- return finding(".", rule, f"{argv[0]} is not installed; install it, or turn {rule} off in [check]")
227
+ return finding(".", rule, f"{argv[0]} is not installed; install it, or turn {rule} off in {table}")
185
228
  result = subprocess.run(argv, cwd=root, capture_output=True, text=True)
186
229
  if result.returncode:
187
230
  output = (result.stdout + result.stderr).strip()
@@ -190,25 +233,33 @@ def run_tool(root: Path, rule: str, argv: list[str]) -> dict | None:
190
233
 
191
234
 
192
235
  def check(args, config: Config) -> int:
193
- settings = config.check
194
- if settings is None:
195
- print(f"ding check: {FILE} has no [check] table; the build-repo skill sets it up", file=sys.stderr)
236
+ try:
237
+ root = kitchens.code_checkout(config)
238
+ found, from_pyproject = settings(config, root)
239
+ except (OSError, ValueError) as error:
240
+ print(f"ding check: {error}", file=sys.stderr)
196
241
  return 2
197
- root = config.root
242
+ if found is None:
243
+ print(f"ding check: {NO_TABLE}; the build-repo skill sets it up", file=sys.stderr)
244
+ return 2
245
+ standard = found.rules or (STANDARD if not config.split else str(config.root / STANDARD))
198
246
  try:
199
247
  base = git(root, "rev-parse", "--verify", "--end-of-options", f"{args.base}^{{commit}}").strip()
200
- findings = layout(root, base, settings)
201
- excluded = ",".join(settings.vendor + settings.outputs)
248
+ table = PYPROJECT_TABLE if from_pyproject else "[check]"
249
+ findings = layout(root, base, found, table)
250
+ excluded = ",".join(found.vendor + found.outputs)
202
251
  exclude = ["--extend-exclude", excluded] if excluded else []
203
252
  tools = []
204
- if settings.ruff:
253
+ if found.ruff:
205
254
  tools += [("ruff", ["ruff", "check", "--quiet", *exclude, "."]),
206
255
  ("format", ["ruff", "format", "--check", "--quiet", *exclude, "."])]
207
- if settings.imports:
256
+ if found.imports:
208
257
  tools.append(("imports", ["lint-imports"]))
209
- tools += [("command", [*argv, "--base", base]) for argv in settings.commands]
210
- findings += [item for rule, argv in tools if (item := run_tool(root, rule, argv))]
211
- changes, trailers = guard_changes(root, base, settings), guard_trailers(root, base)
258
+ tools += [("command", [*argv, "--base", base]) for argv in found.commands]
259
+ findings += [item for rule, argv in tools if (item := run_tool(root, rule, argv, table))]
260
+ changes = guard_changes(root, base, found, own_config=not config.split, from_pyproject=from_pyproject,
261
+ kitchen_check=config.check is not None)
262
+ trailers = guard_trailers(root, base)
212
263
  if changes and not trailers:
213
264
  findings.append(finding(".", "guard-change", "this change touches the checks (" + ", ".join(changes) +
214
265
  "); add a commit trailer `Guard-change: #<ticket> <reason>`"))
@@ -224,23 +275,24 @@ def check(args, config: Config) -> int:
224
275
  print(f"{location}: {item['rule']}: {item['message']}")
225
276
  for trailer in trailers:
226
277
  print(f"Guard-change: {trailer}")
227
- print(f"ding check: {len(findings)} problem(s); rules in {STANDARD}" if findings else "ding check: passed")
278
+ print(f"ding check: {len(findings)} problem(s); rules in {standard}" if findings else "ding check: passed")
228
279
  return int(bool(findings))
229
280
 
230
281
 
231
282
  def module_map(args, config: Config) -> int:
232
- settings = config.check
233
- if settings is None and not args.paths:
234
- print(f"ding map: {FILE} has no [check] table; name the folders to map", file=sys.stderr)
235
- return 2
236
- folders = [path.strip("/") for path in args.paths] or list(settings.library)
237
283
  try:
238
- files = set(paths(git(config.root, "ls-files", "-z", "--", *folders))) | {
239
- path for path in untracked(config.root) if area_of(path, dict.fromkeys(folders, "")) is not None}
240
- except CheckError as error:
284
+ root = kitchens.code_checkout(config)
285
+ found = settings(config, root)[0]
286
+ if found is None and not args.paths:
287
+ print(f"ding map: {NO_TABLE}; name the folders to map", file=sys.stderr)
288
+ return 2
289
+ folders = [path.strip("/") for path in args.paths] or list(found.library)
290
+ files = set(paths(git(root, "ls-files", "-z", "--", *folders))) | {
291
+ path for path in untracked(root) if area_of(path, dict.fromkeys(folders, "")) is not None}
292
+ except (CheckError, OSError, ValueError) as error:
241
293
  print(f"ding map: {error}", file=sys.stderr)
242
294
  return 2
243
295
  for path in sorted(path for path in files if path.endswith(".py")):
244
- source = (config.root / path).read_text(encoding="utf-8", errors="replace")
296
+ source = (root / path).read_text(encoding="utf-8", errors="replace")
245
297
  print(f"{path}: {docstring_line(source) or '(no docstring)'}")
246
298
  return 0