Skip to content

chore: workspace block-document renames - #797

Merged
ilyabo merged 2 commits into
mainfrom
workspace-block-document-renames
Jul 6, 2026
Merged

ilyabo merged 2 commits into
mainfrom
workspace-block-document-renames

Conversation

@ilyabo

@ilyabo ilyabo commented Jul 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Updated CLI AI and command support to operate on block documents (instead of worksheet-specific tooling).
    • Added block-document actions for creating, updating, moving, and organizing blocks, including dashboard, data-table, HTML app, and map blocks.
    • Local file imports now place new data-table blocks into the correct destination block document.
  • Bug Fixes
    • Command and tool flows now consistently return and track block document IDs.
    • Improved embedded HTML app block handling when enabled, aligning tool behavior with the provided options.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bef1914c-cf70-43f9-824f-c0070ea27057

📥 Commits

Reviewing files that changed from the base of the PR and between ac9b4c3 and c85473a.

📒 Files selected for processing (2)
  • apps/sqlrooms-cli-ui/src/ai/constants.ts
  • apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/sqlrooms-cli-ui/src/ai/constants.ts
  • apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts

📝 Walkthrough

Walkthrough

This PR renames CLI worksheet-focused AI adapter, tools, agent, commands, and store wiring in apps/sqlrooms-cli-ui to block-document equivalents, replacing worksheetId with blockDocumentId throughout, and updates a related helper naming in useLocalFileLoader.

Changes

Worksheet to block-document CLI migration

Layer / File(s) Summary
CLI block-document AI adapter rename
apps/sqlrooms-cli-ui/src/createCliBlockDocumentAiAdapter.ts, apps/sqlrooms-cli-ui/src/__tests__/createCliBlockDocumentAiAdapter.test.ts
createWorksheetAiAdapter is renamed to createCliBlockDocumentAiAdapter; tests updated to construct and use the new adapter name.
Block-document AI tool constants and instructions
apps/sqlrooms-cli-ui/src/ai/constants.ts
Introduces CLI_BLOCK_DOCUMENT_AGENT_TOOL_NAME, KnownBlockDocumentTools, and EXPERIMENTAL_BLOCK_DOCUMENT_AGENT_INSTRUCTIONS, replacing worksheet-specific constants.
Block-document AI tools factory
apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAiTools.ts, apps/sqlrooms-cli-ui/src/ai/__tests__/createCliBlockDocumentAiTools.test.ts
createCliBlockDocumentAiTools replaces the worksheet tools factory, using blockDocumentId for built-in tools, hooks, and HTML-app guard logic; tests updated accordingly.
Block-document agent tool implementation
apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts
New BlockDocumentAgentResult type, updated options requiring blockDocumentAdapter, rewritten instructions using KnownBlockDocumentTools, and an execute flow returning blockDocumentId-scoped results.
Block-document CLI commands
apps/sqlrooms-cli-ui/src/createCliBlockDocumentCommands.ts, apps/sqlrooms-cli-ui/src/__tests__/createCliBlockDocumentCommands.test.ts
createCliBlockDocumentCommands replaces worksheet commands; new schemas, resolveBlockDocumentArtifact helper, and updated add/update/map-block command implementations keyed by blockDocumentId.
Block-document agent wiring
apps/sqlrooms-cli-ui/src/createBlockDocumentAgent.ts
worksheetAgentTool renamed to blockDocumentAgentTool, switching adapter and block-creation callbacks to blockDocumentId-based APIs.
Store wiring for block-document commands and agent
apps/sqlrooms-cli-ui/src/store.ts
Registers/unregisters block-document command owners, adds BLOCK_DOCUMENT_OPTIONS, and maps the AI tools registry to blockDocumentAgentTool.
Worksheet artifact id helper rename
apps/sqlrooms-cli-ui/src/components/useLocalFileLoader.ts
getCurrentOrFirstWorksheetId renamed to getCurrentOrFirstWorksheetArtifactId, used to select/create the destination worksheet artifact for imported tables.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

  • sqlrooms/sqlrooms#711: Adds the worksheet agent/tool adapter and registers it in the same CLI store wiring that this PR replaces with a block-document agent.
  • sqlrooms/sqlrooms#780: Performs the same worksheet→block-document migration touching the same CLI AI constants/instruction wiring and command ID namespaces.
  • sqlrooms/sqlrooms#784: Updates the CLI block-document AI adapter path to use the canonical append-blocks command plumbing with corresponding adapter tests.

Suggested reviewers: dmitriy-kostianetskiy, lixun910

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 main change: renaming worksheet-related code and APIs to block-document equivalents.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch workspace-block-document-renames

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts (1)

435-450: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Inconsistent user-facing terminology in the failure path.

The success path falls back to "Worksheet created successfully." and store.ts's CLI instructions explicitly say to "Use the word Worksheet in user-facing replies," but the generic failure friendlyMessage says "Block document agent execution failed.", leaking internal naming to end users.

✏️ Proposed fix
         const friendlyMessage =
           error instanceof AiAgentError
             ? errorMessage
-            : 'Block document agent execution failed.';
+            : 'Worksheet agent execution failed.';
🤖 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 `@apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts` around lines
435 - 450, The failure path in createCliBlockDocumentAgentTool uses internal
“Block document” terminology, which is inconsistent with the user-facing
“Worksheet” wording used elsewhere. Update the friendlyMessage branch in the
catch block so the generic fallback matches the CLI’s user-facing terminology
and does not expose internal agent names, while keeping AiAgentError messages
unchanged. Use the createCliBlockDocumentAgentTool catch path and
friendlyMessage selection to locate the change.
🧹 Nitpick comments (1)
apps/sqlrooms-cli-ui/src/ai/constants.ts (1)

19-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use KnownBlockDocumentTools.list_blocks here
Keep this instruction aligned with the shared tool key instead of hardcoding list_block_document_blocks.

🤖 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 `@apps/sqlrooms-cli-ui/src/ai/constants.ts` around lines 19 - 22, Update
EXPERIMENTAL_BLOCK_DOCUMENT_AGENT_INSTRUCTIONS so it refers to the shared tool
key KnownBlockDocumentTools.list_blocks instead of hardcoding
list_block_document_blocks. Keep the rest of the worksheet map guidance in
place, and adjust the existing update-flow sentence to call the shared symbol
consistently so the instruction stays aligned with the tool registry.
🤖 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.

Outside diff comments:
In `@apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts`:
- Around line 435-450: The failure path in createCliBlockDocumentAgentTool uses
internal “Block document” terminology, which is inconsistent with the
user-facing “Worksheet” wording used elsewhere. Update the friendlyMessage
branch in the catch block so the generic fallback matches the CLI’s user-facing
terminology and does not expose internal agent names, while keeping AiAgentError
messages unchanged. Use the createCliBlockDocumentAgentTool catch path and
friendlyMessage selection to locate the change.

---

Nitpick comments:
In `@apps/sqlrooms-cli-ui/src/ai/constants.ts`:
- Around line 19-22: Update EXPERIMENTAL_BLOCK_DOCUMENT_AGENT_INSTRUCTIONS so it
refers to the shared tool key KnownBlockDocumentTools.list_blocks instead of
hardcoding list_block_document_blocks. Keep the rest of the worksheet map
guidance in place, and adjust the existing update-flow sentence to call the
shared symbol consistently so the instruction stays aligned with the tool
registry.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9105d1da-539a-4fe1-8f01-ddda85b31297

📥 Commits

Reviewing files that changed from the base of the PR and between 6619fd0 and ac9b4c3.

📒 Files selected for processing (11)
  • apps/sqlrooms-cli-ui/src/__tests__/createCliBlockDocumentAiAdapter.test.ts
  • apps/sqlrooms-cli-ui/src/__tests__/createCliBlockDocumentCommands.test.ts
  • apps/sqlrooms-cli-ui/src/ai/__tests__/createCliBlockDocumentAiTools.test.ts
  • apps/sqlrooms-cli-ui/src/ai/constants.ts
  • apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAgentTool.ts
  • apps/sqlrooms-cli-ui/src/ai/createCliBlockDocumentAiTools.ts
  • apps/sqlrooms-cli-ui/src/components/useLocalFileLoader.ts
  • apps/sqlrooms-cli-ui/src/createBlockDocumentAgent.ts
  • apps/sqlrooms-cli-ui/src/createCliBlockDocumentAiAdapter.ts
  • apps/sqlrooms-cli-ui/src/createCliBlockDocumentCommands.ts
  • apps/sqlrooms-cli-ui/src/store.ts

@ilyabo
ilyabo merged commit cbe35fd into main Jul 6, 2026
6 checks passed
@ilyabo
ilyabo deleted the workspace-block-document-renames branch July 6, 2026 18:28
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