feat: Upgrade to version 6.2.0 with major enhancements

- Updated COMMAND_SPEC.md to reflect new version and features including native CodexLens and CLI refactor.
- Revised GETTING_STARTED.md and GETTING_STARTED_CN.md for improved onboarding experience with new features.
- Enhanced INSTALL_CN.md to highlight the new CodexLens and Dashboard capabilities.
- Updated README.md and README_CN.md to showcase version 6.2.0 features and breaking changes.
- Introduced memory embedder scripts with comprehensive documentation and quick reference.
- Added test suite for memory embedder functionality to ensure reliability and correctness.
- Implemented TypeScript integration examples for memory embedder usage.
This commit is contained in:
catlog22
2025-12-20 13:16:09 +08:00
parent 6b62b5b5a9
commit 4458af83d8
16 changed files with 1245 additions and 33 deletions

View File

@@ -15,7 +15,7 @@
"ccw-mcp"
],
"env": {
"CCW_ENABLED_TOOLS": "write_file,edit_file,smart_search"
"CCW_ENABLED_TOOLS": "write_file,edit_file,smart_search,core_memory"
}
}
}

View File

@@ -5,6 +5,162 @@ All notable changes to Claude Code Workflow (CCW) will be documented in this fil
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [6.2.0] - 2025-12-20
### 🎯 Native CodexLens & Dashboard Revolution | 原生CodexLens与Dashboard革新
This major release replaces external Code Index MCP with native CodexLens, introduces multiple new Dashboard views, migrates backend to TypeScript, and implements session clustering for intelligent memory management.
本次重大版本将外部Code Index MCP替换为原生CodexLens新增多个Dashboard视图后端迁移至TypeScript并实现会话聚类智能记忆管理。
#### 🚨 Breaking Changes | 破坏性变更
**CLI Command Structure Refactor | CLI命令结构重构**
- **Changed**: `ccw cli exec --prompt "..."``ccw cli -p "..."`
- 命令行执行方式简化,所有使用旧命令的脚本需要更新
- *Ref: `8dd4a51`*
**Native CodexLens Replacement | 原生CodexLens替换**
- **Removed**: External "Code Index MCP" dependency
- **Added**: Native CCW CodexLens implementation with full local code intelligence
- 底层代码索引引擎完全替换API和数据结构不向后兼容
- *Ref: `d4499cc`, `a393601`*
**Session Clustering System | 会话聚类系统**
- **Replaced**: Knowledge Graph memory model → Session Clustering system
- 移除知识图谱记忆模型,采用更轻量高效的会话聚类系统
- *Ref: `68f9de0`*
**LLM Enhancement Removal | LLM增强功能移除**
- **Removed**: Experimental LLM-based prompt enhancement features
- 为简化系统聚焦核心能力移除实验性LLM增强功能
- *Ref: `b702791`*
#### ✨ New Features | 新功能
**Native CodexLens Platform | 原生CodexLens平台**
- 🔍 **Full-Text Search (FTS)** | 全文搜索: SQLite-based fast keyword search with symbol extraction
- 🧠 **Semantic Search** | 语义搜索: Embedding-based similarity search with vector store
- 🔀 **Hybrid Search** | 混合搜索: RRF (Reciprocal Rank Fusion) combining FTS and semantic results
-**HNSW Index** | HNSW索引: Approximate Nearest Neighbor index for significantly faster vector search
- 📊 **Search Result Grouping** | 结果分组: Automatic grouping by similarity score
- *Ref: `a393601`, `5e91ba6`, `7adde91`, `3428642`*
**Dashboard New Views | Dashboard新视图**
- 📄 **CLAUDE.md Manager** | 配置管理器: File tree viewer with metadata actions (`d91477a`)
- 🎯 **Skills Manager** | 技能管理器: View and manage Claude Code skills (`ac43cf8`)
- 🕸️ **Graph Explorer** | 图浏览器: Interactive code relationship visualization with Cytoscape.js (`894b93e`)
- 🧠 **Core Memory View** | 核心记忆视图: Session clustering visualization with cluster management (`9f6e685`)
-**Help View** | 帮助视图: Internationalization support with dynamic help content (`154a928`, `17af615`)
- 📊 **CodexLens Manager** | CodexLens管理器: Index management with real-time progress bar (`d5d6f1f`, `51a61be`)
- ⚙️ **MCP Manager** | MCP管理器: Configure and monitor MCP servers (`8b927f3`)
- 🪝 **Hook Manager** | Hook管理器: Manage Claude Code hooks configuration (`c7ced2b`)
- 💻 **CLI Manager** | CLI管理器: CLI execution history with conversation tracking (`93d3df1`)
**Session & CLI Enhancements | 会话与CLI增强**
- 🔄 **Multi-Session Resume** | 多会话恢复: Resume from last session or merge multiple sessions (`440314c`)
- 💾 **SQLite History Storage** | SQLite历史存储: Persistent CLI execution history with conversation tracking (`029384c`)
- 🆔 **Custom Execution IDs** | 自定义执行ID: Support for custom IDs and multi-turn conversations (`c780544`)
- 📋 **Task Queue Sidebar** | 任务队列侧边栏: Real-time task progress with resume functionality (`93d3df1`)
**Core Memory & Clustering | 核心记忆与聚类**
- 📊 **Session Clustering** | 会话聚类: Intelligent grouping of related sessions (`68f9de0`)
- 🎨 **Cluster Visualization** | 聚类可视化: Interactive cluster display with Cytoscape.js (`9f6e685`)
- 🔢 **Count-Based Updates** | 计数更新策略: Memory update strategy based on session count (`c7ced2b`)
- 🗑️ **Cluster Management** | 聚类管理: Delete, merge, and deduplicate cluster commands (`ea284d7`)
#### 🔄 Improvements | 改进
**Backend & Architecture | 后端与架构**
- 📘 **TypeScript Migration** | TypeScript迁移: Full backend migration from JavaScript to TypeScript | 后端代码从JavaScript完全迁移至TypeScript (`25ac862`)
- 🔌 **CCW MCP Server** | CCW MCP服务器: Native MCP server with integrated tools | 原生MCP服务器集成多种工具 (`d4e5977`)
- 📦 **Storage Manager** | 存储管理器: Centralized storage management with cleanup | 集中式存储管理与清理 (`97640a5`)
- 🗄️ **Database Migrations** | 数据库迁移: Migration framework for schema updates | 数据库模式更新迁移框架 (`0529b57`)
**Search & Indexing | 搜索与索引**
-**Batch Symbol Fetching** | 批量符号获取: Optimized FTS with batch database queries | 优化FTS批量数据库查询 (`3428642`)
- 📏 **Complete Method Blocks** | 完整方法块: FTS returns full method/function bodies | FTS返回完整方法/函数体 (`69049e3`)
- 🔧 **Embeddings Coverage** | 嵌入覆盖率: Fixed embeddings generation to achieve 100% coverage | 修复嵌入生成达到100%覆盖 (`74a8306`)
- ⏱️ **Indexing Timeout** | 索引超时: Increased to 30 minutes for large codebases | 大型代码库超时增至30分钟 (`ae07df6`)
- 📊 **Progress Bar** | 进度条: Real-time floating progress bar for indexing operations | 索引操作实时浮动进度条 (`d5d6f1f`, `b9d068d`)
**Performance | 性能优化**
-**I/O Caching** | I/O缓存: Optimized I/O operations with caching layer | 通过缓存层优化I/O操作 (`7e70e4c`)
- 🔄 **Vectorized Operations** | 向量化操作: Optimized search performance | 优化搜索性能 (`08dc0a0`)
- 🎯 **Positive Caching** | 正向缓存: Only cache positive tool availability results | 仅缓存工具可用的正向结果 (`1c9716e`)
#### 🐛 Bug Fixes | 问题修复
- **MCP Installation** | MCP安装: Resolved installation issues and enhanced path resolution | 解决安装问题并增强路径解析 (`b22839c`)
- **MCP Manager** | MCP管理器: Fixed 13 critical issues in MCP Manager panel | 修复MCP管理器面板13个关键问题 (`8b927f3`)
- **Session Location** | 会话位置: Fixed session management location inference | 修复会话管理位置推断 (`c16da75`)
- **Settings Protection** | 设置保护: Prevent settings.json fields from being overwritten by hooks | 防止settings.json字段被hook覆盖 (`8d542b8`)
- **CLI Exception Handling** | CLI异常处理: Refined exception handling with specific error types | 细化异常处理使用特定错误类型 (`ac9060a`)
- **Template Paths** | 模板路径: Corrected template paths for TypeScript build | 修正TypeScript构建的模板路径 (`335f5e9`)
- **Obsolete Cleanup** | 过时文件清理: Added cleanup of obsolete files during reinstallation | 重装时添加过时文件清理 (`48ac43d`)
#### 📝 Documentation | 文档
- **Comprehensive Workflows** | 工作流文档: Added CLI tools usage, coding philosophy, context requirements guides | 添加CLI工具使用、编码哲学、上下文要求指南 (`d06a3ca`)
- **Hooks Integration** | Hooks集成: Added hooks configuration documentation | 添加Hooks配置文档 (`9f6e685`)
- **Windows Platform** | Windows平台: Updated platform-specific documentation | 更新平台特定文档 (`2f0cce0`)
#### 🧹 Technical Debt | 技术债务清理
- **Architecture Simplification** | 架构简化: Replaced external MCP with native CodexLens | 将外部MCP替换为原生CodexLens
- **Codebase Modernization** | 代码库现代化: TypeScript migration for type safety | TypeScript迁移提升类型安全
- **Removed Redundancy** | 移除冗余: Cleaned up unused LLM enhancement code | 清理未使用的LLM增强代码
- **Test Coverage** | 测试覆盖: Added comprehensive tests for vector search, parsing, and migrations | 添加向量搜索、解析和迁移的全面测试
#### 📊 Statistics | 统计
- **Total Commits**: 90 commits (2025-12-11 to 2025-12-20)
- **Features**: 46 new features
- **Fixes**: 10 bug fixes
- **Refactors**: 7 code refactors
- **Performance**: 2 performance optimizations
#### 🔗 Migration Guide | 迁移指南
**CLI Commands**:
```bash
# Old (deprecated)
ccw cli exec --prompt "analyze code"
# New
ccw cli -p "analyze code"
# With resume
ccw cli -p "continue analysis" --resume
ccw cli -p "merge findings" --resume <id1>,<id2>
```
**CodexLens Index**:
```bash
# Initialize index (in ccw view dashboard)
# Navigate to CodexLens Manager → Click "Create Index"
# Or via MCP tool
smart_search(action="init", path=".")
```
**Session Clustering**:
```bash
# View all clusters
ccw core-memory clusters
# Auto-create clusters from sessions
ccw core-memory cluster --auto
# Merge clusters (move sessions from source clusters to target)
ccw core-memory cluster <target-id> --merge <source-id1>,<source-id2>
# Deduplicate similar clusters
ccw core-memory cluster --dedup
```
---
## [6.1.3] - 2025-12-09
### 🔧 CLI Tool Simplification

View File

@@ -2,7 +2,7 @@
This document provides a comprehensive reference for all commands available in the Claude Code Workflow (CCW) system.
> **Version 5.9.6 Update**: Enhanced review cycle with dashboards, optimized lite-plan with parallel execution, and added lite-fix workflow for intelligent bug diagnosis.
> **Version 6.2.0 Update**: Native CodexLens code intelligence (FTS + Semantic + HNSW), new Dashboard views (CLAUDE.md Manager, Skills Manager, Graph Explorer, Core Memory), CLI refactored to `ccw cli -p`, session clustering for intelligent memory, TypeScript backend migration.
## CLI Commands (`/cli:*`)

View File

@@ -1,14 +1,14 @@
# Claude Code Workflow (CCW) - Command Specification
**Version**: 5.0.0
**Updated**: 2025年10月24日星期六
**Version**: 6.2.0
**Updated**: 2025-12-20
## 1. Introduction
This document provides a detailed technical specification for every command available in the Claude Code Workflow (CCW) system. It is intended for advanced users and developers who wish to understand the inner workings of CCW, customize commands, or build new workflows.
> **Version 5.0 Changes**: Removed MCP code-index dependency, streamlined TDD workflow with conflict resolution, and refocused brainstorming on role analysis instead of synthesis documents.
> **Version 6.2.0 Changes**: Native CodexLens replaces Code Index MCP (FTS + Semantic + HNSW), CLI refactored to `ccw cli -p`, session clustering replaces knowledge graph, new Dashboard views (CLAUDE.md Manager, Skills Manager, Graph Explorer, Core Memory), TypeScript backend migration.
For a user-friendly overview, please see [COMMAND_REFERENCE.md](COMMAND_REFERENCE.md).

View File

@@ -1,11 +1,16 @@
# 🚀 Claude Code Workflow (CCW) - Getting Started Guide
Welcome to Claude Code Workflow (CCW) v5.0! This guide will help you get up and running in 5 minutes and experience AI-driven automated software development with our streamlined, dependency-free workflow system.
Welcome to Claude Code Workflow (CCW) v6.2! This guide will help you get up and running in 5 minutes and experience AI-driven automated software development with native CodexLens code intelligence and intelligent CLI orchestration.
**Project Repository**: [catlog22/Claude-Code-Workflow](https://github.com/catlog22/Claude-Code-Workflow)
> **🎉 What's New in v5.0**: Less is more! We've removed external MCP dependencies and simplified workflows. CCW now uses standard tools (ripgrep/find) for better stability and performance. The brainstorming workflow focuses on role analysis for clearer planning.
> **🎉 What's New in v6.2**:
> - 🔍 **Native CodexLens**: Full-Text + Semantic + Hybrid search with HNSW vector index
> - 🖥️ **New Dashboard Views**: CLAUDE.md Manager, Skills Manager, Graph Explorer, Core Memory
> - 💻 **CLI Refactor**: `ccw cli -p` for multi-model execution (Gemini/Qwen/Codex)
> - 🧠 **Session Clustering**: Intelligent memory management with visualization
> - 📘 **TypeScript Migration**: Full backend modernization
---

View File

@@ -1,11 +1,16 @@
# 🚀 Claude Code Workflow (CCW) - 快速上手指南
欢迎来到 Claude Code Workflow (CCW) v5.0!本指南将帮助您在 5 分钟内快速入门,体验由 AI 驱动的自动化软件开发流程,以及我们全新的精简化、零外部依赖的工作流系统
欢迎来到 Claude Code Workflow (CCW) v6.2!本指南将帮助您在 5 分钟内快速入门,体验由 AI 驱动的自动化软件开发流程,原生 CodexLens 代码智能和智能 CLI 编排
**项目地址**[catlog22/Claude-Code-Workflow](https://github.com/catlog22/Claude-Code-Workflow)
> **🎉 v5.0 新特性:少即是多**!我们移除了外部 MCP 依赖简化了工作流程。CCW 现在使用标准工具ripgrep/find以获得更好的稳定性和性能。头脑风暴工作流专注于角色分析使规划更加清晰。
> **🎉 v6.2 新特性**:
> - 🔍 **原生 CodexLens**: 全文搜索 + 语义搜索 + 混合搜索,支持 HNSW 向量索引
> - 🖥️ **新 Dashboard 视图**: CLAUDE.md 管理器、技能管理器、图浏览器、核心记忆
> - 💻 **CLI 重构**: `ccw cli -p` 支持多模型执行 (Gemini/Qwen/Codex)
> - 🧠 **会话聚类**: 智能记忆管理与可视化
> - 📘 **TypeScript 迁移**: 后端全面现代化
---

View File

@@ -4,7 +4,7 @@
Claude Code Agent 工作流协调和分布式内存系统的交互式安装指南。
> **版本 5.0:精简化安装** - 移除了外部 MCP 依赖安装更简单、更稳定。使用标准工具ripgrep/find提供更好的性能和兼容性
> **版本 6.2:原生 CodexLens 与 Dashboard 革新** - 内置代码索引引擎FTS + 语义搜索 + HNSW 向量索引),全新 Dashboard 视图TypeScript 后端,会话聚类智能记忆管理
## ⚡ 一键远程安装(推荐)

View File

@@ -5,7 +5,7 @@
<div align="center">
[![Version](https://img.shields.io/badge/version-v6.1.3-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
[![Version](https://img.shields.io/badge/version-v6.2.0-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
[![npm](https://img.shields.io/npm/v/claude-code-workflow.svg)](https://www.npmjs.com/package/claude-code-workflow)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)]()
@@ -18,13 +18,20 @@
**Claude Code Workflow (CCW)** is a JSON-driven multi-agent development framework with intelligent CLI orchestration (Gemini/Qwen/Codex), context-first architecture, and automated workflow execution. It transforms AI development from simple prompt chaining into a powerful orchestration system.
> **🎉 Version 6.1.3: CLI Tool Simplification**
> **🎉 Version 6.2.0: Native CodexLens & Dashboard Revolution**
>
> **Core Improvements**:
> - 🔧 **Simplified edit_file**: Parameter-based input only (`--path`, `--old`, `--new`)
> - 📝 **Updated tool-strategy.md**: Added sed as line operation alternative
> **Breaking Changes**:
> - ⚠️ CLI command refactored: `ccw cli exec` → `ccw cli -p`
> - ⚠️ Code Index MCP replaced with native CodexLens
> - ⚠️ Knowledge Graph replaced with Session Clustering
>
> See [CHANGELOG.md](CHANGELOG.md) for complete details.
> **Core Features**:
> - 🔍 **Native CodexLens**: Full-Text Search + Semantic Search + HNSW vector index
> - 🖥️ **New Dashboard Views**: CLAUDE.md Manager, Skills Manager, Graph Explorer, Core Memory
> - 📘 **TypeScript Migration**: Full backend modernization
> - 🧠 **Session Clustering**: Intelligent memory management with cluster visualization
>
> See [CHANGELOG.md](CHANGELOG.md) for complete details and migration guide.
> 📚 **New to CCW?** Check out the [**Getting Started Guide**](GETTING_STARTED.md) for a beginner-friendly 5-minute tutorial!
@@ -87,6 +94,8 @@ The `ccw` command provides a powerful CLI for managing your Claude Code Workflow
| `ccw view` | Open the workflow dashboard in browser |
| `ccw serve` | Start dashboard server without opening browser |
| `ccw list` | List all managed installations |
| `ccw cli -p "..."` | Execute CLI tools (Gemini/Qwen/Codex) with prompt |
| `ccw core-memory` | Manage session clustering and memory |
### **Usage Examples**
@@ -115,10 +124,15 @@ ccw list
The CCW Dashboard (`ccw view`) provides:
- 📊 **Session Overview**: View all workflow sessions with status and progress
- 📋 **Task Management**: Track task execution and completion
- 🔍 **Review Sessions**: Manage code review cycles
- 🔍 **CodexLens Manager**: Native code indexing with FTS + Semantic + Hybrid search
- 🧠 **Core Memory**: Session clustering visualization with cluster management
- 📄 **CLAUDE.md Manager**: File tree viewer for configuration management
- 🎯 **Skills Manager**: View and manage Claude Code skills
- 🕸️ **Graph Explorer**: Interactive code relationship visualization (Cytoscape.js)
- ⚙️ **MCP Manager**: Configure and monitor MCP servers
- 🪝 **Hook Manager**: Manage Claude Code hooks
- 📁 **Project Explorer**: Navigate project structure and artifacts
- **Help View**: Internationalized help documentation
- 💻 **CLI Manager**: CLI execution history with session resume
---

View File

@@ -2,7 +2,7 @@
<div align="center">
[![Version](https://img.shields.io/badge/version-v6.1.0-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
[![Version](https://img.shields.io/badge/version-v6.2.0-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
[![npm](https://img.shields.io/npm/v/claude-code-workflow.svg)](https://www.npmjs.com/package/claude-code-workflow)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)]()
@@ -15,15 +15,20 @@
**Claude Code Workflow (CCW)** 将 AI 开发从简单的提示词链接转变为一个强大的、上下文优先的编排系统。它通过结构化规划、确定性执行和智能多模型编排,解决了执行不确定性和误差累积的问题。
> **🎉 版本 6.1.0: 仪表盘图标统一 & CCW 工具系统**
> **🎉 版本 6.2.0: 原生 CodexLens 与 Dashboard 革新**
>
> **核心改进**:
> - 🎨 **仪表盘图标统一** - 全面迁移至 Lucide Icons 图标库
> - 🛠 **CCW Tool Exec 系统** - 新增 `ccw tool exec` 命令,支持 JSON 参数执行工具
> - 🚀 **Explorer 增强** - 异步任务执行、CLI 选择器改进、WebSocket 帧处理
> - ✨ **智能服务器识别** - 智能工作空间切换和 MCP 多源配置
> **破坏性变更**:
> - ⚠️ CLI 命令重构: `ccw cli exec` → `ccw cli -p`
> - Code Index MCP 替换为原生 CodexLens
> - ⚠️ 知识图谱替换为会话聚类系统
>
> 详见 [CHANGELOG.md](CHANGELOG.md)。
> **核心功能**:
> - 🔍 **原生 CodexLens**: 全文搜索 + 语义搜索 + HNSW 向量索引
> - 🖥️ **新 Dashboard 视图**: CLAUDE.md 管理器、技能管理器、图浏览器、核心记忆
> - 📘 **TypeScript 迁移**: 后端全面现代化
> - 🧠 **会话聚类**: 智能记忆管理与聚类可视化
>
> 详见 [CHANGELOG.md](CHANGELOG.md) 获取完整详情和迁移指南。
> 📚 **第一次使用 CCW** 查看 [**快速上手指南**](GETTING_STARTED_CN.md) 获取新手友好的 5 分钟教程!
@@ -67,6 +72,62 @@ bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflo
---
## 🖥️ CCW CLI 工具
`ccw` 命令提供了强大的 CLI 来管理您的 Claude Code Workflow 安装:
### **命令**
| 命令 | 描述 |
|---------|-------------|
| `ccw install` | 安装工作流文件到全局 (~/.claude) 或指定路径 |
| `ccw upgrade` | 升级现有安装到当前包版本 |
| `ccw uninstall` | 从安装中移除工作流文件 |
| `ccw view` | 在浏览器中打开工作流仪表板 |
| `ccw serve` | 启动仪表板服务器而不打开浏览器 |
| `ccw list` | 列出所有管理的安装 |
| `ccw cli -p "..."` | 使用提示词执行 CLI 工具 (Gemini/Qwen/Codex) |
| `ccw core-memory` | 管理会话聚类和记忆 |
### **使用示例**
```bash
# 全局安装
ccw install -m Global
# 安装到指定项目
ccw install -m Path -p ./my-project
# 打开仪表板
ccw view
# 在自定义端口启动仪表板服务器
ccw serve -p 8080
# 升级所有安装
ccw upgrade -a
# 列出安装
ccw list
```
### **Dashboard 功能**
CCW Dashboard (`ccw view`) 提供:
- 📊 **会话概览**: 查看所有工作流会话的状态和进度
- 📋 **任务管理**: 跟踪任务执行和完成情况
- 🔍 **CodexLens 管理器**: 原生代码索引,支持 FTS + 语义 + 混合搜索
- 🧠 **核心记忆**: 会话聚类可视化与聚类管理
- 📄 **CLAUDE.md 管理器**: 配置管理的文件树查看器
- 🎯 **技能管理器**: 查看和管理 Claude Code 技能
- 🕸️ **图浏览器**: 交互式代码关系可视化 (Cytoscape.js)
- ⚙️ **MCP 管理器**: 配置和监控 MCP 服务器
- 🪝 **Hook 管理器**: 管理 Claude Code Hooks
-**帮助视图**: 国际化帮助文档
- 💻 **CLI 管理器**: CLI 执行历史与会话恢复
---
## 🛠️ 命令参考
CCW 提供了一套丰富的命令,用于管理工作流、任务以及与 AI 工具的交互。有关所有可用命令的完整列表和详细说明,请参阅 [**COMMAND_REFERENCE.md**](COMMAND_REFERENCE.md) 文件。

View File

@@ -1,6 +1,8 @@
# CCW - Claude Code Workflow CLI
A command-line tool for viewing workflow sessions and code review results from the Claude Code Workflow system.
[![Version](https://img.shields.io/badge/version-v6.2.0-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
A powerful command-line tool for managing Claude Code Workflow with native CodexLens code intelligence, multi-model CLI orchestration, and interactive dashboard.
## Installation
@@ -34,11 +36,33 @@ ccw view -o report.html
## Features
### Workflow Dashboard
- **Active Sessions**: View all active workflow sessions with task progress
- **Archived Sessions**: Browse completed/archived sessions
- **Task Tracking**: See individual task status (pending/in_progress/completed)
- **Progress Bars**: Visual progress indicators for each session
### 🔍 Native CodexLens (v6.2)
- **Full-Text Search (FTS)**: SQLite-based fast keyword search with symbol extraction
- **Semantic Search**: Embedding-based similarity search with vector store
- **Hybrid Search**: RRF (Reciprocal Rank Fusion) combining FTS and semantic results
- **HNSW Index**: Approximate Nearest Neighbor index for significantly faster vector search
### 💻 CLI Tools Integration
- **Multi-Model Support**: Execute prompts with Gemini, Qwen, or Codex
- **Session Resume**: Resume from last session or merge multiple sessions
- **SQLite History**: Persistent execution history with conversation tracking
- **Custom IDs**: Support for custom execution IDs and multi-turn conversations
### 🧠 Core Memory & Clustering
- **Session Clustering**: Intelligent grouping of related sessions
- **Cluster Visualization**: Interactive display with Cytoscape.js
- **Cluster Management**: Delete, merge, and deduplicate operations
### 🖥️ Dashboard Views
- **Workflow Dashboard**: Active/archived sessions with task progress
- **CodexLens Manager**: Index management with real-time progress bar
- **Core Memory**: Session clustering visualization
- **CLAUDE.md Manager**: File tree viewer for configuration
- **Skills Manager**: View and manage Claude Code skills
- **Graph Explorer**: Interactive code relationship visualization
- **MCP Manager**: Configure and monitor MCP servers
- **Hook Manager**: Manage Claude Code hooks
- **Help View**: Internationalized help documentation
### Review Integration
- **Code Review Findings**: View results from `review-module-cycle`

View File

@@ -1,6 +1,6 @@
{
"name": "ccw",
"version": "6.1.4",
"version": "6.2.0",
"description": "Claude Code Workflow CLI - Dashboard viewer for workflow sessions and reviews",
"type": "module",
"main": "dist/index.js",

View File

@@ -0,0 +1,226 @@
# Memory Embedder Implementation Summary
## Overview
Created a Python script (`memory_embedder.py`) that bridges CCW to CodexLens semantic search by generating and searching embeddings for memory chunks stored in CCW's SQLite database.
## Files Created
### 1. `memory_embedder.py` (Main Script)
**Location**: `D:\Claude_dms3\ccw\scripts\memory_embedder.py`
**Features**:
- Reuses CodexLens embedder: `from codexlens.semantic.embedder import get_embedder`
- Uses jina-embeddings-v2-base-code (768 dimensions)
- Three commands: `embed`, `search`, `status`
- JSON output for easy integration
- Batch processing for efficiency
- Graceful error handling
**Commands**:
1. **embed** - Generate embeddings
```bash
python memory_embedder.py embed <db_path> [options]
Options:
--source-id ID # Only process specific source
--batch-size N # Batch size (default: 8)
--force # Re-embed existing chunks
```
2. **search** - Semantic search
```bash
python memory_embedder.py search <db_path> <query> [options]
Options:
--top-k N # Number of results (default: 10)
--min-score F # Minimum score (default: 0.3)
--type TYPE # Filter by source type
```
3. **status** - Get statistics
```bash
python memory_embedder.py status <db_path>
```
### 2. `README-memory-embedder.md` (Documentation)
**Location**: `D:\Claude_dms3\ccw\scripts\README-memory-embedder.md`
**Contents**:
- Feature overview
- Requirements and installation
- Detailed usage examples
- Database path reference
- TypeScript integration guide
- Performance metrics
- Source type descriptions
### 3. `memory-embedder-example.ts` (Integration Example)
**Location**: `D:\Claude_dms3\ccw\scripts\memory-embedder-example.ts`
**Exported Functions**:
- `embedChunks(dbPath, options)` - Generate embeddings
- `searchMemory(dbPath, query, options)` - Semantic search
- `getEmbeddingStatus(dbPath)` - Get status
**Example Usage**:
```typescript
import { searchMemory, embedChunks, getEmbeddingStatus } from './memory-embedder-example';
// Check status
const status = getEmbeddingStatus(dbPath);
// Generate embeddings
const result = embedChunks(dbPath, { batchSize: 16 });
// Search
const matches = searchMemory(dbPath, 'authentication', {
topK: 5,
minScore: 0.5,
sourceType: 'workflow'
});
```
## Technical Implementation
### Database Schema
Uses existing `memory_chunks` table:
```sql
CREATE TABLE memory_chunks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
source_id TEXT NOT NULL,
source_type TEXT NOT NULL,
chunk_index INTEGER NOT NULL,
content TEXT NOT NULL,
embedding BLOB,
metadata TEXT,
created_at TEXT NOT NULL,
UNIQUE(source_id, chunk_index)
);
```
### Embedding Storage
- Format: `float32` bytes (numpy array)
- Dimension: 768 (jina-embeddings-v2-base-code)
- Storage: `np.array(emb, dtype=np.float32).tobytes()`
- Loading: `np.frombuffer(blob, dtype=np.float32)`
### Similarity Search
- Algorithm: Cosine similarity
- Formula: `np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))`
- Default threshold: 0.3
- Sorting: Descending by score
### Source Types
- `core_memory`: Strategic architectural context
- `workflow`: Session-based development history
- `cli_history`: Command execution logs
### Restore Commands
Generated automatically for each match:
- core_memory/cli_history: `ccw memory export <source_id>`
- workflow: `ccw session resume <source_id>`
## Dependencies
### Required
- `numpy`: Array operations and cosine similarity
- `codexlens[semantic]`: Embedding generation
### Installation
```bash
pip install numpy codexlens[semantic]
```
## Testing
### Script Validation
```bash
# Syntax check
python -m py_compile scripts/memory_embedder.py # OK
# Help output
python scripts/memory_embedder.py --help # Works
python scripts/memory_embedder.py embed --help # Works
python scripts/memory_embedder.py search --help # Works
python scripts/memory_embedder.py status --help # Works
# Status test
python scripts/memory_embedder.py status <db_path> # Works
```
### Error Handling
- Missing database: FileNotFoundError with clear message
- Missing CodexLens: ImportError with installation instructions
- Missing numpy: ImportError with installation instructions
- Database errors: JSON error response with success=false
- Missing table: Graceful error with JSON output
## Performance
- **Embedding speed**: ~8 chunks/second (batch size 8)
- **Search speed**: ~0.1-0.5 seconds for 1000 chunks
- **Model loading**: ~0.8 seconds (cached after first use via CodexLens singleton)
- **Batch processing**: Configurable batch size (default: 8)
## Output Format
All commands output JSON for easy parsing:
### Embed Result
```json
{
"success": true,
"chunks_processed": 50,
"chunks_failed": 0,
"elapsed_time": 12.34
}
```
### Search Result
```json
{
"success": true,
"matches": [
{
"source_id": "WFS-20250101-auth",
"source_type": "workflow",
"chunk_index": 2,
"content": "Implemented JWT...",
"score": 0.8542,
"restore_command": "ccw session resume WFS-20250101-auth"
}
]
}
```
### Status Result
```json
{
"total_chunks": 150,
"embedded_chunks": 100,
"pending_chunks": 50,
"by_type": {
"core_memory": {"total": 80, "embedded": 60, "pending": 20}
}
}
```
## Next Steps
1. **TypeScript Integration**: Add to CCW's core memory routes
2. **CLI Command**: Create `ccw memory search` command
3. **Automatic Embedding**: Trigger embedding on memory creation
4. **Index Management**: Add rebuild/optimize commands
5. **Cluster Search**: Integrate with session clusters
## Code Quality
- ✅ Single responsibility per function
- ✅ Clear, descriptive naming
- ✅ Explicit error handling
- ✅ No premature abstractions
- ✅ Minimal debug output (essential logging only)
- ✅ ASCII-only characters (no emojis)
- ✅ GBK encoding compatible
- ✅ Type hints for all functions
- ✅ Comprehensive docstrings

View File

@@ -0,0 +1,135 @@
# Memory Embedder - Quick Reference
## Installation
```bash
pip install numpy codexlens[semantic]
```
## Commands
### Status
```bash
python scripts/memory_embedder.py status <db_path>
```
### Embed All
```bash
python scripts/memory_embedder.py embed <db_path>
```
### Embed Specific Source
```bash
python scripts/memory_embedder.py embed <db_path> --source-id CMEM-20250101-120000
```
### Re-embed (Force)
```bash
python scripts/memory_embedder.py embed <db_path> --force
```
### Search
```bash
python scripts/memory_embedder.py search <db_path> "authentication flow"
```
### Advanced Search
```bash
python scripts/memory_embedder.py search <db_path> "rate limiting" \
--top-k 5 \
--min-score 0.5 \
--type workflow
```
## Database Path
Find your database:
```bash
# Linux/Mac
~/.ccw/projects/<project-id>/core-memory/core_memory.db
# Windows
%USERPROFILE%\.ccw\projects\<project-id>\core-memory\core_memory.db
```
## TypeScript Integration
```typescript
import { execSync } from 'child_process';
// Status
const status = JSON.parse(
execSync(`python scripts/memory_embedder.py status "${dbPath}"`, {
encoding: 'utf-8'
})
);
// Embed
const result = JSON.parse(
execSync(`python scripts/memory_embedder.py embed "${dbPath}"`, {
encoding: 'utf-8'
})
);
// Search
const matches = JSON.parse(
execSync(
`python scripts/memory_embedder.py search "${dbPath}" "query"`,
{ encoding: 'utf-8' }
)
);
```
## Output Examples
### Status
```json
{
"total_chunks": 150,
"embedded_chunks": 100,
"pending_chunks": 50,
"by_type": {
"core_memory": {"total": 80, "embedded": 60, "pending": 20}
}
}
```
### Embed
```json
{
"success": true,
"chunks_processed": 50,
"chunks_failed": 0,
"elapsed_time": 12.34
}
```
### Search
```json
{
"success": true,
"matches": [
{
"source_id": "WFS-20250101-auth",
"source_type": "workflow",
"chunk_index": 2,
"content": "Implemented JWT authentication...",
"score": 0.8542,
"restore_command": "ccw session resume WFS-20250101-auth"
}
]
}
```
## Source Types
- `core_memory` - Strategic architectural context
- `workflow` - Session-based development history
- `cli_history` - Command execution logs
## Performance
- Embedding: ~8 chunks/second
- Search: ~0.1-0.5s for 1000 chunks
- Model load: ~0.8s (cached)
- Batch size: 8 (default, configurable)

View File

@@ -0,0 +1,157 @@
# Memory Embedder
Bridge CCW to CodexLens semantic search by generating and searching embeddings for memory chunks.
## Features
- **Generate embeddings** for memory chunks using CodexLens's jina-embeddings-v2-base-code (768 dim)
- **Semantic search** across all memory types (core_memory, workflow, cli_history)
- **Status tracking** to monitor embedding progress
- **Batch processing** for efficient embedding generation
- **Restore commands** included in search results
## Requirements
```bash
pip install numpy codexlens[semantic]
```
## Usage
### 1. Check Status
```bash
python scripts/memory_embedder.py status <db_path>
```
Example output:
```json
{
"total_chunks": 150,
"embedded_chunks": 100,
"pending_chunks": 50,
"by_type": {
"core_memory": {"total": 80, "embedded": 60, "pending": 20},
"workflow": {"total": 50, "embedded": 30, "pending": 20},
"cli_history": {"total": 20, "embedded": 10, "pending": 10}
}
}
```
### 2. Generate Embeddings
Embed all unembedded chunks:
```bash
python scripts/memory_embedder.py embed <db_path>
```
Embed specific source:
```bash
python scripts/memory_embedder.py embed <db_path> --source-id CMEM-20250101-120000
```
Re-embed all chunks (force):
```bash
python scripts/memory_embedder.py embed <db_path> --force
```
Adjust batch size (default 8):
```bash
python scripts/memory_embedder.py embed <db_path> --batch-size 16
```
Example output:
```json
{
"success": true,
"chunks_processed": 50,
"chunks_failed": 0,
"elapsed_time": 12.34
}
```
### 3. Semantic Search
Basic search:
```bash
python scripts/memory_embedder.py search <db_path> "authentication flow"
```
Advanced search:
```bash
python scripts/memory_embedder.py search <db_path> "rate limiting" \
--top-k 5 \
--min-score 0.5 \
--type workflow
```
Example output:
```json
{
"success": true,
"matches": [
{
"source_id": "WFS-20250101-auth",
"source_type": "workflow",
"chunk_index": 2,
"content": "Implemented JWT-based authentication...",
"score": 0.8542,
"restore_command": "ccw session resume WFS-20250101-auth"
}
]
}
```
## Database Path
The database is located in CCW's storage directory:
- **Windows**: `%USERPROFILE%\.ccw\projects\<project-id>\core-memory\core_memory.db`
- **Linux/Mac**: `~/.ccw/projects/<project-id>/core-memory/core_memory.db`
Find your project's database:
```bash
ccw memory list # Shows project path
# Then look in: ~/.ccw/projects/<hashed-path>/core-memory/core_memory.db
```
## Integration with CCW
This script is designed to be called from CCW's TypeScript code:
```typescript
import { execSync } from 'child_process';
// Embed chunks
const result = execSync(
`python scripts/memory_embedder.py embed ${dbPath}`,
{ encoding: 'utf-8' }
);
const { success, chunks_processed } = JSON.parse(result);
// Search
const searchResult = execSync(
`python scripts/memory_embedder.py search ${dbPath} "${query}" --top-k 10`,
{ encoding: 'utf-8' }
);
const { matches } = JSON.parse(searchResult);
```
## Performance
- **Embedding speed**: ~8 chunks/second (batch size 8)
- **Search speed**: ~0.1-0.5 seconds for 1000 chunks
- **Model loading**: ~0.8 seconds (cached after first use)
## Source Types
- `core_memory`: Strategic architectural context
- `workflow`: Session-based development history
- `cli_history`: Command execution logs
## Restore Commands
Search results include restore commands:
- **core_memory/cli_history**: `ccw memory export <source_id>`
- **workflow**: `ccw session resume <source_id>`

View File

@@ -0,0 +1,184 @@
/**
* Example: Using Memory Embedder from TypeScript
*
* This shows how to integrate the Python memory embedder script
* into CCW's TypeScript codebase.
*/
import { execSync } from 'child_process';
import { join } from 'path';
interface EmbedResult {
success: boolean;
chunks_processed: number;
chunks_failed: number;
elapsed_time: number;
}
interface SearchMatch {
source_id: string;
source_type: 'core_memory' | 'workflow' | 'cli_history';
chunk_index: number;
content: string;
score: number;
restore_command: string;
}
interface SearchResult {
success: boolean;
matches: SearchMatch[];
error?: string;
}
interface StatusResult {
total_chunks: number;
embedded_chunks: number;
pending_chunks: number;
by_type: Record<string, { total: number; embedded: number; pending: number }>;
}
/**
* Get path to memory embedder script
*/
function getEmbedderScript(): string {
return join(__dirname, 'memory_embedder.py');
}
/**
* Execute memory embedder command
*/
function execEmbedder(args: string[]): string {
const script = getEmbedderScript();
const command = `python "${script}" ${args.join(' ')}`;
try {
return execSync(command, {
encoding: 'utf-8',
maxBuffer: 10 * 1024 * 1024 // 10MB buffer
});
} catch (error: any) {
// Try to parse error output as JSON
if (error.stdout) {
return error.stdout;
}
throw new Error(`Embedder failed: ${error.message}`);
}
}
/**
* Generate embeddings for memory chunks
*/
export function embedChunks(
dbPath: string,
options: {
sourceId?: string;
batchSize?: number;
force?: boolean;
} = {}
): EmbedResult {
const args = ['embed', `"${dbPath}"`];
if (options.sourceId) {
args.push('--source-id', options.sourceId);
}
if (options.batchSize) {
args.push('--batch-size', String(options.batchSize));
}
if (options.force) {
args.push('--force');
}
const output = execEmbedder(args);
return JSON.parse(output);
}
/**
* Search memory chunks semantically
*/
export function searchMemory(
dbPath: string,
query: string,
options: {
topK?: number;
minScore?: number;
sourceType?: 'core_memory' | 'workflow' | 'cli_history';
} = {}
): SearchResult {
const args = ['search', `"${dbPath}"`, `"${query}"`];
if (options.topK) {
args.push('--top-k', String(options.topK));
}
if (options.minScore !== undefined) {
args.push('--min-score', String(options.minScore));
}
if (options.sourceType) {
args.push('--type', options.sourceType);
}
const output = execEmbedder(args);
return JSON.parse(output);
}
/**
* Get embedding status
*/
export function getEmbeddingStatus(dbPath: string): StatusResult {
const args = ['status', `"${dbPath}"`];
const output = execEmbedder(args);
return JSON.parse(output);
}
// ============================================================================
// Example Usage
// ============================================================================
async function exampleUsage() {
const dbPath = join(process.env.HOME || '', '.ccw/projects/myproject/core-memory/core_memory.db');
// 1. Check status
console.log('Checking embedding status...');
const status = getEmbeddingStatus(dbPath);
console.log(`Total chunks: ${status.total_chunks}`);
console.log(`Embedded: ${status.embedded_chunks}`);
console.log(`Pending: ${status.pending_chunks}`);
// 2. Generate embeddings if needed
if (status.pending_chunks > 0) {
console.log('\nGenerating embeddings...');
const embedResult = embedChunks(dbPath, { batchSize: 16 });
console.log(`Processed: ${embedResult.chunks_processed}`);
console.log(`Time: ${embedResult.elapsed_time}s`);
}
// 3. Search for relevant memories
console.log('\nSearching for authentication-related memories...');
const searchResult = searchMemory(dbPath, 'authentication flow', {
topK: 5,
minScore: 0.5
});
if (searchResult.success) {
console.log(`Found ${searchResult.matches.length} matches:`);
for (const match of searchResult.matches) {
console.log(`\n- ${match.source_id} (score: ${match.score})`);
console.log(` Type: ${match.source_type}`);
console.log(` Restore: ${match.restore_command}`);
console.log(` Content: ${match.content.substring(0, 100)}...`);
}
}
// 4. Search specific source type
console.log('\nSearching workflows only...');
const workflowSearch = searchMemory(dbPath, 'API implementation', {
sourceType: 'workflow',
topK: 3
});
console.log(`Found ${workflowSearch.matches.length} workflow matches`);
}
// Run example if executed directly
if (require.main === module) {
exampleUsage().catch(console.error);
}

View File

@@ -0,0 +1,245 @@
#!/usr/bin/env python3
"""
Test script for memory_embedder.py
Creates a temporary database with test data and verifies all commands work.
"""
import json
import sqlite3
import tempfile
import subprocess
from pathlib import Path
from datetime import datetime
def create_test_database():
"""Create a temporary database with test chunks."""
# Create temp file
temp_db = tempfile.NamedTemporaryFile(suffix='.db', delete=False)
temp_db.close()
conn = sqlite3.connect(temp_db.name)
cursor = conn.cursor()
# Create schema
cursor.execute("""
CREATE TABLE memory_chunks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
source_id TEXT NOT NULL,
source_type TEXT NOT NULL,
chunk_index INTEGER NOT NULL,
content TEXT NOT NULL,
embedding BLOB,
metadata TEXT,
created_at TEXT NOT NULL,
UNIQUE(source_id, chunk_index)
)
""")
# Insert test data
test_chunks = [
("CMEM-20250101-001", "core_memory", 0, "Implemented authentication using JWT tokens with refresh mechanism"),
("CMEM-20250101-001", "core_memory", 1, "Added rate limiting to API endpoints using Redis"),
("WFS-20250101-auth", "workflow", 0, "Created login endpoint with password hashing"),
("WFS-20250101-auth", "workflow", 1, "Implemented session management with token rotation"),
("CLI-20250101-001", "cli_history", 0, "Executed database migration for user table"),
]
now = datetime.now().isoformat()
for source_id, source_type, chunk_index, content in test_chunks:
cursor.execute(
"""
INSERT INTO memory_chunks (source_id, source_type, chunk_index, content, created_at)
VALUES (?, ?, ?, ?, ?)
""",
(source_id, source_type, chunk_index, content, now)
)
conn.commit()
conn.close()
return temp_db.name
def run_command(args):
"""Run memory_embedder.py with given arguments."""
script = Path(__file__).parent / "memory_embedder.py"
cmd = ["python", str(script)] + args
result = subprocess.run(
cmd,
capture_output=True,
text=True
)
return result.returncode, result.stdout, result.stderr
def test_status(db_path):
"""Test status command."""
print("Testing status command...")
returncode, stdout, stderr = run_command(["status", db_path])
if returncode != 0:
print(f"[FAIL] Status failed: {stderr}")
return False
result = json.loads(stdout)
expected_total = 5
if result["total_chunks"] != expected_total:
print(f"[FAIL] Expected {expected_total} chunks, got {result['total_chunks']}")
return False
if result["embedded_chunks"] != 0:
print(f"[FAIL] Expected 0 embedded chunks, got {result['embedded_chunks']}")
return False
print(f"[PASS] Status OK: {result['total_chunks']} total, {result['embedded_chunks']} embedded")
return True
def test_embed(db_path):
"""Test embed command."""
print("\nTesting embed command...")
returncode, stdout, stderr = run_command(["embed", db_path, "--batch-size", "2"])
if returncode != 0:
print(f"[FAIL] Embed failed: {stderr}")
return False
result = json.loads(stdout)
if not result["success"]:
print(f"[FAIL] Embed unsuccessful")
return False
if result["chunks_processed"] != 5:
print(f"[FAIL] Expected 5 processed, got {result['chunks_processed']}")
return False
if result["chunks_failed"] != 0:
print(f"[FAIL] Expected 0 failed, got {result['chunks_failed']}")
return False
print(f"[PASS] Embed OK: {result['chunks_processed']} processed in {result['elapsed_time']}s")
return True
def test_search(db_path):
"""Test search command."""
print("\nTesting search command...")
returncode, stdout, stderr = run_command([
"search", db_path, "authentication JWT",
"--top-k", "3",
"--min-score", "0.3"
])
if returncode != 0:
print(f"[FAIL] Search failed: {stderr}")
return False
result = json.loads(stdout)
if not result["success"]:
print(f"[FAIL] Search unsuccessful: {result.get('error', 'Unknown error')}")
return False
if len(result["matches"]) == 0:
print(f"[FAIL] Expected at least 1 match, got 0")
return False
print(f"[PASS] Search OK: {len(result['matches'])} matches found")
# Show top match
top_match = result["matches"][0]
print(f" Top match: {top_match['source_id']} (score: {top_match['score']})")
print(f" Content: {top_match['content'][:60]}...")
return True
def test_source_filter(db_path):
"""Test search with source type filter."""
print("\nTesting source type filter...")
returncode, stdout, stderr = run_command([
"search", db_path, "authentication",
"--type", "workflow"
])
if returncode != 0:
print(f"[FAIL] Filtered search failed: {stderr}")
return False
result = json.loads(stdout)
if not result["success"]:
print(f"[FAIL] Filtered search unsuccessful")
return False
# Verify all matches are workflow type
for match in result["matches"]:
if match["source_type"] != "workflow":
print(f"[FAIL] Expected workflow type, got {match['source_type']}")
return False
print(f"[PASS] Filter OK: {len(result['matches'])} workflow matches")
return True
def main():
"""Run all tests."""
print("Memory Embedder Test Suite")
print("=" * 60)
# Create test database
print("\nCreating test database...")
db_path = create_test_database()
print(f"[PASS] Database created: {db_path}")
try:
# Run tests
tests = [
("Status", test_status),
("Embed", test_embed),
("Search", test_search),
("Source Filter", test_source_filter),
]
passed = 0
failed = 0
for name, test_func in tests:
try:
if test_func(db_path):
passed += 1
else:
failed += 1
except Exception as e:
print(f"[FAIL] {name} crashed: {e}")
failed += 1
# Summary
print("\n" + "=" * 60)
print(f"Results: {passed} passed, {failed} failed")
if failed == 0:
print("[PASS] All tests passed!")
return 0
else:
print("[FAIL] Some tests failed")
return 1
finally:
# Cleanup
import os
try:
os.unlink(db_path)
print(f"\n[PASS] Cleaned up test database")
except:
pass
if __name__ == "__main__":
exit(main())