clawui 0.0.4 → 0.0.5
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/dist/index.js +1 -0
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
import{createRequire as h9}from"node:module";var F9=Object.create;var{getPrototypeOf:O9,defineProperty:f1,getOwnPropertyNames:f9}=Object;var v9=Object.prototype.hasOwnProperty;var g=(Y,q,Z)=>{Z=Y!=null?F9(O9(Y)):{};let J=q||!Y||!Y.__esModule?f1(Z,"default",{value:Y,enumerable:!0}):Z;for(let Q of f9(Y))if(!v9.call(J,Q))f1(J,Q,{get:()=>Y[Q],enumerable:!0});return J};var f=(Y,q)=>()=>(q||Y((q={exports:{}}).exports,q),q.exports);var m=h9(import.meta.url);var c=f((u9)=>{class R1 extends Error{constructor(Y,q,Z){super(Z);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=q,this.exitCode=Y,this.nestedError=void 0}}class v1 extends R1{constructor(Y){super(1,"commander.invalidArgument",Y);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}u9.CommanderError=R1;u9.InvalidArgumentError=v1});var p=f((d9)=>{var{InvalidArgumentError:c9}=c();class h1{constructor(Y,q){switch(this.description=q||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,Y[0]){case"<":this.required=!0,this._name=Y.slice(1,-1);break;case"[":this.required=!1,this._name=Y.slice(1,-1);break;default:this.required=!0,this._name=Y;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(Y,q){if(q===this.defaultValue||!Array.isArray(q))return[Y];return q.push(Y),q}default(Y,q){return this.defaultValue=Y,this.defaultValueDescription=q,this}argParser(Y){return this.parseArg=Y,this}choices(Y){return this.argChoices=Y.slice(),this.parseArg=(q,Z)=>{if(!this.argChoices.includes(q))throw new c9(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(q,Z);return q},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function l9(Y){let q=Y.name()+(Y.variadic===!0?"...":"");return Y.required?"<"+q+">":"["+q+"]"}d9.Argument=h1;d9.humanReadableArgName=l9});var S1=f((n9)=>{var{humanReadableArgName:a9}=p();class u1{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(Y){this.helpWidth=this.helpWidth??Y.helpWidth??80}visibleCommands(Y){let q=Y.commands.filter((J)=>!J._hidden),Z=Y._getHelpCommand();if(Z&&!Z._hidden)q.push(Z);if(this.sortSubcommands)q.sort((J,Q)=>{return J.name().localeCompare(Q.name())});return q}compareOptions(Y,q){let Z=(J)=>{return J.short?J.short.replace(/^-/,""):J.long.replace(/^--/,"")};return Z(Y).localeCompare(Z(q))}visibleOptions(Y){let q=Y.options.filter((J)=>!J.hidden),Z=Y._getHelpOption();if(Z&&!Z.hidden){let J=Z.short&&Y._findOption(Z.short),Q=Z.long&&Y._findOption(Z.long);if(!J&&!Q)q.push(Z);else if(Z.long&&!Q)q.push(Y.createOption(Z.long,Z.description));else if(Z.short&&!J)q.push(Y.createOption(Z.short,Z.description))}if(this.sortOptions)q.sort(this.compareOptions);return q}visibleGlobalOptions(Y){if(!this.showGlobalOptions)return[];let q=[];for(let Z=Y.parent;Z;Z=Z.parent){let J=Z.options.filter((Q)=>!Q.hidden);q.push(...J)}if(this.sortOptions)q.sort(this.compareOptions);return q}visibleArguments(Y){if(Y._argsDescription)Y.registeredArguments.forEach((q)=>{q.description=q.description||Y._argsDescription[q.name()]||""});if(Y.registeredArguments.find((q)=>q.description))return Y.registeredArguments;return[]}subcommandTerm(Y){let q=Y.registeredArguments.map((Z)=>a9(Z)).join(" ");return Y._name+(Y._aliases[0]?"|"+Y._aliases[0]:"")+(Y.options.length?" [options]":"")+(q?" "+q:"")}optionTerm(Y){return Y.flags}argumentTerm(Y){return Y.name()}longestSubcommandTermLength(Y,q){return q.visibleCommands(Y).reduce((Z,J)=>{return Math.max(Z,this.displayWidth(q.styleSubcommandTerm(q.subcommandTerm(J))))},0)}longestOptionTermLength(Y,q){return q.visibleOptions(Y).reduce((Z,J)=>{return Math.max(Z,this.displayWidth(q.styleOptionTerm(q.optionTerm(J))))},0)}longestGlobalOptionTermLength(Y,q){return q.visibleGlobalOptions(Y).reduce((Z,J)=>{return Math.max(Z,this.displayWidth(q.styleOptionTerm(q.optionTerm(J))))},0)}longestArgumentTermLength(Y,q){return q.visibleArguments(Y).reduce((Z,J)=>{return Math.max(Z,this.displayWidth(q.styleArgumentTerm(q.argumentTerm(J))))},0)}commandUsage(Y){let q=Y._name;if(Y._aliases[0])q=q+"|"+Y._aliases[0];let Z="";for(let J=Y.parent;J;J=J.parent)Z=J.name()+" "+Z;return Z+q+" "+Y.usage()}commandDescription(Y){return Y.description()}subcommandDescription(Y){return Y.summary()||Y.description()}optionDescription(Y){let q=[];if(Y.argChoices)q.push(`choices: ${Y.argChoices.map((Z)=>JSON.stringify(Z)).join(", ")}`);if(Y.defaultValue!==void 0){if(Y.required||Y.optional||Y.isBoolean()&&typeof Y.defaultValue==="boolean")q.push(`default: ${Y.defaultValueDescription||JSON.stringify(Y.defaultValue)}`)}if(Y.presetArg!==void 0&&Y.optional)q.push(`preset: ${JSON.stringify(Y.presetArg)}`);if(Y.envVar!==void 0)q.push(`env: ${Y.envVar}`);if(q.length>0){let Z=`(${q.join(", ")})`;if(Y.description)return`${Y.description} ${Z}`;return Z}return Y.description}argumentDescription(Y){let q=[];if(Y.argChoices)q.push(`choices: ${Y.argChoices.map((Z)=>JSON.stringify(Z)).join(", ")}`);if(Y.defaultValue!==void 0)q.push(`default: ${Y.defaultValueDescription||JSON.stringify(Y.defaultValue)}`);if(q.length>0){let Z=`(${q.join(", ")})`;if(Y.description)return`${Y.description} ${Z}`;return Z}return Y.description}formatItemList(Y,q,Z){if(q.length===0)return[];return[Z.styleTitle(Y),...q,""]}groupItems(Y,q,Z){let J=new Map;return Y.forEach((Q)=>{let z=Z(Q);if(!J.has(z))J.set(z,[])}),q.forEach((Q)=>{let z=Z(Q);if(!J.has(z))J.set(z,[]);J.get(z).push(Q)}),J}formatHelp(Y,q){let Z=q.padWidth(Y,q),J=q.helpWidth??80;function Q(S,T){return q.formatItem(S,Z,T,q)}let z=[`${q.styleTitle("Usage:")} ${q.styleUsage(q.commandUsage(Y))}`,""],X=q.commandDescription(Y);if(X.length>0)z=z.concat([q.boxWrap(q.styleCommandDescription(X),J),""]);let B=q.visibleArguments(Y).map((S)=>{return Q(q.styleArgumentTerm(q.argumentTerm(S)),q.styleArgumentDescription(q.argumentDescription(S)))});if(z=z.concat(this.formatItemList("Arguments:",B,q)),this.groupItems(Y.options,q.visibleOptions(Y),(S)=>S.helpGroupHeading??"Options:").forEach((S,T)=>{let M=S.map((P)=>{return Q(q.styleOptionTerm(q.optionTerm(P)),q.styleOptionDescription(q.optionDescription(P)))});z=z.concat(this.formatItemList(T,M,q))}),q.showGlobalOptions){let S=q.visibleGlobalOptions(Y).map((T)=>{return Q(q.styleOptionTerm(q.optionTerm(T)),q.styleOptionDescription(q.optionDescription(T)))});z=z.concat(this.formatItemList("Global Options:",S,q))}return this.groupItems(Y.commands,q.visibleCommands(Y),(S)=>S.helpGroup()||"Commands:").forEach((S,T)=>{let M=S.map((P)=>{return Q(q.styleSubcommandTerm(q.subcommandTerm(P)),q.styleSubcommandDescription(q.subcommandDescription(P)))});z=z.concat(this.formatItemList(T,M,q))}),z.join(`
|
|
2
3
|
`)}displayWidth(Y){return g1(Y).length}styleTitle(Y){return Y}styleUsage(Y){return Y.split(" ").map((q)=>{if(q==="[options]")return this.styleOptionText(q);if(q==="[command]")return this.styleSubcommandText(q);if(q[0]==="["||q[0]==="<")return this.styleArgumentText(q);return this.styleCommandText(q)}).join(" ")}styleCommandDescription(Y){return this.styleDescriptionText(Y)}styleOptionDescription(Y){return this.styleDescriptionText(Y)}styleSubcommandDescription(Y){return this.styleDescriptionText(Y)}styleArgumentDescription(Y){return this.styleDescriptionText(Y)}styleDescriptionText(Y){return Y}styleOptionTerm(Y){return this.styleOptionText(Y)}styleSubcommandTerm(Y){return Y.split(" ").map((q)=>{if(q==="[options]")return this.styleOptionText(q);if(q[0]==="["||q[0]==="<")return this.styleArgumentText(q);return this.styleSubcommandText(q)}).join(" ")}styleArgumentTerm(Y){return this.styleArgumentText(Y)}styleOptionText(Y){return Y}styleArgumentText(Y){return Y}styleSubcommandText(Y){return Y}styleCommandText(Y){return Y}padWidth(Y,q){return Math.max(q.longestOptionTermLength(Y,q),q.longestGlobalOptionTermLength(Y,q),q.longestSubcommandTermLength(Y,q),q.longestArgumentTermLength(Y,q))}preformatted(Y){return/\n[^\S\r\n]/.test(Y)}formatItem(Y,q,Z,J){let z=" ".repeat(2);if(!Z)return z+Y;let X=Y.padEnd(q+Y.length-J.displayWidth(Y)),B=2,R=(this.helpWidth??80)-q-B-2,S;if(R<this.minWidthToWrap||J.preformatted(Z))S=Z;else S=J.boxWrap(Z,R).replace(/\n/g,`
|
|
3
4
|
`+" ".repeat(q+B));return z+X+" ".repeat(B)+S.replace(/\n/g,`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clawui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Translate the OpenClaw UI into multiple languages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@clack/prompts": "^1.0.1",
|
|
21
|
-
"clawui": "^0.0.1",
|
|
22
21
|
"commander": "^14.0.3"
|
|
23
22
|
},
|
|
24
23
|
"devDependencies": {
|