jev-codeguard 0.0.0-stage → 1.1.0

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.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +364 -2
  3. package/THIRD_PARTY_NOTICES.md +25 -0
  4. package/dist/src/cli/hook-runner.d.ts +27 -0
  5. package/dist/src/cli/hook-runner.js +196 -0
  6. package/dist/src/cli/hook-runner.js.map +1 -0
  7. package/dist/src/cli/index.d.ts +2 -0
  8. package/dist/src/cli/index.js +173 -0
  9. package/dist/src/cli/index.js.map +1 -0
  10. package/dist/src/cli/setup.d.ts +14 -0
  11. package/dist/src/cli/setup.js +122 -0
  12. package/dist/src/cli/setup.js.map +1 -0
  13. package/dist/src/core/cache.d.ts +16 -0
  14. package/dist/src/core/cache.js +64 -0
  15. package/dist/src/core/cache.js.map +1 -0
  16. package/dist/src/core/command-shape.d.ts +17 -0
  17. package/dist/src/core/command-shape.js +138 -0
  18. package/dist/src/core/command-shape.js.map +1 -0
  19. package/dist/src/core/context-enricher.d.ts +149 -0
  20. package/dist/src/core/context-enricher.js +1397 -0
  21. package/dist/src/core/context-enricher.js.map +1 -0
  22. package/dist/src/core/event-log.d.ts +35 -0
  23. package/dist/src/core/event-log.js +241 -0
  24. package/dist/src/core/event-log.js.map +1 -0
  25. package/dist/src/core/git-collector.d.ts +18 -0
  26. package/dist/src/core/git-collector.js +227 -0
  27. package/dist/src/core/git-collector.js.map +1 -0
  28. package/dist/src/core/hybrid-ast-engine.d.ts +46 -0
  29. package/dist/src/core/hybrid-ast-engine.js +641 -0
  30. package/dist/src/core/hybrid-ast-engine.js.map +1 -0
  31. package/dist/src/core/jev-client.d.ts +50 -0
  32. package/dist/src/core/jev-client.js +262 -0
  33. package/dist/src/core/jev-client.js.map +1 -0
  34. package/dist/src/core/policy-config.d.ts +96 -0
  35. package/dist/src/core/policy-config.js +60 -0
  36. package/dist/src/core/policy-config.js.map +1 -0
  37. package/dist/src/core/policy-engine.d.ts +65 -0
  38. package/dist/src/core/policy-engine.js +344 -0
  39. package/dist/src/core/policy-engine.js.map +1 -0
  40. package/dist/src/core/presets.d.ts +18 -0
  41. package/dist/src/core/presets.js +180 -0
  42. package/dist/src/core/presets.js.map +1 -0
  43. package/dist/src/core/skill-auditor.d.ts +56 -0
  44. package/dist/src/core/skill-auditor.js +435 -0
  45. package/dist/src/core/skill-auditor.js.map +1 -0
  46. package/dist/src/core/telemetry.d.ts +30 -0
  47. package/dist/src/core/telemetry.js +55 -0
  48. package/dist/src/core/telemetry.js.map +1 -0
  49. package/dist/src/core/types.d.ts +89 -0
  50. package/dist/src/core/types.js +2 -0
  51. package/dist/src/core/types.js.map +1 -0
  52. package/dist/src/dashboard/server.d.ts +9 -0
  53. package/dist/src/dashboard/server.js +2425 -0
  54. package/dist/src/dashboard/server.js.map +1 -0
  55. package/dist/src/mcp/server.d.ts +137 -0
  56. package/dist/src/mcp/server.js +875 -0
  57. package/dist/src/mcp/server.js.map +1 -0
  58. package/package.json +75 -4
  59. package/skills/jev-system-one/SKILL.md +54 -0
  60. package/skills/vendor/codebase-design/DEEPENING.md +37 -0
  61. package/skills/vendor/codebase-design/DESIGN-IT-TWICE.md +44 -0
  62. package/skills/vendor/codebase-design/LICENSE +21 -0
  63. package/skills/vendor/codebase-design/SKILL.md +114 -0
  64. package/skills/vendor/gsap-performance/LICENSE +21 -0
  65. package/skills/vendor/gsap-performance/SKILL.md +79 -0
  66. package/skills/vendor/manifest.json +122 -0
  67. package/skills/vendor/security-best-practices/LICENSE.txt +201 -0
  68. package/skills/vendor/security-best-practices/SKILL.md +86 -0
  69. package/skills/vendor/security-best-practices/references/golang-general-backend-security.md +826 -0
  70. package/skills/vendor/security-best-practices/references/javascript-express-web-server-security.md +1158 -0
  71. package/skills/vendor/security-best-practices/references/javascript-general-web-frontend-security.md +747 -0
  72. package/skills/vendor/security-best-practices/references/javascript-jquery-web-frontend-security.md +678 -0
  73. package/skills/vendor/security-best-practices/references/javascript-typescript-nextjs-web-server-security.md +1144 -0
  74. package/skills/vendor/security-best-practices/references/javascript-typescript-react-web-frontend-security.md +990 -0
  75. package/skills/vendor/security-best-practices/references/javascript-typescript-vue-web-frontend-security.md +791 -0
  76. package/skills/vendor/security-best-practices/references/python-django-web-server-security.md +882 -0
  77. package/skills/vendor/security-best-practices/references/python-fastapi-web-server-security.md +1036 -0
  78. package/skills/vendor/security-best-practices/references/python-flask-web-server-security.md +705 -0
@@ -0,0 +1,149 @@
1
+ export interface LearnedHumanOverride {
2
+ id: string;
3
+ createdAt: string;
4
+ tool: string;
5
+ feedbackType: "CORRECT" | "FALSE_POSITIVE_OVERRIDE" | "CUSTOM_RULE";
6
+ rule: string;
7
+ eventId?: string;
8
+ }
9
+ export interface PreFlightSyntaxReport {
10
+ status: "PASS" | "SYNTAX_ERROR" | "SKIPPED";
11
+ checkedFiles: string[];
12
+ errors: string[];
13
+ }
14
+ export interface ProjectDnaEnvelope {
15
+ workspaceName: string;
16
+ workspacePath: string;
17
+ stackSummary: string;
18
+ repoTopology: string;
19
+ domainAndAuthFingerprint?: string;
20
+ projectRulesExcerpt?: string;
21
+ activeMemoryExcerpt?: string;
22
+ learnedHumanOverrides?: LearnedHumanOverride[];
23
+ recentWorkspaceDecisions: Array<{
24
+ timestamp: string;
25
+ agent: string;
26
+ tool: string;
27
+ questionOrTitle: string;
28
+ verdict: string;
29
+ directive: string;
30
+ }>;
31
+ }
32
+ export interface ReverseDependentsSummary {
33
+ modifiedDependents: string[];
34
+ unmodifiedDependents: string[];
35
+ referencedTouchedSymbols: Record<string, string[]>;
36
+ }
37
+ export interface FileStructuralSummary {
38
+ file: string;
39
+ addedLines: number;
40
+ removedLines: number;
41
+ hunkHeaders: string[];
42
+ touchedSymbols: string[];
43
+ }
44
+ export interface SpecRequirementMatch {
45
+ id: string;
46
+ requirement: string;
47
+ matchedFiles: string[];
48
+ matchedEvidence: string[];
49
+ }
50
+ export declare function isGenericHostDirectory(dirPath: string): boolean;
51
+ /**
52
+ * Blocks secret/credential files from ever being auto-read and uploaded to an external API.
53
+ */
54
+ export declare function isSensitiveFilePath(filePath: string): boolean;
55
+ /**
56
+ * Ensures `targetPath` resolves strictly inside `workspaceRoot` (preventing `../` traversal or symlink escape).
57
+ */
58
+ export declare function isWithinWorkspaceBoundary(workspaceRoot: string, targetPath: string): boolean;
59
+ /**
60
+ * Cross-platform Python binary resolver (`python3` preferred on POSIX, `python` on Windows).
61
+ */
62
+ export declare function resolvePythonExecutable(): string;
63
+ /**
64
+ * Resolves the true target project workspace even when the calling agent omits `working_directory`
65
+ * or when `process.cwd()` points to a generic IDE host directory (e.g. `.../Programs/Antigravity`).
66
+ */
67
+ export declare function resolveTargetWorkspace(explicitCwd?: string, hints?: Array<string | undefined>): string;
68
+ export declare function buildProjectContextEnvelope(cwd?: string, hints?: Array<string | undefined>): ProjectDnaEnvelope;
69
+ /**
70
+ * Automatically detects and reads any files (handoffs, review docs, specs, scripts, components)
71
+ * explicitly referenced inside the prompt/spec/question/context so Jev never evaluates blindly.
72
+ */
73
+ export declare function extractReferencedDocsAndFiles(cwd: string, texts: Array<string | undefined>, maxFiles?: number, maxCharsPerFile?: number): Record<string, string>;
74
+ /**
75
+ * Parses the full raw git diff BEFORE character truncation to produce a complete
76
+ * per-file structural map (line counts, hunk headers, and added/modified symbols,
77
+ * functions, components, tests, routes, and CSS selectors).
78
+ */
79
+ export declare function extractStructuralDiffMap(rawDiff: string): FileStructuralSummary[];
80
+ /**
81
+ * Reads the actual post-edit files on disk around the modified hunk line numbers (`@@ ... +start,count @@`)
82
+ * and locates the nearest enclosing function/class/route decorator header above each hunk.
83
+ * This gives Jev the true post-edit code structure and surrounding guards/transactions/auth decorators.
84
+ */
85
+ export declare function extractPostEditHunkScopes(cwd: string, rawDiff: string, maxFiles?: number, maxTotalChars?: number): Record<string, string>;
86
+ /**
87
+ * Resolves local cross-file imports (`./...`, `../...`, `@/...`, `from app... import ...`)
88
+ * from modified files and extracts exported TypeScript interfaces/types/schemas and Python Pydantic/function signatures.
89
+ * Also queries `.codegraph` if initialized in the workspace.
90
+ */
91
+ export declare function extractCrossFileContracts(cwd: string, changedFiles: string[], maxContracts?: number, maxTotalChars?: number): Record<string, string>;
92
+ /**
93
+ * Splits multi-point specifications (e.g., `(1) ... (2) ...` or `1. ... 2. ...` or bulleted lists)
94
+ * into discrete requirement items and pre-maps each requirement against changed files and touched symbols.
95
+ */
96
+ export declare function buildSpecRequirementMatrix(spec: string, structuralMap: FileStructuralSummary[], rawDiff: string): SpecRequirementMatch[];
97
+ /**
98
+ * Extracts the top imports, auth middleware, and validation schema headers of modified files
99
+ * so `jev_audit_code` does not false-flag partial diffs whose imports/validators sit at the top of the file.
100
+ */
101
+ export declare function extractFileHeaderContext(cwd: string, filePath?: string, changedFiles?: string[]): Record<string, string>;
102
+ /**
103
+ * Upward Blast-Radius / Caller Graph:
104
+ * Scans workspace source files to identify which files import the modified files or reference
105
+ * their touched symbols, distinguishing callers that were updated in the diff (`modifiedDependents`)
106
+ * from untouched callers (`unmodifiedDependents` — potential breaking change candidates).
107
+ */
108
+ export declare function extractReverseDependents(cwd: string, changedFiles: string[], structuralMap?: FileStructuralSummary[]): ReverseDependentsSummary;
109
+ /**
110
+ * Companion Test Suite Discovery:
111
+ * Finds existing unit/integration test files (`*.test.ts`, `*.spec.ts`, `test_*.py`) on disk
112
+ * corresponding to the modified files (even when those test files weren't edited in the diff!)
113
+ * and extracts their test case titles so Jev knows what automated test coverage already exists.
114
+ */
115
+ export declare function extractCompanionTestsContext(cwd: string, changedFiles: string[], maxTestFiles?: number): Record<string, string[]>;
116
+ /**
117
+ * Domain Schema, Auth/Validation Convention & Environment Contract Fingerprint:
118
+ * Extracts database/domain models (`schema.prisma`, `models.py`, `packages/contracts`),
119
+ * `.env.example` variable names (never secret values!), and security/runtime conventions
120
+ * (e.g., whether the workspace is an infrastructure/Proxmox CLI lab repo or a web app).
121
+ */
122
+ export declare function extractDomainAndRuntimeFingerprint(cwd: string): string;
123
+ /**
124
+ * Persists a learned Project Brain profile to `~/.mcp-jev/projects/<workspaceName>.json`
125
+ * so Jev retains permanent architectural memory of each project across restarts.
126
+ */
127
+ export declare function getProjectBrainFilePath(workspaceName: string): string;
128
+ export declare function readLearnedHumanOverrides(workspaceName: string): LearnedHumanOverride[];
129
+ export declare function syncProjectBrainProfile(dna: ProjectDnaEnvelope): string | undefined;
130
+ /**
131
+ * Records a human feedback / override rule into the persistent Project Brain (`~/.mcp-jev/projects/<workspaceName>.json`)
132
+ * so Jev immediately learns from user corrections and never repeats a false-positive BLOCK on that project.
133
+ */
134
+ export declare function recordProjectFeedbackRule(input: {
135
+ workspaceName: string;
136
+ workspacePath?: string;
137
+ tool?: string;
138
+ feedbackType: "CORRECT" | "FALSE_POSITIVE_OVERRIDE" | "CUSTOM_RULE";
139
+ rule: string;
140
+ eventId?: string;
141
+ }): LearnedHumanOverride;
142
+ export declare function removeProjectFeedbackRule(workspaceName: string, ruleId: string): boolean;
143
+ export declare function listProjectBrainProfiles(): Array<Record<string, unknown>>;
144
+ /**
145
+ * Fast Pre-Flight Syntax & Compiler Probe:
146
+ * Runs deterministic <700ms syntax checks (`python -m py_compile` for `.py`, `node --check` for `.js`/`.mjs`,
147
+ * `JSON.parse` for `.json`) on modified files before sending the diff to Jev so Jev gets hard compiler ground truth.
148
+ */
149
+ export declare function runFastSyntaxProbe(cwd: string, changedFiles: string[]): PreFlightSyntaxReport;