fix: repair 25 Python scripts failing --help across all domains

- Fix Python 3.10+ syntax (float | None → Optional[float]) in 2 scripts
- Add argparse CLI handling to 9 marketing scripts using raw sys.argv
- Fix 10 scripts crashing at module level (wrap in __main__, add argparse)
- Make yaml/prefect/mcp imports conditional with stdlib fallbacks (4 scripts)
- Fix f-string backslash syntax in project_bootstrapper.py
- Fix -h flag conflict in pr_analyzer.py
- Fix tech-debt.md description (score → prioritize)

All 237 scripts now pass python3 --help verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Reza Rezvani 2026-03-10 05:51:27 +01:00
parent 670a1a61f3
commit 5add886197
25 changed files with 455 additions and 132 deletions

View file

@ -18,7 +18,7 @@ import sys
import argparse import argparse
import math import math
from datetime import datetime from datetime import datetime
from typing import Any from typing import Any, Optional
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -458,7 +458,7 @@ def _dept_revenue_benchmark(dept_name: str, stage: str) -> int:
return stage_data.get(dept_key, stage_data["default"]) return stage_data.get(dept_key, stage_data["default"])
def _efficiency_status(efficiency_pct: float | None) -> str: def _efficiency_status(efficiency_pct: Optional[float]) -> str:
if efficiency_pct is None: if efficiency_pct is None:
return "N/A" return "N/A"
if efficiency_pct >= 90: if efficiency_pct >= 90:

View file

@ -323,8 +323,30 @@ class TeamScalingCalculator:
'designer': 120000, 'designer': 120000,
'data_engineer': 140000 'data_engineer': 140000
}, },
'EU': {k: v * 0.8 for k, v in salary_bands.get('US', {}).items()}, 'EU': {
'APAC': {k: v * 0.6 for k, v in salary_bands.get('US', {}).items()} 'engineering_manager': 160000,
'tech_lead': 144000,
'senior_engineer': 128000,
'mid_engineer': 96000,
'junior_engineer': 68000,
'devops': 120000,
'qa': 80000,
'product_manager': 120000,
'designer': 96000,
'data_engineer': 112000
},
'APAC': {
'engineering_manager': 120000,
'tech_lead': 108000,
'senior_engineer': 96000,
'mid_engineer': 72000,
'junior_engineer': 51000,
'devops': 90000,
'qa': 60000,
'product_manager': 90000,
'designer': 72000,
'data_engineer': 84000
}
} }
location_salaries = salary_bands.get(location, salary_bands['US']) location_salaries = salary_bands.get(location, salary_bands['US'])
@ -493,24 +515,48 @@ def calculate_team_scaling(current_state: Dict, growth_targets: Dict) -> str:
return '\n'.join(output) return '\n'.join(output)
if __name__ == "__main__": if __name__ == "__main__":
# Example usage import argparse
example_current = {
'headcount': 25, parser = argparse.ArgumentParser(
'velocity': 450, description="Engineering Team Scaling Calculator - Optimize team growth and structure"
'roles': { )
'engineering_manager': 2, parser.add_argument(
'tech_lead': 3, "input_file", nargs="?", default=None,
'senior_engineer': 8, help="JSON file with current_state and growth_targets (default: run with sample data)"
'mid_engineer': 10, )
'junior_engineer': 2 parser.add_argument(
}, "--json", action="store_true",
'attrition_rate': 12, help="Output raw JSON instead of formatted report"
'location': 'US' )
} args = parser.parse_args()
example_targets = { if args.input_file:
'target_headcount': 75, with open(args.input_file) as f:
'timeline_quarters': 4 data = json.load(f)
} current_state = data["current_state"]
growth_targets = data["growth_targets"]
print(calculate_team_scaling(example_current, example_targets)) else:
current_state = {
'headcount': 25,
'velocity': 450,
'roles': {
'engineering_manager': 2,
'tech_lead': 3,
'senior_engineer': 8,
'mid_engineer': 10,
'junior_engineer': 2
},
'attrition_rate': 12,
'location': 'US'
}
growth_targets = {
'target_headcount': 75,
'timeline_quarters': 4
}
if args.json:
calculator = TeamScalingCalculator()
results = calculator.calculate_scaling_plan(current_state, growth_targets)
print(json.dumps(results, indent=2))
else:
print(calculate_team_scaling(current_state, growth_targets))

View file

@ -1,6 +1,6 @@
--- ---
name: tech-debt name: tech-debt
description: Score, track, and prioritize technical debt. Usage: /tech-debt <scan|score|report> [options] description: Scan, prioritize, and report technical debt. Usage: /tech-debt <scan|prioritize|report> [options]
--- ---
# /tech-debt # /tech-debt

View file

@ -455,7 +455,7 @@ def main():
help="Base branch for comparison (default: main)" help="Base branch for comparison (default: main)"
) )
parser.add_argument( parser.add_argument(
"--head", "-h", "--head",
default="HEAD", default="HEAD",
help="Head branch/commit for comparison (default: HEAD)" help="Head branch/commit for comparison (default: HEAD)"
) )

View file

@ -15,7 +15,11 @@ Usage:
import os import os
import sys import sys
import json import json
import yaml try:
import yaml
HAS_YAML = True
except ImportError:
HAS_YAML = False
import logging import logging
import argparse import argparse
from pathlib import Path from pathlib import Path
@ -774,7 +778,10 @@ Examples:
# Load config if provided # Load config if provided
if args.config: if args.config:
with open(args.config) as f: with open(args.config) as f:
config_data = yaml.safe_load(f) if HAS_YAML:
config_data = yaml.safe_load(f)
else:
config_data = json.load(f)
config = PipelineConfig(**config_data) config = PipelineConfig(**config_data)
else: else:
# Build config from arguments # Build config from arguments

View file

@ -23,7 +23,22 @@ import sys
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
from typing import Dict, List, Any, Optional, Tuple from typing import Dict, List, Any, Optional, Tuple
import yaml try:
import yaml
except ImportError:
# Minimal YAML subset: parse simple key: value frontmatter without pyyaml
class _YamlStub:
class YAMLError(Exception):
pass
@staticmethod
def safe_load(text):
result = {}
for line in text.strip().splitlines():
if ':' in line:
key, _, value = line.partition(':')
result[key.strip()] = value.strip()
return result if result else None
yaml = _YamlStub()
class QualityDimension: class QualityDimension:

View file

@ -19,7 +19,22 @@ import ast
import json import json
import re import re
import sys import sys
import yaml try:
import yaml
except ImportError:
# Minimal YAML subset: parse simple key: value frontmatter without pyyaml
class _YamlStub:
class YAMLError(Exception):
pass
@staticmethod
def safe_load(text):
result = {}
for line in text.strip().splitlines():
if ':' in line:
key, _, value = line.partition(':')
result[key.strip()] = value.strip()
return result if result else None
yaml = _YamlStub()
import datetime as dt import datetime as dt
from pathlib import Path from pathlib import Path
from typing import Dict, List, Any, Optional, Tuple from typing import Dict, List, Any, Optional, Tuple

View file

@ -416,12 +416,25 @@ SAMPLE_ADS = [
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
def main(): def main():
import argparse
parser = argparse.ArgumentParser(
description="Validates ad copy against platform specs. "
"Checks character counts, rejection triggers, and scores each ad 0-100."
)
parser.add_argument(
"file", nargs="?", default=None,
help="Path to a JSON file containing ad data. "
"If omitted, reads from stdin or runs embedded sample."
)
args = parser.parse_args()
# Load from file or stdin, else use sample # Load from file or stdin, else use sample
ads = None ads = None
if len(sys.argv) > 1: if args.file:
try: try:
with open(sys.argv[1]) as f: with open(args.file) as f:
data = json.load(f) data = json.load(f)
ads = data if isinstance(data, list) else [data] ads = data if isinstance(data, list) else [data]
except Exception as e: except Exception as e:

View file

@ -352,18 +352,33 @@ def print_report(result, inputs):
def main(): def main():
if len(sys.argv) > 1 and sys.argv[1] != "--json": import argparse
with open(sys.argv[1]) as f:
parser = argparse.ArgumentParser(
description="Tracking plan generator — produces event taxonomy, GTM config, and GA4 dimension recommendations."
)
parser.add_argument(
"input_file", nargs="?", default=None,
help="JSON file with business config (default: run with sample SaaS data)"
)
parser.add_argument(
"--json", action="store_true",
help="Output full config as JSON"
)
args = parser.parse_args()
if args.input_file:
with open(args.input_file) as f:
inputs = json.load(f) inputs = json.load(f)
else: else:
if "--json" not in sys.argv: if not args.json:
print("No input file provided. Running with sample data...\n") print("No input file provided. Running with sample data...\n")
inputs = SAMPLE_INPUT inputs = SAMPLE_INPUT
result = generate_tracking_plan(inputs) result = generate_tracking_plan(inputs)
print_report(result, inputs) print_report(result, inputs)
if "--json" in sys.argv: if args.json:
print(json.dumps(result, indent=2)) print(json.dumps(result, indent=2))

View file

@ -164,8 +164,23 @@ def print_report(result):
def main(): def main():
if len(sys.argv) > 1: import argparse
with open(sys.argv[1]) as f:
parser = argparse.ArgumentParser(
description="Churn impact calculator — models revenue impact of churn reduction improvements."
)
parser.add_argument(
"input_file", nargs="?", default=None,
help="JSON file with churn metrics (default: run with sample data)"
)
parser.add_argument(
"--json", action="store_true",
help="Output results as JSON"
)
args = parser.parse_args()
if args.input_file:
with open(args.input_file) as f:
inputs = json.load(f) inputs = json.load(f)
else: else:
print("No input file provided. Running with sample data...\n") print("No input file provided. Running with sample data...\n")
@ -176,8 +191,7 @@ def main():
result = calculate(inputs) result = calculate(inputs)
print_report(result) print_report(result)
# Also dump JSON for programmatic use if args.json:
if "--json" in sys.argv:
print(json.dumps(result, indent=2)) print(json.dumps(result, indent=2))

View file

@ -439,16 +439,29 @@ SAMPLE_SEQUENCE = [
# ─── Main ───────────────────────────────────────────────────────────────────── # ─── Main ─────────────────────────────────────────────────────────────────────
def main(): def main():
if len(sys.argv) > 1: import argparse
arg = sys.argv[1]
if arg == "-": parser = argparse.ArgumentParser(
description="Analyzes a cold email sequence for quality signals. "
"Evaluates word count, reading level, personalization, CTA clarity, "
"spam triggers, and subject lines. Scores each email 0-100."
)
parser.add_argument(
"file", nargs="?", default=None,
help="Path to a JSON file containing the email sequence. "
"Use '-' to read from stdin. If omitted, runs embedded sample."
)
args = parser.parse_args()
if args.file:
if args.file == "-":
sequence = json.load(sys.stdin) sequence = json.load(sys.stdin)
else: else:
try: try:
with open(arg, "r", encoding="utf-8") as f: with open(args.file, "r", encoding="utf-8") as f:
sequence = json.load(f) sequence = json.load(f)
except FileNotFoundError: except FileNotFoundError:
print(f"Error: File not found: {arg}", file=sys.stderr) print(f"Error: File not found: {args.file}", file=sys.stderr)
sys.exit(1) sys.exit(1)
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
print(f"Error: Invalid JSON: {e}", file=sys.stderr) print(f"Error: Invalid JSON: {e}", file=sys.stderr)

View file

@ -448,7 +448,25 @@ def print_report(result: dict, label: str = "") -> None:
def main(): def main():
if len(sys.argv) == 1: import argparse
parser = argparse.ArgumentParser(
description="Scores content 0-100 on 'humanity' by detecting AI writing patterns. "
"Checks AI vocabulary, sentence variance, passive voice, hedging, "
"em-dash overuse, and paragraph variety."
)
parser.add_argument(
"file", nargs="?", default=None,
help="Path to a text file to analyze. If omitted, runs demo comparing "
"human vs AI sample content."
)
parser.add_argument(
"--json", action="store_true",
help="Also output results as JSON."
)
args = parser.parse_args()
if args.file is None:
# Demo mode: compare human vs AI sample # Demo mode: compare human vs AI sample
print("[Demo mode — comparing human vs AI sample content]") print("[Demo mode — comparing human vs AI sample content]")
print() print()
@ -468,18 +486,17 @@ def main():
print(f" Difference: {r1['humanity_score'] - r2['humanity_score']} points") print(f" Difference: {r1['humanity_score'] - r2['humanity_score']} points")
print() print()
else: else:
filepath = sys.argv[1]
try: try:
with open(filepath, 'r', encoding='utf-8') as f: with open(args.file, 'r', encoding='utf-8') as f:
text = f.read() text = f.read()
except FileNotFoundError: except FileNotFoundError:
print(f"Error: file not found: {filepath}", file=sys.stderr) print(f"Error: file not found: {args.file}", file=sys.stderr)
sys.exit(1) sys.exit(1)
result = score_humanity(text) result = score_humanity(text)
print_report(result, filepath) print_report(result, args.file)
if "--json" in sys.argv: if args.json:
print(json.dumps(result, indent=2)) print(json.dumps(result, indent=2))

View file

@ -174,12 +174,24 @@ def analyze_content(content: str, output_format: str = 'json') -> str:
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
import argparse
if len(sys.argv) > 1:
with open(sys.argv[1], 'r') as f: parser = argparse.ArgumentParser(
description="Brand Voice Analyzer - Analyzes content to establish and maintain brand voice consistency"
)
parser.add_argument(
"file", nargs="?", default=None,
help="Text file to analyze"
)
parser.add_argument(
"--format", choices=["json", "text"], default="text",
help="Output format (default: text)"
)
args = parser.parse_args()
if args.file:
with open(args.file, 'r') as f:
content = f.read() content = f.read()
print(analyze_content(content, args.format))
output_format = sys.argv[2] if len(sys.argv) > 2 else 'text'
print(analyze_content(content, output_format))
else: else:
print("Usage: python brand_voice_analyzer.py <file> [json|text]") print("Usage: python brand_voice_analyzer.py <file> [--format json|text]")

View file

@ -401,11 +401,31 @@ def print_report(result: dict, title: str, keyword: str) -> None:
def main(): def main():
import argparse
parser = argparse.ArgumentParser(
description="Scores content 0-100 on readability, SEO, structure, and engagement."
)
parser.add_argument(
"file", nargs="?", default=None,
help="Path to a text/markdown file to analyze. If omitted, runs demo "
"with embedded sample content."
)
parser.add_argument(
"keyword", nargs="?", default="",
help="Target SEO keyword to check density and placement."
)
parser.add_argument(
"--json", action="store_true",
help="Also output results as JSON."
)
args = parser.parse_args()
title = "" title = ""
keyword = "" keyword = args.keyword
text = "" text = ""
if len(sys.argv) == 1: if args.file is None:
# Demo mode — use embedded sample # Demo mode — use embedded sample
print("[Demo mode — using embedded sample content]") print("[Demo mode — using embedded sample content]")
text = SAMPLE_CONTENT text = SAMPLE_CONTENT
@ -413,13 +433,11 @@ def main():
keyword = SAMPLE_KEYWORD keyword = SAMPLE_KEYWORD
else: else:
# Read from file # Read from file
filepath = sys.argv[1]
keyword = sys.argv[2] if len(sys.argv) > 2 else ""
try: try:
with open(filepath, 'r', encoding='utf-8') as f: with open(args.file, 'r', encoding='utf-8') as f:
text = f.read() text = f.read()
except FileNotFoundError: except FileNotFoundError:
print(f"Error: file not found: {filepath}", file=sys.stderr) print(f"Error: file not found: {args.file}", file=sys.stderr)
sys.exit(1) sys.exit(1)
# Extract title from first H1 or first line # Extract title from first H1 or first line
@ -438,7 +456,7 @@ def main():
print_report(result, title, keyword) print_report(result, title, keyword)
# JSON output for programmatic use # JSON output for programmatic use
if "--json" in sys.argv: if args.json:
print(json.dumps(result, indent=2)) print(json.dumps(result, indent=2))

View file

@ -406,14 +406,28 @@ def optimize_content(content: str, keyword: str = None,
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
import argparse
if len(sys.argv) > 1:
with open(sys.argv[1], 'r') as f: parser = argparse.ArgumentParser(
description="SEO Content Optimizer - Analyzes and optimizes content for SEO"
)
parser.add_argument(
"file", nargs="?", default=None,
help="Text file to analyze"
)
parser.add_argument(
"--keyword", "-k", default=None,
help="Primary keyword to optimize for"
)
parser.add_argument(
"--secondary", "-s", default=None,
help="Comma-separated secondary keywords"
)
args = parser.parse_args()
if args.file:
with open(args.file, 'r') as f:
content = f.read() content = f.read()
print(optimize_content(content, args.keyword, args.secondary))
keyword = sys.argv[2] if len(sys.argv) > 2 else None
secondary = sys.argv[3] if len(sys.argv) > 3 else None
print(optimize_content(content, keyword, secondary))
else: else:
print("Usage: python seo_optimizer.py <file> [primary_keyword] [secondary_keywords]") print("Usage: python seo_optimizer.py <file> [--keyword primary] [--secondary kw1,kw2]")

View file

@ -330,11 +330,25 @@ DEFAULT_PARAMS = {
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
def main(): def main():
import argparse
parser = argparse.ArgumentParser(
description="Estimates ROI of building a free marketing tool. "
"Models return given build cost, maintenance, traffic, "
"conversion rate, and lead value."
)
parser.add_argument(
"file", nargs="?", default=None,
help="Path to a JSON file with tool parameters. "
"If omitted, reads from stdin or runs embedded sample."
)
args = parser.parse_args()
params = None params = None
if len(sys.argv) > 1: if args.file:
try: try:
with open(sys.argv[1]) as f: with open(args.file) as f:
params = json.load(f) params = json.load(f)
except Exception as e: except Exception as e:
print(f"Error reading file: {e}", file=sys.stderr) print(f"Error reading file: {e}", file=sys.stderr)

View file

@ -123,8 +123,25 @@ def print_report(results: dict):
def main(): def main():
if len(sys.argv) > 1: import argparse
filepath = Path(sys.argv[1])
parser = argparse.ArgumentParser(
description="Validates marketing context completeness. "
"Scores 0-100 based on required and optional section coverage."
)
parser.add_argument(
"file", nargs="?", default=None,
help="Path to a marketing context markdown file. "
"If omitted, runs demo with embedded sample data."
)
parser.add_argument(
"--json", action="store_true",
help="Also output results as JSON."
)
args = parser.parse_args()
if args.file:
filepath = Path(args.file)
if not filepath.exists(): if not filepath.exists():
print(f"Error: File not found: {filepath}", file=sys.stderr) print(f"Error: File not found: {filepath}", file=sys.stderr)
sys.exit(1) sys.exit(1)
@ -194,7 +211,7 @@ def main():
results = validate_context(content) results = validate_context(content)
print_report(results) print_report(results)
if "--json" in sys.argv: if args.json:
print(f"\n{json.dumps(results, indent=2)}") print(f"\n{json.dumps(results, indent=2)}")

View file

@ -119,8 +119,23 @@ def print_report(analysis: dict):
def main(): def main():
if len(sys.argv) > 1: import argparse
filepath = Path(sys.argv[1])
parser = argparse.ArgumentParser(
description="Track campaign status across marketing skills — tasks, owners, deadlines."
)
parser.add_argument(
"input_file", nargs="?", default=None,
help="JSON file with campaign data (default: run with sample data)"
)
parser.add_argument(
"--json", action="store_true",
help="Also output results as JSON"
)
args = parser.parse_args()
if args.input_file:
filepath = Path(args.input_file)
if filepath.exists(): if filepath.exists():
campaign = json.loads(filepath.read_text()) campaign = json.loads(filepath.read_text())
else: else:
@ -133,7 +148,7 @@ def main():
analysis = analyze_campaign(campaign) analysis = analyze_campaign(campaign)
print_report(analysis) print_report(analysis)
if "--json" in sys.argv: if args.json:
print(f"\n{json.dumps(analysis, indent=2)}") print(f"\n{json.dumps(analysis, indent=2)}")

View file

@ -207,11 +207,26 @@ def print_report(result, inputs):
def main(): def main():
if len(sys.argv) > 1 and sys.argv[1] != "--json": import argparse
with open(sys.argv[1]) as f:
parser = argparse.ArgumentParser(
description="Pricing modeler — projects revenue at different price points and recommends tier structure."
)
parser.add_argument(
"input_file", nargs="?", default=None,
help="JSON file with pricing data (default: run with sample data)"
)
parser.add_argument(
"--json", action="store_true",
help="Output results as JSON"
)
args = parser.parse_args()
if args.input_file:
with open(args.input_file) as f:
inputs = json.load(f) inputs = json.load(f)
else: else:
if "--json" not in sys.argv: if not args.json:
print("No input file provided. Running with sample data...\n") print("No input file provided. Running with sample data...\n")
inputs = SAMPLE_INPUT inputs = SAMPLE_INPUT
@ -260,7 +275,7 @@ def main():
print_report(result, inputs) print_report(result, inputs)
if "--json" in sys.argv: if args.json:
print(json.dumps(result, indent=2)) print(json.dumps(result, indent=2))

View file

@ -353,11 +353,25 @@ def run(params):
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
def main(): def main():
import argparse
parser = argparse.ArgumentParser(
description="Calculates referral program ROI. "
"Models economics given LTV, CAC, referral rate, reward cost, "
"and conversion rate."
)
parser.add_argument(
"file", nargs="?", default=None,
help="Path to a JSON file with referral program parameters. "
"If omitted, reads from stdin or runs embedded sample."
)
args = parser.parse_args()
params = None params = None
if len(sys.argv) > 1: if args.file:
try: try:
with open(sys.argv[1]) as f: with open(args.file) as f:
params = json.load(f) params = json.load(f)
except Exception as e: except Exception as e:
print(f"Error reading file: {e}", file=sys.stderr) print(f"Error reading file: {e}", file=sys.stderr)

View file

@ -390,16 +390,28 @@ SAMPLE_HTML = """<!DOCTYPE html>
# ─── Main ───────────────────────────────────────────────────────────────────── # ─── Main ─────────────────────────────────────────────────────────────────────
def main(): def main():
if len(sys.argv) > 1: import argparse
arg = sys.argv[1]
if arg == "-": parser = argparse.ArgumentParser(
description="Extracts and validates JSON-LD structured data from HTML. "
"Scores 0-100 per schema block based on required/recommended field coverage."
)
parser.add_argument(
"file", nargs="?", default=None,
help="Path to an HTML file to validate. "
"Use '-' to read from stdin. If omitted, runs embedded sample."
)
args = parser.parse_args()
if args.file:
if args.file == "-":
html = sys.stdin.read() html = sys.stdin.read()
else: else:
try: try:
with open(arg, "r", encoding="utf-8") as f: with open(args.file, "r", encoding="utf-8") as f:
html = f.read() html = f.read()
except FileNotFoundError: except FileNotFoundError:
print(f"Error: File not found: {arg}", file=sys.stderr) print(f"Error: File not found: {args.file}", file=sys.stderr)
sys.exit(1) sys.exit(1)
else: else:
print("No file provided — running on embedded sample HTML.\n") print("No file provided — running on embedded sample HTML.\n")

View file

@ -328,12 +328,24 @@ def load_content(source: str) -> str:
def main(): def main():
if len(sys.argv) > 1: import argparse
arg = sys.argv[1]
if arg == "-": parser = argparse.ArgumentParser(
description="Analyzes sitemap.xml files for structure, depth, and potential issues. "
"Reports depth distribution, URL patterns, orphan candidates, and duplicates."
)
parser.add_argument(
"file", nargs="?", default=None,
help="Path to a sitemap.xml file or URL (https://...). "
"Use '-' to read from stdin. If omitted, runs embedded sample."
)
args = parser.parse_args()
if args.file:
if args.file == "-":
content = sys.stdin.read() content = sys.stdin.read()
else: else:
content = load_content(arg) content = load_content(args.file)
else: else:
print("No file or URL provided — running on embedded sample sitemap.\n") print("No file or URL provided — running on embedded sample sitemap.\n")
content = SAMPLE_SITEMAP content = SAMPLE_SITEMAP

View file

@ -412,8 +412,22 @@ def format_single_interview(analysis: Dict) -> str:
def main(): def main():
import sys import sys
import argparse
if len(sys.argv) < 2:
parser = argparse.ArgumentParser(
description="Customer Interview Analyzer - Extracts insights, patterns, and opportunities from user interviews"
)
parser.add_argument(
"file", nargs="?", default=None,
help="Interview transcript text file to analyze"
)
parser.add_argument(
"--json", action="store_true",
help="Output results as JSON"
)
args = parser.parse_args()
if not args.file:
print("Usage: python customer_interview_analyzer.py <interview_file.txt>") print("Usage: python customer_interview_analyzer.py <interview_file.txt>")
print("\nThis tool analyzes customer interview transcripts to extract:") print("\nThis tool analyzes customer interview transcripts to extract:")
print(" - Pain points and frustrations") print(" - Pain points and frustrations")
@ -422,17 +436,14 @@ def main():
print(" - Sentiment analysis") print(" - Sentiment analysis")
print(" - Key themes and quotes") print(" - Key themes and quotes")
sys.exit(1) sys.exit(1)
# Read interview transcript with open(args.file, 'r') as f:
with open(sys.argv[1], 'r') as f:
interview_text = f.read() interview_text = f.read()
# Analyze
analyzer = InterviewAnalyzer() analyzer = InterviewAnalyzer()
analysis = analyzer.analyze_interview(interview_text) analysis = analyzer.analyze_interview(interview_text)
# Output if args.json:
if len(sys.argv) > 2 and sys.argv[2] == 'json':
print(json.dumps(analysis, indent=2)) print(json.dumps(analysis, indent=2))
else: else:
print(format_single_interview(analysis)) print(format_single_interview(analysis))

View file

@ -267,6 +267,9 @@ def generate_docker_compose(config: Dict[str, Any]) -> str:
compose["volumes"]["mongodata"] = {} compose["volumes"]["mongodata"] = {}
# Manual YAML-like output (avoid pyyaml dependency) # Manual YAML-like output (avoid pyyaml dependency)
nl = "\n"
depends_on = f" depends_on:{nl} - db" if db else ""
vol_line = " pgdata:" if db == "postgresql" else " mongodata:" if db == "mongodb" else " {}"
return f"""version: '3.8' return f"""version: '3.8'
services: services:
@ -278,12 +281,12 @@ services:
- .env - .env
volumes: volumes:
- .:/app - .:/app
{f' depends_on:\\n - db' if db else ''} {depends_on}
{generate_db_service(db)} {generate_db_service(db)}
{generate_redis_service(config)} {generate_redis_service(config)}
volumes: volumes:
{f' pgdata:' if db == 'postgresql' else f' mongodata:' if db == 'mongodb' else ' {}'} {vol_line}
""" """

View file

@ -547,33 +547,44 @@ class DesignTokenGenerator:
def main(): def main():
import sys import sys
import argparse
parser = argparse.ArgumentParser(
description="Design Token Generator - Creates consistent design system tokens for colors, typography, spacing, and more."
)
parser.add_argument(
"brand_color", nargs="?", default="#0066CC",
help="Hex brand color (default: #0066CC)"
)
parser.add_argument(
"--style", choices=["modern", "classic", "playful"], default="modern",
help="Design style (default: modern)"
)
parser.add_argument(
"--format", choices=["json", "css", "scss", "summary"], default="json",
dest="output_format",
help="Output format (default: json)"
)
args = parser.parse_args()
generator = DesignTokenGenerator() generator = DesignTokenGenerator()
tokens = generator.generate_complete_system(args.brand_color, args.style)
# Get parameters
brand_color = sys.argv[1] if len(sys.argv) > 1 else "#0066CC" if args.output_format == 'summary':
style = sys.argv[2] if len(sys.argv) > 2 else "modern"
output_format = sys.argv[3] if len(sys.argv) > 3 else "json"
# Generate tokens
tokens = generator.generate_complete_system(brand_color, style)
# Output
if output_format == 'summary':
print("=" * 60) print("=" * 60)
print("DESIGN SYSTEM TOKENS") print("DESIGN SYSTEM TOKENS")
print("=" * 60) print("=" * 60)
print(f"\n🎨 Style: {style}") print(f"\n Style: {args.style}")
print(f"🎨 Brand Color: {brand_color}") print(f" Brand Color: {args.brand_color}")
print("\n📊 Generated Tokens:") print("\n Generated Tokens:")
print(f" • Colors: {len(tokens['colors'])} palettes") print(f" - Colors: {len(tokens['colors'])} palettes")
print(f" • Typography: {len(tokens['typography'])} categories") print(f" - Typography: {len(tokens['typography'])} categories")
print(f" • Spacing: {len(tokens['spacing'])} values") print(f" - Spacing: {len(tokens['spacing'])} values")
print(f" • Shadows: {len(tokens['shadows'])} styles") print(f" - Shadows: {len(tokens['shadows'])} styles")
print(f" • Breakpoints: {len(tokens['breakpoints'])} sizes") print(f" - Breakpoints: {len(tokens['breakpoints'])} sizes")
print("\n💾 Export formats available: json, css, scss") print("\n Export formats available: json, css, scss")
else: else:
print(generator.export_tokens(tokens, output_format)) print(generator.export_tokens(tokens, args.output_format))
if __name__ == "__main__": if __name__ == "__main__":
main() main()