shelfware 0.0.1 → 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/.output/nitro.json +15 -0
- package/.output/public/_nuxt/6IstVYrV.js +1 -0
- package/.output/public/_nuxt/9C5WUlLE.js +36 -0
- package/.output/public/_nuxt/BDNMzG2s.js +1 -0
- package/.output/public/_nuxt/BW3xJdEx.js +1 -0
- package/.output/public/_nuxt/BXXtFil5.js +1 -0
- package/.output/public/_nuxt/BZuUK3cr.js +1 -0
- package/.output/public/_nuxt/BeLyMmd4.js +1 -0
- package/.output/public/_nuxt/C_VgD9ZI.js +3 -0
- package/.output/public/_nuxt/DB5Vxbte.js +2 -0
- package/.output/public/_nuxt/DMg0j7gv.js +14 -0
- package/.output/public/_nuxt/builds/latest.json +1 -0
- package/.output/public/_nuxt/builds/meta/4c307968-4837-497b-a570-d6ee336accc4.json +1 -0
- package/.output/public/_nuxt/entry.b3_DJTEt.css +2 -0
- package/.output/public/_nuxt/error-404.CHsn7XF-.css +1 -0
- package/.output/public/_nuxt/error-500.Bawx2bLr.css +1 -0
- package/.output/server/chunks/_/api-handler.mjs +44 -0
- package/.output/server/chunks/_/batch.mjs +27 -0
- package/.output/server/chunks/_/catalog.mjs +1115 -0
- package/.output/server/chunks/_/detail.mjs +16 -0
- package/.output/server/chunks/_/error-500.mjs +19 -0
- package/.output/server/chunks/_/quarantine.mjs +159 -0
- package/.output/server/chunks/nitro/nitro.mjs +5399 -0
- package/.output/server/chunks/routes/api/_..._.mjs +16 -0
- package/.output/server/chunks/routes/api/health.get.mjs +13 -0
- package/.output/server/chunks/routes/api/skills/_id/file.get.mjs +25 -0
- package/.output/server/chunks/routes/api/skills/_id_.get.mjs +25 -0
- package/.output/server/chunks/routes/api/skills/_id_.put.mjs +74 -0
- package/.output/server/chunks/routes/api/skills/delete.post.mjs +48 -0
- package/.output/server/chunks/routes/api/skills/quarantine.post.mjs +26 -0
- package/.output/server/chunks/routes/api/skills/restore.post.mjs +26 -0
- package/.output/server/chunks/routes/api/skills.get.mjs +41 -0
- package/.output/server/chunks/routes/renderer.mjs +341 -0
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs +3 -0
- package/.output/server/chunks/virtual/precomputed.mjs +3 -0
- package/.output/server/index.mjs +9 -0
- package/.output/server/node_modules/@babel/parser/lib/index.js +14611 -0
- package/.output/server/node_modules/@babel/parser/package.json +50 -0
- package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6801 -0
- package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
- package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +692 -0
- package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
- package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1420 -0
- package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
- package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1903 -0
- package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
- package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6980 -0
- package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
- package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1867 -0
- package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
- package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +904 -0
- package/.output/server/node_modules/@vue/server-renderer/package.json +53 -0
- package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +636 -0
- package/.output/server/node_modules/@vue/shared/package.json +47 -0
- package/.output/server/node_modules/devalue/index.js +17 -0
- package/.output/server/node_modules/devalue/package.json +39 -0
- package/.output/server/node_modules/devalue/src/base64.js +60 -0
- package/.output/server/node_modules/devalue/src/constants.js +12 -0
- package/.output/server/node_modules/devalue/src/operations.js +193 -0
- package/.output/server/node_modules/devalue/src/parse.js +274 -0
- package/.output/server/node_modules/devalue/src/stringify.js +428 -0
- package/.output/server/node_modules/devalue/src/uneval.js +606 -0
- package/.output/server/node_modules/devalue/src/utils.js +185 -0
- package/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
- package/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
- package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
- package/.output/server/node_modules/entities/package.json +120 -0
- package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
- package/.output/server/node_modules/estree-walker/package.json +37 -0
- package/.output/server/node_modules/hookable/dist/index.mjs +257 -0
- package/.output/server/node_modules/hookable/package.json +53 -0
- package/.output/server/node_modules/nostics/dist/formatters/ansi.mjs +19 -0
- package/.output/server/node_modules/nostics/dist/index.mjs +187 -0
- package/.output/server/node_modules/nostics/package.json +125 -0
- package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
- package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
- package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
- package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
- package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
- package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
- package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
- package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
- package/.output/server/node_modules/source-map-js/package.json +71 -0
- package/.output/server/node_modules/source-map-js/source-map.js +8 -0
- package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
- package/.output/server/node_modules/ufo/package.json +48 -0
- package/.output/server/node_modules/unhead/dist/client.mjs +22 -0
- package/.output/server/node_modules/unhead/dist/legacy.mjs +33 -0
- package/.output/server/node_modules/unhead/dist/minify.mjs +183 -0
- package/.output/server/node_modules/unhead/dist/parser.mjs +518 -0
- package/.output/server/node_modules/unhead/dist/plugins.mjs +720 -0
- package/.output/server/node_modules/unhead/dist/server.mjs +99 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.-hZVKou0.mjs +400 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BEmVMkeA.mjs +673 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BGFxPGPQ.mjs +47 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BQWSw36o.mjs +192 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.Bf_fPVYA.mjs +6 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.Bjbp1C8D.mjs +224 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.Bm4Y6XQI.mjs +17 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.C5Bksi2B.mjs +49 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.CGPOfp5O.mjs +32 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.CHEy9ana.mjs +7 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.D7HkBzZn.mjs +59 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.Dssd7L5I.mjs +196 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.jEy9BmRq.mjs +264 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.oZ7pkTV1.mjs +19 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.tQnRaXfX.mjs +240 -0
- package/.output/server/node_modules/unhead/dist/stream/client.mjs +33 -0
- package/.output/server/node_modules/unhead/dist/stream/iife.mjs +2 -0
- package/.output/server/node_modules/unhead/dist/stream/server.mjs +445 -0
- package/.output/server/node_modules/unhead/dist/utils.mjs +7 -0
- package/.output/server/node_modules/unhead/package.json +179 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
- package/.output/server/node_modules/vue/index.js +7 -0
- package/.output/server/node_modules/vue/index.mjs +1 -0
- package/.output/server/node_modules/vue/package.json +112 -0
- package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
- package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +278 -0
- package/.output/server/node_modules/vue-bundle-renderer/package.json +54 -0
- package/.output/server/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/.output/server/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/.output/server/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/.output/server/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/.output/server/node_modules/yaml/dist/compose/composer.js +224 -0
- package/.output/server/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/.output/server/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/.output/server/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/.output/server/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/.output/server/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/.output/server/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
- package/.output/server/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/.output/server/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/.output/server/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/.output/server/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/.output/server/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/.output/server/node_modules/yaml/dist/doc/Document.js +337 -0
- package/.output/server/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/.output/server/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/.output/server/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/.output/server/node_modules/yaml/dist/doc/directives.js +178 -0
- package/.output/server/node_modules/yaml/dist/errors.js +62 -0
- package/.output/server/node_modules/yaml/dist/index.js +50 -0
- package/.output/server/node_modules/yaml/dist/log.js +19 -0
- package/.output/server/node_modules/yaml/dist/nodes/Alias.js +118 -0
- package/.output/server/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/.output/server/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/.output/server/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/.output/server/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/.output/server/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/.output/server/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/.output/server/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/.output/server/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/.output/server/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/.output/server/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/.output/server/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/.output/server/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/.output/server/node_modules/yaml/dist/parse/cst.js +112 -0
- package/.output/server/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/.output/server/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/.output/server/node_modules/yaml/dist/parse/parser.js +980 -0
- package/.output/server/node_modules/yaml/dist/public-api.js +107 -0
- package/.output/server/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/.output/server/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/.output/server/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/.output/server/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/.output/server/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/.output/server/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/.output/server/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/.output/server/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/.output/server/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/.output/server/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/.output/server/node_modules/yaml/dist/schema/tags.js +99 -0
- package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/.output/server/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/.output/server/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/.output/server/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/.output/server/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/.output/server/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/.output/server/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/.output/server/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/.output/server/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/.output/server/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/.output/server/node_modules/yaml/dist/visit.js +236 -0
- package/.output/server/node_modules/yaml/package.json +97 -0
- package/.output/server/package.json +28 -0
- package/LICENSE +21 -0
- package/README.md +57 -1
- package/bin/launch.mjs +158 -0
- package/bin/shelfware.mjs +6 -0
- package/package.json +64 -5
- package/cli.mjs +0 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { q as quarantineRecordFor } from './quarantine.mjs';
|
|
2
|
+
import { b as readSkill } from './catalog.mjs';
|
|
3
|
+
|
|
4
|
+
function skillDetailFor(summary, opts) {
|
|
5
|
+
const detail = readSkill(summary);
|
|
6
|
+
if (summary.quarantined) {
|
|
7
|
+
const record = quarantineRecordFor(summary.path, opts);
|
|
8
|
+
if (record) {
|
|
9
|
+
detail.quarantinedFrom = record.originPath;
|
|
10
|
+
detail.quarantinedAt = record.quarantinedAt;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return detail;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { skillDetailFor as s };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { escapeHtml } from '@vue/shared';
|
|
2
|
+
|
|
3
|
+
//#region src/runtime/templates/error-500.ts
|
|
4
|
+
const _messages = {
|
|
5
|
+
"appName": "Nuxt",
|
|
6
|
+
"status": 500,
|
|
7
|
+
"statusText": "Internal server error",
|
|
8
|
+
"description": "This page is temporarily unavailable.",
|
|
9
|
+
"refresh": "Refresh this page"
|
|
10
|
+
};
|
|
11
|
+
const template = (messages) => {
|
|
12
|
+
messages = {
|
|
13
|
+
..._messages,
|
|
14
|
+
...messages
|
|
15
|
+
};
|
|
16
|
+
return "<!DOCTYPE html><html lang=\"en\"><head><title>" + escapeHtml(messages.status) + " - " + escapeHtml(messages.statusText) + " | " + escapeHtml(messages.appName) + "</title><meta charset=\"utf-8\"><meta content=\"width=device-width,initial-scale=1,minimum-scale=1\" name=\"viewport\"><script>!function(){let e=document.createElement(\"link\").relList;if(!(e&&e.supports&&e.supports(\"modulepreload\"))){for(let e of document.querySelectorAll('link[rel=\"modulepreload\"]'))r(e);new MutationObserver(e=>{for(let t of e)if(\"childList\"===t.type)for(let e of t.addedNodes)\"LINK\"===e.tagName&&\"modulepreload\"===e.rel&&r(e)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;let r=function(e){let r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),r.credentials=\"use-credentials\"===e.crossOrigin?\"include\":\"anonymous\"===e.crossOrigin?\"omit\":\"same-origin\",r}(e);fetch(e.href,r)}}();<\/script><style>*,:after,:before{box-sizing:border-box;border-style:solid;border-width:0;border-color:var(--un-default-border-color,#e5e7eb)}:after,:before{--un-content:\"\"}html{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 #0000;--un-ring-shadow:0 0 #0000;--un-shadow-inset: ;--un-shadow:0 0 #0000;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:#93c5fd80;--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.grid{display:grid}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.max-w-520px{max-width:520px}.min-h-screen{min-height:100vh}.place-content-center{place-content:center}.overflow-hidden{overflow:hidden}.bg-white{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2{padding-left:.5rem;padding-right:.5rem}.text-center{text-align:center}.text-\\[80px\\]{font-size:80px}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\\[\\#020420\\]{--un-text-opacity:1;color:rgb(2 4 32/var(--un-text-opacity))}.text-\\[\\#64748B\\]{--un-text-opacity:1;color:rgb(100 116 139/var(--un-text-opacity))}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-wide{letter-spacing:.025em}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\\:bg-\\[\\#020420\\]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\\:text-white{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (width>=640px){.sm\\:text-\\[110px\\]{font-size:110px}.sm\\:text-3xl{font-size:1.875rem;line-height:2.25rem}}</style></head><body class=\"antialiased bg-white dark:bg-[#020420] dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-[#020420] tracking-wide\"><div class=\"max-w-520px text-center\"><h1 class=\"font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]\">" + escapeHtml(messages.status) + "</h1><h2 class=\"font-semibold mb-2 sm:text-3xl text-2xl\">" + escapeHtml(messages.statusText) + "</h2><p class=\"mb-4 px-2 text-[#64748B] text-md\">" + escapeHtml(messages.description) + "</p></div></body></html>";
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { template };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { f as fail } from './api-handler.mjs';
|
|
4
|
+
import { c as contained, q as quarantineRoot, a as assertSkillTarget, j as isDir, r as realPath } from './catalog.mjs';
|
|
5
|
+
|
|
6
|
+
function canonicalPath(p) {
|
|
7
|
+
const resolved = path.resolve(p);
|
|
8
|
+
return path.join(realPath(path.dirname(resolved)), path.basename(resolved));
|
|
9
|
+
}
|
|
10
|
+
function manifestPath(opts) {
|
|
11
|
+
return path.join(quarantineRoot(opts), "quarantine.json");
|
|
12
|
+
}
|
|
13
|
+
function occupied(p) {
|
|
14
|
+
try {
|
|
15
|
+
fs.lstatSync(p);
|
|
16
|
+
return true;
|
|
17
|
+
} catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function readManifest(opts) {
|
|
22
|
+
let parsed = null;
|
|
23
|
+
try {
|
|
24
|
+
parsed = JSON.parse(fs.readFileSync(manifestPath(opts), "utf8"));
|
|
25
|
+
} catch {
|
|
26
|
+
parsed = null;
|
|
27
|
+
}
|
|
28
|
+
const entries = Array.isArray(parsed == null ? void 0 : parsed.entries) ? parsed.entries : [];
|
|
29
|
+
return {
|
|
30
|
+
version: 1,
|
|
31
|
+
entries: entries.filter((entry) => {
|
|
32
|
+
const e = entry;
|
|
33
|
+
return Boolean(e && typeof e.quarantinePath === "string" && typeof e.originPath === "string" && occupied(e.quarantinePath));
|
|
34
|
+
})
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function writeManifest(manifest, opts) {
|
|
38
|
+
fs.mkdirSync(quarantineRoot(opts), { recursive: true });
|
|
39
|
+
const dest = manifestPath(opts);
|
|
40
|
+
const tmp = `${dest}.${process.pid}.tmp`;
|
|
41
|
+
try {
|
|
42
|
+
fs.writeFileSync(tmp, `${JSON.stringify({ version: 1, entries: manifest.entries }, null, 2)}
|
|
43
|
+
`, "utf8");
|
|
44
|
+
fs.renameSync(tmp, dest);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
try {
|
|
47
|
+
fs.rmSync(tmp, { force: true });
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function scopeFolder(scopeId) {
|
|
54
|
+
const cleaned = String(scopeId || "loose").replace(/[^A-Za-z0-9._-]+/g, "-");
|
|
55
|
+
return cleaned === "." || cleaned === ".." || !cleaned ? "loose" : cleaned;
|
|
56
|
+
}
|
|
57
|
+
function withSuffix(base, n) {
|
|
58
|
+
const ext = path.extname(base);
|
|
59
|
+
return ext ? `${base.slice(0, -ext.length)}-${n}${ext}` : `${base}-${n}`;
|
|
60
|
+
}
|
|
61
|
+
function freeQuarantinePath(scopeDir, base) {
|
|
62
|
+
let candidate = path.join(scopeDir, base);
|
|
63
|
+
for (let n = 2; occupied(candidate) && n < 1e3; n += 1) {
|
|
64
|
+
candidate = path.join(scopeDir, withSuffix(base, n));
|
|
65
|
+
}
|
|
66
|
+
if (occupied(candidate)) throw fail(409, "Too many quarantined copies under that name");
|
|
67
|
+
return candidate;
|
|
68
|
+
}
|
|
69
|
+
function move(source, dest) {
|
|
70
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
71
|
+
try {
|
|
72
|
+
fs.renameSync(source, dest);
|
|
73
|
+
return;
|
|
74
|
+
} catch (err) {
|
|
75
|
+
if (err.code !== "EXDEV") throw err;
|
|
76
|
+
}
|
|
77
|
+
fs.cpSync(source, dest, { recursive: true, verbatimSymlinks: true });
|
|
78
|
+
fs.rmSync(source, { recursive: true, force: true });
|
|
79
|
+
}
|
|
80
|
+
function persistAfterMove(from, to, persist) {
|
|
81
|
+
try {
|
|
82
|
+
persist();
|
|
83
|
+
} catch (err) {
|
|
84
|
+
try {
|
|
85
|
+
move(to, from);
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function pruneScopeDir(dir, opts) {
|
|
92
|
+
const resolved = path.resolve(dir);
|
|
93
|
+
const root = quarantineRoot(opts);
|
|
94
|
+
if (resolved === path.resolve(root)) return;
|
|
95
|
+
if (!contained(resolved, root)) return;
|
|
96
|
+
try {
|
|
97
|
+
if (fs.readdirSync(resolved).length === 0) fs.rmdirSync(resolved);
|
|
98
|
+
} catch {
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function quarantineSkill(summary, roots, opts) {
|
|
102
|
+
if (summary.quarantined) throw fail(400, "Already in the quarantine");
|
|
103
|
+
const source = assertSkillTarget(summary, roots, "quarantine", opts);
|
|
104
|
+
const scopeDir = path.join(quarantineRoot(opts), scopeFolder(summary.scopeId));
|
|
105
|
+
const dest = freeQuarantinePath(scopeDir, path.basename(source));
|
|
106
|
+
move(source, dest);
|
|
107
|
+
persistAfterMove(source, dest, () => {
|
|
108
|
+
const manifest = readManifest(opts);
|
|
109
|
+
manifest.entries = manifest.entries.filter((entry) => path.resolve(entry.quarantinePath) !== path.resolve(dest));
|
|
110
|
+
manifest.entries.push({
|
|
111
|
+
quarantinePath: dest,
|
|
112
|
+
originPath: source,
|
|
113
|
+
name: summary.name,
|
|
114
|
+
slug: summary.slug,
|
|
115
|
+
scopeId: summary.scopeId,
|
|
116
|
+
scopeLabel: summary.scopeLabel,
|
|
117
|
+
kind: summary.kind,
|
|
118
|
+
file: Boolean(summary.file),
|
|
119
|
+
link: Boolean(summary.link),
|
|
120
|
+
quarantinedAt: Date.now()
|
|
121
|
+
});
|
|
122
|
+
writeManifest(manifest, opts);
|
|
123
|
+
});
|
|
124
|
+
return { from: source, to: dest };
|
|
125
|
+
}
|
|
126
|
+
function restoreSkill(summary, roots, opts) {
|
|
127
|
+
const source = path.resolve(summary.path);
|
|
128
|
+
if (!summary.quarantined || !contained(source, quarantineRoot(opts))) throw fail(400, "Not a quarantined card");
|
|
129
|
+
const manifest = readManifest(opts);
|
|
130
|
+
const entry = manifest.entries.find((item) => canonicalPath(item.quarantinePath) === source);
|
|
131
|
+
if (!entry) throw fail(409, "No quarantine record says where this came from. Move it back by hand.");
|
|
132
|
+
const dest = path.resolve(entry.originPath);
|
|
133
|
+
const drawers = roots.filter((root) => root.kind !== "quarantine");
|
|
134
|
+
const insideDrawer = drawers.some((root) => contained(dest, root.root) && path.resolve(root.root) !== dest);
|
|
135
|
+
if (!insideDrawer) throw fail(403, `No cabinet drawer holds ${dest} any more`);
|
|
136
|
+
if (!isDir(path.dirname(dest))) throw fail(409, `The original drawer is gone: ${path.dirname(dest)}`);
|
|
137
|
+
if (occupied(dest)) throw fail(409, `Something is already at ${dest}`);
|
|
138
|
+
move(source, dest);
|
|
139
|
+
persistAfterMove(source, dest, () => {
|
|
140
|
+
manifest.entries = manifest.entries.filter((item) => canonicalPath(item.quarantinePath) !== source);
|
|
141
|
+
writeManifest(manifest, opts);
|
|
142
|
+
pruneScopeDir(path.dirname(source), opts);
|
|
143
|
+
});
|
|
144
|
+
return { from: source, to: dest };
|
|
145
|
+
}
|
|
146
|
+
function quarantineRecordFor(quarantinePath, opts) {
|
|
147
|
+
const target = canonicalPath(quarantinePath);
|
|
148
|
+
return readManifest(opts).entries.find((entry) => canonicalPath(entry.quarantinePath) === target) || null;
|
|
149
|
+
}
|
|
150
|
+
function forgetQuarantinePath(target, opts) {
|
|
151
|
+
const resolved = canonicalPath(target);
|
|
152
|
+
if (!contained(resolved, quarantineRoot(opts))) return;
|
|
153
|
+
const manifest = readManifest(opts);
|
|
154
|
+
const next = manifest.entries.filter((entry) => canonicalPath(entry.quarantinePath) !== resolved);
|
|
155
|
+
writeManifest({ ...manifest, entries: next }, opts);
|
|
156
|
+
pruneScopeDir(path.dirname(resolved), opts);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export { quarantineSkill as a, forgetQuarantinePath as f, quarantineRecordFor as q, restoreSkill as r };
|