Skip to content

FEAT: raycast extension b/c why tf not#111

Open
bmdavis419 wants to merge 4 commits intomainfrom
davis/raycast-btca
Open

FEAT: raycast extension b/c why tf not#111
bmdavis419 wants to merge 4 commits intomainfrom
davis/raycast-btca

Conversation

@bmdavis419
Copy link
Collaborator

@bmdavis419 bmdavis419 commented Jan 24, 2026

plan put together

plan put together

raycast first exploration done, needs ui pass

Greptile Overview

Greptile Summary

This PR implements a Raycast extension for Better Context, allowing users to ask questions with @resource tagging directly from Raycast. The implementation includes new backend HTTP endpoints for authentication and streaming responses, along with a complete Raycast extension UI.

Key changes:

  • Added /raycast/resources and /raycast/ask HTTP endpoints with API key authentication
  • Created raycastAuth.ts for API key validation and raycastUsage.ts for billing integration
  • Built Raycast extension with SSE streaming support and resource tagging
  • Added Raycast documentation resource to btca.config.jsonc
  • Minor UI fix in layout.svelte (removed flex-wrap)

Issues found:

  • RAYCAST-EXTENSION.md plan file should be removed before merging (per repository instructions to check for plan files)
  • Usage tracking in /raycast/ask endpoint uses hardcoded 0 values instead of actual token counts and metrics, which could cause billing inaccuracies

Notes:

  • Check that the Convex deployment URL (https://greedy-partridge-784.convex.site) is correct for production
  • Verify API key generation and hashing in apiKeys.ts meets security requirements
  • Ensure all Raycast extension dependencies are compatible

Confidence Score: 4/5

  • Safe to merge with minor issues that should be addressed
  • The implementation is well-structured and follows good patterns. The main concern is the hardcoded usage tracking (0 values) which could cause billing issues. The plan file should also be removed. Otherwise, the code is clean, properly authenticated, and doesn't break existing features.
  • Pay attention to apps/web/src/convex/http.ts (usage tracking) and remove RAYCAST-EXTENSION.md

Important Files Changed

Filename Overview
RAYCAST-EXTENSION.md Implementation plan document - should be removed before merge per repository instructions
apps/raycast/src/ask.tsx Raycast command UI with form input and streaming response display
apps/web/src/convex/raycastAuth.ts Authentication helper for Raycast HTTP endpoints using API key validation
apps/web/src/convex/raycastUsage.ts Raycast-specific usage tracking and billing integration with Autumn
apps/web/src/convex/http.ts Added Raycast endpoints /raycast/resources and /raycast/ask with SSE streaming; usage tracking has hardcoded 0 values

@bmdavis419 bmdavis419 changed the title plan put together FEAT: raycast extension b/c why tf not Jan 24, 2026
@bmdavis419 bmdavis419 marked this pull request as ready for review January 24, 2026 02:02
Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +930 to +937

reader.releaseLock();

// Finalize usage using internal Raycast-specific action (no JWT auth)
await ctx.runAction(internal.raycastUsage.finalizeUsageForRaycast, {
instanceId: instance._id,
questionTokens: 0, // Simplified for RayCast
outputChars: 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

usage finalization called with hardcoded 0 values - actual token counts and usage metrics not being tracked

Suggested change
reader.releaseLock();
// Finalize usage using internal Raycast-specific action (no JWT auth)
await ctx.runAction(internal.raycastUsage.finalizeUsageForRaycast, {
instanceId: instance._id,
questionTokens: 0, // Simplified for RayCast
outputChars: 0,
// Finalize usage using internal Raycast-specific action (no JWT auth)
// TODO: Track actual token counts and output metrics
await ctx.runAction(internal.raycastUsage.finalizeUsageForRaycast, {
instanceId: instance._id,
questionTokens: inputTokens, // Use actual calculated tokens
outputChars: accumulatedChars, // Track accumulated output
reasoningChars: 0,
resources,
sandboxUsageHours: sandboxUsageHours
});
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/src/convex/http.ts
Line: 930:937

Comment:
usage finalization called with hardcoded 0 values - actual token counts and usage metrics not being tracked

```suggestion
				// Finalize usage using internal Raycast-specific action (no JWT auth)
				// TODO: Track actual token counts and output metrics
				await ctx.runAction(internal.raycastUsage.finalizeUsageForRaycast, {
					instanceId: instance._id,
					questionTokens: inputTokens, // Use actual calculated tokens
					outputChars: accumulatedChars, // Track accumulated output
					reasoningChars: 0,
					resources,
					sandboxUsageHours: sandboxUsageHours
				});
```

How can I resolve this? If you propose a fix, please make it concise.

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

Comments