Documentation
¶
Index ¶
- func ConfigPath() string
- func NewKGCmd(deps Deps) *cobra.Command
- func SaveKGConfig(cfg *KGConfig) error
- type BridgeIntentMapping
- type Deps
- type GlobalFlags
- type GraphHealth
- type GraphNote
- type GraphQuery
- type GraphQueryResponse
- type GraphQueryResult
- type IndexEntry
- type IngestResult
- type IntegrityManifest
- type IntegrityManifestEntry
- type KGAdapter
- type KGAdapterHealth
- type KGConfig
- type LintReport
- type LintResult
- type LocalFileAdapter
- type RawSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigPath ¶
func ConfigPath() string
ConfigPath returns the path to KG_HOME/self/config.yaml (used by other commands packages).
func SaveKGConfig ¶
SaveKGConfig writes cfg to KG_HOME/self/config.yaml.
Exported helper: callers outside this package (e.g. commands/) that need to persist the kg config call SaveKGConfig(cfg) and get the production IO wired in automatically. Internal kg call sites pass an explicit kgIO via saveKGConfigIO so a test fake threads through the same code path.
Types ¶
type BridgeIntentMapping ¶
type BridgeIntentMapping struct {
BridgeIntent string `json:"bridge_intent" yaml:"bridge_intent"`
KGIntents []string `json:"kg_intents" yaml:"kg_intents"`
}
BridgeIntentMapping maps one bridge intent to one or more KG query intents.
type Deps ¶
type Deps struct {
Flags GlobalFlags
ExampleBlock func(lines ...string) string
Store graphstore.Handle
IO kgIO
UsageError func(message string, hints ...string) error
ErrorWithHints func(message string, hints ...string) error
}
Deps carries UX helpers from commands without an import cycle.
gcc3 / di-refactor OD-1: Store is a contract-typed handle whose provider owns pooling and serialization. The Deps struct is justified as a holder of this contract-typed handle — it is NOT the concurrency story (the provider behind the contract is). graphstore.Handle's Store() accessor is nil-safe: when unset, callers fall back to their existing direct-open path via openKGStore (this preserves behavior for the gcc3 pass, which only pins the boundary; wiring every call site to read from the Deps handle is the deferred follow-up tracked on di-refactor OD-1 / the kg-pkg task on seam-interface-di-migration). See internal/graphstore/CONTRACT.md "Deps boundary".
IO is the kgIO collaborator (interface-DI per docs/TEST_SEAMS.md) used by every kg handler that needs filesystem / serialization IO. Production wires stdKGIO{} via cmd.go; tests construct a fakeKGIO and assign it on the Deps value before invoking the handler. When IO is the zero value (e.g. legacy call sites that have not been updated), kgIOFrom(deps) substitutes stdKGIO{} so the handlers never carry a nil collaborator.
type GlobalFlags ¶
GlobalFlags mirrors the subset of commands.Flags used by kg subcommands.
type GraphHealth ¶
type GraphHealth struct {
SchemaVersion int `json:"schema_version"`
Timestamp string `json:"timestamp"`
NoteCount int `json:"note_count"`
SourceCount int `json:"source_count"`
OrphanCount int `json:"orphan_count"`
BrokenLinkCount int `json:"broken_link_count"`
StaleCount int `json:"stale_count"`
ContradictionCount int `json:"contradiction_count"`
QueueDepth int `json:"queue_depth"`
Status string `json:"status"` // healthy|warn|error
Warnings []string `json:"warnings"`
}
GraphHealth is the schema for ops/health/graph-health.json
type GraphNote ¶
type GraphNote struct {
SchemaVersion int `json:"schema_version" yaml:"schema_version"`
ID string `json:"id" yaml:"id"`
Type string `json:"type" yaml:"type"` // source|entity|concept|synthesis|decision|repo|session
Title string `json:"title" yaml:"title"`
Summary string `json:"summary" yaml:"summary"`
Status string `json:"status" yaml:"status"` // draft|active|stale|superseded|archived
SourceRefs []string `json:"source_refs,omitempty" yaml:"source_refs,omitempty"`
Links []string `json:"links,omitempty" yaml:"links,omitempty"`
CreatedAt string `json:"created_at" yaml:"created_at"`
UpdatedAt string `json:"updated_at" yaml:"updated_at"`
Confidence string `json:"confidence,omitempty" yaml:"confidence,omitempty"` // low|medium|high
Version int `json:"version,omitempty" yaml:"version,omitempty"` // reserved for LWW sync
}
GraphNote represents the YAML frontmatter of a knowledge graph page.
type GraphQuery ¶
type GraphQuery struct {
Intent string `json:"intent"`
Query string `json:"query"`
Scope string `json:"scope,omitempty"`
Limit int `json:"limit"`
}
GraphQuery is the input to executeQuery.
type GraphQueryResponse ¶
type GraphQueryResponse struct {
SchemaVersion int `json:"schema_version"`
Intent string `json:"intent"`
Query string `json:"query"`
Results []GraphQueryResult `json:"results"`
Warnings []string `json:"warnings"`
Provider string `json:"provider"`
Timestamp string `json:"timestamp"`
// SparsityScore (0–100) indicates how incomplete the result set is.
// 0 = fully evidenced, 100 = no evidence found.
// Absent (omitted) when the query type does not support scoring.
SparsityScore *int `json:"sparsity_score,omitempty"`
}
GraphQueryResponse is the normalized response envelope.
type GraphQueryResult ¶
type GraphQueryResult struct {
ID string `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
Summary string `json:"summary"`
Path string `json:"path"`
SourceRefs []string `json:"source_refs,omitempty"`
QualifiedName string `json:"qualified_name,omitempty"`
Kind string `json:"kind,omitempty"`
FilePath string `json:"file_path,omitempty"`
LineStart int `json:"line_start,omitempty"`
LineEnd int `json:"line_end,omitempty"`
Language string `json:"language,omitempty"`
RiskScore float64 `json:"risk_score,omitempty"`
TestCoverage string `json:"test_coverage,omitempty"`
}
GraphQueryResult is one item in a query response.
type IndexEntry ¶
IndexEntry is one record in notes/index.md
type IngestResult ¶
type IngestResult struct {
SourceID string `json:"source_id"`
NotesCreated []string `json:"notes_created"`
NotesUpdated []string `json:"notes_updated"`
Warnings []string `json:"warnings"`
Errors []string `json:"errors"`
}
IngestResult summarizes what happened during an ingest run.
type IntegrityManifest ¶
type IntegrityManifest struct {
SchemaVersion int `json:"schema_version"`
UpdatedAt string `json:"updated_at"`
Notes map[string]IntegrityManifestEntry `json:"notes"`
}
IntegrityManifest maps note ID to its hash entry.
type IntegrityManifestEntry ¶
type IntegrityManifestEntry struct {
Hash string `json:"hash"`
UpdatedAt string `json:"updated_at"`
}
IntegrityManifestEntry holds the hash and timestamp for one note.
type KGAdapter ¶
type KGAdapter interface {
Name() string
Query(query GraphQuery) (GraphQueryResponse, error)
Health() (KGAdapterHealth, error)
Available() bool
}
KGAdapter is the interface for pluggable graph query backends.
type KGAdapterHealth ¶
type KGAdapterHealth struct {
AdapterName string `json:"adapter_name"`
Available bool `json:"available"`
LastQueryTime string `json:"last_query_time,omitempty"`
LastQueryStatus string `json:"last_query_status,omitempty"`
NoteCount int `json:"note_count"`
Warnings []string `json:"warnings,omitempty"`
}
KGAdapterHealth reports status for one adapter.
type KGConfig ¶
type KGConfig struct {
SchemaVersion int `json:"schema_version" yaml:"schema_version"`
Name string `json:"name" yaml:"name"`
Description string `json:"description" yaml:"description"`
AdaptersEnabled []string `json:"adapters_enabled" yaml:"adapters_enabled"`
CreatedAt string `json:"created_at" yaml:"created_at"`
UpdatedAt string `json:"updated_at" yaml:"updated_at"`
}
KGConfig is the schema for KG_HOME/self/config.yaml
type LintReport ¶
type LintReport struct {
Timestamp string `json:"timestamp"`
ChecksRun int `json:"checks_run"`
Results []LintResult `json:"results"`
ErrorCount int `json:"error_count"`
WarnCount int `json:"warn_count"`
InfoCount int `json:"info_count"`
}
LintReport is the full output of a lint run.
type LintResult ¶
type LintResult struct {
Check string `json:"check"`
Severity string `json:"severity"` // error|warn|info
Message string `json:"message"`
NoteID string `json:"note_id,omitempty"`
Path string `json:"path,omitempty"`
}
LintResult is one finding from a lint check.
type LocalFileAdapter ¶
type LocalFileAdapter struct {
// contains filtered or unexported fields
}
LocalFileAdapter wraps the Phase 3 index-based search as a KGAdapter.
func NewLocalFileAdapter ¶
func NewLocalFileAdapter(kgHome string) *LocalFileAdapter
func (*LocalFileAdapter) Available ¶
func (a *LocalFileAdapter) Available() bool
func (*LocalFileAdapter) Health ¶
func (a *LocalFileAdapter) Health() (KGAdapterHealth, error)
func (*LocalFileAdapter) Name ¶
func (a *LocalFileAdapter) Name() string
func (*LocalFileAdapter) Query ¶
func (a *LocalFileAdapter) Query(query GraphQuery) (GraphQueryResponse, error)
type RawSource ¶
type RawSource struct {
SchemaVersion int `json:"schema_version" yaml:"schema_version"`
ID string `json:"id" yaml:"id"`
Title string `json:"title" yaml:"title"`
SourceType string `json:"source_type" yaml:"source_type"` // markdown|pdf|text|url|transcript|meeting_notes|repo_doc
OriginalPath string `json:"original_path,omitempty" yaml:"original_path,omitempty"`
CapturedAt string `json:"captured_at" yaml:"captured_at"`
Status string `json:"status" yaml:"status"` // pending|imported|skipped
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
}
RawSource is the frontmatter for files in raw/inbox/.