/** Forward lifecycle order excluding terminal states */
const LIFECYCLE_STAGES = ['draft', 'review', 'approved', 'implementing', 'done'];
/** Maps each forward transition to a guided next action */
const NEXT_ACTION_MAP = {
    review: {
        step: 'Get approval',
        prompt: "Share this plan with your team or just tell me 'approved' to move forward",
        suggestedCommand: 'update_status(approved)',
        whenToDoIt: "When you're happy with the plan",
    },
    approved: {
        step: 'Create your git branch',
        prompt: 'Run: git checkout -b feat/<spec-slug>',
        suggestedCommand: 'manage_git(branch)',
        whenToDoIt: 'Before writing any code',
    },
    implementing: {
        step: 'Start coding',
        prompt: 'Implement the spec following the technical plan',
        suggestedCommand: 'validate(specId)',
        whenToDoIt: 'While developing',
    },
    done: {
        step: 'Validate your implementation',
        prompt: 'Run validate to check that your code matches the spec',
        suggestedCommand: 'validate(specId)',
        whenToDoIt: 'After all tests pass',
    },
    discarded: {
        step: 'Archive or delete spec',
        prompt: 'This spec has been discarded. You can delete it or keep it for reference.',
        suggestedCommand: 'delete_spec(specId)',
        whenToDoIt: 'When cleanup is needed',
    },
};
/**
 * Returns the guided next action for a given status transition.
 * The hint targets the *newStatus* reached, guiding what to do from there.
 */
export function buildNextAction(newStatus) {
    const hint = NEXT_ACTION_MAP[newStatus];
    if (hint !== undefined) {
        return hint;
    }
    // Fallback for any unrecognised status
    return {
        step: 'Continue',
        prompt: `Spec is now ${newStatus}. Check Planu for next steps.`,
        suggestedCommand: 'list_specs()',
        whenToDoIt: 'When ready',
    };
}
/**
 * Returns the lifecycle map for the given current status.
 * Shows where the spec is, what's next, and what remains.
 */
export function buildLifecycleMap(currentStatus) {
    const currentIdx = LIFECYCLE_STAGES.indexOf(currentStatus);
    if (currentIdx === -1) {
        // Terminal state (discarded) or unknown — show full chain as completed/irrelevant
        return {
            stages: LIFECYCLE_STAGES,
            current: currentStatus,
            next: null,
            remaining: [],
        };
    }
    const nextStatus = currentIdx < LIFECYCLE_STAGES.length - 1 ? (LIFECYCLE_STAGES[currentIdx + 1] ?? null) : null;
    const remaining = LIFECYCLE_STAGES.slice(currentIdx + 2);
    return {
        stages: LIFECYCLE_STAGES,
        current: currentStatus,
        next: nextStatus,
        remaining,
    };
}
//# sourceMappingURL=lifecycle-hints.js.map