@sudosandwich/limps 0.2.0 → 0.3.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 +281 -33
- 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/{rlm-query.js → process-doc.js} +7 -8
- 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/{rlm-multi-query.js → process-docs.js} +10 -10
- package/dist/tools/process-docs.js.map +1 -0
- package/dist/tools/release-task.d.ts +5 -10
- package/dist/tools/release-task.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
- package/dist/tools/read-doc.d.ts +0 -44
- package/dist/tools/read-doc.d.ts.map +0 -1
- package/dist/tools/read-doc.js +0 -174
- package/dist/tools/read-doc.js.map +0 -1
- package/dist/tools/rlm-multi-query.d.ts +0 -110
- package/dist/tools/rlm-multi-query.d.ts.map +0 -1
- package/dist/tools/rlm-multi-query.js.map +0 -1
- package/dist/tools/rlm-query.d.ts +0 -56
- package/dist/tools/rlm-query.d.ts.map +0 -1
- package/dist/tools/rlm-query.js.map +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command: list-plans
|
|
3
|
+
* Lists all plans in the configured plansPath.
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { stripMarkdown } from '../utils/markdown.js';
|
|
8
|
+
/**
|
|
9
|
+
* Extract plan number from directory name.
|
|
10
|
+
* Handles both padded (0001-plan-name) and unpadded (1-plan-name) formats.
|
|
11
|
+
*/
|
|
12
|
+
export function extractPlanNumber(dirName) {
|
|
13
|
+
const match = dirName.match(/^(\d+)-/);
|
|
14
|
+
if (match) {
|
|
15
|
+
return match[1];
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Extract plan name from directory name.
|
|
21
|
+
* Removes the number prefix and converts dashes to spaces.
|
|
22
|
+
*/
|
|
23
|
+
export function extractPlanName(dirName) {
|
|
24
|
+
const match = dirName.match(/^\d+-(.+)$/);
|
|
25
|
+
if (match) {
|
|
26
|
+
return match[1].replace(/-/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
|
|
27
|
+
}
|
|
28
|
+
return dirName;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Detect work type from plan content or directory name.
|
|
32
|
+
*/
|
|
33
|
+
export function detectWorkType(dirName, content) {
|
|
34
|
+
const lowerDir = dirName.toLowerCase();
|
|
35
|
+
const lowerContent = content.toLowerCase();
|
|
36
|
+
if (lowerDir.includes('bug') || lowerContent.includes('bug fix')) {
|
|
37
|
+
return 'bug';
|
|
38
|
+
}
|
|
39
|
+
if (lowerDir.includes('refactor') || lowerContent.includes('refactor')) {
|
|
40
|
+
return 'refactor';
|
|
41
|
+
}
|
|
42
|
+
if (lowerDir.includes('doc') || lowerContent.includes('documentation')) {
|
|
43
|
+
return 'docs';
|
|
44
|
+
}
|
|
45
|
+
if (lowerDir.includes('feature') ||
|
|
46
|
+
lowerDir.includes('feat') ||
|
|
47
|
+
lowerContent.includes('feature')) {
|
|
48
|
+
return 'feature';
|
|
49
|
+
}
|
|
50
|
+
return 'unknown';
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parse YAML frontmatter from content.
|
|
54
|
+
*/
|
|
55
|
+
function parseYamlFrontmatter(content) {
|
|
56
|
+
const yamlRegex = /^---\s*\n([\s\S]*?)\n---\s*\n/;
|
|
57
|
+
const match = content.match(yamlRegex);
|
|
58
|
+
if (!match) {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
const frontmatterText = match[1];
|
|
62
|
+
const frontmatter = {};
|
|
63
|
+
const lines = frontmatterText.split('\n');
|
|
64
|
+
for (const line of lines) {
|
|
65
|
+
const trimmed = line.trim();
|
|
66
|
+
if (!trimmed || trimmed.startsWith('#'))
|
|
67
|
+
continue;
|
|
68
|
+
const colonIndex = trimmed.indexOf(':');
|
|
69
|
+
if (colonIndex === -1)
|
|
70
|
+
continue;
|
|
71
|
+
const key = trimmed.slice(0, colonIndex).trim();
|
|
72
|
+
let value = trimmed.slice(colonIndex + 1).trim();
|
|
73
|
+
if (typeof value === 'string') {
|
|
74
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
75
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
76
|
+
value = value.slice(1, -1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (key) {
|
|
80
|
+
frontmatter[key] = value;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return frontmatter;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Extract overview from plan content.
|
|
87
|
+
* Looks for content after the title and before the first section.
|
|
88
|
+
*/
|
|
89
|
+
export function extractOverview(content) {
|
|
90
|
+
// Remove frontmatter
|
|
91
|
+
const withoutFrontmatter = content.replace(/^---\s*\n[\s\S]*?\n---\s*\n/, '');
|
|
92
|
+
// Find content between title and first ## heading
|
|
93
|
+
const lines = withoutFrontmatter.split('\n');
|
|
94
|
+
const overviewLines = [];
|
|
95
|
+
let foundTitle = false;
|
|
96
|
+
for (const line of lines) {
|
|
97
|
+
if (line.startsWith('# ') && !foundTitle) {
|
|
98
|
+
foundTitle = true;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (foundTitle) {
|
|
102
|
+
if (line.startsWith('## ') || line.startsWith('### ')) {
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
const trimmed = line.trim();
|
|
106
|
+
if (trimmed) {
|
|
107
|
+
// Skip lines that look like raw metadata (e.g., `**Status:** Draft **Date:** 2026-01-15`)
|
|
108
|
+
// These are common when frontmatter leaks into content
|
|
109
|
+
if (/^\*\*[A-Za-z]+\*\*:\s*.*(\*\*[A-Za-z]+\*\*:.*)?$/.test(trimmed)) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
// Skip horizontal rules
|
|
113
|
+
if (/^[-*_]{3,}$/.test(trimmed)) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
overviewLines.push(trimmed);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const overview = overviewLines.join(' ');
|
|
121
|
+
// Strip markdown for clean CLI display
|
|
122
|
+
const cleaned = stripMarkdown(overview);
|
|
123
|
+
const truncated = cleaned.slice(0, 100);
|
|
124
|
+
return truncated.length === 100 ? truncated + '...' : truncated;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get plan status from frontmatter or default.
|
|
128
|
+
*/
|
|
129
|
+
export function getPlanStatus(content) {
|
|
130
|
+
const frontmatter = parseYamlFrontmatter(content);
|
|
131
|
+
if (frontmatter.status && typeof frontmatter.status === 'string') {
|
|
132
|
+
const status = frontmatter.status.toUpperCase();
|
|
133
|
+
if (['GAP', 'WIP', 'PASS', 'BLOCKED'].includes(status)) {
|
|
134
|
+
return status;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return 'GAP';
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get all plans data from the configured plansPath.
|
|
141
|
+
* Returns structured data for rendering.
|
|
142
|
+
*
|
|
143
|
+
* @param config - Server configuration
|
|
144
|
+
* @returns Structured plan data or error message
|
|
145
|
+
*/
|
|
146
|
+
export function getPlansData(config) {
|
|
147
|
+
const plansPath = config.plansPath;
|
|
148
|
+
if (!existsSync(plansPath)) {
|
|
149
|
+
return { error: 'No plans found (plans directory does not exist)' };
|
|
150
|
+
}
|
|
151
|
+
const dirs = readdirSync(plansPath, { withFileTypes: true })
|
|
152
|
+
.filter((dirent) => dirent.isDirectory())
|
|
153
|
+
.map((dirent) => dirent.name);
|
|
154
|
+
const plans = [];
|
|
155
|
+
for (const dir of dirs) {
|
|
156
|
+
const planNumber = extractPlanNumber(dir);
|
|
157
|
+
if (!planNumber) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const planMdPath = join(plansPath, dir, 'plan.md');
|
|
161
|
+
let content = '';
|
|
162
|
+
if (existsSync(planMdPath)) {
|
|
163
|
+
try {
|
|
164
|
+
content = readFileSync(planMdPath, 'utf-8');
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// Ignore read errors
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
plans.push({
|
|
171
|
+
number: planNumber,
|
|
172
|
+
name: extractPlanName(dir),
|
|
173
|
+
workType: detectWorkType(dir, content),
|
|
174
|
+
overview: extractOverview(content),
|
|
175
|
+
status: getPlanStatus(content),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (plans.length === 0) {
|
|
179
|
+
return { error: 'No plans found' };
|
|
180
|
+
}
|
|
181
|
+
// Sort by plan number
|
|
182
|
+
plans.sort((a, b) => parseInt(a.number, 10) - parseInt(b.number, 10));
|
|
183
|
+
return { plans, total: plans.length };
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* List all plans from the configured plansPath.
|
|
187
|
+
*
|
|
188
|
+
* @param config - Server configuration
|
|
189
|
+
* @returns Formatted string output for CLI
|
|
190
|
+
*/
|
|
191
|
+
export function listPlans(config) {
|
|
192
|
+
const result = getPlansData(config);
|
|
193
|
+
if ('error' in result) {
|
|
194
|
+
return result.error;
|
|
195
|
+
}
|
|
196
|
+
const { plans } = result;
|
|
197
|
+
// Format output
|
|
198
|
+
const lines = [];
|
|
199
|
+
lines.push('Plans:');
|
|
200
|
+
lines.push('');
|
|
201
|
+
for (const plan of plans) {
|
|
202
|
+
const statusIcon = {
|
|
203
|
+
GAP: ' ',
|
|
204
|
+
WIP: '*',
|
|
205
|
+
PASS: '+',
|
|
206
|
+
BLOCKED: '!',
|
|
207
|
+
}[plan.status];
|
|
208
|
+
lines.push(`[${statusIcon}] ${plan.number.padStart(4, '0')} - ${plan.name}`);
|
|
209
|
+
lines.push(` Type: ${plan.workType} | Status: ${plan.status}`);
|
|
210
|
+
if (plan.overview) {
|
|
211
|
+
lines.push(` ${plan.overview}`);
|
|
212
|
+
}
|
|
213
|
+
lines.push('');
|
|
214
|
+
}
|
|
215
|
+
lines.push(`Total: ${plans.length} plan(s)`);
|
|
216
|
+
return lines.join('\n');
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=list-plans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-plans.js","sourceRoot":"","sources":["../../src/cli/list-plans.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAarD;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,KAAK,GAAG,O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AE,GAAG,MAAM,CAAC;IAEzB,gBAAgB;IAChB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG;YACjB,GAAG,EAAE,GAAG;YACR,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,GAAG;SACb,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEf,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,KAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7E,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,QAAQ,cAAc,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAClE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrC,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC;IAE7C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -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,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GACV,CAAC"}
|
|
@@ -0,0 +1,201 @@
|
|
|
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,C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CAAC,IAAI,CAAC,kBAAkB,CAAC,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,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