Ctrl + K
DocumentationLog inGet started

tessl-labs/intent-integrity-kit

tessl install tessl-labs/intent-integrity-kit@1.0.2

Closing the intent-to-code chasm - specification-driven development with cryptographic verification

init-project.shskills/iikit-core/scripts/bash/

#!/usr/bin/env bash

# Initialize a intent-integrity-kit project with git
# Usage: init-project.sh [--json] [--commit-constitution]

set -e

JSON_MODE=false
COMMIT_CONSTITUTION=false

while [[ $# -gt 0 ]]; do
    case "$1" in
        --json)
            JSON_MODE=true
            shift
            ;;
        --commit-constitution)
            COMMIT_CONSTITUTION=true
            shift
            ;;
        --help|-h)
            echo "Usage: $0 [--json] [--commit-constitution]"
            echo ""
            echo "Initialize a intent-integrity-kit project with git repository."
            echo ""
            echo "Options:"
            echo "  --json                 Output in JSON format"
            echo "  --commit-constitution  Commit the constitution file after git init"
            echo "  --help, -h             Show this help message"
            exit 0
            ;;
        *)
            echo "Unknown option: $1" >&2
            exit 1
            ;;
    esac
done

# Use current working directory as project root
PROJECT_ROOT="$(pwd)"

# Check if .specify exists (validates this is a intent-integrity-kit project)
if [ ! -d "$PROJECT_ROOT/.specify" ]; then
    if $JSON_MODE; then
        printf '{"success":false,"error":"Not a intent-integrity-kit project: .specify directory not found","git_initialized":false}\n'
    else
        echo "Error: Not a intent-integrity-kit project. Directory .specify not found." >&2
    fi
    exit 1
fi

# Check if already a git repo
if [ -d "$PROJECT_ROOT/.git" ]; then
    GIT_INITIALIZED=false
    GIT_STATUS="already_initialized"
else
    # Initialize git
    git init "$PROJECT_ROOT" >/dev/null 2>&1
    GIT_INITIALIZED=true
    GIT_STATUS="initialized"
fi

# Commit constitution if requested and it exists
CONSTITUTION_COMMITTED=false
if [ "$COMMIT_CONSTITUTION" = true ] && [ -f "$PROJECT_ROOT/CONSTITUTION.md" ]; then
    cd "$PROJECT_ROOT"
    git add CONSTITUTION.md
    # Also add README if it exists
    if [ -f "$PROJECT_ROOT/README.md" ]; then
        git add README.md
    fi
    # Check if there's anything to commit
    if ! git diff --cached --quiet 2>/dev/null; then
        git commit -m "Initialize intent-integrity-kit project with constitution" >/dev/null 2>&1
        CONSTITUTION_COMMITTED=true
    fi
fi

if $JSON_MODE; then
    printf '{"success":true,"git_initialized":%s,"git_status":"%s","constitution_committed":%s,"project_root":"%s"}\n' \
        "$GIT_INITIALIZED" "$GIT_STATUS" "$CONSTITUTION_COMMITTED" "$PROJECT_ROOT"
else
    if [ "$GIT_INITIALIZED" = true ]; then
        echo "[specify] Git repository initialized at $PROJECT_ROOT"
    else
        echo "[specify] Git repository already exists at $PROJECT_ROOT"
    fi
    if [ "$CONSTITUTION_COMMITTED" = true ]; then
        echo "[specify] Constitution committed to git"
    fi
fi

Version

Workspace
tessl-labs
Visibility
Public
Created
Last updated

skills

index.mdtile.json