Skip to content

feat(skill): finish EPIC #272 — Task 6 snooze/dismiss write-path + Task 9 provisioning - #354

Merged
getappz merged 2 commits into
masterfrom
task/272
Jul 28, 2026
Merged

feat(skill): finish EPIC #272 — Task 6 snooze/dismiss write-path + Task 9 provisioning#354
getappz merged 2 commits into
masterfrom
task/272

Conversation

@getappz

@getappz getappz commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

Test plan

  • cargo test --bin agentflare skill_proactive:: — 3/3 new tests pass
  • cargo test --bin agentflare cli::skill:: — 10/10 pass (7 new)
  • cargo test --workspace — 853 passed, 0 failed
  • cargo clippy --workspace --all-targets --all-features -- -D warnings -A unsafe_code -A clippy::pedantic — clean
  • cargo fmt --check — clean

Summary by CodeRabbit

  • New Features

    • Added agentflare skill subcommands to snooze skill suggestions (default 7 days) or dismiss them.
    • Added automatic skill provisioning driven by detected project type, with a recommended-skills preview by default.
    • Added --yes to apply provisioning (and record newly provisioned skills for future reference).
  • Bug Fixes

    • Skill preference and override changes now persist reliably, including creating overrides for previously unknown skills while preserving existing snooze/dismiss state.
  • Tests

    • Extended coverage for stack detection, ranking/confidence behavior, and empty-input handling.

Task 6 (proactive advisory): proactive_suggestions()/settings read-path
already existed (PR #302) but had no way to actually set a snooze or
dismiss - save_settings() was dead code. Add `skill snooze <name>
[--days N]` and `skill dismiss <name>` wired to it.

Task 9 (repo stack -> auto provisioning): new `skill provision <path>`
subcommand. Detects stack via manifest files (Cargo.toml/package.json/
tsconfig.json/pyproject.toml/requirements.txt/go.mod), ranks indexed
skills against it via BM25 search, prints a dry-run report (skills,
confidence, token cost) with zero DB writes, and on --yes re-tags the
matched entries under source "provisioned:<repo>" via the existing
scan+rebuild entry-creation path.
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5bd5209c-ada9-4d92-84ce-5a497128ed14

📥 Commits

Reviewing files that changed from the base of the PR and between 2e0827e and cc956fb.

📒 Files selected for processing (2)
  • src/cli/skill.rs
  • src/skill_proactive.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/skill_proactive.rs
  • src/cli/skill.rs

📝 Walkthrough

Walkthrough

Adds agentflare skill snooze, dismiss, and provision commands. Snooze and dismissal settings are persisted, while provisioning detects repository stacks, ranks matching skills, supports dry runs, and rebuilds the skills database.

Changes

Skill management

Layer / File(s) Summary
Persistent proactive overrides
src/skill_proactive.rs
Adds persistent snooze and dismissal updates, preserves existing override fields, creates missing overrides, and tests helper behavior.
CLI actions and skill provisioning
src/cli/skill.rs
Adds the new subcommands, dispatches their handlers, detects repository stacks, ranks candidates, supports dry-run provisioning, and writes provisioned database entries with validation tests.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SkillCLI
  participant skill_proactive
  participant SettingsFile
  SkillCLI->>skill_proactive: snooze or dismiss skill
  skill_proactive->>SettingsFile: load settings
  skill_proactive->>SettingsFile: save updated override
Loading
sequenceDiagram
  participant SkillCLI
  participant detect_stack
  participant rank_candidates
  participant SkillsDB
  SkillCLI->>detect_stack: inspect repository manifests
  detect_stack-->>SkillCLI: detected stack tags
  SkillCLI->>rank_candidates: search index with stack tags
  rank_candidates-->>SkillCLI: ranked skill candidates
  SkillCLI->>SkillsDB: rebuild with provisioned:path entries
Loading

Possibly related PRs

  • getappz/agentflare#302: Provides the JSON-backed proactive advisory settings extended by these snooze and dismiss commands.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: snooze/dismiss write-path plus provisioning for skill commands.
Description check ✅ Passed The description is mostly complete with clear Summary and Test plan sections; only the Notes for reviewers section is missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/272

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
src/skill_proactive.rs (1)

172-230: 📐 Maintainability & Code Quality | 🔵 Trivial

Good coverage of the override-preservation semantics.

Tests correctly verify apply_snooze/apply_dismiss create/update overrides and preserve the sibling field. Note the public snooze()/dismiss() entry points (epoch computation, days clamping, save_settings round-trip) remain untested — consider adding coverage similar to the with_temp_home pattern used elsewhere in the codebase.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/skill_proactive.rs` around lines 172 - 230, The existing tests cover the
internal override helpers but not the public snooze() and dismiss() entry
points. Add tests using the established with_temp_home pattern to verify epoch
computation, days clamping, and save_settings round-trip behavior through those
public APIs, while retaining the current helper tests.
src/cli/skill.rs (1)

778-779: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Agent detection is hardcoded to claude-code only.

default_sources supports conditionally including codex/cursor/opencode conventional directories when those agents are detected, but provisioning always passes &["claude-code".to_string()], so those dirs are never scanned even if present.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/skill.rs` around lines 778 - 779, Update the source initialization in
the skill provisioning flow around skill_registry::sources::default_sources to
pass the agents detected from the environment instead of a hardcoded
["claude-code"] list. Reuse the existing agent-detection mechanism and preserve
default_sources behavior so codex, cursor, and opencode directories are included
when detected.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cli/skill.rs`:
- Around line 735-810: The --yes path in run_provision rebuilds the database
from only freshly scanned sources, dropping existing DB-only and imported
entries. Before calling skill_registry::db::rebuild, load all current database
entries through the existing list-all query/API and merge them with the scanned
entries and newly tagged provisioned entries, deduplicating by the registry’s
entry identity while preserving the new provisioned:{path} records.
- Around line 706-733: Update rank_candidates to retain the lowest score for
each skill name and sort ranked results in ascending score order, matching FTS5
ordering. In the confidence display near the ranking output, replace the current
raw-score normalization with a monotonic bounded conversion that never produces
negative percentages and caps at 100%.

In `@src/skill_proactive.rs`:
- Around line 80-89: Update snooze() to compute the nonnegative duration with
saturating arithmetic so arbitrarily large days cannot overflow during
multiplication or when adding now. Preserve the existing behavior for valid
nonnegative values and continue passing the resulting timestamp to apply_snooze.

---

Nitpick comments:
In `@src/cli/skill.rs`:
- Around line 778-779: Update the source initialization in the skill
provisioning flow around skill_registry::sources::default_sources to pass the
agents detected from the environment instead of a hardcoded ["claude-code"]
list. Reuse the existing agent-detection mechanism and preserve default_sources
behavior so codex, cursor, and opencode directories are included when detected.

In `@src/skill_proactive.rs`:
- Around line 172-230: The existing tests cover the internal override helpers
but not the public snooze() and dismiss() entry points. Add tests using the
established with_temp_home pattern to verify epoch computation, days clamping,
and save_settings round-trip behavior through those public APIs, while retaining
the current helper tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4be30e5a-f092-499f-b62d-a3b5b5f4c895

📥 Commits

Reviewing files that changed from the base of the PR and between 8458e0d and 2e0827e.

📒 Files selected for processing (2)
  • src/cli/skill.rs
  • src/skill_proactive.rs

Comment thread src/cli/skill.rs
Comment thread src/cli/skill.rs
Comment thread src/skill_proactive.rs
- rank_candidates picked the highest bm25 score as "best" and sorted
  descending; bm25 is negative-is-better (search.rs sorts ASC on the
  same raw value), so this had it backwards. Flip to min-selection +
  ascending sort, add confidence_pct() for a bounded 0-100 display
  value instead of the broken score.min(1.0)*100.0.
- run_provision --yes rebuilt the DB from a fresh flat-dir scan only,
  and rebuild() is full-replace -- silently dropping any other
  provisioned:*/imported:*/hub:* DB-only rows on every run. Merge
  existing DB rows (via list_all_name_source_pairs + load, same
  reconstruction run_export already uses) before rebuilding, mirroring
  HubAction::Pull's merge-before-rebuild shape.
- Use crate::components::detected_skill_agents() instead of a
  hardcoded ["claude-code"] source list.
- snooze() clamped days to >=0 but not the upper bound; saturating_add
  from a large --days no longer risks i64 overflow.
- New adversarial rank_candidates test (two same-tag matches of
  different strength) -- the previous test had only one candidate per
  tag, so it couldn't have caught the sign inversion.
@getappz
getappz merged commit 8f7534b into master Jul 28, 2026
16 checks passed
@getappz
getappz deleted the task/272 branch July 28, 2026 05:33
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