@ossdeveloper/github-compliance 1.0.1 → 1.3.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.
package/database.ts CHANGED
@@ -3,10 +3,10 @@
3
3
  *
4
4
  * Manages SQLite database for compliance records, audit logs, and failed attempts.
5
5
  * Uses centralized schema from schema.ts for all table/column names.
6
+ * Uses centralized content hashing from contracts.ts.
6
7
  */
7
8
 
8
9
  import Database from "bun:sqlite";
9
- import { createHash } from "crypto";
10
10
  import { mkdir } from "fs";
11
11
  import { homedir } from "os";
12
12
  import {
@@ -16,6 +16,7 @@ import {
16
16
  RECORD_CLEANUP_AGE_MS,
17
17
  CONTENT_PREVIEW_MAX_LENGTH
18
18
  } from "./schema";
19
+ import { computeContentHash } from "./contracts";
19
20
 
20
21
  const DB_DIR = `${homedir()}/.opencode`;
21
22
  const DB_PATH = `${DB_DIR}/github-compliance.db`;
@@ -114,14 +115,6 @@ function uuid(): string {
114
115
  return crypto.randomUUID();
115
116
  }
116
117
 
117
- function computeContentHash(title: string | null, body: string): string {
118
- const content = JSON.stringify({
119
- title: title || "",
120
- body: body || ""
121
- });
122
- return "sha256:" + createHash("sha256").update(content).digest("hex");
123
- }
124
-
125
118
  // ============================================================================
126
119
  // Database Initialization
127
120
  // ============================================================================