Commit Graph

23 Commits

Author SHA1 Message Date
Pregum 285f6f5239 fix(skill-usage-tracker): skill_usage_sender.jsにJSONパースの行単位エラーハンドリングを追加
PRレビュー指摘対応。loadEvents()でJSONL各行のパース失敗時にクラッシュせず
静かにスキップするよう修正(skill-stats.jsと同様のパターン)。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 16:45:20 +09:00
Pregum 114c3ec89f fix(skill-usage-tracker): PRフィードバック対応 - エラーハンドリング、安全性、原子性の改善
- reset コマンドに --force フラグを追加し、誤操作を防止
- reset 実行前にバックアップを自動作成
- JSONL読み込み時の行ごとエラーハンドリングを追加
- 大量データ(1000件超)同期時の警告メッセージを追加
- ファイルロック機構を実装し、同時書き込みによるデータ破損を防止
- バージョンを0.4.2に更新

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum 2bd77da2b6 docs(skill-usage-tracker): README.mdを最新の機能に合わせて更新
- JSONL形式への移行を反映
- Notion同期機能のセットアップ手順を追加
- /skill-stats setup コマンドの使用方法を追加
- ファイル構成とトラブルシューティングを更新

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum 81a7a8fe1e feat(skill-usage-tracker): setupコマンドを追加
notion_config.jsonを簡単に作成できるsetupサブコマンドを追加。

使用例:
  skill-stats.js setup <skill_db_id> <command_db_id>

- UUID形式のバリデーション
- 既存設定の表示
- 設定完了後の案内メッセージ

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum 2d77575f93 fix(skill-usage-tracker): データベースIDを設定ファイル管理に変更
ハードコードされていたNotion DB IDをnotion_config.jsonで管理するように変更。
公開リポジトリでの機密情報露出を防止。(Issue #71)

- loadNotionConfig()関数を復活
- 設定ファイルがない場合に設定方法を案内
- バージョンを0.4.1に更新

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum c8813af36f fix(skill-usage-tracker): marketplace.jsonのバージョンをplugin.jsonと統一
バージョン番号を 0.1.1 から 0.4.0 に更新し、
descriptionにNotion同期機能を追記

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum 899236d259 feat(skill-usage-tracker): Notion MCP直接呼び出しに変更
/skill-stats sync を実行するとClaudeが自動的にNotion MCPを呼び出して
データを同期するように変更。DB IDをskillファイルに埋め込み、
notion_config.json設定ファイルを不要に。

- setup サブコマンドを削除
- sync出力形式をNotion MCP用SQLite風形式に変更
- loadNotionConfig(), outputSetupInfo() を削除

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum a8ef145de3 feat(skill-usage-tracker): add Notion database sync support
Add /skill-stats setup and /skill-stats sync commands to enable
syncing usage events to Notion databases for team-wide analytics.

- setup: outputs Notion database schema for creation via MCP
- sync: outputs unsynced events with Notion-formatted properties
- Supports sync_state.json for tracking synced lines
- Supports notion_config.json for database IDs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum 162216dc5a feat(skill-usage-tracker): データ保存形式をJSONからJSONLに移行
- 保存先を ~/.claude/hooks/state/ から ~/.claude/hooks/logs/ に変更
- ファイル形式を1行1イベントのJSONL形式に変更し追記効率を向上
- マイグレーションスクリプト bin/migrate-to-jsonl.js を追加
- バージョンを 0.1.1 から 0.2.0 に更新

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum 23654d2786 test: hookスクリプトの実行可能性テストを追加
- testHookScriptsExecutable関数を追加
- 全てのhookスクリプトが実行可能か検証

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum 2efb1c80c2 docs: CHANGELOGを追加し、hooks設定のテストを追加
- CHANGELOG.mdを追加(v0.1.0とv0.1.1の変更履歴)
- hooks.test.jsを追加
  - hooks.jsonが有効なJSONかを検証
  - 全てのhooksにasync: trueが設定されているかを検証
  - 必要なhookタイプが設定されているかを検証
  - hookコマンドのファイルが存在するかを検証

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum 6fab6f0ce3 feat(skill-usage-tracker): hooksをasync実行に変更し、v0.1.1にバージョンアップ
- 全てのhooksにasync: trueを追加してバックグラウンド実行を有効化
- Claude Codeの実行をブロックしないように改善
- バージョンを0.1.0から0.1.1に更新

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:25:43 +09:00
Pregum 0ce3036801 feat: add UserPromptSubmit hook for direct slash command tracking
- Add user_prompt_command_counter.js to detect slash commands in user prompts
- Update hooks.json with UserPromptSubmit hook configuration
- Records events with source: "user_prompt" to distinguish from tool invocations

This enables tracking when users directly type slash commands (e.g., /command),
which previously wasn't captured by the PostToolUse SlashCommand hook.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 15:16:07 +09:00
Pregum 65dc3192f1 feat: add slash command usage tracking
- Add slash_command_counter.js hook to record SlashCommand tool usage
- Update hooks.json to trigger counter on PostToolUse for SlashCommand
- Enhance skill-stats.js to display both skill and command statistics
- Add reset option to skill-stats.js for clearing usage data

Note: This only tracks when Claude programmatically invokes slash
commands via the SlashCommand tool, not direct user input.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 15:09:30 +09:00
Pregum a8b5d3cc57 fix: remove error details from log messages to prevent info leakage
- Remove error.message from loadEventsData() catch block
- Remove error.message from saveEventsData() catch block
- Remove redundant main().catch() handler (already handled inside main)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 14:40:25 +09:00
Pregum f910df823c fix: add event validation and update descriptions to match implementation
- Add validation for event.skill in skill_usage_sender.js
- Update plugin.json description to reflect local-only storage
- Update marketplace.json description and features to match current implementation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:27:08 +09:00
Pregum 02fd4e0b7e fix: add error handling and async I/O, add privacy section
- Add catch handler to main() for unhandled promise rejections
- Use fs.promises for async file I/O operations
- Add privacy and data handling section to README

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:27:08 +09:00
Pregum 3dbc883ab4 chore: remove unused sendRegistration.js
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:27:08 +09:00
Pregum 989a99b5d0 docs: update README with collected data details and troubleshooting
- Add table explaining collected data (git config, context info)
- Document /skill-stats custom command
- Add troubleshooting for permission denied errors
- Note that Stop hook doesn't work with Ctrl+C

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:27:08 +09:00
Pregum 9c7c52ed2e feat: add skill-stats command for usage summary
- Add bin/skill-stats.js for displaying skill usage statistics
- Add commands/skill-stats.md as custom slash command

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:27:08 +09:00
Pregum 2f9f9fc8c7 feat: add skill usage tracking with timestamp and user info
- Enhance skill_usage_counter.js to record detailed event data
  - Timestamp, user info (git config), context (project, branch, hostname)
- Add skill_usage_sender.js for Stop hook to display usage summary
- Update hooks.json to include Stop hook
- Simplify README for current feature scope

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:27:08 +09:00
Pregum ce2b6c858f refactor: simplify skill-usage-tracker plugin configuration
- Remove tools configuration from plugin.json (keep hooks only)
- Move sendRegistration.js from tools/ to root directory

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:27:08 +09:00
Pregum d19eddbf34 Add skill-usage-tracker plugin for monitoring skill invocations
This plugin provides two main features:
1. Automatic skill usage counting via PostToolUse hook
2. Custom command to send registration data with usage statistics

Features:
- Tracks skill invocations automatically through PostToolUse hook
- Stores usage counts in ~/.claude/hooks/state/skill_usage_counts.json
- Provides sendRegistration command to POST data to external services
- Configurable endpoint URL via environment variables or CLI args
- Combines user payload with skill usage statistics

Technical details:
- Requires Node.js 18.0.0+ (for native fetch API support)
- Hook matcher: "Skill" tool
- Data persistence: JSON file storage
- Executable scripts with proper permissions

Author: HINO, Yasushi <y.hino@xtone.co.jp>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:27:07 +09:00