Devbase Code & DB Tool

Tool for Devbase AI agent: deep code introspection (JS/HTML/CSS) + SheetBase database access via Apps Script.

Overview

This node, named Devbase Code & DB Tool, serves as a versatile utility for two main purposes: deep introspection and manipulation of source code (JavaScript, HTML, CSS) and interaction with the SheetBase database backend via Apps Script. It supports various code-related actions such as listing functions, extracting specific functions, searching code by keyword or line range, updating or deleting code ranges, and extracting HTML or CSS blocks. In database mode, it allows operations like pinging the service, validating API keys, managing sheets (list, create, delete), manipulating rows and cells, and handling projects and files. This node is beneficial for developers needing automated code analysis or database management within workflows, such as extracting function metadata, updating code snippets, or managing spreadsheet data programmatically.

Use Case Examples

  1. Extract all JavaScript functions from a code snippet to generate documentation or perform static analysis.
  2. Search for a specific keyword within a codebase to locate relevant code sections.
  3. Update or delete specific lines in a source code file as part of an automated refactoring process.
  4. List all sheets in a SheetBase database to audit available data sources before processing data workflows.

Properties

Name Meaning
Mode Selects the operation mode: 'code' for source code analysis and manipulation, or 'database' for interacting with SheetBase backend.
Code Action Specifies the action to perform on the source code when in 'code' mode.
Language Specifies the programming language of the code for analysis; can be auto-detected or set to JavaScript, HTML, or CSS.
Code Source Field The JSON field path in the input item where the source code is located.
Function Output Determines the output detail level when listing functions: metadata only or full code.
Function Name The name of the function to extract when using the 'getFunction' action.
Search Mode Defines the search method in code: by keyword or by line range.
Keyword The keyword to search for in the code when using keyword search mode.
Max Results Maximum number of search results to return.
Start Line Starting line number for search, update, or delete range actions.
End Line Ending line number for search, update, or delete range actions.
Replacement Code Code to replace the specified line range with when updating code.
HTML Output Output detail level for HTML block extraction: metadata only or full code.
CSS Output Output detail level for CSS block extraction: metadata only or full code.
Database Action Specifies the database operation to perform when in 'database' mode.
Sheet Name Name of the sheet to operate on in database actions that require it.
Limit Maximum number of rows to retrieve when getting sheet data.
New Sheet Name Name for a new sheet when creating one.
Columns (CSV) Comma-separated list of column headers for new sheet creation.
Confirm Name Confirmation input to verify sheet name before deletion.
Rows (JSON) Rows of data in JSON format to append to a sheet.
Row Number Row number to delete in a sheet.
Row Row number for setting a cell value.
Column Column number for setting a cell value.
Value Value to set in a specific cell.
Project ID Identifier of the project for project-related database actions.
User Email User email associated with saving a project.
Metadata (JSON) Metadata JSON for saving a project.
Package (JSON) Package JSON for saving a project.
File Name Name of the file to save in a project.
Media Type Media type of the file content when saving a file.
File Content (Base64) Base64-encoded content of the file to save.

Output

JSON

  • success - Indicates if the operation was successful (true/false).
  • mode - The mode of operation ('code' or 'database').
  • action - The specific action performed within the selected mode.
  • language - Detected or specified programming language of the code (for code mode).
  • codeField - The JSON field path where the source code was read from.
  • count - Number of items found (functions, blocks, or search results).
  • functions - Array of function metadata or full code objects when listing functions.
  • function - Details of a specific function extracted by name.
  • error - Error message if the operation failed.
  • searchMode - Search method used ('keyword' or 'range').
  • keyword - Keyword searched for in the code.
  • results - Array of search result objects with line number, column, and text.
  • startLine - Start line number for code extraction or modification.
  • endLine - End line number for code extraction or modification.
  • extractedCode - Code extracted from a specified line range.
  • updatedCode - Code after applying updates or deletions in a line range.
  • blocks - Array of HTML or CSS block metadata or full code objects.
  • appId - Project ID used in database project actions.
  • userEmail - User email associated with a saved project.
  • metadata - Metadata JSON string for a saved project.
  • package - Package JSON string for a saved project.

Dependencies

  • An API key credential for SheetBase with execUrl or baseUrl and apiKey

Troubleshooting

  • Ensure the input item contains the code at the specified 'Code Source Field' path; otherwise, the node will throw an error indicating no code found.
  • In database mode, credentials for SheetBase API must be configured correctly with 'execUrl' or 'baseUrl' and 'apiKey'; missing these will cause errors.
  • When deleting a sheet, the 'Confirm Name' must exactly match the sheet name to prevent accidental deletion errors.
  • If an unknown code or database action is specified, the node will throw an error indicating the action is unknown.

Discussion