fluffos_validate
Validate LPC code files by checking for compilation errors using the FluffOS driver's symbol tool to ensure code correctness before deployment.
Instructions
Validate an LPC file using the FluffOS driver's symbol tool. Returns success/failure and any compilation errors.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | Absolute path to the LPC file to validate |
Implementation Reference
- src/index.js:90-106 (registration)Registration of the fluffos_validate tool, including name, description, and input schema.{ name: "fluffos_validate", description: "Validate an LPC file using the FluffOS driver's symbol tool. " + "Compiles the file and reports success or failure with any " + "compilation errors. Fast and lightweight check for code validity.", inputSchema: { type: "object", properties: { file: { type: "string", description: "Absolute path to the LPC file to validate", }, }, required: ["file"], }, },
- src/index.js:145-156 (handler)Dispatch handler in the CallToolRequestSchema that invokes runSymbol for fluffos_validate.case "fluffos_validate": { const result = await this.runSymbol(args.file) return { content: [ { type: "text", text: result, }, ], } }
- src/index.js:205-238 (handler)Core handler logic for fluffos_validate: spawns FluffOS 'symbol' tool to compile/validate the LPC file, captures stdout/stderr, and returns success/failure message with output.async runSymbol(lpcFile) { return new Promise((resolve, reject) => { const normalizedPath = this.normalizePath(lpcFile) const symbolPath = path.join(this.binDir, "symbol") const proc = spawn(symbolPath, [this.configFile, normalizedPath], { cwd: path.dirname(this.configFile), }) let stdout = "" let stderr = "" proc.stdout.on("data", data => { stdout += data.toString() }) proc.stderr.on("data", data => { stderr += data.toString() }) proc.on("close", code => { const output = (stdout + stderr).trim() if(code === 0) { resolve(`✓ File validated successfully\n\n${output}`) } else { resolve(`✗ Validation failed (exit code: ${code})\n\n${output}`) } }) proc.on("error", err => { reject(new Error(`Failed to run symbol: ${err.message}`)) }) }) }
- src/index.js:72-85 (helper)Helper function to normalize LPC file paths by stripping the mudlib directory prefix if applicable, used in runSymbol.normalizePath(lpcFile) { // If we have a mudlib directory and the file path is absolute and starts with mudlib dir, // convert it to a relative path if(this.mudlibDir && path.isAbsolute(lpcFile) && lpcFile.startsWith(this.mudlibDir) ) { // Remove mudlib directory prefix and leading slash return lpcFile.substring(this.mudlibDir.length).replace(/^\/+/, "") } // Otherwise return as-is (already relative or not under mudlib) return lpcFile }
- src/index.js:96-105 (schema)Input schema definition for the fluffos_validate tool.inputSchema: { type: "object", properties: { file: { type: "string", description: "Absolute path to the LPC file to validate", }, }, required: ["file"], },