hitloop 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +218 -2
- package/dist/agent.js +318 -0
- package/dist/cli.js +897 -0
- package/dist/client/assets/app.css +1 -0
- package/dist/client/assets/chunks/abap-EINPUMCJ.js +1 -0
- package/dist/client/assets/chunks/abnfDiagram-S7VZAUFO-W2CM2W6D.js +1 -0
- package/dist/client/assets/chunks/actionscript-3-O776AQUO.js +1 -0
- package/dist/client/assets/chunks/ada-WLOTXRTV.js +1 -0
- package/dist/client/assets/chunks/ahk-EF37A2DY.js +1 -0
- package/dist/client/assets/chunks/ahk2-FH4K3CKT.js +1 -0
- package/dist/client/assets/chunks/angular-html-ZALQFV2H.js +1 -0
- package/dist/client/assets/chunks/angular-ts-4IWMF7QO.js +1 -0
- package/dist/client/assets/chunks/apache-44AYOEWM.js +1 -0
- package/dist/client/assets/chunks/apex-XRYPID42.js +1 -0
- package/dist/client/assets/chunks/apl-5HBALFOI.js +1 -0
- package/dist/client/assets/chunks/applescript-2DZEHZEC.js +1 -0
- package/dist/client/assets/chunks/ara-ZGZQBLXL.js +1 -0
- package/dist/client/assets/chunks/architecture-WOLXFQ4H-EJGENNRL.js +1 -0
- package/dist/client/assets/chunks/architectureDiagram-YGSQEFNW-2VHWSKO6.js +36 -0
- package/dist/client/assets/chunks/asciidoc-GSQAKCPO.js +1 -0
- package/dist/client/assets/chunks/asm-BFURM5BK.js +1 -0
- package/dist/client/assets/chunks/astro-VJORWDZJ.js +1 -0
- package/dist/client/assets/chunks/awk-BSHTWXXX.js +1 -0
- package/dist/client/assets/chunks/ballerina-HAOQJ4B2.js +1 -0
- package/dist/client/assets/chunks/bat-OSH45EOF.js +1 -0
- package/dist/client/assets/chunks/beancount-RBATIHOV.js +1 -0
- package/dist/client/assets/chunks/berry-CZUIOUM4.js +1 -0
- package/dist/client/assets/chunks/bibtex-KCL2UWHE.js +1 -0
- package/dist/client/assets/chunks/bicep-SZJZB3SG.js +1 -0
- package/dist/client/assets/chunks/bird2-XBF5YQQV.js +1 -0
- package/dist/client/assets/chunks/blade-Q24LEVFC.js +1 -0
- package/dist/client/assets/chunks/blockDiagram-APKKGZFW-53LXSOOT.js +140 -0
- package/dist/client/assets/chunks/bpmnIcons-APHXDYXF-FMBRQNTY.js +1 -0
- package/dist/client/assets/chunks/bsl-TI44NWFB.js +1 -0
- package/dist/client/assets/chunks/c-NLHY4Y4N.js +1 -0
- package/dist/client/assets/chunks/c3-BUTEM6PO.js +1 -0
- package/dist/client/assets/chunks/c4Diagram-KJ2TOQU5-O53G4GQH.js +38 -0
- package/dist/client/assets/chunks/cadence-JIRTEU64.js +1 -0
- package/dist/client/assets/chunks/cairo-3W6NVDNW.js +1 -0
- package/dist/client/assets/chunks/chapel-BPBJ2E7K.js +1 -0
- package/dist/client/assets/chunks/chunk-25KVF5ZE.js +1 -0
- package/dist/client/assets/chunks/chunk-2CJKSQOI.js +1 -0
- package/dist/client/assets/chunks/chunk-2QIJRTWR.js +1 -0
- package/dist/client/assets/chunks/chunk-2ZCRJZGF.js +2 -0
- package/dist/client/assets/chunks/chunk-3ILNDZNY.js +213 -0
- package/dist/client/assets/chunks/chunk-3M2OOQ7S.js +1 -0
- package/dist/client/assets/chunks/chunk-3M57NTNK.js +1 -0
- package/dist/client/assets/chunks/chunk-3MR6DCZJ.js +1 -0
- package/dist/client/assets/chunks/chunk-3WGHS7F7.js +1 -0
- package/dist/client/assets/chunks/chunk-4JK75V33.js +1 -0
- package/dist/client/assets/chunks/chunk-4NXNVEWK.js +1 -0
- package/dist/client/assets/chunks/chunk-4RNNBDFQ.js +1 -0
- package/dist/client/assets/chunks/chunk-4T4NVH7V.js +1 -0
- package/dist/client/assets/chunks/chunk-4TFFBC35.js +1 -0
- package/dist/client/assets/chunks/chunk-4WYBE67P.js +1 -0
- package/dist/client/assets/chunks/chunk-56ITEUFA.js +1 -0
- package/dist/client/assets/chunks/chunk-5DXRE7IH.js +1 -0
- package/dist/client/assets/chunks/chunk-5IMADCNU.js +1 -0
- package/dist/client/assets/chunks/chunk-5XZPGKN4.js +1 -0
- package/dist/client/assets/chunks/chunk-6O32UKSP.js +1 -0
- package/dist/client/assets/chunks/chunk-7BAEB64Q.js +1 -0
- package/dist/client/assets/chunks/chunk-7FMWBHZO.js +1 -0
- package/dist/client/assets/chunks/chunk-7GFDITUT.js +1 -0
- package/dist/client/assets/chunks/chunk-7H4MLBHI.js +1 -0
- package/dist/client/assets/chunks/chunk-7OJ4MEEB.js +1 -0
- package/dist/client/assets/chunks/chunk-7RSEISFE.js +1 -0
- package/dist/client/assets/chunks/chunk-7YNZZQVT.js +1 -0
- package/dist/client/assets/chunks/chunk-AB7TIL2G.js +1 -0
- package/dist/client/assets/chunks/chunk-ADDF76FL.js +1 -0
- package/dist/client/assets/chunks/chunk-AF6UTCD4.js +321 -0
- package/dist/client/assets/chunks/chunk-AJ2K6ASU.js +1 -0
- package/dist/client/assets/chunks/chunk-AUBAENQZ.js +1 -0
- package/dist/client/assets/chunks/chunk-BJEYVZ65.js +1 -0
- package/dist/client/assets/chunks/chunk-BLRM6LXA.js +1 -0
- package/dist/client/assets/chunks/chunk-BOCTYCDZ.js +1 -0
- package/dist/client/assets/chunks/chunk-BU4VRYN7.js +1 -0
- package/dist/client/assets/chunks/chunk-CALYHV7D.js +1 -0
- package/dist/client/assets/chunks/chunk-CF4W3RZ4.js +1 -0
- package/dist/client/assets/chunks/chunk-DCZ2OBSL.js +1 -0
- package/dist/client/assets/chunks/chunk-DUFPBTHD.js +1 -0
- package/dist/client/assets/chunks/chunk-DUICIQBC.js +88 -0
- package/dist/client/assets/chunks/chunk-EH2N475V.js +1 -0
- package/dist/client/assets/chunks/chunk-EHLLNPZT.js +1 -0
- package/dist/client/assets/chunks/chunk-EIBFAW37.js +1 -0
- package/dist/client/assets/chunks/chunk-EO3ER3GN.js +1 -0
- package/dist/client/assets/chunks/chunk-FH24BIIA.js +1 -0
- package/dist/client/assets/chunks/chunk-FNOXGAL5.js +2 -0
- package/dist/client/assets/chunks/chunk-FTY6WLQF.js +3 -0
- package/dist/client/assets/chunks/chunk-FZFME6UK.js +1 -0
- package/dist/client/assets/chunks/chunk-FZJZZYYO.js +1 -0
- package/dist/client/assets/chunks/chunk-G4Z6L7OO.js +1 -0
- package/dist/client/assets/chunks/chunk-GNCEAN2B.js +1 -0
- package/dist/client/assets/chunks/chunk-GQJIKV3T.js +1 -0
- package/dist/client/assets/chunks/chunk-GUMNOKT2.js +1 -0
- package/dist/client/assets/chunks/chunk-GXRORAF3.js +1 -0
- package/dist/client/assets/chunks/chunk-H36ABDKY.js +1 -0
- package/dist/client/assets/chunks/chunk-HAR5NYVW.js +1 -0
- package/dist/client/assets/chunks/chunk-HIGPS4L2.js +1 -0
- package/dist/client/assets/chunks/chunk-HMOBGTME.js +1 -0
- package/dist/client/assets/chunks/chunk-HNO6SQ7M.js +1 -0
- package/dist/client/assets/chunks/chunk-HYVZ3GYN.js +1 -0
- package/dist/client/assets/chunks/chunk-I6TGFOQS.js +1 -0
- package/dist/client/assets/chunks/chunk-IHIOJK7I.js +1 -0
- package/dist/client/assets/chunks/chunk-IHJNUMSC.js +1 -0
- package/dist/client/assets/chunks/chunk-IP7PB2OC.js +1 -0
- package/dist/client/assets/chunks/chunk-ISDTMH2Y.js +1 -0
- package/dist/client/assets/chunks/chunk-J65M2LNT.js +1 -0
- package/dist/client/assets/chunks/chunk-JCWYZ7X2.js +62 -0
- package/dist/client/assets/chunks/chunk-JENWYTLI.js +1 -0
- package/dist/client/assets/chunks/chunk-JJ6YWJQS.js +1 -0
- package/dist/client/assets/chunks/chunk-JMUVGGX7.js +32 -0
- package/dist/client/assets/chunks/chunk-JNQUFMM4.js +1 -0
- package/dist/client/assets/chunks/chunk-JPTECOAL.js +1 -0
- package/dist/client/assets/chunks/chunk-JZNK4LKS.js +1 -0
- package/dist/client/assets/chunks/chunk-KPNXJBIW.js +1 -0
- package/dist/client/assets/chunks/chunk-KZO2GZL7.js +1 -0
- package/dist/client/assets/chunks/chunk-L2REESOQ.js +1 -0
- package/dist/client/assets/chunks/chunk-LJPJXR7R.js +1 -0
- package/dist/client/assets/chunks/chunk-LOEZMLCI.js +1 -0
- package/dist/client/assets/chunks/chunk-MLYC6FSE.js +1 -0
- package/dist/client/assets/chunks/chunk-MMDGEZYU.js +1 -0
- package/dist/client/assets/chunks/chunk-MYXE7CGE.js +1 -0
- package/dist/client/assets/chunks/chunk-NBH7YOBD.js +15 -0
- package/dist/client/assets/chunks/chunk-NCOVM3YF.js +1 -0
- package/dist/client/assets/chunks/chunk-NCWOBVU7.js +1 -0
- package/dist/client/assets/chunks/chunk-NLRIHHEH.js +1 -0
- package/dist/client/assets/chunks/chunk-NUPEOYK6.js +1 -0
- package/dist/client/assets/chunks/chunk-O4MVOA7X.js +1 -0
- package/dist/client/assets/chunks/chunk-OBHQQZ4H.js +1 -0
- package/dist/client/assets/chunks/chunk-OKPNJIIR.js +1 -0
- package/dist/client/assets/chunks/chunk-OLMPB57R.js +1 -0
- package/dist/client/assets/chunks/chunk-P2FYOAEV.js +1 -0
- package/dist/client/assets/chunks/chunk-PI3SNP4C.js +1 -0
- package/dist/client/assets/chunks/chunk-PRDTEROB.js +1 -0
- package/dist/client/assets/chunks/chunk-PZELHD2H.js +136 -0
- package/dist/client/assets/chunks/chunk-QR2Q34LM.js +1 -0
- package/dist/client/assets/chunks/chunk-R4GIXL6S.js +1 -0
- package/dist/client/assets/chunks/chunk-RORF4F5V.js +1 -0
- package/dist/client/assets/chunks/chunk-S73BYTLL.js +1 -0
- package/dist/client/assets/chunks/chunk-SFC5MRYR.js +1 -0
- package/dist/client/assets/chunks/chunk-SVM2H22K.js +2 -0
- package/dist/client/assets/chunks/chunk-SZ6UCGVD.js +1 -0
- package/dist/client/assets/chunks/chunk-SZYM6GIJ.js +127 -0
- package/dist/client/assets/chunks/chunk-TT5KJZKM.js +1 -0
- package/dist/client/assets/chunks/chunk-UFBKUYNH.js +1 -0
- package/dist/client/assets/chunks/chunk-UL57AD4T.js +1 -0
- package/dist/client/assets/chunks/chunk-UNEI7LMM.js +1 -0
- package/dist/client/assets/chunks/chunk-VNQBBFIY.js +1 -0
- package/dist/client/assets/chunks/chunk-WGVITPII.js +1 -0
- package/dist/client/assets/chunks/chunk-WRA6KJHX.js +10 -0
- package/dist/client/assets/chunks/chunk-WS5EHW43.js +1 -0
- package/dist/client/assets/chunks/chunk-XE6SLBBE.js +3 -0
- package/dist/client/assets/chunks/chunk-XF5T2P7U.js +72 -0
- package/dist/client/assets/chunks/chunk-XFRY5WKO.js +1 -0
- package/dist/client/assets/chunks/chunk-XWYV4OPA.js +1 -0
- package/dist/client/assets/chunks/chunk-YCE5ECKY.js +1 -0
- package/dist/client/assets/chunks/chunk-YIN5CSIF.js +1 -0
- package/dist/client/assets/chunks/chunk-YLFUX6XH.js +1 -0
- package/dist/client/assets/chunks/chunk-YNXJICZM.js +1 -0
- package/dist/client/assets/chunks/chunk-YOHF7NGD.js +1 -0
- package/dist/client/assets/chunks/chunk-YORIST7Z.js +1 -0
- package/dist/client/assets/chunks/chunk-YUL7CG4R.js +1 -0
- package/dist/client/assets/chunks/chunk-YUN7JSFJ.js +2 -0
- package/dist/client/assets/chunks/chunk-YZ7D2IT7.js +1 -0
- package/dist/client/assets/chunks/chunk-Z7LAPMFJ.js +1 -0
- package/dist/client/assets/chunks/chunk-ZE325LPC.js +1 -0
- package/dist/client/assets/chunks/chunk-ZN7TN6PO.js +1 -0
- package/dist/client/assets/chunks/chunk-ZST3EVPO.js +1 -0
- package/dist/client/assets/chunks/chunk-ZZHMDDZN.js +1 -0
- package/dist/client/assets/chunks/clarity-RKRYQ7WF.js +1 -0
- package/dist/client/assets/chunks/classDiagram-v2-L25IHNXF-Y67HVDZV.js +217 -0
- package/dist/client/assets/chunks/clojure-2X2DQECJ.js +1 -0
- package/dist/client/assets/chunks/cmake-LH5524XE.js +1 -0
- package/dist/client/assets/chunks/cobol-7DALQF3W.js +1 -0
- package/dist/client/assets/chunks/codeowners-52SZU5P5.js +1 -0
- package/dist/client/assets/chunks/codeql-EISH3KUP.js +1 -0
- package/dist/client/assets/chunks/coffee-VAWSGA7Y.js +1 -0
- package/dist/client/assets/chunks/common-lisp-4MVK2AN6.js +1 -0
- package/dist/client/assets/chunks/coq-4VRYZRZV.js +1 -0
- package/dist/client/assets/chunks/core-BRBMZSD2.js +12 -0
- package/dist/client/assets/chunks/cose-bilkent-JH36ORCC-BIOOHSAA.js +1 -0
- package/dist/client/assets/chunks/cpp-RFECMSKD.js +1 -0
- package/dist/client/assets/chunks/crystal-ZBGGFAOI.js +1 -0
- package/dist/client/assets/chunks/csharp-BZDPMKKW.js +1 -0
- package/dist/client/assets/chunks/css-3WWGM6UD.js +1 -0
- package/dist/client/assets/chunks/csv-AB4GNWSB.js +1 -0
- package/dist/client/assets/chunks/cue-2E46MZP2.js +1 -0
- package/dist/client/assets/chunks/cynefin-EF2NZ3EQ-TLFQLWUN.js +1 -0
- package/dist/client/assets/chunks/cynefinDiagram-L36ESFBY-FLPXCSSG.js +62 -0
- package/dist/client/assets/chunks/cypher-HR3ILFOL.js +1 -0
- package/dist/client/assets/chunks/d-TARSZPOL.js +1 -0
- package/dist/client/assets/chunks/dagre-SPEB5RXH-7EGEINJ2.js +4 -0
- package/dist/client/assets/chunks/dart-SALLJHVI.js +1 -0
- package/dist/client/assets/chunks/dax-WYMRGMXC.js +1 -0
- package/dist/client/assets/chunks/desktop-ND5CGLLJ.js +1 -0
- package/dist/client/assets/chunks/diagram-3B7GL73J-6USY4HZX.js +200 -0
- package/dist/client/assets/chunks/diagram-DNEMPZML-BNSOC4VW.js +24 -0
- package/dist/client/assets/chunks/diagram-L3MUGCDN-5V5FZYIG.js +41 -0
- package/dist/client/assets/chunks/diagram-LA4NIPWU-25VLY2CO.js +24 -0
- package/dist/client/assets/chunks/diagram-MHCOC4E2-G2LFP3JU.js +3 -0
- package/dist/client/assets/chunks/diagram-XPFHEONP-E6HBBIBV.js +30 -0
- package/dist/client/assets/chunks/diff-PWYGPM7B.js +1 -0
- package/dist/client/assets/chunks/docker-A4D7DT7W.js +1 -0
- package/dist/client/assets/chunks/dotenv-VWQWV2DY.js +1 -0
- package/dist/client/assets/chunks/dream-maker-M5YDQS35.js +1 -0
- package/dist/client/assets/chunks/ebnfDiagram-UZSYDL2S-BMXXZZPI.js +1 -0
- package/dist/client/assets/chunks/edge-3QXIDJHI.js +1 -0
- package/dist/client/assets/chunks/elixir-3OX2UHIZ.js +1 -0
- package/dist/client/assets/chunks/elk-XV6XMXQE-IPR65FON.js +27 -0
- package/dist/client/assets/chunks/elm-CTS65NCT.js +1 -0
- package/dist/client/assets/chunks/emacs-lisp-HHS2IDO7.js +1 -0
- package/dist/client/assets/chunks/engine-javascript-DNHSF67B.js +141 -0
- package/dist/client/assets/chunks/erDiagram-EYBAPDEH-3GEHFWHG.js +99 -0
- package/dist/client/assets/chunks/erb-ICYWK6HS.js +1 -0
- package/dist/client/assets/chunks/erlang-BDQPNCKX.js +1 -0
- package/dist/client/assets/chunks/eventmodeling-K75KTNOO-B27BJTZL.js +1 -0
- package/dist/client/assets/chunks/fennel-4ONBA2PH.js +1 -0
- package/dist/client/assets/chunks/fish-ATLPBZSD.js +1 -0
- package/dist/client/assets/chunks/flowDiagram-MALGAFMO-5PCLR4AE.js +1 -0
- package/dist/client/assets/chunks/fluent-GGMONBVW.js +1 -0
- package/dist/client/assets/chunks/fortran-fixed-form-5MSBDRWQ.js +1 -0
- package/dist/client/assets/chunks/fortran-free-form-TT3RBL75.js +1 -0
- package/dist/client/assets/chunks/fsharp-PAGHNW4O.js +1 -0
- package/dist/client/assets/chunks/ganttDiagram-23REXITY-VE5MVBTO.js +292 -0
- package/dist/client/assets/chunks/gdresource-5OTP326D.js +1 -0
- package/dist/client/assets/chunks/gdscript-VPWHSCLF.js +1 -0
- package/dist/client/assets/chunks/gdshader-FYLPXFE5.js +1 -0
- package/dist/client/assets/chunks/genie-UYMEEMA2.js +1 -0
- package/dist/client/assets/chunks/gherkin-SU7D5DMY.js +1 -0
- package/dist/client/assets/chunks/git-commit-5CF5QAG7.js +1 -0
- package/dist/client/assets/chunks/git-rebase-X72BAUZI.js +1 -0
- package/dist/client/assets/chunks/gitGraph-VSP46ZUC-J6CJ5YZF.js +1 -0
- package/dist/client/assets/chunks/gitGraphDiagram-STJD7YCW-7YJGT6ZP.js +106 -0
- package/dist/client/assets/chunks/gleam-LR42YRKO.js +1 -0
- package/dist/client/assets/chunks/glimmer-js-JPF67FJU.js +1 -0
- package/dist/client/assets/chunks/glimmer-ts-BYPAVIZT.js +1 -0
- package/dist/client/assets/chunks/glsl-GTGUULBN.js +1 -0
- package/dist/client/assets/chunks/gn-NMDQA4K3.js +1 -0
- package/dist/client/assets/chunks/gnuplot-UUAMYBCZ.js +1 -0
- package/dist/client/assets/chunks/go-4RERSTNP.js +1 -0
- package/dist/client/assets/chunks/graphql-5A6RK6YF.js +1 -0
- package/dist/client/assets/chunks/groovy-O7BJONCU.js +1 -0
- package/dist/client/assets/chunks/hack-7QGTNPDP.js +1 -0
- package/dist/client/assets/chunks/haml-ON5GAWN4.js +1 -0
- package/dist/client/assets/chunks/handlebars-6UOQSUBP.js +1 -0
- package/dist/client/assets/chunks/haskell-OIZXZ26Y.js +1 -0
- package/dist/client/assets/chunks/haxe-7FFVS4FO.js +1 -0
- package/dist/client/assets/chunks/hcl-XFUFQJHV.js +1 -0
- package/dist/client/assets/chunks/hjson-QDBHMTD5.js +1 -0
- package/dist/client/assets/chunks/hlsl-4LP25FFN.js +1 -0
- package/dist/client/assets/chunks/html-7RNQXAAV.js +1 -0
- package/dist/client/assets/chunks/html-derivative-ESOY72Q2.js +1 -0
- package/dist/client/assets/chunks/http-SAD4PMBD.js +1 -0
- package/dist/client/assets/chunks/hurl-ZSJJXPQH.js +1 -0
- package/dist/client/assets/chunks/hxml-HJCC37RK.js +1 -0
- package/dist/client/assets/chunks/hy-CLDE3P4K.js +1 -0
- package/dist/client/assets/chunks/imba-REB34U5V.js +1 -0
- package/dist/client/assets/chunks/info-OHQRW6UA-EQQKXR77.js +1 -0
- package/dist/client/assets/chunks/infoDiagram-KBXO4MBG-F6KGZCGS.js +2 -0
- package/dist/client/assets/chunks/ini-PDFEMGRA.js +1 -0
- package/dist/client/assets/chunks/ishikawaDiagram-M35NCXHK-5D6ZOZ34.js +70 -0
- package/dist/client/assets/chunks/java-KB6XENAD.js +1 -0
- package/dist/client/assets/chunks/javascript-3JX5T423.js +1 -0
- package/dist/client/assets/chunks/jinja-V4UNU6K4.js +1 -0
- package/dist/client/assets/chunks/jison-KH5XNLJP.js +1 -0
- package/dist/client/assets/chunks/journeyDiagram-OPLOXDXO-ANDOJZKW.js +139 -0
- package/dist/client/assets/chunks/json-HPXFRRPY.js +1 -0
- package/dist/client/assets/chunks/json5-LJM6TXWM.js +1 -0
- package/dist/client/assets/chunks/jsonc-UZWRU3JV.js +1 -0
- package/dist/client/assets/chunks/jsonl-RFZD5UN4.js +1 -0
- package/dist/client/assets/chunks/jsonnet-GFZABBL6.js +1 -0
- package/dist/client/assets/chunks/jssm-2YIGBISJ.js +1 -0
- package/dist/client/assets/chunks/jsx-KLV2ZWUT.js +1 -0
- package/dist/client/assets/chunks/julia-3TZDIPPO.js +1 -0
- package/dist/client/assets/chunks/just-UHCONBQS.js +1 -0
- package/dist/client/assets/chunks/kanban-definition-BZKZHSQY-GF5I5NVD.js +89 -0
- package/dist/client/assets/chunks/katex-PIN72PQZ.js +257 -0
- package/dist/client/assets/chunks/kdl-DARTFOCL.js +1 -0
- package/dist/client/assets/chunks/kotlin-7KT5DW6Y.js +1 -0
- package/dist/client/assets/chunks/kusto-EKYXZTC5.js +1 -0
- package/dist/client/assets/chunks/langs-GO3UQR4H.js +1 -0
- package/dist/client/assets/chunks/latex-T57MIHR5.js +1 -0
- package/dist/client/assets/chunks/lean-5QVPRMV6.js +1 -0
- package/dist/client/assets/chunks/less-K6QEH5TN.js +1 -0
- package/dist/client/assets/chunks/liquid-3LCNNEIV.js +1 -0
- package/dist/client/assets/chunks/llvm-O32ZIVRF.js +1 -0
- package/dist/client/assets/chunks/log-C4YPJ5BB.js +1 -0
- package/dist/client/assets/chunks/logo-JPMO43A6.js +1 -0
- package/dist/client/assets/chunks/lua-YKVSOG7K.js +1 -0
- package/dist/client/assets/chunks/luau-K4EECYSO.js +1 -0
- package/dist/client/assets/chunks/make-VHSYMHHW.js +1 -0
- package/dist/client/assets/chunks/markdown-GC5J46H4.js +1 -0
- package/dist/client/assets/chunks/marko-U45YFADC.js +1 -0
- package/dist/client/assets/chunks/matlab-AMOKC4LU.js +1 -0
- package/dist/client/assets/chunks/mdc-DIGA2UXP.js +1 -0
- package/dist/client/assets/chunks/mdx-BZUGCKQA.js +1 -0
- package/dist/client/assets/chunks/mermaid-WHDP6ZPA.js +1 -0
- package/dist/client/assets/chunks/mermaid.core-SQMPMUDN.js +10 -0
- package/dist/client/assets/chunks/mindmap-definition-I2QAS2VK-4NH5S56C.js +98 -0
- package/dist/client/assets/chunks/mipsasm-2S4CUGQV.js +1 -0
- package/dist/client/assets/chunks/mojo-ZOL2PNKT.js +1 -0
- package/dist/client/assets/chunks/moonbit-U3BDAIFE.js +1 -0
- package/dist/client/assets/chunks/move-YSXALBWA.js +1 -0
- package/dist/client/assets/chunks/narrat-DHFIAUJH.js +1 -0
- package/dist/client/assets/chunks/nextflow-ESAKNTI3.js +1 -0
- package/dist/client/assets/chunks/nextflow-groovy-FKDSPJUI.js +1 -0
- package/dist/client/assets/chunks/nginx-XYAYERLO.js +1 -0
- package/dist/client/assets/chunks/nim-XOWBVFDH.js +1 -0
- package/dist/client/assets/chunks/nix-RVSTQSHC.js +1 -0
- package/dist/client/assets/chunks/nsis-KMDUKQRL.js +1 -0
- package/dist/client/assets/chunks/nushell-SKJHHZ7U.js +1 -0
- package/dist/client/assets/chunks/objective-c-3B3KXQ7Q.js +1 -0
- package/dist/client/assets/chunks/objective-cpp-6JDULPJS.js +1 -0
- package/dist/client/assets/chunks/ocaml-TMRFXBVO.js +1 -0
- package/dist/client/assets/chunks/odin-IN3PLCK7.js +1 -0
- package/dist/client/assets/chunks/openscad-P52IKPNH.js +1 -0
- package/dist/client/assets/chunks/org-N3SJ2PIA.js +1 -0
- package/dist/client/assets/chunks/packet-JDAUHWVQ-4SWIKSKP.js +1 -0
- package/dist/client/assets/chunks/pascal-T7CUWCQ4.js +1 -0
- package/dist/client/assets/chunks/pegDiagram-FD4XPPHP-WDKZSEGN.js +1 -0
- package/dist/client/assets/chunks/perl-LCZ4KODH.js +1 -0
- package/dist/client/assets/chunks/php-4XHMBVR5.js +1 -0
- package/dist/client/assets/chunks/pie-XZMESJXO-PSSWOWGV.js +1 -0
- package/dist/client/assets/chunks/pieDiagram-J4AKIIQI-BDW5I5ON.js +39 -0
- package/dist/client/assets/chunks/pkl-OACG5B67.js +1 -0
- package/dist/client/assets/chunks/plsql-7E5C7CJX.js +1 -0
- package/dist/client/assets/chunks/po-ZSREFRRP.js +1 -0
- package/dist/client/assets/chunks/polar-4GBINVA7.js +1 -0
- package/dist/client/assets/chunks/postcss-B7RPVGFW.js +1 -0
- package/dist/client/assets/chunks/powerquery-6UFMTY4G.js +1 -0
- package/dist/client/assets/chunks/powershell-3STRPCNT.js +1 -0
- package/dist/client/assets/chunks/prisma-4TPSPIZ5.js +1 -0
- package/dist/client/assets/chunks/prolog-HEAYPKQW.js +1 -0
- package/dist/client/assets/chunks/proto-Y3Y3VKXM.js +1 -0
- package/dist/client/assets/chunks/pug-7PBPMG3M.js +1 -0
- package/dist/client/assets/chunks/puppet-FR35R4OI.js +1 -0
- package/dist/client/assets/chunks/purescript-OUHXQAOW.js +1 -0
- package/dist/client/assets/chunks/python-SNDG7FNU.js +1 -0
- package/dist/client/assets/chunks/qml-UVIOSWP4.js +1 -0
- package/dist/client/assets/chunks/qmldir-6JGUNYL5.js +1 -0
- package/dist/client/assets/chunks/qss-ZCC466IZ.js +1 -0
- package/dist/client/assets/chunks/quadrantDiagram-XTYBLID2-5VKXWVJ6.js +7 -0
- package/dist/client/assets/chunks/r-4XW4O3ZF.js +1 -0
- package/dist/client/assets/chunks/racket-YJAYXOOG.js +1 -0
- package/dist/client/assets/chunks/radar-ABXABTNO-3AXZCEY2.js +1 -0
- package/dist/client/assets/chunks/railroad-I3PHUGI6-2PLXYPOT.js +1 -0
- package/dist/client/assets/chunks/railroad-abnf-LNEFI6M7-M4DGICQX.js +1 -0
- package/dist/client/assets/chunks/railroad-ebnf-DWYD2UWJ-UEIHQMSZ.js +1 -0
- package/dist/client/assets/chunks/railroad-peg-JR7BVNR7-I7VLIBXM.js +1 -0
- package/dist/client/assets/chunks/railroadDiagram-MRQ6NCDL-Y6IYWEFL.js +1 -0
- package/dist/client/assets/chunks/raku-63NEL5JK.js +1 -0
- package/dist/client/assets/chunks/razor-J3CJP523.js +1 -0
- package/dist/client/assets/chunks/rbs-6GQLT7NW.js +1 -0
- package/dist/client/assets/chunks/reg-6Q3OEC2C.js +1 -0
- package/dist/client/assets/chunks/regexp-LPIMILT3.js +1 -0
- package/dist/client/assets/chunks/rel-TOQGUTHB.js +1 -0
- package/dist/client/assets/chunks/requirementDiagram-Y7LWUY3S-CIWXVVWJ.js +84 -0
- package/dist/client/assets/chunks/riscv-UELGBOXE.js +1 -0
- package/dist/client/assets/chunks/ron-FW7LCJJH.js +1 -0
- package/dist/client/assets/chunks/rosmsg-O63VHE3L.js +1 -0
- package/dist/client/assets/chunks/rst-3WJXGLA7.js +1 -0
- package/dist/client/assets/chunks/ruby-7S7L6JTH.js +1 -0
- package/dist/client/assets/chunks/rust-LIK4HRRI.js +1 -0
- package/dist/client/assets/chunks/sankeyDiagram-WGJFYUXA-OGNQPX5V.js +40 -0
- package/dist/client/assets/chunks/sas-FHDPZ2JH.js +1 -0
- package/dist/client/assets/chunks/sass-UI4HW2FN.js +1 -0
- package/dist/client/assets/chunks/scala-KN7RQSUJ.js +1 -0
- package/dist/client/assets/chunks/scheme-5R527YZ5.js +1 -0
- package/dist/client/assets/chunks/scss-KZ6DRE4A.js +1 -0
- package/dist/client/assets/chunks/sdbl-FHOCL5SL.js +1 -0
- package/dist/client/assets/chunks/sequenceDiagram-5NDRBG5M-QX2V24ZU.js +169 -0
- package/dist/client/assets/chunks/shaderlab-2TLHUS2H.js +1 -0
- package/dist/client/assets/chunks/shellscript-PIB6ZBDM.js +1 -0
- package/dist/client/assets/chunks/shellsession-5KL7NFNN.js +1 -0
- package/dist/client/assets/chunks/sizeCapture-INFHLROL-LCS2PIHM.js +1 -0
- package/dist/client/assets/chunks/smalltalk-JFLFU247.js +1 -0
- package/dist/client/assets/chunks/smithy-HONEXZAM.js +1 -0
- package/dist/client/assets/chunks/solidity-SJ3INJFZ.js +1 -0
- package/dist/client/assets/chunks/soy-ND4SWTM2.js +1 -0
- package/dist/client/assets/chunks/sparql-YB2JQBZD.js +1 -0
- package/dist/client/assets/chunks/splunk-UXIDDAWL.js +1 -0
- package/dist/client/assets/chunks/sql-K6OMG7SQ.js +1 -0
- package/dist/client/assets/chunks/ssh-config-I7KJY3KQ.js +1 -0
- package/dist/client/assets/chunks/stata-DNZ3DTFJ.js +1 -0
- package/dist/client/assets/chunks/stateDiagram-v2-FJ4FJNEA-LVAUWF3A.js +291 -0
- package/dist/client/assets/chunks/stylus-GWPR6IQY.js +1 -0
- package/dist/client/assets/chunks/surrealql-KQNHBWLC.js +1 -0
- package/dist/client/assets/chunks/svelte-YQKF25S4.js +1 -0
- package/dist/client/assets/chunks/swift-ZCIZUJXA.js +1 -0
- package/dist/client/assets/chunks/swimlanes-UMQ2AFYF-B3RQOARQ.js +1 -0
- package/dist/client/assets/chunks/swimlanesDiagram-OMPLPG4O-JOE33EOV.js +8 -0
- package/dist/client/assets/chunks/system-verilog-Y7E6FIO3.js +1 -0
- package/dist/client/assets/chunks/systemd-WHC7NBZP.js +1 -0
- package/dist/client/assets/chunks/talonscript-WC7SODAH.js +1 -0
- package/dist/client/assets/chunks/tasl-QHY2GTCB.js +1 -0
- package/dist/client/assets/chunks/tcl-VAMIL5PJ.js +1 -0
- package/dist/client/assets/chunks/temml-ISNSX3VV.js +96 -0
- package/dist/client/assets/chunks/templ-B3BHKWV4.js +1 -0
- package/dist/client/assets/chunks/terraform-Q4UEK6FK.js +1 -0
- package/dist/client/assets/chunks/tex-63OWCYAB.js +1 -0
- package/dist/client/assets/chunks/timeline-definition-SEUHKTQE-FDFTVAJG.js +120 -0
- package/dist/client/assets/chunks/toml-7Z4IPGES.js +1 -0
- package/dist/client/assets/chunks/treeView-D4JQ5SDB-ABSGRAGI.js +1 -0
- package/dist/client/assets/chunks/treemap-SAJKECNS-MYX2CBJN.js +1 -0
- package/dist/client/assets/chunks/ts-tags-DT62HE52.js +1 -0
- package/dist/client/assets/chunks/tsv-RTXHWADP.js +1 -0
- package/dist/client/assets/chunks/tsx-UANUBOC7.js +1 -0
- package/dist/client/assets/chunks/turtle-QVOUNUUL.js +1 -0
- package/dist/client/assets/chunks/twig-ZPC4BPDA.js +1 -0
- package/dist/client/assets/chunks/typescript-WGWKIMMW.js +1 -0
- package/dist/client/assets/chunks/typespec-TYCVR32J.js +1 -0
- package/dist/client/assets/chunks/typst-PIBFYUO6.js +1 -0
- package/dist/client/assets/chunks/usecaseDiagram-AFA6YXN4-KW7ADINR.js +370 -0
- package/dist/client/assets/chunks/v-3ERNWBSP.js +1 -0
- package/dist/client/assets/chunks/vala-UCBCT2GS.js +1 -0
- package/dist/client/assets/chunks/vb-DGI3VTPA.js +1 -0
- package/dist/client/assets/chunks/vennDiagram-NNMJR3RB-RDGLGOGM.js +34 -0
- package/dist/client/assets/chunks/verilog-G72NZROS.js +1 -0
- package/dist/client/assets/chunks/vhdl-PYGA77XE.js +1 -0
- package/dist/client/assets/chunks/viml-OOC5B5UU.js +1 -0
- package/dist/client/assets/chunks/vue-GTNHIOPG.js +1 -0
- package/dist/client/assets/chunks/vue-html-DKAMJV55.js +1 -0
- package/dist/client/assets/chunks/vue-vine-WTM5HREV.js +1 -0
- package/dist/client/assets/chunks/vyper-RHYEHOJM.js +1 -0
- package/dist/client/assets/chunks/wardley-7MLQ67FV-QJL2HSBT.js +1 -0
- package/dist/client/assets/chunks/wardleyDiagram-S7YFUSEH-A4XX3UJR.js +78 -0
- package/dist/client/assets/chunks/wasm-ZMM2Z5XV.js +1 -0
- package/dist/client/assets/chunks/wenyan-HF5UTKSJ.js +1 -0
- package/dist/client/assets/chunks/wgsl-O7D7OPO7.js +1 -0
- package/dist/client/assets/chunks/wikitext-T7BSWSKQ.js +1 -0
- package/dist/client/assets/chunks/wit-TKCHPPT6.js +1 -0
- package/dist/client/assets/chunks/wolfram-7MN66A7N.js +1 -0
- package/dist/client/assets/chunks/xml-NLTLAWOD.js +1 -0
- package/dist/client/assets/chunks/xsl-NZ4ECK3P.js +1 -0
- package/dist/client/assets/chunks/xychartDiagram-GGNKY7IX-OXJILWHR.js +7 -0
- package/dist/client/assets/chunks/yaml-HRJLEV3V.js +1 -0
- package/dist/client/assets/chunks/zenscript-4LLRSLPI.js +1 -0
- package/dist/client/assets/chunks/zig-Y7MUQFUO.js +1 -0
- package/dist/client/assets/icon.svg +1 -0
- package/dist/client/assets/main.js +254 -0
- package/dist/client/index.html +59 -0
- package/dist/diff.js +119 -0
- package/dist/fs/files.js +233 -0
- package/dist/fs/git.js +369 -0
- package/dist/fs/glob.js +89 -0
- package/dist/fs/notes.js +368 -0
- package/dist/fs/search.js +136 -0
- package/dist/fs/watch.js +69 -0
- package/dist/fs/zip.js +100 -0
- package/dist/hooks.js +65 -0
- package/dist/http.js +81 -0
- package/dist/hub/atomic.js +77 -0
- package/dist/hub/notify.js +239 -0
- package/dist/hub/registry.js +219 -0
- package/dist/mcp.js +500 -0
- package/dist/q/agent.js +215 -0
- package/dist/q/model.js +633 -0
- package/dist/q/schema.js +133 -0
- package/dist/q/store.js +413 -0
- package/dist/r/model.js +323 -0
- package/dist/r/schema.js +53 -0
- package/dist/r/store.js +489 -0
- package/dist/server.js +246 -0
- package/dist/settings.js +30 -0
- package/dist/workspace.js +639 -0
- package/package.json +73 -4
- package/schema/questions.schema.json +1670 -0
- package/schema/reviews.schema.json +151 -0
|
@@ -0,0 +1,639 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import crypto from 'node:crypto';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { NOISE, RAW_TYPES, inside, isHidden, list, readText, serveRaw, toRel } from './fs/files.js';
|
|
6
|
+
import { excluder, parseRules } from './fs/glob.js';
|
|
7
|
+
import { writeZip, ZIP_LIMITS } from './fs/zip.js';
|
|
8
|
+
import { Git } from './fs/git.js';
|
|
9
|
+
import { FileIndex } from './fs/search.js';
|
|
10
|
+
import { Notes, agentPrompt } from './fs/notes.js';
|
|
11
|
+
import { watchTree } from './fs/watch.js';
|
|
12
|
+
import { Questions } from './q/store.js';
|
|
13
|
+
import { Reviews } from './r/store.js';
|
|
14
|
+
import { VERDICTS } from './r/model.js';
|
|
15
|
+
import { unifiedDiff } from './diff.js';
|
|
16
|
+
import { decisions } from './agent.js';
|
|
17
|
+
import { hookStatus, setHooks } from './hooks.js';
|
|
18
|
+
import { body, disposition, imageMarks, json, photos, posInt, str, strList, text } from './http.js';
|
|
19
|
+
import { StoreError } from './hub/atomic.js';
|
|
20
|
+
export const DEFAULT_SETTINGS = { exclude: [], hide: [], showSecrets: false, maxFileMb: 5, git: true, watch: true, author: '', readOnly: false };
|
|
21
|
+
const IDLE_MS = 5 * 60_000;
|
|
22
|
+
export class Workspace {
|
|
23
|
+
key;
|
|
24
|
+
root;
|
|
25
|
+
settings;
|
|
26
|
+
emit;
|
|
27
|
+
onRequest;
|
|
28
|
+
scope;
|
|
29
|
+
notes;
|
|
30
|
+
questions;
|
|
31
|
+
reviews;
|
|
32
|
+
index;
|
|
33
|
+
hitlDir;
|
|
34
|
+
gitP;
|
|
35
|
+
status;
|
|
36
|
+
stopTree;
|
|
37
|
+
stopHitl;
|
|
38
|
+
lastUse = 0;
|
|
39
|
+
idle;
|
|
40
|
+
authorP;
|
|
41
|
+
pending = new Map();
|
|
42
|
+
mtimes = new Map();
|
|
43
|
+
constructor(key, root, settings, emit, onRequest = () => undefined) {
|
|
44
|
+
this.key = key;
|
|
45
|
+
this.root = root;
|
|
46
|
+
this.settings = settings;
|
|
47
|
+
this.emit = emit;
|
|
48
|
+
this.onRequest = onRequest;
|
|
49
|
+
this.root = path.resolve(root);
|
|
50
|
+
this.hitlDir = path.join(this.root, '.hitl');
|
|
51
|
+
const rules = [...settings.exclude, ...readIgnore(this.root)];
|
|
52
|
+
this.scope = { root: this.root, hidden: new Set(['.git', ...settings.hide]), hideSecrets: !settings.showSecrets, excluded: excluder(parseRules(rules)) };
|
|
53
|
+
this.index = new FileIndex(this.scope, undefined, settings.maxFileMb * 1048576);
|
|
54
|
+
this.notes = new Notes(path.join(this.hitlDir, 'notes'), this.root);
|
|
55
|
+
this.questions = new Questions(this.root);
|
|
56
|
+
this.reviews = new Reviews(this.root);
|
|
57
|
+
this.notes.onChange(() => {
|
|
58
|
+
this.emit('notes', { project: this.key });
|
|
59
|
+
this.onRequest({ kind: 'notes', id: 'notes', side: 'human' });
|
|
60
|
+
});
|
|
61
|
+
this.notes.watch();
|
|
62
|
+
this.watchHitl();
|
|
63
|
+
}
|
|
64
|
+
get name() {
|
|
65
|
+
return path.basename(this.root) || this.root;
|
|
66
|
+
}
|
|
67
|
+
git() {
|
|
68
|
+
if (!this.settings.git)
|
|
69
|
+
return Promise.resolve(undefined);
|
|
70
|
+
return (this.gitP ??= Git.open(this.root).then((g) => {
|
|
71
|
+
if (g)
|
|
72
|
+
this.index.git = g;
|
|
73
|
+
return g;
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
author() {
|
|
77
|
+
return (this.authorP ??= (async () => this.settings.author || (await (await this.git())?.userName().catch(() => '')) || os.userInfo().username || 'reviewer')());
|
|
78
|
+
}
|
|
79
|
+
visible(rel) {
|
|
80
|
+
return !rel.split('/').some((p) => isHidden(this.scope, p)) && !this.scope.excluded(rel);
|
|
81
|
+
}
|
|
82
|
+
gitStatus() {
|
|
83
|
+
return (this.status ??= this.git().then((git) => {
|
|
84
|
+
if (!git)
|
|
85
|
+
throw new Error('not a git repository');
|
|
86
|
+
return git.status().then((s) => ({
|
|
87
|
+
...s,
|
|
88
|
+
// hitl's own files are ours, not the project's: keep them out of the changes
|
|
89
|
+
changes: s.changes.filter((c) => !c.path.startsWith('.hitl/') && this.visible(c.path)),
|
|
90
|
+
ignored: s.ignored.filter((i) => this.visible(i.replace(/\/$/, ''))),
|
|
91
|
+
}));
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
/** someone is looking at this project's files: watch them (until it's been quiet a while) */
|
|
95
|
+
touch() {
|
|
96
|
+
this.lastUse = Date.now();
|
|
97
|
+
if (!this.stopTree && this.settings.watch) {
|
|
98
|
+
void this.git().then((git) => {
|
|
99
|
+
if (this.stopTree)
|
|
100
|
+
return;
|
|
101
|
+
this.stopTree = watchTree(this.root, git ? path.join(git.top, '.git') : undefined, (b) => {
|
|
102
|
+
if (b.git)
|
|
103
|
+
this.status = undefined;
|
|
104
|
+
if (b.folders.length || b.files.length)
|
|
105
|
+
this.index.invalidate();
|
|
106
|
+
const files = b.files.filter((f) => !f.startsWith('.hitl/'));
|
|
107
|
+
const folders = b.folders.filter((f) => f !== '.hitl' && !f.startsWith('.hitl/'));
|
|
108
|
+
if (files.length || folders.length || b.git)
|
|
109
|
+
this.emit('change', { project: this.key, folders, files, git: b.git });
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (!this.idle) {
|
|
114
|
+
this.idle = setInterval(() => {
|
|
115
|
+
if (Date.now() - this.lastUse < IDLE_MS)
|
|
116
|
+
return;
|
|
117
|
+
this.stopTree?.();
|
|
118
|
+
this.stopTree = undefined;
|
|
119
|
+
this.status = undefined;
|
|
120
|
+
if (this.idle)
|
|
121
|
+
clearInterval(this.idle);
|
|
122
|
+
this.idle = undefined;
|
|
123
|
+
}, 60_000);
|
|
124
|
+
this.idle.unref();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** .hitl/questions, reviews and answers: tell the page (and the hub) what changed */
|
|
128
|
+
watchHitl() {
|
|
129
|
+
const start = () => {
|
|
130
|
+
if (this.stopHitl)
|
|
131
|
+
return;
|
|
132
|
+
try {
|
|
133
|
+
const w = fs.watch(this.hitlDir, { recursive: true }, (_e, name) => {
|
|
134
|
+
const rel = String(name ?? '').split(path.sep).join('/');
|
|
135
|
+
const m = /^(questions|reviews|answers)\/([^/]+)\.json$/.exec(rel);
|
|
136
|
+
if (m && m[1] && m[2])
|
|
137
|
+
this.check(m[1], m[2]);
|
|
138
|
+
});
|
|
139
|
+
w.on('error', () => undefined);
|
|
140
|
+
this.stopHitl = () => w.close();
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
this.stopHitl = () => undefined;
|
|
144
|
+
}
|
|
145
|
+
for (const id of this.questions.ids())
|
|
146
|
+
this.mtimes.set('questions/' + id, mtime(this.questions.setPath(id)));
|
|
147
|
+
for (const id of this.reviews.ids())
|
|
148
|
+
this.mtimes.set('reviews/' + id, mtime(this.reviews.reviewPath(id)));
|
|
149
|
+
for (const f of safeList(path.join(this.hitlDir, 'answers')))
|
|
150
|
+
if (f.endsWith('.json'))
|
|
151
|
+
this.mtimes.set('answers/' + f.slice(0, -5), mtime(path.join(this.hitlDir, 'answers', f)));
|
|
152
|
+
};
|
|
153
|
+
if (fs.existsSync(this.hitlDir))
|
|
154
|
+
start();
|
|
155
|
+
else {
|
|
156
|
+
const t = setInterval(() => {
|
|
157
|
+
if (!fs.existsSync(this.hitlDir))
|
|
158
|
+
return;
|
|
159
|
+
clearInterval(t);
|
|
160
|
+
start();
|
|
161
|
+
for (const id of this.questions.ids())
|
|
162
|
+
this.check('questions', id, true);
|
|
163
|
+
for (const id of this.reviews.ids())
|
|
164
|
+
this.check('reviews', id, true);
|
|
165
|
+
}, 2000);
|
|
166
|
+
t.unref();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
check(dir, id, force = false) {
|
|
170
|
+
const k = dir + '/' + id;
|
|
171
|
+
if (this.pending.has(k))
|
|
172
|
+
return;
|
|
173
|
+
this.pending.set(k, setTimeout(() => {
|
|
174
|
+
this.pending.delete(k);
|
|
175
|
+
const file = path.join(this.hitlDir, dir, id + '.json');
|
|
176
|
+
const now = mtime(file);
|
|
177
|
+
if (!force && this.mtimes.get(k) === now)
|
|
178
|
+
return;
|
|
179
|
+
this.mtimes.set(k, now);
|
|
180
|
+
const isReview = dir === 'reviews' || (dir === 'answers' && this.reviews.has(id));
|
|
181
|
+
const kind = isReview ? 'review' : 'questions';
|
|
182
|
+
const summary = isReview ? this.reviews.summary(id) : this.questions.summary(id);
|
|
183
|
+
this.emit('request', { project: this.key, kind, id, summary: summary ?? null });
|
|
184
|
+
this.onRequest({ kind, id, side: dir === 'answers' ? 'human' : 'agent' });
|
|
185
|
+
}, 120));
|
|
186
|
+
}
|
|
187
|
+
/** everything waiting, for the inbox and the project's home */
|
|
188
|
+
overview() {
|
|
189
|
+
const notes = this.notes.all();
|
|
190
|
+
return {
|
|
191
|
+
key: this.key,
|
|
192
|
+
name: this.name,
|
|
193
|
+
root: tilde(this.root),
|
|
194
|
+
questions: this.questions.summaries(),
|
|
195
|
+
reviews: this.reviews.summaries(),
|
|
196
|
+
notes: { open: notes.filter((c) => c.status === 'open').length, total: notes.length, unread: this.notes.unread() },
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
close() {
|
|
200
|
+
this.stopTree?.();
|
|
201
|
+
this.stopHitl?.();
|
|
202
|
+
this.notes.close();
|
|
203
|
+
if (this.idle)
|
|
204
|
+
clearInterval(this.idle);
|
|
205
|
+
for (const t of this.pending.values())
|
|
206
|
+
clearTimeout(t);
|
|
207
|
+
}
|
|
208
|
+
// ── routes (p is the path after p/<key>, starting with /) ──
|
|
209
|
+
async handle(p, url, req, res) {
|
|
210
|
+
const q = (k) => url.searchParams.get(k) ?? '';
|
|
211
|
+
const method = req.method ?? 'GET';
|
|
212
|
+
const write = method !== 'GET' && method !== 'HEAD';
|
|
213
|
+
if (write && this.settings.readOnly)
|
|
214
|
+
return json(res, 403, { error: 'This hitl is read-only' });
|
|
215
|
+
if (p.startsWith('/raw/')) {
|
|
216
|
+
this.touch();
|
|
217
|
+
const rel = decodeURIComponent(p.slice(5));
|
|
218
|
+
if (q('download') === '1')
|
|
219
|
+
res.setHeader('content-disposition', disposition(path.basename(rel)));
|
|
220
|
+
return serveRaw(this.scope, rel, req, res, q('as') === 'page');
|
|
221
|
+
}
|
|
222
|
+
if (p === '/api/zip')
|
|
223
|
+
return this.zipFolder(q('p'), res);
|
|
224
|
+
if (p === '/api/info') {
|
|
225
|
+
const git = await this.git();
|
|
226
|
+
return json(res, 200, {
|
|
227
|
+
key: this.key,
|
|
228
|
+
name: this.name,
|
|
229
|
+
root: tilde(this.root),
|
|
230
|
+
git: !!git,
|
|
231
|
+
gitPrefix: git?.prefix ?? '',
|
|
232
|
+
author: await this.author(),
|
|
233
|
+
readOnly: this.settings.readOnly,
|
|
234
|
+
notes: { json: toRel(this.scope, this.notes.jsonPath), md: toRel(this.scope, this.notes.mdPath), dir: '.hitl/notes', prompt: agentPrompt(toRel(this.scope, this.notes.mdPath)) },
|
|
235
|
+
maxFile: this.settings.maxFileMb * 1048576,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
if (p === '/api/overview')
|
|
239
|
+
return json(res, 200, this.overview());
|
|
240
|
+
if (p === '/api/list') {
|
|
241
|
+
this.touch();
|
|
242
|
+
const entries = list(this.scope, q('p'));
|
|
243
|
+
return entries ? json(res, 200, { entries }) : json(res, 404, { error: 'No such folder' });
|
|
244
|
+
}
|
|
245
|
+
if (p === '/api/stat') {
|
|
246
|
+
const abs = inside(this.scope, q('p'));
|
|
247
|
+
if (!abs || !fs.existsSync(abs))
|
|
248
|
+
return json(res, 404, { error: 'not found' });
|
|
249
|
+
const st = fs.statSync(abs);
|
|
250
|
+
return json(res, 200, { type: st.isDirectory() ? 'folder' : 'file', size: st.size, mtime: st.mtimeMs });
|
|
251
|
+
}
|
|
252
|
+
if (p === '/api/text') {
|
|
253
|
+
const r = readText(this.scope, q('path'), q('lines'), this.settings.maxFileMb * 1048576);
|
|
254
|
+
return 'error' in r ? json(res, r.status, { error: r.error }) : json(res, 200, r);
|
|
255
|
+
}
|
|
256
|
+
if (p === '/api/files') {
|
|
257
|
+
await this.git();
|
|
258
|
+
return json(res, 200, { files: (await this.index.files()).filter((f) => !f.startsWith('.hitl/')) });
|
|
259
|
+
}
|
|
260
|
+
if (p === '/api/search') {
|
|
261
|
+
if (!q('q'))
|
|
262
|
+
return json(res, 400, { error: 'Nothing to search for' });
|
|
263
|
+
await this.git();
|
|
264
|
+
const result = await this.index.search({ q: q('q'), scope: q('scope'), regex: q('regex') === '1', caseSensitive: q('case') === '1', word: q('word') === '1', include: q('include') });
|
|
265
|
+
// hitl's own files would match every word that was asked or said: leave them out
|
|
266
|
+
result.files = result.files.filter((f) => !f.path.startsWith('.hitl/'));
|
|
267
|
+
return json(res, 200, result);
|
|
268
|
+
}
|
|
269
|
+
if (p.startsWith('/api/git/'))
|
|
270
|
+
return this.gitRoute(p, q, res);
|
|
271
|
+
if (p === '/api/hooks') {
|
|
272
|
+
if (method === 'POST') {
|
|
273
|
+
const b = await body(req);
|
|
274
|
+
setHooks(this.root, { ...(typeof b['prompt'] === 'boolean' ? { prompt: b['prompt'] } : {}), ...(typeof b['stop'] === 'boolean' ? { stop: b['stop'] } : {}) });
|
|
275
|
+
}
|
|
276
|
+
return json(res, 200, hookStatus(this.root));
|
|
277
|
+
}
|
|
278
|
+
if (p === '/api/decisions')
|
|
279
|
+
return json(res, 200, decisions(this, { q: q('q'), limit: Number(q('limit')) || 200 }));
|
|
280
|
+
// notes (folderview's comments): /api/comments…
|
|
281
|
+
if (p === '/api/notes.md')
|
|
282
|
+
return text(res, fs.existsSync(this.notes.mdPath) ? fs.readFileSync(this.notes.mdPath, 'utf8') : 'No notes yet.\n', 'text/markdown; charset=utf-8');
|
|
283
|
+
if (p.startsWith('/api/comments'))
|
|
284
|
+
return this.notesRoute(p, method, q, req, res);
|
|
285
|
+
if (p.startsWith('/api/q/'))
|
|
286
|
+
return this.questionsRoute(p.slice(7), method, req, res);
|
|
287
|
+
if (p.startsWith('/api/r/'))
|
|
288
|
+
return this.reviewsRoute(p.slice(7), method, q, req, res);
|
|
289
|
+
return json(res, 404, { error: 'not found' });
|
|
290
|
+
}
|
|
291
|
+
async gitRoute(p, q, res) {
|
|
292
|
+
const git = await this.git();
|
|
293
|
+
if (!git)
|
|
294
|
+
return json(res, 404, { error: 'Not a git repository' });
|
|
295
|
+
const rel = q('p');
|
|
296
|
+
if (p !== '/api/git/status' && p !== '/api/git/history' && inside(this.scope, rel) === undefined)
|
|
297
|
+
return json(res, 404, { error: 'not found' });
|
|
298
|
+
switch (p) {
|
|
299
|
+
case '/api/git/status':
|
|
300
|
+
this.touch();
|
|
301
|
+
return json(res, 200, await this.gitStatus());
|
|
302
|
+
case '/api/git/diff':
|
|
303
|
+
return text(res, await git.diff(rel));
|
|
304
|
+
case '/api/git/show': {
|
|
305
|
+
const rev = q('rev') || 'HEAD';
|
|
306
|
+
if (!isRev(rev))
|
|
307
|
+
return json(res, 400, { error: 'bad revision' });
|
|
308
|
+
return text(res, await git.show(rel, rev));
|
|
309
|
+
}
|
|
310
|
+
case '/api/git/raw': {
|
|
311
|
+
const rev = q('rev') || 'HEAD';
|
|
312
|
+
if (!isRev(rev))
|
|
313
|
+
return json(res, 400, { error: 'bad revision' });
|
|
314
|
+
const buf = await git.showRaw(rel, rev);
|
|
315
|
+
const ext = path.extname(rel).slice(1).toLowerCase();
|
|
316
|
+
res.writeHead(200, { 'content-type': RAW_TYPES[ext] ?? 'application/octet-stream', 'cache-control': 'no-store', 'content-security-policy': "default-src 'none'; style-src 'unsafe-inline'", 'x-content-type-options': 'nosniff' });
|
|
317
|
+
return void res.end(buf);
|
|
318
|
+
}
|
|
319
|
+
case '/api/git/log': {
|
|
320
|
+
const all = await git.log(rel, 31, Math.max(0, Number(q('skip')) || 0));
|
|
321
|
+
return json(res, 200, { commits: all.slice(0, 30), more: all.length > 30 });
|
|
322
|
+
}
|
|
323
|
+
case '/api/git/history':
|
|
324
|
+
return json(res, 200, await git.history(Math.max(0, Number(q('skip')) || 0), 50, q('q').trim().slice(0, 200)));
|
|
325
|
+
case '/api/git/commit-info': {
|
|
326
|
+
const h = q('h');
|
|
327
|
+
if (!isRev(h))
|
|
328
|
+
return json(res, 400, { error: 'bad revision' });
|
|
329
|
+
const info = await git.commitInfo(h);
|
|
330
|
+
info.files = info.files.filter((f) => this.visible(f.path) && !f.path.startsWith('.hitl/'));
|
|
331
|
+
return json(res, 200, info);
|
|
332
|
+
}
|
|
333
|
+
case '/api/git/commit-diff': {
|
|
334
|
+
const h = q('h');
|
|
335
|
+
const from = q('from');
|
|
336
|
+
if (!isRev(h))
|
|
337
|
+
return json(res, 400, { error: 'bad revision' });
|
|
338
|
+
if (from && inside(this.scope, from) === undefined)
|
|
339
|
+
return json(res, 404, { error: 'not found' });
|
|
340
|
+
return text(res, await git.commitFileDiff(h, rel, from || undefined));
|
|
341
|
+
}
|
|
342
|
+
case '/api/git/commit': {
|
|
343
|
+
const h = q('h');
|
|
344
|
+
if (!isRev(h))
|
|
345
|
+
return json(res, 400, { error: 'bad revision' });
|
|
346
|
+
return text(res, await git.commitDiff(rel, h));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return json(res, 404, { error: 'not found' });
|
|
350
|
+
}
|
|
351
|
+
async notesRoute(p, method, q, req, res) {
|
|
352
|
+
const notes = this.notes;
|
|
353
|
+
if (p === '/api/comments' && method === 'GET')
|
|
354
|
+
return json(res, 200, { comments: notes.all() });
|
|
355
|
+
const file = /^\/api\/comments\/([0-9a-f]+)\/(image\.png|photo\/[\w.-]+)$/.exec(p);
|
|
356
|
+
if (file) {
|
|
357
|
+
const which = file[2] === 'image.png' ? 'image' : (file[2] ?? '').slice(6);
|
|
358
|
+
const abs = notes.filePath(file[1] ?? '', which);
|
|
359
|
+
if (!abs)
|
|
360
|
+
return json(res, 404, { error: 'not found' });
|
|
361
|
+
const ext = path.extname(abs).slice(1);
|
|
362
|
+
res.writeHead(200, { 'content-type': RAW_TYPES[ext] ?? 'image/png', 'cache-control': 'no-cache', 'x-content-type-options': 'nosniff', 'content-security-policy': "default-src 'none'" });
|
|
363
|
+
return void fs.createReadStream(abs).pipe(res);
|
|
364
|
+
}
|
|
365
|
+
if (p === '/api/comments' && method === 'POST') {
|
|
366
|
+
const b = await body(req, 60_000_000);
|
|
367
|
+
const rel = str(b['path']);
|
|
368
|
+
if (rel && inside(this.scope, rel) === undefined)
|
|
369
|
+
return json(res, 400, { error: 'No such file' });
|
|
370
|
+
const ph = photos(b);
|
|
371
|
+
if (!str(b['body']).trim() && !ph.length)
|
|
372
|
+
return json(res, 400, { error: 'The note is empty' });
|
|
373
|
+
const line = posInt(b['line']), endLine = posInt(b['endLine']);
|
|
374
|
+
const marks = imageMarks(b);
|
|
375
|
+
const git = await this.git();
|
|
376
|
+
const c = notes.add({
|
|
377
|
+
path: rel,
|
|
378
|
+
body: str(b['body']),
|
|
379
|
+
author: str(b['author']) || (await this.author()),
|
|
380
|
+
...(line ? { line } : {}),
|
|
381
|
+
...(endLine ? { endLine } : {}),
|
|
382
|
+
...(marks.area ? { area: marks.area } : {}),
|
|
383
|
+
...(marks.strokes ? { strokes: marks.strokes } : {}),
|
|
384
|
+
...(marks.snapshot ? { snapshot: marks.snapshot } : {}),
|
|
385
|
+
...(ph.length ? { photos: ph } : {}),
|
|
386
|
+
...(git && rel ? { commit: (await this.gitStatus().catch(() => undefined))?.head ?? '' } : {}),
|
|
387
|
+
});
|
|
388
|
+
return json(res, 201, c);
|
|
389
|
+
}
|
|
390
|
+
if (p === '/api/comments' && method === 'DELETE' && q('resolved') === '1')
|
|
391
|
+
return json(res, 200, { removed: notes.clearResolved() });
|
|
392
|
+
const m = /^\/api\/comments\/([0-9a-f]+)(\/replies)?$/.exec(p);
|
|
393
|
+
if (m) {
|
|
394
|
+
const id = m[1] ?? '';
|
|
395
|
+
if (m[2] && method === 'POST') {
|
|
396
|
+
const b = await body(req);
|
|
397
|
+
const c = notes.reply(id, str(b['author']) || (await this.author()), str(b['body']));
|
|
398
|
+
return c ? json(res, 200, c) : json(res, 404, { error: 'not found' });
|
|
399
|
+
}
|
|
400
|
+
if (method === 'PATCH') {
|
|
401
|
+
const b = await body(req);
|
|
402
|
+
const s = str(b['status']);
|
|
403
|
+
const patch = {};
|
|
404
|
+
if (typeof b['body'] === 'string')
|
|
405
|
+
patch.body = b['body'];
|
|
406
|
+
if (s === 'open' || s === 'resolved')
|
|
407
|
+
patch.status = s;
|
|
408
|
+
const c = notes.update(id, patch);
|
|
409
|
+
return c ? json(res, 200, c) : json(res, 404, { error: 'not found' });
|
|
410
|
+
}
|
|
411
|
+
if (method === 'DELETE')
|
|
412
|
+
return notes.remove(id) ? json(res, 200, { ok: true }) : json(res, 404, { error: 'not found' });
|
|
413
|
+
}
|
|
414
|
+
return json(res, 404, { error: 'not found' });
|
|
415
|
+
}
|
|
416
|
+
async questionsRoute(rest, method, req, res) {
|
|
417
|
+
const sm = /^([^/]+)(\/[a-z]+)?$/.exec(rest);
|
|
418
|
+
if (!sm)
|
|
419
|
+
return json(res, 404, { error: 'not found' });
|
|
420
|
+
const setId = decodeURIComponent(sm[1] ?? '');
|
|
421
|
+
const action = sm[2] ?? '';
|
|
422
|
+
const qs = this.questions;
|
|
423
|
+
if (!qs.has(setId))
|
|
424
|
+
return json(res, 404, { error: `No question set "${setId}"` });
|
|
425
|
+
if (!action && method === 'GET') {
|
|
426
|
+
const l = qs.load(setId);
|
|
427
|
+
if (!l)
|
|
428
|
+
return json(res, 404, { error: `No question set "${setId}"` });
|
|
429
|
+
return json(res, 200, { set: l.set, errors: l.errors, warnings: l.warnings, answers: qs.answers(setId), summary: qs.summary(setId) });
|
|
430
|
+
}
|
|
431
|
+
if (method !== 'POST')
|
|
432
|
+
return json(res, 405, { error: 'POST' });
|
|
433
|
+
const b = await body(req);
|
|
434
|
+
const qid = str(b['id']);
|
|
435
|
+
switch (action) {
|
|
436
|
+
case '/answer': {
|
|
437
|
+
if (b['clear'] === true) {
|
|
438
|
+
qs.clear(setId, qid);
|
|
439
|
+
return json(res, 200, { answer: null, summary: qs.summary(setId) });
|
|
440
|
+
}
|
|
441
|
+
const a = qs.answer(setId, qid, answerInput(b));
|
|
442
|
+
return json(res, 200, { answer: a, summary: qs.summary(setId) });
|
|
443
|
+
}
|
|
444
|
+
case '/accept': {
|
|
445
|
+
const taken = qs.acceptRecommended(setId, strList(b['ids']));
|
|
446
|
+
return json(res, 200, { taken, answers: qs.answers(setId), summary: qs.summary(setId) });
|
|
447
|
+
}
|
|
448
|
+
case '/message':
|
|
449
|
+
return json(res, 200, { message: qs.message(setId, qid, 'owner', str(b['body'])) });
|
|
450
|
+
}
|
|
451
|
+
return json(res, 404, { error: 'not found' });
|
|
452
|
+
}
|
|
453
|
+
async reviewsRoute(rest, method, q, req, res) {
|
|
454
|
+
const rm = /^([^/]+)(\/[a-z]+)?$/.exec(rest);
|
|
455
|
+
if (!rm)
|
|
456
|
+
return json(res, 404, { error: 'not found' });
|
|
457
|
+
const id = decodeURIComponent(rm[1] ?? '');
|
|
458
|
+
const action = rm[2] ?? '';
|
|
459
|
+
const rv = this.reviews;
|
|
460
|
+
const l = rv.load(id);
|
|
461
|
+
if (!l)
|
|
462
|
+
return json(res, 404, { error: `No review "${id}"` });
|
|
463
|
+
if (method === 'GET' && !action) {
|
|
464
|
+
// each file item: is it still as it was shown?
|
|
465
|
+
const files = {};
|
|
466
|
+
for (const it of l.review.items) {
|
|
467
|
+
if (it.kind !== 'file' || !it.file)
|
|
468
|
+
continue;
|
|
469
|
+
const abs = inside(this.scope, it.file);
|
|
470
|
+
let st;
|
|
471
|
+
try {
|
|
472
|
+
st = abs ? fs.statSync(abs) : undefined;
|
|
473
|
+
}
|
|
474
|
+
catch {
|
|
475
|
+
st = undefined;
|
|
476
|
+
}
|
|
477
|
+
files[it.id] = { exists: !!st, changed: !!it.snap && !!st && (st.size !== it.snap.size || sha1(abs ?? '') !== it.snap.sha), ...(st ? { size: st.size } : {}) };
|
|
478
|
+
}
|
|
479
|
+
return json(res, 200, { review: l.review, errors: l.errors, warnings: l.warnings, feedback: rv.feedback(id), summary: rv.summary(id), files });
|
|
480
|
+
}
|
|
481
|
+
if (method === 'GET' && action === '/diff') {
|
|
482
|
+
// a diff for an item: its file against a git revision, its file now against its snapshot, or before → after text
|
|
483
|
+
const it = l.review.items.find((i) => i.id === q('item'));
|
|
484
|
+
if (!it)
|
|
485
|
+
return json(res, 404, { error: 'No such item' });
|
|
486
|
+
if (it.kind === 'file' && it.file && it.against) {
|
|
487
|
+
const git = await this.git();
|
|
488
|
+
if (!git)
|
|
489
|
+
return json(res, 400, { error: 'Not a git repository' });
|
|
490
|
+
if (inside(this.scope, it.file) === undefined)
|
|
491
|
+
return json(res, 404, { error: 'not found' });
|
|
492
|
+
return text(res, await git.diffAgainst(it.file, it.against));
|
|
493
|
+
}
|
|
494
|
+
if (it.kind === 'file' && it.file && it.snap) {
|
|
495
|
+
const now = readText(this.scope, it.file, '', 20 * 1048576);
|
|
496
|
+
const then = readText({ ...this.scope, hidden: new Set(['.git']), excluded: () => false }, it.snap.path, '', 20 * 1048576);
|
|
497
|
+
if ('error' in now || 'error' in then)
|
|
498
|
+
return json(res, 400, { error: 'error' in now ? now.error : 'The snapshot is gone' });
|
|
499
|
+
return text(res, unifiedDiff(then.text, now.text, it.file + ' (as shown)', it.file + ' (now)'));
|
|
500
|
+
}
|
|
501
|
+
if ((it.kind === 'code' || it.kind === 'text') && typeof it.before === 'string')
|
|
502
|
+
return text(res, unifiedDiff(it.before, it.code ?? it.text ?? '', it.name || 'before', it.name || 'after'));
|
|
503
|
+
return json(res, 400, { error: 'Nothing to compare' });
|
|
504
|
+
}
|
|
505
|
+
if (method !== 'POST')
|
|
506
|
+
return json(res, 405, { error: 'POST' });
|
|
507
|
+
const b = await body(req, 60_000_000);
|
|
508
|
+
const verdictOf = (v) => {
|
|
509
|
+
if (v === null || v === '' || v === undefined)
|
|
510
|
+
return null;
|
|
511
|
+
if (!VERDICTS.includes(String(v)))
|
|
512
|
+
throw new StoreError(`A verdict is ${VERDICTS.join(', ')}`);
|
|
513
|
+
return v;
|
|
514
|
+
};
|
|
515
|
+
switch (action) {
|
|
516
|
+
case '/verdict':
|
|
517
|
+
return json(res, 200, { verdict: rv.verdict(id, str(b['item']), verdictOf(b['verdict']), str(b['note'])), summary: rv.summary(id) });
|
|
518
|
+
case '/overall':
|
|
519
|
+
return json(res, 200, { overall: rv.overall(id, verdictOf(b['verdict']), str(b['note'])), summary: rv.summary(id) });
|
|
520
|
+
case '/comment': {
|
|
521
|
+
const marks = imageMarks(b);
|
|
522
|
+
const c = rv.comment(id, {
|
|
523
|
+
item: str(b['item']),
|
|
524
|
+
body: str(b['body']),
|
|
525
|
+
...(posInt(b['line']) ? { line: posInt(b['line']) } : {}),
|
|
526
|
+
...(posInt(b['endLine']) ? { endLine: posInt(b['endLine']) } : {}),
|
|
527
|
+
...(b['side'] === 'old' ? { side: 'old' } : {}),
|
|
528
|
+
...(str(b['quote']) ? { quote: str(b['quote']) } : {}),
|
|
529
|
+
...(marks.strokes ? { strokes: marks.strokes } : {}),
|
|
530
|
+
...(marks.area ? { area: marks.area } : {}),
|
|
531
|
+
...(marks.snapshotUrl ? { snapshot: marks.snapshotUrl } : {}),
|
|
532
|
+
photos: photos(b),
|
|
533
|
+
});
|
|
534
|
+
return json(res, 201, { comment: c, summary: rv.summary(id) });
|
|
535
|
+
}
|
|
536
|
+
case '/reply':
|
|
537
|
+
return json(res, 200, { comment: rv.reply(id, str(b['cid']), 'owner', str(b['body'])) });
|
|
538
|
+
case '/status': {
|
|
539
|
+
const s = str(b['status']);
|
|
540
|
+
if (s !== 'open' && s !== 'resolved')
|
|
541
|
+
return json(res, 400, { error: 'status is open or resolved' });
|
|
542
|
+
return json(res, 200, { done: rv.setStatus(id, strList(b['cid']), s, 'owner') });
|
|
543
|
+
}
|
|
544
|
+
case '/edit':
|
|
545
|
+
return json(res, 200, { comment: rv.editComment(id, str(b['cid']), str(b['body'])) });
|
|
546
|
+
case '/delete':
|
|
547
|
+
return json(res, 200, { ok: rv.deleteComment(id, str(b['cid'])) });
|
|
548
|
+
}
|
|
549
|
+
return json(res, 404, { error: 'not found' });
|
|
550
|
+
}
|
|
551
|
+
/** a folder as a zip: what the listing shows (no hidden, excluded or noise folders), within the zip limits */
|
|
552
|
+
async zipFolder(rel, res) {
|
|
553
|
+
const abs = inside(this.scope, rel);
|
|
554
|
+
if (!abs || !fs.existsSync(abs) || !fs.statSync(abs).isDirectory())
|
|
555
|
+
return json(res, 404, { error: 'No such folder' });
|
|
556
|
+
const name = rel ? path.basename(abs) : path.basename(this.root) || 'folder';
|
|
557
|
+
const files = [];
|
|
558
|
+
let bytes = 0;
|
|
559
|
+
const stack = [rel];
|
|
560
|
+
while (stack.length) {
|
|
561
|
+
const dir = stack.pop() ?? '';
|
|
562
|
+
for (const e of list(this.scope, dir) ?? []) {
|
|
563
|
+
const child = dir ? dir + '/' + e.name : e.name;
|
|
564
|
+
if (e.type === 'folder') {
|
|
565
|
+
if (!NOISE.has(e.name))
|
|
566
|
+
stack.push(child);
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
bytes += e.size;
|
|
570
|
+
files.push({ abs: path.join(this.root, child), name: path.posix.join(name, rel ? child.slice(rel.length + 1) : child) });
|
|
571
|
+
}
|
|
572
|
+
if (files.length > ZIP_LIMITS.files || bytes > ZIP_LIMITS.bytes)
|
|
573
|
+
return json(res, 413, { error: `Too big to zip here (${files.length.toLocaleString()} files, ${Math.round(bytes / 1048576)} MB so far)` });
|
|
574
|
+
}
|
|
575
|
+
files.sort((a, b) => a.name.localeCompare(b.name));
|
|
576
|
+
res.writeHead(200, { 'content-type': 'application/zip', 'content-disposition': disposition(name + '.zip'), 'cache-control': 'no-store' });
|
|
577
|
+
await writeZip(res, files);
|
|
578
|
+
res.end();
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
function answerInput(b) {
|
|
582
|
+
const out = {};
|
|
583
|
+
if (typeof b['status'] === 'string')
|
|
584
|
+
out.status = b['status'];
|
|
585
|
+
if (Array.isArray(b['picked']))
|
|
586
|
+
out.picked = b['picked'].map(String);
|
|
587
|
+
if (typeof b['other'] === 'string')
|
|
588
|
+
out.other = b['other'];
|
|
589
|
+
if (typeof b['text'] === 'string')
|
|
590
|
+
out.text = b['text'];
|
|
591
|
+
if (typeof b['number'] === 'number')
|
|
592
|
+
out.number = b['number'];
|
|
593
|
+
if (Array.isArray(b['order']))
|
|
594
|
+
out.order = b['order'].map(String);
|
|
595
|
+
if (typeof b['note'] === 'string')
|
|
596
|
+
out.note = b['note'];
|
|
597
|
+
return out;
|
|
598
|
+
}
|
|
599
|
+
function isRev(r) {
|
|
600
|
+
return /^[0-9a-f]{4,40}$/i.test(r) || /^HEAD(~\d{1,4}|\^)?$/.test(r);
|
|
601
|
+
}
|
|
602
|
+
function mtime(f) {
|
|
603
|
+
try {
|
|
604
|
+
return fs.statSync(f).mtimeMs;
|
|
605
|
+
}
|
|
606
|
+
catch {
|
|
607
|
+
return 0;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function safeList(d) {
|
|
611
|
+
try {
|
|
612
|
+
return fs.readdirSync(d);
|
|
613
|
+
}
|
|
614
|
+
catch {
|
|
615
|
+
return [];
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
function sha1(abs) {
|
|
619
|
+
try {
|
|
620
|
+
return crypto.createHash('sha1').update(fs.readFileSync(abs)).digest('hex');
|
|
621
|
+
}
|
|
622
|
+
catch {
|
|
623
|
+
return '';
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
/** .hitlignore (and folderview's .folderviewignore): one pattern per line, # for comments */
|
|
627
|
+
function readIgnore(root) {
|
|
628
|
+
const out = [];
|
|
629
|
+
for (const f of ['.hitlignore', '.folderviewignore']) {
|
|
630
|
+
try {
|
|
631
|
+
out.push(...fs.readFileSync(path.join(root, f), 'utf8').split(/\r?\n/));
|
|
632
|
+
}
|
|
633
|
+
catch {
|
|
634
|
+
// none
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return out.map((l) => l.trim()).filter((l) => l && !l.startsWith('#'));
|
|
638
|
+
}
|
|
639
|
+
export const tilde = (p) => (p.startsWith(os.homedir()) ? '~' + p.slice(os.homedir().length) : p);
|