pumuki 6.3.303 → 6.3.305

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.
@@ -553,6 +553,18 @@ const hasEffectiveChangedCodePlatforms = (params: {
553
553
  params.requiredPlatforms.some((platform) => isPlatformPath(platform, filePath))
554
554
  );
555
555
 
556
+ const toChangedPathDetectedPlatforms = (params: {
557
+ changedPaths: ReadonlyArray<string>;
558
+ requiredPlatforms: ReadonlyArray<PreWriteSkillsPlatform>;
559
+ }): ReadonlyArray<PreWriteSkillsPlatform> => {
560
+ if (params.changedPaths.length === 0 || params.requiredPlatforms.length === 0) {
561
+ return [];
562
+ }
563
+ return params.requiredPlatforms.filter((platform) =>
564
+ params.changedPaths.some((filePath) => isPlatformPath(platform, filePath))
565
+ );
566
+ };
567
+
556
568
  const toLockRequiredPlatforms = (
557
569
  requiredLock: SkillsLockV1 | undefined
558
570
  ): ReadonlyArray<PreWriteSkillsPlatform> => {
@@ -870,6 +882,10 @@ const toSkillsContractAssessment = (params: {
870
882
  const coverage = params.evidenceResult.evidence.snapshot.rules_coverage;
871
883
  const explicitlyDetectedPlatforms = toDetectedSkillsPlatforms(params.evidenceResult.evidence.platforms);
872
884
  const inferredPlatforms = toCoverageInferredPlatforms(coverage);
885
+ const changedPathDetectedPlatforms = toChangedPathDetectedPlatforms({
886
+ changedPaths: effectiveChangedPaths,
887
+ requiredPlatforms,
888
+ });
873
889
  const repoTreeDetectedPlatforms =
874
890
  params.stage !== 'PRE_WRITE' && requiredPlatforms.length > 0 && !hasEffectiveChangedPaths
875
891
  ? toRepoTreeDetectedPlatforms({
@@ -889,7 +905,9 @@ const toSkillsContractAssessment = (params: {
889
905
  ? explicitlyDetectedEffectivePlatforms
890
906
  : inferredPlatforms.length > 0
891
907
  ? inferredPlatforms
892
- : repoTreeDetectedPlatforms;
908
+ : changedPathDetectedPlatforms.length > 0
909
+ ? changedPathDetectedPlatforms
910
+ : repoTreeDetectedPlatforms;
893
911
  const pendingChanges = resolvePendingChanges(params.repoState);
894
912
  const detectedPlatformSet = new Set(detectedPlatforms);
895
913
  const assessmentPlatforms =
@@ -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> => {
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 [];
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.length === 0 || 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.303",
3
+ "version": "6.3.305",
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": {