@heylemon/lemonade 0.2.1 → 0.2.3

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.
@@ -2,7 +2,7 @@
2
2
  name: openai-image-gen
3
3
  description: Batch-generate images via OpenAI Images API. Random prompt sampler + `index.html` gallery.
4
4
  homepage: https://platform.openai.com/docs/api-reference/images
5
- metadata: {"lemonade":{"emoji":"🖼️","requires":{"bins":["python3"],"env":["OPENAI_API_KEY"]},"primaryEnv":"OPENAI_API_KEY","install":[{"id":"python-brew","kind":"brew","formula":"python","bins":["python3"],"label":"Install Python (brew)"}]}}
5
+ metadata: {"lemonade":{"emoji":"🖼️","requires":{"bins":["python3"]},"install":[{"id":"python-brew","kind":"brew","formula":"python","bins":["python3"],"label":"Install Python (brew)"}]}}
6
6
  ---
7
7
 
8
8
  # OpenAI Image Gen
@@ -74,6 +74,19 @@ def get_model_defaults(model: str) -> tuple[str, str]:
74
74
  return ("1024x1024", "high")
75
75
 
76
76
 
77
+ def resolve_api_url_and_key() -> tuple[str, str]:
78
+ """Resolve the images API base URL and auth token.
79
+ Prefers the Lemonade backend proxy; falls back to direct OpenAI key."""
80
+ backend = (os.environ.get("LEMON_BACKEND_URL") or "").strip()
81
+ gw_token = (os.environ.get("GATEWAY_TOKEN") or "").strip()
82
+ if backend and gw_token:
83
+ return f"{backend}/api/lemonade/proxy/v1/images/generations", gw_token
84
+ api_key = (os.environ.get("OPENAI_API_KEY") or "").strip()
85
+ if api_key:
86
+ return "https://api.openai.com/v1/images/generations", api_key
87
+ return "", ""
88
+
89
+
77
90
  def request_images(
78
91
  api_key: str,
79
92
  prompt: str,
@@ -83,8 +96,9 @@ def request_images(
83
96
  background: str = "",
84
97
  output_format: str = "",
85
98
  style: str = "",
99
+ api_url: str = "",
86
100
  ) -> dict:
87
- url = "https://api.openai.com/v1/images/generations"
101
+ url = api_url or "https://api.openai.com/v1/images/generations"
88
102
  args = {
89
103
  "model": model,
90
104
  "prompt": prompt,
@@ -173,9 +187,9 @@ def main() -> int:
173
187
  ap.add_argument("--out-dir", default="", help="Output directory (default: ./tmp/openai-image-gen-<ts>).")
174
188
  args = ap.parse_args()
175
189
 
176
- api_key = (os.environ.get("OPENAI_API_KEY") or "").strip()
190
+ api_url, api_key = resolve_api_url_and_key()
177
191
  if not api_key:
178
- print("Missing OPENAI_API_KEY", file=sys.stderr)
192
+ print("No API credentials available for image generation", file=sys.stderr)
179
193
  return 2
180
194
 
181
195
  # Apply model-specific defaults if not specified
@@ -211,6 +225,7 @@ def main() -> int:
211
225
  args.background,
212
226
  args.output_format,
213
227
  args.style,
228
+ api_url=api_url,
214
229
  )
215
230
  data = res.get("data", [{}])[0]
216
231
  image_b64 = data.get("b64_json")
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: self-improvement
3
+ description: "Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects the agent, (3) User requests a capability that doesn't exist, (4) An external API or tool fails, (5) Agent realizes its knowledge is outdated or incorrect, (6) A better approach is discovered for a recurring task."
4
+ metadata: {"lemonade":{"emoji":"🧠"}}
5
+ ---
6
+
7
+ # Self-Improvement Skill
8
+
9
+ Log learnings and errors to markdown files for continuous improvement. Important learnings get promoted to project memory.
10
+
11
+ ## Quick Reference
12
+
13
+ | Situation | Action |
14
+ |-----------|--------|
15
+ | Command/operation fails | Log to `.learnings/ERRORS.md` |
16
+ | User corrects you | Log to `.learnings/LEARNINGS.md` with category `correction` |
17
+ | User wants missing feature | Log to `.learnings/FEATURE_REQUESTS.md` |
18
+ | API/external tool fails | Log to `.learnings/ERRORS.md` with integration details |
19
+ | Knowledge was outdated | Log to `.learnings/LEARNINGS.md` with category `knowledge_gap` |
20
+ | Found better approach | Log to `.learnings/LEARNINGS.md` with category `best_practice` |
21
+ | Broadly applicable learning | Promote to project memory files |
22
+
23
+ ## Setup
24
+
25
+ ```bash
26
+ mkdir -p ~/.lemonade/workspace/.learnings
27
+ ```
28
+
29
+ ## Logging Format
30
+
31
+ ### Learning Entry
32
+
33
+ Append to `.learnings/LEARNINGS.md`:
34
+
35
+ ```markdown
36
+ ## [LRN-YYYYMMDD-XXX] category
37
+
38
+ **Logged**: ISO-8601 timestamp
39
+ **Priority**: low | medium | high | critical
40
+ **Status**: pending
41
+ **Area**: frontend | backend | infra | tests | docs | config
42
+
43
+ ### Summary
44
+ One-line description of what was learned
45
+
46
+ ### Details
47
+ Full context: what happened, what was wrong, what's correct
48
+
49
+ ### Suggested Action
50
+ Specific fix or improvement to make
51
+
52
+ ### Metadata
53
+ - Source: conversation | error | user_feedback
54
+ - Related Files: path/to/file.ext
55
+ - Tags: tag1, tag2
56
+ ```
57
+
58
+ ### Error Entry
59
+
60
+ Append to `.learnings/ERRORS.md`:
61
+
62
+ ```markdown
63
+ ## [ERR-YYYYMMDD-XXX] skill_or_command_name
64
+
65
+ **Logged**: ISO-8601 timestamp
66
+ **Priority**: high
67
+ **Status**: pending
68
+
69
+ ### Summary
70
+ Brief description of what failed
71
+
72
+ ### Error
73
+ Actual error message or output
74
+
75
+ ### Context
76
+ - Command/operation attempted
77
+ - Input or parameters used
78
+
79
+ ### Suggested Fix
80
+ If identifiable, what might resolve this
81
+ ```
82
+
83
+ ### Feature Request Entry
84
+
85
+ Append to `.learnings/FEATURE_REQUESTS.md`:
86
+
87
+ ```markdown
88
+ ## [FEAT-YYYYMMDD-XXX] capability_name
89
+
90
+ **Logged**: ISO-8601 timestamp
91
+ **Priority**: medium
92
+ **Status**: pending
93
+
94
+ ### Requested Capability
95
+ What the user wanted to do
96
+
97
+ ### User Context
98
+ Why they needed it
99
+
100
+ ### Suggested Implementation
101
+ How this could be built
102
+ ```
103
+
104
+ ## Detection Triggers
105
+
106
+ Automatically log when you notice:
107
+
108
+ **Corrections**: "No, that's not right...", "Actually, it should be...", "You're wrong about..."
109
+
110
+ **Feature Requests**: "Can you also...", "I wish you could...", "Is there a way to..."
111
+
112
+ **Knowledge Gaps**: User provides information you didn't know, documentation is outdated
113
+
114
+ **Errors**: Command returns non-zero exit code, exception or stack trace
115
+
116
+ ## Resolving Entries
117
+
118
+ When an issue is fixed, update `**Status**: pending` to `**Status**: resolved` and add a resolution block.
119
+
120
+ ## Best Practices
121
+
122
+ 1. Log immediately - context is freshest right after the issue
123
+ 2. Be specific - future agents need to understand quickly
124
+ 3. Include reproduction steps - especially for errors
125
+ 4. Link related files - makes fixes easier
126
+ 5. Suggest concrete fixes - not just "investigate"
127
+ 6. Promote aggressively - if in doubt, add to project memory
128
+ ```
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: stock-analysis
3
+ description: Analyze stocks and cryptocurrencies using Yahoo Finance data. Supports portfolio management, watchlists with alerts, dividend analysis, 8-dimension stock scoring, viral trend detection (Hot Scanner), and rumor/early signal detection. Use for stock analysis, portfolio tracking, earnings reactions, crypto monitoring, trending stocks, or finding rumors before they hit mainstream.
4
+ version: 6.2.0
5
+ homepage: https://finance.yahoo.com
6
+ commands:
7
+ - /stock - Analyze a stock or crypto (e.g., /stock AAPL)
8
+ - /stock_compare - Compare multiple tickers
9
+ - /stock_dividend - Analyze dividend metrics
10
+ - /stock_watch - Add/remove from watchlist
11
+ - /stock_alerts - Check triggered alerts
12
+ - /stock_hot - Find trending stocks & crypto (Hot Scanner)
13
+ - /stock_rumors - Find early signals, M&A rumors, insider activity (Rumor Scanner)
14
+ - /portfolio - Show portfolio summary
15
+ - /portfolio_add - Add asset to portfolio
16
+ metadata: {"lemonade":{"emoji":"📈","requires":{"bins":["uv"],"env":[]},"install":[{"id":"uv-brew","kind":"brew","formula":"uv","bins":["uv"],"label":"Install uv (brew)"}]}}
17
+ ---
18
+
19
+ # Stock Analysis v6.1
20
+
21
+ Analyze US stocks and cryptocurrencies with 8-dimension analysis, portfolio management, watchlists, alerts, dividend analysis, and **viral trend detection**.
22
+
23
+ ## What's New in v6.2
24
+
25
+ - **Rumor Scanner** — Early signals before mainstream news
26
+ - M&A rumors and takeover bids
27
+ - Insider buying/selling activity
28
+ - Analyst upgrades/downgrades
29
+ - Twitter/X "hearing that...", "sources say..." detection
30
+ - **Impact Scoring** — Rumors ranked by potential market impact
31
+
32
+ ## What's in v6.1
33
+
34
+ - **Hot Scanner** — Find viral stocks & crypto across multiple sources
35
+ - **Twitter/X Integration** — Social sentiment via bird CLI
36
+ - **Multi-Source Aggregation** — CoinGecko, Google News, Yahoo Finance
37
+ - **Cron Support** — Daily trend reports
38
+
39
+ ## What's in v6.0
40
+
41
+ - **Watchlist + Alerts** — Price targets, stop losses, signal changes
42
+ - **Dividend Analysis** — Yield, payout ratio, growth, safety score
43
+ - **Fast Mode** — `--fast` skips slow analyses (insider, news)
44
+ - **Improved Performance** — `--no-insider` for faster runs
45
+
46
+ ## Quick Commands
47
+
48
+ ### Stock Analysis
49
+ ```bash
50
+ # Basic analysis
51
+ uv run {baseDir}/scripts/analyze_stock.py AAPL
52
+
53
+ # Fast mode (skips insider trading & breaking news)
54
+ uv run {baseDir}/scripts/analyze_stock.py AAPL --fast
55
+
56
+ # Compare multiple
57
+ uv run {baseDir}/scripts/analyze_stock.py AAPL MSFT GOOGL
58
+
59
+ # Crypto
60
+ uv run {baseDir}/scripts/analyze_stock.py BTC-USD ETH-USD
61
+ ```
62
+
63
+ ### Dividend Analysis
64
+ ```bash
65
+ uv run {baseDir}/scripts/dividends.py JNJ
66
+ uv run {baseDir}/scripts/dividends.py JNJ PG KO MCD --output json
67
+ ```
68
+
69
+ ### Watchlist + Alerts
70
+ ```bash
71
+ uv run {baseDir}/scripts/watchlist.py add AAPL
72
+ uv run {baseDir}/scripts/watchlist.py add AAPL --target 200
73
+ uv run {baseDir}/scripts/watchlist.py add AAPL --stop 150
74
+ uv run {baseDir}/scripts/watchlist.py list
75
+ uv run {baseDir}/scripts/watchlist.py check
76
+ ```
77
+
78
+ ### Portfolio Management
79
+ ```bash
80
+ uv run {baseDir}/scripts/portfolio.py create "Tech Portfolio"
81
+ uv run {baseDir}/scripts/portfolio.py add AAPL --quantity 100 --cost 150
82
+ uv run {baseDir}/scripts/portfolio.py show
83
+ ```
84
+
85
+ ### Hot Scanner
86
+ ```bash
87
+ python3 {baseDir}/scripts/hot_scanner.py
88
+ python3 {baseDir}/scripts/hot_scanner.py --no-social
89
+ python3 {baseDir}/scripts/hot_scanner.py --json
90
+ ```
91
+
92
+ ### Rumor Scanner
93
+ ```bash
94
+ python3 {baseDir}/scripts/rumor_scanner.py
95
+ ```
96
+
97
+ ## Analysis Dimensions (8 for stocks, 3 for crypto)
98
+
99
+ ### Stocks
100
+ | Dimension | Weight | Description |
101
+ |-----------|--------|-------------|
102
+ | Earnings Surprise | 30% | EPS beat/miss |
103
+ | Fundamentals | 20% | P/E, margins, growth |
104
+ | Analyst Sentiment | 20% | Ratings, price targets |
105
+ | Historical | 10% | Past earnings reactions |
106
+ | Market Context | 10% | VIX, SPY/QQQ trends |
107
+ | Sector | 15% | Relative strength |
108
+ | Momentum | 15% | RSI, 52-week range |
109
+ | Sentiment | 10% | Fear/Greed, shorts, insiders |
110
+
111
+ ### Crypto
112
+ - Market Cap & Category
113
+ - BTC Correlation (30-day)
114
+ - Momentum (RSI, range)
115
+
116
+ ## Supported Cryptos (Top 20)
117
+
118
+ BTC, ETH, BNB, SOL, XRP, ADA, DOGE, AVAX, DOT, MATIC, LINK, ATOM, UNI, LTC, BCH, XLM, ALGO, VET, FIL, NEAR
119
+
120
+ (Use `-USD` suffix: `BTC-USD`, `ETH-USD`)
121
+
122
+ ## Limitations
123
+
124
+ - Yahoo Finance may lag 15-20 minutes
125
+ - Short interest lags ~2 weeks (FINRA)
126
+ - Insider trades lag 2-3 days (SEC filing)
127
+ - US markets only (non-US incomplete)
128
+
129
+ ## Disclaimer
130
+
131
+ **NOT FINANCIAL ADVICE.** For informational purposes only. Consult a licensed financial advisor before making investment decisions.