GetBaseConfigDir returns the root config directory, ignoring workspace. Priority: LARKSUITE_CLI_CONFIG_DIR env → ~/.lark-cli. If the home directory cannot be determined and no override is set, a warning is written to stderr and the path falls back to a relative ".lark-cli" — callers will then see an
()
| 130 | // ".lark-cli" — callers will then see an explicit I/O error at first use |
| 131 | // instead of a silent misconfiguration. |
| 132 | func GetBaseConfigDir() string { |
| 133 | if dir := os.Getenv("LARKSUITE_CLI_CONFIG_DIR"); dir != "" { |
| 134 | return dir |
| 135 | } |
| 136 | home, err := vfs.UserHomeDir() |
| 137 | if err != nil || home == "" { |
| 138 | // Fall back to a relative ".lark-cli" so the first I/O operation |
| 139 | // surfaces a clear "no such file or directory" error. We cannot |
| 140 | // emit a stderr warning here — this package has no IOStreams in |
| 141 | // scope, and direct writes to os.Stderr violate the IOStreams |
| 142 | // injection boundary (enforced by lint). Users who hit this path |
| 143 | // should set LARKSUITE_CLI_CONFIG_DIR explicitly. |
| 144 | home = "" |
| 145 | } |
| 146 | return filepath.Join(home, ".lark-cli") |
| 147 | } |
| 148 | |
| 149 | // GetRuntimeDir returns the workspace-aware config directory. |
| 150 | // - WorkspaceLocal → GetBaseConfigDir() (unchanged, backward-compatible) |
no test coverage detected