Skip to content

Commit 32c92d4

Browse files
Fix auto-tag release trigger, add workflow_dispatch to release.yml (#46)
- GITHUB_TOKEN tags don't trigger other workflows (by design) - Add workflow_dispatch input to release.yml so CI can trigger it - Auto-tag job now calls 'gh workflow run release.yml' after creating tag - Add actions:write permission to CI for workflow dispatch - All GITHUB_REF/GITHUB_REF_NAME replaced with RELEASE_TAG env var - Update RELEASE.md to document smoke test and smart version-check - Default DB path changed to ~/.copilot-session-tools/copilot_chats.db - SKILL.md updated for new default DB path and install instructions - Bump version to 0.1.3
1 parent 9796112 commit 32c92d4

File tree

10 files changed

+146
-47
lines changed

10 files changed

+146
-47
lines changed

.claude/skills/search-copilot-chats/SKILL.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,31 @@ See [claude-plugins.dev](https://claude-plugins.dev) for browsing available skil
3939

4040
## Prerequisites
4141

42-
- **CLI**: `copilot-session-tools` — installed via `uv` from `C:\_SRC\copilot-session-tools`
43-
- **Database**: `C:\_SRC\copilot-session-tools\copilot_chats.db` (run `stats` for current size/count)
44-
- **Run from repo root**: The CLI defaults to `./copilot_chats.db` in the current directory
42+
The `copilot-session-tools` CLI must be installed and available on PATH. The database is stored at `~/.copilot-session-tools/copilot_chats.db` by default.
4543

46-
All commands below assume you `cd` to the repo first:
44+
### Step 0: Ensure CLI is installed
45+
46+
Check if the CLI is available:
4747

4848
```powershell
49-
cd C:\_SRC\copilot-session-tools
49+
copilot-session-tools --help
50+
```
51+
52+
If the command is not found, install it using whichever package manager is available (in preference order):
53+
54+
```bash
55+
# Option 1: uv (recommended — fast, isolated)
56+
uv tool install copilot-session-tools[all]
57+
58+
# Option 2: pipx (isolated)
59+
pipx install copilot-session-tools[all]
60+
61+
# Option 3: pip (global)
62+
pip install copilot-session-tools[all]
5063
```
5164

65+
The `[all]` extra includes both the CLI and web viewer dependencies.
66+
5267
## Favor CLI over Python
5368

5469
**Always prefer CLI execution** (`copilot-session-tools` commands) over writing Python scripts or importing the library directly. The CLI handles all common workflows. Only drop into Python/SQL when:
@@ -59,7 +74,7 @@ cd C:\_SRC\copilot-session-tools
5974
For direct SQL queries, use `sqlite3` on the database file rather than writing Python:
6075

6176
```powershell
62-
sqlite3 "C:\_SRC\copilot-session-tools\copilot_chats.db" "SELECT session_id, workspace_name, created_at FROM sessions ORDER BY created_at DESC LIMIT 10"
77+
sqlite3 "$HOME/.copilot-session-tools/copilot_chats.db" "SELECT session_id, workspace_name, created_at FROM sessions ORDER BY created_at DESC LIMIT 10"
6378
```
6479

6580
## Instructions
@@ -281,23 +296,23 @@ When the CLI search doesn't support your query shape, use SQLite directly:
281296

282297
```powershell
283298
# Find sessions by workspace name
284-
sqlite3 "C:\_SRC\copilot-session-tools\copilot_chats.db" `
299+
sqlite3 "$HOME/.copilot-session-tools/copilot_chats.db" `
285300
"SELECT session_id, workspace_name, created_at FROM sessions WHERE workspace_name LIKE '%zts%' ORDER BY created_at DESC LIMIT 20"
286301
287302
# Count messages per session (find long conversations)
288-
sqlite3 "C:\_SRC\copilot-session-tools\copilot_chats.db" `
303+
sqlite3 "$HOME/.copilot-session-tools/copilot_chats.db" `
289304
"SELECT s.session_id, s.workspace_name, COUNT(m.id) as msg_count FROM sessions s JOIN messages m ON s.session_id = m.session_id GROUP BY s.session_id ORDER BY msg_count DESC LIMIT 20"
290305
291306
# Find sessions with tool invocations of a specific tool
292-
sqlite3 "C:\_SRC\copilot-session-tools\copilot_chats.db" `
307+
sqlite3 "$HOME/.copilot-session-tools/copilot_chats.db" `
293308
"SELECT DISTINCT s.session_id, s.workspace_name, s.created_at FROM sessions s JOIN messages m ON s.session_id = m.session_id JOIN tool_invocations ti ON m.id = ti.message_id WHERE ti.name LIKE '%build%' ORDER BY s.created_at DESC LIMIT 20"
294309
295310
# Find file changes by path pattern
296-
sqlite3 "C:\_SRC\copilot-session-tools\copilot_chats.db" `
311+
sqlite3 "$HOME/.copilot-session-tools/copilot_chats.db" `
297312
"SELECT DISTINCT s.session_id, s.workspace_name, fc.path FROM sessions s JOIN messages m ON s.session_id = m.session_id JOIN file_changes fc ON m.id = fc.message_id WHERE fc.path LIKE '%Dockerfile%' ORDER BY s.created_at DESC LIMIT 20"
298313
299314
# Find command runs
300-
sqlite3 "C:\_SRC\copilot-session-tools\copilot_chats.db" `
315+
sqlite3 "$HOME/.copilot-session-tools/copilot_chats.db" `
301316
"SELECT s.session_id, cr.command, cr.status FROM sessions s JOIN messages m ON s.session_id = m.session_id JOIN command_runs cr ON m.id = cr.message_id WHERE cr.command LIKE '%az pipelines%' ORDER BY cr.timestamp DESC LIMIT 20"
302317
```
303318

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
permissions:
1010
contents: write
11+
actions: write
1112

1213
jobs:
1314
lint:
@@ -155,3 +156,11 @@ jobs:
155156
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
156157
git push origin "v${{ steps.version.outputs.version }}"
157158
echo "🏷️ Created and pushed tag v${{ steps.version.outputs.version }}"
159+
160+
- name: Trigger release workflow
161+
if: steps.check_tag.outputs.exists == 'false'
162+
env:
163+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164+
run: |
165+
gh workflow run release.yml --field tag="v${{ steps.version.outputs.version }}"
166+
echo "🚀 Triggered release workflow for v${{ steps.version.outputs.version }}"

.github/workflows/release.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,29 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to release (e.g. v0.1.2)'
11+
required: true
12+
type: string
713

814
permissions:
915
contents: write
1016
id-token: write
1117

18+
env:
19+
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
20+
1221
jobs:
1322
lint:
1423
name: Lint & Type Check
1524
runs-on: ubuntu-latest
1625
steps:
1726
- name: Checkout code
1827
uses: actions/checkout@v4
28+
with:
29+
ref: ${{ env.RELEASE_TAG }}
1930

2031
- name: Install uv
2132
uses: astral-sh/setup-uv@v4
@@ -43,6 +54,8 @@ jobs:
4354
steps:
4455
- name: Checkout code
4556
uses: actions/checkout@v4
57+
with:
58+
ref: ${{ env.RELEASE_TAG }}
4659

4760
- name: Install uv
4861
uses: astral-sh/setup-uv@v4
@@ -65,6 +78,8 @@ jobs:
6578
steps:
6679
- name: Checkout code
6780
uses: actions/checkout@v4
81+
with:
82+
ref: ${{ env.RELEASE_TAG }}
6883

6984
- name: Install uv
7085
uses: astral-sh/setup-uv@v4
@@ -76,7 +91,7 @@ jobs:
7691

7792
- name: Verify tag matches package version
7893
run: |
79-
TAG_VERSION=${GITHUB_REF#refs/tags/v}
94+
TAG_VERSION=${RELEASE_TAG#v}
8095
PKG_VERSION=$(grep '^version = ' pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
8196
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
8297
echo "::error::Tag version ($TAG_VERSION) does not match package version ($PKG_VERSION)"
@@ -122,7 +137,7 @@ jobs:
122137

123138
- name: Install from TestPyPI
124139
run: |
125-
TAG_VERSION=${GITHUB_REF_NAME#v}
140+
TAG_VERSION=${RELEASE_TAG#v}
126141
for i in 1 2 3 4 5; do
127142
echo "Attempt $i: installing copilot-session-tools==${TAG_VERSION} from TestPyPI..."
128143
pip install --index-url https://test.pypi.org/simple/ \
@@ -137,7 +152,7 @@ jobs:
137152

138153
- name: Verify version matches tag
139154
run: |
140-
TAG_VERSION=${GITHUB_REF_NAME#v}
155+
TAG_VERSION=${RELEASE_TAG#v}
141156
python -c "from copilot_session_tools import __version__; tag='${TAG_VERSION}'; assert __version__ == tag, f'{__version__} != {tag}'"
142157
143158
- name: Verify CLI works
@@ -168,10 +183,13 @@ jobs:
168183
steps:
169184
- name: Checkout code
170185
uses: actions/checkout@v4
186+
with:
187+
ref: ${{ env.RELEASE_TAG }}
171188

172189
- name: Create GitHub Release
173190
uses: softprops/action-gh-release@v2
174191
with:
192+
tag_name: ${{ env.RELEASE_TAG }}
175193
generate_release_notes: true
176194
draft: false
177195
prerelease: false

RELEASE.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,20 @@ git push origin <branch>
6868
# Create PR targeting main
6969
```
7070

71-
CI enforces that every PR bumps the version. Once approved and merged:
71+
CI enforces that PRs bump the version when package-affecting files change
72+
(`src/`, `pyproject.toml`, `README.md`, `LICENSE`, `CHANGELOG.md`).
73+
PRs that only change tests, CI config, docs, or skills skip the version check.
74+
Once approved and merged:
7275

7376
### 4. What Happens Automatically
7477

7578
1. **CI runs** — Lint, type check, and tests on Ubuntu + Windows
7679
2. **Auto-tag** — CI reads the version from `pyproject.toml` and creates git tag `vX.Y.Z`
77-
3. **Release pipeline triggers**The tag triggers `release.yml`:
80+
3. **Release pipeline triggers**CI dispatches `release.yml` via `workflow_dispatch`:
7881
- Lint & test (release validation)
7982
- Build wheel + sdist
8083
- Publish to TestPyPI
84+
- **Smoke test** — Installs from TestPyPI and verifies import, version, and CLI
8185
- Publish to PyPI
8286
- Create GitHub Release with auto-generated notes
8387

@@ -102,7 +106,7 @@ This project follows [Semantic Versioning](https://semver.org/):
102106
- **MINOR** (0.X.0): New features, backward-compatible
103107
- **PATCH** (0.0.X): Bug fixes, backward-compatible
104108

105-
The CI enforces that every PR to `main` must bump the version.
109+
The CI enforces that PRs to `main` must bump the version when package-affecting files change.
106110

107111
## Troubleshooting
108112

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "uv_build"
44

55
[project]
66
name = "copilot-session-tools"
7-
version = "0.1.2"
7+
version = "0.1.3"
88
description = "A collection of tools for VS Code GitHub Copilot chat history"
99
readme = "README.md"
1010
requires-python = ">=3.12"

src/copilot_session_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- tad-hq/universal-session-viewer: FTS5 full-text search design
1313
"""
1414

15-
__version__ = "0.1.2"
15+
__version__ = "0.1.3"
1616

1717
from .database import Database, ParsedQuery, parse_search_query
1818
from .html_exporter import (

0 commit comments

Comments
 (0)