agent-signage 0.1.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.
- agent_signage-0.1.0/.github/workflows/ci.yml +33 -0
- agent_signage-0.1.0/.github/workflows/publish.yml +43 -0
- agent_signage-0.1.0/.gitignore +11 -0
- agent_signage-0.1.0/CHANGELOG.md +72 -0
- agent_signage-0.1.0/CITATION.cff +17 -0
- agent_signage-0.1.0/CODE_OF_CONDUCT.md +132 -0
- agent_signage-0.1.0/CONTRIBUTING.md +89 -0
- agent_signage-0.1.0/LICENSE +202 -0
- agent_signage-0.1.0/PKG-INFO +302 -0
- agent_signage-0.1.0/README.md +271 -0
- agent_signage-0.1.0/RELEASE-0.0.8.md +66 -0
- agent_signage-0.1.0/RELEASE-0.1.0.md +86 -0
- agent_signage-0.1.0/RELEASING.md +90 -0
- agent_signage-0.1.0/claude-plugin/.claude-plugin/plugin.json +11 -0
- agent_signage-0.1.0/claude-plugin/hooks/hooks.json +12 -0
- agent_signage-0.1.0/claude-plugin/scripts/hook.py +51 -0
- agent_signage-0.1.0/docs/design.md +135 -0
- agent_signage-0.1.0/docs/integrating.md +109 -0
- agent_signage-0.1.0/evals/baseline-0.0.7.json +42 -0
- agent_signage-0.1.0/evals/metrics-0.0.8.json +62 -0
- agent_signage-0.1.0/evals/metrics-0.1.0.json +73 -0
- agent_signage-0.1.0/examples/README.md +112 -0
- agent_signage-0.1.0/integrations/README.md +60 -0
- agent_signage-0.1.0/integrations/codex.md +56 -0
- agent_signage-0.1.0/integrations/copilot-sdk.md +48 -0
- agent_signage-0.1.0/integrations/opencode.md +66 -0
- agent_signage-0.1.0/integrations/openhands.md +76 -0
- agent_signage-0.1.0/pyproject.toml +69 -0
- agent_signage-0.1.0/src/agent_signage/__init__.py +8 -0
- agent_signage-0.1.0/src/agent_signage/__main__.py +183 -0
- agent_signage-0.1.0/src/agent_signage/gitfacts.py +236 -0
- agent_signage-0.1.0/src/agent_signage/hook.py +139 -0
- agent_signage-0.1.0/src/agent_signage/more_signs.py +290 -0
- agent_signage-0.1.0/src/agent_signage/signs.py +161 -0
- agent_signage-0.1.0/src/agent_signage/state.py +144 -0
- agent_signage-0.1.0/tests/conftest.py +6 -0
- agent_signage-0.1.0/tests/test_more_signs.py +315 -0
- agent_signage-0.1.0/tests/test_stale_checkout.py +329 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.9", "3.11", "3.13"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
|
|
23
|
+
- name: Install
|
|
24
|
+
run: pip install -e ".[dev]"
|
|
25
|
+
|
|
26
|
+
- name: Lint
|
|
27
|
+
run: ruff check src tests
|
|
28
|
+
|
|
29
|
+
- name: Test
|
|
30
|
+
run: pytest
|
|
31
|
+
|
|
32
|
+
- name: Selftest
|
|
33
|
+
run: agent-signage selftest
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Token-based, matching the rest of the Hermes Labs stack.
|
|
4
|
+
#
|
|
5
|
+
# The alternative -- PyPI trusted publishing via OIDC -- is more secure but
|
|
6
|
+
# cannot be configured from a CLI: it is a web-only account setting with no
|
|
7
|
+
# API, and twine has no account-management surface. Using the existing
|
|
8
|
+
# user-scoped API token keeps releases scriptable and consistent with how
|
|
9
|
+
# lintlang and the other packages in this org already ship.
|
|
10
|
+
#
|
|
11
|
+
# Requires one repository secret: PYPI_API_TOKEN.
|
|
12
|
+
|
|
13
|
+
on:
|
|
14
|
+
release:
|
|
15
|
+
types: [published]
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
publish:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.12"
|
|
28
|
+
|
|
29
|
+
- name: Install build tools
|
|
30
|
+
run: pip install build twine
|
|
31
|
+
|
|
32
|
+
- name: Build sdist and wheel
|
|
33
|
+
run: python -m build
|
|
34
|
+
|
|
35
|
+
# PyPI runs this on upload anyway. Failing here gives a readable error
|
|
36
|
+
# instead of a rejected upload after the fact.
|
|
37
|
+
- name: Validate distributions
|
|
38
|
+
run: python -m twine check dist/*
|
|
39
|
+
|
|
40
|
+
- name: Publish to PyPI
|
|
41
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
42
|
+
with:
|
|
43
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
7
|
+
once it reaches 1.0. Before 1.0, minor version bumps may include breaking changes.
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-08-05
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Five signs, each selected against a documented failure report rather than invented:
|
|
13
|
+
`symlink_escape` (a path resolving through a symlink to outside the repository),
|
|
14
|
+
`conflict_markers` (unresolved merge markers still in the file),
|
|
15
|
+
`concurrent_worktree_edit` (another worktree has uncommitted changes to the same file),
|
|
16
|
+
`binary_edit` (NUL bytes present, so a text-shaped edit corrupts the file), and
|
|
17
|
+
`generated_file` (the header declares the file machine-generated).
|
|
18
|
+
- `clear_caches()` on the git and content layers, called at the start of every evaluation, so
|
|
19
|
+
embedding the library in a long-lived process is as correct as the one-shot subprocess.
|
|
20
|
+
- `docs/integrating.md` for harness maintainers: the stdin/stdout contract, the measured cost,
|
|
21
|
+
and the five things this will never do.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- Signs whose only consequence is a bad write now fire on write-shaped tools only.
|
|
25
|
+
- Git answers are memoised for the duration of one evaluation. An edit inside a repository went
|
|
26
|
+
from 119 ms to 71 ms; six signs were each re-spawning git to ask the same questions.
|
|
27
|
+
- Ruff rules are now selected explicitly instead of inherited. The default set widens between
|
|
28
|
+
releases, so an unpinned dev dependency silently changed what CI enforced — a fresh clone
|
|
29
|
+
resolving a newer ruff would have failed CI on code that was clean when written.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
- Deduplication is keyed per file, not per repository, so a second affected file in the same
|
|
33
|
+
session is still reported.
|
|
34
|
+
|
|
35
|
+
## [0.0.8] - 2026-08-05
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- First public release: a PreToolUse hook that reads a hook payload on stdin and,
|
|
40
|
+
when the target path is inside a git repository that is behind its configured
|
|
41
|
+
upstream, emits one line of `additionalContext` naming how many commits behind
|
|
42
|
+
and how old the upstream tip is. Silent otherwise.
|
|
43
|
+
- One sign: `stale_checkout`. Registered via `agent_signage.signs.register`, which
|
|
44
|
+
third parties can call without forking.
|
|
45
|
+
- CLI (`agent-signage`): `ack` to silence a sign until the observed state changes,
|
|
46
|
+
`clear` to remove stamps, `signs` to list the registry, `selftest` to assert the
|
|
47
|
+
runtime guarantees without a repository, `install` to add the hook entry to a
|
|
48
|
+
Claude Code `settings.json` idempotently, with a timestamped backup.
|
|
49
|
+
- Suppression rules, all fact-based: vendored/build paths (`node_modules`, `vendor`,
|
|
50
|
+
`.venv`, `venv`, `site-packages`, `dist`, `build`, `.next`, `.tox`, `target`,
|
|
51
|
+
`__pycache__`, `.git`); detached HEAD; an in-progress bisect, rebase, merge, or
|
|
52
|
+
cherry-pick; a repo listed in `AGENT_SIGNAGE_IGNORE`; a repo already fetched
|
|
53
|
+
during the current session (via `AGENT_SIGNAGE_SESSION_START`); one sign per
|
|
54
|
+
(session, repo, sign); and state-keyed acknowledgement via `agent-signage ack`.
|
|
55
|
+
- Freshness handling: remote knowledge older than `DEFAULT_FETCH_TTL_S` (30
|
|
56
|
+
minutes) triggers a detached background `git fetch` and stays silent for that
|
|
57
|
+
turn, with a cooldown (`FETCH_COOLDOWN_S`, 120s) so a slow fetch cannot spawn
|
|
58
|
+
one fetch per tool call. The hot path itself never touches the network.
|
|
59
|
+
- Bounds: a 3-second whole-invocation deadline (`hook.DEADLINE_S`) and a 2-second
|
|
60
|
+
per-git-call timeout (`gitfacts.GIT_TIMEOUT_S`). The hook never emits a block
|
|
61
|
+
decision and always exits 0.
|
|
62
|
+
- 40 tests over real synthetic git repositories in `tests/test_stale_checkout.py`.
|
|
63
|
+
- Zero runtime dependencies. Python 3.9+.
|
|
64
|
+
|
|
65
|
+
### Notes
|
|
66
|
+
|
|
67
|
+
- Phase 0 risk retirement (`evals/baseline-0.0.7.json`): confirmed that
|
|
68
|
+
`PreToolUse` `additionalContext` reaches the model (verified end-to-end against
|
|
69
|
+
an isolated session that quoted the injected token back), and measured Python
|
|
70
|
+
startup on the hot path at 17ms against a planning assumption of ~100ms,
|
|
71
|
+
which is why this ships as a single Python implementation rather than the
|
|
72
|
+
originally planned two-language hot path.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: If you use this software, please cite it as below.
|
|
3
|
+
type: software
|
|
4
|
+
title: agent-signage
|
|
5
|
+
abstract: >-
|
|
6
|
+
Road signs for coding agents. A PreToolUse hook that checks, at the moment a
|
|
7
|
+
coding agent reads or edits a file, whether the file's git repository is
|
|
8
|
+
behind its upstream, and injects one true, checkable fact when it is.
|
|
9
|
+
Silent otherwise.
|
|
10
|
+
authors:
|
|
11
|
+
- family-names: Bosch
|
|
12
|
+
given-names: Rolando
|
|
13
|
+
orcid: "https://orcid.org/0009-0005-4896-1112"
|
|
14
|
+
version: 0.1.0
|
|
15
|
+
date-released: '2026-08-05'
|
|
16
|
+
license: Apache-2.0
|
|
17
|
+
repository-code: "https://github.com/hermes-labs-ai/agent-signage"
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances
|
|
31
|
+
of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for
|
|
49
|
+
moderation decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail
|
|
56
|
+
address, posting via an official social media account, or acting as an
|
|
57
|
+
appointed representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
roli@hermes-labs.ai. All complaints will be reviewed and investigated promptly
|
|
64
|
+
and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.1, available at
|
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by
|
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
+
|
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
+
|
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/hermes-labs-ai/agent-signage.git
|
|
7
|
+
cd agent-signage
|
|
8
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
9
|
+
pip install -e ".[dev]"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Running the checks
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pytest # 68 tests, real synthetic git repos, no mocking of git
|
|
16
|
+
ruff check src tests # lint
|
|
17
|
+
agent-signage selftest # runtime guarantees, no repo needed
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
All three run in CI (`.github/workflows/ci.yml`) on Python 3.9, 3.11, and 3.13.
|
|
21
|
+
A PR that doesn't pass all three won't be merged.
|
|
22
|
+
|
|
23
|
+
## Project layout
|
|
24
|
+
|
|
25
|
+
- `src/agent_signage/gitfacts.py` — every git call, isolated. Nothing here infers;
|
|
26
|
+
every function returns what git actually reported, or `None`.
|
|
27
|
+
- `src/agent_signage/signs.py` — the sign registry and the one shipped sign,
|
|
28
|
+
`stale_checkout`.
|
|
29
|
+
- `src/agent_signage/state.py` — session dedupe, acknowledgement, and fetch
|
|
30
|
+
cooldown stamps.
|
|
31
|
+
- `src/agent_signage/hook.py` — the PreToolUse entry point: stdin JSON in,
|
|
32
|
+
`additionalContext` JSON or nothing out.
|
|
33
|
+
- `src/agent_signage/__main__.py` — the CLI.
|
|
34
|
+
- `tests/test_stale_checkout.py` — the behavioural spec. If you're unsure whether
|
|
35
|
+
a change is in scope, this file is the source of truth, not this document.
|
|
36
|
+
|
|
37
|
+
## The bar for a new sign
|
|
38
|
+
|
|
39
|
+
`src/agent_signage/signs.py` states it directly, and it's worth repeating here
|
|
40
|
+
because it's the part contributors most often push against:
|
|
41
|
+
|
|
42
|
+
> A sign must satisfy three properties, and anything that cannot is not a sign
|
|
43
|
+
> and does not belong here:
|
|
44
|
+
>
|
|
45
|
+
> - **Sound** — it reports a measurement, never an inference. If it fires, the
|
|
46
|
+
> stated fact is true.
|
|
47
|
+
> - **Silent** — it produces nothing at all when there is nothing to say. The
|
|
48
|
+
> cost of the mechanism in the common case is zero tokens.
|
|
49
|
+
> - **Actionable** — it ends in the command that resolves it, so the reader is
|
|
50
|
+
> never left holding a problem with no next step.
|
|
51
|
+
|
|
52
|
+
### Why a heuristic-based sign will be declined
|
|
53
|
+
|
|
54
|
+
"Heuristic" here means anything that scores, estimates, guesses, or infers —
|
|
55
|
+
confidence thresholds, "this file looks risky," "this diff smells large,"
|
|
56
|
+
similarity scores, anything trained or tuned. That fails **sound** by
|
|
57
|
+
construction: a heuristic can be wrong about the fact it's asserting, and a
|
|
58
|
+
sign that can be wrong is not a road sign, it's an opinion wearing a road
|
|
59
|
+
sign's format. The whole reason this project is worth putting in front of
|
|
60
|
+
every file read is that when it speaks, the fact is true — every measurement
|
|
61
|
+
in `gitfacts.py` is something git itself reported, and every suppression rule
|
|
62
|
+
in `signs.py` is drawn from a fact (a marker file, a config value, a
|
|
63
|
+
timestamp), never a guess.
|
|
64
|
+
|
|
65
|
+
A heuristic sign also tends to fail **silent**: heuristics degrade gracefully
|
|
66
|
+
by producing more noise at lower confidence, not less, which is the opposite
|
|
67
|
+
of what this hook is for. And it tends to fail **actionable**, because a score
|
|
68
|
+
or a hunch rarely has a single command that resolves it the way `git fetch`
|
|
69
|
+
or `git rebase --continue` resolves a measured fact.
|
|
70
|
+
|
|
71
|
+
If your proposed sign reports something git (or another tool) can state as a
|
|
72
|
+
fact — "you are N commits behind," "this branch has no upstream," "this file
|
|
73
|
+
is in `.gitignore` but tracked" — it's in scope. If it requires judgment about
|
|
74
|
+
whether something is *probably* fine, it isn't, no matter how useful the
|
|
75
|
+
judgment would be. Open an issue describing the fact you want to surface
|
|
76
|
+
before writing code; it's a fast way to find out which side of that line it's
|
|
77
|
+
on.
|
|
78
|
+
|
|
79
|
+
### Style
|
|
80
|
+
|
|
81
|
+
- No new runtime dependencies. Standard library only.
|
|
82
|
+
- New git calls go in `gitfacts.py`, bounded by a timeout, returning `None` on
|
|
83
|
+
any failure. Never let a subprocess hang the hook.
|
|
84
|
+
- New suppression logic must be a fact check, not a guess, per the section
|
|
85
|
+
above.
|
|
86
|
+
- Tests build real temporary git repositories (see `tests/conftest.py` and the
|
|
87
|
+
fixtures in `tests/test_stale_checkout.py`), not mocked git output — the
|
|
88
|
+
soundness claim is "we report what git reports," and a mock only proves
|
|
89
|
+
fidelity to the mock's own assumptions.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|