@codeyam/codeyam-cli 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analyzer-template/.build-info.json +8 -8
- package/analyzer-template/log.txt +3 -3
- package/analyzer-template/package.json +2 -2
- package/analyzer-template/packages/ai/package.json +1 -1
- package/analyzer-template/packages/aws/package.json +1 -1
- package/analyzer-template/packages/database/package.json +1 -1
- package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +42 -16
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +3 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
- package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/codeyam-cli/src/cli.js +9 -0
- package/codeyam-cli/src/cli.js.map +1 -1
- package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js +51 -0
- package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js.map +1 -0
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +11 -0
- package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -1
- package/codeyam-cli/src/commands/editor.js +1360 -201
- package/codeyam-cli/src/commands/editor.js.map +1 -1
- package/codeyam-cli/src/commands/editorIsolateArgs.js +25 -0
- package/codeyam-cli/src/commands/editorIsolateArgs.js.map +1 -0
- package/codeyam-cli/src/commands/telemetry.js +37 -0
- package/codeyam-cli/src/commands/telemetry.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +893 -1
- package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
- package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
- package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +76 -3
- package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +261 -0
- package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +75 -1
- package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
- package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +441 -17
- package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +67 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
- package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
- package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
- package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +67 -9
- package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
- package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +40 -1
- package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
- package/codeyam-cli/src/utils/__tests__/telemetry.test.js +159 -0
- package/codeyam-cli/src/utils/__tests__/telemetry.test.js.map +1 -0
- package/codeyam-cli/src/utils/analysisRunner.js +3 -1
- package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
- package/codeyam-cli/src/utils/editorAudit.js +145 -0
- package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
- package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
- package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
- package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js +13 -7
- package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/editorEntityHelpers.js +129 -0
- package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
- package/codeyam-cli/src/utils/editorLoaderHelpers.js +40 -1
- package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -1
- package/codeyam-cli/src/utils/editorMigration.js +224 -0
- package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
- package/codeyam-cli/src/utils/editorScenarios.js +163 -2
- package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
- package/codeyam-cli/src/utils/editorSeedAdapter.js +253 -4
- package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
- package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
- package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
- package/codeyam-cli/src/utils/entityChangeStatus.js +19 -2
- package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
- package/codeyam-cli/src/utils/entityChangeStatus.server.js +7 -3
- package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
- package/codeyam-cli/src/utils/fileWatcher.js +38 -0
- package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
- package/codeyam-cli/src/utils/install-skills.js +9 -0
- package/codeyam-cli/src/utils/install-skills.js.map +1 -1
- package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
- package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
- package/codeyam-cli/src/utils/scenarioCoverage.js +8 -9
- package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -1
- package/codeyam-cli/src/utils/scenariosManifest.js +18 -10
- package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
- package/codeyam-cli/src/utils/telemetry.js +106 -0
- package/codeyam-cli/src/utils/telemetry.js.map +1 -0
- package/codeyam-cli/src/utils/telemetryMiddleware.js +22 -0
- package/codeyam-cli/src/utils/telemetryMiddleware.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
- package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +61 -0
- package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
- package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
- package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
- package/codeyam-cli/src/webserver/backgroundServer.js +18 -4
- package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CzTDWkF2.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-BFbq6iFk.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CQIG2qda.js → EntityTypeIcon-B6OMi58N.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-DuYodzo1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-CXo9EeCl.js +25 -0
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DYCNb2It.js +3 -0
- package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-CZgY3sxX.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzHcG7SE.js → ReportIssueModal-CnYYwRDw.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CDoF7ZpU.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-TSD3C211.js → ScenarioViewer-DrnfvaLL.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Df3UCi8k.js +34 -0
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-DRKR9T0U.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-ClR-g3tY.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-DTH6ydEA.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-74hnHF59.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-B8CYhCO9.js} +3 -3
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{book-open-BYOypzCa.js → book-open-CLaoh4ac.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-BZ2DZxbW.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-C4pqxYJB.js → chunk-JZWAC4HX-BBXArFPl.js} +13 -21
- package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-CT4unAk-.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-zK0B6Nu-.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-DJB0YQJL.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CkXFP_i-.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor._tab-DPw7NZHc.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-CjC3_6JI.js +58 -0
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-DBa7T2FK.js +41 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-DwCV5__E.js → entity._sha._-BqAN7hyG.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-BOi8kpwd.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-Dg1NhIms.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CJX6kkkV.js +6 -0
- package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-BhVjZhKg.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-_gzKltPN.js} +6 -6
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/files-CV_17tZS.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/git-D-YXmMbR.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/globals-DRvOjyO3.css +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-Blo6EK8G.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-BsX0F-9C.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-CCrgCshv.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
- package/codeyam-cli/src/webserver/build/client/assets/labs-Byazq8Pv.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-DVQ0oHR7.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-75b1b319.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{memory-9gnxSZlb.js → memory-b-VmA2Vj.js} +2 -2
- package/codeyam-cli/src/webserver/build/client/assets/{pause-f5-1lKBt.js → pause-DGcndCAa.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{root-DBjt6o04.js → root-F-k2uYj5.js} +15 -15
- package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-C0Uw0bcK.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-OoNgHIfW.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/simulations-Bcemfu8a.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{terminal-Br7MOqts.js → terminal-BgMmG7R9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-Cs87hJYK.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BR3Rs7JY.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-C14nCb1q.js → useLastLogLine-BxxP_XF9.js} +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BermyNU5.js +1 -0
- package/codeyam-cli/src/webserver/build/client/assets/useToast-a_QN_W9_.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-lv2ooewK.js +13 -0
- package/codeyam-cli/src/webserver/build/server/assets/{index-DsZjKspK.js → index-Im3Smyei.js} +1 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-BjuAFKGM.js +10 -0
- package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
- package/codeyam-cli/src/webserver/build/server/assets/server-build-CNjF0B9B.js +551 -0
- package/codeyam-cli/src/webserver/build/server/index.js +1 -1
- package/codeyam-cli/src/webserver/build-info.json +5 -5
- package/codeyam-cli/src/webserver/editorProxy.js +112 -13
- package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
- package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
- package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
- package/codeyam-cli/src/webserver/server.js +41 -0
- package/codeyam-cli/src/webserver/server.js.map +1 -1
- package/codeyam-cli/src/webserver/terminalServer.js +74 -8
- package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
- package/codeyam-cli/templates/editor-step-hook.py +104 -20
- package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +42 -7
- package/codeyam-cli/templates/seed-adapters/supabase.ts +282 -0
- package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +62 -0
- package/package.json +2 -1
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
- package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
- package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
- package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
- package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
- package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Ii3inc0_.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/editor-16o0AIFV.js +0 -15
- package/codeyam-cli/src/webserver/build/client/assets/editorPreview-7Uga8I59.js +0 -41
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-BwKcai0j.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CHMiAog3.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
- package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/files-BZrlFE1F.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/globals-CQPR0pFR.css +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/manifest-76e7b62c.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/simulations-DWT-CvLy.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C-_hOl_g.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
- package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
- package/codeyam-cli/src/webserver/build/server/assets/init-DdqKD2p4.js +0 -10
- package/codeyam-cli/src/webserver/build/server/assets/server-build-CKKeWtVK.js +0 -444
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as R,u as $,r as l,a as B,d as D,L as F}from"./chunk-JZWAC4HX-BBXArFPl.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{u as O}from"./useReportContext-BermyNU5.js";import{S as U}from"./SafeScreenshot-CDoF7ZpU.js";import{L as V}from"./LoadingDots-By5zI316.js";import{E as P}from"./EntityTypeIcon-B6OMi58N.js";import{g as Y,a as Q,f as q}from"./fileTableUtils-Daa96Fr1.js";import{C as J}from"./chevron-down-BZ2DZxbW.js";import{S as K}from"./search-C0Uw0bcK.js";import{L as W}from"./loader-circle-DVQ0oHR7.js";import"./createLucideIcon-DJB0YQJL.js";const ce=()=>[{title:"Simulations - CodeYam"},{name:"description",content:"A visual gallery of your recently captured component screenshots"}],de=R(function(){const i=$(),c=i.entities,x=i.queueState;O({source:"simulations-page"});const[n,u]=l.useState(""),[d,S]=l.useState("visual"),g=l.useMemo(()=>{const a=[];return c.forEach(t=>{var y;const r=(y=t.analyses)==null?void 0:y[0];if(r!=null&&r.scenarios){const b=r.scenarios.filter(o=>{var m;return!((m=o.metadata)!=null&&m.sameAsDefault)}).map(o=>{var z,k,A,L,E;const m=(k=(z=o.metadata)==null?void 0:z.screenshotPaths)==null?void 0:k[0],N=(A=o.metadata)==null?void 0:A.noScreenshotSaved,M=m&&!N,T=(E=(L=r.status)==null?void 0:L.scenarios)==null?void 0:E.find(H=>H.name===o.name),I=T&&T.screenshotStartedAt&&!T.screenshotFinishedAt;let w;return M?w="completed":I?w="capturing":w="error",{scenarioName:o.name,scenarioDescription:o.description||"",screenshotPath:m||"",scenarioId:o.id,state:w}}).filter(o=>o.state==="completed"||o.state==="capturing");b.length>0&&a.push({entity:t,screenshots:b,createdAt:r.createdAt||""})}}),a.sort((t,r)=>new Date(r.createdAt).getTime()-new Date(t.createdAt).getTime()),a},[c]),v=l.useMemo(()=>c.filter(a=>{var y,b;const t=(y=a.analyses)==null?void 0:y[0];return!((b=t==null?void 0:t.scenarios)==null?void 0:b.some(o=>{var m,N;return(N=(m=o.metadata)==null?void 0:m.screenshotPaths)==null?void 0:N[0]}))}),[c]),p=l.useMemo(()=>g.filter(({entity:a})=>{const t=!n||a.name.toLowerCase().includes(n.toLowerCase()),r=d==="all"||a.entityType===d;return t&&r}),[g,n,d]),f=l.useMemo(()=>v.filter(a=>{const t=!n||a.name.toLowerCase().includes(n.toLowerCase()),r=d==="all"||a.entityType===d;return t&&r}),[v,n,d]),C=l.useCallback(a=>{u(a.target.value)},[]),j=l.useCallback(a=>{S(a.target.value)},[]),h=g.length>0;return e.jsx("div",{className:"bg-[#F8F7F6] min-h-screen overflow-y-auto",children:e.jsxs("div",{className:"px-20 py-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-[28px] font-semibold text-gray-900 mb-2",children:"Simulations"}),e.jsx("p",{className:"text-[15px] text-gray-500",children:"A visual gallery of your recently captured simulations."})]}),!h&&e.jsx("div",{className:"bg-[#D1F3F9] border border-[#A5E8F0] rounded-lg p-4 mb-6",children:e.jsxs("p",{className:"text-sm text-gray-700 m-0",children:["This page will display a visual gallery of your recently captured component simulations."," ",e.jsx("strong",{children:"Start by analyzing your first component below."})]})}),e.jsxs("div",{className:"bg-white border-b border-gray-200 rounded-t-lg px-5 py-4 mb-3",children:[e.jsx("div",{className:"text-[11px] text-gray-500 mb-2 uppercase",children:"Filters"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"appearance-none bg-gray-50 border border-gray-200 rounded px-3 pr-8 text-[13px] h-[39px] cursor-pointer focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] hover:border-gray-300 transition-colors",value:d,onChange:j,children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"visual",children:"Visual"}),e.jsx("option",{value:"library",children:"Library"})]}),e.jsx(J,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-3 h-3 text-gray-500 pointer-events-none"})]}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(K,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search component",className:"w-full bg-gray-50 border border-gray-200 rounded pl-9 pr-3 text-[13px] h-[39px] placeholder:text-gray-400 focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] transition-colors",value:n,onChange:C})]})]})]}),h&&p.length>0&&e.jsx("div",{className:"mb-2",children:e.jsxs("div",{className:"flex items-center py-3",children:[e.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em"},children:[e.jsx("span",{style:{color:"#000000"},children:p.length})," ",p.length===1?"entity":"entities"]}),e.jsxs("div",{className:"relative group inline-flex items-center ml-1.5",children:[e.jsx("svg",{className:"w-3 h-3 text-gray-400 cursor-help",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("div",{className:"absolute left-0 top-full mt-2 hidden group-hover:block z-50 w-80",children:e.jsxs("div",{className:"bg-gray-900 text-white text-xs rounded-lg px-3 py-2 shadow-lg",children:["In CodeYam, an entity is a discrete, analyzable unit of code that can be independently simulated and tested.",e.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-900 transform rotate-45"})]})})]}),e.jsx("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#d1d5db",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:"|"}),e.jsxs("span",{className:"font-mono uppercase",style:{fontSize:"11px",color:"#8b8b8b",fontWeight:500,letterSpacing:"0.05em",marginLeft:"8px"},children:[e.jsx("span",{style:{color:"#000000"},children:p.reduce((a,{screenshots:t})=>a+t.length,0)})," ","scenarios"]})]})}),e.jsxs("div",{className:"flex flex-col gap-3",children:[h&&(p.length===0?e.jsx("div",{className:"bg-white border border-gray-200 rounded-lg p-8 text-center text-gray-500",children:"No simulations match your filters."}):e.jsx(e.Fragment,{children:p.map(({entity:a,screenshots:t})=>e.jsx(G,{entity:a,screenshots:t,queueJobs:(x==null?void 0:x.jobs)||[]},a.sha))})),!h&&(f.length===0?e.jsx("div",{className:"bg-white border border-gray-200 rounded-b-lg p-8 text-center text-gray-500",children:"No components found matching your filters."}):f.map(a=>e.jsx(X,{entity:a},a.sha)))]})]})})});function G({entity:s,screenshots:i,queueJobs:c}){var j,h,a;const x=B(),n=D(),[u,d]=l.useState(!1),S=i.length||(((a=(h=(j=s.analyses)==null?void 0:j[0])==null?void 0:h.scenarios)==null?void 0:a.length)??0),g=t=>{x(`/entity/${s.sha}/scenarios/${t}?from=simulations`)},v=()=>{d(!0),n.submit({entitySha:s.sha,filePath:s.filePath||""},{method:"post",action:"/api/analyze"})};l.useEffect(()=>{n.state==="idle"&&u&&d(!1)},[n.state,u]);const p=Y(s,c),f=Q(p),C=p==="out-of-date";return e.jsx("div",{className:"rounded-[8px]",style:{backgroundColor:"#ffffff",border:"1px solid #e1e1e1"},children:e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center px-[15px] py-[15px]",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(P,{type:s.entityType||"other",size:"large"})}),e.jsxs("div",{className:"flex flex-col flex-shrink-0",style:{marginLeft:"15px",gap:"4px"},children:[e.jsxs("div",{className:"flex items-center gap-[5px]",children:[e.jsxs(F,{to:`/entity/${s.sha}`,className:"hover:underline cursor-pointer",title:s.name,style:{fontSize:"14px",lineHeight:"18px",color:"#343434",fontWeight:500},children:[s.name," (",S,")"]}),e.jsx("div",{className:"flex items-center justify-center px-2 rounded",style:{height:"20px",backgroundColor:f.bgColor,color:f.textColor,fontSize:"12px",lineHeight:"16px",fontWeight:400},children:f.text})]}),e.jsx("div",{style:{fontSize:"12px",lineHeight:"15px",color:"#b0b0b0",fontWeight:400},className:"font-mono",title:s.filePath,children:s.filePath})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex-shrink-0 flex items-center gap-2",children:[C&&e.jsx(e.Fragment,{children:u||n.state!=="idle"?e.jsxs("div",{className:"px-2 py-1 bg-pink-100 rounded flex items-center gap-1.5",children:[e.jsx(W,{size:14,className:"animate-spin",style:{color:"#be185d"}}),e.jsx("span",{style:{color:"#be185d",fontSize:"10px",lineHeight:"20px",fontWeight:600},children:"Analyzing..."})]}):e.jsx("button",{onClick:v,className:"px-[10px] rounded transition-colors whitespace-nowrap",style:{backgroundColor:"#005c75",color:"#ffffff",fontSize:"10px",lineHeight:"22px",fontWeight:600},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#004d5e"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#005c75"},children:"Re-analyze"})}),e.jsx("button",{onClick:()=>void x(`/entity/${s.sha}/logs`),className:"px-[10px] rounded transition-colors whitespace-nowrap",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",lineHeight:"22px",fontWeight:600},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#d0dfe3"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="#e0e9ec"},children:"View Logs"})]})]}),e.jsx("div",{className:"border-t border-gray-200"}),e.jsx("div",{className:"flex gap-2.5 overflow-x-auto pb-3 px-[15px] pt-3",style:{paddingLeft:"47px"},children:i.length>0?i.map(t=>e.jsxs("div",{className:"shrink-0 flex flex-col gap-2",children:[e.jsx("button",{onClick:()=>g(t.scenarioId||""),className:"block cursor-pointer bg-transparent border-none p-0",children:e.jsx("div",{className:"w-36 h-24 rounded-md border overflow-hidden flex items-center justify-center transition-all",style:{"--hover-border":"#005C75",backgroundColor:t.state==="capturing"?"#f9f9f9":"#f3f4f6",borderColor:t.state==="capturing"?"#efefef":"#d1d5db"},onMouseEnter:r=>{t.state==="completed"&&(r.currentTarget.style.borderColor="#005C75",r.currentTarget.style.boxShadow="0 4px 12px rgba(0, 92, 117, 0.15)")},onMouseLeave:r=>{r.currentTarget.style.borderColor=t.state==="capturing"?"#efefef":"#d1d5db",r.currentTarget.style.boxShadow="none"},children:t.state==="completed"?e.jsx(U,{screenshotPath:t.screenshotPath,alt:t.scenarioName,className:"max-w-full max-h-full object-contain"}):t.state==="capturing"?e.jsx(V,{size:"medium"}):null})}),e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"text-left text-xs text-gray-600 cursor-default",style:{fontSize:"11px",lineHeight:"14px",maxWidth:"144px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.scenarioName}),e.jsx("div",{className:"fixed hidden group-hover:block pointer-events-none",style:{zIndex:1e4,transform:"translateY(8px)"},children:e.jsxs("div",{className:"bg-gray-100 text-gray-800 text-xs rounded-lg px-3 py-2 shadow-lg max-w-xs border border-gray-200",children:[t.scenarioName,t.scenarioDescription&&e.jsxs(e.Fragment,{children:[": ",t.scenarioDescription]}),e.jsx("div",{className:"absolute -top-1 left-4 w-2 h-2 bg-gray-100 border-l border-t border-gray-200 transform rotate-45"})]})})]})]},t.scenarioId)):e.jsx("div",{className:"text-xs text-gray-400 py-4",children:"No screenshots available"})})]})})}function X({entity:s}){const i=D(),[c,x]=l.useState(!1),n=()=>{x(!0),i.submit({entitySha:s.sha,filePath:s.filePath||""},{method:"post",action:"/api/analyze"})};return l.useEffect(()=>{i.state==="idle"&&c&&x(!1)},[i.state,c]),e.jsx("div",{className:"bg-white rounded hover:bg-gray-100 transition-colors cursor-pointer border-b border-[#e1e1e1]",onClick:n,children:e.jsxs("div",{className:"px-5 py-4 flex items-center",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx(P,{type:s.entityType}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-0.5",children:[e.jsx(F,{to:`/entity/${s.sha}`,className:"text-sm font-medium text-gray-900 no-underline",children:s.name}),e.jsx("span",{className:"text-[10px] font-semibold px-1 py-0.5 rounded",style:{color:s.entityType==="visual"?"#7c3aed":s.entityType==="library"?"#0DBFE9":s.entityType==="type"?"#dc2626":s.entityType==="data"?"#2563eb":s.entityType==="index"?"#ea580c":s.entityType==="functionCall"?"#7c3aed":s.entityType==="class"?"#059669":s.entityType==="method"?"#0891b2":"#6b7280",backgroundColor:s.entityType==="visual"?"#f3e8ff":s.entityType==="library"?"#cffafe":s.entityType==="type"?"#fee2e2":s.entityType==="data"?"#dbeafe":s.entityType==="index"?"#ffedd5":s.entityType==="functionCall"?"#f3e8ff":s.entityType==="class"?"#d1fae5":s.entityType==="method"?"#cffafe":"#f3f4f6"},children:s.entityType?s.entityType.toUpperCase():"UNKNOWN"})]}),e.jsx("div",{className:"text-xs text-gray-400 truncate",children:s.filePath})]})]}),e.jsx("div",{className:"w-32 flex justify-center",children:e.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-100 px-2 py-1 rounded",children:"Not analyzed"})}),e.jsx("div",{className:"w-32 text-center text-[10px] text-gray-500",children:q(s.createdAt||null)}),e.jsx("div",{className:"w-24 flex justify-end",children:c||i.state!=="idle"?e.jsxs("div",{className:"px-2 py-1 bg-pink-100 rounded text-xs text-pink-700 font-semibold flex items-center gap-1.5",children:[e.jsx(W,{size:14,className:"animate-spin"}),"Analyzing..."]}):e.jsx("button",{onClick:n,className:"bg-[#e0e9ec] text-[#005c75] px-4 py-1.5 rounded text-xs font-medium hover:bg-[#d0dde1] transition-colors cursor-pointer",children:"Analyze"})})]})})}export{de as default,ce as meta};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{r}from"./chunk-JZWAC4HX-BBXArFPl.js";function D({currentWidth:d,currentHeight:u,devicePresets:l,customSizes:i,onApply:a,onSave:b,onRemove:x,onClose:s}){const[n,o]=r.useState(String(d)),[c,y]=r.useState(String(u)),[m,p]=r.useState(""),[v,L]=r.useState(!1),w=r.useRef(null),S=r.useRef(null);r.useEffect(()=>{const t=N=>{w.current&&!w.current.contains(N.target)&&s()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[s]),r.useEffect(()=>{const t=N=>{N.key==="Escape"&&s()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[s]),r.useEffect(()=>{var t;(t=S.current)==null||t.select()},[]);const g=parseInt(n,10),f=parseInt(c,10),h=g>0&&f>0,k=h&&(g!==d||f!==u),C=()=>{h&&(a({name:"Custom",width:g,height:f}),s())},E=()=>{const t=m.trim();!t||!h||(b(t,g,f),a({name:t,width:g,height:f}),s())},j=t=>{t.key==="Enter"&&(v&&m.trim()?E():k&&C())};return e.jsxs("div",{ref:w,className:"absolute top-full mt-1 right-0 bg-[#2a2a2a] border border-[#444] rounded-lg shadow-xl z-50 w-64",children:[l&&l.length>0&&e.jsxs("div",{className:"border-b border-[#444]",children:[e.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-gray-500",children:"Presets"}),l.map(t=>e.jsxs("button",{onClick:()=>{a(t),s()},className:`w-full px-3 py-1.5 text-left text-xs transition-colors cursor-pointer ${t.width===d&&t.height===u?"text-white bg-[#444]":"text-gray-300 hover:text-white hover:bg-[#333]"}`,children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("span",{className:"text-gray-500 ml-1.5",children:[t.width,"×",t.height]})]},t.name))]}),i.length>0&&e.jsxs("div",{className:"border-b border-[#444]",children:[e.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wider text-gray-500",children:"Saved Sizes"}),i.map(t=>e.jsxs("div",{className:"flex items-center group hover:bg-[#333] transition-colors",children:[e.jsxs("button",{onClick:()=>{a(t),s()},className:"flex-1 px-3 py-1.5 text-left text-xs text-gray-300 hover:text-white transition-colors cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("span",{className:"text-gray-500 ml-1.5",children:[t.width,"×",t.height]})]}),e.jsx("button",{onClick:()=>x(t.name),className:"px-2 py-1.5 text-gray-600 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-all cursor-pointer",title:"Remove",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]},t.name))]}),e.jsxs("div",{className:"p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("input",{ref:S,type:"number",value:n,onChange:t=>o(t.target.value),onKeyDown:j,min:"100",max:"7680",className:"w-full px-2 py-1.5 bg-[#1a1a1a] border border-[#555] rounded text-xs text-white text-center focus:outline-none focus:border-[#007a99] [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",placeholder:"Width"}),e.jsx("span",{className:"text-gray-500 text-xs flex-shrink-0",children:"×"}),e.jsx("input",{type:"number",value:c,onChange:t=>y(t.target.value),onKeyDown:j,min:"100",max:"7680",className:"w-full px-2 py-1.5 bg-[#1a1a1a] border border-[#555] rounded text-xs text-white text-center focus:outline-none focus:border-[#007a99] [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",placeholder:"Height"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:C,disabled:!h||!k,className:"flex-1 px-2 py-1.5 bg-[#007a99] text-white text-xs font-medium rounded hover:bg-[#006080] transition-colors cursor-pointer disabled:bg-[#333] disabled:text-gray-600 disabled:cursor-not-allowed",children:"Apply"}),v?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{type:"text",value:m,onChange:t=>p(t.target.value),onKeyDown:j,placeholder:"Name",className:"w-20 px-2 py-1.5 bg-[#1a1a1a] border border-[#555] rounded text-xs text-white focus:outline-none focus:border-[#007a99]",autoFocus:!0}),e.jsx("button",{onClick:E,disabled:!m.trim()||!h,className:"px-2 py-1.5 bg-[#007a99] text-white text-xs rounded hover:bg-[#006080] transition-colors cursor-pointer disabled:bg-[#333] disabled:text-gray-600 disabled:cursor-not-allowed",children:"OK"})]}):e.jsx("button",{onClick:()=>L(!0),disabled:!h,className:"px-2 py-1.5 bg-[#333] text-gray-300 text-xs rounded hover:bg-[#444] transition-colors cursor-pointer disabled:text-gray-600 disabled:cursor-not-allowed",title:"Save as preset",children:"Save"})]})]})]})}function I({width:d,height:u,onSave:l,onCancel:i}){const[a,b]=r.useState(""),[x,s]=r.useState(""),n=()=>{const o=a.trim();if(!o){s("Please enter a name");return}l(o)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50",children:e.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6 shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Save Custom Size"}),e.jsx("button",{onClick:i,className:"text-gray-400 hover:text-gray-600 transition-colors cursor-pointer","aria-label":"Close",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"mb-6 p-4 bg-gray-50 rounded-lg border border-gray-200",children:[e.jsx("div",{className:"text-sm text-gray-500 mb-1",children:"Dimensions"}),e.jsxs("div",{className:"text-lg font-medium text-gray-900",children:[d,"px × ",u,"px"]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"custom-size-name",className:"block text-sm font-medium text-gray-700 mb-2",children:"Name"}),e.jsx("input",{id:"custom-size-name",type:"text",value:a,onChange:o=>{b(o.target.value),s("")},onKeyDown:o=>{o.key==="Enter"&&a.trim()&&n(),o.key==="Escape"&&i()},placeholder:"e.g., iPhone 15 Pro",className:`w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:border-[#005c75] ${x?"border-red-300":"border-gray-300"}`,autoFocus:!0}),x&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:x})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:i,className:"px-4 py-2 bg-gray-100 text-gray-700 text-sm font-medium rounded-md hover:bg-gray-200 transition-colors cursor-pointer",children:"Cancel"}),e.jsx("button",{onClick:n,disabled:!a.trim(),className:"px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded-md hover:bg-[#004a5c] transition-colors cursor-pointer disabled:bg-gray-300 disabled:cursor-not-allowed",children:"Save"})]})]})})}function R(d){const[u,l]=r.useState([]),i=d?`codeyam-custom-sizes-${d}`:null;r.useEffect(()=>{if(!i||typeof window>"u"){l([]);return}try{const s=localStorage.getItem(i);if(s){const n=JSON.parse(s);Array.isArray(n)&&l(n)}}catch(s){console.error("[useCustomSizes] Failed to load custom sizes:",s),l([])}},[i]);const a=r.useCallback(s=>{if(!(!i||typeof window>"u"))try{localStorage.setItem(i,JSON.stringify(s))}catch(n){console.error("[useCustomSizes] Failed to save custom sizes:",n)}},[i]),b=r.useCallback((s,n,o)=>{l(c=>{const y=c.findIndex(v=>v.name===s),m={name:s,width:n,height:o};let p;return y>=0?(p=[...c],p[y]=m):p=[...c,m],a(p),p})},[a]),x=r.useCallback(s=>{l(n=>{const o=n.filter(c=>c.name!==s);return a(o),o})},[a]);return{customSizes:u,addCustomSize:b,removeCustomSize:x}}export{D as C,I as S,R as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t}from"./chunk-JZWAC4HX-
|
|
1
|
+
import{r as t}from"./chunk-JZWAC4HX-BBXArFPl.js";function I(i,s){const[d,n]=t.useState(""),[g,l]=t.useState(!1),[h,a]=t.useState(null),[u,r]=t.useState(!1);t.useEffect(()=>{s&&(r(!1),l(!1),a(null))},[s]),t.useEffect(()=>{if(!i||!s){s||n("");return}const L=async()=>{if(!u)try{const c=await fetch(`/api/logs/${i}`);if(c.ok){const o=(await c.text()).trim().split(`
|
|
2
2
|
`).filter(e=>e.length>0);if(o.length<3){l(!1),r(!1),a(null),n("");return}const f=o.filter(e=>e.includes("CodeYam Log Level 1"));if(f.length>0){const e=f[f.length-1];n(e.replace(/.*CodeYam Log Level 1: /,""))}const E=o.find(e=>e.includes("$$INTERACTIVE_SERVER_URL$$:"));if(E){const e=E.split("$$INTERACTIVE_SERVER_URL$$:")[1].trim();a(e),r(!0)}o.some(e=>e.includes("CodeYam: Exiting start.js"))&&l(!0)}}catch{}};L().catch(()=>{});const $=setInterval(()=>{L().catch(()=>{})},500);return()=>clearInterval($)},[i,s,u]);const m=t.useCallback(()=>{n(""),l(!1),a(null),r(!1)},[]);return{lastLine:d,interactiveUrl:h,isCompleted:g,resetLogs:m}}export{I as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./jsx-runtime-D_zvdyIk.js";import{r as e,c as x}from"./chunk-JZWAC4HX-BBXArFPl.js";const s={source:"navbar"},r=e.createContext(void 0);function D({children:t}){const[n,o]=e.useState(s),a=e.useCallback(u=>{o(u)},[]),c=e.useCallback(()=>{o(s)},[]);return i.jsx(r.Provider,{value:{contextData:n,setContextData:a,resetContextData:c},children:t})}function p(t){const n=e.useContext(r),o=e.useRef(n);e.useEffect(()=>{if(o.current)return o.current.setContextData(t),()=>{var a;(a=o.current)==null||a.resetContextData()}},[t.source,t.entitySha,t.scenarioId,t.analysisId,t.entityName,t.entityType,t.scenarioName,t.errorMessage])}function m(){const t=e.useContext(r),n=x();return t?{source:t.contextData.source,entitySha:t.contextData.entitySha,scenarioId:t.contextData.scenarioId,analysisId:t.contextData.analysisId,currentUrl:n.pathname,entityName:t.contextData.entityName,entityType:t.contextData.entityType,scenarioName:t.contextData.scenarioName,errorMessage:t.contextData.errorMessage}:{source:"navbar",currentUrl:n.pathname}}export{D as R,m as a,p as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as T}from"./jsx-runtime-D_zvdyIk.js";import{r as t}from"./chunk-JZWAC4HX-BBXArFPl.js";const n=t.createContext(void 0);function p({children:o}){const[i,r]=t.useState([]),c=t.useCallback((s,e="info",a=5e3)=>{const d={id:`toast-${Date.now()}-${Math.random()}`,message:s,type:e,duration:a};r(x=>[...x,d])},[]),u=t.useCallback(s=>{r(e=>e.filter(a=>a.id!==s))},[]);return T.jsx(n.Provider,{value:{toasts:i,showToast:c,closeToast:u},children:o})}function v(){const o=t.useContext(n);if(!o)throw new Error("useToast must be used within a ToastProvider");return o}export{p as T,v as u};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import*as Y from"fs/promises";import*as w from"path";import{P as J,w as H}from"./progress-CHTtrxFG.js";import{ab as V,ac as _,ad as G,ae as q,af as K,ag as Q,ah as X,ai as Z,aj as U,ak as ee,u as te,al as re,am as oe,an as ne}from"./server-build-CNjF0B9B.js";import{spawn as W,execSync as se}from"child_process";import*as P from"fs";import{fileURLToPath as ie}from"url";import"fetch-retry";import"typescript";import"kysely";import"pluralize";import"piscina";import"json5";import"cli-spinners";import"chalk";import"react/jsx-runtime";import"node:stream";import"@react-router/node";import"react-router";import"isbot";import"react-dom/server";import"react";import"lucide-react";import"better-sqlite3";import"pg";import"kysely/helpers/sqlite";import"kysely/helpers/postgres";import"os";import"prompts";import"crypto";import"util";import"dotenv";import"events";import"uuid";import"http";import"net";import"ws";import"node-pty";import"openai";import"p-queue";import"p-retry";import"@aws-sdk/client-dynamodb";import"lru-cache";import"@aws-sdk/util-dynamodb";import"v8";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"minimatch";import"react-markdown";import"remark-gfm";import"react-diff-viewer-continued";const ae=ie(import.meta.url),ce=w.dirname(ae);async function le(b){let i=b.port;const{rootPath:d,project:c,branch:E,processName:R="server"}=b;let m=!1;const{running:g,state:e,pids:v}=V();if(g&&e)if(e.cliVersion!==_)console.log(`CLI version mismatch (server: ${e.cliVersion??"unknown"} → CLI: ${_}), restarting server...`),G(),m=!0;else return{url:e.url,pid:e.pid,wasAlreadyRunning:!0};else g&&v&&v.length>0&&(q(i)||(i=K(i,q)));const j=`http://localhost:${i}`,S=w.join(ce,"..","webserver","bootstrap.js"),o=w.join(d,".codeyam","logs");P.existsSync(o)||P.mkdirSync(o,{recursive:!0});const A={CODEYAM_PORT:i.toString(),CODEYAM_ROOT_PATH:d,CODEYAM_PROJECT:c?JSON.stringify(c):"",CODEYAM_BRANCH:E?JSON.stringify(E):"",CODEYAM_PROCESS_NAME:`codeyam-${R}`,...m?{CODEYAM_WAIT_FOR_PORT:"true"}:{},...process.env.CODEYAM_TRACE_TRANSFORMS?{CODEYAM_TRACE_TRANSFORMS:process.env.CODEYAM_TRACE_TRANSFORMS}:{}};let l;if(process.platform==="win32")l=await pe(S,A,o);else{const s=P.openSync(w.join(o,"background-server.log"),"a"),r=P.openSync(w.join(o,"background-server-error.log"),"a"),f=W("node",["--max-old-space-size=8192",S],{detached:!0,stdio:["ignore",s,r],env:{...process.env,...A}});f.unref(),l=f.pid}try{const s=se(`lsof -ti:${i}`,{encoding:"utf8"}).trim();if(s){const r=s.split(`
|
|
2
|
+
`),f=r.find(C=>C===String(l)),p=r.filter(C=>C!==String(l));p.length>0&&console.warn(`[BackgroundServer] Port ${i} still held by other PID(s): ${p.join(", ")} (server PID: ${l})`)}}catch{}const L=`http://127.0.0.1:${i}/api/health`,y=6e4,D=500,a=Date.now();let u="",k=!1;for(;Date.now()-a<y;){try{process.kill(l,0)}catch{const r=((Date.now()-a)/1e3).toFixed(1);console.error(`[BackgroundServer] Server process (PID ${l}) died after ${r}s`);const f=w.join(o,"background-server.log");try{const $=P.readFileSync(f,"utf8").trim().split(`
|
|
3
|
+
`).slice(-15).join(`
|
|
4
|
+
`);console.error(`[BackgroundServer] Last log lines:
|
|
5
|
+
${$}`)}catch{console.error(`[BackgroundServer] Could not read log at: ${f}`)}const p=w.join(o,"background-server-error.log");try{const $=P.readFileSync(p,"utf8").trim().split(`
|
|
6
|
+
`).slice(-15).join(`
|
|
7
|
+
`);$&&console.error(`[BackgroundServer] Error log:
|
|
8
|
+
${$}`)}catch{}break}try{const r=await fetch(L);if(r.ok)break;u=`HTTP ${r.status}`}catch(r){u=r instanceof Error?r.message.split(`
|
|
9
|
+
`)[0]:String(r)}const s=Date.now()-a;s>=1e4&&!k?(console.log(`[BackgroundServer] Still waiting for server... (${(s/1e3).toFixed(0)}s, last: ${u})`),k=!0):s>=2e4&&s%1e4<D&&console.log(`[BackgroundServer] Still waiting... (${(s/1e3).toFixed(0)}s, last: ${u})`),await new Promise(r=>setTimeout(r,D))}if(Date.now()-a>=y){console.warn(`[BackgroundServer] Warning: Server did not become ready within ${y/1e3}s`),console.warn(`[BackgroundServer] Last error: ${u}`);const s=w.join(o,"background-server.log");try{const p=P.readFileSync(s,"utf8").trim().split(`
|
|
10
|
+
`).slice(-15).join(`
|
|
11
|
+
`);console.warn(`[BackgroundServer] Last log lines:
|
|
12
|
+
${p}`)}catch{console.warn(`[BackgroundServer] Could not read log at: ${s}`)}}const I={pid:l,port:i,url:j,startTime:Date.now(),projectRoot:d,logDir:o,cliVersion:_};return Q(I),{url:j,pid:l,wasAlreadyRunning:!1}}async function pe(b,i,d){const c=m=>m.replace(/'/g,"''"),E=w.join(d,"start-server.ps1"),R=Object.entries(i).map(([m,g])=>`$env:${m} = '${c(g)}'`);return P.writeFileSync(E,[...R,`$env:CODEYAM_LOG_DIR = '${c(d)}'`,`$bootstrapPath = '${c(b)}'`,`$p = Start-Process -FilePath "node" -ArgumentList ('--max-old-space-size=8192', '"{0}"' -f $bootstrapPath) -WindowStyle Hidden -PassThru`,"Write-Output $p.Id"].join(`
|
|
13
|
+
`)),new Promise((m,g)=>{const e=W("powershell.exe",["-NoProfile","-ExecutionPolicy","Bypass","-File",E],{windowsHide:!0,stdio:["ignore","pipe","pipe"]});let v="",j="";e.stdout.on("data",o=>{v+=o.toString()}),e.stderr.on("data",o=>{j+=o.toString()});const S=setTimeout(()=>{e.kill(),g(new Error("Timed out waiting for PowerShell to start server (30s)"))},3e4);e.on("close",o=>{if(clearTimeout(S),o!==0){g(new Error(`Failed to start server via PowerShell (exit ${o}): ${j}`));return}const A=parseInt(v.trim(),10);if(isNaN(A)){g(new Error(`Failed to parse server PID from PowerShell output: ${v}`));return}m(A)})})}async function it(b){const{projectRoot:i,filePaths:d,entityNames:c,progress:E,context:R,scenarioCount:m,onlyDataStructure:g}=b,e=E||new J(!1);try{const t=X(i)}catch(t){throw e.fail("AI service configuration error"),t}const v=w.join(i,".codeyam","config.json");e.start("Loading project configuration...");const j=JSON.parse(await Y.readFile(v,"utf8")),{projectSlug:S,branchId:o}=j;if(!S||!o)throw e.fail("Invalid project configuration"),new Error("Missing project slug or branch ID. Try reinitializing with: codeyam init --force");if(e.succeed("Loaded project configuration"),e.start("Validating environment..."),!await H(()=>ne()))throw e.fail("Environment validation failed"),new Error("Environment validation failed");e.succeed("Environment validated"),e.start("Loading project from database...");const{project:l,branch:L}=await Z(S);e.succeed("Loaded project and branch"),e.start("Starting web server...");const{url:y,wasAlreadyRunning:D}=await le({port:3111,rootPath:i,project:l,branch:L});D?e.succeed(`Web server already running at ${y}`):e.succeed(`Web server started at ${y}`);let a=[];if(c&&c.length>0){e.start(`Looking up ${c.length} entities...`);const t=await U({projectId:l.id,names:c,filePaths:d});if(t.length===0)throw e.fail(`No entities found with names: ${c.join(", ")}`),new Error(`Entities not found: ${c.join(", ")}`);a=t.map(n=>n.sha),e.succeed(`Found ${t.length} entities`)}else{e.start(`Looking up entities in ${d.length} files...`);const t=await U({projectId:l.id,filePaths:d});t.length>0?(a=t.map(n=>n.sha),e.succeed(`Found ${t.length} entities in files`)):e.succeed("No existing entities found (will be discovered)")}e.start("Creating analysis commit...");const u=await ee(l,L,d);e.succeed(`Created commit ${u.sha.substring(0,8)}`),await te({commitSha:u.sha,runStatusUpdate:{queuedAt:new Date().toISOString(),currentEntityShas:a,entityCount:a.length>0?a.length:d.length,analysesCompleted:0,capturesCompleted:0,createdAt:new Date().toISOString()},updateCallback:t=>{const n=t.currentRun;if(n&&n.id&&n.archivedAt)return;n&&(n.analysesCompleted&&n.analysesCompleted>0||n.capturesCompleted&&n.capturesCompleted>0)&&re(t)}}),e.start("Enqueueing analysis job...");const k=await fetch(`${y}/api/queue`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"enqueue",type:"analysis",commitSha:u.sha,projectSlug:S,filePaths:d,entityShas:a,entityNames:c,...R?{context:R}:{},...m?{scenarioCount:m}:{},...g?{onlyDataStructure:!0}:{}})});if(!k.ok){const t=await k.json();throw new Error(`Failed to enqueue job: ${t.error||k.statusText}`)}const{jobId:I}=await k.json();e.succeed(`Job queued (${I.substring(0,8)})`),e.start(g?"Running import analysis...":"Running analysis and capture...");const s=oe(S);let r=0,f=0;const p=[],C=async()=>{try{const t=await Y.stat(s);if(t.size>r){const n=(await import("fs")).createReadStream(s,{start:r,encoding:"utf8"});let h="";for await(const O of n)h+=O;r=t.size;const T=/CodeYam Log Level \d+: (.+)/g;let x;const M=[];for(;(x=T.exec(h))!==null;){const O=x[1];M.push(O)}const z=/CodeYam Error: (.+)/g;let N;for(;(N=z.exec(h))!==null;){const O=N[1];p.includes(O)||p.push(O)}const B=Date.now();M.length>0&&B-f>500&&(e.update(M[M.length-1]),f=B)}}catch{}},F=setInterval(()=>{C().catch(()=>{})},500);try{let n=!1;for(;!n;){await new Promise(x=>setTimeout(x,1e3));const h=await fetch(`${y}/api/queue?queryType=job&jobId=${encodeURIComponent(I)}`);if(!h.ok)throw new Error(`Failed to check job status: ${h.statusText}`);const T=await h.json();if(T.status==="failed")throw new Error(`Analysis failed: ${T.error||"Unknown error"}`);T.status==="completed"&&(n=!0)}p.length>0?(e.warn(`Analysis completed with ${p.length} error(s):`),p.slice(0,5).forEach(h=>{console.log(` • ${h.substring(0,100)}${h.length>100?"...":""}`)}),p.length>5&&console.log(` ... and ${p.length-5} more errors`)):e.succeed("Analysis completed")}catch(t){throw e.fail("Analysis failed"),t&&typeof t=="object"&&!("commitSha"in t)&&(t.commitSha=u.sha,t.entityShas=a),t}finally{F&&clearInterval(F)}let $;return a.length===1?$=`http://localhost:3111/entity/${a[0]}`:$=`http://localhost:3111/commit/${u.sha}`,{commitSha:u.sha,entityShas:a,url:$}}export{it as runAnalysisForEntities};
|
package/codeyam-cli/src/webserver/build/server/assets/{index-DsZjKspK.js → index-Im3Smyei.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"fetch-retry";import{K as Z,N as _,Q as $,R as aa,U as ea,W as sa,Z as ta,a1 as ra,a4 as oa,J as ia,L as ma,M as la,O as pa,P as na,S as ca,T as ba,V as Ta,X as da,Y as ua,_ as ha,$ as Ca,a0 as Sa,a2 as ya,a3 as Ba,a5 as Aa,I as Ea,a6 as Pa,a7 as ga,a8 as ja,aa as Fa,a9 as Ua,d as Da,a as Ga,b as Ma,c as qa,e as Ja,f as fa,g as ka,h as xa,i as Ha,j as La,k as va,E as wa,H as za,G as Ia,F as Ka,l as Na,m as Oa,n as Qa,o as Ra,p as Va,q as Wa,r as Xa,s as Ya,t as Za,u as _a,v as $a,w as ae,x as ee,y as se,z as te,A as re,B as oe,C as ie,D as me}from"./server-build-
|
|
1
|
+
import"fetch-retry";import{K as Z,N as _,Q as $,R as aa,U as ea,W as sa,Z as ta,a1 as ra,a4 as oa,J as ia,L as ma,M as la,O as pa,P as na,S as ca,T as ba,V as Ta,X as da,Y as ua,_ as ha,$ as Ca,a0 as Sa,a2 as ya,a3 as Ba,a5 as Aa,I as Ea,a6 as Pa,a7 as ga,a8 as ja,aa as Fa,a9 as Ua,d as Da,a as Ga,b as Ma,c as qa,e as Ja,f as fa,g as ka,h as xa,i as Ha,j as La,k as va,E as wa,H as za,G as Ia,F as Ka,l as Na,m as Oa,n as Qa,o as Ra,p as Va,q as Wa,r as Xa,s as Ya,t as Za,u as _a,v as $a,w as ae,x as ee,y as se,z as te,A as re,B as oe,C as ie,D as me}from"./server-build-CNjF0B9B.js";import"typescript";import"kysely";import"react/jsx-runtime";import"node:stream";import"@react-router/node";import"react-router";import"isbot";import"react-dom/server";import"react";import"lucide-react";import"better-sqlite3";import"pg";import"fs";import"path";import"kysely/helpers/sqlite";import"kysely/helpers/postgres";import"fs/promises";import"os";import"prompts";import"chalk";import"crypto";import"child_process";import"url";import"util";import"dotenv";import"events";import"uuid";import"http";import"net";import"ws";import"node-pty";import"openai";import"p-queue";import"p-retry";import"@aws-sdk/client-dynamodb";import"lru-cache";import"pluralize";import"piscina";import"json5";import"@aws-sdk/util-dynamodb";import"v8";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"minimatch";import"react-markdown";import"remark-gfm";import"react-diff-viewer-continued";export{Z as AnalysisBranchesTableColumns,_ as BranchesTableColumns,$ as CommitsTableColumns,aa as CommitsTableColumnsLite,ea as EntitiesTableColumns,sa as EntityBranchesTableColumns,ta as FilesTableColumns,ra as ProjectsTableColumns,oa as ScenariosTableColumns,ia as createAnalysesTable,ma as createAnalysisBranchesTable,la as createBackgroundJobsTable,pa as createBranchesTable,na as createCommitBranchesTable,ca as createCommitsTable,ba as createEditorScenariosTable,Ta as createEntitiesTable,da as createEntityBranchesTable,ua as createEntityStatementsTable,ha as createFilesTable,Ca as createGithubPayloadsTable,Sa as createGithubUsersTable,ya as createProjectsTable,Ba as createScenarioCommentsTable,Aa as createScenariosTable,Ea as createSqliteSchema,Pa as createStatementsTable,ga as createTeamsTable,ja as createUserScenariosTable,Fa as createUserTeamsTable,Ua as createUsersTable,Da as dbToAnalysis,Ga as dbToAnalysisBranch,Ma as dbToBranch,qa as dbToCommit,Ja as dbToEntity,fa as dbToFile,ka as dbToProject,xa as dbToScenario,Ha as dbToUserScenario,La as deleteScenarios,va as generateSha,wa as getDatabase,za as getJsonHelper,Ia as getPostgreDatabase,Ka as getSqliteDatabase,Na as loadAnalyses,Oa as loadAnalysis,Qa as loadBranches,Ra as loadCommitBranches,Va as loadCommits,Wa as loadEntities,Xa as loadEntity,Ya as loadFiles,Za as loadProject,_a as updateCommitMetadata,$a as updateFreshAnalysisMetadata,ae as updateFreshAnalysisStatus,ee as updateProjectMetadata,se as upsertBranches,te as upsertCommitBranches,re as upsertCommits,oe as upsertGithubUser,ie as upsertProjects,me as upsertScenarios};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import*as m from"fs/promises";import*as y from"fs";import*as e from"path";import x from"chalk";import{execSync as F}from"child_process";import{h as _,s as b,e as v,P as R,i as B,w as E}from"./progress-CHTtrxFG.js";import{ao as I,ap as W,aq as M,ab as O,ad as T,ar as U,as as A,at as G,F as q,I as Y,an as z,au as N,av as J,x as P}from"./server-build-CNjF0B9B.js";import"fetch-retry";import"typescript";import"kysely";import{fileURLToPath as L}from"url";import"cli-spinners";import"react/jsx-runtime";import"node:stream";import"@react-router/node";import"react-router";import"isbot";import"react-dom/server";import"react";import"lucide-react";import"better-sqlite3";import"pg";import"kysely/helpers/sqlite";import"kysely/helpers/postgres";import"os";import"prompts";import"crypto";import"util";import"dotenv";import"events";import"uuid";import"http";import"net";import"ws";import"node-pty";import"openai";import"p-queue";import"p-retry";import"@aws-sdk/client-dynamodb";import"lru-cache";import"pluralize";import"piscina";import"json5";import"@aws-sdk/util-dynamodb";import"v8";import"react-syntax-highlighter";import"react-syntax-highlighter/dist/cjs/styles/prism/index.js";import"node:crypto";import"minimatch";import"react-markdown";import"remark-gfm";import"react-diff-viewer-continued";function H(a){try{const r=F("git config --get remote.origin.url",{cwd:a,encoding:"utf8"}).trim().match(/github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?$/);if(r)return`${r[1]}-${r[2]}`}catch{}return e.basename(a)}const V=L(import.meta.url),K=e.dirname(V);async function g(a,t){await m.mkdir(t,{recursive:!0});const r=await m.readdir(a,{withFileTypes:!0});for(const i of r){const s=e.join(a,i.name),o=e.join(t,i.name);i.isDirectory()?await g(s,o):(await m.copyFile(s,o),(i.name.endsWith(".sh")||i.name.endsWith(".mjs"))&&await m.chmod(o,493))}}async function Q(a,t){const r=(t==null?void 0:t.mode)??"memory";try{const i=e.join(a,".claude","skills"),s=e.join(K,"../../templates"),o=e.join(s,"skills"),n=e.join(s,"commands"),u=e.join(i,"codeyam-memory"),p=e.join(i,"codeyam-new-rule");await g(e.join(o,"codeyam-memory"),u),await g(e.join(o,"codeyam-new-rule"),p);const w=r==="editor"||(t==null?void 0:t.editorMode)===!0;if(w){const c=e.join(i,"codeyam-editor");await g(e.join(o,"codeyam-editor"),c);const f=e.join(a,"CLAUDE.md");try{await m.access(f)}catch{await m.copyFile(e.join(s,"codeyam-editor-claude.md"),f)}}if(r==="full"){const c=e.join(i,"codeyam-setup"),f=e.join(i,"codeyam-sim"),d=e.join(i,"codeyam-test"),h=e.join(i,"codeyam-verify"),S=e.join(i,"codeyam-dev-mode");await g(e.join(o,"codeyam-setup"),c),await g(e.join(o,"codeyam-sim"),f),await g(e.join(o,"codeyam-test"),d),await g(e.join(o,"codeyam-verify"),h),await g(e.join(o,"codeyam-dev-mode"),S);const k=e.join(a,".claude","commands");await m.mkdir(k,{recursive:!0}),await m.copyFile(e.join(n,"codeyam-diagnose.md"),e.join(k,"codeyam-diagnose.md"))}const l=e.join(a,".codeyam","bin");await m.mkdir(l,{recursive:!0});const j=e.join(a,".codeyam","rules");if(await m.mkdir(j,{recursive:!0}),w){try{const c=e.join(l,"editor-step-hook.py");await m.copyFile(e.join(s,"editor-step-hook.py"),c),await m.chmod(c,493)}catch{}try{const c=e.join(s,"seed-adapters"),f=e.join(a,".codeyam","seed-adapters");await g(c,f)}catch{}}try{const c=e.join(l,"memory-hook.sh");await m.copyFile(e.join(s,"codeyam-memory-hook.sh"),c),await m.chmod(c,493)}catch{}try{const c=e.join(l,"rule-reflection-hook.py");await m.copyFile(e.join(s,"rule-reflection-hook.py"),c),await m.chmod(c,493)}catch{}try{const c=e.join(l,"rule-notification-hook.py");await m.copyFile(e.join(s,"rule-notification-hook.py"),c),await m.chmod(c,493)}catch{}try{const c=e.join(l,"prompts");await m.mkdir(c,{recursive:!0});const f=await m.readdir(e.join(s,"prompts"));for(const d of f)await m.copyFile(e.join(s,"prompts",d),e.join(c,d))}catch{}try{await m.copyFile(e.join(s,"rules-instructions.md"),e.join(j,"instructions.md"))}catch{}return{success:!0,skillsPath:e.relative(a,i)}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}function X(a,t){const r=(t==null?void 0:t.mode)??"memory";try{const i=e.join(a,".claude"),s=e.join(i,"settings.local.json");y.existsSync(i)||y.mkdirSync(i,{recursive:!0});let o={};if(y.existsSync(s))try{const c=y.readFileSync(s,"utf8");o=JSON.parse(c)}catch{console.warn(`Warning: Could not parse ${s}, will create new file`)}o.permissions||(o.permissions={}),o.permissions.allow||(o.permissions.allow=[]);const n=["Skill(codeyam-memory)","Skill(codeyam-new-rule)","Bash(codeyam)","Bash(codeyam:*)","Read(.codeyam/**)","Edit(.codeyam/**)","Write(.codeyam/**)","Glob(.codeyam/**)"],u=["Skill(codeyam-setup)","Skill(codeyam-sim)","Skill(codeyam-debug)","Skill(codeyam-test)","Skill(codeyam-verify)","Skill(codeyam-dev-mode)","Read(/tmp/**)","Edit(/tmp/**)","Write(/tmp/**)","Glob(/tmp/**)","Bash(npm install:*)","Bash(npm run:*)","Bash(npx:*)","Bash(node:*)","Bash(cp:*)","Bash(mkdir:*)","Bash(chmod:*)","Bash(rm:*)","Bash(curl:*)","Bash(sleep:*)","Bash(echo:*)","Bash(grep:*)","Bash(python3:*)","Bash(cat:*)","Bash(printf:*)","Bash(ls:*)"],p=["Skill(codeyam-editor)","Bash(git:*)","Edit(**)","Write(**)"],w=r==="editor"||(t==null?void 0:t.editorMode)===!0;let l;if(r==="full"?l=[...n,...u]:r==="editor"?l=[...n,...p,...u]:l=n,w&&r!=="editor")for(const c of[...p,...u])l.includes(c)||l.push(c);let j=!1;for(const c of l)o.permissions.allow.includes(c)||(o.permissions.allow.push(c),j=!0);if(w){o.hooks||(o.hooks={});const c='test -f "$CLAUDE_PROJECT_DIR"/.codeyam/bin/editor-step-hook.py && python3 "$CLAUDE_PROJECT_DIR"/.codeyam/bin/editor-step-hook.py || true';for(const f of["PostToolUse","Stop","UserPromptSubmit"]){const d=o.hooks[f]||[];d.some(S=>{var k;return(k=S.hooks)==null?void 0:k.some(C=>{var $;return($=C.command)==null?void 0:$.includes("editor-step-hook")})})||(d.push({hooks:[{type:"command",command:c,timeout:5}]}),o.hooks[f]=d,j=!0)}}return j&&y.writeFileSync(s,JSON.stringify(o,null,2),"utf8"),!0}catch(i){return console.warn(`Warning: Could not configure Claude Code settings: ${i.message}`),!1}}function Z(a){return y.existsSync(a)?y.readFileSync(a,"utf8").split(`
|
|
2
|
+
`).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")).map(r=>r.startsWith("/")?r.slice(1):r):[]}function ee(a){const t=[];function r(i){const s=e.join(i,".gitignore");if(y.existsSync(s)){const o=Z(s),n=e.relative(a,i),u=o.map(p=>n?e.join(n,p):p);t.push(...u)}try{const o=y.readdirSync(i,{withFileTypes:!0});for(const n of o)n.isDirectory()&&n.name!=="node_modules"&&n.name!==".git"&&n.name!=="dist"&&n.name!=="build"&&r(e.join(i,n.name))}catch{}}return r(a),t}function te(a){let t=a.replace(/\/$/,"");const r=t.startsWith("**/");r&&(t=t.slice(3));const i=t.startsWith("/");return i&&(t=t.slice(1)),t=t.replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),t=t.replace(/\\\*\\\*/g,".*").replace(/\\\*/g,"[^/]*").replace(/\\\?/g,"."),i&&!r?`^${t}(/.*)?$`:`^(.*/)?${t}(/.*)?$`}function oe(){return["^(.*/)?node_modules/.*$","^(.*/)?dist/.*$","^(.*/)?build/.*$","^(.*/)?\\.next/.*$","^(.*/)?out/.*$","^(.*/)?\\.cache/.*$","^(.*/)?__tests__/.*$","^(.*/)?__mocks__/.*$","^(.*/)?.+\\.test\\.(ts|tsx|js|jsx)$","^(.*/)?.+\\.spec\\.(ts|tsx|js|jsx)$","^(.*/)?test/.*$","^(.*/)?tests/.*$","^(.*/)?__test","^(.*/)?\\.git/.*$","^(.*/)?coverage/.*$","^(.*/)?\\.nyc_output/.*$","^(.*/)?\\.vscode/.*$","^(.*/)?\\.idea/.*$","^(.*/)?\\.DS_Store$"]}function ie(a){const t=oe();try{const i=ee(a).filter(o=>o.trim().length>0).map(o=>te(o)),s=[...t,...i];return Array.from(new Set(s))}catch(r){return console.warn("Failed to load gitignore patterns:",r),t}}const tt={command:"init",describe:"Initialize a project for CodeYam CLI analysis",builder:{force:{type:"boolean",alias:"f",describe:"Force initialization even if .codeyam already exists",default:!1},"keep-server":{type:"boolean",describe:"Skip stopping the running CodeYam server (use when running inside the editor)",default:!1}},handler:async a=>{_("Initializing CodeYam CLI project");let t=I();if(t&&!a.force){b("Project already initialized. Use --force to reinitialize.");return}if(t||(t=process.cwd()),W(t)){v("Cannot initialize CodeYam in your home directory or filesystem root."),v("Please run codeyam init from inside a project directory.");return}M(t);const{running:r}=O();r&&!a["keep-server"]&&(T()?b("CodeYam server stopped"):v("Failed to stop CodeYam server - it may have already stopped"));const i=e.join(t,".codeyam"),s=e.join(i,"config.json"),o=new R;try{o.start("Setting up project scaffolding..."),await m.mkdir(i,{recursive:!0}),await ae(t),o.succeed("Project scaffolding ready");let n=H(t);try{const d=JSON.parse(y.readFileSync(s,"utf8"));d.projectSlug&&!d.projectSlug.startsWith("local-")&&(n=d.projectSlug)}catch{}const u=re(t);let p=[];try{p=U(t)}catch{}if(p.length>0){const d=p.map(h=>`${h.path==="."?"Root":h.path} (${h.framework})`).join(", ");B(`Found ${p.length} web application${p.length>1?"s":""}: ${d}`)}o.start("Configuring project...");const w=A(s),l={projectSlug:n,packageManager:u,webapps:p,environmentVariables:[],createdAt:new Date().toISOString(),...w};await m.writeFile(s,JSON.stringify(l,null,2));const j=G();if(!y.existsSync(j)){const d=q(j);await Y(d)}if(!await E(()=>z())){o.fail("Environment validation failed");return}try{const{project:d}=await N({slug:n,packageManager:u,unapprovedPaths:ie(t),webapps:p});o.succeed("Project configured"),o.start("Installing Claude Code skills...");const h=!!a["keep-server"],S=await Q(t,{mode:h?"editor":"memory",editorMode:h}),{branch:k}=await J(d);l.branchId=k.id,await m.writeFile(s,JSON.stringify(l,null,2)),X(t,{mode:h?"editor":"memory",editorMode:h}),S.success?o.succeed("Claude Code skills installed"):o.warn("Could not install skills");try{a["keep-server"]?await P({projectSlug:n,metadataUpdate:{editorMode:!0,labs:{simulations:!0}}}):await P({projectSlug:n,metadataUpdate:{labs:{simulations:!1}}})}catch{}l.aiMode="interactive"}catch(d){o.fail("Failed to create project"),v(d.message);return}const f=p.length>0?`, ${p.map(d=>d.framework).join(", ")}`:"";console.log(),b(`✨ Initialized ${n} (${u}${f})`),a.autoInit||(console.log(),console.log(x.bold(' Run "codeyam" to start the dashboard')),console.log(' Run "codeyam --help" for all commands'))}catch(n){o.fail("Failed to initialize project"),v(n.message),process.exit(1)}}};function re(a){return y.existsSync(e.join(a,"pnpm-lock.yaml"))?"pnpm":y.existsSync(e.join(a,"yarn.lock"))?"yarn":(y.existsSync(e.join(a,"package-lock.json")),"npm")}const D=[".codeyam/db.sqlite3",".codeyam/db.sqlite3-wal",".codeyam/db.sqlite3-shm",".codeyam/secrets.json",".codeyam/server.json",".codeyam/server-state.json",".codeyam/queue.json",".codeyam/active-scenario.json",".codeyam/editor-step.json",".codeyam/editor-user-prompt.txt",".codeyam/claude-session-id.txt",".codeyam/editor-mode-context.md",".codeyam/dev-mode-context.md",".codeyam/logs/",".codeyam/llm-calls/",".codeyam/captures/",".codeyam/results/",".codeyam/tmp/",".codeyam/rules/",".codeyam/bin/"];async function ae(a){const t=e.join(a,".gitignore");let r="";try{r=await m.readFile(t,"utf8")}catch{}const i=r.split(`
|
|
3
|
+
`),s=i.findIndex(n=>n.trim()===".codeyam"||n.trim()==="/.codeyam");if(s!==-1){const n=s>0&&i[s-1].trim().startsWith("# CodeYam local files")?s-1:s;i.splice(n,s-n+1),r=i.join(`
|
|
4
|
+
`)}if(!D.some(n=>i.some(u=>u.trim()===n))){const n=`
|
|
5
|
+
# CodeYam - local only (not shared)
|
|
6
|
+
`+D.join(`
|
|
7
|
+
`)+`
|
|
8
|
+
`,u=r+(r&&!r.endsWith(`
|
|
9
|
+
`)?`
|
|
10
|
+
`:"")+n;await m.writeFile(t,u,"utf8")}}export{tt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"cli-spinners";import e from"chalk";class t{constructor(s=!1){this.spinnerIndex=0,this.currentMessage="",this.isSpinning=!1,this.spinnerFrames=r.dots.frames,this.spinnerInterval=r.dots.interval,this.isTTY=process.stdout.isTTY,this.quiet=s}start(s){if(this.currentMessage=s,this.isSpinning=!0,this.spinnerIndex=0,t.activeInstance=this,!this.quiet){if(!this.isTTY){console.log(e.cyan("⠿")+" "+this.currentMessage);return}process.stdout.write("\r\x1B[K"+e.cyan(this.spinnerFrames[this.spinnerIndex])+" "+this.currentMessage),this.spinnerIndex=(this.spinnerIndex+1)%this.spinnerFrames.length,this.spinner=setInterval(()=>{process.stdout.write("\r\x1B[K"+e.cyan(this.spinnerFrames[this.spinnerIndex])+" "+this.currentMessage),this.spinnerIndex=(this.spinnerIndex+1)%this.spinnerFrames.length},this.spinnerInterval),this.spinner.unref()}}static pause(){var s;(s=t.activeInstance)==null||s.stop()}static resume(){const s=t.activeInstance;s&&s.currentMessage&&s.start(s.currentMessage)}update(s){this.currentMessage=s,!this.quiet&&(this.isTTY||console.log(e.cyan("⠿")+" "+this.currentMessage))}succeed(s){this.stop();const i=s||this.currentMessage;this.quiet||(this.isTTY||i!==this.currentMessage)&&console.log(e.green("✓")+" "+i)}fail(s){this.stop();const i=s||this.currentMessage;this.quiet||console.log(e.red("✗")+" "+i)}warn(s){this.stop(),!this.quiet&&console.log(e.yellow("⚠")+" "+s)}info(s){this.stop(),!this.quiet&&console.log(e.blue("ℹ")+" "+s)}stop(){this.spinner&&(clearInterval(this.spinner),this.spinner=void 0),this.isSpinning&&this.isTTY&&(process.stdout.write("\r\x1B[K"),this.isSpinning=!1),this===t.activeInstance&&(t.activeInstance=void 0)}}async function c(n){t.pause();try{return await n()}finally{t.resume()}}const h=n=>console.log(e.green("✓")+" "+n),l=n=>console.log(e.red("✗")+" "+n),u=n=>console.log(e.blue("ℹ")+" "+n),p=n=>{console.log(),console.log(e.cyan.bold("🚀 "+n)),console.log()};export{t as P,l as e,p as h,u as i,h as s,c as w};
|