spec-view 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.
Files changed (38) hide show
  1. spec_view-0.2.0/.github/workflows/release.yml +33 -0
  2. spec_view-0.2.0/.gitignore +70 -0
  3. spec_view-0.2.0/PKG-INFO +147 -0
  4. spec_view-0.2.0/README.md +124 -0
  5. spec_view-0.2.0/docs/implementation-log.md +94 -0
  6. spec_view-0.2.0/docs/plan-session-transcript.jsonl +168 -0
  7. spec_view-0.2.0/docs/plan.md +258 -0
  8. spec_view-0.2.0/pyproject.toml +40 -0
  9. spec_view-0.2.0/src/spec_view/__init__.py +3 -0
  10. spec_view-0.2.0/src/spec_view/cli.py +390 -0
  11. spec_view-0.2.0/src/spec_view/core/__init__.py +0 -0
  12. spec_view-0.2.0/src/spec_view/core/config.py +97 -0
  13. spec_view-0.2.0/src/spec_view/core/detector.py +230 -0
  14. spec_view-0.2.0/src/spec_view/core/models.py +239 -0
  15. spec_view-0.2.0/src/spec_view/core/parser.py +232 -0
  16. spec_view-0.2.0/src/spec_view/core/scanner.py +70 -0
  17. spec_view-0.2.0/src/spec_view/core/watcher.py +84 -0
  18. spec_view-0.2.0/src/spec_view/tui/__init__.py +0 -0
  19. spec_view-0.2.0/src/spec_view/tui/app.py +86 -0
  20. spec_view-0.2.0/src/spec_view/tui/dashboard.py +174 -0
  21. spec_view-0.2.0/src/spec_view/tui/spec_view.py +117 -0
  22. spec_view-0.2.0/src/spec_view/tui/task_board.py +145 -0
  23. spec_view-0.2.0/src/spec_view/web/__init__.py +0 -0
  24. spec_view-0.2.0/src/spec_view/web/server.py +200 -0
  25. spec_view-0.2.0/src/spec_view/web/static/htmx.min.js +1 -0
  26. spec_view-0.2.0/src/spec_view/web/static/style.css +670 -0
  27. spec_view-0.2.0/src/spec_view/web/templates/base.html +42 -0
  28. spec_view-0.2.0/src/spec_view/web/templates/dashboard.html +5 -0
  29. spec_view-0.2.0/src/spec_view/web/templates/partials/dashboard_content.html +66 -0
  30. spec_view-0.2.0/src/spec_view/web/templates/partials/spec_content.html +76 -0
  31. spec_view-0.2.0/src/spec_view/web/templates/partials/tasks_content.html +92 -0
  32. spec_view-0.2.0/src/spec_view/web/templates/spec.html +14 -0
  33. spec_view-0.2.0/src/spec_view/web/templates/tasks.html +5 -0
  34. spec_view-0.2.0/tests/__init__.py +0 -0
  35. spec_view-0.2.0/tests/test_detector.py +100 -0
  36. spec_view-0.2.0/tests/test_models.py +320 -0
  37. spec_view-0.2.0/tests/test_parser.py +477 -0
  38. spec_view-0.2.0/tests/test_scanner.py +101 -0
@@ -0,0 +1,33 @@
1
+ name: Release to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-python@v5
13
+ with:
14
+ python-version: "3.12"
15
+ - run: pip install build
16
+ - run: python -m build
17
+ - uses: actions/upload-artifact@v4
18
+ with:
19
+ name: dist
20
+ path: dist/
21
+
22
+ publish:
23
+ needs: build
24
+ runs-on: ubuntu-latest
25
+ environment: pypi
26
+ permissions:
27
+ id-token: write
28
+ steps:
29
+ - uses: actions/download-artifact@v4
30
+ with:
31
+ name: dist
32
+ path: dist/
33
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,70 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+
27
+ # Virtual environments
28
+ .venv/
29
+ venv/
30
+ ENV/
31
+ env/
32
+
33
+ # Hatch
34
+ .hatch/
35
+
36
+ # Testing
37
+ .pytest_cache/
38
+ .coverage
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+
43
+ # Type checkers / linters
44
+ .mypy_cache/
45
+ .dmypy.json
46
+ dmypy.json
47
+ .ruff_cache/
48
+
49
+ # IDE
50
+ .idea/
51
+ .vscode/
52
+ *.swp
53
+ *.swo
54
+ *~
55
+
56
+ # OS
57
+ .DS_Store
58
+ Thumbs.db
59
+
60
+ # Environment variables
61
+ .env
62
+ .env.local
63
+ .env.*.local
64
+
65
+ # Jupyter
66
+ .ipynb_checkpoints/
67
+
68
+ # Local config overrides
69
+ *.local
70
+ local_settings.py
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.4
2
+ Name: spec-view
3
+ Version: 0.2.0
4
+ Summary: Universal spec-driven development dashboard
5
+ Author: spec-view contributors
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: click>=8.0
9
+ Requires-Dist: fastapi>=0.100
10
+ Requires-Dist: jinja2>=3.1
11
+ Requires-Dist: markdown>=3.5
12
+ Requires-Dist: python-frontmatter>=1.0
13
+ Requires-Dist: pyyaml>=6.0
14
+ Requires-Dist: rich>=13.0
15
+ Requires-Dist: textual>=0.40
16
+ Requires-Dist: uvicorn[standard]>=0.20
17
+ Requires-Dist: watchfiles>=0.20
18
+ Provides-Extra: dev
19
+ Requires-Dist: httpx>=0.24; extra == 'dev'
20
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
21
+ Requires-Dist: pytest>=7.0; extra == 'dev'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # spec-view
25
+
26
+ Universal spec-driven development dashboard. Works with **spec-kit**, **Kiro**, **OpenSpec**, or plain markdown specs.
27
+
28
+ Install with `pip install spec-view`, run `spec-view` in your project, done.
29
+
30
+ ## Quick Start
31
+
32
+ ```bash
33
+ # Initialize specs directory with examples
34
+ spec-view init
35
+
36
+ # List all specs
37
+ spec-view list
38
+
39
+ # Launch TUI dashboard
40
+ spec-view
41
+
42
+ # Start web dashboard
43
+ spec-view serve
44
+
45
+ # Watch for changes
46
+ spec-view watch
47
+
48
+ # Validate spec format
49
+ spec-view validate
50
+ ```
51
+
52
+ ## Spec Format
53
+
54
+ Put your specs in a `specs/` directory:
55
+
56
+ ```
57
+ specs/
58
+ ├── overview.md
59
+ ├── auth-system/
60
+ │ ├── spec.md
61
+ │ ├── design.md
62
+ │ └── tasks.md
63
+ └── payment-flow/
64
+ ├── spec.md
65
+ └── tasks.md
66
+ ```
67
+
68
+ Each markdown file supports optional YAML frontmatter:
69
+
70
+ ```markdown
71
+ ---
72
+ title: User Authentication
73
+ status: in-progress
74
+ priority: high
75
+ tags: [auth, backend]
76
+ ---
77
+
78
+ ## Requirements
79
+ - [ ] OAuth2 provider integration
80
+ - [x] JWT token generation
81
+ ```
82
+
83
+ ## Format-Aware Parsing
84
+
85
+ spec-view auto-detects which tool produced your spec files and extracts tool-specific metadata:
86
+
87
+ | Format | Detection | Extracted metadata |
88
+ |--------|-----------|-------------------|
89
+ | **spec-kit** | `## Phase N:` headings + `T001` task IDs | Phases, task IDs, `[P]` parallel markers, `[US1]` story refs, checkpoints |
90
+ | **Kiro** | `.kiro/` in file path | Indentation-based subtask trees |
91
+ | **OpenSpec** | `## 1.` numbered section headers | Section structure |
92
+ | **Generic** | Fallback | Checkbox tasks with subtask trees |
93
+
94
+ ### spec-kit Example
95
+
96
+ spec-view is the missing monitoring piece for spec-kit. A spec-kit `tasks.md` with phases, task IDs, parallel markers, and story refs:
97
+
98
+ ```markdown
99
+ ## Phase 1: Setup
100
+ - [x] T001 [P] Configure project structure
101
+ - [x] T002 [P] Set up testing framework
102
+ - [x] T003 Install dependencies
103
+
104
+ **Checkpoint**: Foundation ready
105
+
106
+ ## Phase 2: US1 - Login Flow
107
+ - [x] T004 [P] [US1] Create User model
108
+ - [ ] T005 [US1] Implement JWT validation
109
+ - [ ] T006 [P] [US1] Create login form
110
+ ```
111
+
112
+ In the TUI, this renders as:
113
+
114
+ ```
115
+ Phase 1: Setup ✓ (3/3)
116
+ ✓ T001 ⇄ Configure project structure
117
+ ✓ T002 ⇄ Set up testing framework
118
+ ✓ T003 Install dependencies
119
+ ⏸ Checkpoint: Foundation ready
120
+
121
+ Phase 2: US1 - Login Flow (1/3)
122
+ ✓ T004 ⇄ [US1] Create User model
123
+ ○ T005 [US1] Implement JWT validation
124
+ ○ T006 ⇄ [US1] Create login form
125
+ ```
126
+
127
+ The web UI shows collapsible phase sections with progress bars, task ID badges, parallel icons, and colored story tags.
128
+
129
+ ## Configuration
130
+
131
+ Create `.spec-view/config.yaml` to customize:
132
+
133
+ ```yaml
134
+ spec_paths:
135
+ - specs/
136
+ - docs/specs/
137
+ include:
138
+ - "**/*.spec.md"
139
+ exclude:
140
+ - "**/node_modules/**"
141
+ serve:
142
+ port: 8080
143
+ ```
144
+
145
+ ## Live Updates
146
+
147
+ Both TUI and web dashboards watch for file changes and update automatically. Edit a `[ ]` to `[x]` in your editor and see progress update within ~1 second.
@@ -0,0 +1,124 @@
1
+ # spec-view
2
+
3
+ Universal spec-driven development dashboard. Works with **spec-kit**, **Kiro**, **OpenSpec**, or plain markdown specs.
4
+
5
+ Install with `pip install spec-view`, run `spec-view` in your project, done.
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
10
+ # Initialize specs directory with examples
11
+ spec-view init
12
+
13
+ # List all specs
14
+ spec-view list
15
+
16
+ # Launch TUI dashboard
17
+ spec-view
18
+
19
+ # Start web dashboard
20
+ spec-view serve
21
+
22
+ # Watch for changes
23
+ spec-view watch
24
+
25
+ # Validate spec format
26
+ spec-view validate
27
+ ```
28
+
29
+ ## Spec Format
30
+
31
+ Put your specs in a `specs/` directory:
32
+
33
+ ```
34
+ specs/
35
+ ├── overview.md
36
+ ├── auth-system/
37
+ │ ├── spec.md
38
+ │ ├── design.md
39
+ │ └── tasks.md
40
+ └── payment-flow/
41
+ ├── spec.md
42
+ └── tasks.md
43
+ ```
44
+
45
+ Each markdown file supports optional YAML frontmatter:
46
+
47
+ ```markdown
48
+ ---
49
+ title: User Authentication
50
+ status: in-progress
51
+ priority: high
52
+ tags: [auth, backend]
53
+ ---
54
+
55
+ ## Requirements
56
+ - [ ] OAuth2 provider integration
57
+ - [x] JWT token generation
58
+ ```
59
+
60
+ ## Format-Aware Parsing
61
+
62
+ spec-view auto-detects which tool produced your spec files and extracts tool-specific metadata:
63
+
64
+ | Format | Detection | Extracted metadata |
65
+ |--------|-----------|-------------------|
66
+ | **spec-kit** | `## Phase N:` headings + `T001` task IDs | Phases, task IDs, `[P]` parallel markers, `[US1]` story refs, checkpoints |
67
+ | **Kiro** | `.kiro/` in file path | Indentation-based subtask trees |
68
+ | **OpenSpec** | `## 1.` numbered section headers | Section structure |
69
+ | **Generic** | Fallback | Checkbox tasks with subtask trees |
70
+
71
+ ### spec-kit Example
72
+
73
+ spec-view is the missing monitoring piece for spec-kit. A spec-kit `tasks.md` with phases, task IDs, parallel markers, and story refs:
74
+
75
+ ```markdown
76
+ ## Phase 1: Setup
77
+ - [x] T001 [P] Configure project structure
78
+ - [x] T002 [P] Set up testing framework
79
+ - [x] T003 Install dependencies
80
+
81
+ **Checkpoint**: Foundation ready
82
+
83
+ ## Phase 2: US1 - Login Flow
84
+ - [x] T004 [P] [US1] Create User model
85
+ - [ ] T005 [US1] Implement JWT validation
86
+ - [ ] T006 [P] [US1] Create login form
87
+ ```
88
+
89
+ In the TUI, this renders as:
90
+
91
+ ```
92
+ Phase 1: Setup ✓ (3/3)
93
+ ✓ T001 ⇄ Configure project structure
94
+ ✓ T002 ⇄ Set up testing framework
95
+ ✓ T003 Install dependencies
96
+ ⏸ Checkpoint: Foundation ready
97
+
98
+ Phase 2: US1 - Login Flow (1/3)
99
+ ✓ T004 ⇄ [US1] Create User model
100
+ ○ T005 [US1] Implement JWT validation
101
+ ○ T006 ⇄ [US1] Create login form
102
+ ```
103
+
104
+ The web UI shows collapsible phase sections with progress bars, task ID badges, parallel icons, and colored story tags.
105
+
106
+ ## Configuration
107
+
108
+ Create `.spec-view/config.yaml` to customize:
109
+
110
+ ```yaml
111
+ spec_paths:
112
+ - specs/
113
+ - docs/specs/
114
+ include:
115
+ - "**/*.spec.md"
116
+ exclude:
117
+ - "**/node_modules/**"
118
+ serve:
119
+ port: 8080
120
+ ```
121
+
122
+ ## Live Updates
123
+
124
+ Both TUI and web dashboards watch for file changes and update automatically. Edit a `[ ]` to `[x]` in your editor and see progress update within ~1 second.
@@ -0,0 +1,94 @@
1
+ # Implementation Log
2
+
3
+ Record of what was built during the initial implementation session.
4
+
5
+ ## What was implemented
6
+
7
+ All four phases from the plan were completed in a single session.
8
+
9
+ ### Phase 1: Core + CLI
10
+
11
+ - **`pyproject.toml`** - Hatchling build, Click entry point, all dependencies declared
12
+ - **`core/models.py`** - `Status` and `Priority` enums with `from_str()`, `Task`, `SpecFile`, and `SpecGroup` dataclasses with computed properties (task_percent, all_tasks, etc.)
13
+ - **`core/config.py`** - `Config` and `ServeConfig` dataclasses, `load_config()` reads `.spec-view/config.yaml` with sensible defaults
14
+ - **`core/parser.py`** - Uses `python-frontmatter` to parse YAML frontmatter + markdown body; extracts checkbox tasks via regex; auto-detects file type from filename; falls back to first `#` heading for title
15
+ - **`core/scanner.py`** - Walks configured `spec_paths`, respects `include`/`exclude` glob patterns, groups files by directory into `SpecGroup` objects
16
+ - **`cli.py`** - Click group with `init`, `list`, `serve`, `watch`, `validate` commands
17
+
18
+ ### Phase 2: TUI (Textual)
19
+
20
+ - **`tui/app.py`** - Main app with keybindings (q=quit, d=dashboard, t=tasks, r=refresh), optional watch mode with background thread
21
+ - **`tui/dashboard.py`** - Split view with `SpecTree` (left) and `SpecDetailView` (right), status bar with summary counts, j/k navigation
22
+ - **`tui/spec_view.py`** - Rich-rendered spec detail showing title, status, priority, tags, task progress, and body content for all files in a group
23
+ - **`tui/task_board.py`** - Lists all tasks across all specs grouped by pending/done
24
+
25
+ ### Phase 3: Web UI (FastAPI + Jinja2 + htmx)
26
+
27
+ - **`web/server.py`** - FastAPI app factory with 3 routes: dashboard (`/`), spec detail (`/spec/{name}`), task board (`/tasks`); renders markdown via `markdown` library
28
+ - **`web/templates/`** - 4 Jinja2 templates: base layout with nav, dashboard with spec cards + progress bar, spec detail with tab navigation, task board with kanban columns
29
+ - **`web/static/style.css`** - Dark theme CSS (GitHub-dark inspired), responsive grid, kanban columns, badges, progress bars
30
+ - **`web/static/htmx.min.js`** - htmx 1.9.12 for future interactivity
31
+
32
+ ### Phase 4: Polish
33
+
34
+ - **`core/watcher.py`** - Uses `watchfiles` to watch spec directories, filters for `.md`/`.yaml` changes
35
+ - **`cli.py validate`** - Checks for missing titles, missing frontmatter status, empty body content
36
+ - **`README.md`** - Quick start guide, spec format docs, config example
37
+
38
+ ### Tests
39
+
40
+ 36 tests, all passing:
41
+ - **`tests/test_models.py`** - 13 tests: Status/Priority parsing, Task defaults, SpecFile task percentages, SpecGroup aggregation and deduplication
42
+ - **`tests/test_parser.py`** - 12 tests: checkbox extraction, file type detection, title parsing, full frontmatter parsing, no-frontmatter fallback, empty files, string tags
43
+ - **`tests/test_scanner.py`** - 8 tests: file discovery, exclude patterns, include patterns, empty/missing dirs, directory grouping, task aggregation across groups, multiple groups (replaced 3 with correct count)
44
+
45
+ ## Dependencies
46
+
47
+ ```
48
+ click>=8.0
49
+ python-frontmatter>=1.0
50
+ pyyaml>=6.0
51
+ rich>=13.0
52
+ textual>=0.40
53
+ fastapi>=0.100
54
+ uvicorn[standard]>=0.20
55
+ jinja2>=3.1
56
+ watchfiles>=0.20
57
+ markdown>=3.5
58
+ ```
59
+
60
+ Dev: `pytest>=7.0`, `pytest-asyncio>=0.21`, `httpx>=0.24`
61
+
62
+ ---
63
+
64
+ ## Session 2: Format-Aware Parsing (spec-kit, Kiro, OpenSpec)
65
+
66
+ Added auto-detection of spec tool formats with enriched metadata and display.
67
+
68
+ ### Phase 5.1: Model Enrichment
69
+
70
+ - **`core/models.py`** — Added `task_id`, `parallel`, `story` fields to `Task` dataclass. New `Phase` dataclass with `number`, `title`, `subtitle`, `tasks`, `checkpoint` and computed `task_total`/`task_done`/`task_percent` properties. Added `phases` list and `format_type` string to `SpecFile`. Added `all_phases`, `format_type`, `stories` properties to `SpecGroup`.
71
+
72
+ ### Phase 5.2: Format Detection + Parsing
73
+
74
+ - **`core/parser.py`** — New `detect_format(body, path)` function: detects `"spec-kit"` (phases + task IDs), `"kiro"` (`.kiro/` in path), `"openspec"` (`## 1.` section headers), or `"generic"`. New `_extract_task_metadata(text)` helper: strips `T\d+` task IDs, `[P]` parallel markers, `[US\d+]` story refs from checkbox text, returns clean text + metadata. New `_parse_phases(body, flat_tasks)`: splits body on `## Phase N:` headings, assigns tasks to phases by position in the document, extracts `**Checkpoint**:` lines. Updated `parse_spec_file()` to call all three and populate new SpecFile fields.
75
+
76
+ ### Phase 5.3: TUI Display
77
+
78
+ - **`tui/spec_view.py`** — Detail pane renders phase-structured view when phases exist: phase headers with completion counts, `⇄` icon for parallel tasks, dim task ID prefixes, `[magenta]` story tags, `⏸ Checkpoint:` lines. Falls back to flat tree for non-phase specs. Refactored task rendering into `_append_task_line()` and `_format_task_prefix()` helpers.
79
+ - **`tui/task_board.py`** — Task board groups by phase when phases exist (new `_render_phase_board()`), falls back to pending/done grouping. Added `_append_task_line()` with metadata display. Simplified `_render_task_tree()` to reuse the shared helper.
80
+ - **`tui/dashboard.py`** — Tree labels show format badge (`[spec-kit]`) and phase sub-nodes with progress counts instead of file-type children when phases are available.
81
+
82
+ ### Phase 5.4: Web Display
83
+
84
+ - **`web/server.py`** — `_tasks_context()` now passes `all_phases` to template. `_spec_context()` passes `phases`, `format_type`, `stories`.
85
+ - **`web/templates/partials/tasks_content.html`** — Renders phase sections with collapsible headers, progress bars, task ID badges, parallel icons, story tags, and checkpoint dividers when phases exist. Falls back to flat task list.
86
+ - **`web/templates/partials/spec_content.html`** — Shows format badge in header, story tags in meta, phase sections with progress before tab content.
87
+ - **`web/templates/partials/dashboard_content.html`** — Format badge on spec cards, mini phase progress bars on cards when phases exist.
88
+ - **`web/static/style.css`** — New styles: `.task-id` (monospace dim badge), `.parallel-badge` (⇄ yellow), `.story-tag` with per-story colors (US1=blue, US2=purple, US3=green, US4=yellow, US5=red), `.format-badge` (pill), `.phase-section` (collapsible), `.phase-header`, `.checkpoint` (dashed divider), `.card-phases` with `.phase-mini` progress bars.
89
+
90
+ ### Phase 5.5: Tests
91
+
92
+ 24 new tests added (89 total, all passing):
93
+ - **`tests/test_parser.py`** — `TestDetectFormat` (4 tests: spec-kit, kiro, openspec, generic), `TestExtractTaskMetadata` (5 tests: task ID, parallel, story, all markers, no markers), `TestParsePhases` (2 tests: 3-phase split with checkpoints, subtitle parsing), `TestSpeckitFullParse` (1 end-to-end test: full tasks.md with phases + enriched metadata)
94
+ - **`tests/test_models.py`** — `TestTaskMetadataFields` (2 tests: defaults, with metadata), `TestPhase` (5 tests: task_total, task_done, task_percent, empty percent, checkpoint), `TestSpecFilePhases` (2 tests: populated, defaults), `TestSpecGroupPhases` (5 tests: all_phases from tasks file, format_type priority, generic fallback, stories collected, stories empty)