ronin-skillforce 0.0.0-stage → 0.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -0
- package/LICENSE +202 -0
- package/NOTICE +19 -0
- package/README.md +258 -2
- package/bin/cli.js +823 -0
- package/bin/commands/archive.js +192 -0
- package/bin/commands/capstone-status.js +82 -0
- package/bin/commands/check.js +298 -0
- package/bin/commands/create.js +226 -0
- package/bin/commands/doctor.js +392 -0
- package/bin/commands/import.js +557 -0
- package/bin/commands/next.js +125 -0
- package/bin/commands/review.js +207 -0
- package/bin/commands/status.js +114 -0
- package/bin/commands/studio-autostart.js +414 -0
- package/bin/commands/studio-state.js +159 -0
- package/bin/commands/studio.js +831 -0
- package/bin/commands/trail.js +361 -0
- package/bin/commands/web.js +348 -0
- package/bin/course-reader.js +602 -0
- package/bin/node-version.js +60 -0
- package/bin/platforms/_shared.js +337 -0
- package/bin/platforms/claude.js +85 -0
- package/bin/platforms/cursor.js +52 -0
- package/bin/platforms/gemini.js +64 -0
- package/bin/platforms/opencode.js +114 -0
- package/bin/registry-helpers.js +504 -0
- package/bin/static-server.js +153 -0
- package/bin/studio-store.js +94 -0
- package/bin/sync-shared.sh +5 -0
- package/package.json +92 -4
- package/plugin.json +139 -0
- package/shared/SKILL.md +598 -0
- package/shared/agents/coach.md +228 -0
- package/shared/agents/navigator.md +208 -0
- package/shared/agents/professor.md +354 -0
- package/shared/agents/researcher.md +181 -0
- package/shared/agents/spotter.md +128 -0
- package/shared/commands/professor/archive.md +96 -0
- package/shared/commands/professor/capstone-review.md +79 -0
- package/shared/commands/professor/capstone.md +34 -0
- package/shared/commands/professor/discuss.md +18 -0
- package/shared/commands/professor/done.md +72 -0
- package/shared/commands/professor/export.md +69 -0
- package/shared/commands/professor/hint.md +120 -0
- package/shared/commands/professor/navigator.md +93 -0
- package/shared/commands/professor/new-topic.md +73 -0
- package/shared/commands/professor/next.md +178 -0
- package/shared/commands/professor/note.md +63 -0
- package/shared/commands/professor/onboard.md +95 -0
- package/shared/commands/professor/progress.md +46 -0
- package/shared/commands/professor/publish.md +93 -0
- package/shared/commands/professor/quiz.md +27 -0
- package/shared/commands/professor/recall.md +74 -0
- package/shared/commands/professor/review.md +57 -0
- package/shared/commands/professor/schedule.md +75 -0
- package/shared/commands/professor/skill-export.md +86 -0
- package/shared/commands/professor/spotter.md +93 -0
- package/shared/commands/professor/stuck.md +51 -0
- package/shared/commands/professor/switch.md +50 -0
- package/shared/commands/professor/syllabus.md +9 -0
- package/shared/commands/professor/template-export.md +91 -0
- package/shared/commands/professor/template-import.md +111 -0
- package/shared/commands/professor/worktrees.md +54 -0
- package/shared/hooks/pre-compact.js +221 -0
- package/studio/README.md +313 -0
- package/studio/dist/assets/BetaReportPanel-BJ9HIAnz.js +1 -0
- package/studio/dist/assets/Capstone-CoUU-jP7.js +6 -0
- package/studio/dist/assets/CodeWorkspace-BNrL4qvR.js +2 -0
- package/studio/dist/assets/Course-BMGTXus_.js +1 -0
- package/studio/dist/assets/Editor-Cw9j3cnp.js +53 -0
- package/studio/dist/assets/Home-D2woITq5.js +1 -0
- package/studio/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/studio/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/studio/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/studio/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/studio/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/studio/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/studio/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/studio/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/studio/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/studio/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/studio/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/studio/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/studio/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/studio/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/studio/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/studio/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/studio/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/studio/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/studio/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/studio/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/studio/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/studio/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/studio/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/studio/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/studio/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/studio/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/studio/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/studio/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/studio/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/studio/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/studio/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/studio/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/studio/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/studio/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/studio/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/studio/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/studio/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/studio/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/studio/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/studio/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/studio/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/studio/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/studio/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/studio/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/studio/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/studio/dist/assets/Lesson-CYQhrDCZ.js +2 -0
- package/studio/dist/assets/NewCourse-CMpwVRQb.js +952 -0
- package/studio/dist/assets/Progress-2rS19Fur.js +1 -0
- package/studio/dist/assets/Review-SlqK-hjp.js +1 -0
- package/studio/dist/assets/Settings-t42u7n9H.js +1 -0
- package/studio/dist/assets/TutorPanel-DQDWIU7f.js +123 -0
- package/studio/dist/assets/abnfDiagram-WEYOIA3C-jTUmGBuB.js +1 -0
- package/studio/dist/assets/anthropic-iIm2l85r.js +15 -0
- package/studio/dist/assets/arc-Y1ARJVZ4.js +1 -0
- package/studio/dist/assets/architecture-WOLXFQ4H-Ch9Ld_vv.js +1 -0
- package/studio/dist/assets/architectureDiagram-ZHVYKT53-Dy-z6wsy.js +36 -0
- package/studio/dist/assets/array-BifhSqXX.js +1 -0
- package/studio/dist/assets/blockDiagram-RJAE7QA3-2fHVrc6N.js +140 -0
- package/studio/dist/assets/bridge-Cr0q4rLp.js +1 -0
- package/studio/dist/assets/c4Diagram-XDPPPE54-BuuKlG4V.js +38 -0
- package/studio/dist/assets/capstone-DhwBeNqk.js +135 -0
- package/studio/dist/assets/card-store-CVMBc-Pv.js +1 -0
- package/studio/dist/assets/channel-M_JkdHrL.js +1 -0
- package/studio/dist/assets/chunk-2E7WHVMD-lZdQWttk.js +88 -0
- package/studio/dist/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/studio/dist/assets/chunk-4EMNKR2T-C6kbMwke.js +1 -0
- package/studio/dist/assets/chunk-55XCU76K-rkBzkZog.js +1 -0
- package/studio/dist/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/studio/dist/assets/chunk-7S6XSTFO-Skg347QF.js +2 -0
- package/studio/dist/assets/chunk-AQDTSKZB-0pSDBJ23.js +72 -0
- package/studio/dist/assets/chunk-DSNLSHJZ-BaeQDl2i.js +129 -0
- package/studio/dist/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
- package/studio/dist/assets/chunk-HAGFOTED-BEm00juw.js +62 -0
- package/studio/dist/assets/chunk-HNE4Q36P-DyCR-LvS.js +1 -0
- package/studio/dist/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
- package/studio/dist/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/studio/dist/assets/chunk-NGNAAXSQ-C2Wy9Xmz.js +136 -0
- package/studio/dist/assets/chunk-NQOKRVIF-BNJ9uMmB.js +213 -0
- package/studio/dist/assets/chunk-UHW7PFBP-DqJczBLs.js +1 -0
- package/studio/dist/assets/chunk-VQ5W62QI-CVWYSP5Q.js +1 -0
- package/studio/dist/assets/chunk-WQQL4CDK-DJf0Dx05.js +10 -0
- package/studio/dist/assets/chunk-XXDRQBXY-CnbRkih_.js +1 -0
- package/studio/dist/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/studio/dist/assets/chunk-YZO67HFG-BFUm_JHA.js +1 -0
- package/studio/dist/assets/chunk-ZAUX2LTX-C5ETkkSE.js +1 -0
- package/studio/dist/assets/chunk-ZCHMQSOR-WVX9r9PZ.js +2 -0
- package/studio/dist/assets/classDiagram-v2-4MYWR3UA-CI77SpuR.js +217 -0
- package/studio/dist/assets/cose-bilkent-JH36ORCC-DMBAZFnj.js +1 -0
- package/studio/dist/assets/course-export-C8jSPuda.js +1 -0
- package/studio/dist/assets/cynefin-EF2NZ3EQ-CLffmM25.js +1 -0
- package/studio/dist/assets/cynefinDiagram-WF24UDRP-BvLwocOb.js +62 -0
- package/studio/dist/assets/cytoscape.esm-CHBj4VkZ.js +321 -0
- package/studio/dist/assets/dagre-NK4GIZVX-C2nMAVdh.js +4 -0
- package/studio/dist/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/studio/dist/assets/diagram-CBK3MWTC-Bid-pdax.js +24 -0
- package/studio/dist/assets/diagram-I5XIIV2D-DYJeAvzl.js +24 -0
- package/studio/dist/assets/diagram-ODIL2UCW-B06X2r_F.js +30 -0
- package/studio/dist/assets/diagram-PFBEJUXE-CwY--5Rz.js +3 -0
- package/studio/dist/assets/diagram-RJA3I4VV-4SqhH8zw.js +41 -0
- package/studio/dist/assets/diagram-TYUNFSNR-CrW4AIM9.js +200 -0
- package/studio/dist/assets/dist-CumnGVmJ.js +1 -0
- package/studio/dist/assets/ebnfDiagram-V4P3TTPT-xeoCmH-d.js +1 -0
- package/studio/dist/assets/elk-QONTBCTQ-Dadmz6iS.js +27 -0
- package/studio/dist/assets/erDiagram-KYQIGQAA-CSuH0bbF.js +99 -0
- package/studio/dist/assets/error-BTdmRKoB.js +1 -0
- package/studio/dist/assets/errors-BZa_CNHL.js +1 -0
- package/studio/dist/assets/eventmodeling-K75KTNOO-CciVfx3I.js +1 -0
- package/studio/dist/assets/fetch-local-DG3O3hmQ.js +4 -0
- package/studio/dist/assets/flowDiagram-IUGLLWBU-DgNR54qK.js +1 -0
- package/studio/dist/assets/ganttDiagram-R7GPNTJY-C0wtA-2y.js +292 -0
- package/studio/dist/assets/gitGraph-VSP46ZUC-BXoDzaA3.js +1 -0
- package/studio/dist/assets/gitGraphDiagram-PDYL7XHY-vZBlNRPe.js +106 -0
- package/studio/dist/assets/graphlib-DS17s2tU.js +1 -0
- package/studio/dist/assets/index-CS8XPYbB.js +313 -0
- package/studio/dist/assets/index-CVenTTOY.css +2 -0
- package/studio/dist/assets/info-OHQRW6UA-bs2Qpf7P.js +1 -0
- package/studio/dist/assets/infoDiagram-MVDRKAX5-rPJio6-1.js +2 -0
- package/studio/dist/assets/init-C-OQMol4.js +1 -0
- package/studio/dist/assets/ishikawaDiagram-HPEHV2GE-CXf9XFff.js +70 -0
- package/studio/dist/assets/journeyDiagram-BOSHW7O7-C3MSH79o.js +139 -0
- package/studio/dist/assets/js.worker-AD7DjksO.js +4 -0
- package/studio/dist/assets/kanban-definition-FNSA4HC5-Bdh7SB4n.js +89 -0
- package/studio/dist/assets/katex-B_JcIwqj.js +257 -0
- package/studio/dist/assets/katex-BgsA2lO1.css +1 -0
- package/studio/dist/assets/line-CHkoQXJF.js +1 -0
- package/studio/dist/assets/linear-C9iwaMOi.js +1 -0
- package/studio/dist/assets/mermaid-parser.core-Do1oxD1S.js +7 -0
- package/studio/dist/assets/mermaid.core-DgZUD0sU.js +44 -0
- package/studio/dist/assets/mindmap-definition-6OY57UG3-PUaK6oE_.js +98 -0
- package/studio/dist/assets/node.browser-DkpMze_r.js +1 -0
- package/studio/dist/assets/node.browser-HQ5SKBOf.js +1 -0
- package/studio/dist/assets/ollama-bJNp3jaD.js +1 -0
- package/studio/dist/assets/openai-compatible-0tmAyMlN.js +1 -0
- package/studio/dist/assets/ordinal-BDEzSJ7C.js +1 -0
- package/studio/dist/assets/packet-JDAUHWVQ-vf2FtqFr.js +1 -0
- package/studio/dist/assets/path-fybaL0A-.js +1 -0
- package/studio/dist/assets/pegDiagram-ECIUJNBX-NEVrgPTY.js +1 -0
- package/studio/dist/assets/pie-XZMESJXO-BIWydVNZ.js +1 -0
- package/studio/dist/assets/pieDiagram-GNMPY74T-BI9_u6rT.js +39 -0
- package/studio/dist/assets/python.worker-CzTrFdd9.js +24 -0
- package/studio/dist/assets/quadrantDiagram-D57K4MC3-ryNpoBC5.js +7 -0
- package/studio/dist/assets/radar-ABXABTNO-D8TjnvBB.js +1 -0
- package/studio/dist/assets/railroad-I3PHUGI6-BmEDV5kf.js +1 -0
- package/studio/dist/assets/railroad-abnf-LNEFI6M7-Cs_sArMc.js +1 -0
- package/studio/dist/assets/railroad-ebnf-DWYD2UWJ-DYuCq46d.js +1 -0
- package/studio/dist/assets/railroad-peg-JR7BVNR7-BcXSgdMy.js +1 -0
- package/studio/dist/assets/railroadDiagram-Y72NRBL7-DBcc8b2c.js +1 -0
- package/studio/dist/assets/react-B8SKf8RM.js +1 -0
- package/studio/dist/assets/rehype-katex-BfUIq5As.js +259 -0
- package/studio/dist/assets/remark-math-XvZOjmDO.js +5 -0
- package/studio/dist/assets/requirementDiagram-EQYSW5RA-CVcBgM1L.js +84 -0
- package/studio/dist/assets/rolldown-runtime-COiEfhsA.js +1 -0
- package/studio/dist/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/studio/dist/assets/sankeyDiagram-SY24JHO5-DjZ81hDs.js +40 -0
- package/studio/dist/assets/schemas-BOc2YsOP.js +55 -0
- package/studio/dist/assets/sequenceDiagram-BLEHNHQU-BNwOa2S7.js +169 -0
- package/studio/dist/assets/settings-DhwuyNPU.js +1 -0
- package/studio/dist/assets/sizeCapture-INFHLROL-3uHXrFqA.js +1 -0
- package/studio/dist/assets/spec-nAnsSMkw.js +1 -0
- package/studio/dist/assets/sql-wasm-C1D_RJuy.wasm +0 -0
- package/studio/dist/assets/sql.worker-D7pBHOrq.js +4 -0
- package/studio/dist/assets/src-BWF7jMDv.js +1 -0
- package/studio/dist/assets/stateDiagram-v2-A6IESKWZ-BFWa5lEx.js +291 -0
- package/studio/dist/assets/swimlanes-B3ENRKFQ-LfM_Jg6Z.js +1 -0
- package/studio/dist/assets/swimlanesDiagram-AYQRV4AK-BDmpoiGp.js +8 -0
- package/studio/dist/assets/timeline-definition-JXYKGLGB-BwGzkWgZ.js +120 -0
- package/studio/dist/assets/treeView-D4JQ5SDB-MLk3VuRt.js +1 -0
- package/studio/dist/assets/treemap-SAJKECNS-D8iSjp7L.js +1 -0
- package/studio/dist/assets/useStream-rdsR6A7P.js +1 -0
- package/studio/dist/assets/usecaseDiagram-WPOLBNNX-BqxpaNlT.js +328 -0
- package/studio/dist/assets/vennDiagram-Q3Y3IDCW-CpeUDMhQ.js +34 -0
- package/studio/dist/assets/wardley-7MLQ67FV-tAMbCZAj.js +1 -0
- package/studio/dist/assets/wardleyDiagram-IVAIDKWA-CDJViWzt.js +78 -0
- package/studio/dist/assets/xychartDiagram-4URNHDU4-CwaQrd3_.js +7 -0
- package/studio/dist/index.html +20 -0
- package/studio/dist/preview.html +22 -0
- package/studio/migrations/0001_init.sql +188 -0
- package/studio/migrations/0002_external_ids.sql +20 -0
- package/studio/migrations/0003_course_language.sql +12 -0
- package/studio/migrations/0004_capstone.sql +51 -0
- package/studio/migrations/0005_beta_loop.sql +73 -0
- package/studio/migrations/0006_interactive_exercises.sql +49 -0
- package/studio/src/lib/activity.js +92 -0
- package/studio/src/lib/ai/anthropic.js +109 -0
- package/studio/src/lib/ai/bridge.js +126 -0
- package/studio/src/lib/ai/catalog.js +160 -0
- package/studio/src/lib/ai/config.js +70 -0
- package/studio/src/lib/ai/errors.js +95 -0
- package/studio/src/lib/ai/fetch-local.js +104 -0
- package/studio/src/lib/ai/index.js +194 -0
- package/studio/src/lib/ai/ollama.js +136 -0
- package/studio/src/lib/ai/openai-compatible.js +101 -0
- package/studio/src/lib/ai/provider-utils.js +107 -0
- package/studio/src/lib/ai/sse.js +99 -0
- package/studio/src/lib/ai/status.js +92 -0
- package/studio/src/lib/ai/useStream.js +109 -0
- package/studio/src/lib/beta/metrics.js +147 -0
- package/studio/src/lib/beta/report.js +134 -0
- package/studio/src/lib/capstone-evidence.js +758 -0
- package/studio/src/lib/capstone.js +663 -0
- package/studio/src/lib/chat-store.js +128 -0
- package/studio/src/lib/course-export.js +38 -0
- package/studio/src/lib/course.js +187 -0
- package/studio/src/lib/exercises/journal-entry.js +259 -0
- package/studio/src/lib/exercises/placement.js +31 -0
- package/studio/src/lib/exercises/registry.js +19 -0
- package/studio/src/lib/exercises/spec.js +129 -0
- package/studio/src/lib/i18n/detect.js +162 -0
- package/studio/src/lib/i18n/en/app.json +23 -0
- package/studio/src/lib/i18n/en/betaReport.json +55 -0
- package/studio/src/lib/i18n/en/capstone.json +57 -0
- package/studio/src/lib/i18n/en/common.json +25 -0
- package/studio/src/lib/i18n/en/course.json +27 -0
- package/studio/src/lib/i18n/en/data.json +35 -0
- package/studio/src/lib/i18n/en/durability.json +5 -0
- package/studio/src/lib/i18n/en/errors.json +20 -0
- package/studio/src/lib/i18n/en/exercises.json +55 -0
- package/studio/src/lib/i18n/en/externalEvidence.json +76 -0
- package/studio/src/lib/i18n/en/home.json +18 -0
- package/studio/src/lib/i18n/en/lesson.json +33 -0
- package/studio/src/lib/i18n/en/nav.json +8 -0
- package/studio/src/lib/i18n/en/newCourse.json +51 -0
- package/studio/src/lib/i18n/en/onboarding.json +35 -0
- package/studio/src/lib/i18n/en/playwrightTemplate.json +20 -0
- package/studio/src/lib/i18n/en/practice.json +79 -0
- package/studio/src/lib/i18n/en/provider.json +27 -0
- package/studio/src/lib/i18n/en/providerMeta.json +26 -0
- package/studio/src/lib/i18n/en/reflection.json +17 -0
- package/studio/src/lib/i18n/en/revision.json +52 -0
- package/studio/src/lib/i18n/en/runnerNotice.json +14 -0
- package/studio/src/lib/i18n/en/settings.json +12 -0
- package/studio/src/lib/i18n/en/storage.json +49 -0
- package/studio/src/lib/i18n/en/tutor.json +39 -0
- package/studio/src/lib/i18n/en/workspace.json +50 -0
- package/studio/src/lib/i18n/index.js +144 -0
- package/studio/src/lib/i18n/languages.js +93 -0
- package/studio/src/lib/i18n/vi/app.json +23 -0
- package/studio/src/lib/i18n/vi/betaReport.json +55 -0
- package/studio/src/lib/i18n/vi/capstone.json +57 -0
- package/studio/src/lib/i18n/vi/common.json +25 -0
- package/studio/src/lib/i18n/vi/course.json +27 -0
- package/studio/src/lib/i18n/vi/data.json +35 -0
- package/studio/src/lib/i18n/vi/durability.json +5 -0
- package/studio/src/lib/i18n/vi/errors.json +20 -0
- package/studio/src/lib/i18n/vi/exercises.json +55 -0
- package/studio/src/lib/i18n/vi/externalEvidence.json +76 -0
- package/studio/src/lib/i18n/vi/home.json +18 -0
- package/studio/src/lib/i18n/vi/lesson.json +33 -0
- package/studio/src/lib/i18n/vi/nav.json +8 -0
- package/studio/src/lib/i18n/vi/newCourse.json +51 -0
- package/studio/src/lib/i18n/vi/onboarding.json +35 -0
- package/studio/src/lib/i18n/vi/playwrightTemplate.json +20 -0
- package/studio/src/lib/i18n/vi/practice.json +79 -0
- package/studio/src/lib/i18n/vi/provider.json +27 -0
- package/studio/src/lib/i18n/vi/providerMeta.json +26 -0
- package/studio/src/lib/i18n/vi/reflection.json +17 -0
- package/studio/src/lib/i18n/vi/revision.json +52 -0
- package/studio/src/lib/i18n/vi/runnerNotice.json +14 -0
- package/studio/src/lib/i18n/vi/settings.json +12 -0
- package/studio/src/lib/i18n/vi/storage.json +49 -0
- package/studio/src/lib/i18n/vi/tutor.json +39 -0
- package/studio/src/lib/i18n/vi/workspace.json +50 -0
- package/studio/src/lib/ids.js +10 -0
- package/studio/src/lib/json.js +26 -0
- package/studio/src/lib/markdown.js +74 -0
- package/studio/src/lib/prompts/base.js +139 -0
- package/studio/src/lib/prompts/capstone.js +777 -0
- package/studio/src/lib/prompts/course.js +150 -0
- package/studio/src/lib/prompts/lesson.js +275 -0
- package/studio/src/lib/prompts/practice.js +511 -0
- package/studio/src/lib/prompts/tutor.js +509 -0
- package/studio/src/lib/repo/blocked-adapter.js +69 -0
- package/studio/src/lib/repo/events.js +239 -0
- package/studio/src/lib/repo/idb-adapter.js +226 -0
- package/studio/src/lib/repo/index.js +1315 -0
- package/studio/src/lib/repo/memory-adapter.js +115 -0
- package/studio/src/lib/repo/remote-adapter.js +158 -0
- package/studio/src/lib/repo/schema.js +143 -0
- package/studio/src/lib/repo/select-adapter.js +345 -0
- package/studio/src/lib/router.js +71 -0
- package/studio/src/lib/runner/browser.js +244 -0
- package/studio/src/lib/runner/checks.js +248 -0
- package/studio/src/lib/runner/current-code.js +98 -0
- package/studio/src/lib/runner/esm-cjs.js +109 -0
- package/studio/src/lib/runner/hash.js +34 -0
- package/studio/src/lib/runner/history.js +48 -0
- package/studio/src/lib/runner/index.js +168 -0
- package/studio/src/lib/runner/languages.js +258 -0
- package/studio/src/lib/runner/local.js +139 -0
- package/studio/src/lib/runner/path.js +104 -0
- package/studio/src/lib/runner/skeleton.js +315 -0
- package/studio/src/lib/runner/strip-types.js +134 -0
- package/studio/src/lib/settings.js +399 -0
- package/studio/src/lib/srs.js +39 -0
- package/templates/agent/settings.json +6 -0
- package/templates/claude/plugin.json +139 -0
- package/templates/claude/settings.json +15 -0
- package/templates/cursor/professor.mdc +4 -0
- package/templates/cursor/settings.json +18 -0
- package/templates/gemini/GEMINI.md +30 -0
- package/templates/gemini/settings.json +5 -0
- package/templates/opencode/opencode.json +3 -0
- package/templates/researcher/README.md +61 -0
- package/templates/researcher/settings.json +18 -0
- package/web/client/components.json +15 -0
- package/web/client/index.html +12 -0
- package/web/client/package-lock.json +8732 -0
- package/web/client/package.json +39 -0
- package/web/client/postcss.config.js +6 -0
- package/web/client/src/App.jsx +140 -0
- package/web/client/src/api/client.js +357 -0
- package/web/client/src/components/ChatPanel.jsx +417 -0
- package/web/client/src/components/CommandPills.jsx +50 -0
- package/web/client/src/components/DeprecationBanner.jsx +21 -0
- package/web/client/src/components/ExerciseEditor.jsx +164 -0
- package/web/client/src/components/Header.jsx +119 -0
- package/web/client/src/components/LecturePanel.jsx +342 -0
- package/web/client/src/components/MobileTabSwitcher.jsx +51 -0
- package/web/client/src/components/SplitPane.jsx +42 -0
- package/web/client/src/components/ui/alert.jsx +38 -0
- package/web/client/src/components/ui/badge.jsx +24 -0
- package/web/client/src/components/ui/button.jsx +23 -0
- package/web/client/src/components/ui/select.jsx +74 -0
- package/web/client/src/hooks/useSSE.js +152 -0
- package/web/client/src/hooks/useWebSocket.js +98 -0
- package/web/client/src/index.css +23 -0
- package/web/client/src/lib/utils.js +6 -0
- package/web/client/src/main.jsx +12 -0
- package/web/client/src/utils/markdown.js +50 -0
- package/web/client/tailwind.config.js +8 -0
- package/web/client/vite.config.js +21 -0
- package/web/dist/assets/index-C1W0eXIQ.js +294 -0
- package/web/dist/assets/index-C3OUx70T.css +1 -0
- package/web/dist/index.html +13 -0
- package/web/lecture-archive.js +172 -0
- package/web/legacy-server.js +1277 -0
- package/web/package-lock.json +855 -0
- package/web/package.json +10 -0
- package/web/security.js +1016 -0
- package/web/server.js +390 -0
- package/web/studio-api/agents.js +580 -0
- package/web/studio-api/bridge.js +199 -0
- package/web/studio-api/db.js +66 -0
- package/web/studio-api/guards.js +201 -0
- package/web/studio-api/health.js +538 -0
- package/web/studio-api.js +214 -0
- package/web/studio-db.js +380 -0
- package/web/studio-runner.js +568 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `skillforce create <slug> --kind <kind>` — create the course folder the
|
|
3
|
+
* way `professor:new-topic` promises, so the agent never improvises it (RON-249).
|
|
4
|
+
*
|
|
5
|
+
* - `programming`: a registered git worktree at `learning/<slug>/` on branch
|
|
6
|
+
* `learning/<slug>`, verified after creation; rolled back on any failure. A new
|
|
7
|
+
* branch is an orphan branch, so the course starts with no host files or history.
|
|
8
|
+
* - other kinds: a plain `learning/<slug>/` folder.
|
|
9
|
+
*
|
|
10
|
+
* `skillforce save <slug> [-m msg]` commits the course worktree so its
|
|
11
|
+
* state lives in git history, not only in untracked files.
|
|
12
|
+
*/
|
|
13
|
+
import { execFileSync } from 'child_process';
|
|
14
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync } from 'fs';
|
|
15
|
+
import { isAbsolute, join, relative } from 'path';
|
|
16
|
+
import { COURSE_KINDS } from '../course-reader.js';
|
|
17
|
+
import { style } from '../registry-helpers.js';
|
|
18
|
+
|
|
19
|
+
export const SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
20
|
+
|
|
21
|
+
function git(cwd, args) {
|
|
22
|
+
return execFileSync('git', args, { cwd, encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function tryGit(cwd, args) {
|
|
26
|
+
try { return git(cwd, args); } catch { return null; }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function gitOutput(cwd, args) {
|
|
30
|
+
try {
|
|
31
|
+
return execFileSync('git', args, { cwd, encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] });
|
|
32
|
+
} catch (err) {
|
|
33
|
+
return `${err.stdout || ''}${err.stderr || ''}`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Whether `git worktree add --orphan` exists, probed from the usage text (`-h` changes nothing).
|
|
39
|
+
* @param {string} cwd
|
|
40
|
+
* @returns {boolean}
|
|
41
|
+
*/
|
|
42
|
+
export function supportsOrphanWorktree(cwd) {
|
|
43
|
+
return /--orphan\b/.test(gitOutput(cwd, ['worktree', 'add', '-h']));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Registered worktrees as `{ path, branch }` (branch without `refs/heads/`). */
|
|
47
|
+
export function listWorktrees(cwd) {
|
|
48
|
+
const out = tryGit(cwd, ['worktree', 'list', '--porcelain']) || '';
|
|
49
|
+
const trees = [];
|
|
50
|
+
for (const block of out.split('\n\n')) {
|
|
51
|
+
const path = block.match(/^worktree (.+)$/m)?.[1];
|
|
52
|
+
if (!path) continue;
|
|
53
|
+
const branch = block.match(/^branch refs\/heads\/(.+)$/m)?.[1] || null;
|
|
54
|
+
trees.push({ path: realpathSync.native(path), branch });
|
|
55
|
+
}
|
|
56
|
+
return trees;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function isCourseWorktree(cwd, dir, branch) {
|
|
60
|
+
if (!existsSync(dir)) return false;
|
|
61
|
+
const real = realpathSync.native(dir);
|
|
62
|
+
return listWorktrees(cwd).some((t) => t.path === real && t.branch === branch);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** An existing ref that would stop git from writing `refs/heads/<branch>` (D/F conflict). */
|
|
66
|
+
function refBlocked(root, branch) {
|
|
67
|
+
const parts = branch.split('/');
|
|
68
|
+
for (let i = 1; i < parts.length; i++) {
|
|
69
|
+
const ancestor = `refs/heads/${parts.slice(0, i).join('/')}`;
|
|
70
|
+
if (tryGit(root, ['rev-parse', '--verify', '-q', ancestor]) !== null) return true;
|
|
71
|
+
}
|
|
72
|
+
const descendants = tryGit(
|
|
73
|
+
root, ['for-each-ref', '--count=1', '--format=%(refname)', `refs/heads/${branch}/`],
|
|
74
|
+
);
|
|
75
|
+
return (descendants || '') !== '';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Keep a path inside the host repo out of `git status` without touching tracked files.
|
|
80
|
+
* @returns {string|null} the exclude line ensured, or null when git already ignores the path.
|
|
81
|
+
*/
|
|
82
|
+
export function excludeRepoPath(root, cwd, target) {
|
|
83
|
+
const abs = isAbsolute(target) ? target : join(cwd, target);
|
|
84
|
+
if (tryGit(root, ['check-ignore', '-q', abs]) !== null) return null;
|
|
85
|
+
const commonDir = git(root, ['rev-parse', '--git-common-dir']);
|
|
86
|
+
const infoDir = join(isAbsolute(commonDir) ? commonDir : join(root, commonDir), 'info');
|
|
87
|
+
mkdirSync(infoDir, { recursive: true });
|
|
88
|
+
const excludeFile = join(infoDir, 'exclude');
|
|
89
|
+
const line = `/${relative(root, abs).split('\\').join('/')}/`;
|
|
90
|
+
const current = existsSync(excludeFile) ? readFileSync(excludeFile, 'utf-8') : '';
|
|
91
|
+
if (current.split('\n').includes(line)) return line;
|
|
92
|
+
appendFileSync(excludeFile, `${current && !current.endsWith('\n') ? '\n' : ''}${line}\n`);
|
|
93
|
+
return line;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Keep `learning/` out of the host repo's `git status`. */
|
|
97
|
+
function excludeLearningDir(root, cwd) {
|
|
98
|
+
return excludeRepoPath(root, cwd, join(cwd, 'learning'));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Create (or reattach) the course directory. Throws with a user-facing message.
|
|
103
|
+
* @param {{ cwd: string, slug: string, kind: string, orphanStrategy?: 'auto'|'fallback' }} options
|
|
104
|
+
* `orphanStrategy: 'fallback'` forces the multi-step orphan procedure (tests only).
|
|
105
|
+
* @returns {{ slug: string, kind: string, dir: string, branch: string|null, created: boolean }}
|
|
106
|
+
*/
|
|
107
|
+
export function createCourse({ cwd, slug, kind, orphanStrategy = 'auto' }) {
|
|
108
|
+
if (!SLUG_RE.test(slug || '')) {
|
|
109
|
+
throw new Error(`Invalid slug ${JSON.stringify(slug)} — use lowercase a-z, 0-9 and single hyphens.`);
|
|
110
|
+
}
|
|
111
|
+
if (!COURSE_KINDS.includes(kind)) {
|
|
112
|
+
throw new Error(`Invalid kind ${JSON.stringify(kind)} — use one of: ${COURSE_KINDS.join(', ')}.`);
|
|
113
|
+
}
|
|
114
|
+
const dir = join(cwd, 'learning', slug);
|
|
115
|
+
|
|
116
|
+
if (kind !== 'programming') {
|
|
117
|
+
const created = !existsSync(dir);
|
|
118
|
+
mkdirSync(dir, { recursive: true });
|
|
119
|
+
return { slug, kind, dir, branch: null, created };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const root = tryGit(cwd, ['rev-parse', '--show-toplevel']);
|
|
123
|
+
if (!root) {
|
|
124
|
+
throw new Error('Programming courses require a git repository. Run `git init` and make a first commit.');
|
|
125
|
+
}
|
|
126
|
+
if (tryGit(root, ['rev-parse', '--verify', '-q', 'HEAD']) === null) {
|
|
127
|
+
throw new Error('This git repository has no commits yet. Make a first commit, then retry.');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const branch = `learning/${slug}`;
|
|
131
|
+
if (isCourseWorktree(root, dir, branch)) {
|
|
132
|
+
excludeLearningDir(root, cwd);
|
|
133
|
+
return { slug, kind, dir, branch, created: false };
|
|
134
|
+
}
|
|
135
|
+
if (existsSync(dir)) {
|
|
136
|
+
throw new Error(`${relative(cwd, dir)}/ already exists but is not the ${branch} worktree. ` +
|
|
137
|
+
'Move it aside or pick another slug — nothing was changed.');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const branchExists = tryGit(root, ['rev-parse', '--verify', '-q', `refs/heads/${branch}`]) !== null;
|
|
141
|
+
if (!branchExists && refBlocked(root, branch)) {
|
|
142
|
+
throw new Error(`Cannot create the ${branch} branch — an existing branch name blocks it. ` +
|
|
143
|
+
'Rename or delete it — nothing was kept.');
|
|
144
|
+
}
|
|
145
|
+
const useFallback = orphanStrategy === 'fallback' || !supportsOrphanWorktree(root);
|
|
146
|
+
try {
|
|
147
|
+
if (branchExists) {
|
|
148
|
+
// Reattach an existing branch (course restored after its worktree was pruned).
|
|
149
|
+
git(root, ['worktree', 'add', dir, branch]);
|
|
150
|
+
} else if (useFallback) {
|
|
151
|
+
git(root, ['worktree', 'add', '--detach', dir]);
|
|
152
|
+
git(dir, ['switch', '--orphan', branch]);
|
|
153
|
+
} else {
|
|
154
|
+
git(root, ['worktree', 'add', '--orphan', '-b', branch, dir]);
|
|
155
|
+
}
|
|
156
|
+
if (!isCourseWorktree(root, dir, branch)) throw new Error('worktree is not registered after creation');
|
|
157
|
+
if (!branchExists && tryGit(dir, ['rev-parse', '--verify', '-q', 'HEAD']) !== null) {
|
|
158
|
+
throw new Error(`branch ${branch} is not orphan`);
|
|
159
|
+
}
|
|
160
|
+
} catch (err) {
|
|
161
|
+
tryGit(root, ['worktree', 'remove', '--force', dir]);
|
|
162
|
+
if (!branchExists) tryGit(root, ['branch', '-D', branch]);
|
|
163
|
+
try { rmSync(dir, { recursive: true, force: true }); } catch { /* a path through a file (ENOTDIR) has nothing to remove */ }
|
|
164
|
+
tryGit(root, ['worktree', 'prune']);
|
|
165
|
+
const detail = (err.stderr || err.message || '').toString().trim();
|
|
166
|
+
throw new Error(`Could not create the course worktree — nothing was kept. ${detail}`);
|
|
167
|
+
}
|
|
168
|
+
excludeLearningDir(root, cwd);
|
|
169
|
+
return { slug, kind, dir, branch, created: true };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Commit everything in a course worktree. No-op for plain-folder courses.
|
|
174
|
+
* @returns {{ committed: boolean, reason?: string }}
|
|
175
|
+
*/
|
|
176
|
+
export function saveCourse({ cwd, slug, message }) {
|
|
177
|
+
if (!SLUG_RE.test(slug || '')) throw new Error(`Invalid slug ${JSON.stringify(slug)}.`);
|
|
178
|
+
const dir = join(cwd, 'learning', slug);
|
|
179
|
+
if (!existsSync(join(dir, 'COURSE.md'))) throw new Error(`No course at learning/${slug}/.`);
|
|
180
|
+
if (!isCourseWorktree(cwd, dir, `learning/${slug}`)) {
|
|
181
|
+
return { committed: false, reason: 'not a course worktree (plain-folder course)' };
|
|
182
|
+
}
|
|
183
|
+
git(dir, ['add', '-A']);
|
|
184
|
+
if (tryGit(dir, ['diff', '--cached', '--quiet']) !== null) {
|
|
185
|
+
return { committed: false, reason: 'nothing to save' };
|
|
186
|
+
}
|
|
187
|
+
git(dir, ['commit', '-q', '--no-verify', '-m', message || `course(${slug}): save progress`]);
|
|
188
|
+
return { committed: true };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function flagValue(args, name) {
|
|
192
|
+
const i = args.indexOf(name);
|
|
193
|
+
return i !== -1 && args[i + 1] && !args[i + 1].startsWith('-') ? args[i + 1] : null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function positionals(args) {
|
|
197
|
+
const out = [];
|
|
198
|
+
for (let i = 0; i < args.length; i++) {
|
|
199
|
+
if (['--kind', '-m', '--message'].includes(args[i])) { i++; continue; }
|
|
200
|
+
if (!args[i].startsWith('-')) out.push(args[i]);
|
|
201
|
+
}
|
|
202
|
+
return out;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** `create` and `save` share this module; cli.js passes the command name. */
|
|
206
|
+
export async function run({ args = [], cwd = process.cwd(), command = 'create' } = {}) {
|
|
207
|
+
const slug = positionals(args)[0];
|
|
208
|
+
const json = args.includes('--json');
|
|
209
|
+
try {
|
|
210
|
+
const result = command === 'save'
|
|
211
|
+
? saveCourse({ cwd, slug, message: flagValue(args, '-m') || flagValue(args, '--message') })
|
|
212
|
+
: createCourse({ cwd, slug, kind: flagValue(args, '--kind') || 'programming' });
|
|
213
|
+
if (json) console.log(JSON.stringify(result));
|
|
214
|
+
else if (command === 'save') {
|
|
215
|
+
console.log(style(result.committed ? 'success' : 'info',
|
|
216
|
+
result.committed ? `Saved learning/${slug}/` : `Not saved: ${result.reason}`));
|
|
217
|
+
} else {
|
|
218
|
+
const where = result.branch ? `git worktree on branch ${result.branch}` : 'plain folder';
|
|
219
|
+
console.log(style('success', `${result.created ? 'Created' : 'Reusing'} learning/${slug}/ (${where})`));
|
|
220
|
+
}
|
|
221
|
+
} catch (err) {
|
|
222
|
+
if (json) console.log(JSON.stringify({ error: err.message }));
|
|
223
|
+
else console.error(style('error', err.message));
|
|
224
|
+
process.exitCode = 1;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `skillforce doctor` — environment checklist with fix hints.
|
|
3
|
+
*/
|
|
4
|
+
import { existsSync, statSync } from 'fs';
|
|
5
|
+
import { join } from 'path';
|
|
6
|
+
import { spawnSync } from 'child_process';
|
|
7
|
+
import http from 'http';
|
|
8
|
+
import net from 'net';
|
|
9
|
+
import os from 'os';
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import { nodeSupportsSqlite } from '../node-version.js';
|
|
12
|
+
import * as security from '../../web/security.js';
|
|
13
|
+
import { AGENT_BINARIES } from '../../web/studio-api/health.js';
|
|
14
|
+
|
|
15
|
+
const AGENT_CLIS = ['claude', 'opencode', 'cursor-agent', 'gemini'];
|
|
16
|
+
const PLATFORMS = ['claude', 'gemini', 'opencode', 'cursor'];
|
|
17
|
+
|
|
18
|
+
/** Look for an executable on PATH without spawning a shell. */
|
|
19
|
+
export function whichPath(cmd, pathValue = process.env.PATH || '') {
|
|
20
|
+
const sep = process.platform === 'win32' ? ';' : ':';
|
|
21
|
+
const exts = process.platform === 'win32' ? ['.cmd', '.exe', ''] : [''];
|
|
22
|
+
for (const dir of pathValue.split(sep)) {
|
|
23
|
+
for (const ext of exts) {
|
|
24
|
+
const full = join(dir, cmd + ext);
|
|
25
|
+
try { if (statSync(full).isFile()) return full; } catch {}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Evaluate the Node.js version string against the >= 18 requirement.
|
|
33
|
+
* @param {string} version e.g. "v20.11.0"
|
|
34
|
+
* @returns {{ status: 'ok'|'fail', detail: string, hint?: string }}
|
|
35
|
+
*/
|
|
36
|
+
export function evaluateNodeVersion(version) {
|
|
37
|
+
const major = Number(String(version).replace(/^v/, '').split('.')[0]);
|
|
38
|
+
if (Number.isFinite(major) && major >= 18) {
|
|
39
|
+
return { status: 'ok', detail: String(version) };
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
status: 'fail',
|
|
43
|
+
detail: `${version} (need >= 18)`,
|
|
44
|
+
hint: 'Install Node.js 18+ from https://nodejs.org',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Reuse per-platform detection from `bin/platforms/*`. */
|
|
49
|
+
export async function detectAgents() {
|
|
50
|
+
const found = [];
|
|
51
|
+
for (const name of PLATFORMS) {
|
|
52
|
+
try {
|
|
53
|
+
const mod = await import(`../platforms/${name}.js`);
|
|
54
|
+
if (mod.detect()) found.push(name);
|
|
55
|
+
} catch {}
|
|
56
|
+
}
|
|
57
|
+
return found;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function professorInstalledFor(cwd) {
|
|
61
|
+
const home = os.homedir();
|
|
62
|
+
const markers = {
|
|
63
|
+
claude: [
|
|
64
|
+
join(home, '.claude', 'commands', 'professor'),
|
|
65
|
+
join(cwd, '.claude', 'commands', 'professor'),
|
|
66
|
+
],
|
|
67
|
+
gemini: [join(home, '.gemini')],
|
|
68
|
+
opencode: [join(home, '.config', 'opencode', 'command'), join(cwd, '.opencode')],
|
|
69
|
+
cursor: [join(cwd, '.cursor', 'rules', 'professor.mdc')],
|
|
70
|
+
};
|
|
71
|
+
return Object.entries(markers)
|
|
72
|
+
.filter(([, paths]) => paths.some((p) => existsSync(p)))
|
|
73
|
+
.map(([name]) => name);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function httpGet(url, timeoutMs = 2000, headers = {}) {
|
|
77
|
+
return new Promise((resolve) => {
|
|
78
|
+
let settled = false;
|
|
79
|
+
const done = (value) => { if (!settled) { settled = true; resolve(value); } };
|
|
80
|
+
let req;
|
|
81
|
+
try {
|
|
82
|
+
req = http.get(url, { headers }, (res) => {
|
|
83
|
+
let body = '';
|
|
84
|
+
res.on('data', (chunk) => { body += chunk; });
|
|
85
|
+
res.on('end', () => {
|
|
86
|
+
const ok = res.statusCode >= 200 && res.statusCode < 300;
|
|
87
|
+
done({ ok, status: res.statusCode, body });
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
} catch { done({ ok: false }); return; }
|
|
91
|
+
req.on('error', () => done({ ok: false }));
|
|
92
|
+
req.setTimeout(timeoutMs, () => {
|
|
93
|
+
try { req.destroy(); } catch {}
|
|
94
|
+
done({ ok: false, timeout: true });
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function portOpen(port, timeoutMs = 800) {
|
|
100
|
+
return new Promise((resolve) => {
|
|
101
|
+
const socket = net.createConnection({ port, host: '127.0.0.1' });
|
|
102
|
+
let settled = false;
|
|
103
|
+
const done = (open) => {
|
|
104
|
+
if (settled) return;
|
|
105
|
+
settled = true;
|
|
106
|
+
try { socket.destroy(); } catch {}
|
|
107
|
+
resolve(open);
|
|
108
|
+
};
|
|
109
|
+
socket.setTimeout(timeoutMs, () => done(false));
|
|
110
|
+
socket.on('connect', () => done(true));
|
|
111
|
+
socket.on('error', () => done(false));
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Pure security-posture checks (D-16, D-26). Exported so tests can assert the whole posture without
|
|
117
|
+
* a live server or the real home directory.
|
|
118
|
+
*
|
|
119
|
+
* @param {object} [opts]
|
|
120
|
+
* @param {Record<string,string|undefined>} [opts.env]
|
|
121
|
+
* @param {string} [opts.platform]
|
|
122
|
+
* @param {typeof statSync} [opts.statImpl]
|
|
123
|
+
* @param {(cmd: string, opts?: object) => string|null} [opts.resolveExecutableImpl]
|
|
124
|
+
* @returns {object[]}
|
|
125
|
+
*/
|
|
126
|
+
export function buildPostureChecks({
|
|
127
|
+
env = process.env,
|
|
128
|
+
platform = process.platform,
|
|
129
|
+
statImpl = statSync,
|
|
130
|
+
resolveExecutableImpl = security.resolveExecutable,
|
|
131
|
+
} = {}) {
|
|
132
|
+
const checks = [];
|
|
133
|
+
const add = (name, status, detail, hint) => checks.push({ name, status, detail, hint });
|
|
134
|
+
|
|
135
|
+
const legacy = env.PROFESSOR_LEGACY === '1';
|
|
136
|
+
add(
|
|
137
|
+
'Security · legacy web',
|
|
138
|
+
legacy ? 'fail' : 'ok',
|
|
139
|
+
legacy ? 'legacy routes/UI are mounted' : 'Studio-only (legacy disabled)',
|
|
140
|
+
legacy
|
|
141
|
+
? 'Stop using --legacy/PROFESSOR_LEGACY and use Professor Studio at http://localhost:5180.'
|
|
142
|
+
: undefined
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const host = env.HOST;
|
|
146
|
+
const loopbackHosts = new Set(['', '127.0.0.1', 'localhost', '::1', '[::1]']);
|
|
147
|
+
if (host && !loopbackHosts.has(host)) {
|
|
148
|
+
add(
|
|
149
|
+
'Security · bind address',
|
|
150
|
+
'warn',
|
|
151
|
+
`${host} (not loopback)`,
|
|
152
|
+
'Bind 127.0.0.1 (default) unless you explicitly need LAN access.'
|
|
153
|
+
);
|
|
154
|
+
} else {
|
|
155
|
+
add('Security · bind address', 'ok', host || '127.0.0.1 (default loopback)');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const tokenFile = security.tokenFilePath(env);
|
|
159
|
+
let mode = null;
|
|
160
|
+
try {
|
|
161
|
+
mode = statImpl(tokenFile).mode & 0o777;
|
|
162
|
+
} catch {
|
|
163
|
+
mode = null;
|
|
164
|
+
}
|
|
165
|
+
if (mode === null) {
|
|
166
|
+
add('Security · token file', 'warn', 'not created yet', 'Created by `skillforce studio`.');
|
|
167
|
+
} else if (mode === 0o600) {
|
|
168
|
+
add('Security · token file', 'ok', `${tokenFile} (0600)`);
|
|
169
|
+
} else {
|
|
170
|
+
add(
|
|
171
|
+
'Security · token file',
|
|
172
|
+
'fail',
|
|
173
|
+
`${tokenFile} (0${mode.toString(8)})`,
|
|
174
|
+
`Run: chmod 600 ${tokenFile}`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
add(
|
|
179
|
+
'Security · bash runner',
|
|
180
|
+
env.PROFESSOR_ALLOW_BASH === '1' ? 'warn' : 'ok',
|
|
181
|
+
env.PROFESSOR_ALLOW_BASH === '1' ? 'Bash runs are allowed' : 'Bash disabled (default)',
|
|
182
|
+
env.PROFESSOR_ALLOW_BASH === '1'
|
|
183
|
+
? 'Unset PROFESSOR_ALLOW_BASH unless a course explicitly needs shell exercises.'
|
|
184
|
+
: undefined
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const wildcardOrigins = security.isWildcardOrigins(env.STUDIO_ORIGINS || '');
|
|
188
|
+
const relaxedHosts = security.isNonLoopbackOptIn(env);
|
|
189
|
+
if (wildcardOrigins && relaxedHosts) {
|
|
190
|
+
add(
|
|
191
|
+
'Security · relaxed env',
|
|
192
|
+
'fail',
|
|
193
|
+
'STUDIO_ORIGINS=* with STUDIO_ALLOW_NON_LOOPBACK',
|
|
194
|
+
'The server refuses this combination. Unset one of them.'
|
|
195
|
+
);
|
|
196
|
+
} else if (wildcardOrigins) {
|
|
197
|
+
add(
|
|
198
|
+
'Security · relaxed env',
|
|
199
|
+
'warn',
|
|
200
|
+
'STUDIO_ORIGINS=*',
|
|
201
|
+
'Any non-null Origin is echoed. Use only while paired on a trusted machine.'
|
|
202
|
+
);
|
|
203
|
+
} else if (relaxedHosts) {
|
|
204
|
+
add(
|
|
205
|
+
'Security · relaxed env',
|
|
206
|
+
'warn',
|
|
207
|
+
'STUDIO_ALLOW_NON_LOOPBACK is set',
|
|
208
|
+
'Non-loopback clients and hosts are allowed. Use only on a trusted network.'
|
|
209
|
+
);
|
|
210
|
+
} else {
|
|
211
|
+
add('Security · relaxed env', 'ok', 'default exact-origin allowlist');
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (platform !== 'win32') {
|
|
215
|
+
add('Windows agent shims', 'ok', 'not applicable');
|
|
216
|
+
} else {
|
|
217
|
+
const unsupported = [];
|
|
218
|
+
for (const [agent, binaries] of Object.entries(AGENT_BINARIES)) {
|
|
219
|
+
for (const binary of binaries) {
|
|
220
|
+
const resolved = resolveExecutableImpl(binary, { platform });
|
|
221
|
+
if (resolved && security.isWindowsCommandShim(resolved, platform)) {
|
|
222
|
+
unsupported.push({ agent, resolved });
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (unsupported.length) {
|
|
227
|
+
add(
|
|
228
|
+
'Windows agent shims',
|
|
229
|
+
'fail',
|
|
230
|
+
unsupported.map((entry) => `${entry.agent} → ${entry.resolved}`).join(', '),
|
|
231
|
+
security.unsupportedWindowsShimMessage('Agent CLI', unsupported[0].resolved)
|
|
232
|
+
);
|
|
233
|
+
} else {
|
|
234
|
+
add('Windows agent shims', 'ok', 'native binaries only');
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return checks;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Token-aware health probe (D-26). Never creates a token: an absent file means the request is sent
|
|
243
|
+
* without `X-Studio-Token`, and a 401 is reported as "reachable but unpaired" rather than "down".
|
|
244
|
+
*
|
|
245
|
+
* @param {{ env?: Record<string,string|undefined>, port?: number, timeoutMs?: number,
|
|
246
|
+
* httpGetImpl?: typeof httpGet, portOpenImpl?: typeof portOpen }} [opts]
|
|
247
|
+
* @returns {Promise<object>}
|
|
248
|
+
*/
|
|
249
|
+
export async function buildStudioHealthCheck({
|
|
250
|
+
env = process.env,
|
|
251
|
+
port = 3000,
|
|
252
|
+
timeoutMs = 1000,
|
|
253
|
+
httpGetImpl = httpGet,
|
|
254
|
+
portOpenImpl = portOpen,
|
|
255
|
+
} = {}) {
|
|
256
|
+
const name = `Studio server (:${port})`;
|
|
257
|
+
const token = security.readTokenFile(security.tokenFilePath(env));
|
|
258
|
+
const headers = token ? { 'X-Studio-Token': token } : {};
|
|
259
|
+
const health = await httpGetImpl(`http://127.0.0.1:${port}/api/studio/health`, timeoutMs, headers);
|
|
260
|
+
|
|
261
|
+
if (health.ok) {
|
|
262
|
+
return { name, status: 'ok', detail: 'health endpoint responding' };
|
|
263
|
+
}
|
|
264
|
+
if (health.status === 401) {
|
|
265
|
+
return {
|
|
266
|
+
name,
|
|
267
|
+
status: 'warn',
|
|
268
|
+
detail: 'server reachable but unpaired',
|
|
269
|
+
hint: 'Open the pairing URL printed by `skillforce studio`.',
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
const open = await portOpenImpl(port);
|
|
273
|
+
if (!open) return { name, status: 'ok', detail: `port ${port} free` };
|
|
274
|
+
return {
|
|
275
|
+
name,
|
|
276
|
+
status: 'warn',
|
|
277
|
+
detail: 'port in use but no health endpoint',
|
|
278
|
+
hint: `Something else is on ${port}. Stop it or start the server with \`npx ronin-skillforce web\`.`,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** Count checks by status (for a footer line). */
|
|
283
|
+
export function summarizeChecks(checks) {
|
|
284
|
+
return checks.reduce((acc, c) => {
|
|
285
|
+
acc[c.status] = (acc[c.status] || 0) + 1;
|
|
286
|
+
return acc;
|
|
287
|
+
}, { ok: 0, warn: 0, fail: 0 });
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Run every environment check.
|
|
292
|
+
* @param {{ cwd?: string, nodeVersion?: string, home?: string }} [deps]
|
|
293
|
+
* @returns {Promise<{ checks: object[] }>}
|
|
294
|
+
*/
|
|
295
|
+
export async function runChecks({
|
|
296
|
+
cwd = process.cwd(),
|
|
297
|
+
nodeVersion = process.version,
|
|
298
|
+
env = process.env,
|
|
299
|
+
platform = process.platform,
|
|
300
|
+
} = {}) {
|
|
301
|
+
const checks = [];
|
|
302
|
+
const add = (name, status, detail, hint) => checks.push({ name, status, detail, hint });
|
|
303
|
+
|
|
304
|
+
const node = evaluateNodeVersion(nodeVersion);
|
|
305
|
+
add('Node.js >= 18', node.status, node.detail, node.hint);
|
|
306
|
+
|
|
307
|
+
const studioReady = nodeSupportsSqlite(nodeVersion);
|
|
308
|
+
add(
|
|
309
|
+
'Node.js 22.5+ (Studio)',
|
|
310
|
+
studioReady ? 'ok' : 'warn',
|
|
311
|
+
studioReady ? nodeVersion : `${nodeVersion} (Studio needs >= 22.5)`,
|
|
312
|
+
studioReady
|
|
313
|
+
? undefined
|
|
314
|
+
: 'Studio, review and import use node:sqlite. Update Node from https://nodejs.org'
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
if (!whichPath('git')) {
|
|
318
|
+
add('git', 'fail', 'not found on PATH', 'Install git from https://git-scm.com');
|
|
319
|
+
} else {
|
|
320
|
+
const args = ['rev-parse', '--is-inside-work-tree'];
|
|
321
|
+
const res = spawnSync('git', args, { cwd, encoding: 'utf-8' });
|
|
322
|
+
const inRepo = res.status === 0 && res.stdout.trim() === 'true';
|
|
323
|
+
if (inRepo) add('git repository', 'ok', 'inside a git work tree');
|
|
324
|
+
else add('git repository', 'warn', 'not inside a git repository',
|
|
325
|
+
'Only programming courses need git. Run `git init` in your project root.');
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const foundClis = AGENT_CLIS.filter((cmd) => whichPath(cmd));
|
|
329
|
+
if (foundClis.length) add('Agent CLIs', 'ok', foundClis.join(', '));
|
|
330
|
+
else add('Agent CLIs', 'warn', 'none found on PATH',
|
|
331
|
+
'Install one: claude, opencode, cursor-agent or gemini');
|
|
332
|
+
|
|
333
|
+
const platforms = await detectAgents();
|
|
334
|
+
const installed = professorInstalledFor(cwd);
|
|
335
|
+
if (platforms.length) add('Agent detected', 'ok', platforms.join(', '));
|
|
336
|
+
else add('Agent detected', 'warn', 'no agent home directory found',
|
|
337
|
+
'Run: npx ronin-skillforce init');
|
|
338
|
+
if (installed.length) add('Professor installed', 'ok', installed.join(', '));
|
|
339
|
+
else add('Professor installed', 'warn', 'no installation marker found',
|
|
340
|
+
'Run: npx ronin-skillforce setup <agent>');
|
|
341
|
+
|
|
342
|
+
const ollama = await httpGet('http://127.0.0.1:11434/api/tags');
|
|
343
|
+
if (ollama.ok) add('Ollama (:11434)', 'ok', 'reachable');
|
|
344
|
+
else add('Ollama (:11434)', 'warn', 'not reachable',
|
|
345
|
+
'Optional. Start Ollama, or set OLLAMA_ORIGINS for browser use.');
|
|
346
|
+
|
|
347
|
+
const studioCheck = await buildStudioHealthCheck({ env });
|
|
348
|
+
add(studioCheck.name, studioCheck.status, studioCheck.detail, studioCheck.hint);
|
|
349
|
+
|
|
350
|
+
const professorHome = env.PROFESSOR_HOME || join(os.homedir(), '.professor');
|
|
351
|
+
const dbPath = join(professorHome, 'professor.db');
|
|
352
|
+
if (existsSync(dbPath)) add('Professor DB', 'ok', dbPath);
|
|
353
|
+
else add('Professor DB', 'warn', 'not created yet', 'Created when the local server runs.');
|
|
354
|
+
|
|
355
|
+
const toolchains = ['python3', 'go'].filter((cmd) => whichPath(cmd));
|
|
356
|
+
const missing = ['python3', 'go'].filter((cmd) => !whichPath(cmd));
|
|
357
|
+
if (missing.length === 0) add('Check toolchains', 'ok', toolchains.join(', '));
|
|
358
|
+
else add('Check toolchains', 'warn', `missing: ${missing.join(', ')}`,
|
|
359
|
+
'Optional — needed only to run those exercise file types with `skillforce check`.');
|
|
360
|
+
|
|
361
|
+
checks.push(...buildPostureChecks({ env, platform }));
|
|
362
|
+
|
|
363
|
+
return { checks };
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* @param {{ cwd?: string, nodeVersion?: string }} ctx
|
|
368
|
+
*/
|
|
369
|
+
export async function run({ cwd = process.cwd(), env = process.env } = {}) {
|
|
370
|
+
const { checks } = await runChecks({ cwd, env });
|
|
371
|
+
|
|
372
|
+
const mark = { ok: '✓', warn: '⚠', fail: '✗' };
|
|
373
|
+
|
|
374
|
+
console.log('');
|
|
375
|
+
console.log('Professor doctor');
|
|
376
|
+
console.log('');
|
|
377
|
+
for (const check of checks) {
|
|
378
|
+
const badge = `${mark[check.status]} ${check.name}`;
|
|
379
|
+
const line = `${badge.padEnd(26)} ${check.detail}`;
|
|
380
|
+
if (check.status === 'ok') console.log(` ${line}`);
|
|
381
|
+
else if (check.status === 'warn') console.log(` ${chalk.yellow(line)}`);
|
|
382
|
+
else console.log(` ${chalk.red(line)}`);
|
|
383
|
+
if (check.hint && check.status !== 'ok') {
|
|
384
|
+
console.log(chalk.dim(` ${' '.repeat(26)} → ${check.hint}`));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const counts = summarizeChecks(checks);
|
|
389
|
+
console.log('');
|
|
390
|
+
console.log(` ${counts.ok} ok · ${counts.warn} warnings · ${counts.fail} failures`);
|
|
391
|
+
console.log('');
|
|
392
|
+
}
|