Commit Graph

13 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 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 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 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