diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e095e797..7050f99d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -203,9 +203,20 @@ jobs: # Insert above the previous newest entry, keeping the file's header. # Release Please owned this file before; its format is preserved so # the existing entries stay readable alongside the new ones. - first_entry=$(grep -n '^## ' CHANGELOG.md | head -n1 | cut -d: -f1 || true) + # + # An `## [Unreleased]` section, when present, stays at the top and + # the new entry goes beneath it: inserting above the first `## ` + # heading would put the release above Unreleased and leave the + # section describing work that has now shipped. Its hand-written + # body is replaced by the generated notes (which cover the same + # commits), so the heading is kept and the body dropped. + first_entry=$(grep -n '^## ' CHANGELOG.md | grep -v ':## \[Unreleased\]' | head -n1 | cut -d: -f1 || true) + unreleased=$(grep -n '^## \[Unreleased\]' CHANGELOG.md | head -n1 | cut -d: -f1 || true) if [ -n "${first_entry:-}" ]; then - head -n "$((first_entry - 1))" CHANGELOG.md > /tmp/new.md + head -n "$(( ${unreleased:-$first_entry} - 1 ))" CHANGELOG.md > /tmp/new.md + if [ -n "${unreleased:-}" ]; then + printf '## [Unreleased]\n\n' >> /tmp/new.md + fi cat /tmp/entry.md >> /tmp/new.md tail -n +"${first_entry}" CHANGELOG.md >> /tmp/new.md else diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index fad43347..74e32da8 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -7,8 +7,8 @@ boundaries between them, and what each part is allowed to trust. ## Parts -- **CLI** (`src/cli/`) — `setup`, `status`, `scan`, `calibrate`, - `disconnect`, and the internal `--hook session-start` entry point. Bare `xtctx` on a non-TTY stdio pair +- **CLI** (`src/cli/`) — `setup`, `status`, `scan`, `export`, `import`, + `calibrate`, `disconnect`, and the internal `--hook session-start` entry point. Bare `xtctx` on a non-TTY stdio pair starts the MCP server. - **MCP server** (`src/mcp/`) — stdio JSON-RPC server exposing exactly five read-only tools. Spawned by coding agents via `npx -y xtctx`. @@ -20,9 +20,16 @@ boundaries between them, and what each part is allowed to trust. (`.xtctx/state/xtctx.db`, WAL, schema-versioned) holding sessions, messages, retrieval windows, FTS index, and embedding vectors. Refreshed on demand from the scrapers and at MCP server start. Derived from the - transcripts, but not disposable: the index keeps sessions whose transcripts have since been deleted (Claude Code deletes them after 30 days by default), so for those it is the only copy. A database that will not - open (corruption, schema mismatch) is moved aside to - `xtctx.db.set-aside-