Skip to content

tim-hub/powerball-harness / .claude/skills/generate-video

generate-video

Verified

Generates product demo videos and release walkthroughs via Remotion. Use when creating video documentation or animated demos.

FileKindSize
SKILL.mdskill md6.6 KB
assets/backgrounds/backgrounds.jsonconfig4.9 KB
assets/sounds/sounds.jsonconfig5.7 KB
package.jsonmanifest710 B
references/MIGRATION-11.2.mdmarkdown7.9 KB
references/analyzer.mdmarkdown4.5 KB
references/asset-customization.mdmarkdown11.2 KB
references/best-practices.mdmarkdown8.6 KB
references/direction-guide.mdmarkdown14.6 KB
references/generator.mdmarkdown25.9 KB
references/image-generator.mdmarkdown9.0 KB
references/image-patterns.mdmarkdown14.5 KB
references/image-quality-check.mdmarkdown6.9 KB
references/naming-conventions.mdmarkdown6.0 KB
references/planner.mdmarkdown7.6 KB
references/visual-effects.mdmarkdown11.0 KB
remotion/components/BackgroundLayer.tsxother7.5 KB
remotion/components/EmphasisBox.tsxother5.9 KB
remotion/components/ProgressIndicator.tsxother6.8 KB
remotion/components/README.mdmarkdown8.5 KB
remotion/components/TransitionWrapper.tsxother5.7 KB
remotion/components/index.tsscript1004 B
remotion/tsconfig.jsonconfig617 B
schemas/README.mdmarkdown8.1 KB
schemas/animation.schema.jsonconfig5.2 KB
schemas/assets.manifest.schema.jsonconfig5.9 KB
schemas/character.schema.jsonconfig16.0 KB
schemas/direction.schema.jsonconfig4.5 KB
schemas/emphasis.schema.jsonconfig8.6 KB
schemas/examples/scenario-example.jsonconfig1.6 KB
schemas/examples/scene-example.jsonconfig1.6 KB
schemas/examples/video-script-example.jsonconfig5.1 KB
schemas/examples/visual-patterns/comparison-example.jsonconfig1.0 KB
schemas/examples/visual-patterns/concept-example.jsonconfig2.1 KB
schemas/examples/visual-patterns/flow-example.jsonconfig1.8 KB
schemas/examples/visual-patterns/highlight-example.jsonconfig745 B
schemas/scenario.schema.jsonconfig3.6 KB
schemas/scene.schema.jsonconfig8.2 KB
schemas/validate-schemas-basic.jsscript2.7 KB
schemas/validate-schemas.jsscript6.6 KB
schemas/video-script.schema.jsonconfig7.6 KB
schemas/visual-patterns.schema.jsonconfig14.2 KB
scripts/README.mdmarkdown7.4 KB
scripts/generate-schemas.jsexecutablescript6.2 KB
scripts/load-assets.jsexecutablescript14.1 KB
scripts/merge-scenes.jsexecutablescript15.0 KB
scripts/render-video.jsexecutablescript14.0 KB
scripts/template-registry.jsexecutablescript10.0 KB
scripts/validate-scenario.jsexecutablescript8.0 KB
scripts/validate-scene.jsexecutablescript4.3 KB
scripts/validate-video.jsexecutablescript13.0 KB
src/schemas/animation.tsscript3.7 KB
src/schemas/assets.manifest.tsscript2.8 KB
src/schemas/character.tsscript6.5 KB
src/schemas/direction.tsscript3.2 KB
src/schemas/emphasis.tsscript5.2 KB
src/schemas/index.tsscript423 B
src/schemas/scenario.tsscript2.7 KB
src/schemas/scene.tsscript5.5 KB
src/schemas/video-script.tsscript9.4 KB
src/schemas/visual-patterns.tsscript8.2 KB
src/types/README.mdmarkdown4.1 KB
src/types/components.tsscript6.0 KB
src/types/index.tsscript108 B
src/utils/README.mdmarkdown6.1 KB
src/utils/converters.jsscript5.9 KB
src/utils/converters.tsscript5.7 KB
src/utils/index.tsscript109 B
templates/image-prompts/comparison.txtmarkdown1.3 KB
templates/image-prompts/concept.txtmarkdown2.3 KB
templates/image-prompts/flow.txtmarkdown2.8 KB
templates/image-prompts/highlight.txtmarkdown3.2 KB
templates/intro-3min.jsonconfig8.9 KB
templates/teaser-90s.jsonconfig7.0 KB
tests/asset-loader.test.jsscript12.1 KB
tests/character-schema.test.jsscript7.9 KB
tests/converters.test.jsscript8.3 KB
tests/determinism.test.jsscript11.4 KB
tests/e2e/merge-e2e.test.jsscript13.3 KB
tests/e2e/render.test.jsscript6.1 KB
tests/fixtures/minimal-video-script.jsonconfig1.2 KB
tests/merge-scenes.test.jsscript17.2 KB
tests/schema-validation.test.jsscript3.7 KB
tests/validation-integration.test.jsscript12.9 KB
tests/visual-patterns.test.jsscript12.1 KB

tests/e2e/merge-e2e.test.js

View on GitHub
/**
 * @file merge-e2e.test.js
 * @description Task 11.6.3: E2E tests for merge-scenes.js
 *
 * Validates:
 * - End-to-end determinism (same input → same output)
 * - Real file system operations
 * - Multiple execution rounds produce identical results
 *
 * Note: Uses execSync with controlled inputs in test environment (safe)
 */

const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const { execSync } = require('child_process'); // Safe in tests with controlled inputs

const MERGE_SCRIPT = path.join(__dirname, '../../scripts/merge-scenes.js');

/**
 * Helper: Generate SHA-256 hash of file content
 */
function hashFile(filePath) {
  const content = fs.readFileSync(filePath, 'utf-8');
  return crypto.createHash('sha256').update(content).digest('hex');
}

/**
 * Helper: Generate SHA-256 hash of JSON object
 */
function hashJson(obj) {
  return crypto.createHash('sha256').update(JSON.stringify(obj)).digest('hex');
}

describe('E2E: merge-scenes.js determinism', () => {
  let tempDir;

  beforeEach(() => {
    tempDir = fs.mkdtempSync(path.join('/tmp', 'merge-e2e-'));
  });

  afterEach(() => {
    if (tempDir && fs.existsSync(tempDir)) {
      fs.rmSync(tempDir, { recursive: true });
    }
  });

  /**
   * Helper: Create test scenario and scenes
   */
  function setupTestData() {
    // Create scenario.json
    const scenario = {
      id: 'e2e-test-scenario',
      title: 'E2E Test Video',
      description: 'End-to-end determinism test',
      metadata: {
        version: '1.0.0',
        generated_at: '2026-02-02T00:00:00Z',
        video_type: 'custom'
      },
      sections: [
        {
          id: 'opening',
          title: 'Opening',
          description: 'Opening section',
          order: 0
        },
        {
          id: 'main',
          title: 'Main',
          description: 'Main content',
          order: 1
        },
        {
          id: 'closing',
          title: 'Closing',
          description: 'Closing section',
          order: 2
        }
      ]
    };

    fs.writeFileSync(
      path.join(tempDir, 'scenario.json'),
      JSON.stringify(scenario, null, 2)
    );

    // Create scenes directory
    const scenesDir = path.join(tempDir, 'scenes');
    fs.mkdirSync(scenesDir);

    // Create scene files
    const scenes = [
      { scene_id: 'intro-1', section_id: 'opening', order: 0 },
      { scene_id: 'intro-2', section_id: 'opening', order: 1 },
      { scene_id: 'hook', section_id: 'opening', order: 2 },
      { scene_id: 'demo-1', section_id: 'main', order: 0 },
      { scene_id: 'demo-2', section_id: 'main', order: 1 },
      { scene_id: 'demo-3', section_id: 'main', order: 1 }, // Duplicate order (tiebreaker test)
      { scene_id: 'cta', section_id: 'closing', order: 0 },
      { scene_id: 'outro', section_id: 'closing', order: 1 }
    ];

    scenes.forEach(sceneData => {
      const scene = {
        scene_id: sceneData.scene_id,
        section_id: sceneData.section_id,
        order: sceneData.order,
        type: 'custom',
        content: {
          title: `Scene ${sceneData.scene_id}`,
          duration_ms: 3000
        },
        direction: {
          transition: {
            in: 'fade',
            out: 'fade',
            duration_ms: 500
          }
        }
      };

      fs.writeFileSync(
        path.join(scenesDir, `${sceneData.scene_id}.json`),
        JSON.stringify(scene, null, 2)
      );
    });
  }

  /**
   * Helper: Run merge-scenes.js
   */
  function runMerge() {
    try {
      execSync(`node ${MERGE_SCRIPT} ${tempDir}`, {
        encoding: 'utf-8',
        stdio: 'pipe'
      });
      return true;
    } catch (error) {
      console.error('Merge failed:', error.message);
      return false;
    }
  }

  /**
   * Helper: Load video-script.json
   */
  function loadVideoScript() {
    const scriptPath = path.join(tempDir, 'video-script.json');
    if (!fs.existsSync(scriptPath)) {
      return null;
    }
    return JSON.parse(fs.readFileSync(scriptPath, 'utf-8'));
  }

  describe('Same input → Same output (deterministic scenes)', () => {
    it('should produce identical scene order across multiple runs', () => {
      setupTestData();

      // Run 1
      expect(runMerge()).toBe(true);
      const script1 = loadVideoScript();

      // Delete output
      fs.unlinkSync(path.join(tempDir, 'video-script.json'));

      // Run 2
      expect(runMerge()).toBe(true);
      const script2 = loadVideoScript();

      // Delete output
      fs.unlinkSync(path.join(tempDir, 'video-script.json'));

      // Run 3
      expect(runMerge()).toBe(true);
      const script3 = loadVideoScript();

      // Scene order and content should be identical (excluding created_at)
      const scenes1 = script1.scenes.map(s => s.scene_id);
      const scenes2 = script2.scenes.map(s => s.scene_id);
      const scenes3 = script3.scenes.map(s => s.scene_id);

      expect(scenes1).toEqual(scenes2);
      expect(scenes2).toEqual(scenes3);

      // Scene content should be identical
      expect(script1.scenes).toEqual(script2.scenes);
      expect(script2.scenes).toEqual(script3.scenes);

      // Total duration should be consistent
      expect(script1.total_duration_ms).toBe(script2.total_duration_ms);
      expect(script2.total_duration_ms).toBe(script3.total_duration_ms);
    });

    it('should produce consistent structure (metadata may have timestamps)', () => {
      setupTestData();

      // Run 1
      expect(runMerge()).toBe(true);
      const script1 = loadVideoScript();

      // Delete output
      fs.unlinkSync(path.join(tempDir, 'video-script.json'));

      // Run 2
      expect(runMerge()).toBe(true);
      const script2 = loadVideoScript();

      // Structure should be consistent
      expect(script1).toHaveProperty('metadata');
      expect(script1).toHaveProperty('scenes');
      expect(script1).toHaveProperty('total_duration_ms');
      expect(script1).toHaveProperty('output_settings');

      expect(script2).toHaveProperty('metadata');
      expect(script2).toHaveProperty('scenes');
      expect(script2).toHaveProperty('total_duration_ms');
      expect(script2).toHaveProperty('output_settings');

      // Metadata fields (except created_at) should match
      expect(script1.metadata.title).toBe(script2.metadata.title);
      expect(script1.metadata.version).toBe(script2.metadata.version);
      expect(script1.metadata.scenario_id).toBe(script2.metadata.scenario_id);

      // Output settings should be identical
      expect(script1.output_settings).toEqual(script2.output_settings);
    });
  });

  describe('Scene order determinism', () => {
    it('should consistently order scenes with tiebreaker', () => {
      setupTestData();

      // Run merge multiple times
      const runs = [];
      for (let i = 0; i < 5; i++) {
        expect(runMerge()).toBe(true);
        const script = loadVideoScript();
        runs.push(script.scenes.map(s => s.scene_id));

        // Delete output for next run
        fs.unlinkSync(path.join(tempDir, 'video-script.json'));
      }

      // All runs should produce the same scene order
      for (let i = 1; i < runs.length; i++) {
        expect(runs[i]).toEqual(runs[0]);
      }

      // Verify correct order (with tiebreaker applied)
      const expectedOrder = [
        'intro-1',  // opening, order 0
        'intro-2',  // opening, order 1
        'hook',     // opening, order 2
        'demo-1',   // main, order 0
        'demo-2',   // main, order 1 (demo-2 < demo-3 by tiebreaker)
        'demo-3',   // main, order 1
        'cta',      // closing, order 0
        'outro'     // closing, order 1
      ];

      expect(runs[0]).toEqual(expectedOrder);
    });
  });

  describe('Metadata consistency', () => {
    it('should generate consistent metadata (excluding timestamps)', () => {
      setupTestData();

      // Run 1
      expect(runMerge()).toBe(true);
      const script1 = loadVideoScript();

      // Delete output
      fs.unlinkSync(path.join(tempDir, 'video-script.json'));

      // Run 2
      expect(runMerge()).toBe(true);
      const script2 = loadVideoScript();

      // Metadata should be consistent (except created_at)
      expect(script1.metadata.title).toBe(script2.metadata.title);
      expect(script1.metadata.version).toBe(script2.metadata.version);
      expect(script1.metadata.scenario_id).toBe(script2.metadata.scenario_id);

      // Output settings should be identical
      expect(script1.output_settings).toEqual(script2.output_settings);

      // Total duration should be identical
      expect(script1.total_duration_ms).toBe(script2.total_duration_ms);
    });
  });

  describe('Real-world scenario simulation', () => {
    it('should handle complex scenario with 20+ scenes', () => {
      // Create larger scenario
      const scenario = {
        id: 'large-test',
        title: 'Large Test Video',
        description: 'Testing with many scenes',
        metadata: {
          version: '1.0.0',
          generated_at: '2026-02-02T00:00:00Z',
          video_type: 'custom'
        },
        sections: [
          { id: 'section-1', title: 'Section 1', description: 'Section 1', order: 0 },
          { id: 'section-2', title: 'Section 2', description: 'Section 2', order: 1 },
          { id: 'section-3', title: 'Section 3', description: 'Section 3', order: 2 },
          { id: 'section-4', title: 'Section 4', description: 'Section 4', order: 3 }
        ]
      };

      fs.writeFileSync(
        path.join(tempDir, 'scenario.json'),
        JSON.stringify(scenario, null, 2)
      );

      const scenesDir = path.join(tempDir, 'scenes');
      fs.mkdirSync(scenesDir);

      // Create 24 scenes (6 per section)
      for (let section = 1; section <= 4; section++) {
        for (let scene = 1; scene <= 6; scene++) {
          const sceneData = {
            scene_id: `s${section}-scene-${scene}`,
            section_id: `section-${section}`,
            order: scene,
            type: 'custom',
            content: {
              duration_ms: 2000
            }
          };

          fs.writeFileSync(
            path.join(scenesDir, `${sceneData.scene_id}.json`),
            JSON.stringify(sceneData, null, 2)
          );
        }
      }

      // Run merge twice
      expect(runMerge()).toBe(true);
      const script1 = loadVideoScript();

      fs.unlinkSync(path.join(tempDir, 'video-script.json'));

      expect(runMerge()).toBe(true);
      const script2 = loadVideoScript();

      // Should produce identical results
      expect(script1.scenes.length).toBe(24);
      expect(script2.scenes.length).toBe(24);

      const order1 = script1.scenes.map(s => s.scene_id);
      const order2 = script2.scenes.map(s => s.scene_id);

      expect(order1).toEqual(order2);
    });
  });

  describe('Error recovery determinism', () => {
    it('should produce consistent warnings for duplicate orders', () => {
      setupTestData();

      // Run merge multiple times and capture output
      const outputs = [];
      for (let i = 0; i < 3; i++) {
        try {
          const output = execSync(`node ${MERGE_SCRIPT} ${tempDir}`, {
            encoding: 'utf-8',
            stdio: 'pipe'
          });
          outputs.push(output);
        } catch (error) {
          outputs.push(error.stdout || '');
        }

        // Delete output for next run
        if (fs.existsSync(path.join(tempDir, 'video-script.json'))) {
          fs.unlinkSync(path.join(tempDir, 'video-script.json'));
        }
      }

      // All outputs should mention duplicate orders
      outputs.forEach(output => {
        expect(output).toMatch(/WARNING: Duplicate orders detected/);
        expect(output).toMatch(/demo-2/);
        expect(output).toMatch(/demo-3/);
      });
    });
  });

  describe('File system operations determinism', () => {
    it('should produce consistent output regardless of file creation order', () => {
      // Create scenario
      const scenario = {
        id: 'order-test',
        title: 'Order Test',
        description: 'Testing file order independence',
        metadata: {
          version: '1.0.0',
          generated_at: '2026-02-02T00:00:00Z',
          video_type: 'custom'
        },
        sections: [
          { id: 'section', title: 'Section', description: 'Test section', order: 0 }
        ]
      };

      fs.writeFileSync(
        path.join(tempDir, 'scenario.json'),
        JSON.stringify(scenario, null, 2)
      );

      const scenesDir = path.join(tempDir, 'scenes');
      fs.mkdirSync(scenesDir);

      // Create scenes in reverse alphabetical order
      const sceneIds = ['scene-c', 'scene-b', 'scene-a'];
      sceneIds.forEach((sceneId, index) => {
        const scene = {
          scene_id: sceneId,
          section_id: 'section',
          order: 1, // Same order for all
          type: 'custom',
          content: { duration_ms: 1000 }
        };

        fs.writeFileSync(
          path.join(scenesDir, `${sceneId}.json`),
          JSON.stringify(scene, null, 2)
        );

        // Add small delay to ensure different mtime
        if (index < sceneIds.length - 1) {
          const start = Date.now();
          while (Date.now() - start < 10) {
            // Busy wait
          }
        }
      });

      // Run merge
      expect(runMerge()).toBe(true);
      const script = loadVideoScript();

      // Should be sorted by scene_id (lexicographic), not file creation order
      const order = script.scenes.map(s => s.scene_id);
      expect(order).toEqual(['scene-a', 'scene-b', 'scene-c']);
    });
  });
});
rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file).Stars: 198kUpdated Claude CodeCodexUnverifiedInstall
doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.Stars: 198kUpdated Claude CodeCodexVerifiedInstall