#!/usr/bin/env nim ## JSON Output Demo for NIP Package Manager ## Demonstrates comprehensive machine-readable output formats import std/[os, strutils, json] proc runCommand(cmd: string): void = echo "šŸ”¹ Command: ", cmd let result = execShellCmd(cmd) if result != 0: echo "āŒ Command failed with exit code: ", result echo "" proc main() = echo """ ╔══════════════════════════════════════════════════════════════╗ ā•‘ NIP JSON Output Demo ā•‘ ā•‘ Machine-Readable Package Management ā•‘ ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā• This demo showcases the comprehensive JSON output capabilities of NIP, enabling automation, tooling integration, and AI-friendly interfaces. Features demonstrated: • Complete package metadata with CAS paths and CIDs • Variant fingerprint information • Integrity status monitoring • Installation and dependency data • Multiple output formats (JSON, YAML, KDL) """ # Ensure we're in the right directory if not fileExists("src/nip.out"): echo "āŒ Error: nip.out not found. Please run 'nim c -d:release src/nip.nim' first" quit(1) echo "šŸš€ Starting JSON Output Demo..." echo "=" .repeat(60) # Demo 1: Enhanced Search with JSON echo "\nšŸ“Š Demo 1: Enhanced Search (JSON)" echo "-" .repeat(40) runCommand("./src/nip.out search firefox --json") # Demo 2: Package Listing with JSON echo "\nšŸ“¦ Demo 2: Package Listing (JSON)" echo "-" .repeat(40) runCommand("./src/nip.out list --json") # Demo 3: Package Information with JSON echo "\nšŸ“‹ Demo 3: Package Information (JSON)" echo "-" .repeat(40) runCommand("./src/nip.out show firefox --json") # Demo 4: YAML Output Format echo "\nšŸ“„ Demo 4: YAML Output Format" echo "-" .repeat(40) runCommand("./src/nip.out search firefox --yaml") # Demo 5: KDL Output Format echo "\nšŸ“ Demo 5: KDL Output Format" echo "-" .repeat(40) runCommand("./src/nip.out search firefox --kdl") echo "\nāœ… JSON Output Demo Complete!" echo """ The NIP package manager now provides: āœ“ Comprehensive JSON output with complete metadata āœ“ CAS paths and Content Identifiers (CIDs) āœ“ Variant fingerprint information āœ“ Integrity status monitoring āœ“ Multiple structured formats (JSON, YAML, KDL) āœ“ AI and automation-friendly interfaces āœ“ Stable schema for tooling integration Perfect for: • CI/CD pipeline integration • Infrastructure as Code • Package management automation • AI assistant integration • Custom tooling development • System monitoring and reporting šŸŽ‰ Ready for production automation! """ when isMainModule: main()