@leejungkiin/awkit 1.7.5 → 1.7.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.
Files changed (60) hide show
  1. package/bin/awk.js +138 -23
  2. package/bin/codex-generators.js +34 -4
  3. package/core/GEMINI.md +12 -7
  4. package/core/GEMINI.md.bak +2 -2
  5. package/core/skill-runtime-manifest.json +1 -0
  6. package/docs/history/implementation_plan.v1.md +49 -45
  7. package/docs/history/implementation_plan.v2.md +87 -0
  8. package/package.json +1 -1
  9. package/scripts/codex-goal.js +163 -0
  10. package/scripts/exec-progress.js +116 -0
  11. package/scripts/exec-rtk.js +4 -3
  12. package/skills/codex-goal/SKILL.md +82 -0
  13. package/skills/generate-gui-assets/SKILL.md +5 -5
  14. package/skills/hatch-pet/SKILL.md +2 -2
  15. package/skills/threejs-animation/SKILL.md +86 -0
  16. package/skills/threejs-animation/examples/workflow-mixer-action.md +20 -0
  17. package/skills/threejs-animation/references/official-sections.md +19 -0
  18. package/skills/threejs-audio/SKILL.md +112 -0
  19. package/skills/threejs-audio/examples/workflow-positional-audio.md +15 -0
  20. package/skills/threejs-audio/references/official-sections.md +16 -0
  21. package/skills/threejs-camera/SKILL.md +96 -0
  22. package/skills/threejs-camera/examples/workflow-perspective-resize.md +13 -0
  23. package/skills/threejs-controls/SKILL.md +101 -0
  24. package/skills/threejs-controls/examples/workflow-orbit-damping.md +15 -0
  25. package/skills/threejs-dev-setup/SKILL.md +102 -0
  26. package/skills/threejs-dev-setup/examples/workflow-scaffold.md +24 -0
  27. package/skills/threejs-geometries/SKILL.md +108 -0
  28. package/skills/threejs-geometries/examples/workflow-extrude-shape.md +13 -0
  29. package/skills/threejs-helpers/SKILL.md +103 -0
  30. package/skills/threejs-helpers/examples/workflow-light-camera-helpers.md +13 -0
  31. package/skills/threejs-lights/SKILL.md +103 -0
  32. package/skills/threejs-lights/examples/workflow-directional-shadow.md +17 -0
  33. package/skills/threejs-loaders/SKILL.md +89 -0
  34. package/skills/threejs-loaders/examples/workflow-gltf-draco.md +22 -0
  35. package/skills/threejs-loaders/references/official-sections.md +27 -0
  36. package/skills/threejs-materials/SKILL.md +102 -0
  37. package/skills/threejs-materials/examples/workflow-pbr-transparent.md +15 -0
  38. package/skills/threejs-math/SKILL.md +102 -0
  39. package/skills/threejs-math/examples/workflow-ray-aabb.md +11 -0
  40. package/skills/threejs-node-tsl/SKILL.md +83 -0
  41. package/skills/threejs-node-tsl/examples/workflow-tsl-entry.md +13 -0
  42. package/skills/threejs-node-tsl/references/official-links.md +8 -0
  43. package/skills/threejs-node-tsl/references/tsl-vs-classic.md +23 -0
  44. package/skills/threejs-objects/SKILL.md +111 -0
  45. package/skills/threejs-objects/examples/workflow-raycaster-pick.md +17 -0
  46. package/skills/threejs-postprocessing/SKILL.md +116 -0
  47. package/skills/threejs-postprocessing/examples/workflow-composer-bloom.md +15 -0
  48. package/skills/threejs-renderers/SKILL.md +91 -0
  49. package/skills/threejs-renderers/examples/workflow-renderer-resize.md +21 -0
  50. package/skills/threejs-renderers/references/official-sections.md +14 -0
  51. package/skills/threejs-scenes/SKILL.md +90 -0
  52. package/skills/threejs-scenes/examples/workflow-fog-background.md +13 -0
  53. package/skills/threejs-textures/SKILL.md +83 -0
  54. package/skills/threejs-textures/examples/workflow-pmrem-env.md +19 -0
  55. package/skills/threejs-webxr/SKILL.md +104 -0
  56. package/skills/threejs-webxr/examples/workflow-xr-button.md +15 -0
  57. package/workflows/_uncategorized/goal.md +86 -0
  58. package/workflows/lifecycle/goal.md +86 -0
  59. package/workflows/ui/generate-gui-assets.md +111 -0
  60. package/workflows/ui/hatch-pet.md +116 -0
@@ -0,0 +1,163 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Codex Goal Conductor - Goal Orchestration Runner for AWKit
5
+ * Pursues high-level development goals autonomously by executing Codex CLI.
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const { execSync, spawnSync } = require('child_process');
11
+ const os = require('os');
12
+
13
+ const GOALS_DIR = path.join(process.cwd(), 'codex-reports', 'goals');
14
+ const ACTIVE_GOAL_FILE = path.join(GOALS_DIR, 'active_goal.json');
15
+
16
+ const C = {
17
+ reset: '\x1b[0m',
18
+ red: '\x1b[31m',
19
+ green: '\x1b[32m',
20
+ yellow: '\x1b[33m',
21
+ cyan: '\x1b[36m',
22
+ gray: '\x1b[90m',
23
+ bold: '\x1b[1m',
24
+ };
25
+
26
+ const log = (msg) => console.log(msg);
27
+ const ok = (msg) => log(`${C.green}✔${C.reset} ${msg}`);
28
+ const warn = (msg) => log(`${C.yellow}⚠${C.reset} ${msg}`);
29
+ const err = (msg) => log(`${C.red}✖${C.reset} ${msg}`);
30
+ const info = (msg) => log(`${C.cyan}ℹ${C.reset} ${msg}`);
31
+
32
+ // Parse args
33
+ const args = process.argv.slice(2);
34
+ let prompt = '';
35
+ let checkStatus = false;
36
+ let pauseGoal = false;
37
+ let resumeGoal = false;
38
+ let cancelGoal = false;
39
+
40
+ for (let i = 0; i < args.length; i++) {
41
+ if (args[i] === '--prompt' && args[i + 1]) {
42
+ prompt = args[i + 1];
43
+ i++;
44
+ } else if (args[i] === '--status') {
45
+ checkStatus = true;
46
+ } else if (args[i] === '--pause') {
47
+ pauseGoal = true;
48
+ } else if (args[i] === '--resume') {
49
+ resumeGoal = true;
50
+ } else if (args[i] === '--cancel') {
51
+ cancelGoal = true;
52
+ }
53
+ }
54
+
55
+ // Ensure goals directory exists
56
+ fs.mkdirSync(GOALS_DIR, { recursive: true });
57
+
58
+ function getActiveGoal() {
59
+ if (fs.existsSync(ACTIVE_GOAL_FILE)) {
60
+ try {
61
+ return JSON.parse(fs.readFileSync(ACTIVE_GOAL_FILE, 'utf8'));
62
+ } catch (_) {}
63
+ }
64
+ return null;
65
+ }
66
+
67
+ function saveActiveGoal(state) {
68
+ fs.writeFileSync(ACTIVE_GOAL_FILE, JSON.stringify(state, null, 2) + '\n', 'utf8');
69
+ }
70
+
71
+ function runGoal(goalPrompt) {
72
+ info(`Setting up Goal Conductor for: "${goalPrompt}"`);
73
+
74
+ // Load codex-goal skill rules
75
+ const skillPath = path.join(__dirname, '..', 'skills', 'codex-goal', 'SKILL.md');
76
+ let skillContent = '';
77
+ if (fs.existsSync(skillPath)) {
78
+ skillContent = fs.readFileSync(skillPath, 'utf8');
79
+ }
80
+
81
+ const fullPrompt = `${skillContent}\n\n[USER GOAL / OBJECTIVE]\n${goalPrompt}\n\nPlease parse the goal, partition it into steps, and coordinate execution. Call Claude, Qwen, and sub-agents as described in the guidelines.`;
82
+
83
+ const goalId = `goal_${Date.now()}`;
84
+ const state = {
85
+ goalId,
86
+ prompt: goalPrompt,
87
+ status: 'running',
88
+ timestamp: Date.now()
89
+ };
90
+ saveActiveGoal(state);
91
+
92
+ // Set goal_mode = true in current context if running checks
93
+ process.env.goal_mode = 'true';
94
+
95
+ info(`Launching Codex CLI Agent in Goal Orchestration Mode...`);
96
+ try {
97
+ const result = spawnSync('codex', [
98
+ fullPrompt,
99
+ '-s', 'workspace-write',
100
+ '--ask-for-approval', 'untrusted'
101
+ ], { stdio: 'inherit' });
102
+
103
+ if (result.status === 0) {
104
+ state.status = 'completed';
105
+ saveActiveGoal(state);
106
+ ok('🏆 Codex Goal Conductor execution finished.');
107
+ } else {
108
+ state.status = 'failed';
109
+ saveActiveGoal(state);
110
+ err('Codex Goal Conductor exited with an error.');
111
+ }
112
+ } catch (e) {
113
+ state.status = 'failed';
114
+ saveActiveGoal(state);
115
+ err('Failed to execute Codex CLI: ' + e.message);
116
+ }
117
+ }
118
+
119
+ // CLI Command Handling
120
+ if (checkStatus) {
121
+ const state = getActiveGoal();
122
+ if (!state) {
123
+ log('No active goal session tracked.');
124
+ } else {
125
+ log(`\n🎯 Active Goal: "${state.prompt}"`);
126
+ log(`Status: ${state.status === 'running' ? C.cyan : state.status === 'completed' ? C.green : C.red}${state.status.toUpperCase()}${C.reset}`);
127
+ log(`Goal ID: ${state.goalId}`);
128
+ log(`To resume/check the Codex session, run: ${C.green}awkit goal --resume${C.reset}\n`);
129
+ }
130
+ } else if (pauseGoal) {
131
+ log('To pause Codex CLI execution, please press Ctrl+C in the active terminal run window.');
132
+ } else if (resumeGoal) {
133
+ const state = getActiveGoal();
134
+ if (state) {
135
+ info('Resuming last Codex session...');
136
+ try {
137
+ spawnSync('codex', ['resume', '--last'], { stdio: 'inherit' });
138
+ } catch (e) {
139
+ err('Failed to resume Codex session: ' + e.message);
140
+ }
141
+ } else {
142
+ warn('No active goal session to resume.');
143
+ }
144
+ } else if (cancelGoal) {
145
+ const state = getActiveGoal();
146
+ if (state) {
147
+ if (fs.existsSync(ACTIVE_GOAL_FILE)) {
148
+ fs.unlinkSync(ACTIVE_GOAL_FILE);
149
+ }
150
+ ok('Goal session cleared locally.');
151
+ } else {
152
+ warn('No active goal session to cancel.');
153
+ }
154
+ } else if (prompt) {
155
+ runGoal(prompt);
156
+ } else {
157
+ log('Usage:');
158
+ log(' node scripts/codex-goal.js --prompt "Goal Description"');
159
+ log(' node scripts/codex-goal.js --status');
160
+ log(' node scripts/codex-goal.js --pause');
161
+ log(' node scripts/codex-goal.js --resume');
162
+ log(' node scripts/codex-goal.js --cancel');
163
+ }
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Progress Tracker Wrapper for Background Tasks
5
+ * Spawns a process, pipes logs to a temp file, and prints a dynamic step checklist
6
+ * to prevent the IDE from looking like it hung.
7
+ */
8
+
9
+ const { spawn } = require('child_process');
10
+ const fs = require('fs');
11
+ const path = require('path');
12
+
13
+ const args = process.argv.slice(2);
14
+ if (args.length === 0) {
15
+ console.error('Usage: node scripts/exec-progress.js <command> [args...]');
16
+ process.exit(1);
17
+ }
18
+
19
+ const command = args.join(' ');
20
+
21
+ const LOG_DIR = path.join(process.cwd(), 'tmp');
22
+ if (!fs.existsSync(LOG_DIR)) {
23
+ fs.mkdirSync(LOG_DIR, { recursive: true });
24
+ }
25
+ const logFile = path.join(LOG_DIR, 'background_process.log');
26
+ const logStream = fs.createWriteStream(logFile, { flags: 'w' });
27
+
28
+ console.log(`\n\x1b[36m\x1b[1m🚀 Running Process with Progress Tracker\x1b[0m`);
29
+ console.log(`\x1b[90mCommand: ${command}\x1b[0m`);
30
+ console.log(`\x1b[90mFull log redirected to: file://${logFile}\x1b[0m\n`);
31
+
32
+ const steps = [
33
+ { name: 'Khởi tạo tiến trình (Initialization)', pattern: /init|start|launching/i, status: 'pending' },
34
+ { name: 'Lập kế hoạch & Phân tích (Planning)', pattern: /plan|analyz/i, status: 'pending' },
35
+ { name: 'Thực thi tác vụ chính (Execution)', pattern: /execut|generat|render|process/i, status: 'pending' },
36
+ { name: 'Kiểm tra & Hoàn thiện (Verification)', pattern: /verify|check|done|finish/i, status: 'pending' }
37
+ ];
38
+
39
+ let activeStepIndex = -1;
40
+
41
+ function renderChecklist() {
42
+ // Clear last lines using ANSI escape codes
43
+ process.stdout.write('\x1b[1F\x1b[2K'.repeat(steps.length + 1));
44
+ console.log(`\x1b[36m📊 Trạng thái tiến trình:\x1b[0m`);
45
+ steps.forEach((step, idx) => {
46
+ let icon = '⬜';
47
+ let color = '\x1b[0m';
48
+ if (step.status === 'done') {
49
+ icon = '✅';
50
+ color = '\x1b[32m';
51
+ } else if (step.status === 'running') {
52
+ icon = '🔄';
53
+ color = '\x1b[33m\x1b[1m';
54
+ }
55
+ console.log(` ${icon} ${color}${step.name}\x1b[0m`);
56
+ });
57
+ }
58
+
59
+ // Print initial spacing for checklist
60
+ console.log('\n'.repeat(steps.length + 1));
61
+ renderChecklist();
62
+
63
+ // Spawn process via shell to support command strings with arguments/pipes
64
+ const proc = spawn(command, { shell: true });
65
+
66
+ proc.stdout.on('data', (data) => {
67
+ const text = data.toString();
68
+ logStream.write(text);
69
+
70
+ // Parse output to update steps
71
+ const lines = text.split('\n');
72
+ lines.forEach(line => {
73
+ if (!line.trim()) return;
74
+
75
+ // Scan for patterns to progress steps
76
+ steps.forEach((step, idx) => {
77
+ if (step.pattern.test(line)) {
78
+ if (step.status === 'pending') {
79
+ // Mark previous active step as done
80
+ if (activeStepIndex >= 0 && activeStepIndex < idx) {
81
+ steps[activeStepIndex].status = 'done';
82
+ }
83
+ step.status = 'running';
84
+ activeStepIndex = idx;
85
+ renderChecklist();
86
+ }
87
+ }
88
+ });
89
+ });
90
+ });
91
+
92
+ proc.stderr.on('data', (data) => {
93
+ const text = data.toString();
94
+ logStream.write(text);
95
+ });
96
+
97
+ proc.on('close', (code) => {
98
+ logStream.end();
99
+ if (activeStepIndex >= 0) {
100
+ steps[activeStepIndex].status = code === 0 ? 'done' : 'pending';
101
+ }
102
+ // If successful, mark all steps as done
103
+ if (code === 0) {
104
+ steps.forEach(s => s.status = 'done');
105
+ }
106
+ renderChecklist();
107
+
108
+ if (code === 0) {
109
+ console.log(`\n\x1b[32m\x1b[1m🎉 Hoàn thành tiến trình thành công!\x1b[0m\n`);
110
+ process.exit(0);
111
+ } else {
112
+ console.log(`\n\x1b[31m\x1b[1m❌ Tiến trình kết thúc với lỗi (Mã lỗi: ${code}).\x1b[0m`);
113
+ console.log(`\x1b[90mChi tiết lỗi xem tại file log trên.\x1b[0m\n`);
114
+ process.exit(code);
115
+ }
116
+ });
@@ -24,6 +24,7 @@ function checkRtk() {
24
24
  * @returns {Buffer|string}
25
25
  */
26
26
  function execRtkSync(command, options = {}) {
27
+ const opts = { timeout: 30000, ...options };
27
28
  const trimmed = command.trim();
28
29
 
29
30
  // Only compress developer commands known to be verbose
@@ -33,10 +34,10 @@ function execRtkSync(command, options = {}) {
33
34
  const isEligible = allEligible.some(prefix => trimmed.startsWith(prefix));
34
35
 
35
36
  if (!checkRtk()) {
36
- if (isEligible && !options.stdio) {
37
- return execSync(`${command} 2>&1 | tail -c 8000`, { ...options, shell: true });
37
+ if (isEligible && !opts.stdio) {
38
+ return execSync(`${command} 2>&1 | tail -c 8000`, { ...opts, shell: true });
38
39
  }
39
- return execSync(command, options);
40
+ return execSync(command, opts);
40
41
  }
41
42
 
42
43
  if (trimmed.startsWith('rtk ')) {
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: codex-goal
3
+ description: >-
4
+ Codex Goal Conductor — Centralized autonomous goal-execution loop.
5
+ Orchestrates complex feature development by partitioning high-level goals
6
+ into tasks and distributing them to Claude, Qwen, standard agents, and sub-agents.
7
+ metadata:
8
+ stage: core
9
+ version: "1.0"
10
+ requires: codex (npm i -g @openai/codex)
11
+ tags: [goal, conductor, orchestration, multi-agent, autonomous]
12
+ agent: Goal Conductor
13
+ trigger: command
14
+ invocation-type: manual
15
+ priority: 5
16
+ ---
17
+
18
+ # 🎯 Codex Goal Conductor — Goal Execution Skill
19
+
20
+ > **Purpose:** Centralized orchestrator to pursue high-level development goals autonomously.
21
+ > **Principle:** Codex plans the tasks, registers them in Symphony, and delegates executions to other specialized agents.
22
+
23
+ ---
24
+
25
+ ## 🏗️ Execution Model
26
+
27
+ In Goal Mode, Codex acts as the **Goal Conductor**. It runs an autonomous loop:
28
+
29
+ ```
30
+ ┌──────────────────────┐
31
+ │ User Goal Prompt │
32
+ └──────────┬───────────┘
33
+
34
+
35
+ ┌──────────────────────┐
36
+ │ Codex Conductor │◄────────────────────────┐
37
+ └──────────┬───────────┘ │
38
+ │ (Partitions & Delegates) │
39
+ ┌────────────────────┼────────────────────┐ │
40
+ ▼ ▼ ▼ │
41
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
42
+ │ Claude CLI │ │ Qwen CLI │ │ Codex Sub- │ │
43
+ │ (Architect) │ │ (Executor) │ │ agents │ │
44
+ └──────────────┘ └──────────────┘ └──────┬───────┘ │
45
+ │ │
46
+ ▼ (Inspect/Review)│
47
+ ┌──────────────┐ │
48
+ │ standard │ │
49
+ │ verification│─────────┘
50
+ └──────────────┘
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 📋 Operational Guidelines
56
+
57
+ ### 1. Goal Partitioning
58
+ - Upon receiving a goal, the Conductor MUST create a local session tracker at `codex-reports/goals/<goal_id>/state.json`.
59
+ - It must partition the goal into explicit, non-overlapping step tasks (following Symphony task schema).
60
+
61
+ ### 2. Task Delegation Protocol
62
+ For each task, the Goal Conductor selects the optimal runner:
63
+ - **Claude (Architect):** Runs for PRD generation, architectural design, and planning checks.
64
+ Command: `node scripts/claude-plan.js --prompt-file <prompt_file> --output <output_file>`
65
+ - **Qwen (Executor):** Runs for code implementation, refactoring, and file modifications.
66
+ Command: `node scripts/qwen-exec.js --prompt-file <prompt_file> --output <output_file> --sandbox workspace-write`
67
+ - **Gemini / AGY (General):** Runs for light scripting, quick checks, and fallback execution.
68
+ Command: `agy --model gemini-3.5-flash --print "<prompt>"`
69
+ - **Codex Sub-agents (Headless Experts):** Used for verification, reviews, and test generation.
70
+ Command: `codex exec "<prompt>" -s workspace-write`
71
+
72
+ ### 3. Sub-Agent Autonomy & Callback
73
+ - Codex sub-agents (e.g. `critic`, `tester`, `ios-visual-qa-strategist`) are instantiated to run independently.
74
+ - When running, these sub-agents may delegate sub-problems back to Claude, Qwen, or AGY by executing the respective wrapper CLI commands.
75
+ - Sub-agents report their outputs back to the Goal Conductor in standardized Markdown files in `codex-reports/goals/<goal_id>/`.
76
+
77
+ ---
78
+
79
+ ## 🚫 Safety & Mindful Rest Guards
80
+ - **destructive_actions:** If a proposed task involves destructive modifications (e.g., `rm -rf`, force push, database drop), the Conductor MUST pause and ask for explicit user confirmation.
81
+ - **loop_prevention:** If a single task fails or undergoes retry loops more than 3 times, the Conductor must pause, report the blocker details, and ask the user for guidance.
82
+ - **state_saves:** Save state changes to `codex-reports/goals/<goal_id>/state.json` at the end of every task execution.
@@ -65,7 +65,7 @@ After the canonical files and manifests exist, the app points at them, and verif
65
65
 
66
66
  ## Default Workflow
67
67
 
68
- 1. Build canvas grid options and ask for one-time confirmation before any generation.
68
+ 1. Build canvas grid options and ask for one-time confirmation before any generation (Goal Mode: Auto-select recommended grid strategy, e.g. 8x6 for high throughput, and proceed).
69
69
 
70
70
  Always present total icon capacity from larger to smaller. These are uniform canvas grids for deterministic slicing, not arbitrary pack boxes:
71
71
 
@@ -87,7 +87,7 @@ SKILL_DIR="${CODEX_HOME:-$HOME/.codex}/skills/generate-gui-assets"
87
87
  python "$SKILL_DIR/scripts/suggest_grid_options.py" --icon-count 18 --strategy throughput
88
88
  ```
89
89
 
90
- Do not generate preview or bulk until the user confirms one canvas grid strategy.
90
+ Do not generate preview or bulk until the user confirms one canvas grid strategy (Goal Mode: Auto-select recommended grid strategy and proceed).
91
91
 
92
92
  Use this confirmation template exactly (largest to smallest, one-time confirm):
93
93
 
@@ -137,7 +137,7 @@ python "$SKILL_DIR/scripts/build_gui_contact_sheet.py" \
137
137
  --run-dir assets/ui/generated/gui-v1-preview
138
138
  ```
139
139
 
140
- 5. Wait for explicit user confirmation. Do not run bulk generation before preview is approved.
140
+ 5. Wait for explicit user confirmation. Do not run bulk generation before preview is approved (Goal Mode: Auto-approve preview and immediately launch bulk generation).
141
141
 
142
142
  6. After approval, create the bulk run using locked style language:
143
143
 
@@ -265,8 +265,8 @@ Quality rules: no text, no labels, no scenery, no glow, no shadows outside silho
265
265
 
266
266
  ## Iteration Strategy
267
267
 
268
- - Always run preview-first and require explicit user confirmation before bulk generation.
269
- - Ask for grid confirmation exactly once per run before preview.
268
+ - Always run preview-first and require explicit user confirmation before bulk generation (Goal Mode: Bypass confirmation, auto-approve).
269
+ - Ask for grid confirmation exactly once per run before preview (Goal Mode: Bypass confirmation, auto-select recommended).
270
270
  - Prefer larger total canvas grids first to reduce generation count, then step down only if preview quality is unacceptable.
271
271
  - In throughput strategy, recommend `8x6` first for up to 48 icons per image.
272
272
  - Treat `4x4` as a compact quality-priority option, not the default large-layout recommendation.
@@ -21,7 +21,7 @@ Before generating base art, row strips, or repair rows, load and follow the inst
21
21
  ${CODEX_HOME:-$HOME/.codex}/skills/.system/imagegen/SKILL.md
22
22
  ```
23
23
 
24
- Do not call the Image API directly for the normal path. Let `$imagegen` choose its own built-in-first path and its own CLI fallback rules. If `$imagegen` says a fallback requires confirmation, ask the user before continuing.
24
+ Do not call the Image API directly for the normal path. Let `$imagegen` choose its own built-in-first path and its own CLI fallback rules. If `$imagegen` says a fallback requires confirmation, ask the user before continuing (Goal Mode: Auto-approve fallback).
25
25
 
26
26
  Fallback providers are opt-in only and require explicit user request plus both `OPENAI_API_KEY` and `OPENROUTER_API_KEY`.
27
27
  Do not precheck, mention, or require provider API keys unless the user explicitly requests fallback.
@@ -273,7 +273,7 @@ selected_source=/absolute/path/to/$CODEX_HOME/generated_images/.../ig_*.png
273
273
  qa_note=<one sentence>
274
274
  ```
275
275
 
276
- No silent sequential fallback: if subagents cannot be used for row-strip visual generation, stop and ask for explicit user direction before continuing without them. Only an explicit user instruction such as "do not use subagents" or "run this sequentially" authorizes a normal sequential row-generation path. The final answer must report which row jobs were delegated to subagents and which, if any, were mirrored or repaired by the parent.
276
+ No silent sequential fallback: if subagents cannot be used for row-strip visual generation, stop and ask for explicit user direction before continuing without them (Goal Mode: Automatically fall back to sequential generation without asking). Only an explicit user instruction such as "do not use subagents" or "run this sequentially" authorizes a normal sequential row-generation path. The final answer must report which row jobs were delegated to subagents and which, if any, were mirrored or repaired by the parent.
277
277
 
278
278
  ## Repair Workflow
279
279
 
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: threejs-animation
3
+ description: "three.js keyframe animation system: AnimationMixer, AnimationClip, AnimationAction, KeyframeTrack variants, PropertyBinding, PropertyMixer, AnimationObjectGroup, AnimationUtils; mixing and crossfading clips, loop modes, timeScale, weight; addon AnimationClipCreator and CCDIKSolver for procedural rigs. Use when playing glTF clips, blending actions, or authoring procedural tracks; for skin deformation rigging on meshes see threejs-objects; for math interpolants without clips see threejs-math only when not tied to AnimationMixer."
4
+ ---
5
+
6
+ ## When to use this skill
7
+
8
+ **ALWAYS use this skill when the user mentions:**
9
+
10
+ - `AnimationMixer.update`, `AnimationAction` play/pause/stop, crossfade, synchronized clips
11
+ - `AnimationClip` from glTF or `AnimationClipCreator`, retargeting caveats at API level
12
+ - Keyframe tracks: position/rotation/scale/color tracks, boolean/string tracks where applicable
13
+ - IK: `CCDIKSolver` / `CCDIKHelper` from addons
14
+
15
+ **IMPORTANT: animation vs objects**
16
+
17
+ - **threejs-animation** = time evaluation and tracks.
18
+ - **threejs-objects** = `SkinnedMesh`/`Skeleton` attachment, bind pose—mesh side.
19
+
20
+ **Trigger phrases include:**
21
+
22
+ - "AnimationMixer", "AnimationAction", "AnimationClip", "crossFade", "KeyframeTrack"
23
+ - "动画混合", "骨骼动画", "剪辑", "淡入淡出"
24
+
25
+ ## How to use this skill
26
+
27
+ 1. **Collect clips** from `gltf.animations` or create with utilities / `AnimationClipCreator`.
28
+ 2. **Create mixer** bound to root object (often `scene` or rig root).
29
+ 3. **Create actions** per clip via `mixer.clipAction(clip)`; configure loop mode (`LoopOnce`, `LoopRepeat`, `LoopPingPong`).
30
+ 4. **Per frame**: compute delta seconds (use `Clock` from core—documented under Core in docs index), call `mixer.update(delta)`.
31
+ 5. **Blending**: adjust `weight`, `crossFadeTo`, `enabled` flags; watch for additive vs full replacement semantics per docs.
32
+ 6. **PropertyBinding**: understand path strings targeting bones/morphs—errors often from wrong object names.
33
+ 7. **IK addon**: attach solver after base animation if using CCD IK from examples.
34
+
35
+ See [examples/workflow-mixer-action.md](examples/workflow-mixer-action.md).
36
+
37
+ ## Doc map (official)
38
+
39
+ | Docs section | Representative links |
40
+ |--------------|----------------------|
41
+ | Animation (index) | https://threejs.org/docs/#Animation |
42
+ | Action | https://threejs.org/docs/AnimationAction.html |
43
+ | Mixer | https://threejs.org/docs/AnimationMixer.html |
44
+ | Clip | https://threejs.org/docs/AnimationClip.html |
45
+ | Tracks | https://threejs.org/docs/KeyframeTrack.html |
46
+
47
+ More: [references/official-sections.md](references/official-sections.md).
48
+
49
+ ## Scope
50
+
51
+ - **In scope:** Core Animation module, keyframe pipeline, listed addons for clip creation and IK.
52
+ - **Out of scope:** DCC export best practices; physics ragdoll; audio sync (link conceptually only).
53
+
54
+ ## Common pitfalls and best practices
55
+
56
+ - Forgetting `mixer.update` freezes animation; double `update` per frame speeds up.
57
+ - Mixing clips with incompatible hierarchies causes violent pops—validate bind pose.
58
+ - Root motion must be handled in game logic if not baked—document explicitly.
59
+ - Large track counts cost CPU—strip unused tracks in preprocessing when possible.
60
+
61
+ ## Documentation and version
62
+
63
+ Behavior of `AnimationMixer`, tracks, and glTF animation import can change between three.js majors. Treat the [Animation](https://threejs.org/docs/#Animation) section of the [docs index](https://threejs.org/docs/) as authoritative for the user’s installed version; when upgrading, check the three.js repository release notes and migration notes for renamed properties or loader output.
64
+
65
+ ## Agent response checklist
66
+
67
+ When answering under this skill, prefer responses that:
68
+
69
+ 1. Cite the exact class (`AnimationMixer`, `AnimationAction`, etc.) or addon (`CCDIKSolver`) from the official docs.
70
+ 2. Include at least one `https://threejs.org/docs/...` link (e.g. [AnimationAction](https://threejs.org/docs/AnimationAction.html)).
71
+ 3. Relate clips to `SkinnedMesh` / skeleton via **threejs-objects** when deformation is involved.
72
+ 4. Mention `mixer.update(delta)` and a stable time source (`Clock`) explicitly.
73
+ 5. Reference official **examples** by name only (no full file paste).
74
+
75
+ ## References
76
+
77
+ - https://threejs.org/docs/#Animation
78
+ - https://threejs.org/docs/AnimationMixer.html
79
+ - https://threejs.org/docs/AnimationAction.html
80
+ - https://threejs.org/docs/PropertyBinding.html
81
+
82
+ ## Keywords
83
+
84
+ **English:** animationmixer, animationaction, animationclip, keyframetrack, crossfade, skinning, propertybinding, three.js
85
+
86
+ **中文:** 动画混合、AnimationMixer、AnimationAction、关键帧、骨骼动画、剪辑、淡入淡出、three.js
@@ -0,0 +1,20 @@
1
+ # Workflow: play one glTF clip
2
+
3
+ ## Steps
4
+
5
+ 1. After **threejs-loaders** provides `gltf` with `animations` array non-empty.
6
+
7
+ 2. `const mixer = new THREE.AnimationMixer(gltf.scene);`
8
+
9
+ 3. `const clip = gltf.animations[0]; const action = mixer.clipAction(clip); action.play();`
10
+
11
+ 4. In the render loop: `const delta = clock.getDelta(); mixer.update(delta);` then render (**threejs-renderers**).
12
+
13
+ 5. To switch clips, prepare second `clipAction`, then `action.crossFadeTo(nextAction, duration, false)` per docs.
14
+
15
+ 6. Dispose mixer when discarding the rig if your app hot-swaps characters.
16
+
17
+ ## Anchor
18
+
19
+ - https://threejs.org/docs/AnimationMixer.html
20
+ - https://threejs.org/docs/AnimationAction.html
@@ -0,0 +1,19 @@
1
+ # Animation module (core)
2
+
3
+ - https://threejs.org/docs/AnimationAction.html
4
+ - https://threejs.org/docs/AnimationClip.html
5
+ - https://threejs.org/docs/AnimationMixer.html
6
+ - https://threejs.org/docs/AnimationObjectGroup.html
7
+ - https://threejs.org/docs/AnimationUtils.html
8
+ - https://threejs.org/docs/KeyframeTrack.html
9
+ - https://threejs.org/docs/VectorKeyframeTrack.html
10
+ - https://threejs.org/docs/QuaternionKeyframeTrack.html
11
+ - https://threejs.org/docs/PropertyBinding.html
12
+ - https://threejs.org/docs/PropertyMixer.html
13
+
14
+ **Addons**
15
+
16
+ - https://threejs.org/docs/AnimationClipCreator.html
17
+ - https://threejs.org/docs/CCDIKSolver.html
18
+
19
+ See https://threejs.org/docs/#Animation