Skip to content

Commit 55f405f

Browse files
committed
Add Commit Explorer constitution with single-file and protocol-first principles
1 parent e404efe commit 55f405f

1 file changed

Lines changed: 101 additions & 35 deletions

File tree

.specify/memory/constitution.md

Lines changed: 101 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,116 @@
1-
# [PROJECT_NAME] Constitution
2-
<!-- Example: Spec Constitution, TaskFlow Constitution, etc. -->
1+
<!--
2+
SYNC IMPACT REPORT
3+
==================
4+
Version change: (unfilled template) → 1.0.0
5+
Initial constitution — all placeholders replaced for the first time.
6+
7+
Modified principles: N/A (first fill)
8+
Added sections: Core Principles, Technology Stack, Development Workflow, Governance
9+
Removed sections: N/A
10+
11+
Templates reviewed:
12+
✅ .specify/templates/plan-template.md — Constitution Check section already present; gates align with principles below.
13+
✅ .specify/templates/spec-template.md — Functional Requirements use MUST/SHOULD language consistent with this constitution.
14+
✅ .specify/templates/tasks-template.md — Phase structure and parallel task guidance align with Simplicity and single-file principles.
15+
✅ .claude/commands/speckit.constitution.md — Command file references generic `.specify/memory/constitution.md`; no agent-specific name leakage.
16+
17+
Deferred TODOs: None — all fields resolved from codebase context.
18+
-->
19+
20+
# Commit Explorer (CEX) Constitution
321

422
## Core Principles
523

6-
### [PRINCIPLE_1_NAME]
7-
<!-- Example: I. Library-First -->
8-
[PRINCIPLE_1_DESCRIPTION]
9-
<!-- Example: Every feature starts as a standalone library; Libraries must be self-contained, independently testable, documented; Clear purpose required - no organizational-only libraries -->
24+
### I. Single-File Architecture
25+
26+
The entire application MUST live in `app.py`. No splitting into packages, submodules, or
27+
separate modules unless absolutely unavoidable. All types, providers, git backend, graph
28+
rendering, and Textual UI belong in that single file.
29+
30+
**Rationale**: Single-file layout enables zero-install usage via `uvx`, trivial code audits,
31+
and eliminates the cognitive overhead of multi-module navigation. The ~900-line budget
32+
is a soft ceiling — violate it only with explicit justification.
33+
34+
### II. Protocol-First Data Access
35+
36+
All repository data MUST be fetched via the git wire protocol (Dulwich `porcelain.clone`),
37+
not via provider REST or GraphQL APIs. GitHub, GitLab, and Azure DevOps MUST all use the
38+
same clone-based approach. Provider classes are URL builders only — they MUST NOT make
39+
HTTP API calls.
40+
41+
**Rationale**: A single data-access path means no per-provider API client code, no REST
42+
pagination logic, no token scope management beyond clone auth. Uniformity across providers
43+
is a hard requirement.
1044

11-
### [PRINCIPLE_2_NAME]
12-
<!-- Example: II. CLI Interface -->
13-
[PRINCIPLE_2_DESCRIPTION]
14-
<!-- Example: Every library exposes functionality via CLI; Text in/out protocol: stdin/args → stdout, errors → stderr; Support JSON + human-readable formats -->
45+
### III. Shallow Clone Performance
1546

16-
### [PRINCIPLE_3_NAME]
17-
<!-- Example: III. Test-First (NON-NEGOTIABLE) -->
18-
[PRINCIPLE_3_DESCRIPTION]
19-
<!-- Example: TDD mandatory: Tests written → User approved → Tests fail → Then implement; Red-Green-Refactor cycle strictly enforced -->
47+
Clones MUST use `filter=blob:none` at all times. File content MUST NOT be fetched at clone
48+
time — only commits and trees. Diff content is computed on demand when a commit is selected.
49+
This MUST hold for all providers and all repository sizes.
2050

21-
### [PRINCIPLE_4_NAME]
22-
<!-- Example: IV. Integration Testing -->
23-
[PRINCIPLE_4_DESCRIPTION]
24-
<!-- Example: Focus areas requiring integration tests: New library contract tests, Contract changes, Inter-service communication, Shared schemas -->
51+
**Rationale**: Without blob filtering, large repositories (e.g. `torvalds/linux`) would be
52+
unusable. The shallow-clone strategy is load-bearing for the tool's core value proposition.
2553

26-
### [PRINCIPLE_5_NAME]
27-
<!-- Example: V. Observability, VI. Versioning & Breaking Changes, VII. Simplicity -->
28-
[PRINCIPLE_5_DESCRIPTION]
29-
<!-- Example: Text I/O ensures debuggability; Structured logging required; Or: MAJOR.MINOR.BUILD format; Or: Start simple, YAGNI principles -->
54+
### IV. TUI as Primary Interface
3055

31-
## [SECTION_2_NAME]
32-
<!-- Example: Additional Constraints, Security Requirements, Performance Standards, etc. -->
56+
All interactive features MUST be implemented as Textual widgets, bindings, or panels inside
57+
`CommitExplorer(App)`. The CLI entry point (`cex`) is for pre-loading arguments only. No
58+
web server, REST endpoint, or non-terminal GUI MUST ever be introduced.
3359

34-
[SECTION_2_CONTENT]
35-
<!-- Example: Technology stack requirements, compliance standards, deployment policies, etc. -->
60+
**Rationale**: The tool is explicitly a terminal UI. Keeping the interface constraint firm
61+
prevents scope creep into browser-based or Electron-style solutions.
3662

37-
## [SECTION_3_NAME]
38-
<!-- Example: Development Workflow, Review Process, Quality Gates, etc. -->
63+
### V. Simplicity & Minimal Dependencies
3964

40-
[SECTION_3_CONTENT]
41-
<!-- Example: Code review requirements, testing gates, deployment approval process, etc. -->
65+
New dependencies MUST NOT be added unless the equivalent functionality cannot be reasonably
66+
implemented with the existing stack (Dulwich, Textual, Rich, urllib3). YAGNI applies: do
67+
not build abstractions for hypothetical future features. Three similar lines are preferable
68+
to a premature abstraction.
69+
70+
**Rationale**: `uvx`-installable tools must have a lean dependency graph. Each new
71+
dependency adds install time, potential breakage, and maintenance surface.
72+
73+
## Technology Stack
74+
75+
- **Language**: Python 3.11+ (type hints, `NamedTuple`, `asyncio.to_thread`)
76+
- **Package manager**: `uv` — MUST be used for all dependency and venv management
77+
- **TUI framework**: Textual — widgets, layouts, `@work`, bindings
78+
- **Git library**: Dulwich (pure-Python) — clone, walk, tree diffs
79+
- **Formatting**: Rich — ANSI→`Text` conversion, markup escaping
80+
- **HTTP layer**: urllib3 — SSL bypass pool manager for corporate proxies
81+
- **System dependency**: `git` binary — required on `$PATH` for graph rendering via
82+
`git log --graph --color=always`
83+
- **Environment**: `python-dotenv` for `.env` token loading
84+
85+
Adding or removing any item from this list is a MINOR version bump to the constitution.
86+
87+
## Development Workflow
88+
89+
- Run `uv sync` before any development session to ensure dependencies are current.
90+
- All changes MUST be validated by running `uv run cex` against at least one real
91+
repository before committing.
92+
- The `--export` flag MUST remain functional as a non-interactive smoke test:
93+
`uv run cex owner/repo --export`.
94+
- Commit messages MUST follow Conventional Commits (`feat:`, `fix:`, `docs:`, `refactor:`).
95+
- No test suite exists at this time; acceptance testing is manual via the TUI. If a
96+
test suite is introduced in future, it SHOULD use `pytest`.
4297

4398
## Governance
44-
<!-- Example: Constitution supersedes all other practices; Amendments require documentation, approval, migration plan -->
4599

46-
[GOVERNANCE_RULES]
47-
<!-- Example: All PRs/reviews must verify compliance; Complexity must be justified; Use [GUIDANCE_FILE] for runtime development guidance -->
100+
This constitution supersedes all other development practices for Commit Explorer. Any
101+
amendment MUST:
102+
103+
1. Be made by editing `.specify/memory/constitution.md` directly.
104+
2. Increment the version per semantic versioning:
105+
- **MAJOR** — principle removed, redefined, or backward-incompatible governance change.
106+
- **MINOR** — new principle or section added, or material expansion of existing guidance.
107+
- **PATCH** — clarifications, wording fixes, typo corrections.
108+
3. Update `LAST_AMENDED_DATE` to the amendment date.
109+
4. Propagate changes to all `.specify/templates/` files that reference the affected principle.
110+
111+
All feature planning (speckit workflow) MUST perform a Constitution Check gate in
112+
`plan.md` before Phase 0 research begins.
113+
114+
Runtime development guidance lives in `CLAUDE.md` at the repository root.
48115

49-
**Version**: [CONSTITUTION_VERSION] | **Ratified**: [RATIFICATION_DATE] | **Last Amended**: [LAST_AMENDED_DATE]
50-
<!-- Example: Version: 2.1.1 | Ratified: 2025-06-13 | Last Amended: 2025-07-16 -->
116+
**Version**: 1.0.0 | **Ratified**: 2026-03-07 | **Last Amended**: 2026-03-29

0 commit comments

Comments
 (0)