Installation

Bootstrap, portability, installation, adoption, and updates.

Last Updated: 2026-02-15

Level 0: Stakeholder Needs (WHY)

Need: Automatic Environment Bootstrap NEED_INST_BOOTSTRAP
status: implemented
tags: installation, init, automation
priority: high

As a developer (or cloud agent), I want to have the sphinx-needs environment auto-initialize, so that I can start working without manual setup.

Acceptance Scenarios:

  1. Given fresh checkout, When I run init script, Then dependencies are installed

  2. Given agent runs in cloud, When it needs sphinx, Then init runs automatically

  3. Given init completes, When I build docs, Then sphinx-build works

Need: Use ubFlow Across Projects NEED_INST_CROSS_PROJECT
status: implemented
tags: installation, portability, sync
priority: medium

As a developer, I want to use ubFlow in multiple projects, so that I have consistent requirements engineering everywhere.

Acceptance Scenarios:

  1. Given ubFlow is released, When I sync to new project, Then agents work

  2. Given ubFlow is updated, When I sync again, Then I get new version

  3. Given project-specific config, When I sync, Then my config is preserved

Need: Install ubFlow in New Project NEED_INST_NEW_PROJECT
status: implemented
tags: installation, install, distribution
priority: mandatory

As a developer starting a new project, I want to install ubFlow from the beginning, so that I have requirements engineering built-in from day one.

Acceptance Scenarios:

  1. Given the setup agent is available in .github/agents/, When I invoke @ubFlow.setup, Then ubFlow structure is created without requiring manual path configuration

  2. Given ubFlow is not found in the project directory, When I invoke @ubFlow.setup, Then the agent offers to download the latest version from GitHub

  3. Given installation completes, When I check, Then I’m ready to run bootstrap

  4. Given I need a specific version, When I install, Then I can obtain that version

Need: Adopt ubFlow in Existing Project NEED_INST_ADOPT_EXISTING
status: implemented
tags: installation, install, adoption, distribution
priority: mandatory

As a developer with an existing project, I want to adopt ubFlow without disrupting my current work, so that I can add requirements engineering to a project already in progress.

Acceptance Scenarios:

  1. Given I have an existing project with code, When I follow the adoption process, Then ubFlow is added alongside existing files

  2. Given I have existing documentation, When I adopt ubFlow, Then my existing docs are not overwritten

  3. Given adoption completes, When I check, Then I can start creating Stakeholder Needs

  4. Given ubFlow is not found in the project directory, When I start adoption, Then the agent offers to download the latest version from GitHub

Need: Update ubFlow to Latest Version NEED_INST_UPDATE
status: implemented
tags: installation, update, migration, distribution
priority: mandatory

As a developer using ubFlow, I want to update to the latest version, so that I benefit from new features, fixes, and improvements.

Acceptance Scenarios:

  1. Given ubFlow is installed, When a new version is available, Then I can update by following the update process

  2. Given I update ubFlow, When the update completes, Then my project-specific customizations are preserved

  3. Given a breaking change exists, When I update, Then I receive migration guidance

  4. Given I update, When I check, Then I can see which version I now have

Level 1: Requirements (WHAT)

Software Requirement: Portable Toolkit REQ_INST_PORTABLE
status: implemented
tags: installation, portability, sync
priority: high
links outgoing: NEED_INST_CROSS_PROJECT
links incoming: SPEC_INST_INIT_SCRIPTS

Description: ubFlow SHALL be a standalone toolkit that can be used across multiple projects.

Rationale: Enables ubFlow to be maintained separately and reused across multiple projects.

Acceptance Criteria:

  • AC-1: ubFlow is self-contained and portable

  • AC-2: ubFlow can be installed into any project

Note: Installation, update, and version tracking covered by REQ_INST_NEW_PROJECT through REQ_INST_AUTO_DETECT.

Software Requirement: Automatic Environment Setup REQ_INST_AUTO_SETUP
status: implemented
tags: installation, init, automation
priority: high

Description: ubFlow SHALL automatically initialize the sphinx-needs environment when it is not available.

Rationale: Agents running in cloud environments or fresh checkouts need to bootstrap their own dependencies without manual intervention.

Acceptance Criteria:

  • AC-1: Detect if sphinx-needs is installed

  • AC-2: Install required dependencies automatically

  • AC-3: Create required directory structure

  • AC-4: Validate installation before proceeding

Software Requirement: ubFlow Distribution via GitHub Releases REQ_INST_GITHUB_RELEASES
status: implemented
tags: installation, install, distribution
priority: mandatory

Description: ubFlow SHALL be distributed via GitHub Releases with semantic versioning.

Rationale: GitHub Releases provides versioned distribution with automatic archive creation, enabling users to obtain specific versions and track what they have installed.

Acceptance Criteria:

  • AC-1: User can identify release versions via GitHub Releases page

  • AC-2: User can download specific version archives (.zip, .tar.gz)

  • AC-3: Installation instructions are included with each release

Software Requirement: New Project Installation REQ_INST_NEW_PROJECT
status: implemented
tags: installation, install, new-project
priority: mandatory

Description: ubFlow SHALL be installable into a new project.

Rationale: New projects need a straightforward path to adopt ubFlow from the beginning.

Acceptance Criteria:

  • AC-1: User can invoke ubFlow agents after installation

  • AC-2: User can build sphinx-needs documentation after installation

  • AC-3: User receives clear confirmation of successful installation

  • AC-4: Setup agent SHALL use REQ_INST_AUTO_DETECT auto-detection to locate ubFlow files within the project directory

  • AC-5: Setup agent SHALL NOT require manual path input

Software Requirement: Existing Project Adoption REQ_INST_ADOPT_EXISTING
status: implemented
tags: installation, install, adoption
priority: mandatory

Description: ubFlow SHALL be adoptable into an existing project without data loss.

Rationale: Projects already in progress need to adopt ubFlow without disrupting their existing work.

Acceptance Criteria:

  • AC-1: User’s existing documentation is preserved

  • AC-2: User’s existing code is preserved

  • AC-3: User is guided through any required decisions

  • AC-4: User can invoke ubFlow agents after adoption

  • AC-5: Setup agent SHALL use REQ_INST_AUTO_DETECT auto-detection to locate ubFlow files within the project directory

Software Requirement: Version Update and Migration REQ_INST_VERSION_UPDATE
status: implemented
tags: installation, update, migration
priority: mandatory

Description: ubFlow SHALL be updatable to newer versions.

Rationale: Users need to benefit from new features, fixes, and improvements over time.

Acceptance Criteria:

  • AC-1: User can determine currently installed version AND newest available ubFlow via REQ_INST_AUTO_DETECT auto-detection

  • AC-2: User can update to a newer version

  • AC-3: User’s customizations are preserved after update

  • AC-4: User receives migration guidance for breaking changes

  • AC-5: Update SHALL use newest version found (not oldest cached)

Software Requirement: Customization Preservation REQ_INST_CUSTOM_PRESERVE
status: implemented
tags: installation, install, update, preservation
priority: high

Description: ubFlow SHALL preserve user customizations during adoption and updates.

Rationale: Users invest effort in customizing their requirements and configuration. This must not be lost during updates.

Acceptance Criteria:

  • AC-1: User-created requirements documents are preserved

  • AC-2: User-modified configuration is preserved

  • AC-3: User can identify what is ubFlow core vs user content

Software Requirement: Sphinx-Needs Mandatory Dependency REQ_INST_SPHINX_NEEDS_DEP
status: implemented
tags: installation, install, sphinx-needs, dependency
priority: mandatory

Description: ubFlow SHALL require sphinx-needs and its dependencies as mandatory components, and guide the user through installation if not available.

Rationale: sphinx-needs provides the traceability infrastructure that ubFlow relies on. The setup agent assists with dependency installation.

Acceptance Criteria:

  • AC-1: User is informed about required dependencies (Python, sphinx, sphinx-needs, furo)

  • AC-2: User is informed about optional dependencies (graphviz for diagrams)

  • AC-3: Setup agent guides user through installation of missing dependencies

  • AC-4: User can build documentation using sphinx-needs after setup

Software Requirement: Auto-Detection of ubFlow Installation REQ_INST_AUTO_DETECT
status: implemented
tags: installation, install, autodetect
priority: mandatory

Description: ubFlow SHALL auto-detect its own location by searching for version.json files within the project directory only.

Rationale: Release ZIP structure places ubFlow in versioned folders (ubFlow-X.Y.Z/). Manual path input is error-prone and breaks user experience. Auto-detection enables seamless installation from arbitrary extraction locations. Searching above the project root is a security/correctness risk when the download location is outside the workspace.

Acceptance Criteria:

  • AC-1: Search within the project directory (workspace root and subdirectories) for version.json files

  • AC-2: Parse each version.json to extract version number

  • AC-3: When multiple found, select newest semantic version (including pre-release tags)

  • AC-4: Return ubFlow root directory (where version.json was found)

  • AC-5: If no version.json found within project directory, inform user and offer to download the latest version from GitHub Releases

  • AC-6: Log all found versions for debugging

  • AC-7: SHALL NOT search above the project root directory

Level 2: Design (HOW)

Installation

Software Detailed Design: Init Scripts for Environment Setup SPEC_INST_INIT_SCRIPTS
status: implemented
tags: installation, init, scripts, install

Design: Minimal init scripts copy only the Setup Agent to enable installation. All other setup is handled interactively by the Setup Agent.

Script Locations (in ubFlow installation):

  • Windows: scripts/powershell/init.ps1

  • Unix: scripts/bash/init.sh

Script Behavior (minimal):

  1. Create .github/agents/ in target project

  2. Copy ubFlow.setup.agent.md from ubFlow’s .github/agents/

  3. Display message: “Open VS Code, start GitHub Copilot Chat, and select @ubFlow.setup”

Rationale:

  • Scripts are static and cannot adapt to user environment

  • Agent can interactively handle dependencies, conflicts, and user choices

  • Minimal script = less maintenance, fewer platform-specific issues

Usage:

# Windows (from target project directory)
C:\path\to\ubFlow\scripts\powershell\init.ps1

# Unix (from target project directory)
/path/to/ubFlow/scripts/bash/init.sh

Note: This is Step 1 of the installation process. Step 2 is invoking @ubFlow.setup agent.

Software Detailed Design: Setup Agent Design SPEC_INST_SETUP_AGENT

Design: Installation is a two-step process: init script, then setup agent.

Step 1: Init Script (manual)

  • User runs scripts/powershell/init.ps1 (or bash/init.sh) from ubFlow location

  • Script copies ubFlow.setup.agent.md from .github/agents/ to target project’s .github/agents/

  • Covered by SPEC_INST_INIT_SCRIPTS

Step 2: Setup Agent (@ubFlow.setup)

Section 1: Auto-Detect ubFlow Location

  1. Run Find-UbFlowInstallation (SPEC_INST_AUTO_DETECT)

  2. Log all found versions for transparency

  3. Select newest version

  4. If none found: Inform user that ubFlow was not found in the project directory. Offer to download the latest version from GitHub Releases (reuse GitHub Release Query mechanism from SPEC_INST_UPDATE_PROCESS). After download and extraction into the project directory, re-run Find-UbFlowInstallation to locate the downloaded version.

Section 2: Check Dependencies (Interactive)

The setup agent guides the user through installing required dependencies:

  1. Check Python: Verify python --version available

  2. Check pip/uv: Verify package manager available

  3. Inform user about what will be installed:

    Required dependencies:
    - sphinx >= 7.0.0 (documentation generator)
    - sphinx-needs >= 2.0.0 (requirements traceability)
    - furo >= 2024.0.0 (documentation theme)
    - myst-parser >= 2.0.0 (Markdown support)
    
    Optional (for diagrams):
    - graphviz (Python package + system tool)
    
  4. Install with user confirmation:

    pip install sphinx sphinx-needs furo myst-parser
    
  5. Graphviz (optional):

    • Check if dot --version works

    • If not: inform user that needflow diagrams won’t render

    • Provide manual install instructions:

      Windows: winget install Graphviz.Graphviz
      macOS:   brew install graphviz
      Linux:   sudo apt install graphviz
      
    • Note: System package managers may require admin rights

  6. Validate: Run sphinx-build --version to confirm

Section 3: Copy Files from ubFlow

Using $ubFlowRoot from auto-detection:

  • Copy agents: $ubFlowRoot/.github/agents/*.agent.md.github/agents/

  • Copy prompts: $ubFlowRoot/.github/prompts/*.prompt.md.github/prompts/

  • Copy skills: $ubFlowRoot/.github/skills/*.skill.md.github/skills/

  • Apply intelligent merge (SPEC_INST_FILE_OWNERSHIP)

Section 4: Validate and Confirm

  • Validate successful sphinx-build

  • Rename version.json to version_installed.json

  • Confirm success

Works for both new and existing projects.

Existing Project Handling:

  • Detects existing docs/conf.py and merges sphinx-needs config

  • Detects existing .github/ content and merges safely

  • Prompts user for decisions on conflicts

File Ownership & Updates

Software Detailed Design: File Layout and Ownership SPEC_INST_FILE_OWNERSHIP
status: implemented
tags: installation, install, update, ownership

Design: Clear separation between ubFlow core files and user content.

UbFlow Core (with intelligent merge):

  • .ubFlow/** (entire folder) - replaceable

  • .github/agents/ubFlow.*.agent.md - merge if modified

  • .github/prompts/ubFlow.*.prompt.md - merge if modified

  • .github/skills/ubFlow.*.skill.md - merge if modified

Intelligent Merge for Agent Files:

When updating agent/prompt files, the setup agent SHALL:

  1. Check for modifications: Compare target file with original ubFlow version

  2. If unmodified: Replace silently

  3. If modified: Show diff to user and ask:

    • Overwrite: Replace with new ubFlow version (lose customizations)

    • Keep: Keep user’s version (may miss new features)

    • Merge: Agent attempts to merge changes interactively

User Content (preserved during updates):

  • docs/modules/** (user’s specifications by theme)

  • docs/changes/** (user’s change documents)

  • .github/copilot-instructions.md (user’s memory)

  • .github/agents/*.agent.md (non-ubFlow agents)

  • .github/prompts/*.prompt.md (non-ubFlow prompts)

Shared/Merged (require interactive merge):

  • docs/conf.py (ubFlow config + user additions)

  • docs/pyproject.toml or docs/requirements.txt

Software Detailed Design: Update Process SPEC_INST_UPDATE_PROCESS
status: implemented
tags: installation, update, migration

Design: Update is agent-driven with backup and rollback support.

Update Flow:

Step 0: Find Newest ubFlow Version

  1. Run Find-UbFlowInstallation (SPEC_INST_AUTO_DETECT)

  2. Log all found versions for transparency

  3. Select newest version as source for update

  4. Compare with currently installed version (.ubFlow/version.json)

  5. If found version <= installed version:

    • Warn user: “Found version X.Y.Z is not newer than installed X.Y.Z”

    • Suggest checking for latest release on GitHub

    • Abort update

  6. If found version > installed version: Proceed to Step 1

Step 1: Detect Update Mode

  1. User invokes @ubFlow.setup (same agent for install and update)

  2. Agent detects existing .ubFlow/version.json → update mode

  3. Inform user of current and target versions

Step 2: Backup and Update

If newer version available (from Step 0):

  1. Backup: Check for .ubFlow_backup/ → delete if exists

  2. Backup: Rename .ubFlow/.ubFlow_backup/

  3. Download: Fetch latest release ZIP from GitHub

  4. Extract: Unpack to .ubFlow/

  5. Merge: Copy agents/prompts/skills with intelligent merge (see SPEC_INST_FILE_OWNERSHIP)

  6. Validate: Run sphinx-build to verify

  7. Success: Delete .ubFlow_backup/

  8. Failure: Restore .ubFlow_backup/.ubFlow/, inform user

GitHub Release Query:

# Agent uses fetch_webpage or terminal curl
curl -s https://api.github.com/repos/OWNER/ubFlow/releases/latest

Rollback on Failure:

If any step fails after backup:

  • Remove partial .ubFlow/

  • Rename .ubFlow_backup/ back to .ubFlow/

  • Inform user: “Update failed, rolled back to previous version”

Auto-Detection

Software Detailed Design: ubFlow Auto-Detection Algorithm SPEC_INST_AUTO_DETECT
status: implemented
tags: installation, install, autodetect, powershell

Design: PowerShell/Bash function that finds ubFlow installation via version.json search within the project directory only.

Algorithm (PowerShell):

function Find-UbFlowInstallation {
    # Search ONLY within the project directory (workspace root)
    $projectRoot = Get-Location

    $foundVersions = @()

    # Find all version.json files recursively within project directory
    $versionFiles = Get-ChildItem -Path $projectRoot -Filter "version.json" `
                                  -Recurse -Depth 3 -ErrorAction SilentlyContinue

    foreach ($file in $versionFiles) {
        try {
            $content = Get-Content $file.FullName | ConvertFrom-Json
            $version = $content.version

            # Skip if not ubFlow version format
            if ($version -notmatch '^(\d+)\.(\d+)\.(\d+)(-\w+(\.\d+)?)?$') {
                continue
            }

            $foundVersions += [PSCustomObject]@{
                Path = $file.Directory.FullName
                Version = $version
                File = $file.FullName
            }
        } catch {
            # Skip invalid JSON
            continue
        }
    }

    if ($foundVersions.Count -eq 0) {
        Write-Host "No ubFlow installation found in project directory: $projectRoot"
        Write-Host ""
        Write-Host "Would you like to download the latest version from GitHub?"
        Write-Host "  The setup agent can fetch the latest release automatically."
        return $null  # Agent handles GitHub download interactively
    }

    # Sort by version (newest first)
    $sorted = $foundVersions | Sort-Object {
        if ($_.Version -match '^(\d+)\.(\d+)\.(\d+)(-(\w+)\.?(\d+)?)?') {
            $major = [int]$matches[1]
            $minor = [int]$matches[2]
            $patch = [int]$matches[3]
            $prerelease = $matches[5]
            $prereleaseNum = if ($matches[6]) { [int]$matches[6] } else { 0 }
            return @($major, $minor, $patch, $(if ($prerelease) { 0 } else { 999 }), $prereleaseNum)
        }
    } -Descending

    # Log all found versions
    Write-Host "Found ubFlow installations:"
    $sorted | ForEach-Object {
        Write-Host "  v$($_.Version) at $($_.Path)"
    }

    # Return newest
    $newest = $sorted[0]
    Write-Host "Selected newest: v$($newest.Version)" -ForegroundColor Green

    return $newest.Path
}

Bash Version:

Equivalent logic in bash using find, jq, and sort.

Edge Cases:

  1. No version.json found: Inform user, offer GitHub download

  2. Multiple identical versions: Pick first found (arbitrary but consistent)

  3. Invalid JSON: Skip file and continue search

  4. Non-ubFlow version.json: Skip (version format check)

  5. ubFlow downloaded outside project: Not found — GitHub fallback offered

Rationale:

  • Searches only within project directory — never escapes project root

  • Works with release ZIP extracted into project directory

  • Works with git clone within project directory

  • Works with multiple versions side-by-side

  • Always selects newest (important for updates)

  • Transparent debugging (logs all found versions)

  • Falls back to GitHub download when not found locally

Distribution

Software Detailed Design: Release Structure SPEC_INST_RELEASE_STRUCTURE
status: implemented
tags: installation, install, distribution, release

Design: ubFlow releases are distributed via GitHub Releases, which automatically creates .zip and .tar.gz archives of the repository at tagged commits.

Release Contents:

  • Complete ubFlow repository structure

  • version.json with release version

  • README with installation instructions

  • docs/releasenotes.md with release history

Version Identification:

  • version.json at repository root contains release version

  • After successful install: copied to project’s .ubFlow/version.json

Directory Structure in Release Archive:

ubFlow-X.Y.Z/
├── .github/
│   ├── agents/       # Agent definitions (*.agent.md)
│   ├── prompts/      # Prompt files (*.prompt.md)
│   ├── skills/       # Skill files (*.skill.md)
│   └── copilot-instructions.md
├── scripts/          # Init and utility scripts
├── templates/        # Document templates
├── docs/             # Self-documentation (including releasenotes.md)
├── version.json      # Release version
└── README.md         # Installation instructions

GitHub Release Mechanism:

  • Maintainer pushes annotated Git tag (e.g., v0.2.0)

  • GitHub automatically creates source archives

  • GitHub Actions publishes documentation to GitHub Pages

  • Release notes from docs/releasenotes.md displayed on release page

Rationale:

  • .github/agents/ is the standard location for GitHub Copilot agents

  • Single source of truth - no duplication between agents/ and .github/agents/

  • Works immediately after git clone or archive extraction without additional setup

  • GitHub’s automatic archiving ensures consistent distribution

Traceability

Stakeholder Needs

ID

Title

Status

Priority

NEED_INST_ADOPT_EXISTING

Adopt ubFlow in Existing Project

implemented

mandatory

NEED_INST_BOOTSTRAP

Automatic Environment Bootstrap

implemented

high

NEED_INST_CROSS_PROJECT

Use ubFlow Across Projects

implemented

medium

NEED_INST_NEW_PROJECT

Install ubFlow in New Project

implemented

mandatory

NEED_INST_UPDATE

Update ubFlow to Latest Version

implemented

mandatory

Requirements

ID

Title

Status

Tags

REQ_INST_ADOPT_EXISTING

Existing Project Adoption

implemented

installation; install; adoption

REQ_INST_AUTO_DETECT

Auto-Detection of ubFlow Installation

implemented

installation; install; autodetect

REQ_INST_AUTO_SETUP

Automatic Environment Setup

implemented

installation; init; automation

REQ_INST_CUSTOM_PRESERVE

Customization Preservation

implemented

installation; install; update; preservation

REQ_INST_GITHUB_RELEASES

ubFlow Distribution via GitHub Releases

implemented

installation; install; distribution

REQ_INST_NEW_PROJECT

New Project Installation

implemented

installation; install; new-project

REQ_INST_PORTABLE

Portable Toolkit

implemented

installation; portability; sync

REQ_INST_SPHINX_NEEDS_DEP

Sphinx-Needs Mandatory Dependency

implemented

installation; install; sphinx-needs; dependency

REQ_INST_VERSION_UPDATE

Version Update and Migration

implemented

installation; update; migration

Design Specifications

ID

Title

Status

Links

SPEC_INST_AUTO_DETECT

ubFlow Auto-Detection Algorithm

implemented

SPEC_INST_FILE_OWNERSHIP

File Layout and Ownership

implemented

SPEC_INST_INIT_SCRIPTS

Init Scripts for Environment Setup

implemented

SPEC_INST_RELEASE_STRUCTURE

Release Structure

implemented

SPEC_INST_SETUP_AGENT

Setup Agent Design

implemented

SPEC_INST_UPDATE_PROCESS

Update Process

implemented