hiiro 0.1.306 → 0.1.308.pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c183cf3e7fe7b583062f06764f09217bf361884d993bf9e50ce57ea8244a82e
4
- data.tar.gz: d93c261665ed81c3dcfee23fd3fe885b2ed5e8b980a23075486b1d9de35cfe11
3
+ metadata.gz: 5133c5b05e6f2040b092c49a8ff75a1e665f9506d5a6b7afc9078dcd9c3d20a2
4
+ data.tar.gz: bea25caa37de50a810b76b72b8eebe5eb1fd37141542aaea21da1932e3dbae9d
5
5
  SHA512:
6
- metadata.gz: f64a5fb53855bb8968b48598224ad5b6a11ec18f64a6985141b8fb547a54aad9be36ed4b64c6f815eb7d5fbfdcda7d57f168d9754840f06632e2b9343a5f2b50
7
- data.tar.gz: 85f1544552f1137f8222ae2fe8bbf48c61a79838f76352743ad367941175216ee9945f2b55cd2007c5ad58045a165d978d7cdbf1c79d090d104ff5f9f4090a7d
6
+ metadata.gz: 321291e9a574a533d3647c7c4a54040fdbf993c174923958a4d1fdb7936bee373c838c689ca10fb50b48940d4a9aefc662c4a72714442271c7180eccf82d748f
7
+ data.tar.gz: 15d46bd5f44affa4fb6418f6f76e61cef848a4ade2a975cba450825aeb730da8362fbc0a885241bad31bae4969f752063de95d9143ab72127576850cf3c4e804
data/CHANGELOG.md CHANGED
@@ -1,6 +1,57 @@
1
1
  ```markdown
2
2
  # Changelog
3
3
 
4
+ ## [0.1.308.pre.1] - 2026-03-31
5
+
6
+ ### Added
7
+ - `Hiiro::Effects` injectable interface for testable file system and command execution
8
+ - `null_fs` to `TestHarness` for testing without side effects
9
+ - Effects helpers and accessors to `TestHarness` for controlled effect simulation
10
+ - `Hiiro::Invocation` and `Hiiro::InvocationResolution` tracking in PaneHome SQLite migration
11
+
12
+ ### Changed
13
+ - Refactor effects layer: expose `executor` and `fs` as accessors on `Hiiro::Effects`
14
+ - `h-db` command now includes h-pane in SQLite migration
15
+ - Gem version handling: treat non-main branches as pre-release in publish script
16
+
17
+ ### Fixed
18
+ - `h-branch co` and `h-branch rm` restore extra argument pass-through
19
+ - Test suite: add missing `TestHarness` stubs and fix pre-existing test failures
20
+ - Test fixtures: anchor `load_bin` path to project root instead of `Dir.pwd`
21
+
22
+ ### Deprecated
23
+ - `SystemCallCapture` — use `Hiiro::Effects` helpers in `TestHarness` instead
24
+
25
+ ## [Unreleased]
26
+
27
+ ### Added
28
+ - `Hiiro::DB` — SQLite foundation via Sequel; `DB.setup!` creates all tables, `DB.connection` establishes connection eagerly at load time; supports `HIIRO_TEST_DB=sqlite::memory:` for tests
29
+ - `lib/hiiro/db.rb` — one-time YAML→SQLite migration (`migrate_yaml!`) guarded by `schema_migrations` table; dual-write mode (`dual_write?` / `disable_dual_write!`) for gradual cutover
30
+ - `lib/hiiro/branch.rb` — `Hiiro::Branch` Sequel model for worktree branch records
31
+ - `lib/hiiro/tracked_pr.rb` — `Hiiro::TrackedPr` Sequel model for tracked PR records (`:prs` table)
32
+ - `lib/hiiro/link.rb` — `Hiiro::Link` Sequel model with `matches?`, `display_string`, `to_h` helpers
33
+ - `lib/hiiro/project.rb` — `Hiiro::Project` Sequel model
34
+ - `lib/hiiro/pane_home.rb` — `Hiiro::PaneHome` Sequel model with `data_json` JSON blob
35
+ - `lib/hiiro/pin_record.rb` — `Hiiro::PinRecord` Sequel model for per-command key-value pin storage
36
+ - `lib/hiiro/task_record.rb` — `Hiiro::TaskRecord` Sequel model for task metadata
37
+ - `lib/hiiro/app_record.rb` — `Hiiro::AppRecord` Sequel model for app directory mappings
38
+ - `lib/hiiro/assignment.rb` — `Hiiro::Assignment` Sequel model for worktree→branch assignments
39
+ - `lib/hiiro/reminder.rb` — `Hiiro::Reminder` Sequel model
40
+ - `lib/hiiro/invocation.rb` — `Hiiro::Invocation` and `Hiiro::InvocationResolution` Sequel models; every CLI invocation is recorded to SQLite for history/analytics
41
+ - `bin/h-db` — new subcommand: `h db status`, `h db tables`, `h db q <sql>`, `h db migrate`, `h db restore`
42
+
43
+ ### Changed
44
+ - `lib/hiiro/todo.rb` — `TodoItem` is now a `Sequel::Model`; `TodoManager` reads/writes via SQLite with YAML dual-write fallback
45
+ - `lib/hiiro/tags.rb` — `Tag` is now a `Sequel::Model`; tag operations persist to SQLite with YAML dual-write fallback
46
+ - `lib/hiiro/pinned_pr_manager.rb` — `PinnedPR` is now a `Sequel::Model` (`lib/hiiro/pinned_pr.rb`); `PinnedPRManager` reads/writes via SQLite with YAML dual-write
47
+ - `lib/hiiro/projects.rb` — `Projects#from_config` reads from `Hiiro::Project` SQLite model with YAML fallback
48
+ - `lib/hiiro/tasks.rb` — `TaskManager::Config` reads/writes tasks and apps via `Hiiro::TaskRecord` and `Hiiro::AppRecord` SQLite models
49
+ - `bin/h-branch` — `BranchManager` reads/writes via `Hiiro::Branch` and `Hiiro::TrackedPr` SQLite models with YAML dual-write fallback; adds `q`/`query` subcommands for raw SQL inspection
50
+ - `bin/h-link` — reads/writes links via `Hiiro::Link` SQLite model with YAML dual-write fallback; adds `q`/`query` subcommands
51
+ - `bin/h-pane` — load/save pane homes via `Hiiro::PaneHome` model with YAML dual-write
52
+ - `bin/h-pr` — adds `q`/`query` subcommands for inspecting PR records via raw SQL
53
+ - `plugins/pins.rb` — `Pin` class reads/writes via `Hiiro::PinRecord` SQLite model with YAML dual-write fallback
54
+
4
55
  ## [0.1.306] - 2026-03-30
5
56
 
6
57
  ### Changed
data/CLAUDE.md CHANGED
@@ -221,6 +221,38 @@ git.move_worktree(from, to) # Rename worktree
221
221
  git.current_pr # Get current PR info
222
222
  ```
223
223
 
224
+ ### Hiiro::DB (lib/hiiro/db.rb)
225
+
226
+ SQLite persistence layer backed by Sequel. All data is stored in `~/.config/hiiro/hiiro.db`.
227
+
228
+ **Setup:** `Hiiro::DB.setup!` is called at startup — creates any missing tables, then runs a one-time YAML→SQLite migration if the DB is new.
229
+
230
+ **Model registration:** Each Sequel model calls `Hiiro::DB.register(self)` so `setup!` can create its table:
231
+
232
+ ```ruby
233
+ class Hiiro::MyModel < Sequel::Model(:my_table)
234
+ Hiiro::DB.register(self)
235
+
236
+ def self.create_table!(db)
237
+ db.create_table?(:my_table) do
238
+ primary_key :id
239
+ String :name, null: false
240
+ end
241
+ end
242
+ end
243
+ ```
244
+
245
+ **Dual-write:** During rollout, models write to both SQLite and YAML. Once migration is stable, call `Hiiro::DB.disable_dual_write!` to stop YAML writes.
246
+
247
+ **Test isolation:** Set `ENV['HIIRO_TEST_DB'] = 'sqlite::memory:'` before requiring `hiiro` to get a clean in-memory DB per test run. Call `Hiiro::DB.setup!` after require.
248
+
249
+ **`h db` subcommand:** Inspect and manage the database:
250
+ - `h db status` — show connection info and migration state
251
+ - `h db tables` — list all tables with row counts
252
+ - `h db q <sql>` — run raw SQL and print results
253
+ - `h db migrate` — re-run YAML import (if not yet migrated)
254
+ - `h db restore` — restore YAML files from SQLite data
255
+
224
256
  ### Hiiro::Fuzzyfind (lib/hiiro/fuzzyfind.rb)
225
257
 
226
258
  Integration with `sk` (skim) or `fzf` fuzzy finders:
@@ -246,6 +278,26 @@ tm.active # Items not done/skipped
246
278
  tm.filter_by_task("feature") # Items for specific task
247
279
  ```
248
280
 
281
+ ### Invocation Tracking (lib/hiiro/invocation.rb)
282
+
283
+ Every CLI invocation is automatically recorded to SQLite via `Hiiro::Invocation` and `Hiiro::InvocationResolution`. This happens in `Hiiro.init` — no extra setup needed.
284
+
285
+ **Schema:**
286
+ - `Hiiro::Invocation` — records `bin_name`, `argv_json`, `cwd`, `invoked_at`
287
+ - `Hiiro::InvocationResolution` — linked to an invocation; records `resolved_name`, `resolution_type` (exact/prefix/abbreviated), `subcmd`
288
+
289
+ **Query recent invocations:**
290
+ ```ruby
291
+ Hiiro::Invocation.order(Sequel.desc(:invoked_at)).limit(20).each do |inv|
292
+ puts "#{inv.invoked_at} #{inv.bin_name} #{JSON.parse(inv.argv_json).join(' ')}"
293
+ end
294
+ ```
295
+
296
+ Or via `h db q`:
297
+ ```bash
298
+ h db q "SELECT bin_name, argv_json, invoked_at FROM invocations ORDER BY invoked_at DESC LIMIT 10"
299
+ ```
300
+
249
301
  ### Hiiro::Shell (lib/hiiro/shell.rb)
250
302
 
251
303
  Utility for piping content to external commands: