@sudocode-ai/cli 0.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.
- package/README.md +330 -0
- package/dist/cli/feedback-commands.d.ts +53 -0
- package/dist/cli/init-commands.d.ts +22 -0
- package/dist/cli/issue-commands.d.ts +45 -0
- package/dist/cli/query-commands.d.ts +18 -0
- package/dist/cli/reference-commands.d.ts +22 -0
- package/dist/cli/relationship-commands.d.ts +14 -0
- package/dist/cli/server-commands.d.ts +17 -0
- package/dist/cli/spec-commands.d.ts +38 -0
- package/dist/cli/status-commands.d.ts +17 -0
- package/dist/cli/sync-commands.d.ts +24 -0
- package/dist/cli/update-commands.d.ts +12 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +196 -0
- package/dist/db.d.ts +21 -0
- package/dist/export.d.ts +79 -0
- package/dist/filename-generator.d.ts +30 -0
- package/dist/id-generator.d.ts +26 -0
- package/dist/import.d.ts +118 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +189 -0
- package/dist/jsonl.d.ts +69 -0
- package/dist/markdown.d.ts +146 -0
- package/dist/migrations.d.ts +23 -0
- package/dist/operations/events.d.ts +53 -0
- package/dist/operations/feedback-anchors.d.ts +92 -0
- package/dist/operations/feedback.d.ts +76 -0
- package/dist/operations/index.d.ts +10 -0
- package/dist/operations/issues.d.ts +82 -0
- package/dist/operations/references.d.ts +34 -0
- package/dist/operations/relationships.d.ts +57 -0
- package/dist/operations/specs.d.ts +64 -0
- package/dist/operations/tags.d.ts +42 -0
- package/dist/operations/transactions.d.ts +41 -0
- package/dist/sync.d.ts +47 -0
- package/dist/test-schema.d.ts +5 -0
- package/dist/types.d.ts +7 -0
- package/dist/update-checker.d.ts +24 -0
- package/dist/version.d.ts +12 -0
- package/dist/watcher.d.ts +63 -0
- package/package.json +68 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database migration utilities for sudocode
|
|
3
|
+
*/
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
export interface Migration {
|
|
6
|
+
version: number;
|
|
7
|
+
name: string;
|
|
8
|
+
up: (db: Database.Database) => void;
|
|
9
|
+
down?: (db: Database.Database) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Get the current migration version from the database
|
|
13
|
+
*/
|
|
14
|
+
export declare function getCurrentMigrationVersion(db: Database.Database): number;
|
|
15
|
+
/**
|
|
16
|
+
* Record a migration as applied
|
|
17
|
+
*/
|
|
18
|
+
export declare function recordMigration(db: Database.Database, migration: Migration): void;
|
|
19
|
+
/**
|
|
20
|
+
* Run all pending migrations
|
|
21
|
+
*/
|
|
22
|
+
export declare function runMigrations(db: Database.Database): void;
|
|
23
|
+
//# sourceMappingURL=migrations.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations for Events (audit trail)
|
|
3
|
+
*/
|
|
4
|
+
import type Database from 'better-sqlite3';
|
|
5
|
+
import type { Event, EntityType, EventType } from '../types.js';
|
|
6
|
+
export interface CreateEventInput {
|
|
7
|
+
entity_id: string;
|
|
8
|
+
entity_type: EntityType;
|
|
9
|
+
event_type: EventType;
|
|
10
|
+
actor: string;
|
|
11
|
+
old_value?: string | null;
|
|
12
|
+
new_value?: string | null;
|
|
13
|
+
comment?: string | null;
|
|
14
|
+
git_commit_sha?: string | null;
|
|
15
|
+
source?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface QueryEventsOptions {
|
|
18
|
+
entity_id?: string;
|
|
19
|
+
entity_type?: EntityType;
|
|
20
|
+
event_type?: EventType;
|
|
21
|
+
actor?: string;
|
|
22
|
+
limit?: number;
|
|
23
|
+
offset?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Insert an event
|
|
27
|
+
*/
|
|
28
|
+
export declare function insertEvent(db: Database.Database, input: CreateEventInput): Event;
|
|
29
|
+
/**
|
|
30
|
+
* Get an event by ID
|
|
31
|
+
*/
|
|
32
|
+
export declare function getEvent(db: Database.Database, id: number): Event | null;
|
|
33
|
+
/**
|
|
34
|
+
* Query events with filters
|
|
35
|
+
*/
|
|
36
|
+
export declare function queryEvents(db: Database.Database, options?: QueryEventsOptions): Event[];
|
|
37
|
+
/**
|
|
38
|
+
* Get all events for a specific entity
|
|
39
|
+
*/
|
|
40
|
+
export declare function getEntityEvents(db: Database.Database, entity_id: string, entity_type: EntityType, limit?: number): Event[];
|
|
41
|
+
/**
|
|
42
|
+
* Get recent events across all entities
|
|
43
|
+
*/
|
|
44
|
+
export declare function getRecentEvents(db: Database.Database, limit?: number): Event[];
|
|
45
|
+
/**
|
|
46
|
+
* Get events by actor
|
|
47
|
+
*/
|
|
48
|
+
export declare function getEventsByActor(db: Database.Database, actor: string, limit?: number): Event[];
|
|
49
|
+
/**
|
|
50
|
+
* Delete events for an entity (cleanup)
|
|
51
|
+
*/
|
|
52
|
+
export declare function deleteEntityEvents(db: Database.Database, entity_id: string, entity_type: EntityType): number;
|
|
53
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feedback anchor creation and manipulation utilities
|
|
3
|
+
*/
|
|
4
|
+
import type { FeedbackAnchor } from '../types.js';
|
|
5
|
+
export interface SectionInfo {
|
|
6
|
+
heading: string;
|
|
7
|
+
level: number;
|
|
8
|
+
startLine: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Create a feedback anchor at a specific line in spec content
|
|
12
|
+
*/
|
|
13
|
+
export declare function createFeedbackAnchor(specContent: string, lineNumber: number, charOffset?: number): FeedbackAnchor;
|
|
14
|
+
/**
|
|
15
|
+
* Create a feedback anchor by searching for text in spec content
|
|
16
|
+
*/
|
|
17
|
+
export declare function createAnchorByText(specContent: string, searchText: string): FeedbackAnchor | null;
|
|
18
|
+
/**
|
|
19
|
+
* Find the section (markdown heading) containing a given line
|
|
20
|
+
* Walks backwards from the line to find the nearest heading
|
|
21
|
+
*/
|
|
22
|
+
export declare function findContainingSection(lines: string[], lineNumber: number): SectionInfo | null;
|
|
23
|
+
/**
|
|
24
|
+
* Extract a text snippet from a line with optional character offset
|
|
25
|
+
*/
|
|
26
|
+
export declare function extractSnippet(line: string, charOffset?: number, maxLength?: number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Get context around a line (before or after)
|
|
29
|
+
* @param chars Number of characters to get (negative for before, positive for after)
|
|
30
|
+
*/
|
|
31
|
+
export declare function getContext(lines: string[], fromLine: number, chars: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Create a content hash for quick validation
|
|
34
|
+
*/
|
|
35
|
+
export declare function createContentHash(content: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Verify that an anchor still points to the expected location
|
|
38
|
+
*/
|
|
39
|
+
export declare function verifyAnchor(specContent: string, anchor: FeedbackAnchor): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Get all section headings from spec content
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAllSections(specContent: string): SectionInfo[];
|
|
44
|
+
/**
|
|
45
|
+
* Search for text with context matching
|
|
46
|
+
* Returns all matching locations with confidence scores
|
|
47
|
+
*/
|
|
48
|
+
export declare function searchByContent(specContent: string, snippet?: string, contextBefore?: string, contextAfter?: string): Array<{
|
|
49
|
+
lineNumber: number;
|
|
50
|
+
confidence: number;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Calculate Levenshtein distance between two strings
|
|
54
|
+
* Used for fuzzy matching of section headings
|
|
55
|
+
*/
|
|
56
|
+
export declare function levenshteinDistance(str1: string, str2: string): number;
|
|
57
|
+
/**
|
|
58
|
+
* Find the best matching section using fuzzy matching
|
|
59
|
+
* Returns section with lowest edit distance (Levenshtein)
|
|
60
|
+
*/
|
|
61
|
+
export declare function findFuzzySection(specContent: string, targetHeading: string, maxDistance?: number): SectionInfo | null;
|
|
62
|
+
/**
|
|
63
|
+
* Relocate a feedback anchor when spec content changes
|
|
64
|
+
* Uses cascade strategy:
|
|
65
|
+
* 1. Section + Line Offset (if section unchanged)
|
|
66
|
+
* 2. Content Search (snippet + context)
|
|
67
|
+
* 3. Fuzzy Section Match (Levenshtein distance)
|
|
68
|
+
* 4. Mark as Stale (preserve original)
|
|
69
|
+
*/
|
|
70
|
+
export declare function relocateFeedbackAnchor(oldSpecContent: string, newSpecContent: string, anchor: FeedbackAnchor): FeedbackAnchor;
|
|
71
|
+
/**
|
|
72
|
+
* Relocate all feedback anchors for a spec when its content changes
|
|
73
|
+
* Returns summary of relocation results
|
|
74
|
+
*/
|
|
75
|
+
export interface RelocationResult {
|
|
76
|
+
feedback_id: string;
|
|
77
|
+
old_status: 'valid' | 'relocated' | 'stale';
|
|
78
|
+
new_status: 'valid' | 'relocated' | 'stale';
|
|
79
|
+
relocated: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface RelocationSummary {
|
|
82
|
+
total: number;
|
|
83
|
+
valid: number;
|
|
84
|
+
relocated: number;
|
|
85
|
+
stale: number;
|
|
86
|
+
results: RelocationResult[];
|
|
87
|
+
}
|
|
88
|
+
export declare function relocateSpecFeedback(oldSpecContent: string, newSpecContent: string, feedbackList: Array<{
|
|
89
|
+
id: string;
|
|
90
|
+
anchor: FeedbackAnchor;
|
|
91
|
+
}>): RelocationSummary;
|
|
92
|
+
//# sourceMappingURL=feedback-anchors.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRUD operations for Issue Feedback
|
|
3
|
+
*/
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
import type { IssueFeedback, FeedbackType, FeedbackAnchor } from "../types.js";
|
|
6
|
+
export interface CreateFeedbackInput {
|
|
7
|
+
id?: string;
|
|
8
|
+
issue_id: string;
|
|
9
|
+
spec_id: string;
|
|
10
|
+
feedback_type: FeedbackType;
|
|
11
|
+
content: string;
|
|
12
|
+
agent?: string;
|
|
13
|
+
anchor?: FeedbackAnchor;
|
|
14
|
+
dismissed?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface UpdateFeedbackInput {
|
|
17
|
+
content?: string;
|
|
18
|
+
dismissed?: boolean;
|
|
19
|
+
anchor?: FeedbackAnchor;
|
|
20
|
+
}
|
|
21
|
+
export interface ListFeedbackOptions {
|
|
22
|
+
issue_id?: string;
|
|
23
|
+
spec_id?: string;
|
|
24
|
+
feedback_type?: FeedbackType;
|
|
25
|
+
dismissed?: boolean;
|
|
26
|
+
limit?: number;
|
|
27
|
+
offset?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Generate next feedback ID (FB-001, FB-002, etc.)
|
|
31
|
+
*/
|
|
32
|
+
export declare function generateFeedbackId(db: Database.Database): string;
|
|
33
|
+
/**
|
|
34
|
+
* Create a new feedback entry
|
|
35
|
+
*/
|
|
36
|
+
export declare function createFeedback(db: Database.Database, input: CreateFeedbackInput): IssueFeedback;
|
|
37
|
+
/**
|
|
38
|
+
* Get a feedback entry by ID
|
|
39
|
+
*/
|
|
40
|
+
export declare function getFeedback(db: Database.Database, id: string): IssueFeedback | null;
|
|
41
|
+
/**
|
|
42
|
+
* Update a feedback entry
|
|
43
|
+
*/
|
|
44
|
+
export declare function updateFeedback(db: Database.Database, id: string, input: UpdateFeedbackInput): IssueFeedback;
|
|
45
|
+
/**
|
|
46
|
+
* Delete a feedback entry
|
|
47
|
+
*/
|
|
48
|
+
export declare function deleteFeedback(db: Database.Database, id: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Dismiss feedback (convenience method)
|
|
51
|
+
*/
|
|
52
|
+
export declare function dismissFeedback(db: Database.Database, id: string): IssueFeedback;
|
|
53
|
+
/**
|
|
54
|
+
* List feedback entries with optional filters
|
|
55
|
+
*/
|
|
56
|
+
export declare function listFeedback(db: Database.Database, options?: ListFeedbackOptions): IssueFeedback[];
|
|
57
|
+
/**
|
|
58
|
+
* Get all feedback for a specific issue
|
|
59
|
+
*/
|
|
60
|
+
export declare function getFeedbackForIssue(db: Database.Database, issue_id: string): IssueFeedback[];
|
|
61
|
+
/**
|
|
62
|
+
* Get all feedback for a specific spec
|
|
63
|
+
*/
|
|
64
|
+
export declare function getFeedbackForSpec(db: Database.Database, spec_id: string): IssueFeedback[];
|
|
65
|
+
/**
|
|
66
|
+
* Get active feedback for a spec (not dismissed)
|
|
67
|
+
*/
|
|
68
|
+
export declare function getActiveFeedbackForSpec(db: Database.Database, spec_id: string): IssueFeedback[];
|
|
69
|
+
/**
|
|
70
|
+
* Count feedback by dismissed status
|
|
71
|
+
*/
|
|
72
|
+
export declare function countFeedbackByDismissed(db: Database.Database, spec_id?: string): {
|
|
73
|
+
active: number;
|
|
74
|
+
dismissed: number;
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=feedback.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main entry point for all database operations
|
|
3
|
+
*/
|
|
4
|
+
export * from './specs.js';
|
|
5
|
+
export * from './issues.js';
|
|
6
|
+
export * from './relationships.js';
|
|
7
|
+
export * from './tags.js';
|
|
8
|
+
export * from './events.js';
|
|
9
|
+
export * from './references.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRUD operations for Issues
|
|
3
|
+
*/
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
import type { Issue, IssueStatus } from "../types.js";
|
|
6
|
+
export interface CreateIssueInput {
|
|
7
|
+
id: string;
|
|
8
|
+
uuid?: string;
|
|
9
|
+
title: string;
|
|
10
|
+
content?: string;
|
|
11
|
+
status?: IssueStatus;
|
|
12
|
+
priority?: number;
|
|
13
|
+
assignee?: string;
|
|
14
|
+
parent_id?: string;
|
|
15
|
+
archived?: boolean;
|
|
16
|
+
archived_at?: string;
|
|
17
|
+
created_at?: string;
|
|
18
|
+
updated_at?: string;
|
|
19
|
+
closed_at?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface UpdateIssueInput {
|
|
22
|
+
title?: string;
|
|
23
|
+
content?: string;
|
|
24
|
+
status?: IssueStatus;
|
|
25
|
+
priority?: number;
|
|
26
|
+
assignee?: string;
|
|
27
|
+
parent_id?: string;
|
|
28
|
+
archived?: boolean;
|
|
29
|
+
archived_at?: string;
|
|
30
|
+
updated_at?: string;
|
|
31
|
+
closed_at?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ListIssuesOptions {
|
|
34
|
+
status?: IssueStatus;
|
|
35
|
+
priority?: number;
|
|
36
|
+
assignee?: string;
|
|
37
|
+
parent_id?: string;
|
|
38
|
+
archived?: boolean;
|
|
39
|
+
limit?: number;
|
|
40
|
+
offset?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a new issue
|
|
44
|
+
*/
|
|
45
|
+
export declare function createIssue(db: Database.Database, input: CreateIssueInput): Issue;
|
|
46
|
+
/**
|
|
47
|
+
* Get an issue by ID
|
|
48
|
+
*/
|
|
49
|
+
export declare function getIssue(db: Database.Database, id: string): Issue | null;
|
|
50
|
+
/**
|
|
51
|
+
* Update an issue
|
|
52
|
+
*/
|
|
53
|
+
export declare function updateIssue(db: Database.Database, id: string, input: UpdateIssueInput): Issue;
|
|
54
|
+
/**
|
|
55
|
+
* Delete an issue
|
|
56
|
+
*/
|
|
57
|
+
export declare function deleteIssue(db: Database.Database, id: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Close an issue (convenience method)
|
|
60
|
+
*/
|
|
61
|
+
export declare function closeIssue(db: Database.Database, id: string): Issue;
|
|
62
|
+
/**
|
|
63
|
+
* Reopen an issue (convenience method)
|
|
64
|
+
*/
|
|
65
|
+
export declare function reopenIssue(db: Database.Database, id: string): Issue;
|
|
66
|
+
/**
|
|
67
|
+
* List issues with optional filters
|
|
68
|
+
*/
|
|
69
|
+
export declare function listIssues(db: Database.Database, options?: ListIssuesOptions): Issue[];
|
|
70
|
+
/**
|
|
71
|
+
* Get ready issues (no blockers)
|
|
72
|
+
*/
|
|
73
|
+
export declare function getReadyIssues(db: Database.Database): Issue[];
|
|
74
|
+
/**
|
|
75
|
+
* Get blocked issues
|
|
76
|
+
*/
|
|
77
|
+
export declare function getBlockedIssues(db: Database.Database): any[];
|
|
78
|
+
/**
|
|
79
|
+
* Search issues by title or content
|
|
80
|
+
*/
|
|
81
|
+
export declare function searchIssues(db: Database.Database, query: string, options?: Omit<ListIssuesOptions, "offset">): Issue[];
|
|
82
|
+
//# sourceMappingURL=issues.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations for managing cross-references in markdown content
|
|
3
|
+
*/
|
|
4
|
+
export interface AddReferenceOptions {
|
|
5
|
+
referenceId: string;
|
|
6
|
+
displayText?: string;
|
|
7
|
+
relationshipType?: string;
|
|
8
|
+
format?: 'inline' | 'newline';
|
|
9
|
+
position?: 'before' | 'after';
|
|
10
|
+
}
|
|
11
|
+
export interface ReferenceLocation {
|
|
12
|
+
line?: number;
|
|
13
|
+
text?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Format a reference string with optional display text and relationship type
|
|
17
|
+
*
|
|
18
|
+
* Examples:
|
|
19
|
+
* - formatReference('issue-001') => '[[issue-001]]'
|
|
20
|
+
* - formatReference('issue-001', 'OAuth') => '[[issue-001|OAuth]]'
|
|
21
|
+
* - formatReference('issue-001', undefined, 'implements') => '[[issue-001]]{ implements }'
|
|
22
|
+
* - formatReference('issue-001', 'OAuth', 'implements') => '[[issue-001|OAuth]]{ implements }'
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatReference(referenceId: string, displayText?: string, relationshipType?: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Add a reference to markdown content at the specified location
|
|
27
|
+
*
|
|
28
|
+
* @param content - The markdown content to modify
|
|
29
|
+
* @param location - Where to insert the reference (line or text)
|
|
30
|
+
* @param options - Reference formatting options
|
|
31
|
+
* @returns Updated content with reference inserted
|
|
32
|
+
*/
|
|
33
|
+
export declare function addReferenceToContent(content: string, location: ReferenceLocation, options: AddReferenceOptions): string;
|
|
34
|
+
//# sourceMappingURL=references.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations for Relationships
|
|
3
|
+
*/
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
import type { Relationship, EntityType, RelationshipType } from "../types.js";
|
|
6
|
+
export interface CreateRelationshipInput {
|
|
7
|
+
from_id: string;
|
|
8
|
+
from_type: EntityType;
|
|
9
|
+
to_id: string;
|
|
10
|
+
to_type: EntityType;
|
|
11
|
+
relationship_type: RelationshipType;
|
|
12
|
+
metadata?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Add a relationship between entities
|
|
16
|
+
*/
|
|
17
|
+
export declare function addRelationship(db: Database.Database, input: CreateRelationshipInput): Relationship;
|
|
18
|
+
/**
|
|
19
|
+
* Get a specific relationship
|
|
20
|
+
*/
|
|
21
|
+
export declare function getRelationship(db: Database.Database, from_id: string, from_type: EntityType, to_id: string, to_type: EntityType, relationship_type: RelationshipType): Relationship | null;
|
|
22
|
+
/**
|
|
23
|
+
* Remove a relationship
|
|
24
|
+
*/
|
|
25
|
+
export declare function removeRelationship(db: Database.Database, from_id: string, from_type: EntityType, to_id: string, to_type: EntityType, relationship_type: RelationshipType): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Get all outgoing relationships from an entity
|
|
28
|
+
*/
|
|
29
|
+
export declare function getOutgoingRelationships(db: Database.Database, entity_id: string, entity_type: EntityType, relationship_type?: RelationshipType): Relationship[];
|
|
30
|
+
/**
|
|
31
|
+
* Get all incoming relationships to an entity
|
|
32
|
+
*/
|
|
33
|
+
export declare function getIncomingRelationships(db: Database.Database, entity_id: string, entity_type: EntityType, relationship_type?: RelationshipType): Relationship[];
|
|
34
|
+
/**
|
|
35
|
+
* Get all dependencies (what this entity depends on - things that block it)
|
|
36
|
+
*/
|
|
37
|
+
export declare function getDependencies(db: Database.Database, entity_id: string, entity_type: EntityType): Relationship[];
|
|
38
|
+
/**
|
|
39
|
+
* Get all dependents (what depends on this entity - things it blocks)
|
|
40
|
+
*/
|
|
41
|
+
export declare function getDependents(db: Database.Database, entity_id: string, entity_type: EntityType): Relationship[];
|
|
42
|
+
/**
|
|
43
|
+
* Get all relationships for an entity (both incoming and outgoing)
|
|
44
|
+
*/
|
|
45
|
+
export declare function getAllRelationships(db: Database.Database, entity_id: string, entity_type: EntityType): {
|
|
46
|
+
outgoing: Relationship[];
|
|
47
|
+
incoming: Relationship[];
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Check if a relationship exists
|
|
51
|
+
*/
|
|
52
|
+
export declare function relationshipExists(db: Database.Database, from_id: string, from_type: EntityType, to_id: string, to_type: EntityType, relationship_type: RelationshipType): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Remove all relationships for an entity
|
|
55
|
+
*/
|
|
56
|
+
export declare function removeAllRelationships(db: Database.Database, entity_id: string, entity_type: EntityType): number;
|
|
57
|
+
//# sourceMappingURL=relationships.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRUD operations for Specs
|
|
3
|
+
*/
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
import type { Spec } from "../types.js";
|
|
6
|
+
export interface CreateSpecInput {
|
|
7
|
+
id: string;
|
|
8
|
+
uuid?: string;
|
|
9
|
+
title: string;
|
|
10
|
+
file_path: string;
|
|
11
|
+
content?: string;
|
|
12
|
+
priority?: number;
|
|
13
|
+
parent_id?: string;
|
|
14
|
+
archived?: boolean;
|
|
15
|
+
archived_at?: string;
|
|
16
|
+
created_at?: string;
|
|
17
|
+
updated_at?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface UpdateSpecInput {
|
|
20
|
+
title?: string;
|
|
21
|
+
file_path?: string;
|
|
22
|
+
content?: string;
|
|
23
|
+
priority?: number;
|
|
24
|
+
parent_id?: string;
|
|
25
|
+
archived?: boolean;
|
|
26
|
+
archived_at?: string;
|
|
27
|
+
updated_at?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ListSpecsOptions {
|
|
30
|
+
priority?: number;
|
|
31
|
+
parent_id?: string;
|
|
32
|
+
archived?: boolean;
|
|
33
|
+
limit?: number;
|
|
34
|
+
offset?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a new spec
|
|
38
|
+
*/
|
|
39
|
+
export declare function createSpec(db: Database.Database, input: CreateSpecInput): Spec;
|
|
40
|
+
/**
|
|
41
|
+
* Get a spec by ID
|
|
42
|
+
*/
|
|
43
|
+
export declare function getSpec(db: Database.Database, id: string): Spec | null;
|
|
44
|
+
/**
|
|
45
|
+
* Get a spec by file path
|
|
46
|
+
*/
|
|
47
|
+
export declare function getSpecByFilePath(db: Database.Database, filePath: string): Spec | null;
|
|
48
|
+
/**
|
|
49
|
+
* Update a spec
|
|
50
|
+
*/
|
|
51
|
+
export declare function updateSpec(db: Database.Database, id: string, input: UpdateSpecInput): Spec;
|
|
52
|
+
/**
|
|
53
|
+
* Delete a spec
|
|
54
|
+
*/
|
|
55
|
+
export declare function deleteSpec(db: Database.Database, id: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* List specs with optional filters
|
|
58
|
+
*/
|
|
59
|
+
export declare function listSpecs(db: Database.Database, options?: ListSpecsOptions): Spec[];
|
|
60
|
+
/**
|
|
61
|
+
* Search specs by title or content
|
|
62
|
+
*/
|
|
63
|
+
export declare function searchSpecs(db: Database.Database, query: string, options?: Omit<ListSpecsOptions, "offset">): Spec[];
|
|
64
|
+
//# sourceMappingURL=specs.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations for Tags
|
|
3
|
+
*/
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
import type { Tag, EntityType } from "../types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Add a tag to an entity
|
|
8
|
+
*/
|
|
9
|
+
export declare function addTag(db: Database.Database, entity_id: string, entity_type: EntityType, tag: string): Tag;
|
|
10
|
+
/**
|
|
11
|
+
* Add multiple tags to an entity
|
|
12
|
+
*/
|
|
13
|
+
export declare function addTags(db: Database.Database, entity_id: string, entity_type: EntityType, tags: string[]): Tag[];
|
|
14
|
+
/**
|
|
15
|
+
* Remove a tag from an entity
|
|
16
|
+
*/
|
|
17
|
+
export declare function removeTag(db: Database.Database, entity_id: string, entity_type: EntityType, tag: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Get all tags for an entity
|
|
20
|
+
*/
|
|
21
|
+
export declare function getTags(db: Database.Database, entity_id: string, entity_type: EntityType): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Get all entities with a specific tag
|
|
24
|
+
*/
|
|
25
|
+
export declare function getEntitiesByTag(db: Database.Database, tag: string, entity_type?: EntityType): Tag[];
|
|
26
|
+
/**
|
|
27
|
+
* Remove all tags from an entity
|
|
28
|
+
*/
|
|
29
|
+
export declare function removeAllTags(db: Database.Database, entity_id: string, entity_type: EntityType): number;
|
|
30
|
+
/**
|
|
31
|
+
* Check if an entity has a specific tag
|
|
32
|
+
*/
|
|
33
|
+
export declare function hasTag(db: Database.Database, entity_id: string, entity_type: EntityType, tag: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Get all unique tags in the system
|
|
36
|
+
*/
|
|
37
|
+
export declare function getAllTags(db: Database.Database, entity_type?: EntityType): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Replace all tags for an entity
|
|
40
|
+
*/
|
|
41
|
+
export declare function setTags(db: Database.Database, entity_id: string, entity_type: EntityType, tags: string[]): string[];
|
|
42
|
+
//# sourceMappingURL=tags.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction support with proper error handling
|
|
3
|
+
*/
|
|
4
|
+
import type Database from 'better-sqlite3';
|
|
5
|
+
export type TransactionCallback<T> = (db: Database.Database) => T;
|
|
6
|
+
/**
|
|
7
|
+
* Execute a function within a transaction
|
|
8
|
+
* Automatically commits on success, rolls back on error
|
|
9
|
+
*/
|
|
10
|
+
export declare function transaction<T>(db: Database.Database, callback: TransactionCallback<T>): T;
|
|
11
|
+
/**
|
|
12
|
+
* Execute multiple operations in a transaction
|
|
13
|
+
* This is a convenience wrapper that handles common patterns
|
|
14
|
+
*/
|
|
15
|
+
export declare function batchTransaction<T>(db: Database.Database, operations: Array<() => T>): T[];
|
|
16
|
+
/**
|
|
17
|
+
* Execute an operation with automatic retry on busy/locked errors
|
|
18
|
+
*/
|
|
19
|
+
export declare function withRetry<T>(db: Database.Database, operation: TransactionCallback<T>, maxRetries?: number, delayMs?: number): T;
|
|
20
|
+
/**
|
|
21
|
+
* Savepoint-based nested transaction support
|
|
22
|
+
*/
|
|
23
|
+
export declare class SavepointTransaction {
|
|
24
|
+
private db;
|
|
25
|
+
private savepointId;
|
|
26
|
+
private released;
|
|
27
|
+
constructor(db: Database.Database, name?: string);
|
|
28
|
+
/**
|
|
29
|
+
* Commit the savepoint
|
|
30
|
+
*/
|
|
31
|
+
commit(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Rollback the savepoint
|
|
34
|
+
*/
|
|
35
|
+
rollback(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Execute a callback with automatic commit/rollback
|
|
38
|
+
*/
|
|
39
|
+
static execute<T>(db: Database.Database, callback: (sp: SavepointTransaction) => T): T;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=transactions.d.ts.map
|
package/dist/sync.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bidirectional sync between Markdown files and JSONL/SQLite
|
|
3
|
+
*/
|
|
4
|
+
import type Database from "better-sqlite3";
|
|
5
|
+
export interface SyncResult {
|
|
6
|
+
success: boolean;
|
|
7
|
+
action: "created" | "updated" | "no-change";
|
|
8
|
+
entityId: string;
|
|
9
|
+
entityType: "spec" | "issue";
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SyncOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Directory for JSONL output (default: .sudocode)
|
|
15
|
+
*/
|
|
16
|
+
outputDir?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to auto-export to JSONL after sync (default: true)
|
|
19
|
+
*/
|
|
20
|
+
autoExport?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* User performing the sync
|
|
23
|
+
*/
|
|
24
|
+
user?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Auto-initialize missing frontmatter fields (default: true)
|
|
27
|
+
* If true, generates missing IDs and provides default values
|
|
28
|
+
* If false, rejects files with missing required fields
|
|
29
|
+
*/
|
|
30
|
+
autoInitialize?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to write back initialized frontmatter to the file (default: true)
|
|
33
|
+
* Only applies when autoInitialize is true
|
|
34
|
+
*/
|
|
35
|
+
writeBackFrontmatter?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Sync a markdown file to JSONL and SQLite
|
|
39
|
+
* Parses markdown, updates database, optionally exports to JSONL
|
|
40
|
+
*/
|
|
41
|
+
export declare function syncMarkdownToJSONL(db: Database.Database, mdPath: string, options?: SyncOptions): Promise<SyncResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Sync from JSONL/SQLite to markdown file
|
|
44
|
+
* Updates markdown frontmatter while preserving content
|
|
45
|
+
*/
|
|
46
|
+
export declare function syncJSONLToMarkdown(db: Database.Database, entityId: string, entityType: "spec" | "issue", mdPath: string): Promise<SyncResult>;
|
|
47
|
+
//# sourceMappingURL=sync.d.ts.map
|
package/dist/types.d.ts
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 type { Spec, Issue, Relationship, EntityType, RelationshipType, IssueStatus, Tag, Event, EventType, IssueFeedback, LocationAnchor, FeedbackAnchor, FeedbackType, SpecJSONL, IssueJSONL, FeedbackJSONL, RelationshipJSONL, Config, } from "@sudocode-ai/types";
|
|
7
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update checker with caching
|
|
3
|
+
* Checks npm registry for new versions and caches results
|
|
4
|
+
*/
|
|
5
|
+
interface UpdateInfo {
|
|
6
|
+
current: string;
|
|
7
|
+
latest: string;
|
|
8
|
+
updateAvailable: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Check for updates
|
|
12
|
+
* Returns null if check fails or update info if successful
|
|
13
|
+
*/
|
|
14
|
+
export declare function checkForUpdates(): Promise<UpdateInfo | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Check for updates and return formatted notification message
|
|
17
|
+
*/
|
|
18
|
+
export declare function getUpdateNotification(): Promise<string | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Clear update cache (useful for testing)
|
|
21
|
+
*/
|
|
22
|
+
export declare function clearUpdateCache(): void;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=update-checker.d.ts.map
|