Skip to content

feat: expose available docs as state value#47

Merged
0xbbjoker merged 2 commits into1.xfrom
feat/expose-available-docs-as-state-value
Nov 17, 2025
Merged

feat: expose available docs as state value#47
0xbbjoker merged 2 commits into1.xfrom
feat/expose-available-docs-as-state-value

Conversation

@0xbbjoker
Copy link
Copy Markdown

@0xbbjoker 0xbbjoker commented Nov 17, 2025

Small PR exposing available docs as state value for easy prompt binding.


Note

Enhances the documents provider to return formatted available documents (with count) via new values fields, updates error/empty handling, bumps version to 1.5.15, and refreshes dependencies.

  • Provider (src/documents-provider.ts):
    • Add new values fields: documentsCount, availableDocuments; keep documents (concise list).
    • Generate formatted document list with metadata and a header (documentsText).
    • Update all return paths (normal/empty/error/no-service) to include the new fields.
  • Release:
    • Bump version to 1.5.15 in package.json.
  • Dependencies:
    • Refresh lockfile with numerous package updates and additions (e.g., unpdf).

Written by Cursor Bugbot for commit 8ec1f18. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • Chores

    • Version bumped to 1.5.15.
  • New Features

    • Provider now returns richer document metadata: consistent document counts, formatted available-documents text, and stable handling when the knowledge service is unavailable.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 17, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Version bumped to 1.5.15 in package.json. The documents provider now always returns documentsCount, documents, and a new availableDocuments (formatted documentsText), and populates counts/empty strings on errors or when the knowledge service is unavailable.

Changes

Cohort / File(s) Summary
Version update
package.json
Version bumped from 1.5.14 to 1.5.15.
Documents provider enhancement
src/documents-provider.ts
Adds documentsCount: number, ensures documents: string is present across all branches, adds availableDocuments: string (set to documentsText), keeps text for documentsText, and updates error handling to return zeros/empty strings when the knowledge service is unavailable or errors occur.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant DocumentsProvider
    Note over DocumentsProvider: fetch/format documents & counts
    Caller->>DocumentsProvider: request documents
    DocumentsProvider-->>Caller: { documentsCount, documents, availableDocuments, text }
    alt knowledge service error / unavailable
        DocumentsProvider-->>Caller: { documentsCount: 0, documents: "", availableDocuments: "", text: "" }
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Pay attention to:
    • Correct scoping/assignment of documentsTextavailableDocuments.
    • All return branches (success, error, unavailable) include the new documentsCount, documents, and availableDocuments fields with appropriate default values.
    • Any callers of the provider that may rely on the previous return shape.

Poem

🐰 I hopped through code with nimble paws,
A count, a list — now tucked in clause.
Available texts on a silver tray,
Bumped the version, then dashed away. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: expose available docs as state value' directly and clearly summarizes the main change: adding a new state value (availableDocuments) to expose available documents.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/expose-available-docs-as-state-value

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 5d90592 and 8ec1f18.

📒 Files selected for processing (1)
  • src/documents-provider.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/documents-provider.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Service failure causes inconsistent data structure.

The values object is missing the availableDocuments field when the knowledge service is unavailable. This creates an inconsistent return type compared to the success case at line 109, which could break code that expects availableDocuments to always be present in the values object for prompt binding.

src/documents-provider.ts#L28-L29

data: { documents: [] },
values: { documents: '' },

Fix in Cursor Fix in Web


Bug: Inconsistent return type: Missing expected field.

The values object is missing the availableDocuments field when no documents are found. This creates an inconsistent return type compared to the success case at line 109, which could break code that expects availableDocuments to always be present in the values object for prompt binding.

src/documents-provider.ts#L48-L49

data: { documents: [] },
values: { documents: '' },

Fix in Cursor Fix in Web


Comment thread src/documents-provider.ts
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between f8062fa and 5d90592.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • package.json (1 hunks)
  • src/documents-provider.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (1)
package.json (1)

4-4: LGTM! Version bump is appropriate.

The patch version increment aligns with the minor feature addition of exposing available documents as a state value.

Comment thread src/documents-provider.ts
@0xbbjoker 0xbbjoker merged commit ad2e154 into 1.x Nov 17, 2025
2 checks passed
@0xbbjoker 0xbbjoker deleted the feat/expose-available-docs-as-state-value branch November 17, 2025 16:40
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