docs

package
v0.2.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateFullHash

func CalculateFullHash(filePath string) (string, error)

CalculateFullHash returns full 64-character SHA256 hash. Use this for database storage if full hash precision is needed.

func CalculateHash

func CalculateHash(filePath string) (string, error)

CalculateHash computes SHA256 hash of documentation file with line ending normalization. Returns first 16 characters (64 bits) for abbreviated display in CANARY tokens.

Line endings are normalized to LF (\n) before hashing to ensure cross-platform consistency between Windows (CRLF) and Unix/Mac (LF) systems.

Example:

hash, err := docs.CalculateHash("docs/user/auth.md")
// Returns: "8f434346648f6b96" (first 16 chars of SHA256)

func CheckMultipleDocumentation

func CheckMultipleDocumentation(token *storage.Token) (map[string]string, error)

CheckMultipleDocumentation handles tokens with multiple DOC paths (comma-separated). Returns a map of doc path to status for each documentation file.

Example:

// Token with: DOC=user:docs/user.md,api:docs/api.md
results, err := docs.CheckMultipleDocumentation(token)
// Returns: {"docs/user.md": "DOC_CURRENT", "docs/api.md": "DOC_STALE"}

func CheckStaleness

func CheckStaleness(token *storage.Token) (string, error)

CheckStaleness compares documentation file hash to token DOC_HASH field. Returns one of: DOC_CURRENT, DOC_STALE, DOC_MISSING, or DOC_UNHASHED

Status meanings:

  • DOC_CURRENT: File hash matches token DOC_HASH (documentation is up-to-date)
  • DOC_STALE: File hash differs from token DOC_HASH (documentation needs updating)
  • DOC_MISSING: Documentation file does not exist at specified path
  • DOC_UNHASHED: Token has no DOC_HASH field (hash tracking not enabled)

Example:

status, err := docs.CheckStaleness(token)
if status == "DOC_STALE" {
    fmt.Printf("Documentation for %s is outdated\n", token.ReqID)
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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