diff --git a/packages/mosaic/framework/skills/algorithmic-art/templates/generator_template.js b/packages/mosaic/framework/skills/algorithmic-art/templates/generator_template.js index e263fbde..ed5b0cfb 100644 --- a/packages/mosaic/framework/skills/algorithmic-art/templates/generator_template.js +++ b/packages/mosaic/framework/skills/algorithmic-art/templates/generator_template.js @@ -22,17 +22,17 @@ // - Serialize/save configurations let params = { - // Define parameters that match YOUR algorithm - // Examples (customize for your art): - // - Counts: how many elements (particles, circles, branches, etc.) - // - Scales: size, speed, spacing - // - Probabilities: likelihood of events - // - Angles: rotation, direction - // - Colors: palette arrays + // Define parameters that match YOUR algorithm + // Examples (customize for your art): + // - Counts: how many elements (particles, circles, branches, etc.) + // - Scales: size, speed, spacing + // - Probabilities: likelihood of events + // - Angles: rotation, direction + // - Colors: palette arrays - seed: 12345, - // define colorPalette as an array -- choose whatever colors you'd like ['#d97757', '#6a9bcc', '#788c5d', '#b0aea5'] - // Add YOUR parameters here based on your algorithm + seed: 12345, + // define colorPalette as an array -- choose whatever colors you'd like ['#d97757', '#6a9bcc', '#788c5d', '#b0aea5'] + // Add YOUR parameters here based on your algorithm }; // ============================================================================ @@ -41,9 +41,9 @@ let params = { // ALWAYS use seeded random for Art Blocks-style reproducible output function initializeSeed(seed) { - randomSeed(seed); - noiseSeed(seed); - // Now all random() and noise() calls will be deterministic + randomSeed(seed); + noiseSeed(seed); + // Now all random() and noise() calls will be deterministic } // ============================================================================ @@ -51,36 +51,34 @@ function initializeSeed(seed) { // ============================================================================ function setup() { - createCanvas(800, 800); + createCanvas(800, 800); - // Initialize seed first - initializeSeed(params.seed); + // Initialize seed first + initializeSeed(params.seed); - // Set up your generative system - // This is where you initialize: - // - Arrays of objects - // - Grid structures - // - Initial positions - // - Starting states + // Set up your generative system + // This is where you initialize: + // - Arrays of objects + // - Grid structures + // - Initial positions + // - Starting states - // For static art: call noLoop() at the end of setup - // For animated art: let draw() keep running + // For static art: call noLoop() at the end of setup + // For animated art: let draw() keep running } function draw() { - // Option 1: Static generation (runs once, then stops) - // - Generate everything in setup() - // - Call noLoop() in setup() - // - draw() doesn't do much or can be empty - - // Option 2: Animated generation (continuous) - // - Update your system each frame - // - Common patterns: particle movement, growth, evolution - // - Can optionally call noLoop() after N frames - - // Option 3: User-triggered regeneration - // - Use noLoop() by default - // - Call redraw() when parameters change + // Option 1: Static generation (runs once, then stops) + // - Generate everything in setup() + // - Call noLoop() in setup() + // - draw() doesn't do much or can be empty + // Option 2: Animated generation (continuous) + // - Update your system each frame + // - Common patterns: particle movement, growth, evolution + // - Can optionally call noLoop() after N frames + // Option 3: User-triggered regeneration + // - Use noLoop() by default + // - Call redraw() when parameters change } // ============================================================================ @@ -90,23 +88,23 @@ function draw() { // Examples: particles, agents, cells, nodes, etc. class Entity { - constructor() { - // Initialize entity properties - // Use random() here - it will be seeded - } + constructor() { + // Initialize entity properties + // Use random() here - it will be seeded + } - update() { - // Update entity state - // This might involve: - // - Physics calculations - // - Behavioral rules - // - Interactions with neighbors - } + update() { + // Update entity state + // This might involve: + // - Physics calculations + // - Behavioral rules + // - Interactions with neighbors + } - display() { - // Render the entity - // Keep rendering logic separate from update logic - } + display() { + // Render the entity + // Keep rendering logic separate from update logic + } } // ============================================================================ @@ -130,32 +128,34 @@ class Entity { // Color utilities function hexToRgb(hex) { - const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); - return result ? { + const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); + return result + ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), - b: parseInt(result[3], 16) - } : null; + b: parseInt(result[3], 16), + } + : null; } function colorFromPalette(index) { - return params.colorPalette[index % params.colorPalette.length]; + return params.colorPalette[index % params.colorPalette.length]; } // Mapping and easing function mapRange(value, inMin, inMax, outMin, outMax) { - return outMin + (outMax - outMin) * ((value - inMin) / (inMax - inMin)); + return outMin + (outMax - outMin) * ((value - inMin) / (inMax - inMin)); } function easeInOutCubic(t) { - return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2; + return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2; } // Constrain to bounds function wrapAround(value, max) { - if (value < 0) return max; - if (value > max) return 0; - return value; + if (value < 0) return max; + if (value > max) return 0; + return value; } // ============================================================================ @@ -163,16 +163,16 @@ function wrapAround(value, max) { // ============================================================================ function updateParameter(paramName, value) { - params[paramName] = value; - // Decide if you need to regenerate or just update - // Some params can update in real-time, others need full regeneration + params[paramName] = value; + // Decide if you need to regenerate or just update + // Some params can update in real-time, others need full regeneration } function regenerate() { - // Reinitialize your generative system - // Useful when parameters change significantly - initializeSeed(params.seed); - // Then regenerate your system + // Reinitialize your generative system + // Useful when parameters change significantly + initializeSeed(params.seed); + // Then regenerate your system } // ============================================================================ @@ -181,19 +181,19 @@ function regenerate() { // Drawing with transparency for trails/fading function fadeBackground(opacity) { - fill(250, 249, 245, opacity); // Anthropic light with alpha - noStroke(); - rect(0, 0, width, height); + fill(250, 249, 245, opacity); // Anthropic light with alpha + noStroke(); + rect(0, 0, width, height); } // Using noise for organic variation function getNoiseValue(x, y, scale = 0.01) { - return noise(x * scale, y * scale); + return noise(x * scale, y * scale); } // Creating vectors from angles function vectorFromAngle(angle, magnitude = 1) { - return createVector(cos(angle), sin(angle)).mult(magnitude); + return createVector(cos(angle), sin(angle)).mult(magnitude); } // ============================================================================ @@ -201,7 +201,7 @@ function vectorFromAngle(angle, magnitude = 1) { // ============================================================================ function exportImage() { - saveCanvas('generative-art-' + params.seed, 'png'); + saveCanvas('generative-art-' + params.seed, 'png'); } // ============================================================================ @@ -220,4 +220,4 @@ function exportImage() { // // The art itself is entirely up to you! // -// ============================================================================ \ No newline at end of file +// ============================================================================ diff --git a/packages/mosaic/framework/skills/nestjs-best-practices/scripts/build-agents.ts b/packages/mosaic/framework/skills/nestjs-best-practices/scripts/build-agents.ts index a0b90390..2c64b113 100644 --- a/packages/mosaic/framework/skills/nestjs-best-practices/scripts/build-agents.ts +++ b/packages/mosaic/framework/skills/nestjs-best-practices/scripts/build-agents.ts @@ -98,7 +98,7 @@ function parseFrontmatter(content: string): { frontmatter: RuleFrontmatter | nul return { frontmatter: frontmatter as RuleFrontmatter, - body: body.trim() + body: body.trim(), }; } @@ -118,8 +118,7 @@ function readMetadata(): any { function readRules(): Rule[] { const rulesDir = path.join(__dirname, '..', 'rules'); - const files = fs.readdirSync(rulesDir) - .filter(f => f.endsWith('.md') && !f.startsWith('_')); + const files = fs.readdirSync(rulesDir).filter((f) => f.endsWith('.md') && !f.startsWith('_')); const rules: Rule[] = []; @@ -144,7 +143,7 @@ function readRules(): Rule[] { frontmatter, content: body, category: category.name, - categorySection: category.section + categorySection: category.section, }); } diff --git a/packages/mosaic/framework/skills/systematic-debugging/condition-based-waiting-example.ts b/packages/mosaic/framework/skills/systematic-debugging/condition-based-waiting-example.ts index 703a06b6..6dab69c4 100644 --- a/packages/mosaic/framework/skills/systematic-debugging/condition-based-waiting-example.ts +++ b/packages/mosaic/framework/skills/systematic-debugging/condition-based-waiting-example.ts @@ -21,7 +21,7 @@ export function waitForEvent( threadManager: ThreadManager, threadId: string, eventType: LaceEventType, - timeoutMs = 5000 + timeoutMs = 5000, ): Promise { return new Promise((resolve, reject) => { const startTime = Date.now(); @@ -62,7 +62,7 @@ export function waitForEventCount( threadId: string, eventType: LaceEventType, count: number, - timeoutMs = 5000 + timeoutMs = 5000, ): Promise { return new Promise((resolve, reject) => { const startTime = Date.now(); @@ -76,8 +76,8 @@ export function waitForEventCount( } else if (Date.now() - startTime > timeoutMs) { reject( new Error( - `Timeout waiting for ${count} ${eventType} events after ${timeoutMs}ms (got ${matchingEvents.length})` - ) + `Timeout waiting for ${count} ${eventType} events after ${timeoutMs}ms (got ${matchingEvents.length})`, + ), ); } else { setTimeout(check, 10); @@ -113,7 +113,7 @@ export function waitForEventMatch( threadId: string, predicate: (event: LaceEvent) => boolean, description: string, - timeoutMs = 5000 + timeoutMs = 5000, ): Promise { return new Promise((resolve, reject) => { const startTime = Date.now(); diff --git a/packages/mosaic/framework/skills/writing-skills/render-graphs.js b/packages/mosaic/framework/skills/writing-skills/render-graphs.js index 1d670fbb..f6e3fbd9 100755 --- a/packages/mosaic/framework/skills/writing-skills/render-graphs.js +++ b/packages/mosaic/framework/skills/writing-skills/render-graphs.js @@ -54,7 +54,10 @@ function combineGraphs(blocks, skillName) { // Wrap each subgraph in a cluster for visual grouping return ` subgraph cluster_${i} { label="${block.name}"; - ${body.split('\n').map(line => ' ' + line).join('\n')} + ${body + .split('\n') + .map((line) => ' ' + line) + .join('\n')} }`; }); @@ -72,7 +75,7 @@ function renderToSvg(dotContent) { return execSync('dot -Tsvg', { input: dotContent, encoding: 'utf-8', - maxBuffer: 10 * 1024 * 1024 + maxBuffer: 10 * 1024 * 1024, }); } catch (err) { console.error('Error running dot:', err.message); @@ -84,7 +87,7 @@ function renderToSvg(dotContent) { function main() { const args = process.argv.slice(2); const combine = args.includes('--combine'); - const skillDirArg = args.find(a => !a.startsWith('--')); + const skillDirArg = args.find((a) => !a.startsWith('--')); if (!skillDirArg) { console.error('Usage: render-graphs.js [--combine]');