pumuki-ast-hooks 5.6.11 → 5.6.12
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/assets/Hook_01.png +0 -0
- package/assets/Hook_02.png +0 -0
- package/assets/ai-start.png +0 -0
- package/assets/ai_gate.png +0 -0
- package/assets/ast_intelligence_01.png +0 -0
- package/assets/ast_intelligence_01.svg +40 -0
- package/assets/ast_intelligence_02.png +0 -0
- package/assets/ast_intelligence_02.svg +39 -0
- package/assets/ast_intelligence_03.png +0 -0
- package/assets/ast_intelligence_03.svg +55 -0
- package/assets/ast_intelligence_04.png +0 -0
- package/assets/ast_intelligence_04.svg +39 -0
- package/assets/ast_intelligence_05.png +0 -0
- package/assets/ast_intelligence_05.svg +45 -0
- package/assets/logo.png +0 -0
- package/assets/logo_banner.svg +29 -0
- package/assets/pre-flight-check.png +0 -0
- package/package.json +2 -1
- package/scripts/hooks-system/.audit_tmp/hook-metrics.jsonl +4 -0
- package/scripts/hooks-system/infrastructure/ast/common/__tests__/ast-common.spec.js +30 -0
- package/scripts/hooks-system/infrastructure/ast/common/ast-common.js +12 -1
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pumuki-ast-hooks",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.12",
|
|
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": {
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
"skills/",
|
|
117
117
|
"hooks/",
|
|
118
118
|
"docs/",
|
|
119
|
+
"assets/",
|
|
119
120
|
"index.js",
|
|
120
121
|
"README.md",
|
|
121
122
|
"LICENSE"
|
|
@@ -498,3 +498,7 @@
|
|
|
498
498
|
{"timestamp":1768158514231,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
499
499
|
{"timestamp":1768158514231,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
500
500
|
{"timestamp":1768158514232,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
501
|
+
{"timestamp":1768158974401,"hook":"audit_logger","operation":"constructor","status":"started","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
502
|
+
{"timestamp":1768158974401,"hook":"audit_logger","operation":"ensure_dir","status":"started"}
|
|
503
|
+
{"timestamp":1768158974401,"hook":"audit_logger","operation":"ensure_dir","status":"success"}
|
|
504
|
+
{"timestamp":1768158974402,"hook":"audit_logger","operation":"constructor","status":"success","repoRoot":"/Users/juancarlosmerlosalbarracin/Developer/Projects/ast-intelligence-hooks/scripts/hooks-system"}
|
|
@@ -2,6 +2,7 @@ jest.mock('../BDDTDDWorkflowRules', () => ({
|
|
|
2
2
|
BDDTDDWorkflowRules: jest.fn().mockImplementation(() => ({ analyze: jest.fn() }))
|
|
3
3
|
}));
|
|
4
4
|
|
|
5
|
+
const fs = require('fs');
|
|
5
6
|
const { Project } = require('../../ast-core');
|
|
6
7
|
const { runCommonIntelligence } = require('../ast-common');
|
|
7
8
|
|
|
@@ -28,6 +29,35 @@ describe('AST Common Module', () => {
|
|
|
28
29
|
expect(findings.some(f => f.ruleId === 'common.testing.missing_makesut')).toBe(false);
|
|
29
30
|
expect(findings.some(f => f.ruleId === 'common.testing.missing_track_for_memory_leaks')).toBe(false);
|
|
30
31
|
});
|
|
32
|
+
|
|
33
|
+
it('does not report false positives for Swift test files when getFullText is empty (fallback to disk)', () => {
|
|
34
|
+
const project = new Project({
|
|
35
|
+
useInMemoryFileSystem: true,
|
|
36
|
+
skipAddingFilesFromTsConfig: true,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const swiftPath = '/tmp/FooTests.spec.swift';
|
|
40
|
+
const swiftContent = [
|
|
41
|
+
'import XCTest',
|
|
42
|
+
'final class FooTests: XCTestCase {',
|
|
43
|
+
' private func makeSUT() -> Foo { Foo() }',
|
|
44
|
+
' func test_example() {',
|
|
45
|
+
' let sut = makeSUT()',
|
|
46
|
+
' trackForMemoryLeaks(sut, testCase: self, file: #file, line: #line)',
|
|
47
|
+
' }',
|
|
48
|
+
'}',
|
|
49
|
+
].join('\n');
|
|
50
|
+
|
|
51
|
+
const sf = project.createSourceFile(swiftPath, swiftContent);
|
|
52
|
+
jest.spyOn(sf, 'getFullText').mockReturnValue('');
|
|
53
|
+
jest.spyOn(fs, 'readFileSync').mockReturnValue(swiftContent);
|
|
54
|
+
|
|
55
|
+
const findings = [];
|
|
56
|
+
runCommonIntelligence(project, findings);
|
|
57
|
+
|
|
58
|
+
expect(findings.some(f => f.ruleId === 'common.testing.missing_makesut')).toBe(false);
|
|
59
|
+
expect(findings.some(f => f.ruleId === 'common.testing.missing_track_for_memory_leaks')).toBe(false);
|
|
60
|
+
});
|
|
31
61
|
});
|
|
32
62
|
|
|
33
63
|
describe('exports', () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const fs = require('fs');
|
|
2
3
|
const { pushFinding, SyntaxKind, platformOf, getRepoRoot } = require(path.join(__dirname, '../ast-core'));
|
|
3
4
|
const { BDDTDDWorkflowRules } = require(path.join(__dirname, 'BDDTDDWorkflowRules'));
|
|
4
5
|
|
|
@@ -208,11 +209,21 @@ function runCommonIntelligence(project, findings) {
|
|
|
208
209
|
if (/\/ast-(?:backend|frontend|android|ios|common|core|intelligence)\.js$/.test(filePath)) return;
|
|
209
210
|
|
|
210
211
|
if (isTestFilePath(filePath)) {
|
|
211
|
-
|
|
212
|
+
let content = sf.getFullText();
|
|
212
213
|
|
|
213
214
|
const ext = path.extname(filePath).toLowerCase();
|
|
214
215
|
const isSwiftOrKotlinTest = ext === '.swift' || ext === '.kt' || ext === '.kts';
|
|
215
216
|
|
|
217
|
+
if (isSwiftOrKotlinTest && (!content || content.trim().length === 0)) {
|
|
218
|
+
try {
|
|
219
|
+
content = fs.readFileSync(filePath, 'utf8');
|
|
220
|
+
} catch (error) {
|
|
221
|
+
if (process.env.DEBUG) {
|
|
222
|
+
console.debug(`[ast-common] Failed to read test file content for ${filePath}: ${error.message}`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
216
227
|
if (isSwiftOrKotlinTest) {
|
|
217
228
|
if (!shouldSkipMakeSUTRule(filePath) && !hasMakeSUT(content)) {
|
|
218
229
|
pushFinding(
|