Skip to content

feat(plugin): project filtering + native deps refactor + command syntax#178

Merged
onlycastle merged 5 commits intomainfrom
feat/plugin-project-filter-20260320
Mar 20, 2026
Merged

feat(plugin): project filtering + native deps refactor + command syntax#178
onlycastle merged 5 commits intomainfrom
feat/plugin-project-filter-20260320

Conversation

@onlycastle
Copy link
Owner

Summary

  • Project filtering: scan_sessions and extract_data tools now accept includeProjects parameter, letting users analyze specific projects instead of everything. Setup wizard adds a project selection step (Step 3).
  • Native deps refactor: ensureNativeDeps() installs to pluginRoot/node_modules/ using standard Node module resolution, removing the NODE_PATH env var workaround from .mcp.json.
  • Command syntax migration: All command references updated from /slash format to space-separated syntax (/bp-analyzebp analyze) across docs, skills, hooks, and README.

Changes

  1. refactor(plugin): use pluginRoot for native dependency resolution — native-deps.ts, server-entry.ts, session-start-handler.ts, .mcp.json
  2. feat(plugin): add project filtering to scan and extract tools — scan-sessions.ts, extract-data.ts, server.ts, prefs.ts
  3. docs: update skills and docs for command syntax + project selection — SKILL.md files, README, docs/
  4. test: update and add tests for plugin refactoring — 3 updated + 1 new test suite

Test Plan

  • All 452 tests pass (npm test)
  • Manual: fresh plugin install → bp setup → project selection persists to prefs.json
  • Manual: bp analyze with selectedProjects set filters correctly
  • Manual: MCP server starts without NODE_PATH env var

Generated with Claude Code using /ship-it

onlycastle and others added 4 commits March 20, 2026 14:09
Install better-sqlite3 into pluginRoot/node_modules/ so Node's standard
module resolution finds it naturally. Removes NODE_PATH env var from
.mcp.json and CLAUDE_PLUGIN_DATA dependency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
scan_sessions and extract_data now accept includeProjects parameter to
filter analysis to user-selected projects. scan_sessions returns
allProjects with session counts for the project selection UI.
selectedProjects added to UserPrefs for persistence.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Migrate command references from /slash format to space-separated syntax
(e.g. /bp-analyze -> bp analyze). Redesign bp-setup wizard to 7 integer
steps with project selection (Step 3). Update plugin docs for pluginRoot
resolution and includeProjects parameters.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update hook-utils and session-hooks tests for new command syntax.
Add prefs tests for selectedProjects persistence. Add new
project-filtering test suite covering includeProjects logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@onlycastle
Copy link
Owner Author

Code Review

Found 1 issue:

  1. JSDoc/commit message inconsistency with CLAUDE_PLUGIN_DATA fallback — The module-level JSDoc in native-deps.ts documents two strategies: primary (pluginRoot) and fallback (~/.betterprompt). The actual code has three: pluginRoot → CLAUDE_PLUGIN_DATA → ~/.betterprompt. The env var middle tier is undocumented in the JSDoc, and the commit message (e6f7a19) states it "removes CLAUDE_PLUGIN_DATA dependency" when the code still reads process.env.CLAUDE_PLUGIN_DATA as a fallback.
    * directory walking. Fallback: `~/.betterprompt/node_modules/` for
    * callers that don't know the plugin root.
    *
    * Safe to call from multiple entry points (SessionStart hook, MCP
    * server startup) — a marker file prevents redundant installs.
    */
    import { existsSync } from 'node:fs';
    import { execFileSync } from 'node:child_process';
    import { join } from 'node:path';
    import { homedir } from 'node:os';
    export function ensureNativeDeps(opts?: { pluginRoot?: string; fatal?: boolean }): void {
    const installDir = opts?.pluginRoot ?? process.env.CLAUDE_PLUGIN_DATA ?? join(homedir(), '.betterprompt');

Generated with Claude Code

If useful, react with a thumbs-up. Otherwise, thumbs-down.

Both callers pass pluginRoot explicitly, making the env var fallback
dead code. Removing it aligns the implementation with the refactor
intent and the JSDoc documentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@onlycastle onlycastle merged commit ec715a2 into main Mar 20, 2026
1 check passed
@onlycastle onlycastle deleted the feat/plugin-project-filter-20260320 branch March 20, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant