pub struct AISpecWriter;Expand description
Manages AI-assisted spec writing with phase guidance and approval gates
Implementations§
Source§impl AISpecWriter
impl AISpecWriter
Sourcepub fn initialize_session(spec_id: &str, spec_name: &str) -> SpecWritingSession
pub fn initialize_session(spec_id: &str, spec_name: &str) -> SpecWritingSession
Sourcepub fn add_message(
session: &mut SpecWritingSession,
role: MessageRole,
content: &str,
) -> Result<(), SpecError>
pub fn add_message( session: &mut SpecWritingSession, role: MessageRole, content: &str, ) -> Result<(), SpecError>
Sourcepub fn get_phase_guidance(session: &SpecWritingSession) -> String
pub fn get_phase_guidance(session: &SpecWritingSession) -> String
Sourcepub fn analyze_gaps(session: &SpecWritingSession, spec: &Spec) -> GapAnalysis
pub fn analyze_gaps(session: &SpecWritingSession, spec: &Spec) -> GapAnalysis
Sourcepub fn request_approval(
session: &mut SpecWritingSession,
approver: &str,
feedback: Option<String>,
) -> Result<(), SpecError>
pub fn request_approval( session: &mut SpecWritingSession, approver: &str, feedback: Option<String>, ) -> Result<(), SpecError>
Requests approval for the current phase
Records approval with timestamp and approver information. Prevents phase transitions without explicit approval.
§Arguments
session- The spec writing sessionapprover- Name of the person approvingfeedback- Optional feedback on the phase
§Returns
Ok if approval is recorded, Err if approval fails
Sourcepub fn transition_to_next_phase(
session: &mut SpecWritingSession,
) -> Result<(), SpecError>
pub fn transition_to_next_phase( session: &mut SpecWritingSession, ) -> Result<(), SpecError>
Sourcepub fn can_transition(session: &SpecWritingSession) -> bool
pub fn can_transition(session: &SpecWritingSession) -> bool
Checks if phase transition is allowed
Returns true if current phase is approved and next phase exists.
Sourcepub fn get_conversation_history(
session: &SpecWritingSession,
) -> &[ConversationMessage]
pub fn get_conversation_history( session: &SpecWritingSession, ) -> &[ConversationMessage]
Gets the conversation history for context
Returns all messages in the session for AI context.
Sourcepub fn get_current_phase(session: &SpecWritingSession) -> SpecPhase
pub fn get_current_phase(session: &SpecWritingSession) -> SpecPhase
Gets the current phase
Sourcepub fn are_phases_approved_up_to(
session: &SpecWritingSession,
target_phase: SpecPhase,
) -> bool
pub fn are_phases_approved_up_to( session: &SpecWritingSession, target_phase: SpecPhase, ) -> bool
Checks if all phases up to a target phase are approved
Useful for validating that a session has completed required phases.
Sourcepub fn build_prompt_with_steering_context(
session: &SpecWritingSession,
global_steering: &Steering,
project_steering: &Steering,
user_input: &str,
) -> Result<String, SpecError>
pub fn build_prompt_with_steering_context( session: &SpecWritingSession, global_steering: &Steering, project_steering: &Steering, user_input: &str, ) -> Result<String, SpecError>
Builds an AI prompt with steering context included
Generates a prompt for AI spec writing that includes steering rules, standards, and templates. Project steering takes precedence over global steering.
§Arguments
session- The spec writing sessionglobal_steering- Global steering document (workspace-level)project_steering- Project steering document (project-level)user_input- The user’s input or question
§Returns
A formatted prompt string with steering context included
Sourcepub fn validate_spec_against_steering(
spec: &Spec,
steering: &Steering,
) -> Result<Vec<String>, SpecError>
pub fn validate_spec_against_steering( spec: &Spec, steering: &Steering, ) -> Result<Vec<String>, SpecError>
Applies steering rules to generated specs
Validates that generated specs conform to steering standards. Returns a list of violations if any steering rules are not followed.
§Arguments
spec- The generated spec to validatesteering- The steering document with rules and standards
§Returns
Ok with list of violations (empty if all rules are followed), or Err if validation fails
Trait Implementations§
Source§impl Clone for AISpecWriter
impl Clone for AISpecWriter
Source§fn clone(&self) -> AISpecWriter
fn clone(&self) -> AISpecWriter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more