Skip to content

Add ask plugin#9

Merged
jamius19 merged 11 commits into
mainfrom
feature/add-ask-plugin
Jun 20, 2026
Merged

Add ask plugin#9
jamius19 merged 11 commits into
mainfrom
feature/add-ask-plugin

Conversation

@jamius19

@jamius19 jamius19 commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added an ask CLI command to answer questions using a provided HTTP(S) URL through a configured ask plugin.
    • Introduced the built-in builtin-ai-ask plugin, which uses configured AI provider/model settings to generate answers from fetched page content.
  • Documentation
    • Updated configuration and plugin docs for ask/builtin-ai-ask, including environment variables and updated default config examples.
    • Refreshed README command/help text and formatting.
  • Configuration
    • Updated default plugin mappings to include the ask plugin and set SIBYL_SHOW_SEARCH_DESCRIPTION=true.
  • Tests
    • Added/extended CLI and builtin-ai-ask tests for success and error handling.
  • Chores
    • Lowered the code coverage target.

@jamius19 jamius19 self-assigned this Jun 18, 2026
@jamius19 jamius19 added the enhancement New feature or request label Jun 18, 2026
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • media-kit/banner.png is excluded by !**/*.png

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 060dee77-6671-4477-ae5c-5af433c3e3c4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new builtin-ai-ask plugin that fetches a URL via the configured fetch plugin and queries an LLM (OpenAI, Anthropic, Ollama, or OpenRouter) using the Vercel AI SDK with provider/model selection via environment variables. The ask command is wired into the CLI, the plugin is registered as a builtin and included in the default config, and documentation is updated throughout.

Changes

builtin-ai-ask plugin and ask CLI command

Layer / File(s) Summary
builtin-ai-ask plugin implementation
src/plugins/builtin-ai-ask/main.ts, src/plugins/builtin-ai-ask/main.test.ts
Defines SYSTEM_PROMPT, AiProvider union, buildModel (dynamic imports for openai/anthropic/ollama/openrouter), and askFn (validates config, fetches URL via fetch plugin, calls generateText with AbortSignal.timeout, wraps errors). Exports SilbylPlugin as AskPlugin. Tests cover all error paths (missing fetch plugin, invalid provider, missing model/key, fetch failure, empty content, AI failure) and the success path.
CLI ask command dispatch and tests
src/cli.ts, src/cli.test.ts
Adds AskPlugin import, a new ask case in the command switch (URL validation + question extraction), handleAsk function (plugin lookup, fn call, result print, error exit), and updated printHelp with the new command and example. CLI tests extend setup to register the ask plugin, add dispatch/argument validation cases, and add full handleAsk test coverage (no plugin configured, missing/not loaded, success, error handling).
Plugin registration and default config
src/plugins/config.ts, src/plugins/config.test.ts, src/setup.ts, src/setup.test.ts
Imports and registers aiAsk in getBuiltinPlugins(). Updates writeDefaultSibylConfig() to include ask: "builtin-ai-ask" and a default SIBYL_SHOW_SEARCH_DESCRIPTION: "true" variable. Test fixtures updated to match.
Dependencies and documentation
package.json, CLAUDE.md, README.md, docs/CONFIGURATION.md, docs/CREATING-PLUGINS.md, codecov.yml
Adds AI SDK packages to dependencies. Updates CLAUDE.md with revised ask plugin fn contract and builtin namespace rules. Reformats README.md command table. Adds builtin-ai-ask environment variable reference table and updated default config example to docs/CONFIGURATION.md. Fixes docs/CREATING-PLUGINS.md terminology. Adjusts codecov patch coverage target to 85%.

Sequence Diagram

sequenceDiagram
  participant User
  participant sibyl as sibyl CLI
  participant handleAsk as handleAsk
  participant askFn as builtin-ai-ask askFn
  participant fetchPlugin as fetch plugin
  participant LLM as LLM provider (ai SDK)

  User->>sibyl: sibyl ask <url> <question>
  sibyl->>handleAsk: handleAsk(url, query, context)
  handleAsk->>askFn: askPlugin.fn(url, query, context)
  askFn->>fetchPlugin: fetchPlugin.fn(url, context)
  fetchPlugin-->>askFn: page content
  askFn->>LLM: generateText(model, systemPrompt, prompt+content, AbortSignal)
  LLM-->>askFn: answer text
  askFn-->>handleAsk: trimmed answer
  handleAsk-->>User: prints answer
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • postapsis/sibyl#2: Introduced the standardized SilbylPlugin contract and plugin-loader support for plugin types including ask, which this PR's builtin-ai-ask implementation directly depends on.
  • postapsis/sibyl#4: Extended PluginContext passing into plugin fn calls in src/cli.ts, which this PR's handleAsk and askPlugin.fn(url, query, context) dispatch pattern builds directly on.

Poem

🐇 A question is asked, a URL in tow,
The rabbit fetched pages and let the AI know.
With OpenAI or Ollama, whichever you choose,
The builtin-ai-ask arrives with the news.
No more searching blindly through the warren's hall —
Just sibyl ask, and the model answers all! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: adding a new ask plugin to the Sibyl CLI tool with supporting infrastructure, tests, and documentation.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/add-ask-plugin

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

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/plugins/builtin-ai-ask/main.ts 73.80% 9 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/CONFIGURATION.md (1)

8-21: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update default config example to include the ask plugin.

The example JSON on lines 8–21 shows only search, fetch, and parse plugins, but per src/setup.ts (lines 51–71), the actual default config written includes ask: "builtin-ai-ask". The example should match the implementation to avoid confusing users about what the default setup includes.

📝 Proposed fix
 {
   "plugins": {
     "search": "builtin-searxng-search",
     "fetch": "builtin-crawl4ai-fetch",
     "parse": "builtin-parse-htmlToMd"
+    "ask": "builtin-ai-ask",
   },
   "variables": [
     {
🤖 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 `@docs/CONFIGURATION.md` around lines 8 - 21, The example JSON configuration in
the CONFIGURATION.md file (lines 8–21) is missing the `ask` plugin which is
included in the actual default configuration implemented in src/setup.ts. Add
the `ask: "builtin-ai-ask"` entry to the plugins object in the example JSON so
that it matches the actual default setup and provides users with an accurate
representation of what gets configured by default.
🤖 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/plugins/builtin-ai-ask/main.test.ts`:
- Around line 19-20: The TypeScript comment directive `@ts-ignore` on the line
above mockedGenerateText.mockResolvedValue({ text }) violates the
`@typescript-eslint/ban-ts-comment` linting rule. Replace `@ts-ignore` with
`@ts-expect-error` while keeping the existing description "Complicated type,
ignoring for now" to satisfy the ESLint configuration requirement that bans
`@ts-ignore` in favor of the more explicit `@ts-expect-error` directive.

In `@src/plugins/builtin-ai-ask/main.ts`:
- Line 6: Remove the module-scope type import of LanguageModelV3 from the
`@openrouter/ai-sdk-provider` package at line 6. SDK package references are only
allowed via dynamic import() calls inside function implementations, not at
module scope. If LanguageModelV3 is needed for type annotations elsewhere in the
module, move the import inside the relevant function implementations using
dynamic import syntax instead.

---

Outside diff comments:
In `@docs/CONFIGURATION.md`:
- Around line 8-21: The example JSON configuration in the CONFIGURATION.md file
(lines 8–21) is missing the `ask` plugin which is included in the actual default
configuration implemented in src/setup.ts. Add the `ask: "builtin-ai-ask"` entry
to the plugins object in the example JSON so that it matches the actual default
setup and provides users with an accurate representation of what gets configured
by default.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f298d5ce-dad8-4e59-aa6a-924fc834c0cc

📥 Commits

Reviewing files that changed from the base of the PR and between 80de31f and 1cae901.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • CLAUDE.md
  • README.md
  • docs/CONFIGURATION.md
  • package.json
  • src/cli.ts
  • src/plugins/builtin-ai-ask/main.test.ts
  • src/plugins/builtin-ai-ask/main.ts
  • src/plugins/config.test.ts
  • src/plugins/config.ts
  • src/setup.test.ts
  • src/setup.ts

Comment thread src/plugins/builtin-ai-ask/main.test.ts Outdated
Comment thread src/plugins/builtin-ai-ask/main.ts Outdated

@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: 1

🤖 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 `@codecov.yml`:
- Line 9: The patch coverage target value has been reduced from 90% to 85% in
the codecov configuration, which weakens quality enforcement on changed code.
Either revert the target back to 90% to maintain the original quality gate, or
if the reduction is intentional, add clear documentation and rationale in the PR
description explaining why the target was lowered and include a follow-up plan
to restore it to 90%.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 542b2112-7333-467c-b936-a2e198404518

📥 Commits

Reviewing files that changed from the base of the PR and between 1cae901 and e5aaa57.

📒 Files selected for processing (5)
  • codecov.yml
  • docs/CONFIGURATION.md
  • src/cli.test.ts
  • src/plugins/builtin-ai-ask/main.test.ts
  • src/plugins/builtin-ai-ask/main.ts
✅ Files skipped from review due to trivial changes (1)
  • docs/CONFIGURATION.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/plugins/builtin-ai-ask/main.test.ts
  • src/plugins/builtin-ai-ask/main.ts

Comment thread codecov.yml
patch:
default:
target: 90%
target: 85%

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid weakening the patch coverage gate without documented rationale.

Reducing the patch target from 90% to 85% lowers quality enforcement on changed code. Please keep 90% or add a clear justification in PR docs/description and a follow-up plan to restore it.

Suggested change
-        target: 85%
+        target: 90%
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
target: 85%
target: 90%
🤖 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 `@codecov.yml` at line 9, The patch coverage target value has been reduced from
90% to 85% in the codecov configuration, which weakens quality enforcement on
changed code. Either revert the target back to 90% to maintain the original
quality gate, or if the reduction is intentional, add clear documentation and
rationale in the PR description explaining why the target was lowered and
include a follow-up plan to restore it to 90%.

@jamius19 jamius19 added the documentation Improvements or additions to documentation label Jun 20, 2026
@jamius19 jamius19 merged commit 4241176 into main Jun 20, 2026
3 checks passed
@jamius19 jamius19 deleted the feature/add-ask-plugin branch June 20, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant