pumuki 6.3.233 → 6.3.235
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/bin/_chained-pre-write.js +22 -0
- package/bin/pumuki-pre-commit.js +5 -0
- package/bin/pumuki-pre-push.js +5 -0
- package/integrations/git/runPlatformGate.ts +71 -3
- package/integrations/lifecycle/audit.ts +4 -1
- package/integrations/lifecycle/hookBlock.ts +5 -2
- package/package.json +1 -1
- package/scripts/framework-menu-system-notifications-cause.ts +21 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const PRE_WRITE_ENTRY = 'integrations/lifecycle/cli.ts';
|
|
2
|
+
const PRE_WRITE_ARGS = ['sdd', 'validate', '--stage=PRE_WRITE'];
|
|
3
|
+
|
|
4
|
+
function shouldRunChainedPreWrite(env = process.env) {
|
|
5
|
+
if (env.PUMUKI_SKIP_CHAINED_PRE_WRITE === '1') {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return env.PUMUKI_CHAINED_PRE_WRITE_DONE !== '1';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function runChainedPreWriteIfNeeded(runTsEntry, env = process.env) {
|
|
12
|
+
if (!shouldRunChainedPreWrite(env)) {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
env.PUMUKI_CHAINED_PRE_WRITE_DONE = '1';
|
|
16
|
+
return runTsEntry(PRE_WRITE_ENTRY, PRE_WRITE_ARGS);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = {
|
|
20
|
+
runChainedPreWriteIfNeeded,
|
|
21
|
+
shouldRunChainedPreWrite,
|
|
22
|
+
};
|
package/bin/pumuki-pre-commit.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { runTsEntry } = require('./_run-ts-entry');
|
|
4
|
+
const { runChainedPreWriteIfNeeded } = require('./_chained-pre-write');
|
|
4
5
|
|
|
6
|
+
const preWriteStatus = runChainedPreWriteIfNeeded(runTsEntry);
|
|
7
|
+
if (preWriteStatus !== 0) {
|
|
8
|
+
process.exit(preWriteStatus);
|
|
9
|
+
}
|
|
5
10
|
process.exit(runTsEntry('integrations/git/preCommitBackend.cli.ts', process.argv.slice(2)));
|
package/bin/pumuki-pre-push.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { runTsEntry } = require('./_run-ts-entry');
|
|
4
|
+
const { runChainedPreWriteIfNeeded } = require('./_chained-pre-write');
|
|
4
5
|
|
|
6
|
+
const preWriteStatus = runChainedPreWriteIfNeeded(runTsEntry);
|
|
7
|
+
if (preWriteStatus !== 0) {
|
|
8
|
+
process.exit(preWriteStatus);
|
|
9
|
+
}
|
|
5
10
|
process.exit(runTsEntry('integrations/git/prePushBackend.cli.ts', process.argv.slice(2)));
|
|
@@ -80,6 +80,61 @@ const defaultServices: GateServices = {
|
|
|
80
80
|
evidence: new EvidenceService(),
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
+
const hasPositiveFindingLine = (lines: Finding['lines']): boolean => {
|
|
84
|
+
if (typeof lines === 'number') {
|
|
85
|
+
return Number.isFinite(lines) && lines > 0;
|
|
86
|
+
}
|
|
87
|
+
if (typeof lines === 'string') {
|
|
88
|
+
return lines.trim().length > 0;
|
|
89
|
+
}
|
|
90
|
+
if (Array.isArray(lines)) {
|
|
91
|
+
return lines.some((line) => Number.isFinite(line) && line > 0);
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const hasActionableFindingLocation = (finding: Finding): boolean => {
|
|
97
|
+
return (
|
|
98
|
+
hasPositiveFindingLine(finding.lines) ||
|
|
99
|
+
finding.primary_node !== undefined ||
|
|
100
|
+
(finding.related_nodes?.length ?? 0) > 0
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const toNonActionableScopedAdvisoryFinding = (finding: Finding): Finding => ({
|
|
105
|
+
...finding,
|
|
106
|
+
blocking: false,
|
|
107
|
+
message:
|
|
108
|
+
`${finding.message} ` +
|
|
109
|
+
'(Advisory: Pumuki no pudo atribuir este hallazgo a una linea, rango o nodo accionable en el scope actual.)',
|
|
110
|
+
why:
|
|
111
|
+
finding.why ??
|
|
112
|
+
'El gate esta limitado a un scope acotado y este finding solo pudo atribuirse al archivo completo.',
|
|
113
|
+
expected_fix:
|
|
114
|
+
finding.expected_fix ??
|
|
115
|
+
'Reintentar cuando el detector aporte lineas, rango, simbolo o nodo; mientras tanto no bloquea el slice acotado.',
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const normalizeScopedRuleEngineFindings = (params: {
|
|
119
|
+
findings: ReadonlyArray<Finding>;
|
|
120
|
+
scope: GateScope;
|
|
121
|
+
}): ReadonlyArray<Finding> => {
|
|
122
|
+
if (params.scope.kind !== 'staged' && params.scope.kind !== 'range') {
|
|
123
|
+
return params.findings;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return params.findings.map((finding) => {
|
|
127
|
+
if (
|
|
128
|
+
!finding.filePath ||
|
|
129
|
+
hasActionableFindingLocation(finding) ||
|
|
130
|
+
(!finding.ruleId.startsWith('skills.') && !finding.ruleId.startsWith('heuristics.'))
|
|
131
|
+
) {
|
|
132
|
+
return finding;
|
|
133
|
+
}
|
|
134
|
+
return toNonActionableScopedAdvisoryFinding(finding);
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
|
|
83
138
|
const buildDefaultMemoryShadowRecommendation = (params: {
|
|
84
139
|
findings: ReadonlyArray<Finding>;
|
|
85
140
|
tddBddSnapshot?: TddBddSnapshot;
|
|
@@ -960,7 +1015,11 @@ export async function runPlatformGate(params: {
|
|
|
960
1015
|
evaluationFacts = factsForPlatformEvaluation,
|
|
961
1016
|
findings: ruleEngineFindings,
|
|
962
1017
|
} = platformEvaluation;
|
|
963
|
-
const
|
|
1018
|
+
const scopedRuleEngineFindings = normalizeScopedRuleEngineFindings({
|
|
1019
|
+
findings: ruleEngineFindings,
|
|
1020
|
+
scope: params.scope,
|
|
1021
|
+
});
|
|
1022
|
+
const findings = [...aiGateRepoPolicyFindings, ...scopedRuleEngineFindings];
|
|
964
1023
|
const evaluationMetrics: SnapshotEvaluationMetrics = coverage
|
|
965
1024
|
? {
|
|
966
1025
|
facts_total: coverage.factsTotal,
|
|
@@ -1270,7 +1329,15 @@ export async function runPlatformGate(params: {
|
|
|
1270
1329
|
? [...brownfieldHotspotFindings, ...findings]
|
|
1271
1330
|
: findings;
|
|
1272
1331
|
const hasAstIntelligenceBlockingFinding = shouldBlockFromFinding(astIntelligenceDualFinding);
|
|
1273
|
-
const
|
|
1332
|
+
const gateDecisionFindings = effectiveFindings.filter((finding) => finding.blocking !== false);
|
|
1333
|
+
const decision = dependencies.evaluateGate([...gateDecisionFindings], params.policy);
|
|
1334
|
+
const hasNonBlockingAdvisoryFinding = effectiveFindings.some(
|
|
1335
|
+
(finding) =>
|
|
1336
|
+
finding.blocking === false &&
|
|
1337
|
+
(finding.severity === 'WARN' ||
|
|
1338
|
+
finding.severity === 'ERROR' ||
|
|
1339
|
+
finding.severity === 'CRITICAL')
|
|
1340
|
+
);
|
|
1274
1341
|
const baseGateOutcome =
|
|
1275
1342
|
sddBlockingFinding ||
|
|
1276
1343
|
degradedModeBlocks ||
|
|
@@ -1286,7 +1353,8 @@ export async function runPlatformGate(params: {
|
|
|
1286
1353
|
brownfieldHotspotFindings.some((finding) => shouldBlockFromFinding(finding)) ||
|
|
1287
1354
|
hasTddBddBlockingFinding
|
|
1288
1355
|
? 'BLOCK'
|
|
1289
|
-
: (decision.outcome === 'PASS' &&
|
|
1356
|
+
: (decision.outcome === 'PASS' &&
|
|
1357
|
+
(tddBddSnapshot?.status === 'advisory' || hasNonBlockingAdvisoryFinding)
|
|
1290
1358
|
? 'WARN'
|
|
1291
1359
|
: decision.outcome);
|
|
1292
1360
|
const gateWaiverStage =
|
|
@@ -207,7 +207,10 @@ const resolveLifecycleAuditScope = (params: {
|
|
|
207
207
|
extensions: ReadonlyArray<string>;
|
|
208
208
|
stagedMatchingExtensions: ReadonlyArray<string>;
|
|
209
209
|
}): LifecycleAuditScope => {
|
|
210
|
-
if (
|
|
210
|
+
if (
|
|
211
|
+
(params.stage === 'PRE_WRITE' || params.stage === 'PRE_COMMIT') &&
|
|
212
|
+
params.stagedMatchingExtensions.length > 0
|
|
213
|
+
) {
|
|
211
214
|
return { kind: 'staged' };
|
|
212
215
|
}
|
|
213
216
|
if (params.stage === 'PRE_PUSH') {
|
|
@@ -33,8 +33,11 @@ const runnerLine = (
|
|
|
33
33
|
phase: ResolverPhase,
|
|
34
34
|
runner: string
|
|
35
35
|
): string => {
|
|
36
|
-
if (
|
|
37
|
-
|
|
36
|
+
if (phase === 'main') {
|
|
37
|
+
if (parentHook === 'pre-push') {
|
|
38
|
+
return ` PUMUKI_CHAINED_PRE_WRITE_DONE=1 PUMUKI_PRE_PUSH_STDIN="$PUMUKI_PRE_PUSH_STDIN" ${runner} "$@"`;
|
|
39
|
+
}
|
|
40
|
+
return ` PUMUKI_CHAINED_PRE_WRITE_DONE=1 ${runner}`;
|
|
38
41
|
}
|
|
39
42
|
return ` ${runner}`;
|
|
40
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pumuki",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.235",
|
|
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": {
|
|
@@ -30,6 +30,10 @@ const BLOCKED_CAUSE_SUMMARY_BY_CODE: Readonly<Record<string, string>> = {
|
|
|
30
30
|
'Hay conflicto entre fuentes de tracking canónico.',
|
|
31
31
|
ACTIVE_RULE_IDS_EMPTY_FOR_CODE_CHANGES_HIGH:
|
|
32
32
|
'No hay reglas activas para cambios de código.',
|
|
33
|
+
EVIDENCE_PLATFORM_CRITICAL_SKILLS_RULES_MISSING:
|
|
34
|
+
'Falta enforcement crítico de skills para la plataforma detectada.',
|
|
35
|
+
EVIDENCE_SKILLS_CONTRACT_INCOMPLETE:
|
|
36
|
+
'El contrato de skills está incompleto para este stage.',
|
|
33
37
|
};
|
|
34
38
|
|
|
35
39
|
const ENGLISH_CAUSE_HINTS = [
|
|
@@ -53,6 +57,19 @@ const ENGLISH_CAUSE_HINTS = [
|
|
|
53
57
|
'usage.',
|
|
54
58
|
];
|
|
55
59
|
|
|
60
|
+
const PRIORITY_CODES_FROM_MESSAGE = [
|
|
61
|
+
'EVIDENCE_PLATFORM_CRITICAL_SKILLS_RULES_MISSING',
|
|
62
|
+
'EVIDENCE_SKILLS_CONTRACT_INCOMPLETE',
|
|
63
|
+
'ACTIVE_RULE_IDS_EMPTY_FOR_CODE_CHANGES_HIGH',
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const resolvePriorityCauseFromMessage = (message?: string): string | null => {
|
|
67
|
+
if (!message) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return PRIORITY_CODES_FROM_MESSAGE.find((code) => message.includes(code)) ?? null;
|
|
71
|
+
};
|
|
72
|
+
|
|
56
73
|
const buildGenericSpanishBlockedCauseSummary = (
|
|
57
74
|
event: Extract<PumukiCriticalNotificationEvent, { kind: 'gate.blocked' }>,
|
|
58
75
|
causeCode: string
|
|
@@ -97,6 +114,10 @@ export const resolveBlockedCauseSummary = (
|
|
|
97
114
|
causeCode: string
|
|
98
115
|
): string => {
|
|
99
116
|
const trackingContext = extractNotificationTrackingContext(event.causeMessage);
|
|
117
|
+
const priorityCode = resolvePriorityCauseFromMessage(event.causeMessage);
|
|
118
|
+
if (priorityCode) {
|
|
119
|
+
return BLOCKED_CAUSE_SUMMARY_BY_CODE[priorityCode];
|
|
120
|
+
}
|
|
100
121
|
if (trackingContext) {
|
|
101
122
|
return buildNotificationTrackingCauseSummary(trackingContext);
|
|
102
123
|
}
|