oh-my-agent 12.0.0 → 12.0.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/README.md +4 -0
- package/bin/cli.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,10 @@ Spawning parallel agents is the easy part. The hard part is knowing whether they
|
|
|
10
10
|
|
|
11
11
|
oh-my-agent makes the claim falsifiable. A Stop hook refuses to end your session until your project's own `typecheck` / `test` / `lint` script exits 0. A gate command decides whether a workflow really ran by looking for the artifacts it must have left behind — and its JSON verdict, not the agent's summary, is the result. An independent judge with a fresh context re-verifies every criterion each round, including the ones that already passed. Every gate decision lands on an append-only event log you can read after the fact. Then it runs that same discipline across a dozen agent runtimes from one portable `.agents/` directory.
|
|
12
12
|
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
[Watch the full video (35s)](https://github.com/first-fluke/oh-my-agent/blob/main/docs/assets/video/oh-my-agent-explainer.mp4)
|
|
16
|
+
|
|
13
17
|
## Verification, Not Narration
|
|
14
18
|
|
|
15
19
|
Each mechanism below is mechanical: a command exits 0 or it doesn't, a file is on disk or it isn't. No LLM is asked whether the work "looks correct."
|
package/bin/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ Expecting one of '${G.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycl
|
|
|
24
24
|
`),this.outputHelp({error:!0});let G=z||{},J=G.exitCode||1,Q=G.code||"commander.error";this._exit(J,Q,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in q4.env){let z=$.attributeName();if(this.getOptionValue(z)===void 0||["default","config","env"].includes(this.getOptionValueSource(z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,q4.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new Qh(this.options),z=(G)=>{return this.getOptionValue(G)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(G))};this.options.filter((G)=>G.implied!==void 0&&z(G.attributeName())&&$.valueFromOption(this.getOptionValue(G.attributeName()),G)).forEach((G)=>{Object.keys(G.implied).filter((J)=>!z(J)).forEach((J)=>{this.setOptionValueWithSource(J,G.implied[J],"implied")})})}missingArgument($){let z=`error: missing required argument '${$}'`;this.error(z,{code:"commander.missingArgument"})}optionMissingArgument($){let z=`error: option '${$.flags}' argument missing`;this.error(z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let z=`error: required option '${$.flags}' not specified`;this.error(z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,z){let G=(U)=>{let K=U.attributeName(),Z=this.getOptionValue(K),W=this.options.find((B)=>B.negate&&K===B.attributeName()),k=this.options.find((B)=>!B.negate&&K===B.attributeName());if(W&&(W.presetArg===void 0&&Z===!1||W.presetArg!==void 0&&Z===W.presetArg))return W;return k||U},J=(U)=>{let K=G(U),Z=K.attributeName();if(this.getOptionValueSource(Z)==="env")return`environment variable '${K.envVar}'`;return`option '${K.flags}'`},Q=`error: ${J($)} cannot be used with ${J(z)}`;this.error(Q,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let z="";if($.startsWith("--")&&this._showSuggestionAfterError){let J=[],Q=this;do{let U=Q.createHelp().visibleOptions(Q).filter((K)=>K.long).map((K)=>K.long);J=J.concat(U),Q=Q.parent}while(Q&&!Q._enablePositionalOptions);z=Kh($,J)}let G=`error: unknown option '${$}'${z}`;this.error(G,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let z=this.registeredArguments.length,G=z===1?"":"s",J=$.length,Q=this.parent?` for '${this.name()}'`:"",U=$.join(", "),K=`error: too many arguments${Q}. Expected ${z} argument${G} but got ${J}: ${U}.`;this.error(K,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],z="";if(this._showSuggestionAfterError){let J=[];this.createHelp().visibleCommands(this).forEach((Q)=>{if(J.push(Q.name()),Q.alias())J.push(Q.alias())}),z=Kh($,J)}let G=`error: unknown command '${$}'${z}`;this.error(G,{code:"commander.unknownCommand"})}version($,z,G){if($===void 0)return this._version;this._version=$,z=z||"-V, --version",G=G||"output the version number";let J=this.createOption(z,G);return this._versionOptionName=J.attributeName(),this._registerOption(J),this.on("option:"+J.name(),()=>{this._outputConfiguration.writeOut(`${$}
|
|
25
25
|
`),this._exit(0,"commander.version",$)}),this}description($,z){if($===void 0&&z===void 0)return this._description;if(this._description=$,z)this._argsDescription=z;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)z=this.commands[this.commands.length-1];if($===z._name)throw Error("Command alias can't be the same as its name");let G=this.parent?._findCommand($);if(G){let J=[G.name()].concat(G.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${J}'`)}return z._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((z)=>this.alias(z)),this}usage($){if($===void 0){if(this._usage)return this._usage;let z=this.registeredArguments.map((G)=>{return Pu(G)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=Uz.basename($,Uz.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let z=this.createHelp(),G=this._getOutputContext($);z.prepareContext({error:G.error,helpWidth:G.helpWidth,outputHasColors:G.hasColors});let J=z.formatHelp(this,z);if(G.hasColors)return J;return this._outputConfiguration.stripColor(J)}_getOutputContext($){$=$||{};let z=!!$.error,G,J,Q;if(z)G=(K)=>this._outputConfiguration.writeErr(K),J=this._outputConfiguration.getErrHasColors(),Q=this._outputConfiguration.getErrHelpWidth();else G=(K)=>this._outputConfiguration.writeOut(K),J=this._outputConfiguration.getOutHasColors(),Q=this._outputConfiguration.getOutHelpWidth();return{error:z,write:(K)=>{if(!J)K=this._outputConfiguration.stripColor(K);return G(K)},hasColors:J,helpWidth:Q}}outputHelp($){let z;if(typeof $==="function")z=$,$=void 0;let G=this._getOutputContext($),J={error:G.error,write:G.write,command:this};this._getCommandAndAncestors().reverse().forEach((U)=>U.emit("beforeAllHelp",J)),this.emit("beforeHelp",J);let Q=this.helpInformation({error:G.error});if(z){if(Q=z(Q),typeof Q!=="string"&&!Buffer.isBuffer(Q))throw Error("outputHelp callback must return a string or a Buffer")}if(G.write(Q),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",J),this._getCommandAndAncestors().forEach((U)=>U.emit("afterAllHelp",J))}helpOption($,z){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",z??"display help for command"),$||z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let z=Number(q4.exitCode??0);if(z===0&&$&&typeof $!=="function"&&$.error)z=1;this._exit(z,"commander.help","(outputHelp)")}addHelpText($,z){let G=["beforeAll","before","after","afterAll"];if(!G.includes($))throw Error(`Unexpected value for position to addHelpText.
|
|
26
26
|
Expecting one of '${G.join("', '")}'`);let J=`${$}Help`;return this.on(J,(Q)=>{let U;if(typeof z==="function")U=z({error:Q.error,command:Q.command});else U=z;if(U)Q.write(`${U}
|
|
27
|
-
`)}),this}_outputHelpIfRequested($){let z=this._getHelpOption();if(z&&$.find((J)=>z.is(J)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}});var xX4;var Wh=q(()=>{Eu();OQ2();TX();Jh();Uh();xX4=new bG});var EX;var kh=q(()=>{EX={name:"oh-my-agent",version:"12.0.0",description:"Portable multi-agent harness for .agents-based skills and workflows across Antigravity, Claude Code, Codex, OpenCode, and more",type:"module",bin:{"oh-my-agent":"./bin/cli.js",oma:"./bin/cli.js"},files:["bin"],keywords:["oh-my-agent","antigravity",".agents","agent","skills","agent-skills","multi-agent","orchestrator","claude","claude-code","codex","opencode","copilot","cursor","chatgpt","pm","frontend","backend","mobile","qa","debug","terraform","database","workflow","bug-fixing"],author:"our.first.fluke <our.first.fluke@gmail.com>",contributors:["gracefullight <gracefullight.dev@gmail.com>","gahyun-git <go4it.gh@gmail.com>"],license:"MIT",funding:[{type:"github",url:"https://github.com/sponsors/first-fluke"},{type:"buymeacoffee",url:"https://buymeacoffee.com/firstfluke"}],scripts:{"sync:readme":"node ./scripts/sync-readme.mjs","generate:skill-data":"node ./scripts/generate-skill-data.mjs",build:"bun run generate:skill-data && bun run sync:readme && bun build cli.ts --outfile bin/cli.js --target node --minify --external @napi-rs/keyring",dev:"bun run generate:skill-data && bun run cli.ts",lint:"biome check .","lint:fix":"biome check --write --unsafe .","check:boundaries":"node ./scripts/check-boundaries.mjs","check:emit-drift":"node ./scripts/check-emit-drift.mjs",test:"vitest run","test:coverage":"vitest run --coverage",prepublishOnly:"bun run build"},dependencies:{"@clack/prompts":"^1.7.0","@date-fns/tz":"^1.5.0","@napi-rs/keyring":"^1.3.0",axios:"^1.18.1","better-sqlite3":"^13.0.2",chokidar:"^5.0.0",commander:"^15.0.0","date-fns":"^4.4.0",eld:"^2.0.3","fast-xml-parser":"^5.10.1",minimatch:"^10.2.6","p-map":"^7.0.6",picocolors:"^1.1.1","puppeteer-core":"^25.4.0",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-parse":"^11.0.0","smol-toml":"^1.7.1",unified:"^11.0.5",ws:"^8.21.1",yaml:"^2.9.0",zod:"^4.4.3"},optionalDependencies:{pptxgenjs:"^4.0.1"},devDependencies:{"@biomejs/biome":"^2.5.6","@types/better-sqlite3":"^7.6.13","@types/mdast":"^4.0.4","@types/node":"^26.1.2","@types/ws":"^8.18.1","@vitest/coverage-v8":"^4.1.10",typescript:"^7.0.2",vitest:"^4.1.10"},repository:{type:"git",url:"https://github.com/first-fluke/oh-my-agent"},homepage:"https://firstfluke.com/oh-my-agent",bugs:{url:"https://github.com/first-fluke/oh-my-agent/issues"},antigravity:{skillsPath:".agents/skills",skills:["oma-architecture","oma-brainstorm","oma-coordination","oma-pm","oma-frontend","oma-backend","oma-db","oma-mobile","oma-qa","oma-debug","oma-orchestrator","oma-dev-workflow","oma-tf-infra","oma-scm","oma-pdf","oma-recap"]}}});import*as TW from"node:fs";import{homedir as sz5}from"node:os";import*as bX from"node:path";function vQ2($){if(xu)throw Error("install context already set in this process");xu=$}function RQ2(){if(xu===null)throw Error("install context not set — entry point must call setInstallContext()");return xu}function FU(){return RQ2().installRoot}function g7(){return RQ2().mode}function VU(){try{return g7()}catch{return"project"}}function PW(){try{return FU()}catch{return process.cwd()}}function wQ2($){let z=process.env.OMA_HOME,G=$.global===!0||process.env.OMA_INSTALL_GLOBAL==="1";if(z!==void 0&&z!=="")return tz5(z),{installRoot:z,mode:G?"global":"project"};if(G)return{installRoot:sz5(),mode:"global"};return{installRoot:process.cwd(),mode:"project"}}function tz5($){if(!bX.isAbsolute($))throw Error("OMA_HOME must be absolute path");for(let G of IQ2)if($===G||$.startsWith(G+bX.sep))throw Error(`OMA_HOME=${$} is forbidden (system path ${G})`);let z;try{z=TW.realpathSync($)}catch(G){let J=G instanceof Error?G.message:String(G);throw Error(`OMA_HOME=${$}: ${J}`)}for(let G of IQ2)if(z===G||z.startsWith(G+bX.sep))throw Error(`OMA_HOME=${z} is forbidden (system path ${G})`);try{TW.accessSync(z,TW.constants.W_OK)}catch{throw Error(`OMA_HOME=${z} is not writable`)}}var xu=null,IQ2;var h8=q(()=>{IQ2=["/etc","/usr","/bin","/boot","/sys","/proc"]});import{join as ez5}from"node:path";function XU($){return $.endsWith("/")?$:`${$}/`}function d3($,z){let G=z.split("/").filter((J)=>J.length>0);return ez5($,...G)}var g8=".agents",yu,G3,_G,CQ2,TQ2,Su,$G5=".antigravitycli",PQ2,zG5=".migration-backup",GG5="docs/plans",JG5=".qwen/tmp",QG5,UG5,KG5,ZG5,WG5,kG5,BG5,Bh;var J3=q(()=>{yu=`${g8}/skills`,G3=`${g8}/results`,_G=`${g8}/state`,CQ2=`${_G}/sessions`,TQ2=`${_G}/retry`,Su=`${_G}/archive`,PQ2=`${g8}/backup`;QG5=XU(G3),UG5=XU(_G),KG5=XU($G5),ZG5=XU(PQ2),WG5=XU(zG5),kG5=XU(GG5),BG5=XU(JG5),Bh=[KG5,QG5,UG5,ZG5,kG5,WG5,BG5]});var V1="first-fluke/oh-my-agent",N4,f8,hu,YG5,FG5,Kz,x1;var S0=q(()=>{J3();N4=yu,f8=["antigravity","claude","codex","commandcode","cursor","grok","kimi","kiro","qwen"],hu=["pi","opencode"],YG5=["copilot","hermes"],FG5=["zcode"],Kz=[...f8,...YG5,...FG5].sort(),x1={antigravity:{projectPath:".gemini/antigravity-cli/skills",homePath:".gemini/antigravity-cli/skills",requiresHomeConsent:!0},claude:{projectPath:".claude/skills",homePath:".claude/skills"},codex:{projectPath:".codex/skills",homePath:".codex/skills"},commandcode:{projectPath:".commandcode/skills",homePath:".commandcode/skills",optIn:!0},copilot:{projectPath:".github/skills",homePath:".copilot/skills"},cursor:{projectPath:".cursor/skills",homePath:".cursor/skills"},hermes:{projectPath:".hermes/skills/oma",homePath:".hermes/skills/oma",requiresHomeConsent:!0},kimi:{projectPath:".kimi-code/skills",homePath:".kimi-code/skills",requiresHomeConsent:!0,optIn:!0},kiro:{projectPath:".kiro/skills",homePath:".kiro/skills",optIn:!0},opencode:{projectPath:".opencode/skills",homePath:".opencode/skills"},qwen:{projectPath:".qwen/skills",homePath:".qwen/skills"}}});var hQ2={};C2(hQ2,{runAction:()=>X2,resolveJsonMode:()=>s2,printDescribe:()=>IG5,addOutputOptions:()=>e2});function e2($,z="Output as JSON"){return $.option("--json",z).option("--output <format>","Output format (text/json)",(G)=>{let J=G.trim().toLowerCase();if(!_X.includes(J))throw Error(`Invalid output format: ${G}. Expected one of ${_X.join(", ")}`);return J})}function VG5($){if($?.json)return"json";let z=$?.output?.trim().toLowerCase();if(z&&_X.includes(z))return z;if(process.env[_Q2]?.trim().toLowerCase()==="json")return"json";return"text"}function s2($){return VG5($)==="json"}function xQ2($){let z=$.at(-1);return z instanceof bG?z:null}function XG5($){let z=xQ2($);if(z)return z.opts();let G=$.at(-1);return G&&typeof G==="object"?G:{}}function HG5($){if($ instanceof Error)return $.message;return String($)}function xG($){throw Error($)}function Fh($,z){for(let G of $){let J=G.charCodeAt(0);if(J>=0&&J<=31||J===127)xG(`${z} must not contain control characters`)}}function LG5($,z){if(Fh($,z),/[?#%]/.test($))xG(`${z} must not contain ?, #, or %`);if($.includes(".."))xG(`${z} must not contain '..'`)}function qG5($,z){Fh($,z);try{new URL($)}catch{xG(`${z} must be a valid absolute URL`)}}function Yh($,z,G="text"){if(typeof $==="string"){if(G==="identifier"){LG5($,z);return}if(G==="url"){qG5($,z);return}Fh($,z);return}if(Array.isArray($))for(let[J,Q]of $.entries())Yh(Q,`${z}[${J}]`,G)}function bQ2($){let z=$.toLowerCase();if(z==="url"||z.endsWith("url"))return"url";if(z.includes("id")||z.includes("type")||z.includes("vendor")||z.includes("session"))return"identifier";return"text"}function NG5($){let z=$.vendor;if(typeof z==="string"){if(z.split(",").map((U)=>U.trim()).filter(Boolean).filter((U)=>!Kz.includes(U)).length>0)xG(`vendor must be one of ${Kz.join(", ")}`)}let G=$.output;if(typeof G==="string"&&!_X.includes(G))xG(`output must be one of ${_X.join(", ")}`)}function AG5($){let z=$.processedArgs??$.args??[];($.registeredArguments??[]).forEach((Q,U)=>{let K=Q.name?.()||String(U),Z=z[U];if(Yh(Z,K,bQ2(K)),K==="agent-type"&&typeof Z==="string"&&!EQ2.includes(Z))xG(`agent-type must be one of ${EQ2.join(", ")}`)});let J=$.opts();NG5(J);for(let[Q,U]of Object.entries(J))Yh(U,Q,bQ2(Q))}function DG5($){return($.registeredArguments??[]).map((z)=>({name:z.name?.()||"",required:!!z.required,variadic:!!z.variadic}))}function jG5($){return $.options.map((z)=>({flags:z.flags,long:z.long||void 0,short:z.short||void 0,description:z.description||"",required:!!z.required||!!z.mandatory,optional:!!z.optional,defaultValue:z.defaultValue}))}function yQ2($){let z=[],G=$;while(G?.parent)z.unshift(G.name()),G=G.parent;return z.join(" ")}function uG5($){return $.options.some((z)=>z.long==="--json"||z.long==="--output")}function MG5($){return $.options.some((z)=>z.long==="--dry-run")}function SQ2($){return{name:$.name(),path:yQ2($),summary:$.summary()||void 0,description:$.description(),arguments:DG5($),options:jG5($),supportsJsonOutput:uG5($),supportsDryRun:MG5($),subcommands:$.commands.map((z)=>SQ2(z))}}function OG5($,z){if(!z?.trim())return $;let G=z.trim(),J=[...$.commands];while(J.length>0){let Q=J.shift();if(!Q)continue;if(Q.name()===G||yQ2(Q)===G)return Q;J.push(...Q.commands)}return null}function IG5($,z){let G=OG5($,z);if(!G)xG(`Unknown command: ${z}`);let J={name:$.name(),version:$.version(),description:$.description(),env:{[_Q2]:"Set to json to force machine-readable output on commands that support it."},command:SQ2(G)};console.log(JSON.stringify(J,null,2))}function X2($,z={}){return async(...G)=>{let J=xQ2(G);if(J&&G.length>=2)G[G.length-2]=J.optsWithGlobals();let Q=XG5(G);try{if(J)AG5(J);await $(...G)}catch(U){let K=HG5(U);if(z.supportsJsonOutput&&s2(Q))console.log(JSON.stringify({error:K},null,2));else console.error(K);process.exitCode=1}}}var _Q2="OH_MY_AG_OUTPUT_FORMAT",_X,EQ2;var Z4=q(()=>{Wh();S0();_X=["text","json"],EQ2=["backend","frontend","mobile","qa","debug","pm"]});var gQ2,fQ2=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},mQ2=($)=>{return $===8987||$===9001||$>=12272&&$<=12287||$>=12289&&$<=12350||$>=12441&&$<=12543||$>=12549&&$<=12591||$>=12593&&$<=12686||$>=12688&&$<=12771||$>=12783&&$<=12830||$>=12832&&$<=12871||$>=12880&&$<=19903||$>=65040&&$<=65049||$>=65072&&$<=65106||$>=65108&&$<=65126||$>=65128&&$<=65131||$>=127488&&$<=127490||$>=127504&&$<=127547||$>=127552&&$<=127560||$>=131072&&$<=196605||$>=196608&&$<=262141};var iQ2=q(()=>{gQ2=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(z)=>{let G=0;$.lastIndex=0;while($.test(z))G+=1;return z.length-G}})()});var vG5,RG5,cQ2,wG5,lQ2,CG5,TG5,PG5,pQ2=($,z={},G={})=>{let J=z.limit??1/0,Q=z.ellipsis??"",U=z?.ellipsisWidth??(Q?pQ2(Q,PG5,G).width:0),K=0,Z=G.controlWidth??0,W=G.tabWidth??8,k=G.emojiWidth??2,B=2,Y=G.regularWidth??1,F=G.wideWidth??2,V=[[CG5,Y],[vG5,0],[RG5,Z],[wG5,W],[lQ2,k],[cQ2,F]],X=0,H=0,L=$.length,N=0,A=!1,D=L,u=Math.max(0,J-U),v=0,j=0,M=0,O=0;$:while(!0){if(j>v||H>=L&&H>X){let w=$.slice(v,j)||$.slice(X,H);N=0;for(let T of w.replaceAll(TG5,"")){let I=T.codePointAt(0)||0;if(fQ2(I))O=2;else if(mQ2(I))O=F;else O=Y;if(M+O>u)D=Math.min(D,Math.max(v,X)+N);if(M+O>J){A=!0;break $}N+=T.length,M+=O}v=j=0}if(H>=L)break $;for(let w=0,T=V.length;w<T;w++){let[I,R]=V[w];if(I.lastIndex=H,I.test($)){if(N=I===cQ2?gQ2($.slice(H,I.lastIndex)):I===lQ2?1:I.lastIndex-H,O=N*R,M+O>u)D=Math.min(D,H+Math.floor((u-M)/R));if(M+O>J){A=!0;break $}M+=O,v=X,j=H,H=X=I.lastIndex;continue $}}H+=1}return{width:A?u:M,index:A?D:L,truncated:A,ellipsed:A&&J>=U}},dQ2;var nQ2=q(()=>{iQ2();vG5=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,RG5=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,cQ2=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,wG5=/\t{1,1000}/y,lQ2=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,CG5=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,TG5=/\p{M}+/gu,PG5={limit:1/0,ellipsis:""},dQ2=pQ2});var EG5,bG5=($,z={})=>{return dQ2($,EG5,z).width},f7;var Vh=q(()=>{nQ2();EG5={limit:1/0,ellipsis:"",ellipsisWidth:0},f7=bG5});function h0($,z,G){return String($).normalize().split(hG5).map((J)=>SG5(J,z,G)).join(`
|
|
27
|
+
`)}),this}_outputHelpIfRequested($){let z=this._getHelpOption();if(z&&$.find((J)=>z.is(J)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}});var xX4;var Wh=q(()=>{Eu();OQ2();TX();Jh();Uh();xX4=new bG});var EX;var kh=q(()=>{EX={name:"oh-my-agent",version:"12.0.2",description:"Portable multi-agent harness for .agents-based skills and workflows across Antigravity, Claude Code, Codex, OpenCode, and more",type:"module",bin:{"oh-my-agent":"./bin/cli.js",oma:"./bin/cli.js"},files:["bin"],keywords:["oh-my-agent","antigravity",".agents","agent","skills","agent-skills","multi-agent","orchestrator","claude","claude-code","codex","opencode","copilot","cursor","chatgpt","pm","frontend","backend","mobile","qa","debug","terraform","database","workflow","bug-fixing"],author:"our.first.fluke <our.first.fluke@gmail.com>",contributors:["gracefullight <gracefullight.dev@gmail.com>","gahyun-git <go4it.gh@gmail.com>"],license:"MIT",funding:[{type:"github",url:"https://github.com/sponsors/first-fluke"},{type:"buymeacoffee",url:"https://buymeacoffee.com/firstfluke"}],scripts:{"sync:readme":"node ./scripts/sync-readme.mjs","generate:skill-data":"node ./scripts/generate-skill-data.mjs",build:"bun run generate:skill-data && bun run sync:readme && bun build cli.ts --outfile bin/cli.js --target node --minify --external @napi-rs/keyring",dev:"bun run generate:skill-data && bun run cli.ts",lint:"biome check .","lint:fix":"biome check --write --unsafe .","check:boundaries":"node ./scripts/check-boundaries.mjs","check:emit-drift":"node ./scripts/check-emit-drift.mjs",test:"vitest run","test:coverage":"vitest run --coverage",prepublishOnly:"bun run build"},dependencies:{"@clack/prompts":"^1.7.0","@date-fns/tz":"^1.5.0","@napi-rs/keyring":"^1.3.0",axios:"^1.18.1","better-sqlite3":"^13.0.2",chokidar:"^5.0.0",commander:"^15.0.0","date-fns":"^4.4.0",eld:"^2.0.3","fast-xml-parser":"^5.10.1",minimatch:"^10.2.6","p-map":"^7.0.6",picocolors:"^1.1.1","puppeteer-core":"^25.4.0",remark:"^15.0.1","remark-frontmatter":"^5.0.0","remark-parse":"^11.0.0","smol-toml":"^1.7.1",unified:"^11.0.5",ws:"^8.21.1",yaml:"^2.9.0",zod:"^4.4.3"},optionalDependencies:{pptxgenjs:"^4.0.1"},devDependencies:{"@biomejs/biome":"^2.5.6","@types/better-sqlite3":"^7.6.13","@types/mdast":"^4.0.4","@types/node":"^26.1.2","@types/ws":"^8.18.1","@vitest/coverage-v8":"^4.1.10",typescript:"^7.0.2",vitest:"^4.1.10"},repository:{type:"git",url:"https://github.com/first-fluke/oh-my-agent"},homepage:"https://firstfluke.com/oh-my-agent",bugs:{url:"https://github.com/first-fluke/oh-my-agent/issues"},antigravity:{skillsPath:".agents/skills",skills:["oma-architecture","oma-brainstorm","oma-coordination","oma-pm","oma-frontend","oma-backend","oma-db","oma-mobile","oma-qa","oma-debug","oma-orchestrator","oma-dev-workflow","oma-tf-infra","oma-scm","oma-pdf","oma-recap"]}}});import*as TW from"node:fs";import{homedir as sz5}from"node:os";import*as bX from"node:path";function vQ2($){if(xu)throw Error("install context already set in this process");xu=$}function RQ2(){if(xu===null)throw Error("install context not set — entry point must call setInstallContext()");return xu}function FU(){return RQ2().installRoot}function g7(){return RQ2().mode}function VU(){try{return g7()}catch{return"project"}}function PW(){try{return FU()}catch{return process.cwd()}}function wQ2($){let z=process.env.OMA_HOME,G=$.global===!0||process.env.OMA_INSTALL_GLOBAL==="1";if(z!==void 0&&z!=="")return tz5(z),{installRoot:z,mode:G?"global":"project"};if(G)return{installRoot:sz5(),mode:"global"};return{installRoot:process.cwd(),mode:"project"}}function tz5($){if(!bX.isAbsolute($))throw Error("OMA_HOME must be absolute path");for(let G of IQ2)if($===G||$.startsWith(G+bX.sep))throw Error(`OMA_HOME=${$} is forbidden (system path ${G})`);let z;try{z=TW.realpathSync($)}catch(G){let J=G instanceof Error?G.message:String(G);throw Error(`OMA_HOME=${$}: ${J}`)}for(let G of IQ2)if(z===G||z.startsWith(G+bX.sep))throw Error(`OMA_HOME=${z} is forbidden (system path ${G})`);try{TW.accessSync(z,TW.constants.W_OK)}catch{throw Error(`OMA_HOME=${z} is not writable`)}}var xu=null,IQ2;var h8=q(()=>{IQ2=["/etc","/usr","/bin","/boot","/sys","/proc"]});import{join as ez5}from"node:path";function XU($){return $.endsWith("/")?$:`${$}/`}function d3($,z){let G=z.split("/").filter((J)=>J.length>0);return ez5($,...G)}var g8=".agents",yu,G3,_G,CQ2,TQ2,Su,$G5=".antigravitycli",PQ2,zG5=".migration-backup",GG5="docs/plans",JG5=".qwen/tmp",QG5,UG5,KG5,ZG5,WG5,kG5,BG5,Bh;var J3=q(()=>{yu=`${g8}/skills`,G3=`${g8}/results`,_G=`${g8}/state`,CQ2=`${_G}/sessions`,TQ2=`${_G}/retry`,Su=`${_G}/archive`,PQ2=`${g8}/backup`;QG5=XU(G3),UG5=XU(_G),KG5=XU($G5),ZG5=XU(PQ2),WG5=XU(zG5),kG5=XU(GG5),BG5=XU(JG5),Bh=[KG5,QG5,UG5,ZG5,kG5,WG5,BG5]});var V1="first-fluke/oh-my-agent",N4,f8,hu,YG5,FG5,Kz,x1;var S0=q(()=>{J3();N4=yu,f8=["antigravity","claude","codex","commandcode","cursor","grok","kimi","kiro","qwen"],hu=["pi","opencode"],YG5=["copilot","hermes"],FG5=["zcode"],Kz=[...f8,...YG5,...FG5].sort(),x1={antigravity:{projectPath:".gemini/antigravity-cli/skills",homePath:".gemini/antigravity-cli/skills",requiresHomeConsent:!0},claude:{projectPath:".claude/skills",homePath:".claude/skills"},codex:{projectPath:".codex/skills",homePath:".codex/skills"},commandcode:{projectPath:".commandcode/skills",homePath:".commandcode/skills",optIn:!0},copilot:{projectPath:".github/skills",homePath:".copilot/skills"},cursor:{projectPath:".cursor/skills",homePath:".cursor/skills"},hermes:{projectPath:".hermes/skills/oma",homePath:".hermes/skills/oma",requiresHomeConsent:!0},kimi:{projectPath:".kimi-code/skills",homePath:".kimi-code/skills",requiresHomeConsent:!0,optIn:!0},kiro:{projectPath:".kiro/skills",homePath:".kiro/skills",optIn:!0},opencode:{projectPath:".opencode/skills",homePath:".opencode/skills"},qwen:{projectPath:".qwen/skills",homePath:".qwen/skills"}}});var hQ2={};C2(hQ2,{runAction:()=>X2,resolveJsonMode:()=>s2,printDescribe:()=>IG5,addOutputOptions:()=>e2});function e2($,z="Output as JSON"){return $.option("--json",z).option("--output <format>","Output format (text/json)",(G)=>{let J=G.trim().toLowerCase();if(!_X.includes(J))throw Error(`Invalid output format: ${G}. Expected one of ${_X.join(", ")}`);return J})}function VG5($){if($?.json)return"json";let z=$?.output?.trim().toLowerCase();if(z&&_X.includes(z))return z;if(process.env[_Q2]?.trim().toLowerCase()==="json")return"json";return"text"}function s2($){return VG5($)==="json"}function xQ2($){let z=$.at(-1);return z instanceof bG?z:null}function XG5($){let z=xQ2($);if(z)return z.opts();let G=$.at(-1);return G&&typeof G==="object"?G:{}}function HG5($){if($ instanceof Error)return $.message;return String($)}function xG($){throw Error($)}function Fh($,z){for(let G of $){let J=G.charCodeAt(0);if(J>=0&&J<=31||J===127)xG(`${z} must not contain control characters`)}}function LG5($,z){if(Fh($,z),/[?#%]/.test($))xG(`${z} must not contain ?, #, or %`);if($.includes(".."))xG(`${z} must not contain '..'`)}function qG5($,z){Fh($,z);try{new URL($)}catch{xG(`${z} must be a valid absolute URL`)}}function Yh($,z,G="text"){if(typeof $==="string"){if(G==="identifier"){LG5($,z);return}if(G==="url"){qG5($,z);return}Fh($,z);return}if(Array.isArray($))for(let[J,Q]of $.entries())Yh(Q,`${z}[${J}]`,G)}function bQ2($){let z=$.toLowerCase();if(z==="url"||z.endsWith("url"))return"url";if(z.includes("id")||z.includes("type")||z.includes("vendor")||z.includes("session"))return"identifier";return"text"}function NG5($){let z=$.vendor;if(typeof z==="string"){if(z.split(",").map((U)=>U.trim()).filter(Boolean).filter((U)=>!Kz.includes(U)).length>0)xG(`vendor must be one of ${Kz.join(", ")}`)}let G=$.output;if(typeof G==="string"&&!_X.includes(G))xG(`output must be one of ${_X.join(", ")}`)}function AG5($){let z=$.processedArgs??$.args??[];($.registeredArguments??[]).forEach((Q,U)=>{let K=Q.name?.()||String(U),Z=z[U];if(Yh(Z,K,bQ2(K)),K==="agent-type"&&typeof Z==="string"&&!EQ2.includes(Z))xG(`agent-type must be one of ${EQ2.join(", ")}`)});let J=$.opts();NG5(J);for(let[Q,U]of Object.entries(J))Yh(U,Q,bQ2(Q))}function DG5($){return($.registeredArguments??[]).map((z)=>({name:z.name?.()||"",required:!!z.required,variadic:!!z.variadic}))}function jG5($){return $.options.map((z)=>({flags:z.flags,long:z.long||void 0,short:z.short||void 0,description:z.description||"",required:!!z.required||!!z.mandatory,optional:!!z.optional,defaultValue:z.defaultValue}))}function yQ2($){let z=[],G=$;while(G?.parent)z.unshift(G.name()),G=G.parent;return z.join(" ")}function uG5($){return $.options.some((z)=>z.long==="--json"||z.long==="--output")}function MG5($){return $.options.some((z)=>z.long==="--dry-run")}function SQ2($){return{name:$.name(),path:yQ2($),summary:$.summary()||void 0,description:$.description(),arguments:DG5($),options:jG5($),supportsJsonOutput:uG5($),supportsDryRun:MG5($),subcommands:$.commands.map((z)=>SQ2(z))}}function OG5($,z){if(!z?.trim())return $;let G=z.trim(),J=[...$.commands];while(J.length>0){let Q=J.shift();if(!Q)continue;if(Q.name()===G||yQ2(Q)===G)return Q;J.push(...Q.commands)}return null}function IG5($,z){let G=OG5($,z);if(!G)xG(`Unknown command: ${z}`);let J={name:$.name(),version:$.version(),description:$.description(),env:{[_Q2]:"Set to json to force machine-readable output on commands that support it."},command:SQ2(G)};console.log(JSON.stringify(J,null,2))}function X2($,z={}){return async(...G)=>{let J=xQ2(G);if(J&&G.length>=2)G[G.length-2]=J.optsWithGlobals();let Q=XG5(G);try{if(J)AG5(J);await $(...G)}catch(U){let K=HG5(U);if(z.supportsJsonOutput&&s2(Q))console.log(JSON.stringify({error:K},null,2));else console.error(K);process.exitCode=1}}}var _Q2="OH_MY_AG_OUTPUT_FORMAT",_X,EQ2;var Z4=q(()=>{Wh();S0();_X=["text","json"],EQ2=["backend","frontend","mobile","qa","debug","pm"]});var gQ2,fQ2=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},mQ2=($)=>{return $===8987||$===9001||$>=12272&&$<=12287||$>=12289&&$<=12350||$>=12441&&$<=12543||$>=12549&&$<=12591||$>=12593&&$<=12686||$>=12688&&$<=12771||$>=12783&&$<=12830||$>=12832&&$<=12871||$>=12880&&$<=19903||$>=65040&&$<=65049||$>=65072&&$<=65106||$>=65108&&$<=65126||$>=65128&&$<=65131||$>=127488&&$<=127490||$>=127504&&$<=127547||$>=127552&&$<=127560||$>=131072&&$<=196605||$>=196608&&$<=262141};var iQ2=q(()=>{gQ2=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(z)=>{let G=0;$.lastIndex=0;while($.test(z))G+=1;return z.length-G}})()});var vG5,RG5,cQ2,wG5,lQ2,CG5,TG5,PG5,pQ2=($,z={},G={})=>{let J=z.limit??1/0,Q=z.ellipsis??"",U=z?.ellipsisWidth??(Q?pQ2(Q,PG5,G).width:0),K=0,Z=G.controlWidth??0,W=G.tabWidth??8,k=G.emojiWidth??2,B=2,Y=G.regularWidth??1,F=G.wideWidth??2,V=[[CG5,Y],[vG5,0],[RG5,Z],[wG5,W],[lQ2,k],[cQ2,F]],X=0,H=0,L=$.length,N=0,A=!1,D=L,u=Math.max(0,J-U),v=0,j=0,M=0,O=0;$:while(!0){if(j>v||H>=L&&H>X){let w=$.slice(v,j)||$.slice(X,H);N=0;for(let T of w.replaceAll(TG5,"")){let I=T.codePointAt(0)||0;if(fQ2(I))O=2;else if(mQ2(I))O=F;else O=Y;if(M+O>u)D=Math.min(D,Math.max(v,X)+N);if(M+O>J){A=!0;break $}N+=T.length,M+=O}v=j=0}if(H>=L)break $;for(let w=0,T=V.length;w<T;w++){let[I,R]=V[w];if(I.lastIndex=H,I.test($)){if(N=I===cQ2?gQ2($.slice(H,I.lastIndex)):I===lQ2?1:I.lastIndex-H,O=N*R,M+O>u)D=Math.min(D,H+Math.floor((u-M)/R));if(M+O>J){A=!0;break $}M+=O,v=X,j=H,H=X=I.lastIndex;continue $}}H+=1}return{width:A?u:M,index:A?D:L,truncated:A,ellipsed:A&&J>=U}},dQ2;var nQ2=q(()=>{iQ2();vG5=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,RG5=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,cQ2=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,wG5=/\t{1,1000}/y,lQ2=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,CG5=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,TG5=/\p{M}+/gu,PG5={limit:1/0,ellipsis:""},dQ2=pQ2});var EG5,bG5=($,z={})=>{return dQ2($,EG5,z).width},f7;var Vh=q(()=>{nQ2();EG5={limit:1/0,ellipsis:"",ellipsisWidth:0},f7=bG5});function h0($,z,G){return String($).normalize().split(hG5).map((J)=>SG5(J,z,G)).join(`
|
|
28
28
|
`)}var gu="\x1B",tQ2="",_G5=39,Hh="\x07",eQ2="[",xG5="]",$U2="m",Lh,aQ2,oQ2=($)=>{if($>=30&&$<=37)return 39;if($>=90&&$<=97)return 39;if($>=40&&$<=47)return 49;if($>=100&&$<=107)return 49;if($===1||$===2)return 22;if($===3)return 23;if($===4)return 24;if($===7)return 27;if($===8)return 28;if($===9)return 29;if($===0)return 0;return},rQ2=($)=>`${gu}${eQ2}${$}${$U2}`,sQ2=($)=>`${gu}${Lh}${$}${Hh}`,Xh=($,z,G)=>{let J=z[Symbol.iterator](),Q=!1,U=!1,K=$.at(-1),Z=K===void 0?0:f7(K),W=J.next(),k=J.next(),B=0;while(!W.done){let Y=W.value,F=f7(Y);if(Z+F<=G)$[$.length-1]+=Y;else $.push(Y),Z=0;if(Y===gu||Y===tQ2)Q=!0,U=z.startsWith(Lh,B+1);if(Q){if(U){if(Y===Hh)Q=!1,U=!1}else if(Y===$U2)Q=!1}else if(Z+=F,Z===G&&!k.done)$.push(""),Z=0;W=k,k=J.next(),B+=Y.length}if(K=$.at(-1),!Z&&K!==void 0&&K.length&&$.length>1)$[$.length-2]+=$.pop()},yG5=($)=>{let z=$.split(" "),G=z.length;while(G){if(f7(z[G-1]))break;G--}if(G===z.length)return $;return z.slice(0,G).join(" ")+z.slice(G).join("")},SG5=($,z,G={})=>{if(G.trim!==!1&&$.trim()==="")return"";let J="",Q,U,K=$.split(" "),Z=[""],W=0;for(let Y=0;Y<K.length;Y++){let F=K[Y];if(G.trim!==!1){let X=Z.at(-1)??"",H=X.trimStart();if(X.length!==H.length)Z[Z.length-1]=H,W=f7(H)}if(Y!==0){if(W>=z&&(G.wordWrap===!1||G.trim===!1))Z.push(""),W=0;if(W||G.trim===!1)Z[Z.length-1]+=" ",W++}let V=f7(F);if(G.hard&&V>z){let X=z-W,H=1+Math.floor((V-X-1)/z);if(Math.floor((V-1)/z)<H)Z.push("");Xh(Z,F,z),W=f7(Z.at(-1)??"");continue}if(W+V>z&&W&&V){if(G.wordWrap===!1&&W<z){Xh(Z,F,z),W=f7(Z.at(-1)??"");continue}Z.push(""),W=0}if(W+V>z&&G.wordWrap===!1){Xh(Z,F,z),W=f7(Z.at(-1)??"");continue}Z[Z.length-1]+=F,W+=V}if(G.trim!==!1)Z=Z.map((Y)=>yG5(Y));let k=Z.join(`
|
|
29
29
|
`),B=!1;for(let Y=0;Y<k.length;Y++){let F=k[Y];if(J+=F,!B){if(B=F>="\uD800"&&F<="\uDBFF",B)continue}else B=!1;if(F===gu||F===tQ2){aQ2.lastIndex=Y+1;let X=aQ2.exec(k)?.groups;if(X?.code!==void 0){let H=Number.parseFloat(X.code);Q=H===_G5?void 0:H}else if(X?.uri!==void 0)U=X.uri.length===0?void 0:X.uri}if(k[Y+1]===`
|
|
30
30
|
`){if(U)J+=sQ2("");let V=Q?oQ2(Q):void 0;if(Q&&V)J+=rQ2(V)}else if(F===`
|
|
@@ -784,7 +784,7 @@ ${qB.stringify(L)}`;if(Qv5(G,N),z.push(`.agents/oma-config.yaml updated (model_p
|
|
|
784
784
|
${Dz.stringify(K)}`;return{content:W+k,addedKeys:Z}}function PD2($,z,G,J=TD2){let Q={content:$,addedKeys:[]},U=Object.keys(G);if(U.length===0)return Q;let K;try{let k=Dz.parse($);if(k===null||k===void 0)K={};else if(AB(k))K=k;else return Q}catch{return Q}if(!(z in K)){let k=Wq($,Dz.stringify({[z]:G}),J);if(k.addedKeys.length===0)return Q;return{content:k.content,addedKeys:U}}let Z=K[z];if(Z!==null&&!AB(Z))return Q;let W=yR5($,z,G,J);if(W===null)return Q;try{let k=Dz.parse(W);if(!AB(k))return Q;let B=k[z];if(!AB(B))return Q;if(!U.every((Y)=>(Y in B)))return Q}catch{return Q}return{content:W,addedKeys:U}}function yR5($,z,G,J){let Q=$.split(`
|
|
785
785
|
`),U=new RegExp(`^${xR5(z)}:[ ]*(#.*)?$`),K=Q.findIndex((k)=>U.test(k));if(K===-1)return null;let Z=K;for(let k=K+1;k<Q.length;k++){let B=Q[k]??"";if(B.trim()==="")continue;if(!/^[ \t]/.test(B))break;Z=k}let W=Dz.stringify(G,{indent:2,lineWidth:0}).replace(/\n+$/,"").split(`
|
|
786
786
|
`).map((k)=>k===""?k:` ${k}`);return Q.splice(Z+1,0,` # ${J}`,...W),Q.join(`
|
|
787
|
-
`)}var Dz,TD2="Added by oma update — new config keys (template defaults; edit freely)";var OR=q(()=>{Dz=V2(O1(),1)});import SR5 from"node:fs";import hR5 from"node:path";function jz($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function vR($){let z=i7($,IR);if(!z)return;try{let G=ED2.parse(SR5.readFileSync(z,"utf-8"));return jz(G)?G:void 0}catch{return}}function RR($,z){let G=$?.[z];return jz(G)?G:void 0}function jo($,z){if($===z)return!0;if(Array.isArray($)&&Array.isArray(z))return $.length===z.length&&$.every((G,J)=>jo(G,z[J]));if(jz($)&&jz(z)){let G=new Set([...Object.keys($),...Object.keys(z)]);for(let J of G)if(!jo($[J],z[J]))return!1;return!0}return!1}function uo($,z){let G={};for(let[J,Q]of Object.entries($)){let U=z[J];if(jz(Q)&&jz(U)){let K=uo(Q,U);if(Object.keys(K).length>0)G[J]=K}else if(!jo(Q,U))G[J]=Q}return G}function kq($,z){let G={...$};for(let[J,Q]of Object.entries(z)){let U=G[J];G[J]=jz(Q)&&jz(U)?kq(U,Q):Q}return G}function bD2($,z){let G=structuredClone($);for(let J of z){let Q=J.split("."),U=[G],K=G;for(let Z of Q.slice(0,-1)){let W=K?.[Z];if(!jz(W)){K=void 0;break}U.push(W),K=W}if(!K)continue;delete K[Q[Q.length-1]];for(let Z=U.length-1;Z>0;Z--){let W=U[Z];if(Object.keys(W).length>0)break;delete U[Z-1][Q[Z-1]]}}return G}var ED2,IR;var Bq=q(()=>{T4();ED2=V2(O1(),1),IR=hR5.join(".agents","oma-config.yaml")});import{existsSync as gR5,readFileSync as _D2,unlinkSync as fR5,writeFileSync as mR5}from"node:fs";import{join as wR}from"node:path";function rR5($){let z=$.providers;if(!DB(z))return $;let G={};for(let[J,Q]of Object.entries(z)){if(!DB(Q)||!("envVar"in Q)){G[J]=Q;continue}let{envVar:U,...K}=Q;G[J]={...K,env_var:U}}return{...$,providers:G}}function DB($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function CR($){if(!gR5($))return null;try{let z=TR.parse(_D2($,"utf-8"));return DB(z)?z:null}catch{return null}}function xD2($,z=""){let G=[];for(let[J,Q]of Object.entries($)){let U=z?`${z}.${J}`:J;if(DB(Q))G.push(...xD2(Q,U));else G.push(U)}return G}function sR5($,z,G){let Q=CR(wR($,".agents","skills","oma-orchestrator","config","cli-config.yaml"))?.active_vendor;if(typeof Q!=="string"||Q==="claude")return[];if(z&&"default_cli"in z)return[];return G.default_cli=Q,[`moved default_cli: ${Q} from .agents/skills/oma-orchestrator/config/cli-config.yaml (active_vendor)`]}function tR5($,z,G){let Q=CR(wR($,".agents","config","models.yaml"))?.models;if(!DB(Q)||Object.keys(Q).length===0)return[];if(z&&"models"in z)return["kept .agents/config/models.yaml — oma-config already has a `models:` section"];return G.models=Q,[`moved ${Object.keys(Q).map((U)=>`models.${U}`).join(", ")} from .agents/config/models.yaml`]}function eR5($,z,G){if(!z)return["kept legacy skill configs — .agents/oma-config.yaml is missing or unreadable"];let J;try{J=_D2($,"utf-8")}catch{return["kept legacy skill configs — .agents/oma-config.yaml is unreadable"]}let{content:Q,addedKeys:U}=Wq(J,TR.stringify(G),iR5);if(U.length===0)return[];try{mR5($,Q)}catch{return["kept legacy skill configs — .agents/oma-config.yaml is not writable"]}return[`updated .agents/oma-config.yaml (${U.join(", ")})`]}var TR,iR5,cR5,lR5,pR5,dR5,nR5,aR5,oR5,yD2;var SD2=q(()=>{OR();Bq();TR=V2(O1(),1),iR5="Added by oma migration 022 — moved from .agents/skills/*/config/*.yaml, "+"which `oma update` overwrites. Edit freely.",cR5={default_output_dir:".agents/results/videos",default_mode:"shorts",default_aspect:"auto",default_locale:"en",default_captions:"tiktok",default_visual:"auto",default_voice:"none",default_music:"none",default_compositor:"remotion",default_timeout_sec:600,providers:{script:{order:["agent-script"]},voice:{order:["oma-voice"]},visual:{order:["oma-image","pexels","pixelle"]},caption:{order:["oma-captions"]},capture:{order:["playwright-web","cap"]},music:{order:["strudel"]},compositor:{order:["remotion","mpt"]},pexels:{enabled:!1,envVar:"PEXELS_API_KEY"},pixelle:{enabled:!1,envVar:"RUNNINGHUB_API_KEY"}},cost:{guardrail_usd:0.2},limits:{max_duration_sec:180,max_scenes:40},naming:{single_folder_pattern:"{timestamp}-{shortid}-{mode}"}},lR5={default_output_dir:".agents/results/images",default_vendor:"auto",default_size:"1024x1024",default_quality:"auto",default_count:1,default_timeout_sec:180,vendors:{codex:{enabled:!0,model:"gpt-image-2",extra_args:[]},antigravity:{enabled:!0,model:""},pollinations:{enabled:!0,model:"flux"}},cost_guardrail:{estimate_threshold_usd:0.2,per_image_usd:{codex:{"gpt-image-2":{low:0.02,medium:0.03,high:0.04,auto:0.03}},antigravity:{"":{low:0,medium:0,high:0,auto:0}},pollinations:{flux:{low:0,medium:0,high:0,auto:0},zimage:{low:0,medium:0,high:0,auto:0},"qwen-image":{low:0,medium:0,high:0,auto:0},"wan-image":{low:0,medium:0,high:0,auto:0},gptimage:{low:0,medium:0,high:0,auto:0},"gptimage-large":{low:0,medium:0,high:0,auto:0},"gpt-image-2":{low:0,medium:0,high:0,auto:0},klein:{low:0,medium:0,high:0,auto:0},kontext:{low:0,medium:0,high:0,auto:0}}}},compare:{folder_pattern:"{timestamp}-{shortid}-compare",manifest:!0},naming:{single_folder_pattern:"{timestamp}-{shortid}"}},pR5={notification_profile:null,asset_profile:null,output_dir:".agents/results/voice",auto_notify_after_sec:60,max_tts_chars:5000,max_stt_minutes:30},dR5={format:"markdown",version:{channel:"latest",pinned:"4.
|
|
787
|
+
`)}var Dz,TD2="Added by oma update — new config keys (template defaults; edit freely)";var OR=q(()=>{Dz=V2(O1(),1)});import SR5 from"node:fs";import hR5 from"node:path";function jz($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function vR($){let z=i7($,IR);if(!z)return;try{let G=ED2.parse(SR5.readFileSync(z,"utf-8"));return jz(G)?G:void 0}catch{return}}function RR($,z){let G=$?.[z];return jz(G)?G:void 0}function jo($,z){if($===z)return!0;if(Array.isArray($)&&Array.isArray(z))return $.length===z.length&&$.every((G,J)=>jo(G,z[J]));if(jz($)&&jz(z)){let G=new Set([...Object.keys($),...Object.keys(z)]);for(let J of G)if(!jo($[J],z[J]))return!1;return!0}return!1}function uo($,z){let G={};for(let[J,Q]of Object.entries($)){let U=z[J];if(jz(Q)&&jz(U)){let K=uo(Q,U);if(Object.keys(K).length>0)G[J]=K}else if(!jo(Q,U))G[J]=Q}return G}function kq($,z){let G={...$};for(let[J,Q]of Object.entries(z)){let U=G[J];G[J]=jz(Q)&&jz(U)?kq(U,Q):Q}return G}function bD2($,z){let G=structuredClone($);for(let J of z){let Q=J.split("."),U=[G],K=G;for(let Z of Q.slice(0,-1)){let W=K?.[Z];if(!jz(W)){K=void 0;break}U.push(W),K=W}if(!K)continue;delete K[Q[Q.length-1]];for(let Z=U.length-1;Z>0;Z--){let W=U[Z];if(Object.keys(W).length>0)break;delete U[Z-1][Q[Z-1]]}}return G}var ED2,IR;var Bq=q(()=>{T4();ED2=V2(O1(),1),IR=hR5.join(".agents","oma-config.yaml")});import{existsSync as gR5,readFileSync as _D2,unlinkSync as fR5,writeFileSync as mR5}from"node:fs";import{join as wR}from"node:path";function rR5($){let z=$.providers;if(!DB(z))return $;let G={};for(let[J,Q]of Object.entries(z)){if(!DB(Q)||!("envVar"in Q)){G[J]=Q;continue}let{envVar:U,...K}=Q;G[J]={...K,env_var:U}}return{...$,providers:G}}function DB($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function CR($){if(!gR5($))return null;try{let z=TR.parse(_D2($,"utf-8"));return DB(z)?z:null}catch{return null}}function xD2($,z=""){let G=[];for(let[J,Q]of Object.entries($)){let U=z?`${z}.${J}`:J;if(DB(Q))G.push(...xD2(Q,U));else G.push(U)}return G}function sR5($,z,G){let Q=CR(wR($,".agents","skills","oma-orchestrator","config","cli-config.yaml"))?.active_vendor;if(typeof Q!=="string"||Q==="claude")return[];if(z&&"default_cli"in z)return[];return G.default_cli=Q,[`moved default_cli: ${Q} from .agents/skills/oma-orchestrator/config/cli-config.yaml (active_vendor)`]}function tR5($,z,G){let Q=CR(wR($,".agents","config","models.yaml"))?.models;if(!DB(Q)||Object.keys(Q).length===0)return[];if(z&&"models"in z)return["kept .agents/config/models.yaml — oma-config already has a `models:` section"];return G.models=Q,[`moved ${Object.keys(Q).map((U)=>`models.${U}`).join(", ")} from .agents/config/models.yaml`]}function eR5($,z,G){if(!z)return["kept legacy skill configs — .agents/oma-config.yaml is missing or unreadable"];let J;try{J=_D2($,"utf-8")}catch{return["kept legacy skill configs — .agents/oma-config.yaml is unreadable"]}let{content:Q,addedKeys:U}=Wq(J,TR.stringify(G),iR5);if(U.length===0)return[];try{mR5($,Q)}catch{return["kept legacy skill configs — .agents/oma-config.yaml is not writable"]}return[`updated .agents/oma-config.yaml (${U.join(", ")})`]}var TR,iR5,cR5,lR5,pR5,dR5,nR5,aR5,oR5,yD2;var SD2=q(()=>{OR();Bq();TR=V2(O1(),1),iR5="Added by oma migration 022 — moved from .agents/skills/*/config/*.yaml, "+"which `oma update` overwrites. Edit freely.",cR5={default_output_dir:".agents/results/videos",default_mode:"shorts",default_aspect:"auto",default_locale:"en",default_captions:"tiktok",default_visual:"auto",default_voice:"none",default_music:"none",default_compositor:"remotion",default_timeout_sec:600,providers:{script:{order:["agent-script"]},voice:{order:["oma-voice"]},visual:{order:["oma-image","pexels","pixelle"]},caption:{order:["oma-captions"]},capture:{order:["playwright-web","cap"]},music:{order:["strudel"]},compositor:{order:["remotion","mpt"]},pexels:{enabled:!1,envVar:"PEXELS_API_KEY"},pixelle:{enabled:!1,envVar:"RUNNINGHUB_API_KEY"}},cost:{guardrail_usd:0.2},limits:{max_duration_sec:180,max_scenes:40},naming:{single_folder_pattern:"{timestamp}-{shortid}-{mode}"}},lR5={default_output_dir:".agents/results/images",default_vendor:"auto",default_size:"1024x1024",default_quality:"auto",default_count:1,default_timeout_sec:180,vendors:{codex:{enabled:!0,model:"gpt-image-2",extra_args:[]},antigravity:{enabled:!0,model:""},pollinations:{enabled:!0,model:"flux"}},cost_guardrail:{estimate_threshold_usd:0.2,per_image_usd:{codex:{"gpt-image-2":{low:0.02,medium:0.03,high:0.04,auto:0.03}},antigravity:{"":{low:0,medium:0,high:0,auto:0}},pollinations:{flux:{low:0,medium:0,high:0,auto:0},zimage:{low:0,medium:0,high:0,auto:0},"qwen-image":{low:0,medium:0,high:0,auto:0},"wan-image":{low:0,medium:0,high:0,auto:0},gptimage:{low:0,medium:0,high:0,auto:0},"gptimage-large":{low:0,medium:0,high:0,auto:0},"gpt-image-2":{low:0,medium:0,high:0,auto:0},klein:{low:0,medium:0,high:0,auto:0},kontext:{low:0,medium:0,high:0,auto:0}}}},compare:{folder_pattern:"{timestamp}-{shortid}-compare",manifest:!0},naming:{single_folder_pattern:"{timestamp}-{shortid}"}},pR5={notification_profile:null,asset_profile:null,output_dir:".agents/results/voice",auto_notify_after_sec:60,max_tts_chars:5000,max_stt_minutes:30},dR5={format:"markdown",version:{channel:"latest",pinned:"4.7.3"},output:{default_location:"same_dir"},supported_formats:["hwp","hwpx","hwpml"]},nR5={format:"markdown",image_output:"off",image_format:"png",use_struct_tree:!1,ocr:{enabled:!1,languages:"en",hybrid_port:5002},output:{default_location:"same_dir",overwrite:!1}},aR5={api:{base_url:"https://knows.academy"}},oR5=[{section:"video",file:"oma-video/config/video-config.yaml",shipped:cR5,drop:["providers.pexels.enabled","providers.pixelle.enabled","language"],deleteWhenPristine:!0,reshape:rR5},{section:"image",file:"oma-image/config/image-config.yaml",shipped:lR5,drop:["language"],deleteWhenPristine:!0},{section:"voice",file:"oma-voice/config/voice-config.yaml",shipped:pR5,deleteWhenPristine:!1},{section:"hwp",file:"oma-hwp/config/hwp-config.yaml",shipped:dR5,drop:["supported_formats"],deleteWhenPristine:!1},{section:"pdf",file:"oma-pdf/config/pdf-config.yaml",shipped:nR5,deleteWhenPristine:!1},{section:"scholar",file:"oma-scholar/config/scholar-config.yaml",shipped:aR5,deleteWhenPristine:!1,reshape:($)=>{let z=$.api;if(!DB(z)||!("base_url"in z))return{};return{base_url:z.base_url}}}];yD2={name:"022-unify-skill-configs",up($){let z=[],G=wR($,".agents","oma-config.yaml"),J=CR(G),Q={};for(let U of oR5){let K=wR($,".agents","skills",...U.file.split("/")),Z=CR(K);if(!Z)continue;let W=uo(Z,U.shipped);if(U.drop)W=bD2(W,U.drop);if(U.reshape)W=U.reshape(W);if(Object.keys(W).length===0){if(!U.deleteWhenPristine)continue;try{fR5(K),z.push(`removed unmodified .agents/skills/${U.file}`)}catch{}continue}if(J&&U.section in J){z.push(`kept .agents/skills/${U.file} — oma-config already has a \`${U.section}:\` section`);continue}Q[U.section]=W,z.push(`moved ${xD2(W).map((k)=>`${U.section}.${k}`).join(", ")} from .agents/skills/${U.file}`)}if(z.push(...sR5($,J,Q)),z.push(...tR5($,J,Q)),Object.keys(Q).length>0)z.push(...eR5(G,J,Q));return z}}});function FK($,z=Ko){let G=[];for(let J of $w5)G.push(...J.up($,z));return G}var $w5;var Mo=q(()=>{DJ();DJ();rN2();GA2();KA2();kA2();FA2();NA2();CA2();_A2();SA2();mA2();cA2();oA2();sA2();JD2();UD2();XD2();AD2();ID2();RD2();CD2();SD2();$w5=[oN2,zA2,UA2,WA2,YA2,qA2,wA2,bA2,yA2,fA2,iA2,aA2,rA2,GD2,QD2,VD2,ND2,OD2,vD2,wD2,yD2]});import{readFileSync as zw5}from"node:fs";function PR($={}){if($.yes)return!0;if(process.env.OMA_YES==="1"||process.env.OMA_YES==="true")return!0;return!1}function Oo($={}){if(PR($))return!0;if(process.env.CI==="true"||process.env.CI==="1")return!0;return!1}function Io($=()=>zw5("/proc/version","utf-8")){if(process.platform!=="linux")return!1;try{return/microsoft|wsl/i.test($())}catch{return!1}}var vo=()=>{};import{execSync as Ro}from"node:child_process";function VK(){try{return Ro("gh --version",{stdio:"ignore"}),!0}catch{return!1}}function k$(){try{return Ro("gh auth status",{stdio:"ignore"}),!0}catch{return!1}}function XK(){try{return Ro(`gh api user/starred/${V1}`,{stdio:"ignore"}),!0}catch{return!1}}function hD2(){return VK()&&k$()&&XK()}var jB=q(()=>{r3()});import{execFileSync as Gw5}from"node:child_process";async function gD2($,z){if(g7()==="global"&&$)a2.info(uB.default.dim("Skipped GitHub star prompt (--global + --yes)."));else if(VK()&&k$()&&!XK()){let G;if($)G=!0;else if(z)G=!1;else G=await o4({message:`${uB.default.yellow("⭐")} Star ${uB.default.cyan(V1)} on GitHub? It helps a lot!`});if(!O5(G)&&G)try{Gw5("gh",["api","-X","PUT",`/user/starred/${V1}`],{stdio:"ignore"}),a2.success(`Starred ${uB.default.cyan(V1)}! Thank you! \uD83C\uDF1F`)}catch{a2.warn(`Could not star automatically. Try: ${uB.default.dim(`gh api --method PUT /user/starred/${V1}`)}`)}}}var uB;var fD2=q(()=>{C4();jB();h8();r3();uB=V2(g2(),1)});import{existsSync as ER,readdirSync as Jw5,readFileSync as wo,writeFileSync as Qw5}from"node:fs";import{join as bR}from"node:path";function Co($){let z=bR($,"docs"),G=["en"];if(ER(z))for(let J of Jw5(z)){let Q=J.match(/^README\.(.+)\.md$/);if(Q?.[1])G.push(Q[1])}return G.map((J)=>({value:J,label:Uw5[J]??J}))}function To($){let z=bR($,".agents","oma-config.yaml");if(!ER(z))return null;try{return wo(z,"utf-8").match(/^language:\s*([A-Za-z-]+)/m)?.[1]??null}catch{return null}}function _R($){let z=bR($,".agents","oma-config.yaml");if(!ER(z))return null;try{return wo(z,"utf-8").match(/^model_preset:\s*([A-Za-z0-9_-]+)/m)?.[1]??null}catch{return null}}function mD2($,z,G,J){let Q=bR($,".agents","oma-config.yaml");if(ER(Q)){let U=wo(Q,"utf-8");if(U=U.replace(/^language:\s*.+$/m,`language: ${z}`),/^model_preset:/m.test(U))U=U.replace(/^model_preset:\s*.+$/m,`model_preset: ${G}`);else U=U.replace(/^(language:\s*.+)$/m,`$1
|
|
788
788
|
model_preset: ${G}`);Qw5(Q,U),ad($,J)}}var Uw5;var xR=q(()=>{r3();Uw5={en:"English",ko:"한국어",ja:"日本語",zh:"中文",vi:"Tiếng Việt",de:"Deutsch",es:"Español",fr:"Français",nl:"Nederlands",pl:"Polski",pt:"Português",ru:"Русский"}});function iD2($){return $.filter((z)=>Kw5.includes(z))}function Zw5($,z){if($)return $;let[G]=iD2(z);return G??"mixed"}async function cD2($,z,G,J){let Q=Co($),U=To(z),K=Q.some((W)=>W.value===U)?U:"en",Z=G?K:await Wz({message:"Response language?",options:Q,initialValue:K});if(O5(Z))J(),A4("Cancelled."),process.exit(0);return Z}async function lD2($,z,G,J){let Q=[{value:"claude",label:"Claude Code",hint:"Claude Max subscription holders"},{value:"codex",label:"Codex",hint:"ChatGPT Plus/Pro subscription holders"},{value:"cursor",label:"Cursor Agent",hint:"Cursor editor with built-in agent"},{value:"qwen",label:"Qwen Code",hint:"Qwen Code subscription holders"},{value:"antigravity",label:"Antigravity CLI (agy)",hint:"Gemini 3.1 Pro impl + Gemini 3.5 Flash orchestration"},{value:"mixed",label:"Mixed (cross-vendor)",hint:"Claude orchestrator + cross-vendor subagents"}],U=_R($),K=Zw5(U,z);if(G)return K;if(iD2(z).length===0){a2.info(Yq.default.dim("Selected CLI(s) use native subagent dispatch. model_preset only affects the cross-vendor 'oma agent:spawn' fallback."));let k=await o4({message:`Pick a cross-vendor model preset? (otherwise defaults to '${K}')`,initialValue:!1});if(O5(k))J(),A4("Cancelled."),process.exit(0);if(!k)return K}let Z=Q.some((k)=>k.value===K)?K:"mixed",W=await Wz({message:"Model preset?",options:Q,initialValue:Z});if(O5(W))J(),A4("Cancelled."),process.exit(0);return W}async function pD2($,z){let G=process.platform!=="win32"&&!process.env.CI,J=[{value:"claude",label:"Claude Code",hint:"hooks + settings + CLAUDE.md"},{value:"codex",label:"Codex",hint:"hooks + plugin"},{value:"commandcode",label:"Command Code",hint:"hooks + skills + .commandcode/agents/"},{value:"copilot",label:"GitHub Copilot",hint:"skill symlinks + .github/prompts/ wrappers"},{value:"cursor",label:"Cursor",hint:".cursor/rules/ export + prompt hooks"},{value:"grok",label:"Grok",hint:"hooks + project MCP + .grok/agents/"},{value:"kiro",label:"Kiro CLI",hint:"hooks + Serena MCP + .kiro/agents/"},{value:"opencode",label:"OpenCode",hint:"in-process plugin bridge — .opencode/plugins/oma/, .opencode/agents/"},{value:"pi",label:"pi (Earendil)",hint:"in-process extension bridge — .pi/extensions/oma/"},...G?[{value:"antigravity",label:"Antigravity CLI (agy)",hint:"hooks + HUD + Serena MCP — HOME-shared (~/.gemini/antigravity-cli/)"},{value:"hermes",label:"Hermes Agent",hint:"skills only — workflows N/A, HOME-shared (no per-project isolation)"},{value:"kimi",label:"Kimi Code CLI",hint:"hooks + skills — HOME-shared (~/.kimi-code/) + project Serena MCP"}]:[],{value:"qwen",label:"Qwen Code",hint:"hooks + settings"},{value:"zcode",label:"ZCode",hint:"workflow slash-commands"}],Q={claude:"claude",codex:"codex",cursor:"cursor",qwen:"qwen",antigravity:"antigravity"},U=J.filter((B)=>{if(YL(B.value))return!1;let Y=x1[B.value];if(Y?.optIn)return!1;if(Y?.requiresHomeConsent&&!G)return!1;return!0}).map((B)=>B.value),K=_R($),Z=K?Q[K]:void 0,W=Z&&J.some((B)=>B.value===Z)?[Z]:U,k=z?W:await gX({message:"CLI tools to configure (deselect all to skip):",options:J,initialValues:W,required:!1});if(O5(k))A4("Cancelled."),process.exit(0);return k}async function dD2($){let z=$?"all":await Wz({message:"What type of project?",options:[{value:"all",label:"All",hint:"Install everything"},{value:"fullstack",label:"Fullstack",hint:"Web + Mobile + Infra (kitchen sink)"},{value:"fullstack-web",label:"Fullstack Web",hint:"Frontend + Backend + DB (no mobile/infra)"},{value:"fullstack-mobile",label:"Fullstack Mobile",hint:"Mobile + Backend + DB"},{value:"frontend",label:"Frontend",hint:"React/Next.js"},{value:"backend",label:"Backend",hint:"Python, Node.js, Rust, ..."},{value:"mobile",label:"Mobile",hint:"Flutter/Dart"},{value:"devops",label:"DevOps",hint:"Terraform + CI/CD + Observability"},{value:"research",label:"Research",hint:"Scholar + Market + PDF/HWP + Writer"},{value:"content",label:"Content",hint:"Image + Voice + Design + Writer"},{value:"custom",label:"Custom",hint:"Choose skills"}]});if(O5(z))A4("Cancelled."),process.exit(0);let G;if(z==="custom"){let J=ZJ(),Q=await gX({message:"Select skills:",options:J.map((U)=>({value:U.name,label:U.name,hint:U.desc})),required:!0});if(O5(Q))A4("Cancelled."),process.exit(0);G=Q}else G=eZ2[z]??[];return G}async function nD2($,z){let G={};if($?.includes("oma-backend")){let J=z?"python":await Wz({message:"Backend language?",options:[{value:"python",label:"\uD83D\uDC0D Python",hint:"FastAPI/SQLAlchemy (default)"},{value:"node",label:"\uD83D\uDFE2 Node.js",hint:"NestJS/Hono + Prisma/Drizzle"},{value:"rust",label:"\uD83E\uDD80 Rust",hint:"Axum/Actix-web"},{value:"other",label:"\uD83D\uDD27 Other / Auto-detect",hint:"Configure later with /stack-set"}],initialValue:"python"});if(O5(J))A4("Cancelled."),process.exit(0);let Q=J||"python";if(Q!=="other")G["oma-backend"]=Q}return G}async function aD2($,z,G){let J=Object.keys(x1),Q=$.filter((K)=>J.includes(K)),U=[];for(let K of Q){if(gU(K)){if(z){a2.info(Yq.default.dim(`Skipped ${K} export (HOME write requires -y opt-in).`));continue}let Z=await o4({message:`${K} export writes to HOME (${Yq.default.cyan(fd(K))}). Proceed?`,initialValue:!1});if(O5(Z))G(),A4("Cancelled."),process.exit(0);if(!Z){a2.info(Yq.default.dim(`Skipped ${K} export.`));continue}}U.push(K)}return U}var Yq,Kw5;var oD2=q(()=>{C4();r3();xR();Yq=V2(g2(),1),Kw5=["claude","codex","cursor","qwen","antigravity"]});import{existsSync as Ww5,lstatSync as kw5,readdirSync as Bw5,readlinkSync as Yw5,unlinkSync as Fw5}from"node:fs";import{join as Vw5,resolve as Xw5}from"node:path";function Po($){if(!Ww5($))return;let z;try{z=Bw5($,{withFileTypes:!0,encoding:"utf-8"})}catch{return}for(let G of z){if(!G.isSymbolicLink())continue;let J=Vw5($,G.name),Q;try{Q=Yw5(J)}catch{continue}let U=Xw5($,Q),K;try{kw5(U),K=!0}catch{K=!1}if(!K)try{Fw5(J),console.log(`cleaned broken symlink: ${J}`)}catch{}}}var Eo=()=>{};import{existsSync as Hw5,rmSync as Lw5}from"node:fs";import{homedir as qw5}from"node:os";import{join as bo}from"node:path";async function Fq($={}){let z=Oo($),G=PR($);if(process.platform!=="win32"&&typeof process.geteuid==="function"&&process.geteuid()===0&&typeof process.env.SUDO_USER==="string"&&process.env.SUDO_USER.length>0)A4("Refusing to install under sudo. Re-run as the target user (without sudo) — oma writes to your HOME and runs as your user."),process.exit(1);if(g7()==="global"&&(process.env.CI==="true"||process.env.CI==="1"))a2.warn("Running `oma install --global` in CI. This will modify the CI user's HOME. Proceeding because --yes / non-interactive mode is set.");let Q=FU(),U=hv(Q);if(!U.ok)A4(`Another oma install/update is running (pid=${U.held.pid}). If none is running it crashed — remove ${eL(Q)}, or wait ~${tL/1000}s for it to auto-clear.`),process.exit(1);let K=gv(U.release);try{if(console.clear(),i4(L1.default.bgMagenta(L1.default.white(" \uD83D\uDEF8 oh-my-agent "))),z)a2.info(L1.default.dim("Non-interactive mode — using defaults."));if(g7()==="project"&&process.cwd()===qw5())if(z)A4("Refusing to install in HOME without --global. Re-run with --global, or cd to a project directory first."),process.exit(1);else{let D=await o4({message:"You're running oma in your HOME directory without --global. This will scatter files in ~/. Are you sure?",initialValue:!1});if(O5(D)||!D)A4("Cancelled."),process.exit(0)}if(g7()==="global"&&Io())a2.info(L1.default.dim("WSL detected: your $HOME ("+Q+") is the WSL Linux home and is distinct from your Windows %USERPROFILE%. oma will install only to the WSL HOME. If you want a Windows-side install, re-run this command from PowerShell."));if(g7()==="global"){if(!z){let u=await o4({message:`You're about to install oh-my-agent globally to ${Q}/.agents/. This will modify ~/.claude/, ~/.codex/, etc. Proceed?`,initialValue:!1});if(O5(u)||!u)A4("Cancelled."),process.exit(0)}if(bv(Q)!=="global"&&!z){L2(["This is your first global install of oh-my-agent.","Scope:"," - SSOT: ~/.agents/ (all skills, workflows, rules)"," - Vendor configs: ~/.claude/, ~/.codex/, ~/.gemini/, ~/.qwen/ (symlinks + settings)"," - Lock file: ~/.agents/_install.lock","Existing per-project installs are not affected."].join(`
|
|
789
789
|
`));let u=await o4({message:"Proceed with the global install?",initialValue:!1});if(O5(u)||!u)A4("Cancelled."),process.exit(0)}}let Z=FK(Q,{vendors:[]});if(Z.length>0)L2(Z.map((D)=>`${L1.default.green("✓")} ${D}`).join(`
|
|
790
790
|
`),"Migration");if(!z)await Sv(Q);let W=p9();W.start("Downloading...");let k,B;try{let D=await WB();k=D.dir,B=D.cleanup}catch(D){W.stop("Download failed"),a2.error(D instanceof Error?D.message:String(D)),process.exit(1)}W.stop("Downloaded!");let Y=await cD2(k,Q,z,B),F=await pD2(Q,z),V=gk(Q)??[],X=await lD2(Q,F,z,B),H=await dD2(z),L=await nD2(H,z),N=await aD2(F,z,B);W.start("Installing skills...");let A=null;try{try{let v=[".claude/skills",".codex/skills",".gemini/skills",".github/skills",".qwen/skills"];for(let w of v)Po(bo(Q,w));HL(k,Q),ld(k,Q),pd(k,Q),cd(k,Q),dd(k,Q),nd(k,Q,!1);for(let w of H??[])W.message(`Installing ${L1.default.cyan(w)}...`),XL(k,w,Q,L[w]);W.stop("Skills installed!");let j=bo(Q,".agents","eval");if(Hw5(j))Lw5(j,{recursive:!0,force:!0});iI(Q,V),mD2(Q,Y,X,F),W.start("Installing vendor adaptations..."),A=LB({root:Q,vendorFilter:F,quiet:!0,telemetry:hk(Q),refreshSymlinks:!1}),W.stop("Vendor adaptations installed!");let M=await JK(k);if(M)await rL(Q,M);let O=FK(Q,{vendors:F});if(O.length>0)L2(O.map((w)=>`${L1.default.green("✓")} ${w}`).join(`
|
|
@@ -2561,7 +2561,7 @@ oma video doctor — toolchain readiness
|
|
|
2561
2561
|
`));let Q=Math.max(...G.map((U)=>U.name.length))+2;for(let U of G){let K=U.ok?u1.default.green("✓"):u1.default.yellow("!"),Z=U.name.padEnd(Q),W=U.ok?u1.default.dim(U.detail):u1.default.yellow(U.detail);if(console.log(` ${K} ${Z} ${W}`),!U.ok&&U.remediation)console.log(` ${u1.default.cyan("→")} ${U.remediation}`)}console.log()}let J=G.filter((Q)=>$F4.has(Q.name)&&!Q.ok);if(z!=="json")if(J.length===0)console.log(u1.default.green("Key-free baseline ready (Node + Chromium + FFmpeg + oma-image)."));else console.log(u1.default.yellow(`${J.length} baseline dependency(ies) missing: ${J.map((Q)=>Q.name).join(", ")}.`));return J.length>0?1:0}var u1,$F4;var u05=q(()=>{NS();uS();RS();MS();IS();u1=V2(g2(),1),$F4=new Set(["node","chromium","ffmpeg","oma-image"])});function M05($){if($ instanceof LX)return $.exitCode;return TG.generic}function MW($){return $ instanceof Error?$.message:String($)}var TG,LX,qX,wS,s6,i9;var KU=q(()=>{nP();TG=P7;LX=class LX extends Error{exitCode;kind;constructor($,z=TG.generic,G="video-error"){super($);this.exitCode=z;this.kind=G;this.name=new.target.name}};qX=class qX extends LX{constructor($){super($,TG.authRequired,"provider-unavailable")}};wS=class wS extends LX{constructor($){super($,TG.generic,"cost-guardrail")}};s6=class s6 extends LX{constructor($){super($,TG.notFound,"capture-required")}};i9=class i9 extends LX{schemaName;constructor($,z){super($,TG.invalidInput,"schema-validation");this.schemaName=z}}});function R05($){if($==="9:16")return{width:1088,height:1920};if($==="1:1")return{width:1088,height:1088};return{width:1920,height:1088}}function bS($){let z=$.composition.toLowerCase();return $.slug?`${z}-${$.slug}.mp4`:`${z}.mp4`}function PG($,z,G){let J=z.safeParse(G);if(J.success)return J.data;let Q=J.error.issues[0],U=Q?.path.length?Q.path.join("."):"(root)";throw new i9(`${$} validation failed at ${U}: ${Q?.message??"invalid value"}`,$)}var E8="1.0",NX,zF4,O05,NJ2,I05,AJ2,DJ2,Ns1,CS,GF4,TS,v05,PS,ES;var t6=q(()=>{r0();KU();NX=f.enum(["shorts","explainer","demo"]),zF4=f.enum(["9:16","16:9","1:1"]),O05=f.enum(["9:16","16:9","1:1","auto"]),NJ2=f.enum(["tiktok","lower-third","none"]),I05=f.enum(["auto","generate","stock","aigc","slide"]),AJ2=f.enum(["upbeat","calm","cinematic","lofi","piano","none"]),DJ2=f.enum(["remotion","mpt"]),Ns1=f.enum(["text","json"]),CS=f.literal(E8),GF4=f.object({id:f.string().min(1),durationSec:f.number().positive(),narration:f.string(),onScreenText:f.array(f.string()).default([]),visual:f.object({kind:f.enum(["still","clip","mixed","slide","capture"]),prompt:f.string().optional(),ref:f.string().optional(),source:f.string().optional()}),transition:f.string().optional()}),TS=f.object({schemaVersion:CS,mode:NX,aspect:zF4,locale:f.string().min(1),title:f.string().min(1),scenes:f.array(GF4).min(1),music:AJ2,brand:f.record(f.string(),f.unknown()).default({})}),v05=f.object({schemaVersion:CS,audio:f.string(),totalSec:f.number().nonnegative(),segments:f.array(f.object({sceneId:f.string().min(1),startSec:f.number().nonnegative(),endSec:f.number().nonnegative(),words:f.array(f.object({t:f.string(),startSec:f.number().nonnegative(),endSec:f.number().nonnegative()}))})),source:f.enum(["tts-native","voicebox-stt","whisper-cpp","estimated"])}),PS=f.object({schemaVersion:CS,compositor:DJ2,composition:f.string().min(1),slug:f.string().min(1).optional(),fps:f.number().int().positive(),dimensions:f.object({width:f.number().int().positive(),height:f.number().int().positive()}),durationInFrames:f.number().int().nonnegative(),audio:f.object({narration:f.string().optional(),music:f.string().optional(),musicGainDb:f.number().optional()}),scenes:f.array(f.object({id:f.string().min(1),fromFrame:f.number().int().nonnegative(),durationInFrames:f.number().int().positive(),visual:f.object({type:f.enum(["image","video","slide","capture","placeholder"]),src:f.string().min(1),kenBurns:f.boolean().default(!1)}),onScreenText:f.array(f.string()).default([]),transitionOut:f.string().optional()})),captions:f.object({file:f.string().optional(),style:NJ2,fontFamily:f.string(),maxWidthPct:f.number().positive().max(100),safeArea:f.object({topPct:f.number().nonnegative(),bottomPct:f.number().nonnegative(),leftPct:f.number().nonnegative(),rightPct:f.number().nonnegative()})}),background:f.object({type:f.enum(["color","image","video"]),src:f.string().optional()}),seed:f.number().int()}),ES=f.object({schemaVersion:CS,runId:f.string().min(1),mode:NX,providers:f.object({script:f.string().optional(),voice:f.string().optional(),visual:f.array(f.string()).default([]),caption:f.string().optional(),capture:f.string().optional(),music:f.string().optional(),compositor:f.string().optional()}),assets:f.array(f.object({path:f.string().min(1),sha256:f.string().regex(/^[a-f0-9]{64}$/),bytes:f.number().int().nonnegative(),seed:f.number().int().optional()})),outputs:f.object({video:f.string().optional(),durationSec:f.number().nonnegative().optional(),sha256:f.string().regex(/^[a-f0-9]{64}$/).optional()}),cost:f.object({usd:f.number().nonnegative(),breakdown:f.record(f.string(),f.number().nonnegative())}),warnings:f.array(f.string()),exitCode:f.number().int().min(0).max(6),nondeterministic:f.boolean().optional(),captureUrlMasked:f.string().optional(),prompt:f.string().optional(),promptSha256:f.string().regex(/^[a-f0-9]{64}$/).optional()})});async function _S($=process.cwd()){let z=vR($),G=structuredClone(Nu),J=RR(z,"video");if(J)G=kq(G,JF4(J));let Q=G;UF4(Q);let U=z?.language;if(typeof U==="string"&&U)Q.language=U;return Q}function JF4($){let z={},G={default_output_dir:"defaultOutputDir",default_mode:"defaultMode",default_aspect:"defaultAspect",default_locale:"defaultLocale",default_captions:"defaultCaptions",default_visual:"defaultVisual",default_voice:"defaultVoice",default_music:"defaultMusic",default_compositor:"defaultCompositor",default_timeout_sec:"defaultTimeoutSec"};for(let[J,Q]of Object.entries($)){let U=G[J]??J;if(U==="cost"&&Q&&typeof Q==="object"){let K=Q;z.cost={guardrailUsd:K.guardrail_usd??K.guardrailUsd??Nu.cost.guardrailUsd}}else if(U==="limits"&&Q&&typeof Q==="object"){let K=Q;z.limits={maxDurationSec:K.max_duration_sec??K.maxDurationSec??Nu.limits.maxDurationSec,maxScenes:K.max_scenes??K.maxScenes??Nu.limits.maxScenes}}else if(U==="naming"&&Q&&typeof Q==="object"){let K=Q;z.naming={singleFolderPattern:K.single_folder_pattern??K.singleFolderPattern??Nu.naming.singleFolderPattern}}else if(U==="providers"&&Q&&typeof Q==="object")z.providers=QF4(Q);else z[U]=Q}return z}function QF4($){let z={};for(let[G,J]of Object.entries($)){if(!J||typeof J!=="object"||Array.isArray(J)){z[G]=J;continue}let{env_var:Q,...U}=J;z[G]=Q===void 0?U:{...U,envVar:Q}}return z}function UF4($){if(process.env.OMA_VIDEO_DEFAULT_MODE){let z=NX.safeParse(process.env.OMA_VIDEO_DEFAULT_MODE);if(z.success)$.defaultMode=z.data}if(process.env.OMA_VIDEO_DEFAULT_OUT)$.defaultOutputDir=process.env.OMA_VIDEO_DEFAULT_OUT;if(process.env.OMA_VIDEO_YES==="1")$.yes=!0;$.providers.pexels.enabled=Boolean(process.env.PEXELS_API_KEY),$.providers.pixelle.enabled=Boolean(process.env.RUNNINGHUB_API_KEY)}var Nu;var jJ2=q(()=>{J3();Bq();t6();Nu={defaultOutputDir:`${G3}/videos`,defaultMode:"shorts",defaultAspect:"auto",defaultLocale:"en",defaultCaptions:"tiktok",defaultVisual:"auto",defaultVoice:"none",defaultMusic:"none",defaultCompositor:"remotion",defaultTimeoutSec:600,yes:!1,providers:{script:{order:["agent-script"]},voice:{order:["oma-voice"]},visual:{order:["oma-image","pexels","pixelle"]},caption:{order:["oma-captions"]},capture:{order:["playwright-web","cap"]},music:{order:["strudel"]},compositor:{order:["remotion","mpt"]},pexels:{enabled:!1,envVar:"PEXELS_API_KEY"},pixelle:{enabled:!1,envVar:"RUNNINGHUB_API_KEY"}},cost:{guardrailUsd:0.2},limits:{maxDurationSec:180,maxScenes:40},naming:{singleFolderPattern:"{timestamp}-{shortid}-{mode}"},language:"en"}});function L3(){return process.env.OMA_VIDEO_MOCK==="1"}var w05=0.35;import{readFile as KF4,stat as ZF4,writeFile as WF4}from"node:fs/promises";import uJ2 from"node:path";async function MJ2($,z){await WF4($,`${JSON.stringify(z,null,2)}
|
|
2562
2562
|
`,"utf8")}async function OJ2($,z){let G=PG("manifest.json",ES,z),J=uJ2.join($,"manifest.json");return await MJ2(J,G),J}async function Au($,z,G){let J=uJ2.resolve($,z),[Q,U]=await Promise.all([ZF4(J),KF4(J)]);return{path:uJ2.relative($,J),sha256:GK(U),bytes:Q.size,...G===void 0?{}:{seed:G}}}var xS=q(()=>{G$();t6()});function C05($,z=new Date){let J={timestamp:kX(z),shortid:P8(),mode:$};return{...J,value:JU("{timestamp}-{shortid}-{mode}",J)}}function T05($,z=40){let G=$.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").slice(0,z).replace(/-+$/,"");return G.length>0?G:"video"}var yS=()=>{};import{existsSync as kF4,realpathSync as BF4}from"node:fs";import SS from"node:path";class OW{cwd;id="cap";constructor($=process.cwd()){this.cwd=$}async available(){return{ok:!0}}estimateCost(){return{usd:0,basis:"guided / Cap CLI capture"}}async guide($){let z=(await QU("cap",["--version"])).ok;if($.capturePath)return{message:"Using the supplied --capture recording. Capture is performed by a human."};if(z)return{message:"Cap CLI detected. Record your walkthrough, then re-run with --capture <path>. Capture is performed by a human."};return{message:"No capture tool detected. Record your demo (Cap / openscreen / screen recorder), then re-run with --capture <path>. Capture is performed by a human."}}async ingest($){if(!$||$.trim().length===0)throw new s6("demo mode requires --capture <path> (capture is performed by a human).");let z=SS.resolve(this.cwd,$);if(!kF4(z))throw new i9(`--capture path does not exist: ${z}`,"capture");let G=SS.extname(z).toLowerCase();if(!P05.has(G))throw new i9(`--capture must be a video file (${[...P05].join(", ")}); got "${G||"no extension"}"`,"capture");let J=E05(z),Q=E05(this.cwd),U=SS.relative(Q,J);if(U.startsWith("..")||SS.isAbsolute(U))throw new i9(`--capture path "${$}" is outside $PWD.`,"capture");return{path:J}}}function E05($){try{return BF4($)}catch{return $}}var P05;var IJ2=q(()=>{KU();m9();P05=new Set([".mp4",".mov",".webm",".mkv"])});import{existsSync as b05,realpathSync as YF4,statSync as FF4}from"node:fs";import _05 from"node:path";class Du{cwd;id="playwright-web";constructor($=process.cwd()){this.cwd=$}async available(){let $=HX();if(!$.dir)return{ok:!1,reason:"Playwright not resolvable",remediation:"Run `oma video doctor --install-playwright`, or set OMA_VIDEO_PLAYWRIGHT_DIR."};if(!$.browserReady)return{ok:!1,reason:"Playwright chromium browser not installed",remediation:"Run `oma video doctor --install-playwright` to download chromium."};if(!YJ2())return{ok:!1,reason:"web capture driver not found",remediation:"Ensure the oma-video skill is installed (resources/playwright/record.mjs)."};return{ok:!0}}estimateCost(){return{usd:0,basis:"local headed web capture (no API)"}}async guide($){return{message:"Web capture opens a headed browser; perform your flow, then press ENTER to stop. Capture is performed by a human; no credentials are automated."}}async ingest($){let z=_05.resolve(this.cwd,$);if(!b05(z)||FF4(z).size===0)throw new s6(`web capture produced no usable file at ${x05(z)}`);return{path:LF4(z)}}async record($){if(!$.url||$.url.trim().length===0)throw new s6("web capture requires a target --url");let z=HX();if(!z.dir||!z.browserReady)throw new s6("Playwright not ready for web capture (run `oma video doctor --install-playwright`)");let G=YJ2();if(!G)throw new s6("web capture driver not found");let J=$.runDir??this.cwd,Q=_05.join(J,"capture.mp4"),U=$.size??{width:1280,height:720},K=[G,"--url",$.url,"--out",Q,"--size",`${U.width}x${U.height}`,"--playwright-dir",z.dir];if(K.push("--headless",$.stop?"1":"0"),$.readySelector)K.push("--ready-selector",$.readySelector);if($.showCursor)K.push("--show-cursor");if($.timeoutMs&&$.timeoutMs>0)K.push("--timeout",String($.timeoutMs));if($.stop)K.push("--stop",$.stop);if($.stop){let W=await o5(process.execPath,K,{cwd:z.dir,timeoutMs:$.timeoutMs?$.timeoutMs+60000:VF4,env:process.env}),k=HF4(W.stdout);if(k?.ok!==!0||!k.output){let B=k?.error??(W.stderr||W.stdout).trim().split(`
|
|
2563
2563
|
`).slice(-1)[0]??`exit ${W.code}`;throw new s6(`web capture failed: ${B}`)}return this.ingest(k.output)}let Z=await XF4(process.execPath,K,z.dir);if(Z!==0||!b05(Q))throw new s6(`web capture did not produce ${x05(Q)} (driver exit ${Z})`);return this.ingest(Q)}}function XF4($,z,G){return import("node:child_process").then(({spawn:J})=>new Promise((Q)=>{let U=J($,z,{stdio:"inherit",cwd:G});U.on("error",()=>Q(1)),U.on("close",(K)=>Q(K??1))}))}function HF4($){let G=$.trim().split(`
|
|
2564
|
-
`).map((J)=>J.trim()).filter((J)=>J.startsWith("{")&&J.endsWith("}")).at(-1);if(!G)return null;try{return JSON.parse(G)}catch{return null}}function LF4($){try{return YF4($)}catch{return $}}function x05($){return $.replace(/([?&][^=\s]+=)[^&\s]+/g,"$1<redacted>")}var VF4=3600000;var vJ2=q(()=>{KU();m9();uS()});function y05($,z,G){if($==="generate")return["oma-image"];if($==="stock")return["pexels","oma-image"];if($==="aigc")return["pixelle","oma-image"];if($==="slide")return["oma-slide","oma-image"];if(z==="explainer")return["oma-slide","oma-image",...G];return G}function S05($){let G=RJ2($.script.aspect),J=0,Q=$.script.scenes.map((U)=>{let K=Math.max(1,Math.round(U.durationSec*30)),Z=$.visualAssets.find((k)=>k.sceneId===U.id),W={id:U.id,fromFrame:J,durationInFrames:K,visual:{type:Z?.type??"placeholder",src:Z?.path??"",kenBurns:(Z?.type??"image")==="image"},onScreenText:U.onScreenText,transitionOut:U.transition};return J+=K,W});return{schemaVersion:E8,compositor:$.compositor,composition:NF4($.script.mode),slug:T05($.script.title),fps:30,dimensions:G,durationInFrames:J,audio:{narration:$.audio.path?$.audio.path:void 0,music:$.music?.path,musicGainDb:$.music?.path?qF4:void 0},scenes:Q,captions:{file:$.captions?.path,style:$.captionStyle,fontFamily:"Pretendard",maxWidthPct:$.script.aspect==="9:16"?86:72,safeArea:$.script.aspect==="9:16"?{topPct:8,bottomPct:18,leftPct:7,rightPct:7}:{topPct:6,bottomPct:10,leftPct:6,rightPct:6}},background:$.footageBackground?{type:"video",src:$.footageBackground}:{type:"color",src:"#0f1117"},seed:$.seed}}function RJ2($){if($==="9:16")return{width:1080,height:1920};if($==="1:1")return{width:1080,height:1080};return{width:1920,height:1080}}function NF4($){if($==="shorts")return"Shorts";if($==="demo")return"Demo";return"Explainer"}var qF4=-18;var wJ2=q(()=>{yS();t6()});import{realpathSync as AF4}from"node:fs";import{copyFile as DF4}from"node:fs/promises";import ju from"node:path";async function g05($,z){let G=z.normalized;if(G.source==="web"&&G.url){await jF4($,z);return}await uF4(G.capture,$,z)}async function jF4($,z){let G=z.normalized,J=new Du($),Q=Boolean(G.captureStop),U=Boolean(process.stdin.isTTY)&&!G.yes,K=await J.available();if(!K.ok||!Q&&!U){let W=!K.ok?K.reason??"Playwright unavailable":"no interactive TTY for the ENTER stop (and no --capture-stop)";z.providers.capture="cap";let B=await new OW($).guide({mode:"demo"}),Y=`web capture unavailable (${W}); ${B.message}`;throw z.warnings.push(`capture: ${Y}`),new s6(Y)}z.providers.capture=J.id,z.nondeterministic=!0;let Z=OF4(G.aspect,G.device);try{let W=await J.record({mode:"demo",source:"web",url:G.url,size:Z,readySelector:G.readySelector,showCursor:G.showCursor,timeoutMs:G.captureTimeoutSec?G.captureTimeoutSec*1000:void 0,runDir:z.runDir,stop:G.captureStop});z.capturedFootage=m05(z.runDir,W.path),z.warnings.push(`capture: recorded live web flow from ${CJ2(G.url??"")} → ${z.capturedFootage} (capture is performed by a human; URL/tokens masked)`)}catch(W){z.providers.capture="cap";let B=await new OW($).guide({mode:"demo"}),Y=`live web capture failed (${MW(W)}); ${B.message}`;throw z.warnings.push(`capture: ${Y}`),new s6(Y)}}async function uF4($,z,G){let J=new OW(z);if(G.providers.capture=J.id,!$){let U=await J.guide({mode:"demo"});throw G.warnings.push(`capture: ${U.message}`),new s6(U.message)}let Q=await J.ingest($);G.capturedFootage=m05(G.runDir,Q.path),G.warnings.push(`capture: ingested human recording ${Q.path} (capture is performed by a human)`)}async function f05($,z,G){if(!z.capturedFootage)return;let J=ju.resolve($,z.capturedFootage),Q=bS({composition:"Demo",slug:G}),U=ju.resolve($,Q);if(J!==U)await DF4(J,U);z.providers.compositor="raw-capture",z.outputs.video=Q;let K=await MF4(U);if(K!==null)z.outputs.durationSec=K;let Z=await Au($,Q,z.normalized.seed);z.assets.push(Z),z.outputs.sha256=Z.sha256}function m05($,z){let G=h05($),J=h05(z),Q=ju.relative(G,J);return Q.startsWith("..")||ju.isAbsolute(Q)?J:Q}function h05($){try{return AF4($)}catch{return ju.resolve($)}}async function MF4($){let z=await o5("ffprobe",["-v","error","-show_entries","format=duration","-of","default=noprint_wrappers=1:nokey=1",$],{timeoutMs:15000});if(z.code!==0)return null;let G=Number.parseFloat(z.stdout.trim());return Number.isFinite(G)&&G>0?G:null}function OF4($,z){if(z){let G=IF4[z.toLowerCase()];if(G)return G}return RJ2($)}function CJ2($){try{let z=new URL($),G=z.username?"***@":"",J=z.search?"?<redacted>":"",Q=z.hash?"#<redacted>":"";return`${z.protocol}//${G}${z.host}${z.pathname}${J}${Q}`}catch{return $.replace(/([?&][^=\s]+=)[^&\s]+/g,"$1<redacted>").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"<redacted>")}}var IF4;var TJ2=q(()=>{KU();m9();xS();IJ2();vJ2();t6();wJ2();IF4={desktop:{width:1920,height:1080},laptop:{width:1440,height:900},tablet:{width:1024,height:1366},mobile:{width:390,height:844}}});async function hS($,z,G,J){let Q=PG($,z,J);return await MJ2(G,Q),Q}function PJ2($){let z=Object.values($.ctx.costBreakdown).reduce((J,Q)=>J+Q,0),G={schemaVersion:E8,runId:$.ctx.runId.value,mode:$.ctx.normalized.mode,providers:$.ctx.providers,assets:$.ctx.assets,outputs:$.ctx.outputs,cost:{usd:Number(z.toFixed(4)),breakdown:$.ctx.costBreakdown},warnings:$.ctx.warnings,exitCode:$.exitCode,...$.ctx.nondeterministic?{nondeterministic:!0}:{},...$.ctx.normalized.source==="web"&&$.ctx.normalized.url?{captureUrlMasked:CJ2($.ctx.normalized.url)}:{},...$.includeBrief?{prompt:$.brief}:{promptSha256:GK($.brief)}};return PG("manifest.json",ES,G)}var i05=q(()=>{G$();xS();t6();TJ2()});function c05($,z,G){if(!$||$.trim().length===0)throw new i9("brief is required","generate");let J={mode:z.mode??G.defaultMode,aspect:z.aspect??G.defaultAspect,locale:z.locale??G.defaultLocale,captions:z.captions??G.defaultCaptions,visual:z.visual??G.defaultVisual,voice:z.voice??G.defaultVoice,music:z.music??G.defaultMusic,compositor:z.compositor??G.defaultCompositor,timeout:z.timeout??String(G.defaultTimeoutSec),maxUsd:z.maxUsd??String(G.cost.guardrailUsd),...z},Q=PG("generate options",vF4,J),U=Q.mode??G.defaultMode,K=Q.aspect??G.defaultAspect,Z=RF4(Q.duration,G),W=wF4(Q.maxUsd,"--max-usd"),k=Q.seed?gS(Q.seed,"--seed"):1,B=gS(Q.timeout??String(G.defaultTimeoutSec),"--timeout"),Y=Q.source??"file";if(U==="demo"&&Y==="web"){if(!Q.url||Q.url.trim().length===0)throw new i9("--source web requires --url <url>","generate options")}let F=Q.captureTimeout?gS(Q.captureTimeout,"--capture-timeout"):void 0;return{mode:U,aspect:K==="auto"?CF4(U):K,locale:Q.locale??G.defaultLocale,captions:Q.captions??G.defaultCaptions,visual:Q.visual??G.defaultVisual,voice:Q.voice??G.defaultVoice,music:Q.music??G.defaultMusic,durationSec:Z,compositor:Q.compositor??G.defaultCompositor,capture:Q.capture,source:Y,url:Q.url,device:Q.device,readySelector:Q.readySelector,showCursor:Q.showCursor===!0,polish:Q.polish===!0,captureTimeoutSec:F,captureStop:Q.captureStop,out:Q.out,allowExternalOut:Q.allowExternalOut===!0,maxUsd:W,seed:k,timeoutSec:B,yes:Q.yes===!0||G.yes,dryRun:Q.dryRun===!0,includeBriefInManifest:Q.briefInManifest??!0}}function RF4($,z){if(!$||$==="auto")return;let G=gS($,"--duration");if(G<=0||G>z.limits.maxDurationSec)throw new i9(`--duration must be between 1 and ${z.limits.maxDurationSec} seconds`,"generate options");return G}function gS($,z){let G=Number.parseInt($,10);if(!Number.isFinite(G))throw new i9(`${z} must be an integer`,"generate");return G}function wF4($,z){if($===void 0)return Number.POSITIVE_INFINITY;let G=Number.parseFloat($);if(!Number.isFinite(G)||G<0)throw new i9(`${z} must be a non-negative number`,"generate");return G}function CF4($){return $==="shorts"?"9:16":"16:9"}var vF4;var l05=q(()=>{r0();KU();t6();vF4=f.object({mode:NX.optional(),aspect:O05.optional(),locale:f.string().min(1).optional(),captions:NJ2.optional(),visual:I05.optional(),voice:f.string().optional(),music:AJ2.optional(),duration:f.string().optional(),compositor:DJ2.optional(),capture:f.string().optional(),source:f.enum(["file","web"]).optional(),url:f.string().optional(),device:f.string().optional(),readySelector:f.string().optional(),showCursor:f.boolean().optional(),polish:f.boolean().optional(),captureTimeout:f.string().optional(),captureStop:f.string().optional(),out:f.string().optional(),allowExternalOut:f.boolean().optional(),maxUsd:f.string().optional(),seed:f.string().optional(),timeout:f.string().optional(),yes:f.boolean().optional(),dryRun:f.boolean().optional(),format:f.enum(["text","json"]).optional(),briefInManifest:f.boolean().optional()})});import EJ2 from"node:path";function p05($){let z=$.cwd??process.cwd(),G=$.outFlag?EJ2.resolve(z,$.outFlag):EJ2.resolve(z,$.defaultBase),J=EJ2.resolve(G,JU($.singleFolderPattern,{timestamp:$.runId.timestamp,shortid:$.runId.shortid,mode:$.runId.mode}));return VS({resolved:J,cwd:z,allowExternal:$.allowExternal,outFlag:$.outFlag})}var d05=q(()=>{kJ2();yS()});import{mkdir as TF4}from"node:fs/promises";import bJ2 from"node:path";class _J2{config;registry;constructor($,z){this.config=$;this.registry=z}async generate($){let z,G=$.cwd??process.cwd();try{let J=c05($.brief,$.opts,this.config),Q=C05(J.mode),U=p05({outFlag:J.out,allowExternal:J.allowExternalOut,defaultBase:this.config.defaultOutputDir,runId:Q,singleFolderPattern:this.config.naming.singleFolderPattern,cwd:G});await TF4(U,{recursive:!0}),z={runId:Q,runDir:U,normalized:J,warnings:[],providers:{visual:[]},assets:[],costBreakdown:{},outputs:{}};let K={text:$.brief.trim(),mode:J.mode,aspect:J.aspect,locale:J.locale,durationSec:J.durationSec,seed:J.seed},Z=await this.pickProvider("script",this.config.providers.script.order,K,z),W=await Z.generate(K,{maxScenes:this.config.limits.maxScenes});z.providers.script=Z.id;let k=bJ2.join(U,"script.json");if(await hS("script.json",TS,k,W),J.mode==="demo")await g05(G,z);let B=await this.pickProvider("voice",this.config.providers.voice.order,W,z),{audio:Y,timing:F}=await B.synthesize(W.scenes.map((T)=>({sceneId:T.id,text:T.narration,durationSec:T.durationSec})),{runDir:U,voice:J.voice,locale:J.locale,dryRun:J.dryRun});z.providers.voice=B.id,z.warnings.push(F.source==="estimated"?`voice provider ${B.id} used fallback path: estimated timing, no audio (source: estimated)`:`voice provider ${B.id} used real path (source: ${F.source})`);let V=bJ2.join(U,"timing.json");await hS("timing.json",v05,V,F);let X=[],H=y05(J.visual,J.mode,this.config.providers.visual.order),L=J.timeoutSec*1000;for(let T of W.scenes){let I=await this.runFallbackChain("visual",H,T,z,(R)=>R.produce(T,{runDir:U,seed:J.seed,aspect:J.aspect,timeoutMs:L,dryRun:J.dryRun}));if(X.push(I),z.providers.visual.push(I.providerId),I.pathTaken==="fallback")z.warnings.push(`visual provider ${I.providerId} used fallback path for ${T.id} (placeholder asset)`)}z.providers.visual=[...new Set(z.providers.visual)];let N;if(J.captions!=="none"){let T=await this.pickProvider("caption",this.config.providers.caption.order,F,z);if(N=await T.align(W.scenes.map((I)=>I.narration),F,Y,{runDir:U,style:J.captions,locale:J.locale,sourceLocale:W.locale,dryRun:J.dryRun}),z.providers.caption=T.id,J.locale!==W.locale&&N.pathTaken==="fallback")z.warnings.push(`caption provider ${T.id} kept source locale ${W.locale} (oma-translator unavailable for ${J.locale})`)}let A=J.mode==="demo"&&z.capturedFootage?z.capturedFootage:void 0,D=await this.composeMusic(W.music!=="none"?W.music:J.music,W.scenes.reduce((T,I)=>T+I.durationSec,0),{runDir:U,seed:J.seed,timeoutSec:J.timeoutSec},J.dryRun,z),u=S05({script:W,timing:F,audio:Y,captions:N,visualAssets:X,compositor:J.compositor,seed:J.seed,captionStyle:J.captions,footageBackground:A,music:D}),v=bJ2.join(U,"render-spec.json");if(await hS("render-spec.json",PS,v,u),!J.dryRun&&J.mode==="demo"&&z.capturedFootage&&!J.polish&&z.capturedFootage)await f05(U,z,u.slug);else if(!J.dryRun){let T=await this.pickProvider("compositor",[J.compositor],u,z);z.providers.compositor=T.id;let I=process.cwd();try{process.chdir(U);let R=await T.render(u);if(z.outputs.video=R.path,z.outputs.durationSec=R.durationSec,R.warnings?.length)z.warnings.push(...R.warnings.map((x)=>`compositor ${T.id}: ${x}`));z.assets.push(await Au(U,R.path,J.seed)),z.outputs.sha256=z.assets.find((x)=>x.path===R.path)?.sha256}finally{process.chdir(I)}}else z.providers.compositor=J.compositor;let M=["script.json","timing.json","render-spec.json",...Y.path?[Y.path]:[],...X.map((T)=>T.path),...N?[N.path]:[],...N?.vttPath?[N.vttPath]:[],...D.path?[D.path]:[],...D.mp3Path?[D.mp3Path]:[]];z.assets.push(...await Promise.all(M.map((T)=>Au(U,T,J.seed))));let O=PJ2({ctx:z,brief:$.brief,exitCode:TG.ok,includeBrief:J.includeBriefInManifest}),w=await OJ2(U,O);return{exitCode:TG.ok,runDir:U,manifestPath:w,scriptPath:k,renderSpecPath:v,warnings:z.warnings,manifest:O}}catch(J){return await this.handleFailure(J,$.brief,z)}}async composeMusic($,z,G,J,Q){if($==="none")return{mode:"none",pathTaken:"fallback"};let U=this.config.providers.music.order,K;if(L3()||J){let[W]=this.registry.resolve("music",U);if(!W)return{mode:$,pathTaken:"fallback"};K=W}else try{K=await this.pickProvider("music",U,{mode:$,durationSec:z},Q)}catch(W){if(!(W instanceof qX))throw W;return Q.warnings.push(`music: requested "${$}" but no music provider is available — rendering without music`),{mode:$,pathTaken:"fallback",reason:W.message}}Q.providers.music=K.id;let Z=await K.compose({runDir:G.runDir,mode:$,durationSec:z,seed:G.seed,timeoutMs:G.timeoutSec*1000,dryRun:J});return Q.warnings.push(Z.pathTaken==="real"?`music provider ${K.id} rendered a "${Z.mode}" bed (${Z.path})`:`music provider ${K.id} used fallback path: ${Z.reason??"no bed produced"} — rendering without music`),Z}async pickProvider($,z,G,J){return await this.runFallbackChain($,z,G,J,async(U)=>U)}async runFallbackChain($,z,G,J,Q){let U=this.registry.resolve($,z),K=[];for(let Z of U){let W=await Z.available();if(!W.ok){K.push(`${Z.id}: ${W.reason??"unavailable"}`),J.warnings.push(`${$} provider ${Z.id} unavailable: ${W.reason??"unavailable"}`);continue}let k=Z.estimateCost(G);J.costBreakdown[Z.id]=(J.costBreakdown[Z.id]??0)+k.usd;let B=Object.values(J.costBreakdown).reduce((Y,F)=>Y+F,0);if(k.usd>0&&B>=J.normalized.maxUsd&&!J.normalized.yes)throw new wS(`estimated ${B.toFixed(2)} USD total (${Z.id} +${k.usd.toFixed(2)}, ${k.basis}); pass -y or raise --max-usd to continue.`);try{return await Q(Z)}catch(Y){if(Y instanceof wS)throw Y;K.push(`${Z.id}: ${MW(Y)}`),J.warnings.push(`${$} provider ${Z.id} failed: ${MW(Y)}`)}}throw new qX(`${$} provider chain exhausted (${K.join("; ")})`)}async handleFailure($,z,G){let J=M05($),Q=MW($);if(!G)return{exitCode:J,warnings:[],error:Q};G.warnings.push(Q);let U=PJ2({ctx:G,brief:z,exitCode:J,includeBrief:G.normalized.includeBriefInManifest});try{let K=await OJ2(G.runDir,U);return{exitCode:J,runDir:G.runDir,manifestPath:K,warnings:G.warnings,error:Q,manifest:U}}catch(K){return{exitCode:J,runDir:G.runDir,warnings:G.warnings,error:`${Q}; failed to write manifest: ${MW(K)}`}}}}var n05=q(()=>{KU();xS();yS();TJ2();i05();l05();wJ2();d05();t6()});import{writeFile as a05}from"node:fs/promises";import o05 from"node:path";class xJ2{id="oma-captions";async available(){return{ok:!0}}estimateCost(){return{usd:0,basis:"key-free captions from timing"}}async align($,z,G,J){let Q=!L3()&&!J.dryRun&&J.locale!==J.sourceLocale,U=$,K=J.sourceLocale,Z="fallback";if(Q){let F=await this.translate($,J);if(F)U=F,K=J.locale,Z="real"}let W=PF4(z,U),k=EF4(z,U),B="captions.srt",Y="captions.vtt";return await a05(o05.join(J.runDir,B),W,"utf8"),await a05(o05.join(J.runDir,Y),k,"utf8"),{path:B,vttPath:Y,style:J.style,locale:K,pathTaken:Z}}async translate($,z){return null}}function t05($,z,G){let J=z[G];if(J&&J.trim().length>0)return J.trim();let Q=$.segments[G];return Q?Q.words.map((U)=>U.t).join(" "):""}function PF4($,z){return $.segments.map((G,J)=>[String(J+1),`${r05(G.startSec)} --> ${r05(G.endSec)}`,t05($,z,J),""].join(`
|
|
2564
|
+
`).map((J)=>J.trim()).filter((J)=>J.startsWith("{")&&J.endsWith("}")).at(-1);if(!G)return null;try{return JSON.parse(G)}catch{return null}}function LF4($){try{return YF4($)}catch{return $}}function x05($){return $.replace(/([?&][^=\s]+=)[^&\s]+/g,"$1<redacted>")}var VF4=3600000;var vJ2=q(()=>{KU();m9();uS()});function y05($,z,G){if($==="generate")return["oma-image"];if($==="stock")return["pexels","oma-image"];if($==="aigc")return["pixelle","oma-image"];if($==="slide")return["oma-slide","oma-image"];if(z==="explainer")return["oma-slide","oma-image",...G];return G}function S05($){let G=RJ2($.script.aspect),J=0,Q=$.script.scenes.map((U)=>{let K=Math.max(1,Math.round(U.durationSec*30)),Z=$.visualAssets.find((k)=>k.sceneId===U.id),W={id:U.id,fromFrame:J,durationInFrames:K,visual:{type:Z?.type??"placeholder",src:Z?.path??"",kenBurns:!1},onScreenText:U.onScreenText,transitionOut:U.transition};return J+=K,W});return{schemaVersion:E8,compositor:$.compositor,composition:NF4($.script.mode),slug:T05($.script.title),fps:30,dimensions:G,durationInFrames:J,audio:{narration:$.audio.path?$.audio.path:void 0,music:$.music?.path,musicGainDb:$.music?.path?qF4:void 0},scenes:Q,captions:{file:$.captions?.path,style:$.captionStyle,fontFamily:"Pretendard",maxWidthPct:$.script.aspect==="9:16"?86:72,safeArea:$.script.aspect==="9:16"?{topPct:8,bottomPct:18,leftPct:7,rightPct:7}:{topPct:6,bottomPct:10,leftPct:6,rightPct:6}},background:$.footageBackground?{type:"video",src:$.footageBackground}:{type:"color",src:"#0f1117"},seed:$.seed}}function RJ2($){if($==="9:16")return{width:1080,height:1920};if($==="1:1")return{width:1080,height:1080};return{width:1920,height:1080}}function NF4($){if($==="shorts")return"Shorts";if($==="demo")return"Demo";return"Explainer"}var qF4=-18;var wJ2=q(()=>{yS();t6()});import{realpathSync as AF4}from"node:fs";import{copyFile as DF4}from"node:fs/promises";import ju from"node:path";async function g05($,z){let G=z.normalized;if(G.source==="web"&&G.url){await jF4($,z);return}await uF4(G.capture,$,z)}async function jF4($,z){let G=z.normalized,J=new Du($),Q=Boolean(G.captureStop),U=Boolean(process.stdin.isTTY)&&!G.yes,K=await J.available();if(!K.ok||!Q&&!U){let W=!K.ok?K.reason??"Playwright unavailable":"no interactive TTY for the ENTER stop (and no --capture-stop)";z.providers.capture="cap";let B=await new OW($).guide({mode:"demo"}),Y=`web capture unavailable (${W}); ${B.message}`;throw z.warnings.push(`capture: ${Y}`),new s6(Y)}z.providers.capture=J.id,z.nondeterministic=!0;let Z=OF4(G.aspect,G.device);try{let W=await J.record({mode:"demo",source:"web",url:G.url,size:Z,readySelector:G.readySelector,showCursor:G.showCursor,timeoutMs:G.captureTimeoutSec?G.captureTimeoutSec*1000:void 0,runDir:z.runDir,stop:G.captureStop});z.capturedFootage=m05(z.runDir,W.path),z.warnings.push(`capture: recorded live web flow from ${CJ2(G.url??"")} → ${z.capturedFootage} (capture is performed by a human; URL/tokens masked)`)}catch(W){z.providers.capture="cap";let B=await new OW($).guide({mode:"demo"}),Y=`live web capture failed (${MW(W)}); ${B.message}`;throw z.warnings.push(`capture: ${Y}`),new s6(Y)}}async function uF4($,z,G){let J=new OW(z);if(G.providers.capture=J.id,!$){let U=await J.guide({mode:"demo"});throw G.warnings.push(`capture: ${U.message}`),new s6(U.message)}let Q=await J.ingest($);G.capturedFootage=m05(G.runDir,Q.path),G.warnings.push(`capture: ingested human recording ${Q.path} (capture is performed by a human)`)}async function f05($,z,G){if(!z.capturedFootage)return;let J=ju.resolve($,z.capturedFootage),Q=bS({composition:"Demo",slug:G}),U=ju.resolve($,Q);if(J!==U)await DF4(J,U);z.providers.compositor="raw-capture",z.outputs.video=Q;let K=await MF4(U);if(K!==null)z.outputs.durationSec=K;let Z=await Au($,Q,z.normalized.seed);z.assets.push(Z),z.outputs.sha256=Z.sha256}function m05($,z){let G=h05($),J=h05(z),Q=ju.relative(G,J);return Q.startsWith("..")||ju.isAbsolute(Q)?J:Q}function h05($){try{return AF4($)}catch{return ju.resolve($)}}async function MF4($){let z=await o5("ffprobe",["-v","error","-show_entries","format=duration","-of","default=noprint_wrappers=1:nokey=1",$],{timeoutMs:15000});if(z.code!==0)return null;let G=Number.parseFloat(z.stdout.trim());return Number.isFinite(G)&&G>0?G:null}function OF4($,z){if(z){let G=IF4[z.toLowerCase()];if(G)return G}return RJ2($)}function CJ2($){try{let z=new URL($),G=z.username?"***@":"",J=z.search?"?<redacted>":"",Q=z.hash?"#<redacted>":"";return`${z.protocol}//${G}${z.host}${z.pathname}${J}${Q}`}catch{return $.replace(/([?&][^=\s]+=)[^&\s]+/g,"$1<redacted>").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"<redacted>")}}var IF4;var TJ2=q(()=>{KU();m9();xS();IJ2();vJ2();t6();wJ2();IF4={desktop:{width:1920,height:1080},laptop:{width:1440,height:900},tablet:{width:1024,height:1366},mobile:{width:390,height:844}}});async function hS($,z,G,J){let Q=PG($,z,J);return await MJ2(G,Q),Q}function PJ2($){let z=Object.values($.ctx.costBreakdown).reduce((J,Q)=>J+Q,0),G={schemaVersion:E8,runId:$.ctx.runId.value,mode:$.ctx.normalized.mode,providers:$.ctx.providers,assets:$.ctx.assets,outputs:$.ctx.outputs,cost:{usd:Number(z.toFixed(4)),breakdown:$.ctx.costBreakdown},warnings:$.ctx.warnings,exitCode:$.exitCode,...$.ctx.nondeterministic?{nondeterministic:!0}:{},...$.ctx.normalized.source==="web"&&$.ctx.normalized.url?{captureUrlMasked:CJ2($.ctx.normalized.url)}:{},...$.includeBrief?{prompt:$.brief}:{promptSha256:GK($.brief)}};return PG("manifest.json",ES,G)}var i05=q(()=>{G$();xS();t6();TJ2()});function c05($,z,G){if(!$||$.trim().length===0)throw new i9("brief is required","generate");let J={mode:z.mode??G.defaultMode,aspect:z.aspect??G.defaultAspect,locale:z.locale??G.defaultLocale,captions:z.captions??G.defaultCaptions,visual:z.visual??G.defaultVisual,voice:z.voice??G.defaultVoice,music:z.music??G.defaultMusic,compositor:z.compositor??G.defaultCompositor,timeout:z.timeout??String(G.defaultTimeoutSec),maxUsd:z.maxUsd??String(G.cost.guardrailUsd),...z},Q=PG("generate options",vF4,J),U=Q.mode??G.defaultMode,K=Q.aspect??G.defaultAspect,Z=RF4(Q.duration,G),W=wF4(Q.maxUsd,"--max-usd"),k=Q.seed?gS(Q.seed,"--seed"):1,B=gS(Q.timeout??String(G.defaultTimeoutSec),"--timeout"),Y=Q.source??"file";if(U==="demo"&&Y==="web"){if(!Q.url||Q.url.trim().length===0)throw new i9("--source web requires --url <url>","generate options")}let F=Q.captureTimeout?gS(Q.captureTimeout,"--capture-timeout"):void 0;return{mode:U,aspect:K==="auto"?CF4(U):K,locale:Q.locale??G.defaultLocale,captions:Q.captions??G.defaultCaptions,visual:Q.visual??G.defaultVisual,voice:Q.voice??G.defaultVoice,music:Q.music??G.defaultMusic,durationSec:Z,compositor:Q.compositor??G.defaultCompositor,capture:Q.capture,source:Y,url:Q.url,device:Q.device,readySelector:Q.readySelector,showCursor:Q.showCursor===!0,polish:Q.polish===!0,captureTimeoutSec:F,captureStop:Q.captureStop,out:Q.out,allowExternalOut:Q.allowExternalOut===!0,maxUsd:W,seed:k,timeoutSec:B,yes:Q.yes===!0||G.yes,dryRun:Q.dryRun===!0,includeBriefInManifest:Q.briefInManifest??!0}}function RF4($,z){if(!$||$==="auto")return;let G=gS($,"--duration");if(G<=0||G>z.limits.maxDurationSec)throw new i9(`--duration must be between 1 and ${z.limits.maxDurationSec} seconds`,"generate options");return G}function gS($,z){let G=Number.parseInt($,10);if(!Number.isFinite(G))throw new i9(`${z} must be an integer`,"generate");return G}function wF4($,z){if($===void 0)return Number.POSITIVE_INFINITY;let G=Number.parseFloat($);if(!Number.isFinite(G)||G<0)throw new i9(`${z} must be a non-negative number`,"generate");return G}function CF4($){return $==="shorts"?"9:16":"16:9"}var vF4;var l05=q(()=>{r0();KU();t6();vF4=f.object({mode:NX.optional(),aspect:O05.optional(),locale:f.string().min(1).optional(),captions:NJ2.optional(),visual:I05.optional(),voice:f.string().optional(),music:AJ2.optional(),duration:f.string().optional(),compositor:DJ2.optional(),capture:f.string().optional(),source:f.enum(["file","web"]).optional(),url:f.string().optional(),device:f.string().optional(),readySelector:f.string().optional(),showCursor:f.boolean().optional(),polish:f.boolean().optional(),captureTimeout:f.string().optional(),captureStop:f.string().optional(),out:f.string().optional(),allowExternalOut:f.boolean().optional(),maxUsd:f.string().optional(),seed:f.string().optional(),timeout:f.string().optional(),yes:f.boolean().optional(),dryRun:f.boolean().optional(),format:f.enum(["text","json"]).optional(),briefInManifest:f.boolean().optional()})});import EJ2 from"node:path";function p05($){let z=$.cwd??process.cwd(),G=$.outFlag?EJ2.resolve(z,$.outFlag):EJ2.resolve(z,$.defaultBase),J=EJ2.resolve(G,JU($.singleFolderPattern,{timestamp:$.runId.timestamp,shortid:$.runId.shortid,mode:$.runId.mode}));return VS({resolved:J,cwd:z,allowExternal:$.allowExternal,outFlag:$.outFlag})}var d05=q(()=>{kJ2();yS()});import{mkdir as TF4}from"node:fs/promises";import bJ2 from"node:path";class _J2{config;registry;constructor($,z){this.config=$;this.registry=z}async generate($){let z,G=$.cwd??process.cwd();try{let J=c05($.brief,$.opts,this.config),Q=C05(J.mode),U=p05({outFlag:J.out,allowExternal:J.allowExternalOut,defaultBase:this.config.defaultOutputDir,runId:Q,singleFolderPattern:this.config.naming.singleFolderPattern,cwd:G});await TF4(U,{recursive:!0}),z={runId:Q,runDir:U,normalized:J,warnings:[],providers:{visual:[]},assets:[],costBreakdown:{},outputs:{}};let K={text:$.brief.trim(),mode:J.mode,aspect:J.aspect,locale:J.locale,durationSec:J.durationSec,seed:J.seed},Z=await this.pickProvider("script",this.config.providers.script.order,K,z),W=await Z.generate(K,{maxScenes:this.config.limits.maxScenes});z.providers.script=Z.id;let k=bJ2.join(U,"script.json");if(await hS("script.json",TS,k,W),J.mode==="demo")await g05(G,z);let B=await this.pickProvider("voice",this.config.providers.voice.order,W,z),{audio:Y,timing:F}=await B.synthesize(W.scenes.map((T)=>({sceneId:T.id,text:T.narration,durationSec:T.durationSec})),{runDir:U,voice:J.voice,locale:J.locale,dryRun:J.dryRun});z.providers.voice=B.id,z.warnings.push(F.source==="estimated"?`voice provider ${B.id} used fallback path: estimated timing, no audio (source: estimated)`:`voice provider ${B.id} used real path (source: ${F.source})`);let V=bJ2.join(U,"timing.json");await hS("timing.json",v05,V,F);let X=[],H=y05(J.visual,J.mode,this.config.providers.visual.order),L=J.timeoutSec*1000;for(let T of W.scenes){let I=await this.runFallbackChain("visual",H,T,z,(R)=>R.produce(T,{runDir:U,seed:J.seed,aspect:J.aspect,timeoutMs:L,dryRun:J.dryRun}));if(X.push(I),z.providers.visual.push(I.providerId),I.pathTaken==="fallback")z.warnings.push(`visual provider ${I.providerId} used fallback path for ${T.id} (placeholder asset)`)}z.providers.visual=[...new Set(z.providers.visual)];let N;if(J.captions!=="none"){let T=await this.pickProvider("caption",this.config.providers.caption.order,F,z);if(N=await T.align(W.scenes.map((I)=>I.narration),F,Y,{runDir:U,style:J.captions,locale:J.locale,sourceLocale:W.locale,dryRun:J.dryRun}),z.providers.caption=T.id,J.locale!==W.locale&&N.pathTaken==="fallback")z.warnings.push(`caption provider ${T.id} kept source locale ${W.locale} (oma-translator unavailable for ${J.locale})`)}let A=J.mode==="demo"&&z.capturedFootage?z.capturedFootage:void 0,D=await this.composeMusic(W.music!=="none"?W.music:J.music,W.scenes.reduce((T,I)=>T+I.durationSec,0),{runDir:U,seed:J.seed,timeoutSec:J.timeoutSec},J.dryRun,z),u=S05({script:W,timing:F,audio:Y,captions:N,visualAssets:X,compositor:J.compositor,seed:J.seed,captionStyle:J.captions,footageBackground:A,music:D}),v=bJ2.join(U,"render-spec.json");if(await hS("render-spec.json",PS,v,u),!J.dryRun&&J.mode==="demo"&&z.capturedFootage&&!J.polish&&z.capturedFootage)await f05(U,z,u.slug);else if(!J.dryRun){let T=await this.pickProvider("compositor",[J.compositor],u,z);z.providers.compositor=T.id;let I=process.cwd();try{process.chdir(U);let R=await T.render(u);if(z.outputs.video=R.path,z.outputs.durationSec=R.durationSec,R.warnings?.length)z.warnings.push(...R.warnings.map((x)=>`compositor ${T.id}: ${x}`));z.assets.push(await Au(U,R.path,J.seed)),z.outputs.sha256=z.assets.find((x)=>x.path===R.path)?.sha256}finally{process.chdir(I)}}else z.providers.compositor=J.compositor;let M=["script.json","timing.json","render-spec.json",...Y.path?[Y.path]:[],...X.map((T)=>T.path),...N?[N.path]:[],...N?.vttPath?[N.vttPath]:[],...D.path?[D.path]:[],...D.mp3Path?[D.mp3Path]:[]];z.assets.push(...await Promise.all(M.map((T)=>Au(U,T,J.seed))));let O=PJ2({ctx:z,brief:$.brief,exitCode:TG.ok,includeBrief:J.includeBriefInManifest}),w=await OJ2(U,O);return{exitCode:TG.ok,runDir:U,manifestPath:w,scriptPath:k,renderSpecPath:v,warnings:z.warnings,manifest:O}}catch(J){return await this.handleFailure(J,$.brief,z)}}async composeMusic($,z,G,J,Q){if($==="none")return{mode:"none",pathTaken:"fallback"};let U=this.config.providers.music.order,K;if(L3()||J){let[W]=this.registry.resolve("music",U);if(!W)return{mode:$,pathTaken:"fallback"};K=W}else try{K=await this.pickProvider("music",U,{mode:$,durationSec:z},Q)}catch(W){if(!(W instanceof qX))throw W;return Q.warnings.push(`music: requested "${$}" but no music provider is available — rendering without music`),{mode:$,pathTaken:"fallback",reason:W.message}}Q.providers.music=K.id;let Z=await K.compose({runDir:G.runDir,mode:$,durationSec:z,seed:G.seed,timeoutMs:G.timeoutSec*1000,dryRun:J});return Q.warnings.push(Z.pathTaken==="real"?`music provider ${K.id} rendered a "${Z.mode}" bed (${Z.path})`:`music provider ${K.id} used fallback path: ${Z.reason??"no bed produced"} — rendering without music`),Z}async pickProvider($,z,G,J){return await this.runFallbackChain($,z,G,J,async(U)=>U)}async runFallbackChain($,z,G,J,Q){let U=this.registry.resolve($,z),K=[];for(let Z of U){let W=await Z.available();if(!W.ok){K.push(`${Z.id}: ${W.reason??"unavailable"}`),J.warnings.push(`${$} provider ${Z.id} unavailable: ${W.reason??"unavailable"}`);continue}let k=Z.estimateCost(G);J.costBreakdown[Z.id]=(J.costBreakdown[Z.id]??0)+k.usd;let B=Object.values(J.costBreakdown).reduce((Y,F)=>Y+F,0);if(k.usd>0&&B>=J.normalized.maxUsd&&!J.normalized.yes)throw new wS(`estimated ${B.toFixed(2)} USD total (${Z.id} +${k.usd.toFixed(2)}, ${k.basis}); pass -y or raise --max-usd to continue.`);try{return await Q(Z)}catch(Y){if(Y instanceof wS)throw Y;K.push(`${Z.id}: ${MW(Y)}`),J.warnings.push(`${$} provider ${Z.id} failed: ${MW(Y)}`)}}throw new qX(`${$} provider chain exhausted (${K.join("; ")})`)}async handleFailure($,z,G){let J=M05($),Q=MW($);if(!G)return{exitCode:J,warnings:[],error:Q};G.warnings.push(Q);let U=PJ2({ctx:G,brief:z,exitCode:J,includeBrief:G.normalized.includeBriefInManifest});try{let K=await OJ2(G.runDir,U);return{exitCode:J,runDir:G.runDir,manifestPath:K,warnings:G.warnings,error:Q,manifest:U}}catch(K){return{exitCode:J,runDir:G.runDir,warnings:G.warnings,error:`${Q}; failed to write manifest: ${MW(K)}`}}}}var n05=q(()=>{KU();xS();yS();TJ2();i05();l05();wJ2();d05();t6()});import{writeFile as a05}from"node:fs/promises";import o05 from"node:path";class xJ2{id="oma-captions";async available(){return{ok:!0}}estimateCost(){return{usd:0,basis:"key-free captions from timing"}}async align($,z,G,J){let Q=!L3()&&!J.dryRun&&J.locale!==J.sourceLocale,U=$,K=J.sourceLocale,Z="fallback";if(Q){let F=await this.translate($,J);if(F)U=F,K=J.locale,Z="real"}let W=PF4(z,U),k=EF4(z,U),B="captions.srt",Y="captions.vtt";return await a05(o05.join(J.runDir,B),W,"utf8"),await a05(o05.join(J.runDir,Y),k,"utf8"),{path:B,vttPath:Y,style:J.style,locale:K,pathTaken:Z}}async translate($,z){return null}}function t05($,z,G){let J=z[G];if(J&&J.trim().length>0)return J.trim();let Q=$.segments[G];return Q?Q.words.map((U)=>U.t).join(" "):""}function PF4($,z){return $.segments.map((G,J)=>[String(J+1),`${r05(G.startSec)} --> ${r05(G.endSec)}`,t05($,z,J),""].join(`
|
|
2565
2565
|
`)).join(`
|
|
2566
2566
|
`)}function EF4($,z){return`WEBVTT
|
|
2567
2567
|
|
package/package.json
CHANGED