@pimzino/claude-code-spec-workflow
Version: 
Automated workflows for Claude Code. Includes spec-driven development (Requirements → Design → Tasks → Implementation) with intelligent task execution, optional steering documents and streamlined bug fix workflow (Report → Analyze → Fix → Verify). We have
72 lines • 2.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SteeringLoader = void 0;
const fs_1 = require("fs");
const path_1 = require("path");
class SteeringLoader {
    constructor(projectRoot = process.cwd()) {
        const root = (0, path_1.normalize)(projectRoot.replace(/\\/g, '/'));
        this.steeringDir = (0, path_1.join)(root, '.claude', 'steering');
    }
    async loadSteeringDocuments() {
        const docs = {};
        try {
            // Check if steering directory exists
            await fs_1.promises.access(this.steeringDir);
            // Try to load each steering document
            const productPath = (0, path_1.join)(this.steeringDir, 'product.md');
            const techPath = (0, path_1.join)(this.steeringDir, 'tech.md');
            const structurePath = (0, path_1.join)(this.steeringDir, 'structure.md');
            try {
                docs.product = await fs_1.promises.readFile(productPath, 'utf-8');
            }
            catch {
                // Product doc not found, that's okay
            }
            try {
                docs.tech = await fs_1.promises.readFile(techPath, 'utf-8');
            }
            catch {
                // Tech doc not found, that's okay
            }
            try {
                docs.structure = await fs_1.promises.readFile(structurePath, 'utf-8');
            }
            catch {
                // Structure doc not found, that's okay
            }
        }
        catch {
            // Steering directory doesn't exist, return empty docs
        }
        return docs;
    }
    async steeringDocumentsExist() {
        try {
            await fs_1.promises.access(this.steeringDir);
            const files = await fs_1.promises.readdir(this.steeringDir);
            return files.some(file => ['product.md', 'tech.md', 'structure.md'].includes(file));
        }
        catch {
            return false;
        }
    }
    formatSteeringContext(docs) {
        const sections = [];
        if (docs.product) {
            sections.push('## Product Context\n' + docs.product);
        }
        if (docs.tech) {
            sections.push('## Technology Context\n' + docs.tech);
        }
        if (docs.structure) {
            sections.push('## Structure Context\n' + docs.structure);
        }
        if (sections.length === 0) {
            return '';
        }
        return '# Steering Documents Context\n\n' + sections.join('\n\n---\n\n');
    }
}
exports.SteeringLoader = SteeringLoader;
//# sourceMappingURL=steering.js.map