Skip to content

Commit af6bef2

Browse files
authored
Merge pull request #7 from yamork779/feat-privacy
feat(privacy): add privacy mode setting to restrict prompt file permissions
2 parents 3ec26b4 + fa16e79 commit af6bef2

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎package.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@
146146
"maximum": 60,
147147
"description": "Auto-close timeout for the success message in seconds. Set to 0 to disable auto-close.",
148148
"order": 10
149+
},
150+
"claudeCommit.privacyMode": {
151+
"type": "boolean",
152+
"default": false,
153+
"markdownDescription": "Privacy mode: Restrict temporary prompt file permissions to owner-only (0600). When disabled, uses default permissions (0644). **Note: This option only takes effect on Linux/macOS. On Windows, file permissions are managed by the OS and this setting is ignored.**",
154+
"order": 11
149155
}
150156
}
151157
}

‎src/cli/execution.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export async function generateWithCLI(
2323

2424
const config = vscode.workspace.getConfiguration("claudeCommit");
2525
const model = config.get<Model>("model", "haiku");
26+
const privacyMode = config.get<boolean>("privacyMode", false);
2627

2728
const tmpDir = os.tmpdir();
2829
const promptFile = path.join(
@@ -31,7 +32,7 @@ export async function generateWithCLI(
3132
);
3233

3334
try {
34-
await fs.promises.writeFile(promptFile, prompt, "utf-8");
35+
await fs.promises.writeFile(promptFile, prompt, { encoding: "utf-8", mode: privacyMode ? 0o600 : 0o644 });
3536

3637
if (progressCallback) {
3738
progressCallback(`Using ${model} model...`);
@@ -122,14 +123,17 @@ export async function generateWithCLIManaged(
122123

123124
const escapedCliPath = cliPath.includes(" ") ? `"${cliPath}"` : cliPath;
124125

126+
const config = vscode.workspace.getConfiguration("claudeCommit");
127+
const privacyMode = config.get<boolean>("privacyMode", false);
128+
125129
const tmpDir = os.tmpdir();
126130
const promptFile = path.join(
127131
tmpDir,
128132
`claude-commit-prompt-${Date.now()}.txt`
129133
);
130134

131135
try {
132-
await fs.promises.writeFile(promptFile, prompt, "utf-8");
136+
await fs.promises.writeFile(promptFile, prompt, { encoding: "utf-8", mode: privacyMode ? 0o600 : 0o644 });
133137

134138
if (progressCallback) {
135139
progressCallback("Using haiku model (managed mode)...");

0 commit comments

Comments
 (0)