# How To Run Wikied

This guide describes the user-facing runtime workflow.

## Open The Current Directory

```bash
wikied
```

## Open A Specific Directory

```bash
wikied docs
```

## Clone A Repository Before Opening

```bash
wikied --git https://github.com/your-org/your-repo.git
```

## Useful Runtime Flags

```bash
wikied docs --no-open
wikied docs --port 4173
```

* `--no-open` keeps the CLI from opening a browser.
* `--port` selects a specific localhost port.

## Run From A Local Tarball On Windows

> **Important:** Run `npx` from **outside** the project source directory. Running it from inside the project root causes npm to try to merge the install with the existing `node_modules`, which fails with an "Invalid Version" error on some npm versions.

```powershell
# Change to a neutral directory first, then pass the full path to your docs
cd $env:TEMP
npx --yes --package "C:\Projects\learning\site-editor\wikied-0.8.7.tgz" wikied "C:\path\to\your\docs"
```

Or use the project's helper script (handles the build, pack, and launch automatically):

```powershell
powershell -ExecutionPolicy Bypass -File scripts/package-local.ps1 -Run -OpenPath docs
```

See [How To Package And Run Locally](package-local.md) for full details.

## Browser Access

The CLI prints a URL such as:

```text
  wikied  v0.8.7
  ────────────────────────────────────────────
  URL    http://127.0.0.1:4173
  Root   docs  (C:\path\to\docs)
  ────────────────────────────────────────────
```

The server binds to `127.0.0.1`. It is intended for local use only.

## Editing Files

Use the file tree in the left navbar to select a Markdown file. Non-Markdown files appear for context but are disabled.

The active Markdown file can be edited in:

* **Rich mode** (default) — WYSIWYG editor with toolbar.
* **Preview mode** — GitHub-flavored Markdown with Mermaid diagram support.

Preview mode supports GFM, Mermaid diagrams, and built-in style presets. Relative document links clicked in Preview mode open in the current editor. If the current file is dirty, Wikied asks whether to save before navigating.

## Saving

Manual save is available when the active file is dirty:

* Press `Ctrl+S` on Windows/Linux or `Cmd+S` on macOS.
* Use the Save button (floppy-disk icon) in the header.
* Use the save icon on the active file row in the file tree.

Autosave runs only when enabled in Settings.

## User Settings

Settings are stored outside the project at:

```text
~/.wikied/settings.json
```

Current settings include autosave preference, recent files list, and asset folder. Color scheme and accent color are stored in the browser's `localStorage`.
