@oculum/scanner 1.0.11 → 1.0.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/dist/ai-context/index.d.ts +6 -0
- package/dist/ai-context/index.d.ts.map +1 -0
- package/dist/ai-context/index.js +13 -0
- package/dist/ai-context/index.js.map +1 -0
- package/dist/ai-context/manager.d.ts +67 -0
- package/dist/ai-context/manager.d.ts.map +1 -0
- package/dist/ai-context/manager.js +104 -0
- package/dist/ai-context/manager.js.map +1 -0
- package/dist/category-filter.d.ts +125 -0
- package/dist/category-filter.d.ts.map +1 -0
- package/dist/category-filter.js +360 -0
- package/dist/category-filter.js.map +1 -0
- package/dist/filtering/context-adjustments.d.ts +23 -0
- package/dist/filtering/context-adjustments.d.ts.map +1 -0
- package/dist/filtering/context-adjustments.js +100 -0
- package/dist/filtering/context-adjustments.js.map +1 -0
- package/dist/filtering/index.d.ts +3 -0
- package/dist/filtering/index.d.ts.map +1 -0
- package/dist/filtering/index.js +8 -0
- package/dist/filtering/index.js.map +1 -0
- package/dist/filtering/pipeline.d.ts +48 -0
- package/dist/filtering/pipeline.d.ts.map +1 -0
- package/dist/filtering/pipeline.js +76 -0
- package/dist/filtering/pipeline.js.map +1 -0
- package/dist/formatters/ai-context.d.ts +23 -0
- package/dist/formatters/ai-context.d.ts.map +1 -0
- package/dist/formatters/ai-context.js +238 -0
- package/dist/formatters/ai-context.js.map +1 -0
- package/dist/formatters/github-comment.d.ts +1 -1
- package/dist/formatters/github-comment.d.ts.map +1 -1
- package/dist/formatters/github-comment.js +2 -2
- package/dist/formatters/github-comment.js.map +1 -1
- package/dist/formatters/ide/claude-code.d.ts +17 -0
- package/dist/formatters/ide/claude-code.d.ts.map +1 -0
- package/dist/formatters/ide/claude-code.js +94 -0
- package/dist/formatters/ide/claude-code.js.map +1 -0
- package/dist/formatters/ide/cursor.d.ts +13 -0
- package/dist/formatters/ide/cursor.d.ts.map +1 -0
- package/dist/formatters/ide/cursor.js +125 -0
- package/dist/formatters/ide/cursor.js.map +1 -0
- package/dist/formatters/ide/index.d.ts +62 -0
- package/dist/formatters/ide/index.d.ts.map +1 -0
- package/dist/formatters/ide/index.js +184 -0
- package/dist/formatters/ide/index.js.map +1 -0
- package/dist/formatters/ide/windsurf.d.ts +13 -0
- package/dist/formatters/ide/windsurf.d.ts.map +1 -0
- package/dist/formatters/ide/windsurf.js +117 -0
- package/dist/formatters/ide/windsurf.js.map +1 -0
- package/dist/formatters/index.d.ts +2 -0
- package/dist/formatters/index.d.ts.map +1 -1
- package/dist/formatters/index.js +17 -1
- package/dist/formatters/index.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +272 -44
- package/dist/index.js.map +1 -1
- package/dist/layer1/comments.d.ts +4 -1
- package/dist/layer1/comments.d.ts.map +1 -1
- package/dist/layer1/comments.js +1 -1
- package/dist/layer1/comments.js.map +1 -1
- package/dist/layer1/config-audit.d.ts +4 -1
- package/dist/layer1/config-audit.d.ts.map +1 -1
- package/dist/layer1/config-audit.js +45 -11
- package/dist/layer1/config-audit.js.map +1 -1
- package/dist/layer1/config-mcp-audit.d.ts +4 -1
- package/dist/layer1/config-mcp-audit.d.ts.map +1 -1
- package/dist/layer1/config-mcp-audit.js +2 -2
- package/dist/layer1/config-mcp-audit.js.map +1 -1
- package/dist/layer1/entropy.d.ts +4 -1
- package/dist/layer1/entropy.d.ts.map +1 -1
- package/dist/layer1/entropy.js +212 -1
- package/dist/layer1/entropy.js.map +1 -1
- package/dist/layer1/file-flags.d.ts +4 -1
- package/dist/layer1/file-flags.d.ts.map +1 -1
- package/dist/layer1/file-flags.js +12 -5
- package/dist/layer1/file-flags.js.map +1 -1
- package/dist/layer1/index.d.ts.map +1 -1
- package/dist/layer1/index.js +14 -19
- package/dist/layer1/index.js.map +1 -1
- package/dist/layer1/patterns.d.ts +4 -1
- package/dist/layer1/patterns.d.ts.map +1 -1
- package/dist/layer1/patterns.js +34 -4
- package/dist/layer1/patterns.js.map +1 -1
- package/dist/layer1/urls.d.ts +4 -1
- package/dist/layer1/urls.d.ts.map +1 -1
- package/dist/layer1/urls.js +162 -14
- package/dist/layer1/urls.js.map +1 -1
- package/dist/layer1/weak-crypto.d.ts +4 -1
- package/dist/layer1/weak-crypto.d.ts.map +1 -1
- package/dist/layer1/weak-crypto.js +144 -7
- package/dist/layer1/weak-crypto.js.map +1 -1
- package/dist/layer2/ai-agent-tools.d.ts +4 -1
- package/dist/layer2/ai-agent-tools.d.ts.map +1 -1
- package/dist/layer2/ai-agent-tools.js +661 -2
- package/dist/layer2/ai-agent-tools.js.map +1 -1
- package/dist/layer2/ai-endpoint-protection.d.ts +2 -0
- package/dist/layer2/ai-endpoint-protection.d.ts.map +1 -1
- package/dist/layer2/ai-endpoint-protection.js +1 -1
- package/dist/layer2/ai-endpoint-protection.js.map +1 -1
- package/dist/layer2/ai-execution-sinks.d.ts +4 -1
- package/dist/layer2/ai-execution-sinks.d.ts.map +1 -1
- package/dist/layer2/ai-execution-sinks.js +252 -43
- package/dist/layer2/ai-execution-sinks.js.map +1 -1
- package/dist/layer2/ai-fingerprinting.d.ts +4 -1
- package/dist/layer2/ai-fingerprinting.d.ts.map +1 -1
- package/dist/layer2/ai-fingerprinting.js +25 -32
- package/dist/layer2/ai-fingerprinting.js.map +1 -1
- package/dist/layer2/ai-mcp-security.d.ts +4 -1
- package/dist/layer2/ai-mcp-security.d.ts.map +1 -1
- package/dist/layer2/ai-mcp-security.js +200 -2
- package/dist/layer2/ai-mcp-security.js.map +1 -1
- package/dist/layer2/ai-package-hallucination.d.ts +4 -1
- package/dist/layer2/ai-package-hallucination.d.ts.map +1 -1
- package/dist/layer2/ai-package-hallucination.js +136 -4
- package/dist/layer2/ai-package-hallucination.js.map +1 -1
- package/dist/layer2/ai-prompt-hygiene.d.ts +4 -1
- package/dist/layer2/ai-prompt-hygiene.d.ts.map +1 -1
- package/dist/layer2/ai-prompt-hygiene.js +342 -28
- package/dist/layer2/ai-prompt-hygiene.js.map +1 -1
- package/dist/layer2/ai-rag-safety.d.ts +4 -1
- package/dist/layer2/ai-rag-safety.d.ts.map +1 -1
- package/dist/layer2/ai-rag-safety.js +82 -2
- package/dist/layer2/ai-rag-safety.js.map +1 -1
- package/dist/layer2/ai-schema-validation.d.ts +4 -1
- package/dist/layer2/ai-schema-validation.d.ts.map +1 -1
- package/dist/layer2/ai-schema-validation.js +2 -2
- package/dist/layer2/ai-schema-validation.js.map +1 -1
- package/dist/layer2/auth-antipatterns.d.ts +2 -0
- package/dist/layer2/auth-antipatterns.d.ts.map +1 -1
- package/dist/layer2/auth-antipatterns.js +205 -20
- package/dist/layer2/auth-antipatterns.js.map +1 -1
- package/dist/layer2/byok-patterns.d.ts +4 -1
- package/dist/layer2/byok-patterns.d.ts.map +1 -1
- package/dist/layer2/byok-patterns.js +2 -2
- package/dist/layer2/byok-patterns.js.map +1 -1
- package/dist/layer2/dangerous-functions/dom-xss.d.ts +9 -4
- package/dist/layer2/dangerous-functions/dom-xss.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/dom-xss.js +73 -22
- package/dist/layer2/dangerous-functions/dom-xss.js.map +1 -1
- package/dist/layer2/dangerous-functions/index.d.ts +4 -1
- package/dist/layer2/dangerous-functions/index.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/index.js +551 -20
- package/dist/layer2/dangerous-functions/index.js.map +1 -1
- package/dist/layer2/dangerous-functions/math-random.d.ts +54 -4
- package/dist/layer2/dangerous-functions/math-random.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/math-random.js +241 -16
- package/dist/layer2/dangerous-functions/math-random.js.map +1 -1
- package/dist/layer2/dangerous-functions/patterns.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/patterns.js +3 -1
- package/dist/layer2/dangerous-functions/patterns.js.map +1 -1
- package/dist/layer2/dangerous-functions/utils/control-flow.d.ts +3 -2
- package/dist/layer2/dangerous-functions/utils/control-flow.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/utils/control-flow.js +41 -120
- package/dist/layer2/dangerous-functions/utils/control-flow.js.map +1 -1
- package/dist/layer2/dangerous-functions/utils/helpers.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/utils/helpers.js +26 -3
- package/dist/layer2/dangerous-functions/utils/helpers.js.map +1 -1
- package/dist/layer2/dangerous-functions/utils/schema-validation.d.ts.map +1 -1
- package/dist/layer2/dangerous-functions/utils/schema-validation.js +14 -1
- package/dist/layer2/dangerous-functions/utils/schema-validation.js.map +1 -1
- package/dist/layer2/data-exposure.d.ts +4 -1
- package/dist/layer2/data-exposure.d.ts.map +1 -1
- package/dist/layer2/data-exposure.js +11 -38
- package/dist/layer2/data-exposure.js.map +1 -1
- package/dist/layer2/framework-checks.d.ts +4 -1
- package/dist/layer2/framework-checks.d.ts.map +1 -1
- package/dist/layer2/framework-checks.js +2 -2
- package/dist/layer2/framework-checks.js.map +1 -1
- package/dist/layer2/index.d.ts +9 -1
- package/dist/layer2/index.d.ts.map +1 -1
- package/dist/layer2/index.js +57 -51
- package/dist/layer2/index.js.map +1 -1
- package/dist/layer2/logic-gates.d.ts +4 -1
- package/dist/layer2/logic-gates.d.ts.map +1 -1
- package/dist/layer2/logic-gates.js +54 -20
- package/dist/layer2/logic-gates.js.map +1 -1
- package/dist/layer2/model-supply-chain.d.ts +4 -1
- package/dist/layer2/model-supply-chain.d.ts.map +1 -1
- package/dist/layer2/model-supply-chain.js +72 -4
- package/dist/layer2/model-supply-chain.js.map +1 -1
- package/dist/layer2/risky-imports.d.ts +4 -1
- package/dist/layer2/risky-imports.d.ts.map +1 -1
- package/dist/layer2/risky-imports.js +2 -2
- package/dist/layer2/risky-imports.js.map +1 -1
- package/dist/layer2/variables.d.ts +4 -1
- package/dist/layer2/variables.d.ts.map +1 -1
- package/dist/layer2/variables.js +2 -2
- package/dist/layer2/variables.js.map +1 -1
- package/dist/layer3/anthropic/auto-dismiss.d.ts.map +1 -1
- package/dist/layer3/anthropic/auto-dismiss.js +11 -0
- package/dist/layer3/anthropic/auto-dismiss.js.map +1 -1
- package/dist/modes/incremental.js +1 -1
- package/dist/tiers.d.ts +2 -2
- package/dist/tiers.d.ts.map +1 -1
- package/dist/tiers.js +7 -7
- package/dist/tiers.js.map +1 -1
- package/dist/types.d.ts +78 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +34 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/code-analysis.d.ts +39 -0
- package/dist/utils/code-analysis.d.ts.map +1 -0
- package/dist/utils/code-analysis.js +159 -0
- package/dist/utils/code-analysis.js.map +1 -0
- package/dist/utils/comment-analyzer.d.ts +38 -0
- package/dist/utils/comment-analyzer.d.ts.map +1 -0
- package/dist/utils/comment-analyzer.js +218 -0
- package/dist/utils/comment-analyzer.js.map +1 -0
- package/dist/utils/context-helpers.d.ts +108 -1
- package/dist/utils/context-helpers.d.ts.map +1 -1
- package/dist/utils/context-helpers.js +351 -2
- package/dist/utils/context-helpers.js.map +1 -1
- package/dist/utils/environment-context.d.ts +76 -0
- package/dist/utils/environment-context.d.ts.map +1 -0
- package/dist/utils/environment-context.js +271 -0
- package/dist/utils/environment-context.js.map +1 -0
- package/dist/utils/intent-detector.d.ts +66 -0
- package/dist/utils/intent-detector.d.ts.map +1 -0
- package/dist/utils/intent-detector.js +282 -0
- package/dist/utils/intent-detector.js.map +1 -0
- package/dist/utils/parsed-file.d.ts +51 -0
- package/dist/utils/parsed-file.d.ts.map +1 -0
- package/dist/utils/parsed-file.js +95 -0
- package/dist/utils/parsed-file.js.map +1 -0
- package/dist/utils/route-hierarchy.d.ts +50 -0
- package/dist/utils/route-hierarchy.d.ts.map +1 -0
- package/dist/utils/route-hierarchy.js +226 -0
- package/dist/utils/route-hierarchy.js.map +1 -0
- package/dist/utils/schema-semantics.d.ts +45 -0
- package/dist/utils/schema-semantics.d.ts.map +1 -0
- package/dist/utils/schema-semantics.js +193 -0
- package/dist/utils/schema-semantics.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/benchmark/fixtures/layer2/index.ts +12 -0
- package/src/__tests__/benchmark/fixtures/layer2/phase5-excessive-agency.ts +580 -0
- package/src/__tests__/benchmark/fixtures/layer2/sprint6-ai-enhancements.ts +515 -0
- package/src/__tests__/benchmark/run-depth-validation.ts +9 -9
- package/src/__tests__/category-filter.test.ts +478 -0
- package/src/__tests__/regression/known-false-positives.test.ts +490 -0
- package/src/__tests__/snapshots/__snapshots__/anthropic-validation-refactor.test.ts.snap +18 -14
- package/src/__tests__/snapshots/__snapshots__/scan-depth.test.ts.snap +0 -9
- package/src/__tests__/snapshots/anthropic-validation-refactor.test.ts +1 -1
- package/src/__tests__/validation/run-validation.ts +7 -7
- package/src/ai-context/__tests__/manager.test.ts +193 -0
- package/src/ai-context/index.ts +15 -0
- package/src/ai-context/manager.ts +145 -0
- package/src/baseline/__tests__/manager.test.ts +2 -2
- package/src/category-filter.ts +400 -0
- package/src/filtering/__tests__/pipeline.test.ts +134 -0
- package/src/filtering/context-adjustments.ts +111 -0
- package/src/filtering/index.ts +10 -0
- package/src/filtering/pipeline.ts +130 -0
- package/src/formatters/__tests__/ai-context.test.ts +254 -0
- package/src/formatters/ai-context.ts +302 -0
- package/src/formatters/github-comment.ts +3 -3
- package/src/formatters/ide/__tests__/ide.test.ts +319 -0
- package/src/formatters/ide/claude-code.ts +110 -0
- package/src/formatters/ide/cursor.ts +147 -0
- package/src/formatters/ide/index.ts +216 -0
- package/src/formatters/ide/windsurf.ts +135 -0
- package/src/formatters/index.ts +24 -0
- package/src/index.ts +312 -34
- package/src/layer1/comments.ts +3 -1
- package/src/layer1/config-audit.ts +50 -11
- package/src/layer1/config-mcp-audit.ts +4 -2
- package/src/layer1/entropy.ts +234 -1
- package/src/layer1/file-flags.ts +17 -6
- package/src/layer1/index.ts +14 -18
- package/src/layer1/patterns.ts +42 -4
- package/src/layer1/urls.ts +188 -14
- package/src/layer1/weak-crypto.ts +168 -16
- package/src/layer2/ai-agent-tools.ts +707 -2
- package/src/layer2/ai-endpoint-protection.ts +3 -1
- package/src/layer2/ai-execution-sinks.ts +265 -43
- package/src/layer2/ai-fingerprinting.ts +28 -32
- package/src/layer2/ai-mcp-security.ts +206 -3
- package/src/layer2/ai-package-hallucination.ts +153 -4
- package/src/layer2/ai-prompt-hygiene.ts +369 -26
- package/src/layer2/ai-rag-safety.ts +85 -2
- package/src/layer2/ai-schema-validation.ts +4 -2
- package/src/layer2/auth-antipatterns.ts +230 -20
- package/src/layer2/byok-patterns.ts +4 -2
- package/src/layer2/dangerous-functions/dom-xss.ts +94 -22
- package/src/layer2/dangerous-functions/index.ts +635 -51
- package/src/layer2/dangerous-functions/math-random.ts +268 -16
- package/src/layer2/dangerous-functions/patterns.ts +3 -1
- package/src/layer2/dangerous-functions/utils/control-flow.ts +8 -135
- package/src/layer2/dangerous-functions/utils/schema-validation.ts +16 -1
- package/src/layer2/data-exposure.ts +13 -38
- package/src/layer2/framework-checks.ts +4 -2
- package/src/layer2/index.ts +69 -50
- package/src/layer2/logic-gates.ts +59 -22
- package/src/layer2/model-supply-chain.ts +79 -4
- package/src/layer2/risky-imports.ts +4 -2
- package/src/layer2/variables.ts +4 -2
- package/src/layer3/anthropic/auto-dismiss.ts +11 -0
- package/src/modes/incremental.ts +1 -1
- package/src/tiers.ts +9 -9
- package/src/types.ts +122 -8
- package/src/utils/__tests__/code-analysis.test.ts +165 -0
- package/src/utils/__tests__/parsed-file.test.ts +124 -0
- package/src/utils/code-analysis.ts +179 -0
- package/src/utils/comment-analyzer.ts +249 -0
- package/src/utils/context-helpers.ts +408 -2
- package/src/utils/environment-context.ts +304 -0
- package/src/utils/intent-detector.ts +318 -0
- package/src/utils/parsed-file.ts +103 -0
- package/src/utils/route-hierarchy.ts +250 -0
- package/src/utils/schema-semantics.ts +233 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Context Module
|
|
3
|
+
* Exports for AI context management functionality
|
|
4
|
+
*/
|
|
5
|
+
export { AIContextManager, AI_CONTEXT_FILE, AI_CONTEXT_PATH, OCULUM_DIR, type AIContextManagerOptions, type SaveContextResult, type LoadContextResult, type ClearContextResult, } from './manager';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai-context/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,UAAU,EACV,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AI Context Module
|
|
4
|
+
* Exports for AI context management functionality
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.OCULUM_DIR = exports.AI_CONTEXT_PATH = exports.AI_CONTEXT_FILE = exports.AIContextManager = void 0;
|
|
8
|
+
var manager_1 = require("./manager");
|
|
9
|
+
Object.defineProperty(exports, "AIContextManager", { enumerable: true, get: function () { return manager_1.AIContextManager; } });
|
|
10
|
+
Object.defineProperty(exports, "AI_CONTEXT_FILE", { enumerable: true, get: function () { return manager_1.AI_CONTEXT_FILE; } });
|
|
11
|
+
Object.defineProperty(exports, "AI_CONTEXT_PATH", { enumerable: true, get: function () { return manager_1.AI_CONTEXT_PATH; } });
|
|
12
|
+
Object.defineProperty(exports, "OCULUM_DIR", { enumerable: true, get: function () { return manager_1.OCULUM_DIR; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai-context/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCASkB;AARhB,2GAAA,gBAAgB,OAAA;AAChB,0GAAA,eAAe,OAAA;AACf,0GAAA,eAAe,OAAA;AACf,qGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Context Manager
|
|
3
|
+
* Handles loading, saving, and clearing AI context files
|
|
4
|
+
*/
|
|
5
|
+
/** AI context file name */
|
|
6
|
+
export declare const AI_CONTEXT_FILE = "ai-context.md";
|
|
7
|
+
/** Directory for oculum files */
|
|
8
|
+
export declare const OCULUM_DIR = ".oculum";
|
|
9
|
+
/** Full path to AI context file (relative to project root) */
|
|
10
|
+
export declare const AI_CONTEXT_PATH = ".oculum/ai-context.md";
|
|
11
|
+
export interface AIContextManagerOptions {
|
|
12
|
+
/** Project root path */
|
|
13
|
+
projectPath: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SaveContextResult {
|
|
16
|
+
/** Whether the save was successful */
|
|
17
|
+
success: boolean;
|
|
18
|
+
/** Path where context was saved */
|
|
19
|
+
path: string;
|
|
20
|
+
/** Error message (if failed) */
|
|
21
|
+
error?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface LoadContextResult {
|
|
24
|
+
/** Whether a context file was found */
|
|
25
|
+
found: boolean;
|
|
26
|
+
/** The context content (if found) */
|
|
27
|
+
content?: string;
|
|
28
|
+
/** Error message (if failed to load) */
|
|
29
|
+
error?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ClearContextResult {
|
|
32
|
+
/** Whether the clear was successful */
|
|
33
|
+
success: boolean;
|
|
34
|
+
/** Whether a context file existed before clearing */
|
|
35
|
+
existed: boolean;
|
|
36
|
+
/** Error message (if failed) */
|
|
37
|
+
error?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Manages AI context files for IDE consumption
|
|
41
|
+
*/
|
|
42
|
+
export declare class AIContextManager {
|
|
43
|
+
private projectPath;
|
|
44
|
+
private contextPath;
|
|
45
|
+
constructor(options: AIContextManagerOptions | string);
|
|
46
|
+
/**
|
|
47
|
+
* Get the full path to the AI context file
|
|
48
|
+
*/
|
|
49
|
+
getContextPath(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Save AI context to .oculum/ai-context.md
|
|
52
|
+
*/
|
|
53
|
+
saveContext(content: string): SaveContextResult;
|
|
54
|
+
/**
|
|
55
|
+
* Load AI context from .oculum/ai-context.md
|
|
56
|
+
*/
|
|
57
|
+
loadContext(): LoadContextResult;
|
|
58
|
+
/**
|
|
59
|
+
* Clear (delete) the AI context file
|
|
60
|
+
*/
|
|
61
|
+
clearContext(): ClearContextResult;
|
|
62
|
+
/**
|
|
63
|
+
* Check if an AI context file exists
|
|
64
|
+
*/
|
|
65
|
+
hasContext(): boolean;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/ai-context/manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,2BAA2B;AAC3B,eAAO,MAAM,eAAe,kBAAkB,CAAA;AAE9C,iCAAiC;AACjC,eAAO,MAAM,UAAU,YAAY,CAAA;AAEnC,8DAA8D;AAC9D,eAAO,MAAM,eAAe,0BAAqC,CAAA;AAEjE,MAAM,WAAW,uBAAuB;IACtC,wBAAwB;IACxB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAA;IAChB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,uCAAuC;IACvC,KAAK,EAAE,OAAO,CAAA;IACd,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAA;IAChB,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAA;IAChB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,WAAW,CAAQ;gBAEf,OAAO,EAAE,uBAAuB,GAAG,MAAM;IAUrD;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB;IAqB/C;;OAEG;IACH,WAAW,IAAI,iBAAiB;IAgBhC;;OAEG;IACH,YAAY,IAAI,kBAAkB;IAmBlC;;OAEG;IACH,UAAU,IAAI,OAAO;CAGtB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AI Context Manager
|
|
4
|
+
* Handles loading, saving, and clearing AI context files
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AIContextManager = exports.AI_CONTEXT_PATH = exports.OCULUM_DIR = exports.AI_CONTEXT_FILE = void 0;
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
/** AI context file name */
|
|
11
|
+
exports.AI_CONTEXT_FILE = 'ai-context.md';
|
|
12
|
+
/** Directory for oculum files */
|
|
13
|
+
exports.OCULUM_DIR = '.oculum';
|
|
14
|
+
/** Full path to AI context file (relative to project root) */
|
|
15
|
+
exports.AI_CONTEXT_PATH = `${exports.OCULUM_DIR}/${exports.AI_CONTEXT_FILE}`;
|
|
16
|
+
/**
|
|
17
|
+
* Manages AI context files for IDE consumption
|
|
18
|
+
*/
|
|
19
|
+
class AIContextManager {
|
|
20
|
+
constructor(options) {
|
|
21
|
+
// Support both old string arg and new options object
|
|
22
|
+
if (typeof options === 'string') {
|
|
23
|
+
this.projectPath = options;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.projectPath = options.projectPath;
|
|
27
|
+
}
|
|
28
|
+
this.contextPath = (0, path_1.join)(this.projectPath, exports.OCULUM_DIR, exports.AI_CONTEXT_FILE);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the full path to the AI context file
|
|
32
|
+
*/
|
|
33
|
+
getContextPath() {
|
|
34
|
+
return this.contextPath;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Save AI context to .oculum/ai-context.md
|
|
38
|
+
*/
|
|
39
|
+
saveContext(content) {
|
|
40
|
+
try {
|
|
41
|
+
// Ensure .oculum directory exists
|
|
42
|
+
const oculumDir = (0, path_1.join)(this.projectPath, exports.OCULUM_DIR);
|
|
43
|
+
if (!(0, fs_1.existsSync)(oculumDir)) {
|
|
44
|
+
(0, fs_1.mkdirSync)(oculumDir, { recursive: true });
|
|
45
|
+
}
|
|
46
|
+
// Write content to file
|
|
47
|
+
(0, fs_1.writeFileSync)(this.contextPath, content);
|
|
48
|
+
return { success: true, path: this.contextPath };
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
path: this.contextPath,
|
|
54
|
+
error: `Failed to save AI context: ${err instanceof Error ? err.message : 'Unknown error'}`,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Load AI context from .oculum/ai-context.md
|
|
60
|
+
*/
|
|
61
|
+
loadContext() {
|
|
62
|
+
if (!(0, fs_1.existsSync)(this.contextPath)) {
|
|
63
|
+
return { found: false };
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const content = (0, fs_1.readFileSync)(this.contextPath, 'utf-8');
|
|
67
|
+
return { found: true, content };
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
return {
|
|
71
|
+
found: false,
|
|
72
|
+
error: `Failed to read AI context: ${err instanceof Error ? err.message : 'Unknown error'}`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Clear (delete) the AI context file
|
|
78
|
+
*/
|
|
79
|
+
clearContext() {
|
|
80
|
+
const existed = (0, fs_1.existsSync)(this.contextPath);
|
|
81
|
+
if (!existed) {
|
|
82
|
+
return { success: true, existed: false };
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
(0, fs_1.unlinkSync)(this.contextPath);
|
|
86
|
+
return { success: true, existed: true };
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
return {
|
|
90
|
+
success: false,
|
|
91
|
+
existed: true,
|
|
92
|
+
error: `Failed to clear AI context: ${err instanceof Error ? err.message : 'Unknown error'}`,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Check if an AI context file exists
|
|
98
|
+
*/
|
|
99
|
+
hasContext() {
|
|
100
|
+
return (0, fs_1.existsSync)(this.contextPath);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.AIContextManager = AIContextManager;
|
|
104
|
+
//# sourceMappingURL=manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/ai-context/manager.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Category-Based Filtering
|
|
3
|
+
*
|
|
4
|
+
* Enables CI to fail only on specific vulnerability categories,
|
|
5
|
+
* allowing gradual rollout (e.g., "only block prompt injection")
|
|
6
|
+
* and fine-grained control over which findings are blocking.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Fail only on AI-related and secret categories
|
|
10
|
+
* --fail-on-categories ai-*,secrets-*
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Combined with severity
|
|
14
|
+
* --fail-on high --fail-on-categories ai-*
|
|
15
|
+
* // Only fail on high+ AI findings
|
|
16
|
+
*/
|
|
17
|
+
import type { VulnerabilityCategory, Vulnerability, VulnerabilitySeverity } from './types';
|
|
18
|
+
/**
|
|
19
|
+
* Category group definitions for wildcard expansion
|
|
20
|
+
*
|
|
21
|
+
* These groups allow users to specify broad categories like "ai-*"
|
|
22
|
+
* which expand to all AI-related vulnerability categories.
|
|
23
|
+
*/
|
|
24
|
+
export declare const CATEGORY_GROUPS: Record<string, VulnerabilityCategory[]>;
|
|
25
|
+
/**
|
|
26
|
+
* All known valid category names for validation
|
|
27
|
+
*/
|
|
28
|
+
export declare const ALL_CATEGORIES: VulnerabilityCategory[];
|
|
29
|
+
/**
|
|
30
|
+
* Normalize category name for comparison
|
|
31
|
+
* - Converts to lowercase
|
|
32
|
+
* - Converts hyphens to underscores
|
|
33
|
+
* - Trims whitespace
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* normalizeCategory('SQL-Injection') // 'sql_injection'
|
|
37
|
+
* normalizeCategory('high_entropy_string') // 'high_entropy_string'
|
|
38
|
+
*/
|
|
39
|
+
export declare function normalizeCategory(category: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Expand a wildcard pattern or single category to a list of categories
|
|
42
|
+
*
|
|
43
|
+
* @param pattern - Category name or wildcard (e.g., 'sql_injection', 'ai-*')
|
|
44
|
+
* @returns Array of matching categories
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* expandCategoryPattern('ai-*') // Returns all ai_* categories
|
|
48
|
+
* expandCategoryPattern('sql_injection') // Returns ['sql_injection']
|
|
49
|
+
* expandCategoryPattern('unknown-*') // Returns []
|
|
50
|
+
*/
|
|
51
|
+
export declare function expandCategoryPattern(pattern: string): VulnerabilityCategory[];
|
|
52
|
+
/**
|
|
53
|
+
* Check if a category matches any pattern in the filter list
|
|
54
|
+
*
|
|
55
|
+
* @param category - The vulnerability category to check
|
|
56
|
+
* @param patterns - Array of category patterns (names or wildcards)
|
|
57
|
+
* @returns true if the category matches any pattern
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* matchesAnyCategory('ai_prompt_injection', ['ai-*']) // true
|
|
61
|
+
* matchesAnyCategory('sql_injection', ['ai-*']) // false
|
|
62
|
+
* matchesAnyCategory('sql_injection', ['sql_injection', 'xss']) // true
|
|
63
|
+
*/
|
|
64
|
+
export declare function matchesAnyCategory(category: VulnerabilityCategory, patterns: string[]): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Check if vulnerabilities should cause failure based on category filter
|
|
67
|
+
*
|
|
68
|
+
* When both category patterns and severity threshold are provided,
|
|
69
|
+
* BOTH conditions must match for a finding to cause failure.
|
|
70
|
+
*
|
|
71
|
+
* @param vulnerabilities - List of vulnerabilities to check
|
|
72
|
+
* @param categoryPatterns - Category patterns to filter on
|
|
73
|
+
* @param severityThreshold - Optional severity threshold (both must match)
|
|
74
|
+
* @returns true if any vulnerability matches and should cause failure
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // Only fail on AI findings
|
|
78
|
+
* shouldFailOnCategories(vulns, ['ai-*'])
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // Only fail on HIGH+ AI findings
|
|
82
|
+
* shouldFailOnCategories(vulns, ['ai-*'], 'high')
|
|
83
|
+
*/
|
|
84
|
+
export declare function shouldFailOnCategories(vulnerabilities: Vulnerability[], categoryPatterns: string[], severityThreshold?: VulnerabilitySeverity): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Get the categories that matched the filter from vulnerabilities
|
|
87
|
+
* Useful for error messages showing which categories caused failure
|
|
88
|
+
*/
|
|
89
|
+
export declare function getMatchingCategories(vulnerabilities: Vulnerability[], categoryPatterns: string[], severityThreshold?: VulnerabilitySeverity): VulnerabilityCategory[];
|
|
90
|
+
/**
|
|
91
|
+
* Parse comma-separated category string into array
|
|
92
|
+
*
|
|
93
|
+
* @param input - Comma-separated category string
|
|
94
|
+
* @returns Array of trimmed category patterns
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* parseCategoryList('ai-*, secrets-*') // ['ai-*', 'secrets-*']
|
|
98
|
+
* parseCategoryList('sql_injection, xss') // ['sql_injection', 'xss']
|
|
99
|
+
*/
|
|
100
|
+
export declare function parseCategoryList(input: string): string[];
|
|
101
|
+
/**
|
|
102
|
+
* Validate category names, separating valid from invalid
|
|
103
|
+
*
|
|
104
|
+
* @param categories - Array of category patterns to validate
|
|
105
|
+
* @returns Object with valid and invalid category arrays
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* validateCategories(['ai-*', 'sql_injection', 'fake_category'])
|
|
109
|
+
* // { valid: ['ai-*', 'sql_injection'], invalid: ['fake_category'] }
|
|
110
|
+
*/
|
|
111
|
+
export declare function validateCategories(categories: string[]): {
|
|
112
|
+
valid: string[];
|
|
113
|
+
invalid: string[];
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Get a human-readable list of available category groups
|
|
117
|
+
* Useful for help text and error messages
|
|
118
|
+
*/
|
|
119
|
+
export declare function getAvailableCategoryGroups(): string[];
|
|
120
|
+
/**
|
|
121
|
+
* Get the count of categories in each group
|
|
122
|
+
* Useful for documentation and help text
|
|
123
|
+
*/
|
|
124
|
+
export declare function getCategoryGroupCounts(): Record<string, number>;
|
|
125
|
+
//# sourceMappingURL=category-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category-filter.d.ts","sourceRoot":"","sources":["../src/category-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAG1F;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,EAAE,CA6CnE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,qBAAqB,EA4CjD,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK1D;AAUD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB,EAAE,CAgC9E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,qBAAqB,EAC/B,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAiBT;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,aAAa,EAAE,EAChC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,iBAAiB,CAAC,EAAE,qBAAqB,GACxC,OAAO,CA6BT;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,aAAa,EAAE,EAChC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,iBAAiB,CAAC,EAAE,qBAAqB,GACxC,qBAAqB,EAAE,CAyBzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CASzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG;IACxD,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB,CA4BA;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,EAAE,CAErD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAM/D"}
|