From fc990fe885abfa3118998070f900cfabe1f0d5d1 Mon Sep 17 00:00:00 2001 From: DSA Agent Date: Sun, 1 Nov 2026 08:53:58 -0500 Subject: [PATCH 1/3] =?UTF-8?q?docs:=20README=20=E2=80=94=20H1=20+=20pitch?= =?UTF-8?q?,=20CI=20badge,=20Quickstart,=20Tested-on=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an H1 and bold one-line pitch under the banner, a CI status badge for .github/workflows/ci.yml, rename 'Quick start' to 'Quickstart', and add a 'Tested on' section built only from facts already documented in INSTALL.md, package.json engines and the CI workflow. Refresh version/test-count badges and the stale '347 tests' comment to the current 3.3.0 / 866. Co-Authored-By: Claude Fable 5.1 --- README.md | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 727c367..f8d5ae5 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,15 @@ sentinel-cli — one AI coding engine, four faces, any model

-

- One AI coding engine. Four faces. Any model.
- A streaming agentic loop with real tools — terminal UI, desktop GUI, headless CLI, and MCP server — that runs against any cloud or local provider. -

+# sentinel-cli + +**One AI coding engine, four faces (TUI, desktop GUI, headless CLI, MCP server), any cloud or local model.**

MIT license - v3.2.0 - 849 tests passing + CI + v3.3.0 + 866 tests passing TypeScript ESM MCP client + server

@@ -53,7 +53,8 @@ Most "AI CLIs" are a thin wrapper around one provider's chat endpoint. **Sentine ## 📑 Table of Contents - [The four faces](#-the-four-faces) -- [Quick start](#-quick-start) +- [Quickstart](#-quickstart) +- [Tested on](#%EF%B8%8F-tested-on) - [Providers](#-providers) - [Features](#-features) - [Commands](#-commands) @@ -84,7 +85,7 @@ Build once; pick how you use it — all share the same engine, tools, and config --- -## 🚀 Quick start +## 🚀 Quickstart ```bash git clone https://github.com/dirtysouthalpha/sentinel-code.git @@ -133,6 +134,20 @@ Full install / update / uninstall details in [`INSTALL.md`](INSTALL.md). --- +## 🖥️ Tested on + +Facts only — everything below is taken from what the repo already documents ([`INSTALL.md`](INSTALL.md), [`package.json`](package.json) `engines`, [`.github/workflows/ci.yml`](.github/workflows/ci.yml)). + +| Platform | Node.js | How it's exercised | +|----------|---------|--------------------| +| Ubuntu 24.04 (GitHub Actions) | 22 | CI on every push/PR: `npm ci` → `npm run lint` → `npm test` → `npm run build` → GUI `vite build` | +| Windows (PowerShell) | ≥ 20 | `install.bat` / `install.ps1` one-click install; the bash tool runs PowerShell natively | +| macOS / Linux | ≥ 20 | `npm install && npm run build`, then `npm link` for a global `sentinel` | + +Minimum supported runtime is **Node.js 20** (`engines.node >= 20.0.0`). The native desktop window additionally needs a Rust toolchain for Tauri v2. Add your machine via PR if you've run it somewhere else. + +--- + ## 🔌 Providers Everywhere a model is referenced it's `provider/model` (split on the first `/`). The default is `zai/glm-4.6`. @@ -295,7 +310,7 @@ See [`CLAUDE.md`](CLAUDE.md) for the full code map and conventions. ```bash npm run build # tsup -> dist/ (+ copies builtins into dist/builtin) npm run lint # tsc --noEmit (type-check only — there is no ESLint) -npm test # vitest (347 tests) +npm test # vitest (866 tests) npm run dev # tsup --watch # Single test file / single test From 1af8b142aac92461a2213ded0cefc314c868cfb8 Mon Sep 17 00:00:00 2001 From: DSA Agent Date: Sun, 1 Nov 2026 08:53:58 -0500 Subject: [PATCH 2/3] test: cover ai/compression fallback and core/project-detector Two previously untested pure modules: - compression: forces the local fallback via HEADROOM_CONFIG_DIR pointing at a missing dir; checks role-merging/truncation ratios, cache hits, and stats accumulation in state. - project-detector: node/rust/python/go detection, name extraction, fallback to directory name on bad JSON, priority order, and icon fallback. Co-Authored-By: Claude Fable 5.1 --- tests/compression.test.ts | 90 ++++++++++++++++++++++++++++++++++ tests/project-detector.test.ts | 65 ++++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 tests/compression.test.ts create mode 100644 tests/project-detector.test.ts diff --git a/tests/compression.test.ts b/tests/compression.test.ts new file mode 100644 index 0000000..d4ce2c9 --- /dev/null +++ b/tests/compression.test.ts @@ -0,0 +1,90 @@ +import { describe, it, expect, beforeEach, beforeAll } from "vitest"; +import { mkdtempSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; + +// Point Headroom at an empty config dir so isHeadroomAvailable() is false and +// every call takes the deterministic local fallback path (no network). +process.env.HEADROOM_CONFIG_DIR = join(mkdtempSync(join(tmpdir(), "sentinel-headroom-")), "missing"); + +import { state } from "../src/core/state.js"; +import { + compressToolOutput, + compressMessages, + clearCompressionCache, + getCompressionStats, +} from "../src/ai/compression.js"; + +describe("compression (local fallback)", () => { + beforeAll(() => { + state.reset(); + }); + + beforeEach(() => { + state.reset(); + clearCompressionCache(); + }); + + it("returns input unchanged for an empty message list", async () => { + const result = await compressMessages([]); + expect(result).toEqual([]); + expect(getCompressionStats().originalTokens).toBe(0); + }); + + it("merges consecutive same-role messages and truncates content", async () => { + const a = "a".repeat(100); + const b = "b".repeat(100); + const c = "c".repeat(100); + const result = await compressMessages([ + { role: "user", content: a }, + { role: "user", content: b }, + { role: "assistant", content: c }, + ]); + + expect(result).toHaveLength(2); + expect(result[0].role).toBe("user"); + expect(result[1].role).toBe("assistant"); + // first message of a run keeps 70%, subsequent same-role messages keep 60% + expect(result[0].content).toBe("a".repeat(70) + " " + "b".repeat(60)); + expect(result[1].content).toBe("c".repeat(70)); + }); + + it("never grows the content and records savings in state", async () => { + const input = [{ role: "system", content: "x".repeat(350) }]; + const result = await compressMessages(input); + + expect(result[0].content.length).toBeLessThanOrEqual(input[0].content.length); + + const stats = getCompressionStats(); + expect(stats.originalTokens).toBeGreaterThan(0); + expect(stats.compressedTokens).toBeLessThan(stats.originalTokens); + expect(stats.savingsPercent).toBeGreaterThan(0); + expect(stats.savingsPercent).toBeLessThanOrEqual(100); + expect(stats.lastCompressed).toBeGreaterThan(0); + }); + + it("compressToolOutput prefixes the tool name and caches by content", async () => { + const output = "line\n".repeat(50); + const first = await compressToolOutput(output, "bash"); + expect(first.startsWith("[bash output]")).toBe(true); + + const statsAfterFirst = getCompressionStats(); + + // Same content -> cache hit -> stats must not change. + const second = await compressToolOutput(output, "bash"); + expect(second).toBe(first); + expect(getCompressionStats()).toEqual(statsAfterFirst); + + // Clearing the cache makes the next call recompute (and re-count). + clearCompressionCache(); + await compressToolOutput(output, "bash"); + expect(getCompressionStats().originalTokens).toBeGreaterThan(statsAfterFirst.originalTokens); + }); + + it("accumulates stats across multiple compressions", async () => { + await compressMessages([{ role: "user", content: "y".repeat(70) }]); + const once = getCompressionStats().originalTokens; + await compressMessages([{ role: "user", content: "z".repeat(70) }]); + expect(getCompressionStats().originalTokens).toBe(once * 2); + }); +}); diff --git a/tests/project-detector.test.ts b/tests/project-detector.test.ts new file mode 100644 index 0000000..19df3b3 --- /dev/null +++ b/tests/project-detector.test.ts @@ -0,0 +1,65 @@ +import { describe, it, expect, beforeEach, afterEach } from "vitest"; +import { mkdtempSync, writeFileSync, rmSync, mkdirSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { detectProject, getProjectIcon } from "../src/core/project-detector.js"; + +let root: string; + +beforeEach(() => { + root = mkdtempSync(join(tmpdir(), "sentinel-detect-")); +}); + +afterEach(() => { + rmSync(root, { recursive: true, force: true }); +}); + +describe("detectProject", () => { + it("returns null when no known project file exists", () => { + expect(detectProject(root)).toBeNull(); + }); + + it("detects a Node project and reads the package name", () => { + writeFileSync(join(root, "package.json"), JSON.stringify({ name: "@scope/my-app" })); + const info = detectProject(root); + expect(info).toMatchObject({ type: "node", name: "@scope/my-app", language: "TypeScript/JavaScript" }); + }); + + it("falls back to the directory name when package.json is unparsable", () => { + const dir = join(root, "fallback-name"); + mkdirSync(dir); + writeFileSync(join(dir, "package.json"), "{ not json"); + expect(detectProject(dir)?.name).toBe("fallback-name"); + }); + + it("detects Rust, Python and Go projects with their names", () => { + const rust = join(root, "rs"); + mkdirSync(rust); + writeFileSync(join(rust, "Cargo.toml"), '[package]\nname = "crabby"\nversion = "0.1.0"\n'); + expect(detectProject(rust)).toMatchObject({ type: "rust", name: "crabby", language: "Rust" }); + + const py = join(root, "py"); + mkdirSync(py); + writeFileSync(join(py, "pyproject.toml"), '[project]\nname = "snek"\n'); + expect(detectProject(py)).toMatchObject({ type: "python", name: "snek", language: "Python" }); + + const go = join(root, "go"); + mkdirSync(go); + writeFileSync(join(go, "go.mod"), "module example.com/gopher\n\ngo 1.22\n"); + expect(detectProject(go)).toMatchObject({ type: "go", name: "example.com/gopher", language: "Go" }); + }); + + it("prefers package.json when several project files are present", () => { + writeFileSync(join(root, "Cargo.toml"), 'name = "crabby"\n'); + writeFileSync(join(root, "package.json"), JSON.stringify({ name: "node-wins" })); + expect(detectProject(root)?.type).toBe("node"); + }); +}); + +describe("getProjectIcon", () => { + it("returns the folder icon for unknown projects and the project icon otherwise", () => { + expect(getProjectIcon(root)).toBe("\u{1F4C1}"); + writeFileSync(join(root, "go.mod"), "module x\n"); + expect(getProjectIcon(root)).toBe("\u{1F408}"); + }); +}); From dd41a406fd4c9b84c6e9650d70855d0029a750a6 Mon Sep 17 00:00:00 2001 From: DSA Agent Date: Sun, 1 Nov 2026 08:53:58 -0500 Subject: [PATCH 3/3] ci: pin ubuntu-24.04 + Node 22, npm ci, paths-ignore, concurrency Replace the ubuntu-latest/node-20 matrix with a single job pinned to ubuntu-24.04 on Node 22 (setup-node@v4 with npm cache covering both lock files). Use npm ci instead of npm install, skip the Puppeteer Chromium download, add paths-ignore for docs/assets, concurrency cancel-in-progress, and read-only token permissions. Co-Authored-By: Claude Fable 5.1 --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4da8f55..f4b9586 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,30 +2,39 @@ name: CI on: push: - branches: [main, master] + branches: [main] + paths-ignore: ['**.md', 'docs/**', 'assets/**', 'LICENSE', 'NOTICE', 'TRADEMARK.md', '.gitignore'] pull_request: - branches: [main, master] + paths-ignore: ['**.md', 'docs/**', 'assets/**', 'LICENSE', 'NOTICE', 'TRADEMARK.md', '.gitignore'] -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - node: [20] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read +env: + # CI never drives a real browser; skip the ~150 MB Chromium download. + PUPPETEER_SKIP_DOWNLOAD: '1' + +jobs: + test: + runs-on: ubuntu-24.04 + timeout-minutes: 15 steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node }} + node-version: 22 cache: npm + cache-dependency-path: | + package-lock.json + gui/package-lock.json - - name: Install dependencies - run: npm install + - name: Install (engine) + run: npm ci - name: Lint (tsc --noEmit) run: npm run lint @@ -36,8 +45,8 @@ jobs: - name: Build engine (tsup) run: npm run build - - name: Build GUI (vite) + - name: Install + build GUI (vite) working-directory: gui run: | - npm install + npm ci npm run build