# Cloud-Kinetix Scripts

This directory contains essential scripts for the Cloud-Kinetix BMAD Enhanced project.

## Scripts Overview (in execution order)

### 🧪 Testing & Validation

- **00-test-upstream-bmad.sh** - Tests pure upstream BMAD installation
  - Analyzes what files/directories upstream BMAD creates
  - Helps track upstream behavior for compatibility
  - Documents legacy files and modern directory structures
  - Usage: `bash ck-layer/scripts/00-test-upstream-bmad.sh`

- **01-validate-installer.sh** - Comprehensive installer validation
  - Tests full installation with all IDEs including GitHub Copilot
  - Validates upstream BMAD + CK expansion packs
  - Checks all 8 IDE configurations
  - Usage: `npm run validate` or `bash ck-layer/scripts/01-validate-installer.sh`

- **02-test-local-install.sh** - Tests various installation scenarios
  - Multiple IDE combinations
  - Different expansion pack configurations
  - Edge cases and error handling
  - Usage: `npm run test:pre-publish` or `bash ck-layer/scripts/02-test-local-install.sh`

### 🚀 Publishing & Release

- **04-npm-publish-beta.sh** - Publishes beta versions to NPM
  - Usage: `npm run publish:beta` or `bash ck-layer/scripts/04-npm-publish-beta.sh`
  - Automatically runs pre-publish validation
  - Creates beta version with timestamp

- **05-test-published-beta.sh** - Tests the published beta version from NPM
  - Usage: `npm run test:beta` or `bash ck-layer/scripts/05-test-published-beta.sh`
  - Downloads and tests beta from NPM registry
  - Validates all installation scenarios

- **06-npm-publish-stable.sh** - Publishes stable production versions to NPM
  - Usage: `npm run publish:stable` or `bash ck-layer/scripts/06-npm-publish-stable.sh`
  - Includes safety checks and confirmations
  - Requires clean version number (no pre-release suffix)

- **07-test-published-stable.sh** - Tests the published stable version from NPM
  - Usage: `npm run test:stable` or `bash ck-layer/scripts/07-test-published-stable.sh`
  - Downloads and tests stable from NPM registry
  - Final validation after stable release

### Pre-Publish Validation

- **03-pre-publish-validation.sh** - Comprehensive pre-publish validation
  - Usage: `npm run pre-publish:check` or `bash ck-layer/scripts/03-pre-publish-validation.sh`
  - Validates package integrity
  - Tests end-user installation commands
  - Generates validation reports
  - Note: Automatically called by publish scripts

## Usage

### Complete Publishing Workflow

Follow these steps in order:

```bash
# Step 0: Analyze upstream BMAD behavior (optional but recommended)
bash ck-layer/scripts/00-test-upstream-bmad.sh

# Step 1: Validate installer functionality
npm run validate

# Step 2: Test local installations
npm run test:local

# Step 3: Run pre-publish validation (optional - called automatically by publish scripts)
npm run pre-publish:check

# Step 4: Publish beta version
npm run publish:beta

# Step 5: Test the published beta version
npm run test:beta

# Step 6: Publish stable version (after beta testing)
npm run publish:stable

# Step 7: Test the published stable version
npm run test:stable
```

### Publishing to NPM

After validation passes:

```bash
# Publish beta version
npm run publish:beta

# After beta testing, publish stable version
npm run publish:stable
```

### Testing Installation

To validate what end users will experience:

```bash
npm run test:local    # Test local installation
npm run test:beta     # Test NPM beta installation
npm run test:stable   # Test NPM stable installation
npm run test:all      # Run all three tests in sequence
```

## Notes

- All scripts use the layered architecture structure
- Publishing includes automatic validation and testing
- The 03-pre-publish-validation.sh script creates detailed validation reports in test-results/validation/
