@fermindi/pwn-cli 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli/update.js
CHANGED
|
@@ -166,12 +166,13 @@ export default async function updateCommand(args = []) {
|
|
|
166
166
|
if (templateContent !== currentContent) {
|
|
167
167
|
if (dryRun) {
|
|
168
168
|
console.log(` 📝 Would update: CLAUDE.md`);
|
|
169
|
-
if (
|
|
169
|
+
// Only mention backup if content is actually different (not empty)
|
|
170
|
+
if (currentContent && currentContent !== templateContent) {
|
|
170
171
|
console.log(` 📦 Would backup: CLAUDE.md → ~CLAUDE.md`);
|
|
171
172
|
}
|
|
172
173
|
} else {
|
|
173
|
-
// Backup existing CLAUDE.md
|
|
174
|
-
if (existsSync(claudeMdPath) && currentContent) {
|
|
174
|
+
// Backup existing CLAUDE.md only if it has custom content (different from template)
|
|
175
|
+
if (existsSync(claudeMdPath) && currentContent && currentContent !== templateContent) {
|
|
175
176
|
renameSync(claudeMdPath, backupClaudeMdPath);
|
|
176
177
|
console.log(` 📦 Backed up: CLAUDE.md → ~CLAUDE.md`);
|
|
177
178
|
backed_up.push('CLAUDE.md');
|
package/package.json
CHANGED
package/src/core/inject.js
CHANGED
|
@@ -175,23 +175,28 @@ export async function inject(options = {}) {
|
|
|
175
175
|
// Update .gitignore
|
|
176
176
|
updateGitignore(cwd, silent);
|
|
177
177
|
|
|
178
|
-
// Handle CLAUDE.md: backup existing and copy PWN template to root
|
|
178
|
+
// Handle CLAUDE.md: backup existing (only if different) and copy PWN template to root
|
|
179
179
|
let backupInfo = { backed_up: [] };
|
|
180
180
|
const claudeMdPath = join(cwd, 'CLAUDE.md');
|
|
181
181
|
const backupClaudeMdPath = join(cwd, '~CLAUDE.md');
|
|
182
182
|
const templateClaudeMd = join(targetDir, 'agents', 'claude.md');
|
|
183
|
+
const templateContent = existsSync(templateClaudeMd) ? readFileSync(templateClaudeMd, 'utf8') : '';
|
|
183
184
|
|
|
184
|
-
// Backup existing CLAUDE.md if present
|
|
185
|
+
// Backup existing CLAUDE.md if present AND different from template
|
|
185
186
|
if (backedUpContent['CLAUDE.md'] || backedUpContent['claude.md']) {
|
|
186
187
|
const originalName = backedUpContent['CLAUDE.md'] ? 'CLAUDE.md' : 'claude.md';
|
|
187
188
|
const originalPath = join(cwd, originalName);
|
|
189
|
+
const existingContent = backedUpContent[originalName]?.content || '';
|
|
188
190
|
|
|
189
|
-
if
|
|
191
|
+
// Only backup if content is different from PWN template
|
|
192
|
+
if (existsSync(originalPath) && existingContent !== templateContent) {
|
|
190
193
|
renameSync(originalPath, backupClaudeMdPath);
|
|
191
194
|
backupInfo.backed_up.push({ from: originalName, to: '~CLAUDE.md' });
|
|
192
195
|
if (!silent) {
|
|
193
196
|
console.log(`📦 Backed up ${originalName} → ~CLAUDE.md`);
|
|
194
197
|
}
|
|
198
|
+
} else if (existsSync(originalPath) && !silent) {
|
|
199
|
+
console.log(`⏭️ Skipped backup: ${originalName} is identical to PWN template`);
|
|
195
200
|
}
|
|
196
201
|
}
|
|
197
202
|
|
|
@@ -2,20 +2,11 @@
|
|
|
2
2
|
"hooks": {
|
|
3
3
|
"Notification": [
|
|
4
4
|
{
|
|
5
|
-
"matcher": "
|
|
5
|
+
"matcher": "",
|
|
6
6
|
"hooks": [
|
|
7
7
|
{
|
|
8
8
|
"type": "command",
|
|
9
|
-
"command": "pwn notify send \"Claude Code aguardando
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"matcher": "idle_prompt",
|
|
15
|
-
"hooks": [
|
|
16
|
-
{
|
|
17
|
-
"type": "command",
|
|
18
|
-
"command": "pwn notify send \"Claude Code aguardando input\" --title \"PWN\""
|
|
9
|
+
"command": "pwn notify send \"Claude Code aguardando permissao\" --title \"PWN\""
|
|
19
10
|
}
|
|
20
11
|
]
|
|
21
12
|
}
|