Skip to content

Latest commit

 

History

History
120 lines (85 loc) · 2.17 KB

File metadata and controls

120 lines (85 loc) · 2.17 KB

Developer Setup

Prerequisites

  • Node.js ≥ 18
  • npm account (for publishing)

Build

npm install
npm run build        # compiles TypeScript → dist/

Develop

# Terminal 1 — recompile on every save
npm run dev

# Terminal 2 — run commands as you go
node dist/index.js recall "test"
node dist/index.js remember "a note"
node dist/index.js list
node dist/index.js stats

Test with a real brain command (no global install)

npm run build
npm link              # creates a global `brain` → dist/index.js symlink

brain recall "test"
brain setup
brain remember "linked dev build"

npm unlink            # remove when done

Reset the setup wizard

rm ~/.config/second-brain/config.json
node dist/index.js recall "test"   # wizard auto-triggers
# or
node dist/index.js setup           # explicit

Test all commands

node dist/index.js remember "test memory" --tags dev,test
echo "piped content" | node dist/index.js remember
node dist/index.js recall "test memory" --limit 3
node dist/index.js list --limit 5
node dist/index.js stats
node dist/index.js append <id> "additional context"
node dist/index.js forget <id>

Publish to npm

One-time login

# Create account at https://www.npmjs.com/signup if needed
npm login
# → prompts for username, password, email, OTP (if 2FA enabled)

Verify what gets published

npm run build
npm pack --dry-run                           # lists files that will be included
npm pack && tar -tzf *.tgz && rm *.tgz       # inspect tarball then clean up

The tarball should contain only dist/ files, package.json, and README.md.

Publish

npm publish
# Available at: https://www.npmjs.com/package/second-brain-cli

Verify after publish

npm install -g second-brain-cli
brain --help
brain setup

npx second-brain-cli --help   # test without global install

Version bumps

npm version patch   # 0.1.0 → 0.1.1  (bug fixes)
npm version minor   # 0.1.0 → 0.2.0  (new features)
npm version major   # 0.1.0 → 1.0.0  (breaking changes)
# auto-creates a git commit + tag

npm publish