sqlprism 1.0.1__tar.gz → 1.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 (69) hide show
  1. sqlprism-1.2.0/.claude/skills/creating-branches-and-prs/PR-TEMPLATE.md +24 -0
  2. sqlprism-1.2.0/.claude/skills/creating-branches-and-prs/SKILL.md +77 -0
  3. sqlprism-1.2.0/.claude/skills/implementing-issues/AGENT-INSTRUCTIONS.md +68 -0
  4. sqlprism-1.2.0/.claude/skills/implementing-issues/SKILL.md +137 -0
  5. sqlprism-1.2.0/.claude/skills/implementing-issues/TASK-FORMAT.md +94 -0
  6. sqlprism-1.2.0/.claude/skills/managing-project-releases/BDD-TEMPLATE.md +107 -0
  7. sqlprism-1.2.0/.claude/skills/managing-project-releases/SKILL.md +75 -0
  8. sqlprism-1.2.0/.claude/skills/reviewing-prs/COMMENT-TEMPLATE.md +78 -0
  9. sqlprism-1.2.0/.claude/skills/reviewing-prs/REVIEWERS.md +87 -0
  10. sqlprism-1.2.0/.claude/skills/reviewing-prs/SKILL.md +67 -0
  11. sqlprism-1.2.0/.claude/skills/writing-graph-queries/EXAMPLES.md +82 -0
  12. sqlprism-1.2.0/.claude/skills/writing-graph-queries/SKILL.md +88 -0
  13. {sqlprism-1.0.1 → sqlprism-1.2.0}/.github/workflows/ci.yml +4 -0
  14. {sqlprism-1.0.1 → sqlprism-1.2.0}/.github/workflows/docs.yml +2 -2
  15. {sqlprism-1.0.1 → sqlprism-1.2.0}/.gitignore +3 -1
  16. {sqlprism-1.0.1 → sqlprism-1.2.0}/CLAUDE.md +9 -5
  17. {sqlprism-1.0.1 → sqlprism-1.2.0}/PKG-INFO +60 -48
  18. {sqlprism-1.0.1 → sqlprism-1.2.0}/README.md +57 -46
  19. sqlprism-1.2.0/docs/api/conventions.md +23 -0
  20. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/architecture/schema.md +54 -1
  21. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/getting-started/configuration.md +38 -48
  22. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/getting-started/installation.md +1 -1
  23. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/guide/cli.md +39 -9
  24. sqlprism-1.2.0/docs/guide/conventions.md +82 -0
  25. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/guide/dbt.md +10 -14
  26. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/guide/mcp-tools.md +133 -1
  27. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/guide/sqlmesh.md +11 -16
  28. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/index.md +2 -1
  29. {sqlprism-1.0.1 → sqlprism-1.2.0}/mkdocs.yml +2 -0
  30. {sqlprism-1.0.1 → sqlprism-1.2.0}/pyproject.toml +26 -2
  31. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/cli.py +283 -39
  32. sqlprism-1.2.0/src/sqlprism/core/conventions.py +1590 -0
  33. sqlprism-1.2.0/src/sqlprism/core/graph.py +3815 -0
  34. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/core/indexer.py +125 -4
  35. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/core/mcp_tools.py +553 -67
  36. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/languages/dbt.py +101 -1
  37. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/languages/sql.py +76 -6
  38. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/languages/sqlmesh.py +59 -6
  39. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/types.py +34 -0
  40. {sqlprism-1.0.1 → sqlprism-1.2.0}/tests/test_cli.py +68 -0
  41. sqlprism-1.2.0/tests/test_config.py +166 -0
  42. sqlprism-1.2.0/tests/test_conventions.py +2847 -0
  43. sqlprism-1.2.0/tests/test_federation.py +144 -0
  44. {sqlprism-1.0.1 → sqlprism-1.2.0}/tests/test_graph.py +511 -4
  45. sqlprism-1.2.0/tests/test_graph_tools.py +758 -0
  46. {sqlprism-1.0.1 → sqlprism-1.2.0}/tests/test_indexer.py +558 -0
  47. {sqlprism-1.0.1 → sqlprism-1.2.0}/tests/test_mcp_tools.py +706 -6
  48. {sqlprism-1.0.1 → sqlprism-1.2.0}/tests/test_renderers.py +416 -0
  49. {sqlprism-1.0.1 → sqlprism-1.2.0}/tests/test_sql_parser.py +118 -0
  50. sqlprism-1.2.0/tests/test_types.py +56 -0
  51. {sqlprism-1.0.1 → sqlprism-1.2.0}/uv.lock +64 -6
  52. sqlprism-1.0.1/src/sqlprism/core/graph.py +0 -1611
  53. {sqlprism-1.0.1 → sqlprism-1.2.0}/.github/dependabot.yml +0 -0
  54. {sqlprism-1.0.1 → sqlprism-1.2.0}/.github/workflows/publish.yml +0 -0
  55. {sqlprism-1.0.1 → sqlprism-1.2.0}/LICENSE +0 -0
  56. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/api/dbt.md +0 -0
  57. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/api/graph.md +0 -0
  58. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/api/indexer.md +0 -0
  59. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/api/mcp-tools.md +0 -0
  60. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/api/sql-parser.md +0 -0
  61. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/api/sqlmesh.md +0 -0
  62. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/api/types.md +0 -0
  63. {sqlprism-1.0.1 → sqlprism-1.2.0}/docs/architecture/overview.md +0 -0
  64. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/__init__.py +0 -0
  65. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/core/__init__.py +0 -0
  66. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/languages/__init__.py +0 -0
  67. {sqlprism-1.0.1 → sqlprism-1.2.0}/src/sqlprism/languages/utils.py +0 -0
  68. {sqlprism-1.0.1 → sqlprism-1.2.0}/tests/__init__.py +0 -0
  69. {sqlprism-1.0.1 → sqlprism-1.2.0}/tests/test_languages.py +0 -0
@@ -0,0 +1,24 @@
1
+ # PR Body Template
2
+
3
+ ```markdown
4
+ Closes #<issue_number>
5
+
6
+ ## Summary
7
+ - <what changed and why — 1-3 bullet points>
8
+
9
+ ## Test Plan
10
+ | Scenario | Test | Status |
11
+ |----------|------|--------|
12
+ | <from issue> | `test_function_name` | <pass/fail/pending> |
13
+ | <from issue> | `test_function_name` | <pass/fail/pending> |
14
+
15
+ ## Notes
16
+ <optional: anything reviewers should know — migration steps, breaking changes, etc.>
17
+ ```
18
+
19
+ ## Guidelines
20
+
21
+ - **Summary** should explain *why*, not just *what* — the diff shows the what
22
+ - **Test Plan** is copied from the issue's Test Plan section, with a Status column added
23
+ - **Closes** keyword auto-closes the linked issue on merge
24
+ - Keep the PR scoped to one issue — if it touches multiple issues, split into multiple PRs
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: creating-branches-and-prs
3
+ description: Creates git branches and GitHub pull requests following the project naming convention. Enforces the format type-issue_number-short-description for both branches and PR titles. Use when creating a branch, opening a PR, or asking about branch/PR naming.
4
+ ---
5
+
6
+ # Creating Branches and PRs
7
+
8
+ ## Naming Convention
9
+
10
+ Both branches and PR titles use the same format:
11
+
12
+ ```
13
+ <type>-<issue_number>-<short-description>
14
+ ```
15
+
16
+ ### Rules
17
+
18
+ - **Lowercase, hyphens only** — no spaces, underscores, slashes, or camelCase
19
+ - **Type prefix** — matches the issue label
20
+ - **Issue number** — the GitHub issue this work addresses
21
+ - **Short description** — 2-4 words summarizing the change
22
+
23
+ ### Types
24
+
25
+ | Type | When | Maps to label |
26
+ |------|------|---------------|
27
+ | `feat` | New functionality | `enhancement` |
28
+ | `fix` | Bug fix | `bug` |
29
+ | `chore` | Maintenance, CI, deps, migrations | `chore` |
30
+
31
+ ### Examples
32
+
33
+ | Issue | Branch / PR title |
34
+ |-------|-------------------|
35
+ | #8 Add repo_type column | `chore-8-repo-type-column` |
36
+ | #9 dbt render_models | `feat-9-dbt-render-models` |
37
+ | #11 Indexer reindex_files | `feat-11-indexer-reindex-files` |
38
+ | #14 Tests for reindex | `feat-14-reindex-on-save-tests` |
39
+
40
+ ## Creating a Branch
41
+
42
+ ```bash
43
+ git checkout main
44
+ git pull origin main
45
+ git checkout -b <type>-<issue_number>-<short-description>
46
+ ```
47
+
48
+ ## Creating a PR
49
+
50
+ Link the PR to its issue using `Closes #<number>` in the body. This auto-closes the issue on merge.
51
+
52
+ ```bash
53
+ gh pr create \
54
+ --title "<type>-<issue_number>-<short-description>" \
55
+ --body "$(cat <<'EOF'
56
+ Closes #<issue_number>
57
+
58
+ ## Summary
59
+ <1-3 bullet points>
60
+
61
+ ## Test plan
62
+ <checklist from the issue's Test Plan section>
63
+ EOF
64
+ )"
65
+ ```
66
+
67
+ ## PR Body Structure
68
+
69
+ See [PR-TEMPLATE.md](PR-TEMPLATE.md) for the full template.
70
+
71
+ ## Validation Checklist
72
+
73
+ Before creating a branch or PR, verify:
74
+ - [ ] Type matches the issue label (`enhancement` → `feat`, `bug` → `fix`, `chore` → `chore`)
75
+ - [ ] Issue number exists and is open
76
+ - [ ] Branch is based on latest `main`
77
+ - [ ] PR body includes `Closes #<number>`
@@ -0,0 +1,68 @@
1
+ # Sub-Agent Instructions
2
+
3
+ When spawning a sub-agent for a task, provide these instructions along with the task-specific context.
4
+
5
+ ## Prompt Template
6
+
7
+ ```
8
+ You are implementing task {task_id} for issue #{issue_number} in the SQLPrism project.
9
+
10
+ Tech stack: Python 3.12, DuckDB, sqlglot, FastMCP, click, pytest, uv.
11
+
12
+ ## Your Task
13
+ {task_title}
14
+
15
+ ## Files to Modify
16
+ {files list}
17
+
18
+ ## Scenarios to Satisfy
19
+ {scenarios from the task, copied from the issue's BDD scenarios}
20
+
21
+ ## Done When
22
+ {done_when}
23
+
24
+ ## Instructions
25
+
26
+ 1. Read the existing code in the files listed above before making changes
27
+ 2. Implement the changes to satisfy the scenarios
28
+ 3. If this is a test task, ensure test names match the issue's Test Plan exactly
29
+ 4. Run lint and type check to verify:
30
+ ```bash
31
+ uv run ruff check .
32
+ uv run ty check
33
+ ```
34
+ 5. Run the relevant tests to verify:
35
+ ```bash
36
+ uv run pytest {test_file} -v -k "{test_pattern}"
37
+ ```
38
+ 6. If lint and tests pass, commit with:
39
+ ```bash
40
+ git add {files}
41
+ git commit -m "{commit_message}
42
+
43
+ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>"
44
+ ```
45
+ 7. If lint or tests fail, fix the issue and try again (max 3 attempts)
46
+ 8. Return a summary: what changed, tests passed/failed, any concerns
47
+
48
+ ## Boundaries
49
+ - Only modify files listed in your task
50
+ - If you need to change other files, return with a note explaining why — do not modify them
51
+ - Do not amend or rebase existing commits
52
+ - Do not push to remote (the main agent handles this)
53
+ ```
54
+
55
+ ## What the Sub-Agent Returns
56
+
57
+ Each sub-agent must return a structured result:
58
+
59
+ ```
60
+ Task: {task_id}
61
+ Status: completed | failed
62
+ Files changed: {list}
63
+ Tests: {passed_count} passed, {failed_count} failed
64
+ Commit: {short sha} {commit message}
65
+ Notes: {any concerns, blockers, or scope questions}
66
+ ```
67
+
68
+ The main agent uses this to update `tasks.json` and decide next steps.
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: implementing-issues
3
+ description: Implements a GitHub issue end-to-end. Reads the issue, creates a branch and PR, breaks work into tasks saved to plans/, executes tasks in parallel via sub-agents, and commits after each task. Use when the user says /implement, asks to work on an issue, or references an issue number to start implementing.
4
+ ---
5
+
6
+ # Implementing Issues
7
+
8
+ ## Workflow
9
+
10
+ Copy this checklist and track progress:
11
+
12
+ ```
13
+ Implementation Progress:
14
+ - [ ] Step 1: Read issue and understand scope
15
+ - [ ] Step 2: Create branch and draft PR
16
+ - [ ] Step 3: Break down into tasks
17
+ - [ ] Step 4: Execute tasks (parallel where possible)
18
+ - [ ] Step 5: Verify and finalize
19
+ ```
20
+
21
+ ## Step 1: Read Issue
22
+
23
+ ```bash
24
+ gh issue view <number> --json title,body,labels,milestone
25
+ ```
26
+
27
+ Extract from the issue body:
28
+ - **Scenarios** — the acceptance criteria
29
+ - **Test Plan** — test function names and files
30
+ - **Dependencies** — blocked by / blocks
31
+
32
+ If the issue is blocked by open issues, stop and inform the user.
33
+
34
+ ## Step 2: Create Branch and Draft PR
35
+
36
+ Follow the branch/PR naming convention: `<type>-<issue_number>-<short-description>`
37
+
38
+ Type mapping: `enhancement` → `feat`, `bug` → `fix`, `chore` → `chore`
39
+
40
+ ```bash
41
+ git checkout main && git pull origin main
42
+ git checkout -b <type>-<number>-<description>
43
+ git push -u origin <type>-<number>-<description>
44
+ ```
45
+
46
+ Create a **draft PR** immediately so progress is visible:
47
+
48
+ ```bash
49
+ gh pr create --draft \
50
+ --title "<type>-<number>-<description>" \
51
+ --body "$(cat <<'EOF'
52
+ Closes #<number>
53
+
54
+ ## Summary
55
+ - <to be updated on completion>
56
+
57
+ ## Test Plan
58
+ <copy Test Plan table from issue, add Status column set to pending>
59
+ EOF
60
+ )"
61
+ ```
62
+
63
+ ## Step 3: Break Down into Tasks
64
+
65
+ Analyze the issue scenarios and create a task breakdown. Save to `.claude/plans/<issue_number>/tasks.json`.
66
+
67
+ ```bash
68
+ mkdir -p .claude/plans/<issue_number>
69
+ ```
70
+
71
+ See [TASK-FORMAT.md](TASK-FORMAT.md) for the JSON schema and decomposition rules.
72
+
73
+ **Key rules:**
74
+ - Each task maps to one or more scenarios from the issue
75
+ - Tasks that touch different files/modules can run in parallel
76
+ - Tests are a separate task per module, but run after implementation tasks
77
+ - Every task has a clear "done when" that maps back to a scenario
78
+
79
+ ## Step 4: Execute Tasks
80
+
81
+ Read `.claude/plans/<issue_number>/tasks.json` and identify which tasks can run in parallel (no shared files, no dependency between them).
82
+
83
+ For each task, spawn a sub-agent with:
84
+ - The task description and acceptance criteria from tasks.json
85
+ - The relevant scenario(s) from the issue
86
+ - The specific files to create/modify
87
+ - Instructions to commit when done (see [AGENT-INSTRUCTIONS.md](AGENT-INSTRUCTIONS.md))
88
+
89
+ **Parallel execution rules:**
90
+ - Tasks in the same `parallel_group` run simultaneously
91
+ - Tasks with `depends_on` wait for dependencies to complete
92
+ - After each sub-agent finishes, update tasks.json status
93
+
94
+ ```bash
95
+ # After each task completes, update the task status
96
+ # The sub-agent commits its own changes
97
+ ```
98
+
99
+ ## Step 5: Verify and Finalize
100
+
101
+ After all tasks complete:
102
+
103
+ ```bash
104
+ # Run linter and type checker — must pass before PR is marked ready
105
+ uv run ruff check .
106
+ uv run ty check
107
+
108
+ # Run full test suite
109
+ uv run pytest tests/ -v
110
+
111
+ # Update the draft PR to ready
112
+ gh pr ready <pr_number>
113
+ ```
114
+
115
+ If ruff, ty, or tests fail, fix the issues and commit before marking the PR ready.
116
+
117
+ Update the PR body with final summary and test plan status.
118
+
119
+ ## Boundaries
120
+
121
+ **Always:**
122
+ - Create `.claude/plans/<issue_number>/tasks.json` before writing any code
123
+ - Commit after each task (not one big commit at the end)
124
+ - Run tests after implementation tasks before marking complete
125
+ - Run `uv run ruff check .` and `uv run ty check` before marking PR ready — lint and type check must pass
126
+ - Update tasks.json status as tasks complete
127
+
128
+ **Ask first:**
129
+ - If a task requires changing files not mentioned in the issue
130
+ - If dependencies need updating
131
+ - If the issue scope seems larger than expected
132
+
133
+ **Never:**
134
+ - Skip creating the task plan
135
+ - Modify files outside the task's listed scope without flagging it
136
+ - Force push or amend commits from other sub-agents
137
+ - Mark the PR as ready without passing tests
@@ -0,0 +1,94 @@
1
+ # Task Format
2
+
3
+ ## Schema: `.claude/plans/<issue_number>/tasks.json`
4
+
5
+ ```json
6
+ {
7
+ "issue": 9,
8
+ "title": "Add render_models() with --select support to dbt renderer",
9
+ "branch": "feat-9-dbt-render-models",
10
+ "tasks": [
11
+ {
12
+ "id": "T1",
13
+ "title": "Add render_models() method to DbtRenderer",
14
+ "status": "pending",
15
+ "parallel_group": "A",
16
+ "depends_on": [],
17
+ "files": ["src/sqlprism/renderers/dbt.py"],
18
+ "scenarios": [
19
+ "Compile a single dbt model",
20
+ "Compile multiple dbt models in one call",
21
+ "Model compilation fails"
22
+ ],
23
+ "done_when": "render_models() compiles selected models via --select and returns parsed results",
24
+ "commit_message": "feat(dbt): add render_models with --select support"
25
+ },
26
+ {
27
+ "id": "T2",
28
+ "title": "Ensure render_project remains unchanged",
29
+ "status": "pending",
30
+ "parallel_group": "A",
31
+ "depends_on": [],
32
+ "files": ["src/sqlprism/renderers/dbt.py"],
33
+ "scenarios": ["render_project remains unchanged"],
34
+ "done_when": "Existing render_project tests still pass with no code changes to that method",
35
+ "commit_message": ""
36
+ },
37
+ {
38
+ "id": "T3",
39
+ "title": "Add tests for render_models",
40
+ "status": "pending",
41
+ "parallel_group": "B",
42
+ "depends_on": ["T1"],
43
+ "files": ["tests/test_renderers.py"],
44
+ "scenarios": [
45
+ "Compile a single dbt model",
46
+ "Compile multiple dbt models in one call",
47
+ "Model compilation fails",
48
+ "render_project remains unchanged"
49
+ ],
50
+ "done_when": "All 4 test functions from Test Plan pass",
51
+ "commit_message": "test(dbt): add tests for render_models"
52
+ }
53
+ ]
54
+ }
55
+ ```
56
+
57
+ ## Decomposition Rules
58
+
59
+ ### Sizing
60
+ - Each task should be completable by a single sub-agent in one pass
61
+ - If a task touches more than 3 files, split it
62
+ - If a task has more than 4 scenarios, consider splitting by happy path vs edge cases
63
+
64
+ ### Parallel Groups
65
+ - Tasks in the same `parallel_group` letter (A, B, C...) can run simultaneously
66
+ - Group A typically has no dependencies — these run first
67
+ - Group B depends on group A, group C on B, etc.
68
+ - Tasks sharing the same file **cannot** be in the same parallel group
69
+
70
+ ### Task Types
71
+ | Type | Parallel? | Commit? |
72
+ |------|-----------|---------|
73
+ | Implementation (new code) | Yes, if different files | Yes |
74
+ | Refactor (modify existing) | Usually sequential | Yes |
75
+ | Tests | After implementation | Yes |
76
+ | Verification (no-op check) | With anything | No commit needed |
77
+
78
+ ### Status Values
79
+ - `pending` — not started
80
+ - `in_progress` — sub-agent working on it
81
+ - `completed` — committed and verified
82
+ - `failed` — sub-agent encountered an error
83
+ - `skipped` — not needed (explain in notes)
84
+
85
+ ### Commit Messages
86
+ Follow conventional commits: `<type>(<scope>): <description>`
87
+
88
+ | Type | When |
89
+ |------|------|
90
+ | `feat` | New functionality |
91
+ | `fix` | Bug fix |
92
+ | `test` | Adding/updating tests |
93
+ | `chore` | Migration, config, maintenance |
94
+ | `refactor` | Code change that doesn't add/fix |
@@ -0,0 +1,107 @@
1
+ # BDD Issue Template
2
+
3
+ Every issue follows this structure. Scenarios double as acceptance criteria AND test case specifications.
4
+
5
+ ## Template
6
+
7
+ ```markdown
8
+ ## Description
9
+ Brief context: what is being done and why.
10
+
11
+ ## Scenarios
12
+
13
+ ### Scenario: <descriptive name — the happy path>
14
+ **Given** <precondition or initial state>
15
+ **When** <action or event>
16
+ **Then** <expected outcome>
17
+ **And** <additional assertions if needed>
18
+
19
+ ### Scenario: <edge case or error path>
20
+ **Given** <precondition>
21
+ **When** <action>
22
+ **Then** <expected behavior>
23
+
24
+ ### Scenario: <another edge case>
25
+ ...
26
+
27
+ ## Test Plan
28
+
29
+ | Scenario | Test | File |
30
+ |----------|------|------|
31
+ | <scenario name> | `test_<descriptive_function_name>` | `tests/<test_file>.py` |
32
+ | <scenario name> | `test_<descriptive_function_name>` | `tests/<test_file>.py` |
33
+
34
+ ## Dependencies
35
+ - Blocked by: #<issue_number>, #<issue_number>
36
+ - Blocks: #<issue_number>
37
+
38
+ ## Notes
39
+ Implementation hints, links to plan sections, design decisions.
40
+ ```
41
+
42
+ ## Writing Good Scenarios
43
+
44
+ ### DO
45
+ - Name scenarios descriptively: `Scenario: File outside any configured repo is skipped`
46
+ - Keep each scenario focused on one behavior
47
+ - Include both happy path and error/edge case scenarios
48
+ - Use concrete values in examples: `"stg_orders.sql"` not `"a file"`
49
+ - Write scenarios that translate directly to test functions
50
+
51
+ ### DON'T
52
+ - Don't write vague scenarios: `Scenario: It works correctly`
53
+ - Don't combine multiple behaviors in one scenario
54
+ - Don't skip edge cases — they're where bugs hide
55
+ - Don't write implementation details in Given/When/Then — describe behavior
56
+
57
+ ## Scenario Categories
58
+
59
+ Each issue should cover these categories where applicable:
60
+
61
+ 1. **Happy path** — the normal, expected use case
62
+ 2. **Error handling** — what happens when things fail
63
+ 3. **Edge cases** — boundary conditions, empty inputs, concurrent access
64
+ 4. **Backwards compatibility** — existing behavior remains unchanged
65
+ 5. **Integration** — how this interacts with adjacent components
66
+
67
+ ## Example
68
+
69
+ ```markdown
70
+ ## Description
71
+ Add checksum-based skip logic to avoid re-parsing unchanged files during reindex.
72
+
73
+ ## Scenarios
74
+
75
+ ### Scenario: Unchanged file is skipped
76
+ **Given** a file `stg_orders.sql` already indexed with checksum `abc123`
77
+ **When** `reindex_files()` is called and the file still has checksum `abc123`
78
+ **Then** no parse or database write occurs
79
+ **And** the file appears in the result as `skipped: unchanged`
80
+
81
+ ### Scenario: Changed file is reindexed
82
+ **Given** a file `stg_orders.sql` indexed with checksum `abc123`
83
+ **When** the file content changes (new checksum `def456`) and `reindex_files()` is called
84
+ **Then** the file is re-parsed and the graph is updated
85
+ **And** the stored checksum is updated to `def456`
86
+
87
+ ### Scenario: New file has no previous checksum
88
+ **Given** a file `new_model.sql` that has never been indexed
89
+ **When** `reindex_files()` is called
90
+ **Then** the file is parsed and inserted
91
+ **And** no checksum comparison is attempted
92
+
93
+ ## Test Plan
94
+
95
+ | Scenario | Test | File |
96
+ |----------|------|------|
97
+ | Unchanged file is skipped | `test_reindex_unchanged_file_skipped` | `tests/test_indexer.py` |
98
+ | Changed file is reindexed | `test_reindex_changed_file_updates_graph` | `tests/test_indexer.py` |
99
+ | New file has no previous checksum | `test_reindex_new_file_no_checksum_check` | `tests/test_indexer.py` |
100
+
101
+ ## Dependencies
102
+ - Blocked by: #8
103
+ - Blocks: #12
104
+
105
+ ## Notes
106
+ Checksum uses SHA-256 of file content. Stored in the `files` table.
107
+ ```
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: managing-project-releases
3
+ description: Decomposes features or releases into BDD-formatted GitHub issues with Given/When/Then scenarios and test cases. Creates milestones, assigns labels, and adds issues to the project board. Use when starting a new release, planning a feature, or creating issue tickets.
4
+ ---
5
+
6
+ # Managing Project Releases
7
+
8
+ ## Context
9
+
10
+ - **GitHub repo:** darkcofy/sqlprism
11
+ - **GitHub Project:** SQLPrism (project number 1, owner darkcofy)
12
+ - **Labels:** `enhancement`, `bug`, `chore` (no sizing labels)
13
+ - **Branch convention:** `feat-<name>`, `fix-<name>`, `chore-<name>`
14
+
15
+ ## Workflow
16
+
17
+ 1. **Read the implementation plan** for the release from `.claude/plans/`
18
+ 2. **Create a milestone** named after the release version (e.g., `v1.0.1`)
19
+ 3. **Decompose into issues** — one per logical unit of work
20
+ 4. **Write each issue in BDD format** — see [BDD-TEMPLATE.md](BDD-TEMPLATE.md)
21
+ 5. **Add all issues** to the GitHub Project board
22
+ 6. **Update dependency references** with actual issue numbers after creation
23
+
24
+ ## Issue Decomposition Guidelines
25
+
26
+ Break work into issues that are:
27
+ - **Independent where possible** — parallelizable steps get separate issues
28
+ - **Ordered by dependency** — identify what blocks what
29
+ - **Testable** — every issue has BDD scenarios that become test cases
30
+ - **Single responsibility** — one issue = one logical change
31
+
32
+ Group by layer, not by file. Example layers:
33
+ - Schema/migration changes
34
+ - Renderer/parser changes
35
+ - Core logic (indexer, engine)
36
+ - API/tool surface (MCP tools, CLI commands)
37
+ - Tests (can be a single issue or per-layer)
38
+
39
+ ## Creating Issues
40
+
41
+ ```bash
42
+ gh issue create \
43
+ --milestone "<version>" \
44
+ --label "<type>" \
45
+ --title "<concise title>" \
46
+ --body "$(cat <<'EOF'
47
+ <BDD body — see BDD-TEMPLATE.md>
48
+ EOF
49
+ )"
50
+ ```
51
+
52
+ After creating all issues, add them to the project:
53
+
54
+ ```bash
55
+ gh project item-add 1 --owner darkcofy --url "<issue_url>"
56
+ ```
57
+
58
+ Then update dependency cross-references to use actual issue numbers.
59
+
60
+ ## Creating Milestones
61
+
62
+ ```bash
63
+ gh api repos/darkcofy/sqlprism/milestones \
64
+ -f title="<version>" \
65
+ -f description="<one-line summary>" \
66
+ -f state="open"
67
+ ```
68
+
69
+ ## Label Selection
70
+
71
+ | Label | When to use |
72
+ |-------|------------|
73
+ | `enhancement` | New features, new capabilities |
74
+ | `bug` | Fixing broken behavior |
75
+ | `chore` | Migrations, CI, deps, refactors |
@@ -0,0 +1,78 @@
1
+ # PR Comment Template
2
+
3
+ The synthesized review posted to GitHub follows this format exactly.
4
+
5
+ ## Template
6
+
7
+ ```markdown
8
+ ## PR Review — #<number>
9
+
10
+ ### Critical
11
+ | Reviewer | File:Line | Finding | Suggestion |
12
+ |----------|-----------|---------|------------|
13
+ | <SWE/DE/QA> | `path:line` | description | fix |
14
+
15
+ ### Warnings
16
+ | Reviewer | File:Line | Finding | Suggestion |
17
+ |----------|-----------|---------|------------|
18
+ | <SWE/DE/QA> | `path:line` | description | fix |
19
+
20
+ ### Suggestions
21
+ | Reviewer | File:Line | Finding | Suggestion |
22
+ |----------|-----------|---------|------------|
23
+ | <SWE/DE/QA> | `path:line` | description | fix |
24
+
25
+ ### Test Coverage
26
+ - [ ] All scenarios from issue Test Plan have corresponding tests
27
+ - [ ] Edge cases covered
28
+ - [ ] No regression risk identified
29
+
30
+ ### Summary
31
+ <2-3 sentence synthesis: overall assessment, key risks, recommendation>
32
+
33
+ ---
34
+ *Reviewed by: SWE, Data Engineer, QA Engineer*
35
+ *🤖 Generated with [Claude Code](https://claude.com/claude-code)*
36
+ ```
37
+
38
+ ## Rules
39
+
40
+ - **Deduplicate**: if two reviewers flag the same issue, list it once and credit both
41
+ - **Order by severity**: critical first, then warnings, then suggestions
42
+ - **Omit empty sections**: if no criticals, remove the Critical table entirely
43
+ - **Keep it scannable**: no prose paragraphs in the tables, save that for Summary
44
+ - **Link to lines**: use `path:line` format so GitHub renders clickable links in the diff
45
+
46
+ ## Example
47
+
48
+ ```markdown
49
+ ## PR Review — #9
50
+
51
+ ### Critical
52
+ | Reviewer | File:Line | Finding | Suggestion |
53
+ |----------|-----------|---------|------------|
54
+ | DE | `src/sqlprism/renderers/dbt.py:87` | `--select` flag placed before `compile` subcommand — dbt ignores it | Move `--select` after `compile`: `dbt compile --select model` |
55
+
56
+ ### Warnings
57
+ | Reviewer | File:Line | Finding | Suggestion |
58
+ |----------|-----------|---------|------------|
59
+ | SWE | `src/sqlprism/renderers/dbt.py:92` | No timeout on subprocess call — could hang indefinitely | Add `timeout=300` to `subprocess.run()` |
60
+ | QA | `tests/test_renderers.py` | No test for compilation timeout scenario | Add `test_dbt_render_models_timeout` |
61
+
62
+ ### Suggestions
63
+ | Reviewer | File:Line | Finding | Suggestion |
64
+ |----------|-----------|---------|------------|
65
+ | SWE | `src/sqlprism/renderers/dbt.py:95` | Hardcoded `target/compiled/` path | Extract to constant `_DBT_COMPILED_DIR` |
66
+
67
+ ### Test Coverage
68
+ - [x] All scenarios from issue #9 Test Plan have corresponding tests
69
+ - [ ] Edge cases covered — missing: timeout, empty model list
70
+ - [x] No regression risk identified
71
+
72
+ ### Summary
73
+ The `--select` flag ordering is a blocking issue — dbt silently ignores it, so no models actually compile. The subprocess timeout is a real risk in CI. Otherwise solid implementation with good test coverage.
74
+
75
+ ---
76
+ *Reviewed by: SWE, Data Engineer, QA Engineer*
77
+ *🤖 Generated with [Claude Code](https://claude.com/claude-code)*
78
+ ```