pumuki 6.3.304 → 6.3.306

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,4 +1,5 @@
1
1
  import { existsSync } from 'node:fs';
2
+ import { execFileSync } from 'node:child_process';
2
3
  import { evaluateAiGate } from '../gate/evaluateAiGate';
3
4
  import { GitService } from '../git/GitService';
4
5
  import { runPlatformGate } from '../git/runPlatformGate';
@@ -87,11 +88,46 @@ const collectAutoFixableViolationCodes = (aiGate: ReturnType<typeof evaluateAiGa
87
88
  .map((violation) => violation.code)
88
89
  .sort((left, right) => left.localeCompare(right));
89
90
 
91
+ const PRE_WRITE_FUNCTIONAL_EXTENSIONS = [
92
+ '.swift',
93
+ '.ts',
94
+ '.tsx',
95
+ '.js',
96
+ '.jsx',
97
+ '.kt',
98
+ '.kts',
99
+ ] as const;
100
+
101
+ const isFunctionalPath = (filePath: string): boolean => {
102
+ const normalized = filePath.trim().toLowerCase();
103
+ return PRE_WRITE_FUNCTIONAL_EXTENSIONS.some((extension) => normalized.endsWith(extension));
104
+ };
105
+
106
+ const collectStagedPaths = (repoRoot: string): ReadonlyArray<string> | null => {
107
+ try {
108
+ return execFileSync('git', ['diff', '--cached', '--name-only'], {
109
+ cwd: repoRoot,
110
+ encoding: 'utf8',
111
+ stdio: ['ignore', 'pipe', 'ignore'],
112
+ })
113
+ .split('\n')
114
+ .map((line) => line.trim())
115
+ .filter((line) => line.length > 0);
116
+ } catch {
117
+ return null;
118
+ }
119
+ };
120
+
90
121
  const resolvePreWriteRefreshScope = (aiGate: ReturnType<typeof evaluateAiGate>): GateScope => {
91
122
  const staged = aiGate.repo_state.git.staged ?? 0;
92
- return staged > 0
93
- ? { kind: 'staged' }
94
- : { kind: 'workingTree' };
123
+ if (staged <= 0) {
124
+ return { kind: 'workingTree' };
125
+ }
126
+ const stagedPaths = collectStagedPaths(aiGate.repo_state.repo_root);
127
+ if (stagedPaths === null || stagedPaths.some(isFunctionalPath)) {
128
+ return { kind: 'staged' };
129
+ }
130
+ return { kind: 'workingTree' };
95
131
  };
96
132
 
97
133
  export const buildPreWriteAutomationTrace = async (params: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.304",
3
+ "version": "6.3.306",
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": {