feat: Add build and publish scripts for claude-mem
- Implemented build.js to bundle TypeScript source into a minified executable using Bun. - Created publish.js to handle version bumping, building, and publishing to npm with user prompts. - Added tests for database schema and hook functions in database-schema.test.ts. - Introduced integration tests for hooks database in hooks-database-integration.test.ts. - Developed end-to-end tests for SDK prompts and parser in sdk-prompts-parser.test.ts. - Created session lifecycle tests to simulate complete Claude Code session in session-lifecycle.test.ts.
This commit is contained in:
+116
@@ -0,0 +1,116 @@
|
||||
# Build & Publish Guide
|
||||
|
||||
This repository is now the primary source for `claude-mem`. All builds and publishes happen from this repo.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [Bun](https://bun.sh) - Fast JavaScript runtime and bundler
|
||||
- npm account with publish access to `claude-mem`
|
||||
|
||||
## Building
|
||||
|
||||
Build the project to create a bundled, minified executable:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
# or
|
||||
node build.js
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Bundle all TypeScript source files using Bun
|
||||
2. Minify the output
|
||||
3. Add shebang (`#!/usr/bin/env node`)
|
||||
4. Set executable permissions
|
||||
5. Output to `dist/claude-mem.min.js`
|
||||
|
||||
### Build Output
|
||||
|
||||
- **Entry point:** `src/bin/cli.ts`
|
||||
- **Output:** `dist/claude-mem.min.js` (~350KB minified)
|
||||
- **Target:** Node.js (via Bun's `--target=node`)
|
||||
- **Externals:** `@anthropic-ai/claude-agent-sdk` (not bundled)
|
||||
|
||||
## Publishing
|
||||
|
||||
To publish a new version to npm:
|
||||
|
||||
```bash
|
||||
npm run publish:npm
|
||||
# or
|
||||
node publish.js
|
||||
```
|
||||
|
||||
The publish script will:
|
||||
1. Check git status (warn if uncommitted changes)
|
||||
2. Show current version and prompt for version bump type:
|
||||
- `patch` - Bug fixes (1.0.X)
|
||||
- `minor` - New features (1.X.0)
|
||||
- `major` - Breaking changes (X.0.0)
|
||||
- `custom` - Enter version manually
|
||||
3. Update `package.json` with new version
|
||||
4. Run build script
|
||||
5. Run tests (if configured)
|
||||
6. Create git commit and tag (`v{version}`)
|
||||
7. Publish to npm
|
||||
8. Push commit and tags to GitHub
|
||||
|
||||
### Manual Publishing
|
||||
|
||||
If you prefer to do it manually:
|
||||
|
||||
```bash
|
||||
# 1. Update version in package.json
|
||||
# 2. Build
|
||||
npm run build
|
||||
|
||||
# 3. Commit and tag
|
||||
git add package.json dist/
|
||||
git commit -m "Release v3.9.17"
|
||||
git tag v3.9.17
|
||||
|
||||
# 4. Publish
|
||||
npm publish
|
||||
|
||||
# 5. Push
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Run the CLI directly from source without building:
|
||||
|
||||
```bash
|
||||
npm run dev -- [command] [options]
|
||||
# or
|
||||
bun run src/bin/cli.ts [command] [options]
|
||||
```
|
||||
|
||||
Example:
|
||||
```bash
|
||||
npm run dev -- status
|
||||
npm run dev -- --version
|
||||
```
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
claude-mem/
|
||||
├── src/ # TypeScript source
|
||||
│ ├── bin/cli.ts # CLI entry point
|
||||
│ ├── commands/ # Command implementations
|
||||
│ ├── services/ # Core services
|
||||
│ └── shared/ # Shared utilities
|
||||
├── dist/ # Build output
|
||||
│ └── claude-mem.min.js # Bundled executable
|
||||
├── build.js # Build script
|
||||
├── publish.js # Publish script
|
||||
└── package.json # Package configuration
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- The build process embeds the version from `package.json` at build time
|
||||
- `prepublishOnly` script ensures build runs before npm publish
|
||||
- Dependencies are bundled except for external packages
|
||||
- The published package includes: `dist/`, `hook-templates/`, `commands/`, `src/`
|
||||
@@ -0,0 +1,119 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
|
||||
## [3.7.1] - 2025-09-17
|
||||
|
||||
### Added
|
||||
- SQLite storage backend with session, memory, overview, and diagnostics management
|
||||
- Mintlify documentation site with searchable interface and comprehensive guides
|
||||
- Context7 MCP integration for documentation retrieval
|
||||
|
||||
### Changed
|
||||
- Session-start overviews to display chronologically from oldest to newest
|
||||
|
||||
### Fixed
|
||||
- Migration index parsing bug that prevented JSONL records from importing to SQLite
|
||||
|
||||
|
||||
## [3.6.10] - 2025-09-16
|
||||
|
||||
### Added
|
||||
- Claude Code statusline integration for real-time memory status
|
||||
- MCP memory tools server providing compress, stats, search, and overview commands
|
||||
- Concept documentation explaining memory compression and context loading
|
||||
|
||||
### Fixed
|
||||
- Corrected integration architecture to use hooks instead of MCP SDK
|
||||
|
||||
|
||||
## [3.6.9] - 2025-09-14
|
||||
|
||||
### Added
|
||||
- Display current date and time at the top of session-start hook output for better temporal context
|
||||
|
||||
### Changed
|
||||
- Enhanced session-start hook formatting with emoji icons and separator lines for improved readability
|
||||
|
||||
|
||||
## [3.6.8] - 2025-09-14
|
||||
|
||||
### Fixed
|
||||
- Fixed publish command failing when no version-related memories exist for changelog generation
|
||||
|
||||
|
||||
## [3.6.6] - 2025-09-14
|
||||
|
||||
### Fixed
|
||||
- Resolved compaction errors when processing large conversation histories by reducing chunk size limits to stay within Claude's context window
|
||||
|
||||
|
||||
## [3.6.5] - 2025-09-14
|
||||
|
||||
### Changed
|
||||
- Session groups now display in chronological order (most recent first)
|
||||
|
||||
### Fixed
|
||||
- Improved CLI path detection for cross-platform compatibility
|
||||
|
||||
|
||||
## [3.6.4] - 2025-09-13
|
||||
|
||||
### Changed
|
||||
- Update save documentation to include allowed-tools and description metadata fields
|
||||
|
||||
### Removed
|
||||
- Remove deprecated markdown to JSONL migration script
|
||||
|
||||
|
||||
## [3.6.3] - 2025-09-11
|
||||
|
||||
### Changed
|
||||
- Updated changelog generation prompts to use date strings in query text for temporal filtering
|
||||
|
||||
### Fixed
|
||||
- Resolved changelog timestamp filtering by using semantic search instead of metadata queries, enabling proper date-based searches
|
||||
- Corrected install.ts search instructions to remove misleading metadata filtering guidance that caused 'Error finding id' errors
|
||||
|
||||
|
||||
## [3.6.2] - 2025-09-10
|
||||
|
||||
### Added
|
||||
- Visual feedback to changelog command showing current version, next version, and number of overviews being processed
|
||||
- Generate changelog for specific versions using `--generate` flag with npm publish time boundaries
|
||||
- Introduce 'Who Wants To Be a Memoryonaire?' trivia game that generates personalized questions from your stored memories
|
||||
- Add interactive terminal UI with lifelines (50:50, Phone-a-Friend, Audience Poll) and cross-platform audio support
|
||||
- Implement permanent question caching with --regenerate flag for instant game loading
|
||||
- Enable hybrid vector search to discover related memory chains during question generation
|
||||
|
||||
### Changed
|
||||
- Changelog regeneration automatically removes old entries from JSONL file when using `--generate` or `--historical` flags
|
||||
- Switch to direct JSONL file loading for instant memory access without API calls
|
||||
- Optimize AI generation with faster 'sonnet' model for improved performance
|
||||
- Reduce memory query limit from 100 to 50 to prevent token overflow
|
||||
|
||||
### Fixed
|
||||
- Changelog command now uses npm publish timestamps exclusively for accurate version time ranges
|
||||
- Resolved timestamp filtering issues with Chroma database by leveraging semantic search with embedded dates
|
||||
- Resolve game hanging at startup due to confirmation loop
|
||||
- Fix memory integration bypass that prevented questions from using actual stored memories
|
||||
- Consolidate 500+ lines of duplicate code for better maintainability
|
||||
|
||||
|
||||
## [3.6.1] - 2025-09-10
|
||||
|
||||
### Changed
|
||||
- Refactored pre-compact hook to work independently without status line updates
|
||||
|
||||
### Removed
|
||||
- Removed status line integration and ccstatusline configuration support
|
||||
|
||||
|
||||
## [3.5.5] - 2025-09-10
|
||||
|
||||
### Changed
|
||||
- Standardized GitHub release naming to lowercase 'claude-mem vX.X.X' format for consistent branding
|
||||
|
||||
Reference in New Issue
Block a user