maxsim-flutter 1.33.0 → 1.34.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks-writer.d.ts","sourceRoot":"","sources":["../../src/claude-setup/hooks-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks-writer.d.ts","sourceRoot":"","sources":["../../src/claude-setup/hooks-writer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AA2GzD,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmG3F"}
|
|
@@ -32,6 +32,55 @@ if echo "$INPUT" | grep -qE '"file_path"\\s*:\\s*"[^"]*\\.dart"'; then
|
|
|
32
32
|
fi
|
|
33
33
|
fi
|
|
34
34
|
|
|
35
|
+
exit 0
|
|
36
|
+
`;
|
|
37
|
+
const PROTECT_SECRETS_SH = `#!/bin/bash
|
|
38
|
+
# PreToolUse hook: block access to secret/credential files
|
|
39
|
+
# Matches Read, Edit, Write tool invocations
|
|
40
|
+
|
|
41
|
+
INPUT=$(cat)
|
|
42
|
+
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // empty')
|
|
43
|
+
|
|
44
|
+
[ -z "$FILE" ] && exit 0
|
|
45
|
+
|
|
46
|
+
# Check for sensitive file patterns
|
|
47
|
+
case "$FILE" in
|
|
48
|
+
*.env|*.env.*|*.pem|*.key)
|
|
49
|
+
echo '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Blocked: access to sensitive file '"$FILE"'"}}'
|
|
50
|
+
exit 0
|
|
51
|
+
;;
|
|
52
|
+
esac
|
|
53
|
+
|
|
54
|
+
BASENAME=$(basename "$FILE")
|
|
55
|
+
case "$BASENAME" in
|
|
56
|
+
credentials*|secrets*)
|
|
57
|
+
echo '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"Blocked: access to credentials/secrets file '"$FILE"'"}}'
|
|
58
|
+
exit 0
|
|
59
|
+
;;
|
|
60
|
+
esac
|
|
61
|
+
|
|
62
|
+
exit 0
|
|
63
|
+
`;
|
|
64
|
+
const NOTIFY_WAITING_SH = `#!/bin/bash
|
|
65
|
+
# Notification hook: send desktop notification when Claude needs attention
|
|
66
|
+
# Triggered on idle_prompt events
|
|
67
|
+
|
|
68
|
+
INPUT=$(cat)
|
|
69
|
+
|
|
70
|
+
# Cross-platform notification
|
|
71
|
+
MESSAGE="Claude Code needs your attention"
|
|
72
|
+
|
|
73
|
+
if command -v osascript &>/dev/null; then
|
|
74
|
+
# macOS
|
|
75
|
+
osascript -e "display notification \\"$MESSAGE\\" with title \\"Claude Code\\"" 2>/dev/null &
|
|
76
|
+
elif command -v notify-send &>/dev/null; then
|
|
77
|
+
# Linux (freedesktop)
|
|
78
|
+
notify-send "Claude Code" "$MESSAGE" 2>/dev/null &
|
|
79
|
+
elif command -v powershell.exe &>/dev/null; then
|
|
80
|
+
# Windows (WSL)
|
|
81
|
+
powershell.exe -Command "[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | Out-Null; [System.Windows.Forms.MessageBox]::Show('$MESSAGE', 'Claude Code')" 2>/dev/null &
|
|
82
|
+
fi
|
|
83
|
+
|
|
35
84
|
exit 0
|
|
36
85
|
`;
|
|
37
86
|
export async function writeHooks(context, outputPath) {
|
|
@@ -42,11 +91,17 @@ export async function writeHooks(context, outputPath) {
|
|
|
42
91
|
// Write shell scripts
|
|
43
92
|
const blockDangerousPath = path.join(hooksDir, 'block-dangerous.sh');
|
|
44
93
|
const formatDartPath = path.join(hooksDir, 'format-dart.sh');
|
|
94
|
+
const protectSecretsPath = path.join(hooksDir, 'protect-secrets.sh');
|
|
95
|
+
const notifyWaitingPath = path.join(hooksDir, 'notify-waiting.sh');
|
|
45
96
|
await fs.writeFile(blockDangerousPath, BLOCK_DANGEROUS_SH);
|
|
46
97
|
await fs.writeFile(formatDartPath, FORMAT_DART_SH);
|
|
98
|
+
await fs.writeFile(protectSecretsPath, PROTECT_SECRETS_SH);
|
|
99
|
+
await fs.writeFile(notifyWaitingPath, NOTIFY_WAITING_SH);
|
|
47
100
|
// Make scripts executable (mode 0o755)
|
|
48
101
|
await chmod(blockDangerousPath, 0o755);
|
|
49
102
|
await chmod(formatDartPath, 0o755);
|
|
103
|
+
await chmod(protectSecretsPath, 0o755);
|
|
104
|
+
await chmod(notifyWaitingPath, 0o755);
|
|
50
105
|
// Build hooks config
|
|
51
106
|
const hooks = {
|
|
52
107
|
PreToolUse: [
|
|
@@ -59,6 +114,16 @@ export async function writeHooks(context, outputPath) {
|
|
|
59
114
|
},
|
|
60
115
|
],
|
|
61
116
|
},
|
|
117
|
+
{
|
|
118
|
+
matcher: 'Read|Edit|Write',
|
|
119
|
+
hooks: [
|
|
120
|
+
{
|
|
121
|
+
type: 'command',
|
|
122
|
+
command: '.claude/hooks/protect-secrets.sh',
|
|
123
|
+
timeout: 5,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
},
|
|
62
127
|
],
|
|
63
128
|
PostToolUse: [
|
|
64
129
|
{
|
|
@@ -81,6 +146,18 @@ export async function writeHooks(context, outputPath) {
|
|
|
81
146
|
],
|
|
82
147
|
},
|
|
83
148
|
],
|
|
149
|
+
Notification: [
|
|
150
|
+
{
|
|
151
|
+
matcher: 'idle_prompt',
|
|
152
|
+
hooks: [
|
|
153
|
+
{
|
|
154
|
+
type: 'command',
|
|
155
|
+
command: '.claude/hooks/notify-waiting.sh',
|
|
156
|
+
timeout: 10,
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
],
|
|
84
161
|
};
|
|
85
162
|
if (context.claude?.agentTeams) {
|
|
86
163
|
hooks.TeammateIdle = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks-writer.js","sourceRoot":"","sources":["../../src/claude-setup/hooks-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks-writer.js","sourceRoot":"","sources":["../../src/claude-setup/hooks-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,IAAI,MAAM,WAAW,CAAC;AAsB7B,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;CAgB1B,CAAC;AAEF,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;CAetB,CAAC;AAEF,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B1B,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBzB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAuB,EAAE,UAAkB;IAC1E,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAE/C,MAAM,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,MAAM,KAAK,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE3C,sBAAsB;IACtB,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IACrE,MAAM,c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