oh-my-codex-cli 0.1.0
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/.agent/skills/agent-kb/HOW_TO_USE.md +428 -0
- package/.agent/skills/agent-kb/README.md +46 -0
- package/.agent/skills/agent-kb/SKILL.md +128 -0
- package/.agent/skills/agent-kb/references/intelligent-analysis-explained.md +333 -0
- package/.agent/skills/agent-kb/references/query-optimization.md +225 -0
- package/.agent/skills/aireview/SKILL.md +704 -0
- package/.agent/skills/analyze/SKILL.md +81 -0
- package/.agent/skills/architect-planner/HOW_TO_USE.md +238 -0
- package/.agent/skills/architect-planner/README.md +41 -0
- package/.agent/skills/architect-planner/SKILL.md +539 -0
- package/.agent/skills/auto-mbti/SKILL.md +291 -0
- package/.agent/skills/autopilot/SKILL.md +222 -0
- package/.agent/skills/backend-patterns/SKILL.md +602 -0
- package/.agent/skills/bdd-generator/README.md +78 -0
- package/.agent/skills/bdd-generator/SKILL.md +436 -0
- package/.agent/skills/brainstorming/HOW_TO_USE.md +289 -0
- package/.agent/skills/brainstorming/README.md +41 -0
- package/.agent/skills/brainstorming/SKILL.md +165 -0
- package/.agent/skills/build-fix/SKILL.md +190 -0
- package/.agent/skills/cancel/SKILL.md +658 -0
- package/.agent/skills/checkpoint/SKILL.md +94 -0
- package/.agent/skills/code-review/SKILL.md +273 -0
- package/.agent/skills/coding-standards/SKILL.md +535 -0
- package/.agent/skills/conductor/SKILL.md +128 -0
- package/.agent/skills/conductor/commands/conductor/implement.toml +358 -0
- package/.agent/skills/conductor/commands/conductor/newTrack.toml +142 -0
- package/.agent/skills/conductor/commands/conductor/revert.toml +123 -0
- package/.agent/skills/conductor/commands/conductor/setup.toml +429 -0
- package/.agent/skills/conductor/commands/conductor/status.toml +57 -0
- package/.agent/skills/conductor/scripts/install.sh +89 -0
- package/.agent/skills/conductor/templates/code_styleguides/csharp.md +115 -0
- package/.agent/skills/conductor/templates/code_styleguides/dart.md +238 -0
- package/.agent/skills/conductor/templates/code_styleguides/general.md +23 -0
- package/.agent/skills/conductor/templates/code_styleguides/go.md +48 -0
- package/.agent/skills/conductor/templates/code_styleguides/html-css.md +49 -0
- package/.agent/skills/conductor/templates/code_styleguides/javascript.md +51 -0
- package/.agent/skills/conductor/templates/code_styleguides/python.md +37 -0
- package/.agent/skills/conductor/templates/code_styleguides/typescript.md +43 -0
- package/.agent/skills/conductor/templates/rules/README.md +23 -0
- package/.agent/skills/conductor/templates/rules/agents.md +49 -0
- package/.agent/skills/conductor/templates/rules/coding-style.md +70 -0
- package/.agent/skills/conductor/templates/rules/dev.md +20 -0
- package/.agent/skills/conductor/templates/rules/git-workflow.md +45 -0
- package/.agent/skills/conductor/templates/rules/hooks.md +6 -0
- package/.agent/skills/conductor/templates/rules/patterns.md +55 -0
- package/.agent/skills/conductor/templates/rules/performance.md +47 -0
- package/.agent/skills/conductor/templates/rules/research.md +26 -0
- package/.agent/skills/conductor/templates/rules/review.md +22 -0
- package/.agent/skills/conductor/templates/rules/security.md +36 -0
- package/.agent/skills/conductor/templates/rules/testing.md +30 -0
- package/.agent/skills/conductor/templates/workflow.md +333 -0
- package/.agent/skills/consensus/HOW_TO_USE.md +191 -0
- package/.agent/skills/consensus/README.md +41 -0
- package/.agent/skills/consensus/SKILL.md +317 -0
- package/.agent/skills/content-research-writer/SKILL.md +537 -0
- package/.agent/skills/debug-analysis/SKILL.md +331 -0
- package/.agent/skills/deepinit/SKILL.md +347 -0
- package/.agent/skills/deepsearch/SKILL.md +56 -0
- package/.agent/skills/doctor/SKILL.md +158 -0
- package/.agent/skills/drawio/EXAMPLES.md +382 -0
- package/.agent/skills/drawio/QUICK_START.md +237 -0
- package/.agent/skills/drawio/README.md +315 -0
- package/.agent/skills/drawio/SETUP_GUIDE.md +254 -0
- package/.agent/skills/drawio/SKILL.md +1176 -0
- package/.agent/skills/e2e/SKILL.md +396 -0
- package/.agent/skills/ecomode/SKILL.md +160 -0
- package/.agent/skills/electron-driver/SKILL.md +144 -0
- package/.agent/skills/electron-driver/scripts/driver-template.js +71 -0
- package/.agent/skills/eval/SKILL.md +140 -0
- package/.agent/skills/eval-harness/SKILL.md +242 -0
- package/.agent/skills/evolve/SKILL.md +213 -0
- package/.agent/skills/frontend-design/SKILL.md +42 -0
- package/.agent/skills/frontend-patterns/SKILL.md +646 -0
- package/.agent/skills/frontend-ui-ux/SKILL.md +70 -0
- package/.agent/skills/git-master/SKILL.md +75 -0
- package/.agent/skills/help/SKILL.md +89 -0
- package/.agent/skills/iterative-retrieval/SKILL.md +217 -0
- package/.agent/skills/local-skills-setup/SKILL.md +483 -0
- package/.agent/skills/log-analyzer/SKILL.md +187 -0
- package/.agent/skills/mcp-setup/SKILL.md +226 -0
- package/.agent/skills/multi-model-research/HOW_TO_USE.md +614 -0
- package/.agent/skills/multi-model-research/README.md +233 -0
- package/.agent/skills/multi-model-research/SKILL.md +541 -0
- package/.agent/skills/multi-model-research/references/troubleshooting.md +415 -0
- package/.agent/skills/note/SKILL.md +80 -0
- package/.agent/skills/omc-setup/SKILL.md +219 -0
- package/.agent/skills/orchestrate/SKILL.md +620 -0
- package/.agent/skills/patent-workflow/IMPLEMENTATION_SUMMARY.md +500 -0
- package/.agent/skills/patent-workflow/README.md +455 -0
- package/.agent/skills/patent-workflow/SKILL.md +1036 -0
- package/.agent/skills/patent-workflow/tools/irr_checker.py +260 -0
- package/.agent/skills/patent-workflow/tools/sample_terminology.json +49 -0
- package/.agent/skills/patent-workflow/tools/term_checker.py +355 -0
- package/.agent/skills/pattern-recognition/SKILL.md +792 -0
- package/.agent/skills/pipeline/SKILL.md +448 -0
- package/.agent/skills/plan/SKILL.md +309 -0
- package/.agent/skills/planning-methodology/SKILL.md +370 -0
- package/.agent/skills/planning-with-files/SKILL.md +210 -0
- package/.agent/skills/planning-with-files/examples.md +202 -0
- package/.agent/skills/planning-with-files/reference.md +218 -0
- package/.agent/skills/planning-with-files/scripts/check-complete.ps1 +42 -0
- package/.agent/skills/planning-with-files/scripts/check-complete.sh +44 -0
- package/.agent/skills/planning-with-files/scripts/init-session.ps1 +120 -0
- package/.agent/skills/planning-with-files/scripts/init-session.sh +120 -0
- package/.agent/skills/planning-with-files/scripts/session-catchup.py +208 -0
- package/.agent/skills/planning-with-files/templates/findings.md +95 -0
- package/.agent/skills/planning-with-files/templates/progress.md +114 -0
- package/.agent/skills/planning-with-files/templates/task_plan.md +132 -0
- package/.agent/skills/project-analyze/CLAUDE.md +18 -0
- package/.agent/skills/project-analyze/HOW_TO_USE.md +145 -0
- package/.agent/skills/project-analyze/README.md +42 -0
- package/.agent/skills/project-analyze/SKILL.md +289 -0
- package/.agent/skills/project-analyze/SKILL.md.backup +287 -0
- package/.agent/skills/project-analyze/SKILL.md.backup_20260105_093646 +287 -0
- package/.agent/skills/project-analyze/assets/analysis-report-template.md +433 -0
- package/.agent/skills/project-analyze/references/analysis-patterns.md +422 -0
- package/.agent/skills/project-analyze/references/projectmind-explained.md +535 -0
- package/.agent/skills/project-session-manager/SKILL.md +428 -0
- package/.agent/skills/project-session-manager/lib/config.sh +86 -0
- package/.agent/skills/project-session-manager/lib/parse.sh +121 -0
- package/.agent/skills/project-session-manager/lib/session.sh +132 -0
- package/.agent/skills/project-session-manager/lib/tmux.sh +103 -0
- package/.agent/skills/project-session-manager/lib/worktree.sh +171 -0
- package/.agent/skills/project-session-manager/psm.sh +629 -0
- package/.agent/skills/project-session-manager/templates/feature.md +56 -0
- package/.agent/skills/project-session-manager/templates/issue-fix.md +57 -0
- package/.agent/skills/project-session-manager/templates/pr-review.md +65 -0
- package/.agent/skills/project-session-manager/templates/projects.json +19 -0
- package/.agent/skills/quality-check/HOW_TO_USE.md +171 -0
- package/.agent/skills/quality-check/README.md +50 -0
- package/.agent/skills/quality-check/SKILL.md +240 -0
- package/.agent/skills/quality-check/SKILL.md.backup +238 -0
- package/.agent/skills/quality-check/SKILL.md.backup_20260105_093646 +238 -0
- package/.agent/skills/quality-check/assets/quality-report-template.md +437 -0
- package/.agent/skills/quality-check/references/refactoring-patterns.md +550 -0
- package/.agent/skills/quality-check/references/scoring-criteria.md +454 -0
- package/.agent/skills/quality-validation/SKILL.md +519 -0
- package/.agent/skills/quality-validation/SKILL.md.backup +573 -0
- package/.agent/skills/quality-validation/SKILL.md.backup_20260105_093646 +573 -0
- package/.agent/skills/ralph/SKILL.md +236 -0
- package/.agent/skills/ralph-init/SKILL.md +78 -0
- package/.agent/skills/ralplan/SKILL.md +58 -0
- package/.agent/skills/refactor-clean/SKILL.md +49 -0
- package/.agent/skills/release/SKILL.md +84 -0
- package/.agent/skills/research/SKILL.md +526 -0
- package/.agent/skills/research-methodology/SKILL.md +268 -0
- package/.agent/skills/review/SKILL.md +53 -0
- package/.agent/skills/security-review/SKILL.md +509 -0
- package/.agent/skills/security-review/cloud-infrastructure-security.md +361 -0
- package/.agent/skills/setup-pm/SKILL.md +102 -0
- package/.agent/skills/skill/SKILL.md +424 -0
- package/.agent/skills/skill-create/SKILL.md +209 -0
- package/.agent/skills/skill-debugger/HOW_TO_USE.md +244 -0
- package/.agent/skills/skill-debugger/README.md +44 -0
- package/.agent/skills/skill-debugger/SKILL.md +326 -0
- package/.agent/skills/skill-debugger/diagnostic_checklist.md +115 -0
- package/.agent/skills/skill-development/SKILL.md +661 -0
- package/.agent/skills/skill-development/references/skill-creator-original.md +209 -0
- package/.agent/skills/skill-doc-generator/README.md +37 -0
- package/.agent/skills/skill-doc-generator/SKILL.md +331 -0
- package/.agent/skills/skill-quality-analyzer/HOW_TO_USE.md +243 -0
- package/.agent/skills/skill-quality-analyzer/README.md +61 -0
- package/.agent/skills/skill-quality-analyzer/SKILL.md +247 -0
- package/.agent/skills/skill-quality-analyzer/analyzer.py +209 -0
- package/.agent/skills/skill-quality-analyzer/expected_output.json +81 -0
- package/.agent/skills/skill-quality-analyzer/sample_input.json +9 -0
- package/.agent/skills/skill-tester/README.md +46 -0
- package/.agent/skills/skill-tester/SKILL.md +345 -0
- package/.agent/skills/start-dev/SKILL.md +701 -0
- package/.agent/skills/swarm/SKILL.md +691 -0
- package/.agent/skills/task-kb-lookup/SKILL.md +211 -0
- package/.agent/skills/task-kb-record/SKILL.md +417 -0
- package/.agent/skills/tdd/SKILL.md +446 -0
- package/.agent/skills/tdd-generator/DEMO.md +516 -0
- package/.agent/skills/tdd-generator/README.md +89 -0
- package/.agent/skills/tdd-generator/SKILL.md +278 -0
- package/.agent/skills/tdd-workflow/SKILL.md +424 -0
- package/.agent/skills/test-coverage/SKILL.md +48 -0
- package/.agent/skills/thinkdeep/HOW_TO_USE.md +183 -0
- package/.agent/skills/thinkdeep/README.md +41 -0
- package/.agent/skills/thinkdeep/SKILL.md +343 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +228 -0
- package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/skills/ui-ux-pro-max/scripts/core.py +236 -0
- package/.agent/skills/ui-ux-pro-max/scripts/search.py +61 -0
- package/.agent/skills/ultrapilot/SKILL.md +647 -0
- package/.agent/skills/ultraqa/SKILL.md +152 -0
- package/.agent/skills/ultrawork/SKILL.md +123 -0
- package/.agent/skills/update-codemaps/SKILL.md +38 -0
- package/.agent/skills/update-docs/SKILL.md +52 -0
- package/.agent/skills/verification-loop/SKILL.md +140 -0
- package/.agent/skills/verify/SKILL.md +80 -0
- package/.agent/skills/writer-memory/SKILL.md +459 -0
- package/.agent/skills/writer-memory/lib/character-tracker.ts +338 -0
- package/.agent/skills/writer-memory/lib/memory-manager.ts +804 -0
- package/.agent/skills/writer-memory/lib/relationship-graph.ts +400 -0
- package/.agent/skills/writer-memory/lib/scene-organizer.ts +544 -0
- package/.agent/skills/writer-memory/lib/synopsis-builder.ts +339 -0
- package/.agent/skills/writer-memory/templates/synopsis-template.md +46 -0
- package/.governance/skill-lint.allowlist +4 -0
- package/.governance/skill-llm.allowlist +4 -0
- package/AGENTS.md +59 -0
- package/LICENSE +21 -0
- package/README.md +169 -0
- package/README.zh.md +145 -0
- package/bin/omcodex.js +8 -0
- package/commands/conductor/implement.toml +358 -0
- package/commands/conductor/newTrack.toml +142 -0
- package/commands/conductor/revert.toml +123 -0
- package/commands/conductor/setup.toml +429 -0
- package/commands/conductor/status.toml +57 -0
- package/docs/ALIGNMENT.md +40 -0
- package/docs/CODEX.md +133 -0
- package/docs/NOTIFY.md +81 -0
- package/docs/SKILL_GOVERNANCE.md +72 -0
- package/docs/SKILL_GOVERNANCE_FRAMEWORK.md +182 -0
- package/docs/SKILL_GOVERNANCE_FRAMEWORK.zh.md +170 -0
- package/package.json +50 -0
- package/prompts/architect.md +105 -0
- package/prompts/executor.md +134 -0
- package/prompts/planner.md +113 -0
- package/scripts/check-skill-governance.sh +84 -0
- package/scripts/check-skill-llm-governance.js +302 -0
- package/scripts/eval-skills.js +217 -0
- package/scripts/generate-catalog-docs.js +95 -0
- package/scripts/generate-codex-mcp-config.sh +22 -0
- package/scripts/install-codex-force.sh +5 -0
- package/scripts/install-codex-incremental.sh +5 -0
- package/scripts/install-codex.sh +79 -0
- package/scripts/notify-dispatch.js +15 -0
- package/scripts/setup-package-manager.js +137 -0
- package/src/catalog/generated/public-catalog.json +547 -0
- package/src/catalog/manifest.json +542 -0
- package/src/catalog/reader.js +43 -0
- package/src/catalog/schema.js +79 -0
- package/src/cli/doctor.js +62 -0
- package/src/cli/index.js +85 -0
- package/src/cli/notify.js +127 -0
- package/src/cli/route.js +43 -0
- package/src/cli/setup.js +155 -0
- package/src/cli/team.js +125 -0
- package/src/config/generator.js +119 -0
- package/src/mcp/memory-server.js +241 -0
- package/src/mcp/state-server.js +112 -0
- package/src/mcp/trace-server.js +168 -0
- package/src/notify/dispatch.js +74 -0
- package/src/notify/extensibility/dispatcher.js +113 -0
- package/src/notify/extensibility/events.js +15 -0
- package/src/notify/extensibility/loader.js +54 -0
- package/src/router/skill-router.js +90 -0
- package/src/team/auto-advance.js +72 -0
- package/src/team/orchestrator.js +82 -0
- package/src/team/state-store.js +33 -0
- package/src/utils/paths.js +33 -0
- package/templates/AGENTS.md +15 -0
- package/templates/catalog-manifest.json +542 -0
- package/templates/code_styleguides/csharp.md +115 -0
- package/templates/code_styleguides/dart.md +238 -0
- package/templates/code_styleguides/general.md +23 -0
- package/templates/code_styleguides/go.md +48 -0
- package/templates/code_styleguides/html-css.md +49 -0
- package/templates/code_styleguides/javascript.md +51 -0
- package/templates/code_styleguides/python.md +37 -0
- package/templates/code_styleguides/typescript.md +43 -0
- package/templates/rules/README.md +23 -0
- package/templates/rules/agents.md +49 -0
- package/templates/rules/coding-style.md +70 -0
- package/templates/rules/dev.md +20 -0
- package/templates/rules/git-workflow.md +45 -0
- package/templates/rules/notify.md +6 -0
- package/templates/rules/patterns.md +55 -0
- package/templates/rules/performance.md +47 -0
- package/templates/rules/research.md +26 -0
- package/templates/rules/review.md +22 -0
- package/templates/rules/security.md +36 -0
- package/templates/rules/testing.md +30 -0
- package/templates/workflow.md +333 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
import { loadMemory, saveMemory, findSceneById, findScenesByCharacter, generateId, now } from './memory-manager';
|
|
2
|
+
import type { Scene, Cut, WriterMemory } from './memory-manager';
|
|
3
|
+
|
|
4
|
+
// === Korean Emotion Vocabulary ===
|
|
5
|
+
const EMOTION_VOCABULARY: string[] = [
|
|
6
|
+
"긴장", "설렘", "불안", "평온", "갈등",
|
|
7
|
+
"슬픔", "기쁨", "분노", "체념", "희망",
|
|
8
|
+
"외로움", "그리움", "애틋함", "당혹", "환희",
|
|
9
|
+
"공포", "안도", "후회", "결의", "허탈"
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const CUT_TYPE_LABELS: Record<string, string> = {
|
|
13
|
+
dialogue: "대사",
|
|
14
|
+
narration: "내레이션",
|
|
15
|
+
action: "액션",
|
|
16
|
+
internal: "내면"
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// === Type Definitions ===
|
|
20
|
+
export interface SceneSummary {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
chapter?: string;
|
|
24
|
+
order: number;
|
|
25
|
+
characterCount: number;
|
|
26
|
+
cutCount: number;
|
|
27
|
+
emotionTags: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface SceneFlowEntry {
|
|
31
|
+
order: number;
|
|
32
|
+
title: string;
|
|
33
|
+
chapter?: string;
|
|
34
|
+
primaryEmotion: string;
|
|
35
|
+
characters: string[];
|
|
36
|
+
cutCount: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// === Scene CRUD ===
|
|
40
|
+
|
|
41
|
+
export function addScene(title: string, options?: {
|
|
42
|
+
chapter?: string;
|
|
43
|
+
characters?: string[];
|
|
44
|
+
emotionTags?: string[];
|
|
45
|
+
narrationTone?: string;
|
|
46
|
+
notes?: string;
|
|
47
|
+
}): Scene | null {
|
|
48
|
+
try {
|
|
49
|
+
const memory = loadMemory();
|
|
50
|
+
|
|
51
|
+
const newScene: Scene = {
|
|
52
|
+
id: generateId('scene'),
|
|
53
|
+
title,
|
|
54
|
+
chapter: options?.chapter,
|
|
55
|
+
characters: options?.characters || [],
|
|
56
|
+
emotionTags: options?.emotionTags || [],
|
|
57
|
+
cuts: [],
|
|
58
|
+
narrationTone: options?.narrationTone || '',
|
|
59
|
+
notes: options?.notes || '',
|
|
60
|
+
order: memory.scenes.length,
|
|
61
|
+
created: now()
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
memory.scenes.push(newScene);
|
|
65
|
+
saveMemory(memory);
|
|
66
|
+
|
|
67
|
+
return newScene;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error('Failed to add scene:', error);
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function updateScene(sceneId: string, updates: Partial<Scene>): Scene | null {
|
|
75
|
+
try {
|
|
76
|
+
const memory = loadMemory();
|
|
77
|
+
const scene = findSceneById(memory, sceneId);
|
|
78
|
+
|
|
79
|
+
if (!scene) {
|
|
80
|
+
console.error(`Scene not found: ${sceneId}`);
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Apply updates (preserve immutable fields)
|
|
85
|
+
Object.assign(scene, {
|
|
86
|
+
...updates,
|
|
87
|
+
id: scene.id,
|
|
88
|
+
created: scene.created
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
saveMemory(memory);
|
|
92
|
+
return scene;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.error('Failed to update scene:', error);
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function removeScene(sceneId: string): boolean {
|
|
100
|
+
try {
|
|
101
|
+
const memory = loadMemory();
|
|
102
|
+
const index = memory.scenes.findIndex(s => s.id === sceneId);
|
|
103
|
+
|
|
104
|
+
if (index === -1) {
|
|
105
|
+
console.error(`Scene not found: ${sceneId}`);
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
memory.scenes.splice(index, 1);
|
|
110
|
+
|
|
111
|
+
// Reorder remaining scenes
|
|
112
|
+
memory.scenes.forEach((scene, idx) => {
|
|
113
|
+
scene.order = idx;
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
saveMemory(memory);
|
|
117
|
+
return true;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error('Failed to remove scene:', error);
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function getScene(sceneId: string): Scene | null {
|
|
125
|
+
try {
|
|
126
|
+
const memory = loadMemory();
|
|
127
|
+
return findSceneById(memory, sceneId);
|
|
128
|
+
} catch (error) {
|
|
129
|
+
console.error('Failed to get scene:', error);
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function listScenes(options?: {
|
|
135
|
+
chapter?: string;
|
|
136
|
+
character?: string;
|
|
137
|
+
emotionTag?: string;
|
|
138
|
+
}): SceneSummary[] {
|
|
139
|
+
try {
|
|
140
|
+
const memory = loadMemory();
|
|
141
|
+
let scenes = [...memory.scenes];
|
|
142
|
+
|
|
143
|
+
// Apply filters
|
|
144
|
+
if (options?.chapter) {
|
|
145
|
+
scenes = scenes.filter(s => s.chapter === options.chapter);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (options?.character) {
|
|
149
|
+
scenes = scenes.filter(s => s.characters.includes(options.character!));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (options?.emotionTag) {
|
|
153
|
+
scenes = scenes.filter(s => s.emotionTags.includes(options.emotionTag!));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Sort by order
|
|
157
|
+
scenes.sort((a, b) => a.order - b.order);
|
|
158
|
+
|
|
159
|
+
// Convert to summaries
|
|
160
|
+
return scenes.map(scene => ({
|
|
161
|
+
id: scene.id,
|
|
162
|
+
title: scene.title,
|
|
163
|
+
chapter: scene.chapter,
|
|
164
|
+
order: scene.order,
|
|
165
|
+
characterCount: scene.characters.length,
|
|
166
|
+
cutCount: scene.cuts.length,
|
|
167
|
+
emotionTags: scene.emotionTags
|
|
168
|
+
}));
|
|
169
|
+
} catch (error) {
|
|
170
|
+
console.error('Failed to list scenes:', error);
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// === Cut Management (콘티 컷) ===
|
|
176
|
+
|
|
177
|
+
export function addCut(sceneId: string, cut: {
|
|
178
|
+
type: "dialogue" | "narration" | "action" | "internal";
|
|
179
|
+
content: string;
|
|
180
|
+
character?: string;
|
|
181
|
+
emotionTag?: string;
|
|
182
|
+
}): boolean {
|
|
183
|
+
try {
|
|
184
|
+
const memory = loadMemory();
|
|
185
|
+
const scene = findSceneById(memory, sceneId);
|
|
186
|
+
|
|
187
|
+
if (!scene) {
|
|
188
|
+
console.error(`Scene not found: ${sceneId}`);
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const newCut: Cut = {
|
|
193
|
+
order: scene.cuts.length,
|
|
194
|
+
type: cut.type,
|
|
195
|
+
content: cut.content,
|
|
196
|
+
character: cut.character,
|
|
197
|
+
emotionTag: cut.emotionTag
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
scene.cuts.push(newCut);
|
|
201
|
+
|
|
202
|
+
saveMemory(memory);
|
|
203
|
+
return true;
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.error('Failed to add cut:', error);
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function updateCut(sceneId: string, cutOrder: number, updates: Partial<Cut>): boolean {
|
|
211
|
+
try {
|
|
212
|
+
const memory = loadMemory();
|
|
213
|
+
const scene = findSceneById(memory, sceneId);
|
|
214
|
+
|
|
215
|
+
if (!scene) {
|
|
216
|
+
console.error(`Scene not found: ${sceneId}`);
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const cut = scene.cuts.find(c => c.order === cutOrder);
|
|
221
|
+
|
|
222
|
+
if (!cut) {
|
|
223
|
+
console.error(`Cut not found: order ${cutOrder} in scene ${sceneId}`);
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Apply updates (preserve order)
|
|
228
|
+
Object.assign(cut, {
|
|
229
|
+
...updates,
|
|
230
|
+
order: cut.order
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
saveMemory(memory);
|
|
234
|
+
return true;
|
|
235
|
+
} catch (error) {
|
|
236
|
+
console.error('Failed to update cut:', error);
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export function removeCut(sceneId: string, cutOrder: number): boolean {
|
|
242
|
+
try {
|
|
243
|
+
const memory = loadMemory();
|
|
244
|
+
const scene = findSceneById(memory, sceneId);
|
|
245
|
+
|
|
246
|
+
if (!scene) {
|
|
247
|
+
console.error(`Scene not found: ${sceneId}`);
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const index = scene.cuts.findIndex(c => c.order === cutOrder);
|
|
252
|
+
|
|
253
|
+
if (index === -1) {
|
|
254
|
+
console.error(`Cut not found: order ${cutOrder} in scene ${sceneId}`);
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
scene.cuts.splice(index, 1);
|
|
259
|
+
|
|
260
|
+
// Reorder remaining cuts
|
|
261
|
+
scene.cuts.forEach((cut, idx) => {
|
|
262
|
+
cut.order = idx;
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
saveMemory(memory);
|
|
266
|
+
return true;
|
|
267
|
+
} catch (error) {
|
|
268
|
+
console.error('Failed to remove cut:', error);
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export function reorderCuts(sceneId: string, newOrder: number[]): boolean {
|
|
274
|
+
try {
|
|
275
|
+
const memory = loadMemory();
|
|
276
|
+
const scene = findSceneById(memory, sceneId);
|
|
277
|
+
|
|
278
|
+
if (!scene) {
|
|
279
|
+
console.error(`Scene not found: ${sceneId}`);
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (newOrder.length !== scene.cuts.length) {
|
|
284
|
+
console.error('New order length does not match cuts length');
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Validate all indices are present
|
|
289
|
+
const sortedOrder = [...newOrder].sort((a, b) => a - b);
|
|
290
|
+
for (let i = 0; i < sortedOrder.length; i++) {
|
|
291
|
+
if (sortedOrder[i] !== i) {
|
|
292
|
+
console.error('Invalid order array: must contain all indices 0 to n-1');
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Reorder cuts
|
|
298
|
+
const reorderedCuts: Cut[] = newOrder.map(oldIdx => scene.cuts[oldIdx]);
|
|
299
|
+
reorderedCuts.forEach((cut, newIdx) => {
|
|
300
|
+
cut.order = newIdx;
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
scene.cuts = reorderedCuts;
|
|
304
|
+
|
|
305
|
+
saveMemory(memory);
|
|
306
|
+
return true;
|
|
307
|
+
} catch (error) {
|
|
308
|
+
console.error('Failed to reorder cuts:', error);
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// === Emotion Tags ===
|
|
314
|
+
|
|
315
|
+
export function addEmotionTag(sceneId: string, tag: string): boolean {
|
|
316
|
+
try {
|
|
317
|
+
const memory = loadMemory();
|
|
318
|
+
const scene = findSceneById(memory, sceneId);
|
|
319
|
+
|
|
320
|
+
if (!scene) {
|
|
321
|
+
console.error(`Scene not found: ${sceneId}`);
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (scene.emotionTags.includes(tag)) {
|
|
326
|
+
console.warn(`Emotion tag already exists: ${tag}`);
|
|
327
|
+
return true; // Not an error
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
scene.emotionTags.push(tag);
|
|
331
|
+
|
|
332
|
+
saveMemory(memory);
|
|
333
|
+
return true;
|
|
334
|
+
} catch (error) {
|
|
335
|
+
console.error('Failed to add emotion tag:', error);
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export function removeEmotionTag(sceneId: string, tag: string): boolean {
|
|
341
|
+
try {
|
|
342
|
+
const memory = loadMemory();
|
|
343
|
+
const scene = findSceneById(memory, sceneId);
|
|
344
|
+
|
|
345
|
+
if (!scene) {
|
|
346
|
+
console.error(`Scene not found: ${sceneId}`);
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const index = scene.emotionTags.indexOf(tag);
|
|
351
|
+
|
|
352
|
+
if (index === -1) {
|
|
353
|
+
console.warn(`Emotion tag not found: ${tag}`);
|
|
354
|
+
return true; // Not an error
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
scene.emotionTags.splice(index, 1);
|
|
358
|
+
|
|
359
|
+
saveMemory(memory);
|
|
360
|
+
return true;
|
|
361
|
+
} catch (error) {
|
|
362
|
+
console.error('Failed to remove emotion tag:', error);
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export function getScenesByEmotion(emotionTag: string): Scene[] {
|
|
368
|
+
try {
|
|
369
|
+
const memory = loadMemory();
|
|
370
|
+
return memory.scenes
|
|
371
|
+
.filter(scene => scene.emotionTags.includes(emotionTag))
|
|
372
|
+
.sort((a, b) => a.order - b.order);
|
|
373
|
+
} catch (error) {
|
|
374
|
+
console.error('Failed to get scenes by emotion:', error);
|
|
375
|
+
return [];
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export function getAllEmotionTags(): { tag: string; count: number }[] {
|
|
380
|
+
try {
|
|
381
|
+
const memory = loadMemory();
|
|
382
|
+
const tagCounts = new Map<string, number>();
|
|
383
|
+
|
|
384
|
+
memory.scenes.forEach(scene => {
|
|
385
|
+
scene.emotionTags.forEach(tag => {
|
|
386
|
+
tagCounts.set(tag, (tagCounts.get(tag) || 0) + 1);
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
return Array.from(tagCounts.entries())
|
|
391
|
+
.map(([tag, count]) => ({ tag, count }))
|
|
392
|
+
.sort((a, b) => b.count - a.count);
|
|
393
|
+
} catch (error) {
|
|
394
|
+
console.error('Failed to get all emotion tags:', error);
|
|
395
|
+
return [];
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// === Scene Organization ===
|
|
400
|
+
|
|
401
|
+
export function reorderScenes(sceneIds: string[]): boolean {
|
|
402
|
+
try {
|
|
403
|
+
const memory = loadMemory();
|
|
404
|
+
|
|
405
|
+
if (sceneIds.length !== memory.scenes.length) {
|
|
406
|
+
console.error('Scene IDs length does not match scenes length');
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// Validate all IDs exist
|
|
411
|
+
const sceneMap = new Map(memory.scenes.map(s => [s.id, s]));
|
|
412
|
+
for (const id of sceneIds) {
|
|
413
|
+
if (!sceneMap.has(id)) {
|
|
414
|
+
console.error(`Scene not found: ${id}`);
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Reorder scenes
|
|
420
|
+
memory.scenes = sceneIds.map(id => sceneMap.get(id)!);
|
|
421
|
+
memory.scenes.forEach((scene, idx) => {
|
|
422
|
+
scene.order = idx;
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
saveMemory(memory);
|
|
426
|
+
return true;
|
|
427
|
+
} catch (error) {
|
|
428
|
+
console.error('Failed to reorder scenes:', error);
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export function getSceneFlow(): SceneFlowEntry[] {
|
|
434
|
+
try {
|
|
435
|
+
const memory = loadMemory();
|
|
436
|
+
|
|
437
|
+
return memory.scenes
|
|
438
|
+
.sort((a, b) => a.order - b.order)
|
|
439
|
+
.map(scene => ({
|
|
440
|
+
order: scene.order + 1, // 1-indexed for display
|
|
441
|
+
title: scene.title,
|
|
442
|
+
chapter: scene.chapter,
|
|
443
|
+
primaryEmotion: scene.emotionTags[0] || "감정 미설정",
|
|
444
|
+
characters: scene.characters,
|
|
445
|
+
cutCount: scene.cuts.length
|
|
446
|
+
}));
|
|
447
|
+
} catch (error) {
|
|
448
|
+
console.error('Failed to get scene flow:', error);
|
|
449
|
+
return [];
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// === Scene Profile Generation ===
|
|
454
|
+
|
|
455
|
+
export function generateSceneProfile(sceneId: string): string {
|
|
456
|
+
try {
|
|
457
|
+
const scene = getScene(sceneId);
|
|
458
|
+
|
|
459
|
+
if (!scene) {
|
|
460
|
+
return `# 오류: 장면을 찾을 수 없습니다 (${sceneId})`;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
let profile = `# 장면: ${scene.title}\n\n`;
|
|
464
|
+
|
|
465
|
+
if (scene.chapter) {
|
|
466
|
+
profile += `**챕터**: ${scene.chapter}\n`;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (scene.characters.length > 0) {
|
|
470
|
+
profile += `**등장인물**: ${scene.characters.join(', ')}\n`;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
if (scene.emotionTags.length > 0) {
|
|
474
|
+
profile += `**감정 태그**: ${scene.emotionTags.join(', ')}\n`;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (scene.narrationTone) {
|
|
478
|
+
profile += `**내레이션 톤**: ${scene.narrationTone}\n`;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
if (scene.notes) {
|
|
482
|
+
profile += `\n**노트**: ${scene.notes}\n`;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
profile += `\n## 컷 구성\n\n`;
|
|
486
|
+
|
|
487
|
+
if (scene.cuts.length === 0) {
|
|
488
|
+
profile += `*(컷이 아직 추가되지 않았습니다)*\n`;
|
|
489
|
+
} else {
|
|
490
|
+
scene.cuts.forEach(cut => {
|
|
491
|
+
const typeLabel = CUT_TYPE_LABELS[cut.type] || cut.type;
|
|
492
|
+
const charPart = cut.character ? `/${cut.character}` : '';
|
|
493
|
+
const emotionPart = cut.emotionTag ? ` (감정: ${cut.emotionTag})` : '';
|
|
494
|
+
|
|
495
|
+
profile += `${cut.order + 1}. [${typeLabel}${charPart}] ${cut.content}${emotionPart}\n`;
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
return profile;
|
|
500
|
+
} catch (error) {
|
|
501
|
+
console.error('Failed to generate scene profile:', error);
|
|
502
|
+
return `# 오류: 장면 프로필 생성 실패`;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export function generateSceneList(): string {
|
|
507
|
+
try {
|
|
508
|
+
const memory = loadMemory();
|
|
509
|
+
|
|
510
|
+
let list = `## 전체 장면 목록\n\n`;
|
|
511
|
+
list += `| # | 제목 | 챕터 | 감정 | 등장인물 | 컷 수 |\n`;
|
|
512
|
+
list += `|---|------|------|------|---------|-------|\n`;
|
|
513
|
+
|
|
514
|
+
if (memory.scenes.length === 0) {
|
|
515
|
+
list += `| - | *(장면이 아직 추가되지 않았습니다)* | - | - | - | - |\n`;
|
|
516
|
+
return list;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
const sortedScenes = [...memory.scenes].sort((a, b) => a.order - b.order);
|
|
520
|
+
|
|
521
|
+
sortedScenes.forEach(scene => {
|
|
522
|
+
const sceneNum = scene.order + 1;
|
|
523
|
+
const title = scene.title;
|
|
524
|
+
const chapter = scene.chapter || '-';
|
|
525
|
+
const emotions = scene.emotionTags.length > 0
|
|
526
|
+
? scene.emotionTags.join(', ')
|
|
527
|
+
: '-';
|
|
528
|
+
const characters = scene.characters.length > 0
|
|
529
|
+
? scene.characters.join(', ')
|
|
530
|
+
: '-';
|
|
531
|
+
const cutCount = scene.cuts.length;
|
|
532
|
+
|
|
533
|
+
list += `| ${sceneNum} | ${title} | ${chapter} | ${emotions} | ${characters} | ${cutCount} |\n`;
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
return list;
|
|
537
|
+
} catch (error) {
|
|
538
|
+
console.error('Failed to generate scene list:', error);
|
|
539
|
+
return `## 오류: 장면 목록 생성 실패`;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// Export emotion vocabulary for external use
|
|
544
|
+
export { EMOTION_VOCABULARY, CUT_TYPE_LABELS };
|