diff --git a/openspec/changes/fix-coverletter-template-path/proposal.md b/openspec/changes/fix-coverletter-template-path/proposal.md new file mode 100644 index 0000000..87999e0 --- /dev/null +++ b/openspec/changes/fix-coverletter-template-path/proposal.md @@ -0,0 +1,33 @@ +# Change: Fix Cover Letter Template Path Resolution + +## Why + +The `/convert-cover-letter` command uses a placeholder syntax `[path-to-swiss-letter.tex]` instead of an explicit path, causing Claude Code to inconsistently locate the Swiss letter template. This results in cover letters sometimes using Pandoc's default template instead of the required Swiss business letter standards (scrlttr2 with Swiss Norm). + +The user reported: "Often claude does not take the template swiss-letter.tex" - this is because the placeholder syntax is ambiguous and Claude Code cannot reliably resolve it. + +## What Changes + +- Fix template path in `/convert-cover-letter` command from placeholder to explicit path +- Update specification to require explicit path resolution +- Add documentation clarifying path must be relative to framework root + +This is a **single-line bug fix** with specification clarification - no architectural changes, no new features. + +## Impact + +**Affected specs**: +- `cover-letter-pdf-conversion` (MODIFIED - Template Management requirement) + +**Affected code**: +- `src/.claude/commands/convert-cover-letter.md:250` (PRIMARY FIX - change placeholder to explicit path) +- Add clarification about path resolution after line 255 + +**Benefits**: +- Consistent template usage in all scenarios +- Reliable Swiss Norm formatting (address window positioning) +- No more fallback to incorrect Pandoc defaults + +**Risks**: +- **LOW** - Single-line change, easy to test and verify +- No breaking changes - existing functionality preserved diff --git a/openspec/changes/fix-coverletter-template-path/specs/cover-letter-pdf-conversion/spec.md b/openspec/changes/fix-coverletter-template-path/specs/cover-letter-pdf-conversion/spec.md new file mode 100644 index 0000000..71793dd --- /dev/null +++ b/openspec/changes/fix-coverletter-template-path/specs/cover-letter-pdf-conversion/spec.md @@ -0,0 +1,25 @@ +# cover-letter-pdf-conversion Delta + +## MODIFIED Requirements + +### Requirement: Template Management + +The system SHALL provide and maintain the Swiss letter LaTeX template with explicit path resolution to ensure consistent template usage across all execution contexts. + +#### Scenario: Template availability +- **WHEN** the `/convert-cover-letter` command is run +- **THEN** the system uses the template at `src/.claude/templates/swiss-letter.tex` +- **AND** the path is specified explicitly relative to the typical execution location +- **AND** passes it to Pandoc via the `--template` option with the full relative path + +#### Scenario: Template path resolution +- **WHEN** converting a cover letter from an application folder location (`applications/pending/[job-folder]/`) +- **THEN** the template path `../../../src/.claude/templates/swiss-letter.tex` is used +- **AND** the path goes up three levels to the project root and then to the template directory +- **AND** the explicit path ensures consistent template discovery regardless of execution context + +#### Scenario: Template customization +- **WHEN** users need to modify letter styling +- **THEN** they can edit the swiss-letter.tex template at `src/.claude/templates/swiss-letter.tex` +- **AND** changes apply to all subsequent conversions +- **AND** the template includes comments explaining customizable sections diff --git a/openspec/changes/fix-coverletter-template-path/tasks.md b/openspec/changes/fix-coverletter-template-path/tasks.md new file mode 100644 index 0000000..f4e353b --- /dev/null +++ b/openspec/changes/fix-coverletter-template-path/tasks.md @@ -0,0 +1,27 @@ +# Implementation Tasks + +## 1. Fix Command Implementation +- [ ] 1.1 Update `src/.claude/commands/convert-cover-letter.md` line 250 from `--template=[path-to-swiss-letter.tex]` to `--template=src/.claude/templates/swiss-letter.tex` +- [ ] 1.2 Add clarification after line 255 explaining path resolution (relative to framework root) +- [ ] 1.3 Verify command documentation consistency with workflow version + +## 2. Update Specification +- [ ] 2.1 Modify "Requirement: Template Management" in `openspec/specs/cover-letter-pdf-conversion/spec.md` +- [ ] 2.2 Add new scenario "Template path resolution" specifying explicit path requirement +- [ ] 2.3 Update existing "Template availability" scenario to mention path resolution + +## 3. Validation +- [ ] 3.1 Run `openspec validate fix-coverletter-template-path --strict` +- [ ] 3.2 Resolve any validation errors + +## 4. Testing +- [ ] 4.1 Create test application with `/new-application` +- [ ] 4.2 Create minimal valid cover-letter.md with required frontmatter +- [ ] 4.3 Run `/convert-cover-letter` from application folder +- [ ] 4.4 Verify PDF generated with Swiss Norm formatting +- [ ] 4.5 Test from different working directories (framework root, application folder) +- [ ] 4.6 Verify address window positioning is correct + +## 5. Documentation +- [ ] 5.1 Update commit message with reference to this change +- [ ] 5.2 Verify all documentation is consistent diff --git a/openspec/specs/cover-letter-pdf-conversion/spec.md b/openspec/specs/cover-letter-pdf-conversion/spec.md index e394b95..7906b77 100644 --- a/openspec/specs/cover-letter-pdf-conversion/spec.md +++ b/openspec/specs/cover-letter-pdf-conversion/spec.md @@ -112,16 +112,23 @@ The system SHALL convert the markdown body to PDF using Pandoc with the Swiss le ### Requirement: Template Management -The system SHALL provide and maintain the Swiss letter LaTeX template. +The system SHALL provide and maintain the Swiss letter LaTeX template with explicit path resolution to ensure consistent template usage across all execution contexts. #### Scenario: Template availability - **WHEN** the `/convert-cover-letter` command is run - **THEN** the system uses the template at `src/.claude/templates/swiss-letter.tex` -- **AND** passes it to Pandoc via the `--template` option +- **AND** the path is specified explicitly relative to the typical execution location +- **AND** passes it to Pandoc via the `--template` option with the full relative path + +#### Scenario: Template path resolution +- **WHEN** converting a cover letter from an application folder location (`applications/pending/[job-folder]/`) +- **THEN** the template path `../../../src/.claude/templates/swiss-letter.tex` is used +- **AND** the path goes up three levels to the project root and then to the template directory +- **AND** the explicit path ensures consistent template discovery regardless of execution context #### Scenario: Template customization - **WHEN** users need to modify letter styling -- **THEN** they can edit the swiss-letter.tex template +- **THEN** they can edit the swiss-letter.tex template at `src/.claude/templates/swiss-letter.tex` - **AND** changes apply to all subsequent conversions - **AND** the template includes comments explaining customizable sections diff --git a/src/.claude/commands/convert-cover-letter.md b/src/.claude/commands/convert-cover-letter.md index e8aab1f..b3a0647 100644 --- a/src/.claude/commands/convert-cover-letter.md +++ b/src/.claude/commands/convert-cover-letter.md @@ -247,12 +247,12 @@ Build the conversion command: pandoc cover-letter.md \ --from markdown \ --to latex \ - --template=[path-to-swiss-letter.tex] \ + --template=../../../src/.claude/templates/swiss-letter.tex \ --pdf-engine=pdflatex \ --output=cover-letter.pdf ``` -**Template path**: Use the template at `src/.claude/templates/swiss-letter.tex` relative to the framework root. +**Template path**: The path `../../../src/.claude/templates/swiss-letter.tex` is relative to the typical execution location (`applications/pending/[job-folder]/`), going up three levels to the project root and then to the template directory. ### Execute Conversion