scripts-strategy-brief-cli
#!/usr/bin/env python3 """
title: "Strategy Brief Cli" component_type: script version: "1.0.0" audience: contributor status: stable summary: "Strategy Brief CLI ==================" keywords: ['analysis', 'api', 'brief', 'cli', 'generation'] tokens: ~500 created: 2025-12-22 updated: 2025-12-22 script_name: "strategy-brief-cli.py" language: python executable: true usage: "python3 scripts/strategy-brief-cli.py [options]" python_version: "3.10+" dependencies: [] modifies_files: false network_access: false requires_auth: false
Strategy Brief CLI
Command-line interface for generating industry strategy briefs. Wraps the strategy-brief-generator with interactive configuration.
Usage: python3 scripts/strategy-brief-cli.py create "AI Development Tools" python3 scripts/strategy-brief-cli.py create "Healthcare IT" --geography "North America" python3 scripts/strategy-brief-cli.py configure python3 scripts/strategy-brief-cli.py list python3 scripts/strategy-brief-cli.py export <brief_id> --format html
Commands: create - Generate new strategy brief configure - Interactive configuration wizard list - List generated briefs export - Export brief to HTML/DOCX/PDF
Source: Adapted from ANALYZE-REVIEW/extracted-consulting/brief_cli.py """
import argparse import asyncio import json import sys from datetime import datetime, timezone from pathlib import Path from typing import Dict, Any, Optional
class BriefConfig: """Configuration management for strategy briefs."""
DEFAULT_CONFIG = {
'geography': 'Global',
'time_horizon': '12-24 months',
'client_type': 'Incumbent Expanding',
'competitor_count': 5,
'trend_count': 8,
'output_directory': './briefs',
'auto_export': True,
'export_formats': ['markdown', 'html']
}
def __init__(self, config_path: str = '.brief_config.json'):
self.config_path = Path(config_path)
self.config = self._load_config()
def _load_config(self) -> Dict[str, Any]:
if self.config_path.exists():
with open(self.config_path) as f:
user_config = json.load(f)
config = self.DEFAULT_CONFIG.copy()
config.update(user_config)
return config
return self.DEFAULT_CONFIG.copy()
def save(self):
with open(self.config_path, 'w') as f:
json.dump(self.config, f, indent=2)
def interactive_configure(self):
"""Interactive configuration wizard."""
print("\n" + "=" * 60)
print("STRATEGY BRIEF CONFIGURATION")
print("=" * 60 + "\n")
prompts = [
('geography', 'Default geography'),
('time_horizon', 'Default time horizon'),
('client_type', 'Default client type'),
('competitor_count', 'Number of competitors (3-10)'),
('output_directory', 'Output directory')
]
for key, prompt in prompts:
current = self.config[key]
print(f"{prompt} [{current}]: ", end='')
value = input().strip()
if value:
if key == 'competitor_count':
value = int(value)
self.config[key] = value
self.save()
print(f"\nConfiguration saved to {self.config_path}")
class BriefCLI: """Command-line interface for brief generation."""
def __init__(self):
self.config = BriefConfig()
self.output_dir = Path(self.config.config['output_directory'])
self.output_dir.mkdir(exist_ok=True)
def create_brief(self, industry: str, **overrides):
"""Generate a new strategy brief."""
print(f"\n{'=' * 80}")
print(f"CREATING STRATEGY BRIEF: {industry}")
print(f"{'=' * 80}\n")
# Validate industry
if not industry or len(industry) < 3:
print("Error: Industry name must be at least 3 characters")
return None
params = {
'industry': industry,
'geography': overrides.get('geography', self.config.config['geography']),
'time_horizon': overrides.get('time_horizon', self.config.config['time_horizon']),
'client_type': overrides.get('client_type', self.config.config['client_type']),
'competitor_count': overrides.get('competitor_count', self.config.config['competitor_count']),
'trend_count': overrides.get('trend_count', self.config.config['trend_count'])
}
print("Parameters:")
for k, v in params.items():
print(f" {k}: {v}")
# Generate brief ID
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
slug = industry.lower().replace(' ', '_').replace('/', '_')[:30]
brief_id = f"{slug}_{timestamp}"
# Create output directory
brief_dir = self.output_dir / brief_id
brief_dir.mkdir(exist_ok=True)
# Generate placeholder brief
brief_content = self._generate_placeholder_brief(params)
# Save brief
brief_path = brief_dir / 'brief.md'
brief_path.write_text(brief_content)
# Save metadata
metadata = {
'brief_id': brief_id,
'parameters': params,
'generated_at': datetime.now(timezone.utc).isoformat(),
'status': 'generated'
}
(brief_dir / 'metadata.json').write_text(json.dumps(metadata, indent=2))
print(f"\nBrief saved to: {brief_path}")
print(f"Brief ID: {brief_id}")
# Auto-export if configured
if self.config.config['auto_export']:
for fmt in self.config.config['export_formats']:
if fmt == 'html':
self._export_html(brief_id)
return brief_id
def _generate_placeholder_brief(self, params: Dict[str, Any]) -> str:
"""Generate placeholder brief content."""
now = datetime.now(timezone.utc)
return f"""# {params['industry']}
Strategic Market & Competitive Brief | {params['geography']} | {params['time_horizon']}
Prepared {now.strftime('%B %Y')} | Client Type: {params['client_type']}
A. Executive Snapshot
Key Takeaways
- Market overview. Analysis pending from research agents.
- Competitive landscape. Detailed competitor analysis required.
- Strategic opportunities. Framework application needed.
Recommended Moves (Next 12-24 Months)
- Complete full analysis: Run strategy-brief-generator with API integration
- Validate findings: Cross-reference with industry sources
- Develop action plan: Create detailed implementation roadmap
B. Market Context
Section requires market research agent completion.
C. Key Trends, Threats & Disruptions
Section requires trend analyst agent completion.
D. Competitive Landscape
Section requires competitive analyst agent completion.
Competitors to analyze: {params['competitor_count']}
E. Strategic Frameworks
Section requires framework specialist agent completion.
F. Entry / Growth Strategy Options
Section requires strategy specialist agent completion.
G. One-Page Strategic Brief
Section requires synthesis writer agent completion.
H. Transparency & Disclaimers
Generation Metadata
- Generated: {now.isoformat()}
- Parameters: {json.dumps(params, indent=2)}
- Status: Placeholder - requires full agent execution
Disclaimer
This is a placeholder brief. Run the complete strategy-brief-generator with Claude API integration for full analysis.
Generated by CODITECT Strategy Brief CLI """
def list_briefs(self):
"""List all generated briefs."""
briefs = sorted(self.output_dir.glob('*/metadata.json'))
if not briefs:
print("\nNo briefs found.")
return
print(f"\n{'=' * 80}")
print(f"GENERATED BRIEFS ({len(briefs)})")
print(f"{'=' * 80}\n")
for meta_path in briefs:
with open(meta_path) as f:
meta = json.load(f)
brief_id = meta_path.parent.name
params = meta.get('parameters', {})
print(f"ID: {brief_id}")
print(f"Industry: {params.get('industry', 'Unknown')}")
print(f"Geography: {params.get('geography', 'Global')}")
print(f"Generated: {meta.get('generated_at', 'Unknown')}")
print()
def _export_html(self, brief_id: str):
"""Export brief to HTML."""
brief_dir = self.output_dir / brief_id
brief_path = brief_dir / 'brief.md'
if not brief_path.exists():
print(f"Brief not found: {brief_id}")
return
content = brief_path.read_text()
# Simple markdown to HTML conversion
html = f"""
def main(): parser = argparse.ArgumentParser( description='Generate professional strategy briefs', formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" Examples: python3 strategy-brief-cli.py create "AI Development Tools" python3 strategy-brief-cli.py create "Healthcare IT" --geography "North America" python3 strategy-brief-cli.py configure python3 strategy-brief-cli.py list """ )
subparsers = parser.add_subparsers(dest='command', help='Command')
# Create command
create_parser = subparsers.add_parser('create', help='Generate new brief')
create_parser.add_argument('industry', help='Industry to analyze')
create_parser.add_argument('--geography', help='Geographic focus')
create_parser.add_argument('--horizon', dest='time_horizon', help='Time horizon')
create_parser.add_argument('--client-type', help='Client type')
create_parser.add_argument('--competitors', type=int, dest='competitor_count', help='Competitor count')
# Configure command
subparsers.add_parser('configure', help='Interactive configuration')
# List command
subparsers.add_parser('list', help='List generated briefs')
args = parser.parse_args()
if not args.command:
parser.print_help()
return
cli = BriefCLI()
if args.command == 'create':
overrides = {k: v for k, v in vars(args).items()
if v is not None and k not in ('industry', 'command')}
cli.create_brief(args.industry, **overrides)
elif args.command == 'configure':
cli.config.interactive_configure()
elif args.command == 'list':
cli.list_briefs()
if name == 'main': main()