view

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package view aggregates everything known about one requirement — tokens, files, tests, dependencies, spec/plan, diagrams, ticket link — into one bounded, agent-friendly answer. CANARY: REQ=CP-270; FEATURE="RequirementView"; ASPECT=CLI; STATUS=TESTED; TEST=TestCANARY_CBIN_204_BuildView,TestCANARY_CBIN_204_BuildView_DeclaredWording; UPDATED=2026-08-31 CANARY: REQ=ENG-4325; FEATURE="MigrateNotesView"; ASPECT=CLI; STATUS=TESTED; TEST=TestCANARY_CBIN_301_BuildView_MigrateNotes,TestCANARY_CBIN_301_BuildView_MigrateNotesCap; UPDATED=2026-08-29 CANARY: REQ=CP-278; FEATURE="DriftedView"; ASPECT=CLI; STATUS=TESTED; TEST=TestCANARY_CBIN_305_BuildView_Drifted,TestCANARY_CBIN_305_BuildView_NotDrifted,TestCANARY_CBIN_305_BuildView_NonGitRootSoftSkip; UPDATED=2026-08-29

Index

Constants

View Source
const DefaultViewLimit = 10

DefaultViewLimit bounds list sections (files, diagrams) by default; agents raise it with --limit when they need the full list.

Variables

This section is empty.

Functions

func CreateViewCommand

func CreateViewCommand() *cobra.Command

CreateViewCommand returns the `canary view` command.

Types

type View

type View struct {
	ReqID     string         `json:"req_id"`
	Source    string         `json:"source,omitempty"`
	TicketURL string         `json:"ticket_url,omitempty"`
	Statuses  map[string]int `json:"statuses"` // status -> token count
	// DeclaredCompletionPct is the percentage of tokens declaring
	// STATUS=TESTED or STATUS=BENCHED -- declared status, not verified
	// evidence (R-15). Renamed from "Completion" so the field name itself
	// cannot be misread as a verified completion percentage.
	DeclaredCompletionPct int      `json:"declared_completion_pct"`
	Features              []string `json:"features"` // "Feature (ASPECT, STATUS)"
	Files                 []string `json:"files"`    // capped at limit
	FilesTotal            int      `json:"files_total"`
	Tests                 []string `json:"tests"`
	Benches               []string `json:"benches,omitempty"`
	DependsOn             []string `json:"depends_on,omitempty"`
	Blocks                []string `json:"blocks,omitempty"`
	RelatedTo             []string `json:"related_to,omitempty"`
	SpecPath              string   `json:"spec_path,omitempty"`
	PlanPath              string   `json:"plan_path,omitempty"`
	Diagrams              []string `json:"diagrams,omitempty"` // "file:line"
	DiagramsTotal         int      `json:"diagrams_total,omitempty"`
	MigrateNotes          []string `json:"migrate_notes,omitempty"` // "file:line: text"
	MigrateNotesTotal     int      `json:"migrate_notes_total,omitempty"`
	Drifted               bool     `json:"drifted,omitempty"`
	DriftReason           string   `json:"drift_reason,omitempty"`
}

View is the aggregate answer for one requirement: everything an agent or a human needs to orient on CANARY tokens, files, tests, dependencies, spec/plan location, diagram refs, and (when configured) the owning ticket system — in one bounded call.

func BuildView

func BuildView(dbPath, root, projectID, reqID string, limit int) (*View, error)

BuildView assembles the view from the index DB plus filesystem conventions. The database is opened read-only: viewing a requirement never creates or migrates an index. projectID scopes the lookup; "" spans every project and reports storage.ErrProjectRequired when that would be ambiguous.

Jump to

Keyboard shortcuts

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