loki-mode 6.27.2 → 6.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/autonomy/loki CHANGED
@@ -392,7 +392,7 @@ show_help() {
392
392
  echo " start [PRD] Start Loki Mode (optionally with PRD file)"
393
393
  echo " quick \"task\" Quick single-task mode (lightweight, 3 iterations max)"
394
394
  echo " demo Run interactive demo (~60s simulated session)"
395
- echo " init Build a PRD interactively or from templates"
395
+ echo " init [name] Project scaffolding with 22 PRD templates"
396
396
  echo " issue <url|num> [DEPRECATED] Use 'loki run' instead"
397
397
  echo " watch [sec] Live TUI session monitor (v6.0.0)"
398
398
  echo " export <format> Export session data: json|markdown|csv|timeline (v6.0.0)"
@@ -6450,268 +6450,412 @@ QPRDEOF
6450
6450
  exec "$RUN_SH" "$quick_prd"
6451
6451
  }
6452
6452
 
6453
- # Interactive PRD builder
6453
+ # Project scaffolding (v6.28.0)
6454
6454
  cmd_init() {
6455
6455
  local version=$(get_version)
6456
- local output_file="./prd.md"
6457
- local template=""
6458
- local start_after=false
6456
+ local project_name=""
6457
+ local template_name=""
6458
+ local no_git=false
6459
+ local stdout_mode=false
6460
+ local dry_run=false
6461
+ local list_mode=false
6462
+ local json_mode=false
6463
+
6464
+ # 22 built-in template names (order: simple, standard, complex)
6465
+ local TEMPLATE_NAMES=(
6466
+ simple-todo-app
6467
+ static-landing-page
6468
+ api-only
6469
+ rest-api
6470
+ rest-api-auth
6471
+ cli-tool
6472
+ discord-bot
6473
+ chrome-extension
6474
+ blog-platform
6475
+ full-stack-demo
6476
+ web-scraper
6477
+ data-pipeline
6478
+ dashboard
6479
+ game
6480
+ slack-bot
6481
+ npm-library
6482
+ microservice
6483
+ mobile-app
6484
+ saas-app
6485
+ saas-starter
6486
+ e-commerce
6487
+ ai-chatbot
6488
+ )
6489
+
6490
+ local -A TEMPLATE_LABELS=(
6491
+ [simple-todo-app]="Simple Todo App"
6492
+ [static-landing-page]="Static Landing Page"
6493
+ [api-only]="REST API (No Frontend)"
6494
+ [rest-api]="REST API"
6495
+ [rest-api-auth]="REST API with Auth"
6496
+ [cli-tool]="CLI Tool"
6497
+ [discord-bot]="Discord Bot"
6498
+ [chrome-extension]="Chrome Extension"
6499
+ [blog-platform]="Blog Platform"
6500
+ [full-stack-demo]="Full-Stack Demo"
6501
+ [web-scraper]="Web Scraper"
6502
+ [data-pipeline]="Data Pipeline"
6503
+ [dashboard]="Analytics Dashboard"
6504
+ [game]="Browser Game"
6505
+ [slack-bot]="Slack Bot"
6506
+ [npm-library]="npm Library"
6507
+ [microservice]="Microservice"
6508
+ [mobile-app]="Mobile App"
6509
+ [saas-app]="SaaS Application"
6510
+ [saas-starter]="SaaS Starter Kit"
6511
+ [e-commerce]="E-Commerce Store"
6512
+ [ai-chatbot]="AI Chatbot (RAG)"
6513
+ )
6514
+
6515
+ local template_count=${#TEMPLATE_NAMES[@]}
6459
6516
 
6460
6517
  # Parse arguments
6461
6518
  while [[ $# -gt 0 ]]; do
6462
6519
  case "$1" in
6463
- --output|-o)
6464
- if [[ -n "${2:-}" ]]; then
6465
- output_file="$2"
6466
- shift 2
6467
- else
6468
- echo -e "${RED}--output requires a file path${NC}"
6469
- exit 1
6470
- fi
6520
+ --list)
6521
+ list_mode=true
6522
+ shift
6523
+ ;;
6524
+ --json)
6525
+ json_mode=true
6526
+ list_mode=true
6527
+ shift
6471
6528
  ;;
6472
6529
  --template|-t)
6473
6530
  if [[ -n "${2:-}" ]]; then
6474
- template="$2"
6531
+ template_name="$2"
6475
6532
  shift 2
6476
6533
  else
6477
- echo -e "${RED}--template requires a template name${NC}"
6534
+ echo -e "${RED}--template requires a value${NC}"
6478
6535
  exit 1
6479
6536
  fi
6480
6537
  ;;
6481
- --start|-s)
6482
- start_after=true
6538
+ --no-git)
6539
+ no_git=true
6483
6540
  shift
6484
6541
  ;;
6485
- --list-templates)
6486
- _list_templates
6487
- exit 0
6542
+ --stdout)
6543
+ stdout_mode=true
6544
+ shift
6545
+ ;;
6546
+ --dry-run)
6547
+ dry_run=true
6548
+ shift
6488
6549
  ;;
6489
6550
  --help|-h)
6490
- echo -e "${BOLD}loki init${NC} - Interactive PRD builder"
6551
+ echo -e "${BOLD}loki init${NC} - Project scaffolding with PRD templates"
6552
+ echo ""
6553
+ echo "Usage: loki init [project-name] [--template TYPE]"
6554
+ echo ""
6555
+ echo "Creates a new project scaffold with a PRD, config directory, and README."
6556
+ echo "If no project-name is given, scaffolds the current directory."
6491
6557
  echo ""
6492
- echo "Usage: loki init [options]"
6558
+ echo "What it creates:"
6559
+ echo " prd.md PRD from selected template"
6560
+ echo " .loki/loki.config.json Project configuration"
6561
+ echo " README.md Project README stub"
6562
+ echo " .gitignore Git ignore rules (with git init)"
6493
6563
  echo ""
6494
6564
  echo "Options:"
6495
- echo " --output, -o FILE Output file (default: ./prd.md)"
6496
- echo " --template, -t NAME Start from a template"
6497
- echo " --start, -s Start loki mode after generating PRD"
6498
- echo " --list-templates List available templates"
6565
+ echo " --template, -t TYPE Template name (e.g., saas-app, cli-tool)"
6566
+ echo " --no-git Skip git init"
6567
+ echo " --stdout Print PRD to stdout instead of writing files"
6568
+ echo " --list List all available templates"
6569
+ echo " --json Machine-readable template list (JSON)"
6570
+ echo " --dry-run Show what would be created without doing it"
6571
+ echo " --help, -h Show this help"
6499
6572
  echo ""
6500
6573
  echo "Examples:"
6501
- echo " loki init Interactive PRD builder"
6502
- echo " loki init -t saas-starter Start from SaaS template"
6503
- echo " loki init -o docs/requirements.md Custom output path"
6504
- echo " loki init --start Build PRD and start immediately"
6574
+ echo " loki init my-saas --template saas-app Create my-saas/ with SaaS PRD"
6575
+ echo " loki init --template cli-tool Scaffold current dir with CLI PRD"
6576
+ echo " loki init my-app Create my-app/ (prompts for template)"
6577
+ echo " loki init --list Show all $template_count templates"
6578
+ echo " loki init --template rest-api --stdout Print REST API PRD to stdout"
6579
+ echo " loki init my-app --dry-run Preview without writing anything"
6505
6580
  exit 0
6506
6581
  ;;
6507
- *)
6582
+ -*)
6508
6583
  echo -e "${RED}Unknown option: $1${NC}"
6584
+ echo "Run 'loki init --help' for usage."
6509
6585
  exit 1
6510
6586
  ;;
6587
+ *)
6588
+ if [[ -z "$project_name" ]]; then
6589
+ project_name="$1"
6590
+ else
6591
+ echo -e "${RED}Too many arguments${NC}"
6592
+ echo "Usage: loki init [project-name] [--template TYPE]"
6593
+ exit 1
6594
+ fi
6595
+ shift
6596
+ ;;
6511
6597
  esac
6512
6598
  done
6513
6599
 
6514
- # If template specified, copy it
6515
- if [ -n "$template" ]; then
6516
- local template_file=""
6517
- # Check templates/ directory
6518
- for dir in "$SKILL_DIR/templates" "$SKILL_DIR/examples"; do
6519
- if [ -f "$dir/$template.md" ]; then
6520
- template_file="$dir/$template.md"
6521
- break
6522
- elif [ -f "$dir/${template}" ]; then
6523
- template_file="$dir/${template}"
6524
- break
6600
+ # Handle --list / --json
6601
+ if $list_mode; then
6602
+ if $json_mode; then
6603
+ echo "["
6604
+ local first=true
6605
+ for tname in "${TEMPLATE_NAMES[@]}"; do
6606
+ if $first; then
6607
+ first=false
6608
+ else
6609
+ echo ","
6610
+ fi
6611
+ printf ' {"name": "%s", "label": "%s"}' "$tname" "${TEMPLATE_LABELS[$tname]}"
6612
+ done
6613
+ echo ""
6614
+ echo "]"
6615
+ else
6616
+ echo -e "${BOLD}Available PRD Templates ($template_count)${NC}"
6617
+ echo ""
6618
+ echo -e " ${DIM}Simple:${NC}"
6619
+ local idx=1
6620
+ for tname in "${TEMPLATE_NAMES[@]}"; do
6621
+ if [[ "$tname" == "rest-api" ]]; then
6622
+ echo -e " ${DIM}Standard:${NC}"
6623
+ elif [[ "$tname" == "mobile-app" ]]; then
6624
+ echo -e " ${DIM}Complex:${NC}"
6625
+ fi
6626
+ printf " %2d. ${CYAN}%-22s${NC} %s\n" "$idx" "$tname" "${TEMPLATE_LABELS[$tname]}"
6627
+ idx=$((idx + 1))
6628
+ done
6629
+ echo ""
6630
+ echo "Usage: loki init [project-name] --template <name>"
6631
+ fi
6632
+ exit 0
6633
+ fi
6634
+
6635
+ # Interactive template picker if no template specified
6636
+ if [[ -z "$template_name" ]]; then
6637
+ echo -e "${BOLD}Loki Mode v$version - Project Scaffolding${NC}"
6638
+ echo ""
6639
+ echo "Select a PRD template:"
6640
+ echo ""
6641
+ echo -e " ${DIM}Simple:${NC}"
6642
+ local idx=1
6643
+ for tname in "${TEMPLATE_NAMES[@]}"; do
6644
+ if [[ "$tname" == "rest-api" ]]; then
6645
+ echo -e " ${DIM}Standard:${NC}"
6646
+ elif [[ "$tname" == "mobile-app" ]]; then
6647
+ echo -e " ${DIM}Complex:${NC}"
6525
6648
  fi
6649
+ printf " %2d. %-22s %s\n" "$idx" "$tname" "${TEMPLATE_LABELS[$tname]}"
6650
+ idx=$((idx + 1))
6526
6651
  done
6652
+ echo ""
6653
+ echo -e -n "${BOLD}Choose [1-$template_count]:${NC} "
6654
+ read -r choice
6527
6655
 
6528
- if [ -z "$template_file" ]; then
6529
- echo -e "${RED}Template not found: $template${NC}"
6530
- echo ""
6531
- _list_templates
6656
+ if ! [[ "$choice" =~ ^[0-9]+$ ]] || [ "$choice" -lt 1 ] || [ "$choice" -gt "$template_count" ]; then
6657
+ echo -e "${RED}Invalid choice. Enter a number between 1 and $template_count.${NC}"
6532
6658
  exit 1
6533
6659
  fi
6534
6660
 
6535
- cp "$template_file" "$output_file"
6536
- echo -e "${GREEN}Created${NC} $output_file from template: $template"
6537
- echo -e "${DIM}Edit the file to customize it for your project${NC}"
6538
-
6539
- if [ "$start_after" = true ]; then
6540
- echo ""
6541
- echo -e "${CYAN}Starting Loki Mode...${NC}"
6542
- exec "$0" start "$output_file"
6543
- fi
6544
- exit 0
6661
+ template_name="${TEMPLATE_NAMES[$((choice - 1))]}"
6662
+ echo ""
6663
+ echo -e "Selected: ${CYAN}$template_name${NC} (${TEMPLATE_LABELS[$template_name]})"
6545
6664
  fi
6546
6665
 
6547
- # Interactive mode
6548
- echo -e "${BOLD}Loki Mode v$version - PRD Builder${NC}"
6549
- echo ""
6550
- echo -e "${CYAN}Answer a few questions to generate your PRD.${NC}"
6551
- echo ""
6666
+ # Resolve template file
6667
+ local template_file=""
6668
+ for dir in "$SKILL_DIR/templates" "$SKILL_DIR/examples"; do
6669
+ if [[ -f "$dir/${template_name}.md" ]]; then
6670
+ template_file="$dir/${template_name}.md"
6671
+ break
6672
+ fi
6673
+ done
6552
6674
 
6553
- # Project name
6554
- echo -e -n "${BOLD}Project name:${NC} "
6555
- read -r project_name
6556
- if [ -z "$project_name" ]; then
6557
- echo -e "${RED}Project name is required${NC}"
6675
+ if [[ -z "$template_file" ]]; then
6676
+ echo -e "${RED}Unknown template: $template_name${NC}"
6677
+ echo ""
6678
+ echo "Available templates:"
6679
+ for tname in "${TEMPLATE_NAMES[@]}"; do
6680
+ echo " $tname"
6681
+ done
6682
+ echo ""
6683
+ echo "Run 'loki init --list' for details."
6558
6684
  exit 1
6559
6685
  fi
6560
6686
 
6561
- # Description
6562
- echo -e -n "${BOLD}One-line description:${NC} "
6563
- read -r description
6687
+ # Read template content
6688
+ local prd_content
6689
+ prd_content=$(cat "$template_file")
6564
6690
 
6565
- # Project type
6566
- echo ""
6567
- echo -e "${BOLD}Project type:${NC}"
6568
- echo " 1) Web application (full-stack)"
6569
- echo " 2) REST API (backend only)"
6570
- echo " 3) CLI tool"
6571
- echo " 4) Landing page (static)"
6572
- echo " 5) Mobile app (React Native)"
6573
- echo " 6) Browser extension"
6574
- echo " 7) Other"
6575
- echo -e -n "Choose [1-7]: "
6576
- read -r type_choice
6577
-
6578
- local project_type=""
6579
- local default_stack=""
6580
- case "$type_choice" in
6581
- 1) project_type="Web Application"; default_stack="Next.js + TypeScript + Prisma + PostgreSQL" ;;
6582
- 2) project_type="REST API"; default_stack="Node.js + Express + TypeScript + SQLite" ;;
6583
- 3) project_type="CLI Tool"; default_stack="Node.js + TypeScript + Commander.js" ;;
6584
- 4) project_type="Landing Page"; default_stack="HTML + CSS + JavaScript (no framework)" ;;
6585
- 5) project_type="Mobile App"; default_stack="React Native + TypeScript + Expo" ;;
6586
- 6) project_type="Browser Extension"; default_stack="Chrome Manifest V3 + TypeScript" ;;
6587
- 7) project_type="Custom"; default_stack="" ;;
6588
- *) project_type="Web Application"; default_stack="Next.js + TypeScript + Prisma + PostgreSQL" ;;
6589
- esac
6691
+ # --stdout mode: just print PRD and exit
6692
+ if $stdout_mode; then
6693
+ echo "$prd_content"
6694
+ exit 0
6695
+ fi
6590
6696
 
6591
- # Tech stack
6592
- echo ""
6593
- if [ -n "$default_stack" ]; then
6594
- echo -e -n "${BOLD}Tech stack${NC} [${DIM}$default_stack${NC}]: "
6595
- read -r tech_stack
6596
- if [ -z "$tech_stack" ]; then
6597
- tech_stack="$default_stack"
6598
- fi
6697
+ # Determine target directory
6698
+ local target_dir
6699
+ if [[ -n "$project_name" ]]; then
6700
+ target_dir="$(pwd)/$project_name"
6599
6701
  else
6600
- echo -e -n "${BOLD}Tech stack:${NC} "
6601
- read -r tech_stack
6702
+ target_dir="$(pwd)"
6602
6703
  fi
6603
6704
 
6604
- # Features
6605
- echo ""
6606
- echo -e "${BOLD}Key features${NC} (enter one per line, empty line to finish):"
6607
- local features=()
6608
- local feat_num=1
6609
- while true; do
6610
- echo -e -n " ${feat_num}. "
6611
- read -r feature
6612
- if [ -z "$feature" ]; then
6613
- break
6705
+ # Build config JSON
6706
+ local config_json
6707
+ config_json=$(cat <<ENDJSON
6708
+ {
6709
+ "version": "$version",
6710
+ "template": "$template_name",
6711
+ "created": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
6712
+ "provider": "claude",
6713
+ "complexity": "auto",
6714
+ "quality_gates": true,
6715
+ "parallel_mode": false,
6716
+ "dashboard": true
6717
+ }
6718
+ ENDJSON
6719
+ )
6720
+
6721
+ # Build README content
6722
+ local display_name="${project_name:-$(basename "$target_dir")}"
6723
+ local readme_content
6724
+ readme_content=$(cat <<ENDREADME
6725
+ # $display_name
6726
+
6727
+ Built with [Loki Mode](https://www.autonomi.dev/) using the \`$template_name\` template.
6728
+
6729
+ ## Getting Started
6730
+
6731
+ \`\`\`bash
6732
+ # Review the PRD
6733
+ cat prd.md
6734
+
6735
+ # Launch autonomous development
6736
+ claude --dangerously-skip-permissions
6737
+ # Then: "Loki Mode with PRD at prd.md"
6738
+
6739
+ # Or via CLI
6740
+ loki start prd.md
6741
+ \`\`\`
6742
+
6743
+ ## Project Structure
6744
+
6745
+ This project was scaffolded by \`loki init\`. Key files:
6746
+
6747
+ - \`prd.md\` - Product Requirements Document
6748
+ - \`.loki/loki.config.json\` - Loki Mode configuration
6749
+ ENDREADME
6750
+ )
6751
+
6752
+ # Build gitignore content
6753
+ local gitignore_content
6754
+ gitignore_content=$(cat <<'ENDGITIGNORE'
6755
+ # Dependencies
6756
+ node_modules/
6757
+ venv/
6758
+ __pycache__/
6759
+
6760
+ # Build output
6761
+ dist/
6762
+ build/
6763
+ *.egg-info/
6764
+
6765
+ # Loki Mode runtime state (keep .loki/loki.config.json)
6766
+ .loki/state/
6767
+ .loki/memory/episodic/
6768
+ .loki/metrics/
6769
+ .loki/queue/
6770
+ .loki/sessions/
6771
+ .loki/logs/
6772
+
6773
+ # Environment
6774
+ .env
6775
+ .env.local
6776
+
6777
+ # OS
6778
+ .DS_Store
6779
+ Thumbs.db
6780
+ ENDGITIGNORE
6781
+ )
6782
+
6783
+ # --dry-run mode: show what would be created
6784
+ if $dry_run; then
6785
+ echo -e "${BOLD}Dry run: loki init${NC}"
6786
+ echo ""
6787
+ if [[ -n "$project_name" ]]; then
6788
+ echo -e " ${GREEN}CREATE${NC} $target_dir/"
6614
6789
  fi
6615
- features+=("$feature")
6616
- feat_num=$((feat_num + 1))
6617
- if [ $feat_num -gt 10 ]; then
6618
- echo -e "${DIM} (max 10 features)${NC}"
6619
- break
6790
+ echo -e " ${GREEN}CREATE${NC} $target_dir/prd.md (${TEMPLATE_LABELS[$template_name]} template)"
6791
+ echo -e " ${GREEN}CREATE${NC} $target_dir/.loki/"
6792
+ echo -e " ${GREEN}CREATE${NC} $target_dir/.loki/loki.config.json"
6793
+ echo -e " ${GREEN}CREATE${NC} $target_dir/README.md"
6794
+ if ! $no_git; then
6795
+ if [[ -n "$project_name" ]] || ! git rev-parse --git-dir &>/dev/null; then
6796
+ echo -e " ${GREEN}CREATE${NC} $target_dir/.gitignore"
6797
+ echo -e " ${GREEN}RUN${NC} git init"
6798
+ fi
6620
6799
  fi
6621
- done
6622
-
6623
- if [ ${#features[@]} -eq 0 ]; then
6624
- echo -e "${RED}At least one feature is required${NC}"
6625
- exit 1
6800
+ echo ""
6801
+ echo "Run without --dry-run to create these files."
6802
+ exit 0
6626
6803
  fi
6627
6804
 
6628
- # Out of scope
6629
- echo ""
6630
- echo -e "${BOLD}Out of scope${NC} (enter one per line, empty line to finish):"
6631
- local exclusions=()
6632
- local exc_num=1
6633
- while true; do
6634
- echo -e -n " ${exc_num}. "
6635
- read -r exclusion
6636
- if [ -z "$exclusion" ]; then
6637
- break
6638
- fi
6639
- exclusions+=("$exclusion")
6640
- exc_num=$((exc_num + 1))
6641
- if [ $exc_num -gt 10 ]; then
6642
- break
6805
+ # Create project directory if project name given
6806
+ if [[ -n "$project_name" ]]; then
6807
+ if [[ -d "$target_dir" ]]; then
6808
+ echo -e "${RED}Directory already exists: $target_dir${NC}"
6809
+ exit 1
6643
6810
  fi
6644
- done
6811
+ mkdir -p "$target_dir"
6812
+ fi
6645
6813
 
6646
- # Generate PRD
6647
- {
6648
- echo "# PRD: $project_name"
6649
- echo ""
6650
- echo "## Overview"
6651
- echo "$description"
6652
- echo ""
6653
- echo "## Project Type"
6654
- echo "$project_type"
6655
- echo ""
6656
- echo "## Target Users"
6657
- echo "Developers and end-users who need $description"
6658
- echo ""
6659
- echo "## Features"
6660
- echo ""
6661
- echo "### MVP Features"
6662
- local i=1
6663
- for feat in "${features[@]}"; do
6664
- echo "$i. **$(echo "$feat" | awk '{print toupper(substr($0,1,1)) substr($0,2)}')** - $feat"
6665
- i=$((i + 1))
6666
- done
6667
- echo ""
6668
- echo "## Tech Stack"
6669
- echo "- $tech_stack"
6670
- echo ""
6671
- echo "## Requirements"
6672
- echo "- All features functional and tested"
6673
- echo "- Clean, well-structured code"
6674
- echo "- Error handling with user feedback"
6675
- echo "- Input validation where applicable"
6676
- echo ""
6677
- echo "## Testing"
6678
- echo "- Unit tests for core functionality"
6679
- echo "- Integration tests for API endpoints (if applicable)"
6680
- echo "- Manual testing checklist"
6681
- echo ""
6682
- echo "## Out of Scope"
6683
- if [ ${#exclusions[@]} -gt 0 ]; then
6684
- for exc in "${exclusions[@]}"; do
6685
- echo "- $exc"
6686
- done
6687
- else
6688
- echo "- Authentication (unless specified in features)"
6689
- echo "- Cloud deployment"
6690
- echo "- Performance optimization"
6814
+ # Create .loki config directory
6815
+ mkdir -p "$target_dir/.loki"
6816
+
6817
+ # Write files
6818
+ echo "$prd_content" > "$target_dir/prd.md"
6819
+ echo "$config_json" > "$target_dir/.loki/loki.config.json"
6820
+
6821
+ # Only write README if it does not already exist
6822
+ if [[ ! -f "$target_dir/README.md" ]]; then
6823
+ echo "$readme_content" > "$target_dir/README.md"
6824
+ fi
6825
+
6826
+ # Git init (unless --no-git or already in a git repo)
6827
+ local did_git_init=false
6828
+ if ! $no_git; then
6829
+ if [[ -n "$project_name" ]] || ! git rev-parse --git-dir &>/dev/null; then
6830
+ echo "$gitignore_content" > "$target_dir/.gitignore"
6831
+ (cd "$target_dir" && git init -q)
6832
+ did_git_init=true
6691
6833
  fi
6692
- echo ""
6693
- echo "## Success Criteria"
6694
- echo "- All MVP features working"
6695
- echo "- Tests passing"
6696
- echo "- No console errors"
6697
- echo "- Code review passes"
6698
- echo ""
6699
- echo "---"
6700
- echo ""
6701
- echo "**Generated by:** loki init v$(get_version)"
6702
- } > "$output_file"
6834
+ fi
6703
6835
 
6836
+ # Print summary
6704
6837
  echo ""
6705
- echo -e "${GREEN}PRD generated:${NC} $output_file"
6838
+ echo -e "${GREEN}Project scaffolded:${NC} $target_dir"
6706
6839
  echo ""
6707
-
6708
- if [ "$start_after" = true ]; then
6709
- echo -e "${CYAN}Starting Loki Mode...${NC}"
6710
- exec "$0" start "$output_file"
6840
+ echo " Files created:"
6841
+ echo -e " prd.md ${DIM}${TEMPLATE_LABELS[$template_name]} template${NC}"
6842
+ echo -e " .loki/loki.config.json ${DIM}project configuration${NC}"
6843
+ if [[ ! -f "$target_dir/README.md" ]] || [[ -n "$project_name" ]]; then
6844
+ echo -e " README.md ${DIM}project readme${NC}"
6845
+ fi
6846
+ if $did_git_init; then
6847
+ echo -e " .gitignore ${DIM}git ignore rules${NC}"
6848
+ echo -e " ${DIM}git repo initialized${NC}"
6849
+ fi
6850
+ echo ""
6851
+ echo "Next steps:"
6852
+ if [[ -n "$project_name" ]]; then
6853
+ echo -e " 1. ${BOLD}cd $project_name${NC}"
6854
+ echo -e " 2. Review and edit: ${BOLD}prd.md${NC}"
6855
+ echo -e " 3. Run: ${BOLD}loki start prd.md${NC}"
6711
6856
  else
6712
- echo "Next steps:"
6713
- echo -e " 1. Review and edit: ${BOLD}$output_file${NC}"
6714
- echo -e " 2. Start Loki Mode: ${BOLD}loki start $output_file${NC}"
6857
+ echo -e " 1. Review and edit: ${BOLD}prd.md${NC}"
6858
+ echo -e " 2. Run: ${BOLD}loki start prd.md${NC}"
6715
6859
  fi
6716
6860
  }
6717
6861
 
@@ -6744,34 +6888,9 @@ cmd_dogfood() {
6744
6888
  bash "$stats_script" $json_flag
6745
6889
  }
6746
6890
 
6747
- # List available templates
6891
+ # List available templates (legacy helper, kept for backward compat)
6748
6892
  _list_templates() {
6749
- echo -e "${BOLD}Available Templates${NC}"
6750
- echo ""
6751
- local found=false
6752
- declare -A seen_names
6753
- for dir in "$SKILL_DIR/templates" "$SKILL_DIR/examples"; do
6754
- if [ -d "$dir" ]; then
6755
- for f in "$dir"/*.md; do
6756
- if [ -f "$f" ] && [ "$(basename "$f")" != "README.md" ]; then
6757
- local name=$(basename "$f" .md)
6758
- # Skip duplicates (templates/ takes priority over examples/)
6759
- if [[ -n "${seen_names[$name]:-}" ]]; then
6760
- continue
6761
- fi
6762
- seen_names[$name]=1
6763
- local title=$(head -1 "$f" | sed -E 's/^#+ *//')
6764
- echo -e " ${CYAN}$name${NC} - $title"
6765
- found=true
6766
- fi
6767
- done
6768
- fi
6769
- done
6770
- if [ "$found" = false ]; then
6771
- echo " No templates found"
6772
- fi
6773
- echo ""
6774
- echo "Usage: loki init --template <name>"
6893
+ cmd_init --list
6775
6894
  }
6776
6895
 
6777
6896
  # Watchdog: process health monitoring