@sudosandwich/limps 0.2.1 → 1.0.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 +250 -15
- package/dist/cli/config-cmd.d.ts +68 -0
- package/dist/cli/config-cmd.d.ts.map +1 -0
- package/dist/cli/config-cmd.js +206 -0
- package/dist/cli/config-cmd.js.map +1 -0
- package/dist/cli/index.d.ts +11 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init-project.d.ts +12 -0
- package/dist/cli/init-project.d.ts.map +1 -0
- package/dist/cli/init-project.js +104 -0
- package/dist/cli/init-project.js.map +1 -0
- package/dist/cli/list-agents.d.ts +66 -0
- package/dist/cli/list-agents.d.ts.map +1 -0
- package/dist/cli/list-agents.js +147 -0
- package/dist/cli/list-agents.js.map +1 -0
- package/dist/cli/list-plans.d.ts +63 -0
- package/dist/cli/list-plans.d.ts.map +1 -0
- package/dist/cli/list-plans.js +218 -0
- package/dist/cli/list-plans.js.map +1 -0
- package/dist/cli/next-task.d.ts +83 -0
- package/dist/cli/next-task.d.ts.map +1 -0
- package/dist/cli/next-task.js +201 -0
- package/dist/cli/next-task.js.map +1 -0
- package/dist/cli/registry.d.ts +94 -0
- package/dist/cli/registry.d.ts.map +1 -0
- package/dist/cli/registry.js +150 -0
- package/dist/cli/registry.js.map +1 -0
- package/dist/cli/status.d.ts +35 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +110 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +10 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/config/add.d.ts +9 -0
- package/dist/commands/config/add.d.ts.map +1 -0
- package/dist/commands/config/add.js +20 -0
- package/dist/commands/config/add.js.map +1 -0
- package/dist/commands/config/discover.d.ts +3 -0
- package/dist/commands/config/discover.d.ts.map +1 -0
- package/dist/commands/config/discover.js +9 -0
- package/dist/commands/config/discover.js.map +1 -0
- package/dist/commands/config/index.d.ts +3 -0
- package/dist/commands/config/index.d.ts.map +1 -0
- package/dist/commands/config/index.js +7 -0
- package/dist/commands/config/index.js.map +1 -0
- package/dist/commands/config/list.d.ts +3 -0
- package/dist/commands/config/list.d.ts.map +1 -0
- package/dist/commands/config/list.js +9 -0
- package/dist/commands/config/list.js.map +1 -0
- package/dist/commands/config/path.d.ts +3 -0
- package/dist/commands/config/path.d.ts.map +1 -0
- package/dist/commands/config/path.js +10 -0
- package/dist/commands/config/path.js.map +1 -0
- package/dist/commands/config/remove.d.ts +9 -0
- package/dist/commands/config/remove.d.ts.map +1 -0
- package/dist/commands/config/remove.js +17 -0
- package/dist/commands/config/remove.js.map +1 -0
- package/dist/commands/config/set.d.ts +9 -0
- package/dist/commands/config/set.d.ts.map +1 -0
- package/dist/commands/config/set.js +17 -0
- package/dist/commands/config/set.js.map +1 -0
- package/dist/commands/config/show.d.ts +3 -0
- package/dist/commands/config/show.d.ts.map +1 -0
- package/dist/commands/config/show.js +15 -0
- package/dist/commands/config/show.js.map +1 -0
- package/dist/commands/config/use.d.ts +9 -0
- package/dist/commands/config/use.d.ts.map +1 -0
- package/dist/commands/config/use.js +17 -0
- package/dist/commands/config/use.js.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +7 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +13 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +20 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list-agents.d.ts +13 -0
- package/dist/commands/list-agents.d.ts.map +1 -0
- package/dist/commands/list-agents.js +31 -0
- package/dist/commands/list-agents.js.map +1 -0
- package/dist/commands/list-plans.d.ts +11 -0
- package/dist/commands/list-plans.d.ts.map +1 -0
- package/dist/commands/list-plans.js +21 -0
- package/dist/commands/list-plans.js.map +1 -0
- package/dist/commands/next-task.d.ts +13 -0
- package/dist/commands/next-task.d.ts.map +1 -0
- package/dist/commands/next-task.js +46 -0
- package/dist/commands/next-task.js.map +1 -0
- package/dist/commands/serve.d.ts +11 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +31 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/status.d.ts +13 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +28 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/components/AgentsList.d.ts +19 -0
- package/dist/components/AgentsList.d.ts.map +1 -0
- package/dist/components/AgentsList.js +29 -0
- package/dist/components/AgentsList.js.map +1 -0
- package/dist/components/Error.d.ts +6 -0
- package/dist/components/Error.d.ts.map +1 -0
- package/dist/components/Error.js +6 -0
- package/dist/components/Error.js.map +1 -0
- package/dist/components/NextTask.d.ts +12 -0
- package/dist/components/NextTask.d.ts.map +1 -0
- package/dist/components/NextTask.js +11 -0
- package/dist/components/NextTask.js.map +1 -0
- package/dist/components/PlanStatus.d.ts +11 -0
- package/dist/components/PlanStatus.d.ts.map +1 -0
- package/dist/components/PlanStatus.js +18 -0
- package/dist/components/PlanStatus.js.map +1 -0
- package/dist/components/PlansList.d.ts +12 -0
- package/dist/components/PlansList.d.ts.map +1 -0
- package/dist/components/PlansList.js +23 -0
- package/dist/components/PlansList.js.map +1 -0
- package/dist/components/Success.d.ts +6 -0
- package/dist/components/Success.d.ts.map +1 -0
- package/dist/components/Success.js +6 -0
- package/dist/components/Success.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -246
- package/dist/index.js.map +1 -1
- package/dist/server-main.d.ts +11 -0
- package/dist/server-main.d.ts.map +1 -0
- package/dist/server-main.js +81 -0
- package/dist/server-main.js.map +1 -0
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/theme/colors.d.ts +64 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +85 -0
- package/dist/theme/colors.js.map +1 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +6 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/tools/claim-task.d.ts +7 -10
- package/dist/tools/claim-task.d.ts.map +1 -1
- package/dist/tools/create-doc.d.ts +7 -10
- package/dist/tools/create-doc.d.ts.map +1 -1
- package/dist/tools/create-plan.d.ts +1 -7
- package/dist/tools/create-plan.d.ts.map +1 -1
- package/dist/tools/delete-doc.d.ts +1 -9
- package/dist/tools/delete-doc.d.ts.map +1 -1
- package/dist/tools/get-next-task.d.ts +19 -9
- package/dist/tools/get-next-task.d.ts.map +1 -1
- package/dist/tools/get-next-task.js +64 -1
- package/dist/tools/get-next-task.js.map +1 -1
- package/dist/tools/get-plan-status.d.ts +24 -0
- package/dist/tools/get-plan-status.d.ts.map +1 -0
- package/dist/tools/get-plan-status.js +48 -0
- package/dist/tools/get-plan-status.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +66 -18
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/list-agents.d.ts +24 -0
- package/dist/tools/list-agents.d.ts.map +1 -0
- package/dist/tools/list-agents.js +60 -0
- package/dist/tools/list-agents.js.map +1 -0
- package/dist/tools/list-docs.d.ts +1 -11
- package/dist/tools/list-docs.d.ts.map +1 -1
- package/dist/tools/list-plans.d.ts +23 -0
- package/dist/tools/list-plans.d.ts.map +1 -0
- package/dist/tools/list-plans.js +44 -0
- package/dist/tools/list-plans.js.map +1 -0
- package/dist/tools/open-document-in-cursor.d.ts +1 -9
- package/dist/tools/open-document-in-cursor.d.ts.map +1 -1
- package/dist/tools/process-doc.d.ts +43 -0
- package/dist/tools/process-doc.d.ts.map +1 -0
- package/dist/tools/process-doc.js +227 -0
- package/dist/tools/process-doc.js.map +1 -0
- package/dist/tools/process-docs.d.ts +54 -0
- package/dist/tools/process-docs.d.ts.map +1 -0
- package/dist/tools/process-docs.js +348 -0
- package/dist/tools/process-docs.js.map +1 -0
- package/dist/tools/read-doc.d.ts +1 -7
- package/dist/tools/read-doc.d.ts.map +1 -1
- package/dist/tools/release-task.d.ts +5 -10
- package/dist/tools/release-task.d.ts.map +1 -1
- package/dist/tools/rlm-multi-query.d.ts +5 -61
- package/dist/tools/rlm-multi-query.d.ts.map +1 -1
- package/dist/tools/rlm-query.d.ts +1 -13
- package/dist/tools/rlm-query.d.ts.map +1 -1
- package/dist/tools/search-docs.d.ts +1 -7
- package/dist/tools/search-docs.d.ts.map +1 -1
- package/dist/tools/update-doc.d.ts +6 -90
- package/dist/tools/update-doc.d.ts.map +1 -1
- package/dist/tools/update-task-status.d.ts +7 -12
- package/dist/tools/update-task-status.d.ts.map +1 -1
- package/dist/utils/config-resolver.d.ts +19 -0
- package/dist/utils/config-resolver.d.ts.map +1 -0
- package/dist/utils/config-resolver.js +65 -0
- package/dist/utils/config-resolver.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/markdown.d.ts +15 -0
- package/dist/utils/markdown.d.ts.map +1 -0
- package/dist/utils/markdown.js +20 -0
- package/dist/utils/markdown.js.map +1 -0
- package/dist/utils/os-paths.d.ts +4 -4
- package/dist/utils/os-paths.js +5 -5
- package/dist/utils/os-paths.js.map +1 -1
- package/package.json +22 -11
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command: next-task
|
|
3
|
+
* Get the next best task with scoring breakdown.
|
|
4
|
+
*/
|
|
5
|
+
import type { ServerConfig } from '../config.js';
|
|
6
|
+
import { type CoordinationState } from '../coordination.js';
|
|
7
|
+
import { type ParsedAgentFile } from '../agent-parser.js';
|
|
8
|
+
/**
|
|
9
|
+
* Score breakdown for a task.
|
|
10
|
+
*/
|
|
11
|
+
export interface TaskScoreBreakdown {
|
|
12
|
+
taskId: string;
|
|
13
|
+
agentNumber: string;
|
|
14
|
+
title: string;
|
|
15
|
+
totalScore: number;
|
|
16
|
+
dependencyScore: number;
|
|
17
|
+
priorityScore: number;
|
|
18
|
+
workloadScore: number;
|
|
19
|
+
reasons: string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Calculate dependency score (40% weight).
|
|
23
|
+
* Higher score when all dependencies are satisfied.
|
|
24
|
+
*/
|
|
25
|
+
declare function calculateDependencyScore(agent: ParsedAgentFile, coordination: CoordinationState): {
|
|
26
|
+
score: number;
|
|
27
|
+
reasons: string[];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Calculate priority score (30% weight).
|
|
31
|
+
* Lower agent numbers get higher priority.
|
|
32
|
+
*/
|
|
33
|
+
declare function calculatePriorityScore(agent: ParsedAgentFile): {
|
|
34
|
+
score: number;
|
|
35
|
+
reasons: string[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Calculate workload score (30% weight).
|
|
39
|
+
* Based on file count - fewer files = easier task = higher score.
|
|
40
|
+
*/
|
|
41
|
+
declare function calculateWorkloadScore(agent: ParsedAgentFile): {
|
|
42
|
+
score: number;
|
|
43
|
+
reasons: string[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Check if task is eligible (GAP status, no file conflicts).
|
|
47
|
+
*/
|
|
48
|
+
declare function isTaskEligible(agent: ParsedAgentFile, coordination: CoordinationState): {
|
|
49
|
+
eligible: boolean;
|
|
50
|
+
reason?: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Score a task and return breakdown.
|
|
54
|
+
*/
|
|
55
|
+
declare function scoreTask(agent: ParsedAgentFile, coordination: CoordinationState): TaskScoreBreakdown | null;
|
|
56
|
+
/**
|
|
57
|
+
* Result of getting next task.
|
|
58
|
+
*/
|
|
59
|
+
export interface NextTaskResult {
|
|
60
|
+
task: TaskScoreBreakdown;
|
|
61
|
+
otherAvailableTasks: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the next best task data from a plan.
|
|
65
|
+
* Returns structured data for rendering.
|
|
66
|
+
*
|
|
67
|
+
* @param config - Server configuration
|
|
68
|
+
* @param planId - Plan number or name
|
|
69
|
+
* @returns Structured task data or error message
|
|
70
|
+
*/
|
|
71
|
+
export declare function getNextTaskData(config: ServerConfig, planId: string): Promise<NextTaskResult | {
|
|
72
|
+
error: string;
|
|
73
|
+
}>;
|
|
74
|
+
/**
|
|
75
|
+
* Get the next best task from a plan.
|
|
76
|
+
*
|
|
77
|
+
* @param config - Server configuration
|
|
78
|
+
* @param planId - Plan number or name
|
|
79
|
+
* @returns Formatted string output for CLI
|
|
80
|
+
*/
|
|
81
|
+
export declare function nextTask(config: ServerConfig, planId: string): Promise<string>;
|
|
82
|
+
export { calculateDependencyScore, calculatePriorityScore, calculateWorkloadScore, isTaskEligible, scoreTask, };
|
|
83
|
+
//# sourceMappingURL=next-task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-task.d.ts","sourceRoot":"","sources":["../../src/cli/next-task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,KAAK,eAAe,EAAqB,MAAM,oBAAoB,CAAC;AAG7E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;GAGG;AACH,iB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 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command: next-task
|
|
3
|
+
* Get the next best task with scoring breakdown.
|
|
4
|
+
*/
|
|
5
|
+
import { readCoordination } from '../coordination.js';
|
|
6
|
+
import { resolveDependency } from '../agent-parser.js';
|
|
7
|
+
import { findPlanDirectory, getAgentFiles } from './list-agents.js';
|
|
8
|
+
/**
|
|
9
|
+
* Calculate dependency score (40% weight).
|
|
10
|
+
* Higher score when all dependencies are satisfied.
|
|
11
|
+
*/
|
|
12
|
+
function calculateDependencyScore(agent, coordination) {
|
|
13
|
+
const reasons = [];
|
|
14
|
+
const deps = agent.frontmatter.dependencies;
|
|
15
|
+
if (deps.length === 0) {
|
|
16
|
+
reasons.push('No dependencies (unblocked)');
|
|
17
|
+
return { score: 40, reasons };
|
|
18
|
+
}
|
|
19
|
+
let satisfiedCount = 0;
|
|
20
|
+
for (const dep of deps) {
|
|
21
|
+
const taskId = resolveDependency(dep, agent.planFolder);
|
|
22
|
+
if (taskId) {
|
|
23
|
+
const depTask = coordination.tasks[taskId];
|
|
24
|
+
if (depTask && depTask.status === 'PASS') {
|
|
25
|
+
satisfiedCount++;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (satisfiedCount === deps.length) {
|
|
30
|
+
reasons.push(`All ${deps.length} dependencies satisfied`);
|
|
31
|
+
return { score: 40, reasons };
|
|
32
|
+
}
|
|
33
|
+
const unsatisfied = deps.length - satisfiedCount;
|
|
34
|
+
reasons.push(`${unsatisfied}/${deps.length} dependencies not satisfied`);
|
|
35
|
+
return { score: 0, reasons };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Calculate priority score (30% weight).
|
|
39
|
+
* Lower agent numbers get higher priority.
|
|
40
|
+
*/
|
|
41
|
+
function calculatePriorityScore(agent) {
|
|
42
|
+
const reasons = [];
|
|
43
|
+
const agentNum = parseInt(agent.agentNumber, 10);
|
|
44
|
+
// Agents 0-2 get full priority score
|
|
45
|
+
// Score decreases for higher agent numbers
|
|
46
|
+
const score = Math.max(0, 30 - agentNum * 3);
|
|
47
|
+
reasons.push(`Agent #${agentNum} priority: ${score}/30`);
|
|
48
|
+
return { score, reasons };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Calculate workload score (30% weight).
|
|
52
|
+
* Based on file count - fewer files = easier task = higher score.
|
|
53
|
+
*/
|
|
54
|
+
function calculateWorkloadScore(agent) {
|
|
55
|
+
const reasons = [];
|
|
56
|
+
const fileCount = agent.frontmatter.files.length;
|
|
57
|
+
// Fewer files = higher score (max 30)
|
|
58
|
+
const score = Math.max(0, 30 - fileCount * 5);
|
|
59
|
+
reasons.push(`${fileCount} files to modify: ${score}/30`);
|
|
60
|
+
return { score, reasons };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check if task is eligible (GAP status, no file conflicts).
|
|
64
|
+
*/
|
|
65
|
+
function isTaskEligible(agent, coordination) {
|
|
66
|
+
if (agent.frontmatter.status !== 'GAP') {
|
|
67
|
+
return {
|
|
68
|
+
eligible: false,
|
|
69
|
+
reason: `Status is ${agent.frontmatter.status}, not GAP`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// Check file conflicts
|
|
73
|
+
for (const file of agent.frontmatter.files) {
|
|
74
|
+
const lockedBy = coordination.fileLocks[file];
|
|
75
|
+
if (lockedBy) {
|
|
76
|
+
return {
|
|
77
|
+
eligible: false,
|
|
78
|
+
reason: `File ${file} is locked by ${lockedBy}`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Check dependency satisfaction
|
|
83
|
+
for (const dep of agent.frontmatter.dependencies) {
|
|
84
|
+
const taskId = resolveDependency(dep, agent.planFolder);
|
|
85
|
+
if (taskId) {
|
|
86
|
+
const depTask = coordination.tasks[taskId];
|
|
87
|
+
if (!depTask || depTask.status !== 'PASS') {
|
|
88
|
+
return {
|
|
89
|
+
eligible: false,
|
|
90
|
+
reason: `Dependency ${dep} not satisfied`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return { eligible: true };
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Score a task and return breakdown.
|
|
99
|
+
*/
|
|
100
|
+
function scoreTask(agent, coordination) {
|
|
101
|
+
const eligibility = isTaskEligible(agent, coordination);
|
|
102
|
+
if (!eligibility.eligible) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
const depResult = calculateDependencyScore(agent, coordination);
|
|
106
|
+
const priorityResult = calculatePriorityScore(agent);
|
|
107
|
+
const workloadResult = calculateWorkloadScore(agent);
|
|
108
|
+
const totalScore = depResult.score + priorityResult.score + workloadResult.score;
|
|
109
|
+
return {
|
|
110
|
+
taskId: agent.taskId,
|
|
111
|
+
agentNumber: agent.agentNumber,
|
|
112
|
+
title: agent.title || `Agent ${agent.agentNumber}`,
|
|
113
|
+
totalScore,
|
|
114
|
+
dependencyScore: depResult.score,
|
|
115
|
+
priorityScore: priorityResult.score,
|
|
116
|
+
workloadScore: workloadResult.score,
|
|
117
|
+
reasons: [...depResult.reasons, ...priorityResult.reasons, ...workloadResult.reasons],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Get the next best task data from a plan.
|
|
122
|
+
* Returns structured data for rendering.
|
|
123
|
+
*
|
|
124
|
+
* @param config - Server configuration
|
|
125
|
+
* @param planId - Plan number or name
|
|
126
|
+
* @returns Structured task data or error message
|
|
127
|
+
*/
|
|
128
|
+
export async function getNextTaskData(config, planId) {
|
|
129
|
+
const planDir = findPlanDirectory(config.plansPath, planId);
|
|
130
|
+
if (!planDir) {
|
|
131
|
+
return { error: `Plan not found: ${planId}` };
|
|
132
|
+
}
|
|
133
|
+
const agents = getAgentFiles(planDir);
|
|
134
|
+
if (agents.length === 0) {
|
|
135
|
+
return { error: 'No agents found' };
|
|
136
|
+
}
|
|
137
|
+
// Load coordination state
|
|
138
|
+
const coordination = await readCoordination(config.coordinationPath);
|
|
139
|
+
// Score all eligible tasks
|
|
140
|
+
const scoredTasks = [];
|
|
141
|
+
for (const agent of agents) {
|
|
142
|
+
const score = scoreTask(agent, coordination);
|
|
143
|
+
if (score) {
|
|
144
|
+
scoredTasks.push(score);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (scoredTasks.length === 0) {
|
|
148
|
+
// Check if all tasks are complete
|
|
149
|
+
const passCount = agents.filter((a) => a.frontmatter.status === 'PASS').length;
|
|
150
|
+
if (passCount === agents.length) {
|
|
151
|
+
return { error: 'All tasks completed!' };
|
|
152
|
+
}
|
|
153
|
+
return { error: 'No available tasks (all blocked or in progress)' };
|
|
154
|
+
}
|
|
155
|
+
// Sort by total score (descending)
|
|
156
|
+
scoredTasks.sort((a, b) => b.totalScore - a.totalScore);
|
|
157
|
+
const best = scoredTasks[0];
|
|
158
|
+
return {
|
|
159
|
+
task: best,
|
|
160
|
+
otherAvailableTasks: scoredTasks.length - 1,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get the next best task from a plan.
|
|
165
|
+
*
|
|
166
|
+
* @param config - Server configuration
|
|
167
|
+
* @param planId - Plan number or name
|
|
168
|
+
* @returns Formatted string output for CLI
|
|
169
|
+
*/
|
|
170
|
+
export async function nextTask(config, planId) {
|
|
171
|
+
const result = await getNextTaskData(config, planId);
|
|
172
|
+
if ('error' in result) {
|
|
173
|
+
return result.error;
|
|
174
|
+
}
|
|
175
|
+
const { task: best, otherAvailableTasks } = result;
|
|
176
|
+
// Format output
|
|
177
|
+
const lines = [];
|
|
178
|
+
lines.push('Next Best Task:');
|
|
179
|
+
lines.push('');
|
|
180
|
+
lines.push(` Task ID: ${best.taskId}`);
|
|
181
|
+
lines.push(` Title: ${best.title}`);
|
|
182
|
+
lines.push('');
|
|
183
|
+
lines.push('Score Breakdown:');
|
|
184
|
+
lines.push(` Total Score: ${best.totalScore}/100`);
|
|
185
|
+
lines.push(` Dependencies: ${best.dependencyScore}/40`);
|
|
186
|
+
lines.push(` Priority: ${best.priorityScore}/30`);
|
|
187
|
+
lines.push(` Workload: ${best.workloadScore}/30`);
|
|
188
|
+
lines.push('');
|
|
189
|
+
lines.push('Scoring Reasons:');
|
|
190
|
+
for (const reason of best.reasons) {
|
|
191
|
+
lines.push(` - ${reason}`);
|
|
192
|
+
}
|
|
193
|
+
if (otherAvailableTasks > 0) {
|
|
194
|
+
lines.push('');
|
|
195
|
+
lines.push(`Other available tasks: ${otherAvailableTasks}`);
|
|
196
|
+
}
|
|
197
|
+
return lines.join('\n');
|
|
198
|
+
}
|
|
199
|
+
// Export scoring functions for testing
|
|
200
|
+
export { calculateDependencyScore, calculatePriorityScore, calculateWorkloadScore, isTaskEligible, scoreTask, };
|
|
201
|
+
//# sourceMappingURL=next-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-task.js","sourceRoot":"","sources":["../../src/cli/next-task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAA0B,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAwB,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAgBpE;;;GAGG;AACH,SAAS,wBAAwB,CAC/B,KAAsB,EACtB,YAA+B;IAE/B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC;IAE5C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC5C,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,KAAK,MAAM,GAAG,IAA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CAAC;IAC/B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC,OAAO,MAAM,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,mBAAmB,GAAG,CAAC,EAAE,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,0BAA0B,mBAAmB,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,uCAAuC;AACvC,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,SAAS,GACV,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project registry for managing limps configurations.
|
|
3
|
+
* Stores a mapping of project names to config paths, enabling
|
|
4
|
+
* users to switch between projects without specifying --config each time.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A registered project entry in the registry.
|
|
8
|
+
*/
|
|
9
|
+
export interface RegisteredProject {
|
|
10
|
+
/** Absolute path to the project's config.json file */
|
|
11
|
+
configPath: string;
|
|
12
|
+
/** ISO timestamp when the project was registered */
|
|
13
|
+
registeredAt: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The project registry file structure.
|
|
17
|
+
*/
|
|
18
|
+
export interface ProjectRegistry {
|
|
19
|
+
/** Schema version for future migrations */
|
|
20
|
+
version: 1;
|
|
21
|
+
/** Currently active project name, or null if none set */
|
|
22
|
+
current: string | null;
|
|
23
|
+
/** Map of project names to their registration info */
|
|
24
|
+
projects: Record<string, RegisteredProject>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the path to the registry file.
|
|
28
|
+
* Uses XDG-compliant location: ~/.config/limps/registry.json
|
|
29
|
+
*
|
|
30
|
+
* @returns Absolute path to registry.json
|
|
31
|
+
*/
|
|
32
|
+
export declare function getRegistryPath(): string;
|
|
33
|
+
/**
|
|
34
|
+
* Load the project registry from disk.
|
|
35
|
+
* Returns an empty registry if the file doesn't exist.
|
|
36
|
+
*
|
|
37
|
+
* @returns The project registry
|
|
38
|
+
*/
|
|
39
|
+
export declare function loadRegistry(): ProjectRegistry;
|
|
40
|
+
/**
|
|
41
|
+
* Save the project registry to disk.
|
|
42
|
+
* Uses atomic write (write to temp, then rename) to prevent corruption.
|
|
43
|
+
*
|
|
44
|
+
* @param registry - The registry to save
|
|
45
|
+
*/
|
|
46
|
+
export declare function saveRegistry(registry: ProjectRegistry): void;
|
|
47
|
+
/**
|
|
48
|
+
* Register a new project in the registry.
|
|
49
|
+
*
|
|
50
|
+
* @param name - Project name (used as identifier)
|
|
51
|
+
* @param configPath - Absolute path to the project's config.json
|
|
52
|
+
*/
|
|
53
|
+
export declare function registerProject(name: string, configPath: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Unregister a project from the registry.
|
|
56
|
+
* If the project is the current project, clears the current selection.
|
|
57
|
+
* Does not delete any files, only removes the registry entry.
|
|
58
|
+
*
|
|
59
|
+
* @param name - Project name to unregister
|
|
60
|
+
* @throws Error if the project is not registered
|
|
61
|
+
*/
|
|
62
|
+
export declare function unregisterProject(name: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Set the current/default project.
|
|
65
|
+
*
|
|
66
|
+
* @param name - Project name to set as current, or null to clear
|
|
67
|
+
* @throws Error if the project is not registered
|
|
68
|
+
*/
|
|
69
|
+
export declare function setCurrentProject(name: string | null): void;
|
|
70
|
+
/**
|
|
71
|
+
* Get the config path for the current project.
|
|
72
|
+
*
|
|
73
|
+
* @returns Config path if a current project is set and exists, null otherwise
|
|
74
|
+
*/
|
|
75
|
+
export declare function getCurrentProjectPath(): string | null;
|
|
76
|
+
/**
|
|
77
|
+
* Get the config path for a specific project by name.
|
|
78
|
+
*
|
|
79
|
+
* @param name - Project name to look up
|
|
80
|
+
* @returns Config path if found, null otherwise
|
|
81
|
+
*/
|
|
82
|
+
export declare function getProjectPath(name: string): string | null;
|
|
83
|
+
/**
|
|
84
|
+
* List all registered projects.
|
|
85
|
+
*
|
|
86
|
+
* @returns Array of project info objects
|
|
87
|
+
*/
|
|
88
|
+
export declare function listProjects(): {
|
|
89
|
+
name: string;
|
|
90
|
+
current: boolean;
|
|
91
|
+
configPath: string;
|
|
92
|
+
registeredAt: string;
|
|
93
|
+
}[];
|
|
94
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/cli/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,2CAA2C;IAC3C,OAAO,EAAE,CAAC,CAAC;IACX,yDAAyD;IACzD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC7C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,eAAe,CAqB9C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAQ5D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAOtE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAepD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAW3D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAarD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI1D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,EAAE,CAWF"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project registry for managing limps configurations.
|
|
3
|
+
* Stores a mapping of project names to config paths, enabling
|
|
4
|
+
* users to switch between projects without specifying --config each time.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, renameSync } from 'fs';
|
|
7
|
+
import { dirname } from 'path';
|
|
8
|
+
import { getOSBasePath } from '../utils/os-paths.js';
|
|
9
|
+
/**
|
|
10
|
+
* Get the path to the registry file.
|
|
11
|
+
* Uses XDG-compliant location: ~/.config/limps/registry.json
|
|
12
|
+
*
|
|
13
|
+
* @returns Absolute path to registry.json
|
|
14
|
+
*/
|
|
15
|
+
export function getRegistryPath() {
|
|
16
|
+
return `${getOSBasePath('limps')}/registry.json`;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Load the project registry from disk.
|
|
20
|
+
* Returns an empty registry if the file doesn't exist.
|
|
21
|
+
*
|
|
22
|
+
* @returns The project registry
|
|
23
|
+
*/
|
|
24
|
+
export function loadRegistry() {
|
|
25
|
+
const path = getRegistryPath();
|
|
26
|
+
if (!existsSync(path)) {
|
|
27
|
+
return { version: 1, current: null, projects: {} };
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const content = readFileSync(path, 'utf-8');
|
|
31
|
+
const registry = JSON.parse(content);
|
|
32
|
+
// Validate basic structure
|
|
33
|
+
if (!registry.version || !registry.projects) {
|
|
34
|
+
console.error('Warning: Corrupt registry file, resetting to empty');
|
|
35
|
+
return { version: 1, current: null, projects: {} };
|
|
36
|
+
}
|
|
37
|
+
return registry;
|
|
38
|
+
}
|
|
39
|
+
catch (_error) {
|
|
40
|
+
console.error('Warning: Failed to parse registry file, resetting to empty');
|
|
41
|
+
return { version: 1, current: null, projects: {} };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Save the project registry to disk.
|
|
46
|
+
* Uses atomic write (write to temp, then rename) to prevent corruption.
|
|
47
|
+
*
|
|
48
|
+
* @param registry - The registry to save
|
|
49
|
+
*/
|
|
50
|
+
export function saveRegistry(registry) {
|
|
51
|
+
const path = getRegistryPath();
|
|
52
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
53
|
+
// Atomic write: write to temp file, then rename
|
|
54
|
+
const tmp = `${path}.tmp.${process.pid}`;
|
|
55
|
+
writeFileSync(tmp, JSON.stringify(registry, null, 2));
|
|
56
|
+
renameSync(tmp, path);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Register a new project in the registry.
|
|
60
|
+
*
|
|
61
|
+
* @param name - Project name (used as identifier)
|
|
62
|
+
* @param configPath - Absolute path to the project's config.json
|
|
63
|
+
*/
|
|
64
|
+
export function registerProject(name, configPath) {
|
|
65
|
+
const registry = loadRegistry();
|
|
66
|
+
registry.projects[name] = {
|
|
67
|
+
configPath,
|
|
68
|
+
registeredAt: new Date().toISOString(),
|
|
69
|
+
};
|
|
70
|
+
saveRegistry(registry);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Unregister a project from the registry.
|
|
74
|
+
* If the project is the current project, clears the current selection.
|
|
75
|
+
* Does not delete any files, only removes the registry entry.
|
|
76
|
+
*
|
|
77
|
+
* @param name - Project name to unregister
|
|
78
|
+
* @throws Error if the project is not registered
|
|
79
|
+
*/
|
|
80
|
+
export function unregisterProject(name) {
|
|
81
|
+
const registry = loadRegistry();
|
|
82
|
+
if (!registry.projects[name]) {
|
|
83
|
+
throw new Error(`Project not found: ${name}`);
|
|
84
|
+
}
|
|
85
|
+
// Clear current if this was the active project
|
|
86
|
+
if (registry.current === name) {
|
|
87
|
+
registry.current = null;
|
|
88
|
+
}
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
90
|
+
delete registry.projects[name];
|
|
91
|
+
saveRegistry(registry);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Set the current/default project.
|
|
95
|
+
*
|
|
96
|
+
* @param name - Project name to set as current, or null to clear
|
|
97
|
+
* @throws Error if the project is not registered
|
|
98
|
+
*/
|
|
99
|
+
export function setCurrentProject(name) {
|
|
100
|
+
const registry = loadRegistry();
|
|
101
|
+
if (name !== null && !registry.projects[name]) {
|
|
102
|
+
throw new Error(`Project not found: ${name}\nRun \`limps config list\` to see available projects.`);
|
|
103
|
+
}
|
|
104
|
+
registry.current = name;
|
|
105
|
+
saveRegistry(registry);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get the config path for the current project.
|
|
109
|
+
*
|
|
110
|
+
* @returns Config path if a current project is set and exists, null otherwise
|
|
111
|
+
*/
|
|
112
|
+
export function getCurrentProjectPath() {
|
|
113
|
+
const registry = loadRegistry();
|
|
114
|
+
if (!registry.current) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
const project = registry.projects[registry.current];
|
|
118
|
+
if (!project) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return project.configPath;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get the config path for a specific project by name.
|
|
125
|
+
*
|
|
126
|
+
* @param name - Project name to look up
|
|
127
|
+
* @returns Config path if found, null otherwise
|
|
128
|
+
*/
|
|
129
|
+
export function getProjectPath(name) {
|
|
130
|
+
const registry = loadRegistry();
|
|
131
|
+
const project = registry.projects[name];
|
|
132
|
+
return project?.configPath ?? null;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* List all registered projects.
|
|
136
|
+
*
|
|
137
|
+
* @returns Array of project info objects
|
|
138
|
+
*/
|
|
139
|
+
export function listProjects() {
|
|
140
|
+
const registry = loadRegistry();
|
|
141
|
+
return Object.entries(registry.projects)
|
|
142
|
+
.map(([name, project]) => ({
|
|
143
|
+
name,
|
|
144
|
+
current: name === registry.current,
|
|
145
|
+
configPath: project.configPath,
|
|
146
|
+
registeredAt: project.registeredAt,
|
|
147
|
+
}))
|
|
148
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/cli/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAwBrD;;;;;GAKG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;IAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACrD,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,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CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAChC,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxC,OAAO,OAAO,EAAE,UAAU,IAAI,IAAI,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAM1B,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAEhC,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;SACrC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QACzB,IAAI;QACJ,OAAO,EAAE,IAAI,KAAK,QAAQ,CAAC,OAAO;QAClC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,YAAY,EAAE,OAAO,CAAC,YAAY;KACnC,CAAC,CAAC;SACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command: status
|
|
3
|
+
* Show plan status summary.
|
|
4
|
+
*/
|
|
5
|
+
import type { ServerConfig } from '../config.js';
|
|
6
|
+
import type { AgentFrontmatter } from '../agent-parser.js';
|
|
7
|
+
/**
|
|
8
|
+
* Plan status summary.
|
|
9
|
+
*/
|
|
10
|
+
export interface PlanStatusSummary {
|
|
11
|
+
planName: string;
|
|
12
|
+
totalAgents: number;
|
|
13
|
+
statusCounts: Record<AgentFrontmatter['status'], number>;
|
|
14
|
+
personaCounts: Record<AgentFrontmatter['persona'], number>;
|
|
15
|
+
completionPercentage: number;
|
|
16
|
+
blockedAgents: string[];
|
|
17
|
+
wipAgents: string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get status summary for a plan.
|
|
21
|
+
*
|
|
22
|
+
* @param config - Server configuration
|
|
23
|
+
* @param planId - Plan number or name
|
|
24
|
+
* @returns Plan status summary
|
|
25
|
+
*/
|
|
26
|
+
export declare function getPlanStatusSummary(config: ServerConfig, planId: string): PlanStatusSummary;
|
|
27
|
+
/**
|
|
28
|
+
* Format status summary for CLI output.
|
|
29
|
+
*
|
|
30
|
+
* @param config - Server configuration
|
|
31
|
+
* @param planId - Plan number or name
|
|
32
|
+
* @returns Formatted string output for CLI
|
|
33
|
+
*/
|
|
34
|
+
export declare function status(config: ServerConfig, planId: string): string;
|
|
35
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/cli/status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;IACzD,aAAa,EAAE,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3D,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAmD5F;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAsDnE"}
|