fix(init): create start.prompt.md on init and fix next-steps guidance#746
Closed
edenfunf wants to merge 1 commit intomicrosoft:mainfrom
Closed
fix(init): create start.prompt.md on init and fix next-steps guidance#746edenfunf wants to merge 1 commit intomicrosoft:mainfrom
edenfunf wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Without a starter prompt, running `apm run start` immediately after
`apm init` fails with "prompt file not found". This change creates
start.prompt.md during init so the end-to-end flow works out of the box.
Changes:
- _helpers.py: _create_minimal_apm_yml() creates start.prompt.md (skipped
if file already exists, and skipped for --plugin mode)
- init.py: list start.prompt.md in the "Created Files" table after init
- init.py: simplify next-steps to the 3 essential steps (install runtime,
edit prompt, run); remove apm install and apm compile which are not
required for a basic first run
- init.py: replace _lazy_confirm() / try-except-Exception overwrite prompt
with a plain click.confirm() to avoid swallowing unexpected exceptions
- tests: assert start.prompt.md is created; add test verifying that
re-running init does not overwrite an existing start.prompt.md
Verified: pytest tests/unit/test_init_command.py -- 15/15 passed
pytest tests/unit/ -- 3865 passed, no regressions (Python 3.13, Windows 11)
Contributor
Author
|
Closing this — I realized I had already submitted PR #606 covering the same fix back on 2026-04-07 and forgot about it. Sorry for the noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #747
What
Before:
apm initcreated onlyapm.yml. Runningapm run startimmediately after would fail with prompt file not found. The "Next Steps" panel also listedapm installandapm compile, neither of which is required for a basic first run.After:
apm initcreatesstart.prompt.mdalongsideapm.yml. Next Steps now shows the three essential steps: install a runtime, edit the prompt, run.Why
The root problem is that
apm run startlooks forstart.prompt.mdto exist, soapm initleaving it absent breaks the advertised end-to-end flow.apm installandapm compileare listed as if required but a fresh project with a single prompt file needs neither.The overwrite-confirm path used
_lazy_confirm()with a bareexcept Exceptionfallback; replacing it withclick.confirm()(consistent with the rest of the fallback paths in the same file) avoids swallowing unexpected exceptions.How
_helpers._create_minimal_apm_yml(): after writingapm.yml, writestart.prompt.mdwith a template if it does not yet exist. Skipped for--pluginmode (matches the existing pattern where plugin projects don't receive a starter prompt). Pattern mirrors the_create_plugin_json()neighbour: create once, never overwrite.init.py: addstart.prompt.mdto the "Created Files" table (both rich and plain-text paths). Fix next-steps list. Replace_lazy_confirm()block withclick.confirm().Reference:
src/apm_cli/commands/_helpers.py—_create_plugin_json()uses the same "create if not exists" pattern forplugin.json.Test
New test
test_init_starter_prompt_not_overwrittenverifies that re-runningapm init --yeson an existing project does not clobber a customisedstart.prompt.md.