@weavecode/weave 0.1.1 → 0.1.2
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/node_modules/@weavecode/cli/dist/cli.js +4 -4
- package/node_modules/@weavecode/cli/dist/commands/chpass.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/daemon-auth.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/daemon.d.ts +7 -0
- package/node_modules/@weavecode/cli/dist/commands/daemon.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/dashboard.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/doctor.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/init.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/scan.js +1 -1
- package/node_modules/@weavecode/cli/dist/commands/status.js +2 -2
- package/node_modules/@weavecode/cli/dist/commands/uninstall.js +1 -1
- package/node_modules/@weavecode/cli/dist/i18n/dict/en.js +1 -9
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.d.ts +0 -1
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +2 -10
- package/node_modules/@weavecode/cli/dist/i18n/index.js +1 -1
- package/node_modules/@weavecode/cli/dist/i18n/t.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/claudemd-gen.d.ts +2 -3
- package/node_modules/@weavecode/cli/dist/init/claudemd-gen.js +4 -4
- package/node_modules/@weavecode/cli/dist/init/executor.js +3 -3
- package/node_modules/@weavecode/cli/dist/init/git-commit.js +2 -2
- package/node_modules/@weavecode/cli/dist/init/harnesses/claude.js +7 -7
- package/node_modules/@weavecode/cli/dist/init/harnesses/codex.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/harnesses/zcode.d.ts +29 -0
- package/node_modules/@weavecode/cli/dist/init/harnesses/zcode.js +1 -0
- package/node_modules/@weavecode/cli/dist/init/instruction-link.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/plugin-templates.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/prompt.js +4 -4
- package/node_modules/@weavecode/cli/dist/init/uninstall.js +6 -6
- package/node_modules/@weavecode/cli/dist/init/wiring.js +1 -1
- package/node_modules/@weavecode/cli/dist/parser.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/mock-input.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/preview.js +2 -2
- package/node_modules/@weavecode/cli/package.json +5 -5
- package/node_modules/@weavecode/core/dist/harness-checks.js +1 -1
- package/node_modules/@weavecode/core/dist/index.d.ts +1 -1
- package/node_modules/@weavecode/core/dist/index.js +1 -1
- package/node_modules/@weavecode/core/dist/platform.js +1 -1
- package/node_modules/@weavecode/core/dist/types.d.ts +0 -8
- package/node_modules/@weavecode/core/dist/types.js +1 -1
- package/node_modules/@weavecode/core/dist/utils/fs.js +1 -1
- package/node_modules/@weavecode/core/dist/utils/logger.js +1 -1
- package/node_modules/@weavecode/core/package.json +1 -1
- package/node_modules/@weavecode/harness/dist/claude/assets.d.ts +10 -0
- package/node_modules/@weavecode/harness/dist/claude/assets.js +4 -1
- package/node_modules/@weavecode/harness/dist/claude/capture.d.ts +4 -2
- package/node_modules/@weavecode/harness/dist/claude/capture.js +15 -9
- package/node_modules/@weavecode/harness/dist/claude/detect.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/event-source.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/index.d.ts +6 -1
- package/node_modules/@weavecode/harness/dist/claude/index.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/mcp-gen.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/messaging.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/model-aliases.d.ts +14 -0
- package/node_modules/@weavecode/harness/dist/claude/model-aliases.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/peers.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/plan.d.ts +2 -0
- package/node_modules/@weavecode/harness/dist/claude/plan.js +1 -0
- package/node_modules/@weavecode/harness/dist/claude/plugins.js +4 -4
- package/node_modules/@weavecode/harness/dist/claude/prompt-inbox.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/prompt.js +3 -3
- package/node_modules/@weavecode/harness/dist/claude/questions.js +2 -2
- package/node_modules/@weavecode/harness/dist/claude/settings-gen.js +1 -1
- package/node_modules/@weavecode/harness/dist/claude/side-question.d.ts +12 -0
- package/node_modules/@weavecode/harness/dist/claude/side-question.js +1 -0
- package/node_modules/@weavecode/harness/dist/claude/statusline/config.d.ts +200 -0
- package/node_modules/@weavecode/harness/dist/claude/statusline/config.js +1 -0
- package/node_modules/@weavecode/harness/dist/claude/statusline/generator.d.ts +12 -0
- package/node_modules/@weavecode/harness/dist/claude/statusline/generator.js +745 -0
- package/node_modules/@weavecode/harness/dist/claude/statusline/git-cache.d.ts +10 -0
- package/node_modules/@weavecode/harness/dist/claude/statusline/git-cache.js +1 -0
- package/node_modules/@weavecode/harness/dist/claude/statusline/surface.d.ts +20 -0
- package/node_modules/@weavecode/harness/dist/claude/statusline/surface.js +2 -0
- package/node_modules/@weavecode/harness/dist/claude/transcript.js +3 -3
- package/node_modules/@weavecode/harness/dist/codex/assets.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/detect.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/index.d.ts +1 -0
- package/node_modules/@weavecode/harness/dist/codex/index.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/mcp.d.ts +30 -0
- package/node_modules/@weavecode/harness/dist/codex/mcp.js +1 -0
- package/node_modules/@weavecode/harness/dist/codex/messaging.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/plugin-state.js +1 -1
- package/node_modules/@weavecode/harness/dist/codex/toml.js +9 -9
- package/node_modules/@weavecode/harness/dist/driver.d.ts +110 -2
- package/node_modules/@weavecode/harness/dist/driver.js +1 -1
- package/node_modules/@weavecode/harness/dist/init/generated.js +2 -2
- package/node_modules/@weavecode/harness/dist/init/pipeline.js +1 -1
- package/node_modules/@weavecode/harness/dist/registry-wiring.js +1 -1
- package/node_modules/@weavecode/harness/dist/shared/install-link.js +1 -1
- package/node_modules/@weavecode/harness/dist/zcode/assets.d.ts +8 -0
- package/node_modules/@weavecode/harness/dist/zcode/assets.js +1 -0
- package/node_modules/@weavecode/harness/dist/zcode/capture.d.ts +36 -0
- package/node_modules/@weavecode/harness/dist/zcode/capture.js +3 -0
- package/node_modules/@weavecode/harness/dist/zcode/detect.d.ts +2 -0
- package/node_modules/@weavecode/harness/dist/zcode/detect.js +1 -0
- package/node_modules/@weavecode/harness/dist/zcode/event-source.d.ts +8 -0
- package/node_modules/@weavecode/harness/dist/zcode/event-source.js +1 -0
- package/node_modules/@weavecode/harness/dist/zcode/index.d.ts +13 -0
- package/node_modules/@weavecode/harness/dist/zcode/index.js +1 -0
- package/node_modules/@weavecode/harness/dist/zcode/mcp.d.ts +6 -0
- package/node_modules/@weavecode/harness/dist/zcode/mcp.js +2 -0
- package/node_modules/@weavecode/harness/dist/zcode/messaging.d.ts +13 -0
- package/node_modules/@weavecode/harness/dist/zcode/messaging.js +1 -0
- package/node_modules/@weavecode/harness/dist/zcode/resume.d.ts +7 -0
- package/node_modules/@weavecode/harness/dist/zcode/resume.js +1 -0
- package/node_modules/@weavecode/harness/package.json +2 -2
- package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.d.ts +8 -1
- package/node_modules/@weavecode/server/dist/daemon/hook-pipeline.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/server.d.ts +7 -0
- package/node_modules/@weavecode/server/dist/daemon/server.js +8 -6
- package/node_modules/@weavecode/server/dist/daemon/session-probe.d.ts +13 -0
- package/node_modules/@weavecode/server/dist/daemon/session-probe.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/snapshot-refresher.d.ts +7 -1
- package/node_modules/@weavecode/server/dist/daemon/snapshot-refresher.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/sse-hub.d.ts +40 -0
- package/node_modules/@weavecode/server/dist/daemon/sse-hub.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/start.js +1 -1
- package/node_modules/@weavecode/server/dist/db/db.js +20 -2
- package/node_modules/@weavecode/server/dist/hooks/bus.d.ts +5 -0
- package/node_modules/@weavecode/server/dist/hooks/inbox-worker.d.ts +8 -1
- package/node_modules/@weavecode/server/dist/hooks/inbox-worker.js +3 -3
- package/node_modules/@weavecode/server/dist/hooks/message-deliverer.d.ts +29 -0
- package/node_modules/@weavecode/server/dist/hooks/message-deliverer.js +2 -2
- package/node_modules/@weavecode/server/dist/hooks/mirror.d.ts +9 -4
- package/node_modules/@weavecode/server/dist/hooks/mirror.js +4 -4
- package/node_modules/@weavecode/server/dist/hooks/session-purge.d.ts +3 -0
- package/node_modules/@weavecode/server/dist/hooks/session-purge.js +1 -1
- package/node_modules/@weavecode/server/dist/hooks/side-questions.d.ts +41 -0
- package/node_modules/@weavecode/server/dist/hooks/side-questions.js +1 -0
- package/node_modules/@weavecode/server/dist/hooks/toolkit.js +5 -5
- package/node_modules/@weavecode/server/dist/install/apply-update.js +1 -1
- package/node_modules/@weavecode/server/dist/install/capabilities.d.ts +10 -0
- package/node_modules/@weavecode/server/dist/install/capabilities.js +1 -1
- package/node_modules/@weavecode/server/dist/install/codex-toml.d.ts +8 -26
- package/node_modules/@weavecode/server/dist/install/codex-toml.js +1 -1
- package/node_modules/@weavecode/server/dist/install/global-config.d.ts +2 -4
- package/node_modules/@weavecode/server/dist/install/global-config.js +1 -2
- package/node_modules/@weavecode/server/dist/install/installer.d.ts +3 -5
- package/node_modules/@weavecode/server/dist/install/installer.js +1 -3
- package/node_modules/@weavecode/server/dist/install/mcp-rows.d.ts +5 -5
- package/node_modules/@weavecode/server/dist/install/mcp-rows.js +1 -1
- package/node_modules/@weavecode/server/dist/registry.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/hook-events.d.ts +7 -0
- package/node_modules/@weavecode/server/dist/repositories/hook-events.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/sessions.d.ts +15 -4
- package/node_modules/@weavecode/server/dist/repositories/sessions.js +2 -2
- package/node_modules/@weavecode/server/dist/repositories/side-questions.d.ts +50 -0
- package/node_modules/@weavecode/server/dist/repositories/side-questions.js +6 -0
- package/node_modules/@weavecode/server/dist/statusline/config.d.ts +4 -198
- package/node_modules/@weavecode/server/dist/statusline/config.js +1 -1
- package/node_modules/@weavecode/server/dist/statusline/generator.d.ts +5 -0
- package/node_modules/@weavecode/server/dist/statusline/generator.js +1 -717
- package/node_modules/@weavecode/server/dist/statusline/manager.d.ts +5 -5
- package/node_modules/@weavecode/server/dist/statusline/manager.js +3 -4
- package/node_modules/@weavecode/server/dist/surfaces.d.ts +11 -1
- package/node_modules/@weavecode/server/dist/surfaces.js +1 -1
- package/node_modules/@weavecode/server/package.json +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/index-CHWbLAje.js +594 -0
- package/node_modules/@weavecode/server/web/dist/assets/index-D0s5v8QS.css +11 -0
- package/node_modules/@weavecode/server/web/dist/index.html +2 -2
- package/node_modules/@weavecode/templates/package.json +2 -2
- package/package.json +6 -6
- package/node_modules/@weavecode/server/web/dist/assets/index-D5WFh77i.css +0 -11
- package/node_modules/@weavecode/server/web/dist/assets/index-DJibaGnJ.js +0 -585
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{readFileSync as f}from"node:fs";import l from"node:path";import{fileURLToPath as g}from"node:url";import{CommandParser as h}from"./parser.js";import{initCommand as u}from"./commands/init.js";import{statusCommand as C}from"./commands/status.js";import{daemonCommand as
|
|
2
|
-
`),console.log(`${
|
|
3
|
-
`),console.log(
|
|
4
|
-
${
|
|
1
|
+
import{readFileSync as f}from"node:fs";import l from"node:path";import{fileURLToPath as g}from"node:url";import{CommandParser as h}from"./parser.js";import{initCommand as u}from"./commands/init.js";import{statusCommand as C}from"./commands/status.js";import{daemonCommand as $}from"./commands/daemon.js";import{dashboardCommand as b}from"./commands/dashboard.js";import{scanCommand as w}from"./commands/scan.js";import{chpassCommand as x}from"./commands/chpass.js";import{doctorCommand as E}from"./commands/doctor.js";import{uninstallCommand as S}from"./commands/uninstall.js";import{initCliLocale as j,t as r}from"./i18n/index.js";const v=l.dirname(g(import.meta.url));function d(){try{return JSON.parse(f(l.join(v,"..","package.json"),"utf-8")).version??"0.0.0"}catch{return"0.0.0"}}function P(a){if(a.description){console.log(` ${a.name.padEnd(12)}${r(a.description)}`);for(const n of a.subcommands??[]){const o=[n.name,...n.aliases??[]].join(", "),s=n.description?r(n.description):"";console.log(` ${o.padEnd(12)}${s}`)}}}function m(a){const n=d();console.log(`${r("help.tagline",{version:n})}
|
|
2
|
+
`),console.log(`${r("help.usage")}
|
|
3
|
+
`),console.log(r("help.commands"));for(const o of a.getAllCommands())P(o);console.log(`
|
|
4
|
+
${r("help.globalOptions")}`);for(const o of a.getGlobalOptions()){const s=o.short?`-${o.short}, --${o.name}`:` --${o.name}`;console.log(` ${s.padEnd(20)}${r(o.description)}`)}}function L(a){console.error(r("help.subcommands"));for(const n of a.subcommands??[]){const o=[n.name,...n.aliases??[]].join(", "),s=n.description?r(n.description):"";console.error(` ${o.padEnd(12)}${s}`)}}export class CLI{parser;constructor(){this.parser=new h,this.registerCommands()}registerCommands(){this.parser.registerCommand(u),this.parser.registerCommand(S),this.parser.registerCommand(C),this.parser.registerCommand($),this.parser.registerCommand(b),this.parser.registerCommand(w),this.parser.registerCommand(x),this.parser.registerCommand(E)}async run(n=process.argv.slice(2)){delete process.env.CLAUDE_CODE_CHILD_SESSION,await j();const o=this.parser.parse(n);if(o.flags.version){console.log(d());return}if(o.flags.help||o.command.length===0){m(this.parser);return}let s;for(const e of o.command)s=(s?s.subcommands?.find(c=>c.name===e||c.aliases?.includes(e)):this.parser.getCommand(e))??s;if(!s?.action){if(s?.subcommands?.length){const e=o.positional[0];console.error(e?r("cli.unknownSubcommand",{command:s.name,subcommand:e}):r("cli.missingSubcommand",{command:s.name})),L(s),process.exit(1)}console.error(r("cli.unknownCommand",{command:o.command.join(" ")})),m(this.parser),process.exit(1)}const i=s.maxPositionals??0;if(o.positional.length>i){const e=o.command.join(" ");console.error(r("cli.unexpectedPositional",{command:e,arg:o.positional[i]})),m(this.parser),process.exit(1)}const t=this.parser.validateFlags(o.flags,s);if(t.length>0){for(const e of t)console.error(r("cli.error",{error:e}));process.exit(1)}const p={commandPath:o.command,flags:o.flags,positional:o.positional,raw:o.raw};await s.action(p)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DAEMON_HOST as c}from"@weavecode/server";import{logger as s}from"@weavecode/core";import{t as r}from"../i18n/index.js";import{ensureDaemonRunning as i}from"./daemon.js";import{localTokenHeader as p}from"./daemon-auth.js";const m=6;async function h(
|
|
1
|
+
import{DAEMON_HOST as c}from"@weavecode/server";import{logger as s}from"@weavecode/core";import{t as r}from"../i18n/index.js";import{ensureDaemonRunning as i}from"./daemon.js";import{localTokenHeader as p}from"./daemon-auth.js";const m=6;async function h(e){const t=e.positional[0];if(typeof t!="string"||t.length<m){s.warn(r("out.chpass.usage")),process.exitCode=1;return}const n=await i();try{const o=await fetch(`http://${c}:${n.port}/auth/password`,{method:"PUT",headers:{"content-type":"application/json",...p()},body:JSON.stringify({next:t})}),a=await o.json().catch(()=>({}));if(!o.ok)throw new Error(typeof a.error=="string"?a.error:`HTTP ${o.status}`);s.success(r("out.chpass.ok"))}catch(o){s.warn(r("out.chpass.fail",{error:o instanceof Error?o.message:String(o)})),process.exitCode=1}}export const chpassCommand={name:"chpass",description:"cmd.chpass.desc",action:h,maxPositionals:1};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as a,readFileSync as r,rmSync as e}from"node:fs";import{getAuthPath as n,getInitialPasswordPath as s}from"@weavecode/server";import{logger as i}from"@weavecode/core";import{t as c}from"../i18n/index.js";export function localTokenHeader(){try{const t=JSON.parse(r(n(),"utf8"));return typeof t.localToken=="string"&&t.localToken?{"x-weave-local":t.localToken}:{}}catch{return{}}}export function announceInitialPassword(){const t=s();if(!a(t))return;let o;try{o=r(t,"utf8").trim()}catch{return}e(t,{force:!0}),o&&i.info(c("out.dash.initialPassword",{password:o}))}
|
|
@@ -6,6 +6,13 @@ export interface DaemonHandle {
|
|
|
6
6
|
/** False when an already-running daemon was reused. */
|
|
7
7
|
started: boolean;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* 等守护进程真能应答。/health 是它起好的标志:`spawn` 返回的只是子进程,此刻
|
|
11
|
+
* 它连模块都还没加载完——首启的初始密码标记文件、auth.json 都是启动过程中才写
|
|
12
|
+
* 出的,早一步问就扑空(`weave dashboard` 因此首次运行默默不打印密码),紧接着
|
|
13
|
+
* 的 HTTP 请求也会连不上(`weave chpass`)。超时就不再等,让后续请求照常报错。
|
|
14
|
+
*/
|
|
15
|
+
export declare function waitForDaemon(port: number, timeoutMs?: number): Promise<boolean>;
|
|
9
16
|
/**
|
|
10
17
|
* Ensure a daemon is running and return how to reach it.
|
|
11
18
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{spawn as u}from"node:child_process";import{DEFAULT_PORT as
|
|
2
|
-
`)))}else t?
|
|
1
|
+
import{spawn as u}from"node:child_process";import{DEFAULT_PORT as i,DAEMON_HOST as d,isPortFree as h,findFreePort as g,readDaemonState as m,writeDaemonState as y,clearDaemonState as D,resolveDaemonEntry as $,accessUrls as P}from"@weavecode/server";import{logger as a}from"@weavecode/core";import{t as r}from"../i18n/index.js";export async function probeDaemon(t){try{const e=await fetch(`http://${d}:${t}/health`);return e.ok?(await e.json()).service==="weave-daemon":!1}catch{return!1}}export async function waitForDaemon(t,e=1e4){const o=Date.now()+e;for(;!await probeDaemon(t);){if(Date.now()>=o)return!1;await new Promise(n=>setTimeout(n,100))}return!0}async function x(t,e){if(process.platform!=="win32")return!1;const o=s=>/\s/.test(s)?`"${s}"`:s,n=s=>`'${s.replace(/'/g,"''")}'`,c=`$ErrorActionPreference='Stop';$r=Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine=${n([t,...e].map(o).join(" "))};CurrentDirectory=${n(process.cwd())}};if($r.ReturnValue -ne 0){exit 1}`,w=Buffer.from(c,"utf16le").toString("base64");return new Promise(s=>{const p=u("powershell.exe",["-NoProfile","-NonInteractive","-EncodedCommand",w],{windowsHide:!0,stdio:"ignore"});p.on("error",()=>s(!1)),p.on("exit",l=>s(l===0))})}export async function ensureDaemonRunning(){const t=m();if(t&&await probeDaemon(t.port))return{port:t.port,started:!1};if(await probeDaemon(i))return{port:i,started:!1};const e=await h(i)?i:await g(i+1);y({pid:0,port:e,startedAt:new Date().toISOString()});const o=$(),n=o.isTs?["--import","tsx",o.path]:[o.path];return await x(process.execPath,n)||u(process.execPath,n,{detached:!0,stdio:"ignore"}).unref(),await waitForDaemon(e),{port:e,started:!0}}async function S(){const t=await ensureDaemonRunning();if(!t.started){a.info(r("out.daemon.alreadyRunning",{port:t.port}));return}a.success(r("out.daemon.started",{host:d,port:t.port}))}async function f(t){return await(await fetch(`http://${d}:${t}/health`)).json()}async function C(){const t=m(),e=t?.port??i;let o=t?.pid;if(await probeDaemon(e))o=(await f(e)).pid;else if(!t){a.info(r("out.daemon.statusNotRunning"));return}let n;if(o)try{process.kill(o),n=o}catch{}D(),n!==void 0?a.success(r("out.daemon.stopped",{pid:n})):a.warn(r("out.daemon.statusStale",{pid:o??0,port:e}))}async function N(){const t=m(),e=t?.port??i;if(await probeDaemon(e)){const o=await f(e);a.info(r("out.daemon.statusRunning",{pid:o.pid,port:o.port,uptime:Math.round(o.uptimeMs/1e3)}));const n=P(e,t?.tlsPort??0);n.length>0&&(a.dim(r("out.daemon.urlsTitle")),a.dim(n.map(c=>` ${c.url}`).join(`
|
|
2
|
+
`)))}else t?a.warn(r("out.daemon.statusStale",{pid:t.pid,port:t.port})):a.info(r("out.daemon.statusNotRunning"))}export const daemonCommand={name:"daemon",description:"cmd.daemon.desc",subcommands:[{name:"start",description:"cmd.daemon.start.desc",action:S},{name:"stop",description:"cmd.daemon.stop.desc",action:C},{name:"status",description:"cmd.daemon.status.desc",action:N}]};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{spawn as p}from"node:child_process";import{accessUrls as m,DAEMON_HOST as d,readDaemonState as
|
|
2
|
-
`))),f(),
|
|
1
|
+
import{spawn as p}from"node:child_process";import{accessUrls as m,DAEMON_HOST as d,readDaemonState as u,resolveStaticDir as c}from"@weavecode/server";import{logger as o}from"@weavecode/core";import{t as a}from"../i18n/index.js";import{ensureDaemonRunning as l}from"./daemon.js";import{announceInitialPassword as f}from"./daemon-auth.js";export function openBrowser(r){const[s,n]=process.platform==="win32"?["cmd",["/c","start","",r]]:process.platform==="darwin"?["open",[r]]:["xdg-open",[r]],t=p(s,n,{detached:!0,stdio:"ignore"});t.on("error",()=>{o.dim(a("out.dash.browserFailed"))}),t.unref()}export function dashboardUrl(r){return`http://${d}:${r}/`}async function h(r){const s=!!r.flags.noOpen,n=await l();n.started?(o.success(a("out.daemon.started",{host:d,port:n.port})),o.dim(a("out.dash.stopHint"))):o.info(a("out.daemon.alreadyRunning",{port:n.port})),c()||(o.warn(a("out.dash.noBundle")),o.dim(a("out.dash.buildHint")));const t=dashboardUrl(n.port);o.info(a("out.dash.url",{url:t}));const e=m(n.port,u()?.tlsPort??0);if(e.length>0&&(o.dim(a("out.daemon.urlsTitle")),o.dim(e.map(i=>` ${i.url}`).join(`
|
|
2
|
+
`))),f(),s){o.dim(a("out.dash.noOpen"));return}openBrowser(t)}export const dashboardCommand={name:"dashboard",aliases:["dash"],description:"cmd.dashboard.desc",options:[{name:"no-open",description:"flag.dashboard.noOpen",type:"boolean",default:!1}],action:h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as g,readFileSync as w}from"node:fs";import u from"node:path";import{DAEMON_HOST as v,DEFAULT_PORT as S,getDbPath as x,openDatabase as y,ProjectRepository as N,readDaemonState as b}from"@weavecode/server";import{formatTable as f,logger as r}from"@weavecode/core";import{checkHarness as T}from"../init/harness-checks.js";import{probeDaemon as P}from"./daemon.js";import{localTokenHeader as E}from"./daemon-auth.js";import{t as o}from"../i18n/index.js";const j={"no-mechanism":"out.doctor.reason.noMechanism","no-credentials":"out.doctor.reason.noCredentials","auth-token-required":"out.doctor.reason.authTokenRequired","no-peer-name":"out.doctor.reason.noPeerName","no-backend":"out.doctor.reason.noBackend","no-pane-env":"out.doctor.reason.noPaneEnv"},C={"no-hook-script":"out.doctor.hint.noHookScript","hook-script-not-weave":"out.doctor.hint.hookScriptNotWeave","hook-script-stale":"out.doctor.hint.hookScriptStale","no-events":"out.doctor.hint.noEvents","no-inbox-credentials":"out.doctor.hint.noInboxCredentials","inbox-token-required":"out.doctor.hint.inboxTokenRequired","no-peer-name":"out.doctor.hint.noPeerName","terminal-no-backend":"out.doctor.hint.terminalNoBackend","terminal-no-pane-env":"out.doctor.hint.terminalNoPaneEnv","not-running":"out.doctor.hint.notRunning",queued:"out.doctor.hint.queued",stalled:"out.doctor.hint.stalled"};function p(n,e){if(!e)return"";const i=n[e];return i?o(i):e}function D(n){if(!n||!n.present)return o("out.doctor.diagScriptNone");const e=n.source==="user"?o("out.doctor.diagSourceUser"):n.source==="project"?o("out.doctor.diagSourceProject"):o("out.doctor.diagSourceNone");if(!n.weaveOwned)return o("out.doctor.diagScriptNotOwned",{source:e});const i=o("out.doctor.diagYes");return o("out.doctor.diagScriptValue",{harness:n.harness,source:e,version:n.generatedVersion??o("out.doctor.diagMissing"),inbox:n.reportsInbox?i:o("out.doctor.diagNo"),pane:n.reportsPaneEnv?i:o("out.doctor.diagNo")})}function m(n){const e=p(j,n.reason);return n.status==="ready"?o("out.doctor.diagReady"):n.status==="unknown"?o("out.doctor.diagUnknown",{reason:e}):o("out.doctor.diagUnavailable",{reason:e})}async function q(n,e){let i;try{const t=await fetch(`http://${v}:${n}/messaging/diagnostics?project=${e}`,{headers:E()});if(!t.ok)throw new Error(`HTTP ${t.status}`);try{i=await t.json()}catch{throw new Error(`HTTP ${t.status}`)}}catch(t){r.warn(o("out.doctor.diagFailed",{error:t instanceof Error?t.message:String(t)}));return}const{daemon:d}=i,s=i.projects.find(t=>t.id===e)?.captures[0]??null;if(console.log(),r.info(o("out.doctor.diagHeader",{id:e})),console.log(f([[o("out.doctor.diagDaemon"),o("out.doctor.diagDaemonValue",{version:d.version,platform:d.platform,preset:d.terminalPreset,channel:o(d.terminalTextChannel?"out.doctor.diagChannelOn":"out.doctor.diagChannelOff")})],[o("out.doctor.diagScript"),D(s)]])),i.sessions.length===0){r.dim(o("out.doctor.diagNoSessions"));return}const a=t=>t===null?o("out.doctor.diagUnknownAlive"):o(t?"out.doctor.diagYes":"out.doctor.diagNo");for(const t of i.sessions)console.log(),console.log(" "+o("out.doctor.diagSession",{id:t.sessionId.slice(0,8),title:t.title??o("out.doctor.diagUntitled"),alive:a(t.alive),events:t.eventCount,last:t.lastEventType??o("out.doctor.diagMissing")})),console.log(" "+o("out.doctor.diagChannels",{inbox:m(t.channels.inbox),relay:m(t.channels.relay),terminal:m(t.channels.terminal)})),console.log(" "+o("out.doctor.diagQueue",{pending:t.queue.pending,stalled:o(t.queue.stalled?"out.doctor.diagYes":"out.doctor.diagNo")})),t.hints.length>0&&r.dim(" "+o("out.doctor.diagHints",{hints:t.hints.map(c=>p(C,c)).join("\uFF1B")}))}const k=n=>{const e=u.resolve(n);return process.platform==="win32"?e.toLowerCase():e};function H(n){if(!g(x()))return null;const e=y();try{const i=new N(e),d=k(n),s=[...i.list(),...i.listArchived()].find(a=>k(a.path)===d);return s?{id:s.id,source:s.source,archived:s.archivedAt!==null,token:s.token}:null}finally{e.close()}}function O(n){const e=u.join(n,".weave","token");return g(e)?w(e,"utf-8").trim():null}export const doctorCommand={name:"doctor",description:"cmd.doctor.desc",options:[{name:"dir",short:"d",description:"flag.dir",type:"string",default:process.cwd()}],async action(n){const e=u.resolve(String(n.flags.dir??process.cwd())),i=g(u.join(e,".weave","config.yaml")),d=b()?.port??S,s=await P(d),a=H(e),t=O(e);let c;t===null?c=o("out.doctor.tokenMissing"):a?t===a.token?c=o("out.doctor.tokenOk"):c=o("out.doctor.tokenStale"):c=o("out.doctor.tokenUnregistered"),r.info(o("out.doctor.header")),console.log(f([[o("out.doctor.dir"),e],[o("out.doctor.initialized"),i?o("out.doctor.yes"):o("out.doctor.no")],[o("out.doctor.daemon"),s?o("out.doctor.daemonRunning",{port:d}):o("out.doctor.daemonStopped")],[o("out.doctor.registered"),a?o(a.archived?"out.doctor.registeredArchived":"out.doctor.registeredYes",{id:a.id,source:a.source}):o("out.doctor.registeredNo")],[o("out.doctor.token"),c]])),console.log();const l=await T(e);if(l.length>0){r.warn(o("out.status.issuesFound",{count:l.length}));for(const h of l)r.warn(o("out.status.issue",{message:h.message})),r.dim(o("out.status.fix",{fix:h.fix}));console.log()}if(s&&a&&!a.archived&&await q(d,a.id),!a){r.warn(o("out.doctor.warnNotRegistered")),r.dim(o("out.doctor.fixInit")),i||r.dim(o("out.doctor.fixScan",{dir:e}));return}if(a.archived){r.warn(o("out.doctor.warnArchived"));return}if(t===null){r.warn(o("out.doctor.warnTokenMissing")),r.dim(o("out.doctor.fixInit"));return}if(t!==a.token){r.warn(o("out.doctor.warnTokenStale")),r.dim(o("out.doctor.fixInit"));return}r.success(o("out.doctor.ok")),s||r.dim(o("out.doctor.fixDaemon"))}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PresetSchema as
|
|
1
|
+
import{PresetSchema as p,HARNESS_KEYS as m,logger as n,formatTable as g,resolveComponents as f}from"@weavecode/core";import{executeInit as u}from"../init/executor.js";import{registerProject as h}from"@weavecode/server";import{t as e}from"../i18n/index.js";const d=["preToolUse","postToolUse","userPromptSubmit","sessionStart","stop","stopFailure","subagentStop","subagentStart","notification","postToolUseFailure","permissionRequest","permissionDenied","preCompact","sessionEnd","preModelSwitch"];function S(r){const s=r.trim();if(!s)return{};const c=Object.fromEntries(d.map(i=>[i,!1]));if(s==="none")return c;const a=new Set(s.split(",").map(i=>i.trim()).filter(Boolean)),o=[...a].filter(i=>!d.includes(i));return o.length>0&&n.warn(e("init.hooksUnknownKeys",{keys:o.join(", ")})),Object.fromEntries(d.map(i=>[i,a.has(i)]))}export function parseHarnessFlag(r){const s=r.trim();if(!s)return;const c=s.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean),a=[...new Set(c.filter(i=>m.includes(i)))],o=c.filter(i=>!m.includes(i));return o.length>0&&n.warn(e("init.harnessUnknownKeys",{keys:o.join(", ")})),a.length>0?a:["claude"]}export const initCommand={name:"init",description:"cmd.init.desc",options:[{name:"preset",short:"p",description:"flag.init.preset",type:"string",default:"default",choices:["minimal","default","full"]},{name:"force",short:"f",description:"flag.init.force",type:"boolean",default:!1},{name:"no-interactive",description:"flag.init.noInteractive",type:"boolean",default:!1},{name:"dir",short:"d",description:"flag.dir",type:"string",default:process.cwd()},{name:"hooks",description:"flag.init.hooks",type:"string",default:""},{name:"harness",description:"flag.init.harness",type:"string",default:""}],async action(r){const s=p.parse(r.flags.preset??"default"),c=!!r.flags.force,a=r.flags.noInteractive!==!0&&r.flags.interactive!==!1,o=String(r.flags.dir??process.cwd());n.info(e("init.banner")),n.dim(e("init.presetTarget",{preset:s,target:o}));const i=f(s);let t;try{t=await u({targetDir:o,force:c,interactive:a,preset:s,harnesses:parseHarnessFlag(String(r.flags.harness??"")),components:i,hooks:S(String(r.flags.hooks??"")),skills:{},commands:{},agents:{},mcp:{}})}catch(l){n.error(e("init.failed",{error:l instanceof Error?l.message:String(l)})),process.exit(1)}if(t.success){h(o,"init"),n.success(e("init.complete"));const l=[[e("init.table.directories"),String(t.created.directories.length)],[e("init.table.filesCreated"),String(t.created.files.length)],[e("init.table.filesMerged"),String(t.merged.length)],[e("init.table.weaveUpdated"),String(t.updated.length)],[e("init.table.skills"),String(t.summary.skillsCount)],[e("init.table.commands"),String(t.summary.commandsCount)],[e("init.table.agents"),String(t.summary.agentsCount)]];console.log(g(l)),console.log(),t.merged.length>0&&n.dim(e("init.merged",{count:t.merged.length})),t.updated.length>0&&n.dim(e("init.refreshed",{count:t.updated.length})),t.removed.length>0&&n.dim(e("init.removed",{count:t.removed.length})),t.skipped.length>0&&n.dim(e("init.skipped",{count:t.skipped.length}))}else{n.error(e("init.completedWithErrors"));for(const l of t.errors)n.error(e("init.errorLine",{error:l}))}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readdir as
|
|
1
|
+
import{readdir as c}from"node:fs/promises";import{existsSync as m}from"node:fs";import{join as n}from"node:path";import{registerProject as d}from"@weavecode/server";import{logger as a}from"@weavecode/core";import{createRuntimeRegistry as f}from"@weavecode/harness";import{t as p}from"../i18n/index.js";const g=new Set(["node_modules",".git","dist","build",".next","coverage",".cache"]),u=f().byCapability("detect").map(t=>t.detect).filter(t=>t!==void 0);export async function findProjectDirs(t,s=0,r=6){if(s>r)return[];if(m(n(t,".weave"))||u.some(e=>e.present(t)))return[t];let o;try{o=await c(t,{withFileTypes:!0})}catch{return[]}const i=[];for(const e of o)e.isDirectory()&&(e.name.startsWith(".")||g.has(e.name)||i.push(...await findProjectDirs(n(t,e.name),s+1,r)));return i}export const scanCommand={name:"scan",description:"cmd.scan.desc",options:[{name:"dir",short:"d",description:"flag.scan.dir",type:"string",default:process.cwd()}],async action(t){const s=String(t.flags.dir??process.cwd()),r=await findProjectDirs(s);for(const o of r)d(o,"scan");if(a.success(p("out.scan.registered",{count:r.length,root:s})),r.length>0)for(const o of r)a.dim(` ${o}`)}};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
`)){const n=r.indexOf(":");n>0&&(
|
|
1
|
+
import c from"node:path";import k from"node:os";import{readFile as x}from"node:fs/promises";import{fileExists as j,logger as l,formatTable as R,HARNESS_DIRS as S,HARNESS_INSTRUCTION_FILES as D,HARNESS_KEYS as E}from"@weavecode/core";import{createRuntimeRegistry as $}from"@weavecode/harness";import{checkHarness as b}from"../init/harness-checks.js";import{t as o}from"../i18n/index.js";async function I(e){const t=c.join(e,".weave","config.yaml");if(!await j(t))return null;try{const a=await x(t,"utf-8"),i={};for(const r of a.split(`
|
|
2
|
+
`)){const n=r.indexOf(":");n>0&&(i[r.slice(0,n).trim()]=r.slice(n+1).trim())}return i}catch{return null}}async function N(e,t){return await j(c.join(t,e))?"out.status.present":"out.status.missing"}async function u(e,t,a){return[e,o(await N(t,a))]}function C(e,t,a){if(!e)return null;try{const i=e.targetDir(t,"project",a,k.homedir());return c.relative(a,i).split(c.sep).join("/")}catch{return null}}export const statusCommand={name:"status",description:"cmd.status.desc",options:[{name:"dir",short:"d",description:"flag.dir",type:"string",default:process.cwd()}],async action(e){const t=String(e.flags.dir??process.cwd()),a=await I(t);if(!a){l.warn(o("out.status.notInitialized"));return}l.info(o("out.status.header"));const i=$(),r=i.byCapability("detect").flatMap(s=>s.detect&&s.detect.detect(t).present?[s.id]:[]),n=[[o("out.status.col.version"),a.initVersion??o("out.status.unknown")],[o("out.status.col.initialized"),a.initTimestamp??o("out.status.unknown")],[o("out.status.col.preset"),a.preset??o("out.status.unknown")],[o("out.status.col.harness"),r.length>0?r.join(", "):o("out.status.unknown")]],p=E[0],m=S[p].projectDir,g=i.get(p)?.assets;for(const s of D[p])n.push(await u(s,s,t));n.push(await u("settings.json",`${m}/settings.json`,t)),n.push(await u(".mcp.json",".mcp.json",t)),n.push(await u("helpers",`${m}/helpers`,t));const w=g?.projectSkillsDir()??`${m}/skills`;n.push(await u(c.posix.basename(w),w,t));const y=[["commands","command"],["agents","agent"]];for(const[s,f]of y){const h=C(g,f,t)??`${m}/${s}`;n.push(await u(c.posix.basename(h),h,t))}for(const s of r){if(s===p)continue;const f=i.get(s)?.assets?.projectSkillsDir()??`${S[s].projectDir}/skills`;n.push(await u(f,f,t))}console.log(R(n)),console.log();const d=await b(t);if(d.length>0){l.warn(o("out.status.issuesFound",{count:d.length}));for(const s of d)l.warn(o("out.status.issue",{message:s.message})),l.dim(o("out.status.fix",{fix:s.fix}));console.log()}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as t}from"@weavecode/core";import{executeUninstall as a}from"../init/uninstall.js";import{t as i}from"../i18n/index.js";function
|
|
1
|
+
import{logger as t}from"@weavecode/core";import{executeUninstall as a}from"../init/uninstall.js";import{t as i}from"../i18n/index.js";function r(s){s.outcome==="removed"?t.dim(i("out.uninstall.serverRemoved",{name:s.name??"",events:s.purged?.events??0,dispatches:s.purged?.dispatches??0,sessions:s.purged?.sessions??0})):s.outcome==="failed"&&t.warn(i("out.uninstall.serverFailed",{error:s.error??""}))}export const uninstallCommand={name:"uninstall",description:"cmd.uninstall.desc",options:[{name:"dir",short:"d",description:"flag.dir",type:"string",default:process.cwd()}],async action(s){const n=String(s.flags.dir??process.cwd());t.info(i("out.uninstall.banner",{target:n}));const e=await a({targetDir:n});if(e.status==="not-initialized"){t.warn(i("out.uninstall.notInitialized")),r(e.server);return}if(t.success(i("out.uninstall.done",{files:e.removedFiles.length,dirs:e.removedDirs.length})),e.modifiedFiles.length>0&&t.dim(i("out.uninstall.modified",{count:e.modifiedFiles.length})),e.keptUserFiles.length>0){t.dim(i("out.uninstall.keptUser",{count:e.keptUserFiles.length}));for(const o of e.keptUserFiles)t.dim(` ${o}`)}switch(e.restoredFromBackup&&t.dim(i("out.uninstall.restored",{path:e.restoredFromBackup})),r(e.server),e.git){case"reset":t.dim(i("out.uninstall.gitReset",{sha:e.gitSha??""}));break;case"committed":t.dim(i("out.uninstall.gitCommit",{sha:e.gitSha??"",count:e.removedFiles.length+e.modifiedFiles.length}));break;case"no-changes":t.dim(i("out.uninstall.gitNoChanges"));break;case"skipped-dirty-index":t.warn(i("out.uninstall.gitDirty"));break;case"skipped-not-repo":t.dim(i("out.uninstall.gitNotRepo"));break;case"failed":t.warn(i("out.uninstall.gitFailed",{error:e.gitError??""}));break}}};
|
|
@@ -46,13 +46,5 @@ import{HARNESS_DIRS as t,HARNESS_KEYS as e}from"@weavecode/core";export const en
|
|
|
46
46
|
- Don't introduce XSS, SQL injection, or command injection vectors
|
|
47
47
|
- Prefer parameterized queries and safe APIs over string concatenation
|
|
48
48
|
|
|
49
|
-
`,"claudemd.skills":"## Skills\n\nReusable skills live in your harness's own skills directory (Claude Code: `.claude/skills/`): one directory per skill, each with a `SKILL.md`; invoke a skill by name when the task matches one.\n\n","
|
|
50
|
-
|
|
51
|
-
A user message starting with \`{marker}\` was injected by the weave dashboard, not typed by someone at the terminal:
|
|
52
|
-
|
|
53
|
-
- The text after the marker is the full instruction \u2014 **just follow it**;
|
|
54
|
-
- Don't echo the marker back as content, and don't reply to it (this path has no reply channel);
|
|
55
|
-
- **Only this direct-injection path carries the marker**: relay, terminal fallback and inject deliveries do not \u2014 so "no marker" does not mean "typed by the user"; don't infer the sender from it.
|
|
56
|
-
|
|
57
|
-
`,"init.removed":` Removed {count} stale generated file(s) by marker.
|
|
49
|
+
`,"claudemd.skills":"## Skills\n\nReusable skills live in your harness's own skills directory (Claude Code: `.claude/skills/`): one directory per skill, each with a `SKILL.md`; invoke a skill by name when the task matches one.\n\n","init.removed":` Removed {count} stale generated file(s) by marker.
|
|
58
50
|
`,"harness.instructionLinkNotMaterialised.message":'{agents} is a plain file containing "{claude}" \u2014 git checked the symlink out as text.',"harness.instructionLinkNotMaterialised.fix":"Enable Developer Mode, then run `git config core.symlinks true` and re-checkout the file.","harness.instructionFilesDuplicated.message":"{claude} and {agents} are both regular files \u2014 they will drift apart.","harness.instructionFilesDuplicated.fix":"Run `weave init` to link one to the other (the displaced file is backed up).","harness.instructionLinkDangling.message":"{name} is a symlink whose target does not exist.","harness.instructionLinkDangling.fix":"Run `weave init` to rewrite the link and the instruction file.","harness.statuslinePathUnresolved.message":"statusLine command does not resolve to a script path: {command}","harness.statuslinePathUnresolved.fix":`Run \`weave init\` to regenerate \`${t[e[0]].projectDir}/settings.json\`.`,"harness.statuslinePathForeign.message":"statusLine points outside this project ({path}) \u2014 it was generated for another checkout.","harness.statuslinePathForeign.fix":"Run `weave init` in this project to rewrite the absolute path.","harness.statuslineScriptMissing.message":"statusLine script is missing: {path}","harness.statuslineScriptMissing.fix":"Run `weave init` to regenerate it.","ilink.bothHaveContent":"CLAUDE.md and AGENTS.md both contain content","ilink.replaceDetail":"AGENTS.md will be replaced with a symlink to CLAUDE.md (the original is backed up to {backupDir}).","ilink.linkFailed":"Could not create {link} -> {target} ({path}): {detail}","ilink.symlinkNotAllowed":"this system does not allow symlinks without elevation. On Windows, enable Developer Mode (Settings > System > For developers) or run weave init from an elevated shell, then retry."};
|
|
@@ -190,7 +190,6 @@ export declare const zh: {
|
|
|
190
190
|
'claudemd.files': string;
|
|
191
191
|
'claudemd.security': string;
|
|
192
192
|
'claudemd.skills': string;
|
|
193
|
-
'claudemd.injected': string;
|
|
194
193
|
'harness.instructionLinkNotMaterialised.message': string;
|
|
195
194
|
'harness.instructionLinkNotMaterialised.fix': string;
|
|
196
195
|
'harness.instructionFilesDuplicated.message': string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{HARNESS_DIRS as
|
|
1
|
+
import{HARNESS_DIRS as F,HARNESS_KEYS as u}from"@weavecode/core";export const zh={"help.tagline":"weave v{version} \u2014 Harness \u5DE5\u5177","help.usage":"\u7528\u6CD5\uFF1Aweave <\u547D\u4EE4> [\u9009\u9879]","help.commands":"\u547D\u4EE4\uFF1A","help.globalOptions":"\u5168\u5C40\u9009\u9879\uFF1A","help.subcommands":"\u53EF\u7528\u5B50\u547D\u4EE4\uFF1A","cli.unknownCommand":"\u672A\u77E5\u547D\u4EE4\uFF1A{command}","cli.error":"\u9519\u8BEF\uFF1A{error}","cli.missingRequired":"\u7F3A\u5C11\u5FC5\u586B\u9009\u9879\uFF1A--{name}","cli.invalidChoice":'--{name} \u7684\u53D6\u503C "{value}" \u65E0\u6548\uFF0C\u53EF\u9009\u503C\uFF1A{choices}',"cli.missingSubcommand":"\u547D\u4EE4 {command} \u9700\u8981\u4E00\u4E2A\u5B50\u547D\u4EE4","cli.unknownSubcommand":"\u672A\u77E5\u5B50\u547D\u4EE4\uFF1A{command} {subcommand}","cli.unexpectedPositional":"\u547D\u4EE4 {command} \u4E0D\u63A5\u53D7\u53C2\u6570\u300C{arg}\u300D","flag.help":"\u663E\u793A\u5E2E\u52A9","flag.version":"\u663E\u793A\u7248\u672C","flag.verbose":"\u8BE6\u7EC6\u8F93\u51FA","flag.quiet":"\u6291\u5236\u975E\u5FC5\u8981\u8F93\u51FA","cmd.init.desc":"\u5728\u5F53\u524D\u9879\u76EE\u521D\u59CB\u5316 weave harness","cmd.uninstall.desc":"\u5378\u8F7D weave\uFF1A\u79FB\u9664 init \u751F\u6210\u7269\uFF08init \u63D0\u4EA4\u521A\u843D\u76D8\u65F6\u56DE\u6EDA\u6307\u9488\uFF0C\u5426\u5219\u751F\u6210\u5378\u8F7D\u63D0\u4EA4\uFF09","cmd.status.desc":"\u67E5\u770B\u5F53\u524D harness \u72B6\u6001","cmd.daemon.desc":"\u7BA1\u7406\u540E\u53F0\u5B88\u62A4\u8FDB\u7A0B\uFF08start\u3001stop\u3001status\uFF09","cmd.daemon.start.desc":"\u5728\u540E\u53F0\u542F\u52A8\u5B88\u62A4\u8FDB\u7A0B\uFF08\u4E0D\u5F00\u6D4F\u89C8\u5668\u2014\u2014\u89C1 `weave dashboard`\uFF09","cmd.daemon.stop.desc":"\u505C\u6B62\u8FD0\u884C\u4E2D\u7684\u5B88\u62A4\u8FDB\u7A0B","cmd.daemon.status.desc":"\u67E5\u770B\u5B88\u62A4\u8FDB\u7A0B\u72B6\u6001","cmd.dashboard.desc":"\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00 web \u63A7\u5236\u53F0\uFF08\u5FC5\u8981\u65F6\u5148\u542F\u52A8\u5B88\u62A4\u8FDB\u7A0B\uFF09","cmd.chpass.desc":"\u4FEE\u6539 dashboard \u767B\u5F55\u5BC6\u7801\uFF08\u6307\u5B9A\u65B0\u5BC6\u7801\uFF1B\u672C\u673A\u6267\u884C\u4E0D\u9700\u8981\u65E7\u5BC6\u7801\uFF09","cmd.scan.desc":"\u626B\u63CF\u5DF2\u521D\u59CB\u5316 weave \u7684\u9879\u76EE\u5E76\u6CE8\u518C","cmd.doctor.desc":"\u8BCA\u65AD\u672C\u673A\u63A5\u7EBF\uFF1A\u8FD9\u6761\u68C0\u51FA\u662F\u5426\u5DF2\u6CE8\u518C\u8FDB\u672C\u673A weave server","flag.init.preset":"\u914D\u7F6E\u9884\u8BBE\uFF1Aminimal\u3001default \u6216 full","flag.init.force":"\u8986\u76D6\u5DF2\u5B58\u5728\u7684\u6587\u4EF6","flag.init.noInteractive":"\u7981\u7528\u4EA4\u4E92\u5F0F\u63D0\u793A","flag.init.hooks":"\u542F\u7528\u7684 hook \u4E8B\u4EF6\uFF0C\u9017\u53F7\u5206\u9694\uFF08preToolUse,postToolUse,userPromptSubmit,sessionStart,stop,stopFailure,subagentStop,subagentStart,notification,postToolUseFailure,permissionRequest,permissionDenied,preCompact,sessionEnd,preModelSwitch\uFF09\uFF1Bnone \u8868\u793A\u5168\u4E0D\u6CE8\u518C\uFF1B\u9ED8\u8BA4\u5168\u5F00","flag.init.harness":`\u8981\u521D\u59CB\u5316\u7684 harness \u9762\uFF0C\u9017\u53F7\u5206\u9694\uFF08${u.join("\u3001")}\uFF09\uFF1B\u7F3A\u7701\u65F6 TTY \u4E0B\u4EA4\u4E92\u591A\u9009\uFF0C\u9ED8\u8BA4 ${u[0]}`,"flag.dir":"\u76EE\u6807\u76EE\u5F55\uFF08\u9ED8\u8BA4\uFF1A\u5F53\u524D\u76EE\u5F55\uFF09","flag.scan.dir":"\u626B\u63CF\u7684\u6839\u76EE\u5F55\uFF08\u9ED8\u8BA4\uFF1A\u5F53\u524D\u76EE\u5F55\uFF09","flag.dashboard.noOpen":"\u53EA\u6253\u5370 dashboard URL\uFF0C\u4E0D\u6253\u5F00\u6D4F\u89C8\u5668","out.daemon.alreadyRunning":"\u5B88\u62A4\u8FDB\u7A0B\u5DF2\u5728 {port} \u7AEF\u53E3\u8FD0\u884C","out.daemon.started":"\u5B88\u62A4\u8FDB\u7A0B\u5DF2\u542F\u52A8\uFF1Ahttp://{host}:{port}","out.daemon.stopped":"\u5B88\u62A4\u8FDB\u7A0B\u5DF2\u505C\u6B62\uFF08pid {pid}\uFF09\u3002","out.daemon.statusNotRunning":"\u5B88\u62A4\u8FDB\u7A0B\uFF1A\u672A\u8FD0\u884C","out.daemon.statusRunning":"\u5B88\u62A4\u8FDB\u7A0B\uFF1A\u8FD0\u884C\u4E2D\uFF08pid {pid}\uFF0C\u7AEF\u53E3 {port}\uFF0C\u5DF2\u8FD0\u884C {uptime}s\uFF09","out.daemon.urlsTitle":"\u8BBF\u95EE\u5730\u5740\uFF1A","out.daemon.statusStale":"\u5B88\u62A4\u8FDB\u7A0B\uFF1A\u72B6\u6001\u8FC7\u671F\uFF08pid {pid}\uFF0C\u7AEF\u53E3 {port} \u65E0\u54CD\u5E94\uFF09","out.doctor.header":`
|
|
2
2
|
Weave Doctor \u2014\u2014 \u672C\u673A\u63A5\u7EBF
|
|
3
3
|
`,"out.doctor.dir":"\u76EE\u5F55","out.doctor.initialized":"\u5DF2\u521D\u59CB\u5316","out.doctor.yes":"\u662F","out.doctor.no":"\u5426","out.doctor.daemon":"\u5B88\u62A4\u8FDB\u7A0B","out.doctor.daemonRunning":"\u8FD0\u884C\u4E2D\uFF08\u7AEF\u53E3 {port}\uFF09","out.doctor.daemonStopped":"\u672A\u8FD0\u884C","out.doctor.registered":"\u672C\u673A\u6CE8\u518C","out.doctor.registeredYes":"\u662F\uFF08id {id}\uFF0C\u6765\u6E90 {source}\uFF09","out.doctor.registeredNo":"\u5426\u2014\u2014\u8FD9\u6761\u68C0\u51FA\u4E0D\u5728\u672C\u673A\u6CE8\u518C\u8868\u91CC","out.doctor.registeredArchived":"\u5DF2\u5F52\u6863\uFF08id {id}\uFF09","out.doctor.token":"\u4EE4\u724C","out.doctor.tokenOk":"\u6B63\u5E38","out.doctor.tokenMissing":"\u7F3A\u5931\uFF08.weave/token \u4E0D\u5B58\u5728\uFF09","out.doctor.tokenUnregistered":"\u5B58\u5728\uFF0C\u4F46\u9879\u76EE\u672A\u6CE8\u518C","out.doctor.tokenStale":"\u8FC7\u671F\u2014\u2014\u4E0E\u672C\u673A\u6CE8\u518C\u8868\u7684\u4EE4\u724C\u4E0D\u4E00\u81F4","out.doctor.warnNotRegistered":"\u8FD9\u4E2A\u9879\u76EE\u5E26\u7740 weave \u6587\u4EF6\uFF0C\u5374\u6CA1\u6709\u6CE8\u518C\u8FDB\u672C\u673A weave server\u3002","out.doctor.fixInit":"\u8FD0\u884C `weave init` \u53EF\u91CD\u65B0\u6CE8\u518C\u8FD9\u6761\u68C0\u51FA\u3001\u5237\u65B0 harness \u6587\u4EF6\u5E76\u91CD\u5199\u672C\u5730\u8DEF\u5F84\u3002","out.doctor.fixScan":"\u6216\u7528 `weave scan -d <\u4E0A\u7EA7\u76EE\u5F55>` \u6279\u91CF\u53D1\u73B0\u5E76\u6CE8\u518C\u3002","out.doctor.warnArchived":"\u8FD9\u4E2A\u9879\u76EE\u5DF2\u6CE8\u518C\u4F46\u5904\u4E8E\u5F52\u6863\u6001\u2014\u2014\u5728 dashboard \u91CC\u6062\u590D\u540E\u624D\u80FD\u4F7F\u7528\u3002","out.doctor.warnTokenMissing":"\u5DF2\u6CE8\u518C\uFF0C\u4F46 `.weave/token` \u7F3A\u5931\u2014\u2014\u91CD\u65B0\u751F\u6210\u524D hook \u65E0\u6CD5\u901A\u8FC7\u9274\u6743\u3002","out.doctor.warnTokenStale":"\u5DF2\u6CE8\u518C\uFF0C\u4F46 `.weave/token` \u5C5E\u4E8E\u53E6\u4E00\u6B21\u68C0\u51FA\u2014\u2014\u9700\u8981\u91CD\u65B0\u751F\u6210\u3002","out.doctor.ok":"\u6B63\u5E38\u2014\u2014\u8FD9\u6761\u68C0\u51FA\u5DF2\u6CE8\u518C\uFF0C\u4EE4\u724C\u4E00\u81F4\u3002","out.doctor.fixDaemon":"\u5B88\u62A4\u8FDB\u7A0B\u672A\u8FD0\u884C\uFF1B\u9700\u8981\u91C7\u96C6\u65F6\u7528 `weave daemon start` \u542F\u52A8\u3002","out.doctor.diagHeader":`
|
|
4
4
|
Weave Doctor \u2014\u2014 \u6D88\u606F\u6295\u9012\u8BCA\u65AD\uFF08\u9879\u76EE #{id}\uFF09
|
|
@@ -47,12 +47,4 @@ import{HARNESS_DIRS as t,HARNESS_KEYS as e}from"@weavecode/core";export const zh
|
|
|
47
47
|
- \u4E0D\u5F15\u5165 XSS\u3001SQL \u6CE8\u5165\u3001\u547D\u4EE4\u6CE8\u5165\u9762
|
|
48
48
|
- \u4F18\u5148\u53C2\u6570\u5316\u67E5\u8BE2\u4E0E\u5B89\u5168 API\uFF0C\u800C\u4E0D\u662F\u5B57\u7B26\u4E32\u62FC\u63A5
|
|
49
49
|
|
|
50
|
-
`,"claudemd.skills":"## \u6280\u80FD\n\n\u53EF\u590D\u7528\u6280\u80FD\u653E harness \u81EA\u5DF1\u7684\u6280\u80FD\u76EE\u5F55\uFF08Claude Code \u4E3A `.claude/skills/`\uFF09\uFF1A\u4E00\u4E2A\u6280\u80FD\u4E00\u4E2A\u76EE\u5F55\u3001\u5185\u542B `SKILL.md`\uFF1B\u4EFB\u52A1\u547D\u4E2D\u67D0\u4E2A\u6280\u80FD\u65F6\u6309\u540D\u8C03\u7528\u3002\n\n","
|
|
51
|
-
|
|
52
|
-
\u4EE5 \`{marker}\` \u5F00\u5934\u7684\u7528\u6237\u6D88\u606F\u6765\u81EA weave \u63A7\u5236\u53F0\u7684\u76F4\u6295\uFF0C\u4E0D\u662F\u5750\u5728\u7EC8\u7AEF\u524D\u7684\u4EBA\u624B\u6253\u7684\uFF1A
|
|
53
|
-
|
|
54
|
-
- \u53BB\u6389\u8BE5\u6807\u8BB0\u540E\u7684\u5168\u6587\u5C31\u662F\u5B8C\u6574\u6307\u4EE4\uFF0C**\u7167\u5B83\u6267\u884C**\uFF1B
|
|
55
|
-
- \u4E0D\u8981\u628A\u6807\u8BB0\u5F53\u5185\u5BB9\u590D\u8FF0\uFF0C\u4E5F\u4E0D\u5FC5\u5C31\u8FD9\u6761\u6D88\u606F\u56DE\u8BDD\uFF08\u8FD9\u6761\u8DEF\u5F84\u6CA1\u6709\u56DE\u590D\u9762\uFF09\uFF1B
|
|
56
|
-
- **\u53EA\u6709\u76F4\u6295\u8FD9\u4E00\u6761\u8DEF\u5F84\u5E26\u6807\u8BB0**\uFF1A\u4E2D\u7EE7\u3001\u7EC8\u7AEF\u515C\u5E95\u3001\u6CE8\u5165\u4E09\u6761\u8DEF\u5F84\u7684\u6295\u9012\u90FD\u4E0D\u5E26\u2014\u2014\u6240\u4EE5\u300C\u6CA1\u6709\u6807\u8BB0\u300D\u4E0D\u7B49\u4E8E\u300C\u7528\u6237\u624B\u6253\u300D\uFF0C\u522B\u636E\u6B64\u5224\u65AD\u6765\u6E90\u3002
|
|
57
|
-
|
|
58
|
-
`,"harness.instructionLinkNotMaterialised.message":'{agents} \u662F\u5185\u5BB9\u4E3A "{claude}" \u7684\u666E\u901A\u6587\u4EF6\u2014\u2014git \u628A\u8F6F\u94FE\u63A5\u68C0\u51FA\u6210\u4E86\u6587\u672C\u3002',"harness.instructionLinkNotMaterialised.fix":"\u542F\u7528\u5F00\u53D1\u8005\u6A21\u5F0F\uFF0C\u7136\u540E\u8FD0\u884C `git config core.symlinks true` \u5E76\u91CD\u65B0\u68C0\u51FA\u8BE5\u6587\u4EF6\u3002","harness.instructionFilesDuplicated.message":"{claude} \u4E0E {agents} \u90FD\u662F\u72EC\u7ACB\u6587\u4EF6\u2014\u2014\u4E24\u8005\u5185\u5BB9\u4F1A\u5404\u81EA\u6F02\u79FB\u3002","harness.instructionFilesDuplicated.fix":"\u8FD0\u884C `weave init` \u8BA9\u5176\u4E2D\u4E00\u4E2A\u94FE\u63A5\u5230\u53E6\u4E00\u4E2A\uFF08\u88AB\u66FF\u6362\u7684\u6587\u4EF6\u4F1A\u5148\u5907\u4EFD\uFF09\u3002","harness.instructionLinkDangling.message":"{name} \u662F\u76EE\u6807\u4E0D\u5B58\u5728\u7684\u8F6F\u94FE\u63A5\u3002","harness.instructionLinkDangling.fix":"\u8FD0\u884C `weave init` \u91CD\u5EFA\u94FE\u63A5\u4E0E\u6307\u4EE4\u6587\u4EF6\u3002","harness.statuslinePathUnresolved.message":"statusLine \u547D\u4EE4\u65E0\u6CD5\u89E3\u6790\u51FA\u811A\u672C\u8DEF\u5F84\uFF1A{command}","harness.statuslinePathUnresolved.fix":`\u8FD0\u884C \`weave init\` \u91CD\u65B0\u751F\u6210 \`${t[e[0]].projectDir}/settings.json\`\u3002`,"harness.statuslinePathForeign.message":"statusLine \u6307\u5411\u672C\u9879\u76EE\u4E4B\u5916\uFF08{path}\uFF09\u2014\u2014\u5B83\u662F\u4E3A\u53E6\u4E00\u4E2A\u68C0\u51FA\u751F\u6210\u7684\u3002","harness.statuslinePathForeign.fix":"\u5728\u672C\u9879\u76EE\u4E2D\u8FD0\u884C `weave init` \u91CD\u5199\u7EDD\u5BF9\u8DEF\u5F84\u3002","harness.statuslineScriptMissing.message":"statusLine \u811A\u672C\u7F3A\u5931\uFF1A{path}","harness.statuslineScriptMissing.fix":"\u8FD0\u884C `weave init` \u91CD\u65B0\u751F\u6210\u3002","ilink.bothHaveContent":"CLAUDE.md \u4E0E AGENTS.md \u90FD\u5305\u542B\u5185\u5BB9","ilink.replaceDetail":"\u5C06\u628A AGENTS.md \u66FF\u6362\u4E3A\u6307\u5411 CLAUDE.md \u7684\u8F6F\u8FDE\u63A5\uFF08\u539F\u6587\u4EF6\u4F1A\u5907\u4EFD\u5230 {backupDir}\uFF09\u3002","ilink.linkFailed":"\u65E0\u6CD5\u521B\u5EFA {link} -> {target}\uFF08{path}\uFF09\uFF1A{detail}","ilink.symlinkNotAllowed":"\u6B64\u7CFB\u7EDF\u4E0D\u5141\u8BB8\u672A\u63D0\u6743\u521B\u5EFA\u8F6F\u94FE\u63A5\u3002\u5728 Windows \u4E0A\u8BF7\u542F\u7528\u5F00\u53D1\u8005\u6A21\u5F0F\uFF08\u8BBE\u7F6E > \u7CFB\u7EDF > \u5F00\u53D1\u8005\u9009\u9879\uFF09\uFF0C\u6216\u4ECE\u63D0\u6743\u7EC8\u7AEF\u8FD0\u884C weave init\uFF0C\u7136\u540E\u91CD\u8BD5\u3002"};
|
|
50
|
+
`,"claudemd.skills":"## \u6280\u80FD\n\n\u53EF\u590D\u7528\u6280\u80FD\u653E harness \u81EA\u5DF1\u7684\u6280\u80FD\u76EE\u5F55\uFF08Claude Code \u4E3A `.claude/skills/`\uFF09\uFF1A\u4E00\u4E2A\u6280\u80FD\u4E00\u4E2A\u76EE\u5F55\u3001\u5185\u542B `SKILL.md`\uFF1B\u4EFB\u52A1\u547D\u4E2D\u67D0\u4E2A\u6280\u80FD\u65F6\u6309\u540D\u8C03\u7528\u3002\n\n","harness.instructionLinkNotMaterialised.message":'{agents} \u662F\u5185\u5BB9\u4E3A "{claude}" \u7684\u666E\u901A\u6587\u4EF6\u2014\u2014git \u628A\u8F6F\u94FE\u63A5\u68C0\u51FA\u6210\u4E86\u6587\u672C\u3002',"harness.instructionLinkNotMaterialised.fix":"\u542F\u7528\u5F00\u53D1\u8005\u6A21\u5F0F\uFF0C\u7136\u540E\u8FD0\u884C `git config core.symlinks true` \u5E76\u91CD\u65B0\u68C0\u51FA\u8BE5\u6587\u4EF6\u3002","harness.instructionFilesDuplicated.message":"{claude} \u4E0E {agents} \u90FD\u662F\u72EC\u7ACB\u6587\u4EF6\u2014\u2014\u4E24\u8005\u5185\u5BB9\u4F1A\u5404\u81EA\u6F02\u79FB\u3002","harness.instructionFilesDuplicated.fix":"\u8FD0\u884C `weave init` \u8BA9\u5176\u4E2D\u4E00\u4E2A\u94FE\u63A5\u5230\u53E6\u4E00\u4E2A\uFF08\u88AB\u66FF\u6362\u7684\u6587\u4EF6\u4F1A\u5148\u5907\u4EFD\uFF09\u3002","harness.instructionLinkDangling.message":"{name} \u662F\u76EE\u6807\u4E0D\u5B58\u5728\u7684\u8F6F\u94FE\u63A5\u3002","harness.instructionLinkDangling.fix":"\u8FD0\u884C `weave init` \u91CD\u5EFA\u94FE\u63A5\u4E0E\u6307\u4EE4\u6587\u4EF6\u3002","harness.statuslinePathUnresolved.message":"statusLine \u547D\u4EE4\u65E0\u6CD5\u89E3\u6790\u51FA\u811A\u672C\u8DEF\u5F84\uFF1A{command}","harness.statuslinePathUnresolved.fix":`\u8FD0\u884C \`weave init\` \u91CD\u65B0\u751F\u6210 \`${F[u[0]].projectDir}/settings.json\`\u3002`,"harness.statuslinePathForeign.message":"statusLine \u6307\u5411\u672C\u9879\u76EE\u4E4B\u5916\uFF08{path}\uFF09\u2014\u2014\u5B83\u662F\u4E3A\u53E6\u4E00\u4E2A\u68C0\u51FA\u751F\u6210\u7684\u3002","harness.statuslinePathForeign.fix":"\u5728\u672C\u9879\u76EE\u4E2D\u8FD0\u884C `weave init` \u91CD\u5199\u7EDD\u5BF9\u8DEF\u5F84\u3002","harness.statuslineScriptMissing.message":"statusLine \u811A\u672C\u7F3A\u5931\uFF1A{path}","harness.statuslineScriptMissing.fix":"\u8FD0\u884C `weave init` \u91CD\u65B0\u751F\u6210\u3002","ilink.bothHaveContent":"CLAUDE.md \u4E0E AGENTS.md \u90FD\u5305\u542B\u5185\u5BB9","ilink.replaceDetail":"\u5C06\u628A AGENTS.md \u66FF\u6362\u4E3A\u6307\u5411 CLAUDE.md \u7684\u8F6F\u8FDE\u63A5\uFF08\u539F\u6587\u4EF6\u4F1A\u5907\u4EFD\u5230 {backupDir}\uFF09\u3002","ilink.linkFailed":"\u65E0\u6CD5\u521B\u5EFA {link} -> {target}\uFF08{path}\uFF09\uFF1A{detail}","ilink.symlinkNotAllowed":"\u6B64\u7CFB\u7EDF\u4E0D\u5141\u8BB8\u672A\u63D0\u6743\u521B\u5EFA\u8F6F\u94FE\u63A5\u3002\u5728 Windows \u4E0A\u8BF7\u542F\u7528\u5F00\u53D1\u8005\u6A21\u5F0F\uFF08\u8BBE\u7F6E > \u7CFB\u7EDF > \u5F00\u53D1\u8005\u9009\u9879\uFF09\uFF0C\u6216\u4ECE\u63D0\u6743\u7EC8\u7AEF\u8FD0\u884C weave init\uFF0C\u7136\u540E\u91CD\u8BD5\u3002"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_LOCALE as
|
|
1
|
+
import{DEFAULT_LOCALE as e,SUPPORTED_LOCALES as L,readDaemonSettings as f}from"@weavecode/server";import{DICTS as n}from"./dict/index.js";import{makeT as a}from"./t.js";let c=e,i=a(n[e],n[e]);function r(o){c=o,i=a(n[o],n[e])}export async function initCliLocale(){const o=process.env.WEAVE_LOCALE;if(o&&L.includes(o)){r(o);return}try{r((await f()).locale)}catch{r(e)}}export function setLocale(o){r(o)}export function getLocale(){return c}export function t(o,s){return i(o,s)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function interpolate(t
|
|
1
|
+
export function interpolate(n,t){return t?n.replace(/\{(\w+)\}/g,(e,r)=>r in t?String(t[r]):e):n}export function makeT(n,t){return(e,r)=>interpolate(n[e]??t[e]??String(e),r)}
|
|
@@ -12,9 +12,8 @@ export interface ClaudeMdGeneratorInput {
|
|
|
12
12
|
*
|
|
13
13
|
* The block text lives in the CLI dictionary (`claudemd.*`) and renders in the
|
|
14
14
|
* active locale. What belongs here is anything the agent needs to work in THIS
|
|
15
|
-
* project
|
|
16
|
-
*
|
|
17
|
-
* engineering notes (internal paths, module layout, dev workflow) do not.
|
|
15
|
+
* project. weave's own engineering notes (internal paths, module layout, dev
|
|
16
|
+
* workflow) do not.
|
|
18
17
|
*/
|
|
19
18
|
/** Delimit weave's managed block so re-init can replace it in place. */
|
|
20
19
|
export declare const WEAVE_BLOCK_START = "<!-- weave:start -->";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as a}from"../i18n/index.js";export const WEAVE_BLOCK_START="<!-- weave:start -->",WEAVE_BLOCK_END="<!-- weave:end -->",WEAVE_MANAGED_HEADER="> This file is managed by [weave](https://github.com/zijing66/weave) \u2014 a coding-agent harness.";function r(e){return`# ${e}
|
|
2
2
|
|
|
3
3
|
> This file is managed by [weave](https://github.com/zijing66/weave) \u2014 a coding-agent harness.
|
|
4
4
|
> Re-run \`weave init\` to regenerate.
|
|
5
5
|
|
|
6
|
-
`}
|
|
7
|
-
`;return t+=
|
|
8
|
-
`,t}export function generateClaudeMd(e){return
|
|
6
|
+
`}export function generateClaudeMdSection(e){const{template:n}=e;let t=`${WEAVE_BLOCK_START}
|
|
7
|
+
`;return t+=a("claudemd.rules"),(n==="standard"||n==="full")&&(t+=a("claudemd.files")),n==="full"&&(t+=a("claudemd.security")),t+=a("claudemd.skills"),t+=`${WEAVE_BLOCK_END}
|
|
8
|
+
`,t}export function generateClaudeMd(e){return r(e.projectName)+generateClaudeMdSection(e)}export function mergeClaudeMd(e,n){const t=e.indexOf(WEAVE_BLOCK_START),i=e.indexOf(WEAVE_BLOCK_END);return t!==-1&&i!==-1&&i>t?e.slice(0,t)+n.trimEnd()+e.slice(i+WEAVE_BLOCK_END.length):e.replace(/\s+$/,"")+`
|
|
9
9
|
|
|
10
10
|
`+n.trimEnd()+`
|
|
11
11
|
`}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import m from"node:path";import{readFile as P,writeFile as f}from"node:fs/promises";import{detectPlatform as x,resolveComponents as B,DEFAULT_HOOKS as G,DEFAULT_MCP as H,HARNESS_DIRS as L,HARNESS_KEYS as V,ensureDir as D,fileExists as Y,logger as I}from"@weavecode/core";import{templateRegistry as b}from"@weavecode/templates";import{WEAVE_VERSION as K}from"@weavecode/server";import{generateClaudeMd as $,generateClaudeMdSection as q,mergeClaudeMd as J}from"./claudemd-gen.js";import{ensureInstructionLink as W}from"./instruction-link.js";import{buildInitRegistry as z}from"./wiring.js";import{createPromptPort as Q}from"./prompt.js";import{commitInitOutputs as X,findGitRepoRoot as Z}from"./git-commit.js";import{t as N}from"../i18n/index.js";const tt={minimal:"minimal",default:"standard",full:"full"},S=["claude"];async function et(t,r){if(t.harnesses&&t.harnesses.length>0)return[...t.harnesses];if(!t.interactive)return[...S];if(!process.stdin.isTTY||!process.stdout.isTTY)return[...S];const s=await r.multiselect(V,S);return s.length>0?[...s]:[...S]}export async function executeInit(t,r){const{targetDir:s,force:u,interactive:g,preset:y}=t,j=x(),a={directories:[],files:[]},C=[],E=[],T=[],v=[],M=[],n=B(y,t.components),e={...G,...t.hooks},U={...H,...t.mcp},k=r??Q(g);g||I.dim(N("init.nonInteractive"));const h=await et(t,k),F={...t,platform:j},_=z();for(const o of h){const p=new(_.initFor(o))(F);await p.runSurface();const i=p.records;a.directories.push(...i.created.directories),a.files.push(...i.created.files),C.push(...i.skipped),E.push(...i.merged),T.push(...i.updated),v.push(...i.removed)}if(n.claudeMd||n.agentsMd){const o=await W(s,{force:u,interactive:g,confirm:(d,l)=>k.confirm(d,l)});o.backedUpTo&&(I.dim(N("init.backedUp",{path:o.backedUpTo})),a.files.push(o.backedUpTo));const p=tt[y]??"standard",i=m.basename(s),c=m.join(s,o.realFile),w=$({template:p,projectName:i});if(u)await f(c,w,"utf-8"),a.files.push(c);else{const d=await O(c);if(d===null)await f(c,w,"utf-8"),a.files.push(c);else{const l=q({template:p,projectName:i});await f(c,J(d,l),"utf-8"),E.push(c)}}}{const o=m.join(s,".weave");await D(o),a.directories.push(o);const p={initVersion:K,initTimestamp:new Date().toISOString(),preset:y,harnesses:h,components:{settings:n.settings,skills:n.skills,commands:n.commands,agents:n.agents,helpers:n.helpers,mcp:n.mcp,claudeMd:n.claudeMd,agentsMd:n.agentsMd},hooks:e,mcp:U},i=m.join(o,"config.yaml"),c=Object.entries(p).map(([d,l])=>`${d}: ${typeof l=="object"?JSON.stringify(l):l}`).join(`
|
|
2
2
|
`)+`
|
|
3
|
-
`,w=await Y(
|
|
3
|
+
`,w=await Y(i);await f(i,c,"utf-8"),(w?T:a.files).push(i)}for(const o of h)await R(s,m.join(s,L[o].projectDir),a);await R(s,m.join(s,".weave"),a),await X({targetDir:s,interactive:g,selected:h,prompt:k});const A={skillsCount:b.getByCategory("skill").length,commandsCount:b.getByCategory("command").length,agentsCount:b.getByCategory("agent").length,hooksEnabled:[e.preToolUse,e.postToolUse,e.userPromptSubmit,e.sessionStart,e.stop,e.stopFailure,e.subagentStop,e.subagentStart,e.notification,e.postToolUseFailure,e.permissionRequest,e.permissionDenied,e.preCompact,e.sessionEnd,e.preModelSwitch].filter(Boolean).length};return{success:M.length===0,platform:j,created:a,skipped:C,merged:E,updated:T,removed:v,errors:M,summary:A}}export const NESTED_GITIGNORE=`# weave \u2014 generated; do not commit
|
|
4
4
|
*
|
|
5
5
|
!.gitignore
|
|
6
|
-
`;async function
|
|
6
|
+
`;async function R(t,r,s){if(!await Z(t))return;const u=m.join(r,".gitignore");await O(u)===null&&(await D(r),await f(u,NESTED_GITIGNORE,"utf-8"),s.files.push(u))}async function O(t){try{return await P(t,"utf-8")}catch(r){if(st(r))return null;throw r}}function st(t){return typeof t=="object"&&t!==null&&t.code==="ENOENT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import f from"node:path";import{execFile as
|
|
2
|
-
`).filter(Boolean).length,
|
|
1
|
+
import f from"node:path";import{execFile as y}from"node:child_process";import{promisify as S}from"node:util";import{lstat as E,stat as I}from"node:fs/promises";import{HARNESS_DIRS as T,INSTRUCTION_FILES as j,logger as c}from"@weavecode/core";import{t as s}from"../i18n/index.js";export async function findGitRepoRoot(i){let r=f.resolve(i);for(;;){try{return(await I(f.join(r,".git"))).isDirectory()?r:null}catch{}const o=f.dirname(r);if(o===r)return null;r=o}}const v=S(y);export const defaultGitExec=async(i,r,o)=>{try{const{stdout:e,stderr:t}=await v(i,r,{cwd:o.cwd,windowsHide:!0,timeout:1e4,maxBuffer:1048576});return{stdout:String(e),stderr:String(t),code:0}}catch(e){const t=e;if(typeof t.code=="number")return{stdout:String(t.stdout??""),stderr:String(t.stderr??""),code:t.code};throw e}};export async function collectCommitPaths(i,r){const o=[...j,".mcp.json",...r.map(t=>T[t].projectDir),".weave"],e=[];for(const t of o)try{await E(f.join(i,t)),e.includes(t)||e.push(t)}catch{}return e}export const COMMIT_MESSAGE="chore: weave init \u751F\u6210\u521D\u59CB\u5316\u4EA7\u7269";export async function commitInitOutputs(i){try{return await D(i)}catch(r){return c.warn(s("init.commit.failed",{error:r instanceof Error?r.message:String(r)})),{status:"failed"}}}async function D({targetDir:i,interactive:r,selected:o,prompt:e,execGit:t=defaultGitExec}){if(!await findGitRepoRoot(i))return{status:"not-repo"};if(!r||!process.stdin.isTTY||!process.stdout.isTTY)return{status:"skipped"};const n=await t("git",["diff","--cached","--quiet"],{cwd:i});if(n.code!==0){if(n.code===1)return c.dim(s("init.commit.preStaged")),{status:"skipped"};throw new Error(n.stderr.trim()||`git diff --cached exited ${n.code}`)}const a=await collectCommitPaths(i,o);if(a.length===0)return{status:"no-changes"};const d=await t("git",["status","--porcelain","--",...a],{cwd:i});if(d.code!==0)throw new Error(d.stderr.trim()||`git status exited ${d.code}`);if(!d.stdout.trim())return{status:"no-changes"};const x=s("init.commit.detail",{paths:a.join(", ")});if(!await e.confirm(s("init.commit.question"),x))return{status:"declined"};const w=[];for(const l of a)(await t("git",["add","--",l],{cwd:i})).code!==0&&w.push(l);w.length>0&&c.warn(s("init.commit.pathIgnored",{paths:w.join(", ")}));const u=await t("git",["diff","--cached","--quiet"],{cwd:i});if(u.code===0)return c.warn(s("init.commit.failed",{error:"nothing staged after git add"})),{status:"no-changes"};if(u.code!==1)throw new Error(u.stderr.trim()||`git diff --cached exited ${u.code}`);const p=(await t("git",["diff","--cached","--name-only"],{cwd:i})).stdout.split(`
|
|
2
|
+
`).filter(Boolean).length,m=await t("git",["commit","-m",COMMIT_MESSAGE],{cwd:i});if(m.code!==0)throw new Error(m.stderr.trim()||m.stdout.trim()||`git commit exited ${m.code}`);const g=await t("git",["rev-parse","--short","HEAD"],{cwd:i}),h=g.code===0?g.stdout.trim():"";return c.success(s("init.commit.done",{sha:h,count:p})),{status:"committed",sha:h,count:p}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import a from"node:path";import{readFile as
|
|
2
|
-
`,"utf-8"),
|
|
3
|
-
`,"utf-8"),
|
|
4
|
-
`,"utf-8"),
|
|
5
|
-
`,"utf-8"),
|
|
6
|
-
`,"utf-8"),
|
|
7
|
-
`,"utf-8"),
|
|
1
|
+
import a from"node:path";import{readFile as f,writeFile as c,readdir as D,unlink as T}from"node:fs/promises";import{DEFAULT_AGENTS as A,DEFAULT_COMMANDS as F,DEFAULT_HOOKS as O,DEFAULT_MCP as J,DEFAULT_SKILLS as N,ensureDir as m,fileExists as w,logger as p,resolveComponents as b,writeFileIfAbsent as y}from"@weavecode/core";import{templateRegistry as d}from"@weavecode/templates";import{generateStatuslineScript as M,readStatuslineConfig as C,WEAVE_VERSION as U}from"@weavecode/server";import{InitPipeline as L,generateHookHandler as P,readUserCapture as _}from"@weavecode/harness";import{generateSettingsJson as I,mergeSettingsJson as R}from"../settings-gen.js";import{generateMcpJson as H,mergeMcpJson as x}from"../mcp-gen.js";import{generateAutoMemoryHook as K}from"../helpers-gen.js";import{registerPluginTemplates as V,collectPluginMcpServers as W}from"../plugin-templates.js";import{t as l}from"../../i18n/index.js";export const WEAVE_HELPER_MARKER="@version weave@";const q={preToolUse:!1,postToolUse:!1,userPromptSubmit:!1,sessionStart:!1,stop:!1,stopFailure:!1,subagentStop:!1,subagentStart:!1,notification:!1,postToolUseFailure:!1,permissionRequest:!1,permissionDenied:!1,preCompact:!1,sessionEnd:!1,preModelSwitch:!1,timeout:5e3,continueOnError:!0};export class ClaudeInitTemplate extends L{records={created:{directories:[],files:[]},skipped:[],merged:[],updated:[],removed:[]};st;constructor(s){super(s);const i=a.join(s.targetDir,".claude");this.st={targetDir:s.targetDir,force:s.force,platform:s.platform,components:b(s.preset,s.components),hooks:{...O,...s.hooks},skills:{...N,...s.skills},commands:{...F,...s.commands},agents:{...A,...s.agents},mcp:{...J,...s.mcp},claudeDir:i,skillsDir:a.join(i,"skills"),commandsDir:a.join(i,"commands"),agentsDir:a.join(i,"agents"),helpersDir:a.join(i,"helpers"),...this.records}}ensureDirs(){return G(this.st)}writeSettings(){return z(this.st)}writeMcp(){return B(this.st)}copySkills(){return Q(this.st)}copyCommands(){return X(this.st)}copyAgents(){return Y(this.st)}injectPluginTemplates(){return Z(this.st)}writeHelpers(){return $(this.st)}}async function G(t){await m(t.claudeDir),t.created.directories.push(t.claudeDir),t.components.skills&&(await m(t.skillsDir),t.created.directories.push(t.skillsDir)),t.components.commands&&(await m(t.commandsDir),t.created.directories.push(t.commandsDir)),t.components.agents&&(await m(t.agentsDir),t.created.directories.push(t.agentsDir)),t.components.helpers&&(await m(t.helpersDir),t.created.directories.push(t.helpersDir))}async function z(t){if(t.components.settings){const s=await _({home:t.platform.homeDir}),i=s.installed?q:t.hooks;s.installed&&p.dim(l("init.userCaptureActive"));const o=I({components:t.components,hooks:i,platform:t.platform,helpersDir:t.helpersDir}),e=a.join(t.claudeDir,"settings.json");if(t.force)await c(e,JSON.stringify(o,null,2)+`
|
|
2
|
+
`,"utf-8"),t.created.files.push(e);else{const r=await S(e);if(r===void 0)await w(e)?(t.skipped.push(e),p.warn(l("init.skippedInvalidJson",{path:e}))):(await c(e,JSON.stringify(o,null,2)+`
|
|
3
|
+
`,"utf-8"),t.created.files.push(e));else{const n=R(r,o);await c(e,JSON.stringify(n,null,2)+`
|
|
4
|
+
`,"utf-8"),t.merged.push(e)}}}}async function B(t){if(t.components.mcp){const s=H({platform:t.platform,includeWeaveServer:t.mcp.weave}),i=Object.keys(s.mcpServers),o=await W(t.targetDir,void 0,i),e=s.mcpServers;for(const[r,n]of Object.entries(o.servers))e[r]=n;for(const r of o.renamed)p.warn(l("init.pluginMcpRenamed",{renamed:r}));if(Object.keys(e).length>0){const r=a.join(t.targetDir,".mcp.json");if(t.force)await c(r,JSON.stringify(s,null,2)+`
|
|
5
|
+
`,"utf-8"),t.created.files.push(r);else{const n=await S(r);if(n===void 0)await w(r)?(t.skipped.push(r),p.warn(l("init.skippedInvalidJson",{path:r}))):(await c(r,JSON.stringify(s,null,2)+`
|
|
6
|
+
`,"utf-8"),t.created.files.push(r));else{const u=x(n,s);await c(r,JSON.stringify(u,null,2)+`
|
|
7
|
+
`,"utf-8"),t.merged.push(r)}}}else await w(a.join(t.targetDir,".mcp.json"))&&t.skipped.push(a.join(t.targetDir,".mcp.json"))}}async function Q(t){if(t.components.skills&&t.skills.core){const s=d.getSkillsSourceDir();await h(s,t.skillsDir,t.force,t.created,t.skipped)}}async function X(t){if(t.components.commands&&t.commands.core){const s=d.getCommandsSourceDir();await h(s,t.commandsDir,t.force,t.created,t.skipped)}}async function Y(t){if(t.components.agents&&t.agents.core){const s=d.getAgentsSourceDir();await h(s,t.agentsDir,t.force,t.created,t.skipped)}}async function Z(t){try{const{registered:s}=await V(t.targetDir);for(const i of s){const o=d.resolvePath(i);if(i.category==="skill"){await h(o,a.join(t.skillsDir,a.basename(o)),t.force,t.created,t.skipped);continue}const e=i.category==="command"?t.commandsDir:t.agentsDir,r=a.join(e,a.basename(o));try{const n=await f(o,"utf-8");await y(r,n,t.force)?t.created.files.push(r):t.skipped.push(r)}catch(n){p.warn(l("init.copyTemplatesFailed",{srcDir:o,error:String(n)}))}}}catch(s){p.warn(l("init.copyTemplatesFailed",{srcDir:"plugins",error:String(s)}))}}async function $(t){if(t.components.helpers){const s=await C(t.targetDir),i=[["hook-handler.cjs",P(U)],["statusline.cjs",M(s)],["auto-memory-hook.mjs",K()]];for(const[e,r]of i){const n=a.join(t.helpersDir,e);if(t.force){await c(n,r,"utf-8"),t.created.files.push(n);continue}const u=await k(n);u===null?(await c(n,r,"utf-8"),t.created.files.push(n)):u.includes(WEAVE_HELPER_MARKER)?(await c(n,r,"utf-8"),t.updated.push(n)):t.skipped.push(n)}const o=new Set(i.map(([e])=>e));try{for(const e of await D(t.helpersDir,{withFileTypes:!0})){if(!e.isFile()||o.has(e.name))continue;const r=a.join(t.helpersDir,e.name),n=await k(r);n!==null&&n.includes(WEAVE_HELPER_MARKER)&&(await T(r),t.removed.push(r))}}catch{}}}async function k(t){try{return await f(t,"utf-8")}catch(s){if(j(s))return null;throw s}}async function S(t){let s;try{s=await f(t,"utf-8")}catch(i){if(j(i))return;throw i}try{const i=JSON.parse(s);if(typeof i=="object"&&i!==null&&!Array.isArray(i))return i}catch{}}function j(t){return typeof t=="object"&&t!==null&&t.code==="ENOENT"}async function h(t,s,i,o,e){try{const r=await v(t);for(const n of r){const u=a.relative(t,n),g=a.join(s,u),E=await f(n,"utf-8");await y(g,E,i)?o.files.push(g):e.push(g)}}catch(r){p.warn(l("init.copyTemplatesFailed",{srcDir:t,error:String(r)}))}}async function v(t){const s=[];try{const i=await D(t,{withFileTypes:!0});for(const o of i){const e=a.join(t,o.name);o.isDirectory()?s.push(...await v(e)):s.push(e)}}catch{}return s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"node:path";import{readdir as
|
|
1
|
+
import o from"node:path";import{readdir as m,readFile as k}from"node:fs/promises";import{DEFAULT_SKILLS as f,HARNESS_DIRS as u,ensureDir as n,logger as p,resolveComponents as D,writeFileIfAbsent as w}from"@weavecode/core";import{templateRegistry as y}from"@weavecode/templates";import{InitPipeline as g}from"@weavecode/harness";import{t as a}from"../../i18n/index.js";export class CodexInitTemplate extends g{records={created:{directories:[],files:[]},skipped:[],merged:[],updated:[],removed:[]};force;components;skills;codexDir;skillsDir;constructor(s){super(s);const i=D(s.preset,s.components),e=o.join(s.targetDir,u.codex.projectDir);this.force=s.force,this.components=i,this.skills={...f,...s.skills},this.codexDir=e,this.skillsDir=o.join(e,"skills")}async ensureDirs(){await n(this.codexDir),this.records.created.directories.push(this.codexDir),this.components.skills&&(await n(this.skillsDir),this.records.created.directories.push(this.skillsDir))}writeSettings(){this.skipNoFace("writeSettings")}writeMcp(){this.skipNoFace("writeMcp")}async copySkills(){if(this.components.skills&&this.skills.core){const s=y.getSkillsSourceDir();await F(s,this.skillsDir,this.force,this.records)}}copyCommands(){this.skipNoFace("copyCommands")}copyAgents(){this.skipNoFace("copyAgents")}injectPluginTemplates(){this.skipNoFace("injectPluginTemplates")}writeHelpers(){this.skipNoFace("writeHelpers")}skipNoFace(s){const i=a("init.noPeerFace");this.skip(s,i),p.dim(a("init.stepSkipped",{step:s,reason:i}))}}async function F(t,s,i,e){try{for(const r of await l(t)){const h=o.relative(t,r),c=o.join(s,h),d=await k(r,"utf-8");await w(c,d,i)?e.created.files.push(c):e.skipped.push(c)}}catch(r){p.warn(a("init.copyTemplatesFailed",{srcDir:t,error:String(r)}))}}async function l(t){const s=[];try{const i=await m(t,{withFileTypes:!0});for(const e of i){const r=o.join(t,e.name);e.isDirectory()?s.push(...await l(r)):s.push(r)}}catch{return s}return s}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { InitPipeline, type InitContext } from '@weavecode/harness';
|
|
2
|
+
import { type SurfaceRecords } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* ZCode init 模板:项目侧只有 `.zcode/skills`(它的 skill 根),其余表面
|
|
5
|
+
* (单文件资产、MCP、commands)ZCode 都没有 → `skip(step, 无对等面)`。
|
|
6
|
+
*
|
|
7
|
+
* 采集面**不在项目里**:ZCode 的项目级 hooks 在当前发行版里要过工作区信任、
|
|
8
|
+
* CLI/TUI 路径下恒被拒,故 hook 入口只能写用户级 `~/.zcode/cli/config.json`
|
|
9
|
+
* 并指向一份全局脚本(见 `zcode/capture.ts`)。
|
|
10
|
+
*/
|
|
11
|
+
export declare class ZcodeInitTemplate extends InitPipeline {
|
|
12
|
+
readonly records: SurfaceRecords;
|
|
13
|
+
private readonly force;
|
|
14
|
+
private readonly components;
|
|
15
|
+
private readonly skills;
|
|
16
|
+
private readonly zcodeDir;
|
|
17
|
+
private readonly skillsDir;
|
|
18
|
+
constructor(ctx: InitContext);
|
|
19
|
+
protected ensureDirs(): Promise<void>;
|
|
20
|
+
protected writeSettings(): void;
|
|
21
|
+
protected writeMcp(): void;
|
|
22
|
+
protected copySkills(): Promise<void>;
|
|
23
|
+
protected copyCommands(): void;
|
|
24
|
+
protected copyAgents(): void;
|
|
25
|
+
protected injectPluginTemplates(): void;
|
|
26
|
+
protected writeHelpers(): Promise<void>;
|
|
27
|
+
/** 无对等面跳过:步骤名/原因入 `skipped`/`skipReasons`,并即时 dim 提示。 */
|
|
28
|
+
private skipNoFace;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"node:path";import{readdir as d,readFile as f}from"node:fs/promises";import{homedir as k}from"node:os";import{DEFAULT_SKILLS as u,HARNESS_DIRS as D,ensureDir as n,logger as p,resolveComponents as w,writeFileIfAbsent as y}from"@weavecode/core";import{templateRegistry as g}from"@weavecode/templates";import{InitPipeline as F,ZCODE_CAPTURE as S,zcodeConfigFile as N,zcodeHookScript as j}from"@weavecode/harness";import{WEAVE_VERSION as z}from"@weavecode/server";import{t as a}from"../../i18n/index.js";export class ZcodeInitTemplate extends F{records={created:{directories:[],files:[]},skipped:[],merged:[],updated:[],removed:[]};force;components;skills;zcodeDir;skillsDir;constructor(s){super(s);const i=w(s.preset,s.components),e=o.join(s.targetDir,D.zcode.projectDir);this.force=s.force,this.components=i,this.skills={...u,...s.skills},this.zcodeDir=e,this.skillsDir=o.join(e,"skills")}async ensureDirs(){await n(this.zcodeDir),this.records.created.directories.push(this.zcodeDir),this.components.skills&&(await n(this.skillsDir),this.records.created.directories.push(this.skillsDir))}writeSettings(){this.skipNoFace("writeSettings")}writeMcp(){this.skipNoFace("writeMcp")}async copySkills(){if(this.components.skills&&this.skills.core){const s=g.getSkillsSourceDir();await T(s,this.skillsDir,this.force,this.records)}}copyCommands(){this.skipNoFace("copyCommands")}copyAgents(){this.skipNoFace("copyAgents")}injectPluginTemplates(){this.skipNoFace("injectPluginTemplates")}async writeHelpers(){if(!this.components.helpers||!this.components.settings){this.skipNoFace("writeHelpers");return}await S.installUserCapture({version:z}),this.records.created.files.push(j(),N(k()))}skipNoFace(s){const i=a("init.noPeerFace");this.skip(s,i),p.dim(a("init.stepSkipped",{step:s,reason:i}))}}async function T(t,s,i,e){try{for(const r of await l(t)){const h=o.relative(t,r),c=o.join(s,h),m=await f(r,"utf-8");await y(c,m,i)?e.created.files.push(c):e.skipped.push(c)}}catch(r){p.warn(a("init.copyTemplatesFailed",{srcDir:t,error:String(r)}))}}async function l(t){const s=[];try{const i=await d(t,{withFileTypes:!0});for(const e of i){const r=o.join(t,e.name);e.isDirectory()?s.push(...await l(r)):s.push(r)}}catch{return s}return s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"node:path";import{lstat as m,mkdir as p,readFile as u,readlink as b,symlink as g,unlink as f,writeFile as y}from"node:fs/promises";import{INSTRUCTION_FILES as F}from"@weavecode/core";import{t as c}from"../i18n/index.js";const[n,s]=F;async function w(t){try{if((await m(t)).isSymbolicLink()){const a=await b(t);try{return await u(o.resolve(o.dirname(t),a)),{state:"link",target:a}}catch{return{state:"broken-link",target:a}}}return{state:"file"}}catch{return{state:"absent"}}}async function k(t,a,r){const l=o.join(t,a);try{await g(r,l,"file")}catch(e){const i=e.code;throw new Error(c("ilink.linkFailed",{link:a,target:r,path:l,detail:i==="EPERM"||i==="EACCES"||i==="UNKNOWN"?c("ilink.symlinkNotAllowed"):String(e)}))}}async function h(t,a){const r=o.join(t,".weave","backup");await p(r,{recursive:!0});const l=new Date().toISOString().replace(/[:.]/g,"-"),e=o.join(r,`${a}.${l}`);return await y(e,await u(o.join(t,a),"utf-8"),"utf-8"),e}export async function ensureInstructionLink(t,a){const r=o.join(t,n),l=o.join(t,s),e=await w(r),i=await w(l);if(e.state==="link"&&e.target===s&&i.state==="file")return{action:"unchanged",realFile:s};if((i.state==="link"||i.state==="broken-link")&&i.target===n)return{action:"unchanged",realFile:n};if(e.state==="absent"&&i.state==="file")return await k(t,n,s),{action:"adopted",realFile:s};if(i.state==="absent")return(e.state==="link"||e.state==="broken-link")&&await f(r),await k(t,s,n),{action:"created",realFile:n};if(!(a.force||await a.confirm(c("ilink.bothHaveContent"),c("ilink.replaceDetail",{backupDir:".weave/backup/"}))))return{action:"unchanged",realFile:n};const d=i.state==="file"?await h(t,s):void 0;return await f(l),await k(t,s,n),{action:"replaced",realFile:n,backedUpTo:d}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"node:path";import{readdir as
|
|
1
|
+
import o from"node:path";import{readdir as y,readFile as $}from"node:fs/promises";import{detectPlatform as w,WEAVE_PLUGIN_MANIFEST as P,WeavePluginManifestSchema as S}from"@weavecode/core";import{templateRegistry as j}from"@weavecode/templates";async function*g(f,m){const i=[m??o.join(w().configDir,"weave","plugins"),o.join(f,".weave","plugins")];for(const e of i){let s;try{s=await y(e)}catch{continue}for(const r of s){const t=o.join(e,r);let n;try{n=JSON.parse(await $(o.join(t,P),"utf8"))}catch{continue}const c=S.safeParse(n);c.success&&(yield{dir:t,manifest:c.data})}}}export async function registerPluginTemplates(f,m){const i=[],e=[];for await(const{dir:s,manifest:r}of g(f,m)){if(!r.templates)continue;const{id:t,templates:n}=r,c={skills:"skill",commands:"command",agents:"agent"};for(const[a,h]of Object.entries(n)){const l=c[a];if(l)for(const d of h??[]){const u=o.resolve(s,d);if(!u.startsWith(o.resolve(s)+o.sep)){e.push(d);continue}const v=o.basename(u).replace(/\.md$/,""),p={name:`${t}:${v}`,category:l,sourcePath:u,description:`${t} \u63D2\u4EF6\u6A21\u677F`};j.register(p)?i.push(p):e.push(p.name)}}}return{registered:i,skipped:e}}export async function collectPluginMcpServers(f,m,i=[]){const e={},s=[],r=new Set(i);for await(const{manifest:t}of g(f,m))if(t.mcpServers)for(const[n,c]of Object.entries(t.mcpServers)){let a=n;r.has(a)&&(a=`${t.id}-${n}`,s.push(`${n} \u2192 ${a}`)),r.add(a),e[a]=c}return{servers:e,renamed:s}}
|