@sudocode-ai/cli 0.1.0 → 0.1.2

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 (112) hide show
  1. package/dist/cli/feedback-commands.d.ts.map +1 -0
  2. package/dist/cli/feedback-commands.js +274 -0
  3. package/dist/cli/feedback-commands.js.map +1 -0
  4. package/dist/cli/init-commands.d.ts.map +1 -0
  5. package/dist/cli/init-commands.js +148 -0
  6. package/dist/cli/init-commands.js.map +1 -0
  7. package/dist/cli/issue-commands.d.ts.map +1 -0
  8. package/dist/cli/issue-commands.js +310 -0
  9. package/dist/cli/issue-commands.js.map +1 -0
  10. package/dist/cli/query-commands.d.ts.map +1 -0
  11. package/dist/cli/query-commands.js +61 -0
  12. package/dist/cli/query-commands.js.map +1 -0
  13. package/dist/cli/reference-commands.d.ts.map +1 -0
  14. package/dist/cli/reference-commands.js +136 -0
  15. package/dist/cli/reference-commands.js.map +1 -0
  16. package/dist/cli/relationship-commands.d.ts.map +1 -0
  17. package/dist/cli/relationship-commands.js +76 -0
  18. package/dist/cli/relationship-commands.js.map +1 -0
  19. package/dist/cli/server-commands.d.ts.map +1 -0
  20. package/dist/cli/server-commands.js +99 -0
  21. package/dist/cli/server-commands.js.map +1 -0
  22. package/dist/cli/spec-commands.d.ts.map +1 -0
  23. package/dist/cli/spec-commands.js +321 -0
  24. package/dist/cli/spec-commands.js.map +1 -0
  25. package/dist/cli/status-commands.d.ts.map +1 -0
  26. package/dist/cli/status-commands.js +131 -0
  27. package/dist/cli/status-commands.js.map +1 -0
  28. package/dist/cli/sync-commands.d.ts.map +1 -0
  29. package/dist/cli/sync-commands.js +416 -0
  30. package/dist/cli/sync-commands.js.map +1 -0
  31. package/dist/cli/update-commands.d.ts.map +1 -0
  32. package/dist/cli/update-commands.js +78 -0
  33. package/dist/cli/update-commands.js.map +1 -0
  34. package/dist/cli.d.ts.map +1 -0
  35. package/dist/cli.js +425 -195
  36. package/dist/cli.js.map +1 -0
  37. package/dist/db.d.ts.map +1 -0
  38. package/dist/db.js +54 -0
  39. package/dist/db.js.map +1 -0
  40. package/dist/export.d.ts.map +1 -0
  41. package/dist/export.js +195 -0
  42. package/dist/export.js.map +1 -0
  43. package/dist/filename-generator.d.ts.map +1 -0
  44. package/dist/filename-generator.js +93 -0
  45. package/dist/filename-generator.js.map +1 -0
  46. package/dist/id-generator.d.ts.map +1 -0
  47. package/dist/id-generator.js +123 -0
  48. package/dist/id-generator.js.map +1 -0
  49. package/dist/import.d.ts.map +1 -0
  50. package/dist/import.js +608 -0
  51. package/dist/import.js.map +1 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +13 -189
  54. package/dist/index.js.map +1 -0
  55. package/dist/jsonl.d.ts.map +1 -0
  56. package/dist/jsonl.js +333 -0
  57. package/dist/jsonl.js.map +1 -0
  58. package/dist/markdown.d.ts.map +1 -0
  59. package/dist/markdown.js +357 -0
  60. package/dist/markdown.js.map +1 -0
  61. package/dist/migrations.d.ts.map +1 -0
  62. package/dist/migrations.js +57 -0
  63. package/dist/migrations.js.map +1 -0
  64. package/dist/operations/events.d.ts.map +1 -0
  65. package/dist/operations/events.js +108 -0
  66. package/dist/operations/events.js.map +1 -0
  67. package/dist/operations/feedback-anchors.d.ts.map +1 -0
  68. package/dist/operations/feedback-anchors.js +444 -0
  69. package/dist/operations/feedback-anchors.js.map +1 -0
  70. package/dist/operations/feedback.d.ts.map +1 -0
  71. package/dist/operations/feedback.js +234 -0
  72. package/dist/operations/feedback.js.map +1 -0
  73. package/dist/operations/index.d.ts.map +1 -0
  74. package/dist/operations/index.js +10 -0
  75. package/dist/operations/index.js.map +1 -0
  76. package/dist/operations/issues.d.ts.map +1 -0
  77. package/dist/operations/issues.js +411 -0
  78. package/dist/operations/issues.js.map +1 -0
  79. package/dist/operations/references.d.ts.map +1 -0
  80. package/dist/operations/references.js +117 -0
  81. package/dist/operations/references.js.map +1 -0
  82. package/dist/operations/relationships.d.ts.map +1 -0
  83. package/dist/operations/relationships.js +236 -0
  84. package/dist/operations/relationships.js.map +1 -0
  85. package/dist/operations/specs.d.ts.map +1 -0
  86. package/dist/operations/specs.js +290 -0
  87. package/dist/operations/specs.js.map +1 -0
  88. package/dist/operations/tags.d.ts.map +1 -0
  89. package/dist/operations/tags.js +127 -0
  90. package/dist/operations/tags.js.map +1 -0
  91. package/dist/operations/transactions.d.ts.map +1 -0
  92. package/dist/operations/transactions.js +111 -0
  93. package/dist/operations/transactions.js.map +1 -0
  94. package/dist/sync.d.ts.map +1 -0
  95. package/dist/sync.js +442 -0
  96. package/dist/sync.js.map +1 -0
  97. package/dist/test-schema.d.ts.map +1 -0
  98. package/dist/test-schema.js +46 -0
  99. package/dist/test-schema.js.map +1 -0
  100. package/dist/types.d.ts.map +1 -0
  101. package/dist/types.js +7 -0
  102. package/dist/types.js.map +1 -0
  103. package/dist/update-checker.d.ts.map +1 -0
  104. package/dist/update-checker.js +151 -0
  105. package/dist/update-checker.js.map +1 -0
  106. package/dist/version.d.ts.map +1 -0
  107. package/dist/version.js +23 -0
  108. package/dist/version.js.map +1 -0
  109. package/dist/watcher.d.ts.map +1 -0
  110. package/dist/watcher.js +438 -0
  111. package/dist/watcher.js.map +1 -0
  112. package/package.json +4 -7
package/dist/sync.js ADDED
@@ -0,0 +1,442 @@
1
+ /**
2
+ * Bidirectional sync between Markdown files and JSONL/SQLite
3
+ */
4
+ import * as fs from "fs";
5
+ import * as path from "path";
6
+ import { parseMarkdownFile, updateFrontmatterFile, writeMarkdownFile, } from "./markdown.js";
7
+ import { getSpec, getSpecByFilePath, createSpec, updateSpec, } from "./operations/specs.js";
8
+ import { getIssue, createIssue, updateIssue } from "./operations/issues.js";
9
+ import { addRelationship } from "./operations/relationships.js";
10
+ import { getTags, setTags } from "./operations/tags.js";
11
+ import { listFeedback, updateFeedback } from "./operations/feedback.js";
12
+ import { relocateFeedbackAnchor } from "./operations/feedback-anchors.js";
13
+ import { exportToJSONL } from "./export.js";
14
+ import { generateSpecId, generateIssueId } from "./id-generator.js";
15
+ /**
16
+ * Remove internal fields that shouldn't be in markdown frontmatter
17
+ * These fields are only for database tracking, not for the markdown files
18
+ */
19
+ function cleanFrontmatterForMarkdown(data) {
20
+ const { file_path, entity_type, ...clean } = data;
21
+ return clean;
22
+ }
23
+ /**
24
+ * Initialize missing frontmatter fields
25
+ */
26
+ function initializeFrontmatter(db, data, entityType, mdPath, outputDir, user) {
27
+ const now = new Date().toISOString();
28
+ const initialized = { ...data };
29
+ // Generate ID if missing
30
+ if (!initialized.id) {
31
+ initialized.id =
32
+ entityType === "spec"
33
+ ? generateSpecId(db, outputDir)
34
+ : generateIssueId(db, outputDir);
35
+ }
36
+ // Extract title from content if missing
37
+ if (!initialized.title) {
38
+ const content = fs.readFileSync(mdPath, "utf8");
39
+ const titleMatch = content.match(/^#\s+(.+)$/m);
40
+ initialized.title = titleMatch
41
+ ? titleMatch[1]
42
+ : path.basename(mdPath, ".md");
43
+ }
44
+ // Set timestamps
45
+ if (!initialized.created_at) {
46
+ initialized.created_at = now;
47
+ }
48
+ if (!initialized.updated_at) {
49
+ initialized.updated_at = now;
50
+ }
51
+ // Set type-specific defaults
52
+ if (entityType === "spec") {
53
+ if (!initialized.priority && initialized.priority !== 0)
54
+ initialized.priority = 2;
55
+ }
56
+ else {
57
+ // issue
58
+ if (!initialized.status)
59
+ initialized.status = "open";
60
+ if (!initialized.priority && initialized.priority !== 0)
61
+ initialized.priority = 2;
62
+ }
63
+ return initialized;
64
+ }
65
+ /**
66
+ * Sync a markdown file to JSONL and SQLite
67
+ * Parses markdown, updates database, optionally exports to JSONL
68
+ */
69
+ export async function syncMarkdownToJSONL(db, mdPath, options = {}) {
70
+ const { outputDir = ".sudocode", autoExport = true, user = "system", autoInitialize = true, writeBackFrontmatter = true, } = options;
71
+ try {
72
+ // Parse markdown file with database validation for cross-references
73
+ const parsed = parseMarkdownFile(mdPath, db, outputDir);
74
+ let { data, content, references } = parsed;
75
+ // Determine entity type from frontmatter or file path
76
+ const entityType = determineEntityType(data, mdPath);
77
+ let entityId = data.id;
78
+ const frontmatterId = entityId; // Keep track of ID from frontmatter for validation
79
+ // Calculate relative file path from outputDir
80
+ const relPath = path.relative(outputDir, mdPath);
81
+ const filePath = relPath.startsWith("..")
82
+ ? path.relative(process.cwd(), mdPath)
83
+ : relPath;
84
+ // For specs, determine which spec this file corresponds to
85
+ // Support two scenarios: rename (ID stays, path changes) and path-based lookup (no ID)
86
+ let existingByPath = null;
87
+ let existingById = null;
88
+ if (entityType === "spec") {
89
+ // Always set the calculated file path in data (for create/update)
90
+ data.file_path = filePath;
91
+ // Check if a spec exists with this ID (from frontmatter)
92
+ if (frontmatterId) {
93
+ existingById = getSpec(db, frontmatterId);
94
+ }
95
+ // Check if a spec exists at this file path
96
+ existingByPath = getSpecByFilePath(db, filePath);
97
+ // Scenario 1: Spec exists with this ID
98
+ if (existingById) {
99
+ entityId = existingById.id;
100
+ // Check if file was renamed (ID exists but different path)
101
+ if (existingById.file_path !== filePath) {
102
+ console.log(`[sync] File renamed: ${existingById.file_path} → ${filePath}`);
103
+ // Check if another spec already exists at new path (conflict)
104
+ if (existingByPath && existingByPath.id !== existingById.id) {
105
+ console.warn(`[sync] Warning: File path conflict! Spec ${existingByPath.id} already exists at ${filePath}. Keeping ${existingById.id} and updating path.`);
106
+ }
107
+ }
108
+ }
109
+ // Scenario 2: No ID in frontmatter, but spec exists at this path
110
+ else if (existingByPath) {
111
+ entityId = existingByPath.id;
112
+ data.id = entityId;
113
+ }
114
+ // Scenario 3: ID in frontmatter differs from spec at this path (user changed ID)
115
+ else if (frontmatterId && existingByPath) {
116
+ // This shouldn't happen due to earlier checks, but handle it
117
+ const correctId = existingByPath.id;
118
+ console.warn(`[sync] Warning: ID in frontmatter (${frontmatterId}) differs from existing spec ID (${correctId}) for ${filePath}. Using existing ID.`);
119
+ entityId = correctId;
120
+ data.id = entityId;
121
+ }
122
+ }
123
+ // Handle missing frontmatter
124
+ if (!entityId) {
125
+ if (autoInitialize) {
126
+ // Auto-initialize missing fields
127
+ data = initializeFrontmatter(db, data, entityType, mdPath, outputDir, user);
128
+ entityId = data.id;
129
+ // Write back frontmatter if requested
130
+ if (writeBackFrontmatter) {
131
+ // Filter out internal fields that shouldn't be in markdown frontmatter
132
+ const cleanData = cleanFrontmatterForMarkdown(data);
133
+ updateFrontmatterFile(mdPath, cleanData);
134
+ }
135
+ }
136
+ else {
137
+ return {
138
+ success: false,
139
+ action: "no-change",
140
+ entityId: "",
141
+ entityType,
142
+ error: "Missing id in frontmatter (auto-initialization disabled)",
143
+ };
144
+ }
145
+ }
146
+ // Check if entity exists by ID
147
+ const existing = entityType === "spec" ? getSpec(db, entityId) : getIssue(db, entityId);
148
+ const isNew = !existing;
149
+ // Get file modification time to use as updated_at timestamp
150
+ // This ensures database timestamp matches when the file was actually modified
151
+ const fileStat = fs.statSync(mdPath);
152
+ const fileModTime = new Date(fileStat.mtimeMs).toISOString();
153
+ if (entityType === "spec") {
154
+ await syncSpec(db, entityId, data, content, references, isNew, user, fileModTime);
155
+ }
156
+ else {
157
+ await syncIssue(db, entityId, data, content, references, isNew, user, fileModTime);
158
+ }
159
+ // Auto-export to JSONL if enabled
160
+ if (autoExport) {
161
+ await exportToJSONL(db, {
162
+ outputDir,
163
+ });
164
+ }
165
+ return {
166
+ success: true,
167
+ action: isNew ? "created" : "updated",
168
+ entityId,
169
+ entityType,
170
+ };
171
+ }
172
+ catch (error) {
173
+ return {
174
+ success: false,
175
+ action: "no-change",
176
+ entityId: "",
177
+ entityType: "spec",
178
+ error: error instanceof Error ? error.message : String(error),
179
+ };
180
+ }
181
+ }
182
+ /**
183
+ * Sync from JSONL/SQLite to markdown file
184
+ * Updates markdown frontmatter while preserving content
185
+ */
186
+ export async function syncJSONLToMarkdown(db, entityId, entityType, mdPath) {
187
+ try {
188
+ // Get entity from database
189
+ const entity = entityType === "spec" ? getSpec(db, entityId) : getIssue(db, entityId);
190
+ if (!entity) {
191
+ return {
192
+ success: false,
193
+ action: "no-change",
194
+ entityId,
195
+ entityType,
196
+ error: `${entityType} not found: ${entityId}`,
197
+ };
198
+ }
199
+ // Get relationships and tags
200
+ const { getOutgoingRelationships } = await import("./operations/relationships.js");
201
+ const relationships = getOutgoingRelationships(db, entityId, entityType);
202
+ const tags = getTags(db, entityId, entityType);
203
+ // Build frontmatter
204
+ const frontmatter = entityToFrontmatter(entity, entityType, relationships, tags);
205
+ // Check if file exists
206
+ const fileExists = fs.existsSync(mdPath);
207
+ if (fileExists) {
208
+ // Update existing file's frontmatter only
209
+ updateFrontmatterFile(mdPath, frontmatter);
210
+ }
211
+ else {
212
+ // Create new file with content from database
213
+ const content = entity.content || "";
214
+ writeMarkdownFile(mdPath, frontmatter, content);
215
+ }
216
+ return {
217
+ success: true,
218
+ action: fileExists ? "updated" : "created",
219
+ entityId,
220
+ entityType,
221
+ };
222
+ }
223
+ catch (error) {
224
+ return {
225
+ success: false,
226
+ action: "no-change",
227
+ entityId,
228
+ entityType,
229
+ error: error instanceof Error ? error.message : String(error),
230
+ };
231
+ }
232
+ }
233
+ /**
234
+ * Determine entity type from frontmatter or file path
235
+ */
236
+ function determineEntityType(frontmatter, filePath) {
237
+ // Check frontmatter type field
238
+ if (frontmatter.entity_type === "issue") {
239
+ return "issue";
240
+ }
241
+ if (frontmatter.entity_type === "spec") {
242
+ return "spec";
243
+ }
244
+ // Check file path
245
+ if (filePath.includes("/issues/") || filePath.includes("/issue-")) {
246
+ return "issue";
247
+ }
248
+ if (filePath.includes("/specs/") || filePath.includes("/spec-")) {
249
+ return "spec";
250
+ }
251
+ // Default to spec
252
+ return "spec";
253
+ }
254
+ /**
255
+ * Sync spec data to database
256
+ */
257
+ async function syncSpec(db, id, frontmatter, content, references, isNew, user, fileModTime) {
258
+ // Get old content before updating (for anchor relocation)
259
+ const oldSpec = isNew ? null : getSpec(db, id);
260
+ const oldContent = oldSpec?.content || "";
261
+ const specData = {
262
+ id,
263
+ title: frontmatter.title || "Untitled",
264
+ file_path: frontmatter.file_path || "",
265
+ content,
266
+ priority: frontmatter.priority ?? 2,
267
+ parent_id: frontmatter.parent_id || undefined,
268
+ };
269
+ if (isNew) {
270
+ createSpec(db, {
271
+ ...specData,
272
+ updated_at: fileModTime,
273
+ });
274
+ }
275
+ else {
276
+ // Check if content has actually changed
277
+ const contentChanged = oldSpec?.title !== specData.title ||
278
+ oldSpec?.content !== specData.content ||
279
+ oldSpec?.priority !== specData.priority ||
280
+ oldSpec?.parent_id !== specData.parent_id ||
281
+ oldSpec?.file_path !== specData.file_path;
282
+ // Only update timestamp if content actually changed
283
+ updateSpec(db, id, {
284
+ ...specData,
285
+ ...(contentChanged && fileModTime ? { updated_at: fileModTime } : {}),
286
+ });
287
+ // Relocate feedback anchors if content changed
288
+ if (oldContent !== content) {
289
+ const feedbackList = listFeedback(db, { spec_id: id });
290
+ if (feedbackList.length > 0) {
291
+ // Relocate each feedback anchor
292
+ for (const feedback of feedbackList) {
293
+ const oldAnchor = typeof feedback.anchor === "string"
294
+ ? JSON.parse(feedback.anchor)
295
+ : feedback.anchor;
296
+ // Relocate the anchor
297
+ const newAnchor = relocateFeedbackAnchor(oldContent, content, oldAnchor);
298
+ // Update feedback with new anchor
299
+ updateFeedback(db, feedback.id, {
300
+ anchor: newAnchor,
301
+ });
302
+ }
303
+ }
304
+ }
305
+ }
306
+ // Sync tags
307
+ if (frontmatter.tags && Array.isArray(frontmatter.tags)) {
308
+ setTags(db, id, "spec", frontmatter.tags);
309
+ }
310
+ // Sync relationships from cross-references
311
+ await syncRelationships(db, id, "spec", references, frontmatter.relationships, user);
312
+ }
313
+ /**
314
+ * Sync issue data to database
315
+ */
316
+ async function syncIssue(db, id, frontmatter, content, references, isNew, user, fileModTime) {
317
+ const oldIssue = isNew ? null : getIssue(db, id);
318
+ const issueData = {
319
+ id,
320
+ title: frontmatter.title || "Untitled",
321
+ content,
322
+ status: frontmatter.status || "open",
323
+ priority: frontmatter.priority ?? 2,
324
+ assignee: frontmatter.assignee || undefined,
325
+ parent_id: frontmatter.parent_id || undefined,
326
+ };
327
+ if (isNew) {
328
+ createIssue(db, {
329
+ ...issueData,
330
+ updated_at: fileModTime,
331
+ });
332
+ }
333
+ else {
334
+ // Check if content has actually changed
335
+ const contentChanged = oldIssue?.title !== issueData.title ||
336
+ oldIssue?.content !== issueData.content ||
337
+ oldIssue?.status !== issueData.status ||
338
+ oldIssue?.priority !== issueData.priority ||
339
+ oldIssue?.assignee !== issueData.assignee ||
340
+ oldIssue?.parent_id !== issueData.parent_id;
341
+ // Only update timestamp if content actually changed
342
+ updateIssue(db, id, {
343
+ ...issueData,
344
+ ...(contentChanged && fileModTime ? { updated_at: fileModTime } : {}),
345
+ });
346
+ }
347
+ // Sync tags
348
+ if (frontmatter.tags && Array.isArray(frontmatter.tags)) {
349
+ setTags(db, id, "issue", frontmatter.tags);
350
+ }
351
+ // Sync relationships from cross-references
352
+ await syncRelationships(db, id, "issue", references, frontmatter.relationships, user);
353
+ }
354
+ /**
355
+ * Sync relationships from cross-references and frontmatter
356
+ * Preserves existing relationships not in frontmatter
357
+ */
358
+ async function syncRelationships(db, entityId, entityType, references, frontmatterRels, user = "system") {
359
+ // Get existing relationships (all outgoing)
360
+ const { getOutgoingRelationships } = await import("./operations/relationships.js");
361
+ const existing = getOutgoingRelationships(db, entityId, entityType);
362
+ const existingSet = new Set(existing.map((r) => `${r.relationship_type}:${r.to_type}:${r.to_id}`));
363
+ // Add relationships from cross-references (defaults to 'references' type)
364
+ for (const ref of references) {
365
+ const relType = ref.relationshipType || "references";
366
+ const key = `${relType}:${ref.type}:${ref.id}`;
367
+ if (!existingSet.has(key)) {
368
+ try {
369
+ addRelationship(db, {
370
+ from_id: entityId,
371
+ from_type: entityType,
372
+ to_id: ref.id,
373
+ to_type: ref.type,
374
+ relationship_type: relType,
375
+ metadata: ref.anchor
376
+ ? JSON.stringify({ anchor: ref.anchor })
377
+ : undefined,
378
+ });
379
+ }
380
+ catch (error) {
381
+ // Ignore errors (e.g., target not found, duplicate)
382
+ }
383
+ }
384
+ }
385
+ // Add relationships from frontmatter
386
+ if (frontmatterRels && Array.isArray(frontmatterRels)) {
387
+ for (const rel of frontmatterRels) {
388
+ const key = `${rel.relationship_type}:${rel.target_type}:${rel.target_id}`;
389
+ if (!existingSet.has(key)) {
390
+ try {
391
+ addRelationship(db, {
392
+ from_id: entityId,
393
+ from_type: entityType,
394
+ to_id: rel.target_id,
395
+ to_type: rel.target_type,
396
+ relationship_type: rel.relationship_type,
397
+ });
398
+ }
399
+ catch (error) {
400
+ // Ignore errors
401
+ }
402
+ }
403
+ }
404
+ }
405
+ // Note: We preserve existing relationships not in frontmatter
406
+ // This allows relationships added via CLI/UI to persist
407
+ }
408
+ /**
409
+ * Convert entity to frontmatter object
410
+ */
411
+ function entityToFrontmatter(entity, entityType, relationships, tags) {
412
+ const base = {
413
+ id: entity.id,
414
+ title: entity.title,
415
+ priority: entity.priority,
416
+ created_at: entity.created_at,
417
+ };
418
+ // Only add optional fields if they have values
419
+ if (entity.parent_id)
420
+ base.parent_id = entity.parent_id;
421
+ if (tags.length > 0)
422
+ base.tags = tags;
423
+ if (relationships.length > 0)
424
+ base.relationships = relationships;
425
+ if (entityType === "spec") {
426
+ return base;
427
+ }
428
+ else {
429
+ const issue = entity;
430
+ const result = {
431
+ ...base,
432
+ status: issue.status,
433
+ };
434
+ // Only add optional issue fields if they have values
435
+ if (issue.assignee)
436
+ result.assignee = issue.assignee;
437
+ if (issue.closed_at)
438
+ result.closed_at = issue.closed_at;
439
+ return result;
440
+ }
441
+ }
442
+ //# sourceMappingURL=sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.js","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,eAA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C,SAAS,CAAC;IACxD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACtC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IAEjE,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,GAAG,MAAe,CAAC;QAC9B,MAAM,MAAM,GAAwB;YAClC,GAAG,IAAI;YACP,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC;QAEF,qDAAqD;QACrD,IAAI,KAAK,CAAC,QAAQ;YAAE,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QACrD,IAAI,KAAK,CAAC,SAAS;YAAE,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QAExD,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-schema.d.ts","sourceRoot":"","sources":["../src/test-schema.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Simple test to verify schema initialization
3
+ */
4
+ import { initDatabase } from './db.js';
5
+ async function testSchema() {
6
+ console.log('Testing database schema initialization...');
7
+ // Create an in-memory database for testing
8
+ const db = initDatabase({ path: ':memory:', verbose: true });
9
+ // Test that tables exist
10
+ const tables = db
11
+ .prepare(`SELECT name FROM sqlite_master WHERE type='table' ORDER BY name`)
12
+ .all();
13
+ console.log('\n✓ Tables created:');
14
+ tables.forEach((table) => {
15
+ console.log(` - ${table.name}`);
16
+ });
17
+ // Test that indexes exist
18
+ const indexes = db
19
+ .prepare(`SELECT name FROM sqlite_master WHERE type='index' ORDER BY name`)
20
+ .all();
21
+ console.log('\n✓ Indexes created:');
22
+ indexes.forEach((index) => {
23
+ console.log(` - ${index.name}`);
24
+ });
25
+ // Test that views exist
26
+ const views = db
27
+ .prepare(`SELECT name FROM sqlite_master WHERE type='view' ORDER BY name`)
28
+ .all();
29
+ console.log('\n✓ Views created:');
30
+ views.forEach((view) => {
31
+ console.log(` - ${view.name}`);
32
+ });
33
+ // Test database configuration
34
+ const walMode = db.pragma('journal_mode', { simple: true });
35
+ const foreignKeys = db.pragma('foreign_keys', { simple: true });
36
+ console.log('\n✓ Database configuration:');
37
+ console.log(` - WAL mode: ${walMode}`);
38
+ console.log(` - Foreign keys: ${foreignKeys ? 'enabled' : 'disabled'}`);
39
+ db.close();
40
+ console.log('\n✓ Schema test completed successfully!');
41
+ }
42
+ testSchema().catch((error) => {
43
+ console.error('Schema test failed:', error);
44
+ process.exit(1);
45
+ });
46
+ //# sourceMappingURL=test-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-schema.js","sourceRoot":"","sources":["../src/test-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,KAAK,UAAU,UAAU;IACvB,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;IAEzD,2CAA2C;IAC3C,MAAM,EAAE,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7D,yBAAyB;IACzB,MAAM,MAAM,GAAG,EAAE;SACd,OAAO,CACN,iEAAiE,CAClE;SACA,GAAG,EAAE,CAAC;IAET,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACnC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;QAC5B,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,0BAA0B;IAC1B,MAAM,OAAO,GAAG,EAAE;SACf,OAAO,CACN,iEAAiE,CAClE;SACA,GAAG,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ClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,IAAI,EACJ,KAAK,EACL,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,GAAG,EACH,KAAK,EACL,SAAS,EACT,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,SAAS,EACT,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,MAAM,GACP,MAAM,oBAAoB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Type definitions for sudocode CLI
3
+ *
4
+ * Core entity types are imported from the main sudocode package.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-checker.d.ts","sourceRoot":"","sources":["../src/update-checker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,UAAU,UAAU;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;CAC1B;AA0ED;;;GAGG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAyBlE;AAqBD;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAsBpE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAQvC"}