@compilr-dev/cli 0.6.1 → 0.6.3
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/CHANGELOG.md +104 -0
- package/README.md +12 -0
- package/dist/commands-v2/handlers/core.js +2 -2
- package/dist/commands-v2/handlers/index.d.ts +1 -0
- package/dist/commands-v2/handlers/index.js +5 -2
- package/dist/commands-v2/handlers/perf.d.ts +9 -0
- package/dist/commands-v2/handlers/perf.js +66 -0
- package/dist/commands-v2/handlers/project.js +2 -3
- package/dist/compilr-diff-companion.vsix +0 -0
- package/dist/index.js +14 -8
- package/dist/repl-v2.js +5 -1
- package/dist/session/project-session-manager.js +1 -1
- package/dist/slash-autocomplete.js +18 -16
- package/dist/tabbed-menu.js +8 -7
- package/dist/ui/base/overlay-base.js +2 -1
- package/dist/ui/overlay/impl/artifact-detail-overlay-v2.js +12 -7
- package/dist/ui/overlay/impl/config-overlay-v2.js +2 -2
- package/dist/ui/overlay/impl/document-detail-overlay-v2.js +12 -8
- package/dist/ui/overlay/impl/pending-overlay-v2.js +4 -1
- package/dist/ui/overlay-manager.js +7 -6
- package/dist/ui/terminal-render-item.js +2 -1
- package/dist/ui/terminal-renderer.js +1 -2
- package/dist/ui/terminal-ui.js +6 -4
- package/dist/ui/terminal.d.ts +9 -0
- package/dist/ui/terminal.js +28 -15
- package/dist/utils/update-checker.d.ts +6 -1
- package/dist/utils/update-checker.js +16 -1
- package/package.json +5 -4
- package/dist/.tsbuildinfo.app +0 -1
- package/dist/.tsbuildinfo.data +0 -1
- package/dist/.tsbuildinfo.domain +0 -1
- package/dist/.tsbuildinfo.foundation +0 -1
- package/dist/guide/guide-content.d.ts +0 -23
- package/dist/guide/guide-content.js +0 -196
- package/dist/multi-agent/activity.d.ts +0 -21
- package/dist/multi-agent/activity.js +0 -34
- package/dist/multi-agent/agent-selection.d.ts +0 -55
- package/dist/multi-agent/agent-selection.js +0 -90
- package/dist/multi-agent/artifacts.d.ts +0 -197
- package/dist/multi-agent/artifacts.js +0 -379
- package/dist/multi-agent/collision-utils.d.ts +0 -16
- package/dist/multi-agent/collision-utils.js +0 -28
- package/dist/multi-agent/context-resolver.d.ts +0 -97
- package/dist/multi-agent/context-resolver.js +0 -316
- package/dist/multi-agent/mention-parser.d.ts +0 -64
- package/dist/multi-agent/mention-parser.js +0 -146
- package/dist/multi-agent/shared-context.d.ts +0 -293
- package/dist/multi-agent/shared-context.js +0 -671
- package/dist/multi-agent/skill-requirements.d.ts +0 -66
- package/dist/multi-agent/skill-requirements.js +0 -178
- package/dist/multi-agent/task-assignment.d.ts +0 -69
- package/dist/multi-agent/task-assignment.js +0 -123
- package/dist/multi-agent/task-suggestion.d.ts +0 -31
- package/dist/multi-agent/task-suggestion.js +0 -72
- package/dist/multi-agent/team-agent.d.ts +0 -201
- package/dist/multi-agent/team-agent.js +0 -488
- package/dist/multi-agent/team.d.ts +0 -286
- package/dist/multi-agent/team.js +0 -610
- package/dist/multi-agent/tool-config.d.ts +0 -110
- package/dist/multi-agent/tool-config.js +0 -661
- package/dist/multi-agent/types.d.ts +0 -211
- package/dist/multi-agent/types.js +0 -617
- package/dist/tools/guide-tool.d.ts +0 -12
- package/dist/tools/guide-tool.js +0 -59
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Guide Content
|
|
3
|
-
*
|
|
4
|
-
* Documentation for the compilr_guide tool.
|
|
5
|
-
* Uses shared content from shared-content.ts for topics that overlap with tutorials.
|
|
6
|
-
*/
|
|
7
|
-
import { CONTENT_TOPICS, topicToPlainText, searchContentTopics, getAllTopicIds, } from './shared-content.js';
|
|
8
|
-
// =============================================================================
|
|
9
|
-
// Guide-Only Entries (not in tutorials)
|
|
10
|
-
// =============================================================================
|
|
11
|
-
const GUIDE_ONLY_ENTRIES = [
|
|
12
|
-
{
|
|
13
|
-
id: 'overview',
|
|
14
|
-
title: 'Compilr Dev CLI Overview',
|
|
15
|
-
keywords: ['overview', 'what is', 'introduction', 'about', 'compilr'],
|
|
16
|
-
content: `
|
|
17
|
-
Compilr Dev CLI is an AI-powered coding assistant that helps you build software projects.
|
|
18
|
-
|
|
19
|
-
Key features:
|
|
20
|
-
- Multi-LLM support (Claude, OpenAI, Gemini, Ollama)
|
|
21
|
-
- Project management with structured workflows
|
|
22
|
-
- Requirements gathering with /design command
|
|
23
|
-
- Backlog tracking with /backlog command
|
|
24
|
-
- Team agents for specialized assistance ($arch, $pm, $qa, etc.)
|
|
25
|
-
- Session persistence and context management
|
|
26
|
-
|
|
27
|
-
The CLI has two main interfaces:
|
|
28
|
-
1. Dashboard - A menu-based interface for project management
|
|
29
|
-
2. REPL - A command-line interface for chatting with the AI
|
|
30
|
-
|
|
31
|
-
Run "compilr" to start. Use /help to see all commands.
|
|
32
|
-
`.trim(),
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: 'workflow-modes',
|
|
36
|
-
title: 'Workflow Modes',
|
|
37
|
-
keywords: ['workflow', 'flexible', 'guided', 'mode'],
|
|
38
|
-
content: `
|
|
39
|
-
Two workflow modes are available:
|
|
40
|
-
|
|
41
|
-
Flexible (recommended):
|
|
42
|
-
- Work at your own pace
|
|
43
|
-
- AI responds to your requests
|
|
44
|
-
- No enforced structure
|
|
45
|
-
- Best for experienced developers
|
|
46
|
-
|
|
47
|
-
Guided:
|
|
48
|
-
- AI suggests next steps
|
|
49
|
-
- Tracks work item progress
|
|
50
|
-
- More structured approach
|
|
51
|
-
- Best for learning the workflow
|
|
52
|
-
|
|
53
|
-
Switch modes with /workflow command.
|
|
54
|
-
|
|
55
|
-
The footer shows current mode: "mode: Normal" or "mode: Guided"
|
|
56
|
-
`.trim(),
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: 'workflow-recommended',
|
|
60
|
-
title: 'Recommended Workflow',
|
|
61
|
-
keywords: ['workflow', 'how to', 'best practice', 'process'],
|
|
62
|
-
content: `
|
|
63
|
-
Recommended workflow for new projects:
|
|
64
|
-
|
|
65
|
-
1. Create project with /new
|
|
66
|
-
- Choose your tech stack
|
|
67
|
-
- Set up git repository
|
|
68
|
-
|
|
69
|
-
2. Plan with /design
|
|
70
|
-
- Describe what you want to build
|
|
71
|
-
- AI asks clarifying questions
|
|
72
|
-
- Generates PRD and backlog items
|
|
73
|
-
|
|
74
|
-
3. Review backlog with /backlog
|
|
75
|
-
- See all work items
|
|
76
|
-
- Prioritize tasks
|
|
77
|
-
- Pick one to start
|
|
78
|
-
|
|
79
|
-
4. Build features
|
|
80
|
-
- Ask AI to implement from backlog
|
|
81
|
-
- "Build REQ-001: User authentication"
|
|
82
|
-
- Review and iterate
|
|
83
|
-
|
|
84
|
-
5. Manage context
|
|
85
|
-
- Use /compact when context fills up
|
|
86
|
-
- Add /anchors for important decisions
|
|
87
|
-
- Use /resume to continue later
|
|
88
|
-
`.trim(),
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
id: 'command-resume',
|
|
92
|
-
title: '/resume Command',
|
|
93
|
-
keywords: ['/resume', 'resume', 'session', 'continue', 'previous'],
|
|
94
|
-
content: `
|
|
95
|
-
/resume - Continue a previous session.
|
|
96
|
-
|
|
97
|
-
Sessions are auto-saved after each AI response.
|
|
98
|
-
|
|
99
|
-
The overlay shows:
|
|
100
|
-
- Recent: Sessions from current project
|
|
101
|
-
- All: Sessions from all projects
|
|
102
|
-
- Session date, message count, and preview
|
|
103
|
-
|
|
104
|
-
Actions:
|
|
105
|
-
j/k Navigate sessions
|
|
106
|
-
/ Search sessions
|
|
107
|
-
Enter Resume selected session
|
|
108
|
-
d Delete session
|
|
109
|
-
q/Esc Close
|
|
110
|
-
|
|
111
|
-
What's saved in a session:
|
|
112
|
-
- Conversation history (all messages)
|
|
113
|
-
- Todo list items
|
|
114
|
-
- Workflow state (mode, current work item)
|
|
115
|
-
- Token usage
|
|
116
|
-
|
|
117
|
-
What's NOT in sessions (per-project instead):
|
|
118
|
-
- Anchors (persistent across sessions)
|
|
119
|
-
- Team agent configurations
|
|
120
|
-
- Documents (PRD, backlog, etc.)
|
|
121
|
-
|
|
122
|
-
Cross-project sessions show a warning before resuming.
|
|
123
|
-
`.trim(),
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
id: 'command-team',
|
|
127
|
-
title: '/team Command',
|
|
128
|
-
keywords: ['/team', 'team', 'agents', 'manage'],
|
|
129
|
-
content: `
|
|
130
|
-
/team - View and manage team agents.
|
|
131
|
-
|
|
132
|
-
The overlay shows:
|
|
133
|
-
- All available agents
|
|
134
|
-
- Current agent (marked with ★)
|
|
135
|
-
- Agent status and context usage
|
|
136
|
-
|
|
137
|
-
Tabs:
|
|
138
|
-
Agents List of all agents
|
|
139
|
-
Context Per-agent token usage
|
|
140
|
-
|
|
141
|
-
Switch agents by selecting one and pressing Enter.
|
|
142
|
-
Or use $ prefix in REPL: $arch, $pm, $qa, etc.
|
|
143
|
-
`.trim(),
|
|
144
|
-
},
|
|
145
|
-
];
|
|
146
|
-
// =============================================================================
|
|
147
|
-
// Combined Guide Entries
|
|
148
|
-
// =============================================================================
|
|
149
|
-
/**
|
|
150
|
-
* Build guide entries from shared content and guide-only entries.
|
|
151
|
-
*/
|
|
152
|
-
function buildGuideEntries() {
|
|
153
|
-
const entries = [...GUIDE_ONLY_ENTRIES];
|
|
154
|
-
// Convert shared content topics to guide entries
|
|
155
|
-
for (const topic of CONTENT_TOPICS) {
|
|
156
|
-
entries.push({
|
|
157
|
-
id: topic.id,
|
|
158
|
-
title: topic.title,
|
|
159
|
-
keywords: topic.keywords,
|
|
160
|
-
content: topicToPlainText(topic),
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
return entries;
|
|
164
|
-
}
|
|
165
|
-
export const guideEntries = buildGuideEntries();
|
|
166
|
-
// =============================================================================
|
|
167
|
-
// Search Functions
|
|
168
|
-
// =============================================================================
|
|
169
|
-
/**
|
|
170
|
-
* Search guide entries by keyword or topic.
|
|
171
|
-
*/
|
|
172
|
-
export function searchGuide(query) {
|
|
173
|
-
const q = query.toLowerCase().trim();
|
|
174
|
-
// Exact ID match
|
|
175
|
-
const exactMatch = guideEntries.find((e) => e.id === q);
|
|
176
|
-
if (exactMatch)
|
|
177
|
-
return [exactMatch];
|
|
178
|
-
// Command match (e.g., "/design" or "design")
|
|
179
|
-
const cmdQuery = q.startsWith('/') ? q : `/${q}`;
|
|
180
|
-
const cmdMatch = guideEntries.find((e) => e.keywords.includes(cmdQuery) || e.keywords.includes(q));
|
|
181
|
-
if (cmdMatch)
|
|
182
|
-
return [cmdMatch];
|
|
183
|
-
// Keyword search
|
|
184
|
-
const matches = guideEntries.filter((e) => e.keywords.some((k) => k.includes(q) || q.includes(k)) ||
|
|
185
|
-
e.title.toLowerCase().includes(q) ||
|
|
186
|
-
e.content.toLowerCase().includes(q));
|
|
187
|
-
return matches.slice(0, 3); // Return top 3 matches
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Get all available topics for listing.
|
|
191
|
-
*/
|
|
192
|
-
export function getGuideTopics() {
|
|
193
|
-
return guideEntries.map((e) => e.id);
|
|
194
|
-
}
|
|
195
|
-
// Re-export shared content helpers for use elsewhere
|
|
196
|
-
export { searchContentTopics, getAllTopicIds };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Activity Recording Module
|
|
3
|
-
*
|
|
4
|
-
* Provides a global function for tools to record team activity.
|
|
5
|
-
* The SharedContextManager is set by the REPL when a team is active.
|
|
6
|
-
*/
|
|
7
|
-
import type { SharedContextManager, TeamActivityType } from './shared-context.js';
|
|
8
|
-
/**
|
|
9
|
-
* Set the active SharedContextManager for activity recording
|
|
10
|
-
* Called by the REPL when a team is initialized
|
|
11
|
-
*/
|
|
12
|
-
export declare function setActiveSharedContext(ctx: SharedContextManager | null): void;
|
|
13
|
-
/**
|
|
14
|
-
* Get the active SharedContextManager
|
|
15
|
-
*/
|
|
16
|
-
export declare function getActiveSharedContext(): SharedContextManager | null;
|
|
17
|
-
/**
|
|
18
|
-
* Record team activity
|
|
19
|
-
* Safe to call even if no team is active (will be a no-op)
|
|
20
|
-
*/
|
|
21
|
-
export declare function recordTeamActivity(agentId: string, action: TeamActivityType, summary: string): void;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Activity Recording Module
|
|
3
|
-
*
|
|
4
|
-
* Provides a global function for tools to record team activity.
|
|
5
|
-
* The SharedContextManager is set by the REPL when a team is active.
|
|
6
|
-
*/
|
|
7
|
-
// Module-level reference to the active SharedContextManager
|
|
8
|
-
let activeSharedContext = null;
|
|
9
|
-
/**
|
|
10
|
-
* Set the active SharedContextManager for activity recording
|
|
11
|
-
* Called by the REPL when a team is initialized
|
|
12
|
-
*/
|
|
13
|
-
export function setActiveSharedContext(ctx) {
|
|
14
|
-
activeSharedContext = ctx;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Get the active SharedContextManager
|
|
18
|
-
*/
|
|
19
|
-
export function getActiveSharedContext() {
|
|
20
|
-
return activeSharedContext;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Record team activity
|
|
24
|
-
* Safe to call even if no team is active (will be a no-op)
|
|
25
|
-
*/
|
|
26
|
-
export function recordTeamActivity(agentId, action, summary) {
|
|
27
|
-
if (activeSharedContext) {
|
|
28
|
-
activeSharedContext.recordActivity({
|
|
29
|
-
agentId,
|
|
30
|
-
action,
|
|
31
|
-
summary,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Selection Helpers
|
|
3
|
-
*
|
|
4
|
-
* Provides functions for selecting the best agent for a task:
|
|
5
|
-
* - findAgentForRole: Find an agent by role (LRU selection if multiple)
|
|
6
|
-
* - findAgentById: Find an agent by ID
|
|
7
|
-
* - getAvailableSpecialists: Get all non-default agents
|
|
8
|
-
*
|
|
9
|
-
* Uses Least Recently Used (LRU) selection when multiple agents have the same role.
|
|
10
|
-
* This spreads work across agents and prepares for future background execution
|
|
11
|
-
* where we'll prefer idle agents.
|
|
12
|
-
*/
|
|
13
|
-
import type { AgentTeam } from './team.js';
|
|
14
|
-
import type { TeamAgent } from './team-agent.js';
|
|
15
|
-
import type { AgentRole } from './types.js';
|
|
16
|
-
/**
|
|
17
|
-
* Find the best agent for a given role.
|
|
18
|
-
* If multiple agents have the same role, selects the least recently used.
|
|
19
|
-
*
|
|
20
|
-
* @param team - The agent team
|
|
21
|
-
* @param role - The role to find (e.g., 'arch', 'dev', 'qa')
|
|
22
|
-
* @returns The best matching agent, or null if none found
|
|
23
|
-
*/
|
|
24
|
-
export declare function findAgentForRole(team: AgentTeam, role: AgentRole): TeamAgent | null;
|
|
25
|
-
/**
|
|
26
|
-
* Find an agent by ID.
|
|
27
|
-
*
|
|
28
|
-
* @param team - The agent team
|
|
29
|
-
* @param id - The agent ID (e.g., 'arch', 'dev-1', 'my-custom-agent')
|
|
30
|
-
* @returns The agent, or null if not found
|
|
31
|
-
*/
|
|
32
|
-
export declare function findAgentById(team: AgentTeam, id: string): TeamAgent | null;
|
|
33
|
-
/**
|
|
34
|
-
* Get all specialist agents (non-default agents).
|
|
35
|
-
* Useful for listing available delegation targets.
|
|
36
|
-
*
|
|
37
|
-
* @param team - The agent team
|
|
38
|
-
* @returns Array of specialist agents
|
|
39
|
-
*/
|
|
40
|
-
export declare function getAvailableSpecialists(team: AgentTeam): TeamAgent[];
|
|
41
|
-
/**
|
|
42
|
-
* Get a summary of available specialists for the coordinator.
|
|
43
|
-
* Returns a formatted string listing specialists by role.
|
|
44
|
-
*
|
|
45
|
-
* @param team - The agent team
|
|
46
|
-
* @returns Formatted string of available specialists
|
|
47
|
-
*/
|
|
48
|
-
export declare function getSpecialistsSummary(team: AgentTeam): string;
|
|
49
|
-
/**
|
|
50
|
-
* Check if the team has any specialists available for delegation.
|
|
51
|
-
*
|
|
52
|
-
* @param team - The agent team
|
|
53
|
-
* @returns True if there are specialist agents
|
|
54
|
-
*/
|
|
55
|
-
export declare function hasSpecialists(team: AgentTeam): boolean;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Selection Helpers
|
|
3
|
-
*
|
|
4
|
-
* Provides functions for selecting the best agent for a task:
|
|
5
|
-
* - findAgentForRole: Find an agent by role (LRU selection if multiple)
|
|
6
|
-
* - findAgentById: Find an agent by ID
|
|
7
|
-
* - getAvailableSpecialists: Get all non-default agents
|
|
8
|
-
*
|
|
9
|
-
* Uses Least Recently Used (LRU) selection when multiple agents have the same role.
|
|
10
|
-
* This spreads work across agents and prepares for future background execution
|
|
11
|
-
* where we'll prefer idle agents.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Find the best agent for a given role.
|
|
15
|
-
* If multiple agents have the same role, selects the least recently used.
|
|
16
|
-
*
|
|
17
|
-
* @param team - The agent team
|
|
18
|
-
* @param role - The role to find (e.g., 'arch', 'dev', 'qa')
|
|
19
|
-
* @returns The best matching agent, or null if none found
|
|
20
|
-
*/
|
|
21
|
-
export function findAgentForRole(team, role) {
|
|
22
|
-
const agents = team.getAll();
|
|
23
|
-
// Filter to agents with matching role
|
|
24
|
-
const candidates = agents.filter((agent) => agent.role === role);
|
|
25
|
-
if (candidates.length === 0) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
if (candidates.length === 1) {
|
|
29
|
-
return candidates[0];
|
|
30
|
-
}
|
|
31
|
-
// Multiple candidates: select Least Recently Used (LRU)
|
|
32
|
-
// Sort by lastActivity ascending (oldest first)
|
|
33
|
-
candidates.sort((a, b) => a.lastActivity.getTime() - b.lastActivity.getTime());
|
|
34
|
-
return candidates[0];
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Find an agent by ID.
|
|
38
|
-
*
|
|
39
|
-
* @param team - The agent team
|
|
40
|
-
* @param id - The agent ID (e.g., 'arch', 'dev-1', 'my-custom-agent')
|
|
41
|
-
* @returns The agent, or null if not found
|
|
42
|
-
*/
|
|
43
|
-
export function findAgentById(team, id) {
|
|
44
|
-
return team.get(id) ?? null;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Get all specialist agents (non-default agents).
|
|
48
|
-
* Useful for listing available delegation targets.
|
|
49
|
-
*
|
|
50
|
-
* @param team - The agent team
|
|
51
|
-
* @returns Array of specialist agents
|
|
52
|
-
*/
|
|
53
|
-
export function getAvailableSpecialists(team) {
|
|
54
|
-
return team.getAll().filter((agent) => agent.id !== 'default');
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Get a summary of available specialists for the coordinator.
|
|
58
|
-
* Returns a formatted string listing specialists by role.
|
|
59
|
-
*
|
|
60
|
-
* @param team - The agent team
|
|
61
|
-
* @returns Formatted string of available specialists
|
|
62
|
-
*/
|
|
63
|
-
export function getSpecialistsSummary(team) {
|
|
64
|
-
const specialists = getAvailableSpecialists(team);
|
|
65
|
-
if (specialists.length === 0) {
|
|
66
|
-
return 'No specialist agents available. Add agents via /team.';
|
|
67
|
-
}
|
|
68
|
-
// Group by role
|
|
69
|
-
const byRole = new Map();
|
|
70
|
-
for (const agent of specialists) {
|
|
71
|
-
const list = byRole.get(agent.role) ?? [];
|
|
72
|
-
list.push(agent);
|
|
73
|
-
byRole.set(agent.role, list);
|
|
74
|
-
}
|
|
75
|
-
const lines = [];
|
|
76
|
-
for (const [role, agents] of byRole) {
|
|
77
|
-
const agentList = agents.map((a) => `$${a.id}`).join(', ');
|
|
78
|
-
lines.push(`- ${role}: ${agentList}`);
|
|
79
|
-
}
|
|
80
|
-
return lines.join('\n');
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Check if the team has any specialists available for delegation.
|
|
84
|
-
*
|
|
85
|
-
* @param team - The agent team
|
|
86
|
-
* @returns True if there are specialist agents
|
|
87
|
-
*/
|
|
88
|
-
export function hasSpecialists(team) {
|
|
89
|
-
return getAvailableSpecialists(team).length > 0;
|
|
90
|
-
}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ArtifactStore - Storage for team artifacts
|
|
3
|
-
*
|
|
4
|
-
* Artifacts are named pieces of work that agents can publish and reference:
|
|
5
|
-
* - design: Architecture, API specs, data models
|
|
6
|
-
* - plan: Sprint plans, task breakdowns, timelines
|
|
7
|
-
* - review: Code reviews, security audits, feedback
|
|
8
|
-
* - decision: Architectural decisions, trade-off analysis
|
|
9
|
-
* - note: General notes, meeting summaries
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Artifact types
|
|
13
|
-
*/
|
|
14
|
-
export type ArtifactType = 'design' | 'plan' | 'review' | 'decision' | 'note';
|
|
15
|
-
/**
|
|
16
|
-
* Full artifact structure
|
|
17
|
-
*/
|
|
18
|
-
export interface Artifact {
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
agent: string;
|
|
22
|
-
type: ArtifactType;
|
|
23
|
-
content: string;
|
|
24
|
-
summary: string;
|
|
25
|
-
version: number;
|
|
26
|
-
createdAt: Date;
|
|
27
|
-
updatedAt: Date;
|
|
28
|
-
mentions: string[];
|
|
29
|
-
referencedBy: string[];
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Artifact summary for the shared context index
|
|
33
|
-
*/
|
|
34
|
-
export interface ArtifactSummary {
|
|
35
|
-
id: string;
|
|
36
|
-
name: string;
|
|
37
|
-
agent: string;
|
|
38
|
-
type: ArtifactType;
|
|
39
|
-
summary: string;
|
|
40
|
-
updatedAt: Date;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Options for creating an artifact
|
|
44
|
-
*/
|
|
45
|
-
export interface CreateArtifactOptions {
|
|
46
|
-
name: string;
|
|
47
|
-
agent: string;
|
|
48
|
-
type: ArtifactType;
|
|
49
|
-
content: string;
|
|
50
|
-
summary?: string;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Options for updating an artifact
|
|
54
|
-
*/
|
|
55
|
-
export interface UpdateArtifactOptions {
|
|
56
|
-
content?: string;
|
|
57
|
-
summary?: string;
|
|
58
|
-
type?: ArtifactType;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Serialized artifact for persistence
|
|
62
|
-
*/
|
|
63
|
-
export interface SerializedArtifact {
|
|
64
|
-
id: string;
|
|
65
|
-
name: string;
|
|
66
|
-
agent: string;
|
|
67
|
-
type: ArtifactType;
|
|
68
|
-
content: string;
|
|
69
|
-
summary: string;
|
|
70
|
-
version: number;
|
|
71
|
-
createdAt: string;
|
|
72
|
-
updatedAt: string;
|
|
73
|
-
mentions?: string[];
|
|
74
|
-
referencedBy?: string[];
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Artifact index for persistence
|
|
78
|
-
*/
|
|
79
|
-
export interface ArtifactIndex {
|
|
80
|
-
version: number;
|
|
81
|
-
artifacts: Array<{
|
|
82
|
-
id: string;
|
|
83
|
-
name: string;
|
|
84
|
-
agent: string;
|
|
85
|
-
type: ArtifactType;
|
|
86
|
-
summary: string;
|
|
87
|
-
updatedAt: string;
|
|
88
|
-
}>;
|
|
89
|
-
updatedAt: string;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Manages artifact storage and retrieval
|
|
93
|
-
*/
|
|
94
|
-
export declare class ArtifactStore {
|
|
95
|
-
private readonly basePath;
|
|
96
|
-
private readonly artifacts;
|
|
97
|
-
private readonly nameToId;
|
|
98
|
-
private updatedAt;
|
|
99
|
-
constructor(basePath: string);
|
|
100
|
-
/**
|
|
101
|
-
* Get the artifacts directory path
|
|
102
|
-
*/
|
|
103
|
-
private getArtifactsDir;
|
|
104
|
-
/**
|
|
105
|
-
* Get the index file path
|
|
106
|
-
*/
|
|
107
|
-
private getIndexPath;
|
|
108
|
-
/**
|
|
109
|
-
* Get the path for an artifact file
|
|
110
|
-
*/
|
|
111
|
-
private getArtifactPath;
|
|
112
|
-
/**
|
|
113
|
-
* Ensure artifacts directory exists
|
|
114
|
-
*/
|
|
115
|
-
private ensureDir;
|
|
116
|
-
/**
|
|
117
|
-
* Create a new artifact
|
|
118
|
-
*/
|
|
119
|
-
create(options: CreateArtifactOptions): Artifact;
|
|
120
|
-
/**
|
|
121
|
-
* Get an artifact by ID
|
|
122
|
-
*/
|
|
123
|
-
get(id: string): Artifact | undefined;
|
|
124
|
-
/**
|
|
125
|
-
* Get an artifact by name (case-insensitive)
|
|
126
|
-
*/
|
|
127
|
-
getByName(name: string): Artifact | undefined;
|
|
128
|
-
/**
|
|
129
|
-
* Update an artifact
|
|
130
|
-
*/
|
|
131
|
-
update(id: string, options: UpdateArtifactOptions): Artifact | undefined;
|
|
132
|
-
/**
|
|
133
|
-
* Delete an artifact
|
|
134
|
-
*/
|
|
135
|
-
delete(id: string): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Rename an artifact
|
|
138
|
-
*/
|
|
139
|
-
rename(id: string, newName: string): Artifact | undefined;
|
|
140
|
-
/**
|
|
141
|
-
* List all artifacts
|
|
142
|
-
*/
|
|
143
|
-
list(): Artifact[];
|
|
144
|
-
/**
|
|
145
|
-
* List artifacts by agent
|
|
146
|
-
*/
|
|
147
|
-
listByAgent(agent: string): Artifact[];
|
|
148
|
-
/**
|
|
149
|
-
* List artifacts by type
|
|
150
|
-
*/
|
|
151
|
-
listByType(type: ArtifactType): Artifact[];
|
|
152
|
-
/**
|
|
153
|
-
* Search artifacts by name or content
|
|
154
|
-
*/
|
|
155
|
-
search(query: string): Artifact[];
|
|
156
|
-
/**
|
|
157
|
-
* Get artifact count
|
|
158
|
-
*/
|
|
159
|
-
get size(): number;
|
|
160
|
-
/**
|
|
161
|
-
* Check if an artifact exists by name
|
|
162
|
-
*/
|
|
163
|
-
has(name: string): boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Check if an artifact exists by ID
|
|
166
|
-
*/
|
|
167
|
-
hasId(id: string): boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Generate a summary from content
|
|
170
|
-
* Simple extraction of first meaningful lines
|
|
171
|
-
*/
|
|
172
|
-
private generateSummary;
|
|
173
|
-
/**
|
|
174
|
-
* Get summaries for shared context injection
|
|
175
|
-
*/
|
|
176
|
-
getSummaries(): ArtifactSummary[];
|
|
177
|
-
/**
|
|
178
|
-
* Save all artifacts to disk
|
|
179
|
-
*/
|
|
180
|
-
save(): void;
|
|
181
|
-
/**
|
|
182
|
-
* Save just the index file
|
|
183
|
-
*/
|
|
184
|
-
private saveIndex;
|
|
185
|
-
/**
|
|
186
|
-
* Load artifacts from disk
|
|
187
|
-
*/
|
|
188
|
-
load(): void;
|
|
189
|
-
/**
|
|
190
|
-
* Clear all artifacts (including from disk)
|
|
191
|
-
*/
|
|
192
|
-
clear(): void;
|
|
193
|
-
/**
|
|
194
|
-
* Get the last update timestamp
|
|
195
|
-
*/
|
|
196
|
-
getLastUpdated(): Date;
|
|
197
|
-
}
|