shadow-claw 1.35.0 → 1.36.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/.well-known/mcp/server-card.json +1 -1
- package/.well-known/mcp.json +1 -1
- package/dist/cli/build/build.js +1 -1
- package/dist/cli/{chunk-B4a6SyOL.js → chunk-6dsqmo6-.js} +3 -3
- package/dist/cli/chunk-BT2f5jvi.js +1 -0
- package/dist/cli/{chunk-DoHbMaWn.js → chunk-BwtEsB9s.js} +6 -6
- package/dist/cli/chunk-DMRbWmO2.js +1 -0
- package/dist/cli/chunk-Du5qiUIk.js +2 -0
- package/dist/cli/chunk-rJtMBaNB.js +2 -0
- package/dist/cli/cli.js +2 -2
- package/dist/public/.well-known/mcp/server-card.json +1 -1
- package/dist/public/.well-known/mcp.json +1 -1
- package/dist/public/docs/example/article/index.html +1 -1
- package/dist/public/docs/publishing/index.html +1 -1
- package/dist/public/docs/skill-creator/index.html +1 -1
- package/dist/public/docs/subsystems/cli.md +10 -9
- package/dist/public/index.html +1 -1
- package/dist/public/main/index.html +1 -1
- package/dist/public/main/memory/index.html +1 -1
- package/dist/public/service-worker.js +1 -1
- package/package.json +1 -1
- package/src/cli/build/build.test.ts +11 -0
- package/src/cli/build/build.ts +10 -9
- package/src/cli/cli.ts +5 -0
- package/src/cli/commands/skills-index.test.ts +84 -2
- package/src/cli/commands/skills-index.ts +20 -2
- package/dist/cli/chunk-Cdq9DIrc.js +0 -1
- package/dist/cli/chunk-DBk6e4N-.js +0 -1
- package/dist/cli/chunk-JBAAPRpe.js +0 -2
- package/dist/cli/chunk-uOnw3tuc.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://modelcontextprotocol.io/schemas/server-card/v1.json",
|
|
3
3
|
"name": "shadow-claw",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.36.0",
|
|
5
5
|
"description": "Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.",
|
|
6
6
|
"title": "ShadowClaw MCP Server",
|
|
7
7
|
"websiteUrl": "https://xt-ml.github.io/shadow-claw/",
|
package/.well-known/mcp.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://modelcontextprotocol.io/schemas/server-card/v1.json",
|
|
3
3
|
"name": "shadow-claw",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.36.0",
|
|
5
5
|
"description": "Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.",
|
|
6
6
|
"title": "ShadowClaw MCP Server",
|
|
7
7
|
"websiteUrl": "https://xt-ml.github.io/shadow-claw/",
|
package/dist/cli/build/build.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../chunk-
|
|
1
|
+
import{t as e}from"../chunk-BwtEsB9s.js";export{e as runBuild};
|
|
@@ -6,6 +6,6 @@ globstar while`,e,d,t,f,p),this.matchOne(e.slice(d),t.slice(f),n))return this.de
|
|
|
6
6
|
`))}i.siteUrl&&!i.siteUrl.includes(`xt-ml.github.io`)&&(n=n.replace(/\s*<meta\s+http-equiv="origin-trial"\s+content="[^"]*"\s*\/?>\s*/iu,`
|
|
7
7
|
`));let a=t.theme||{};if(a.stylesheet){let e=so(a.stylesheet),t=`<link rel="stylesheet" href="${Z(e)}" />`;!n.includes(`href="${e}"`)&&!n.includes(`href="${Z(e)}"`)&&(n=/<link\s+rel="stylesheet"\s+href="index\.css"\s*\/?>/iu.test(n)?n.replace(/(<link\s+rel="stylesheet"\s+href="index\.css"\s*\/?>)/iu,`$1\n ${t}`):ao(n,` ${t}`))}let{allowedDomains:o}=no(t,a),s=io(t,o),c=`<script id="shadow-claw-site-config" type="application/json">${JSON.stringify(s).replace(/</g,`\\u003c`).replace(/>/g,`\\u003e`).replace(/\//g,`\\u002f`)}<\/script>`;return n=n.includes(`<script id="shadow-claw-site-config"`)?n.replace(/<script\s+id="shadow-claw-site-config"[\s\S]*?<\/script>/iu,()=>c):n.includes(`<script src="theme-init.js">`)?n.replace(`<script src="theme-init.js">`,`${c}\n <script src="theme-init.js">`):/<script\b[^>]*>\s*var\s+ShadowClawThemeInit\b/iu.test(n)?n.replace(/(<script\b[^>]*>\s*var\s+ShadowClawThemeInit\b)/iu,`${c}\n $1`):ao(n,` ${c}`),n}function po(e){let t=(e.src||``).replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),n=e.type||(t.endsWith(`.svg`)?`image/svg+xml`:t.endsWith(`.png`)?`image/png`:`image/x-icon`),r=(e.purpose||`any`).trim();return n===`image/svg+xml`||t.endsWith(`.svg`)?[{...e,src:t,type:n,purpose:`any`}]:r.includes(`any`)&&r.includes(`maskable`)?[{...e,src:t,type:n,purpose:`any`},{...e,src:t,type:n,purpose:`maskable`}]:[{...e,src:t,type:n,purpose:r}]}function mo(e,t){let n=typeof e==`string`?JSON.parse(e):e,r=t.pwa||{},i=t.site||{},a=w.env.PAGES_ORIGIN;if((r.name||i.title)&&(n.name=r.name||i.title),(r.shortName||i.title)&&(n.short_name=r.shortName||i.title),i.description&&(n.description=i.description),r.backgroundColor&&(n.background_color=r.backgroundColor),(r.themeColor||i.themeColor)&&(n.theme_color=r.themeColor||i.themeColor),r.startUrl?n.start_url=r.startUrl:a?n.start_url=a:n.start_url||=`./`,r.icons&&Array.isArray(r.icons)){let e=r.icons.flatMap(po),t=Array.isArray(n.icons)?n.icons.flatMap(po):[],i=new Set(e.map(e=>e.src));n.icons=[...e,...t.filter(e=>!i.has(e.src))]}else Array.isArray(n.icons)&&(n.icons=n.icons.flatMap(po));return r.screenshots&&Array.isArray(r.screenshots)&&(n.screenshots=r.screenshots.map(e=>{let t=(e.src||``).replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``);return{...e,src:t}})),JSON.stringify(n,null,2)}function ho(e,t){if(!t)return e;if(/<loc>/i.test(e))return e.replace(/<loc>[^<]*<\/loc>/giu,`<loc>${Z(t)}</loc>`);let n=t.endsWith(`/`)?t:t+`/`;return e.split(`
|
|
8
8
|
`).map(e=>{let t=e.trim();if(!t)return e;if(t.startsWith(`http://`)||t.startsWith(`https://`))try{let e=new URL(t),r=new URL(n);return e.protocol=r.protocol,e.host=r.host,e.pathname=(r.pathname.endsWith(`/`)?r.pathname.slice(0,-1):r.pathname)+e.pathname,e.toString()}catch{return n}else if(t.startsWith(`/`))try{return new URL(t,n).toString()}catch{return e}return e}).join(`
|
|
9
|
-
`)}function go(e,t,n){let r=e,i=t.site||{};if(i.title&&(r=r.replace(/<title>[^<]*<\/title>/iu,`<title>${Z(i.title)} - Not Found</title>`)),n){let e=n.endsWith(`/`)?n:n+`/`;r=r.replace(/l\.replace\(["']\/shadow-claw\/["']\)/gu,`l.replace("${Z(e)}")`)}return r}function _o(e){let t=y.resolve(e),n=t.split(y.sep),r=n[n.length-1],i=n[n.length-2];return(r===`resources`||r===`deps`)&&i===`pages`?y.resolve(t,`../..`):r===`resources`||r===`deps`||r===`pages`?y.resolve(t,`..`):t}function vo(e){let t=y.resolve(e),n=y.basename(t);return n===`resources`||n===`deps`||n===`pages`?y.resolve(t,`..`):t}function Q(e,t,n){if(!e||typeof e!=`string`)return[];if(y.isAbsolute(e))return[e];let r=e.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=_o(t);return[y.resolve(t,`resources`,r),y.resolve(t,`deps`,r),y.resolve(t,`main`,r),y.resolve(i,`pages`,`resources`,r),y.resolve(i,`pages`,`resources`,e),y.resolve(i,`pages`,`deps`,r),y.resolve(i,`pages`,`deps`,e),y.resolve(i,`resources`,r),y.resolve(i,`resources`,e),y.resolve(i,`deps`,r),y.resolve(i,`deps`,e),y.resolve(n,`pages`,`resources`,r),y.resolve(n,`pages`,`deps`,r),y.resolve(n,`resources`,r),y.resolve(n,`deps`,r),y.resolve(n,`pages`,e),y.resolve(n,`pages`,r),y.resolve(n,`pages`,`main`,r),y.resolve(i,`pages`,e),y.resolve(i,`pages`,r),y.resolve(i,`pages`,`main`,r),y.resolve(i,`pages`,`main`,e),y.resolve(t,e),y.resolve(t,r),y.resolve(n,e),y.resolve(n,r),y.resolve(i,e),y.resolve(i,r)]}async function yo(e){for(let t of e)if(t)try{return await de(t),t}catch{}return null}async function bo(e,t,n){let r=n?y.dirname(y.resolve(n)):w.cwd(),i=vo(r),a=_o(r),o=[y.resolve(r,`resources`),y.resolve(r,`deps`),y.resolve(i,`resources`),y.resolve(i,`deps`),y.resolve(i,`pages`,`resources`),y.resolve(i,`pages`,`deps`),y.resolve(a,`resources`),y.resolve(a,`deps`),y.resolve(a,`pages`,`resources`),y.resolve(a,`pages`,`deps`)];for(let e of o)try{let n=await se(e,{withFileTypes:!0});for(let r of n){let n=y.join(e,r.name),i=y.join(t,r.name);r.isDirectory()?await E(n,i,{recursive:!0,force:!0}):r.isFile()&&(await D(y.dirname(i),{recursive:!0}),await T(n,i))}}catch{}let s=await yo([...e.pages?.notFoundPath?Q(e.pages.notFoundPath,r,i):[],...e.branding?.notFoundPath?Q(e.branding.notFoundPath,r,i):[],...e.notFoundPath?Q(e.notFoundPath,r,i):[],...Q(`404.html`,r,i)]);if(s)try{await T(s,y.join(t,`404.html`)),console.log(` Copied custom 404.html: ${s}`)}catch(e){console.warn(` Warning: Could not copy custom 404.html: ${e.message}`)}let c=await yo([...e.pwa?.manifestPath?Q(e.pwa.manifestPath,r,i):[],...e.manifestPath?Q(e.manifestPath,r,i):[],...Q(`manifest.json`,r,i)]);if(c)try{await T(c,y.join(t,`manifest.json`)),console.log(` Copied custom manifest.json: ${c}`)}catch(e){console.warn(` Warning: Could not copy custom manifest.json: ${e.message}`)}let l=!1;if(e.sitemapPath){let n=await yo(Q(e.sitemapPath,r,i));if(n)try{let e=y.basename(n);await T(n,y.join(t,e)),console.log(` Copied custom sitemap: ${n} → ${e}`),l=!0}catch(e){console.warn(` Warning: Could not copy custom sitemap: ${e.message}`)}}if(!l){let e=await yo(Q(`sitemap.xml`,r,i));if(e)try{await T(e,y.join(t,`sitemap.xml`)),console.log(` Copied custom sitemap.xml: ${e}`)}catch(e){console.warn(` Warning: Could not copy custom sitemap.xml: ${e.message}`)}let n=await yo(Q(`sitemap.txt`,r,i));if(n)try{await T(n,y.join(t,`sitemap.txt`)),console.log(` Copied custom sitemap.txt: ${n}`)}catch(e){console.warn(` Warning: Could not copy custom sitemap.txt: ${e.message}`)}}let u=e.overwriteAssets===!0||e.branding?.overwriteAssets===!0,d=Array.isArray(e.assets)?e.assets:[e.assetsDir,e.assets].filter(Boolean),f=Array.from(new Set([...d.flatMap(e=>Q(e,r,i)),...Q(`assets`,r,i)].filter(e=>e&&typeof e==`string`))),p=y.join(t,`assets`);if(u)try{await ue(p,{recursive:!0,force:!0}),await D(p,{recursive:!0}),console.log(` Cleared dist public assets for complete template asset overwrite.`)}catch{}let m=new Set,h=[...f].reverse();for(let e of h)if(!m.has(e))try{let t=await de(e);if(m.add(e),t.isDirectory())await E(e,p,{recursive:!0,force:!0}),console.log(` Copied custom assets: ${e} → ${p}`);else if(t.isFile()){let t=y.basename(e);await D(p,{recursive:!0}),await T(e,y.join(p,t)),console.log(` Copied custom asset file: ${e} → ${p}`)}}catch{}}async function xo(e,t,n){let r=e.theme||{};if(!r.stylesheet)return;let i=n?y.dirname(y.resolve(n)):w.cwd(),a=vo(i),o=await yo(Q(r.stylesheet,i,a));if(!o)return;let s=r.stylesheet.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),c=y.join(t,s);try{await D(y.dirname(c),{recursive:!0}),await T(o,c),console.log(` Copied theme stylesheet: ${o} → ${c}`)}catch(e){console.warn(` Warning: Could not copy theme stylesheet ${o}: ${e.message}`)}}async function So(e,t,n){let r=(e.customElements&&typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.scripts:void 0)||e.scripts||[];if(!Array.isArray(r)||r.length===0)return;let i=n?y.dirname(y.resolve(n)):w.cwd(),a=vo(i);for(let e of r){let n=typeof e==`string`?e:e?.src;if(!n||n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`//`))continue;let r=await yo(Q(n,i,a));if(r){let e=n.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=y.join(t,e);try{await D(y.dirname(i),{recursive:!0}),await T(r,i),console.log(` Copied custom script: ${r} → ${i}`)}catch(e){console.warn(` Warning: Could not copy custom script ${r}: ${e.message}`)}}}}async function Co(e,t,n){let r=e.branding||{},i=e.pwa||{},a=n?y.dirname(y.resolve(n)):w.cwd(),o=vo(a),s=[],c=await yo(Q(i.manifestPath||e.manifestPath||`manifest.json`,a,o));if(c){let e=await co(c);e&&Array.isArray(e.icons)&&(s=e.icons.map(e=>e?.src).filter(Boolean))}let l=[r.faviconPath,r.appleTouchIconPath,`assets/icons/favicon.svg`,`assets/icons/favicon.ico`,`favicon.svg`,`favicon.ico`,`pages/resources/assets/icons/favicon.svg`,`pages/resources/assets/icons/favicon.ico`,`pages/resources/favicon.svg`,`pages/deps/favicon.svg`,`pages/main/favicon.svg`,...Array.isArray(i.icons)?i.icons.map(e=>e.src):[],...s].filter(e=>!!e&&typeof e==`string`&&!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&!e.startsWith(`//`));if(l.length===0)return;let u=new Set,d=new Set;for(let e of l){if(u.has(e))continue;u.add(e);let n=await yo(Q(e,a,o));if(n){let r=e.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=y.join(t,r);if(d.has(i))continue;d.add(i);try{await D(y.dirname(i),{recursive:!0}),await T(n,i),console.log(` Copied branding asset: ${n} → ${i}`)}catch(e){console.warn(` Warning: Could not copy branding asset ${n}: ${e.message}`)}}}}async function wo(e,t){let n=await co(t);if(!n)return console.log(`No site-config.json found — skipping site configuration.`),{applied:!1};console.log(`Applying site-config.json...`);let r=w.env.PAGES_ORIGIN||``,i=w.env.PAGES_BASE_PATH||``;await bo(n,e,t);let a=y.join(e,`index.html`),o=await lo(a);o&&(await uo(a,fo(o,n)),console.log(` Patched index.html`));let s=y.join(e,`manifest.json`),c=await lo(s);c&&(await uo(s,mo(c,n)),console.log(` Patched manifest.json`));let l=y.join(e,`sitemap.xml`),u=await lo(l);u&&(await uo(l,ho(u,r)),console.log(` Patched sitemap.xml`));let d=y.join(e,`sitemap.txt`),f=await lo(d);f&&(await uo(d,ho(f,r)),console.log(` Patched sitemap.txt`));let p=y.join(e,`404.html`),m=await lo(p);return m&&(await uo(p,go(m,n,i)),console.log(` Patched 404.html`)),await xo(n,e,t),await So(n,e,t),await Co(n,e,t),console.log(`Site configuration applied successfully.`),{applied:!0}}async function To(){let[e,t]=w.argv.slice(2);(!e||!t)&&(console.error(`Usage: node bin/site-config/apply.mjs <distPublicDir> <siteConfigPath>`),w.exit(1)),await wo(e,t)}w.argv[1]&&y.resolve(w.argv[1])===y.resolve(C(import.meta.url))&&To().catch(e=>{console.error(`site-config/apply.ts failed:`,e),w.exit(1)});async function Eo(t,{writeFileImpl:n=k}={}){await n(b(t||b(e(import.meta.url),`dist`,`public`),`.nojekyll`),``,`utf-8`)}w.argv[1]&&y.resolve(w.argv[1])===y.resolve(C(import.meta.url))&&await Eo();const Do=e(import.meta.url);async function $(e){try{return await de(e),!0}catch{return!1}}async function Oo(e={}){let t=e.quiet??(process.env.NODE_ENV===`test`&&!process.env.VERBOSE),n=e.stdio??(process.env.NODE_ENV===`test`&&!process.env.VERBOSE?`pipe`:`inherit`),r=(...e)=>{t||console.log(...e)};async function i(e,r={}){!t&&!r.quiet&&console.log(`> ${e}`),ae(e,{stdio:r.stdio??n,...r})}let a=te(e.contentRoot||re.SHADOWCLAW_CONTENT_ROOT||process.cwd()),o=te(e.toolchainRoot||Do),s=a===o,{isProduction:l,copyAllAssets:u,prerenderPages:d,prerenderMainMemory:f}=Xa({...re,...e.isProduction===void 0?{}:{NODE_ENV:e.isProduction?`production`:`development`},...e.copyAllAssets===void 0?{}:{COPY_ALL_ASSETS:String(e.copyAllAssets)},...e.prerenderPages===void 0?{}:{PRERENDER_PAGES:String(e.prerenderPages)},...e.prerenderMainMemory===void 0?{}:{PRERENDER_MAIN_MEMORY:String(e.prerenderMainMemory)}});if(s){if(ne(Do),await Ua(`dist/public`),await D(`dist/public/assets`,{recursive:!0}),u)await E(`assets`,`dist/public`,{recursive:!0});else{await E(`assets/icons`,`dist/public/assets/icons`,{recursive:!0}),await E(`assets/screenshots`,`dist/public/assets/screenshots`,{recursive:!0});try{await E(`assets/fonts`,`dist/public/assets/fonts`,{recursive:!0})}catch{}}await Wa([`pages/resources`,`pages/deps`,`resources`,`deps`,`pages/assets`,`pages/main/assets`],`dist/public`);for(let e of qa())await Ga(e.sources,e.dest,e.opts||{});try{await E(`e2e/README.md`,`dist/public/e2e/README.md`)}catch{}try{await E(`pages`,`dist/public/pages`,{recursive:!0})}catch{}try{await E(`pages/main`,`dist/public/files/main`,{recursive:!0})}catch{}try{await E(`pages/main`,`dist/public/static-main`,{recursive:!0})}catch{}try{await E(`.agents/skills`,`dist/public/.agents/skills`,{recursive:!0})}catch{}try{await E(`.agents/tools`,`dist/public/.agents/tools`,{recursive:!0})}catch{}try{await E(`.agents/scripts`,`dist/public/.agents/scripts`,{recursive:!0})}catch{}if(await $(`.agents/skills`))try{let{generateSkillsIndex:e}=await import(`./chunk-DBk6e4N-.js`);await e(Do)}catch(e){console.warn(`Notice: Failed to auto-generate agent-skills index:`,e)}if(await $(`.well-known`))try{await E(`.well-known`,`dist/public/.well-known`,{recursive:!0,force:!0})}catch{}await i(`npm run -s rolldown`),f?await c({indexPath:`dist/public/index.html`,sourcePath:`pages/main`,prerenderPages:d}):await c({indexPath:`dist/public/index.html`,noSeed:!0});let t=await Ka(Ya())||`pages/site-config.json`;try{await wo(`dist/public`,t)}catch{}try{let e=JSON.parse(await O(`package.json`,`utf8`));if(e.version){let t=`dist/public/index.html`;await k(t,(await O(t,`utf8`)).replace(/<meta\s+name="version"[^>]*>/,`<meta name="version" content="${e.version}" />`),`utf8`);for(let t of[`.well-known/mcp.json`,`.well-known/mcp/server-card.json`]){let n=b(`dist/public`,t);if(await $(n))try{let t=JSON.parse(await O(n,`utf8`));t.version!==e.version&&(t.version=e.version,await k(n,JSON.stringify(t,null,2)+`
|
|
10
|
-
`,`utf8`))}catch{}}}}catch{}if(l){r(`Running production post-build steps...`);let t=e.pagesOrigin||re.PAGES_ORIGIN,n=e.basePath||(re.PAGES_BASE_PATH??`/shadow-claw/`);if(r(` PAGES_ORIGIN : ${t||`(relative ./)`}`),r(` PAGES_BASE_PATH: ${n}`),t)try{let e=`dist/public/manifest.json`,n=await O(e,`utf8`),r=JSON.parse(n);r.start_url&&(r.start_url=t,await k(e,JSON.stringify(r,null,2),`utf8`))}catch{}try{let e=`dist/public/index.html`,t=await O(e,`utf8`);t=t.replace(/<base\s+href="[^"]*"\s*\/?>/i,`<base href="${n}" />`),await k(e,t,`utf8`)}catch{}await Eo(`dist/public`);let a=``;try{a=ae(`npm run -s build:pkg:get:meta`,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{}a&&await i(`npm run -s build:pkg:meta "${a}"`)}await eo({publicDir:`dist/public`,routesPath:await Ka(Ja())||`pages/routes.json`,sourcePath:`pages/main`,prerenderPages:d}),await i(`npm run -s build:service-worker`);let n=`dist/public/service-worker.js`;await $(n)&&await _(n,{logImpl:()=>{}}),r(`Build completed successfully.`);return}let p=te(a,e.outDir||`dist/public`);await D(p,{recursive:!0}),await D(b(p,`assets`),{recursive:!0});let m=b(o,`dist/public`);await $(b(m,`index.js`))||(r(`Building ShadowClaw core toolchain...`),await Ua(b(o,`dist/public`)),await Ua(b(o,`dist-electron`)),await i(`npm run -s rolldown`,{cwd:o})),await E(m,p,{recursive:!0,filter:e=>!(e.includes(`/assets/cache/`)||e.includes(`\\assets\\cache\\`)||e.includes(`/.cache/`)||e.includes(`\\.cache\\`))});let h=b(a,`assets`);await $(h)&&(u?await E(h,p,{recursive:!0,force:!0}):(await $(b(h,`icons`))&&await E(b(h,`icons`),b(p,`assets/icons`),{recursive:!0,force:!0}),await $(b(h,`screenshots`))&&await E(b(h,`screenshots`),b(p,`assets/screenshots`),{recursive:!0,force:!0}),await $(b(h,`fonts`))&&await E(b(h,`fonts`),b(p,`assets/fonts`),{recursive:!0,force:!0}))),await Wa([`pages/resources`,`pages/deps`,`resources`,`deps`,`pages/assets`,`pages/main/assets`],p,{baseDir:a});let g=qa({contentRoot:a,toolchainRoot:o,distPublicDir:p});for(let e of g)await Ga(e.sources,e.dest,e.opts||{});let ee=b(a,`pages`);await $(ee)&&await E(ee,b(p,`pages`),{recursive:!0,force:!0});let v=b(a,`pages/main`);await $(v)&&(await E(v,b(p,`files/main`),{recursive:!0,force:!0}),await E(v,b(p,`static-main`),{recursive:!0,force:!0}));let y=b(a,`.agents/skills`);
|
|
11
|
-
`,`utf8`))}catch{}}}await k(
|
|
9
|
+
`)}function go(e,t,n){let r=e,i=t.site||{};if(i.title&&(r=r.replace(/<title>[^<]*<\/title>/iu,`<title>${Z(i.title)} - Not Found</title>`)),n){let e=n.endsWith(`/`)?n:n+`/`;r=r.replace(/l\.replace\(["']\/shadow-claw\/["']\)/gu,`l.replace("${Z(e)}")`)}return r}function _o(e){let t=y.resolve(e),n=t.split(y.sep),r=n[n.length-1],i=n[n.length-2];return(r===`resources`||r===`deps`)&&i===`pages`?y.resolve(t,`../..`):r===`resources`||r===`deps`||r===`pages`?y.resolve(t,`..`):t}function vo(e){let t=y.resolve(e),n=y.basename(t);return n===`resources`||n===`deps`||n===`pages`?y.resolve(t,`..`):t}function Q(e,t,n){if(!e||typeof e!=`string`)return[];if(y.isAbsolute(e))return[e];let r=e.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=_o(t);return[y.resolve(t,`resources`,r),y.resolve(t,`deps`,r),y.resolve(t,`main`,r),y.resolve(i,`pages`,`resources`,r),y.resolve(i,`pages`,`resources`,e),y.resolve(i,`pages`,`deps`,r),y.resolve(i,`pages`,`deps`,e),y.resolve(i,`resources`,r),y.resolve(i,`resources`,e),y.resolve(i,`deps`,r),y.resolve(i,`deps`,e),y.resolve(n,`pages`,`resources`,r),y.resolve(n,`pages`,`deps`,r),y.resolve(n,`resources`,r),y.resolve(n,`deps`,r),y.resolve(n,`pages`,e),y.resolve(n,`pages`,r),y.resolve(n,`pages`,`main`,r),y.resolve(i,`pages`,e),y.resolve(i,`pages`,r),y.resolve(i,`pages`,`main`,r),y.resolve(i,`pages`,`main`,e),y.resolve(t,e),y.resolve(t,r),y.resolve(n,e),y.resolve(n,r),y.resolve(i,e),y.resolve(i,r)]}async function yo(e){for(let t of e)if(t)try{return await de(t),t}catch{}return null}async function bo(e,t,n){let r=n?y.dirname(y.resolve(n)):w.cwd(),i=vo(r),a=_o(r),o=[y.resolve(r,`resources`),y.resolve(r,`deps`),y.resolve(i,`resources`),y.resolve(i,`deps`),y.resolve(i,`pages`,`resources`),y.resolve(i,`pages`,`deps`),y.resolve(a,`resources`),y.resolve(a,`deps`),y.resolve(a,`pages`,`resources`),y.resolve(a,`pages`,`deps`)];for(let e of o)try{let n=await se(e,{withFileTypes:!0});for(let r of n){let n=y.join(e,r.name),i=y.join(t,r.name);r.isDirectory()?await E(n,i,{recursive:!0,force:!0}):r.isFile()&&(await D(y.dirname(i),{recursive:!0}),await T(n,i))}}catch{}let s=await yo([...e.pages?.notFoundPath?Q(e.pages.notFoundPath,r,i):[],...e.branding?.notFoundPath?Q(e.branding.notFoundPath,r,i):[],...e.notFoundPath?Q(e.notFoundPath,r,i):[],...Q(`404.html`,r,i)]);if(s)try{await T(s,y.join(t,`404.html`)),console.log(` Copied custom 404.html: ${s}`)}catch(e){console.warn(` Warning: Could not copy custom 404.html: ${e.message}`)}let c=await yo([...e.pwa?.manifestPath?Q(e.pwa.manifestPath,r,i):[],...e.manifestPath?Q(e.manifestPath,r,i):[],...Q(`manifest.json`,r,i)]);if(c)try{await T(c,y.join(t,`manifest.json`)),console.log(` Copied custom manifest.json: ${c}`)}catch(e){console.warn(` Warning: Could not copy custom manifest.json: ${e.message}`)}let l=!1;if(e.sitemapPath){let n=await yo(Q(e.sitemapPath,r,i));if(n)try{let e=y.basename(n);await T(n,y.join(t,e)),console.log(` Copied custom sitemap: ${n} → ${e}`),l=!0}catch(e){console.warn(` Warning: Could not copy custom sitemap: ${e.message}`)}}if(!l){let e=await yo(Q(`sitemap.xml`,r,i));if(e)try{await T(e,y.join(t,`sitemap.xml`)),console.log(` Copied custom sitemap.xml: ${e}`)}catch(e){console.warn(` Warning: Could not copy custom sitemap.xml: ${e.message}`)}let n=await yo(Q(`sitemap.txt`,r,i));if(n)try{await T(n,y.join(t,`sitemap.txt`)),console.log(` Copied custom sitemap.txt: ${n}`)}catch(e){console.warn(` Warning: Could not copy custom sitemap.txt: ${e.message}`)}}let u=e.overwriteAssets===!0||e.branding?.overwriteAssets===!0,d=Array.isArray(e.assets)?e.assets:[e.assetsDir,e.assets].filter(Boolean),f=Array.from(new Set([...d.flatMap(e=>Q(e,r,i)),...Q(`assets`,r,i)].filter(e=>e&&typeof e==`string`))),p=y.join(t,`assets`);if(u)try{await ue(p,{recursive:!0,force:!0}),await D(p,{recursive:!0}),console.log(` Cleared dist public assets for complete template asset overwrite.`)}catch{}let m=new Set,h=[...f].reverse();for(let e of h)if(!m.has(e))try{let t=await de(e);if(m.add(e),t.isDirectory())await E(e,p,{recursive:!0,force:!0}),console.log(` Copied custom assets: ${e} → ${p}`);else if(t.isFile()){let t=y.basename(e);await D(p,{recursive:!0}),await T(e,y.join(p,t)),console.log(` Copied custom asset file: ${e} → ${p}`)}}catch{}}async function xo(e,t,n){let r=e.theme||{};if(!r.stylesheet)return;let i=n?y.dirname(y.resolve(n)):w.cwd(),a=vo(i),o=await yo(Q(r.stylesheet,i,a));if(!o)return;let s=r.stylesheet.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),c=y.join(t,s);try{await D(y.dirname(c),{recursive:!0}),await T(o,c),console.log(` Copied theme stylesheet: ${o} → ${c}`)}catch(e){console.warn(` Warning: Could not copy theme stylesheet ${o}: ${e.message}`)}}async function So(e,t,n){let r=(e.customElements&&typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.scripts:void 0)||e.scripts||[];if(!Array.isArray(r)||r.length===0)return;let i=n?y.dirname(y.resolve(n)):w.cwd(),a=vo(i);for(let e of r){let n=typeof e==`string`?e:e?.src;if(!n||n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`//`))continue;let r=await yo(Q(n,i,a));if(r){let e=n.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=y.join(t,e);try{await D(y.dirname(i),{recursive:!0}),await T(r,i),console.log(` Copied custom script: ${r} → ${i}`)}catch(e){console.warn(` Warning: Could not copy custom script ${r}: ${e.message}`)}}}}async function Co(e,t,n){let r=e.branding||{},i=e.pwa||{},a=n?y.dirname(y.resolve(n)):w.cwd(),o=vo(a),s=[],c=await yo(Q(i.manifestPath||e.manifestPath||`manifest.json`,a,o));if(c){let e=await co(c);e&&Array.isArray(e.icons)&&(s=e.icons.map(e=>e?.src).filter(Boolean))}let l=[r.faviconPath,r.appleTouchIconPath,`assets/icons/favicon.svg`,`assets/icons/favicon.ico`,`favicon.svg`,`favicon.ico`,`pages/resources/assets/icons/favicon.svg`,`pages/resources/assets/icons/favicon.ico`,`pages/resources/favicon.svg`,`pages/deps/favicon.svg`,`pages/main/favicon.svg`,...Array.isArray(i.icons)?i.icons.map(e=>e.src):[],...s].filter(e=>!!e&&typeof e==`string`&&!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&!e.startsWith(`//`));if(l.length===0)return;let u=new Set,d=new Set;for(let e of l){if(u.has(e))continue;u.add(e);let n=await yo(Q(e,a,o));if(n){let r=e.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=y.join(t,r);if(d.has(i))continue;d.add(i);try{await D(y.dirname(i),{recursive:!0}),await T(n,i),console.log(` Copied branding asset: ${n} → ${i}`)}catch(e){console.warn(` Warning: Could not copy branding asset ${n}: ${e.message}`)}}}}async function wo(e,t){let n=await co(t);if(!n)return console.log(`No site-config.json found — skipping site configuration.`),{applied:!1};console.log(`Applying site-config.json...`);let r=w.env.PAGES_ORIGIN||``,i=w.env.PAGES_BASE_PATH||``;await bo(n,e,t);let a=y.join(e,`index.html`),o=await lo(a);o&&(await uo(a,fo(o,n)),console.log(` Patched index.html`));let s=y.join(e,`manifest.json`),c=await lo(s);c&&(await uo(s,mo(c,n)),console.log(` Patched manifest.json`));let l=y.join(e,`sitemap.xml`),u=await lo(l);u&&(await uo(l,ho(u,r)),console.log(` Patched sitemap.xml`));let d=y.join(e,`sitemap.txt`),f=await lo(d);f&&(await uo(d,ho(f,r)),console.log(` Patched sitemap.txt`));let p=y.join(e,`404.html`),m=await lo(p);return m&&(await uo(p,go(m,n,i)),console.log(` Patched 404.html`)),await xo(n,e,t),await So(n,e,t),await Co(n,e,t),console.log(`Site configuration applied successfully.`),{applied:!0}}async function To(){let[e,t]=w.argv.slice(2);(!e||!t)&&(console.error(`Usage: node bin/site-config/apply.mjs <distPublicDir> <siteConfigPath>`),w.exit(1)),await wo(e,t)}w.argv[1]&&y.resolve(w.argv[1])===y.resolve(C(import.meta.url))&&To().catch(e=>{console.error(`site-config/apply.ts failed:`,e),w.exit(1)});async function Eo(t,{writeFileImpl:n=k}={}){await n(b(t||b(e(import.meta.url),`dist`,`public`),`.nojekyll`),``,`utf-8`)}w.argv[1]&&y.resolve(w.argv[1])===y.resolve(C(import.meta.url))&&await Eo();const Do=e(import.meta.url);async function $(e){try{return await de(e),!0}catch{return!1}}async function Oo(e={}){let t=e.quiet??(process.env.NODE_ENV===`test`&&!process.env.VERBOSE),n=e.stdio??(process.env.NODE_ENV===`test`&&!process.env.VERBOSE?`pipe`:`inherit`),r=(...e)=>{t||console.log(...e)};async function i(e,r={}){!t&&!r.quiet&&console.log(`> ${e}`),ae(e,{stdio:r.stdio??n,...r})}let a=te(e.contentRoot||re.SHADOWCLAW_CONTENT_ROOT||process.cwd()),o=te(e.toolchainRoot||Do),s=a===o,{isProduction:l,copyAllAssets:u,prerenderPages:d,prerenderMainMemory:f}=Xa({...re,...e.isProduction===void 0?{}:{NODE_ENV:e.isProduction?`production`:`development`},...e.copyAllAssets===void 0?{}:{COPY_ALL_ASSETS:String(e.copyAllAssets)},...e.prerenderPages===void 0?{}:{PRERENDER_PAGES:String(e.prerenderPages)},...e.prerenderMainMemory===void 0?{}:{PRERENDER_MAIN_MEMORY:String(e.prerenderMainMemory)}});if(s){if(ne(Do),await Ua(`dist/public`),await D(`dist/public/assets`,{recursive:!0}),u)await E(`assets`,`dist/public`,{recursive:!0});else{await E(`assets/icons`,`dist/public/assets/icons`,{recursive:!0}),await E(`assets/screenshots`,`dist/public/assets/screenshots`,{recursive:!0});try{await E(`assets/fonts`,`dist/public/assets/fonts`,{recursive:!0})}catch{}}await Wa([`pages/resources`,`pages/deps`,`resources`,`deps`,`pages/assets`,`pages/main/assets`],`dist/public`);for(let e of qa())await Ga(e.sources,e.dest,e.opts||{});try{await E(`e2e/README.md`,`dist/public/e2e/README.md`)}catch{}try{await E(`pages`,`dist/public/pages`,{recursive:!0})}catch{}try{await E(`pages/main`,`dist/public/files/main`,{recursive:!0})}catch{}try{await E(`pages/main`,`dist/public/static-main`,{recursive:!0})}catch{}try{await E(`.agents/skills`,`dist/public/.agents/skills`,{recursive:!0})}catch{}try{await E(`.agents/tools`,`dist/public/.agents/tools`,{recursive:!0})}catch{}try{await E(`.agents/scripts`,`dist/public/.agents/scripts`,{recursive:!0})}catch{}if(await $(`.agents/skills`))try{let{generateSkillsIndex:e}=await import(`./chunk-BT2f5jvi.js`);await e(Do)}catch(e){console.warn(`Notice: Failed to auto-generate agent-skills index:`,e)}if(await $(`.well-known`))try{await E(`.well-known`,`dist/public/.well-known`,{recursive:!0,force:!0})}catch{}await i(`npm run -s rolldown`),f?await c({indexPath:`dist/public/index.html`,sourcePath:`pages/main`,prerenderPages:d}):await c({indexPath:`dist/public/index.html`,noSeed:!0});let t=await Ka(Ya())||`pages/site-config.json`;try{await wo(`dist/public`,t)}catch{}try{let e=JSON.parse(await O(`package.json`,`utf8`));if(e.version){let t=`dist/public/index.html`;await k(t,(await O(t,`utf8`)).replace(/<meta\s+name="version"[^>]*>/,`<meta name="version" content="${e.version}" />`),`utf8`);for(let t of[`.well-known/mcp.json`,`.well-known/mcp/server-card.json`]){let n=b(`dist/public`,t);if(await $(n))try{let t=JSON.parse(await O(n,`utf8`));t.version!==e.version&&(t.version=e.version,await k(n,JSON.stringify(t,null,2)+`
|
|
10
|
+
`,`utf8`))}catch{}}}}catch{}if(l){r(`Running production post-build steps...`);let t=e.pagesOrigin||re.PAGES_ORIGIN,n=e.basePath||(re.PAGES_BASE_PATH??`/shadow-claw/`);if(r(` PAGES_ORIGIN : ${t||`(relative ./)`}`),r(` PAGES_BASE_PATH: ${n}`),t)try{let e=`dist/public/manifest.json`,n=await O(e,`utf8`),r=JSON.parse(n);r.start_url&&(r.start_url=t,await k(e,JSON.stringify(r,null,2),`utf8`))}catch{}try{let e=`dist/public/index.html`,t=await O(e,`utf8`);t=t.replace(/<base\s+href="[^"]*"\s*\/?>/i,`<base href="${n}" />`),await k(e,t,`utf8`)}catch{}await Eo(`dist/public`);let a=``;try{a=ae(`npm run -s build:pkg:get:meta`,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{}a&&await i(`npm run -s build:pkg:meta "${a}"`)}await eo({publicDir:`dist/public`,routesPath:await Ka(Ja())||`pages/routes.json`,sourcePath:`pages/main`,prerenderPages:d}),await i(`npm run -s build:service-worker`);let n=`dist/public/service-worker.js`;await $(n)&&await _(n,{logImpl:()=>{}}),r(`Build completed successfully.`);return}let p=te(a,e.outDir||`dist/public`);await D(p,{recursive:!0}),await D(b(p,`assets`),{recursive:!0});let m=b(o,`dist/public`);await $(b(m,`index.js`))||(r(`Building ShadowClaw core toolchain...`),await Ua(b(o,`dist/public`)),await Ua(b(o,`dist-electron`)),await i(`npm run -s rolldown`,{cwd:o})),await E(m,p,{recursive:!0,filter:e=>!(e.includes(`/assets/cache/`)||e.includes(`\\assets\\cache\\`)||e.includes(`/.cache/`)||e.includes(`\\.cache\\`))});let h=b(a,`assets`);await $(h)&&(u?await E(h,p,{recursive:!0,force:!0}):(await $(b(h,`icons`))&&await E(b(h,`icons`),b(p,`assets/icons`),{recursive:!0,force:!0}),await $(b(h,`screenshots`))&&await E(b(h,`screenshots`),b(p,`assets/screenshots`),{recursive:!0,force:!0}),await $(b(h,`fonts`))&&await E(b(h,`fonts`),b(p,`assets/fonts`),{recursive:!0,force:!0}))),await Wa([`pages/resources`,`pages/deps`,`resources`,`deps`,`pages/assets`,`pages/main/assets`],p,{baseDir:a});let g=qa({contentRoot:a,toolchainRoot:o,distPublicDir:p});for(let e of g)await Ga(e.sources,e.dest,e.opts||{});let ee=b(a,`pages`);await $(ee)&&await E(ee,b(p,`pages`),{recursive:!0,force:!0});let v=b(a,`pages/main`);await $(v)&&(await E(v,b(p,`files/main`),{recursive:!0,force:!0}),await E(v,b(p,`static-main`),{recursive:!0,force:!0}));let y=b(a,`.agents/skills`);await $(y)&&await E(y,b(p,`.agents/skills`),{recursive:!0,force:!0});let x=b(o,`.agents/skills`);a!==o&&await $(x)&&await E(x,b(p,`.agents/skills`),{recursive:!0,force:!1,errorOnExist:!1});let S=b(a,`.agents/tools`);if(await $(S))await E(S,b(p,`.agents/tools`),{recursive:!0,force:!0});else{let e=b(o,`.agents/tools`);await $(e)&&await E(e,b(p,`.agents/tools`),{recursive:!0,force:!0})}let C=b(a,`.agents/scripts`);if(await $(C))await E(C,b(p,`.agents/scripts`),{recursive:!0,force:!0});else{let e=b(o,`.agents/scripts`);await $(e)&&await E(e,b(p,`.agents/scripts`),{recursive:!0,force:!0})}let w=b(o,`.well-known`);await $(w)&&await E(w,b(p,`.well-known`),{recursive:!0,force:!0});let ie=b(a,`.well-known`);if(a!==o&&await $(ie)&&await E(ie,b(p,`.well-known`),{recursive:!0,force:!0}),await $(b(p,`.agents/skills`)))try{let{generateSkillsIndex:e}=await import(`./chunk-BT2f5jvi.js`);if(await e(p,{metadataRoot:a,outDir:`.well-known/agent-skills`,toolchainRoot:o,includeBundled:!0}),await $(y))try{await e(a,{toolchainRoot:o,includeBundled:!0})}catch{}}catch(e){console.warn(`Notice: Failed to auto-generate agent-skills index:`,e)}let T=b(p,`index.html`);f&&await $(v)?await c({indexPath:T,sourcePath:v,prerenderPages:d}):await c({indexPath:T,noSeed:!0});let oe=await Ka(Ya(a))||b(a,`pages/site-config.json`);try{await wo(p,oe)}catch{}let se=l?e.basePath||re.PAGES_BASE_PATH||`/`:e.basePath||`/`;try{let e=await O(T,`utf8`);e=e.replace(/<base\s+href="[^"]*"\s*\/?>/i,`<base href="${se}" />`);let t=``;try{let e=await Ka([b(a,`package.json`),b(o,`package.json`)]);e&&(t=JSON.parse(await O(e,`utf8`)).version||``)}catch{}if(t){e=e.replace(/<meta\s+name="version"[^>]*>/,`<meta name="version" content="${t}" />`);for(let e of[`.well-known/mcp.json`,`.well-known/mcp/server-card.json`]){let n=b(p,e);if(await $(n))try{let e=JSON.parse(await O(n,`utf8`));e.version!==t&&(e.version=t,await k(n,JSON.stringify(e,null,2)+`
|
|
11
|
+
`,`utf8`))}catch{}}}await k(T,e,`utf8`)}catch{}if(l){r(`Running production post-build steps...`);let t=e.pagesOrigin||re.PAGES_ORIGIN;if(r(` PAGES_ORIGIN : ${t||`(relative ./)`}`),r(` PAGES_BASE_PATH: ${se}`),t)try{let e=b(p,`manifest.json`),n=await O(e,`utf8`),r=JSON.parse(n);r.start_url&&(r.start_url=t,await k(e,JSON.stringify(r,null,2),`utf8`))}catch{}await k(b(p,`.nojekyll`),``,`utf8`);let n=``;try{n=ae(`git rev-parse HEAD`,{cwd:a,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{try{n=ae(`git rev-parse HEAD`,{cwd:o,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{}}n&&await k(T,(await O(T,`utf8`)).replace(/<meta\s+name="revision"[^>]*>/,`<meta name="revision" content="${n}" />`),`utf8`)}await eo({publicDir:p,routesPath:await Ka(Ja(a))||b(a,`pages/routes.json`),sourcePath:await $(v)?v:b(o,`pages/main`),prerenderPages:d});let ce=b(p,`service-worker.js`);await $(ce)&&await _(ce,{logImpl:()=>{}}),r(`Build completed successfully.`)}process.argv[1]&&te(process.argv[1])===te(C(import.meta.url))&&Oo().catch(e=>{console.error(e),ie(1)});export{Oo as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-Du5qiUIk.js";export{e as generateSkillsIndex};
|