clavix 2.3.0 → 2.4.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/dist/cli/commands/init.js +1 -1
- package/dist/core 2/adapters/agents-md-generator.d.ts +26 -0
- package/dist/core 2/adapters/agents-md-generator.js +102 -0
- package/dist/core 2/adapters/amp-adapter.d.ts +27 -0
- package/dist/core 2/adapters/amp-adapter.js +42 -0
- package/dist/core 2/adapters/augment-adapter.d.ts +22 -0
- package/dist/core 2/adapters/augment-adapter.js +77 -0
- package/dist/core 2/adapters/base-adapter.d.ts +45 -0
- package/dist/core 2/adapters/base-adapter.js +142 -0
- package/dist/core 2/adapters/claude-code-adapter.d.ts +32 -0
- package/dist/core 2/adapters/claude-code-adapter.js +116 -0
- package/dist/core 2/adapters/cline-adapter.d.ts +34 -0
- package/dist/core 2/adapters/cline-adapter.js +52 -0
- package/dist/core 2/adapters/codebuddy-adapter.d.ts +24 -0
- package/dist/core 2/adapters/codebuddy-adapter.js +82 -0
- package/dist/core 2/adapters/codex-adapter.d.ts +24 -0
- package/dist/core 2/adapters/codex-adapter.js +79 -0
- package/dist/core 2/adapters/copilot-instructions-generator.d.ts +26 -0
- package/dist/core 2/adapters/copilot-instructions-generator.js +104 -0
- package/dist/core 2/adapters/crush-adapter.d.ts +35 -0
- package/dist/core 2/adapters/crush-adapter.js +49 -0
- package/dist/core 2/adapters/cursor-adapter.d.ts +25 -0
- package/dist/core 2/adapters/cursor-adapter.js +40 -0
- package/dist/core 2/adapters/droid-adapter.d.ts +33 -0
- package/dist/core 2/adapters/droid-adapter.js +57 -0
- package/dist/core 2/adapters/gemini-adapter.d.ts +27 -0
- package/dist/core 2/adapters/gemini-adapter.js +90 -0
- package/dist/core 2/adapters/kilocode-adapter.d.ts +34 -0
- package/dist/core 2/adapters/kilocode-adapter.js +49 -0
- package/dist/core 2/adapters/octo-md-generator.d.ts +26 -0
- package/dist/core 2/adapters/octo-md-generator.js +102 -0
- package/dist/core 2/adapters/opencode-adapter.d.ts +33 -0
- package/dist/core 2/adapters/opencode-adapter.js +56 -0
- package/dist/core 2/adapters/qwen-adapter.d.ts +27 -0
- package/dist/core 2/adapters/qwen-adapter.js +90 -0
- package/dist/core 2/adapters/roocode-adapter.d.ts +40 -0
- package/dist/core 2/adapters/roocode-adapter.js +68 -0
- package/dist/core 2/adapters/warp-md-generator.d.ts +17 -0
- package/dist/core 2/adapters/warp-md-generator.js +88 -0
- package/dist/core 2/adapters/windsurf-adapter.d.ts +34 -0
- package/dist/core 2/adapters/windsurf-adapter.js +49 -0
- package/dist/core 2/agent-manager.d.ts +51 -0
- package/dist/core 2/agent-manager.js +126 -0
- package/dist/core 2/archive-manager.d.ts +100 -0
- package/dist/core 2/archive-manager.js +338 -0
- package/dist/core 2/conversation-analyzer.d.ts +86 -0
- package/dist/core 2/doc-injector.d.ts +51 -0
- package/dist/core 2/doc-injector.js +236 -0
- package/dist/core 2/git-manager.d.ts +100 -0
- package/dist/core 2/git-manager.js +214 -0
- package/dist/core 2/prompt-optimizer.d.ts +268 -0
- package/dist/core 2/prompt-optimizer.js +963 -0
- package/dist/core 2/question-engine.d.ts +167 -0
- package/dist/core 2/question-engine.js +395 -0
- package/dist/core 2/session-manager.d.ts +139 -0
- package/dist/core 2/session-manager.js +403 -0
- package/dist/core 2/task-manager.d.ts +155 -0
- package/dist/core 2/task-manager.js +689 -0
- package/dist/utils/template-loader.js +24 -22
- package/package.json +1 -1
- package/dist/templates/slash-commands/augment/archive.md +0 -291
- package/dist/templates/slash-commands/augment/deep.md +0 -207
- package/dist/templates/slash-commands/augment/fast.md +0 -183
- package/dist/templates/slash-commands/augment/implement.md +0 -267
- package/dist/templates/slash-commands/augment/plan.md +0 -173
- package/dist/templates/slash-commands/augment/prd.md +0 -178
- package/dist/templates/slash-commands/augment/start.md +0 -142
- package/dist/templates/slash-commands/augment/summarize.md +0 -179
- package/dist/templates/slash-commands/claude-code/archive.md +0 -291
- package/dist/templates/slash-commands/claude-code/deep.md +0 -207
- package/dist/templates/slash-commands/claude-code/fast.md +0 -183
- package/dist/templates/slash-commands/claude-code/implement.md +0 -267
- package/dist/templates/slash-commands/claude-code/plan.md +0 -173
- package/dist/templates/slash-commands/claude-code/prd.md +0 -178
- package/dist/templates/slash-commands/claude-code/start.md +0 -142
- package/dist/templates/slash-commands/claude-code/summarize.md +0 -179
- package/dist/templates/slash-commands/cline/archive.md +0 -291
- package/dist/templates/slash-commands/cline/deep.md +0 -207
- package/dist/templates/slash-commands/cline/fast.md +0 -183
- package/dist/templates/slash-commands/cline/implement.md +0 -267
- package/dist/templates/slash-commands/cline/plan.md +0 -173
- package/dist/templates/slash-commands/cline/prd.md +0 -178
- package/dist/templates/slash-commands/cline/start.md +0 -142
- package/dist/templates/slash-commands/cline/summarize.md +0 -179
- package/dist/templates/slash-commands/codebuddy/archive.md +0 -291
- package/dist/templates/slash-commands/codebuddy/deep.md +0 -207
- package/dist/templates/slash-commands/codebuddy/fast.md +0 -183
- package/dist/templates/slash-commands/codebuddy/implement.md +0 -267
- package/dist/templates/slash-commands/codebuddy/plan.md +0 -173
- package/dist/templates/slash-commands/codebuddy/prd.md +0 -178
- package/dist/templates/slash-commands/codebuddy/start.md +0 -142
- package/dist/templates/slash-commands/codebuddy/summarize.md +0 -179
- package/dist/templates/slash-commands/codex/archive.md +0 -291
- package/dist/templates/slash-commands/codex/deep.md +0 -207
- package/dist/templates/slash-commands/codex/fast.md +0 -183
- package/dist/templates/slash-commands/codex/implement.md +0 -267
- package/dist/templates/slash-commands/codex/plan.md +0 -173
- package/dist/templates/slash-commands/codex/prd.md +0 -178
- package/dist/templates/slash-commands/codex/start.md +0 -142
- package/dist/templates/slash-commands/codex/summarize.md +0 -179
- package/dist/templates/slash-commands/crush/archive.md +0 -291
- package/dist/templates/slash-commands/crush/deep.md +0 -207
- package/dist/templates/slash-commands/crush/fast.md +0 -183
- package/dist/templates/slash-commands/crush/implement.md +0 -267
- package/dist/templates/slash-commands/crush/plan.md +0 -173
- package/dist/templates/slash-commands/crush/prd.md +0 -178
- package/dist/templates/slash-commands/crush/start.md +0 -142
- package/dist/templates/slash-commands/crush/summarize.md +0 -179
- package/dist/templates/slash-commands/cursor/archive.md +0 -291
- package/dist/templates/slash-commands/cursor/deep.md +0 -207
- package/dist/templates/slash-commands/cursor/fast.md +0 -183
- package/dist/templates/slash-commands/cursor/implement.md +0 -267
- package/dist/templates/slash-commands/cursor/plan.md +0 -173
- package/dist/templates/slash-commands/cursor/prd.md +0 -178
- package/dist/templates/slash-commands/cursor/start.md +0 -142
- package/dist/templates/slash-commands/cursor/summarize.md +0 -179
- package/dist/templates/slash-commands/droid/archive.md +0 -291
- package/dist/templates/slash-commands/droid/deep.md +0 -207
- package/dist/templates/slash-commands/droid/fast.md +0 -183
- package/dist/templates/slash-commands/droid/implement.md +0 -267
- package/dist/templates/slash-commands/droid/plan.md +0 -173
- package/dist/templates/slash-commands/droid/prd.md +0 -178
- package/dist/templates/slash-commands/droid/start.md +0 -142
- package/dist/templates/slash-commands/droid/summarize.md +0 -179
- package/dist/templates/slash-commands/gemini/archive.toml +0 -290
- package/dist/templates/slash-commands/gemini/deep.toml +0 -206
- package/dist/templates/slash-commands/gemini/fast.toml +0 -182
- package/dist/templates/slash-commands/gemini/implement.toml +0 -266
- package/dist/templates/slash-commands/gemini/plan.toml +0 -170
- package/dist/templates/slash-commands/gemini/prd.toml +0 -177
- package/dist/templates/slash-commands/gemini/start.toml +0 -141
- package/dist/templates/slash-commands/gemini/summarize.toml +0 -178
- package/dist/templates/slash-commands/kilocode/archive.md +0 -291
- package/dist/templates/slash-commands/kilocode/deep.md +0 -207
- package/dist/templates/slash-commands/kilocode/fast.md +0 -183
- package/dist/templates/slash-commands/kilocode/implement.md +0 -267
- package/dist/templates/slash-commands/kilocode/plan.md +0 -173
- package/dist/templates/slash-commands/kilocode/prd.md +0 -178
- package/dist/templates/slash-commands/kilocode/start.md +0 -142
- package/dist/templates/slash-commands/kilocode/summarize.md +0 -179
- package/dist/templates/slash-commands/opencode/archive.md +0 -291
- package/dist/templates/slash-commands/opencode/deep.md +0 -207
- package/dist/templates/slash-commands/opencode/fast.md +0 -183
- package/dist/templates/slash-commands/opencode/implement.md +0 -267
- package/dist/templates/slash-commands/opencode/plan.md +0 -173
- package/dist/templates/slash-commands/opencode/prd.md +0 -178
- package/dist/templates/slash-commands/opencode/start.md +0 -142
- package/dist/templates/slash-commands/opencode/summarize.md +0 -179
- package/dist/templates/slash-commands/qwen/archive.toml +0 -290
- package/dist/templates/slash-commands/qwen/deep.toml +0 -206
- package/dist/templates/slash-commands/qwen/fast.toml +0 -182
- package/dist/templates/slash-commands/qwen/implement.toml +0 -266
- package/dist/templates/slash-commands/qwen/plan.toml +0 -170
- package/dist/templates/slash-commands/qwen/prd.toml +0 -177
- package/dist/templates/slash-commands/qwen/start.toml +0 -141
- package/dist/templates/slash-commands/qwen/summarize.toml +0 -178
- package/dist/templates/slash-commands/roocode/archive.md +0 -291
- package/dist/templates/slash-commands/roocode/deep.md +0 -207
- package/dist/templates/slash-commands/roocode/fast.md +0 -183
- package/dist/templates/slash-commands/roocode/implement.md +0 -267
- package/dist/templates/slash-commands/roocode/plan.md +0 -173
- package/dist/templates/slash-commands/roocode/prd.md +0 -178
- package/dist/templates/slash-commands/roocode/start.md +0 -142
- package/dist/templates/slash-commands/roocode/summarize.md +0 -179
- package/dist/templates/slash-commands/windsurf/archive.md +0 -291
- package/dist/templates/slash-commands/windsurf/deep.md +0 -207
- package/dist/templates/slash-commands/windsurf/fast.md +0 -183
- package/dist/templates/slash-commands/windsurf/implement.md +0 -267
- package/dist/templates/slash-commands/windsurf/plan.md +0 -173
- package/dist/templates/slash-commands/windsurf/prd.md +0 -178
- package/dist/templates/slash-commands/windsurf/start.md +0 -142
- package/dist/templates/slash-commands/windsurf/summarize.md +0 -179
- /package/dist/templates/slash-commands/{amp → _canonical}/archive.md +0 -0
- /package/dist/templates/slash-commands/{amp → _canonical}/deep.md +0 -0
- /package/dist/templates/slash-commands/{amp → _canonical}/fast.md +0 -0
- /package/dist/templates/slash-commands/{amp → _canonical}/implement.md +0 -0
- /package/dist/templates/slash-commands/{amp → _canonical}/plan.md +0 -0
- /package/dist/templates/slash-commands/{amp → _canonical}/prd.md +0 -0
- /package/dist/templates/slash-commands/{amp → _canonical}/start.md +0 -0
- /package/dist/templates/slash-commands/{amp → _canonical}/summarize.md +0 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ArchiveManager - Manages archival of completed PRD projects
|
|
4
|
+
*
|
|
5
|
+
* This class handles:
|
|
6
|
+
* - Listing active and archived PRD projects
|
|
7
|
+
* - Checking task completion status
|
|
8
|
+
* - Moving completed projects to archive
|
|
9
|
+
* - Managing archive directory structure
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.ArchiveManager = void 0;
|
|
46
|
+
const fs = __importStar(require("fs-extra"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const task_manager_1 = require("./task-manager");
|
|
49
|
+
/**
|
|
50
|
+
* ArchiveManager class
|
|
51
|
+
*
|
|
52
|
+
* Manages archival of completed PRD projects
|
|
53
|
+
*/
|
|
54
|
+
class ArchiveManager {
|
|
55
|
+
constructor() {
|
|
56
|
+
this.outputsDir = '.clavix/outputs';
|
|
57
|
+
this.archiveDir = '.clavix/outputs/archive';
|
|
58
|
+
this.taskManager = new task_manager_1.TaskManager();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* List all PRD projects in outputs directory
|
|
62
|
+
*
|
|
63
|
+
* @param includeArchived - Include archived projects in results
|
|
64
|
+
* @returns Array of PRD projects
|
|
65
|
+
*/
|
|
66
|
+
async listPrdProjects(includeArchived = false) {
|
|
67
|
+
const projects = [];
|
|
68
|
+
// Check if outputs directory exists
|
|
69
|
+
if (!(await fs.pathExists(this.outputsDir))) {
|
|
70
|
+
return projects;
|
|
71
|
+
}
|
|
72
|
+
const dirs = await fs.readdir(this.outputsDir);
|
|
73
|
+
for (const dir of dirs) {
|
|
74
|
+
// Skip archive directory when listing active projects
|
|
75
|
+
if (dir === 'archive' && !includeArchived) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const fullPath = path.join(this.outputsDir, dir);
|
|
79
|
+
const stat = await fs.stat(fullPath);
|
|
80
|
+
if (stat.isDirectory()) {
|
|
81
|
+
// Check if it has a PRD file
|
|
82
|
+
if (await this.hasPrdFile(fullPath)) {
|
|
83
|
+
const taskStatus = await this.checkTasksStatus(fullPath);
|
|
84
|
+
projects.push({
|
|
85
|
+
name: dir,
|
|
86
|
+
path: fullPath,
|
|
87
|
+
taskStatus,
|
|
88
|
+
modifiedTime: stat.mtime,
|
|
89
|
+
isArchived: false,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Add archived projects if requested
|
|
95
|
+
if (includeArchived) {
|
|
96
|
+
const archivedProjects = await this.listArchivedProjects();
|
|
97
|
+
projects.push(...archivedProjects);
|
|
98
|
+
}
|
|
99
|
+
// Sort by modification time (most recent first)
|
|
100
|
+
projects.sort((a, b) => b.modifiedTime.getTime() - a.modifiedTime.getTime());
|
|
101
|
+
return projects;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* List archived PRD projects
|
|
105
|
+
*
|
|
106
|
+
* @returns Array of archived PRD projects
|
|
107
|
+
*/
|
|
108
|
+
async listArchivedProjects() {
|
|
109
|
+
const projects = [];
|
|
110
|
+
if (!(await fs.pathExists(this.archiveDir))) {
|
|
111
|
+
return projects;
|
|
112
|
+
}
|
|
113
|
+
const dirs = await fs.readdir(this.archiveDir);
|
|
114
|
+
for (const dir of dirs) {
|
|
115
|
+
const fullPath = path.join(this.archiveDir, dir);
|
|
116
|
+
const stat = await fs.stat(fullPath);
|
|
117
|
+
if (stat.isDirectory()) {
|
|
118
|
+
if (await this.hasPrdFile(fullPath)) {
|
|
119
|
+
const taskStatus = await this.checkTasksStatus(fullPath);
|
|
120
|
+
projects.push({
|
|
121
|
+
name: dir,
|
|
122
|
+
path: fullPath,
|
|
123
|
+
taskStatus,
|
|
124
|
+
modifiedTime: stat.mtime,
|
|
125
|
+
isArchived: true,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return projects;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get PRD projects that are ready to archive (all tasks completed)
|
|
134
|
+
*
|
|
135
|
+
* @returns Array of archivable PRD projects
|
|
136
|
+
*/
|
|
137
|
+
async getArchivablePrds() {
|
|
138
|
+
const allProjects = await this.listPrdProjects(false);
|
|
139
|
+
// Filter to only projects with all tasks completed
|
|
140
|
+
return allProjects.filter((project) => project.taskStatus.hasTasksFile && project.taskStatus.allCompleted);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Check task completion status for a PRD project
|
|
144
|
+
*
|
|
145
|
+
* @param projectPath - Path to the PRD project directory
|
|
146
|
+
* @returns Task status information
|
|
147
|
+
*/
|
|
148
|
+
async checkTasksStatus(projectPath) {
|
|
149
|
+
const tasksPath = path.join(projectPath, 'tasks.md');
|
|
150
|
+
// Check if tasks.md exists
|
|
151
|
+
if (!(await fs.pathExists(tasksPath))) {
|
|
152
|
+
return {
|
|
153
|
+
hasTasksFile: false,
|
|
154
|
+
total: 0,
|
|
155
|
+
completed: 0,
|
|
156
|
+
remaining: 0,
|
|
157
|
+
percentage: 0,
|
|
158
|
+
allCompleted: false,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
// Read and parse tasks
|
|
163
|
+
const phases = await this.taskManager.readTasksFile(tasksPath);
|
|
164
|
+
const stats = this.taskManager.getTaskStats(phases);
|
|
165
|
+
return {
|
|
166
|
+
hasTasksFile: true,
|
|
167
|
+
total: stats.total,
|
|
168
|
+
completed: stats.completed,
|
|
169
|
+
remaining: stats.remaining,
|
|
170
|
+
percentage: stats.percentage,
|
|
171
|
+
allCompleted: stats.remaining === 0 && stats.total > 0,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
// If parsing fails, return error status
|
|
176
|
+
return {
|
|
177
|
+
hasTasksFile: true,
|
|
178
|
+
total: 0,
|
|
179
|
+
completed: 0,
|
|
180
|
+
remaining: 0,
|
|
181
|
+
percentage: 0,
|
|
182
|
+
allCompleted: false,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Archive a PRD project (move to archive directory)
|
|
188
|
+
*
|
|
189
|
+
* @param projectName - Name of the project to archive
|
|
190
|
+
* @param force - Force archive even if tasks are incomplete
|
|
191
|
+
* @returns Success status and message
|
|
192
|
+
*/
|
|
193
|
+
async archiveProject(projectName, force = false) {
|
|
194
|
+
const sourcePath = path.join(this.outputsDir, projectName);
|
|
195
|
+
// Check if project exists
|
|
196
|
+
if (!(await fs.pathExists(sourcePath))) {
|
|
197
|
+
return {
|
|
198
|
+
success: false,
|
|
199
|
+
message: `Project not found: ${projectName}`,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
// Check if it's already in archive
|
|
203
|
+
if (sourcePath.includes('/archive/')) {
|
|
204
|
+
return {
|
|
205
|
+
success: false,
|
|
206
|
+
message: `Project is already archived: ${projectName}`,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
// Check task status unless forced
|
|
210
|
+
if (!force) {
|
|
211
|
+
const taskStatus = await this.checkTasksStatus(sourcePath);
|
|
212
|
+
if (!taskStatus.hasTasksFile) {
|
|
213
|
+
return {
|
|
214
|
+
success: false,
|
|
215
|
+
message: `Project has no tasks.md file. Use --force to archive anyway.`,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
if (!taskStatus.allCompleted) {
|
|
219
|
+
return {
|
|
220
|
+
success: false,
|
|
221
|
+
message: `Project has ${taskStatus.remaining} incomplete task(s). Use --force to archive anyway.`,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Ensure archive directory exists
|
|
226
|
+
await fs.ensureDir(this.archiveDir);
|
|
227
|
+
// Move project to archive
|
|
228
|
+
const destPath = path.join(this.archiveDir, projectName);
|
|
229
|
+
// Check if destination already exists
|
|
230
|
+
if (await fs.pathExists(destPath)) {
|
|
231
|
+
return {
|
|
232
|
+
success: false,
|
|
233
|
+
message: `Archive already contains a project named: ${projectName}`,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
try {
|
|
237
|
+
await fs.move(sourcePath, destPath);
|
|
238
|
+
return {
|
|
239
|
+
success: true,
|
|
240
|
+
message: `Successfully archived ${projectName} to ${destPath}`,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
const { getErrorMessage } = await Promise.resolve().then(() => __importStar(require('../utils/error-utils.js')));
|
|
245
|
+
return {
|
|
246
|
+
success: false,
|
|
247
|
+
message: `Failed to archive project: ${getErrorMessage(error)}`,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Restore an archived project back to active outputs
|
|
253
|
+
*
|
|
254
|
+
* @param projectName - Name of the archived project to restore
|
|
255
|
+
* @returns Success status and message
|
|
256
|
+
*/
|
|
257
|
+
async restoreProject(projectName) {
|
|
258
|
+
const sourcePath = path.join(this.archiveDir, projectName);
|
|
259
|
+
// Check if archived project exists
|
|
260
|
+
if (!(await fs.pathExists(sourcePath))) {
|
|
261
|
+
return {
|
|
262
|
+
success: false,
|
|
263
|
+
message: `Archived project not found: ${projectName}`,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
const destPath = path.join(this.outputsDir, projectName);
|
|
267
|
+
// Check if destination already exists
|
|
268
|
+
if (await fs.pathExists(destPath)) {
|
|
269
|
+
return {
|
|
270
|
+
success: false,
|
|
271
|
+
message: `Active outputs already contains a project named: ${projectName}`,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
try {
|
|
275
|
+
await fs.move(sourcePath, destPath);
|
|
276
|
+
return {
|
|
277
|
+
success: true,
|
|
278
|
+
message: `Successfully restored ${projectName} to ${destPath}`,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
const { getErrorMessage } = await Promise.resolve().then(() => __importStar(require('../utils/error-utils.js')));
|
|
283
|
+
return {
|
|
284
|
+
success: false,
|
|
285
|
+
message: `Failed to restore project: ${getErrorMessage(error)}`,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Check if a directory contains a PRD file
|
|
291
|
+
*/
|
|
292
|
+
async hasPrdFile(dirPath) {
|
|
293
|
+
const possibleFiles = [
|
|
294
|
+
'PRD.md',
|
|
295
|
+
'full-prd.md',
|
|
296
|
+
'prd.md',
|
|
297
|
+
'Full-PRD.md',
|
|
298
|
+
'FULL_PRD.md',
|
|
299
|
+
'FULL-PRD.md',
|
|
300
|
+
'QUICK_PRD.md',
|
|
301
|
+
];
|
|
302
|
+
for (const filename of possibleFiles) {
|
|
303
|
+
if (await fs.pathExists(path.join(dirPath, filename))) {
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Get incomplete tasks for a project (for display purposes)
|
|
311
|
+
*
|
|
312
|
+
* @param projectPath - Path to the PRD project
|
|
313
|
+
* @returns Array of incomplete task descriptions
|
|
314
|
+
*/
|
|
315
|
+
async getIncompleteTasks(projectPath) {
|
|
316
|
+
const tasksPath = path.join(projectPath, 'tasks.md');
|
|
317
|
+
if (!(await fs.pathExists(tasksPath))) {
|
|
318
|
+
return [];
|
|
319
|
+
}
|
|
320
|
+
try {
|
|
321
|
+
const phases = await this.taskManager.readTasksFile(tasksPath);
|
|
322
|
+
const incompleteTasks = [];
|
|
323
|
+
for (const phase of phases) {
|
|
324
|
+
for (const task of phase.tasks) {
|
|
325
|
+
if (!task.completed) {
|
|
326
|
+
incompleteTasks.push(`[${phase.name}] ${task.description}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return incompleteTasks;
|
|
331
|
+
}
|
|
332
|
+
catch {
|
|
333
|
+
return [];
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
exports.ArchiveManager = ArchiveManager;
|
|
338
|
+
//# sourceMappingURL=archive-manager.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConversationAnalyzer - Analyzes conversation sessions and extracts structured requirements
|
|
3
|
+
*
|
|
4
|
+
* This class handles:
|
|
5
|
+
* - Conversation analysis and pattern extraction
|
|
6
|
+
* - Key requirement identification
|
|
7
|
+
* - Technical constraint extraction
|
|
8
|
+
* - Success criteria identification
|
|
9
|
+
* - Mini-PRD and optimized prompt generation
|
|
10
|
+
*/
|
|
11
|
+
import { Session } from '../types/session';
|
|
12
|
+
/**
|
|
13
|
+
* Analyzed conversation data
|
|
14
|
+
*/
|
|
15
|
+
export interface ConversationAnalysis {
|
|
16
|
+
summary: string;
|
|
17
|
+
keyRequirements: string[];
|
|
18
|
+
technicalConstraints: string[];
|
|
19
|
+
successCriteria: string[];
|
|
20
|
+
outOfScope: string[];
|
|
21
|
+
additionalContext: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* ConversationAnalyzer class
|
|
25
|
+
*
|
|
26
|
+
* Analyzes conversational sessions to extract structured requirements
|
|
27
|
+
* suitable for PRD generation or AI prompting
|
|
28
|
+
*/
|
|
29
|
+
export declare class ConversationAnalyzer {
|
|
30
|
+
/**
|
|
31
|
+
* Analyze a conversation session
|
|
32
|
+
*
|
|
33
|
+
* @param session - The session to analyze
|
|
34
|
+
* @returns Structured analysis of the conversation
|
|
35
|
+
*/
|
|
36
|
+
analyze(session: Session): ConversationAnalysis;
|
|
37
|
+
/**
|
|
38
|
+
* Generate a mini-PRD from analyzed conversation
|
|
39
|
+
*
|
|
40
|
+
* @param session - The session
|
|
41
|
+
* @param analysis - The conversation analysis
|
|
42
|
+
* @returns Mini-PRD content
|
|
43
|
+
*/
|
|
44
|
+
generateMiniPrd(session: Session, analysis: ConversationAnalysis): string;
|
|
45
|
+
/**
|
|
46
|
+
* Generate an optimized prompt for AI consumption
|
|
47
|
+
*
|
|
48
|
+
* @param session - The session
|
|
49
|
+
* @param analysis - The conversation analysis
|
|
50
|
+
* @returns Optimized prompt content
|
|
51
|
+
*/
|
|
52
|
+
generateOptimizedPrompt(session: Session, analysis: ConversationAnalysis): string;
|
|
53
|
+
/**
|
|
54
|
+
* Extract a summary from the conversation
|
|
55
|
+
*/
|
|
56
|
+
private extractSummary;
|
|
57
|
+
/**
|
|
58
|
+
* Extract key requirements from messages
|
|
59
|
+
*/
|
|
60
|
+
private extractKeyRequirements;
|
|
61
|
+
/**
|
|
62
|
+
* Extract technical constraints from messages
|
|
63
|
+
*/
|
|
64
|
+
private extractTechnicalConstraints;
|
|
65
|
+
/**
|
|
66
|
+
* Extract success criteria from messages
|
|
67
|
+
*/
|
|
68
|
+
private extractSuccessCriteria;
|
|
69
|
+
/**
|
|
70
|
+
* Extract out-of-scope items from messages
|
|
71
|
+
*/
|
|
72
|
+
private extractOutOfScope;
|
|
73
|
+
/**
|
|
74
|
+
* Extract additional context from messages
|
|
75
|
+
*/
|
|
76
|
+
private extractAdditionalContext;
|
|
77
|
+
/**
|
|
78
|
+
* Clean up extracted text
|
|
79
|
+
*/
|
|
80
|
+
private cleanupText;
|
|
81
|
+
/**
|
|
82
|
+
* Check if message matches any pattern
|
|
83
|
+
*/
|
|
84
|
+
private matchesAnyPattern;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=conversation-analyzer.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface ManagedBlockOptions {
|
|
2
|
+
startMarker: string;
|
|
3
|
+
endMarker: string;
|
|
4
|
+
content: string;
|
|
5
|
+
createIfMissing?: boolean;
|
|
6
|
+
validateMarkdown?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* DocInjector - manages injection and updating of managed blocks in documentation files
|
|
10
|
+
*/
|
|
11
|
+
export declare class DocInjector {
|
|
12
|
+
private static readonly DEFAULT_START_MARKER;
|
|
13
|
+
private static readonly DEFAULT_END_MARKER;
|
|
14
|
+
/**
|
|
15
|
+
* Inject or update managed block in a file
|
|
16
|
+
*/
|
|
17
|
+
static injectBlock(filePath: string, content: string, options?: Partial<ManagedBlockOptions>): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Detect if file contains managed block
|
|
20
|
+
*/
|
|
21
|
+
static hasBlock(filePath: string, startMarker?: string, endMarker?: string): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Extract content from managed block
|
|
24
|
+
*/
|
|
25
|
+
static extractBlock(filePath: string, startMarker?: string, endMarker?: string): Promise<string | null>;
|
|
26
|
+
/**
|
|
27
|
+
* Remove managed block from file
|
|
28
|
+
*/
|
|
29
|
+
static removeBlock(filePath: string, startMarker?: string, endMarker?: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Wrap content with markers
|
|
32
|
+
*/
|
|
33
|
+
private static wrapContent;
|
|
34
|
+
/**
|
|
35
|
+
* Escape special regex characters
|
|
36
|
+
*/
|
|
37
|
+
private static escapeRegex;
|
|
38
|
+
/**
|
|
39
|
+
* Basic markdown validation
|
|
40
|
+
*/
|
|
41
|
+
private static validateMarkdown;
|
|
42
|
+
/**
|
|
43
|
+
* Create default AGENTS.md content
|
|
44
|
+
*/
|
|
45
|
+
static getDefaultAgentsContent(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Create default CLAUDE.md content for Claude Code
|
|
48
|
+
*/
|
|
49
|
+
static getDefaultClaudeContent(): string;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=doc-injector.d.ts.map
|