()
| 25 | } |
| 26 | |
| 27 | parse() { |
| 28 | const latestActionStart = this.currentArtifact.split("\n").findIndex((line) => line.includes("<boltAction type=")); |
| 29 | const latestActionEnd = this.currentArtifact.split("\n").findIndex((line) => line.includes("</boltAction>")) ?? (this.currentArtifact.split("\n").length - 1); |
| 30 | |
| 31 | if (latestActionStart === -1) { |
| 32 | return; |
| 33 | } |
| 34 | |
| 35 | const latestActionType = this.currentArtifact.split("\n")[latestActionStart].split("type=")[1].split(" ")[0].split(">")[0]; |
| 36 | const latestActionContent = this.currentArtifact.split("\n").slice(latestActionStart, latestActionEnd + 1).join("\n"); |
| 37 | |
| 38 | try { |
| 39 | if (latestActionType === "\"shell\"") { |
| 40 | let shellCommand = latestActionContent.split('\n').slice(1).join('\n'); |
| 41 | if (shellCommand.includes("</boltAction>")) { |
| 42 | shellCommand = shellCommand.split("</boltAction>")[0]; |
| 43 | this.currentArtifact = this.currentArtifact.split(latestActionContent)[1]; |
| 44 | this.onShellCommand(shellCommand); |
| 45 | } |
| 46 | } else if (latestActionType === "\"file\"") { |
| 47 | const filePath = this.currentArtifact.split("\n")[latestActionStart].split("filePath=")[1].split(">")[0]; |
| 48 | let fileContent = latestActionContent.split("\n").slice(1).join("\n"); |
| 49 | if (fileContent.includes("</boltAction>")) { |
| 50 | fileContent = fileContent.split("</boltAction>")[0]; |
| 51 | this.currentArtifact = this.currentArtifact.split(latestActionContent)[1]; |
| 52 | this.onFileContent(filePath.split("\"")[1], fileContent); |
| 53 | } |
| 54 | } |
| 55 | } catch(e) {} |
| 56 | } |
| 57 | } |
no outgoing calls
no test coverage detected