> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useskald.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Skald CLI

> Documentation on how to install and use the Skald CLI.

The Skald CLI is a command-line interface that allows users to manage memos, interact with a knowledge base, and generate documentation.

## Installation

To install the Skald CLI, run the following command:

```bash theme={null}
npm install -g @skald-labs/cli
```

Before using any other commands, authenticate with your API key:

```bash theme={null}
skald auth
```

## Usage

After installation, you can use the `skald` command:

```bash theme={null}
# Show help
skald --help

# Authenticate with your API key (first time setup)
skald auth

# Initialize documentation structure
skald docs init

# Add a memo from a file
skald memo add --title "Meeting Notes" --file-path ./notes.md

# Add a memo with tags
skald memo add -t "Project Update" -f ./update.md --tags "project,update"

# Write a memo using vi editor
skald memo write

# Write a memo with tags
skald memo write --tags "meeting,notes"

# Ask a question to your knowledge base
skald chat ask "What are our quarterly goals?"

# Ask about specific topics
skald chat ask "Tell me about the API authentication process"

# Show help for a specific command
skald docs --help

# Generate documentation (uses current directory by default)
skald docs generate

# Generate with custom paths
skald docs generate --config-path ./config --output-path ./dist/docs

# Using short flags
skald docs generate -c ./config -o ./dist/docs
```

## Commands

### Authentication

* `skald auth` - Authenticate with your project API key
  * Prompts for API key and stores it securely in `~/.skald/config` (macOS/Linux) or `%USERPROFILE%\.skald\config` (Windows)
  * **Required**: Must run this command before using any other commands

### Documentation Commands

* `skald docs init` - Initialize documentation structure with example outline.yml
  * `--config-path, -c <path>` - Path to configuration directory (defaults to current directory)
* `skald docs generate` - Generate documentation (requires authentication)
  * `--config-path, -c <path>` - Path to configuration file (defaults to current directory)
  * `--output-path, -o <path>` - Path to output directory (defaults to current directory)
  * **Required files**:
    * `<config-path>/.skald/outline.yml` - Outline configuration file (YAML format)
  * **Optional files**:
    * `<config-path>/.skald/rules.md` - Custom rules for documentation generation

### Memo Commands

* `skald memo add` - Add a new memo from a file (requires authentication)
  * `--title, -t <title>` - Title of the memo (required)
  * `--file-path, -f <path>` - Path to the file containing memo content (required)
  * `--tags <tags>` - Comma-separated tags for the memo
  * `--source <source>` - Source of the memo (defaults to "cli")
  * `--reference-id <id>` - External reference ID for the memo
* `skald memo write` - Write a new memo using vi editor (requires authentication)
  * `--tags <tags>` - Comma-separated tags for the memo
  * `--source <source>` - Source of the memo (defaults to "cli")
  * `--reference-id <id>` - External reference ID for the memo

### Chat Commands

* `skald chat ask <question>` - Ask a question to your knowledge base (requires authentication)
  * Streams the response in real-time to the console

## Expected Directory Structure for Documentation

When running `skald docs generate`, your project should have:

```
<config-path>/
└── .skald/
    ├── outline.yml     # Required: documentation outline (YAML format)
    └── rules.md        # Optional: custom generation rules
```

## YAML Outline Format

The `outline.yml` file uses the `_docs` key to define documentation files:

```yaml theme={null}
api:
  _docs:
    - name: authentication.md
      title: Authentication
      description: API authentication guide
  reference:
    _docs:
      - name: user.md
        title: User API
        description: User endpoints
features:
  _docs:
    - name: features.md
      title: Features Overview
```
