@pratik7368patil/anchor-core 0.1.6 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pratik7368patil/anchor-core",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Core local indexing, sanitization, and retrieval engine for Anchor.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/db/schema.sql CHANGED
@@ -74,10 +74,55 @@ CREATE VIRTUAL TABLE IF NOT EXISTS wisdom_units_fts USING fts5(
74
74
  category
75
75
  );
76
76
 
77
+ CREATE TABLE IF NOT EXISTS code_files (
78
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
79
+ repo_id INTEGER NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
80
+ path TEXT NOT NULL,
81
+ language TEXT,
82
+ size_bytes INTEGER NOT NULL,
83
+ content_hash TEXT NOT NULL,
84
+ updated_at TEXT NOT NULL,
85
+ UNIQUE(repo_id, path)
86
+ );
87
+
88
+ CREATE TABLE IF NOT EXISTS code_chunks (
89
+ id TEXT PRIMARY KEY,
90
+ repo_id INTEGER NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
91
+ file_id INTEGER NOT NULL REFERENCES code_files(id) ON DELETE CASCADE,
92
+ repo TEXT NOT NULL,
93
+ file_path TEXT NOT NULL,
94
+ language TEXT,
95
+ start_line INTEGER NOT NULL,
96
+ end_line INTEGER NOT NULL,
97
+ sanitized_text TEXT NOT NULL,
98
+ symbols_json TEXT NOT NULL,
99
+ content_hash TEXT NOT NULL,
100
+ updated_at TEXT NOT NULL
101
+ );
102
+
103
+ CREATE VIRTUAL TABLE IF NOT EXISTS code_chunks_fts USING fts5(
104
+ chunkId UNINDEXED,
105
+ sanitizedText,
106
+ filePath,
107
+ symbols,
108
+ language
109
+ );
110
+
111
+ CREATE TABLE IF NOT EXISTS code_index_state (
112
+ repo TEXT PRIMARY KEY,
113
+ last_indexed_at TEXT NOT NULL,
114
+ indexed_files INTEGER NOT NULL,
115
+ code_chunks INTEGER NOT NULL,
116
+ skipped_files INTEGER NOT NULL
117
+ );
118
+
77
119
  CREATE TABLE IF NOT EXISTS sync_state (
78
120
  repo TEXT PRIMARY KEY,
79
121
  last_sync_at TEXT,
80
122
  last_indexed_pr INTEGER,
123
+ history_coverage TEXT,
124
+ history_limit INTEGER,
125
+ history_since TEXT,
81
126
  updated_at TEXT NOT NULL
82
127
  );
83
128
 
@@ -86,3 +131,5 @@ CREATE INDEX IF NOT EXISTS idx_pr_files_path ON pr_files(path);
86
131
  CREATE INDEX IF NOT EXISTS idx_pr_comments_source ON pr_comments(source_type);
87
132
  CREATE INDEX IF NOT EXISTS idx_wisdom_units_category ON wisdom_units(category);
88
133
  CREATE INDEX IF NOT EXISTS idx_wisdom_units_pr ON wisdom_units(pr_id);
134
+ CREATE INDEX IF NOT EXISTS idx_code_files_path ON code_files(path);
135
+ CREATE INDEX IF NOT EXISTS idx_code_chunks_file_path ON code_chunks(file_path);