lgtm-specs 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +14 -0
- package/.gemini/README.md +8 -0
- package/.gemini/config.yaml +20 -0
- package/.gemini/styleguide.md +35 -0
- package/.github/workflows/README.md +5 -0
- package/.github/workflows/release.yml +52 -0
- package/.github/workflows/validate.yml +27 -0
- package/.prettierignore +4 -0
- package/.prettierrc +1 -0
- package/AGENTS.md +151 -0
- package/README.md +98 -0
- package/VERSION +1 -0
- package/agents/README.md +73 -0
- package/agents/modes/README.md +9 -0
- package/agents/modes/build.md +88 -0
- package/agents/modes/hack.md +76 -0
- package/agents/modes/review.md +79 -0
- package/agents/roles/builder.md +75 -0
- package/agents/roles/counsel.md +96 -0
- package/agents/roles/explorer.md +77 -0
- package/agents/roles/lead.md +76 -0
- package/agents/roles/librarian.md +63 -0
- package/agents/roles/planner.md +75 -0
- package/agents/roles/reviewer/BASE.md +9 -0
- package/agents/roles/reviewer/OUTPUT_FORMAT.md +4 -0
- package/agents/roles/reviewer/README.md +48 -0
- package/agents/roles/reviewer/lite.md +51 -0
- package/agents/roles/reviewer/logic.md +48 -0
- package/agents/roles/reviewer/performance.md +45 -0
- package/agents/roles/reviewer/plan.md +52 -0
- package/agents/roles/reviewer/quality.md +49 -0
- package/agents/roles/reviewer/security.md +47 -0
- package/agents/roles/reviewer/test.md +48 -0
- package/agents/templates/README.md +6 -0
- package/agents/templates/mode.md +33 -0
- package/agents/templates/role.md +73 -0
- package/contribute/README.md +24 -0
- package/contribute/add-agent.md +29 -0
- package/contribute/add-ci.md +31 -0
- package/contribute/add-constitution.md +17 -0
- package/contribute/add-law.md +20 -0
- package/contribute/add-policy.md +27 -0
- package/contribute/checklist.md +42 -0
- package/contribute/maintenance.md +19 -0
- package/contribute/update-models.md +47 -0
- package/docs/README.md +13 -0
- package/docs/adr/0001-knowledge-engineering-workflow.md +22 -0
- package/docs/adr/0002-rule-hierarchy.md +25 -0
- package/docs/adr/0003-atomic-knowledge-graph.md +21 -0
- package/docs/adr/0004-identification-schema.md +22 -0
- package/docs/adr/0005-agent-specialization.md +39 -0
- package/docs/adr/0006-git-workflow-integrity.md +34 -0
- package/docs/adr/0007-operating-modes-and-gates.md +54 -0
- package/docs/adr/0008-rules-vs-workflows-boundary.md +64 -0
- package/docs/adr/README.md +14 -0
- package/docs/agent_architecture.md +164 -0
- package/docs/context_lifecycle.md +228 -0
- package/docs/engineering_principles.md +128 -0
- package/docs/local_policies.md +59 -0
- package/docs/meta/collaborative_dynamics.md +142 -0
- package/docs/meta/domains/README.md +8 -0
- package/docs/meta/domains/bitcoin/01-units.md +21 -0
- package/docs/meta/domains/bitcoin/02-broadcast-cancellation.md +20 -0
- package/docs/meta/domains/bitcoin/03-fee-rates-rounding.md +21 -0
- package/docs/meta/domains/bitcoin/04-confirmations-reorgs.md +20 -0
- package/docs/meta/domains/bitcoin/05-address-gap-limit.md +16 -0
- package/docs/meta/domains/bitcoin/06-relay-policy.md +27 -0
- package/docs/meta/domains/bitcoin/README.md +12 -0
- package/docs/meta/domains/git/01-workflow.md +89 -0
- package/docs/meta/domains/git/02-commits.md +57 -0
- package/docs/meta/domains/git/03-collaboration.md +40 -0
- package/docs/meta/domains/git/04-integrity.md +26 -0
- package/docs/meta/domains/git/05-configuration.md +209 -0
- package/docs/meta/domains/git/06-advanced.md +130 -0
- package/docs/meta/domains/git/README.md +29 -0
- package/docs/meta/industry_best_practices.md +555 -0
- package/docs/meta/languages/README.md +8 -0
- package/docs/meta/languages/go/01-concurrency.md +37 -0
- package/docs/meta/languages/go/02-api-design.md +30 -0
- package/docs/meta/languages/go/03-resilience.md +27 -0
- package/docs/meta/languages/go/04-errors.md +27 -0
- package/docs/meta/languages/go/05-performance.md +18 -0
- package/docs/meta/languages/go/06-safety.md +18 -0
- package/docs/meta/languages/go/07-testing.md +44 -0
- package/docs/meta/languages/go/08-config-layout.md +23 -0
- package/docs/meta/languages/go/README.md +14 -0
- package/docs/meta/languages/typescript/01-strictness.md +19 -0
- package/docs/meta/languages/typescript/02-immutability.md +15 -0
- package/docs/meta/languages/typescript/03-async.md +18 -0
- package/docs/meta/languages/typescript/04-design.md +19 -0
- package/docs/meta/languages/typescript/05-control-flow.md +11 -0
- package/docs/meta/languages/typescript/README.md +11 -0
- package/docs/meta/workflow.md +68 -0
- package/docs/philosophy.md +36 -0
- package/integrate/README.md +459 -0
- package/integrate/versioning.md +41 -0
- package/models/README.md +68 -0
- package/models/registry.yaml +55 -0
- package/package.json +11 -0
- package/rules/README.md +57 -0
- package/rules/RULE-00000-EXAMPLE.md +29 -0
- package/rules/constitution/CONS-00001-srp.md +40 -0
- package/rules/constitution/CONS-00002-ocp.md +43 -0
- package/rules/constitution/CONS-00003-lsp.md +44 -0
- package/rules/constitution/CONS-00004-isp.md +46 -0
- package/rules/constitution/CONS-00005-dip.md +37 -0
- package/rules/constitution/CONS-00006-dry.md +45 -0
- package/rules/constitution/CONS-00007-demeter.md +35 -0
- package/rules/constitution/CONS-00008-composition.md +44 -0
- package/rules/constitution/CONS-00009-deep-modules.md +39 -0
- package/rules/constitution/CONS-00010-kiss.md +47 -0
- package/rules/constitution/CONS-00011-yagni.md +49 -0
- package/rules/constitution/CONS-00012-cognitive-limits.md +28 -0
- package/rules/constitution/CONS-00013-boy-scout.md +27 -0
- package/rules/constitution/CONS-00014-broken-windows.md +35 -0
- package/rules/constitution/CONS-00015-safety.md +46 -0
- package/rules/constitution/CONS-00016-cqs.md +39 -0
- package/rules/constitution/CONS-00017-postel.md +35 -0
- package/rules/constitution/CONS-00018-cap.md +35 -0
- package/rules/constitution/CONS-00019-fallacies.md +37 -0
- package/rules/constitution/CONS-00020-shift-left.md +28 -0
- package/rules/constitution/CONS-00021-congruence.md +28 -0
- package/rules/constitution/CONS-00022-orthogonality.md +40 -0
- package/rules/constitution/CONS-00023-determinism.md +38 -0
- package/rules/constitution/CONS-00024-security.md +42 -0
- package/rules/constitution/CONS-00025-efficiency.md +38 -0
- package/rules/constitution/CONS-00026-resilience.md +41 -0
- package/rules/constitution/CONS-00027-transparency.md +40 -0
- package/rules/constitution/CONS-00028-evolvability.md +36 -0
- package/rules/constitution/CONS-00029-operability.md +36 -0
- package/rules/constitution/CONS-00030-rework-cycle.md +27 -0
- package/rules/constitution/CONS-00031-checklist.md +28 -0
- package/rules/constitution/CONS-00032-documentation.md +39 -0
- package/rules/constitution/README.md +52 -0
- package/rules/laws/README.md +15 -0
- package/rules/laws/bitcoin/BTC-00001-amounts-as-satoshis.md +39 -0
- package/rules/laws/bitcoin/BTC-00002-broadcast-not-cancelable.md +36 -0
- package/rules/laws/bitcoin/BTC-00003-fee-rate-math-rounding.md +37 -0
- package/rules/laws/bitcoin/BTC-00004-confirmations-and-reorgs.md +40 -0
- package/rules/laws/bitcoin/BTC-00005-address-gap-limit.md +37 -0
- package/rules/laws/bitcoin/BTC-00006-relay-is-policy-dependent.md +36 -0
- package/rules/laws/bitcoin/BTC-00007-dust-policy.md +36 -0
- package/rules/laws/bitcoin/BTC-00008-min-relay-fee.md +36 -0
- package/rules/laws/bitcoin/BTC-00009-feefilter.md +36 -0
- package/rules/laws/bitcoin/README.md +29 -0
- package/rules/laws/default.md +30 -0
- package/rules/laws/git/GIT-00001-atomic-commit.md +29 -0
- package/rules/laws/git/GIT-00002-imperative-subject.md +27 -0
- package/rules/laws/git/GIT-00003-formatting-50-72.md +28 -0
- package/rules/laws/git/GIT-00004-trunk-based.md +28 -0
- package/rules/laws/git/GIT-00005-public-immutability.md +26 -0
- package/rules/laws/git/GIT-00006-signing.md +27 -0
- package/rules/laws/git/GIT-00007-reviewer-capital.md +26 -0
- package/rules/laws/git/GIT-00008-patch-series.md +28 -0
- package/rules/laws/git/GIT-00009-branch-naming.md +28 -0
- package/rules/laws/git/GIT-00010-pr-hygiene.md +51 -0
- package/rules/laws/git/GIT-00011-merge-method.md +35 -0
- package/rules/laws/git/GIT-00012-conflict-resolution.md +35 -0
- package/rules/laws/git/GIT-00013-ignore-standards.md +38 -0
- package/rules/laws/git/GIT-00014-lfs-large-binaries.md +37 -0
- package/rules/laws/git/GIT-00015-git-hooks.md +35 -0
- package/rules/laws/git/GIT-00016-branch-protection.md +34 -0
- package/rules/laws/git/GIT-00017-secrets-management.md +34 -0
- package/rules/laws/git/GIT-00018-ci-enforcement.md +33 -0
- package/rules/laws/git/GIT-00019-review-checklist.md +39 -0
- package/rules/laws/git/GIT-00020-issue-references.md +34 -0
- package/rules/laws/git/GIT-00021-partial-staging.md +38 -0
- package/rules/laws/git/GIT-00022-feature-flags.md +33 -0
- package/rules/laws/git/GIT-00023-breaking-changes.md +41 -0
- package/rules/laws/git/GIT-00024-dependency-management.md +44 -0
- package/rules/laws/git/GIT-00025-large-repository-optimization.md +54 -0
- package/rules/laws/git/README.md +31 -0
- package/rules/laws/go/GO-00001-actor-model.md +51 -0
- package/rules/laws/go/GO-00002-api-design.md +37 -0
- package/rules/laws/go/GO-00003-error-handling.md +43 -0
- package/rules/laws/go/GO-00004-context.md +45 -0
- package/rules/laws/go/GO-00005-performance.md +40 -0
- package/rules/laws/go/GO-00006-packages.md +29 -0
- package/rules/laws/go/GO-00007-circuit-breakers.md +43 -0
- package/rules/laws/go/GO-00008-safety.md +39 -0
- package/rules/laws/go/GO-00009-table-driven-test.md +48 -0
- package/rules/laws/go/GO-00010-escape-analysis.md +37 -0
- package/rules/laws/go/GO-00011-retry.md +45 -0
- package/rules/laws/go/GO-00012-rate-limiting.md +42 -0
- package/rules/laws/go/GO-00013-io-buffering.md +43 -0
- package/rules/laws/go/GO-00014-memory-layout.md +41 -0
- package/rules/laws/go/GO-00015-aaa-pattern.md +49 -0
- package/rules/laws/go/GO-00016-test-libraries.md +35 -0
- package/rules/laws/go/GO-00017-comments.md +37 -0
- package/rules/laws/go/GO-00018-test-isolation.md +38 -0
- package/rules/laws/go/GO-00019-test-comments.md +36 -0
- package/rules/laws/go/GO-00020-mocking.md +36 -0
- package/rules/laws/go/GO-00021-configuration.md +36 -0
- package/rules/laws/go/GO-00022-observability.md +34 -0
- package/rules/laws/go/GO-00023-dependency-management.md +28 -0
- package/rules/laws/go/GO-00024-project-layout.md +30 -0
- package/rules/laws/go/GO-00025-concurrency-patterns.md +39 -0
- package/rules/laws/go/README.md +45 -0
- package/rules/laws/typescript/README.md +14 -0
- package/rules/laws/typescript/TS-00001-no-any.md +39 -0
- package/rules/laws/typescript/TS-00002-immutability.md +36 -0
- package/rules/laws/typescript/TS-00003-async.md +35 -0
- package/rules/laws/typescript/TS-00004-strict-null.md +38 -0
- package/rules/laws/typescript/TS-00005-unions.md +35 -0
- package/rules/laws/typescript/TS-00006-interface.md +38 -0
- package/rules/laws/typescript/TS-00007-generics.md +38 -0
- package/rules/laws/typescript/TS-00008-modules.md +28 -0
- package/rules/policies/README.md +12 -0
- package/rules/policies/default.md +28 -0
- package/scripts/README.md +45 -0
- package/scripts/generate_release_notes.py +376 -0
- package/scripts/validate_specs.py +730 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Bitcoin: Relay Policy Gates (Dust, Min Fee, Feefilter)
|
|
2
|
+
|
|
3
|
+
**Sources**:
|
|
4
|
+
|
|
5
|
+
- Bitcoin Dev Guide (dust + standardness): https://developer.bitcoin.org/devguide/transactions.html#non-standard-transactions
|
|
6
|
+
- Bitcoin Dev Guide (minimum relay fee): https://developer.bitcoin.org/devguide/transactions.html#transaction-fees-and-change
|
|
7
|
+
- Bitcoin Core policy constants (dust relay fee / min relay fee): https://raw.githubusercontent.com/bitcoin/bitcoin/master/src/policy/policy.h
|
|
8
|
+
- BIP-0133 (feefilter message): https://raw.githubusercontent.com/bitcoin/bips/master/bip-0133.mediawiki
|
|
9
|
+
|
|
10
|
+
## Relay Is Policy-Dependent
|
|
11
|
+
|
|
12
|
+
- Transaction relay is not a consensus guarantee; it depends on node policy and peer-to-peer filtering.
|
|
13
|
+
|
|
14
|
+
## Gate 1: Dust
|
|
15
|
+
|
|
16
|
+
- Outputs below the dust threshold may be considered non-standard and not relayed by default.
|
|
17
|
+
- Treat dust checks as part of transaction construction.
|
|
18
|
+
|
|
19
|
+
## Gate 2: Node Minimum Fee
|
|
20
|
+
|
|
21
|
+
- Nodes enforce a minimum feerate for relay/mempool admission.
|
|
22
|
+
- This minimum may differ across nodes and can change under mempool pressure.
|
|
23
|
+
|
|
24
|
+
## Gate 3: Peer feefilter
|
|
25
|
+
|
|
26
|
+
- Peers may announce a `feefilter` value; transactions below that feerate may not be announced to that peer.
|
|
27
|
+
- The feefilter value is a feerate interpreted as satoshis per kilobyte.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Bitcoin Domain (Meta)
|
|
2
|
+
|
|
3
|
+
This directory contains source material and distilled patterns for Bitcoin-related engineering.
|
|
4
|
+
|
|
5
|
+
## Index
|
|
6
|
+
|
|
7
|
+
- [01-units.md](01-units.md)
|
|
8
|
+
- [02-broadcast-cancellation.md](02-broadcast-cancellation.md)
|
|
9
|
+
- [03-fee-rates-rounding.md](03-fee-rates-rounding.md)
|
|
10
|
+
- [04-confirmations-reorgs.md](04-confirmations-reorgs.md)
|
|
11
|
+
- [05-address-gap-limit.md](05-address-gap-limit.md)
|
|
12
|
+
- [06-relay-policy.md](06-relay-policy.md)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# 01. The Workflow: Trunk-Based Development
|
|
2
|
+
|
|
3
|
+
**Source**: [Trunk Based Development](https://trunkbaseddevelopment.com/)
|
|
4
|
+
|
|
5
|
+
## 1. The Single Source of Truth
|
|
6
|
+
|
|
7
|
+
We adhere to **Trunk-Based Development (TBD)**.
|
|
8
|
+
|
|
9
|
+
- **Trunk**: `main` is the only long-lived branch. It must always be deployable.
|
|
10
|
+
- **Branches**: Feature branches should be short-lived.
|
|
11
|
+
- **Guideline**: Target a lifespan of < 1 week.
|
|
12
|
+
- **Rationale**: The longer a branch lives, the higher the probability of complex merge conflicts ("Merge Hell").
|
|
13
|
+
- **Exceptions**: Longer-lived branches may be acceptable for large coordinated work (e.g., multi-repo changes, research spikes), but they require explicit coordination and frequent integration from `main`.
|
|
14
|
+
- **Naming**: Use `<type>/<short-description>` (kebab-case). Prefer `feat/`, `fix/`, `refactor/`, `docs/`, `test/`, `chore/`.
|
|
15
|
+
- **Atomic Rules**: GIT-00004, GIT-00009
|
|
16
|
+
|
|
17
|
+
## 2. The Atomic Commit Philosophy
|
|
18
|
+
|
|
19
|
+
Treat the **Commit** as the primary unit of communication.
|
|
20
|
+
|
|
21
|
+
- **Cognitive Focus**: A commit should be understandable in a single mental pass.
|
|
22
|
+
- **Logical Progression**: Submit changes as a series of commits (Logical Commit Series).
|
|
23
|
+
- _Tooling_: We use pull requests / merge requests (e.g., GitHub PRs, GitLab MRs, Bitbucket PRs) to review the Logical Commit Series. We do not use `git send-email`.
|
|
24
|
+
- **Independence**: Ideally, every commit in the series should be buildable to support review, safe reverts, and `git bisect`.
|
|
25
|
+
- **Atomic Rules**: GIT-00008, GIT-00010
|
|
26
|
+
|
|
27
|
+
Pull requests are the unit of integration into `main`.
|
|
28
|
+
|
|
29
|
+
- **Description**: A PR description **SHOULD** include intent, testing performed, and any rollout/flagging notes.
|
|
30
|
+
- **Scope**: Keep PRs small enough that reviewers can complete a high-quality review.
|
|
31
|
+
|
|
32
|
+
## 3. The Release Lifecycle
|
|
33
|
+
|
|
34
|
+
- **Tagging**: Releases are SemVer tags (`v1.2.3`) on `main`.
|
|
35
|
+
- **Breaking Changes**: Breaking changes must follow Semantic Versioning (major version increment) and include migration documentation.
|
|
36
|
+
- **Feature Flags**: Merge incomplete features behind a toggle to maintain the "Always Deployable" invariant.
|
|
37
|
+
- **Atomic Rules**: GIT-00022, GIT-00023
|
|
38
|
+
|
|
39
|
+
## 4. Feature Flags
|
|
40
|
+
|
|
41
|
+
Feature flags preserve trunk discipline by separating _merge time_ from _release time_.
|
|
42
|
+
|
|
43
|
+
- **Principle**: Merge early. Release deliberately.
|
|
44
|
+
- **Guideline**: Flags should default to safe/off, be configurable per environment, and support rapid rollback.
|
|
45
|
+
- **Anti-Pattern**: Long-lived branches used to "hide" unfinished work.
|
|
46
|
+
- **Atomic Rules**: GIT-00022
|
|
47
|
+
|
|
48
|
+
### Implementation Patterns
|
|
49
|
+
|
|
50
|
+
#### Boolean Toggles
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// feature-flags.ts
|
|
54
|
+
export const FEATURE_FLAGS = {
|
|
55
|
+
NEW_CHECKOUT: process.env.FF_NEW_CHECKOUT === "true",
|
|
56
|
+
EXPERIMENTAL_API: process.env.FF_EXPERIMENTAL_API === "true",
|
|
57
|
+
} as const;
|
|
58
|
+
|
|
59
|
+
// Usage
|
|
60
|
+
if (FEATURE_FLAGS.NEW_CHECKOUT) {
|
|
61
|
+
renderNewCheckout();
|
|
62
|
+
} else {
|
|
63
|
+
renderLegacyCheckout();
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
#### Rollout Percentages
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
// Use a consistent hashing strategy for user-based rollouts
|
|
71
|
+
function isUserInRollout(userId: string, percentage: number): boolean {
|
|
72
|
+
const hash = crypto.createHash("sha256").update(userId).digest("hex");
|
|
73
|
+
const value = parseInt(hash.slice(0, 8), 16) % 100;
|
|
74
|
+
return value < percentage;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Configuration Management
|
|
79
|
+
|
|
80
|
+
- **Environment Variables**: Simple boolean flags via env vars.
|
|
81
|
+
- **Feature Flag Services**: Dedicated services (LaunchDarkly, Flagsmith) for dynamic, real-time control.
|
|
82
|
+
- **Database-backed Flags**: Store flags in a database for admin UI control.
|
|
83
|
+
|
|
84
|
+
#### Example: Gradual Rollout with Feature Flags
|
|
85
|
+
|
|
86
|
+
1. Merge feature behind a flag defaulting to `false`.
|
|
87
|
+
2. Enable flag for internal testing (staging environment).
|
|
88
|
+
3. Gradually enable for percentage of users (1% → 10% → 50% → 100%).
|
|
89
|
+
4. Once stable, remove flag conditional code and delete flag.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# 02. The Commit: The Atomic Unit
|
|
2
|
+
|
|
3
|
+
**Source**: [Conventional Commits v1.0.0](https://www.conventionalcommits.org/en/v1.0.0/#specification)
|
|
4
|
+
|
|
5
|
+
## 1. Atomicity (The Golden Rule)
|
|
6
|
+
|
|
7
|
+
A commit must represent **one** logical change.
|
|
8
|
+
|
|
9
|
+
- **The Audit Test**: Can a reviewer fully understand the intent and verify the correctness of this commit in a single mental pass?
|
|
10
|
+
- **The Revert Test**: Can I revert _only_ this commit without breaking the build or unrelated features?
|
|
11
|
+
- **Debugging**: Atomic commits enable `git bisect` (See [06-advanced](06-advanced.md)) to find bugs.
|
|
12
|
+
- **Atomic Rules**: GIT-00001, GIT-00021
|
|
13
|
+
|
|
14
|
+
## 2. Commit Often, Perfect Later
|
|
15
|
+
|
|
16
|
+
- **Outcome**: A PR should present a clean, reviewable Logical Commit Series.
|
|
17
|
+
- **Guideline**: Before requesting review, you **SHOULD** rewrite your feature-branch history to remove noisy commits (`wip`, `typo`, `fix`) and group changes into logical steps.
|
|
18
|
+
- **Tooling**: Use `git commit --fixup <sha>` (and `git rebase -i --autosquash`) or consider `git absorb` to generate `fixup!` commits automatically. (See https://github.com/tummychow/git-absorb)
|
|
19
|
+
- **Constraint**: Never rewrite shared branches. If you rebase a pushed feature branch, use `--force-with-lease`.
|
|
20
|
+
- **Amend (Before Push)**: If you forgot a file or need to fix the message, use `git commit --amend` only before pushing. Never amend commits that are already shared.
|
|
21
|
+
- **Atomic Rules**: GIT-00005
|
|
22
|
+
|
|
23
|
+
## 3. Conventional Commits (v1.0.0)
|
|
24
|
+
|
|
25
|
+
**Structure**:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
feat(pkg): add login handler
|
|
29
|
+
|
|
30
|
+
This adds the /login endpoint using OAuth2.
|
|
31
|
+
|
|
32
|
+
Closes #123
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Annotations**:
|
|
36
|
+
|
|
37
|
+
- **Type**: `feat` (user-facing change).
|
|
38
|
+
- **Scope**: `pkg` (the package/module affected).
|
|
39
|
+
- **Subject**: `add login handler` (imperative mood).
|
|
40
|
+
- **Body**: explains why (and any non-obvious tradeoffs), not just what.
|
|
41
|
+
- **Footer**: references issues (`Closes #123`).
|
|
42
|
+
|
|
43
|
+
**Types**:
|
|
44
|
+
|
|
45
|
+
- `feat`, `fix` (User facing).
|
|
46
|
+
- `build`, `ci`, `docs`, `style`, `refactor`, `perf`, `test`, `chore` (Internal).
|
|
47
|
+
- **Breaking**: `feat!: drop support for v1` or `BREAKING CHANGE:` footer.
|
|
48
|
+
- **Atomic Rules**: GIT-00002, GIT-00003
|
|
49
|
+
|
|
50
|
+
## 4. Issue References
|
|
51
|
+
|
|
52
|
+
Issue references make intent and traceability explicit.
|
|
53
|
+
|
|
54
|
+
- **Guideline**: Prefer explicit closing keywords when applicable (`Closes`, `Fixes`, `Resolves`).
|
|
55
|
+
- **Guideline**: Use non-closing references for context when appropriate (`Refs`, `Related-to`).
|
|
56
|
+
- **Anti-Pattern**: PRs/commits with no linkage to the motivating issue.
|
|
57
|
+
- **Atomic Rules**: GIT-00020
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 03. Collaboration & Etiquette
|
|
2
|
+
|
|
3
|
+
**Source**: [Upstream Merge: What Not To Do](https://kernelnewbies.org/UpstreamMerge/WhatNotToDo)
|
|
4
|
+
|
|
5
|
+
## 1. The Social Contract
|
|
6
|
+
|
|
7
|
+
Merging code transfers maintenance responsibility to the team. Ensure your contribution is maintainable.
|
|
8
|
+
|
|
9
|
+
## 2. Reviewer Capital
|
|
10
|
+
|
|
11
|
+
"Reviewer capital" is the team's limited attention and review capacity. Spend it intentionally.
|
|
12
|
+
|
|
13
|
+
- **Cost**: Every minute a reviewer spends understanding your code is a cost.
|
|
14
|
+
- **Compliance**: If a reviewer suggests a change, accept it unless you have a specific technical objection.
|
|
15
|
+
- **Arbitration**: In cases of unresolvable disagreement, the **Team Lead** makes the final decision.
|
|
16
|
+
- _Escalation_: For architectural disputes, open a Request for Comments (RFC) issue.
|
|
17
|
+
- **Atomic Rules**: GIT-00007
|
|
18
|
+
|
|
19
|
+
## 3. Handling Critique
|
|
20
|
+
|
|
21
|
+
- **Focus**: Focus on the technical debt being pointed out, not the tone.
|
|
22
|
+
- **Response**: Never reply with anger. Address the technical points objectively.
|
|
23
|
+
|
|
24
|
+
## 4. Conflict Resolution
|
|
25
|
+
|
|
26
|
+
- **Owner**: The author resolves merge conflicts.
|
|
27
|
+
- **Protocol**: Resolve conflicts in small, reviewable commits. If the conflict materially changes behavior, call it out in the PR description.
|
|
28
|
+
- **Escalation**: If resolution is unclear or high-risk, escalate to the Team Lead and/or open an RFC issue.
|
|
29
|
+
- **Atomic Rules**: GIT-00012
|
|
30
|
+
|
|
31
|
+
## 5. Review Checklist
|
|
32
|
+
|
|
33
|
+
Reviews are where quality is enforced.
|
|
34
|
+
|
|
35
|
+
- **Correctness**: The change matches intent and edge cases are handled.
|
|
36
|
+
- **Security**: No secrets, unsafe defaults, or new attack surface without justification.
|
|
37
|
+
- **Performance**: No obvious regressions (hot paths, N+1 patterns, unnecessary allocations).
|
|
38
|
+
- **Maintainability**: Readable, minimal complexity, good naming.
|
|
39
|
+
- **Verification**: Tests/CI evidence matches the risk.
|
|
40
|
+
- **Atomic Rules**: GIT-00019
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# 04. History Integrity & Security
|
|
2
|
+
|
|
3
|
+
**Source**: [Pro Git: Signing](https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work)
|
|
4
|
+
|
|
5
|
+
## 1. Immutable Public History
|
|
6
|
+
|
|
7
|
+
- **Rule**: Never `git push --force` on shared branches (e.g., `main`).
|
|
8
|
+
- **Safety**: If you must force push a feature branch, use `--force-with-lease`.
|
|
9
|
+
- **Atomic Rules**: GIT-00005
|
|
10
|
+
|
|
11
|
+
## 2. Merge Strategy
|
|
12
|
+
|
|
13
|
+
- **Main Branch**: Merge into `main` using a merge commit to preserve commit history.
|
|
14
|
+
- **No Squash**: Do not squash-merge into `main`. Our policy is to preserve the Logical Commit Series. See `docs/meta/domains/git/05-configuration.md`.
|
|
15
|
+
- **No Rebase-Merge**: Do not use rebase-merge for `main`.
|
|
16
|
+
- **Feature Branches**: Rebase your feature branch onto `main` to keep it clean before merging.
|
|
17
|
+
- **Rebase**: Rebase only branches you own (no one else has pulled). Rebasing a shared branch rewrites history and breaks clones.
|
|
18
|
+
- **When to Rebase**: Rebase after pulling updates from `main`, before requesting review, and before merging if the branch has drifted.
|
|
19
|
+
- **Atomic Rules**: GIT-00011
|
|
20
|
+
|
|
21
|
+
## 3. Cryptographic Identity
|
|
22
|
+
|
|
23
|
+
- **Signing**: Commits on `main` **MUST** be signed (GPG/SSH). Feature branch commits **MUST** be signed.
|
|
24
|
+
- **Enforcement**: Enforce on `main` via branch protection (require signed commits).
|
|
25
|
+
- **SHA-256**: Git is migrating from SHA-1 to SHA-256 to prevent collisions. Signing provides immediate authorship verification.
|
|
26
|
+
- **Atomic Rules**: GIT-00006
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# 05. Configuration & Governance
|
|
2
|
+
|
|
3
|
+
**Source**: [Pro Git: Customizing Git](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration)
|
|
4
|
+
|
|
5
|
+
## 1. Git Hooks
|
|
6
|
+
|
|
7
|
+
- **pre-commit**: Run fast linters (Biome, Ruff).
|
|
8
|
+
- **prepare-commit-msg**: Generate or prefill commit message templates (e.g., add a PR/issue reference).
|
|
9
|
+
- **commit-msg**: Validate Conventional Commits syntax.
|
|
10
|
+
- **pre-push**: Run unit tests to prevent broken builds on CI.
|
|
11
|
+
- **post-checkout**: Refresh generated files or local tooling after branch switches.
|
|
12
|
+
- **post-merge**: Sync dependencies after merges (e.g., `npm install` when lockfiles change).
|
|
13
|
+
|
|
14
|
+
**CI/CD Integration**: Hooks are a fast local gate; CI is the authoritative gate. Prefer hooks that are quick and deterministic, and keep CI checks superset-compatible (avoid hook-only rules).
|
|
15
|
+
|
|
16
|
+
- **Atomic Rules**: GIT-00015
|
|
17
|
+
|
|
18
|
+
### Example: Pre-commit Hook
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
#!/usr/bin/env bash
|
|
22
|
+
# .git/hooks/pre-commit
|
|
23
|
+
set -e
|
|
24
|
+
|
|
25
|
+
# Run fast linters
|
|
26
|
+
if command -v ruff >/dev/null 2>&1; then
|
|
27
|
+
ruff check --fix --exit-zero
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Ensure no secrets are accidentally committed
|
|
31
|
+
if command -v trufflehog >/dev/null 2>&1; then
|
|
32
|
+
trufflehog git file://. --since-commit HEAD --fail >/dev/null 2>&1 || {
|
|
33
|
+
echo "ERROR: Potential secrets found. Aborting commit."
|
|
34
|
+
exit 1
|
|
35
|
+
}
|
|
36
|
+
fi
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Example: Commit-msg Hook
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
#!/usr/bin/env bash
|
|
43
|
+
# .git/hooks/commit-msg
|
|
44
|
+
MSG_FILE="$1"
|
|
45
|
+
|
|
46
|
+
# Validate subject line length
|
|
47
|
+
subject=$(head -1 "$MSG_FILE")
|
|
48
|
+
if [ ${#subject} -gt 50 ]; then
|
|
49
|
+
echo "ERROR: Subject line exceeds 50 characters."
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# Validate imperative mood (basic heuristic)
|
|
54
|
+
if echo "$subject" | grep -qE '^(Added|Fixed|Updated|Removed|Changed)'; then
|
|
55
|
+
echo "WARNING: Subject line appears to be in past tense. Use imperative mood (e.g., 'Add', 'Fix', 'Update')."
|
|
56
|
+
fi
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 2. Branch Protection (Hosting Platform)
|
|
60
|
+
|
|
61
|
+
- **Require Pull Requests**: No direct pushes to `main`.
|
|
62
|
+
- **Require Status Checks**: CI must pass before merging.
|
|
63
|
+
- **Require Signed Commits**: Require signed commits on `main` (GPG/SSH).
|
|
64
|
+
- **Merge Method**: Allow merge commits. Disable squash merging and rebase merging.
|
|
65
|
+
- **Rationale**: Preserve the Logical Commit Series on `main` to improve auditability, enable precise reverts, and make `git bisect` useful.
|
|
66
|
+
- **Atomic Rules**: GIT-00016
|
|
67
|
+
|
|
68
|
+
### Example: GitHub Actions Workflow for Signed Commits
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
name: Verify Signed Commits
|
|
72
|
+
on: [pull_request]
|
|
73
|
+
jobs:
|
|
74
|
+
verify-signed:
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
steps:
|
|
77
|
+
- uses: actions/checkout@v4
|
|
78
|
+
with:
|
|
79
|
+
fetch-depth: 0
|
|
80
|
+
- name: Verify all commits are signed
|
|
81
|
+
run: |
|
|
82
|
+
git log --oneline HEAD^..HEAD | while read commit; do
|
|
83
|
+
if ! git verify-commit $(echo $commit | cut -d' ' -f1) 2>/dev/null; then
|
|
84
|
+
echo "ERROR: Unsigned commit detected: $commit"
|
|
85
|
+
exit 1
|
|
86
|
+
fi
|
|
87
|
+
done
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## 3. Ignore Standards
|
|
91
|
+
|
|
92
|
+
- **Blocklist**: Explicitly ignore generated artifacts and secrets.
|
|
93
|
+
- **Patterns**: `node_modules/`, `dist/`, `.env`, `.DS_Store`.
|
|
94
|
+
- **Atomic Rules**: GIT-00013
|
|
95
|
+
|
|
96
|
+
### Example: .gitignore
|
|
97
|
+
|
|
98
|
+
```gitignore
|
|
99
|
+
# Dependencies
|
|
100
|
+
node_modules/
|
|
101
|
+
vendor/
|
|
102
|
+
*.pyc
|
|
103
|
+
|
|
104
|
+
# Build artifacts
|
|
105
|
+
dist/
|
|
106
|
+
build/
|
|
107
|
+
*.o
|
|
108
|
+
*.so
|
|
109
|
+
|
|
110
|
+
# Environment files
|
|
111
|
+
.env
|
|
112
|
+
.env.local
|
|
113
|
+
.env.*.local
|
|
114
|
+
|
|
115
|
+
# Editor files
|
|
116
|
+
.vscode/
|
|
117
|
+
.idea/
|
|
118
|
+
*.swp
|
|
119
|
+
|
|
120
|
+
# OS files
|
|
121
|
+
.DS_Store
|
|
122
|
+
Thumbs.db
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 4. Secrets and Credential Hygiene
|
|
126
|
+
|
|
127
|
+
Secrets must not enter Git history.
|
|
128
|
+
|
|
129
|
+
- **Principle**: Treat any committed secret as compromised.
|
|
130
|
+
- **Guideline**: Use platform secret scanning and/or a pre-commit secret detector. If a secret is committed, rotate it immediately.
|
|
131
|
+
- **Anti-Pattern**: Relying on "private repo" as a security control.
|
|
132
|
+
- **Atomic Rules**: GIT-00017
|
|
133
|
+
|
|
134
|
+
### Recommended Tools
|
|
135
|
+
|
|
136
|
+
- **trufflehog**: Scans Git history and diffs for high-entropy strings and known secret patterns.
|
|
137
|
+
- **gitleaks**: Lightweight secret scanner with configurable rule sets.
|
|
138
|
+
- **GitHub Secret Scanning**: Native scanning for public repositories; enable for private repos via GitHub Advanced Security.
|
|
139
|
+
|
|
140
|
+
### Example: Pre-commit Hook with gitleaks
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
#!/usr/bin/env bash
|
|
144
|
+
if command -v gitleaks >/dev/null 2>&1; then
|
|
145
|
+
gitleaks protect --staged --verbose
|
|
146
|
+
if [ $? -ne 0 ]; then
|
|
147
|
+
echo "ERROR: gitleaks detected potential secrets. Commit aborted."
|
|
148
|
+
exit 1
|
|
149
|
+
fi
|
|
150
|
+
fi
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## 5. CI Enforcement
|
|
154
|
+
|
|
155
|
+
CI is the authoritative gate for merge policy.
|
|
156
|
+
|
|
157
|
+
- **Guideline**: CI should enforce tests, lint, and policy checks that cannot be reliably enforced locally.
|
|
158
|
+
- **Guideline**: For policies that hosting cannot enforce (e.g., verifying all PR commits are signed), CI should fail the PR.
|
|
159
|
+
- **Atomic Rules**: GIT-00018
|
|
160
|
+
|
|
161
|
+
### Example: GitHub Actions Workflow for Branch Protection
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
name: PR Compliance
|
|
165
|
+
on: [pull_request]
|
|
166
|
+
jobs:
|
|
167
|
+
compliance:
|
|
168
|
+
runs-on: ubuntu-latest
|
|
169
|
+
steps:
|
|
170
|
+
- uses: actions/checkout@v4
|
|
171
|
+
- name: Check branch naming
|
|
172
|
+
run: |
|
|
173
|
+
BRANCH_NAME="${{ github.head_ref }}"
|
|
174
|
+
if [[ ! "$BRANCH_NAME" =~ ^(feat|fix|refactor|docs|test|chore)/[a-z0-9-]+$ ]]; then
|
|
175
|
+
echo "ERROR: Branch name '$BRANCH_NAME' does not follow pattern <type>/<short-description> (kebab-case)."
|
|
176
|
+
exit 1
|
|
177
|
+
fi
|
|
178
|
+
- name: Check commit message format
|
|
179
|
+
run: |
|
|
180
|
+
git log --oneline --no-merges ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | while read line; do
|
|
181
|
+
commit_hash=$(echo "$line" | cut -d' ' -f1)
|
|
182
|
+
subject=$(echo "$line" | cut -d' ' -f2-)
|
|
183
|
+
if [ ${#subject} -gt 50 ]; then
|
|
184
|
+
echo "ERROR: Commit $commit_hash subject line >50 chars: '$subject'"
|
|
185
|
+
exit 1
|
|
186
|
+
fi
|
|
187
|
+
done
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 6. Dependency Management
|
|
191
|
+
|
|
192
|
+
- **Lockfiles**: Version lockfiles must be committed to ensure reproducible builds.
|
|
193
|
+
- **Atomic Updates**: Dependency updates should be isolated in dedicated commits.
|
|
194
|
+
- **Security Patches**: Critical security updates must be prioritized and applied promptly.
|
|
195
|
+
- **Transitive Dependencies**: Regularly review transitive dependencies for vulnerabilities.
|
|
196
|
+
- **Atomic Rules**: GIT-00024
|
|
197
|
+
|
|
198
|
+
### Example: Dependency Update Commit
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Update a dependency and commit lockfile
|
|
202
|
+
npm update package-name --save
|
|
203
|
+
git add package.json package-lock.json
|
|
204
|
+
git commit -m "chore(deps): update package-name to v2.1.0
|
|
205
|
+
|
|
206
|
+
- Security fix for CVE-2023-XXXXX
|
|
207
|
+
- Performance improvements
|
|
208
|
+
- Tested with existing test suite"
|
|
209
|
+
```
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# 06. Advanced Operations
|
|
2
|
+
|
|
3
|
+
**Sources**: [Pro Git: Tools](https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection), [GitHub: Large files](https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github)
|
|
4
|
+
|
|
5
|
+
## 1. Partial Staging (`git add -p`)
|
|
6
|
+
|
|
7
|
+
- **Principle**: A commit represents one logical change.
|
|
8
|
+
- **Guideline**: If a file contains multiple logical changes, you **SHOULD** stage only the relevant hunks so the resulting commit stays atomic.
|
|
9
|
+
- **Anti-Pattern**: One commit that mixes refactors, formatting, and behavior changes.
|
|
10
|
+
- **Atomic Rules**: GIT-00021
|
|
11
|
+
|
|
12
|
+
### Example: Interactive Staging
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Stage specific hunks
|
|
16
|
+
git add -p path/to/file.js
|
|
17
|
+
|
|
18
|
+
# Review staged changes
|
|
19
|
+
git diff --cached
|
|
20
|
+
|
|
21
|
+
# Commit only the staged changes
|
|
22
|
+
git commit -m "Fix validation logic for email field"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 2. Recovery & Maintenance
|
|
26
|
+
|
|
27
|
+
- **Reflog**: If you lost work, you **SHOULD** check the reflog before assuming it is gone.
|
|
28
|
+
- **Bisect**: For regressions, you **SHOULD** use bisect to identify the first bad commit.
|
|
29
|
+
- **Prerequisite**: The Logical Commit Series should be buildable and testable to keep bisect effective.
|
|
30
|
+
- **Stash**: You **SHOULD** prefer commits or worktrees for context switching. Use stash for short-lived, local-only interruption handling.
|
|
31
|
+
- **Guideline**: Do not keep long-lived stashes; they rot and create hidden merge conflicts.
|
|
32
|
+
- **Cherry-Pick**: You **SHOULD** cherry-pick for backports/hotfix propagation when you need to apply a specific fix without merging unrelated history.
|
|
33
|
+
- **Revert**: On public branches, you **SHOULD** revert instead of rewriting history.
|
|
34
|
+
- **LFS**: Repositories **MUST** not store large binary artifacts directly in Git history. Track large or non-diffable binaries via Git LFS and commit the corresponding `.gitattributes` changes.
|
|
35
|
+
- **Platform Constraint (e.g., GitHub)**: Hosting platforms may warn above 50 MiB and block above 100 MiB. Treat warning thresholds as hard guidelines and hard limits as hard blocks.
|
|
36
|
+
- **Atomic Rules**: GIT-00014
|
|
37
|
+
|
|
38
|
+
### Example: Git LFS Setup
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Install Git LFS
|
|
42
|
+
git lfs install
|
|
43
|
+
|
|
44
|
+
# Track large binary files
|
|
45
|
+
git lfs track "*.psd"
|
|
46
|
+
git lfs track "*.zip"
|
|
47
|
+
git lfs track "*.bin"
|
|
48
|
+
|
|
49
|
+
# Commit .gitattributes
|
|
50
|
+
git add .gitattributes
|
|
51
|
+
git commit -m "track large files with LFS"
|
|
52
|
+
|
|
53
|
+
# Push as usual
|
|
54
|
+
git push origin main
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 3. Worktrees
|
|
58
|
+
|
|
59
|
+
- **Principle**: Separate concurrent work to reduce accidental cross-task edits.
|
|
60
|
+
- **Guideline**: If you are working on more than one task/branch at once, you **SHOULD** use worktrees instead of stashing and constantly switching your working directory.
|
|
61
|
+
- **Constraint**: Keep one branch checked out per worktree.
|
|
62
|
+
|
|
63
|
+
### Example: Creating a Worktree
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Create a new worktree for feature branch
|
|
67
|
+
git worktree add ../myrepo-feature feat/new-widget
|
|
68
|
+
|
|
69
|
+
# Switch to the worktree
|
|
70
|
+
cd ../myrepo-feature
|
|
71
|
+
|
|
72
|
+
# Later, remove the worktree
|
|
73
|
+
git worktree remove ../myrepo-feature
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 4. Large Repos & Dependencies
|
|
77
|
+
|
|
78
|
+
- **Sparse Checkout**: You **SHOULD** use sparse checkout when a repo is large enough that full checkouts meaningfully slow iteration.
|
|
79
|
+
- **Constraint**: Ensure tooling (build/test/scripts) still works with the reduced working set.
|
|
80
|
+
- **Submodules**: You **SHOULD** avoid submodules by default; they make clones, CI, and dependency updates harder.
|
|
81
|
+
- **If Required**: You **MUST** pin exact SHAs, document the update workflow, and never rely on floating refs.
|
|
82
|
+
|
|
83
|
+
### Example: Sparse Checkout
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Enable sparse checkout
|
|
87
|
+
git config core.sparseCheckout true
|
|
88
|
+
|
|
89
|
+
# Specify which directories to keep
|
|
90
|
+
echo "src/frontend/" >> .git/info/sparse-checkout
|
|
91
|
+
echo "config/" >> .git/info/sparse-checkout
|
|
92
|
+
|
|
93
|
+
# Read the configured sparse checkout
|
|
94
|
+
git read-tree -mu HEAD
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Example: Submodule Update Workflow
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Update submodule to latest commit of a specific branch
|
|
101
|
+
cd submodule-path
|
|
102
|
+
git checkout main
|
|
103
|
+
git pull origin main
|
|
104
|
+
cd ..
|
|
105
|
+
git add submodule-path
|
|
106
|
+
git commit -m "Update submodule to latest main"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
- **Atomic Rules**: GIT-00025
|
|
110
|
+
|
|
111
|
+
## 5. Code Archaeology & Debugging
|
|
112
|
+
|
|
113
|
+
- **Principle**: Prefer understanding history over rewriting it.
|
|
114
|
+
- **Guideline**: You **SHOULD** use history inspection (diff/log/show/blame) to explain changes, identify regressions, and support reviews.
|
|
115
|
+
|
|
116
|
+
### Example: Finding When a Bug Was Introduced
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Use git bisect to find the commit that introduced a bug
|
|
120
|
+
git bisect start
|
|
121
|
+
git bisect bad HEAD
|
|
122
|
+
git bisect good v1.0.0
|
|
123
|
+
|
|
124
|
+
# Test current commit (mark bad/good)
|
|
125
|
+
git bisect bad # if bug present
|
|
126
|
+
git bisect good # if bug absent
|
|
127
|
+
|
|
128
|
+
# After bisect completes, reset
|
|
129
|
+
git bisect reset
|
|
130
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Git Meta-Documentation
|
|
2
|
+
|
|
3
|
+
**Domain**: Version Control & Collaboration Protocol.
|
|
4
|
+
**Scope**: All repositories managed by LGTM agents.
|
|
5
|
+
|
|
6
|
+
These documents define the operational standard for Git usage. They are written for humans and agents, and they serve as the cited sources for atomic rules under `rules/laws/git/*`.
|
|
7
|
+
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
## Atomic Rule Mapping
|
|
11
|
+
|
|
12
|
+
- 1. Workflow: GIT-00004, GIT-00009, GIT-00010, GIT-00022, GIT-00023
|
|
13
|
+
- 2. Commit: GIT-00001, GIT-00002, GIT-00003, GIT-00008, GIT-00020, GIT-00021
|
|
14
|
+
- 3. Collaboration: GIT-00007, GIT-00012, GIT-00019
|
|
15
|
+
- 4. Integrity: GIT-00005, GIT-00006, GIT-00011
|
|
16
|
+
- 5. Configuration: GIT-00013, GIT-00015, GIT-00016, GIT-00017, GIT-00018, GIT-00024
|
|
17
|
+
- 6. Advanced Ops: GIT-00014, GIT-00025
|
|
18
|
+
|
|
19
|
+
### Core Principles
|
|
20
|
+
|
|
21
|
+
- **[01. The Workflow](01-workflow.md)**: Trunk-Based Development, Branch Lifecycles, Branch Naming, and PR hygiene.
|
|
22
|
+
- **[02. The Commit](02-commits.md)**: Atomicity, Conventional structure, and the Cognitive Pass.
|
|
23
|
+
- **[03. Collaboration](03-collaboration.md)**: Reviewer capital, Etiquette, and Escalation.
|
|
24
|
+
- **[04. Integrity](04-integrity.md)**: Signing, Merge Strategies, and Immutable History.
|
|
25
|
+
|
|
26
|
+
### Operational Guides
|
|
27
|
+
|
|
28
|
+
- **[05. Configuration & Governance](05-configuration.md)**: Hooks, Ignore standards, and Branch Protection.
|
|
29
|
+
- **[06. Advanced Operations](06-advanced.md)**: Atomic staging, recovery, LFS, worktrees, and large repo practices.
|