2608fb180e
- Updated the published package contents to exclude `hook-templates`. - Removed references to the hooks directory and related scripts in the installation and uninstallation processes. - Simplified the status command by eliminating checks for runtime hook scripts. - Adjusted the path discovery service to remove methods related to hook templates. - Updated the installation logic to directly configure hooks using CLI commands. - Cleaned up the uninstall process to remove claude-mem hooks from settings.
3.3 KiB
3.3 KiB
Build & Publish Guide
This repository is now the primary source for claude-mem. All builds and publishes happen from this repo.
Prerequisites
- Bun - Fast JavaScript runtime and bundler
- npm account with publish access to
claude-mem
Building
Build the project to create a bundled, minified executable:
npm run build
# or
node scripts/build.js
This will:
- Bundle all TypeScript source files using Bun
- Minify the output
- Add shebang (
#!/usr/bin/env node) - Set executable permissions
- 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:
npm run publish:npm
# or
node scripts/publish.js
The publish script will:
- Check git status (warn if uncommitted changes)
- 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
- Update
package.jsonwith new version - Run build script
- Run tests (if configured)
- Create git commit and tag (
v{version}) - Publish to npm
- Push commit and tags to GitHub
Manual Publishing
If you prefer to do it manually:
# 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:
npm run dev -- [command] [options]
# or
bun run src/bin/cli.ts [command] [options]
Example:
npm run dev -- status
npm run dev -- --version
File Structure
claude-mem/
├── src/ # TypeScript source
│ ├── bin/cli.ts # CLI entry point
│ ├── commands/ # Command implementations
│ ├── hooks/ # Hook implementations
│ ├── sdk/ # Agent SDK worker
│ ├── services/ # SQLite and path services
│ ├── shared/ # Configuration and types
│ └── utils/ # Platform utilities
├── dist/ # Build output
│ └── claude-mem.min.js # Bundled executable
├── tests/ # Test files
│ ├── database-schema.test.ts
│ ├── sdk-prompts-parser.test.ts
│ ├── hooks-database-integration.test.ts
│ └── session-lifecycle.test.ts
├── docs/ # Documentation
│ ├── BUILD.md # This file
│ └── CHANGELOG.md # Release notes
├── scripts/ # Build automation
│ ├── build.js # Build script
│ └── publish.js # Publish script
└── package.json # Package configuration
Notes
- The build process embeds the version from
package.jsonat build time prepublishOnlyscript ensures build runs before npm publish- Dependencies are bundled except for external packages
- The published package includes:
dist/,commands/,src/,docs/