@codeyam/codeyam-cli 0.1.0-staging.a890816 → 0.1.0-staging.ae0de75

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 (106) hide show
  1. package/analyzer-template/.build-info.json +6 -6
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +6 -6
  4. package/analyzer-template/packages/ai/package.json +1 -1
  5. package/analyzer-template/packages/aws/package.json +1 -1
  6. package/analyzer-template/packages/database/package.json +3 -3
  7. package/analyzer-template/packages/github/package.json +1 -1
  8. package/codeyam-cli/src/commands/editor.js +892 -90
  9. package/codeyam-cli/src/commands/editor.js.map +1 -1
  10. package/codeyam-cli/src/commands/init.js +6 -1
  11. package/codeyam-cli/src/commands/init.js.map +1 -1
  12. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +246 -0
  13. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  14. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +126 -0
  15. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  16. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +295 -0
  17. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  18. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  19. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  20. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +100 -0
  21. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  22. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +147 -0
  23. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  24. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +76 -0
  25. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  26. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  27. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  28. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  29. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  30. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  31. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  32. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  33. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  34. package/codeyam-cli/src/utils/editorAudit.js +82 -0
  35. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  36. package/codeyam-cli/src/utils/editorDevServer.js +98 -0
  37. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  38. package/codeyam-cli/src/utils/editorJournal.js +137 -0
  39. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  40. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  41. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  42. package/codeyam-cli/src/utils/editorPreloadHelpers.js +64 -0
  43. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  44. package/codeyam-cli/src/utils/editorPreview.js +66 -0
  45. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  46. package/codeyam-cli/src/utils/editorScenarios.js +56 -0
  47. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  48. package/codeyam-cli/src/utils/git.js +51 -0
  49. package/codeyam-cli/src/utils/git.js.map +1 -1
  50. package/codeyam-cli/src/utils/install-skills.js +28 -17
  51. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  52. package/codeyam-cli/src/utils/project.js +15 -5
  53. package/codeyam-cli/src/utils/project.js.map +1 -1
  54. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  55. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  56. package/codeyam-cli/src/utils/testRunner.js +1 -1
  57. package/codeyam-cli/src/utils/testRunner.js.map +1 -1
  58. package/codeyam-cli/src/webserver/build/client/assets/Terminal-wkqC0AQk.js +41 -0
  59. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  60. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  61. package/codeyam-cli/src/webserver/build/client/assets/editor-CdjF_fX6.js +8 -0
  62. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D8ILZMR0.js +6 -0
  63. package/codeyam-cli/src/webserver/build/client/assets/globals-B17TBSS6.css +1 -0
  64. package/codeyam-cli/src/webserver/build/client/assets/manifest-b8fd6b07.js +1 -0
  65. package/codeyam-cli/src/webserver/build/client/assets/{root-DiRdBreB.js → root-DUKqhFlb.js} +7 -7
  66. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  67. package/codeyam-cli/src/webserver/build/server/assets/{index-BzAbACSx.js → index-BLhjL9Xi.js} +1 -1
  68. package/codeyam-cli/src/webserver/build/server/assets/server-build-DyMuI5mU.js +363 -0
  69. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  70. package/codeyam-cli/src/webserver/build-info.json +5 -5
  71. package/codeyam-cli/src/webserver/editorProxy.js +182 -14
  72. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  73. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +175 -0
  74. package/codeyam-cli/src/webserver/server.js +61 -12
  75. package/codeyam-cli/src/webserver/server.js.map +1 -1
  76. package/codeyam-cli/src/webserver/terminalServer.js +29 -103
  77. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  78. package/codeyam-cli/templates/editor-step-hook.py +6 -4
  79. package/codeyam-cli/templates/{codeyam-dev-mode.md → skills/codeyam-dev-mode/SKILL.md} +1 -1
  80. package/codeyam-cli/templates/{codeyam-editor.md → skills/codeyam-editor/SKILL.md} +5 -4
  81. package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
  82. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  83. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.sh +108 -0
  84. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.sh +69 -0
  85. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  86. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  87. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.sh +12 -0
  88. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter.jq +45 -0
  89. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.sh +139 -0
  90. package/package.json +2 -2
  91. package/scripts/npm-post-install.cjs +12 -0
  92. package/codeyam-cli/src/webserver/build/client/assets/Terminal-CcG8YTLx.js +0 -41
  93. package/codeyam-cli/src/webserver/build/client/assets/editor-W_IGJ2Kd.js +0 -7
  94. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D6SEzMCu.js +0 -6
  95. package/codeyam-cli/src/webserver/build/client/assets/globals-BZB_H1w2.css +0 -1
  96. package/codeyam-cli/src/webserver/build/client/assets/manifest-8daa4147.js +0 -1
  97. package/codeyam-cli/src/webserver/build/client/assets/xterm-DMSzMhqy.js +0 -9
  98. package/codeyam-cli/src/webserver/build/server/assets/server-build-OdUocH6P.js +0 -362
  99. package/scripts/finalize-analyzer.cjs +0 -13
  100. /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
  101. /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
  102. /package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -0
  103. /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
  104. /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
  105. /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
  106. /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../../../../src/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOzC;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,QAAiB;IAC7C,MAAM,UAAU,GAAG,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAE7C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,wBAAwB,EAAE;YAChD,GAAG,EAAE,UAAU;YACf,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;SAClC,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,MAAM;aACjB,IAAI,EAAE;aACN,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAErC,sDAAsD;QACtD,8CAA8C;QAC9C,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAEtE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QACpC,CAAC;QAED,0CAA0C;QAC1C,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACxC,iCAAiC;YACjC,8DAA8D;YAC9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AAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,OAAO,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,GAAW;IAC9D,IAAI,CAAC;QACH,QAAQ,CAAC,mBAAmB,GAAG,EAAE,EAAE;YACjC,GAAG,EAAE,QAAQ;YACb,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CACtB,QAAgB,EAChB,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,qBAAqB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE;YACtE,GAAG,EAAE,QAAQ;YACb,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB,EAAE,GAAW;IACvD,QAAQ,CAAC,gBAAgB,GAAG,EAAE,EAAE;QAC9B,GAAG,EAAE,QAAQ;QACb,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,MAAM;KACd,CAAC,CAAC;AACL,CAAC"}
@@ -3,24 +3,40 @@ import * as path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
  const __filename = fileURLToPath(import.meta.url);
5
5
  const __dirname = path.dirname(__filename);
6
+ async function copyDirRecursive(src, dest) {
7
+ await fs.mkdir(dest, { recursive: true });
8
+ const entries = await fs.readdir(src, { withFileTypes: true });
9
+ for (const entry of entries) {
10
+ const srcPath = path.join(src, entry.name);
11
+ const destPath = path.join(dest, entry.name);
12
+ if (entry.isDirectory()) {
13
+ await copyDirRecursive(srcPath, destPath);
14
+ }
15
+ else {
16
+ await fs.copyFile(srcPath, destPath);
17
+ if (entry.name.endsWith('.sh')) {
18
+ await fs.chmod(destPath, 0o755);
19
+ }
20
+ }
21
+ }
22
+ }
6
23
  export async function installClaudeCodeSkills(projectRoot, options) {
7
24
  const mode = options?.mode ?? 'memory';
8
25
  try {
9
26
  const skillsDir = path.join(projectRoot, '.claude', 'skills');
10
27
  const templatesDir = path.join(__dirname, '../../templates');
28
+ const skillsTemplateDir = path.join(templatesDir, 'skills');
29
+ const commandsTemplateDir = path.join(templatesDir, 'commands');
11
30
  // Memory skills — always installed
12
31
  const memorySkillDir = path.join(skillsDir, 'codeyam-memory');
13
32
  const newRuleSkillDir = path.join(skillsDir, 'codeyam-new-rule');
14
- await fs.mkdir(memorySkillDir, { recursive: true });
15
- await fs.mkdir(newRuleSkillDir, { recursive: true });
16
- await fs.copyFile(path.join(templatesDir, 'codeyam-memory.md'), path.join(memorySkillDir, 'SKILL.md'));
17
- await fs.copyFile(path.join(templatesDir, 'codeyam-new-rule.md'), path.join(newRuleSkillDir, 'SKILL.md'));
33
+ await copyDirRecursive(path.join(skillsTemplateDir, 'codeyam-memory'), memorySkillDir);
34
+ await copyDirRecursive(path.join(skillsTemplateDir, 'codeyam-new-rule'), newRuleSkillDir);
18
35
  // Editor skill — in editor mode (either explicit mode or editorMode flag)
19
36
  const isEditorMode = mode === 'editor' || options?.editorMode === true;
20
37
  if (isEditorMode) {
21
38
  const editorSkillDir = path.join(skillsDir, 'codeyam-editor');
22
- await fs.mkdir(editorSkillDir, { recursive: true });
23
- await fs.copyFile(path.join(templatesDir, 'codeyam-editor.md'), path.join(editorSkillDir, 'SKILL.md'));
39
+ await copyDirRecursive(path.join(skillsTemplateDir, 'codeyam-editor'), editorSkillDir);
24
40
  // CLAUDE.md for editor projects — guides Claude to build with scenarios
25
41
  const claudeMdPath = path.join(projectRoot, 'CLAUDE.md');
26
42
  try {
@@ -39,20 +55,15 @@ export async function installClaudeCodeSkills(projectRoot, options) {
39
55
  const testSkillDir = path.join(skillsDir, 'codeyam-test');
40
56
  const verifySkillDir = path.join(skillsDir, 'codeyam-verify');
41
57
  const devModeSkillDir = path.join(skillsDir, 'codeyam-dev-mode');
42
- await fs.mkdir(setupSkillDir, { recursive: true });
43
- await fs.mkdir(simSkillDir, { recursive: true });
44
- await fs.mkdir(testSkillDir, { recursive: true });
45
- await fs.mkdir(verifySkillDir, { recursive: true });
46
- await fs.mkdir(devModeSkillDir, { recursive: true });
47
- await fs.copyFile(path.join(templatesDir, 'codeyam-setup.md'), path.join(setupSkillDir, 'SKILL.md'));
48
- await fs.copyFile(path.join(templatesDir, 'codeyam-sim.md'), path.join(simSkillDir, 'SKILL.md'));
49
- await fs.copyFile(path.join(templatesDir, 'codeyam-test.md'), path.join(testSkillDir, 'SKILL.md'));
50
- await fs.copyFile(path.join(templatesDir, 'codeyam-verify.md'), path.join(verifySkillDir, 'SKILL.md'));
51
- await fs.copyFile(path.join(templatesDir, 'codeyam-dev-mode.md'), path.join(devModeSkillDir, 'SKILL.md'));
58
+ await copyDirRecursive(path.join(skillsTemplateDir, 'codeyam-setup'), setupSkillDir);
59
+ await copyDirRecursive(path.join(skillsTemplateDir, 'codeyam-sim'), simSkillDir);
60
+ await copyDirRecursive(path.join(skillsTemplateDir, 'codeyam-test'), testSkillDir);
61
+ await copyDirRecursive(path.join(skillsTemplateDir, 'codeyam-verify'), verifySkillDir);
62
+ await copyDirRecursive(path.join(skillsTemplateDir, 'codeyam-dev-mode'), devModeSkillDir);
52
63
  // Diagnose command — only in full mode
53
64
  const commandsDir = path.join(projectRoot, '.claude', 'commands');
54
65
  await fs.mkdir(commandsDir, { recursive: true });
55
- await fs.copyFile(path.join(templatesDir, 'codeyam-diagnose.md'), path.join(commandsDir, 'codeyam-diagnose.md'));
66
+ await fs.copyFile(path.join(commandsTemplateDir, 'codeyam-diagnose.md'), path.join(commandsDir, 'codeyam-diagnose.md'));
56
67
  }
57
68
  // Helper scripts and hooks — always installed
58
69
  const binDir = path.join(projectRoot, '.codeyam', 'bin');
@@ -1 +1 @@
1
- {"version":3,"file":"install-skills.js","sourceRoot":"","sources":["../../../../src/utils/install-skills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAO3C,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,WAAmB,EACnB,OAA8B;IAE9B,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,QAAQ,CAAC;IAEvC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC9D,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;QAE7D,mCAAmC;QACnC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;QAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;QACjE,MAAM,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,EAAE,CAAC,K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AAI,EAAE,CAAC,CAAC;YACpD,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;YACzE,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;gBAC/B,MAAM,EAAE,CAAC,QAAQ,CACf,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,IAAI,CAAC,EACxC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAChC,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,gCAAgC;QAClC,CAAC;QAED,qBAAqB;QACrB,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,QAAQ,CACf,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,uBAAuB,CAAC,EAChD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CACvC,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,8DAA8D;QAChE,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC;SAClD,CAAC;IACJ,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACxD,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,9 +1,22 @@
1
1
  import * as fs from 'fs';
2
+ import * as os from 'os';
2
3
  import * as path from 'path';
4
+ export function isForbiddenProjectRoot(dir) {
5
+ const normalized = path.resolve(dir);
6
+ const root = path.parse(normalized).root;
7
+ if (normalized === root)
8
+ return true;
9
+ if (normalized === path.resolve(os.homedir()))
10
+ return true;
11
+ return false;
12
+ }
3
13
  /**
4
14
  * Find the root directory of a CodeYam project by walking up the directory tree
5
15
  * looking for .codeyam/config.json, similar to how git finds .git directories.
6
16
  *
17
+ * Stops before checking the user's home directory or the filesystem root —
18
+ * these are never valid project roots.
19
+ *
7
20
  * @param startDir - Directory to start searching from (defaults to process.cwd())
8
21
  * @returns Project root path if found, null otherwise
9
22
  */
@@ -11,17 +24,14 @@ export function findProjectRoot(startDir = process.cwd()) {
11
24
  let currentDir = path.resolve(startDir);
12
25
  const root = path.parse(currentDir).root;
13
26
  while (currentDir !== root) {
27
+ if (isForbiddenProjectRoot(currentDir))
28
+ return null;
14
29
  const configPath = path.join(currentDir, '.codeyam', 'config.json');
15
30
  if (fs.existsSync(configPath)) {
16
31
  return currentDir;
17
32
  }
18
33
  currentDir = path.dirname(currentDir);
19
34
  }
20
- // Check root directory as well
21
- const configPath = path.join(root, '.codeyam', 'config.json');
22
- if (fs.existsSync(configPath)) {
23
- return root;
24
- }
25
35
  return null;
26
36
  }
27
37
  //# sourceMappingURL=project.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../../../../src/utils/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,WAAmB,OAAO,CAAC,GAAG,EAAE;IAEhC,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;IAEzC,OAAO,UAAU,KAAK,IAAI,EAAE,CAAC;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;QAEpE,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OA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AAI,CAAC;QAEpD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;QACpE,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Pure logic for transforming {{scenario:Name:ID}} markers into OSC 8
3
+ * clickable hyperlinks in terminal output.
4
+ *
5
+ * Extracted from terminalServer.ts for testability. Zero side-effects.
6
+ *
7
+ * Claude Code's renderer inserts ANSI escape codes (colors/styles) within the
8
+ * marker text, so we can't regex-match on raw PTY data directly. Instead,
9
+ * strip ANSI codes to find markers, then map positions back to the original
10
+ * string for replacement.
11
+ */
12
+ // Matches CSI sequences: \x1b[ followed by params and a letter.
13
+ // Also handles private-mode params (?) and colon-delimited SGR (e.g., 38:2:R:G:B).
14
+ const ANSI_ESCAPE_RE = /\x1b\[[?]?[0-9;:]*[a-zA-Z]/g;
15
+ // Additional non-CSI escapes: charset selection (\x1b(B), save/restore cursor, etc.
16
+ const OTHER_ESCAPE_RE = /\x1b[()][A-Z0-9]/g;
17
+ /**
18
+ * Strip all ANSI escape sequences from a string.
19
+ */
20
+ function stripAnsi(data) {
21
+ return data.replace(ANSI_ESCAPE_RE, '').replace(OTHER_ESCAPE_RE, '');
22
+ }
23
+ /**
24
+ * Build a position map from ANSI-stripped indices to original indices.
25
+ * posMap[strippedIndex] = originalIndex, skipping over ANSI sequences.
26
+ */
27
+ function buildAnsiPositionMap(data, stripped) {
28
+ const posMap = [];
29
+ for (let di = 0, si = 0; di < data.length; di++) {
30
+ if (data[di] === '\x1b') {
31
+ // Try CSI sequence (with optional ? for private mode, : for colon-delimited SGR)
32
+ const seqMatch = data.slice(di).match(/^\x1b\[?\??[0-9;:]*[a-zA-Z]/);
33
+ if (seqMatch) {
34
+ di += seqMatch[0].length - 1;
35
+ continue;
36
+ }
37
+ // Try charset selection: \x1b(B, \x1b)0, etc.
38
+ const charsetMatch = data.slice(di).match(/^\x1b[()][A-Z0-9]/);
39
+ if (charsetMatch) {
40
+ di += charsetMatch[0].length - 1;
41
+ continue;
42
+ }
43
+ }
44
+ posMap[si] = di;
45
+ si++;
46
+ }
47
+ posMap[stripped.length] = data.length; // sentinel for end-of-string markers
48
+ return posMap;
49
+ }
50
+ const MARKER_RE = /\{\{scenario:([^:}]+):([^}]+)\}\}/g;
51
+ /**
52
+ * Transform {{scenario:Name:ID}} markers into OSC 8 hyperlinks.
53
+ * OSC 8 format: \x1b]8;;URL\x07VISIBLE_TEXT\x1b]8;;\x07
54
+ *
55
+ * Stateless — operates on a single string. For streaming PTY data,
56
+ * use createMarkerTransformer() which buffers partial markers.
57
+ */
58
+ export function transformScenarioMarkers(data, port) {
59
+ const stripped = stripAnsi(data);
60
+ if (!stripped.includes('{{scenario:'))
61
+ return data;
62
+ const posMap = buildAnsiPositionMap(data, stripped);
63
+ const replacements = [];
64
+ let m;
65
+ while ((m = MARKER_RE.exec(stripped)) !== null) {
66
+ const url = `http://localhost:${port}/editor?scenario=${m[2]}&ref=link`;
67
+ const visibleName = m[1];
68
+ // Pad replacement to match the original marker's visible width so table
69
+ // columns stay aligned after the shorter hyperlink text replaces the marker.
70
+ const pad = ' '.repeat(Math.max(0, m[0].length - visibleName.length));
71
+ replacements.push({
72
+ origStart: posMap[m.index],
73
+ origEnd: posMap[m.index + m[0].length],
74
+ replacement: `\x1b]8;;${url}\x07${visibleName}\x1b]8;;\x07${pad}`,
75
+ });
76
+ }
77
+ if (replacements.length === 0)
78
+ return data;
79
+ // Replace from end to start so earlier positions stay valid
80
+ let result = data;
81
+ for (let i = replacements.length - 1; i >= 0; i--) {
82
+ const r = replacements[i];
83
+ result =
84
+ result.slice(0, r.origStart) + r.replacement + result.slice(r.origEnd);
85
+ }
86
+ return result;
87
+ }
88
+ /**
89
+ * Create a stateful scenario marker transformer that buffers partial markers
90
+ * across PTY chunks. Claude Code streams output token by token, so the PTY
91
+ * can split a {{scenario:Name:ID}} marker across two (or more) data events.
92
+ *
93
+ * Also handles Ink-style line rewrites where \r (carriage return) invalidates
94
+ * buffered content from the same line.
95
+ */
96
+ export function createMarkerTransformer(port) {
97
+ let buffer = '';
98
+ return function transform(data) {
99
+ // If the incoming data contains \r (carriage return), Ink is rewriting
100
+ // the current line. Any buffered partial marker from that line is stale —
101
+ // discard it so the new content isn't confused with old fragments.
102
+ // The buffer only ever holds content after an unclosed {{ (i.e., a partial
103
+ // marker on the current line), so discarding it is always safe when the
104
+ // line is being rewritten.
105
+ if (buffer && data.includes('\r')) {
106
+ buffer = '';
107
+ return transform(data);
108
+ }
109
+ // Prepend any buffered partial-marker text from the previous chunk
110
+ const combined = buffer + data;
111
+ buffer = '';
112
+ // Strip ANSI to detect partial markers at the end
113
+ const stripped = stripAnsi(combined);
114
+ // Check for an unclosed {{ at the end — potential partial marker
115
+ const lastOpen = stripped.lastIndexOf('{{');
116
+ if (lastOpen !== -1 && !stripped.slice(lastOpen).includes('}}')) {
117
+ // Map the stripped position back to the original string
118
+ const posMap = buildAnsiPositionMap(combined, stripped);
119
+ const splitPos = posMap[lastOpen];
120
+ // Safety: if partial marker exceeds 500 chars, it's not a real marker — flush it
121
+ if (combined.length - splitPos > 500) {
122
+ return transformScenarioMarkers(combined, port);
123
+ }
124
+ buffer = combined.slice(splitPos);
125
+ const toSend = combined.slice(0, splitPos);
126
+ // If nothing to send yet (entire chunk is a partial marker), return empty
127
+ if (toSend.length === 0)
128
+ return '';
129
+ return transformScenarioMarkers(toSend, port);
130
+ }
131
+ return transformScenarioMarkers(combined, port);
132
+ };
133
+ }
134
+ //# sourceMappingURL=scenarioMarkers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenarioMarkers.js","sourceRoot":"","sources":["../../../../src/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oB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACxD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;YAElC,iFAAiF;YACjF,IAAI,QAAQ,CAAC,MAAM,GAAG,QAAQ,GAAG,GAAG,EAAE,CAAC;gBACrC,OAAO,wBAAwB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAClD,CAAC;YAED,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;YAC3C,0EAA0E;YAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;YACnC,OAAO,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,wBAAwB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC"}
@@ -104,7 +104,7 @@ export async function runTestFile(projectRoot, testFilePath) {
104
104
  '--json',
105
105
  '--outputFile',
106
106
  tmpPath,
107
- '--testPathPattern',
107
+ '--testPathPatterns',
108
108
  testFilePath,
109
109
  ];
110
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"testRunner.js","sourceRoot":"","sources":["../../../../src/utils/testRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAiBzB;;GAEG;AACH,SAAS,gBAAgB,CAAC,WAAmB;IAC3C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACvD,MAAM,GAAG,GAAG,IAAI,C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C,OAAO,EAAE,MAAM,CAAC,CAAC;gBACpD,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBACvB,OAAO,CAAC,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;YACrD,CAAC;YAAC,MAAM,CAAC;gBACP,mDAAmD;gBACnD,OAAO,CAAC;oBACN,YAAY;oBACZ,MAAM,EAAE,OAAO;oBACf,SAAS,EAAE,EAAE;oBACb,YAAY,EACV,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;wBAC3B,sCAAsC;iBACzC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACxB,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,CAAC;gBACN,YAAY;gBACZ,MAAM,EAAE,OAAO;gBACf,SAAS,EAAE,EAAE;gBACb,YAAY,EAAE,gCAAgC,GAAG,CAAC,OAAO,EAAE;aAC5D,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,41 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/addon-fit-CUXOrorO.js","assets/chunk-JZWAC4HX-C4pqxYJB.js","assets/addon-web-links-Duc5hnl7.js"])))=>i.map(i=>d[i]);
2
+ import{r as n,j as r}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{_ as H}from"./preload-helper-ckwbz45p.js";function ee({serverUrl:f,isStarting:A,projectSlug:w,devServerError:R,onStartServer:g}){const[y,b]=n.useState(null),u=n.useRef(null);n.useEffect(()=>{if(!w)return;const _=new EventSource("/api/dev-mode-events");return _.onmessage=E=>{try{const S=JSON.parse(E.data);S.type==="file-synced"&&(b(S.fileName),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{b(null)},5e3))}catch{}},()=>{_.close(),u.current&&clearTimeout(u.current)}},[w]);let a;R?a="error":A?a="starting":f?a="running":a="stopped";const v={starting:"bg-yellow-400",running:"bg-green-400",stopped:"bg-gray-400",error:"bg-red-400"},N={starting:"Starting...",running:f||"Running",stopped:"Stopped",error:"Error"};return r.jsxs("div",{className:"bg-[#1e1e1e] border-t border-[#3d3d3d] h-7 flex items-center px-4 gap-4 shrink-0 text-xs font-mono",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-2 h-2 rounded-full ${v[a]}`}),r.jsxs("span",{className:"text-gray-400",children:["Server:"," ",r.jsx("span",{className:"text-gray-300",children:N[a]})]}),(a==="stopped"||a==="error")&&g&&r.jsx("button",{onClick:g,className:"ml-1 px-2.5 py-0.5 bg-[#005c75] hover:bg-[#007a9a] text-white text-[11px] font-medium rounded transition-colors cursor-pointer border-none leading-tight",children:"Start Server"})]}),r.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"}),y&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4ade80",strokeWidth:"2",children:r.jsx("path",{d:"M20 6L9 17l-5-5"})}),r.jsxs("span",{className:"text-green-400",children:["Synced: ",y]})]}),r.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"})]}),r.jsx("div",{className:"flex-1"}),r.jsx("span",{className:"text-gray-500",children:"Claude edits auto-sync to preview via HMR"})]})}const K=`
3
+ .xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
4
+ .xterm.focus, .xterm:focus { outline: none; }
5
+ .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
6
+ .xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; }
7
+ .xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
8
+ .xterm .composition-view.active { display: block; }
9
+ .xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
10
+ .xterm .xterm-screen { position: relative; }
11
+ .xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
12
+ .xterm .xterm-scroll-area { visibility: hidden; }
13
+ .xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
14
+ .xterm.enable-mouse-events { cursor: default; }
15
+ .xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
16
+ .xterm.column-select.focus { cursor: crosshair; }
17
+ .xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
18
+ .xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
19
+ .xterm .xterm-accessibility-tree { user-select: text; white-space: pre; }
20
+ .xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
21
+ .xterm-dim { opacity: 1 !important; }
22
+ .xterm-underline-1 { text-decoration: underline; }
23
+ .xterm-underline-2 { text-decoration: double underline; }
24
+ .xterm-underline-3 { text-decoration: wavy underline; }
25
+ .xterm-underline-4 { text-decoration: dotted underline; }
26
+ .xterm-underline-5 { text-decoration: dashed underline; }
27
+ .xterm-overline { text-decoration: overline; }
28
+ .xterm-strikethrough { text-decoration: line-through; }
29
+ .xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
30
+ .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
31
+ .xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
32
+ .xterm-decoration-top { z-index: 2; position: relative; }
33
+ `;function Q(){if(document.getElementById("xterm-css"))return;const f=document.createElement("style");f.id="xterm-css",f.textContent=K,document.head.appendChild(f)}const te=n.forwardRef(function({entityName:A,entityType:w,entitySha:R,entityFilePath:g,scenarioName:y,scenarioDescription:b,analysisId:u,projectSlug:a,onRefreshPreview:v,onShowResults:N,editorMode:_,onIdleChange:E,notificationsEnabled:S},I){const M=n.useRef(null),T=n.useRef(null),j=n.useRef(null),h=n.useRef(null),B=n.useRef(null),C=n.useRef(!1),O=n.useRef(0),L=n.useRef(!1),x=n.useRef(E);x.current=E;const W=n.useRef(S);W.current=S;const $=n.useCallback(()=>{var o;(o=j.current)==null||o.focus()},[]);return n.useImperativeHandle(I,()=>({sendInput(o){const l=h.current;l&&l.readyState===WebSocket.OPEN&&(l.send(JSON.stringify({type:"input",data:o})),setTimeout(()=>{l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:"input",data:"\r"}))},100))},focus(){var o;(o=j.current)==null||o.focus()},scrollToBottom(){var l;const o=(l=M.current)==null?void 0:l.querySelector(".xterm-viewport");o&&(o.scrollTop=o.scrollHeight)}})),n.useEffect(()=>{const o=M.current;if(!o)return;let l=!1;return Q(),Promise.all([H(()=>import("./xterm-BqvuqXEL.js"),[]),H(()=>import("./addon-fit-CUXOrorO.js").then(m=>m.a),__vite__mapDeps([0,1])),H(()=>import("./addon-web-links-Duc5hnl7.js").then(m=>m.a),__vite__mapDeps([2,1]))]).then(([m,U,V])=>{if(l)return;const t=new m.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"},linkHandler:{activate(s,e){try{const i=new URL(e),c=i.searchParams.get("scenario");if(c&&i.pathname==="/editor"){const d=new BroadcastChannel("codeyam-editor");d.postMessage({type:"switch-scenario",scenarioId:c}),d.close();return}}catch{}window.open(e,"_blank")}}}),z=new U.FitAddon;t.loadAddon(z),t.loadAddon(new V.WebLinksAddon),t.open(o),z.fit(),j.current=t,t.focus(),setTimeout(()=>t.focus(),100),setTimeout(()=>t.focus(),500);const q=window.location.protocol==="https:"?"wss:":"ws:",X=window.location.host;function G(s){const e=new URLSearchParams;return e.set("entityName",A),w&&e.set("entityType",w),R&&e.set("entitySha",R),g&&e.set("entityFilePath",g),y&&e.set("scenarioName",y),b&&e.set("scenarioDescription",b),u&&e.set("analysisId",u),a&&e.set("projectSlug",a),_&&e.set("editorMode","true"),s&&e.set("reconnectId",s),`${q}//${X}/ws/terminal?${e.toString()}`}function F(s){const e=G(s),i=new WebSocket(e);h.current=i,i.onopen=()=>{O.current=0,L.current=!1,i.send(JSON.stringify({type:"resize",cols:t.cols,rows:t.rows}))},i.onmessage=c=>{var d,D;try{const p=JSON.parse(c.data);if(p.type==="session-id"){B.current=p.sessionId;return}if(p.type==="refresh-preview"){v==null||v(p.path);return}if(p.type==="show-results"){N==null||N();return}if(p.type==="claude-idle"){if(console.log("[Terminal] Received claude-idle, notifications:",W.current,"permission:",typeof Notification<"u"?Notification.permission:"N/A"),(d=x.current)==null||d.call(x,!0),W.current&&typeof Notification<"u"&&Notification.permission==="granted"){const J=new Notification("Claude is ready for you",{body:"Claude has finished and is waiting for your input.",tag:"claude-idle"});J.onclick=()=>{window.focus(),J.close()}}return}p.type==="output"&&(t.write(p.data),(D=x.current)==null||D.call(x,!1))}catch{t.write(c.data)}},i.onclose=()=>{if(C.current){t.write(`\r
34
+ \x1B[90m[Terminal session ended]\x1B[0m\r
35
+ `);return}const c=O.current;if(c<5&&B.current){const d=1e3*Math.pow(2,Math.min(c,3));O.current=c+1,t.write(`\r
36
+ \x1B[33m[Reconnecting...]\x1B[0m\r
37
+ `),setTimeout(()=>{C.current||F(B.current)},d)}else L.current?t.write(`\r
38
+ \x1B[90m[Terminal session ended]\x1B[0m\r
39
+ `):(L.current=!0,t.write(`\r
40
+ \x1B[33m[Starting new session...]\x1B[0m\r
41
+ `),B.current=null,O.current=0,F())},i.onerror=()=>{}}F(),t.onData(s=>{const e=h.current;e&&e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({type:"input",data:s}))});let k=null;const P=new ResizeObserver(()=>{k&&clearTimeout(k),k=setTimeout(()=>{const s=z.proposeDimensions();if(!s||s.cols===t.cols&&s.rows===t.rows)return;const e=o.querySelector(".xterm-viewport");let i,c=!0;e&&(i=e.scrollTop,c=e.scrollTop+e.clientHeight>=e.scrollHeight-10),z.fit(),e&&i!==void 0&&(c?e.scrollTop=e.scrollHeight:e.scrollTop=i);const d=h.current;d&&d.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"resize",cols:t.cols,rows:t.rows}))},150)});P.observe(o),T.current=()=>{var s;k&&clearTimeout(k),P.disconnect(),C.current=!0,(s=h.current)==null||s.close(),h.current=null,t.dispose(),j.current=null}}),()=>{var m;l=!0,(m=T.current)==null||m.call(T),T.current=null}},[]),r.jsx("div",{ref:M,onClick:$,className:"w-full h-full",style:{padding:"4px 0 0 8px"}})});export{ee as D,te as T};
@@ -0,0 +1,8 @@
1
+ import{r as a,j as e,w as et,u as tt,f as st,b as at}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as nt,V as rt,S as it}from"./useCustomSizes-ByhSyh0W.js";import{T as lt,D as ot}from"./Terminal-wkqC0AQk.js";import{c as ct}from"./cy-logo-cli-DcX-ZS3p.js";import{S as Pe,u as dt}from"./Spinner-Bb5uFQ5V.js";import"./preload-helper-ckwbz45p.js";import"./useLastLogLine-C14nCb1q.js";function $e(r){const[s,i]=a.useState(null),[l,u]=a.useState(!1),N=a.useCallback(()=>{r&&(u(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(r)}`).then(v=>v.json()).then(v=>{i(v),u(!1)}).catch(()=>{i({testFilePath:r,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),u(!1)}))},[r]);return a.useEffect(()=>{r&&N()},[r,N]),{results:s,isRunning:l,runTests:N}}function Y({imgSrc:r,name:s,isActive:i,onSelect:l}){return e.jsxs("button",{onClick:l,className:"flex flex-col items-center gap-1 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${i?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:r?e.jsx("img",{src:r,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-32 ${i?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function me({testFile:r,entityName:s}){const{results:i,isRunning:l,runTests:u}=$e(r);if(l&&!i)return e.jsxs("div",{className:"px-2 pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!i)return null;if(i.status==="error")return e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:i.errorMessage})});const N=s?i.testCases.filter(h=>{const f=`${s} > `;return h.fullName.startsWith(f)||h.fullName===s}):i.testCases;if(N.length===0)return null;const v=s?`${s} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[N.map(h=>{var o;const f=v&&h.fullName.startsWith(v)?h.fullName.slice(v.length):h.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[h.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):h.status==="failed"?e.jsx("span",{className:"text-red-400 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-500 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${h.status==="passed"?"text-green-400":h.status==="failed"?"text-red-400":"text-gray-500"}`,children:f})]}),h.status==="failed"&&((o=h.failureMessages)==null?void 0:o.map((p,b)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:p,children:p.split(`
2
+ `)[0]},b)))]},h.fullName)}),e.jsx("button",{onClick:u,disabled:l,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#00c4ee] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:l?"Running...":"Re-run"})]})}function V({filePath:r,projectRoot:s}){if(!r)return null;const l=`vscode://file/${s?`${s}/${r}`:r}`;return e.jsxs("div",{className:"flex items-center gap-1 px-2 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:r}),e.jsx("a",{href:l,title:"Open in editor",className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function xt({scenarios:r,projectRoot:s,activeScenarioId:i,onScenarioSelect:l,zoomComponent:u,onZoomChange:N,analyzedEntities:v=[],glossaryFunctions:h=[],activeAnalyzedScenarioId:f,onAnalyzedScenarioSelect:o,entityImports:p}){const{appScenarios:b,componentGroups:k}=a.useMemo(()=>{const t=[],m=new Map;for(const y of r)if(y.componentName){const I=m.get(y.componentName)||[];I.push(y),m.set(y.componentName,I)}else t.push(y);const j=new Map([...m.entries()].sort(([y],[I])=>y.localeCompare(I)));return{appScenarios:t,componentGroups:j}},[r]),g=a.useMemo(()=>{const t=new Set((v||[]).filter(j=>j.entityType==="visual").map(j=>j.name)),m=new Map;for(const[j,y]of k)t.has(j)||m.set(j,y);return m},[k,v]),{visualEntities:E,libraryEntities:M}=a.useMemo(()=>{const t=v.filter(j=>j.entityType==="visual").sort((j,y)=>j.name.localeCompare(y.name)),m=v.filter(j=>j.entityType==="library"||j.entityType==="functionCall").sort((j,y)=>j.name.localeCompare(y.name));return{visualEntities:t,libraryEntities:m}},[v]),R=a.useMemo(()=>{const t=new Set(M.map(m=>m.name));return h.filter(m=>!t.has(m.name)).sort((m,j)=>m.name.localeCompare(j.name))},[h,M]),z=v.some(t=>t.isAnalyzing),A=a.useRef(null),x=a.useRef(0),C=a.useCallback(()=>{A.current&&(x.current=A.current.scrollTop)},[]);if(a.useEffect(()=>{A.current&&x.current>0&&(A.current.scrollTop=x.current)}),r.length===0&&v.length===0&&R.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No scenarios yet"}),e.jsx("p",{className:"text-xs",children:"Scenarios will appear here as Claude creates them alongside your code. Each scenario represents a different state of your app's data."})]})});if(u){const t=k.get(u)||[],m=new Set((p==null?void 0:p[u])||[]),j=m.size>0,y=j?E.filter(w=>m.has(w.name)):[],I=j?M.filter(w=>m.has(w.name)):[];return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-1",children:[e.jsxs("button",{onClick:()=>N(void 0),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All scenarios"]}),e.jsx("div",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-xs font-semibold text-white uppercase tracking-wider",children:u})}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2",children:t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):t.map(w=>e.jsx(Y,{imgSrc:w.screenshotPath?`/api/editor-scenario-image/${w.id}.png`:null,name:w.name,isActive:w.id===i,onSelect:()=>l(w)},w.id))}),y.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),y.map(w=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center gap-2 px-2 py-1",children:e.jsx("button",{onClick:()=>N(w.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:w.name})}),e.jsx(V,{filePath:w.filePath,projectRoot:s}),(w.scenarios.length>0||w.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:w.scenarios.map(c=>e.jsx(Y,{imgSrc:c.screenshotPath?`/api/screenshot/${c.screenshotPath}`:null,name:c.name,isActive:c.id===f,onSelect:()=>o==null?void 0:o({analysisId:w.analysisId,scenarioId:c.id,scenarioName:c.name,entitySha:w.sha,entityName:w.name})},c.id))})]},w.sha))]}),I.length>0&&e.jsxs("div",{className:"pt-2 mt-1",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),I.map(w=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:w.name})}),e.jsx(V,{filePath:w.filePath,projectRoot:s}),w.testFile&&e.jsx(me,{testFile:w.testFile,entityName:w.name})]},w.sha))]})]})})}return e.jsx("div",{ref:A,onScroll:C,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[b.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),e.jsxs("div",{className:"px-2 pt-1",children:[e.jsx("div",{className:"py-0.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-400",children:"Home"})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:b.map(t=>e.jsx(Y,{imgSrc:t.screenshotPath?`/api/editor-scenario-image/${t.id}.png`:null,name:t.name,isActive:t.id===i&&!f,onSelect:()=>l(t)},t.id))})]})]}),g.size>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),[...g.entries()].map(([t,m])=>{var j;return e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center justify-between px-2 py-1",children:e.jsx("button",{onClick:()=>N(t),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:t})}),((j=m[0])==null?void 0:j.componentPath)&&e.jsx(V,{filePath:m[0].componentPath,projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:m.map(y=>e.jsx(Y,{imgSrc:y.screenshotPath?`/api/editor-scenario-image/${y.id}.png`:null,name:y.name,isActive:y.id===i&&!f,onSelect:()=>l(y)},y.id))})]},t)})]}),E.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),z&&r.length===0&&v.every(t=>t.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),E.map(t=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx("button",{onClick:()=>N(t.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:t.name}),t.isAnalyzing&&t.scenarioCount===0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(V,{filePath:t.filePath,projectRoot:s}),(t.scenarios.length>0||t.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[t.scenarios.map(m=>e.jsx(Y,{imgSrc:m.screenshotPath?`/api/screenshot/${m.screenshotPath}`:null,name:m.name,isActive:m.id===f,onSelect:()=>o==null?void 0:o({analysisId:t.analysisId,scenarioId:m.id,scenarioName:m.name,entitySha:t.sha,entityName:t.name})},m.id)),t.pendingScenarios.map(m=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:m,children:m},m))]})]},t.sha))]}),(M.length>0||R.length>0)&&e.jsxs("div",{className:`pt-2 mt-1 ${E.length>0?"":"border-t border-[#3d3d3d]"}`,children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),M.map(t=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:t.name}),t.isAnalyzing&&t.scenarioCount===0&&e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(V,{filePath:t.filePath,projectRoot:s}),t.testFile?e.jsx(me,{testFile:t.testFile,entityName:t.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},t.sha)),R.map(t=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:t.name})}),e.jsx(V,{filePath:t.filePath,projectRoot:s}),e.jsx(me,{testFile:t.testFile,entityName:t.name})]},t.name))]})]})})}function mt(r){const s=new Map;for(const i of[...r].reverse()){const l=s.get(i.date)||[];l.push(i),s.set(i.date,l)}return s}function ht(r){const s=new Map;for(const i of r){const l=i.name.indexOf(" - "),u=l!==-1?i.name.slice(0,l):"App",N=s.get(u)||[];N.push(i),s.set(u,N)}return[...s.entries()].sort(([i],[l])=>i==="App"?-1:l==="App"?1:i.localeCompare(l))}const pt={feature:{label:"Feature",color:"bg-[#005c75]"},fix:{label:"Fix",color:"bg-amber-700"},refactor:{label:"Refactor",color:"bg-purple-700"},scaffold:{label:"Scaffold",color:"bg-green-700"},data:{label:"Data",color:"bg-blue-700"},milestone:{label:"Milestone",color:"bg-yellow-600"}};function ut(r){try{return new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function ft(r){try{return new Date(r+"T00:00:00").toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}catch{return r}}function gt({isActive:r,onScreenshotClick:s}){const[i,l]=a.useState([]),[u,N]=a.useState(!0),[v,h]=a.useState(new Set),f=a.useCallback(b=>{h(k=>{const g=new Set(k);return g.has(b)?g.delete(b):g.add(b),g})},[]),o=a.useCallback(async()=>{try{const b=await fetch("/api/editor-journal");if(b.ok){const k=await b.json();l(k.entries||[])}}catch{}finally{N(!1)}},[]);if(a.useEffect(()=>{o()},[o]),a.useEffect(()=>{r&&o()},[r,o]),a.useEffect(()=>{const b=new EventSource("/api/events");return b.addEventListener("message",k=>{try{const g=JSON.parse(k.data);g.type==="db-change"&&g.changeType==="journal"&&o()}catch{}}),()=>b.close()},[o]),u)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Loading journal..."})});if(i.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No journal entries yet"}),e.jsx("p",{className:"text-xs",children:"Journal entries will appear as you build. Claude records features, screenshots, and commits as the project evolves."})]})});const p=mt(i);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx("div",{className:"p-3 space-y-4",children:[...p.entries()].map(([b,k])=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1.5 sticky top-0 bg-[#1e1e1e] z-10",children:e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:ft(b)})}),e.jsx("div",{className:"space-y-2",children:k.map((g,E)=>{const M=pt[g.type]||{label:g.type,color:"bg-gray-600"},R=`${g.time}-${E}`,z=v.has(R);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:`p-3 space-y-2 ${z?"":"max-h-[300px] overflow-y-auto"}`,children:[e.jsx("div",{className:"flex items-start gap-2",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-white truncate",children:g.title}),e.jsx("span",{className:`${M.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:M.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:ut(g.time)})]})}),e.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:g.description}),g.screenshot&&e.jsx("button",{type:"button",className:"rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] flex items-center justify-center p-1 cursor-pointer transition-colors w-full",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${g.screenshot.replace("screenshots/","")}`,commitSha:g.commitSha,commitMessage:g.commitMessage,scenarioName:g.title}),children:e.jsx("img",{src:`/api/editor-journal-image/${g.screenshot.replace("screenshots/","")}`,alt:g.title,className:"max-w-full max-h-full object-contain",loading:"lazy"})}),g.scenarioScreenshots&&g.scenarioScreenshots.length>0&&(()=>{const A=ht(g.scenarioScreenshots);return e.jsx("div",{className:"space-y-1.5",children:A.map(([x,C])=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:x}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:C.map(t=>e.jsx("button",{type:"button",className:"w-[4.5rem] h-[4.5rem] rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${t.path.replace("screenshots/","")}`,commitSha:g.commitSha,commitMessage:g.commitMessage,scenarioName:t.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${t.path.replace("screenshots/","")}`,alt:t.name,title:t.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},t.path))})]},x))})})(),g.commitSha&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[e.jsx("span",{className:"font-mono text-[#00a0c4] bg-[#00a0c4]/10 px-1.5 py-0.5 rounded",children:g.commitSha.slice(0,7)}),e.jsx("span",{className:"text-gray-500 truncate",children:g.commitMessage})]})]}),e.jsxs("button",{onClick:()=>f(R),className:"w-full py-1.5 text-[10px] text-gray-500 hover:text-gray-300 border-t border-[#3d3d3d] transition-colors cursor-pointer",children:["——— ",z?"Collapse":"Expand"," ———"]})]},R)})})]},b))})})}function F({imgSrc:r,name:s,isActive:i,onSelect:l}){return e.jsxs("button",{onClick:l,className:"flex flex-col items-center gap-1 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-24 h-24 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${i?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:r?e.jsx("img",{src:r,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-24 ${i?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function jt({filePath:r,projectRoot:s}){if(!r)return null;const l=`vscode://file/${s?`${s}/${r}`:r}`;return e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:r}),e.jsx("a",{href:l,title:"Open in editor",className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function vt({hasProject:r,scenarios:s,analyzedEntities:i,glossaryFunctions:l=[],projectRoot:u,activeScenarioId:N,onScenarioSelect:v,onAnalyzedScenarioSelect:h,onSwitchToBuild:f,zoomComponent:o,onZoomChange:p,entityImports:b}){const{pageGroups:k,componentGroups:g}=a.useMemo(()=>{const x=new Map,C=new Map;for(const m of s)if(m.componentName){const j=C.get(m.componentName)||[];j.push(m),C.set(m.componentName,j)}else{const j="Home",y=x.get(j)||[];y.push(m),x.set(j,y)}const t=new Map([...C.entries()].sort(([m],[j])=>m.localeCompare(j)));return{pageGroups:x,componentGroups:t}},[s]),E=a.useRef(null),M=a.useRef(0),R=a.useCallback(()=>{E.current&&(M.current=E.current.scrollTop)},[]);if(a.useEffect(()=>{E.current&&M.current>0&&(E.current.scrollTop=M.current)}),!r)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Ready to build something?"}),e.jsx("button",{onClick:f,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});const z=a.useMemo(()=>i.filter(x=>x.entityType==="visual").sort((x,C)=>x.name.localeCompare(C.name)),[i]);if(!(s.length>0||z.length>0))return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 px-8 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Your project is ready"}),e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed max-w-[280px]",children:"Describe what you want to build in the Chat and your pages and components will appear here."}),e.jsx("button",{onClick:f,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(o){const x=k.get(o)||[],C=g.get(o)||[],t=z.find(c=>c.name===o),m=k.has(o),j=new Set((b==null?void 0:b[o])||[]),y=j.size>0,I=y?[...g.entries()].filter(([c])=>j.has(c)):[...g.entries()],w=y?z.filter(c=>j.has(c.name)):z;return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("button",{onClick:()=>p(void 0),className:"flex items-center gap-2 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer bg-transparent border-none p-0",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All"]}),e.jsx("h2",{className:"text-sm font-semibold text-white m-0 font-['IBM_Plex_Sans'] uppercase tracking-wider",children:o}),x.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:x.map(c=>e.jsx(F,{imgSrc:c.screenshotPath?`/api/editor-scenario-image/${c.id}.png`:null,name:c.name,isActive:c.id===N,onSelect:()=>v(c)},c.id))}),C.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:C.map(c=>e.jsx(F,{imgSrc:c.screenshotPath?`/api/editor-scenario-image/${c.id}.png`:null,name:c.name,isActive:c.id===N,onSelect:()=>v(c)},c.id))}),t&&(t.scenarios.length>0||t.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.scenarios.map(c=>e.jsx(F,{imgSrc:c.screenshotPath?`/api/screenshot/${c.screenshotPath}`:null,name:c.name,isActive:!1,onSelect:()=>h({analysisId:t.analysisId,scenarioId:c.id,scenarioName:c.name,entitySha:t.sha,entityName:t.name})},c.id)),t.pendingScenarios.map(c=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:c,children:c},c))]}),m&&I.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),I.map(([c,P])=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>p(c),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:c})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:P.map(_=>e.jsx(F,{imgSrc:_.screenshotPath?`/api/editor-scenario-image/${_.id}.png`:null,name:_.name,isActive:_.id===N,onSelect:()=>v(_)},_.id))})]},c))]}),m&&w.length>0&&e.jsxs("div",{className:`${I.length===0?"pt-2 mt-1 border-t border-[#3d3d3d]":"mt-2"}`,children:[I.length===0&&e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),w.map(c=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>p(c.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:c.name})}),(c.scenarios.length>0||c.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[c.scenarios.map(P=>e.jsx(F,{imgSrc:P.screenshotPath?`/api/screenshot/${P.screenshotPath}`:null,name:P.name,isActive:!1,onSelect:()=>h({analysisId:c.analysisId,scenarioId:P.id,scenarioName:P.name,entitySha:c.sha,entityName:c.name})},P.id)),c.pendingScenarios.map(P=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:P,children:P},P))]})]},c.sha))]}),x.length===0&&C.length===0&&!t&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"})]})})}return e.jsx("div",{ref:E,onScroll:R,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm font-medium text-gray-300 m-0 font-['IBM_Plex_Sans']",children:"What do you want to work on next?"}),e.jsx("button",{onClick:f,className:"w-full py-3 border-2 border-dashed border-[#4d4d4d] rounded-lg text-sm text-gray-400 hover:border-[#005c75] hover:text-white transition-colors cursor-pointer bg-transparent",children:"+ New Page"}),k.size>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),[...k.entries()].map(([x,C])=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>p(x),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:x})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:C.map(t=>e.jsx(F,{imgSrc:t.screenshotPath?`/api/editor-scenario-image/${t.id}.png`:null,name:t.name,isActive:t.id===N,onSelect:()=>v(t)},t.id))})]},x))]}),g.size>0&&e.jsx("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),[...g.entries()].map(([x,C])=>e.jsxs("div",{children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>p(x),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:x})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:C.map(t=>e.jsx(F,{imgSrc:t.screenshotPath?`/api/editor-scenario-image/${t.id}.png`:null,name:t.name,isActive:t.id===N,onSelect:()=>v(t)},t.id))})]},x)),z.map(x=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 py-1",children:[e.jsx("button",{onClick:()=>p(x.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:x.name}),x.isAnalyzing&&x.scenarioCount===0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),(x.scenarios.length>0||x.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[x.scenarios.map(C=>e.jsx(F,{imgSrc:C.screenshotPath?`/api/screenshot/${C.screenshotPath}`:null,name:C.name,isActive:!1,onSelect:()=>h({analysisId:x.analysisId,scenarioId:C.id,scenarioName:C.name,entitySha:x.sha,entityName:x.name})},C.id)),x.pendingScenarios.map(C=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:C,children:C},C))]})]},x.sha)),l.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),l.map(x=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 py-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:x.name}),x.testFile&&e.jsx("span",{className:"text-[9px] text-green-400 bg-green-400/10 px-1.5 py-0.5 rounded",children:"tested"})]}),x.description&&e.jsx("p",{className:"text-[10px] text-gray-500 mt-0 mb-0 leading-relaxed",children:x.description}),e.jsx(jt,{filePath:x.filePath,projectRoot:u})]},x.name))]})]})})}function Nt({items:r,onNavigate:s}){return r.length===0?null:e.jsx("nav",{className:"flex items-center gap-1 text-xs",children:r.map((i,l)=>{const u=l===r.length-1;return e.jsxs("span",{className:"flex items-center gap-1",children:[l>0&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500",children:e.jsx("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),u?e.jsx("span",{className:"text-white font-medium",children:i.name}):e.jsx("button",{onClick:()=>s(i.componentName),className:"text-gray-400 hover:text-white transition-colors cursor-pointer",children:i.name})]},i.componentName||"app")})})}function Me({scenarioId:r,name:s,isActive:i,onSelect:l}){const[u,N]=a.useState(!1);return e.jsxs("button",{onClick:l,className:"flex flex-col items-center gap-1.5 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded-lg overflow-hidden border-2 transition-all ${i?"border-[#0ea5e9] ring-2 ring-[#0ea5e9]/40 shadow-lg shadow-[#0ea5e9]/20":"border-gray-200 hover:border-gray-400 shadow-sm"}`,children:u?e.jsx("div",{className:"w-full h-full bg-gray-100 flex items-center justify-center",children:e.jsx("span",{className:"text-[9px] text-gray-400",children:"No preview"})}):e.jsx("img",{src:`/api/editor-scenario-image/${r}.png`,alt:s,className:"w-full h-full object-contain bg-white",loading:"lazy",onError:()=>N(!0)})}),e.jsx("span",{className:`text-[11px] leading-tight text-center truncate w-32 font-medium ${i?"text-gray-900":"text-gray-600 group-hover:text-gray-900"}`,children:s})]})}function bt({filePath:r,projectRoot:s}){if(!r)return null;const l=`vscode://file/${s?`${s}/${r}`:r}`;return e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-400 truncate",children:r}),e.jsx("a",{href:l,title:"Open in editor",className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function wt({testFile:r,entityName:s}){const{results:i,isRunning:l,runTests:u}=$e(r);if(l&&!i)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#0ea5e9] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!i)return null;if(i.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-500",children:i.errorMessage})});const N=s?i.testCases.filter(h=>{const f=`${s} > `;return h.fullName.startsWith(f)||h.fullName===s}):i.testCases;if(N.length===0)return null;const v=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[N.map(h=>{var o;const f=v&&h.fullName.startsWith(v)?h.fullName.slice(v.length):h.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[h.status==="passed"?e.jsx("span",{className:"text-green-600 text-[10px]",children:"✓"}):h.status==="failed"?e.jsx("span",{className:"text-red-500 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-400 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${h.status==="passed"?"text-green-600":h.status==="failed"?"text-red-500":"text-gray-400"}`,children:f})]}),h.status==="failed"&&((o=h.failureMessages)==null?void 0:o.map((p,b)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:p,children:p.split(`
3
+ `)[0]},b)))]},h.fullName)}),e.jsx("button",{onClick:u,disabled:l,className:"mt-1 text-[10px] text-[#0ea5e9] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:l?"Running...":"Re-run"})]})}function yt(r){if(!r||r==="/")return"Home";const i=r.split("?")[0].replace(/^\//,"").split("/")[0];return i.charAt(0).toUpperCase()+i.slice(1)}function St({scenarios:r,glossaryFunctions:s=[],projectRoot:i,activeScenarioId:l,onScenarioSelect:u,onClose:N}){const{pageGroups:v,componentGroups:h}=a.useMemo(()=>{const f=new Map,o=new Map;for(const b of r)if(b.componentName){const k=o.get(b.componentName)||[];k.push(b),o.set(b.componentName,k)}else{const k=yt(b.url),g=f.get(k)||[];g.push(b),f.set(k,g)}const p=new Map([...o.entries()].sort(([b],[k])=>b.localeCompare(k)));return{pageGroups:f,componentGroups:p}},[r]);return r.length===0&&s.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:N,className:"absolute top-2 right-3 text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none",title:"Close results",children:"×"}),e.jsx("span",{className:"text-sm text-gray-400",children:"No scenarios registered yet"})]}):e.jsxs("div",{className:"h-full bg-white flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Working Session Results"}),e.jsx("button",{onClick:N,className:"text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none",title:"Close results",children:"×"})]}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsxs("div",{className:"space-y-5",children:[v.size>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),e.jsx("div",{className:"space-y-3 pl-1",children:[...v.entries()].map(([f,o])=>e.jsxs("div",{children:[e.jsx("div",{className:"mb-1.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:f})}),e.jsx("div",{className:"flex flex-wrap gap-3",children:o.map(p=>e.jsx(Me,{scenarioId:p.id,name:p.name,isActive:p.id===l,onSelect:()=>u(p)},p.id))})]},f))})]}),h.size>0&&e.jsxs("div",{className:v.size>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),e.jsx("div",{className:"space-y-3 pl-1",children:[...h.entries()].map(([f,o])=>e.jsxs("div",{children:[e.jsx("div",{className:"mb-1.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:f})}),e.jsx("div",{className:"flex flex-wrap gap-3",children:o.map(p=>e.jsx(Me,{scenarioId:p.id,name:p.name,isActive:p.id===l,onSelect:()=>u(p)},p.id))})]},f))})]}),s.length>0&&e.jsxs("div",{className:r.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),e.jsx("div",{className:"space-y-2 pl-1",children:s.map(f=>e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-700",children:f.name})}),e.jsx(bt,{filePath:f.filePath,projectRoot:i}),f.testFile?e.jsx(wt,{testFile:f.testFile,entityName:f.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-400",children:"No test file"})})]},f.name))})]})]})})]})}function K(r){return r.replace(/[^a-zA-Z0-9_]+/g,"_")}function Ct(r){const{activeAnalyzedScenario:s,analyzedPreviewUrl:i,activeScenarioId:l,scenarios:u,proxyUrl:N,devServerUrl:v,zoomComponent:h}=r;if(s&&i)return i;if(s&&!i)return null;if(l){const o=u.find(p=>p.id===l);if(o!=null&&o.url){const p=N||v;return p?o.url.startsWith("/")?`${p}${o.url}`:o.url:null}}const f=N||v;if(!f)return null;if(h&&l){const o=u.find(b=>b.id===l),p=o?K(o.name):"Default";return`${f}/__codeyam__/${h}/${p}`}return f}function kt(r,s){const i=s.width,l=s.height??900,u=r.width,N=r.height;return i<=u&&l<=N?1:Math.min(u/i,N/l)}const zt=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}],he=[{name:"Mobile",width:375,height:667},{name:"Tablet",width:768,height:1024},{name:"Laptop",width:1024,height:768},{name:"Desktop",width:1440,height:900}];function Pt({analysisId:r,scenarioId:s,scenarioName:i,entityName:l,projectSlug:u,onStateChange:N}){const{interactiveServerUrl:v,isStarting:h,isLoading:f}=dt({analysisId:r,scenarioId:s,scenarioName:i,entityName:l,projectSlug:u,enabled:!0});return a.useEffect(()=>{N(v,h||f)},[v,h,f,N]),null}const Bt=et(function(){const{projectSlug:s,projectRoot:i,hasProject:l,scenarios:u,analyzedEntities:N,glossaryFunctions:v,entityImports:h}=tt(),f=st(),[o,p]=at(),b=a.useRef(null),k=a.useRef(null),g=a.useRef(null),E=o.get("zoom")||void 0,M=o.get("scenario")||void 0;a.useEffect(()=>{if(!M)return;const n=u.find(S=>S.id===M);if(!n)return;const d=K(n.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:d,scenarioId:n.id})}).catch(()=>{})},[M,u]),a.useEffect(()=>{const n=new BroadcastChannel("codeyam-editor");return n.onmessage=d=>{var S;if(((S=d.data)==null?void 0:S.type)==="switch-scenario"&&d.data.scenarioId){const $=d.data.scenarioId,B=u.find(xe=>xe.id===$);if(!B)return;const Z=new URLSearchParams(o);Z.set("scenario",$),Z.delete("zoom"),p(Z),_(null),q(null),O(null);const Ze=K(B.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:Ze,scenarioId:$})}).then(()=>{G(xe=>xe+1),I(!1)}).catch(()=>{})}},()=>n.close()},[o,p,u]),a.useEffect(()=>{if(o.get("ref")!=="link"||!M)return;const n=new BroadcastChannel("codeyam-editor");n.postMessage({type:"switch-scenario",scenarioId:M}),n.close(),window.close()},[]);const[R,z]=a.useState(null),[A,x]=a.useState(null),[C,t]=a.useState(!1),[m,j]=a.useState(null),[y,I]=a.useState(!1),[w,c]=a.useState(!0),[P,_]=a.useState(null),[pe,q]=a.useState(null),[ee,ue]=a.useState(!1),[D,O]=a.useState(null),[fe,ge]=a.useState(!1),[je,Q]=a.useState(null),Ee=a.useCallback(n=>{O(n),Q(null)},[]),Ie=a.useCallback((n,d)=>{q(S=>(n&&n!==S&&I(!1),n)),!d&&n&&I(!0),ue(d)},[]),ve=a.useCallback(n=>{O(null),_(S=>(S&&S.analysisId===n.analysisId||(q(null),G(B=>B+1)),n)),ue(!0),I(!1);const d=new URLSearchParams(o);d.delete("scenario"),d.delete("zoom"),p(d)},[o,p]),[Le,Ne]=a.useState(1440),[L,te]=a.useState({name:"Desktop",width:1440,height:900}),[Te,se]=a.useState(!1),[ae,Re]=a.useState(null),[T,W]=a.useState("app"),ze=a.useCallback(()=>{W("build"),ne(!0)},[]),[Be,ne]=a.useState(!1),[Ae,be]=a.useState(!1),_e=a.useCallback(n=>{be(n)},[]),[re,we]=a.useState(!1),De=a.useCallback(()=>{we(!0),W("build"),ne(!0)},[]),Ue=a.useCallback(()=>{we(!1)},[]),[J,ie]=a.useState(!1),Fe=a.useCallback(()=>{if(J){ie(!1);return}typeof Notification<"u"&&Notification.permission==="default"?Notification.requestPermission().then(n=>{n==="granted"&&ie(!0)}):ie(!0)},[J]);a.useEffect(()=>{if(T==="build"){be(!1);const n=setTimeout(()=>{var d,S;(d=b.current)==null||d.scrollToBottom(),(S=b.current)==null||S.focus()},50);return()=>clearTimeout(n)}},[T]);const[le,Oe]=a.useState(null);a.useEffect(()=>{const n=g.current;if(!n)return;const d=new ResizeObserver(S=>{const $=S[0];$&&Oe({width:$.contentRect.width,height:$.contentRect.height})});return d.observe(n),()=>d.disconnect()},[]);const H=a.useMemo(()=>le?kt(le,L):1,[le,L]),[We,G]=a.useState(0),[oe,ye]=a.useState(null),Je=a.useCallback(n=>{ye(n||null),G(d=>d+1)},[]),{customSizes:Se,addCustomSize:He}=nt(s),X=a.useMemo(()=>[...he,...Se],[Se]),Ce=a.useRef(!1);a.useEffect(()=>{let n=!1,d=null;const S=async()=>{try{const $=await fetch("/api/editor-dev-server");if(n)return;const B=await $.json();if(B.status==="error")z(null),x(null),t(!1),j(B.errorMessage||"Dev server crashed");else if(B.url)z(B.url),x(B.proxyUrl||null),t(!1),j(null),c(!0);else if(B.status==="starting")t(!0),j(null),c(!0);else if(B.status==="stopped")if(R)z(null),t(!1);else if(Ce.current)t(!1);else{Ce.current=!0;try{(await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})})).ok?t(!0):c(!1)}catch{}}}catch{}};return S(),d=setInterval(()=>void S(),2e3),()=>{n=!0,d&&clearInterval(d)}},[R]),a.useEffect(()=>{const n=new EventSource("/api/events");let d=null;return n.addEventListener("message",S=>{try{const $=JSON.parse(S.data);($.type==="db-change"||$.type==="unknown")&&(d&&clearTimeout(d),d=setTimeout(()=>{f.revalidate()},2e3))}catch{}}),()=>{d&&clearTimeout(d),n.close()}},[f]);const Ve=a.useMemo(()=>{const n=[{name:"App"}];return E&&n.push({name:E,componentName:E}),n},[E]),ce=a.useCallback(n=>{const d=new URLSearchParams(o);if(n){d.set("zoom",n);const S=u.find($=>$.componentName===n||$.componentName===null&&n==="Home");if(S){d.set("scenario",S.id);const $=K(S.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:$,scenarioId:S.id})}).catch(()=>{}),G(B=>B+1),I(!1)}else d.delete("scenario")}else d.delete("zoom"),d.delete("scenario");p(d)},[o,p,u]),de=a.useCallback(n=>{_(null),q(null),O(null);const d=new URLSearchParams(o);d.set("scenario",n.id),p(d);const S=K(n.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:S,scenarioId:n.id})}).catch(()=>{}),G($=>$+1),I(!1)},[o,p]),Ge=(n,d)=>{Ne(n);const S=X.find($=>$.width===n&&$.height===d);te({name:(S==null?void 0:S.name)||"Custom",width:n,height:d})},ke=n=>{Ne(n.width),te({name:n.name,width:n.width,height:n.height})},Ye=n=>{He(n,L.width,L.height??900),se(!1),te(d=>({...d,name:n}))},Ke=()=>{P||I(!0)},qe=a.useCallback(()=>{j(null),t(!0),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).catch(()=>{})},[]),Qe=a.useCallback(()=>{j(null),t(!0),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})}).catch(()=>{})},[]),U=a.useMemo(()=>Ct({activeAnalyzedScenario:!!P,analyzedPreviewUrl:pe,activeScenarioId:M||null,scenarios:u,proxyUrl:A,devServerUrl:R,zoomComponent:E||null}),[A,R,E,M,u,P,pe]),Xe=a.useMemo(()=>{if(!U||!oe)return U;try{const n=new URL(U);return n.pathname=oe,n.href}catch{return U}},[U,oe]);return e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[P&&e.jsx(Pt,{analysisId:P.analysisId,scenarioId:P.scenarioId,scenarioName:P.scenarioName,entityName:P.entityName,projectSlug:s,onStateChange:Ie},P.analysisId),e.jsx("div",{className:"bg-[#3d3d3d] h-12 flex items-center px-4 gap-4 shrink-0 z-20",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("img",{src:ct,alt:"CodeYam",className:"h-6 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-sm whitespace-nowrap",children:"Editor"}),E&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-4 bg-gray-600"}),e.jsx(Nt,{items:Ve,onNavigate:ce})]}),e.jsx("span",{className:"bg-[#005c75] text-white text-[10px] font-bold px-2 py-0.5 rounded uppercase tracking-wider ml-auto",children:"Code + Data"})]})}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("div",{className:"bg-[#e5e7eb] border-b border-[rgba(0,0,0,0.1)] shrink-0 z-10 h-6 flex items-center justify-center relative",children:[e.jsx("div",{className:"absolute inset-0 flex justify-center",children:e.jsx("div",{style:{maxWidth:`${he[he.length-1].width}px`,width:"100%"},children:e.jsx(rt,{currentViewportWidth:Le,currentPresetName:L.name,onDevicePresetClick:ke,devicePresets:X,hideLabel:!0,onHoverChange:Re,lightMode:!0})})}),e.jsxs("div",{className:"relative z-10 flex items-center gap-2",children:[e.jsxs("div",{className:"relative w-28 h-5",children:[e.jsxs("div",{className:"absolute inset-0 bg-white text-gray-900 text-xs px-2 rounded flex items-center justify-between pointer-events-none border border-gray-300",children:[e.jsx("span",{className:"leading-none",children:(ae==null?void 0:ae.name)||L.name}),e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsxs("select",{value:L.name,onChange:n=>{const d=X.find(S=>S.name===n.target.value);d&&ke(d)},className:"relative w-full h-full opacity-0 cursor-pointer",children:[X.map(n=>e.jsx("option",{value:n.name,children:n.name},n.name)),L.name==="Custom"&&e.jsx("option",{value:"Custom",children:"Custom"})]})]}),e.jsx("input",{type:"number",value:L.width,onChange:n=>{const d=parseInt(n.target.value,10);!isNaN(d)&&d>0&&Ge(d,L.height??900)},className:"bg-white text-gray-900 text-xs px-1 rounded border border-gray-300 outline-none w-16 text-center h-5 leading-none",min:"200",max:"3840"}),e.jsx("span",{className:"text-gray-400 text-xs h-5 flex items-center leading-none",children:"x"}),e.jsx("span",{className:"bg-gray-100 text-gray-600 text-xs px-1 rounded w-14 text-center h-5 flex items-center justify-center leading-none",children:L.height??900}),L.name==="Custom"&&e.jsx("button",{onClick:()=>se(!0),className:"bg-white text-gray-900 text-xs px-2 rounded h-5 flex items-center leading-none border border-gray-300 hover:bg-gray-50 transition-colors",children:"Save"})]})]}),e.jsx("div",{ref:g,className:"flex-1 flex items-center justify-center overflow-hidden p-8",style:{backgroundImage:`
4
+ linear-gradient(45deg, #ebebeb 25%, transparent 25%),
5
+ linear-gradient(-45deg, #ebebeb 25%, transparent 25%),
6
+ linear-gradient(45deg, transparent 75%, #ebebeb 75%),
7
+ linear-gradient(-45deg, transparent 75%, #ebebeb 75%)
8
+ `,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:"#fafafa"},children:D?e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-[700px] w-full",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-lg font-semibold text-[#333] m-0 font-['IBM_Plex_Sans']",children:"Journal Screenshot"}),e.jsx("p",{className:"text-sm text-[#888] mt-1 m-0 font-['IBM_Plex_Sans']",children:"This is a snapshot from a previous version — not a live preview"})]}),e.jsx("div",{className:"rounded-lg overflow-hidden border-2 border-[#ccc] shadow-md max-w-full w-fit",children:e.jsx("img",{src:D.screenshotUrl,alt:D.scenarioName,className:"max-w-full h-auto block"})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[D.commitSha&&e.jsx("span",{className:"font-mono text-xs text-[#00a0c4] bg-[#00a0c4]/15 px-2 py-0.5 rounded",children:D.commitSha.slice(0,7)}),e.jsxs("span",{className:"truncate",children:[D.scenarioName,D.commitMessage&&` — ${D.commitMessage}`]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>O(null),className:"text-sm text-[#888] hover:text-[#333] transition-colors cursor-pointer px-3 py-1.5 rounded border border-[#ccc] hover:border-[#999] bg-white",children:"Back to live preview"}),D.commitSha&&e.jsx("button",{onClick:()=>{ge(!0),Q(null),fetch("/api/editor-load-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitSha:D.commitSha})}).then(n=>n.json()).then(n=>{n.success?(O(null),t(!0),I(!1)):Q(n.error||"Failed to load commit")}).catch(n=>{Q(n instanceof Error?n.message:"Network error")}).finally(()=>{ge(!1)})},disabled:fe,className:"bg-[#005c75] hover:bg-[#004d63] disabled:opacity-50 text-white text-sm font-medium px-4 py-1.5 rounded transition-colors cursor-pointer",children:fe?"Loading...":"Load this version"})]}),je&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded px-4 py-2 text-sm text-red-600 w-full text-center",children:je})]}):U?e.jsx("div",{style:{width:`${L.width*H}px`,height:`${(L.height??900)*H}px`},children:e.jsxs("div",{className:"relative bg-white origin-top-left",style:{width:`${L.width}px`,height:`${L.height??900}px`,transform:H<1?`scale(${H})`:void 0},children:[!y&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 bg-white rounded-lg p-8 shadow-sm w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx(Pe,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Loading Preview"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Waiting for the app to render"})]})]})}),e.jsx("iframe",{ref:k,src:Xe||U,className:"w-full h-full border-none",title:"Editor preview",onLoad:Ke,style:{opacity:y?1:0}},We)]})}):e.jsx("div",{className:"bg-white rounded-lg shadow-sm flex flex-col items-center justify-center",style:{width:`${L.width*H}px`,height:`${(L.height??900)*H}px`},children:m?e.jsxs("div",{className:"flex flex-col gap-4 text-center px-8 max-w-[600px]",children:[e.jsx("h2",{className:"text-xl font-medium text-red-600 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Dev Server Failed"}),e.jsx("pre",{className:"text-xs text-left bg-gray-100 text-gray-800 p-4 rounded overflow-auto max-h-[300px] w-full font-mono whitespace-pre-wrap",children:m}),e.jsx("button",{onClick:qe,className:"mx-auto px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Retry"})]}):C||ee?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(Pe,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:ee?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:ee?"Loading component preview...":"Your dev server is starting up..."})]})]}):e.jsxs("div",{className:"flex flex-col gap-3 text-center px-8",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Code + Data Editor"}),e.jsx("p",{className:"text-sm text-[#888] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Describe what you want to build in the chat"})]})})})]}),e.jsxs("aside",{className:"w-[50%] min-w-[400px] max-w-[800px] bg-[#1e1e1e] border-r border-[#3d3d3d] shrink-0 flex flex-col overflow-hidden order-first",children:[e.jsxs("div",{className:"border-b border-[#3d3d3d] px-4 shrink-0 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-0",children:[e.jsxs("button",{onClick:()=>W("app"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="app"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["App",T==="app"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>{W("build"),ne(!0)},className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="build"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Build",Ae&&T!=="build"&&e.jsx("span",{className:"ml-1.5 inline-block w-2 h-2 rounded-full bg-amber-400 animate-pulse"}),T==="build"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>W("data"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="data"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Data",T==="data"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>W("journal"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="journal"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Journal",T==="journal"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]})]}),typeof Notification<"u"&&e.jsx("button",{onClick:Fe,className:`px-2 py-1 text-[10px] rounded transition-colors cursor-pointer ${J?"text-green-400 hover:text-green-300":"text-gray-500 hover:text-gray-300"}`,title:J?"Click to turn off notifications":"Click to get notified when Claude finishes",children:J?"Notifications On":"Notifications Off"})]}),e.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[Be&&e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="build"?"visible":"hidden"},children:[e.jsx("div",{className:re?"flex-1 min-h-0":"flex-1",style:re?{flex:"1 1 50%"}:void 0,children:e.jsx(lt,{ref:b,entityName:"Editor",projectSlug:s,entityFilePath:null,scenarioName:null,onRefreshPreview:Je,onShowResults:De,editorMode:!0,onIdleChange:_e,notificationsEnabled:J})}),re&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx(St,{scenarios:u,glossaryFunctions:v,projectRoot:i,activeScenarioId:M,onScenarioSelect:de,onClose:Ue})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="app"?"visible":"hidden"},children:e.jsx(vt,{hasProject:l,scenarios:u,analyzedEntities:[],glossaryFunctions:v,projectRoot:i,activeScenarioId:M,onScenarioSelect:de,onAnalyzedScenarioSelect:ve,onSwitchToBuild:ze,zoomComponent:E,onZoomChange:ce,entityImports:h})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="data"?"visible":"hidden"},children:e.jsx(xt,{scenarios:u,projectRoot:i,activeScenarioId:M,onScenarioSelect:de,zoomComponent:E,onZoomChange:ce,analyzedEntities:[],glossaryFunctions:v,activeAnalyzedScenarioId:P==null?void 0:P.scenarioId,onAnalyzedScenarioSelect:ve,entityImports:h})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="journal"?"visible":"hidden"},children:e.jsx(gt,{isActive:T==="journal",onScreenshotClick:Ee})})]})]})]}),e.jsx(ot,{serverUrl:R,isStarting:C,projectSlug:s,devServerError:m,onStartServer:w?Qe:void 0}),Te&&e.jsx(it,{width:L.width,height:L.height??900,onSave:Ye,onCancel:()=>se(!1)})]})});export{Bt as default,zt as meta};