Skip to content

feat(ai): add ubiquitous prompt routing and richer AI context#18

Merged
dubscode merged 3 commits intomainfrom
codex/ai-ubiquitous-prompting
Mar 2, 2026
Merged

feat(ai): add ubiquitous prompt routing and richer AI context#18
dubscode merged 3 commits intomainfrom
codex/ai-ubiquitous-prompting

Conversation

@dubscode
Copy link
Copy Markdown
Contributor

@dubscode dubscode commented Mar 2, 2026

Summary

  • add CLI pre-parse routing so unknown top-level input is treated as AI prompt (dub PROMPT) and add forced --ai mode
  • add typo-guard behavior (interactive choice on TTY; fail with suggestion on non-interactive)
  • extend AI context with bounded redacted shell history and add model-native browsing with graceful fallback
  • persist invocation/browsing metadata in history entries and update tests/config defaults

Test Plan

  • pnpm typecheck
  • pnpm test
  • pnpm vitest run src/lib/ai-shortcut.test.ts src/lib/shell-history.test.ts src/lib/ai-context.test.ts src/commands/ai.test.ts

- Add pre-parse AI shortcut support for 'dub PROMPT' and '--ai'

- Add typo-guard handling with interactive/non-interactive behavior

- Extend AI context with bounded redacted shell history

- Add model-native browsing option with graceful fallback metadata

- Persist invocation and browsing metadata in command history
Copilot AI review requested due to automatic review settings March 2, 2026 03:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds “AI shortcut” CLI routing so unknown top-level input can be treated as an AI prompt, and enriches AI runs with additional context/metadata (including shell history and browsing telemetry).

Changes:

  • Introduces CLI arg preprocessing with typo-guard + --ai forced AI prompt mode, and persists invocation metadata into history.
  • Extends AI context collection to include bounded, redacted recent shell history.
  • Adds model-native web browsing provider options with graceful fallback, and expands config defaults/tests accordingly.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/lib/shell-history.ts New utility to read/parse recent zsh/bash history and redact sensitive fragments.
src/lib/shell-history.test.ts Tests for zsh/bash parsing, bounding, and redaction.
src/lib/history.ts Adds new optional metadata fields to history entries.
src/lib/history.test.ts Validates new history metadata fields round-trip.
src/lib/config.ts Adds new ai.* configuration defaults and normalizes nested config.
src/lib/config.test.ts Updates default-config expectations.
src/lib/ai-shortcut.ts New CLI preprocessing (AI shortcut fallback, typo guard, --ai forced mode).
src/lib/ai-shortcut.test.ts Tests for shortcut routing and typo guard behavior.
src/lib/ai-context.ts Adds recent shell history into AI context (configurable via options/config).
src/lib/ai-context.test.ts Updates context expectations and injects shell history in tests.
src/index.ts Hooks preprocessing into CLI startup; records invocation + browsing metadata in history.
src/commands/ai.ts Adds web-browsing provider options + graceful fallback and returns browsing telemetry.
src/commands/ai.test.ts Tests browsing provider options and graceful fallback behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/ai-context.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/lib/config.ts
Comment thread src/lib/shell-history.ts Outdated
- Respect ai.shortcutFallback.enabled before applying fallback routing

- Truncate and budget shell history before adding to AI context

- Use bounded tail reads for shell history files to avoid full-file loads
@dubscode dubscode force-pushed the codex/ai-ubiquitous-prompting branch from 1161e07 to 8bb09b4 Compare March 2, 2026 04:21
@dubscode dubscode merged commit afc0ef8 into main Mar 2, 2026
3 checks passed
@dubscode dubscode deleted the codex/ai-ubiquitous-prompting branch March 2, 2026 04:23
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.

2 participants