mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 22:32:04 +00:00
- Added a new keyboard shortcut 'P' to open the project picker dropdown.
- Implemented functionality to select projects using number keys, allowing users to quickly switch between projects.
- Updated the feature list to include a new feature for project selection via keyboard shortcuts.
- Removed obsolete coding_prompt.md and added initializer_prompt.md for better session management.
- Introduced context management for features, enabling reading, writing, and deleting context files.
- Updated package dependencies to include @radix-ui/react-checkbox for enhanced UI components.
This commit enhances user experience by streamlining project selection and improves the overall feature management process.
🤖 Generated with Claude Code
72 lines
2.0 KiB
JavaScript
72 lines
2.0 KiB
JavaScript
const path = require("path");
|
|
const fs = require("fs/promises");
|
|
|
|
/**
|
|
* Context Manager - Handles reading, writing, and deleting context files for features
|
|
*/
|
|
class ContextManager {
|
|
/**
|
|
* Write output to feature context file
|
|
*/
|
|
async writeToContextFile(projectPath, featureId, content) {
|
|
if (!projectPath) return;
|
|
|
|
try {
|
|
const contextDir = path.join(projectPath, ".automaker", "agents-context");
|
|
|
|
// Ensure directory exists
|
|
try {
|
|
await fs.access(contextDir);
|
|
} catch {
|
|
await fs.mkdir(contextDir, { recursive: true });
|
|
}
|
|
|
|
const filePath = path.join(contextDir, `${featureId}.md`);
|
|
|
|
// Append to existing file or create new one
|
|
try {
|
|
const existing = await fs.readFile(filePath, "utf-8");
|
|
await fs.writeFile(filePath, existing + content, "utf-8");
|
|
} catch {
|
|
await fs.writeFile(filePath, content, "utf-8");
|
|
}
|
|
} catch (error) {
|
|
console.error("[ContextManager] Failed to write to context file:", error);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Read context file for a feature
|
|
*/
|
|
async readContextFile(projectPath, featureId) {
|
|
try {
|
|
const contextPath = path.join(projectPath, ".automaker", "agents-context", `${featureId}.md`);
|
|
const content = await fs.readFile(contextPath, "utf-8");
|
|
return content;
|
|
} catch (error) {
|
|
console.log(`[ContextManager] No context file found for ${featureId}`);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Delete agent context file for a feature
|
|
*/
|
|
async deleteContextFile(projectPath, featureId) {
|
|
if (!projectPath) return;
|
|
|
|
try {
|
|
const contextPath = path.join(projectPath, ".automaker", "agents-context", `${featureId}.md`);
|
|
await fs.unlink(contextPath);
|
|
console.log(`[ContextManager] Deleted agent context for feature ${featureId}`);
|
|
} catch (error) {
|
|
// File might not exist, which is fine
|
|
if (error.code !== 'ENOENT') {
|
|
console.error("[ContextManager] Failed to delete context file:", error);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = new ContextManager();
|