Skip to content

feat(cli): persist project-scoped prompt history - #1132

Draft
lifelmy wants to merge 6 commits into
CodebuffAI:mainfrom
lifelmy:agent-tasks/1125
Draft

feat(cli): persist project-scoped prompt history#1132
lifelmy wants to merge 6 commits into
CodebuffAI:mainfrom
lifelmy:agent-tasks/1125

Conversation

@lifelmy

@lifelmy lifelmy commented Aug 26, 2026

Copy link
Copy Markdown

Summary

Closes #1125.

  • persist CLI prompt history per project by default while preserving the existing global history path behind FREEBUFF_HISTORY_SCOPE=global
  • cap persisted history at 500 entries by default and collapse consecutive duplicate prompts
  • add FREEBUFF_HISTORY_SIZE=0 as an explicit off switch for prompt history persistence
  • document the plaintext on-disk history behavior and configuration in the CLI README
  • keep recalled entries editable before resubmission through the existing up/down recall flow

Testing

  • bun install
  • ./node_modules/.bin/prettier --write cli/README.md cli/src/chat.tsx cli/src/hooks/use-input-history.ts cli/src/utils/message-history.ts cli/src/utils/tests/message-history.test.ts
  • git diff --check
  • bun test cli/src/utils/tests/message-history.test.ts cli/src/hooks/tests/use-input-history.test.ts cli/src/utils/tests/keyboard-actions.test.ts cli/src/utils/tests/chat-input-key-intercept.test.ts — 111 pass, 0 fail, 213 expect() calls
  • bun run build:sdk
  • bun run build:freebuff

Notes

I also tried the broader CLI checks. cd cli && bun run typecheck currently fails because this checkout is missing existing dependencies/types for tar and react-dom/server; cd cli && bun run test currently fails before running tests because cli/bunfig.toml preloads missing ../test/setup-scm-loader.ts.

I use a coding assistant to help implement, and I review and take responsibility for the final change.

@lifelmy

lifelmy commented Aug 26, 2026

Copy link
Copy Markdown
Author

Refreshed this branch onto the latest public main; new head is 15effff45. The merge completed cleanly and only incorporated upstream public snapshot updates. The PR diff remains scoped to project-scoped CLI prompt history and the related docs/tests.

Verification on 15effff45:

  • git diff --check -> clean
  • bun test cli/src/utils/__tests__/message-history.test.ts cli/src/hooks/__tests__/use-input-history.test.ts cli/src/utils/__tests__/keyboard-actions.test.ts cli/src/utils/__tests__/chat-input-key-intercept.test.ts -> 111 pass / 0 fail
  • bun run build:sdk -> build complete
  • bun run build:freebuff -> build complete

Broader local CLI checks still hit the same pre-existing environment/dependency gaps as before: cd cli && bun run typecheck is blocked by missing tar and react-dom/server declarations, and cd cli && bun run test is blocked by missing ../test/setup-scm-loader.ts preload.

I use a coding assistant to help implement, and I review and take responsibility for the final change.

@lifelmy

lifelmy commented Aug 26, 2026

Copy link
Copy Markdown
Author

Updated once more after public main advanced again; new head is 673295c08. The merge completed cleanly and only incorporated the latest upstream public snapshot changes. The PR diff remains scoped to project-scoped CLI prompt history and the related docs/tests.

Verification on 673295c08:

  • git diff --check -> clean
  • bun test cli/src/utils/__tests__/message-history.test.ts cli/src/hooks/__tests__/use-input-history.test.ts cli/src/utils/__tests__/keyboard-actions.test.ts cli/src/utils/__tests__/chat-input-key-intercept.test.ts -> 111 pass / 0 fail
  • bun run build:sdk -> build complete
  • bun run build:freebuff -> build complete

Broader local CLI checks still hit the same pre-existing environment/dependency gaps as before: cd cli && bun run typecheck is blocked by missing tar and react-dom/server declarations, and cd cli && bun run test is blocked by missing ../test/setup-scm-loader.ts preload.

I use a coding assistant to help implement, and I review and take responsibility for the final change.

@lifelmy

lifelmy commented Aug 27, 2026

Copy link
Copy Markdown
Author

Refreshed this draft PR onto the latest public main; new head is 89124cbb. The merge completed without manual conflicts and only incorporated upstream public snapshot updates (bun.lock, common/src/constants/freebuff-ads.ts).

Verification run after the refresh:

  • git diff --check
  • bun test cli/src/utils/__tests__/message-history.test.ts cli/src/hooks/__tests__/use-input-history.test.ts cli/src/utils/__tests__/keyboard-actions.test.ts cli/src/utils/__tests__/chat-input-key-intercept.test.ts (111 pass / 0 fail)
  • bun run build:sdk
  • bun run build:freebuff

I use a coding assistant to help implement, and I review and take responsibility for the final change.

@lifelmy

lifelmy commented Aug 27, 2026

Copy link
Copy Markdown
Author

Refreshed this draft PR onto current public main; new head is 55cffdd0d. The merge completed without manual conflicts and only brought in the upstream common/src/types/freebuff-session.ts change.

Verified after refresh:

  • git diff --check
  • bun test cli/src/utils/__tests__/message-history.test.ts cli/src/hooks/__tests__/use-input-history.test.ts cli/src/utils/__tests__/keyboard-actions.test.ts cli/src/utils/__tests__/chat-input-key-intercept.test.ts (111 pass / 0 fail / 213 expects)
  • bun run build:sdk
  • bun run build:freebuff

I use a coding assistant to help implement, and I review and take responsibility for the final change.

@lifelmy

lifelmy commented Aug 27, 2026

Copy link
Copy Markdown
Author

Refreshed this draft PR onto the latest public main; new head is 83b7cdfdb. The merge completed without manual conflicts and only incorporated the latest upstream public snapshot updates (README*, free-model catalog/constants/tests, and related CLI settings coverage). The project-scoped prompt history diff remains unchanged.

Verification after refresh:

  • bun test cli/src/utils/__tests__/message-history.test.ts cli/src/hooks/__tests__/use-input-history.test.ts cli/src/utils/__tests__/keyboard-actions.test.ts cli/src/utils/__tests__/chat-input-key-intercept.test.ts -> 111 pass / 0 fail
  • bun run build:sdk -> success
  • bun run build:freebuff -> success
  • cd cli && bun run typecheck -> still fails in pre-existing workspace files because tar and react-dom/server declarations are missing; no new failures attributable to this PR

I use a coding assistant to help implement, and I review and take responsibility for the final change.

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.

Feature: Up/Down arrow prompt-history recall in the input boxes (CLI + Desktop)

1 participant