alias

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseResourceAlias

func ParseResourceAlias(alias string) (workspace, resourcePath string, err error)

ParseResourceAlias parses a string in the format "workspace:path/to/resource". It separates the workspace name from the relative path within that workspace's notebook. Note: The "nb:" prefix should already be stripped before calling this function.

Types

type AliasResolver

type AliasResolver struct {
	Provider *workspace.Provider

	DiscoverErr error
	// contains filtered or unexported fields
}

AliasResolver discovers available workspaces and resolves aliases to their absolute paths.

func NewAliasResolver

func NewAliasResolver() *AliasResolver

NewAliasResolver creates a new, uninitialized alias resolver. Discovery happens lazily on first use.

func NewAliasResolverWithConfig

func NewAliasResolverWithConfig(configPath string) *AliasResolver

NewAliasResolverWithConfig creates a new alias resolver with a custom config path for testing.

func NewAliasResolverWithWorkDir

func NewAliasResolverWithWorkDir(workDir string) *AliasResolver

NewAliasResolverWithWorkDir creates a new alias resolver with a working directory for context-aware resolution.

func (*AliasResolver) InitProvider

func (r *AliasResolver) InitProvider()

InitProvider performs the workspace discovery process once and initializes the provider.

func (*AliasResolver) Resolve

func (r *AliasResolver) Resolve(alias string) (string, error)

Resolve translates an alias string into an absolute filesystem path. It supports two primary types of aliases:

  1. Project/Workspace Aliases (default): Used to resolve the root path of a project, ecosystem, or worktree. Can optionally use "project:" prefix for clarity. Examples: - "project-name" // Standalone project - "ecosystem:repo" // Ecosystem sub-project - "repo:worktree" // Worktree - "ecosystem:repo:worktree" // Ecosystem repo worktree - "worktree:repo/pkg/alias/**" // Path within worktree - "project:ecosystem:repo/cmd/**" // Explicit (optional)
  1. Notebook Resource Aliases (requires "nb:" prefix): Used to resolve paths to specific files or directories within a workspace's notebook structure. The "nb:" prefix is REQUIRED to distinguish from project paths. Examples: - "nb:workspace-name:plans/my-plan" // Plan directory - "nb:workspace-name:inbox/my-note.md" // Note file - "nb:workspace-name:chats/conversation" // Chat file

Alias Syntax in Different Contexts:

In .rules files, use the @a: or @alias: directive:

@a:grove-core/pkg/**                         // Project paths (default)
@a:concepts-eco:grove-core/cmd/**            // Worktree paths
@a:nb:grove-core:inbox/note.md               // Notebook resources (nb: required)

In YAML configuration files (like concept manifests):

related_plans:
  - nb:grove-core:plans/architecture         // nb: prefix required
related_notes:
  - nb:grove-ecosystem:inbox/brainstorm.md   // nb: prefix required

The "nb:" prefix is essential because both project and notebook aliases can contain colons and slashes (e.g., "worktree:repo/path" vs "nb:workspace:path"), making them ambiguous without an explicit marker.

func (*AliasResolver) ResolveLine

func (r *AliasResolver) ResolveLine(line string) (string, error)

ResolveLine parses a full rule line, resolves the alias, and reconstructs the line with an absolute path.

func (*AliasResolver) ResolveResourceAlias

func (r *AliasResolver) ResolveResourceAlias(alias string) (string, error)

ResolveResourceAlias resolves a notebook resource alias (e.g., "my-project:plans/my-plan") to its full absolute path.

Jump to

Keyboard shortcuts

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