Skip to content

Export stack scaffolding primitives for setup reuse #1600

Closed

Description

@propr-dev

Context

propr setup needs to initialize a stack directory as one wizard step. The existing propr init stack implementation already has the correct behavior: create data/, logs/, repos/, copy .env.example, detect credential directories, and persist stackRoot. Setup should reuse that logic instead of duplicating it.

Requirements

  • Export the existing stack scaffolding function and result type from initStack.ts.
  • Keep the propr init stack command behavior unchanged.
  • Ensure setup can call stack scaffolding without forcing overwrite.

Implementation Specification

Modify packages/cli/src/commands/initStack.ts to export the relevant types and function. If the current function is private, convert it to an exported function without changing its implementation.

Acceptance Criteria

  • Existing propr init stack tests continue to pass.
  • New setup code can import scaffoldStack directly.
  • Re-running setup against an initialized root does not overwrite .env unless an explicit force option is added later.

Created by ProPR AI Planner

Activity

  1. propr-dev commented on Jun 22, 2026

    @propr-dev
    ContributorAuthor

    Suggested Implementation:

    Implementation Approach

    This change deliberately reuses the existing stack initializer as the single source of truth. Duplicating directory creation and .env generation inside setup would create drift, especially around agent credential detection and file permissions. The rejected alternative was shelling out to propr init stack, but direct function reuse gives better error handling and avoids spawning a nested CLI process.

    File: packages/cli/src/commands/initStack.ts

    Why this file: initStack.ts already owns stack scaffolding. Setup needs access to that implementation so both commands create identical runtime directories and .env files.

    --- a/packages/cli/src/commands/initStack.ts
    +++ b/packages/cli/src/commands/initStack.ts
    @@
    -interface StackScaffoldResult {
    +export interface StackScaffoldResult {
    @@
    -async function scaffoldStack(options: StackScaffoldOptions): Promise<StackScaffoldResult> {
    +export async function scaffoldStack(options: StackScaffoldOptions): Promise<StackScaffoldResult> {
    +  // Export this helper so `propr setup` can reuse the exact same stack
    +  // initialization behavior. Keeping one implementation avoids subtle drift in
    +  // .env defaults, credential detection, and stackRoot persistence.
    @@
     }
  2. propr-dev commented on Jun 22, 2026

    @propr-dev
    ContributorAuthor

    🤖 AI processing has started for this issue using claude agent with claude-opus-4-8 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-4-8
    • Branch: 1600/claude-opus-4-8-export-stack-scaffolding--20260622-0947-l9p
    • Base Branch: 1599-epic-build-comprehensive-b5c
    • Worktree: issue-1600-20260622-0947-claude-opus-4-8-l9p

    🔍 Track Task Execution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions