<?xml version="1.0" encoding="UTF-8"?>
<gsl-prompt id="20250809T142525+0000" type="feat">
<gsl-header>

# Add `set-project-path` Command and Remove Legacy Walk-up Logic
</gsl-header>
<gsl-block>

<gsl-purpose>
<gsl-label>

## 1. Purpose    
</gsl-label>    
<gsl-description>

Introduce a `set-project-path` CLI command to explicitly configure and manage the project root directory used by all prompt-based commands (e.g., `validate-all`, `harmonize-all`), **removing** the legacy “walk up” search for `prompts/` entirely.  
If no project path is set via environment variable or config file, commands must fail with an explicit error.
</gsl-description>
</gsl-purpose>

<gsl-inputs>
<gsl-label>

## 2. Inputs
</gsl-label>
<gsl-description>

| Input | Notes |
| --- | --- |
| Repo Source Code | Provides current CLI command implementations (`validate-all`, etc.) |
| Cross-Platform Config Path Specs | For storing persistent settings in Linux/macOS and Windows |
| Requirements List | Defines command behavior, precedence rules, and test coverage |
| Typer CLI Framework | Used for CLI command declaration and option parsing |

</gsl-description>
</gsl-inputs>

<gsl-outputs>
<gsl-label>

## 3. Outputs
</gsl-label>
<gsl-description>

- New `set-project-path` CLI command with:
  - `--path <dir>` — set an explicit project root.
  - `--here` — set project root to the current working directory.
  - `--unset` — clear any configured project root.
  - `--show` — display the effective project root and its source.
- Config storage in platform-appropriate location:
  - Linux/macOS: `~/.config/obk/config.toml`
  - Windows: `%APPDATA%\obk\config.toml`
- Resolution precedence:
  1. `OBK_PROJECT_PATH` environment variable.
  2. Config file value.
  3. *(No fallback)* — if neither is set, fail with:
     ```
     ❌ No project path configured. Run `obk set-project-path --here` or use --path <dir>.
     ```
- Updated CLI commands (`validate-all`, `harmonize-all`) to use `resolve_project_root()`.
- Verified compatibility with both Linux/macOS and Windows.
- Automated tests covering:
  - Each CLI option.
  - Resolution precedence.
  - Error message when unset.
  - Cross-platform correctness.

</gsl-description>
</gsl-outputs>

<gsl-workflows>
<gsl-label>

## 4. Workflows
</gsl-label>
<gsl-description>

- **Setting the project path explicitly**  
  1. Run `obk set-project-path --path /path/to/project`.
  2. Config file is updated with new `project_path`.

- **Setting the project path to the current directory**  
  1. `cd` into the desired project folder.
  2. Run `obk set-project-path --here`.

- **Clearing the project path**  
  1. Run `obk set-project-path --unset`.
  2. Future commands will fail unless env var or new config value is set.

- **Viewing the current project path**  
  1. Run `obk set-project-path --show`.
  2. Output includes path and source (env/config).

- **Running commands with the configured project path**  
  1. Run `obk validate-all` or `obk harmonize-all`.
  2. Path is resolved via precedence rules before execution; fail if none set.

</gsl-description>
</gsl-workflows>

<gsl-acceptance-tests>
<gsl-label>

## 5. Acceptance Tests
</gsl-label>

<gsl-acceptance-test id="1">
<gsl-performed-action>

1. When I set explicit project path via `--path` 
</gsl-performed-action>
<gsl-expected-result>
    
    Then I can confirm it is stored and config file contains the provided path, `obk set-project-path --show` outputs the path with source `config`.
</gsl-expected-result>
</gsl-acceptance-test>

<gsl-acceptance-test id="2">
<gsl-performed-action>

2. When I run `set-project-path --here` from `/tmp/myproject`.
</gsl-performed-action>
<gsl-expected-result>

    Then config file updates `project_path` to `/tmp/myproject`; `--show` reflects change.
</gsl-expected-result>
</gsl-acceptance-test>

<gsl-acceptance-test id="3">
<gsl-performed-action>

3. When I set `OBK_PROJECT_PATH=/env/path` and run `validate-all`
</gsl-performed-action>
<gsl-expected-result>

    Then command uses `/env/path` regardless of config file value.
</gsl-expected-result>
</gsl-acceptance-test>

<gsl-acceptance-test id="4">
<gsl-performed-action>

4. When no env var or config value is set, and I run `validate-all`
</gsl-performed-action>
<gsl-expected-result>

    Then the command fails with:
    ```
    ❌ No project path configured. Run `obk set-project-path --here` or use --path <dir>.
    ```
    and exits with a non-zero status.
</gsl-expected-result>
</gsl-acceptance-test>

<gsl-acceptance-test id="5">
<gsl-performed-action>

5. When I try to run all commands on both Linux and Windows environments.
</gsl-performed-action>
<gsl-expected-result>

    Then behavior is consistent, config stored in correct OS-specific location, tests pass on both platforms.
</gsl-expected-result>
</gsl-acceptance-test>

</gsl-acceptance-tests>

</gsl-block>
</gsl-prompt>
