aiden-runtime 3.19.5 → 3.19.7
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.
- package/README.md +1 -1
- package/dist/api/server.js +24 -25
- package/dist/core/agentLoop.js +8 -6
- package/dist/core/aidenPersonality.js +20 -3
- package/dist/core/protectedContext.js +15 -2
- package/dist/core/skillLoader.js +2 -0
- package/dist/core/skillTeacher.js +18 -5
- package/dist/core/version.js +1 -1
- package/dist-bundle/cli.js +50 -18
- package/dist-bundle/index.js +73 -35
- package/package.json +2 -1
- package/scripts/postinstall.js +70 -1
- package/workspace-templates/HEARTBEAT.md +16 -0
- package/workspace-templates/SOUL.md +267 -0
- package/workspace-templates/STANDING_ORDERS.md +21 -0
- package/workspace-templates/permissions.yaml +180 -0
- package/workspace-templates/skills/architecture-diagram/SKILL.md +126 -0
- package/workspace-templates/skills/architecture-diagram/skill.json +25 -0
- package/workspace-templates/skills/arxiv/SKILL.md +124 -0
- package/workspace-templates/skills/arxiv/skill.json +26 -0
- package/workspace-templates/skills/ascii-art/SKILL.md +142 -0
- package/workspace-templates/skills/ascii-art/skill.json +26 -0
- package/workspace-templates/skills/blogwatcher/SKILL.md +147 -0
- package/workspace-templates/skills/blogwatcher/skill.json +26 -0
- package/workspace-templates/skills/censys/SKILL.md +104 -0
- package/workspace-templates/skills/censys/index.ts +133 -0
- package/workspace-templates/skills/censys/skill.json +25 -0
- package/workspace-templates/skills/clipboard-history/SKILL.md +101 -0
- package/workspace-templates/skills/clipboard-history/skill.json +23 -0
- package/workspace-templates/skills/crt-sh/SKILL.md +102 -0
- package/workspace-templates/skills/crt-sh/index.ts +59 -0
- package/workspace-templates/skills/crt-sh/skill.json +25 -0
- package/workspace-templates/skills/cveapi/SKILL.md +114 -0
- package/workspace-templates/skills/cveapi/index.ts +249 -0
- package/workspace-templates/skills/cveapi/skill.json +25 -0
- package/workspace-templates/skills/docker-management/SKILL.md +156 -0
- package/workspace-templates/skills/docker-management/skill.json +25 -0
- package/workspace-templates/skills/excalidraw/SKILL.md +148 -0
- package/workspace-templates/skills/excalidraw/skill.json +25 -0
- package/workspace-templates/skills/explainshell/SKILL.md +93 -0
- package/workspace-templates/skills/explainshell/index.ts +132 -0
- package/workspace-templates/skills/explainshell/skill.json +25 -0
- package/workspace-templates/skills/financial_research/SKILL.md +21 -0
- package/workspace-templates/skills/financial_research/skill.json +24 -0
- package/workspace-templates/skills/gif-search/SKILL.md +122 -0
- package/workspace-templates/skills/gif-search/skill.json +25 -0
- package/workspace-templates/skills/github-auth/SKILL.md +134 -0
- package/workspace-templates/skills/github-auth/skill.json +26 -0
- package/workspace-templates/skills/github-issues/SKILL.md +130 -0
- package/workspace-templates/skills/github-issues/skill.json +25 -0
- package/workspace-templates/skills/github-pr-workflow/SKILL.md +143 -0
- package/workspace-templates/skills/github-pr-workflow/skill.json +26 -0
- package/workspace-templates/skills/github-repo-management/SKILL.md +147 -0
- package/workspace-templates/skills/github-repo-management/skill.json +26 -0
- package/workspace-templates/skills/google-workspace/SKILL.md +110 -0
- package/workspace-templates/skills/google-workspace/skill.json +26 -0
- package/workspace-templates/skills/greynoise/SKILL.md +96 -0
- package/workspace-templates/skills/greynoise/index.ts +107 -0
- package/workspace-templates/skills/greynoise/skill.json +25 -0
- package/workspace-templates/skills/haveibeenpwned/SKILL.md +100 -0
- package/workspace-templates/skills/haveibeenpwned/index.ts +72 -0
- package/workspace-templates/skills/haveibeenpwned/skill.json +24 -0
- package/workspace-templates/skills/jupyter-live-kernel/SKILL.md +116 -0
- package/workspace-templates/skills/jupyter-live-kernel/skill.json +25 -0
- package/workspace-templates/skills/linear/SKILL.md +107 -0
- package/workspace-templates/skills/linear/skill.json +25 -0
- package/workspace-templates/skills/nano-pdf/SKILL.md +113 -0
- package/workspace-templates/skills/nano-pdf/skill.json +26 -0
- package/workspace-templates/skills/notion/SKILL.md +108 -0
- package/workspace-templates/skills/notion/skill.json +24 -0
- package/workspace-templates/skills/obsidian/SKILL.md +115 -0
- package/workspace-templates/skills/obsidian/skill.json +24 -0
- package/workspace-templates/skills/ocr-and-documents/SKILL.md +125 -0
- package/workspace-templates/skills/ocr-and-documents/skill.json +26 -0
- package/workspace-templates/skills/p5js/SKILL.md +163 -0
- package/workspace-templates/skills/p5js/skill.json +24 -0
- package/workspace-templates/skills/research-paper-writing/SKILL.md +158 -0
- package/workspace-templates/skills/research-paper-writing/skill.json +26 -0
- package/workspace-templates/skills/securityheaders/SKILL.md +99 -0
- package/workspace-templates/skills/securityheaders/index.ts +213 -0
- package/workspace-templates/skills/securityheaders/skill.json +26 -0
- package/workspace-templates/skills/shodan/SKILL.md +113 -0
- package/workspace-templates/skills/shodan/index.ts +94 -0
- package/workspace-templates/skills/shodan/skill.json +26 -0
- package/workspace-templates/skills/songsee/SKILL.md +152 -0
- package/workspace-templates/skills/songsee/skill.json +25 -0
- package/workspace-templates/skills/ssllabs/SKILL.md +107 -0
- package/workspace-templates/skills/ssllabs/index.ts +208 -0
- package/workspace-templates/skills/ssllabs/skill.json +27 -0
- package/workspace-templates/skills/stable-diffusion-image-generation/SKILL.md +136 -0
- package/workspace-templates/skills/stable-diffusion-image-generation/skill.json +24 -0
- package/workspace-templates/skills/systematic-debugging/SKILL.md +131 -0
- package/workspace-templates/skills/systematic-debugging/skill.json +25 -0
- package/workspace-templates/skills/test-driven-development/SKILL.md +164 -0
- package/workspace-templates/skills/test-driven-development/skill.json +25 -0
- package/workspace-templates/skills/urlscan/SKILL.md +118 -0
- package/workspace-templates/skills/urlscan/index.ts +94 -0
- package/workspace-templates/skills/urlscan/skill.json +24 -0
- package/workspace-templates/skills/virustotal/SKILL.md +120 -0
- package/workspace-templates/skills/virustotal/index.ts +124 -0
- package/workspace-templates/skills/virustotal/skill.json +26 -0
- package/workspace-templates/skills/web_research/SKILL.md +18 -0
- package/workspace-templates/skills/web_research/skill.json +20 -0
- package/workspace-templates/skills/xitter/SKILL.md +148 -0
- package/workspace-templates/skills/xitter/skill.json +26 -0
- package/workspace-templates/skills/youtube-content/SKILL.md +121 -0
- package/workspace-templates/skills/youtube-content/skill.json +25 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// skills/ssllabs/index.ts
|
|
2
|
+
// Programmatic handler — comprehensive TLS/SSL analysis via Qualys SSL Labs API v4.
|
|
3
|
+
//
|
|
4
|
+
// Pattern: start scan → long-poll until READY → return normalised results.
|
|
5
|
+
|
|
6
|
+
import { ApiSkill } from '../../core/apiSkillBase'
|
|
7
|
+
|
|
8
|
+
// Note: v4 requires an email header; v3 is the public anonymous endpoint.
|
|
9
|
+
const skill = new ApiSkill({
|
|
10
|
+
name: 'ssllabs',
|
|
11
|
+
baseUrl: 'https://api.ssllabs.com/api/v3',
|
|
12
|
+
authType: 'none',
|
|
13
|
+
rateLimit: { requests: 1, windowMs: 2_000 }, // 1 req/2sec
|
|
14
|
+
timeout: 30_000,
|
|
15
|
+
retries: 2,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
// ── Output types ──────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
export interface SslProtocol {
|
|
21
|
+
name: string // e.g. "TLS"
|
|
22
|
+
version: string // e.g. "1.3"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SslEndpoint {
|
|
26
|
+
ip: string
|
|
27
|
+
grade: string
|
|
28
|
+
statusMessage: string
|
|
29
|
+
protocols: SslProtocol[]
|
|
30
|
+
forwardSecrecy: boolean
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface SslScanResult {
|
|
34
|
+
host: string
|
|
35
|
+
status: string // "READY" | "IN_PROGRESS" | "ERROR"
|
|
36
|
+
grade: string // best grade across all endpoints
|
|
37
|
+
endpoints: SslEndpoint[]
|
|
38
|
+
vulnerabilities: string[] // names of detected vulnerabilities
|
|
39
|
+
scanUrl: string // direct browser link to results
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ── Grade ordering ────────────────────────────────────────────
|
|
43
|
+
|
|
44
|
+
const GRADE_ORDER = ['A+', 'A', 'A-', 'B', 'C', 'D', 'E', 'F', 'T', 'M']
|
|
45
|
+
|
|
46
|
+
function bestGrade(grades: string[]): string {
|
|
47
|
+
let best = ''
|
|
48
|
+
for (const g of grades) {
|
|
49
|
+
const gi = GRADE_ORDER.indexOf(g)
|
|
50
|
+
const bi = GRADE_ORDER.indexOf(best)
|
|
51
|
+
if (gi >= 0 && (bi < 0 || gi < bi)) best = g
|
|
52
|
+
}
|
|
53
|
+
return best || 'N/A'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ── Vulnerability detection ───────────────────────────────────
|
|
57
|
+
|
|
58
|
+
function detectVulns(endpointDetails: any): string[] {
|
|
59
|
+
if (!endpointDetails) return []
|
|
60
|
+
const d = endpointDetails
|
|
61
|
+
const found: string[] = []
|
|
62
|
+
|
|
63
|
+
if (d.heartbleed) found.push('Heartbleed (CVE-2014-0160)')
|
|
64
|
+
if (d.poodleSsl) found.push('POODLE (SSLv3)')
|
|
65
|
+
if (d.poodleTls === 2) found.push('POODLE (TLS)')
|
|
66
|
+
if (d.freak) found.push('FREAK')
|
|
67
|
+
if (d.logjam) found.push('Logjam')
|
|
68
|
+
if (d.drownVulnerable) found.push('DROWN')
|
|
69
|
+
if (d.ticketbleed === 2) found.push('Ticketbleed')
|
|
70
|
+
if (d.bleichenbacher === 2 || d.bleichenbacher === 3) found.push('ROBOT/Bleichenbacher')
|
|
71
|
+
if (d.zombiePoodle === 2) found.push('Zombie POODLE')
|
|
72
|
+
if (d.goldenDoodle === 2) found.push('GoldenDoodle')
|
|
73
|
+
if (d.openSSLLuckyMinus20 === 2) found.push('Lucky MINUS 20')
|
|
74
|
+
|
|
75
|
+
return found
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ── Parse raw SSL Labs response ───────────────────────────────
|
|
79
|
+
|
|
80
|
+
function parseResponse(host: string, raw: any): SslScanResult {
|
|
81
|
+
const scanUrl = `https://www.ssllabs.com/ssltest/analyze.html?d=${encodeURIComponent(host)}&hideResults=on`
|
|
82
|
+
|
|
83
|
+
if (raw.status !== 'READY') {
|
|
84
|
+
return { host, status: raw.status ?? 'UNKNOWN', grade: 'N/A', endpoints: [], vulnerabilities: [], scanUrl }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const endpoints: SslEndpoint[] = (raw.endpoints ?? []).map((ep: any) => ({
|
|
88
|
+
ip: ep.ipAddress ?? '',
|
|
89
|
+
grade: ep.grade ?? ep.gradeTrustIgnored ?? 'N/A',
|
|
90
|
+
statusMessage: ep.statusMessage ?? '',
|
|
91
|
+
protocols: (ep.details?.protocols ?? []).map((p: any) => ({
|
|
92
|
+
name: p.name ?? 'TLS',
|
|
93
|
+
version: p.version ?? '',
|
|
94
|
+
})),
|
|
95
|
+
forwardSecrecy: (ep.details?.forwardSecrecy ?? 0) >= 2,
|
|
96
|
+
}))
|
|
97
|
+
|
|
98
|
+
const allVulns = new Set<string>()
|
|
99
|
+
for (const ep of (raw.endpoints ?? [])) {
|
|
100
|
+
for (const v of detectVulns(ep.details)) allVulns.add(v)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
host,
|
|
105
|
+
status: 'READY',
|
|
106
|
+
grade: bestGrade(endpoints.map(e => e.grade)),
|
|
107
|
+
endpoints,
|
|
108
|
+
vulnerabilities: [...allVulns],
|
|
109
|
+
scanUrl,
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ── Public API ────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Return the SSL Labs browser report URL immediately — no waiting.
|
|
117
|
+
*
|
|
118
|
+
* Use this when the user just wants a link rather than waiting 60–120s.
|
|
119
|
+
*/
|
|
120
|
+
export function quickScan(host: string): string {
|
|
121
|
+
const h = host.replace(/^https?:\/\//i, '').replace(/\/.*$/, '')
|
|
122
|
+
return `https://www.ssllabs.com/ssltest/analyze.html?d=${encodeURIComponent(h)}&hideResults=on&ignoreMismatch=on`
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Run a full SSL Labs scan with long-polling.
|
|
127
|
+
*
|
|
128
|
+
* Starts a new scan, polls every `pollIntervalMs` until the status is READY,
|
|
129
|
+
* then returns parsed results. Throws if the scan fails or times out.
|
|
130
|
+
*
|
|
131
|
+
* @param host Domain to scan (e.g. "github.com")
|
|
132
|
+
* @param options.maxWaitSeconds Maximum seconds to wait (default 180)
|
|
133
|
+
* @param options.pollIntervalMs Milliseconds between polls (default 20000)
|
|
134
|
+
*/
|
|
135
|
+
export async function scan(
|
|
136
|
+
host: string,
|
|
137
|
+
options?: { maxWaitSeconds?: number; pollIntervalMs?: number },
|
|
138
|
+
): Promise<SslScanResult> {
|
|
139
|
+
const maxWait = (options?.maxWaitSeconds ?? 180) * 1_000
|
|
140
|
+
const pollMs = options?.pollIntervalMs ?? 20_000
|
|
141
|
+
const cleanHost = host.replace(/^https?:\/\//i, '').replace(/\/.*$/, '')
|
|
142
|
+
const scanUrl = quickScan(cleanHost)
|
|
143
|
+
|
|
144
|
+
// Start a fresh scan
|
|
145
|
+
let raw = await skill.get('/analyze', {
|
|
146
|
+
host: cleanHost,
|
|
147
|
+
publish: 'off',
|
|
148
|
+
startNew: 'on',
|
|
149
|
+
all: 'done',
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
const start = Date.now()
|
|
153
|
+
|
|
154
|
+
// Poll until READY, ERROR, or timeout
|
|
155
|
+
while (raw.status !== 'READY' && raw.status !== 'ERROR') {
|
|
156
|
+
if (Date.now() - start >= maxWait) {
|
|
157
|
+
throw new Error(
|
|
158
|
+
`SSL Labs scan for "${cleanHost}" timed out after ${options?.maxWaitSeconds ?? 180}s.\n` +
|
|
159
|
+
`View progress at: ${scanUrl}`,
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
await new Promise(r => setTimeout(r, pollMs))
|
|
163
|
+
raw = await skill.get('/analyze', {
|
|
164
|
+
host: cleanHost,
|
|
165
|
+
publish: 'off',
|
|
166
|
+
all: 'done',
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (raw.status === 'ERROR') {
|
|
171
|
+
throw new Error(
|
|
172
|
+
`SSL Labs scan failed for "${cleanHost}": ${raw.statusMessage ?? 'unknown error'}\n` +
|
|
173
|
+
`View at: ${scanUrl}`,
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return parseResponse(cleanHost, raw)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Format an SslScanResult as a human-readable string. */
|
|
181
|
+
export function formatScan(result: SslScanResult): string {
|
|
182
|
+
if (result.status !== 'READY') {
|
|
183
|
+
return `SSL Labs scan for ${result.host}: status = ${result.status}\n${result.scanUrl}`
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const lines = [
|
|
187
|
+
`Host: ${result.host}`,
|
|
188
|
+
`Grade: ${result.grade}`,
|
|
189
|
+
'',
|
|
190
|
+
'Endpoints:',
|
|
191
|
+
...result.endpoints.map(ep => {
|
|
192
|
+
const protos = ep.protocols.map(p => `${p.name} ${p.version}`).join(', ')
|
|
193
|
+
const fs = ep.forwardSecrecy ? ' FS' : ''
|
|
194
|
+
return ` ${ep.ip} ${ep.grade}${fs} [${protos || 'no protocol data'}]`
|
|
195
|
+
}),
|
|
196
|
+
]
|
|
197
|
+
|
|
198
|
+
if (result.vulnerabilities.length > 0) {
|
|
199
|
+
lines.push('', '⚠️ Vulnerabilities:')
|
|
200
|
+
result.vulnerabilities.forEach(v => lines.push(` • ${v}`))
|
|
201
|
+
} else {
|
|
202
|
+
lines.push('', '✅ No known vulnerabilities detected')
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
lines.push('', `Full report: ${result.scanUrl}`)
|
|
206
|
+
|
|
207
|
+
return lines.join('\n')
|
|
208
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ssllabs",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Comprehensive TLS/SSL analysis via Qualys SSL Labs — grades cipher suites, certificate chains, protocol versions, and known vulnerabilities",
|
|
5
|
+
"author": "aiden",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"tools": [],
|
|
8
|
+
"trigger_phrases": [],
|
|
9
|
+
"compatible_agents": [
|
|
10
|
+
"aiden"
|
|
11
|
+
],
|
|
12
|
+
"min_agent_version": "3.0.0",
|
|
13
|
+
"tags": [
|
|
14
|
+
"security",
|
|
15
|
+
"ssl",
|
|
16
|
+
"tls",
|
|
17
|
+
"certificates",
|
|
18
|
+
"ssllabs",
|
|
19
|
+
"qualys",
|
|
20
|
+
"https",
|
|
21
|
+
"ciphers",
|
|
22
|
+
"heartbleed",
|
|
23
|
+
"poodle",
|
|
24
|
+
"compliance"
|
|
25
|
+
],
|
|
26
|
+
"created": "2026-04-27T17:11:40.749Z"
|
|
27
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stable-diffusion-image-generation
|
|
3
|
+
description: Generate images using Stable Diffusion via HuggingFace Diffusers library locally or via API
|
|
4
|
+
category: creative
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
origin: aiden
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
tags: stable-diffusion, image-generation, ai-art, diffusers, huggingface, text-to-image, sdxl, creative
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Stable Diffusion Image Generation
|
|
12
|
+
|
|
13
|
+
Generate images from text prompts using Stable Diffusion locally via HuggingFace Diffusers, or via the HuggingFace Inference API for zero-install operation.
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
- User wants to generate an image from a text description
|
|
18
|
+
- User wants to create concept art, illustrations, or visual mockups
|
|
19
|
+
- User wants to experiment with AI image generation locally
|
|
20
|
+
- User wants to generate multiple variations of an image
|
|
21
|
+
- User wants to use img2img (image-to-image) transformation
|
|
22
|
+
|
|
23
|
+
## How to Use
|
|
24
|
+
|
|
25
|
+
### 1. Quick generation via HuggingFace Inference API (no GPU needed)
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import requests, base64, os
|
|
29
|
+
|
|
30
|
+
def generate_image_api(prompt, output="output.png"):
|
|
31
|
+
api_url = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
|
|
32
|
+
headers = {"Authorization": f"Bearer {os.environ['HF_TOKEN']}"}
|
|
33
|
+
resp = requests.post(api_url, headers=headers, json={"inputs": prompt}, timeout=120)
|
|
34
|
+
resp.raise_for_status()
|
|
35
|
+
with open(output, "wb") as f:
|
|
36
|
+
f.write(resp.content)
|
|
37
|
+
print(f"Saved: {output}")
|
|
38
|
+
|
|
39
|
+
# Set HF_TOKEN in env: huggingface.co/settings/tokens
|
|
40
|
+
generate_image_api("a futuristic city at night, cyberpunk style, neon lights, 8k")
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Local generation with Diffusers (requires GPU or CPU + patience)
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
# pip install diffusers transformers accelerate torch
|
|
47
|
+
from diffusers import StableDiffusionXLPipeline
|
|
48
|
+
import torch
|
|
49
|
+
|
|
50
|
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
|
51
|
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
|
52
|
+
torch_dtype=torch.float16,
|
|
53
|
+
use_safetensors=True
|
|
54
|
+
)
|
|
55
|
+
pipe = pipe.to("cuda") # use "cpu" if no GPU (very slow)
|
|
56
|
+
|
|
57
|
+
image = pipe(
|
|
58
|
+
prompt="a majestic mountain landscape at golden hour, photorealistic",
|
|
59
|
+
negative_prompt="blurry, low quality, cartoon",
|
|
60
|
+
num_inference_steps=30,
|
|
61
|
+
guidance_scale=7.5,
|
|
62
|
+
width=1024, height=1024
|
|
63
|
+
).images[0]
|
|
64
|
+
|
|
65
|
+
image.save("landscape.png")
|
|
66
|
+
print("Saved: landscape.png")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 3. Generate multiple variations
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
images = pipe(
|
|
73
|
+
prompt="a robot reading a book in a cozy library",
|
|
74
|
+
num_images_per_prompt=4,
|
|
75
|
+
num_inference_steps=25,
|
|
76
|
+
).images
|
|
77
|
+
|
|
78
|
+
for i, img in enumerate(images):
|
|
79
|
+
img.save(f"variation_{i+1}.png")
|
|
80
|
+
print(f"Saved variation_{i+1}.png")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 4. Write effective prompts
|
|
84
|
+
|
|
85
|
+
Good prompt structure:
|
|
86
|
+
```
|
|
87
|
+
[subject], [style], [setting/background], [lighting], [quality tags]
|
|
88
|
+
|
|
89
|
+
Examples:
|
|
90
|
+
"a golden retriever puppy, oil painting style, in a sunlit meadow, warm afternoon light, highly detailed"
|
|
91
|
+
"abstract data visualization, dark background, glowing cyan lines, geometric patterns, 4k"
|
|
92
|
+
"portrait of a scientist, dramatic studio lighting, photorealistic, sharp focus, professional headshot"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Useful negative prompt additions:
|
|
96
|
+
```
|
|
97
|
+
"blurry, low quality, watermark, signature, deformed, extra limbs, bad anatomy, poorly drawn"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 5. CPU-only generation (slower but works without GPU)
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from diffusers import StableDiffusionPipeline
|
|
104
|
+
import torch
|
|
105
|
+
|
|
106
|
+
pipe = StableDiffusionPipeline.from_pretrained(
|
|
107
|
+
"runwayml/stable-diffusion-v1-5",
|
|
108
|
+
torch_dtype=torch.float32
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
image = pipe(
|
|
112
|
+
prompt="a simple landscape, watercolor style",
|
|
113
|
+
num_inference_steps=15, # fewer steps = faster on CPU
|
|
114
|
+
width=512, height=512 # smaller size for CPU
|
|
115
|
+
).images[0]
|
|
116
|
+
image.save("output.png")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Examples
|
|
120
|
+
|
|
121
|
+
**"Generate an image of a futuristic AI lab"**
|
|
122
|
+
→ Use step 1 (API) if `HF_TOKEN` is set. Prompt: `"futuristic AI research lab, holographic displays, clean aesthetic, cinematic lighting"`.
|
|
123
|
+
|
|
124
|
+
**"Create 4 variations of a logo concept for a tech startup"**
|
|
125
|
+
→ Use step 3 with a logo-style prompt and `num_images_per_prompt=4`.
|
|
126
|
+
|
|
127
|
+
**"Generate an image locally without internet"**
|
|
128
|
+
→ Use step 2 (local Diffusers). SDXL needs ~8GB VRAM; for CPU use step 5 with SD v1.5 at 512×512.
|
|
129
|
+
|
|
130
|
+
## Cautions
|
|
131
|
+
|
|
132
|
+
- SDXL requires at least 8GB VRAM for float16; use SD v1.5 (step 5) on CPU or low-VRAM GPUs
|
|
133
|
+
- First run downloads model weights (~6-7GB) — this takes time; subsequent runs use cache
|
|
134
|
+
- HuggingFace Inference API free tier has rate limits — set a delay between requests for batch generation
|
|
135
|
+
- Generated images may reflect biases in training data — review outputs before publishing
|
|
136
|
+
- `HF_TOKEN` must be set as an environment variable — never hardcode it in scripts
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "stable-diffusion-image-generation",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Generate images using Stable Diffusion via HuggingFace Diffusers library locally or via API",
|
|
5
|
+
"author": "aiden",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"tools": [],
|
|
8
|
+
"trigger_phrases": [],
|
|
9
|
+
"compatible_agents": [
|
|
10
|
+
"aiden"
|
|
11
|
+
],
|
|
12
|
+
"min_agent_version": "3.0.0",
|
|
13
|
+
"tags": [
|
|
14
|
+
"stable-diffusion",
|
|
15
|
+
"image-generation",
|
|
16
|
+
"ai-art",
|
|
17
|
+
"diffusers",
|
|
18
|
+
"huggingface",
|
|
19
|
+
"text-to-image",
|
|
20
|
+
"sdxl",
|
|
21
|
+
"creative"
|
|
22
|
+
],
|
|
23
|
+
"created": "2026-04-27T17:11:40.763Z"
|
|
24
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: systematic-debugging
|
|
3
|
+
description: Four-phase root cause investigation process for diagnosing bugs, errors, and unexpected behavior
|
|
4
|
+
category: developer
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
origin: aiden
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
tags: debugging, root-cause, investigation, bug, error, diagnosis, troubleshooting, logs, testing
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Systematic Debugging
|
|
12
|
+
|
|
13
|
+
A structured four-phase process for diagnosing software bugs: **Reproduce → Isolate → Hypothesize → Verify**. Prevents guessing and ensures you find the root cause, not just a workaround.
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
- User reports a bug or unexpected behavior without an obvious cause
|
|
18
|
+
- An error message appears but the source is unclear
|
|
19
|
+
- A fix was applied but the problem persists
|
|
20
|
+
- Tests are failing intermittently (flaky tests)
|
|
21
|
+
- Production behavior differs from local behavior
|
|
22
|
+
|
|
23
|
+
## How to Use
|
|
24
|
+
|
|
25
|
+
### Phase 1: Reproduce reliably
|
|
26
|
+
|
|
27
|
+
A bug you can reproduce consistently is halfway solved.
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
1. Get the exact error message, stack trace, and environment
|
|
31
|
+
2. Identify exact steps to trigger the bug
|
|
32
|
+
3. Confirm the bug happens in a clean environment (not just local state)
|
|
33
|
+
4. Record: OS, runtime version, dependencies, config values
|
|
34
|
+
5. Try: does it fail on every run, or only sometimes?
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If intermittent: add timing, logging, or retry logic to isolate the trigger.
|
|
38
|
+
|
|
39
|
+
### Phase 2: Isolate the failure
|
|
40
|
+
|
|
41
|
+
Narrow the failure to the smallest possible unit.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1. Add logging before/after suspected areas to find where state diverges
|
|
45
|
+
2. Binary search through code: comment out half, does it still fail?
|
|
46
|
+
3. Check: when did this last work? (git log, git bisect)
|
|
47
|
+
4. Check: what changed recently? (git diff main, dependency updates)
|
|
48
|
+
5. Reproduce in a minimal test case — strip away all unrelated code
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
# git bisect to find the breaking commit
|
|
53
|
+
git bisect start
|
|
54
|
+
git bisect bad # current commit is broken
|
|
55
|
+
git bisect good v2.0.0 # last known good tag
|
|
56
|
+
# git will checkout commits — test each, then:
|
|
57
|
+
git bisect good # or
|
|
58
|
+
git bisect bad
|
|
59
|
+
# Repeat until git identifies the culprit commit
|
|
60
|
+
git bisect reset
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Phase 3: Generate hypotheses
|
|
64
|
+
|
|
65
|
+
Form 2-3 specific, testable hypotheses about the root cause.
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Bad hypothesis: "Something is wrong with the database"
|
|
69
|
+
Good hypothesis: "The connection pool is exhausted under concurrent load
|
|
70
|
+
because maxConnections defaults to 5 in test config"
|
|
71
|
+
|
|
72
|
+
For each hypothesis:
|
|
73
|
+
- What evidence supports it?
|
|
74
|
+
- What evidence would refute it?
|
|
75
|
+
- What one-line change would test it?
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Rank by probability and test from most to least likely.
|
|
79
|
+
|
|
80
|
+
### Phase 4: Verify and fix
|
|
81
|
+
|
|
82
|
+
Prove the fix, not just that the error goes away.
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
1. Apply the smallest change that addresses the root cause
|
|
86
|
+
2. Run the original reproduction steps — confirm bug is gone
|
|
87
|
+
3. Run the full test suite — confirm no regressions
|
|
88
|
+
4. Check edge cases: empty input, null values, concurrent access
|
|
89
|
+
5. Write a regression test that would have caught this bug
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
# Regression test template
|
|
94
|
+
def test_issue_42_connection_pool_exhaustion():
|
|
95
|
+
"""
|
|
96
|
+
Regression test: ensure concurrent requests don't exhaust the connection pool.
|
|
97
|
+
Root cause: maxConnections was not configurable; defaulted to 5 in test.
|
|
98
|
+
Fixed in commit abc123.
|
|
99
|
+
"""
|
|
100
|
+
results = run_concurrent_requests(count=20)
|
|
101
|
+
assert all(r.status_code == 200 for r in results), "Some requests failed under concurrency"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Debugging cheat sheet
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
Error: KeyError / undefined → check input shapes; add null guard
|
|
108
|
+
Error: Off-by-one → examine loop bounds and index math
|
|
109
|
+
Error: Works locally, fails in CI → check env vars, file paths, timing
|
|
110
|
+
Error: Works first run, fails after → check state mutation, cache, side effects
|
|
111
|
+
Error: Inconsistent / race condition → check shared mutable state, locks
|
|
112
|
+
Error: Memory leak → profile allocations; check event listener cleanup
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Examples
|
|
116
|
+
|
|
117
|
+
**"My API returns 500 randomly but I can't reproduce it"**
|
|
118
|
+
→ Start at Phase 1 — add structured logging with request IDs. Once patterns emerge, apply Phase 2 binary search.
|
|
119
|
+
|
|
120
|
+
**"Tests pass locally but fail in GitHub Actions"**
|
|
121
|
+
→ Phase 2: diff the environments (OS, Node version, env vars). Often caused by missing env vars or OS path differences.
|
|
122
|
+
|
|
123
|
+
**"I fixed the bug but it came back after a week"**
|
|
124
|
+
→ Phase 4: add a regression test and check if the root cause fix addressed the underlying issue or just a symptom.
|
|
125
|
+
|
|
126
|
+
## Cautions
|
|
127
|
+
|
|
128
|
+
- Never apply multiple changes at once when debugging — you won't know which one fixed it
|
|
129
|
+
- "Works on my machine" is a Phase 1 failure — always reproduce in the target environment
|
|
130
|
+
- Logs and print statements are powerful — do not underestimate them in favor of complex tooling
|
|
131
|
+
- Document the root cause in the fix commit message so future developers understand why the change was made
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "systematic-debugging",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Four-phase root cause investigation process for diagnosing bugs, errors, and unexpected behavior",
|
|
5
|
+
"author": "aiden",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"tools": [],
|
|
8
|
+
"trigger_phrases": [],
|
|
9
|
+
"compatible_agents": [
|
|
10
|
+
"aiden"
|
|
11
|
+
],
|
|
12
|
+
"min_agent_version": "3.0.0",
|
|
13
|
+
"tags": [
|
|
14
|
+
"debugging",
|
|
15
|
+
"root-cause",
|
|
16
|
+
"investigation",
|
|
17
|
+
"bug",
|
|
18
|
+
"error",
|
|
19
|
+
"diagnosis",
|
|
20
|
+
"troubleshooting",
|
|
21
|
+
"logs",
|
|
22
|
+
"testing"
|
|
23
|
+
],
|
|
24
|
+
"created": "2026-04-27T17:11:40.778Z"
|
|
25
|
+
}
|