appname

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package appname is the single source of truth for the running app's *path-safe identifier* — the slug used in `~/.<app>/` for DB, logs, agents Layout, gate spec/socket. Every artefact lands under one tree.

Resolution order (first non-empty wins):

  1. BuildAppName — ldflag-baked at compile time by `wick build`
  2. wick.yml — top-level `name:` field, walked from cwd
  3. "wick" — last-ditch fallback

`APP_NAME` env var is intentionally NOT in this chain. That env holds the human-readable display label (e.g. "My App" with spaces and capitalization) used by the UI / login / systray title — it must not contaminate filesystem paths. Path identifiers come from `name:` in wick.yml, which already enforces no-space slug rules.

The package has zero deps on the rest of the codebase so any other internal package can import it without risking cycles.

Index

Constants

This section is empty.

Variables

View Source
var BuildAppName = ""

BuildAppName is the ldflag injection target. Builder writes here via `-X github.com/yogasw/wick/internal/appname.BuildAppName=<name>`. Empty when not built via `wick build` (e.g. `go run`, VSCode debug).

View Source
var BuildAppVersion = "dev"

BuildAppVersion is the ldflag injection target for the downstream app version. Injected via `-X github.com/yogasw/wick/internal/appname.BuildAppVersion=<ver>`. Falls back to "dev" when not injected.

Functions

func Resolve

func Resolve() string

Resolve returns the active app name. Result is cached for the process lifetime — chain inputs (BuildAppName, env, yml) don't change at runtime, so we resolve exactly once.

func ResolveAfterChdir added in v0.13.0

func ResolveAfterChdir() string

ResolveAfterChdir re-runs resolution from scratch and re-caches the result. Call this once after os.Chdir to the project root so that wick.yml-based names are picked up even when Resolve() fired before the chdir (e.g. MCP stdio). No-op if BuildAppName is already baked via ldflags (ldflag always wins).

Types

This section is empty.

Jump to

Keyboard shortcuts

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