Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive AI design skill providing design intelligence across platforms with 161 reasoning rules.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/cip/search.py
1#!/usr/bin/env python32# -*- coding: utf-8 -*-3"""4CIP Design Search CLI - Search corporate identity design guidelines5"""67import argparse8import json9import sys10from pathlib import Path1112# Add parent directory for imports13sys.path.insert(0, str(Path(__file__).parent))14from core import search, search_all, get_cip_brief, CSV_CONFIG151617def format_results(results, domain):18"""Format search results for display"""19if not results:20return "No results found."2122output = []23for i, item in enumerate(results, 1):24output.append(f"\n{'='*60}")25output.append(f"Result {i}:")26for key, value in item.items():27if value:28output.append(f" {key}: {value}")29return "\n".join(output)303132def format_brief(brief):33"""Format CIP brief for display"""34output = []35output.append(f"\n{'='*60}")36output.append(f"CIP DESIGN BRIEF: {brief['brand_name']}")37output.append(f"{'='*60}")3839if brief.get("industry"):40output.append(f"\n📊 INDUSTRY: {brief['industry'].get('Industry', 'N/A')}")41output.append(f" Style: {brief['industry'].get('CIP Style', 'N/A')}")42output.append(f" Mood: {brief['industry'].get('Mood', 'N/A')}")4344if brief.get("style"):45output.append(f"\n🎨 DESIGN STYLE: {brief['style'].get('Style Name', 'N/A')}")46output.append(f" Description: {brief['style'].get('Description', 'N/A')}")47output.append(f" Materials: {brief['style'].get('Materials', 'N/A')}")48output.append(f" Finishes: {brief['style'].get('Finishes', 'N/A')}")4950if brief.get("color_system"):51output.append(f"\n🎯 COLOR SYSTEM:")52output.append(f" Primary: {brief['color_system'].get('primary', 'N/A')}")53output.append(f" Secondary: {brief['color_system'].get('secondary', 'N/A')}")5455output.append(f"\n✏️ TYPOGRAPHY: {brief.get('typography', 'N/A')}")5657if brief.get("recommended_deliverables"):58output.append(f"\n📦 RECOMMENDED DELIVERABLES:")59for d in brief["recommended_deliverables"]:60output.append(f" • {d.get('Deliverable', 'N/A')}: {d.get('Description', '')[:60]}...")6162return "\n".join(output)636465def main():66parser = argparse.ArgumentParser(67description="Search CIP design guidelines",68formatter_class=argparse.RawDescriptionHelpFormatter,69epilog="""70Examples:71# Search deliverables72python search.py "business card"7374# Search specific domain75python search.py "luxury elegant" --domain style7677# Generate CIP brief78python search.py "tech startup" --cip-brief -b "TechFlow"7980# Search all domains81python search.py "corporate professional" --all8283# JSON output84python search.py "vehicle branding" --json85"""86)8788parser.add_argument("query", help="Search query")89parser.add_argument("--domain", "-d", choices=list(CSV_CONFIG.keys()),90help="Search domain (auto-detected if not specified)")91parser.add_argument("--max", "-m", type=int, default=3, help="Max results (default: 3)")92parser.add_argument("--all", "-a", action="store_true", help="Search all domains")93parser.add_argument("--cip-brief", "-c", action="store_true", help="Generate CIP brief")94parser.add_argument("--brand", "-b", default="BrandName", help="Brand name for CIP brief")95parser.add_argument("--style", "-s", help="Style override for CIP brief")96parser.add_argument("--json", "-j", action="store_true", help="Output as JSON")9798args = parser.parse_args()99100if args.cip_brief:101brief = get_cip_brief(args.brand, args.query, args.style)102if args.json:103print(json.dumps(brief, indent=2))104else:105print(format_brief(brief))106elif args.all:107results = search_all(args.query, args.max)108if args.json:109print(json.dumps(results, indent=2))110else:111for domain, items in results.items():112print(f"\n{'#'*60}")113print(f"# {domain.upper()}")114print(format_results(items, domain))115else:116result = search(args.query, args.domain, args.max)117if args.json:118print(json.dumps(result, indent=2))119else:120print(f"\nDomain: {result['domain']}")121print(f"Query: {result['query']}")122print(f"Results: {result['count']}")123print(format_results(result.get("results", []), result["domain"]))124125126if __name__ == "__main__":127main()128