huskies: merge 542_refactor_add_doc_comments_to_all_undocumented_source_files_and_generate_source_map_in_readme

This commit is contained in:
dave
2026-04-12 13:11:23 +00:00
parent 6b1737d52d
commit cec62dad1c
99 changed files with 377 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
//! Agent log persistence — reads and writes JSONL agent event logs to disk.
use crate::agents::AgentEvent;
use chrono::Utc;
use serde::{Deserialize, Serialize};
+1
View File
@@ -1,3 +1,4 @@
//! Headless build-agent mode for distributed, rendezvous-based story processing.
/// Headless build agent mode.
///
/// When invoked via `huskies agent --rendezvous ws://host:3001/crdt-sync`, this
+1
View File
@@ -1,3 +1,4 @@
//! Acceptance gates — runs test suites and validation scripts in agent worktrees.
use std::path::Path;
use std::process::Command;
use std::time::Duration;
+1
View File
@@ -1,3 +1,4 @@
//! Story lifecycle helpers — file creation, archival, and stage transitions for pipeline items.
use std::path::Path;
use std::process::Command;
+1
View File
@@ -1,3 +1,4 @@
//! Merge operations — rebases agent work onto master and runs post-merge validation.
use std::path::Path;
use std::process::Command;
use std::sync::Mutex;
+1
View File
@@ -1,3 +1,4 @@
//! Agent subsystem — types, configuration, and orchestration for coding agents.
pub mod gates;
pub mod lifecycle;
pub mod merge;
+1
View File
@@ -1,3 +1,4 @@
//! Agent pool — manages the set of active agents across all pipeline stages.
mod auto_assign;
mod pipeline;
mod start;
@@ -1,3 +1,4 @@
//! Pipeline advance — moves stories forward through pipeline stages after agent completion.
use crate::config::ProjectConfig;
use crate::slog;
use crate::slog_error;
@@ -1,3 +1,4 @@
//! Agent completion handling — processes exit results and triggers pipeline advancement.
use crate::slog;
use crate::io::watcher::WatcherEvent;
use std::collections::HashMap;
+1
View File
@@ -1,3 +1,4 @@
//! Pipeline merge step — orchestrates the merge-to-master flow for completed stories.
use crate::slog;
use crate::slog_error;
use crate::slog_warn;
+1
View File
@@ -1,3 +1,4 @@
//! Pipeline operations — stage advancement, completion handling, and merge orchestration.
mod advance;
mod completion;
mod merge;
+1
View File
@@ -1,3 +1,4 @@
//! Process management — kills orphaned PTY child processes on server shutdown.
use crate::slog;
use super::AgentPool;
+1
View File
@@ -1,3 +1,4 @@
//! Pool queries — lists available agents, active agents, and agent info lookups.
use crate::config::ProjectConfig;
use std::path::PathBuf;
use tokio::sync::broadcast;
+1
View File
@@ -1,3 +1,4 @@
//! Agent start — spawns a new agent process in a worktree for a given story.
use crate::agent_log::AgentLogWriter;
use crate::config::ProjectConfig;
use crate::slog_error;
+1
View File
@@ -1,3 +1,4 @@
//! Agent stop — terminates a running agent while preserving its worktree.
use crate::slog;
use crate::slog_error;
use std::path::Path;
+1
View File
@@ -1,3 +1,4 @@
//! Test helpers for the agent pool — in-memory pool construction and assertions.
use crate::worktree::WorktreeInfo;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
+1
View File
@@ -1,3 +1,4 @@
//! Agent pool types — `AgentPool`, `StoryAgent`, and related data structures.
use crate::slog;
use crate::worktree::WorktreeInfo;
use std::collections::HashMap;
+1
View File
@@ -1,3 +1,4 @@
//! Agent wait — blocks until an agent reaches a terminal state with optional timeout.
use super::super::{AgentEvent, AgentInfo, AgentStatus};
use super::types::{agent_info_from_entry, composite_key};
use super::AgentPool;
+1
View File
@@ -1,3 +1,4 @@
//! Agent worktree management — creates and configures git worktrees for agents.
use crate::config::ProjectConfig;
use std::path::{Path, PathBuf};
+1
View File
@@ -1,3 +1,4 @@
//! PTY runner — spawns agent processes in pseudo-terminals and streams their output.
use std::collections::HashMap;
use std::io::{BufRead, BufReader};
use std::sync::{Arc, Mutex};
+1
View File
@@ -1,3 +1,4 @@
//! Claude Code runtime — launches Claude Code CLI sessions as agent backends.
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
+1
View File
@@ -1,3 +1,4 @@
//! Gemini runtime — drives Google Gemini API sessions as agent backends.
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
+1
View File
@@ -1,3 +1,4 @@
//! Agent runtimes — pluggable backends (Claude Code, Gemini, OpenAI) for running agents.
mod claude_code;
mod gemini;
mod openai;
+1
View File
@@ -1,3 +1,4 @@
//! OpenAI Codex runtime — drives OpenAI API sessions as agent backends.
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
+1
View File
@@ -1,3 +1,4 @@
//! Token usage tracking — persists per-agent token consumption records to disk.
use std::fs;
use std::path::Path;
@@ -1,3 +1,4 @@
//! Matrix bot context — shared state for the Matrix bot (rooms, history, permissions).
use crate::agents::AgentPool;
use crate::chat::timer::TimerStore;
use crate::chat::ChatTransport;
@@ -1,3 +1,4 @@
//! Matrix message formatting — Markdown-to-HTML conversion and startup announcements.
use pulldown_cmark::{Options, Parser, html};
/// Format the startup greeting the bot sends to each room when it comes online.
@@ -1,3 +1,4 @@
//! Matrix conversation history — per-room message history for LLM context.
use crate::slog;
use matrix_sdk::ruma::OwnedRoomId;
use serde::{Deserialize, Serialize};
@@ -1,3 +1,4 @@
//! Matrix mention detection — checks whether a message mentions the bot.
use matrix_sdk::ruma::events::room::message::{Relation, RoomMessageEventContentWithoutRelation};
use matrix_sdk::ruma::{OwnedEventId, OwnedUserId};
use std::collections::HashSet;
@@ -1,3 +1,4 @@
//! Matrix message handler — processes incoming room messages and dispatches commands.
use crate::chat::util::{drain_complete_paragraphs, is_permission_approval};
use crate::http::context::PermissionDecision;
use crate::llm::providers::claude_code::{ClaudeCodeProvider, ClaudeCodeResult};
@@ -1,3 +1,4 @@
//! Matrix bot — sub-modules for the Matrix chat bot implementation.
pub mod context;
pub mod format;
pub mod history;
@@ -1,3 +1,4 @@
//! Matrix bot run loop — connects to the homeserver and processes sync events.
use crate::agents::AgentPool;
use crate::slog;
use matrix_sdk::{Client, LoopCtrl, config::SyncSettings};
@@ -1,3 +1,4 @@
//! Matrix device verification — interactive emoji verification flow for E2EE.
use crate::slog;
use futures::StreamExt;
use matrix_sdk::Client;
@@ -1,3 +1,4 @@
//! Matrix transport configuration — deserialization of `bot.toml` Matrix settings.
use serde::Deserialize;
use std::path::Path;
+1
View File
@@ -1,3 +1,4 @@
//! Chat transports — pluggable backends (Matrix, Slack, WhatsApp, Discord) for bot messaging.
pub mod discord;
pub mod matrix;
pub mod slack;
@@ -1,3 +1,4 @@
//! WhatsApp command handling — processes incoming WhatsApp messages as bot commands.
use std::sync::Arc;
use crate::chat::transport::matrix::{ConversationEntry, ConversationRole, RoomConversation};
@@ -1,3 +1,4 @@
//! WhatsApp message formatting — Markdown-to-WhatsApp conversion and message chunking.
use regex::Regex;
use std::sync::LazyLock;
@@ -1,3 +1,4 @@
//! WhatsApp conversation history — per-number message history and messaging window tracking.
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::sync::Arc;
@@ -1,3 +1,4 @@
//! WhatsApp Meta (Cloud API) transport — sends and receives messages via the Meta Graph API.
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
@@ -1,3 +1,4 @@
//! WhatsApp Twilio transport — sends and receives messages via the Twilio API.
use async_trait::async_trait;
use serde::Deserialize;
+1
View File
@@ -1,3 +1,4 @@
//! Project configuration — parses `project.toml` for agents, components, and server settings.
use crate::slog;
use serde::Deserialize;
use std::collections::HashSet;
+1
View File
@@ -1,3 +1,4 @@
//! CRDT state layer — manages pipeline state as a conflict-free replicated document backed by SQLite.
/// CRDT state layer for pipeline state, backed by SQLite.
///
/// The CRDT document is the primary source of truth for pipeline item
+1
View File
@@ -1,3 +1,4 @@
//! CRDT sync — WebSocket-based replication of pipeline state between huskies nodes.
/// WebSocket-based CRDT sync layer for replicating pipeline state between
/// huskies nodes.
///
+1
View File
@@ -1,3 +1,4 @@
//! CRDT wire codec — serialization format for `SignedOp` sync messages between nodes.
/// Wire codec for `SignedOp` CRDT sync between nodes.
///
/// # Wire Format
+1
View File
@@ -1,3 +1,4 @@
//! SQLite storage layer — content store, shadow writes, and CRDT op persistence.
/// SQLite storage layer for pipeline state and story content.
///
/// The CRDT layer (`crdt_state`) is the primary source of truth for pipeline
+1
View File
@@ -1,3 +1,4 @@
//! HTTP agent endpoints — REST API for listing, starting, stopping, and inspecting agents.
use crate::config::ProjectConfig;
use crate::http::context::{AppContext, OpenApiResult, bad_request, not_found};
use crate::workflow::{StoryTestResults, TestCaseResult, TestStatus};
+1
View File
@@ -1,3 +1,4 @@
//! Agent SSE streaming — Server-Sent Events endpoint for real-time agent output.
use crate::http::context::AppContext;
use poem::handler;
use poem::http::StatusCode;
+1
View File
@@ -1,3 +1,4 @@
//! Anthropic API proxy — forwards model listing and key-validation requests to Anthropic.
use crate::http::context::{AppContext, OpenApiResult, bad_request};
use crate::llm::chat;
use crate::store::StoreOps;
+1
View File
@@ -1,3 +1,4 @@
//! Static asset serving — serves the embedded React frontend via `rust-embed`.
use poem::{
Response, handler,
http::{StatusCode, header},
+1
View File
@@ -1,3 +1,4 @@
//! HTTP chat endpoints — REST API for the LLM-powered chat interface.
use crate::http::context::{AppContext, OpenApiResult, bad_request};
use crate::llm::chat;
use poem_openapi::{OpenApi, Tags, payload::Json};
+1
View File
@@ -1,3 +1,4 @@
//! Application context — shared state (`AppContext`) threaded through all HTTP handlers.
use crate::agents::{AgentPool, ReconciliationEvent};
use crate::chat::timer::TimerStore;
use crate::io::watcher::WatcherEvent;
+1
View File
@@ -1,3 +1,4 @@
//! Health check endpoint — returns a static "ok" response.
use poem::handler;
use poem_openapi::{Object, OpenApi, Tags, payload::Json};
use serde::Serialize;
+1
View File
@@ -1,3 +1,4 @@
//! HTTP I/O endpoints — REST API for file and directory operations.
use crate::http::context::{AppContext, OpenApiResult, bad_request};
use crate::io::fs as io_fs;
use poem_openapi::{Object, OpenApi, Tags, payload::Json};
+1
View File
@@ -1,3 +1,4 @@
//! MCP agent tools — start, stop, wait, list, and inspect agents via MCP.
use crate::agents::PipelineStage;
use crate::config::ProjectConfig;
use crate::http::context::AppContext;
+1
View File
@@ -1,3 +1,4 @@
//! MCP diagnostic tools — server logs, CRDT dump, and story movement helpers.
use crate::agents::move_story_to_stage;
use crate::http::context::AppContext;
use crate::log_buffer;
+1
View File
@@ -1,3 +1,4 @@
//! MCP git tools — status, diff, add, commit, and log operations on agent worktrees.
use crate::http::context::AppContext;
use serde_json::{json, Value};
use std::path::PathBuf;
+1
View File
@@ -1,3 +1,4 @@
//! MCP merge tools — merge agent work to master and report merge failures.
use crate::agents::move_story_to_merge;
use crate::http::context::AppContext;
use crate::io::story_metadata::write_merge_failure;
+1
View File
@@ -1,3 +1,4 @@
//! MCP server — Model Context Protocol endpoint dispatching tool calls to handlers.
use crate::slog_warn;
use crate::http::context::AppContext;
use poem::handler;
+1
View File
@@ -1,3 +1,4 @@
//! MCP QA tools — request, approve, and reject QA reviews for stories.
use crate::agents::{move_story_to_merge, move_story_to_qa, reject_story_from_qa};
use crate::http::context::AppContext;
use crate::slog;
+1
View File
@@ -1,3 +1,4 @@
//! MCP shell tools — run commands, execute tests, and stream output via MCP.
use crate::http::context::AppContext;
use bytes::Bytes;
use futures::StreamExt;
+1
View File
@@ -1,3 +1,4 @@
//! MCP status tools — pipeline status, story triage, and acceptance criteria inspection.
use crate::http::context::AppContext;
use serde_json::{Value, json};
use std::fs;
+1
View File
@@ -1,3 +1,4 @@
//! MCP story tools — create, update, move, and manage stories, bugs, and refactors via MCP.
use crate::agents::{
close_bug_to_archive, feature_branch_has_unmerged_changes, move_story_to_done,
};
+1
View File
@@ -1,3 +1,4 @@
//! HTTP server — module declarations for all REST, MCP, WebSocket, and SSE endpoints.
pub mod agents;
pub mod agents_sse;
pub mod anthropic;
+1
View File
@@ -1,3 +1,4 @@
//! HTTP model endpoints — REST API for model selection and LLM provider management.
use crate::http::context::{AppContext, OpenApiResult, bad_request};
use crate::io::fs;
use crate::llm::chat;
+1
View File
@@ -1,3 +1,4 @@
//! OAuth endpoints — Anthropic OAuth callback and token exchange flow.
use crate::llm::oauth;
use crate::slog;
use poem::handler;
+1
View File
@@ -1,3 +1,4 @@
//! HTTP project endpoints — REST API for project initialization and context management.
use crate::http::context::{AppContext, OpenApiResult, bad_request};
use crate::io::fs;
use poem_openapi::{Object, OpenApi, Tags, payload::Json};
+1
View File
@@ -1,3 +1,4 @@
//! HTTP settings endpoints — REST API for user preferences and editor configuration.
use crate::http::context::{AppContext, OpenApiResult, bad_request};
use crate::store::StoreOps;
use poem_openapi::{Object, OpenApi, Tags, param::Query, payload::Json};
+1
View File
@@ -1,3 +1,4 @@
//! HTTP wizard endpoints — REST API for the project setup wizard.
use crate::http::context::{AppContext, OpenApiResult, bad_request, not_found};
use crate::io::wizard::{StepStatus, WizardState, WizardStep};
use poem_openapi::{Object, OpenApi, Tags, param::Path, payload::Json};
+1
View File
@@ -1,3 +1,4 @@
//! Bug operations — creates bug, refactor, and spike files in the pipeline.
use crate::io::story_metadata::parse_front_matter;
use std::path::Path;
+1
View File
@@ -1,3 +1,4 @@
//! Workflow helpers — shared story/bug file operations used by HTTP and MCP handlers.
mod bug_ops;
mod story_ops;
mod test_results;
+1
View File
@@ -1,3 +1,4 @@
//! Story operations — creates, updates, and manages acceptance criteria in story files.
use crate::io::story_metadata::set_front_matter_field;
use serde_json::Value;
use std::collections::HashMap;
+1
View File
@@ -1,3 +1,4 @@
//! Test result persistence — writes structured test results into story markdown files.
use crate::io::story_metadata::set_front_matter_field;
use crate::workflow::{StoryTestResults, TestCaseResult, TestStatus};
use std::path::Path;
+1
View File
@@ -1,3 +1,4 @@
//! WebSocket endpoint — real-time pipeline updates, chat, and permission prompts.
use crate::http::context::{AppContext, PermissionDecision};
use crate::http::workflow::{PipelineState, load_pipeline_state};
use crate::io::onboarding;
+1
View File
@@ -1,3 +1,4 @@
//! Filesystem file operations — read, write, list, and create files and directories.
use crate::state::SessionState;
use serde::Serialize;
use std::fs;
+1
View File
@@ -1,3 +1,4 @@
//! Filesystem I/O — module declarations and re-exports for file operations.
pub mod files;
pub mod paths;
pub mod preferences;
+1
View File
@@ -1,3 +1,4 @@
//! Path resolution — resolves CLI and session-relative paths to absolute paths.
use crate::state::SessionState;
use std::path::{Path, PathBuf};
+1
View File
@@ -1,3 +1,4 @@
//! User preferences — reads and writes model selection and other user settings.
use crate::store::StoreOps;
use serde_json::json;
+1
View File
@@ -1,3 +1,4 @@
//! Project management — tracks known projects and resolves the active project root.
use crate::state::SessionState;
use crate::store::StoreOps;
use serde_json::json;
+1
View File
@@ -1,3 +1,4 @@
//! Project scaffolding — creates the `.huskies/` directory structure and default files.
use std::fs;
use std::path::Path;
+1
View File
@@ -1,3 +1,4 @@
//! I/O subsystem — filesystem, shell, search, onboarding, and story metadata operations.
pub mod fs;
pub mod onboarding;
pub mod search;
+1
View File
@@ -1,3 +1,4 @@
//! Onboarding detection — checks whether scaffold templates have been customized.
use std::path::Path;
/// Sentinel comment injected as the first line of scaffold templates.
+1
View File
@@ -1,3 +1,4 @@
//! Code search — full-text search across project files using the `ignore` crate.
use crate::slog;
use crate::state::SessionState;
use ignore::WalkBuilder;
+1
View File
@@ -1,3 +1,4 @@
//! Shell command execution — runs commands in the project directory and captures output.
use crate::state::SessionState;
use serde::Serialize;
use std::path::PathBuf;
+1
View File
@@ -1,3 +1,4 @@
//! Story metadata — parses and modifies YAML front matter in story markdown files.
use serde::Deserialize;
use std::fs;
use std::path::Path;
+1
View File
@@ -1,3 +1,4 @@
//! Setup wizard — multi-step project onboarding flow with per-step status tracking.
use serde::{Deserialize, Serialize};
use serde_json;
use std::fs;
+1
View File
@@ -1,3 +1,4 @@
//! LLM chat — orchestrates multi-turn conversations with tool-calling LLM providers.
use crate::slog;
use crate::io::onboarding;
use crate::llm::prompts::{ONBOARDING_PROMPT, SYSTEM_PROMPT};
+1
View File
@@ -1,3 +1,4 @@
//! LLM subsystem — chat orchestration, prompts, OAuth, and provider integrations.
pub mod chat;
pub mod oauth;
pub mod prompts;
+1
View File
@@ -1,3 +1,4 @@
//! Anthropic OAuth — token refresh and credential management for Claude API access.
use crate::slog;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
+1
View File
@@ -1,3 +1,4 @@
//! System prompts — static prompt templates for the LLM chat and onboarding flows.
pub const SYSTEM_PROMPT: &str = r#"You are an AI Agent with direct access to the user's filesystem and development environment.
CRITICAL INSTRUCTIONS:
+1
View File
@@ -1,3 +1,4 @@
//! Anthropic provider — streaming completion client for the Claude Messages API.
use crate::llm::types::{
CompletionResponse, FunctionCall, Message, Role, ToolCall, ToolDefinition,
};
+1
View File
@@ -1,3 +1,4 @@
//! Claude Code provider — runs Claude Code CLI in a PTY and parses structured output.
use crate::slog;
use portable_pty::{CommandBuilder, PtySize, native_pty_system};
use std::io::{BufRead, BufReader};
+1
View File
@@ -1,3 +1,4 @@
//! LLM providers — module declarations for Anthropic, Claude Code, and Ollama backends.
pub mod anthropic;
pub mod claude_code;
pub mod ollama;
+1
View File
@@ -1,3 +1,4 @@
//! Ollama provider — streaming completion client for locally-hosted Ollama models.
use crate::llm::types::{
CompletionResponse, FunctionCall, Message, ModelProvider, Role, ToolCall, ToolDefinition,
};
+1
View File
@@ -1,3 +1,4 @@
//! LLM types — `Message`, `Role`, `ToolCall`, `ModelProvider`, and related data structures.
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
+2
View File
@@ -1,3 +1,5 @@
//! Huskies server — entry point, CLI argument parsing, and server startup.
// matrix-sdk-crypto's deeply nested types require a higher recursion limit
// when the `e2e-encryption` feature is enabled.
#![recursion_limit = "256"]
+1
View File
@@ -1,3 +1,4 @@
//! Session state — global mutable state shared across the server (project root, cancellation).
use std::path::PathBuf;
use std::sync::Mutex;
use tokio::sync::watch;
+1
View File
@@ -1,3 +1,4 @@
//! Key-value store — JSON-backed persistent storage for user settings and preferences.
use serde_json::Value;
use std::collections::HashMap;
use std::fs;
+1
View File
@@ -1,3 +1,4 @@
//! Git worktree management — creates, lists, and removes worktrees for agent isolation.
use crate::config::ProjectConfig;
use crate::slog;
use std::path::{Path, PathBuf};