Visitar URL original
Okf.Cli
okf-cli
Safe HaskellNone
LanguageGHC2024

Okf.Cli

Description

Top-level CLI entry point for okf.

Synopsis

Documentation

data BundlesOptions Source #

Constructors

BundlesOptions 

Fields

Instances

Instances details
Show BundlesOptions Source # 
Instance details

Defined in Okf.Cli

Eq BundlesOptions Source # 
Instance details

Defined in Okf.Cli

data ConceptsOptions Source #

Constructors

ConceptsOptions 

Fields

Instances

Instances details
Show ConceptsOptions Source # 
Instance details

Defined in Okf.Cli

Eq ConceptsOptions Source # 
Instance details

Defined in Okf.Cli

data GraphOptions Source #

Constructors

GraphOptions 

Fields

Instances

Instances details
Show GraphOptions Source # 
Instance details

Defined in Okf.Cli

Eq GraphOptions Source # 
Instance details

Defined in Okf.Cli

data IdOptions Source #

Constructors

IdOptions 

Instances

Instances details
Show IdOptions Source # 
Instance details

Defined in Okf.Cli

Eq IdOptions Source # 
Instance details

Defined in Okf.Cli

data IdSub Source #

Constructors

IdNext !Text 
IdList 

Instances

Instances details
Show IdSub Source # 
Instance details

Defined in Okf.Cli

Methods

showsPrec :: Int -> IdSub -> ShowS #

show :: IdSub -> String #

showList :: [IdSub] -> ShowS #

Eq IdSub Source # 
Instance details

Defined in Okf.Cli

Methods

(==) :: IdSub -> IdSub -> Bool #

(/=) :: IdSub -> IdSub -> Bool #

data IndexOptions Source #

Constructors

IndexOptions 

Instances

Instances details
Show IndexOptions Source # 
Instance details

Defined in Okf.Cli

Eq IndexOptions Source # 
Instance details

Defined in Okf.Cli

data ConfigCommand Source #

Instances

Instances details
Show ConfigCommand Source # 
Instance details

Defined in Okf.Cli

Eq ConfigCommand Source # 
Instance details

Defined in Okf.Cli

data LogAddOptions Source #

Constructors

LogAddOptions 

Fields

Instances

Instances details
Show LogAddOptions Source # 
Instance details

Defined in Okf.Cli

Eq LogAddOptions Source # 
Instance details

Defined in Okf.Cli

data LogOptions Source #

Constructors

LogOptions 

Instances

Instances details
Show LogOptions Source # 
Instance details

Defined in Okf.Cli

Eq LogOptions Source # 
Instance details

Defined in Okf.Cli

data LogSub Source #

Instances

Instances details
Show LogSub Source # 
Instance details

Defined in Okf.Cli

Eq LogSub Source # 
Instance details

Defined in Okf.Cli

Methods

(==) :: LogSub -> LogSub -> Bool #

(/=) :: LogSub -> LogSub -> Bool #

data Options Source #

Constructors

Options 

Fields

Instances

Instances details
Show Options Source # 
Instance details

Defined in Okf.Cli

Eq Options Source # 
Instance details

Defined in Okf.Cli

Methods

(==) :: Options -> Options -> Bool #

(/=) :: Options -> Options -> Bool #

data ProfilesOptions Source #

Constructors

ProfilesOptions 

Fields

Instances

Instances details
Show ProfilesOptions Source # 
Instance details

Defined in Okf.Cli

Eq ProfilesOptions Source # 
Instance details

Defined in Okf.Cli

data ProfileSourceOrigin Source #

The winning precedence layer for a resolved profile source. This travels with the source so inspection never has to reconstruct resolution later.

data ProfileSweepOptions Source #

Constructors

ProfileSweepOptions 

Fields

Instances

Instances details
Generic ProfileSweepOptions Source # 
Instance details

Defined in Okf.Cli.ProfileSweep

Associated Types

type Rep ProfileSweepOptions 
Instance details

Defined in Okf.Cli.ProfileSweep

Show ProfileSweepOptions Source # 
Instance details

Defined in Okf.Cli.ProfileSweep

Eq ProfileSweepOptions Source # 
Instance details

Defined in Okf.Cli.ProfileSweep

type Rep ProfileSweepOptions Source # 
Instance details

Defined in Okf.Cli.ProfileSweep

data ShowOptions Source #

Constructors

ShowOptions 

Fields

Instances

Instances details
Show ShowOptions Source # 
Instance details

Defined in Okf.Cli

Eq ShowOptions Source # 
Instance details

Defined in Okf.Cli

data SourcesOptions Source #

Constructors

SourcesOptions 

Fields

Instances

Instances details
Show SourcesOptions Source # 
Instance details

Defined in Okf.Cli

Eq SourcesOptions Source # 
Instance details

Defined in Okf.Cli

data TrustOptions Source #

Constructors

TrustOptions 

Fields

Instances

Instances details
Show TrustOptions Source # 
Instance details

Defined in Okf.Cli

Eq TrustOptions Source # 
Instance details

Defined in Okf.Cli

bundleListJson :: [(FilePath, [Text])] -> Value Source #

JSON wire format for okf bundles --json. An empty prefix list means no evidence was observed, so the optional field is absent rather than empty.

computationReport :: [Concept] -> [Text] Source #

The lines okf computations prints, as data. Pure and separate from runComputations so a test can assert the whole report rather than only the accessors behind it; renderProfileDetail is exported for the same reason.

Concepts arrive in walkBundle order and keep it. Column widths are computed over the selected rows only, so one unrelated long concept ID elsewhere in the bundle cannot pad this report.

conceptReport :: [Text] -> [Concept] -> [Text] Source #

The lines okf concepts prints, as data: concept ID, type, one column per key requested with --show, and title last. The --show option affects this text report only; JSON output always carries complete stored frontmatter. Pure and separate from runConcepts so a test can assert the whole report rather than only the accessors behind it, as computationReport and renderProfileDetail already are.

The three default columns are the ones conceptCandidates shows in the interactive concept picker, so the two listings agree.

title comes last and is never padded, so a long title cannot push anything off the right edge and a concept with no title simply ends the line. Column widths are computed over the rows actually printed, so one unrelated long concept ID elsewhere in the bundle cannot pad a filtered listing.

conceptReportJson :: [Concept] -> Value Source #

The rows okf concepts --json emits.

Each row is the complete stored frontmatter object. File-derived identity, source paths, Markdown bodies, derived readings, and a CLI-owned envelope are deliberately absent. Filters choose the rows before this renderer runs, and --show is not an input because it controls text columns only.

conceptsProfileDiagnostics :: CompiledProfile -> [Text] -> [WhereCondition] -> [FieldSelector] -> [FieldSelector] -> [SortKey] -> [Text] Source #

Every profile diagnostic for an okf concepts command line, in a stable order: the legacy filters first — --type, legacy --where equalities, --has, --missing, as they always have been — then each explicit condition in flag order, then each --sort key. A predicate or sort-key error repeated across flags is reported once.

A sort key is checked for declaration only, as has(KEY) would be: there is no value to check. It is worth checking at all because a misspelled sort key leaves the listing in concept-ID order, which looks entirely plausible.

The two kinds render differently on purpose. A legacy equality outside a vocabulary really can match nothing, and its message has always said so. A predicate's out-of-vocabulary value may sit under != or not, where the condition can still match plenty; it is still a typo worth stopping for, but "no concept can match" would be false.

renderFilterProfileError :: FilterProfileError -> Text Source #

Why a profile says a filter can never select anything.

The message quotes the filter, status=acepted, and not the flag the user typed. --type Reqest desugars into a filter on the type key before any checking happens, so by the time an error exists there is no flag left to quote and guessing one would sometimes name a flag the user did not use.

renderPredicateProfileError :: FilterProfileError -> Text Source #

Why a profile rejects an explicit --where condition. Neutral about matching, since the offending value may be one the condition excludes.

observedIdPrefixes :: [Concept] -> [Text] Source #

Sorted, duplicate-free strict handle prefixes observed anywhere in the top-level string frontmatter of the supplied concepts.

parseProfileRegistriesEnv :: Text -> Either Text [Text] Source #

Decode the plural environment value. Aeson decodes directly to [Text], so a non-array or non-string member is rejected rather than coerced. Blank elements are discarded and exact duplicates keep their first occurrence.

profileRegistriesEnvVar :: String Source #

Plural environment override. JSON is used because registry references may themselves contain colons in URLs and integrity hashes.

profileRegistryEnvVar :: String Source #

Legacy singular environment override for the registry okf profile reads.

profileDescriptorJson :: FilePath -> ProfileSpec -> Value Source #

JSON wire format for one discovered descriptor. Optional prose is omitted rather than rendered as null, matching the bundle-listing convention.

resolveEffectiveProfileSources :: [Text] -> Bool -> IO [ResolvedProfileSource] Source #

Resolve the winning registry layer and append network-silent local descriptors unless the caller explicitly requested registry-only behavior.

resolveProfilePathWith :: FzfConfig -> Maybe FilePath -> IO FilePath Source #

Resolve a descriptor with an already-detected picker configuration. This is exported so tests can prove the explicit branch ignores availability.

resolveProfileSources :: [Text] -> IO [ResolvedProfileSource] Source #

Profile source precedence: repeated --registry flags, then the plural JSON environment value, then the legacy singular environment value, then the effective configuration. Only the winning layer contributes sources. Configuration is read only when needed, so a broken file cannot stop an explicit invocation.

renderProfileDetail :: Text -> ProfileSpec -> [Text] Source #

One profile's complete rule set. Every optional field prints as (none) rather than being omitted, so the output shape does not change between profiles and stays reliable to eyeball or grep. Type rules print in the order the profile declares them, since that order is the author's.

renderProfileViolation :: CompiledProfile -> [Concept] -> ProfileViolation -> Text Source #

One deviation as one line. The ProfileSpec is here only so a missing required field can carry the profile's own explanation of what that field is for; every other case ignores it.

Exported so a test can assert a whole diagnostic line rather than only the accessors behind it, as computationReport and renderProfileDetail already are. The constructors that quote a frontmatter value back to the author ignore both the CompiledProfile and the concept list, so such a test can pass any compiled profile and an empty list.

renderRegistryTable :: RegistryTableMode -> [SourcedProfile] -> [Text] Source #

A deterministic two-line row per profile. Compact mode uses fixed column budgets whose separators sum to 100 Unicode code points, then caps the indented description to 98. Wide mode derives widths from the full identity values and keeps the complete normalized description. Unicode code points are intentionally used instead of terminal display cells so rendering stays pure and terminal-independent; combining and double-width glyphs may not visually occupy exactly one cell.

renderProfileSourceResolution :: [ProfileSourceResolution] -> ProfileFreshness -> Text Source #

The source inspection table and its precedence legend are pure so the command can be pinned without evaluating Dhall or consulting the network.

selectSourcedProfile :: [SourcedProfile] -> Maybe Text -> Either Text SourcedProfile Source #

Resolve one profile from a complete, successfully loaded source set. The pure result keeps ambiguity behavior directly testable; command policy turns the Left into exit status 1.