@sudocode-ai/types 0.1.6 → 0.1.7
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/dist/migrations.d.ts +23 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +150 -0
- package/dist/migrations.js.map +1 -0
- package/dist/schema.d.ts +2 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +10 -12
- package/dist/schema.js.map +1 -1
- package/package.json +5 -1
- package/src/index.d.ts +8 -7
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,KAAK,IAAI,CAAC;IACpC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,KAAK,IAAI,CAAC;CACxC;AA8GD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAaxE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,SAAS,EAAE,SAAS,GACnB,IAAI,CAMN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAwBzD"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database migration utilities for sudocode
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* All migrations in order
|
|
6
|
+
*/
|
|
7
|
+
const MIGRATIONS = [
|
|
8
|
+
{
|
|
9
|
+
version: 1,
|
|
10
|
+
name: "generalize-feedback-table",
|
|
11
|
+
up: (db) => {
|
|
12
|
+
// Check if old columns exist
|
|
13
|
+
const tableInfo = db.pragma("table_info(issue_feedback)");
|
|
14
|
+
const hasOldColumns = tableInfo.some((col) => col.name === "issue_id");
|
|
15
|
+
if (!hasOldColumns) {
|
|
16
|
+
// Already migrated or new database
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// Create new table with updated schema
|
|
20
|
+
db.exec(`
|
|
21
|
+
CREATE TABLE IF NOT EXISTS issue_feedback_new (
|
|
22
|
+
id TEXT PRIMARY KEY,
|
|
23
|
+
from_id TEXT NOT NULL,
|
|
24
|
+
from_uuid TEXT NOT NULL,
|
|
25
|
+
to_id TEXT NOT NULL,
|
|
26
|
+
to_uuid TEXT NOT NULL,
|
|
27
|
+
feedback_type TEXT NOT NULL CHECK(feedback_type IN ('comment', 'suggestion', 'request')),
|
|
28
|
+
content TEXT NOT NULL,
|
|
29
|
+
agent TEXT,
|
|
30
|
+
anchor TEXT,
|
|
31
|
+
dismissed INTEGER NOT NULL DEFAULT 0 CHECK(dismissed IN (0, 1)),
|
|
32
|
+
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
33
|
+
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
34
|
+
FOREIGN KEY (from_id) REFERENCES issues(id) ON DELETE CASCADE,
|
|
35
|
+
FOREIGN KEY (from_uuid) REFERENCES issues(uuid) ON DELETE CASCADE
|
|
36
|
+
);
|
|
37
|
+
`);
|
|
38
|
+
// Copy data from old table to new table
|
|
39
|
+
db.exec(`
|
|
40
|
+
INSERT INTO issue_feedback_new (
|
|
41
|
+
id, from_id, from_uuid, to_id, to_uuid, feedback_type,
|
|
42
|
+
content, agent, anchor, dismissed, created_at, updated_at
|
|
43
|
+
)
|
|
44
|
+
SELECT
|
|
45
|
+
id, issue_id, issue_uuid, spec_id, spec_uuid, feedback_type,
|
|
46
|
+
content, agent, anchor, dismissed, created_at, updated_at
|
|
47
|
+
FROM issue_feedback;
|
|
48
|
+
`);
|
|
49
|
+
// Drop old table
|
|
50
|
+
db.exec(`DROP TABLE issue_feedback;`);
|
|
51
|
+
// Rename new table to original name
|
|
52
|
+
db.exec(`ALTER TABLE issue_feedback_new RENAME TO issue_feedback;`);
|
|
53
|
+
// Recreate indexes
|
|
54
|
+
db.exec(`
|
|
55
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_from_id ON issue_feedback(from_id);
|
|
56
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_from_uuid ON issue_feedback(from_uuid);
|
|
57
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_to_id ON issue_feedback(to_id);
|
|
58
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_to_uuid ON issue_feedback(to_uuid);
|
|
59
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_dismissed ON issue_feedback(dismissed);
|
|
60
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_type ON issue_feedback(feedback_type);
|
|
61
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_created_at ON issue_feedback(created_at);
|
|
62
|
+
`);
|
|
63
|
+
},
|
|
64
|
+
down: (db) => {
|
|
65
|
+
// Rollback: rename columns back
|
|
66
|
+
db.exec(`
|
|
67
|
+
CREATE TABLE IF NOT EXISTS issue_feedback_old (
|
|
68
|
+
id TEXT PRIMARY KEY,
|
|
69
|
+
issue_id TEXT NOT NULL,
|
|
70
|
+
issue_uuid TEXT NOT NULL,
|
|
71
|
+
spec_id TEXT NOT NULL,
|
|
72
|
+
spec_uuid TEXT NOT NULL,
|
|
73
|
+
feedback_type TEXT NOT NULL CHECK(feedback_type IN ('comment', 'suggestion', 'request')),
|
|
74
|
+
content TEXT NOT NULL,
|
|
75
|
+
agent TEXT,
|
|
76
|
+
anchor TEXT,
|
|
77
|
+
dismissed INTEGER NOT NULL DEFAULT 0 CHECK(dismissed IN (0, 1)),
|
|
78
|
+
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
79
|
+
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
80
|
+
FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE,
|
|
81
|
+
FOREIGN KEY (issue_uuid) REFERENCES issues(uuid) ON DELETE CASCADE,
|
|
82
|
+
FOREIGN KEY (spec_id) REFERENCES specs(id) ON DELETE CASCADE,
|
|
83
|
+
FOREIGN KEY (spec_uuid) REFERENCES specs(uuid) ON DELETE CASCADE
|
|
84
|
+
);
|
|
85
|
+
`);
|
|
86
|
+
db.exec(`
|
|
87
|
+
INSERT INTO issue_feedback_old (
|
|
88
|
+
id, issue_id, issue_uuid, spec_id, spec_uuid, feedback_type,
|
|
89
|
+
content, agent, anchor, dismissed, created_at, updated_at
|
|
90
|
+
)
|
|
91
|
+
SELECT
|
|
92
|
+
id, from_id, from_uuid, to_id, to_uuid, feedback_type,
|
|
93
|
+
content, agent, anchor, dismissed, created_at, updated_at
|
|
94
|
+
FROM issue_feedback;
|
|
95
|
+
`);
|
|
96
|
+
db.exec(`DROP TABLE issue_feedback;`);
|
|
97
|
+
db.exec(`ALTER TABLE issue_feedback_old RENAME TO issue_feedback;`);
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
/**
|
|
102
|
+
* Get the current migration version from the database
|
|
103
|
+
*/
|
|
104
|
+
export function getCurrentMigrationVersion(db) {
|
|
105
|
+
// Create migrations table if it doesn't exist
|
|
106
|
+
db.exec(`
|
|
107
|
+
CREATE TABLE IF NOT EXISTS migrations (
|
|
108
|
+
version INTEGER PRIMARY KEY,
|
|
109
|
+
name TEXT NOT NULL,
|
|
110
|
+
applied_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
111
|
+
)
|
|
112
|
+
`);
|
|
113
|
+
const stmt = db.prepare("SELECT MAX(version) as version FROM migrations");
|
|
114
|
+
const result = stmt.get();
|
|
115
|
+
return result.version ?? 0;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Record a migration as applied
|
|
119
|
+
*/
|
|
120
|
+
export function recordMigration(db, migration) {
|
|
121
|
+
const stmt = db.prepare(`
|
|
122
|
+
INSERT OR REPLACE INTO migrations (version, name)
|
|
123
|
+
VALUES (?, ?)
|
|
124
|
+
`);
|
|
125
|
+
stmt.run(migration.version, migration.name);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Run all pending migrations
|
|
129
|
+
*/
|
|
130
|
+
export function runMigrations(db) {
|
|
131
|
+
const currentVersion = getCurrentMigrationVersion(db);
|
|
132
|
+
const pendingMigrations = MIGRATIONS.filter((m) => m.version > currentVersion);
|
|
133
|
+
if (pendingMigrations.length === 0) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
console.log(`Running ${pendingMigrations.length} pending migration(s)...`);
|
|
137
|
+
for (const migration of pendingMigrations) {
|
|
138
|
+
console.log(` Applying migration ${migration.version}: ${migration.name}`);
|
|
139
|
+
try {
|
|
140
|
+
migration.up(db);
|
|
141
|
+
recordMigration(db, migration);
|
|
142
|
+
console.log(` ✓ Migration ${migration.version} applied successfully`);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
console.error(` ✗ Migration ${migration.version} failed:`, error);
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=migrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH;;GAEG;AACH,MAAM,UAAU,GAAgB;IAC9B;QACE,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,2BAA2B;QACjC,EAAE,EAAE,CAAC,EAAqB,EAAE,EAAE;YAC5B,6BAA6B;YAC7B,MAAM,SAAS,GAAG,EAAE,CAAC,MAAM,CAAC,4BAA4B,CAEtD,CAAC;YACH,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;YAEvE,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,mCAAmC;gBACnC,OAAO;YACT,CAAC;YAED,uCAAuC;YACvC,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;OAiBP,CAAC,CAAC;YAEH,wCAAwC;YACxC,EAAE,CAAC,IAAI,CAAC;;;;;;;;;OASP,CAAC,CAAC;YAEH,iBAAiB;YACjB,EAAE,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;YAEtC,oCAAoC;YACpC,EAAE,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;YAEpE,mBAAmB;YACnB,EAAE,CAAC,IAAI,CAAC;;;;;;;;OAQP,CAAC,CAAC;QACL,CAAC;QACD,IAAI,EAAE,CAAC,EAAqB,EAAE,EAAE;YAC9B,gCAAgC;YAChC,EAAE,CAAC,IAAI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,CAAC,wBAAwB,SAAS,CAAC,OAAO,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5E,IAAI,CAAC;YACH,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACjB,eAAe,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,iBAAiB,SAAS,CAAC,OAAO,uBAAuB,CAAC,CAAC;QACzE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,iBAAiB,SAAS,CAAC,OAAO,UAAU,EAAE,KAAK,CAAC,CAAC;YACnE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const ISSUES_TABLE = "\nCREATE TABLE IF NOT EXISTS issues (\n
|
|
|
15
15
|
export declare const RELATIONSHIPS_TABLE = "\nCREATE TABLE IF NOT EXISTS relationships (\n from_id TEXT NOT NULL,\n from_uuid TEXT NOT NULL,\n from_type TEXT NOT NULL,\n to_id TEXT NOT NULL,\n to_uuid TEXT NOT NULL,\n to_type TEXT NOT NULL,\n relationship_type TEXT NOT NULL,\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n metadata TEXT,\n PRIMARY KEY (from_id, from_type, to_id, to_type, relationship_type)\n);\n";
|
|
16
16
|
export declare const TAGS_TABLE = "\nCREATE TABLE IF NOT EXISTS tags (\n entity_id TEXT NOT NULL,\n entity_uuid TEXT NOT NULL,\n entity_type TEXT NOT NULL,\n tag TEXT NOT NULL,\n PRIMARY KEY (entity_id, entity_type, tag)\n);\n";
|
|
17
17
|
export declare const EVENTS_TABLE = "\nCREATE TABLE IF NOT EXISTS events (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n entity_id TEXT NOT NULL,\n entity_uuid TEXT NOT NULL,\n entity_type TEXT NOT NULL,\n event_type TEXT NOT NULL,\n actor TEXT NOT NULL,\n old_value TEXT,\n new_value TEXT,\n comment TEXT,\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n git_commit_sha TEXT,\n source TEXT\n);\n";
|
|
18
|
-
export declare const ISSUE_FEEDBACK_TABLE = "\nCREATE TABLE IF NOT EXISTS issue_feedback (\n id TEXT PRIMARY KEY,\n
|
|
18
|
+
export declare const ISSUE_FEEDBACK_TABLE = "\nCREATE TABLE IF NOT EXISTS issue_feedback (\n id TEXT PRIMARY KEY,\n from_id TEXT NOT NULL,\n from_uuid TEXT NOT NULL,\n to_id TEXT NOT NULL,\n to_uuid TEXT NOT NULL,\n feedback_type TEXT NOT NULL CHECK(feedback_type IN ('comment', 'suggestion', 'request')),\n content TEXT NOT NULL,\n agent TEXT,\n anchor TEXT,\n dismissed INTEGER NOT NULL DEFAULT 0 CHECK(dismissed IN (0, 1)),\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (from_id) REFERENCES issues(id) ON DELETE CASCADE,\n FOREIGN KEY (from_uuid) REFERENCES issues(uuid) ON DELETE CASCADE\n);\n";
|
|
19
19
|
export declare const EXECUTIONS_TABLE = "\nCREATE TABLE IF NOT EXISTS executions (\n id TEXT PRIMARY KEY,\n issue_id TEXT,\n issue_uuid TEXT,\n\n -- Execution mode and configuration\n mode TEXT CHECK(mode IN ('worktree', 'local')),\n prompt TEXT,\n config TEXT,\n\n -- Process information (legacy + new)\n agent_type TEXT CHECK(agent_type IN ('claude-code', 'codex')),\n session_id TEXT,\n workflow_execution_id TEXT,\n\n -- Git/branch information\n target_branch TEXT NOT NULL,\n branch_name TEXT NOT NULL,\n before_commit TEXT,\n after_commit TEXT,\n worktree_path TEXT,\n\n -- Status (unified - supports both old and new statuses)\n status TEXT NOT NULL CHECK(status IN (\n 'preparing', 'pending', 'running', 'paused',\n 'completed', 'failed', 'cancelled', 'stopped'\n )),\n\n -- Timing (consistent with other tables)\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n started_at DATETIME,\n completed_at DATETIME,\n cancelled_at DATETIME,\n\n -- Results and metadata\n exit_code INTEGER,\n error_message TEXT,\n error TEXT,\n model TEXT,\n summary TEXT,\n files_changed TEXT,\n\n -- Relationships\n parent_execution_id TEXT,\n\n -- Multi-step workflow support (future extension)\n step_type TEXT,\n step_index INTEGER,\n step_config TEXT,\n\n FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE SET NULL,\n FOREIGN KEY (issue_uuid) REFERENCES issues(uuid) ON DELETE SET NULL,\n FOREIGN KEY (parent_execution_id) REFERENCES executions(id) ON DELETE SET NULL\n);\n";
|
|
20
20
|
export declare const PROMPT_TEMPLATES_TABLE = "\nCREATE TABLE IF NOT EXISTS prompt_templates (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n description TEXT,\n type TEXT NOT NULL CHECK(type IN ('issue', 'spec', 'custom')),\n template TEXT NOT NULL,\n variables TEXT NOT NULL,\n is_default INTEGER NOT NULL DEFAULT 0 CHECK(is_default IN (0, 1)),\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP\n);\n";
|
|
21
21
|
export declare const EXECUTION_LOGS_TABLE = "\nCREATE TABLE IF NOT EXISTS execution_logs (\n execution_id TEXT PRIMARY KEY,\n raw_logs TEXT NOT NULL DEFAULT '',\n byte_size INTEGER NOT NULL DEFAULT 0,\n line_count INTEGER NOT NULL DEFAULT 0,\n created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (execution_id) REFERENCES executions(id) ON DELETE CASCADE\n);\n";
|
|
@@ -27,7 +27,7 @@ export declare const ISSUES_INDEXES = "\nCREATE INDEX IF NOT EXISTS idx_issues_u
|
|
|
27
27
|
export declare const RELATIONSHIPS_INDEXES = "\nCREATE INDEX IF NOT EXISTS idx_rel_from_id ON relationships(from_id, from_type);\nCREATE INDEX IF NOT EXISTS idx_rel_from_uuid ON relationships(from_uuid, from_type);\nCREATE INDEX IF NOT EXISTS idx_rel_to_id ON relationships(to_id, to_type);\nCREATE INDEX IF NOT EXISTS idx_rel_to_uuid ON relationships(to_uuid, to_type);\nCREATE INDEX IF NOT EXISTS idx_rel_type ON relationships(relationship_type);\nCREATE INDEX IF NOT EXISTS idx_rel_created_at ON relationships(created_at);\n";
|
|
28
28
|
export declare const TAGS_INDEXES = "\nCREATE INDEX IF NOT EXISTS idx_tags_entity_id ON tags(entity_id, entity_type);\nCREATE INDEX IF NOT EXISTS idx_tags_entity_uuid ON tags(entity_uuid, entity_type);\nCREATE INDEX IF NOT EXISTS idx_tags_tag ON tags(tag);\n";
|
|
29
29
|
export declare const EVENTS_INDEXES = "\nCREATE INDEX IF NOT EXISTS idx_events_entity_id ON events(entity_id, entity_type);\nCREATE INDEX IF NOT EXISTS idx_events_entity_uuid ON events(entity_uuid, entity_type);\nCREATE INDEX IF NOT EXISTS idx_events_type ON events(event_type);\nCREATE INDEX IF NOT EXISTS idx_events_actor ON events(actor);\nCREATE INDEX IF NOT EXISTS idx_events_created_at ON events(created_at);\nCREATE INDEX IF NOT EXISTS idx_events_git_commit ON events(git_commit_sha);\n";
|
|
30
|
-
export declare const ISSUE_FEEDBACK_INDEXES = "\nCREATE INDEX IF NOT EXISTS
|
|
30
|
+
export declare const ISSUE_FEEDBACK_INDEXES = "\nCREATE INDEX IF NOT EXISTS idx_feedback_from_id ON issue_feedback(from_id);\nCREATE INDEX IF NOT EXISTS idx_feedback_from_uuid ON issue_feedback(from_uuid);\nCREATE INDEX IF NOT EXISTS idx_feedback_to_id ON issue_feedback(to_id);\nCREATE INDEX IF NOT EXISTS idx_feedback_to_uuid ON issue_feedback(to_uuid);\nCREATE INDEX IF NOT EXISTS idx_feedback_dismissed ON issue_feedback(dismissed);\nCREATE INDEX IF NOT EXISTS idx_feedback_type ON issue_feedback(feedback_type);\nCREATE INDEX IF NOT EXISTS idx_feedback_created_at ON issue_feedback(created_at);\n";
|
|
31
31
|
export declare const EXECUTIONS_INDEXES = "\nCREATE INDEX IF NOT EXISTS idx_executions_issue_id ON executions(issue_id);\nCREATE INDEX IF NOT EXISTS idx_executions_issue_uuid ON executions(issue_uuid);\nCREATE INDEX IF NOT EXISTS idx_executions_status ON executions(status);\nCREATE INDEX IF NOT EXISTS idx_executions_session_id ON executions(session_id);\nCREATE INDEX IF NOT EXISTS idx_executions_parent ON executions(parent_execution_id);\nCREATE INDEX IF NOT EXISTS idx_executions_created_at ON executions(created_at);\nCREATE INDEX IF NOT EXISTS idx_executions_workflow ON executions(workflow_execution_id);\nCREATE INDEX IF NOT EXISTS idx_executions_workflow_step ON executions(workflow_execution_id, step_index);\nCREATE INDEX IF NOT EXISTS idx_executions_step_type ON executions(step_type);\n";
|
|
32
32
|
export declare const PROMPT_TEMPLATES_INDEXES = "\nCREATE INDEX IF NOT EXISTS idx_templates_type ON prompt_templates(type);\nCREATE INDEX IF NOT EXISTS idx_templates_default ON prompt_templates(is_default);\n";
|
|
33
33
|
export declare const EXECUTION_LOGS_INDEXES = "\nCREATE INDEX IF NOT EXISTS idx_execution_logs_updated_at ON execution_logs(updated_at);\nCREATE INDEX IF NOT EXISTS idx_execution_logs_byte_size ON execution_logs(byte_size);\nCREATE INDEX IF NOT EXISTS idx_execution_logs_line_count ON execution_logs(line_count);\n";
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,SAAS,uSAarB,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,WAAW,ysBAiB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;GAEG;AACH,eAAO,MAAM,UAAU,UAUtB,CAAC;AAEF,eAAO,MAAM,WAAW,UAUvB,CAAC;AAEF,eAAO,MAAM,SAAS,UAA2C,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -103,10 +103,10 @@ CREATE TABLE IF NOT EXISTS events (
|
|
|
103
103
|
export const ISSUE_FEEDBACK_TABLE = `
|
|
104
104
|
CREATE TABLE IF NOT EXISTS issue_feedback (
|
|
105
105
|
id TEXT PRIMARY KEY,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
from_id TEXT NOT NULL,
|
|
107
|
+
from_uuid TEXT NOT NULL,
|
|
108
|
+
to_id TEXT NOT NULL,
|
|
109
|
+
to_uuid TEXT NOT NULL,
|
|
110
110
|
feedback_type TEXT NOT NULL CHECK(feedback_type IN ('comment', 'suggestion', 'request')),
|
|
111
111
|
content TEXT NOT NULL,
|
|
112
112
|
agent TEXT,
|
|
@@ -114,10 +114,8 @@ CREATE TABLE IF NOT EXISTS issue_feedback (
|
|
|
114
114
|
dismissed INTEGER NOT NULL DEFAULT 0 CHECK(dismissed IN (0, 1)),
|
|
115
115
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
116
116
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
117
|
-
FOREIGN KEY (
|
|
118
|
-
FOREIGN KEY (
|
|
119
|
-
FOREIGN KEY (spec_id) REFERENCES specs(id) ON DELETE CASCADE,
|
|
120
|
-
FOREIGN KEY (spec_uuid) REFERENCES specs(uuid) ON DELETE CASCADE
|
|
117
|
+
FOREIGN KEY (from_id) REFERENCES issues(id) ON DELETE CASCADE,
|
|
118
|
+
FOREIGN KEY (from_uuid) REFERENCES issues(uuid) ON DELETE CASCADE
|
|
121
119
|
);
|
|
122
120
|
`;
|
|
123
121
|
export const EXECUTIONS_TABLE = `
|
|
@@ -250,10 +248,10 @@ CREATE INDEX IF NOT EXISTS idx_events_created_at ON events(created_at);
|
|
|
250
248
|
CREATE INDEX IF NOT EXISTS idx_events_git_commit ON events(git_commit_sha);
|
|
251
249
|
`;
|
|
252
250
|
export const ISSUE_FEEDBACK_INDEXES = `
|
|
253
|
-
CREATE INDEX IF NOT EXISTS
|
|
254
|
-
CREATE INDEX IF NOT EXISTS
|
|
255
|
-
CREATE INDEX IF NOT EXISTS
|
|
256
|
-
CREATE INDEX IF NOT EXISTS
|
|
251
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_from_id ON issue_feedback(from_id);
|
|
252
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_from_uuid ON issue_feedback(from_uuid);
|
|
253
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_to_id ON issue_feedback(to_id);
|
|
254
|
+
CREATE INDEX IF NOT EXISTS idx_feedback_to_uuid ON issue_feedback(to_uuid);
|
|
257
255
|
CREATE INDEX IF NOT EXISTS idx_feedback_dismissed ON issue_feedback(dismissed);
|
|
258
256
|
CREATE INDEX IF NOT EXISTS idx_feedback_type ON issue_feedback(feedback_type);
|
|
259
257
|
CREATE INDEX IF NOT EXISTS idx_feedback_created_at ON issue_feedback(created_at);
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;CAaxB,CAAC;AAEF;;GAEG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;CAiB1B,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;CAmB3B,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;CAalC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GA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pC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;CAI3B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;CAO7B,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;CAQrC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;CAUjC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;CAGvC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;CAIrC,CAAC;AAEF;;GAEG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;CAkBhC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;CAmBlC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,WAAW;IACX,YAAY;IACZ,mBAAmB;IACnB,UAAU;IACV,YAAY;IACZ,oBAAoB;IACpB,gBAAgB;IAChB,sBAAsB;IACtB,oBAAoB;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,aAAa;IACb,cAAc;IACd,qBAAqB;IACrB,YAAY;IACZ,cAAc;IACd,sBAAsB;IACtB,kBAAkB;IAClB,wBAAwB;IACxB,sBAAsB;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudocode-ai/types",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "TypeScript type definitions for sudocode",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"./schema": {
|
|
13
13
|
"types": "./dist/schema.d.ts",
|
|
14
14
|
"default": "./dist/schema.js"
|
|
15
|
+
},
|
|
16
|
+
"./migrations": {
|
|
17
|
+
"types": "./dist/migrations.d.ts",
|
|
18
|
+
"default": "./dist/migrations.js"
|
|
15
19
|
}
|
|
16
20
|
},
|
|
17
21
|
"scripts": {
|
package/src/index.d.ts
CHANGED
|
@@ -94,14 +94,15 @@ export type EventType =
|
|
|
94
94
|
| "tag_removed";
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
* Issue-based
|
|
97
|
+
* Issue-based feedback types
|
|
98
|
+
* Feedback can target either a spec or another issue (type inferred from ID prefix)
|
|
98
99
|
*/
|
|
99
100
|
export interface IssueFeedback {
|
|
100
101
|
id: string;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
from_id: string;
|
|
103
|
+
from_uuid: string;
|
|
104
|
+
to_id: string;
|
|
105
|
+
to_uuid: string;
|
|
105
106
|
feedback_type: FeedbackType;
|
|
106
107
|
content: string;
|
|
107
108
|
agent?: string;
|
|
@@ -155,8 +156,8 @@ export interface IssueJSONL extends Issue {
|
|
|
155
156
|
|
|
156
157
|
export interface FeedbackJSONL {
|
|
157
158
|
id: string;
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
from_id: string;
|
|
160
|
+
to_id: string;
|
|
160
161
|
feedback_type: FeedbackType;
|
|
161
162
|
content: string;
|
|
162
163
|
agent?: string;
|