cmd

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Copyright © 2026 nmdra

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAndRun added in v1.1.0

func ParseAndRun(ctx context.Context) error

ParseAndRun parses CLI arguments and runs the selected subcommand.

Types

type BacklinksCmd added in v1.1.0

type BacklinksCmd struct {
	Note string `arg:"" help:"Note slug"`
}

func (*BacklinksCmd) Run added in v1.1.0

func (c *BacklinksCmd) Run(globals *Globals) error

type BoostedCmd added in v1.1.0

type BoostedCmd struct {
	Query string  `arg:"" help:"Search query"`
	Limit int     `help:"maximum number of results to return" default:"10"`
	Seed  string  `help:"seed note for graph-based score boosting" required:"true"`
	Boost float64 `help:"multiplier applied to graph-connected results" default:"1.5"`
}

func (*BoostedCmd) Run added in v1.1.0

func (c *BoostedCmd) Run(globals *Globals) error

type CLI added in v1.1.0

type CLI struct {
	Globals

	Ingest      IngestCmd      `cmd:"" help:"Ingest markdown files from a vault"`
	Search      SearchCmd      `cmd:"" help:"Semantic search across indexed notes"`
	Backlinks   BacklinksCmd   `cmd:"" help:"Find incoming links to a note"`
	Connections ConnectionsCmd `cmd:"" help:"Traverse graph connections"`
	Hidden      HiddenCmd      `cmd:"" help:"Discover hidden semantic links between unlinked notes"`
	Tags        TagsCmd        `cmd:"" help:"Find notes sharing common tags"`
	Boosted     BoostedCmd     `cmd:"" help:"Graph-boosted semantic search"`
	Stats       StatsCmd       `cmd:"" help:"Show collection statistics"`
	Reset       ResetCmd       `cmd:"" help:"Reset the ChromaDB collections"`
}

CLI is the top-level Kong command tree.

type ConnectionsCmd added in v1.1.0

type ConnectionsCmd struct {
	Note string `arg:"" help:"Note slug"`
	Hops int    `help:"maximum number of graph hops to traverse" default:"2"`
}

func (*ConnectionsCmd) Run added in v1.1.0

func (c *ConnectionsCmd) Run(globals *Globals) error

type Globals added in v1.1.0

type Globals struct {
	ChromaPath   string `help:"path to ChromaDB persistent storage" default:"~/.notebrain/chroma"`
	ChromaMode   string `help:"ChromaDB client mode ('persistent' or 'http')" default:"persistent"`
	ChromaURL    string `help:"ChromaDB server URL (used when --chroma-mode=http)" default:"http://localhost:8000"`
	Vault        string `help:"Obsidian vault name"`
	Verbose      bool   `help:"enable verbose output"`
	NoHyperlinks bool   `help:"Disable OSC 8 terminal hyperlinks in output"`

	// Internal fields, not exposed as flags
	Ctx       context.Context `kong:"-"`
	VaultName string          `kong:"-"` // resolved display name for Obsidian URIs
}

Globals holds shared configuration available to all subcommands.

type HiddenCmd added in v1.1.0

type HiddenCmd struct {
	Note  string `arg:"" help:"Note slug"`
	Limit int    `help:"maximum number of hidden connections to return" default:"10"`
}

func (*HiddenCmd) Run added in v1.1.0

func (c *HiddenCmd) Run(globals *Globals) error

type IngestCmd added in v1.1.0

type IngestCmd struct {
	Glob    string `arg:"" optional:"" help:"glob pattern to ingest"`
	Workers int    `help:"number of concurrent ingestion workers" default:"4"`
}

func (*IngestCmd) Run added in v1.1.0

func (c *IngestCmd) Run(globals *Globals) error

type ResetCmd added in v1.1.0

type ResetCmd struct {
}

func (*ResetCmd) Run added in v1.1.0

func (c *ResetCmd) Run(globals *Globals) error

type SearchCmd added in v1.1.0

type SearchCmd struct {
	Query       string `arg:"" help:"Search query"`
	Limit       int    `help:"maximum number of results to return" default:"10"`
	Section     string `help:"filter by heading path"`
	HasTasks    bool   `help:"only return chunks that contain task lists"`
	HasCode     bool   `help:"only return chunks that contain code blocks"`
	Interactive bool   `help:"open interactive browser"`
}

func (*SearchCmd) Run added in v1.1.0

func (c *SearchCmd) Run(globals *Globals) error

type StatsCmd added in v1.1.0

type StatsCmd struct {
}

func (*StatsCmd) Run added in v1.1.0

func (c *StatsCmd) Run(globals *Globals) error

type TagsCmd added in v1.1.0

type TagsCmd struct {
	Note      string `arg:"" help:"Note slug"`
	MinShared int    `help:"minimum number of shared tags to include a result" default:"1"`
}

func (*TagsCmd) Run added in v1.1.0

func (c *TagsCmd) Run(globals *Globals) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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