Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 20 additions & 19 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
version: 2
updates:
# Enable version updates for npm
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
target-branch: 'dev'
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "Europe/Oslo"
interval: 'weekly'
day: 'monday'
time: '09:00'
timezone: 'Europe/Oslo'
# Limit number of open PRs
open-pull-requests-limit: 10
# Group minor and patch updates
groups:
development-dependencies:
dependency-type: "development"
dependency-type: 'development'
update-types:
- "minor"
- "patch"
- 'minor'
- 'patch'
production-dependencies:
dependency-type: "production"
dependency-type: 'production'
update-types:
- "minor"
- "patch"
- 'minor'
- 'patch'
# Auto-approve and merge patch updates for dev dependencies
# (Requires GitHub Actions workflow with dependabot-auto-merge)
labels:
- "dependencies"
- "automated"
- 'dependencies'
- 'automated'
# Ignore major version bumps for these (manual review required)
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
- dependency-name: '*'
update-types: ['version-update:semver-major']
# Rebase strategy (cleaner history)
rebase-strategy: "auto"
rebase-strategy: 'auto'
# Commit message prefix for semantic versioning
commit-message:
prefix: "chore"
include: "scope"
prefix: 'chore'
include: 'scope'
42 changes: 41 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:
cache: 'npm'

- name: Install dependencies
env:
ZEROSHOT_TUI_BINARY_SKIP: '1'
run: npm ci

- name: Security audit
Expand All @@ -75,6 +77,12 @@ jobs:
- name: Type check
run: npm run typecheck

- name: Type check (tui-backend)
run: npm run typecheck:tui-backend

- name: Build tui-backend
run: npm run build:tui-backend

- name: Unit tests with coverage (fast)
run: npm run test:coverage
timeout-minutes: 3
Expand All @@ -83,6 +91,36 @@ jobs:
run: npm run test:slow
timeout-minutes: 15

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- name: Cache cargo registry + build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
tui-rs/target
key: rust-${{ runner.os }}-${{ hashFiles('tui-rs/Cargo.lock') }}
restore-keys: rust-${{ runner.os }}-

- name: Rust fmt
run: cargo fmt --manifest-path tui-rs/Cargo.toml --all -- --check

- name: Rust build
run: cargo build --release --manifest-path tui-rs/Cargo.toml

- name: Rust test
run: cargo test --manifest-path tui-rs/Cargo.toml

- name: Rust clippy
run: cargo clippy --manifest-path tui-rs/Cargo.toml -- -D warnings

- name: Smoke test Rust TUI binary
run: ./tui-rs/target/release/zeroshot-tui --version

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
Expand All @@ -100,7 +138,7 @@ jobs:
if: |
github.ref == 'refs/heads/main' ||
(github.event_name == 'pull_request' && github.base_ref == 'main') ||
(github.event_name == 'merge_group' && github.event.merge_group.base_ref == 'refs/heads/main')
github.event_name == 'merge_group'
strategy:
fail-fast: false
matrix:
Expand All @@ -122,6 +160,8 @@ jobs:
cache: 'npm'

- name: Install dependencies
env:
ZEROSHOT_TUI_BINARY_SKIP: '1'
run: npm ci

- name: Link CLI
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "CodeQL Security Analysis"
name: 'CodeQL Security Analysis'

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
schedule:
# Run at 3 AM UTC every Monday
- cron: '0 3 * * 1'
Expand Down Expand Up @@ -56,4 +56,4 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:javascript"
category: '/language:javascript'
90 changes: 87 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
# Auto-release after CI passes on main
workflow_run:
workflows: ["CI"]
workflows: ['CI']
types: [completed]
branches: [main]
# Manual trigger for DRY-RUN ONLY (testing release process)
Expand Down Expand Up @@ -50,6 +50,8 @@ jobs:
cache: 'npm'

- name: Install dependencies
env:
ZEROSHOT_TUI_BINARY_SKIP: '1'
run: npm ci

- name: Link CLI
Expand Down Expand Up @@ -107,8 +109,72 @@ jobs:
console.log('✓ StatusFooter test passed');
"

tui-binary-matrix:
if: |
(github.event_name == 'workflow_dispatch' && inputs.dry_run == true) ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
arch: x64
target: x86_64-unknown-linux-gnu
- os: ubuntu-24.04-arm64
platform: linux
arch: arm64
target: aarch64-unknown-linux-gnu
- os: macos-13
platform: darwin
arch: x64
target: x86_64-apple-darwin
- os: macos-14
platform: darwin
arch: arm64
target: aarch64-apple-darwin

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Build zeroshot-tui
run: |
cargo build --release -p zeroshot-tui --target ${{ matrix.target }} --manifest-path tui-rs/Cargo.toml

- name: Smoke test binary
run: |
BIN_PATH="tui-rs/target/${{ matrix.target }}/release/zeroshot-tui"
"$BIN_PATH" --version
"$BIN_PATH" --smoke-test

- name: Package release asset
run: |
BIN_DIR="tui-rs/target/${{ matrix.target }}/release"
ASSET="zeroshot-tui-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz"
tar -czf "$ASSET" -C "$BIN_DIR" zeroshot-tui
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "$ASSET" > "$ASSET.sha256"
else
shasum -a 256 "$ASSET" > "$ASSET.sha256"
fi

- name: Upload TUI binary artifact
uses: actions/upload-artifact@v4
with:
name: tui-binary-${{ matrix.platform }}-${{ matrix.arch }}
path: |
zeroshot-tui-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz
zeroshot-tui-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz.sha256

release:
needs: [install-matrix]
needs: [install-matrix, tui-binary-matrix]
# SAFETY: Only run if CI passed OR manual dry-run
# Real releases MUST go through CI (workflow_run with success)
# Manual trigger MUST be dry-run only (cannot publish untested code)
Expand Down Expand Up @@ -137,8 +203,23 @@ jobs:
cache: 'npm'

- name: Install dependencies
env:
ZEROSHOT_TUI_BINARY_SKIP: '1'
run: npm ci

- name: Download TUI binaries
uses: actions/download-artifact@v4
with:
pattern: tui-binary-*
path: dist/tui
merge-multiple: true

- name: Prepare TUI binary for install validation
run: |
ls -la dist/tui
tar -xzf dist/tui/zeroshot-tui-linux-x64.tar.gz -C dist/tui
chmod +x dist/tui/zeroshot-tui

- name: Verify package before release
run: |
# Create tarball (respects 'files' array in package.json)
Expand All @@ -147,13 +228,16 @@ jobs:
echo "Created: $TARBALL"

# Install from tarball (simulates npm install -g @covibes/zeroshot)
npm install -g "./$TARBALL"
ZEROSHOT_TUI_BINARY_PATH="$PWD/dist/tui/zeroshot-tui" npm install -g "./$TARBALL"

# Smoke tests - must all pass
echo "=== Testing installed package ==="
zeroshot --version
zeroshot --help
zeroshot list
INSTALLED_ROOT="$(npm root -g)/@covibes/zeroshot"
test -x "$INSTALLED_ROOT/libexec/zeroshot-tui"
"$INSTALLED_ROOT/libexec/zeroshot-tui" --version

# Cleanup
npm uninstall -g @covibes/zeroshot
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ dist/
build/
*.tsbuildinfo

# Rust build output
tui-rs/target/

# Environment
.env
.env.local
Expand Down Expand Up @@ -40,7 +43,8 @@ tmp/
*.tmp

# Zeroshot runtime
.zeroshot/
.zeroshot/*
!.zeroshot/settings.json
.claude-zeroshots/
zeroshot-isolated/
zeroshot-cluster-configs/
Expand All @@ -56,3 +60,4 @@ report/
# Generated/temp files
test-metadata-manual.sh
test-isolated-fix.js
lib/tui-backend/
9 changes: 9 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ if [ -n "$BAD_FILES" ]; then
exit 1
fi

# Enforce Rust formatting when Rust files are staged
if git diff --cached --name-only -- '*.rs' | grep -q .; then
if ! command -v rustfmt >/dev/null 2>&1; then
echo "ERROR: rustfmt is required to format Rust (install Rust toolchain)."
exit 1
fi
git diff --cached --name-only -z -- '*.rs' | xargs -0 rustfmt --edition 2021 --check
fi

# Lint and format only staged files
npx lint-staged

Expand Down
16 changes: 16 additions & 0 deletions .mocharc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const hasCliTestFile = process.argv
.slice(2)
.some((arg) => typeof arg === 'string' && /\.test\.[jt]s$/.test(arg));

const config = {
parallel: true,
jobs: 4,
timeout: 10000,
slow: 1000,
};

if (!hasCliTestFile) {
config.spec = 'tests/**/*.test.js';
}

module.exports = config;
7 changes: 0 additions & 7 deletions .mocharc.json

This file was deleted.

7 changes: 6 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"npmPublish": true
}
],
"@semantic-release/github"
[
"@semantic-release/github",
{
"assets": ["dist/tui/zeroshot-tui-*.tar.gz", "dist/tui/zeroshot-tui-*.tar.gz.sha256"]
}
]
]
}
8 changes: 8 additions & 0 deletions .zeroshot/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"github": {
"prBase": "dev"
},
"worktree": {
"baseRef": "origin/dev"
}
}
Loading