Skip to content

Refactor apm init to minimal-only mode (breaking change) #13

@danielmeppiel

Description

@danielmeppiel

Summary

Refactor apm init to create only minimal apm.yml by default, removing all template scaffolding. This aligns APM with npm's behavior where npm init creates only package.json.

Current Behavior

  • Creates full scaffold: apm.yml, hello-world.prompt.md, feature-implementation.prompt.md, README.md, .apm/ directory structure
  • Prompts to overwrite files in existing projects
  • Single mode with template-heavy defaults

Target Behavior

  • Creates only apm.yml with auto-detected metadata
  • No template files, no example prompts, no README generation
  • Works cleanly in brownfield projects without file pollution
  • Supports optional project name argument

Expected Commands

apm init           # Minimal apm.yml in current directory
apm init -y        # Skip prompts, use auto-detected defaults
apm init my-project # Create my-project/ with minimal apm.yml

Implementation Requirements

Auto-Detection System

  • Extract project name from directory name or git repository
  • Extract author from git config user.name
  • Extract description from git repository description if available
  • Fallback to sensible defaults for all fields

Minimal apm.yml Output

name: <auto-detected>
version: 1.0.0
description: <auto-detected or default>
author: <from git config or "Developer">

dependencies:
  apm: []
  mcp: []

scripts: {}

Code Changes

  • Remove template file creation logic (_create_project_files)
  • Remove template loading (_load_template_file)
  • Simplify to single minimal mode
  • Update argument parsing to accept optional project name
  • Add auto-detection utilities
  • Update tests to reflect minimal behavior

Breaking Changes

  • Users relying on automatic template generation will need to adapt
  • Template files (hello-world.prompt.md, etc.) no longer created
  • .apm/ directory structure no longer auto-generated

Acceptance Criteria

  • apm init creates only apm.yml in current directory
  • apm init -y skips all prompts using auto-detected defaults
  • apm init my-project creates my-project/ directory with apm.yml
  • Auto-detection extracts metadata from git config and repository
  • No template files are created
  • Works in existing projects without prompting about overwrites
  • All existing tests updated to reflect new behavior
  • New tests added for auto-detection logic

Related

Part of npm-parity redesign for brownfield adoption (issue #TBD)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions