stewardkit 0.1.0__tar.gz → 0.2.0__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.
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.claude-plugin/marketplace.json +2 -2
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.claude-plugin/plugin.json +1 -1
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.stewardkit.toml +1 -1
- {stewardkit-0.1.0 → stewardkit-0.2.0}/CHANGELOG.md +11 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/PKG-INFO +9 -2
- {stewardkit-0.1.0 → stewardkit-0.2.0}/README.md +8 -1
- {stewardkit-0.1.0 → stewardkit-0.2.0}/SECURITY.md +3 -2
- {stewardkit-0.1.0 → stewardkit-0.2.0}/docs/configuration.md +5 -5
- stewardkit-0.2.0/docs/findings.md +37 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/docs/how-it-works.md +2 -2
- stewardkit-0.2.0/docs/nits/style.md +7 -0
- stewardkit-0.2.0/docs/nits/wording.md +8 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/docs/tests.md +3 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/plugin.json +1 -1
- {stewardkit-0.1.0 → stewardkit-0.2.0}/pyproject.toml +1 -1
- {stewardkit-0.1.0 → stewardkit-0.2.0}/skills/steward-init/SKILL.md +1 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/skills/steward-orchestrate/SKILL.md +2 -2
- {stewardkit-0.1.0 → stewardkit-0.2.0}/skills/steward-sweep/SKILL.md +1 -1
- {stewardkit-0.1.0 → stewardkit-0.2.0}/src/stewardkit/__init__.py +1 -1
- {stewardkit-0.1.0 → stewardkit-0.2.0}/src/stewardkit/config.py +35 -1
- {stewardkit-0.1.0 → stewardkit-0.2.0}/src/stewardkit/doctor.py +77 -14
- {stewardkit-0.1.0 → stewardkit-0.2.0}/tests/test_doctor.py +182 -1
- {stewardkit-0.1.0 → stewardkit-0.2.0}/tests/test_harnesses.py +83 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/uv.lock +1 -1
- stewardkit-0.1.0/docs/findings.md +0 -31
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.gitattributes +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.github/copilot-instructions.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.github/dependabot.yml +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.github/instructions/stewardkit.instructions.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.github/workflows/ci.yml +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.github/workflows/release.yml +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.gitignore +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/.pre-commit-hooks.yaml +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/AGENTS.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/CLAUDE.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/CONTRIBUTING.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/LICENSE +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/docs/intent.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/docs/nits/README.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/docs/nits/ergonomics.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/docs/nits/refactor.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/rules/AGENTS.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/skills/steward-intent-bar/SKILL.md +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/src/stewardkit/cli.py +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/src/stewardkit/harnesses.py +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/src/stewardkit/installer.py +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/src/stewardkit/markers.py +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/src/stewardkit/templates.py +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/src/stewardkit/test_parity.py +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/tests/test_cli_init_sync.py +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/tests/test_install_global.py +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/tests/test_markers.py +0 -0
- {stewardkit-0.1.0 → stewardkit-0.2.0}/tests/test_test_parity.py +0 -0
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Multi-harness specialist orchestration, intent-first quality bar, frozen read-only review sweeps, and findings tracking for software repositories.",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.2.0"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "stewardkit",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "Multi-harness specialist orchestration, intent-first quality bar, frozen read-only review sweeps, and findings tracking for software repositories.",
|
|
16
|
-
"version": "0.
|
|
16
|
+
"version": "0.2.0",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Mitchell Abbott"
|
|
19
19
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stewardkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Multi-harness specialist orchestration, intent-first quality bar, frozen read-only review sweeps, and findings tracking for software repositories.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mitchell Abbott"
|
|
@@ -15,7 +15,7 @@ recommended_specialist_catalog = "https://github.com/msitarzewski/agency-agents"
|
|
|
15
15
|
default_branch = "main"
|
|
16
16
|
delivery_mode = "pull-request"
|
|
17
17
|
merge_strategy = "squash"
|
|
18
|
-
blocked_staged_globs = [".env", ".env.*", ".stewardkit.local.toml", "*.db", "*.sqlite", "*.sqlite3", "*.pem", "*.key"]
|
|
18
|
+
blocked_staged_globs = [".env", ".env.*", "!.env.example", ".stewardkit.local.toml", "*.db", "*.sqlite", "*.sqlite3", "*.pem", "*.key"]
|
|
19
19
|
|
|
20
20
|
[stewardkit.hygiene]
|
|
21
21
|
min_free_disk_gb = 5.0
|
|
@@ -6,6 +6,17 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.2.0] - 2026-12-05
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Added segment-aware gitignore-style `!` negation allowlist support to `git.blocked_staged_globs` (evaluated in order with last-match-wins semantics, preserving duplicate order for re-blocking; `*`/`?`/`[...]` match within a single path segment without crossing `/`, `**` crosses directory segments, leading `/` or `./` anchors to the repo root, trailing `/` matches directory contents, and empty or anchor/dot-only patterns are rejected with `ConfigError`).
|
|
14
|
+
- Documented `pip install stewardkit` and Homebrew tap (`brew install mitchell-abbott/tap/stewardkit`) installation options in `README.md`.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Updated `DEFAULT_BLOCKED_STAGED_GLOBS` to include `"!.env.example"` immediately after `".env.*"` (replacing the previous hardcoded `.env.example`/`.env.sample`/`.env.template` exemption in `doctor` `git_hygiene`) so `.env.example` templates can be staged by default while `.env` and secret `.env.*` variants remain blocked.
|
|
19
|
+
|
|
9
20
|
## [0.1.0] - 2026-12-02
|
|
10
21
|
|
|
11
22
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: stewardkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Multi-harness orchestration, intent-first review sweep, and test-parity toolkit for AI coding agents.
|
|
5
5
|
Project-URL: Homepage, https://github.com/mitchell-abbott/stewardkit
|
|
6
6
|
Project-URL: Repository, https://github.com/mitchell-abbott/stewardkit
|
|
@@ -68,6 +68,12 @@ pipx install stewardkit
|
|
|
68
68
|
|
|
69
69
|
# Or with mise
|
|
70
70
|
mise use -g "pipx:stewardkit"
|
|
71
|
+
|
|
72
|
+
# Or with pip (inside a virtualenv or CI)
|
|
73
|
+
pip install stewardkit
|
|
74
|
+
|
|
75
|
+
# Or with Homebrew (macOS / Linux)
|
|
76
|
+
brew install mitchell-abbott/tap/stewardkit
|
|
71
77
|
```
|
|
72
78
|
|
|
73
79
|
From GitHub `main` (unreleased changes): `uv tool install git+https://github.com/mitchell-abbott/stewardkit.git`
|
|
@@ -257,6 +263,7 @@ In Global Mode, agents respect the repository's existing rules first, infer the
|
|
|
257
263
|
- **Company / OSS repo (zero repo files):** Run `stewardkit user-config init` once; inspect mode with `stewardkit config` and scan Python tests with `stewardkit check-tests --doc-readers-only`.
|
|
258
264
|
- **JS/TS colocated tests vs. Go/Rust/Java repos:** For colocated `src/**/*.test.ts`, set `tests.roots = ["."]` (build/VCS dirs like `node_modules` are skipped automatically). For Go, Rust, Java, C#, Ruby, PHP, Swift, or Kotlin repos, keep `bar.require_tests_doc_parity = false` (`check-tests` parses Python and JS/TS/TSX and emits an advisory `unsupported_lang` warning otherwise).
|
|
259
265
|
- **PR-only teams & large repos (directory docs):** Set `docs.findings = ""` to opt out of `docs/findings.md`, and point `docs.intent`, `docs.how_it_works`, or `docs.tests` to directories (e.g., `docs.tests = "docs/tests"` scans all contained `.md` files recursively, skipping `README.md` and symlinks).
|
|
266
|
+
- **Staging guard allowlists (`git.blocked_staged_globs`):** Supports gitignore-style `!` negation entries evaluated in order (last match wins, matching both repo-relative path and basename). By default, `"!.env.example"` follows `".env.*"` so `.env.example` templates remain committable while `.env`, `.env.local`, `.env.production`, and other secret variants stay blocked.
|
|
260
267
|
- **Clean uninstall:** `stewardkit uninstall-repo --remove-config` strips managed blocks from a repo (preserving user content and deleting kit-only files); `stewardkit install-global --uninstall` removes only `stewardkit` global assets without touching user skills.
|
|
261
268
|
|
|
262
269
|
### Pre-Commit & Consumer GitHub Actions CI
|
|
@@ -265,7 +272,7 @@ In Global Mode, agents respect the repository's existing rules first, infer the
|
|
|
265
272
|
# .pre-commit-config.yaml
|
|
266
273
|
repos:
|
|
267
274
|
- repo: https://github.com/mitchell-abbott/stewardkit
|
|
268
|
-
rev: v0.
|
|
275
|
+
rev: v0.2.0
|
|
269
276
|
hooks:
|
|
270
277
|
- id: stewardkit-sync-check
|
|
271
278
|
- id: stewardkit-check-tests
|
|
@@ -44,6 +44,12 @@ pipx install stewardkit
|
|
|
44
44
|
|
|
45
45
|
# Or with mise
|
|
46
46
|
mise use -g "pipx:stewardkit"
|
|
47
|
+
|
|
48
|
+
# Or with pip (inside a virtualenv or CI)
|
|
49
|
+
pip install stewardkit
|
|
50
|
+
|
|
51
|
+
# Or with Homebrew (macOS / Linux)
|
|
52
|
+
brew install mitchell-abbott/tap/stewardkit
|
|
47
53
|
```
|
|
48
54
|
|
|
49
55
|
From GitHub `main` (unreleased changes): `uv tool install git+https://github.com/mitchell-abbott/stewardkit.git`
|
|
@@ -233,6 +239,7 @@ In Global Mode, agents respect the repository's existing rules first, infer the
|
|
|
233
239
|
- **Company / OSS repo (zero repo files):** Run `stewardkit user-config init` once; inspect mode with `stewardkit config` and scan Python tests with `stewardkit check-tests --doc-readers-only`.
|
|
234
240
|
- **JS/TS colocated tests vs. Go/Rust/Java repos:** For colocated `src/**/*.test.ts`, set `tests.roots = ["."]` (build/VCS dirs like `node_modules` are skipped automatically). For Go, Rust, Java, C#, Ruby, PHP, Swift, or Kotlin repos, keep `bar.require_tests_doc_parity = false` (`check-tests` parses Python and JS/TS/TSX and emits an advisory `unsupported_lang` warning otherwise).
|
|
235
241
|
- **PR-only teams & large repos (directory docs):** Set `docs.findings = ""` to opt out of `docs/findings.md`, and point `docs.intent`, `docs.how_it_works`, or `docs.tests` to directories (e.g., `docs.tests = "docs/tests"` scans all contained `.md` files recursively, skipping `README.md` and symlinks).
|
|
242
|
+
- **Staging guard allowlists (`git.blocked_staged_globs`):** Supports gitignore-style `!` negation entries evaluated in order (last match wins, matching both repo-relative path and basename). By default, `"!.env.example"` follows `".env.*"` so `.env.example` templates remain committable while `.env`, `.env.local`, `.env.production`, and other secret variants stay blocked.
|
|
236
243
|
- **Clean uninstall:** `stewardkit uninstall-repo --remove-config` strips managed blocks from a repo (preserving user content and deleting kit-only files); `stewardkit install-global --uninstall` removes only `stewardkit` global assets without touching user skills.
|
|
237
244
|
|
|
238
245
|
### Pre-Commit & Consumer GitHub Actions CI
|
|
@@ -241,7 +248,7 @@ In Global Mode, agents respect the repository's existing rules first, infer the
|
|
|
241
248
|
# .pre-commit-config.yaml
|
|
242
249
|
repos:
|
|
243
250
|
- repo: https://github.com/mitchell-abbott/stewardkit
|
|
244
|
-
rev: v0.
|
|
251
|
+
rev: v0.2.0
|
|
245
252
|
hooks:
|
|
246
253
|
- id: stewardkit-sync-check
|
|
247
254
|
- id: stewardkit-check-tests
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
| Version | Supported |
|
|
6
6
|
| --- | --- |
|
|
7
|
-
| `0.
|
|
7
|
+
| `0.2.x` | Yes |
|
|
8
|
+
| `< 0.2.0` | No |
|
|
8
9
|
|
|
9
10
|
## Reporting a Vulnerability
|
|
10
11
|
|
|
@@ -20,4 +21,4 @@ Do **not** open public GitHub issues for security bugs, path-containment bypasse
|
|
|
20
21
|
- **Home-directory, user-config, & global-rules isolation:** `install-global` never modifies `~/.gemini/config/config.json` or unrelated user plugins/skills, refuses symlinked global rules files on upsert (and skips them on uninstall), and copies strictly a 4-asset allowlist (`plugin.json`, `.claude-plugin/`, `rules/`, `skills/`) for Antigravity copy mode. Reading user-level `config.toml` (`load_user_config_data`) supports valid file symlinks (for dotfiles repositories) while rejecting broken/cyclic symlinks and directories with `ConfigError`, whereas writing (`write_user_config` / `stewardkit user-config init`) always refuses symlinked targets even with `--force`. Explicit custom `--home` calls confine ambient `$XDG_CONFIG_HOME`, `$XDG_STATE_HOME`, `%APPDATA%`, and `%LOCALAPPDATA%` lookups inside `--home`.
|
|
21
22
|
- **4-layer config & `.stewardkit.local.toml` boundary:** Local overrides are restricted to seven personal/machine keys (`orchestration_mode`, `recommended_specialist_catalog`, `docs.timezone`, `docs.clock_format`, `hygiene.min_free_disk_gb`, `hygiene.disk_check_path`, `hygiene.allow_overnight_loops`), and in Project mode user-level `config.toml` supplies fallback defaults only for those same seven personal/machine keys when omitted in shared `.stewardkit.toml` (never weakening team `profile`, `[stewardkit.bar]`, `[stewardkit.git]`, `[stewardkit.tests]`, shared doc paths, or `hygiene.max_followups_before_checkin`). Security and policy settings are locked to shared `.stewardkit.toml`, repo-only keys are rejected in user config on `schema_version <= 1`, and `[stewardkit.projectless]` is allowed only in user config. `sync`, `uninstall-repo`, and `check-tests` load shared config with `include_local=False` and `include_user=False` so broken user or local configs never affect team/CI runs. External `hygiene.disk_check_path` values in shared `.stewardkit.toml` are never probed by `doctor` (external paths must come from `.stewardkit.local.toml` or user-level `config.toml`).
|
|
22
23
|
- **No dynamic code execution during parity checks:** `stewardkit check-tests` uses pure static analysis (`ast.parse` for Python and a custom lexer for JS/TS/TSX) and never imports or executes target repository code.
|
|
23
|
-
- **Blocked secret/local-config staging:** Default `git.blocked_staged_globs` blocks staging `.env`, `.env.*` (
|
|
24
|
+
- **Blocked secret/local-config staging:** Default `git.blocked_staged_globs` blocks staging `.env`, `.env.*` (allowing `.env.example` via ordered `!` negation `"!.env.example"`), `.stewardkit.local.toml`, database files, and key/certificate files (`*.pem`, `*.key`), and `doctor` flags tracked or unignored `.stewardkit.local.toml` files.
|
|
@@ -97,9 +97,9 @@ default_branch = "main" # Protected default branch
|
|
|
97
97
|
# delivery_mode = "pull-request" # Omitted in minimal output when matching profile
|
|
98
98
|
merge_strategy = "no-ff" # "no-ff" | "squash" | "ff-only"
|
|
99
99
|
blocked_staged_globs = [
|
|
100
|
-
".env", ".env.*", ".stewardkit.local.toml",
|
|
100
|
+
".env", ".env.*", "!.env.example", ".stewardkit.local.toml",
|
|
101
101
|
"*.db", "*.sqlite", "*.sqlite3", "*.pem", "*.key",
|
|
102
|
-
]
|
|
102
|
+
] # Ordered gitignore-style rules (`!` allowlists; last match wins)
|
|
103
103
|
|
|
104
104
|
[stewardkit.hygiene]
|
|
105
105
|
min_free_disk_gb = 5.0 # Finite float >= 0 (0 disables disk check)
|
|
@@ -154,7 +154,7 @@ ignore_globs = [] # Globs excluded from discovery & doc-rea
|
|
|
154
154
|
| `default_branch` | `str` | `"main"` (all profiles) | Non-empty string with no whitespace. | Locked to shared (inferred from git in Global Mode) | `default_branch = "develop"` |
|
|
155
155
|
| `delivery_mode` | `str` | `direct-merge` / `pull-request` / `pull-request` | Must be `"pull-request"` or `"direct-merge"`. | Locked to shared (allowed in user config for Global Mode) | `delivery_mode = "pull-request"` |
|
|
156
156
|
| `merge_strategy` | `str` | `"no-ff"` (all profiles) | Must be `"no-ff"`, `"squash"`, or `"ff-only"`. | Locked to shared | `merge_strategy = "squash"` |
|
|
157
|
-
| `blocked_staged_globs` | `list[str]` | `[".env", ".env.*", ".stewardkit.local.toml", "*.db", "*.sqlite", "*.sqlite3", "*.pem", "*.key"]` | List of non-empty strings (may be empty `[]`). Checked by `doctor` against staged `ACMR` files (allowing `git rm
|
|
157
|
+
| `blocked_staged_globs` | `list[str]` | `[".env", ".env.*", "!.env.example", ".stewardkit.local.toml", "*.db", "*.sqlite", "*.sqlite3", "*.pem", "*.key"]` | List of non-empty strings (may be empty `[]`); empty or anchor/dot-only patterns (`"!"`, `"!/"`, `"./"`, `"/"`, `"."`) raise `ConfigError`. Checked by `doctor` against staged `ACMR` files (allowing `git rm`). Supports segment-aware gitignore-style `!` negation allowlist entries evaluated in order (last matching rule wins, preserving duplicate order for re-blocking): `*`/`?`/`[...]` match within a single path segment (never crossing `/`), `**` matches across directory segments (`a/**` matches nested files inside `a/`), leading `/` or `./` anchors to the repo root, unanchored patterns without `/` match both basename and repo-relative path, and trailing `/` matches files inside matching directories. | Locked to shared (allowed in user config for Global Mode) | `blocked_staged_globs = [".env", ".env.*", "!.env.example", "*.pem"]` |
|
|
158
158
|
|
|
159
159
|
#### `[stewardkit.hygiene]` (4 keys)
|
|
160
160
|
|
|
@@ -300,9 +300,9 @@ orchestration_mode = "auto" # Also acts as Project Mode fallback if o
|
|
|
300
300
|
[stewardkit.git]
|
|
301
301
|
delivery_mode = "pull-request" # Global Mode default delivery mode
|
|
302
302
|
blocked_staged_globs = [
|
|
303
|
-
".env", ".env.*", ".stewardkit.local.toml",
|
|
303
|
+
".env", ".env.*", "!.env.example", ".stewardkit.local.toml",
|
|
304
304
|
"*.db", "*.sqlite", "*.sqlite3", "*.pem", "*.key",
|
|
305
|
-
]
|
|
305
|
+
] # Ordered gitignore-style rules (`!` allowlists; last match wins)
|
|
306
306
|
|
|
307
307
|
[stewardkit.hygiene]
|
|
308
308
|
min_free_disk_gb = 10.0 # Project Mode fallback + Global Mode default
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Findings & Sweep Log
|
|
2
|
+
|
|
3
|
+
Tracks active branch progress, review rounds, kept findings, and follow-ups for `stewardkit`. Exempt from reviewer findings (`bar.exempt_review_files`). Never delete dropped findings or follow-ups—mark them `Dropped` with the reason. All timestamps are in US Central Time (`CT`, 12-hour clock).
|
|
4
|
+
|
|
5
|
+
## Current Branch Overview
|
|
6
|
+
|
|
7
|
+
| Branch | Started (CT) | Status | Next Gate |
|
|
8
|
+
| --- | --- | --- | --- |
|
|
9
|
+
| `release/v0.2.0` | Dec 5, 2026, 1:23 AM CT | Sweep Clean | Push, PR, CI, & v0.2.0 tag |
|
|
10
|
+
|
|
11
|
+
## Active Branch Steps & Kept Findings
|
|
12
|
+
|
|
13
|
+
- **Round 1 Checkpoint (`0bbb6c3`, Dec 5, 2026, 1:29 AM CT):** Frozen release review and independent triage returned 2 Kept Bar #4 findings in `SECURITY.md`.
|
|
14
|
+
- **Round 2 Fresh Re-Review (`51823c9`, Dec 5, 2026, 1:32 AM CT):** Fresh read-only re-review verified `F1` and `F2` resolved and cleared with **0 new findings** and **0 nits**.
|
|
15
|
+
|
|
16
|
+
| ID | Triage | Bar | Status | Summary |
|
|
17
|
+
| --- | --- | --- | --- | --- |
|
|
18
|
+
| `F1` | `Keep` | #4 | `Verified (Round 2)` | `SECURITY.md:5-7` Supported Versions table still listed only `0.1.x` instead of `0.2.x` / `< 0.2.0`. |
|
|
19
|
+
| `F2` | `Keep` | #4 | `Verified (Round 2)` | `SECURITY.md:23` still referenced the removed hardcoded `.env.example`/`.env.sample`/`.env.template` exemption instead of ordered `!` negation `"!.env.example"` in `DEFAULT_BLOCKED_STAGED_GLOBS`. |
|
|
20
|
+
|
|
21
|
+
## Completed Branches
|
|
22
|
+
|
|
23
|
+
| Branch | Started (CT) | Merged (CT) | Merge Commit | Summary |
|
|
24
|
+
| --- | --- | --- | --- | --- |
|
|
25
|
+
| `feat/blocked-staged-globs-negation` | Dec 5, 2026, 12:43 AM CT | Dec 5, 2026, 1:20 AM CT | `d811ab1` | Added segment-aware gitignore-style `!` negation allowlist support in `git.blocked_staged_globs` and default `"!.env.example"`; cleared 3 review rounds (`F1`–`F5` resolved, 0 findings on Round 3). |
|
|
26
|
+
|
|
27
|
+
## Follow-Ups
|
|
28
|
+
|
|
29
|
+
| ID | Status | Started (CT) | Completed (CT) | Summary |
|
|
30
|
+
| --- | --- | --- | --- | --- |
|
|
31
|
+
| — | — | — | — | None |
|
|
32
|
+
|
|
33
|
+
## Upcoming Stages
|
|
34
|
+
|
|
35
|
+
| Stage | Status | Summary |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| — | — | None |
|
|
@@ -116,7 +116,7 @@ Key invariants `(Owner, intent 1.3)`:
|
|
|
116
116
|
|
|
117
117
|
## 4 Configuration Schema, Profiles, User-Level Config, & Local Overrides
|
|
118
118
|
|
|
119
|
-
`src/stewardkit/config.py` loads `.stewardkit.toml`, optional user-level `config.toml`, and optional `.stewardkit.local.toml` via Python's stdlib `tomllib`, validates every section and field strictly (rejecting unknown root/section keys, invalid profiles/modes, invalid types, path traversal via `..`, absolute paths, and dot-only doc paths such as `.` or `./` while normalizing `./` segments in repo-relative fields, invalid IANA timezones, unknown harnesses, negative or non-finite disk/followup thresholds, and any `skills_mode` other than `"global"`), and serializes deterministically via `dump_config(cfg, full=False)` / `render_config_toml` (omitting profile-governed keys that match `PROFILE_DEFAULTS[cfg.profile]` by default so editing `profile` switches them cleanly, or emitting all keys with `full=True`, never serializing runtime-only fields like `mode`, `projectless`, `user_config_path`, `user_overrides`, `local_overrides`, or `config_warnings`, while preserving non-BMP Unicode characters and escaping `\x7f` as `\u007f` for TOML compliance) `(Owner, intent 1.4–1.6, 1.9, 1.11–1.13)`.
|
|
119
|
+
`src/stewardkit/config.py` loads `.stewardkit.toml`, optional user-level `config.toml`, and optional `.stewardkit.local.toml` via Python's stdlib `tomllib`, validates every section and field strictly (rejecting unknown root/section keys, invalid profiles/modes, invalid types, path traversal via `..`, absolute paths, and dot-only doc paths such as `.` or `./` while normalizing `./` segments in repo-relative fields, invalid IANA timezones, unknown harnesses, negative or non-finite disk/followup thresholds, empty or anchor/dot-only patterns in `git.blocked_staged_globs` validated via `normalize_blocked_staged_glob_pattern` in `GitConfig` while preserving duplicate rule order and including `"!.env.example"` right after `".env.*"` by default, and any `skills_mode` other than `"global"`), and serializes deterministically via `dump_config(cfg, full=False)` / `render_config_toml` (omitting profile-governed keys that match `PROFILE_DEFAULTS[cfg.profile]` by default so editing `profile` switches them cleanly, or emitting all keys with `full=True`, never serializing runtime-only fields like `mode`, `projectless`, `user_config_path`, `user_overrides`, `local_overrides`, or `config_warnings`, while preserving non-BMP Unicode characters and escaping `\x7f` as `\u007f` for TOML compliance) `(Owner, intent 1.4–1.6, 1.9, 1.11–1.13)`.
|
|
120
120
|
|
|
121
121
|
### Config Inspection, 4-Layer Precedence, Schema Versioning, & Provenance (`stewardkit config`)
|
|
122
122
|
|
|
@@ -212,7 +212,7 @@ Contributors can place an optional, gitignored `.stewardkit.local.toml` beside `
|
|
|
212
212
|
| 7 | `local_config` | Validates optional `.stewardkit.local.toml` independently of shared `.stewardkit.toml` (`PASS` listing active dotted override keys when applied in project or global mode, `PASS` noting valid overrides are inactive when `.stewardkit.toml` exists and fails validation, or confirming none; `FAIL` on locked shared/user-only keys/tables, unknown keys, invalid values, malformed TOML, or bad paths/symlinks) `(Owner, intent 1.12)`. |
|
|
213
213
|
| * | `schema_version` *(conditional)* | Emitted as an advisory `WARN` (never `FAIL`) only when `.stewardkit.toml` or user-level `config.toml` declares `schema_version > CURRENT_SCHEMA_VERSION` and triggers forward-compatibility warnings (listing ignored future keys/tables). |
|
|
214
214
|
| 8 | `repo_sync` | Returns `PASS` (`skipped`) in `excluded` and `global` modes. In `project` mode, loads shared `.stewardkit.toml` (isolated from user and local config errors) and runs `sync_repo(..., check=True)` (`FAIL` on invalid shared config, non-UTF-8 targets, symlinked/escaping repo targets, marker errors, `24,000`-byte cap violations, or drift). |
|
|
215
|
-
| 9 | `git_hygiene` | Returns `PASS` (`skipped`) in `excluded` mode. Detects git repositories cleanly across standalone repos and monorepo subdirectories via `git rev-parse --show-toplevel` (`PASS` as a non-git scratch folder in `global` mode; `WARN` in `project` mode), checks staged files via `git -c core.quotepath=false diff --cached --name-only --diff-filter=ACMR` against `git.blocked_staged_globs` (
|
|
215
|
+
| 9 | `git_hygiene` | Returns `PASS` (`skipped`) in `excluded` mode. Detects git repositories cleanly across standalone repos and monorepo subdirectories via `git rev-parse --show-toplevel` (`PASS` as a non-git scratch folder in `global` mode; `WARN` in `project` mode), checks staged files via `git -c core.quotepath=false diff --cached --name-only --diff-filter=ACMR` against `git.blocked_staged_globs` using `normalize_blocked_staged_glob_pattern` and segment-aware pure-stdlib gitignore-style `!` negation matching (last matching rule wins, preserving duplicate order in `git.blocked_staged_globs` for re-blocking; `*`/`?`/`[...]` match within a single path segment without crossing `/`, `**` crosses directory segments, leading `/` or `./` anchors to the repo root, trailing `/` matches files inside matching directories, empty or anchor/dot-only patterns are rejected by `GitConfig` with `ConfigError`, staged `git rm` deletions are allowed, `"!.env.example"` follows `".env.*"` by default, and user `blocked_staged_globs` are honored in global git repos), fails if `.stewardkit.local.toml` is tracked (`git ls-files`), warns if an existing `.stewardkit.local.toml` is not gitignored (`git check-ignore`), and warns if the working tree is dirty directly on `git.default_branch` (inferred in global mode). |
|
|
216
216
|
| 10 | `tests_parity` | Returns `PASS` (`skipped`) in `excluded` and `global` modes, or `PASS` (`disabled by config`) when `bar.require_tests_doc_parity` is `false`. When `true` in `project` mode, validates `docs.tests` (single file or directory) with `assert_contained_path(..., allow_symlinks=False)` (`FAIL` on symlinked or escaping docs) and runs `check_tests_parity` (`WARN` if the tests doc does not exist yet or if `0` Python/JS tests are found alongside non-Python/JS test files; `FAIL` on parity, non-UTF-8 parse errors, or doc-reader violations; `PASS` when matching 1:1) `(Owner, intent 1.11)`. |
|
|
217
217
|
|
|
218
218
|
## 7 CI, Pre-Commit Hooks, & Release Packaging
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Style Nits
|
|
2
|
+
|
|
3
|
+
Optional formatting, naming, and stylistic cleanups outside **The Bar** (sweep-exempt; addressed strictly on the owner's schedule).
|
|
4
|
+
|
|
5
|
+
| Status | Location | Note |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| `Open` | `tests/test_doctor.py`, `tests/test_harnesses.py` | Extra trailing blank lines at EOF (logged Dec 5, 2026, 12:58 AM CT). |
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Wording Nits
|
|
2
|
+
|
|
3
|
+
Optional prose, comments, and phrasing polish outside **The Bar** (sweep-exempt; addressed strictly on the owner's schedule).
|
|
4
|
+
|
|
5
|
+
| Status | Location | Note |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| `Open` | `docs/configuration.md:157` | Tighten `"unanchored patterns without / match both basename and repo-relative path"` to `"unanchored patterns without / match the filename (basename) at any depth"` (logged Dec 5, 2026, 1:08 AM CT). |
|
|
8
|
+
| `Open` | `docs/tests.md:173` | Optionally mention trailing `/.` and `**/` directory-only guards in the description for `test_blocked_staged_globs_negation_order_and_nested_paths` (logged Dec 5, 2026, 1:13 AM CT). |
|
|
@@ -54,6 +54,7 @@ Every unit test in `stewardkit` paired with the application behavior it protects
|
|
|
54
54
|
- `test_windows_drive_and_root_relative_appdata_env_vars_fall_back_safely`: Drive-relative, root-relative, and plain relative `%APPDATA%` and `%LOCALAPPDATA%` environment values fall back safely to standard home-relative paths across `user_config_path`, `external_state_dir`, and Windows `resolve_harness_paths`, while truly absolute Windows drive-rooted paths are honored.
|
|
55
55
|
- `test_resolve_path_strict_cycles_rejects_loops_and_resolves_dangling_and_missing_paths`: Strict symlink-cycle path resolution resolves existing, missing, relative, and genuine dangling symlink paths cleanly while raising `OSError(ELOOP)` across direct, mutual, relative, growing, and trailing-segment symlink loops (including under the Windows/Python 3.13 fallback walker and Windows filename-resolution loop errors), without falsely failing on macOS Seatbelt-style `EPERM` ancestor errors.
|
|
56
56
|
- `test_assert_contained_path_rejects_foreign_windows_drives_and_unc_without_probing`: Repository path containment rejects foreign Windows drive letters and UNC network paths with `ConfigError` before probing foreign ancestors on disk.
|
|
57
|
+
- `test_blocked_staged_globs_default_order_preservation_and_empty_negation_rejection`: Verifies `"!.env.example"` follows `".env.*"` in `DEFAULT_BLOCKED_STAGED_GLOBS`, preserves rule order including repeated globs across `GitConfig` and TOML round-trips for last-match-wins re-blocking, and rejects bare `"!"`, anchor-only, and dot-only empty patterns (both negated and non-negated) with `ConfigError` in both repo and user configs.
|
|
57
58
|
|
|
58
59
|
## 3 Repo Init & Sync
|
|
59
60
|
|
|
@@ -169,3 +170,5 @@ Every unit test in `stewardkit` paired with the application behavior it protects
|
|
|
169
170
|
- `test_doctor_fails_closed_on_nonexistent_file_and_dangling_symlink_repo`: `run_doctor` raises `ConfigError` for nonexistent paths, regular files, and dangling symlinks, and `stewardkit doctor --json` exits non-zero with structured JSON error payloads rather than failing open in Global mode.
|
|
170
171
|
- `test_doctor_validate_kit_manifests_handles_non_utf8_and_unreadable_files_without_aborting`: Manifest validation catches invalid UTF-8 bytes and unreadable-file `OSError` failures across `plugin.json`, `.claude-plugin/plugin.json`, `rules/AGENTS.md`, and `skills/*/SKILL.md`, collecting all errors cleanly into a `FAIL` `kit_manifests` diagnostic across Python API and `doctor --json`.
|
|
171
172
|
- `test_doctor_codex_partial_halves_across_agents_and_codex_roots_reports_warn`: Global install diagnostics evaluate each Codex skill root independently so splitting bundled workflow skills across `~/.agents/skills` and `~/.codex/skills` reports a partial-install `WARN`, transitioning to `PASS` once at least one root contains the complete skill set.
|
|
173
|
+
- `test_blocked_staged_globs_negation_order_and_nested_paths`: Verifies `matches_blocked_staged_glob` blocks `.env` and secret `.env.*` variants at root and nested paths, allows `.env.example` via default `"!.env.example"`, enforces ordered last-match-wins re-blocking and negation ordering, enforces segment-aware wildcard boundaries (`*` does not cross `/`, `**` matches across subdirectories), normalizes leading `./` and `/./` with root anchoring, supports path-scoped and trailing-`/` directory patterns, and normalizes Windows backslash paths.
|
|
174
|
+
- `test_doctor_git_hygiene_allows_env_example_and_honors_negation_rules`: Verifies `run_doctor` `git_hygiene` passes when staging `.env.example` at root or nested paths under defaults, fails when staging `.env` or secret `.env.*` variants, and honors custom ordered negation and re-blocking rules end to end.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "stewardkit",
|
|
3
3
|
"displayName": "StewardKit",
|
|
4
4
|
"description": "Multi-harness specialist orchestration, intent-first quality bar, frozen read-only review sweeps, and findings tracking for software repositories.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.2.0",
|
|
6
6
|
"author": "Mitchell Abbott",
|
|
7
7
|
"repository": "https://github.com/mitchell-abbott/stewardkit",
|
|
8
8
|
"suggestedPrompts": [
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "stewardkit"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "Multi-harness orchestration, intent-first review sweep, and test-parity toolkit for AI coding agents."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -45,6 +45,7 @@ All 8 CLI subcommands support `--json` for CI/automation. All repo commands acce
|
|
|
45
45
|
- **Inspect & uninstall:** `stewardkit config [--home <dir>] [--json]` auto-detects `project`, `global`, or `excluded` mode and prints `git_repo`, `inferred_default_branch`, `user_config`, `[stewardkit.projectless]` (including `external_state_dir` in `global` mode when `state_mode = "external"`), `resolved_timezone`, `user_overrides`, `local_overrides`, `warnings`, and per-key provenance (`default`|`profile`|`user`|`shared`|`local`). `stewardkit uninstall-repo [--remove-config] [--dry-run] [--json]` strips managed blocks cleanly while preserving user rules, EOLs, and POSIX modes.
|
|
46
46
|
- **User-level config & 4-layer precedence (`stewardkit user-config {init,path,show}`):** Cross-OS `~/.config/stewardkit/config.toml` (`$XDG_CONFIG_HOME` / `%APPDATA%`) configures personal/Global Mode defaults plus `[stewardkit.projectless]` (`state_mode = "chat" | "external"`, `exclude_paths`). Resolution follows 4 layers (`profile -> user -> shared -> local`): in `project` mode user config fills only omitted keys from the 7-key personal/machine allowlist; in `global` mode full user defaults apply with zero repo files created; paths matching `exclude_paths` (without `.stewardkit.toml`) enter `excluded` mode.
|
|
47
47
|
- **`.stewardkit.local.toml` (gitignored via `--update-gitignore`, in default `blocked_staged_globs`):** allows **only 7 personal/machine keys**: `[stewardkit]` (`orchestration_mode`, `recommended_specialist_catalog`), `[stewardkit.docs]` (`timezone`, `clock_format`), `[stewardkit.hygiene]` (`min_free_disk_gb`, `disk_check_path`, `allow_overnight_loops`). Every shared key/table (`schema_version`, `[stewardkit.bar]`, `[stewardkit.git]`, `[stewardkit.tests]`, `profile`, harness/sync keys, doc paths, `hygiene.max_followups_before_checkin`, and user-only `[stewardkit.projectless]`) is locked out of `.stewardkit.local.toml` and raises `ConfigError`.
|
|
48
|
+
- **`git.blocked_staged_globs` negations:** supports gitignore-style `!` allowlist entries evaluated in order (last match wins, matching both repo-relative path and basename; `"!.env.example"` follows `".env.*"` by default).
|
|
48
49
|
|
|
49
50
|
### Mode A — New Project
|
|
50
51
|
|
|
@@ -50,7 +50,7 @@ Prevent multi-harness drift by recording project-specific rules (outside `<!-- s
|
|
|
50
50
|
|
|
51
51
|
- **Active monitoring:** stop scope creep, reviewer edits during freeze, forbidden actions (deploying, force-pushing, staging `git.blocked_staged_globs`, runaway tests), and low disk space immediately; escalate stalls right away.
|
|
52
52
|
- **Anti-loop guardrails:** honor `hygiene.allow_overnight_loops` (`false` = stop at a clean checkpoint); pause to check in if findings repeat, fail to converge, or exceed `hygiene.max_followups_before_checkin` (`> 0`) new follow-ups; respect `bar.protected_files` and safety guards.
|
|
53
|
-
- **Disk, secret, & scratchpad hygiene:** check free disk at `hygiene.disk_check_path` against `hygiene.min_free_disk_gb` (`> 0`) before every review/fix round; pass `--basetemp <session-scratchpad>/<subagent-temp>` and delete temp repo copies/`--basetemp` dirs before reporting; never force-push; verify `git diff --cached --name-only` blocks `git.blocked_staged_globs` (including `.stewardkit.local.toml`).
|
|
53
|
+
- **Disk, secret, & scratchpad hygiene:** check free disk at `hygiene.disk_check_path` against `hygiene.min_free_disk_gb` (`> 0`) before every review/fix round; pass `--basetemp <session-scratchpad>/<subagent-temp>` and delete temp repo copies/`--basetemp` dirs before reporting; never force-push; verify `git diff --cached --name-only` blocks `git.blocked_staged_globs` (including `.stewardkit.local.toml`; gitignore-style `!` negation allowlists are evaluated in order, last match wins, with `"!.env.example"` allowed by default).
|
|
54
54
|
|
|
55
55
|
## Pitfalls
|
|
56
56
|
|
|
@@ -65,4 +65,4 @@ Prevent multi-harness drift by recording project-specific rules (outside `<!-- s
|
|
|
65
65
|
2. Execution matched effective `profile` and `orchestration_mode` cleanly without fabricated delegation.
|
|
66
66
|
3. Free disk at `hygiene.disk_check_path` meets `hygiene.min_free_disk_gb` (`> 0`).
|
|
67
67
|
4. Any same-spot choice passes both test sets and is logged under **"Same-spot choices"** in `docs.how_it_works`.
|
|
68
|
-
5. Zero `git.blocked_staged_globs` are staged, and all temp copies and `--basetemp` dirs are deleted.
|
|
68
|
+
5. Zero files blocked by `git.blocked_staged_globs` (honoring ordered `!` negations) are staged, and all temp copies and `--basetemp` dirs are deleted.
|
|
@@ -28,7 +28,7 @@ Scale ceremony to `[stewardkit].profile`:
|
|
|
28
28
|
Pre-flight:
|
|
29
29
|
1. Check free disk at `hygiene.disk_check_path` against `hygiene.min_free_disk_gb` (`> 0`).
|
|
30
30
|
2. Run tests under `tests.roots` (honoring `tests.ignore_globs`), plus `stewardkit check-tests` when `bar.require_tests_doc_parity = true`.
|
|
31
|
-
3. **Checkpoint commit & push** (via git specialist when delegating): commit branch changes with zero `git.blocked_staged_globs` staged; check `git remote` and push to `origin` only if configured (never force-push; skip pushes cleanly in local-only repos).
|
|
31
|
+
3. **Checkpoint commit & push** (via git specialist when delegating): commit branch changes with zero files blocked by `git.blocked_staged_globs` staged (gitignore-style `!` negations evaluated in order, last match wins; `"!.env.example"` allowed by default); check `git remote` and push to `origin` only if configured (never force-push; skip pushes cleanly in local-only repos).
|
|
32
32
|
|
|
33
33
|
### 2. Frozen Diff-Scoped Read-Only Review
|
|
34
34
|
|
|
@@ -81,6 +81,7 @@ PROFILE_DEFAULTS: dict[str, dict[str, Any]] = {
|
|
|
81
81
|
DEFAULT_BLOCKED_STAGED_GLOBS: tuple[str, ...] = (
|
|
82
82
|
".env",
|
|
83
83
|
".env.*",
|
|
84
|
+
"!.env.example",
|
|
84
85
|
LOCAL_CONFIG_FILENAME,
|
|
85
86
|
"*.db",
|
|
86
87
|
"*.sqlite",
|
|
@@ -661,6 +662,7 @@ def _validate_str_list(
|
|
|
661
662
|
allow_empty: bool = True,
|
|
662
663
|
rel_paths: bool = False,
|
|
663
664
|
allow_dot: bool = False,
|
|
665
|
+
dedupe: bool = True,
|
|
664
666
|
) -> list[str]:
|
|
665
667
|
if not isinstance(value, list):
|
|
666
668
|
raise ConfigError(f"{field_name} must be a list of strings")
|
|
@@ -673,7 +675,9 @@ def _validate_str_list(
|
|
|
673
675
|
entry = _validate_rel_path(item, f"{field_name}[{idx}]", allow_dot=allow_dot)
|
|
674
676
|
else:
|
|
675
677
|
entry = _validate_nonempty_str(item, f"{field_name}[{idx}]")
|
|
676
|
-
if
|
|
678
|
+
if not dedupe:
|
|
679
|
+
cleaned.append(entry)
|
|
680
|
+
elif entry not in seen:
|
|
677
681
|
seen.add(entry)
|
|
678
682
|
cleaned.append(entry)
|
|
679
683
|
return cleaned
|
|
@@ -752,6 +756,27 @@ def _validate_timezone(value: Any) -> str:
|
|
|
752
756
|
return tz
|
|
753
757
|
|
|
754
758
|
|
|
759
|
+
def normalize_blocked_staged_glob_pattern(
|
|
760
|
+
pattern: str,
|
|
761
|
+
) -> tuple[bool, bool, bool, tuple[str, ...]]:
|
|
762
|
+
"""Parse a `git.blocked_staged_globs` entry into `(negated, anchored, dir_only, segments)`.
|
|
763
|
+
|
|
764
|
+
Normalizes separators to `/`, drops empty and `.` segments, detects leading `!`
|
|
765
|
+
negation, treats any `/` except trailing slashes as anchoring the rule to repo root,
|
|
766
|
+
and treats trailing `/` or `/.` as directory-only rules.
|
|
767
|
+
"""
|
|
768
|
+
negated = pattern.startswith("!")
|
|
769
|
+
raw_pat = pattern[1:] if negated else pattern
|
|
770
|
+
if not raw_pat.strip():
|
|
771
|
+
return negated, False, False, ()
|
|
772
|
+
pat_norm = raw_pat.replace("\\", "/")
|
|
773
|
+
stripped_trailing = pat_norm.rstrip("/")
|
|
774
|
+
anchored = "/" in stripped_trailing
|
|
775
|
+
dir_only = pat_norm.endswith("/") or stripped_trailing.endswith("/.")
|
|
776
|
+
segments = tuple(seg for seg in pat_norm.split("/") if seg and seg != ".")
|
|
777
|
+
return negated, anchored, dir_only, segments
|
|
778
|
+
|
|
779
|
+
|
|
755
780
|
@dataclass
|
|
756
781
|
class GitConfig:
|
|
757
782
|
"""Git branch, delivery, merge, and staging hygiene rules (`[stewardkit.git]`)."""
|
|
@@ -785,7 +810,16 @@ class GitConfig:
|
|
|
785
810
|
self.blocked_staged_globs,
|
|
786
811
|
"git.blocked_staged_globs",
|
|
787
812
|
allow_empty=True,
|
|
813
|
+
dedupe=False,
|
|
788
814
|
)
|
|
815
|
+
for idx, entry in enumerate(self.blocked_staged_globs):
|
|
816
|
+
negated, _anchored, _dir_only, segments = normalize_blocked_staged_glob_pattern(entry)
|
|
817
|
+
if not segments:
|
|
818
|
+
if negated:
|
|
819
|
+
raise ConfigError(
|
|
820
|
+
f"git.blocked_staged_globs[{idx}] negation pattern must not be empty"
|
|
821
|
+
)
|
|
822
|
+
raise ConfigError(f"git.blocked_staged_globs[{idx}] pattern must not be empty")
|
|
789
823
|
|
|
790
824
|
|
|
791
825
|
@dataclass
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from collections.abc import Callable
|
|
5
|
+
from collections.abc import Callable, Sequence
|
|
6
6
|
from dataclasses import dataclass
|
|
7
7
|
import fnmatch
|
|
8
8
|
import json
|
|
@@ -23,6 +23,7 @@ from stewardkit.config import (
|
|
|
23
23
|
assert_contained_path,
|
|
24
24
|
load_config,
|
|
25
25
|
load_user_config_data,
|
|
26
|
+
normalize_blocked_staged_glob_pattern,
|
|
26
27
|
resolve_path_strict_cycles,
|
|
27
28
|
user_config_path,
|
|
28
29
|
validate_local_config,
|
|
@@ -38,8 +39,6 @@ from stewardkit.harnesses import (
|
|
|
38
39
|
from stewardkit.installer import MANAGED_SKILL_NAMES, _is_kit_root, find_kit_root, sync_repo
|
|
39
40
|
from stewardkit.test_parity import check_tests_parity, find_unsupported_language_test_files
|
|
40
41
|
|
|
41
|
-
_ALLOWED_ENV_SAMPLES = frozenset({".env.example", ".env.sample", ".env.template"})
|
|
42
|
-
|
|
43
42
|
|
|
44
43
|
@dataclass(frozen=True)
|
|
45
44
|
class CheckResult:
|
|
@@ -538,18 +537,82 @@ def _check_repo_sync(
|
|
|
538
537
|
)
|
|
539
538
|
|
|
540
539
|
|
|
541
|
-
def
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
540
|
+
def _match_glob_segments(path_segs: tuple[str, ...], pat_segs: tuple[str, ...]) -> bool:
|
|
541
|
+
"""Match normalized path segments against glob pattern segments (`O(P * S)` iterative DP)."""
|
|
542
|
+
collapsed: list[str] = []
|
|
543
|
+
for seg in pat_segs:
|
|
544
|
+
if seg == "**" and collapsed and collapsed[-1] == "**":
|
|
545
|
+
continue
|
|
546
|
+
collapsed.append(seg)
|
|
547
|
+
|
|
548
|
+
m = len(collapsed)
|
|
549
|
+
n = len(path_segs)
|
|
550
|
+
if m == 0:
|
|
551
|
+
return n == 0
|
|
552
|
+
|
|
553
|
+
dp = [False] * (n + 1)
|
|
554
|
+
dp[0] = True
|
|
555
|
+
|
|
556
|
+
for i, pat in enumerate(collapsed):
|
|
557
|
+
next_dp = [False] * (n + 1)
|
|
558
|
+
if pat == "**":
|
|
559
|
+
if i == m - 1:
|
|
560
|
+
seen = False
|
|
561
|
+
for j in range(1, n + 1):
|
|
562
|
+
if dp[j - 1]:
|
|
563
|
+
seen = True
|
|
564
|
+
next_dp[j] = seen
|
|
565
|
+
else:
|
|
566
|
+
seen = False
|
|
567
|
+
for j in range(n + 1):
|
|
568
|
+
if dp[j]:
|
|
569
|
+
seen = True
|
|
570
|
+
next_dp[j] = seen
|
|
571
|
+
else:
|
|
572
|
+
for j in range(1, n + 1):
|
|
573
|
+
if dp[j - 1] and fnmatch.fnmatchcase(path_segs[j - 1], pat):
|
|
574
|
+
next_dp[j] = True
|
|
575
|
+
dp = next_dp
|
|
576
|
+
|
|
577
|
+
return dp[n]
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
def matches_blocked_staged_glob(path_str: str, patterns: Sequence[str]) -> bool:
|
|
581
|
+
"""Return True if `path_str` is blocked by ordered `patterns` (with `!` negation, last match wins)."""
|
|
582
|
+
rel_norm = path_str.replace("\\", "/")
|
|
583
|
+
rel_segments = tuple(seg.lower() for seg in rel_norm.split("/") if seg and seg != ".")
|
|
584
|
+
if not rel_segments:
|
|
585
|
+
return False
|
|
586
|
+
name_lower = rel_segments[-1]
|
|
587
|
+
|
|
588
|
+
blocked = False
|
|
546
589
|
for pattern in patterns:
|
|
547
|
-
|
|
548
|
-
if
|
|
590
|
+
negated, anchored, dir_only, raw_segs = normalize_blocked_staged_glob_pattern(pattern)
|
|
591
|
+
if not raw_segs:
|
|
549
592
|
continue
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
593
|
+
pat_segs = tuple(seg.lower() for seg in raw_segs)
|
|
594
|
+
if dir_only:
|
|
595
|
+
if len(rel_segments) < 2:
|
|
596
|
+
matched = False
|
|
597
|
+
else:
|
|
598
|
+
if anchored or len(pat_segs) > 1:
|
|
599
|
+
effective_segs = (*pat_segs, "**")
|
|
600
|
+
else:
|
|
601
|
+
effective_segs = ("**", *pat_segs, "**")
|
|
602
|
+
matched = _match_glob_segments(rel_segments, effective_segs)
|
|
603
|
+
elif not anchored and len(pat_segs) == 1:
|
|
604
|
+
if pat_segs[0] == "**":
|
|
605
|
+
matched = True
|
|
606
|
+
else:
|
|
607
|
+
matched = fnmatch.fnmatchcase(name_lower, pat_segs[0])
|
|
608
|
+
else:
|
|
609
|
+
matched = _match_glob_segments(rel_segments, pat_segs)
|
|
610
|
+
if matched:
|
|
611
|
+
blocked = not negated
|
|
612
|
+
return blocked
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
_matches_blocked_staged_glob = matches_blocked_staged_glob
|
|
553
616
|
|
|
554
617
|
|
|
555
618
|
def _check_git_hygiene(repo_root: Path, cfg: WorkflowConfig) -> CheckResult:
|
|
@@ -588,7 +651,7 @@ def _check_git_hygiene(repo_root: Path, cfg: WorkflowConfig) -> CheckResult:
|
|
|
588
651
|
bad_staged = [
|
|
589
652
|
line.strip()
|
|
590
653
|
for line in staged.stdout.splitlines()
|
|
591
|
-
if line.strip() and
|
|
654
|
+
if line.strip() and matches_blocked_staged_glob(line.strip(), cfg.git.blocked_staged_globs)
|
|
592
655
|
]
|
|
593
656
|
if bad_staged:
|
|
594
657
|
return CheckResult(
|
|
@@ -12,6 +12,7 @@ import pytest
|
|
|
12
12
|
from stewardkit.cli import main
|
|
13
13
|
from stewardkit.config import (
|
|
14
14
|
CONFIG_FILENAME,
|
|
15
|
+
DEFAULT_BLOCKED_STAGED_GLOBS,
|
|
15
16
|
DEFAULT_SPECIALIST_CATALOG,
|
|
16
17
|
LOCAL_CONFIG_FILENAME,
|
|
17
18
|
ConfigError,
|
|
@@ -20,7 +21,13 @@ from stewardkit.config import (
|
|
|
20
21
|
write_config,
|
|
21
22
|
write_user_config,
|
|
22
23
|
)
|
|
23
|
-
from stewardkit.doctor import
|
|
24
|
+
from stewardkit.doctor import (
|
|
25
|
+
_matches_blocked_staged_glob,
|
|
26
|
+
has_failures,
|
|
27
|
+
matches_blocked_staged_glob,
|
|
28
|
+
run_doctor,
|
|
29
|
+
validate_kit_manifests,
|
|
30
|
+
)
|
|
24
31
|
from stewardkit.harnesses import ANTIGRAVITY_MAX_RULE_BYTES
|
|
25
32
|
from stewardkit.installer import MANAGED_SKILL_NAMES, init_repo, install_global
|
|
26
33
|
|
|
@@ -1344,5 +1351,179 @@ def test_doctor_codex_partial_halves_across_agents_and_codex_roots_reports_warn(
|
|
|
1344
1351
|
assert "codex" in global_complete.detail
|
|
1345
1352
|
|
|
1346
1353
|
|
|
1354
|
+
def test_blocked_staged_globs_negation_order_and_nested_paths() -> None:
|
|
1355
|
+
assert _matches_blocked_staged_glob is matches_blocked_staged_glob
|
|
1356
|
+
|
|
1357
|
+
# 1. Default globs block .env and real env variants across root, nested POSIX, and Windows paths
|
|
1358
|
+
for blocked_path in (
|
|
1359
|
+
".env",
|
|
1360
|
+
".env.local",
|
|
1361
|
+
".env.production",
|
|
1362
|
+
".ENV.LOCAL",
|
|
1363
|
+
"apps/web/.env",
|
|
1364
|
+
"apps/web/.env.local",
|
|
1365
|
+
"apps/web/.env.production",
|
|
1366
|
+
"apps\\web\\.env.local",
|
|
1367
|
+
):
|
|
1368
|
+
assert matches_blocked_staged_glob(blocked_path, DEFAULT_BLOCKED_STAGED_GLOBS) is True, (
|
|
1369
|
+
blocked_path
|
|
1370
|
+
)
|
|
1371
|
+
|
|
1372
|
+
# 2. Default globs allow .env.example (case-insensitive, root and nested POSIX/Windows paths)
|
|
1373
|
+
for allowed_path in (
|
|
1374
|
+
".env.example",
|
|
1375
|
+
".ENV.EXAMPLE",
|
|
1376
|
+
"apps/web/.env.example",
|
|
1377
|
+
"apps\\web\\.env.example",
|
|
1378
|
+
):
|
|
1379
|
+
assert matches_blocked_staged_glob(allowed_path, DEFAULT_BLOCKED_STAGED_GLOBS) is False, (
|
|
1380
|
+
allowed_path
|
|
1381
|
+
)
|
|
1382
|
+
|
|
1383
|
+
# 3. Re-blocking after negation follows last-match-wins semantics
|
|
1384
|
+
reblock_exact = [".env.*", "!.env.example", ".env.example"]
|
|
1385
|
+
assert matches_blocked_staged_glob(".env.example", reblock_exact) is True
|
|
1386
|
+
assert matches_blocked_staged_glob("apps/web/.env.example", reblock_exact) is True
|
|
1387
|
+
|
|
1388
|
+
reblock_glob = [".env.*", "!.env.example", ".env.*"]
|
|
1389
|
+
assert matches_blocked_staged_glob(".env.example", reblock_glob) is True
|
|
1390
|
+
assert matches_blocked_staged_glob("apps/web/.env.example", reblock_glob) is True
|
|
1391
|
+
|
|
1392
|
+
reblock_scoped = [".env.*", "!.env.example", "apps/prod/.env.example"]
|
|
1393
|
+
assert matches_blocked_staged_glob(".env.example", reblock_scoped) is False
|
|
1394
|
+
assert matches_blocked_staged_glob("apps/web/.env.example", reblock_scoped) is False
|
|
1395
|
+
assert matches_blocked_staged_glob("apps/prod/.env.example", reblock_scoped) is True
|
|
1396
|
+
|
|
1397
|
+
negate_before_block = ["!.env.example", ".env.*"]
|
|
1398
|
+
assert matches_blocked_staged_glob(".env.example", negate_before_block) is True
|
|
1399
|
+
|
|
1400
|
+
# 4. Path-scoped negation allows only the matching subpath
|
|
1401
|
+
scoped_negation = [".env.*", "!apps/web/.env.example"]
|
|
1402
|
+
assert matches_blocked_staged_glob("apps/web/.env.example", scoped_negation) is False
|
|
1403
|
+
assert matches_blocked_staged_glob("apps/api/.env.example", scoped_negation) is True
|
|
1404
|
+
assert matches_blocked_staged_glob(".env.example", scoped_negation) is True
|
|
1405
|
+
|
|
1406
|
+
# 5. Root-anchored negation allows only the repo-root file, not nested copies
|
|
1407
|
+
root_anchored = [".env.*", "!/.env.example"]
|
|
1408
|
+
assert matches_blocked_staged_glob(".env.example", root_anchored) is False
|
|
1409
|
+
assert matches_blocked_staged_glob("./.env.example", root_anchored) is False
|
|
1410
|
+
assert matches_blocked_staged_glob("apps/web/.env.example", root_anchored) is True
|
|
1411
|
+
|
|
1412
|
+
# 6. Negation on an unmatched path stays unblocked
|
|
1413
|
+
assert matches_blocked_staged_glob(".env.example", ["!.env.example"]) is False
|
|
1414
|
+
assert matches_blocked_staged_glob("README.md", ["!.env.example"]) is False
|
|
1415
|
+
|
|
1416
|
+
# 7. Segment boundaries prevent wildcard negation safety bypasses across `/`
|
|
1417
|
+
assert matches_blocked_staged_glob("apps/prod/.env.example", [".env.*", "!/*.example"]) is True
|
|
1418
|
+
assert matches_blocked_staged_glob("dev-ops/prod/live.pem", ["*.pem", "!/dev-*.pem"]) is True
|
|
1419
|
+
assert (
|
|
1420
|
+
matches_blocked_staged_glob("apps/dev/prod/secret.key", ["*.key", "!apps/dev/*.key"])
|
|
1421
|
+
is True
|
|
1422
|
+
)
|
|
1423
|
+
assert matches_blocked_staged_glob("apps/dev/mock.key", ["*.key", "!apps/dev/*.key"]) is False
|
|
1424
|
+
assert (
|
|
1425
|
+
matches_blocked_staged_glob("apps/dev/prod/mock.key", ["*.key", "!apps/dev/**/*.key"])
|
|
1426
|
+
is False
|
|
1427
|
+
)
|
|
1428
|
+
assert (
|
|
1429
|
+
matches_blocked_staged_glob("apps/dev/mock.key", ["*.key", "!apps/dev/**/*.key"]) is False
|
|
1430
|
+
)
|
|
1431
|
+
|
|
1432
|
+
# 8. False-positive regressions: root-anchored wildcard and directory names matching `.env.*`
|
|
1433
|
+
assert matches_blocked_staged_glob("tests/fixtures/mock.key", ["/*.key"]) is False
|
|
1434
|
+
assert (
|
|
1435
|
+
matches_blocked_staged_glob(".env.templates/README.md", DEFAULT_BLOCKED_STAGED_GLOBS)
|
|
1436
|
+
is False
|
|
1437
|
+
)
|
|
1438
|
+
|
|
1439
|
+
# 9. Leading `./`, `/./`, directory-trailing `/`, and trailing `/**` semantics
|
|
1440
|
+
assert matches_blocked_staged_glob(".env", ["./.env"]) is True
|
|
1441
|
+
assert matches_blocked_staged_glob("./.env", ["./.env"]) is True
|
|
1442
|
+
assert matches_blocked_staged_glob("/./.env", ["/.env"]) is True
|
|
1443
|
+
assert matches_blocked_staged_glob("apps/web/.env", ["./.env"]) is False
|
|
1444
|
+
assert matches_blocked_staged_glob(".env.example", [".env.*", "!./.env.example"]) is False
|
|
1445
|
+
assert matches_blocked_staged_glob("apps/prod/.env.example", [".env.*", "!./.env.example"]) is True
|
|
1446
|
+
assert matches_blocked_staged_glob("secrets/token.txt", ["secrets/"]) is True
|
|
1447
|
+
assert matches_blocked_staged_glob("apps/secrets/nested/token.txt", ["secrets/"]) is True
|
|
1448
|
+
assert matches_blocked_staged_glob("secrets", ["secrets/"]) is False
|
|
1449
|
+
assert matches_blocked_staged_glob("apps/secrets/token.txt", ["/secrets/"]) is False
|
|
1450
|
+
assert matches_blocked_staged_glob("secrets/nested/token.txt", ["/secrets/"]) is True
|
|
1451
|
+
assert matches_blocked_staged_glob("a", ["a/**"]) is False
|
|
1452
|
+
assert matches_blocked_staged_glob("a/b", ["a/**"]) is True
|
|
1453
|
+
|
|
1454
|
+
# 10. Directory-only rules never match 1-segment root files; trailing `/.` and interior `/` anchor cleanly
|
|
1455
|
+
assert matches_blocked_staged_glob(".env", [".env", "!**/"]) is True
|
|
1456
|
+
assert matches_blocked_staged_glob(".env", [".env", "!/**/"]) is True
|
|
1457
|
+
assert matches_blocked_staged_glob("README.md", ["**/"]) is False
|
|
1458
|
+
assert matches_blocked_staged_glob("README.md", ["/**/"]) is False
|
|
1459
|
+
assert matches_blocked_staged_glob("apps/web/.env", [".env", "!**/"]) is False
|
|
1460
|
+
assert matches_blocked_staged_glob("prod/dev/secret.key", ["*.key", "!dev/./"]) is True
|
|
1461
|
+
assert matches_blocked_staged_glob("dev/mock.key", ["*.key", "!dev/./"]) is False
|
|
1462
|
+
assert matches_blocked_staged_glob("apps/prod/.env", [".env", "!.env/."]) is True
|
|
1463
|
+
assert matches_blocked_staged_glob(".env", [".env", "!.env/."]) is True
|
|
1464
|
+
assert matches_blocked_staged_glob(".env/mock.key", ["*.key", "!.env/."]) is False
|
|
1465
|
+
assert matches_blocked_staged_glob("a/foo.", ["a/foo."]) is True
|
|
1466
|
+
assert matches_blocked_staged_glob("a/foo./bar", ["a/foo."]) is False
|
|
1467
|
+
assert matches_blocked_staged_glob("apps/secrets/token.txt", ["secrets///"]) is True
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
def test_doctor_git_hygiene_allows_env_example_and_honors_negation_rules(tmp_path: Path) -> None:
|
|
1471
|
+
kit, home, repo = _setup_healthy_repo(tmp_path)
|
|
1472
|
+
disk_ok = lambda _p: _DiskUsage(100 * 1024**3, 50 * 1024**3, 50 * 1024**3)
|
|
1473
|
+
|
|
1474
|
+
# 1. With default config, staging root and nested .env.example passes git_hygiene
|
|
1475
|
+
(repo / ".env.example").write_text("API_URL=https://example.com\n", encoding="utf-8")
|
|
1476
|
+
(repo / "apps" / "web").mkdir(parents=True)
|
|
1477
|
+
(repo / "apps" / "web" / ".env.example").write_text("NEXT_PUBLIC_APP=demo\n", encoding="utf-8")
|
|
1478
|
+
subprocess.run(
|
|
1479
|
+
["git", "-C", str(repo), "add", "-f", ".env.example", "apps/web/.env.example"],
|
|
1480
|
+
check=True,
|
|
1481
|
+
capture_output=True,
|
|
1482
|
+
)
|
|
1483
|
+
res_allowed = run_doctor(repo_root=repo, home_dir=home, kit_root=kit, disk_usage_fn=disk_ok)
|
|
1484
|
+
assert next(r for r in res_allowed if r.name == "git_hygiene").status == "PASS"
|
|
1485
|
+
|
|
1486
|
+
# 2. Staging real .env files fails git_hygiene naming the offending path
|
|
1487
|
+
for bad_rel in (".env", ".env.local", ".env.production", "apps/web/.env.local"):
|
|
1488
|
+
bad_file = repo / bad_rel
|
|
1489
|
+
bad_file.parent.mkdir(parents=True, exist_ok=True)
|
|
1490
|
+
bad_file.write_text("SECRET=value\n", encoding="utf-8")
|
|
1491
|
+
subprocess.run(
|
|
1492
|
+
["git", "-C", str(repo), "add", "-f", bad_rel],
|
|
1493
|
+
check=True,
|
|
1494
|
+
capture_output=True,
|
|
1495
|
+
)
|
|
1496
|
+
res_bad = run_doctor(repo_root=repo, home_dir=home, kit_root=kit, disk_usage_fn=disk_ok)
|
|
1497
|
+
git_bad = next(r for r in res_bad if r.name == "git_hygiene")
|
|
1498
|
+
assert git_bad.status == "FAIL", bad_rel
|
|
1499
|
+
assert bad_rel in git_bad.detail
|
|
1500
|
+
subprocess.run(
|
|
1501
|
+
["git", "-C", str(repo), "reset", "HEAD", "--", bad_rel],
|
|
1502
|
+
check=True,
|
|
1503
|
+
capture_output=True,
|
|
1504
|
+
)
|
|
1505
|
+
bad_file.unlink()
|
|
1506
|
+
|
|
1507
|
+
# 3. Custom ordered negation + scoped re-block honors last-match-wins end-to-end
|
|
1508
|
+
cfg = load_config(repo, home_dir=home)
|
|
1509
|
+
cfg.git.blocked_staged_globs = [".env.*", "!.env.example", "apps/prod/.env.example"]
|
|
1510
|
+
write_config(repo, cfg)
|
|
1511
|
+
res_custom_ok = run_doctor(repo_root=repo, home_dir=home, kit_root=kit, disk_usage_fn=disk_ok)
|
|
1512
|
+
assert next(r for r in res_custom_ok if r.name == "git_hygiene").status == "PASS"
|
|
1513
|
+
|
|
1514
|
+
(repo / "apps" / "prod").mkdir(parents=True)
|
|
1515
|
+
(repo / "apps" / "prod" / ".env.example").write_text("PROD_KEY=placeholder\n", encoding="utf-8")
|
|
1516
|
+
subprocess.run(
|
|
1517
|
+
["git", "-C", str(repo), "add", "-f", "apps/prod/.env.example"],
|
|
1518
|
+
check=True,
|
|
1519
|
+
capture_output=True,
|
|
1520
|
+
)
|
|
1521
|
+
res_custom_fail = run_doctor(repo_root=repo, home_dir=home, kit_root=kit, disk_usage_fn=disk_ok)
|
|
1522
|
+
git_custom_fail = next(r for r in res_custom_fail if r.name == "git_hygiene")
|
|
1523
|
+
assert git_custom_fail.status == "FAIL"
|
|
1524
|
+
assert "apps/prod/.env.example" in git_custom_fail.detail
|
|
1525
|
+
|
|
1526
|
+
|
|
1527
|
+
|
|
1347
1528
|
|
|
1348
1529
|
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
from collections import namedtuple
|
|
6
6
|
import errno
|
|
7
7
|
import hashlib
|
|
8
|
+
import json
|
|
8
9
|
import os
|
|
9
10
|
from pathlib import Path
|
|
10
11
|
import stat
|
|
@@ -2173,6 +2174,88 @@ def test_assert_contained_path_rejects_foreign_windows_drives_and_unc_without_pr
|
|
|
2173
2174
|
), probed
|
|
2174
2175
|
|
|
2175
2176
|
|
|
2177
|
+
def test_blocked_staged_globs_default_order_preservation_and_empty_negation_rejection(
|
|
2178
|
+
tmp_path: Path,
|
|
2179
|
+
) -> None:
|
|
2180
|
+
# 1. Default blocked_staged_globs includes "!.env.example" immediately after ".env.*"
|
|
2181
|
+
env_glob_idx = DEFAULT_BLOCKED_STAGED_GLOBS.index(".env.*")
|
|
2182
|
+
assert DEFAULT_BLOCKED_STAGED_GLOBS[env_glob_idx + 1] == "!.env.example"
|
|
2183
|
+
|
|
2184
|
+
# 2. GitConfig and TOML round-trips preserve ordered duplicates (no silent deduplication)
|
|
2185
|
+
ordered_rules = [".env.*", "!.env.example", ".env.*"]
|
|
2186
|
+
git_cfg = GitConfig(blocked_staged_globs=ordered_rules)
|
|
2187
|
+
assert git_cfg.blocked_staged_globs == ordered_rules
|
|
2188
|
+
|
|
2189
|
+
repo = tmp_path / "repo"
|
|
2190
|
+
write_config(repo, WorkflowConfig(git=git_cfg))
|
|
2191
|
+
loaded = load_config(repo, include_user=False)
|
|
2192
|
+
assert loaded.git.blocked_staged_globs == ordered_rules
|
|
2193
|
+
|
|
2194
|
+
home = tmp_path / "home"
|
|
2195
|
+
uc_file = user_config_path(home=home, env={}, platform="linux")
|
|
2196
|
+
write_user_config(uc_file, blocked_staged_globs=ordered_rules)
|
|
2197
|
+
uc_data = load_user_config_data(home_dir=home, env={}, platform="linux")
|
|
2198
|
+
assert uc_data is not None
|
|
2199
|
+
assert uc_data.git["blocked_staged_globs"] == ordered_rules
|
|
2200
|
+
|
|
2201
|
+
# 3. Empty, whitespace-only, and anchor/dot-only negation or positive patterns raise ConfigError
|
|
2202
|
+
empty_negations = ("!", "! ", "!/", "!\\", "!///", "!./", "!.", "!/./")
|
|
2203
|
+
empty_positives = ("/", "\\", "///", "./", ".", "/.")
|
|
2204
|
+
|
|
2205
|
+
for idx, bad_pattern in enumerate(empty_negations):
|
|
2206
|
+
with pytest.raises(ConfigError, match="negation pattern must not be empty"):
|
|
2207
|
+
GitConfig(blocked_staged_globs=[".env.*", bad_pattern])
|
|
2208
|
+
|
|
2209
|
+
bad_repo = tmp_path / f"bad_neg_repo_{idx}"
|
|
2210
|
+
bad_repo.mkdir()
|
|
2211
|
+
(bad_repo / CONFIG_FILENAME).write_text(
|
|
2212
|
+
"[stewardkit]\n[stewardkit.git]\n"
|
|
2213
|
+
f"blocked_staged_globs = [\".env.*\", {json.dumps(bad_pattern)}]\n",
|
|
2214
|
+
encoding="utf-8",
|
|
2215
|
+
)
|
|
2216
|
+
with pytest.raises(ConfigError, match="negation pattern must not be empty"):
|
|
2217
|
+
load_config(bad_repo, include_user=False)
|
|
2218
|
+
|
|
2219
|
+
for idx, bad_pattern in enumerate(empty_positives):
|
|
2220
|
+
with pytest.raises(ConfigError, match="pattern must not be empty"):
|
|
2221
|
+
GitConfig(blocked_staged_globs=[".env.*", bad_pattern])
|
|
2222
|
+
|
|
2223
|
+
bad_repo = tmp_path / f"bad_pos_repo_{idx}"
|
|
2224
|
+
bad_repo.mkdir()
|
|
2225
|
+
(bad_repo / CONFIG_FILENAME).write_text(
|
|
2226
|
+
"[stewardkit]\n[stewardkit.git]\n"
|
|
2227
|
+
f"blocked_staged_globs = [\".env.*\", {json.dumps(bad_pattern)}]\n",
|
|
2228
|
+
encoding="utf-8",
|
|
2229
|
+
)
|
|
2230
|
+
with pytest.raises(ConfigError, match="pattern must not be empty"):
|
|
2231
|
+
load_config(bad_repo, include_user=False)
|
|
2232
|
+
|
|
2233
|
+
# User-level config rejects bare, whitespace, and anchor/dot-only entries (negated & positive)
|
|
2234
|
+
for idx, (bad_pattern, expected_msg) in enumerate(
|
|
2235
|
+
(
|
|
2236
|
+
("!", "negation pattern must not be empty"),
|
|
2237
|
+
("! ", "negation pattern must not be empty"),
|
|
2238
|
+
("!/", "negation pattern must not be empty"),
|
|
2239
|
+
("!./", "negation pattern must not be empty"),
|
|
2240
|
+
("/", "pattern must not be empty"),
|
|
2241
|
+
("./", "pattern must not be empty"),
|
|
2242
|
+
)
|
|
2243
|
+
):
|
|
2244
|
+
bad_home = tmp_path / f"bad_home_{idx}"
|
|
2245
|
+
bad_uc = user_config_path(home=bad_home, env={}, platform="linux")
|
|
2246
|
+
with pytest.raises(ConfigError, match=expected_msg):
|
|
2247
|
+
write_user_config(bad_uc, blocked_staged_globs=[".env.*", bad_pattern])
|
|
2248
|
+
bad_uc.parent.mkdir(parents=True, exist_ok=True)
|
|
2249
|
+
bad_uc.write_text(
|
|
2250
|
+
"[stewardkit]\n[stewardkit.git]\n"
|
|
2251
|
+
f"blocked_staged_globs = [\".env.*\", {json.dumps(bad_pattern)}]\n",
|
|
2252
|
+
encoding="utf-8",
|
|
2253
|
+
)
|
|
2254
|
+
with pytest.raises(ConfigError, match=expected_msg):
|
|
2255
|
+
load_user_config_data(home_dir=bad_home, env={}, platform="linux")
|
|
2256
|
+
|
|
2257
|
+
|
|
2258
|
+
|
|
2176
2259
|
|
|
2177
2260
|
|
|
2178
2261
|
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Findings & Sweep Log
|
|
2
|
-
|
|
3
|
-
Tracks active branch progress, review rounds, kept findings, and follow-ups for `stewardkit`. Exempt from reviewer findings (`bar.exempt_review_files`). Never delete dropped findings or follow-ups—mark them `Dropped` with the reason. All timestamps are in US Central Time (`CT`, 12-hour clock).
|
|
4
|
-
|
|
5
|
-
## Current Branch Overview
|
|
6
|
-
|
|
7
|
-
| Branch | Started (CT) | Status | Next Gate |
|
|
8
|
-
| --- | --- | --- | --- |
|
|
9
|
-
| `main` | — | Clean | — |
|
|
10
|
-
|
|
11
|
-
## Active Branch Steps & Kept Findings
|
|
12
|
-
|
|
13
|
-
None — main clean.
|
|
14
|
-
|
|
15
|
-
## Completed Branches
|
|
16
|
-
|
|
17
|
-
| Branch | Started (CT) | Merged (CT) | Merge Commit | Summary |
|
|
18
|
-
| --- | --- | --- | --- | --- |
|
|
19
|
-
| — | — | — | — | None |
|
|
20
|
-
|
|
21
|
-
## Follow-Ups
|
|
22
|
-
|
|
23
|
-
| ID | Status | Started (CT) | Completed (CT) | Summary |
|
|
24
|
-
| --- | --- | --- | --- | --- |
|
|
25
|
-
| — | — | — | — | None |
|
|
26
|
-
|
|
27
|
-
## Upcoming Stages
|
|
28
|
-
|
|
29
|
-
| Stage | Status | Summary |
|
|
30
|
-
| --- | --- | --- |
|
|
31
|
-
| — | — | None |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|