Skip to content

Add initial implementation of draft CLI#1

Merged
linyows merged 8 commits intomainfrom
feature/initial-implementation
Jan 19, 2026
Merged

Add initial implementation of draft CLI#1
linyows merged 8 commits intomainfrom
feature/initial-implementation

Conversation

@linyows
Copy link
Copy Markdown
Owner

@linyows linyows commented Jan 18, 2026

Summary

  • Implement Markdown template generator CLI in Zig
  • Add template-based document generation with variable substitution ({{@title}}, {{@date}}, {{@name}}, {{@id}})
  • Add auto-increment document IDs with configurable digit width
  • Add index generation with customizable table format
  • Include built-in ADR and Design Doc templates
  • Organize code into modular structure (config, template, index, utils)

Test plan

  • zig build test - All tests pass
  • zig build - Build succeeds
  • draft help - Shows usage
  • draft version - Shows version
  • draft init - Creates .draft directory with templates

🤖 Generated with Claude Code

linyows and others added 3 commits January 19, 2026 07:40
Implement a Markdown template generator with the following features:
- Template-based document generation with variable substitution
- Auto-increment document IDs
- Index generation with customizable table format
- Built-in ADR and Design Doc templates
- Modular code structure (config, template, index, utils)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add CI workflow for testing on Ubuntu and macOS
- Test against Zig 0.13.0 and master
- Add lint job for format checking
- Configure Dependabot for GitHub Actions updates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@linyows linyows requested a review from Copilot January 18, 2026 22:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces the initial implementation of a Markdown template generator CLI tool written in Zig. The tool enables generation of Markdown documents from templates with variable substitution, auto-incrementing document IDs, and index file generation.

Changes:

  • Implements core CLI with template-based document generation supporting variable substitution ({{@title}}, {{@date}}, {{@name}}, {{@id}})
  • Adds auto-increment ID functionality with configurable digit width formatting
  • Includes built-in ADR and Design Doc templates with index generation
  • Sets up CI/CD with GitHub Actions for testing and linting across multiple platforms

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/main.zig Main CLI entry point with command routing for init, generate, and index operations
src/config.zig Configuration loading from JSON with default values
src/template.zig Template variable replacement and ID formatting logic
src/index.zig Document metadata extraction and index table generation
src/utils.zig Utility functions for date, username, and next ID retrieval
src/templates/*.md Built-in template files for ADR and Design documents
build.zig Zig build configuration
build.zig.zon Package metadata
README.md Comprehensive documentation with usage examples
.github/workflows/ci.yml CI workflow for testing and building
.github/dependabot.yml Dependabot configuration for GitHub Actions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

README.md Outdated

### Build from source

Requires Zig 0.13.0 or later.
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build.zig.zon specifies minimum_zig_version as '0.15.0', but the documentation states '0.13.0 or later'. These should be consistent.

Suggested change
Requires Zig 0.13.0 or later.
Requires Zig 0.15.0 or later.

Copilot uses AI. Check for mistakes.
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
zig-version: ['0.13.0', 'master']
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI workflow tests with Zig 0.13.0, but build.zig.zon specifies minimum_zig_version as '0.15.0'. The test matrix should use the actual minimum version or higher.

Copilot uses AI. Check for mistakes.
- name: Setup Zig
uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1
with:
version: '0.13.0'
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lint job uses Zig 0.13.0, but build.zig.zon specifies minimum_zig_version as '0.15.0'. This should match the minimum required version.

Suggested change
version: '0.13.0'
version: '0.15.0'

Copilot uses AI. Check for mistakes.
linyows and others added 5 commits January 19, 2026 07:48
- Update test matrix to use Zig 0.15.0 (remove 0.13.0 and master)
- Update lint job to use Zig 0.15.0
- Update README to specify correct minimum version

The project requires Zig 0.15.0+ due to build.zig.zon syntax and
stdlib API usage.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
goto-bus-stop/setup-zig doesn't support Zig 0.15.0 yet.
mlugg/setup-zig has better support for recent Zig versions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The official Zig download mirrors don't have 0.15.0 indexed yet.
Use zml.ai mirror which has the release available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use Zig 0.15.2 which is available in setup-zig
- Update minimum_zig_version in build.zig.zon
- Update README to reflect correct version requirement

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@linyows linyows merged commit d28ee57 into main Jan 19, 2026
3 checks passed
@linyows linyows deleted the feature/initial-implementation branch January 19, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants