Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pkg/console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The following components and functions are exported by the `console` package:
| `RenderTitleBox` / `RenderErrorBox` / `RenderInfoSection` | funcs | Section rendering helpers |
| `RenderComposedSections` | func | Composes and prints multiple sections |
| `FormatSuccessMessage` / `FormatInfoMessage` / `FormatWarningMessage` / `FormatErrorMessage` | funcs | Styled status message formatting |
| `FormatSuccessMessageStderr` / `FormatInfoMessageStderr` / `FormatListItemStderr` / `FormatSectionHeaderStderr` | funcs | Stderr-TTY-aware variants of matching format functions |
| `FormatCommandMessage` / `FormatProgressMessage` / `FormatVerboseMessage` | funcs | Additional message styles |
| `FormatError` | func | Renders a structured `CompilerError` with context |
| `FormatErrorChain` | func | Renders a wrapped-error chain |
Expand Down Expand Up @@ -358,19 +359,35 @@ All `Format*` functions return a styled string ready to be printed to `os.Stderr
| Function | Style | Typical use |
|----------|-------|-------------|
| `FormatSuccessMessage(message string) string` | Green, bold | Operation completed successfully |
| `FormatSuccessMessageStderr(message string) string` | Green, bold (stderr TTY) | Success message using stderr TTY detection |
| `FormatInfoMessage(message string) string` | Cyan, bold | General informational output |
| `FormatInfoMessageStderr(message string) string` | Cyan, bold (stderr TTY) | Info message using stderr TTY detection |
| `FormatWarningMessage(message string) string` | Orange, bold | Non-fatal warnings |
| `FormatErrorMessage(message string) string` | Red, bold | Recoverable error messages |
| `FormatCommandMessage(command string) string` | Purple | CLI commands and code snippets |
| `FormatProgressMessage(message string) string` | Yellow | In-progress status updates |
| `FormatPromptMessage(message string) string` | Cyan | Interactive prompt labels |
| `FormatVerboseMessage(message string) string` | Muted/comment | Verbose/debug detail |
| `FormatListItem(item string) string` | Foreground | Individual list entries |
| `FormatListItemStderr(item string) string` | Foreground (stderr TTY) | List entry using stderr TTY detection |
| `FormatListHeader(header string) string` | Plain (WASM only) | Section headers inside lists |
| `FormatSectionHeader(header string) string` | Bold, bordered | Section titles in output |
| `FormatSectionHeaderStderr(header string) string` | Bold, bordered (stderr TTY) | Section title using stderr TTY detection |
| `FormatLocationMessage(message string) string` | Foreground (WASM only) | File and location paths |
| `FormatCountMessage(message string) string` | Foreground (WASM only) | Counts and metrics |

### Stderr TTY Variants

The `*Stderr` variants (`FormatSuccessMessageStderr`, `FormatInfoMessageStderr`, `FormatListItemStderr`, `FormatSectionHeaderStderr`) check whether **`os.Stderr`** is a terminal rather than `os.Stdout`. Use these when writing to `os.Stderr` directly, so that color stripping is applied correctly in non-interactive contexts (e.g., piped stderr).

```go
// Use Stderr variants when writing directly to os.Stderr
fmt.Fprintln(os.Stderr, console.FormatInfoMessageStderr("Already configured"))
fmt.Fprintln(os.Stderr, console.FormatSuccessMessageStderr("Updated "+filePath))
fmt.Fprintln(os.Stderr, console.FormatSectionHeaderStderr("Section Title"))
fmt.Fprintln(w, console.FormatListItemStderr("Detail item"))
```

### Usage Pattern

```go
Expand Down
12 changes: 12 additions & 0 deletions pkg/constants/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,18 @@ constants.ExpressionBreakThreshold // 100 — threshold at which long lines ge
constants.CLIExtensionPrefix // "gh aw" — user-facing CLI prefix
```

## File Permission Constants

Standard `fs.FileMode` values for consistent file and directory creation:

```go
constants.FilePermSensitive // 0o600 — owner-only read/write (config files, credentials)
constants.FilePermPublic // 0o644 — owner read/write + world read (normal files)
constants.FilePermExecutable // 0o755 — owner/group/world executable (scripts, binaries)
constants.DirPermSensitive // 0o750 — owner+group access (sensitive directories)
constants.DirPermPublic // 0o755 — standard non-sensitive directory access
```

## Runtime Configuration

```go
Expand Down
Loading