Skip to content

fix(init): create start.prompt.md on init and fix next-steps guidance#746

Closed
edenfunf wants to merge 1 commit intomicrosoft:mainfrom
edenfunf:fix/init-create-starter-prompt
Closed

fix(init): create start.prompt.md on init and fix next-steps guidance#746
edenfunf wants to merge 1 commit intomicrosoft:mainfrom
edenfunf:fix/init-create-starter-prompt

Conversation

@edenfunf
Copy link
Copy Markdown
Contributor

@edenfunf edenfunf commented Apr 17, 2026

Closes #747

What

Before: apm init created only apm.yml. Running apm run start immediately after would fail with prompt file not found. The "Next Steps" panel also listed apm install and apm compile, neither of which is required for a basic first run.

After: apm init creates start.prompt.md alongside apm.yml. Next Steps now shows the three essential steps: install a runtime, edit the prompt, run.

- next_steps = [
-     "Install a runtime:       apm runtime setup copilot",
-     "Add APM dependencies:    apm install <owner>/<repo>",
-     "Compile agent context:   apm compile",
-     "Run your first workflow: apm run start",
- ]
+ next_steps = [
+     "Install a runtime:       apm runtime setup copilot",
+     "Edit your prompt:        open start.prompt.md and write your instructions",
+     "Run your first workflow: apm run start",
+ ]

Why

The root problem is that apm run start looks for start.prompt.md to exist, so apm init leaving it absent breaks the advertised end-to-end flow. apm install and apm compile are listed as if required but a fresh project with a single prompt file needs neither.

The overwrite-confirm path used _lazy_confirm() with a bare except Exception fallback; replacing it with click.confirm() (consistent with the rest of the fallback paths in the same file) avoids swallowing unexpected exceptions.

How

  • _helpers._create_minimal_apm_yml(): after writing apm.yml, write start.prompt.md with a template if it does not yet exist. Skipped for --plugin mode (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: add start.prompt.md to the "Created Files" table (both rich and plain-text paths). Fix next-steps list. Replace _lazy_confirm() block with click.confirm().

Reference: src/apm_cli/commands/_helpers.py_create_plugin_json() uses the same "create if not exists" pattern for plugin.json.

Test

pytest tests/unit/test_init_command.py    15/15  pass  (Python 3.13, Windows 11)
pytest tests/unit/                       3865/3865  pass  (no regression)

New test test_init_starter_prompt_not_overwritten verifies that re-running apm init --yes on an existing project does not clobber a customised start.prompt.md.

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)
@edenfunf
Copy link
Copy Markdown
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.

@edenfunf edenfunf closed this Apr 17, 2026
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.

apm init does not create start.prompt.md, causing apm run start to fail immediately

1 participant