Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix(cli): use atomic write for rc file updates in install command
jkomyno121793eb7345
diff --git a/ts/packages/cli/src/commands/install.cmd.ts b/ts/packages/cli/src/commands/install.cmd.tsindex df1b8d5dc..3125756c0 100644--- a/ts/packages/cli/src/commands/install.cmd.ts+++ b/ts/packages/cli/src/commands/install.cmd.ts@@ -192,7 +192,12 @@ export const installShellIntegration = (params: {);const appendContent = '\n' + blocks.join('\n\n') + '\n';- yield* fs.writeFileString(rcPath, existing + appendContent);++ // Atomic write: write to a temp file then rename, so a crash mid-write+ // cannot leave the user's rc file truncated/corrupted.+ const tmpPath = `${rcPath}.composio-tmp`;+ yield* fs.writeFileString(tmpPath, existing + appendContent);+ yield* fs.rename(tmpPath, rcPath);yield* ui.log.success(`Updated ${tildify(rcPath, os.homedir)}`);yield* ui.note(