knowledgeops

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package knowledgeops owns allowlisted knowledge projection export rules behind the app.Service facade.

Command family: knowledge export-projection. Responsibility: dual-condition allowlist matching, refs-only projection entries, tombstone revocation, and digest-diff incremental selection. Prohibited dependencies: internal/cli, internal/output, direct stdout/stderr writes, provider token handling, external retrieval clients, vault or index writes. Focused tests: go test ./internal/app/knowledgeops ./internal/app ./cmd/pinax -run 'Knowledge' -count=1

Index

Constants

View Source
const (
	SchemaVersion = "pinax.knowledge_projection.v1"

	EmptyReasonAllowlistEmpty = "allowlist_empty"
	EmptyReasonNoMatch        = "no_dual_condition_match"

	EntryKindNote      = "note"
	EntryKindTombstone = "tombstone"

	AllowMarkerKey   = "knowledge_export"
	AllowMarkerValue = "allow"
)

Variables

This section is empty.

Functions

func HasAllowMarker

func HasAllowMarker(frontmatter map[string]string) bool

func NormalizeAllowlist

func NormalizeAllowlist(paths []string) []string

func ParseAllowlistFile

func ParseAllowlistFile(content string) []string

func PathAllowed

func PathAllowed(rel string, allowlist []string) bool

Types

type Audit

type Audit struct {
	AllowlistPaths       int `json:"allowlist_paths"`
	PathAllowlisted      int `json:"path_allowlisted"`
	Included             int `json:"included"`
	OmittedMissingMarker int `json:"omitted_missing_marker"`
	Tombstones           int `json:"tombstones"`
	Unchanged            int `json:"unchanged"`
	ReadNoteBodies       int `json:"read_note_bodies"`
}

type Candidate

type Candidate struct {
	Path        string
	NoteID      string
	Title       string
	Frontmatter map[string]string
	Digest      string
	ChangedAt   string
}

Candidate is a path-allowlisted note the facade already opened. Non-allowlisted note bodies never become candidates.

type ChunkRef

type ChunkRef struct {
	ChunkID string `json:"chunk_id"`
	Digest  string `json:"digest,omitempty"`
}

type Citation

type Citation struct {
	Title  string `json:"title,omitempty"`
	Path   string `json:"path"`
	NoteID string `json:"note_id,omitempty"`
}

type Entry

type Entry struct {
	Kind       string      `json:"kind"`
	Refs       Refs        `json:"refs"`
	Digest     string      `json:"digest"`
	Permission Permission  `json:"permission"`
	Citation   Citation    `json:"citation"`
	Freshness  Freshness   `json:"freshness"`
	Revocation *Revocation `json:"revocation,omitempty"`
}

func BuildNoteEntry

func BuildNoteEntry(candidate Candidate) Entry

func BuildTombstone

func BuildTombstone(prior Entry) Entry

func DigestDiff

func DigestDiff(current []Entry, prior *Package) (entries []Entry, unchanged, tombstones int)

func SelectCurrent

func SelectCurrent(candidates []Candidate) (entries []Entry, omittedMissingMarker int)

type Freshness

type Freshness struct {
	ContentDigest string `json:"content_digest"`
	ChangedAt     string `json:"changed_at,omitempty"`
}

type Package

type Package struct {
	SchemaVersion string  `json:"schema_version"`
	ExportedAt    string  `json:"exported_at"`
	EmptyReason   string  `json:"empty_reason,omitempty"`
	Entries       []Entry `json:"entries"`
	Audit         Audit   `json:"audit"`
}

func AssemblePackage

func AssemblePackage(exportedAt string, allowlist []string, pathAllowlisted, readBodies int, current []Entry, omittedMissingMarker int, prior *Package) Package

type Permission

type Permission struct {
	Export     string `json:"export"`
	Visibility string `json:"visibility"`
}

type Refs

type Refs struct {
	NoteID string     `json:"note_id,omitempty"`
	Path   string     `json:"path"`
	Source string     `json:"source"`
	Chunks []ChunkRef `json:"chunks,omitempty"`
}

type Revocation

type Revocation struct {
	Status string `json:"status"`
	Reason string `json:"reason,omitempty"`
}

Jump to

Keyboard shortcuts

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