@agent-scaffolder:project-builderfrom scaffolder
This document provides essential context about the project-builder system for AI agents working on this codebase.
Ships in scaffolder. Installing the plugin adds it to Claude Code.
This document provides essential context about the project-builder system for AI agents working on this codebase.
The project-builder is a code generation system that scaffolds project files from YAML structure definitions. It processes YAML files that define file structures, templates, and generation rules to create complete project directories.
buildProjectFiles.ts: Main function that orchestrates the entire build process
project-processors/)processYamlStructure.ts: Recursively processes YAML structure, handling all project actionsprocessMultipleFiles.ts: Generates multiple files from schema tables (FILE_LOOP action)
--ignore flag with USE_CONSTANT() for filtering tables--include-table and --exclude-table for table filtering--template for specifying template filesprocessLoopFolders.ts: Generates files by iterating over folders matching glob patternsimportProject.ts: Handles importing other project structuresprocessDynamicFolders.ts: Creates dynamic folder structures based on conditionstemplate-processors/)processIterateCommand.ts: Handles LOOP commands and iteration logic
--ignore flag with USE_CONSTANT() for filtering in LOOP commands--filter, --separator, --include-files, --exclude-files flagsloadConstant.ts: Loads constant values from YAML files
loadConstant(): Loads from Constants folder (legacy)loadConstantFromPath(): Loads from any file path (relative or absolute) - NEWprocessCommand.ts: Processes template commands like USE_CONSTANT, USE_FORM_DATA, USE_USER_ENVreplacePlaceholders.ts: Replaces placeholders like {{tableName}} with actual valuesutils/)parseCommand.ts: Parses command strings and extracts flags/options
--template, --ignore, --data-source, --include-table, etc.findFileInStructure.ts: Finds files in the file structure by pathprocessRelativePath.ts: Resolves relative paths to absolute paths based on project file locationloadTemplateContent.ts: Loads template file contentloadDataSourceFile.ts: Loads data source YAML filesfilterViewTables.ts: Centralized helper for filtering view tables from schema info
schemaInfoParsed.getViewTables() for consistent view detectionupdateFilesInStructure.ts: Updates multiple files in a structure in a single pass
USE_USER_ENV)helpers/)sanitizeFileName.ts: Enterprise-grade filename and folder name sanitization
Generates multiple files by iterating over schema tables.
Syntax:
FILE_LOOP(filename --template=path --ignore=value --data-source=path)
Flags:
--template: Path to template file (supports relative paths)--ignore: Comma-separated list of table names to skip, or USE_CONSTANT(path) to load from file--include-table: Only include specific table--exclude-table: Exclude specific table--data-source: Path to data source YAML files--format: Enable/disable file formatting (default: true)View Table Exclusion: View tables (tables with viewQuery property) are automatically excluded by default. Views are read-only and don't need code generation (migrations, controllers, models, etc.).
Example:
db:
FILE_LOOP({{timestamp('YYYY_MM_DD_HHmmss')}}_create_{{tableName.plural.snakeCase}}_table.sql
--ignore USE_CONSTANT(./constants/ignoredTables.yaml)
--template ./templates/migration.sql.txt
--data-source=/Constants/typeMappings.yaml,/Constants/dbTypes.yaml):
Generates files by iterating over folders matching a glob pattern.
Syntax:
LOOP_FOLDERS(filename --data-source=pattern --template=path)
View Table Exclusion: View tables are automatically excluded when iterating over schema tables (when --data-source is not used).
Imports another project structure.
Syntax:
IMPORT_PROJECT(path/to/structure.yaml)
Accesses constant values from YAML files. Supports two formats:
[[USE_CONSTANT(constantName)]]USE_CONSTANT(./path/to/file.yaml)Path Support:
./constants/ignoredTables.yaml (resolved relative to project YAML file)/Projects/App/constants/ignoredTables.yamltableName) loads from /Constants/tableName.yamlFile Format: YAML files can contain:
- value1\n- value2constantName: [value1, value2]Accesses form data values: [[USE_FORM_DATA(key)]]
Accesses user environment variables: [[USE_USER_ENV(VAR_NAME)]]
Accesses data from external YAML files: [[USE_DATA(path.to.value)]]
Includes another template: [[USE_TEMPLATE(./path/to/template.txt)]]
Placeholders use double curly braces: {{placeholderName}}
Common Placeholders:
{{tableName}}: Table name in original case{{tableName.snakeCase}}: Table name in snake_case{{tableName.plural.snakeCase}}: Plural table name in snake_case{{tableName.camelCase}}: Table name in camelCase{{columnName}}: Column name{{index(1, 3)}}: Sequential index (1-based, padded to 3 digits){{timestamp('YYYY_MM_DD')}}: Formatted timestamp (automatically unique when generating multiple files)View tables are automatically excluded by default in all loop operations (FILE_LOOP, FOLDER_LOOP, LOOP(tables), LOOP(tablesReversed)). Views are read-only database objects identified by the viewQuery property and don't need code generation (migrations, controllers, models, etc.). This exclusion cannot be disabled as views are fundamentally different from base tables.
The --ignore flag allows filtering out tables or folders during generation. Note: View tables are already excluded by default, so you don't need to add them to the ignore list.
FILE_LOOP(filename.sql --ignore USE_CONSTANT(./constants/ignoredTables.yaml) --template=./template.txt):
someKey: LOOP(columns --ignore="id,created_at,updated_at"):
--ignore="table1,table2"--ignore="USE_CONSTANT(./constants/ignoredTables.yaml)"--ignore="USE_CONSTANT(/Projects/App/constants/ignored.yaml)"--ignore="USE_CONSTANT(constantName)"loadConstantFromPath(): New function that loads constants from any file path
processRelativePath())processMultipleFiles.ts: Filters schema tables based on ignore listprocessIterateCommand.ts: Filters items in LOOP commands based on ignore listUSE_CONSTANT(...) syntax (without brackets) for command optionsThe system works with an in-memory file structure (IStructure) that represents:
{ type: 'file', name: string, content: string }{ type: 'folder', name: string, children: IStructure }Files are loaded from this structure, processed, and new files are generated.
The system uses IBuildContext to pass shared state:
userFiles: The file structureschemaInfo: Database schema informationschemaInfoParsed: Parsed schema with relationshipsprojectYamlPath: Path to the project YAML fileformData: User form datauserMetadata: Additional metadatatable: Current table context (when iterating)options: Command options/flags./ or ../): Resolved relative to the project YAML file's directory/): Used as-isprocessRelativePath()Test files are located in src/tests/utils/project-builder/:
*.test.tsdescribe() and it() from vitestIStructure typeISchemaInfo interface (must include all required fields)parseCommand.tsIActionFlags interface if neededUse findFileInStructure() with resolved path:
const resolvedPath = processRelativePath(relativePath, projectYamlPath);
const file = findFileInStructure(resolvedPath, userFiles);
Check for both formats:
const USE_CONSTANT_OPTION_REGEX = /USE_CONSTANT\(([^)]+)\)/;
let match = USE_CONSTANT_OPTION_REGEX.exec(value); // Without brackets
if (!match) {
match = USE_CONSTANT_REGEX.exec(value); // With brackets
}
buildProjectFiles.ts: Entry point, understand the flowprocessYamlStructure.ts: How YAML is processedprocessMultipleFiles.ts: How FILE_LOOP worksloadConstant.ts: How constants are loaded (including new path support)parseCommand.ts: How command options are parsedinterfaces/interfaces.ts: Type definitionsutils/filterViewTables.ts: Centralized helper for filtering view tables (uses getSchemaInfo().getViewTables())getSchemaInfo.ts (in src/utils/): Schema utility with getViewTables() method for view table detectionfetchUserMetadata() in src/hooks/useUser.ts to return null instead of throwing errors when API failsApp.tsx to allow project building without requiring decryptedMetadata !== nullUSE_USER_ENV placeholders are replaced with empty strings when metadata is unavailableUSE_USER_ENV are tracked in filesUsingUserEnv array for user awareness/api/user-metadata endpoint to return proper JSON error responsesloadConstantFromPath() function to load constants from any file pathprocessMultipleFiles.ts to support --ignore flag with USE_CONSTANT(path)processIterateCommand.ts to support --ignore flag with USE_CONSTANT(path)USE_CONSTANT_OPTION_REGEX to match USE_CONSTANT(...) without brackets (for command options)updateFilesInStructure() utility function for efficiently updating multiple files in a structurebuildProjectFiles.ts for use in project store and other modulesUSE_USER_ENV when metadata changes/scaffold and /create-local-files endpoints now use the same project builder systemIProjectGenerationRequest interface in src/interfaces/IProjectGenerationRequest.tsschemaInfo, SQLSchema, formData, and userMetadata/scaffold endpoint: Generates files using project builder AND executes database operations (creates/resets database with SQL schema) AND validates backend URL/create-local-files endpoint: Generates files using project builder only (no database operations)buildProjectFiles() function/scaffold when you need database setup and backend validation/create-local-files when you only need file generationsrc/utils/project-builder/helpers/sanitizeFileName.ts<, >, ", |, ?, *, /, \):) with hyphens (-) for Windows compatibility (common in ISO 8601 timestamps)CON, PRN, AUX, NUL, COM1-9, LPT1-9) by prefixing with underscorefileFILE_LOOP commands: Filenames sanitized in processMultipleFiles.tsCREATE_FILE commands: Filenames sanitized in processYamlStructure.tsLOOP_FOLDERS commands: Filenames sanitized in processLoopFolders.tsprocessYamlStructure.ts (conditional folders)FOLDER_LOOP commands: Folder names sanitized in processDynamicFolders.tssrc/tests/utils/project-builder/helpers/sanitizeFileName.test.ts with 31 test cases covering all edge casessrc/utils/project-builder/docs/PLACEHOLDER_FUNCTIONS.md for user-facing documentationFILE_LOOP, FOLDER_LOOP, LOOP(tables), and LOOP(tablesReversed) commandsgetViewTables() function from getSchemaInfo.ts via filterViewTables() helperCREATE VIEW, not CREATE TABLE; no CRUD operations needed)getSchemaInfo.ts: Added getViewTables() method that returns IViewTable[] with tableName and viewQueryfilterViewTables.ts: Helper utility that uses schemaInfoParsed.getViewTables() to filter out viewsprocessMultipleFiles.ts: Uses filterViewTables() before file generationprocessDynamicFolders.ts: Uses filterViewTables() before folder generationprocessIterateCommand.ts: Uses filterViewTables() in processLoopTables, processLoopTablesReversed, and processHtmlLoopprocessMultipleFiles-viewTables.test.ts: 9 tests for FILE_LOOPprocessDynamicFolders-viewTables.test.ts: 6 tests for FOLDER_LOOPprocessLoopTables-viewTables.test.ts: 12 tests for template LOOP commandsuseSchemaInfo.test.ts: 3 tests for getViewTables() function--ignore flag (views excluded first, then manual ignores applied)src/utils/project-builder/docs/README.md for user-facing documentationselectedProject is restored from localStorage before userFiles are fetched, causing unnecessary build attemptsApp.tsx and useProjectStore.tsApp.tsx): useEffect checks prerequisites (hasSelectedProject, hasUser, hasUserFiles) before triggering build
userFiles become available via dependency arrayuseProjectStore.ts): buildProjectFilesForProject returns early if userFiles are empty
hasSelectedProject, hasUser, hasUserFiles, canBuildProject, hasNoUserFiles) for readabilitysrc/utils/project-builder/docs/PERFORMANCE_OPTIMIZATIONS.md for detailed documentationFILE_LOOP with {{timestamp()}}, all files would receive the same timestamp, causing filename collisionsformatTimestamp() (placeholderFunctions.ts): Added optional offsetMs parameter to apply millisecond offset to base dateprocessTimestampFunction() (placeholderFunctions.ts): Added optional offsetMs parameter and passes it to formatTimestamp()processDynamicProperties() (processDynamicProperties.ts): Automatically calculates offset from tableIndex (1 second per index, converted to milliseconds)tableIndex)placeholderFunctions.test.ts (7 tests) and processDynamicProperties-timestamp.test.ts (10 tests)src/utils/project-builder/docs/PLACEHOLDER_FUNCTIONS.md for user-facing documentationProjects/ folder) would fail silently or show stale data from localStorage, preventing users from browsing invalid repositoriesuseMockDatabaseStore.ts: Fixed state update to occur even when no Projects folder is found, enabling fallback viewersrc/utils/project-builder/utils/findProjectsFolderAtRoot.ts: Created self-documenting utility function that enforces root-level-only Projects folder lookup (not nested)App.tsx: Added repository viewer fallback UI with helpful hints and call-to-action linkssrc/components/FileViewer.tsx: Conditionally hide action buttons when in read-only modeuseUserFiles.ts: Improved error messaging for empty repositoriesProjects/ folder is missing, explaining where it should be locatedfindProjectsFolderAtRoot() function name)useMockDatabaseStore, App.tsx, loadCoreFiles.ts)src/useMockDatabaseStore.ts: Fixed state update logic, uses findProjectsFolderAtRoot()src/App.tsx: Added fallback viewer UI, conditional button rendering, uses findProjectsFolderAtRoot()src/components/FileViewer.tsx: Conditionally hide buttons when mode === 'view'src/utils/project-builder/utils/findProjectsFolderAtRoot.ts: New utility functionsrc/utils/project-builder/utils/loadCoreFiles.ts: Uses findProjectsFolderAtRoot()src/hooks/useUserFiles.ts: Improved error messaging for empty repositoriesWhat the agent file sets; muted values are Claude Code's defaults
7-day visitors to each agent page
Claude Code refuses to install this plugin
.claude-plugin/plugin.json: agents: Invalid string: must end with ".md"
Checked against Claude Code 2.1.332's install rules. The listing below is what the repository ships; Claude Code cannot install it as published.
16 agents in this plugin
agent-templateAgent Name[System prompt content - describe what this agent does and how it should behave]ai-chat-schema-builderAgent AI Chat Schema Builder - Context GuideThis document provides essential context about the AI chat-based schema builder system for AI agents working on this codebase.database-introspectorAgent Database Introspector - Context GuideThis document provides essential context about the database introspection system for AI agents working on this codebase.design-systemDesign System Maintenance AgentYou are a design system specialist responsible for maintaining the enterprise-grade design system architecture in this project.docker-environmentAgent Docker Environment - Context GuideThis document provides essential context about the Docker development environment setup for AI agents working on this codebase.error-handlingAgent Error Handling and Server Configuration - Context GuideThis document provides essential context about the error handling system and server configuration management for AI agents working on this codebase.Other plugins' agents for the same job