pumuki 6.3.64 → 6.3.65

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.
@@ -6,6 +6,11 @@ This file keeps only the operational highlights and rollout notes that matter wh
6
6
 
7
7
  ## 2026-04 (CLI stability and macOS notifications)
8
8
 
9
+ ### 2026-04-06 (v6.3.65)
10
+
11
+ - **pre-commit.com + `exec`**: Pumuki ya no inserta su bloque gestionado *después* del `exec` del hook generado por pre-commit (código inalcanzable). Tras actualizar a **6.3.65**, ejecutar `pumuki install` en el consumer para reordenar `.git/hooks/pre-commit`.
12
+ - Rollout: repin a `pumuki@6.3.65`; validar que un `git commit` dispara el gate (salida `[pumuki]` / policy) antes de que corra pre-commit.
13
+
9
14
  ### 2026-04-05 (v6.3.64)
10
15
 
11
16
  - **Notificaciones multiplataforma**: fuera de macOS, avisos críticos van a **stderr** por defecto (terminal visible). `PUMUKI_DISABLE_STDERR_NOTIFICATIONS=1` lo silencia para CI/scripts. En macOS, `PUMUKI_NOTIFICATION_STDERR_MIRROR=1` añade copia en terminal; si `osascript`/banner falla, stderr actúa como respaldo.
@@ -82,23 +82,58 @@ const ensureExecutableHeader = (contents: string): string => {
82
82
  return contents;
83
83
  };
84
84
 
85
+ const isPreCommitFrameworkWithExecTerminator = (contents: string): boolean => {
86
+ if (!contents.includes('pre-commit.com') && !contents.includes('pre_commit')) {
87
+ return false;
88
+ }
89
+ return /\bexec\b/.test(contents);
90
+ };
91
+
92
+ const prependManagedBlockAfterShebang = (params: {
93
+ contents: string;
94
+ block: string;
95
+ }): string => {
96
+ const trimmed = trimTrailingWhitespace(params.contents);
97
+ const firstNewline = trimmed.indexOf('\n');
98
+ const shebangLine = firstNewline === -1 ? trimmed : trimmed.slice(0, firstNewline);
99
+ const rest =
100
+ firstNewline === -1 ? '' : trimmed.slice(firstNewline + 1).replace(/^\n+/, '');
101
+ const header = shebangLine.startsWith('#!') ? shebangLine : '#!/usr/bin/env sh';
102
+ const bodyAfterShebang = shebangLine.startsWith('#!') ? rest : trimmed;
103
+ const tail = trimTrailingWhitespace(bodyAfterShebang);
104
+ return tail.length > 0
105
+ ? `${header}\n${params.block}\n\n${tail}\n`
106
+ : `${header}\n${params.block}\n`;
107
+ };
108
+
85
109
  export const upsertPumukiManagedBlock = (params: {
86
110
  contents: string;
87
111
  hook: PumukiManagedHook;
88
112
  }): string => {
89
113
  const block = buildPumukiManagedHookBlock(params.hook);
90
114
  const baseline = ensureExecutableHeader(params.contents);
115
+ const hadManagedBlock = hasPumukiManagedBlock(baseline);
116
+ const core = collapseBlankLines(
117
+ trimTrailingWhitespace(
118
+ hadManagedBlock ? baseline.replace(managedBlockPattern, '\n') : baseline
119
+ )
120
+ );
121
+
122
+ if (
123
+ params.hook === 'pre-commit' &&
124
+ core.length > 0 &&
125
+ isPreCommitFrameworkWithExecTerminator(core)
126
+ ) {
127
+ const merged = prependManagedBlockAfterShebang({ contents: core, block });
128
+ return `${trimTrailingWhitespace(merged)}\n`;
129
+ }
91
130
 
92
- if (hasPumukiManagedBlock(baseline)) {
93
- const replaced = baseline.replace(managedBlockPattern, `${block}\n`);
94
- return `${trimTrailingWhitespace(replaced)}\n`;
131
+ if (hadManagedBlock || core.length > 0) {
132
+ const withSeparator = core.length > 0 ? `${core}\n\n${block}` : block;
133
+ return `${trimTrailingWhitespace(withSeparator)}\n`;
95
134
  }
96
135
 
97
- const withSeparator =
98
- trimTrailingWhitespace(baseline).length > 0
99
- ? `${trimTrailingWhitespace(baseline)}\n\n${block}`
100
- : block;
101
- return `${withSeparator}\n`;
136
+ return `${block}\n`;
102
137
  };
103
138
 
104
139
  export const removePumukiManagedBlock = (contents: string): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.64",
3
+ "version": "6.3.65",
4
4
  "description": "Enterprise-grade AST Intelligence System with multi-platform support (iOS, Android, Backend, Frontend) and Feature-First + DDD + Clean Architecture enforcement. Includes dynamic violations API for intelligent querying.",
5
5
  "main": "index.js",
6
6
  "bin": {