Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 04:30 UTC
fix(cli): use atomic write for rc file updates in install command
Write to a temp file then rename, so a crash or Ctrl+C mid-write cannot leave the user's shell config file truncated or corrupted.
jkomyno committed
Mar 9, 2026 at 16:11 UTC
121793eb7345008d9a493e935b57779d5019278a
1 file changed
+6
-1
ts/packages/cli/src/commands/install.cmd.ts
+6
-1
@@ -192,7 +192,12 @@ export const installShellIntegration = (params: {
192
);
193
194
const appendContent = '\n' + blocks.join('\n\n') + '\n';
195
- yield* fs.writeFileString(rcPath, existing + appendContent);
195
+
196
+ // Atomic write: write to a temp file then rename, so a crash mid-write
197
+ // cannot leave the user's rc file truncated/corrupted.
198
+ const tmpPath = `${rcPath}.composio-tmp`;
199
+ yield* fs.writeFileString(tmpPath, existing + appendContent);
200
+ yield* fs.rename(tmpPath, rcPath);
201
202
yield* ui.log.success(`Updated ${tildify(rcPath, os.homedir)}`);
203
yield* ui.note(