fix: fix variable shadowing in file action parsing

Rename conflicting variable 'actionType' to 'fileActionType' to avoid shadowing
This commit is contained in:
KevIsDev 2025-06-23 13:20:03 +01:00
parent 335f7c6077
commit c5804a4ab9
2 changed files with 4 additions and 2 deletions

View File

@ -57,6 +57,7 @@ exports[`StreamingMessageParser > valid artifacts with actions > should correctl
exports[`StreamingMessageParser > valid artifacts with actions > should correctly parse chunks and strip out bolt artifacts (1) > onActionClose 2`] = `
{
"action": {
"actionType": "create",
"content": "some content
",
"filePath": "index.js",
@ -83,6 +84,7 @@ exports[`StreamingMessageParser > valid artifacts with actions > should correctl
exports[`StreamingMessageParser > valid artifacts with actions > should correctly parse chunks and strip out bolt artifacts (1) > onActionOpen 2`] = `
{
"action": {
"actionType": "create",
"content": "",
"filePath": "index.js",
"type": "file",

View File

@ -357,14 +357,14 @@ export class StreamingMessageParser {
}
} else if (actionType === 'file') {
const filePath = this.#extractAttribute(actionTag, 'filePath') as string;
const actionType = this.#extractAttribute(actionTag, 'actionType') as 'create' | 'update';
const fileActionType = this.#extractAttribute(actionTag, 'actionType') as 'create' | 'update';
if (!filePath) {
logger.debug('File path not specified');
}
(actionAttributes as FileAction).filePath = filePath;
(actionAttributes as FileAction).actionType = actionType || 'create'; // default to 'create' if not specified
(actionAttributes as FileAction).actionType = fileActionType || 'create';
} else if (!['shell', 'start'].includes(actionType)) {
logger.warn(`Unknown action type '${actionType}'`);
}