import{_ as i,o as a,c as e,a2 as n}from"./chunks/framework.CJEbdX1t.js";const k=JSON.parse('{"title":"Code Style","description":"","frontmatter":{},"headers":[],"relativePath":"contributing/code-style.md","filePath":"contributing/code-style.md"}'),t={name:"contributing/code-style.md"};function l(h,s,p,o,r,d){return a(),e("div",null,[...s[0]||(s[0]=[n(`<h1 id="code-style" tabindex="-1">Code Style <a class="header-anchor" href="#code-style" aria-label="Permalink to &quot;Code Style&quot;">​</a></h1><p>Specwright uses automated tools for consistent code style. All checks run in CI.</p><h2 id="python" tabindex="-1">Python <a class="header-anchor" href="#python" aria-label="Permalink to &quot;Python&quot;">​</a></h2><h3 id="linter-ruff" tabindex="-1">Linter: Ruff <a class="header-anchor" href="#linter-ruff" aria-label="Permalink to &quot;Linter: Ruff&quot;">​</a></h3><p><a href="https://docs.astral.sh/ruff/" target="_blank" rel="noreferrer">Ruff</a> handles both linting and formatting:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Check for lint errors</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">make</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> lint-backend</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Auto-fix lint errors + format</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">make</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> format</span></span></code></pre></div><p>Or directly:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">uv</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ruff</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> check</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">           # lint</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">uv</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ruff</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> check</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --fix</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">     # auto-fix</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">uv</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ruff</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> format</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">          # format</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">uv</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ruff</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> format</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --check</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">  # check formatting without changing files</span></span></code></pre></div><h3 id="type-checking-mypy" tabindex="-1">Type Checking: mypy <a class="header-anchor" href="#type-checking-mypy" aria-label="Permalink to &quot;Type Checking: mypy&quot;">​</a></h3><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">make</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> typecheck</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># or</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">uv</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> mypy</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> src/specwright</span></span></code></pre></div><h3 id="conventions" tabindex="-1">Conventions <a class="header-anchor" href="#conventions" aria-label="Permalink to &quot;Conventions&quot;">​</a></h3><ul><li><strong>Python 3.12+</strong> — Use modern syntax (type unions <code>X | Y</code>, <code>match</code> statements, etc.)</li><li><strong>Pydantic v2</strong> — All data models use Pydantic with strict validation</li><li><strong>Async by default</strong> — Use <code>async def</code> for handler functions and API calls</li><li><strong>httpx</strong> — Async HTTP client (not requests)</li></ul><h2 id="frontend" tabindex="-1">Frontend <a class="header-anchor" href="#frontend" aria-label="Permalink to &quot;Frontend&quot;">​</a></h2><h3 id="linter-eslint" tabindex="-1">Linter: ESLint <a class="header-anchor" href="#linter-eslint" aria-label="Permalink to &quot;Linter: ESLint&quot;">​</a></h3><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">make</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> lint-frontend</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># or</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> frontend</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &amp;&amp; </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> lint</span></span></code></pre></div><h3 id="type-checking-vue-tsc" tabindex="-1">Type Checking: vue-tsc <a class="header-anchor" href="#type-checking-vue-tsc" aria-label="Permalink to &quot;Type Checking: vue-tsc&quot;">​</a></h3><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> frontend</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &amp;&amp; </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> run</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> type-check</span></span></code></pre></div><h2 id="commit-messages" tabindex="-1">Commit Messages <a class="header-anchor" href="#commit-messages" aria-label="Permalink to &quot;Commit Messages&quot;">​</a></h2><p>Use conventional commit format:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>type: short description</span></span>
<span class="line"><span></span></span>
<span class="line"><span>Longer description if needed.</span></span></code></pre></div><p>Types:</p><ul><li><code>feat:</code> — New feature</li><li><code>fix:</code> — Bug fix</li><li><code>docs:</code> — Documentation changes</li><li><code>refactor:</code> — Code restructuring</li><li><code>test:</code> — Test additions/changes</li><li><code>chore:</code> — Build/tooling changes</li><li><code>spec:</code> — Spec file additions/changes</li></ul><p>Examples:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>feat: add Linear ticket sync adapter</span></span>
<span class="line"><span>fix: handle empty spec sections in parser</span></span>
<span class="line"><span>docs: update self-hosting guide for Auth0</span></span>
<span class="line"><span>spec: add user notifications spec</span></span></code></pre></div>`,24)])])}const g=i(t,[["render",l]]);export{k as __pageData,g as default};
