Skip to content

fix: substitute [DATE] in create-new-feature and setup-plan scripts - #5608

Open
IlayWolfson wants to merge 1 commit into
github:mainfrom
IlayWolfson:fix/4335-template-date-and-frontmatter
Open

IlayWolfson wants to merge 1 commit into
github:mainfrom
IlayWolfson:fix/4335-template-date-and-frontmatter

Conversation

@IlayWolfson

@IlayWolfson IlayWolfson commented Nov 28, 2026 •

Copy link
Copy Markdown

Part of #4335 (fixes the [DATE] substitution; the tasks-template front matter fix will come in a separate PR)

Description

The bug: the agent never got the date. create-new-feature and setup-plan copied the templates as-is, so spec.md and plan.md kept a literal [DATE] and the agent had to guess it, sometimes wrong.

What this PR changes:

Change Where
Replace [DATE] with today's date (YYYY-MM-DD) Bash, PowerShell 5.1 and Python versions of create-new-feature and setup-plan
Update one test that compared plan.md to the raw template tests/test_setup_plan_no_overwrite.py
New regression tests tests/test_template_date_substitution.py

Kept as-is: other placeholders ([DATE_CREATED], $ARGUMENTS, ...), --dry-run, --json, and not overwriting an existing spec.md or plan.md. Field labels in the templates are unchanged.

Testing

Set up this checkout's .venv and editable install using the local development guide. Run commands from the checkout root.

  • Tested locally with .venv/bin/specify --help (Windows PowerShell: .\.venv\Scripts\specify.exe --help)
    • Windows App Control blocks the unsigned specify.exe on my machine, so I ran the same entry point through python -c "from specify_cli import main; ...".
  • Ran relevant existing tests with .venv/bin/python -m pytest tests -q (Windows PowerShell: .\.venv\Scripts\python.exe -m pytest tests -q); use affected test paths for focused checks and LC_ALL=en_US.UTF-8 on macOS
    • New tests: 24 of 36 fail on main, all 36 pass with this fix (Python, Windows PowerShell 5.1, Git Bash). The 12 that pass on main guard behavior that must not change.
    • Related existing tests: pass, except one @requires_bash case that fails on Windows Git Bash because of /tmp paths (not related to this change)
    • ruff check src tests: passed
  • Tested with a sample project (if applicable)
    • specify init --script ps, then ran both scripts in PowerShell 5.1: spec.md and plan.md got today's date.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (fill in the disclosure below)

AI disclosure: I used Antigravity agents in separate checkouts that could not see each other's work: Claude Opus (high, autonomous) wrote the fix, a second agent wrote the regression tests, and Gemini (high, autonomous) wrote an independent blind test suite that I used only locally. After review, Claude (Opus 5.5) fixed the test Copilot flagged, removed the front-matter change and squashed the PR into one commit, under my direction. I reviewed the diffs, ran the tests and the sample project myself, and edited this description.

@IlayWolfson
IlayWolfson requested a review from mnriem as a code owner November 28, 2026 12:38
Copilot AI adaptive review requested due to automatic review settings November 28, 2026 12:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The preservation test selects 002-existing instead of the seeded 001-existing, so its final assertion cannot detect changes to an existing spec’s literal [DATE].

1 open issue
What changed in this PR

This PR addresses part of #4335 by filling [DATE] when Spec Kit creates feature specifications and implementation plans, rather than leaving the date for the agent to infer.

Changes:

  • Substitute today’s local date across Bash, PowerShell, and Python scripts while preserving other placeholders and existing files.
  • Remove the blank line after the tasks template’s opening front-matter delimiter.
  • Add cross-language regression coverage and update an existing plan-template assertion.

AI-generated review for the requester by GitHub Copilot (model unknown, autonomous). Validation used source inspection; tests were not run.

File Description
tests/​test_template_date_and_frontmatter.py Adds date-substitution, preservation, error-path, and front-matter tests.
tests/​test_setup_plan_no_overwrite.py Updates expected plan content to include the generated date.
templates/​tasks-template.md Removes the blank line inside front matter.
scripts/​python/​setup_plan.py Substitutes [DATE] in new plans.
scripts/​python/​create_new_feature.py Substitutes [DATE] in new specifications.
scripts/​powershell/​setup-plan.ps1 Adds literal, culture-independent date substitution for plans.
scripts/​powershell/​create-new-feature.ps1 Adds literal, culture-independent date substitution for specifications.
scripts/​bash/​setup-plan.sh Substitutes dates while preserving trailing newlines.
scripts/​bash/​create-new-feature.sh Substitutes the exact date token in new specifications.

Review effort: Balanced (adaptive)

Copilot AI adaptive review requested due to automatic review settings November 28, 2026 12:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the changes to populate date placeholders in generated specifications and plans.

No open issues 🎉

1 resolved since last review

Review effort: Balanced (adaptive)

@IlayWolfson
IlayWolfson force-pushed the fix/4335-template-date-and-frontmatter branch from 0f7cbba to 678783d Compare November 28, 2026 22:09
Copilot AI adaptive review requested due to automatic review settings November 28, 2026 22:09
@IlayWolfson IlayWolfson changed the title fix: substitute [DATE] in feature/plan scripts and fix tasks-template… fix: substitute [DATE] in create-new-feature and setup-plan scripts Nov 28, 2026
@IlayWolfson

IlayWolfson commented Nov 28, 2026 •

Copy link
Copy Markdown
Author

Force-pushed 0f7cbba → ff38bd9 to rescope this PR to the [DATE] fix only (one concern per PR). The tasks-template.md front-matter fix is removed here and will come as a separate PR.

  • Squashed into one commit; the message now says "Part of [Bug]: Template files are inconsistently formatted #4335" so merging won't auto-close the issue.
  • Evidence: the 36 tests in tests/test_template_date_substitution.py give 24 failed / 12 passed on main and 36/36 passed on this branch (Python, Windows PowerShell 5.1, Git Bash). The 12 that pass on main guard behavior that must not change (--dry-run, no-overwrite, other placeholders).
  • The Copilot finding (test targeting 002-existing) is fixed in this commit.
  • The intermediate push 678783d still contained the front-matter test by mistake (Copilot flagged it); ff38bd9 removes it.

AI disclosure: the rescope, squash and the Copilot test fixes were done with Claude (Opus 5.5) under my direction; I reviewed and ran the checks.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The template’s blank-line removal is missing, causing the new regression assertion to fail on every platform before YAML parsing.

1 open issue

Review effort: Balanced (adaptive)

Replaces literal [DATE] with today's local YYYY-MM-DD date when
create-new-feature and setup-plan write spec.md and plan.md, across
bash, PowerShell 5.1, and Python. Plain string replace, so other
placeholders are untouched; --dry-run, --json and no-overwrite of an
existing spec.md/plan.md behave as before.

Part of github#4335.

Assisted-by: Antigravity (model: claude-opus-5-5-high, autonomous)
Assisted-by: Antigravity (model: gemini-4-neon-high, autonomous)
@IlayWolfson
IlayWolfson force-pushed the fix/4335-template-date-and-frontmatter branch from 678783d to ff38bd9 Compare November 28, 2026 22:18
Copilot AI adaptive review requested due to automatic review settings November 28, 2026 22:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the cross-platform date-substitution change.

No open issues 🎉

1 resolved since last review

Review effort: Balanced (adaptive)

This branch has not been deployed

No deployments
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