openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 970 B
JavaScript
//!src/infra/git-maintenance-env.ts
const AUTO_MAINTENANCE_CONFIG=[[`maintenance.auto`,`false`],[`gc.auto`,`0`]];const AGENT_GIT_CONFIG_PARAMETERS=AUTO_MAINTENANCE_CONFIG.map(([e,t])=>`'${e}=${t}'`).join(` `);const gitMaintenanceEnvironment=(e={})=>appendGitConfig(e,AUTO_MAINTENANCE_CONFIG);function appendGitConfig(e,t){const n={...e};let r=Number(e.GIT_CONFIG_COUNT??0);for(const[e,i]of t){n[`GIT_CONFIG_KEY_${r}`]=e;n[`GIT_CONFIG_VALUE_${r++}`]=i}n.GIT_CONFIG_COUNT=String(r);return n}function gitMaintenanceEnvironmentExpression(e){const t=gitMaintenanceEnvironment();const n=Number(t.GIT_CONFIG_COUNT);const r=new Set(e.flatMap((e,t)=>[`GIT_CONFIG_KEY_${n+t}`,`GIT_CONFIG_VALUE_${n+t}`]));const i=appendGitConfig(t,e);return`{${Object.entries(i).map(([e,t])=>`${JSON.stringify(e)}: ${r.has(e)?t:JSON.stringify(t)}`).join(`, `)}}`}export{gitMaintenanceEnvironmentExpression as i,appendGitConfig as n,gitMaintenanceEnvironment as r,AGENT_GIT_CONFIG_PARAMETERS as t};