Skip to content

Commit 8f76c65

Browse files
authored
feat: release semantic-release workflow
Promote the validated release branch to main and trigger protected semantic-release publishing.
2 parents 115dfa2 + 522c503 commit 8f76c65

67 files changed

Lines changed: 3860 additions & 301 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Validation
44

5+
- [ ] `pnpm validate`
6+
- [ ] `pnpm audit:security`
57
- [ ] `pnpm check`
68
- [ ] `pnpm test`
79
- [ ] `pnpm build`

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
branches: [main, develop]
66
push:
7-
branches: [main, develop, "feature/**"]
7+
branches: [main, develop, "feature/**", "release/**", "hotfix/**"]
88
merge_group:
99

1010
permissions:
@@ -35,6 +35,9 @@ jobs:
3535
- name: Install dependencies
3636
run: pnpm install --frozen-lockfile
3737

38+
- name: Security dependency audit
39+
run: pnpm audit:security
40+
3841
- name: Lint and format check
3942
run: pnpm lint
4043

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CodeQL
33
on:
44
pull_request:
55
push:
6-
branches: [main]
6+
branches: [main, develop, "release/**", "hotfix/**"]
77
schedule:
88
- cron: "27 4 * * 1"
99

.github/workflows/npm-publish.yml

Lines changed: 22 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
name: Publish npm
1+
name: Release npm
22

33
on:
4+
push:
5+
branches: [main]
46
workflow_dispatch:
5-
inputs:
6-
version:
7-
description: "Version already committed in package.json"
8-
required: true
9-
type: string
107

118
permissions:
12-
actions: read
13-
contents: read
9+
contents: write
10+
issues: write
1411
id-token: write
12+
pull-requests: write
13+
14+
concurrency:
15+
group: release-npm-${{ github.ref }}
16+
cancel-in-progress: false
1517

1618
jobs:
17-
publish:
18-
name: Publish to npm
19+
release:
20+
name: Semantic release
1921
runs-on: ubuntu-latest
2022
environment:
2123
name: npm-publish
@@ -24,15 +26,10 @@ jobs:
2426
- name: Verify main branch
2527
run: test "${GITHUB_REF}" = "refs/heads/main"
2628

27-
- name: Verify CI passed for this commit
28-
env:
29-
GH_TOKEN: ${{ github.token }}
30-
run: |
31-
conclusion="$(gh run list --repo jcode-works/jcode-mimir --workflow ci.yml --branch main --commit "$GITHUB_SHA" --json conclusion --jq '.[0].conclusion')"
32-
test "$conclusion" = "success"
33-
3429
- name: Checkout
3530
uses: actions/checkout@v6
31+
with:
32+
fetch-depth: 0
3633

3734
- name: Set up Node
3835
uses: actions/setup-node@v4
@@ -45,50 +42,20 @@ jobs:
4542
corepack enable
4643
corepack prepare pnpm@11.9.0 --activate
4744
48-
- name: Verify version input
49-
run: |
50-
test "$(node -p "require('./packages/mimir-core/package.json').version")" = "${{ inputs.version }}"
51-
test "$(node -p "require('./packages/mimir-tts/package.json').version")" = "${{ inputs.version }}"
52-
5345
- name: Install dependencies
5446
run: pnpm install --frozen-lockfile
5547

56-
- name: Lint and format check
57-
run: pnpm lint
58-
59-
- name: Typecheck
60-
run: pnpm check
61-
62-
- name: Test
63-
run: pnpm test
64-
65-
- name: Build
66-
run: pnpm build
67-
68-
- name: Smoke test production CLI and MCP
69-
run: pnpm smoke
48+
- name: Validate release gate
49+
run: pnpm validate
7050

71-
- name: Verify generated dist is committed
72-
run: git diff --exit-code -- packages/mimir-core/dist packages/mimir-tts/dist
73-
74-
- name: Verify npm package metadata
75-
run: pnpm package:check
76-
77-
- name: Generate release verification artifacts
78-
run: pnpm release:artifacts
51+
- name: Semantic release
52+
run: pnpm exec semantic-release
53+
env:
54+
GITHUB_TOKEN: ${{ github.token }}
55+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7956

8057
- name: Upload release verification artifacts
8158
uses: actions/upload-artifact@v4
8259
with:
83-
name: mimir-release-${{ inputs.version }}
60+
name: mimir-release-${{ github.sha }}
8461
path: release-artifacts/
85-
86-
- name: Publish Mimir TTS
87-
run: pnpm --dir packages/mimir-tts publish --access public --provenance --no-git-checks
88-
env:
89-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
90-
91-
- name: Publish Mimir
92-
run: pnpm --dir packages/mimir-core publish --access public --provenance --no-git-checks
93-
env:
94-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

AGENTS.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@
151151
package/user testing only; never place real confidential documents there.
152152
- Use Context7 before changing dependencies or public APIs that rely on external libraries.
153153
- Run `pnpm validate` before opening a release pull request or publishing. It covers
154-
Biome, TypeScript, Vitest, build output, production CLI/MCP smoke tests, and npm package
155-
metadata.
154+
Biome, dependency security audit, TypeScript, Vitest, build output, production CLI/MCP smoke
155+
tests, npm package metadata, semantic-release wiring, and release artifacts.
156156
- Do not publish from a local machine or direct push to `main`. npm releases must go through
157-
the protected manual `Publish npm` GitHub Actions workflow after `main` has green CI. The workflow
158-
publishes `@jcode.labs/mimir-tts` first, then `@jcode.labs/mimir`.
157+
the protected `Release npm` GitHub Actions workflow on `main`; semantic-release derives the
158+
version from Conventional Commits, prepares both package tarballs, publishes
159+
`@jcode.labs/mimir-tts` first, then publishes `@jcode.labs/mimir`.
159160
- Use Git Flow locally: `main` is production, `develop` is integration, feature work starts from
160161
`develop` under `feature/*`. Do not deploy or publish from feature branches.
161162

@@ -201,8 +202,9 @@ General principles (KISS, DRY, YAGNI, SOLID) as applied in this codebase. Match
201202
local LanceDB table. Normal ingest is incremental and reuses rows whose checksum/provider/model
202203
still match; `--rebuild` forces a full re-index.
203204
- `packages/mimir-core/src/parsing.ts` uses proven parsers for high-risk Office formats:
204-
Mammoth for `.docx` and SheetJS for `.xlsx`. Keep the lightweight XML ZIP parser for
205-
`.pptx`, OpenDocument, and EPUB unless tests show fidelity gaps.
205+
Mammoth for `.docx` and read-excel-file for `.xlsx`. Keep the lightweight XML ZIP parser for
206+
`.pptx`, OpenDocument, and EPUB unless tests show fidelity gaps. Legacy `.xls` workbooks are not
207+
supported by default; convert them to `.xlsx`, CSV, PDF, HTML, or text before ingesting.
206208
- `packages/mimir-core/src/query.ts` performs hybrid retrieval (vector candidates plus bounded lexical
207209
BM25 scoring) and returns cited retrieval context; LLM synthesis belongs outside Mimir core.
208210
- `packages/mimir-core/src/mcp.ts` exposes Mimir as an MCP stdio server for agents.
@@ -250,7 +252,7 @@ General principles (KISS, DRY, YAGNI, SOLID) as applied in this codebase. Match
250252
<!-- gitnexus:start -->
251253
# GitNexus — Code Intelligence
252254

253-
This project is indexed by GitNexus as **jcode-mimir** (2537 symbols, 4246 relationships, 216 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
255+
This project is indexed by GitNexus as **jcode-mimir** (2559 symbols, 4274 relationships, 218 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
254256

255257
> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.
256258

CLAUDE.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ pnpm lint:fix # Biome auto-fix
1818
pnpm format # Biome format --write
1919
pnpm test # vitest run for packages/mimir-tts, then packages/mimir-core
2020
pnpm smoke # build production CLI + MCP smoke test (scripts/smoke.mjs)
21-
pnpm validate # full release gate: lint + check + test + build + smoke + package:check + release:artifacts
21+
pnpm audit:security # dependency security audit at moderate severity and above
22+
pnpm release:semantic:smoke # checks semantic-release config and monorepo publish scripts without publishing
23+
pnpm validate # full release gate: lint + audit + check + test + build + smoke + package:check + semantic release smoke + release:artifacts
2224
```
2325

2426
Run a single core test file: `pnpm --filter @jcode.labs/mimir exec vitest run src/config.test.ts`
@@ -118,13 +120,13 @@ Coding conventions (KISS, DRY, YAGNI, SOLID as applied here) live in `AGENTS.md`
118120
semicolons as-needed, trailing commas all.
119121
- Conventional Commits are enforced by commitlint in CI.
120122

121-
Release policy (no local publish, no direct push to `main`, protected `Publish npm` workflow) lives
122-
in `AGENTS.md`. The workflow publishes `@jcode.labs/mimir-tts` before `@jcode.labs/mimir`.
123+
Release policy (no local publish, no direct push to `main`, protected semantic-release workflow)
124+
lives in `AGENTS.md`. The workflow publishes `@jcode.labs/mimir-tts` before `@jcode.labs/mimir`.
123125

124126
<!-- gitnexus:start -->
125127
# GitNexus — Code Intelligence
126128

127-
This project is indexed by GitNexus as **jcode-mimir** (2537 symbols, 4246 relationships, 216 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
129+
This project is indexed by GitNexus as **jcode-mimir** (2559 symbols, 4274 relationships, 218 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
128130

129131
> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.
130132

CONTRIBUTING.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,30 @@ pnpm install
1111
pnpm validate
1212
```
1313

14-
`pnpm validate` runs Biome, TypeScript, Vitest, the production CLI/MCP smoke test, and npm
15-
package metadata checks.
14+
`pnpm validate` runs Biome, a dependency security audit, TypeScript, Vitest, the production CLI/MCP
15+
smoke test, and npm package metadata checks.
16+
17+
Run the security audit alone with:
18+
19+
```bash
20+
pnpm audit:security
21+
```
1622

1723
## Pull Requests
1824

19-
- Open pull requests against `main`.
25+
- Branch from `develop` for normal feature work, using `feature/<short-name>`.
26+
- Open feature pull requests against `develop`.
27+
- Use `release/<version-or-topic>` branches from `develop` when preparing a production release, then
28+
open the release pull request against `main`.
29+
- Use `hotfix/<short-name>` branches from `main` for urgent production fixes, then back-merge the fix
30+
into `develop`.
2031
- Keep changes focused and include tests or smoke coverage for behavior changes.
2132
- Do not commit private documents, generated vector stores, generated `.mimir/` state, environment
2233
files, tokens, credentials, customer ledgers, pricing tests, or interview notes.
2334
- Use conventional commit messages such as `feat: add source parser` or
2435
`fix: handle empty index`.
36+
- Non-release branches run CI only. npm publishing is restricted to the protected semantic-release
37+
workflow from `main`; versions are derived from Conventional Commits, not manual package bumps.
2538

2639
## Security
2740

README.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ spread across repositories, specifications, exports, and synced folders.
3232
| Work from a downloaded Google Drive folder | Point Mimir at files synced locally through Google Drive for desktop, then let the agent retrieve context without uploading the corpus to a hosted RAG service. |
3333
| Onboard to a legacy codebase | Ask where a flow is implemented, which modules own a responsibility, which docs explain a behavior, and what to read before changing risky code. |
3434
| Keep multiple agents on the same evidence | Install the same project skills and MCP server for Claude Code, Codex, Kimi Code CLI, OpenCode, and Cline so each tool retrieves from the same local index. |
35+
| Research before implementation | Run an audit-backed multi-query pass over specs, docs, and code references before asking an agent to plan a feature, migration, or review. |
3536
| Prepare implementation and review work | Generate cited task breakdowns, migration notes, release checklists, QA plans, and code-review context from the same local sources the team uses. |
3637
| Audit local knowledge coverage | Check which supported files were indexed, which formats were skipped, whether secrets are likely present, and whether golden queries still retrieve expected evidence. |
3738

@@ -54,7 +55,7 @@ flowchart TD
5455
5556
subgraph Mimir["Mimir Core"]
5657
Ingest["mimir ingest<br/>parse, redact, chunk"]
57-
Retrieve["mimir search / ask<br/>rank cited passages"]
58+
Retrieve["mimir search / ask / research<br/>rank cited evidence"]
5859
Audit["doctor, audit,<br/>security-audit, evaluate"]
5960
end
6061
@@ -84,6 +85,7 @@ pnpm add -D @jcode.labs/mimir
8485
pnpm exec mimir setup
8586
pnpm exec mimir install-agent --agents claude,codex,kimi,opencode,cline
8687
pnpm exec mimir doctor --fix
88+
pnpm exec mimir research "release readiness and risks" --compact
8789

8890
# Claude Code
8991
claude mcp add-json --scope local mimir "$(cat .mimir/claude-mcp-server.json)"
@@ -366,6 +368,12 @@ Return cited retrieval context for an agent or model:
366368
pnpm exec mimir ask "What evidence supports offline operation?"
367369
```
368370

371+
Run an audit-backed multi-query research pass before a broad synthesis or implementation task:
372+
373+
```bash
374+
pnpm exec mimir research "release readiness and risks" --compact
375+
```
376+
369377
Measure recall against a golden query file:
370378

371379
```bash
@@ -487,10 +495,11 @@ Start the MCP server from the repository root when a compatible agent needs tool
487495
pnpm exec mimir serve-mcp
488496
```
489497

490-
The MCP server exposes `mimir_status`, `mimir_search`, `mimir_ask`, `mimir_audit`,
491-
`mimir_evaluate`, `mimir_usage_report`, and `mimir_security_audit`. The LLM does not need to know
492-
about LanceDB or the raw file layout; it asks Mimir for ranked passages, cited context, local recall
493-
gates, or metadata-only usage summaries and uses the returned citations.
498+
The MCP server exposes `mimir_status`, `mimir_search`, `mimir_ask`, `mimir_research`,
499+
`mimir_audit`, `mimir_evaluate`, `mimir_usage_report`, and `mimir_security_audit`. The LLM does not
500+
need to know about LanceDB or the raw file layout; it asks Mimir for ranked passages, cited context,
501+
audit-backed research, local recall gates, or metadata-only usage summaries and uses the returned
502+
citations.
494503

495504
Per-agent setup details live in [`docs/agent-integration.md`](./docs/agent-integration.md).
496505

@@ -606,7 +615,8 @@ Mimir supports common text, document, data, config, log, and source-code files o
606615
- HTML: `.html`, `.htm`
607616
- EPUB: `.epub`
608617
- PDF: `.pdf`
609-
- Office/OpenDocument: `.docx`, `.pptx`, `.xls`, `.xlsx`, `.odt`, `.ods`, `.odp`
618+
- Office/OpenDocument: `.docx`, `.pptx`, `.xlsx`, `.odt`, `.ods`, `.odp`
619+
- Legacy Excel: convert `.xls` workbooks to `.xlsx`, CSV, PDF, HTML, or text before ingesting
610620
- Legacy Word: `.doc` only when an explicit local `legacyWordCommand` is configured
611621
- Rich text: `.rtf`
612622
- Notebook: `.ipynb`
@@ -740,10 +750,10 @@ Mimir ships two CLIs:
740750
- `mimir`: the main local RAG, MCP, skills, security, and audio command. `kb` remains a legacy alias for compatibility.
741751
- `mimir-tts`: the standalone text-to-speech renderer used by `mimir audio`.
742752

743-
Most users start with `mimir setup`, `mimir doctor`, `mimir ingest`, `mimir search`, `mimir ask`, and
744-
`mimir security-audit`. Use `mimir models pull --enable` before semantic offline ingestion when
745-
remote model download is acceptable, and `mimir ingest --rebuild` after switching embedding provider
746-
or model.
753+
Most users start with `mimir setup`, `mimir doctor`, `mimir ingest`, `mimir search`, `mimir ask`,
754+
`mimir research`, and `mimir security-audit`. Use `mimir models pull --enable` before semantic
755+
offline ingestion when remote model download is acceptable, and `mimir ingest --rebuild` after
756+
switching embedding provider or model.
747757

748758
The full command and option table lives in [`docs/cli-reference.md`](./docs/cli-reference.md).
749759

@@ -788,7 +798,7 @@ core features:
788798
| LanceDB | Local vector storage and nearest-neighbor retrieval. |
789799
| MCP SDK | MCP server for compatible agents. |
790800
| fast-glob | Safe source-file discovery. |
791-
| unpdf, mammoth, xlsx, html-to-text, yaml, fflate | Document parsing for PDF, Office, HTML, YAML, OpenDocument, and EPUB files. |
801+
| unpdf, mammoth, read-excel-file, html-to-text, yaml, fflate | Document parsing for PDF, Office, HTML, YAML, OpenDocument, and EPUB files. |
792802
| commander, zod, picocolors | CLI, config validation, readable terminal output. |
793803

794804
Removing more dependencies is possible only by dropping features or replacing them with smaller
@@ -851,8 +861,9 @@ pnpm validate
851861
CI checks that generated `dist/` files match the source.
852862

853863
The root package is private and only orchestrates workspace tasks. npm publishing is handled by the
854-
protected `Publish npm` GitHub Actions workflow, which publishes `@jcode.labs/mimir-tts` before
855-
`@jcode.labs/mimir`.
864+
protected `Release npm` GitHub Actions workflow on `main`. semantic-release derives the version from
865+
Conventional Commits, prepares both package tarballs, publishes `@jcode.labs/mimir-tts` first, then
866+
publishes `@jcode.labs/mimir`.
856867

857868
Build from source:
858869

docs/agent-integration.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,16 @@ MCP tools exposed:
6969
- `mimir_status`
7070
- `mimir_search`
7171
- `mimir_ask`
72+
- `mimir_research`
7273
- `mimir_audit`
7374
- `mimir_evaluate`
7475
- `mimir_usage_report`
7576
- `mimir_security_audit`
7677

7778
This MCP layer is the recommended way to let any compatible LLM or agent query the same local
7879
knowledge base. The LLM does not need to know about LanceDB or the raw file layout; it asks Mimir for
79-
ranked passages, cited context, local recall gates, or metadata-only usage summaries and uses the
80-
returned citations.
80+
ranked passages, cited context, audit-backed research reports, local recall gates, or metadata-only
81+
usage summaries and uses the returned citations.
8182

8283
## Claude Code
8384

@@ -156,9 +157,9 @@ when launching `mimir serve-mcp`.
156157
From a repository that already ran `mimir setup` and has Mimir wired into the current agent, ask:
157158

158159
```plain text
159-
Use Mimir to audit the local evidence. First run mimir_status and mimir_audit. Then search for
160-
"offline retrieval approval" and produce a cited Markdown report. Do not rely on memory if Mimir
161-
does not contain enough evidence.
160+
Use Mimir to audit the local evidence. First run mimir_status and mimir_audit. Then run
161+
mimir_research for "release readiness and risks" and produce a cited Markdown report. Do not rely on
162+
memory if Mimir does not contain enough evidence.
162163
```
163164

164165
Agents that support skill folders should also load:

0 commit comments

Comments
 (0)