mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-14 00:23:04 +08:00
feat: add work items CLI
This commit is contained in:
committed by
Affaan Mustafa
parent
8926ea925e
commit
b1e67788f7
@@ -450,6 +450,10 @@ function createQueryApi(db) {
|
||||
ORDER BY updated_at DESC, id DESC
|
||||
LIMIT ?
|
||||
`);
|
||||
const countWorkItemsStatement = db.prepare(`
|
||||
SELECT COUNT(*) AS total_count
|
||||
FROM work_items
|
||||
`);
|
||||
const listAllWorkItemsStatement = db.prepare(`
|
||||
SELECT *
|
||||
FROM work_items
|
||||
@@ -690,6 +694,11 @@ function createQueryApi(db) {
|
||||
return row ? mapSessionRow(row) : null;
|
||||
}
|
||||
|
||||
function getWorkItemById(id) {
|
||||
const row = getWorkItemStatement.get(id);
|
||||
return row ? mapWorkItemRow(row) : null;
|
||||
}
|
||||
|
||||
function listRecentSessions(options = {}) {
|
||||
const limit = normalizeLimit(options.limit, 10);
|
||||
return {
|
||||
@@ -716,6 +725,14 @@ function createQueryApi(db) {
|
||||
};
|
||||
}
|
||||
|
||||
function listWorkItems(options = {}) {
|
||||
const limit = normalizeLimit(options.limit, 20);
|
||||
return {
|
||||
totalCount: countWorkItemsStatement.get().total_count,
|
||||
items: listWorkItemsStatement.all(limit).map(mapWorkItemRow),
|
||||
};
|
||||
}
|
||||
|
||||
function getStatus(options = {}) {
|
||||
const activeLimit = normalizeLimit(options.activeLimit, 5);
|
||||
const recentSkillRunLimit = normalizeLimit(options.recentSkillRunLimit, 20);
|
||||
@@ -763,6 +780,7 @@ function createQueryApi(db) {
|
||||
return {
|
||||
getSessionById,
|
||||
getSessionDetail,
|
||||
getWorkItemById,
|
||||
getStatus,
|
||||
insertDecision(decision) {
|
||||
const normalized = normalizeDecisionInput(decision);
|
||||
@@ -812,6 +830,7 @@ function createQueryApi(db) {
|
||||
return normalized;
|
||||
},
|
||||
listRecentSessions,
|
||||
listWorkItems,
|
||||
upsertInstallState(installState) {
|
||||
const normalized = normalizeInstallStateInput(installState);
|
||||
assertValidEntity('installState', normalized);
|
||||
|
||||
Reference in New Issue
Block a user