Skip to content

Conversation

@rubenfiszel
Copy link
Contributor

@rubenfiszel rubenfiszel commented Dec 24, 2025

mov-2025-12-24--20-53-39.mp4

rubenfiszel and others added 19 commits December 23, 2025 18:02
Add automatic generation of DATATABLES.md file when syncing raw apps.
This documentation helps AI agents understand the datatable configuration
and clarifies that tables must be whitelisted in data.tables of raw_app.yaml.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Ensure the auto-generated DATATABLES.md documentation file is not
pushed as an app file. Added to skip lists in both collectAppFiles
and elementsToMap functions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add new interactive command that prompts for summary, path, and framework
to scaffold a new raw app with template files and DATATABLES.md.

- Validates path format (u/ or f/ prefix, no dots, alphanumeric only)
- Supports React 19, React 18, Svelte 5, and Vue 3 templates
- Generates complete app structure with backend folder and example runnable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add a new mechanism for AI agents to create and modify datatables during development:

- Add sql_to_apply folder to app templates (excluded from push)
- Watch sql_to_apply folder in dev server for .sql file changes
- Show confirmation modal in browser when SQL files are created/modified
- Execute confirmed SQL against the configured datatable
- Update DATATABLES.md to document the sql_to_apply workflow
- Remind agents to add created tables to data.tables in raw_app.yaml

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…generate-datatables command

Enhance wmill app new:
- Fetch and display available datatables from workspace
- Allow interactive selection of datatable (prefers "main")
- Support creating new schema or selecting existing one
- Generate SQL file in sql_to_apply/ for new schema creation
- Update raw_app.yaml with data configuration
- Advise user to run wmill app dev for full experience

Add wmill app generate-datatables:
- Fetch datatable schemas from remote workspace
- Generate comprehensive DATATABLES.md with all tables/columns
- Include app-specific configuration from raw_app.yaml
- Document SQL migration workflow and usage examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…autocompletion

Fix bug where 'wmill app new' was only using the last path segment for the
folder name (e.g., f/foobar/x/y became y.raw_app instead of f/foobar/x/y.raw_app).

Add folder autocompletion when typing paths - fetches workspace folders and
suggests matching f/<folder>/ paths as the user types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…ng SQL files on startup

DATATABLES.md improvements:
- Add prominent "CRITICAL RULES FOR AI AGENTS" section at the top
- Make clear that agents can ONLY use tables listed in data.tables
- Show whitelisted tables with "USE THESE FIRST" heading
- Add "How to Add a New Table to the Whitelist" section with examples
- Mark schema discovery as optional/reference only

SQL watcher fix:
- Scan existing SQL files in sql_to_apply/ on dev server startup
- Show modal for each existing file after 2 second delay (for WebSocket connection)
- Track prompted files to avoid duplicate modals

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Major changes:
- Create AGENTS.md as main documentation file for AI agents
- DATATABLES.md now focuses only on schema information
- Rename command from generate-datatables to generate-agents
- Command now regenerates both AGENTS.md and DATATABLES.md
- Auto-refresh docs after SQL migration is applied in dev server

AGENTS.md improvements:
- Complete app structure overview
- Backend runnables: only code file needed, .yaml is optional
- Added generate-locks command documentation
- All supported languages and extensions listed
- Clear instructions for creating and calling runnables

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Queue SQL files and process them one at a time
- Delete SQL files after successful application
- Send pending SQL files to new WebSocket clients on connect
- Show next file in queue after apply or skip

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Code files in backend/ are now auto-detected as inline runnables
- No need for <id>.yaml with type: inline - just add <id>.<ext>
- YAML config is optional for additional settings (fields, static values)
- Updated AGENTS.md documentation to reflect simpler workflow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
These are auto-generated files that shouldn't be included in the
app files sent to the server.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Skip dev-only and generated files during pull operations to prevent them
from being created when syncing from remote:
- sql_to_apply/ folder (dev-only SQL migrations)
- wmill.d.ts (generated TypeScript definitions)
- AGENTS.md (generated documentation)
- DATATABLES.md (generated documentation)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove custom_path from sync pull (it's derived from file path)
- Remove custom_path from new app template
- Make custom_path optional in AppFile interface
- Only include custom_path in push if explicitly set

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@claude
Copy link
Contributor

claude bot commented Dec 24, 2025

Claude finished @rubenfiszel's task in 2m 59s —— View job


Reviewing PR #7448: feat: raw apps can be built by agents fully locally

  • Analyze the PR changes
  • Review backend changes (workspaces.rs, openapi.yaml)
  • Review CLI changes (app commands, sync)
  • Review frontend changes
  • Provide comprehensive feedback
  • Add testing instructions

Summary

This PR introduces significant enhancements to enable raw apps to be built by AI agents fully locally. The changes span backend (new datatable schema export API), CLI (new commands for app creation and agent documentation), and frontend (improved copilot integration).

Key Changes

Backend

  • New API endpoint GET /w/{workspace}/workspaces/list_datatable_schemas that exports all datatable schemas with column types in a compact format
  • Returns hierarchical structure: schema_name → table_name → column_name → compact_type where compact_type includes nullable (?) and default values (=value)

CLI (wmill app)

  • wmill app new - Interactive wizard to create new raw apps with framework selection (React 18/19, Svelte 5, Vue 3) and datatable configuration
  • wmill app generate-agents - Regenerates AGENTS.md and DATATABLES.md documentation files for AI agents
  • wmill app dev enhancements:
    • SQL migration modal for files in sql_to_apply/ folder
    • Auto-regenerates agent docs after SQL migrations
    • Watches for runnable changes and auto-infers schemas

Frontend

  • Enhanced copilot chat integration with datatable schema awareness
  • New AI tools for datatable operations (get_datatables, exec_datatable_sql)
  • Improved system prompt with datatable usage instructions

Issues Found

Minor Issues (2)

  1. Comment syntax error in workspaces.rs:1221 - Uses single forward slash instead of //
  2. Comment syntax error in workspaces.rs:1304 - Same issue

I've added inline suggestions to fix these.

Code Quality Assessment

Strengths:

  • Well-structured agent documentation generation with comprehensive instructions
  • Good separation between code-only runnables (auto-detected) and YAML-configured runnables
  • Proper exclusion of generated/development files from app bundles
  • Solid error handling throughout the CLI commands
  • Excellent system prompt for AI with clear datatable usage rules

Architecture:

  • The hierarchical schema export format is efficient and provides all necessary information
  • The sql_to_apply/ folder pattern is a clean approach for SQL migrations during development
  • Auto-detection of backend runnables from code files reduces configuration overhead

Security Considerations

  • The datatable schema export endpoint is protected by authentication (ApiAuthed)
  • SQL execution through the copilot respects the datatable creation policy configured by the user

Performance

  • The schema query in get_datatable_schema efficiently retrieves all column metadata in a single query
  • Connection pooling could be considered for repeated schema lookups in the future

Testing Instructions

To test the changes in this PR:

  1. Create a new raw app via CLI:

    • Navigate to a workspace directory with wmill configured
    • Run wmill app new and follow the interactive prompts
    • Select a framework (e.g., React 19), provide a path like f/test/my_app, and optionally configure a datatable
    • Verify the folder structure is created with AGENTS.md, DATATABLES.md, raw_app.yaml, and framework files
  2. Test the dev server with SQL migrations:

    • cd into the created .raw_app folder
    • Run npm install then wmill app dev .
    • Create a SQL file in sql_to_apply/ (e.g., 001_create_table.sql with CREATE TABLE test (id SERIAL PRIMARY KEY, name TEXT))
    • Observe the modal appearing in the browser to apply the migration
    • Confirm the migration is applied and the SQL file is deleted
  3. Test agent documentation regeneration:

    • Run wmill app generate-agents inside the .raw_app folder
    • Verify AGENTS.md and DATATABLES.md are updated with current datatable schemas
  4. Test the datatable schema API:

    • In the Windmill UI, open the Raw App Editor for an existing app
    • Open the AI chat and ask to "show datatables" or create a table
    • Verify the AI can see the datatable schemas and create/query tables
  5. Test backend runnable auto-detection:

    • In a raw app's backend/ folder, create a TypeScript file without a corresponding YAML (e.g., hello.ts)
    • Verify it's automatically detected as an inline runnable when running wmill app dev

@cloudflare-workers-and-pages
Copy link

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0e095c1
Status: ✅  Deploy successful!
Preview URL: https://2d9fcbcf.windmill.pages.dev
Branch Preview URL: https://rf-datatableschemas.windmill.pages.dev

View logs

.await
.map_err(|e| Error::internal_err(format!("Failed to query schema: {}", e)))?;

// Build hierarchical structure: schema -> table -> column -> compact_type
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment here has a formatting issue - it uses a forward slash (/) instead of double slashes (//) for a comment. This appears to be a typo introduced during editing.

Suggested change
// Build hierarchical structure: schema -> table -> column -> compact_type
// Build hierarchical structure: schema -> table -> column -> compact_type

#[derive(Serialize, Debug)]
struct DataTableSchema {
datatable_name: String,
/// Hierarchical schema: schema_name -> table_name -> column_name -> "type[?][=default]"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same issue - this uses a single forward slash instead of double slashes for the comment.

Suggested change
/// Hierarchical schema: schema_name -> table_name -> column_name -> "type[?][=default]"
// Hierarchical schema: schema_name -> table_name -> column_name -> "type[?][=default]"


// Regenerate AGENTS.md and DATATABLES.md to reflect schema changes
try {
await regenerateAgentDocs(workspaceId, process.cwd(), true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Good practice: After applying SQL migrations, the code regenerates AGENTS.md and DATATABLES.md to reflect schema changes. The error handling here is appropriately lenient (warning rather than failing) since refreshing docs is a non-critical operation.

* - Cannot contain dots
* - Can only contain alphanumeric characters, underscores, hyphens, and slashes
*/
function validateAppPath(appPath: string): { valid: boolean; error?: string } {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good validation function! This properly enforces Windmill's path conventions (u/ or f/ prefix, no dots, valid characters). This prevents common user errors when creating apps via CLI.

if (entry.isDirectory) {
// Skip the runnables and node_modules subfolders
// Skip the runnables, node_modules, and sql_to_apply subfolders
if (
Copy link
Contributor

Choose a reason for hiding this comment

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

Good practice: Excluding generated files (DATATABLES.md, AGENTS.md, wmill.d.ts) and development folders (node_modules, dist, .claude, sql_to_apply) from the app bundle prevents accidental inclusion of local development artifacts in the deployed app.

* Generates AGENTS.md - the main documentation file for AI agents working with raw apps.
* This includes app structure, backend runnables, datatables usage, and all critical rules.
*/
export function generateAgentsDocumentation(data: {
Copy link
Contributor

Choose a reason for hiding this comment

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

The generateAgentsDocumentation function is well-structured and provides excellent documentation for AI agents. It covers:

  • App structure with clear directory layout
  • Backend runnable creation patterns
  • Supported languages and extensions
  • Critical datatable rules

This is a great improvement for making raw apps self-documenting and agent-friendly.

* Hierarchical structure: schema_name -> table_name -> column_name -> compact_type
* Compact type format: 'type[?][=default]' where ? means nullable (e.g. 'int4', 'text?', 'int4?=0')
*/
export interface DataTableSchema {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good alignment: The DataTableSchema interface here correctly mirrors the backend's DataTableSchema struct defined in workspaces.rs. The hierarchical schema format (schema_name → table_name → column_name → compact_type) provides a compact yet comprehensive representation.

@rubenfiszel rubenfiszel merged commit 3dd4579 into main Dec 24, 2025
135 checks passed
@rubenfiszel rubenfiszel deleted the rf/datatableSchemas branch December 24, 2025 21:00
@github-actions github-actions bot locked and limited conversation to collaborators Dec 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants