Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
443b5b2
feat: implement lru cache and sophisticated token counting (issues #4…
ooples Nov 3, 2025
69a3555
fix: address all pr review comments
ooples Nov 3, 2025
0e506ac
fix: address all pr review comments
ooples Nov 3, 2025
0c11a46
refactor(dispatcher): use write-verbose for logging
ooples Nov 3, 2025
d3172df
refactor(logging): create shared logging module
ooples Nov 3, 2025
0428d1c
refactor(logging): replace write-host with write-log
ooples Nov 3, 2025
d04cf6a
refactor(error-handling): use centralized error handling function
ooples Nov 3, 2025
cd051af
feat(optimization): store optimization results in a database
ooples Nov 5, 2025
2525110
feat(optimization): implement compression for stored optimization res…
ooples Nov 5, 2025
6bb07b6
Merge remote-tracking branch 'origin/master' into feat/sophisticated-…
ooples Apr 20, 2026
90d946e
fix: align optimization-storage with project patterns (better-sqlite3…
ooples Apr 20, 2026
1dba76f
feat(utils): add generic lrucache with ttl and stats (#125)
ooples Apr 20, 2026
c3b6e3f
feat(tokenizers): add pluggable tokenizer framework (#124)
ooples Apr 20, 2026
35f888e
feat(config): add optimization settings with zod validation (#120)
ooples Apr 20, 2026
16305fc
feat(session): add session + context-delta + chat compression (#121, …
ooples Apr 20, 2026
bfe8278
test: add unit tests for lrucache, tokenizers, diff, session, configm…
ooples Apr 20, 2026
8b7e481
fix(core): production hardening for session, delta, storage, tokenize…
ooples Apr 20, 2026
4e3f119
feat(tokenizers): refactor tokencounter to delegate via tokenizerfact…
ooples Apr 20, 2026
2a1cab1
feat(config): cachesettings + chatcompression + default file + wiring…
ooples Apr 20, 2026
1392ee1
feat(cache): lru memoize smart-read / smart-grep / smart-glob (#125)
ooples Apr 20, 2026
abbc648
feat(summarization): foundation-model isummarizer implementations (#121)
ooples Apr 20, 2026
a78d196
feat(storage): gzip session persistence + shared gzip utilities (#126)
ooples Apr 20, 2026
fd0a0b2
feat(powershell): config / gzip / context-delta helpers (#120, #122, …
ooples Apr 20, 2026
778d01a
fix: resolve coderabbit review comments on pr #163
ooples Apr 20, 2026
4c0fc79
fix(compression): restore strict decompress + move legacy fallback to…
ooples Apr 20, 2026
b040513
ci(security): audit prod deps only + pin brace-expansion / picomatch
ooples Apr 20, 2026
7374f3e
fix: resolve 21 new coderabbit comments on pr #163
ooples Apr 20, 2026
9e02c48
ci(security): drop risky overrides, add informational full-tree audit
ooples Apr 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions .github/workflows/quality-gates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,38 +129,57 @@ jobs:
- name: Run npm audit
id: audit
run: |
npm audit --json > audit-results.json || true
# Gating audit — prod deps only. Dev deps (e.g. @semantic-release/npm,
# which bundles its own node_modules/npm) can carry unfixable
# transitive vulnerabilities that never ship to end users, and
# failing CI on those is noise. The "Dependency Vulnerability Scan"
# step below still covers the full tree for visibility.
npm audit --omit=dev --json > audit-results.json || true

# Informational audit — full tree, including dev deps. Always
# collected so teams can review non-gating findings even on
# forks/repos without a SNYK_TOKEN.
npm audit --json > audit-results-full.json || true

# Check for high/critical vulnerabilities using Python for reliable JSON parsing
HIGH_VULNS=$(python3 -c "import json; data = json.load(open('audit-results.json')); print(data.get('metadata', {}).get('vulnerabilities', {}).get('high', 0))")
CRITICAL_VULNS=$(python3 -c "import json; data = json.load(open('audit-results.json')); print(data.get('metadata', {}).get('vulnerabilities', {}).get('critical', 0))")
FULL_CRITICAL=$(python3 -c "import json; data = json.load(open('audit-results-full.json')); print(data.get('metadata', {}).get('vulnerabilities', {}).get('critical', 0))")
FULL_HIGH=$(python3 -c "import json; data = json.load(open('audit-results-full.json')); print(data.get('metadata', {}).get('vulnerabilities', {}).get('high', 0))")

# Ensure we have valid integers
HIGH_VULNS=${HIGH_VULNS:-0}
CRITICAL_VULNS=${CRITICAL_VULNS:-0}
FULL_CRITICAL=${FULL_CRITICAL:-0}
FULL_HIGH=${FULL_HIGH:-0}

echo "high_vulnerabilities=$HIGH_VULNS" >> $GITHUB_OUTPUT
echo "critical_vulnerabilities=$CRITICAL_VULNS" >> $GITHUB_OUTPUT

echo "Found $CRITICAL_VULNS critical and $HIGH_VULNS high severity vulnerabilities"
echo "Production: $CRITICAL_VULNS critical, $HIGH_VULNS high"
echo "Full tree: $FULL_CRITICAL critical, $FULL_HIGH high (informational)"

if [ "$CRITICAL_VULNS" -gt 0 ] 2>/dev/null; then
echo "Error: Found $CRITICAL_VULNS critical vulnerabilities"
npm audit
echo "Error: Found $CRITICAL_VULNS critical vulnerabilities in production deps"
npm audit --omit=dev || true
exit 1
fi

if [ "$HIGH_VULNS" -gt 0 ] 2>/dev/null; then
echo "Warning: Found $HIGH_VULNS high vulnerabilities"
npm audit
echo "Warning: Found $HIGH_VULNS high vulnerabilities in production deps"
# npm audit exits non-zero when vulns exist — don't let that
# turn a "warning" into a failed step.
npm audit --omit=dev || true
fi

- name: Upload audit results
if: always()
uses: actions/upload-artifact@v4
with:
name: security-audit-${{ github.sha }}
path: audit-results.json
path: |
audit-results.json
audit-results-full.json
retention-days: 30

- name: Comment PR with security audit
Expand Down
20 changes: 16 additions & 4 deletions hooks/dispatcher.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,30 @@
# Minimal dispatcher focused on token optimization via MCP
# Replaces 400+ line mess with clean architecture

[CmdletBinding()]
param([string]$Phase = "")

$HANDLERS_DIR = "C:\Users\cheat\.claude-global\hooks\handlers"
$LOG_FILE = "C:\Users\cheat\.claude-global\hooks\logs\dispatcher.log"
$ORCHESTRATOR = "$HANDLERS_DIR\token-optimizer-orchestrator.ps1"

function Write-Log {
param([string]$Message)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
"[$timestamp] [$Phase] $Message" | Out-File -FilePath $LOG_FILE -Append -Encoding UTF8
# Load the shared logging helper defensively: a missing/malformed helper
# must not kill the dispatcher for every hook phase. Fall back to a
# minimal Write-Log shim so the rest of the script still runs.
$loggingHelperPath = "$PSScriptRoot\helpers\logging.ps1"
try {
if (Test-Path $loggingHelperPath) {
. $loggingHelperPath
} else {
throw "logging helper not found at $loggingHelperPath"
}
} catch {
function Write-Log { param([string]$Message, [string]$Level = 'INFO') $null = $Message; $null = $Level }
function Handle-Error { param($Exception, [string]$Message) $null = $Exception; $null = $Message }
}



function Block-Tool {
param([string]$Reason)

Expand Down
Loading
Loading