stb-reader 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.
- stb_reader-0.1.0/.claude/skills/incremental-implementation/SKILL.md +44 -0
- stb_reader-0.1.0/.claude/skills/planning-and-task-breakdown/SKILL.md +40 -0
- stb_reader-0.1.0/.claude/skills/spec-driven-development/SKILL.md +245 -0
- stb_reader-0.1.0/.github/workflows/ci.yml +25 -0
- stb_reader-0.1.0/.github/workflows/publish.yml +32 -0
- stb_reader-0.1.0/.gitignore +10 -0
- stb_reader-0.1.0/AGENTS.md +100 -0
- stb_reader-0.1.0/CLAUDE.md +87 -0
- stb_reader-0.1.0/LICENSE +21 -0
- stb_reader-0.1.0/PKG-INFO +153 -0
- stb_reader-0.1.0/README.md +105 -0
- stb_reader-0.1.0/docs/README.md +100 -0
- stb_reader-0.1.0/docs/authentication.md +161 -0
- stb_reader-0.1.0/docs/guide/api-reference.md +407 -0
- stb_reader-0.1.0/docs/guide/authentication.md +104 -0
- stb_reader-0.1.0/docs/guide/error-handling.md +165 -0
- stb_reader-0.1.0/docs/guide/getting-started.md +119 -0
- stb_reader-0.1.0/docs/guide/live-tv.md +180 -0
- stb_reader-0.1.0/docs/guide/pagination.md +136 -0
- stb_reader-0.1.0/docs/guide/series.md +268 -0
- stb_reader-0.1.0/docs/guide/vod.md +178 -0
- stb_reader-0.1.0/docs/live-tv.md +220 -0
- stb_reader-0.1.0/docs/vod-series.md +406 -0
- stb_reader-0.1.0/pyproject.toml +31 -0
- stb_reader-0.1.0/spec/001-stb-api-server/001-stb-api-server-implement.md +95 -0
- stb_reader-0.1.0/spec/001-stb-api-server/001-stb-api-server-plan.md +235 -0
- stb_reader-0.1.0/spec/001-stb-api-server/001-stb-api-server-requirements.md +229 -0
- stb_reader-0.1.0/spec/002-search-vod-endpoint/002-search-vod-endpoint-implement.md +114 -0
- stb_reader-0.1.0/spec/002-search-vod-endpoint/002-search-vod-endpoint-plan.md +131 -0
- stb_reader-0.1.0/spec/002-search-vod-endpoint/002-search-vod-endpoint-requirements.md +175 -0
- stb_reader-0.1.0/spec/003-episode-quality-levels/003-episode-quality-levels-plan.md +107 -0
- stb_reader-0.1.0/spec/003-episode-quality-levels/003-episode-quality-levels-requirements.md +153 -0
- stb_reader-0.1.0/spec/004-vod-movie-stream-link/004-vod-movie-stream-link-requirements.md +100 -0
- stb_reader-0.1.0/spec/005-strm-generator/005-strm-generator-implement.md +186 -0
- stb_reader-0.1.0/spec/005-strm-generator/005-strm-generator-plan.md +353 -0
- stb_reader-0.1.0/spec/005-strm-generator/005-strm-generator-requirements.md +277 -0
- stb_reader-0.1.0/spec/006-portal-content-sync/006-portal-content-sync-plan.md +220 -0
- stb_reader-0.1.0/spec/006-portal-content-sync/006-portal-content-sync-requirements.md +210 -0
- stb_reader-0.1.0/spec/007-lightweight-frontend/007-lightweight-frontend-implement.md +31 -0
- stb_reader-0.1.0/spec/007-lightweight-frontend/007-lightweight-frontend-plan.md +55 -0
- stb_reader-0.1.0/spec/007-lightweight-frontend/007-lightweight-frontend-requirements.md +138 -0
- stb_reader-0.1.0/spec/008-screenshot-support/008-screenshot-support-implement.md +15 -0
- stb_reader-0.1.0/spec/008-screenshot-support/008-screenshot-support-plan.md +29 -0
- stb_reader-0.1.0/spec/008-screenshot-support/008-screenshot-support-requirements.md +83 -0
- stb_reader-0.1.0/spec/009-category-library-sync/009-category-library-sync-implement.md +99 -0
- stb_reader-0.1.0/spec/009-category-library-sync/009-category-library-sync-plan.md +145 -0
- stb_reader-0.1.0/spec/009-category-library-sync/009-category-library-sync-requirements.md +213 -0
- stb_reader-0.1.0/spec/010-category-content-folders/010-category-content-folders-implement.md +113 -0
- stb_reader-0.1.0/spec/010-category-content-folders/010-category-content-folders-plan.md +82 -0
- stb_reader-0.1.0/spec/010-category-content-folders/010-category-content-folders-requirements.md +234 -0
- stb_reader-0.1.0/spec/011-category-item-count/011-category-item-count-implement.md +16 -0
- stb_reader-0.1.0/spec/011-category-item-count/011-category-item-count-plan.md +48 -0
- stb_reader-0.1.0/spec/011-category-item-count/011-category-item-count-requirements.md +107 -0
- stb_reader-0.1.0/spec/012-library-only/012-library-only-plan.md +175 -0
- stb_reader-0.1.0/spec/012-library-only/012-library-only-requirements.md +178 -0
- stb_reader-0.1.0/spec/013-documentation/013-documentation-plan.md +167 -0
- stb_reader-0.1.0/spec/013-documentation/013-documentation-requirements.md +179 -0
- stb_reader-0.1.0/stb_reader/__init__.py +10 -0
- stb_reader-0.1.0/stb_reader/_http.py +105 -0
- stb_reader-0.1.0/stb_reader/auth.py +28 -0
- stb_reader-0.1.0/stb_reader/client.py +24 -0
- stb_reader-0.1.0/stb_reader/exceptions.py +14 -0
- stb_reader-0.1.0/stb_reader/live_tv.py +87 -0
- stb_reader-0.1.0/stb_reader/models.py +77 -0
- stb_reader-0.1.0/stb_reader/vod.py +161 -0
- stb_reader-0.1.0/tests/__init__.py +0 -0
- stb_reader-0.1.0/tests/conftest.py +22 -0
- stb_reader-0.1.0/tests/test_auth.py +54 -0
- stb_reader-0.1.0/tests/test_http.py +108 -0
- stb_reader-0.1.0/tests/test_live_tv.py +129 -0
- stb_reader-0.1.0/tests/test_vod.py +275 -0
- stb_reader-0.1.0/uv.lock +893 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Incremental Implementation Guide
|
|
2
|
+
|
|
3
|
+
This document outlines a disciplined approach to building features in small, testable increments rather than large, monolithic changes.
|
|
4
|
+
|
|
5
|
+
## Core Principle
|
|
6
|
+
|
|
7
|
+
"Build in thin vertical slices — implement one piece, test it, verify it, then expand." Each increment should leave the system in a working, deployable state.
|
|
8
|
+
|
|
9
|
+
## Key Workflow Phases
|
|
10
|
+
|
|
11
|
+
The implementation phase follows specification, planning, and task breakdown. Work must proceed through established phase layers—completing setup before foundation work, foundation before core features—without skipping ahead to incomplete levels.
|
|
12
|
+
|
|
13
|
+
## The Increment Cycle
|
|
14
|
+
|
|
15
|
+
Each slice follows this pattern:
|
|
16
|
+
1. Implement the smallest complete piece
|
|
17
|
+
2. Run the test suite
|
|
18
|
+
3. Confirm the slice works as expected
|
|
19
|
+
4. Commit with a descriptive message
|
|
20
|
+
5. Proceed to the next slice
|
|
21
|
+
|
|
22
|
+
## Slicing Approaches
|
|
23
|
+
|
|
24
|
+
**Vertical slices** deliver end-to-end functionality (database through UI). **Contract-first slicing** defines API specifications before parallel backend/frontend work. **Risk-first slicing** tackles uncertain pieces early to avoid wasted effort.
|
|
25
|
+
|
|
26
|
+
## Implementation Rules
|
|
27
|
+
|
|
28
|
+
**Simplicity first**: Question whether abstractions justify their complexity. Three similar code blocks beats premature generalization.
|
|
29
|
+
|
|
30
|
+
**Scope discipline**: Touch only what the task requires. Don't refactor adjacent code or add unspecified features.
|
|
31
|
+
|
|
32
|
+
**One thing at a time**: Each commit addresses a single logical change.
|
|
33
|
+
|
|
34
|
+
**Keep it compilable**: The project must build and existing tests must pass between increments.
|
|
35
|
+
|
|
36
|
+
**Feature flags**: Hide incomplete work behind toggles when merging to main.
|
|
37
|
+
|
|
38
|
+
**Safe defaults**: New code should default to conservative, opt-in behavior.
|
|
39
|
+
|
|
40
|
+
**Rollback-friendly**: Each increment should be independently revertable.
|
|
41
|
+
|
|
42
|
+
## Critical Gate
|
|
43
|
+
|
|
44
|
+
Task completion requires validating acceptance criteria explicitly—not merely passing tests, which only prove code does what it does, not what the specification requires.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Planning and Task Breakdown Guide
|
|
2
|
+
|
|
3
|
+
This document outlines a systematic approach for decomposing work into manageable, verifiable tasks—essential when handling large features or unclear requirements.
|
|
4
|
+
|
|
5
|
+
## Key Principles
|
|
6
|
+
|
|
7
|
+
The workflow follows four sequential phases: SPECIFY → PLAN → TASKS → IMPLEMENT, with human review at each checkpoint. Planning must occur in read-only mode before any implementation begins.
|
|
8
|
+
|
|
9
|
+
## When to Apply This Method
|
|
10
|
+
|
|
11
|
+
Use task breakdown when:
|
|
12
|
+
- You possess specifications requiring implementation units
|
|
13
|
+
- Work feels too expansive to initiate
|
|
14
|
+
- Multiple agents or sessions need parallelization
|
|
15
|
+
- Scope communication to stakeholders is necessary
|
|
16
|
+
- Implementation sequence isn't straightforward
|
|
17
|
+
|
|
18
|
+
Avoid this approach for "single-file changes with obvious scope" or specs already containing defined tasks.
|
|
19
|
+
|
|
20
|
+
## Critical Planning Steps
|
|
21
|
+
|
|
22
|
+
**Step 0** requires identifying unresolved technical questions requiring research spikes before planning proceeds—invalid assumptions necessitate plan rewrites.
|
|
23
|
+
|
|
24
|
+
**Step 2** maps dependencies bottom-up, ensuring foundations precede dependent components.
|
|
25
|
+
|
|
26
|
+
**Step 3** emphasizes vertical slicing (one complete feature path) over horizontal slicing (all database, then all API, then UI).
|
|
27
|
+
|
|
28
|
+
Each task requires:
|
|
29
|
+
- Clear description and acceptance criteria
|
|
30
|
+
- Verification procedures
|
|
31
|
+
- File references
|
|
32
|
+
- Scope estimation (XS through XL)
|
|
33
|
+
|
|
34
|
+
## Task Sizing Standards
|
|
35
|
+
|
|
36
|
+
Tasks should remain Small to Medium (1-5 files). Anything exceeding 8 files needs further decomposition. "If a task is L or larger, it should be broken into smaller tasks."
|
|
37
|
+
|
|
38
|
+
## Quality Assurance
|
|
39
|
+
|
|
40
|
+
Before implementation, verify every task has acceptance criteria, verification steps, correct dependency ordering, and that all specification requirements map to tasks. Flag gaps as CRITICAL, HIGH, or MEDIUM severity.
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-driven-development
|
|
3
|
+
|
|
4
|
+
description: Creates specs before coding. Use when starting a new project, feature, or significant change and no specification exists yet. Use when requirements are unclear, ambiguous, or only exist as a vague idea.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Write a structured specification before writing any code. The spec is the shared source of truth between you and the human engineer — it defines what we're building, why, and how we'll know it's done. Code without a spec is guessing.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Starting a new project or feature
|
|
14
|
+
- Requirements are ambiguous or incomplete
|
|
15
|
+
- The change touches multiple files or modules
|
|
16
|
+
- You're about to make an architectural decision
|
|
17
|
+
- The task would take more than 30 minutes to implement
|
|
18
|
+
|
|
19
|
+
**When NOT to use:** Single-line fixes, typo corrections, or changes where requirements are unambiguous and self-contained.
|
|
20
|
+
|
|
21
|
+
## The Gated Workflow
|
|
22
|
+
|
|
23
|
+
Spec-driven development has four phases. Do not advance to the next phase until the current one is validated.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
SPECIFY ──→ PLAN ──→ TASKS ──→ IMPLEMENT
|
|
27
|
+
│ │ │ │
|
|
28
|
+
▼ ▼ ▼ ▼
|
|
29
|
+
Human Human Human Human
|
|
30
|
+
reviews reviews reviews reviews
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Phase 1: Specify
|
|
34
|
+
|
|
35
|
+
Start with a high-level vision. Ask the human clarifying questions until requirements are concrete.
|
|
36
|
+
|
|
37
|
+
**Surface assumptions immediately.** Before writing any spec content, list what you're assuming:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
ASSUMPTIONS I'M MAKING:
|
|
41
|
+
1. This is a web application (not native mobile)
|
|
42
|
+
2. Authentication uses session-based cookies (not JWT)
|
|
43
|
+
3. The database is PostgreSQL (based on existing Prisma schema)
|
|
44
|
+
4. We're targeting modern browsers only (no IE11)
|
|
45
|
+
→ Correct me now or I'll proceed with these.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Don't silently fill in ambiguous requirements. "The spec's entire purpose is to surface misunderstandings *before* code gets written — assumptions are the most dangerous form of misunderstanding."
|
|
49
|
+
|
|
50
|
+
**Handle mid-spec ambiguity with `[NEEDS CLARIFICATION]` markers.** When a requirement is unclear but not blocking enough to stop writing, embed the marker inline and keep going. Cap at **3 markers per spec** — more than 3 means you should stop and ask the human before continuing. When presenting markers for resolution, use a table:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
| # | Question | Options | Implication if left open |
|
|
54
|
+
|---|----------|---------|--------------------------|
|
|
55
|
+
| 1 | Should filtering apply server-side or client-side? | Server / Client | Drives whether the API needs filter params |
|
|
56
|
+
| 2 | Is this feature gated by user role? | Yes (admin only) / No (all users) | Changes auth requirements significantly |
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Replace all markers before the spec advances to the PLAN phase.
|
|
60
|
+
|
|
61
|
+
**Write a spec document covering these six core areas:**
|
|
62
|
+
|
|
63
|
+
1. **Objective** — What are we building and why? Who is the user? What does success look like?
|
|
64
|
+
|
|
65
|
+
2. **Commands** — Full executable commands with flags, not just tool names.
|
|
66
|
+
```
|
|
67
|
+
Build: npm run build
|
|
68
|
+
Test: npm test -- --coverage
|
|
69
|
+
Lint: npm run lint --fix
|
|
70
|
+
Dev: npm run dev
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
3. **Project Structure** — Where source code lives, where tests go, where docs belong.
|
|
74
|
+
```
|
|
75
|
+
src/ → Application source code
|
|
76
|
+
src/components → React components (*.test.ts colocated)
|
|
77
|
+
src/lib → Shared utilities (*.test.ts colocated)
|
|
78
|
+
e2e/ → End-to-end tests
|
|
79
|
+
docs/ → Documentation
|
|
80
|
+
```
|
|
81
|
+
Tests live next to the code they test, not in a separate top-level folder.
|
|
82
|
+
|
|
83
|
+
4. **Code Style** — One real code snippet showing your style beats three paragraphs describing it. Include naming conventions, formatting rules, and examples of good output.
|
|
84
|
+
|
|
85
|
+
5. **Testing Strategy** — What framework, where tests live, coverage expectations, which test levels for which concerns.
|
|
86
|
+
|
|
87
|
+
6. **Boundaries** — Three-tier system:
|
|
88
|
+
- **Always do:** Run tests before commits, follow naming conventions, validate inputs
|
|
89
|
+
- **Ask first:** Database schema changes, adding dependencies, changing CI config
|
|
90
|
+
- **Never do:** Commit secrets, edit vendor directories, remove failing tests without approval
|
|
91
|
+
|
|
92
|
+
**Spec template:**
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
# Spec: [Project/Feature Name]
|
|
96
|
+
|
|
97
|
+
## Objective
|
|
98
|
+
[What we're building and why.]
|
|
99
|
+
|
|
100
|
+
## User Stories
|
|
101
|
+
- As a [user type], I want to [action] so that [outcome]
|
|
102
|
+
|
|
103
|
+
## Functional Requirements
|
|
104
|
+
- FR-1: [requirement]
|
|
105
|
+
- FR-2: [requirement]
|
|
106
|
+
|
|
107
|
+
## Non-Functional Requirements
|
|
108
|
+
- NFR-1: [performance / security / accessibility requirement]
|
|
109
|
+
|
|
110
|
+
## Out of Scope
|
|
111
|
+
- [Explicit exclusions for this iteration]
|
|
112
|
+
|
|
113
|
+
## Assumptions
|
|
114
|
+
- [What we're treating as settled without explicit confirmation]
|
|
115
|
+
|
|
116
|
+
## Tech Stack
|
|
117
|
+
[Framework, language, key dependencies with versions]
|
|
118
|
+
|
|
119
|
+
## Commands
|
|
120
|
+
[Build, test, lint, dev — full commands]
|
|
121
|
+
|
|
122
|
+
## Project Structure
|
|
123
|
+
[Directory layout with descriptions]
|
|
124
|
+
|
|
125
|
+
## Code Style
|
|
126
|
+
[Example snippet + key conventions]
|
|
127
|
+
|
|
128
|
+
## Testing Strategy
|
|
129
|
+
[Framework, test locations, coverage requirements, test levels]
|
|
130
|
+
|
|
131
|
+
## Boundaries
|
|
132
|
+
- Always: [...]
|
|
133
|
+
- Ask first: [...]
|
|
134
|
+
- Never: [...]
|
|
135
|
+
|
|
136
|
+
## Success Criteria
|
|
137
|
+
[How we'll know this is done — specific, measurable, technology-agnostic conditions]
|
|
138
|
+
|
|
139
|
+
## Open Questions
|
|
140
|
+
[Anything unresolved that needs human input]
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Reframe instructions as success criteria.** When receiving vague requirements, translate them into concrete conditions:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
REQUIREMENT: "Make the dashboard faster"
|
|
147
|
+
|
|
148
|
+
REFRAMED SUCCESS CRITERIA:
|
|
149
|
+
- Dashboard LCP < 2.5s on 4G connection
|
|
150
|
+
- Initial data load completes in < 500ms
|
|
151
|
+
- No layout shift during load (CLS < 0.1)
|
|
152
|
+
→ Are these the right targets?
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
This lets you loop, retry, and problem-solve toward a clear goal rather than guessing what "faster" means.
|
|
156
|
+
|
|
157
|
+
**Success criteria must be technology-agnostic.** Describe observable user outcomes, not implementation choices:
|
|
158
|
+
|
|
159
|
+
| Bad (tech-coupled) | Good (user-focused) |
|
|
160
|
+
|--------------------|---------------------|
|
|
161
|
+
| "Uses Redis for caching" | "Search returns in < 300ms for 95% of queries" |
|
|
162
|
+
| "Migrates to PostgreSQL" | "All existing user data is preserved and queryable after migration" |
|
|
163
|
+
| "Implements React Query" | "UI reflects server state within 2 seconds of a background update" |
|
|
164
|
+
|
|
165
|
+
### Phase 2: Plan
|
|
166
|
+
|
|
167
|
+
With the validated spec, generate a technical implementation plan:
|
|
168
|
+
|
|
169
|
+
1. Identify the major components and their dependencies
|
|
170
|
+
2. Determine the implementation order (what must be built first)
|
|
171
|
+
3. Note risks and mitigation strategies
|
|
172
|
+
4. Identify what can be built in parallel vs. what must be sequential
|
|
173
|
+
5. Define verification checkpoints between phases
|
|
174
|
+
|
|
175
|
+
The plan should be reviewable: the human should be able to read it and say "yes, that's the right approach" or "no, change X."
|
|
176
|
+
|
|
177
|
+
### Phase 3: Tasks
|
|
178
|
+
|
|
179
|
+
Break the plan into discrete, implementable tasks:
|
|
180
|
+
|
|
181
|
+
- Each task should be completable in a single focused session
|
|
182
|
+
- Each task has explicit acceptance criteria
|
|
183
|
+
- Each task includes a verification step (test, build, manual check)
|
|
184
|
+
- Tasks are ordered by dependency, not by perceived importance
|
|
185
|
+
- No task should require changing more than ~5 files
|
|
186
|
+
|
|
187
|
+
**Task template:**
|
|
188
|
+
```markdown
|
|
189
|
+
- [ ] Task: [Description]
|
|
190
|
+
- Acceptance: [What must be true when done]
|
|
191
|
+
- Verify: [How to confirm — test command, build, manual check]
|
|
192
|
+
- Files: [Which files will be touched]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Every task list must end with a documentation update task:**
|
|
196
|
+
```markdown
|
|
197
|
+
- [ ] Task: Update Documentation
|
|
198
|
+
- Acceptance: `AGENTS.md` updated to reflect any new commands, endpoints, models, or boundaries introduced by this feature; relevant `docs/` files updated or created to describe new behavior; no stale references remain in either file
|
|
199
|
+
- Verify: Review `AGENTS.md` and affected `docs/*.md` for accuracy
|
|
200
|
+
- Files: `AGENTS.md`, `docs/<relevant>.md`
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Phase 4: Implement
|
|
204
|
+
|
|
205
|
+
Execute tasks one at a time following `incremental-implementation` and `test-driven-development` skills. Use `context-engineering` to load the right spec sections and source files at each step rather than flooding the agent with the entire spec. The final task of every implement phase is always to update `AGENTS.md` and relevant `docs/` files.
|
|
206
|
+
|
|
207
|
+
## Keeping the Spec Alive
|
|
208
|
+
|
|
209
|
+
The spec is a living document, not a one-time artifact:
|
|
210
|
+
|
|
211
|
+
- **Update when decisions change** — If you discover the data model needs to change, update the spec first, then implement.
|
|
212
|
+
- **Update when scope changes** — Features added or cut should be reflected in the spec.
|
|
213
|
+
- **Commit the spec** — The spec belongs in version control alongside the code.
|
|
214
|
+
- **Reference the spec in PRs** — Link back to the spec section that each PR implements.
|
|
215
|
+
|
|
216
|
+
## Common Rationalizations
|
|
217
|
+
|
|
218
|
+
| Rationalization | Reality |
|
|
219
|
+
|---|---|
|
|
220
|
+
| "This is simple, I don't need a spec" | Simple tasks don't need *long* specs, but they still need acceptance criteria. A two-line spec is fine. |
|
|
221
|
+
| "I'll write the spec after I code it" | That's documentation, not specification. The spec's value is in forcing clarity *before* code. |
|
|
222
|
+
| "The spec will slow us down" | A 15-minute spec prevents hours of rework. Waterfall in 15 minutes beats debugging in 15 hours. |
|
|
223
|
+
| "Requirements will change anyway" | That's why the spec is a living document. An outdated spec is still better than no spec. |
|
|
224
|
+
| "The user knows what they want" | Even clear requests have implicit assumptions. The spec surfaces those assumptions. |
|
|
225
|
+
|
|
226
|
+
## Red Flags
|
|
227
|
+
|
|
228
|
+
- Starting to write code without any written requirements
|
|
229
|
+
- Asking "should I just start building?" before clarifying what "done" means
|
|
230
|
+
- Implementing features not mentioned in any spec or task list
|
|
231
|
+
- Making architectural decisions without documenting them
|
|
232
|
+
- Skipping the spec because "it's obvious what to build"
|
|
233
|
+
|
|
234
|
+
## Verification
|
|
235
|
+
|
|
236
|
+
This is a quality gate — do not advance to PLAN until every item is checked.
|
|
237
|
+
|
|
238
|
+
- [ ] The spec covers all six core areas
|
|
239
|
+
- [ ] The human has reviewed and approved the spec
|
|
240
|
+
- [ ] Success criteria are specific, testable, and technology-agnostic
|
|
241
|
+
- [ ] Boundaries (Always/Ask First/Never) are defined
|
|
242
|
+
- [ ] The spec is saved to a file in the repository
|
|
243
|
+
- [ ] Functional requirements are numbered (FR-1, FR-2…) so tasks can reference them
|
|
244
|
+
- [ ] Out of Scope section exists with at least one explicit exclusion
|
|
245
|
+
- [ ] No `[NEEDS CLARIFICATION]` markers remain
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Set up Python 3.11
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.11"
|
|
20
|
+
|
|
21
|
+
- name: Install test dependencies
|
|
22
|
+
run: pip install -e ".[test,server]"
|
|
23
|
+
|
|
24
|
+
- name: Run tests with coverage
|
|
25
|
+
run: python -m pytest --cov=stb_reader --cov-report=term-missing --cov-fail-under=90
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment: pypi
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up uv
|
|
19
|
+
uses: astral-sh/setup-uv@v4
|
|
20
|
+
with:
|
|
21
|
+
version: "latest"
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
run: uv python install 3.11
|
|
25
|
+
|
|
26
|
+
- name: Build
|
|
27
|
+
run: uv build
|
|
28
|
+
|
|
29
|
+
- name: Publish
|
|
30
|
+
env:
|
|
31
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
32
|
+
run: uv publish
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Build & Setup
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
Install library: uv pip install -e .
|
|
7
|
+
Install test deps: uv pip install -e ".[test]"
|
|
8
|
+
Run tests: uv run pytest tests/ -v
|
|
9
|
+
Run with coverage: uv run pytest --cov=stb_reader tests/
|
|
10
|
+
Build distribution: uv build
|
|
11
|
+
Check package: uv run twine check dist/*
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Project Structure
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
stb_reader/ Sole importable package
|
|
18
|
+
__init__.py Public API: STBClient, all models, all exceptions
|
|
19
|
+
client.py STBClient entry point
|
|
20
|
+
auth.py handshake(), get_profile()
|
|
21
|
+
live_tv.py ITVService — genres, channels, stream URLs
|
|
22
|
+
vod.py VODService — categories, content, seasons, episodes, streams
|
|
23
|
+
models.py Dataclasses: Genre, Channel, Category, Content, Season, Episode, EpisodeFile, PagedResult
|
|
24
|
+
_http.py STBSession (requests wrapper with STB headers and auto-reauth)
|
|
25
|
+
exceptions.py STBError, AuthError, StreamError, NotFoundError
|
|
26
|
+
|
|
27
|
+
tests/ pytest suite; all HTTP mocked via `responses` library
|
|
28
|
+
docs/ STB protocol reference (authentication, live-tv, vod-series)
|
|
29
|
+
spec/ Spec-driven feature specs (NNN-slug/{requirements,plan,implement}.md)
|
|
30
|
+
|
|
31
|
+
.github/
|
|
32
|
+
workflows/
|
|
33
|
+
publish.yml Publishes to PyPI on v* tag push (requires PYPI_TOKEN secret)
|
|
34
|
+
|
|
35
|
+
pyproject.toml Package metadata and hatchling build config
|
|
36
|
+
README.md Installation and quick-start documentation
|
|
37
|
+
LICENSE MIT licence
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Public API
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from stb_reader import STBClient
|
|
44
|
+
|
|
45
|
+
client = STBClient(base_url="http://portal.example.com", mac="00:1A:79:XX:XX:XX")
|
|
46
|
+
client.authenticate()
|
|
47
|
+
|
|
48
|
+
# Live TV
|
|
49
|
+
genres = client.live_tv.get_genres()
|
|
50
|
+
channels = client.live_tv.get_channels(genre_id="*", page=1)
|
|
51
|
+
url = client.live_tv.get_stream_url(channels.items[0].cmd)
|
|
52
|
+
|
|
53
|
+
# VOD
|
|
54
|
+
cats = client.vod.get_categories()
|
|
55
|
+
content = client.vod.get_content(category_id="*", page=1)
|
|
56
|
+
seasons = client.vod.get_seasons(series_id="123")
|
|
57
|
+
episodes = client.vod.get_episodes(series_id="123", season_id=seasons[0].id)
|
|
58
|
+
url = client.vod.get_stream_url_by_first_file("123", seasons[0].id, episodes[0].id)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
All models and exceptions are importable directly from `stb_reader`:
|
|
62
|
+
`Genre`, `Channel`, `Category`, `Content`, `Season`, `Episode`, `EpisodeFile`, `PagedResult`,
|
|
63
|
+
`STBError`, `AuthError`, `StreamError`, `NotFoundError`
|
|
64
|
+
|
|
65
|
+
## Code Style
|
|
66
|
+
|
|
67
|
+
- Python 3.11+; snake_case everywhere
|
|
68
|
+
- Dataclasses for all domain models (`stb_reader/models.py`)
|
|
69
|
+
- Full type hints on every function signature
|
|
70
|
+
- No Pydantic, no async in `stb_reader/`
|
|
71
|
+
|
|
72
|
+
## Testing
|
|
73
|
+
|
|
74
|
+
- Mock all HTTP with `responses` library — never make real network calls in tests
|
|
75
|
+
- Target: 90%+ coverage on `stb_reader/`
|
|
76
|
+
- Run `uv run pytest tests/ -v` before every commit
|
|
77
|
+
- No test file may import from `server.*`
|
|
78
|
+
|
|
79
|
+
## Publishing
|
|
80
|
+
|
|
81
|
+
Releases publish to PyPI automatically when a `v*` tag is pushed:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git tag v0.2.0
|
|
85
|
+
git push origin v0.2.0
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The `PYPI_TOKEN` secret must be configured in the GitHub repository settings.
|
|
89
|
+
|
|
90
|
+
## Boundaries
|
|
91
|
+
|
|
92
|
+
- **Always:** typed signatures, run pytest before commits, run `uv build` to verify packaging
|
|
93
|
+
- **Ask first:** new runtime dependencies, changing the public `__init__.py` API, adding new STBClient methods
|
|
94
|
+
- **Never:** real HTTP calls in tests, credentials in source, async in `stb_reader/` core
|
|
95
|
+
|
|
96
|
+
## Documentation
|
|
97
|
+
|
|
98
|
+
- `docs/` contains protocol-level reference for the Ministra/Stalker STB API
|
|
99
|
+
- Update the relevant `docs/` file when changing protocol behavior
|
|
100
|
+
- Update this file (`AGENTS.md`) when adding commands, models, or boundaries
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Claude Instructions
|
|
2
|
+
|
|
3
|
+
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
|
|
4
|
+
|
|
5
|
+
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
|
|
6
|
+
|
|
7
|
+
## 0. Spec-Driven Development
|
|
8
|
+
|
|
9
|
+
**Before implementing any feature, run all three spec skills in order.**
|
|
10
|
+
|
|
11
|
+
Whenever asked to build, implement, add, or create a new feature, ALWAYS invoke these skills in sequence before writing any code:
|
|
12
|
+
|
|
13
|
+
1. `/planning-and-task-breakdown` — decompose the request into clear, ordered tasks
|
|
14
|
+
→ **Stop and wait for human review before continuing.**
|
|
15
|
+
2. `/spec-driven-development` — write requirements and a design spec for the feature
|
|
16
|
+
→ **Stop and wait for human review before continuing.**
|
|
17
|
+
3. `/incremental-implementation` — implement task-by-task, verifying each step
|
|
18
|
+
→ **Stop and wait for human review before continuing.**
|
|
19
|
+
|
|
20
|
+
Do not proceed past any step until the human explicitly approves.
|
|
21
|
+
|
|
22
|
+
### Spec File Naming & Structure
|
|
23
|
+
|
|
24
|
+
- Live under `spec/` at the repo root
|
|
25
|
+
- Each feature: `spec/NNN-slug/`
|
|
26
|
+
- Files: `NNN-slug-{requirements,plan,implement}.md`
|
|
27
|
+
- Increment NNN for each new feature (001, 002, 003…)
|
|
28
|
+
|
|
29
|
+
## 1. Think Before Coding
|
|
30
|
+
|
|
31
|
+
**Don't assume. Don't hide confusion. Surface tradeoffs.**
|
|
32
|
+
|
|
33
|
+
Before implementing:
|
|
34
|
+
- State your assumptions explicitly. If uncertain, ask.
|
|
35
|
+
- If multiple interpretations exist, present them - don't pick silently.
|
|
36
|
+
- If a simpler approach exists, say so. Push back when warranted.
|
|
37
|
+
- If something is unclear, stop. Name what's confusing. Ask.
|
|
38
|
+
|
|
39
|
+
## 2. Simplicity First
|
|
40
|
+
|
|
41
|
+
**Minimum code that solves the problem. Nothing speculative.**
|
|
42
|
+
|
|
43
|
+
- No features beyond what was asked.
|
|
44
|
+
- No abstractions for single-use code.
|
|
45
|
+
- No "flexibility" or "configurability" that wasn't requested.
|
|
46
|
+
- No error handling for impossible scenarios.
|
|
47
|
+
- If you write 200 lines and it could be 50, rewrite it.
|
|
48
|
+
|
|
49
|
+
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
|
|
50
|
+
|
|
51
|
+
## 3. Surgical Changes
|
|
52
|
+
|
|
53
|
+
**Touch only what you must. Clean up only your own mess.**
|
|
54
|
+
|
|
55
|
+
When editing existing code:
|
|
56
|
+
- Don't "improve" adjacent code, comments, or formatting.
|
|
57
|
+
- Don't refactor things that aren't broken.
|
|
58
|
+
- Match existing style, even if you'd do it differently.
|
|
59
|
+
- If you notice unrelated dead code, mention it - don't delete it.
|
|
60
|
+
|
|
61
|
+
When your changes create orphans:
|
|
62
|
+
- Remove imports/variables/functions that YOUR changes made unused.
|
|
63
|
+
- Don't remove pre-existing dead code unless asked.
|
|
64
|
+
|
|
65
|
+
The test: Every changed line should trace directly to the user's request.
|
|
66
|
+
|
|
67
|
+
## 4. Goal-Driven Execution
|
|
68
|
+
|
|
69
|
+
**Define success criteria. Loop until verified.**
|
|
70
|
+
|
|
71
|
+
Transform tasks into verifiable goals:
|
|
72
|
+
- "Add validation" → "Write tests for invalid inputs, then make them pass"
|
|
73
|
+
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
|
|
74
|
+
- "Refactor X" → "Ensure tests pass before and after"
|
|
75
|
+
|
|
76
|
+
For multi-step tasks, state a brief plan:
|
|
77
|
+
```
|
|
78
|
+
1. [Step] → verify: [check]
|
|
79
|
+
2. [Step] → verify: [check]
|
|
80
|
+
3. [Step] → verify: [check]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
**These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.
|
stb_reader-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 shubhsheth
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|