handler

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package handler — reconcile_handler.go exposes POST /api/tasks/reconcile-merged-prs. Closes the "PR merged but task still pending" gap (sprint feature/gtd-enforce-server-side GTD-fix 9/12).

Wire contract:

POST /api/tasks/reconcile-merged-prs
Content-Type: application/json
Body: {
  "merged_prs": [
    {
      "url": "https://github.com/owner/repo/pull/123",
      "head_ref": "feature/x",
      "merged_at": "2026-05-18T12:00:00Z",
      "title": "feat: x",
      "body": "Closes #42",
      "repo": "Wayne997035/wayneblacktea"
    }
  ]
}

200 OK:
{
  "matches":     [{"task_id":"...", "reason":"...", "pr_url":"...", "applied": true}],
  "ambiguous":   [{"task_id":"...", "reason":"...", "pr_url":"..."}],
  "applied":    N,
  "no_match":   N,
  "candidate_writes": N
}

Each entry in "matches" carries its own "applied" bool: a match can be present here (the exact-match matcher found it) yet "applied":false if the guarded UPDATE in BatchCompleteTasksByPRMatch skipped it (e.g. the task drifted away from pending/in_progress — TOCTOU guard) — see gtd.StoreIface.BatchCompleteTasksByPRMatch.

Index

Constants

View Source
const (
	// WbtSessionCookie is the name of the httpOnly browser session cookie.
	// Kept in sync with middleware.WbtSessionCookie — they share the same value.
	WbtSessionCookie = "wbt_session"
)

Variables

This section is empty.

Functions

func WithDecisionStore

func WithDecisionStore(d suggestionDecisionStore) learningHandlerOption

WithDecisionStore sets the decision store on the handler.

func WithKnowledgeStore

func WithKnowledgeStore(k knowledgeStore) learningHandlerOption

WithKnowledgeStore sets the knowledge store on the handler.

Types

type AuthSessionHandler

type AuthSessionHandler struct {
	// contains filtered or unexported fields
}

AuthSessionHandler issues browser session cookies so that the React SPA never needs to know the raw API_KEY.

func NewAuthSessionHandler

func NewAuthSessionHandler(apiKey string) *AuthSessionHandler

NewAuthSessionHandler creates an AuthSessionHandler using the given API key as the HMAC signing secret.

func (*AuthSessionHandler) IssueSession

func (h *AuthSessionHandler) IssueSession(c echo.Context) error

IssueSession signs a short-lived session token with HMAC-SHA256(apiKey, ts) and sets it as an httpOnly, Secure, SameSite=Strict cookie. The caller must present the raw API key in the X-API-Key header; this prevents unauthenticated third parties from minting session cookies.

type AutologHandler

type AutologHandler struct {
	// contains filtered or unexported fields
}

AutologHandler handles the /api/activity and /api/auto-handoff endpoints.

func NewAutologHandler

func NewAutologHandler(
	g autologGTDStore,
	s autologSessionStore,
	d autologDecisionStore,
	sum *ai.Summarizer,
) *AutologHandler

NewAutologHandler creates an AutologHandler. sum may be nil — when nil, AI enrichment is disabled and the handler falls back to the mechanical "Auto-handoff: in_progress=[...]" summary. classifier is wired when CLAUDE_API_KEY is set; nil disables auto-decision capture.

func NewAutologHandlerWithClassifier

func NewAutologHandlerWithClassifier(
	g autologGTDStore,
	s autologSessionStore,
	d autologDecisionStore,
	sum *ai.Summarizer,
	clf *ai.ActivityClassifier,
) *AutologHandler

NewAutologHandlerWithClassifier creates an AutologHandler with both summarizer and classifier. Used by main.go when CLAUDE_API_KEY is configured; clf may be nil to disable auto-capture.

func NewAutologHandlerWithClassifierAndProposal

func NewAutologHandlerWithClassifierAndProposal(
	g autologGTDStore,
	s autologSessionStore,
	d autologDecisionStore,
	sum *ai.Summarizer,
	clf *ai.ActivityClassifier,
	proposalStore autologProposalStore,
) *AutologHandler

NewAutologHandlerWithClassifierAndProposal extends NewAutologHandlerWithClassifier by also wiring the proposal store. When proposalStore is non-nil, IsTask=true classifier verdicts go through the TypeTask proposal queue for user review (TASK 2 of feature/gtd-enforce-server-side); when nil the legacy direct-task path is preserved so existing callers / tests are unaffected.

func (*AutologHandler) AutoHandoff

func (h *AutologHandler) AutoHandoff(c echo.Context) error

AutoHandoff handles POST /api/auto-handoff. It reads in-progress tasks and recent decisions, then creates a session handoff row. When a transcript is provided and a summarizer is configured, the handoff includes an AI-generated summary and any implicitly decided architectural decisions.

func (*AutologHandler) LogActivity

func (h *AutologHandler) LogActivity(c echo.Context) error

LogActivity handles POST /api/activity.

type ContextHandler

type ContextHandler struct {
	// contains filtered or unexported fields
}

ContextHandler handles the /api/context endpoints.

func NewContextHandler

func NewContextHandler(g gtdStore, s sessionStore) *ContextHandler

NewContextHandler creates a ContextHandler.

func (*ContextHandler) GetTodayContext

func (h *ContextHandler) GetTodayContext(c echo.Context) error

GetTodayContext returns active goals, projects, weekly progress and pending handoff.

func (*ContextHandler) WithSnapshotStore

func (h *ContextHandler) WithSnapshotStore(store snapshot.StoreIface) *ContextHandler

WithSnapshotStore wires an optional snapshot store for latest-status enrichment.

type DashboardAICostStoreIface

type DashboardAICostStoreIface = dashboardAICostStore

DashboardAICostStoreIface is the exported alias for cmd/server wiring.

type DashboardActivityStoreIface

type DashboardActivityStoreIface = dashboardActivityStore

DashboardActivityStoreIface is the exported alias of dashboardActivityStore for use by cmd/server/main.go when wiring the concrete store implementation.

type DashboardHandler

type DashboardHandler struct {
	// contains filtered or unexported fields
}

DashboardHandler handles the /api/dashboard/* endpoints.

func NewDashboardHandler

func NewDashboardHandler(g dashboardGTDStore, d dashboardDecisionStore, p dashboardProposalStore) *DashboardHandler

NewDashboardHandler creates a DashboardHandler.

func (*DashboardHandler) GetAICost

func (h *DashboardHandler) GetAICost(c echo.Context) error

GetAICost handles GET /api/dashboard/ai-cost. Returns per-model token totals and computed USD costs for the last 30 days. When the PG pool is unavailable (SQLite dev) the aiCost store is nil and the endpoint returns an empty response (graceful degrade).

func (*DashboardHandler) GetAutomationFeed

func (h *DashboardHandler) GetAutomationFeed(c echo.Context) error

GetAutomationFeed handles GET /api/dashboard/automation-feed?limit=20. limit must be 1-50 (default 20); values outside range → 400. Returns recent MCP automation actions from activity_log, most-recent first.

func (*DashboardHandler) GetAutomationHealth

func (h *DashboardHandler) GetAutomationHealth(c echo.Context) error

GetAutomationHealth handles GET /api/dashboard/automation-health. It lists pending candidates, counts pending proposals, checks whether the latest session handoff is stale, and reports dashboard reconcile freshness.

func (*DashboardHandler) GetNextTask

func (h *DashboardHandler) GetNextTask(c echo.Context) error

GetNextTask handles GET /api/dashboard/next-task. Returns 200 with {"task": <db.Task>} when a pending task exists, or {"task": null} when none exist. Store errors yield 500.

func (*DashboardHandler) GetRecentDecisions

func (h *DashboardHandler) GetRecentDecisions(c echo.Context) error

GetRecentDecisions handles GET /api/dashboard/recent-decisions?limit=10. limit is capped at 100 to prevent DoS.

func (*DashboardHandler) GetStats

func (h *DashboardHandler) GetStats(c echo.Context) error

GetStats handles GET /api/dashboard/stats?period=7 (or period=30). It returns completed task count (this week), total active task count, decision count (up to periodLimit), and pending proposal count.

func (*DashboardHandler) GetUpcoming

func (h *DashboardHandler) GetUpcoming(c echo.Context) error

GetUpcoming handles GET /api/dashboard/upcoming. It returns a flat JSON array of pending/in_progress tasks with due_date in the next 7 days (server-side hardcoded window), ordered by due_date ASC. Workspace isolation is enforced by the store — no workspace input from request.

func (*DashboardHandler) GetUpcomingTasks

func (h *DashboardHandler) GetUpcomingTasks(c echo.Context) error

GetUpcomingTasks handles GET /api/dashboard/upcoming-tasks.

Query params:

  • days: 1-14 (default 7) — how far ahead the "upcoming" window extends
  • limit: 1-50 (default 10) — total tasks across all groups
  • tz: IANA timezone name (default "UTC") — used for day-boundary calculation

func (*DashboardHandler) SetAICostStore

func (h *DashboardHandler) SetAICostStore(s dashboardAICostStore)

SetAICostStore wires the AI cost store into the dashboard handler.

func (*DashboardHandler) SetActivityStore

func (h *DashboardHandler) SetActivityStore(s dashboardActivityStore)

SetActivityStore wires the activity store into the dashboard handler.

func (*DashboardHandler) SetCandidateStore

func (h *DashboardHandler) SetCandidateStore(s candidateStore)

SetCandidateStore wires the completion candidate store into the dashboard handler.

func (*DashboardHandler) SetHandoffStore

func (h *DashboardHandler) SetHandoffStore(s automationHandoffStore)

SetHandoffStore wires the session handoff store into the dashboard handler.

type DecisionHandler

type DecisionHandler struct {
	// contains filtered or unexported fields
}

DecisionHandler handles the /api/decisions endpoints.

func NewDecisionHandler

func NewDecisionHandler(s decisionStore) *DecisionHandler

NewDecisionHandler creates a DecisionHandler.

func (*DecisionHandler) ListDecisions

func (h *DecisionHandler) ListDecisions(c echo.Context) error

ListDecisions returns decisions, optionally filtered by repo_name or project_id query params. The ?limit= query parameter controls how many results to return (default 20, max 100).

func (*DecisionHandler) LogDecision

func (h *DecisionHandler) LogDecision(c echo.Context) error

LogDecision records a new architectural decision.

type GTDHandler

type GTDHandler struct {
	// contains filtered or unexported fields
}

GTDHandler handles all GTD-domain endpoints.

func NewGTDHandler

func NewGTDHandler(s gtdStore) *GTDHandler

NewGTDHandler creates a GTDHandler.

func (*GTDHandler) CompleteTask

func (h *GTDHandler) CompleteTask(c echo.Context) error

CompleteTask marks a task as completed. If the artifact is a GitHub PR URL or a 40-hex commit SHA, the corresponding task fields (pr_url / commit_shas) are updated as a side-effect so the HTTP path stays in parity with the MCP complete_task tool. SECURITY: only the string is stored — no HTTP fetch is made.

func (*GTDHandler) CreateGoal

func (h *GTDHandler) CreateGoal(c echo.Context) error

CreateGoal inserts a new goal.

func (*GTDHandler) CreateProject

func (h *GTDHandler) CreateProject(c echo.Context) error

CreateProject inserts a new project.

func (*GTDHandler) CreateTask

func (h *GTDHandler) CreateTask(c echo.Context) error

CreateTask inserts a new task.

func (*GTDHandler) GetProject

func (h *GTDHandler) GetProject(c echo.Context) error

GetProject returns a single project by ID (UUID path param).

func (*GTDHandler) ListGoals

func (h *GTDHandler) ListGoals(c echo.Context) error

ListGoals returns all active goals.

func (*GTDHandler) ListProjectTasks

func (h *GTDHandler) ListProjectTasks(c echo.Context) error

ListProjectTasks returns tasks for a specific project.

Query params:

  • status=all → return every task regardless of status, ordered by COALESCE(updated_at, created_at) DESC. Used by the project-detail UI to render the "completed" section.
  • any other value (or unset) → default behaviour: only pending / in_progress tasks. Preserves the prior contract so existing GTD list pages do not regress.

Unknown status values are treated as the default rather than 400 so future clients passing experimental filters degrade gracefully; the only opt-in is the explicit `all` token.

func (*GTDHandler) ListProjects

func (h *GTDHandler) ListProjects(c echo.Context) error

ListProjects returns projects filtered by the status query param (default: active, same as the historical contract).

Query params:

  • status unset or "active" → active only (unchanged default; existing callers that don't pass status see byte-identical results).
  • status=all → every status, so completed/archived/on_hold projects are included (this is what makes a completed project like wbt-core-mvp visible again).
  • status=completed|archived|on_hold → exact match.
  • any other value → 400 (previously there was no filter capability at all — ListActiveProjects always ran regardless of any query param — so an invalid value here is a new failure mode, not a regression: nothing that worked before now fails).

func (*GTDHandler) ListTasks

func (h *GTDHandler) ListTasks(c echo.Context) error

ListTasks returns tasks filtered by the status query param (default: pending/in_progress, same as the historical contract), optionally further filtered by branch_name or pr_url query parameters. The branch/pr_url filter is applied Go-side after fetching (personal-scale, low row count).

Query params:

  • status unset or "active" → pending + in_progress (unchanged default; existing callers that don't pass status see byte-identical results).
  • status=all → every status, so completed/cancelled tasks are included. Mirrors the ?status=all contract already used by GET /api/projects/:id/tasks and the list_tasks MCP tool.
  • status=pending|in_progress|completed|cancelled → exact match.
  • any other value → 400 (previously silently ignored, which is the bug this fixes: a caller passing an unrecognised status believed it was filtering when the server silently returned the unfiltered default).

func (*GTDHandler) UpdateGoal

func (h *GTDHandler) UpdateGoal(c echo.Context) error

UpdateGoal handles PATCH /api/goals/:id — full update of a goal's mutable fields.

func (*GTDHandler) UpdateProject

func (h *GTDHandler) UpdateProject(c echo.Context) error

UpdateProject handles PATCH /api/projects/:id — full update of a project's mutable fields.

func (*GTDHandler) UpdateTask

func (h *GTDHandler) UpdateTask(c echo.Context) error

UpdateTask handles PATCH /api/tasks/:id — partial update of a task's mutable fields. At least one field must be provided. status="completed" is rejected (use CompleteTask).

type KnowledgeHandler

type KnowledgeHandler struct {
	// contains filtered or unexported fields
}

KnowledgeHandler handles all Knowledge-domain endpoints.

func NewKnowledgeHandler

func NewKnowledgeHandler(s knowledgeStore, p proposalStore) *KnowledgeHandler

NewKnowledgeHandler creates a KnowledgeHandler. proposal may be nil to opt out of the auto-propose-concept-card behaviour (mainly for tests).

func (*KnowledgeHandler) AddKnowledge

func (h *KnowledgeHandler) AddKnowledge(c echo.Context) error

AddKnowledge creates a new knowledge item.

func (*KnowledgeHandler) ListKnowledge

func (h *KnowledgeHandler) ListKnowledge(c echo.Context) error

ListKnowledge returns knowledge items with optional pagination.

func (*KnowledgeHandler) SearchKnowledge

func (h *KnowledgeHandler) SearchKnowledge(c echo.Context) error

SearchKnowledge searches knowledge items by full-text query.

func (*KnowledgeHandler) UpdateLearningValue

func (h *KnowledgeHandler) UpdateLearningValue(c echo.Context) error

UpdateLearningValue handles PATCH /api/knowledge/:id. Body: { "learning_value": N } where 1 ≤ N ≤ 5.

func (*KnowledgeHandler) WithAtomizer

func (h *KnowledgeHandler) WithAtomizer(fn func(string, uuid.UUID, string)) *KnowledgeHandler

WithAtomizer injects a background atomization function so HTTP-added knowledge enters the same digestion pipeline as MCP-added knowledge.

type LearningHandler

type LearningHandler struct {
	// contains filtered or unexported fields
}

LearningHandler handles all Learning-domain endpoints.

func NewLearningHandler

func NewLearningHandler(s learningStore, opts ...learningHandlerOption) *LearningHandler

NewLearningHandler creates a LearningHandler with optional knowledge and decision stores for the suggestions and from-knowledge endpoints. knowledge and decisions may be nil; those endpoints will return 501 when absent.

func (*LearningHandler) CreateConcept

func (h *LearningHandler) CreateConcept(c echo.Context) error

CreateConcept inserts a new concept with an initial review schedule.

func (*LearningHandler) CreateConceptFromKnowledge

func (h *LearningHandler) CreateConceptFromKnowledge(c echo.Context) error

CreateConceptFromKnowledge creates a learning concept from an existing knowledge item in one click.

func (*LearningHandler) GetDueReviews

func (h *LearningHandler) GetDueReviews(c echo.Context) error

GetDueReviews returns concepts currently due for review.

func (*LearningHandler) GetHistory

func (h *LearningHandler) GetHistory(c echo.Context) error

GetHistory handles GET /api/learning/history?status=all|new|learning|reviewing|mastered|reviewed.

func (*LearningHandler) GetStats

func (h *LearningHandler) GetStats(c echo.Context) error

GetStats handles GET /api/learning/stats.

func (*LearningHandler) GetSuggestions

func (h *LearningHandler) GetSuggestions(c echo.Context) error

GetSuggestions returns AI-curated concept suggestions from the knowledge base and recent decisions.

func (*LearningHandler) SubmitReview

func (h *LearningHandler) SubmitReview(c echo.Context) error

SubmitReview applies an FSRS rating for a scheduled review.

type PostToolUseHandler

type PostToolUseHandler struct {
	// contains filtered or unexported fields
}

PostToolUseHandler handles POST /api/activity/posttooluse. It enqueues events into a buffered channel (fire-and-forget from the HTTP handler's perspective) and a background worker drains them to activity_log.

func NewPostToolUseHandler

func NewPostToolUseHandler(g autologGTDStore) *PostToolUseHandler

NewPostToolUseHandler creates a PostToolUseHandler and starts the background drain worker. Call Stop() to shut it down gracefully.

func (*PostToolUseHandler) PostToolUse

func (h *PostToolUseHandler) PostToolUse(c echo.Context) error

PostToolUse handles POST /api/activity/posttooluse. It reads the request, validates minimal fields, enqueues the event, and returns 202 immediately. The actual DB write happens in the drain worker.

func (*PostToolUseHandler) Stop

func (h *PostToolUseHandler) Stop()

Stop signals the drain worker to exit and waits for the flush to complete. It blocks until drainWorker has finished persisting all queued events so that in-flight events are never lost on server shutdown.

type ProposalHandler

type ProposalHandler struct {
	// contains filtered or unexported fields
}

ProposalHandler exposes GET /api/proposals/pending and POST /api/proposals/:id/confirm.

func NewProposalHandler

func NewProposalHandler(p proposalListStore, l proposalConceptStore) *ProposalHandler

NewProposalHandler creates a ProposalHandler. Decision-proposal accept will fail with 500 unless WithDecision is also used (see NewProposalHandlerWithDecision).

func (*ProposalHandler) ConfirmBatch

func (h *ProposalHandler) ConfirmBatch(c echo.Context) error

ConfirmBatch handles POST /api/proposals/confirm-batch. Body: { "ids": ["uuid1","uuid2",...], "action": "accept" | "reject" } For each accepted concept proposal the handler materialises a Concept entity. Concept creation failures are non-fatal.

func (*ProposalHandler) ConfirmProposal

func (h *ProposalHandler) ConfirmProposal(c echo.Context) error

ConfirmProposal handles POST /api/proposals/:id/confirm. Body: { "action": "accept" | "reject" }

func (*ProposalHandler) ListPendingProposals

func (h *ProposalHandler) ListPendingProposals(c echo.Context) error

ListPendingProposals handles GET /api/proposals/pending. Accepts optional ?type=concept query param to filter by type.

func (*ProposalHandler) ListProposals

func (h *ProposalHandler) ListProposals(c echo.Context) error

ListProposals handles GET /api/proposals?status=pending|accepted|rejected|all. Omitting ?status defaults to "pending" for backward compat with the old endpoint. The ?type= param is also supported to filter by proposal type.

func (*ProposalHandler) WithDecision

func (h *ProposalHandler) WithDecision(d proposalDecisionStore) *ProposalHandler

WithDecision wires the decision store used by the TypeDecision accept path. Returns the handler for chaining. nil decision = decision-accept disabled.

func (*ProposalHandler) WithGoalProjectAccept

func (h *ProposalHandler) WithGoalProjectAccept(f goalProjectAcceptAdapterFactory) *ProposalHandler

WithGoalProjectAccept wires the factory used to construct a fresh proposal.AcceptAdapter per accept call for TypeGoal / TypeProject proposals, routing them through the same atomic proposal.AcceptOrchestration flow the MCP path uses. Returns the handler for chaining. nil (the zero value) falls back to the legacy resolve-only branch — mirrors WithTask's nil h.task fallback.

func (*ProposalHandler) WithKnowledge

func (h *ProposalHandler) WithKnowledge(k proposalKnowledgeStore) *ProposalHandler

WithKnowledge wires the knowledge store used by the TypeKnowledge accept path. Returns the handler for chaining. nil knowledge = knowledge-accept disabled.

func (*ProposalHandler) WithTask

func (h *ProposalHandler) WithTask(t proposalTaskStore) *ProposalHandler

WithTask wires the gtd store used by the TypeTask accept path (TASK 3 of feature/gtd-enforce-server-side). Returns the handler for chaining. nil = TypeTask accept falls back to the legacy resolve-only branch.

type ReconcileHandler

type ReconcileHandler struct {
	// contains filtered or unexported fields
}

ReconcileHandler exposes POST /api/tasks/reconcile-merged-prs.

func NewReconcileHandler

func NewReconcileHandler(g gtd.StoreIface, c completioncandidate.Store) *ReconcileHandler

NewReconcileHandler wires the GTD store + completion-candidate store into the handler. candidate MAY be nil — in that case auto-close still happens and the candidate-write step is a no-op (the GTD store carries the audit via activity_log, so the candidate row is supplementary).

The merged_prs_observed persistence (Phase 2 fuzzy-match audit trail) is wired separately via WithMergedPRsStore so existing tests that only need the exact-match path don't have to construct that store. Both stores can be nil — exact-match continues to work; only fuzzy candidates require the candidate store, and the audit trail requires the merged_prs store.

func (*ReconcileHandler) Reconcile

func (h *ReconcileHandler) Reconcile(c echo.Context) error

Reconcile handles POST /api/tasks/reconcile-merged-prs.

func (*ReconcileHandler) WithMergedPRsStore

func (h *ReconcileHandler) WithMergedPRsStore(m mergedprs.Store) *ReconcileHandler

WithMergedPRsStore wires the merged_prs_observed store into the handler so every incoming PR is persisted (idempotent on URL conflict) and so the Phase 2 fuzzy candidate detection can surface null-linkage matches. Returns the receiver to enable fluent wiring at construction time.

type SearchHandler

type SearchHandler struct {
	// contains filtered or unexported fields
}

SearchHandler handles cross-entity semantic search.

func NewSearchHandler

func NewSearchHandler(k searchKnowledgeStore, d searchDecisionStore, g searchGTDStore) *SearchHandler

NewSearchHandler creates a SearchHandler with the provided narrow-interface stores.

func (*SearchHandler) Search

func (h *SearchHandler) Search(c echo.Context) error

Search handles GET /api/search?q=... It searches knowledge items (semantic), decisions (substring), and tasks (substring), and returns a unified result list.

type SearchResult

type SearchResult struct {
	Type    string    `json:"type"`
	ID      uuid.UUID `json:"id"`
	Title   string    `json:"title"`
	Content string    `json:"content"`
	Score   *float32  `json:"score"`
}

SearchResult is a unified result entry across entity types.

type TimelineHandler

type TimelineHandler struct {
	// contains filtered or unexported fields
}

TimelineHandler handles the aggregated timeline endpoint.

func NewTimelineHandler

func NewTimelineHandler(agg timelineAggregator) *TimelineHandler

NewTimelineHandler creates a TimelineHandler backed by the given aggregator.

func (*TimelineHandler) GetTimeline

func (h *TimelineHandler) GetTimeline(c echo.Context) error

GetTimeline handles GET /api/timeline?from=<RFC3339>&to=<RFC3339>.

Both params are optional:

  • Absent → default: to=now, from=now-30days.
  • Range > 366 days → 400.
  • Unparseable date → 400.

type VisionHandler

type VisionHandler struct {
	// contains filtered or unexported fields
}

VisionHandler handles all vision-domain endpoints.

func NewVisionHandler

func NewVisionHandler(s visionStore) *VisionHandler

NewVisionHandler creates a VisionHandler.

func (*VisionHandler) AddVision

func (h *VisionHandler) AddVision(c echo.Context) error

AddVision creates a new vision item.

func (*VisionHandler) ListVision

func (h *VisionHandler) ListVision(c echo.Context) error

ListVision returns vision items optionally filtered by status and/or initiative.

func (*VisionHandler) UpdateVision

func (h *VisionHandler) UpdateVision(c echo.Context) error

UpdateVision patches a vision item's status or context.

type WorkspaceHandler

type WorkspaceHandler struct {
	// contains filtered or unexported fields
}

WorkspaceHandler handles the /api/workspace endpoints.

func NewWorkspaceHandler

func NewWorkspaceHandler(s workspaceStore) *WorkspaceHandler

NewWorkspaceHandler creates a WorkspaceHandler.

func (*WorkspaceHandler) GetSettings

func (h *WorkspaceHandler) GetSettings(c echo.Context) error

GetSettings returns the workspace's AI model preference.

func (*WorkspaceHandler) ListRepos

func (h *WorkspaceHandler) ListRepos(c echo.Context) error

ListRepos returns all active repos.

func (*WorkspaceHandler) PatchSettings

func (h *WorkspaceHandler) PatchSettings(c echo.Context) error

PatchSettings updates the workspace's AI model preference. The model MUST be in workspace.AllowedModels (explicit whitelist — arbitrary strings rejected).

func (*WorkspaceHandler) UpsertRepo

func (h *WorkspaceHandler) UpsertRepo(c echo.Context) error

UpsertRepo creates or updates a repo.

type WorkspaceOverviewHandler

type WorkspaceOverviewHandler struct {
	// contains filtered or unexported fields
}

WorkspaceOverviewHandler serves GET /api/workspace/repos/:id/overview, the drill-down view for a single repo card on /workspace.

Workspace scoping is automatic: every backing Store is constructed with the process workspaceID at startup (see internal/storage/factory.go) so all reads here are filtered by workspace_id without any request-side input.

func NewWorkspaceOverviewHandler

func NewWorkspaceOverviewHandler(
	w repoOverviewWorkspaceStore,
	g repoOverviewGTDStore,
	d repoOverviewDecisionStore,
	s repoOverviewSessionStore,
) *WorkspaceOverviewHandler

NewWorkspaceOverviewHandler constructs the handler with the four narrow store interfaces it needs. Pass concrete *Store values from cmd/server.

func (*WorkspaceOverviewHandler) GetRepoOverview

func (h *WorkspaceOverviewHandler) GetRepoOverview(c echo.Context) error

GetRepoOverview handles GET /api/workspace/repos/:id/overview.

400 — id path param is not a valid UUID. 404 — repo not found in the configured workspace. 200 — overview payload (lists may be empty, never null).

Implementation: looks up the repo by id (workspace-scoped), then resolves the matching project by repo.name (project-name == repo-name convention). Decisions and handoffs are looked up by repo.name (TEXT). When no project matches the repo, task and activity lists are empty (not an error) so the UI degrades gracefully for repos that have not yet been mirrored as a GTD project.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL