klaudius 0.19.0 → 0.19.1
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as w,e as oe,f as ie,h as se,k as re,m as le}from"./chunk-H6TMU6MK.js";import{useEffect as ca,useMemo as da,useRef as te,useState as K}from"react";import{Box as P,Text as E,useApp as ga,useInput as ha}from"ink";var Te=[{country:"the United Kingdom",code:"GB",language:"English",langCode:"en",aliases:["uk","united kingdom","great britain","britain","england","scotland","wales","northern ireland"]},{country:"Ireland",code:"IE",language:"English",langCode:"en"},{country:"France",code:"FR",language:"French",langCode:"fr"},{country:"Germany",code:"DE",language:"German",langCode:"de",aliases:["deutschland"]},{country:"Austria",code:"AT",language:"German",langCode:"de",aliases:["\xF6sterreich","osterreich"]},{country:"Switzerland",code:"CH",language:"German",langCode:"de",aliases:["schweiz","suisse","svizzera"]},{country:"Liechtenstein",code:"LI",language:"German",langCode:"de"},{country:"Luxembourg",code:"LU",language:"French",langCode:"fr",aliases:["l\xEBtzebuerg"]},{country:"the Netherlands",code:"NL",language:"Dutch",langCode:"nl",aliases:["netherlands","holland","nederland"]},{country:"Belgium",code:"BE",language:"Dutch",langCode:"nl",aliases:["belgi\xEB","belgique"]},{country:"Monaco",code:"MC",language:"French",langCode:"fr"},{country:"Andorra",code:"AD",language:"Catalan",langCode:"ca"},{country:"Italy",code:"IT",language:"Italian",langCode:"it",aliases:["italia"]},{country:"Spain",code:"ES",language:"Spanish",langCode:"es",aliases:["espa\xF1a","espana"]},{country:"Portugal",code:"PT",language:"Portuguese",langCode:"pt"},{country:"Malta",code:"MT",language:"English",langCode:"en"},{country:"San Marino",code:"SM",language:"Italian",langCode:"it"},{country:"Vatican City",code:"VA",language:"Italian",langCode:"it",aliases:["the vatican","holy see"]},{country:"Sweden",code:"SE",language:"Swedish",langCode:"sv",aliases:["sverige"]},{country:"Norway",code:"NO",language:"Norwegian",langCode:"no",aliases:["norge"]},{country:"Denmark",code:"DK",language:"Danish",langCode:"da",aliases:["danmark"]},{country:"Finland",code:"FI",language:"Finnish",langCode:"fi",aliases:["suomi"]},{country:"Iceland",code:"IS",language:"Icelandic",langCode:"is",aliases:["\xEDsland"]},{country:"Poland",code:"PL",language:"Polish",langCode:"pl",aliases:["polska"]},{country:"Czech Republic",code:"CZ",language:"Czech",langCode:"cs",aliases:["czechia","\u010Desko"]},{country:"Slovakia",code:"SK",language:"Slovak",langCode:"sk",aliases:["slovensko"]},{country:"Hungary",code:"HU",language:"Hungarian",langCode:"hu",aliases:["magyarorsz\xE1g"]},{country:"Slovenia",code:"SI",language:"Slovenian",langCode:"sl",aliases:["slovenija"]},{country:"Croatia",code:"HR",language:"Croatian",langCode:"hr",aliases:["hrvatska"]},{country:"Bosnia and Herzegovina",code:"BA",language:"Bosnian",langCode:"bs",aliases:["bosnia"]},{country:"Serbia",code:"RS",language:"Serbian",langCode:"sr",aliases:["srbija"]},{country:"Montenegro",code:"ME",language:"Montenegrin",langCode:"sr",aliases:["crna gora"]},{country:"Kosovo",code:"XK",language:"Albanian",langCode:"sq"},{country:"North Macedonia",code:"MK",language:"Macedonian",langCode:"mk",aliases:["macedonia"]},{country:"Albania",code:"AL",language:"Albanian",langCode:"sq",aliases:["shqip\xEBria"]},{country:"Bulgaria",code:"BG",language:"Bulgarian",langCode:"bg"},{country:"Romania",code:"RO",language:"Romanian",langCode:"ro",aliases:["rom\xE2nia"]},{country:"Moldova",code:"MD",language:"Romanian",langCode:"ro"},{country:"Greece",code:"GR",language:"Greek",langCode:"el",aliases:["\u03B5\u03BB\u03BB\u03AC\u03B4\u03B1"]},{country:"Cyprus",code:"CY",language:"Greek",langCode:"el"},{country:"Russia",code:"RU",language:"Russian",langCode:"ru",aliases:["\u0440\u043E\u0441\u0441\u0438\u044F"]},{country:"Ukraine",code:"UA",language:"Ukrainian",langCode:"uk",aliases:["\u0443\u043A\u0440\u0430\u0457\u043D\u0430"]},{country:"Belarus",code:"BY",language:"Belarusian",langCode:"be"},{country:"Estonia",code:"EE",language:"Estonian",langCode:"et",aliases:["eesti"]},{country:"Latvia",code:"LV",language:"Latvian",langCode:"lv",aliases:["latvija"]},{country:"Lithuania",code:"LT",language:"Lithuanian",langCode:"lt",aliases:["lietuva"]},{country:"Turkey",code:"TR",language:"Turkish",langCode:"tr",aliases:["t\xFCrkiye","turkiye"]},{country:"Armenia",code:"AM",language:"Armenian",langCode:"hy"},{country:"Azerbaijan",code:"AZ",language:"Azerbaijani",langCode:"az",aliases:["az\u0259rbaycan"]},{country:"Georgia",code:"GE",language:"Georgian",langCode:"ka",aliases:["\u10E1\u10D0\u10E5\u10D0\u10E0\u10D7\u10D5\u10D4\u10DA\u10DD"]},{country:"Israel",code:"IL",language:"Hebrew",langCode:"he"},{country:"Palestine",code:"PS",language:"Arabic",langCode:"ar"},{country:"Lebanon",code:"LB",language:"Arabic",langCode:"ar"},{country:"Syria",code:"SY",language:"Arabic",langCode:"ar"},{country:"Jordan",code:"JO",language:"Arabic",langCode:"ar"},{country:"Iraq",code:"IQ",language:"Arabic",langCode:"ar"},{country:"Iran",code:"IR",language:"Persian",langCode:"fa",aliases:["islamic republic of iran"]},{country:"Saudi Arabia",code:"SA",language:"Arabic",langCode:"ar"},{country:"Yemen",code:"YE",language:"Arabic",langCode:"ar"},{country:"Oman",code:"OM",language:"Arabic",langCode:"ar"},{country:"the United Arab Emirates",code:"AE",language:"English",langCode:"en",aliases:["uae","united arab emirates","dubai","abu dhabi"]},{country:"Qatar",code:"QA",language:"Arabic",langCode:"ar"},{country:"Bahrain",code:"BH",language:"Arabic",langCode:"ar"},{country:"Kuwait",code:"KW",language:"Arabic",langCode:"ar"},{country:"Kazakhstan",code:"KZ",language:"Kazakh",langCode:"kk"},{country:"Uzbekistan",code:"UZ",language:"Uzbek",langCode:"uz"},{country:"Kyrgyzstan",code:"KG",language:"Kyrgyz",langCode:"ky"},{country:"Turkmenistan",code:"TM",language:"Turkmen",langCode:"tk"},{country:"Tajikistan",code:"TJ",language:"Tajik",langCode:"tg"},{country:"Afghanistan",code:"AF",language:"Persian",langCode:"fa"},{country:"India",code:"IN",language:"English",langCode:"en"},{country:"Pakistan",code:"PK",language:"English",langCode:"en"},{country:"Bangladesh",code:"BD",language:"Bengali",langCode:"bn"},{country:"Sri Lanka",code:"LK",language:"English",langCode:"en"},{country:"Nepal",code:"NP",language:"Nepali",langCode:"ne"},{country:"Bhutan",code:"BT",language:"English",langCode:"en"},{country:"the Maldives",code:"MV",language:"English",langCode:"en",aliases:["maldives"]},{country:"China",code:"CN",language:"Chinese",langCode:"zh",aliases:["\u4E2D\u56FD","people's republic of china","prc"]},{country:"Hong Kong",code:"HK",language:"English",langCode:"en",aliases:["hk"]},{country:"Macao",code:"MO",language:"Chinese",langCode:"zh",aliases:["macau"]},{country:"Taiwan",code:"TW",language:"Chinese",langCode:"zh",aliases:["\u53F0\u7063","republic of china"]},{country:"Japan",code:"JP",language:"Japanese",langCode:"ja",aliases:["\u65E5\u672C"]},{country:"South Korea",code:"KR",language:"Korean",langCode:"ko",aliases:["korea","republic of korea"]},{country:"North Korea",code:"KP",language:"Korean",langCode:"ko",aliases:["dprk"]},{country:"Mongolia",code:"MN",language:"Mongolian",langCode:"mn"},{country:"Thailand",code:"TH",language:"Thai",langCode:"th"},{country:"Vietnam",code:"VN",language:"Vietnamese",langCode:"vi",aliases:["viet nam"]},{country:"Cambodia",code:"KH",language:"Khmer",langCode:"km"},{country:"Laos",code:"LA",language:"Lao",langCode:"lo"},{country:"Myanmar",code:"MM",language:"Burmese",langCode:"my",aliases:["burma"]},{country:"Malaysia",code:"MY",language:"Malay",langCode:"ms"},{country:"Singapore",code:"SG",language:"English",langCode:"en"},{country:"Brunei",code:"BN",language:"Malay",langCode:"ms",aliases:["brunei darussalam"]},{country:"Indonesia",code:"ID",language:"Indonesian",langCode:"id"},{country:"the Philippines",code:"PH",language:"English",langCode:"en",aliases:["philippines"]},{country:"Timor-Leste",code:"TL",language:"Portuguese",langCode:"pt",aliases:["east timor"]},{country:"the United States",code:"US",language:"English",langCode:"en",aliases:["us","usa","united states","united states of america","america","states"]},{country:"Canada",code:"CA",language:"English",langCode:"en"},{country:"Mexico",code:"MX",language:"Spanish",langCode:"es",aliases:["m\xE9xico"]},{country:"Guatemala",code:"GT",language:"Spanish",langCode:"es"},{country:"Belize",code:"BZ",language:"English",langCode:"en"},{country:"El Salvador",code:"SV",language:"Spanish",langCode:"es"},{country:"Honduras",code:"HN",language:"Spanish",langCode:"es"},{country:"Nicaragua",code:"NI",language:"Spanish",langCode:"es"},{country:"Costa Rica",code:"CR",language:"Spanish",langCode:"es"},{country:"Panama",code:"PA",language:"Spanish",langCode:"es",aliases:["panam\xE1"]},{country:"Cuba",code:"CU",language:"Spanish",langCode:"es"},{country:"the Dominican Republic",code:"DO",language:"Spanish",langCode:"es",aliases:["dominican republic"]},{country:"Haiti",code:"HT",language:"French",langCode:"fr"},{country:"Jamaica",code:"JM",language:"English",langCode:"en"},{country:"the Bahamas",code:"BS",language:"English",langCode:"en",aliases:["bahamas"]},{country:"Trinidad and Tobago",code:"TT",language:"English",langCode:"en"},{country:"Barbados",code:"BB",language:"English",langCode:"en"},{country:"Saint Lucia",code:"LC",language:"English",langCode:"en"},{country:"Saint Vincent and the Grenadines",code:"VC",language:"English",langCode:"en"},{country:"Grenada",code:"GD",language:"English",langCode:"en"},{country:"Dominica",code:"DM",language:"English",langCode:"en"},{country:"Saint Kitts and Nevis",code:"KN",language:"English",langCode:"en"},{country:"Antigua and Barbuda",code:"AG",language:"English",langCode:"en"},{country:"Puerto Rico",code:"PR",language:"Spanish",langCode:"es"},{country:"Brazil",code:"BR",language:"Portuguese",langCode:"pt",aliases:["brasil"]},{country:"Argentina",code:"AR",language:"Spanish",langCode:"es"},{country:"Colombia",code:"CO",language:"Spanish",langCode:"es"},{country:"Chile",code:"CL",language:"Spanish",langCode:"es"},{country:"Peru",code:"PE",language:"Spanish",langCode:"es",aliases:["per\xFA"]},{country:"Venezuela",code:"VE",language:"Spanish",langCode:"es"},{country:"Ecuador",code:"EC",language:"Spanish",langCode:"es"},{country:"Bolivia",code:"BO",language:"Spanish",langCode:"es"},{country:"Paraguay",code:"PY",language:"Spanish",langCode:"es"},{country:"Uruguay",code:"UY",language:"Spanish",langCode:"es"},{country:"Guyana",code:"GY",language:"English",langCode:"en"},{country:"Suriname",code:"SR",language:"Dutch",langCode:"nl"},{country:"Australia",code:"AU",language:"English",langCode:"en",aliases:["aus","oz"]},{country:"New Zealand",code:"NZ",language:"English",langCode:"en",aliases:["nz","aotearoa"]},{country:"Fiji",code:"FJ",language:"English",langCode:"en"},{country:"Papua New Guinea",code:"PG",language:"English",langCode:"en",aliases:["png"]},{country:"Samoa",code:"WS",language:"English",langCode:"en"},{country:"Tonga",code:"TO",language:"English",langCode:"en"},{country:"Vanuatu",code:"VU",language:"English",langCode:"en"},{country:"Solomon Islands",code:"SB",language:"English",langCode:"en"},{country:"Kiribati",code:"KI",language:"English",langCode:"en"},{country:"Tuvalu",code:"TV",language:"English",langCode:"en"},{country:"Nauru",code:"NR",language:"English",langCode:"en"},{country:"Palau",code:"PW",language:"English",langCode:"en"},{country:"the Marshall Islands",code:"MH",language:"English",langCode:"en",aliases:["marshall islands"]},{country:"Micronesia",code:"FM",language:"English",langCode:"en",aliases:["federated states of micronesia"]},{country:"Egypt",code:"EG",language:"Arabic",langCode:"ar"},{country:"Libya",code:"LY",language:"Arabic",langCode:"ar"},{country:"Tunisia",code:"TN",language:"Arabic",langCode:"ar"},{country:"Algeria",code:"DZ",language:"Arabic",langCode:"ar"},{country:"Morocco",code:"MA",language:"Arabic",langCode:"ar",aliases:["maroc"]},{country:"Sudan",code:"SD",language:"Arabic",langCode:"ar"},{country:"South Sudan",code:"SS",language:"English",langCode:"en"},{country:"Mauritania",code:"MR",language:"Arabic",langCode:"ar"},{country:"Nigeria",code:"NG",language:"English",langCode:"en"},{country:"Ghana",code:"GH",language:"English",langCode:"en"},{country:"Senegal",code:"SN",language:"French",langCode:"fr",aliases:["s\xE9n\xE9gal"]},{country:"C\xF4te d'Ivoire",code:"CI",language:"French",langCode:"fr",aliases:["ivory coast"]},{country:"Mali",code:"ML",language:"French",langCode:"fr"},{country:"Burkina Faso",code:"BF",language:"French",langCode:"fr"},{country:"Niger",code:"NE",language:"French",langCode:"fr"},{country:"Guinea",code:"GN",language:"French",langCode:"fr",aliases:["guin\xE9e"]},{country:"Guinea-Bissau",code:"GW",language:"Portuguese",langCode:"pt"},{country:"Sierra Leone",code:"SL",language:"English",langCode:"en"},{country:"Liberia",code:"LR",language:"English",langCode:"en"},{country:"the Gambia",code:"GM",language:"English",langCode:"en",aliases:["gambia"]},{country:"Cabo Verde",code:"CV",language:"Portuguese",langCode:"pt",aliases:["cape verde"]},{country:"Togo",code:"TG",language:"French",langCode:"fr"},{country:"Benin",code:"BJ",language:"French",langCode:"fr",aliases:["b\xE9nin"]},{country:"Cameroon",code:"CM",language:"French",langCode:"fr",aliases:["cameroun"]},{country:"the Central African Republic",code:"CF",language:"French",langCode:"fr",aliases:["central african republic","car"]},{country:"Chad",code:"TD",language:"French",langCode:"fr",aliases:["tchad"]},{country:"Equatorial Guinea",code:"GQ",language:"Spanish",langCode:"es"},{country:"Gabon",code:"GA",language:"French",langCode:"fr"},{country:"the Republic of the Congo",code:"CG",language:"French",langCode:"fr",aliases:["congo","republic of the congo","congo-brazzaville"]},{country:"the Democratic Republic of the Congo",code:"CD",language:"French",langCode:"fr",aliases:["dr congo","drc","democratic republic of the congo","congo-kinshasa","zaire"]},{country:"S\xE3o Tom\xE9 and Pr\xEDncipe",code:"ST",language:"Portuguese",langCode:"pt",aliases:["sao tome and principe","sao tome"]},{country:"Ethiopia",code:"ET",language:"Amharic",langCode:"am"},{country:"Eritrea",code:"ER",language:"Tigrinya",langCode:"ti"},{country:"Djibouti",code:"DJ",language:"French",langCode:"fr"},{country:"Somalia",code:"SO",language:"Somali",langCode:"so"},{country:"Kenya",code:"KE",language:"English",langCode:"en"},{country:"Uganda",code:"UG",language:"English",langCode:"en"},{country:"Tanzania",code:"TZ",language:"English",langCode:"en",aliases:["united republic of tanzania"]},{country:"Rwanda",code:"RW",language:"English",langCode:"en"},{country:"Burundi",code:"BI",language:"French",langCode:"fr"},{country:"Madagascar",code:"MG",language:"French",langCode:"fr"},{country:"Mauritius",code:"MU",language:"English",langCode:"en"},{country:"the Seychelles",code:"SC",language:"English",langCode:"en",aliases:["seychelles"]},{country:"Comoros",code:"KM",language:"French",langCode:"fr"},{country:"South Africa",code:"ZA",language:"English",langCode:"en",aliases:["sa"]},{country:"Namibia",code:"NA",language:"English",langCode:"en"},{country:"Botswana",code:"BW",language:"English",langCode:"en"},{country:"Zimbabwe",code:"ZW",language:"English",langCode:"en"},{country:"Zambia",code:"ZM",language:"English",langCode:"en"},{country:"Malawi",code:"MW",language:"English",langCode:"en"},{country:"Mozambique",code:"MZ",language:"Portuguese",langCode:"pt",aliases:["mo\xE7ambique"]},{country:"Angola",code:"AO",language:"Portuguese",langCode:"pt"},{country:"Lesotho",code:"LS",language:"English",langCode:"en"},{country:"Eswatini",code:"SZ",language:"English",langCode:"en",aliases:["swaziland"]}],Ee=[{language:"English",code:"en"},{language:"Italian",code:"it",aliases:["italiano"]},{language:"Spanish",code:"es",aliases:["espa\xF1ol","espanol","castellano"]},{language:"French",code:"fr",aliases:["fran\xE7ais","francais"]},{language:"German",code:"de",aliases:["deutsch"]},{language:"Portuguese",code:"pt",aliases:["portugu\xEAs","portugues"]},{language:"Dutch",code:"nl",aliases:["nederlands","flemish"]},{language:"Swedish",code:"sv",aliases:["svenska"]},{language:"Norwegian",code:"no",aliases:["norsk"]},{language:"Danish",code:"da",aliases:["dansk"]},{language:"Icelandic",code:"is",aliases:["\xEDslenska"]},{language:"Catalan",code:"ca",aliases:["catal\xE0"]},{language:"Romanian",code:"ro",aliases:["rom\xE2n\u0103","romana"]},{language:"Polish",code:"pl",aliases:["polski"]},{language:"Czech",code:"cs",aliases:["\u010De\u0161tina","cestina"]},{language:"Slovak",code:"sk",aliases:["sloven\u010Dina"]},{language:"Slovenian",code:"sl",aliases:["sloven\u0161\u010Dina"]},{language:"Croatian",code:"hr",aliases:["hrvatski"]},{language:"Bosnian",code:"bs",aliases:["bosanski"]},{language:"Serbian",code:"sr",aliases:["\u0441\u0440\u043F\u0441\u043A\u0438"]},{language:"Montenegrin",code:"sr",aliases:["crnogorski"]},{language:"Macedonian",code:"mk",aliases:["\u043C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438"]},{language:"Bulgarian",code:"bg",aliases:["\u0431\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"]},{language:"Russian",code:"ru",aliases:["\u0440\u0443\u0441\u0441\u043A\u0438\u0439"]},{language:"Ukrainian",code:"uk",aliases:["\u0443\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"]},{language:"Belarusian",code:"be",aliases:["\u0431\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F"]},{language:"Latvian",code:"lv",aliases:["latvie\u0161u"]},{language:"Lithuanian",code:"lt",aliases:["lietuvi\u0173"]},{language:"Greek",code:"el",aliases:["\u03B5\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC","ellinik\xE1"]},{language:"Albanian",code:"sq",aliases:["shqip"]},{language:"Armenian",code:"hy",aliases:["\u0570\u0561\u0575\u0565\u0580\u0565\u0576"]},{language:"Persian",code:"fa",aliases:["farsi","dari","\u0641\u0627\u0631\u0633\u06CC"]},{language:"Hindi",code:"hi",aliases:["\u0939\u093F\u0928\u094D\u0926\u0940"]},{language:"Urdu",code:"ur",aliases:["\u0627\u0631\u062F\u0648"]},{language:"Bengali",code:"bn",aliases:["bangla","\u09AC\u09BE\u0982\u09B2\u09BE"]},{language:"Nepali",code:"ne",aliases:["\u0928\u0947\u092A\u093E\u0932\u0940"]},{language:"Sinhala",code:"si",aliases:["\u0DC3\u0DD2\u0D82\u0DC4\u0DBD","sinhalese"]},{language:"Finnish",code:"fi",aliases:["suomi"]},{language:"Estonian",code:"et",aliases:["eesti"]},{language:"Hungarian",code:"hu",aliases:["magyar"]},{language:"Turkish",code:"tr",aliases:["t\xFCrk\xE7e","turkce"]},{language:"Azerbaijani",code:"az",aliases:["az\u0259rbaycan dili","azeri"]},{language:"Kazakh",code:"kk",aliases:["\u049B\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456"]},{language:"Uzbek",code:"uz",aliases:["o'zbek"]},{language:"Kyrgyz",code:"ky",aliases:["\u043A\u044B\u0440\u0433\u044B\u0437\u0447\u0430"]},{language:"Turkmen",code:"tk",aliases:["t\xFCrkmen\xE7e"]},{language:"Arabic",code:"ar",aliases:["\u0627\u0644\u0639\u0631\u0628\u064A\u0629"]},{language:"Hebrew",code:"he",aliases:["\u05E2\u05D1\u05E8\u05D9\u05EA","ivrit"]},{language:"Amharic",code:"am",aliases:["\u12A0\u121B\u122D\u129B"]},{language:"Tigrinya",code:"ti",aliases:["\u1275\u130D\u122D\u129B"]},{language:"Chinese",code:"zh",aliases:["mandarin","\u4E2D\u6587","\u6C49\u8BED","putonghua"]},{language:"Japanese",code:"ja",aliases:["\u65E5\u672C\u8A9E","nihongo"]},{language:"Korean",code:"ko",aliases:["\uD55C\uAD6D\uC5B4"]},{language:"Thai",code:"th",aliases:["\u0E44\u0E17\u0E22"]},{language:"Vietnamese",code:"vi",aliases:["ti\u1EBFng vi\u1EC7t"]},{language:"Khmer",code:"km",aliases:["\u1781\u17D2\u1798\u17C2\u179A","cambodian"]},{language:"Lao",code:"lo",aliases:["\u0EA5\u0EB2\u0EA7"]},{language:"Burmese",code:"my",aliases:["\u1019\u103C\u1014\u103A\u1019\u102C","myanmar"]},{language:"Dzongkha",code:"dz",aliases:["\u0F62\u0FAB\u0F7C\u0F44\u0F0B\u0F41"]},{language:"Mongolian",code:"mn",aliases:["\u043C\u043E\u043D\u0433\u043E\u043B"]},{language:"Georgian",code:"ka",aliases:["\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8"]},{language:"Tajik",code:"tg",aliases:["\u0442\u043E\u04B7\u0438\u043A\u04E3"]},{language:"Malay",code:"ms",aliases:["bahasa malaysia","bahasa melayu"]},{language:"Indonesian",code:"id",aliases:["bahasa indonesia"]},{language:"Filipino",code:"fil",aliases:["tagalog","pilipino"]},{language:"Swahili",code:"sw",aliases:["kiswahili"]},{language:"Somali",code:"so",aliases:["af soomaali"]},{language:"Yoruba",code:"yo",aliases:["yor\xF9b\xE1"]},{language:"Hausa",code:"ha",aliases:["harshen hausa"]},{language:"Zulu",code:"zu",aliases:["isizulu"]},{language:"Afrikaans",code:"af"}];function B(e){return e.trim().toLowerCase()}function ue(e){if(!e)return;let a=B(e);for(let t of Te)if(B(t.country)===a||t.aliases?.some(n=>B(n)===a))return t}function ce(e){if(!e)return;let a=B(e);for(let t of Ee)if(B(t.language)===a||t.aliases?.some(n=>B(n)===a))return t}var G=class extends Error{constructor(){super("user pressed back"),this.name="BackSignal"}},_=class extends Error{constructor(){super("user cancelled"),this.name="CancelSignal"}},xe="Include the country code with a + (e.g. +12025550123 for US, +447123456789 for UK)",de=e=>/^\+\d{8,15}$/.test(e)?void 0:xe,Me=e=>/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e)?void 0:"Enter a valid email",M=e=>a=>a.trim().length===0?`${e} is required`:void 0,Ne=/[\u2022\u2023\u2024\u2027\u00B7\u2219\u22C5\u25CF\u25CB\u25AA\u25AB\u204E\u2217\uFE61\u25E6\u2218]/,Ke="That looks like the masked \u2022\u2022\u2022\u2022\u2022 value your screen shows, not the token itself. Click the reveal/copy icon next to it and paste the real value (letters and numbers).",Z=e=>Ne.test(e)?Ke:void 0,Oe=e=>a=>Z(a)??(a.trim().length===0?`${e} is required`:void 0),Be=e=>{let a=e.replace(/\s+/g,"");return a.length===0?"Personal access token is required":Z(a)??(/^sbp_[A-Za-z0-9._~+\/=-]{20,}$/.test(a)?void 0:"Doesn't look like a valid token \u2014 it should be 'sbp_' followed by letters and numbers.")},Re="one-off, no monthly fees",ge="per month";function H(e){if(!e)return!0;let a=e.trim();if(a==="")return!0;let t=a.replace(/[^\d.]/g,"");if(t==="")return/^\s*free\s*$/i.test(a);let n=parseFloat(t);return!isNaN(n)&&n===0}var Le={id:"ai-agent",title:"AI coding agent",isApplicable:()=>!0,execute:async(e,{prompt:a,info:t})=>(t({title:"Which AI coding agent do you use?",body:`Klaudius works with two AI coding agents in your terminal \u2014 Claude Code
|
|
1
|
+
import{a as w,e as le,f as ue,h as ce,k as de,m as ge}from"./chunk-H6TMU6MK.js";import{useEffect as ca,useMemo as da,useRef as re,useState as B}from"react";import{Box as P,Text as E,useApp as ga,useInput as ha}from"ink";var Te=[{country:"the United Kingdom",code:"GB",language:"English",langCode:"en",aliases:["uk","united kingdom","great britain","britain","england","scotland","wales","northern ireland"]},{country:"Ireland",code:"IE",language:"English",langCode:"en"},{country:"France",code:"FR",language:"French",langCode:"fr"},{country:"Germany",code:"DE",language:"German",langCode:"de",aliases:["deutschland"]},{country:"Austria",code:"AT",language:"German",langCode:"de",aliases:["\xF6sterreich","osterreich"]},{country:"Switzerland",code:"CH",language:"German",langCode:"de",aliases:["schweiz","suisse","svizzera"]},{country:"Liechtenstein",code:"LI",language:"German",langCode:"de"},{country:"Luxembourg",code:"LU",language:"French",langCode:"fr",aliases:["l\xEBtzebuerg"]},{country:"the Netherlands",code:"NL",language:"Dutch",langCode:"nl",aliases:["netherlands","holland","nederland"]},{country:"Belgium",code:"BE",language:"Dutch",langCode:"nl",aliases:["belgi\xEB","belgique"]},{country:"Monaco",code:"MC",language:"French",langCode:"fr"},{country:"Andorra",code:"AD",language:"Catalan",langCode:"ca"},{country:"Italy",code:"IT",language:"Italian",langCode:"it",aliases:["italia"]},{country:"Spain",code:"ES",language:"Spanish",langCode:"es",aliases:["espa\xF1a","espana"]},{country:"Portugal",code:"PT",language:"Portuguese",langCode:"pt"},{country:"Malta",code:"MT",language:"English",langCode:"en"},{country:"San Marino",code:"SM",language:"Italian",langCode:"it"},{country:"Vatican City",code:"VA",language:"Italian",langCode:"it",aliases:["the vatican","holy see"]},{country:"Sweden",code:"SE",language:"Swedish",langCode:"sv",aliases:["sverige"]},{country:"Norway",code:"NO",language:"Norwegian",langCode:"no",aliases:["norge"]},{country:"Denmark",code:"DK",language:"Danish",langCode:"da",aliases:["danmark"]},{country:"Finland",code:"FI",language:"Finnish",langCode:"fi",aliases:["suomi"]},{country:"Iceland",code:"IS",language:"Icelandic",langCode:"is",aliases:["\xEDsland"]},{country:"Poland",code:"PL",language:"Polish",langCode:"pl",aliases:["polska"]},{country:"Czech Republic",code:"CZ",language:"Czech",langCode:"cs",aliases:["czechia","\u010Desko"]},{country:"Slovakia",code:"SK",language:"Slovak",langCode:"sk",aliases:["slovensko"]},{country:"Hungary",code:"HU",language:"Hungarian",langCode:"hu",aliases:["magyarorsz\xE1g"]},{country:"Slovenia",code:"SI",language:"Slovenian",langCode:"sl",aliases:["slovenija"]},{country:"Croatia",code:"HR",language:"Croatian",langCode:"hr",aliases:["hrvatska"]},{country:"Bosnia and Herzegovina",code:"BA",language:"Bosnian",langCode:"bs",aliases:["bosnia"]},{country:"Serbia",code:"RS",language:"Serbian",langCode:"sr",aliases:["srbija"]},{country:"Montenegro",code:"ME",language:"Montenegrin",langCode:"sr",aliases:["crna gora"]},{country:"Kosovo",code:"XK",language:"Albanian",langCode:"sq"},{country:"North Macedonia",code:"MK",language:"Macedonian",langCode:"mk",aliases:["macedonia"]},{country:"Albania",code:"AL",language:"Albanian",langCode:"sq",aliases:["shqip\xEBria"]},{country:"Bulgaria",code:"BG",language:"Bulgarian",langCode:"bg"},{country:"Romania",code:"RO",language:"Romanian",langCode:"ro",aliases:["rom\xE2nia"]},{country:"Moldova",code:"MD",language:"Romanian",langCode:"ro"},{country:"Greece",code:"GR",language:"Greek",langCode:"el",aliases:["\u03B5\u03BB\u03BB\u03AC\u03B4\u03B1"]},{country:"Cyprus",code:"CY",language:"Greek",langCode:"el"},{country:"Russia",code:"RU",language:"Russian",langCode:"ru",aliases:["\u0440\u043E\u0441\u0441\u0438\u044F"]},{country:"Ukraine",code:"UA",language:"Ukrainian",langCode:"uk",aliases:["\u0443\u043A\u0440\u0430\u0457\u043D\u0430"]},{country:"Belarus",code:"BY",language:"Belarusian",langCode:"be"},{country:"Estonia",code:"EE",language:"Estonian",langCode:"et",aliases:["eesti"]},{country:"Latvia",code:"LV",language:"Latvian",langCode:"lv",aliases:["latvija"]},{country:"Lithuania",code:"LT",language:"Lithuanian",langCode:"lt",aliases:["lietuva"]},{country:"Turkey",code:"TR",language:"Turkish",langCode:"tr",aliases:["t\xFCrkiye","turkiye"]},{country:"Armenia",code:"AM",language:"Armenian",langCode:"hy"},{country:"Azerbaijan",code:"AZ",language:"Azerbaijani",langCode:"az",aliases:["az\u0259rbaycan"]},{country:"Georgia",code:"GE",language:"Georgian",langCode:"ka",aliases:["\u10E1\u10D0\u10E5\u10D0\u10E0\u10D7\u10D5\u10D4\u10DA\u10DD"]},{country:"Israel",code:"IL",language:"Hebrew",langCode:"he"},{country:"Palestine",code:"PS",language:"Arabic",langCode:"ar"},{country:"Lebanon",code:"LB",language:"Arabic",langCode:"ar"},{country:"Syria",code:"SY",language:"Arabic",langCode:"ar"},{country:"Jordan",code:"JO",language:"Arabic",langCode:"ar"},{country:"Iraq",code:"IQ",language:"Arabic",langCode:"ar"},{country:"Iran",code:"IR",language:"Persian",langCode:"fa",aliases:["islamic republic of iran"]},{country:"Saudi Arabia",code:"SA",language:"Arabic",langCode:"ar"},{country:"Yemen",code:"YE",language:"Arabic",langCode:"ar"},{country:"Oman",code:"OM",language:"Arabic",langCode:"ar"},{country:"the United Arab Emirates",code:"AE",language:"English",langCode:"en",aliases:["uae","united arab emirates","dubai","abu dhabi"]},{country:"Qatar",code:"QA",language:"Arabic",langCode:"ar"},{country:"Bahrain",code:"BH",language:"Arabic",langCode:"ar"},{country:"Kuwait",code:"KW",language:"Arabic",langCode:"ar"},{country:"Kazakhstan",code:"KZ",language:"Kazakh",langCode:"kk"},{country:"Uzbekistan",code:"UZ",language:"Uzbek",langCode:"uz"},{country:"Kyrgyzstan",code:"KG",language:"Kyrgyz",langCode:"ky"},{country:"Turkmenistan",code:"TM",language:"Turkmen",langCode:"tk"},{country:"Tajikistan",code:"TJ",language:"Tajik",langCode:"tg"},{country:"Afghanistan",code:"AF",language:"Persian",langCode:"fa"},{country:"India",code:"IN",language:"English",langCode:"en"},{country:"Pakistan",code:"PK",language:"English",langCode:"en"},{country:"Bangladesh",code:"BD",language:"Bengali",langCode:"bn"},{country:"Sri Lanka",code:"LK",language:"English",langCode:"en"},{country:"Nepal",code:"NP",language:"Nepali",langCode:"ne"},{country:"Bhutan",code:"BT",language:"English",langCode:"en"},{country:"the Maldives",code:"MV",language:"English",langCode:"en",aliases:["maldives"]},{country:"China",code:"CN",language:"Chinese",langCode:"zh",aliases:["\u4E2D\u56FD","people's republic of china","prc"]},{country:"Hong Kong",code:"HK",language:"English",langCode:"en",aliases:["hk"]},{country:"Macao",code:"MO",language:"Chinese",langCode:"zh",aliases:["macau"]},{country:"Taiwan",code:"TW",language:"Chinese",langCode:"zh",aliases:["\u53F0\u7063","republic of china"]},{country:"Japan",code:"JP",language:"Japanese",langCode:"ja",aliases:["\u65E5\u672C"]},{country:"South Korea",code:"KR",language:"Korean",langCode:"ko",aliases:["korea","republic of korea"]},{country:"North Korea",code:"KP",language:"Korean",langCode:"ko",aliases:["dprk"]},{country:"Mongolia",code:"MN",language:"Mongolian",langCode:"mn"},{country:"Thailand",code:"TH",language:"Thai",langCode:"th"},{country:"Vietnam",code:"VN",language:"Vietnamese",langCode:"vi",aliases:["viet nam"]},{country:"Cambodia",code:"KH",language:"Khmer",langCode:"km"},{country:"Laos",code:"LA",language:"Lao",langCode:"lo"},{country:"Myanmar",code:"MM",language:"Burmese",langCode:"my",aliases:["burma"]},{country:"Malaysia",code:"MY",language:"Malay",langCode:"ms"},{country:"Singapore",code:"SG",language:"English",langCode:"en"},{country:"Brunei",code:"BN",language:"Malay",langCode:"ms",aliases:["brunei darussalam"]},{country:"Indonesia",code:"ID",language:"Indonesian",langCode:"id"},{country:"the Philippines",code:"PH",language:"English",langCode:"en",aliases:["philippines"]},{country:"Timor-Leste",code:"TL",language:"Portuguese",langCode:"pt",aliases:["east timor"]},{country:"the United States",code:"US",language:"English",langCode:"en",aliases:["us","usa","united states","united states of america","america","states"]},{country:"Canada",code:"CA",language:"English",langCode:"en"},{country:"Mexico",code:"MX",language:"Spanish",langCode:"es",aliases:["m\xE9xico"]},{country:"Guatemala",code:"GT",language:"Spanish",langCode:"es"},{country:"Belize",code:"BZ",language:"English",langCode:"en"},{country:"El Salvador",code:"SV",language:"Spanish",langCode:"es"},{country:"Honduras",code:"HN",language:"Spanish",langCode:"es"},{country:"Nicaragua",code:"NI",language:"Spanish",langCode:"es"},{country:"Costa Rica",code:"CR",language:"Spanish",langCode:"es"},{country:"Panama",code:"PA",language:"Spanish",langCode:"es",aliases:["panam\xE1"]},{country:"Cuba",code:"CU",language:"Spanish",langCode:"es"},{country:"the Dominican Republic",code:"DO",language:"Spanish",langCode:"es",aliases:["dominican republic"]},{country:"Haiti",code:"HT",language:"French",langCode:"fr"},{country:"Jamaica",code:"JM",language:"English",langCode:"en"},{country:"the Bahamas",code:"BS",language:"English",langCode:"en",aliases:["bahamas"]},{country:"Trinidad and Tobago",code:"TT",language:"English",langCode:"en"},{country:"Barbados",code:"BB",language:"English",langCode:"en"},{country:"Saint Lucia",code:"LC",language:"English",langCode:"en"},{country:"Saint Vincent and the Grenadines",code:"VC",language:"English",langCode:"en"},{country:"Grenada",code:"GD",language:"English",langCode:"en"},{country:"Dominica",code:"DM",language:"English",langCode:"en"},{country:"Saint Kitts and Nevis",code:"KN",language:"English",langCode:"en"},{country:"Antigua and Barbuda",code:"AG",language:"English",langCode:"en"},{country:"Puerto Rico",code:"PR",language:"Spanish",langCode:"es"},{country:"Brazil",code:"BR",language:"Portuguese",langCode:"pt",aliases:["brasil"]},{country:"Argentina",code:"AR",language:"Spanish",langCode:"es"},{country:"Colombia",code:"CO",language:"Spanish",langCode:"es"},{country:"Chile",code:"CL",language:"Spanish",langCode:"es"},{country:"Peru",code:"PE",language:"Spanish",langCode:"es",aliases:["per\xFA"]},{country:"Venezuela",code:"VE",language:"Spanish",langCode:"es"},{country:"Ecuador",code:"EC",language:"Spanish",langCode:"es"},{country:"Bolivia",code:"BO",language:"Spanish",langCode:"es"},{country:"Paraguay",code:"PY",language:"Spanish",langCode:"es"},{country:"Uruguay",code:"UY",language:"Spanish",langCode:"es"},{country:"Guyana",code:"GY",language:"English",langCode:"en"},{country:"Suriname",code:"SR",language:"Dutch",langCode:"nl"},{country:"Australia",code:"AU",language:"English",langCode:"en",aliases:["aus","oz"]},{country:"New Zealand",code:"NZ",language:"English",langCode:"en",aliases:["nz","aotearoa"]},{country:"Fiji",code:"FJ",language:"English",langCode:"en"},{country:"Papua New Guinea",code:"PG",language:"English",langCode:"en",aliases:["png"]},{country:"Samoa",code:"WS",language:"English",langCode:"en"},{country:"Tonga",code:"TO",language:"English",langCode:"en"},{country:"Vanuatu",code:"VU",language:"English",langCode:"en"},{country:"Solomon Islands",code:"SB",language:"English",langCode:"en"},{country:"Kiribati",code:"KI",language:"English",langCode:"en"},{country:"Tuvalu",code:"TV",language:"English",langCode:"en"},{country:"Nauru",code:"NR",language:"English",langCode:"en"},{country:"Palau",code:"PW",language:"English",langCode:"en"},{country:"the Marshall Islands",code:"MH",language:"English",langCode:"en",aliases:["marshall islands"]},{country:"Micronesia",code:"FM",language:"English",langCode:"en",aliases:["federated states of micronesia"]},{country:"Egypt",code:"EG",language:"Arabic",langCode:"ar"},{country:"Libya",code:"LY",language:"Arabic",langCode:"ar"},{country:"Tunisia",code:"TN",language:"Arabic",langCode:"ar"},{country:"Algeria",code:"DZ",language:"Arabic",langCode:"ar"},{country:"Morocco",code:"MA",language:"Arabic",langCode:"ar",aliases:["maroc"]},{country:"Sudan",code:"SD",language:"Arabic",langCode:"ar"},{country:"South Sudan",code:"SS",language:"English",langCode:"en"},{country:"Mauritania",code:"MR",language:"Arabic",langCode:"ar"},{country:"Nigeria",code:"NG",language:"English",langCode:"en"},{country:"Ghana",code:"GH",language:"English",langCode:"en"},{country:"Senegal",code:"SN",language:"French",langCode:"fr",aliases:["s\xE9n\xE9gal"]},{country:"C\xF4te d'Ivoire",code:"CI",language:"French",langCode:"fr",aliases:["ivory coast"]},{country:"Mali",code:"ML",language:"French",langCode:"fr"},{country:"Burkina Faso",code:"BF",language:"French",langCode:"fr"},{country:"Niger",code:"NE",language:"French",langCode:"fr"},{country:"Guinea",code:"GN",language:"French",langCode:"fr",aliases:["guin\xE9e"]},{country:"Guinea-Bissau",code:"GW",language:"Portuguese",langCode:"pt"},{country:"Sierra Leone",code:"SL",language:"English",langCode:"en"},{country:"Liberia",code:"LR",language:"English",langCode:"en"},{country:"the Gambia",code:"GM",language:"English",langCode:"en",aliases:["gambia"]},{country:"Cabo Verde",code:"CV",language:"Portuguese",langCode:"pt",aliases:["cape verde"]},{country:"Togo",code:"TG",language:"French",langCode:"fr"},{country:"Benin",code:"BJ",language:"French",langCode:"fr",aliases:["b\xE9nin"]},{country:"Cameroon",code:"CM",language:"French",langCode:"fr",aliases:["cameroun"]},{country:"the Central African Republic",code:"CF",language:"French",langCode:"fr",aliases:["central african republic","car"]},{country:"Chad",code:"TD",language:"French",langCode:"fr",aliases:["tchad"]},{country:"Equatorial Guinea",code:"GQ",language:"Spanish",langCode:"es"},{country:"Gabon",code:"GA",language:"French",langCode:"fr"},{country:"the Republic of the Congo",code:"CG",language:"French",langCode:"fr",aliases:["congo","republic of the congo","congo-brazzaville"]},{country:"the Democratic Republic of the Congo",code:"CD",language:"French",langCode:"fr",aliases:["dr congo","drc","democratic republic of the congo","congo-kinshasa","zaire"]},{country:"S\xE3o Tom\xE9 and Pr\xEDncipe",code:"ST",language:"Portuguese",langCode:"pt",aliases:["sao tome and principe","sao tome"]},{country:"Ethiopia",code:"ET",language:"Amharic",langCode:"am"},{country:"Eritrea",code:"ER",language:"Tigrinya",langCode:"ti"},{country:"Djibouti",code:"DJ",language:"French",langCode:"fr"},{country:"Somalia",code:"SO",language:"Somali",langCode:"so"},{country:"Kenya",code:"KE",language:"English",langCode:"en"},{country:"Uganda",code:"UG",language:"English",langCode:"en"},{country:"Tanzania",code:"TZ",language:"English",langCode:"en",aliases:["united republic of tanzania"]},{country:"Rwanda",code:"RW",language:"English",langCode:"en"},{country:"Burundi",code:"BI",language:"French",langCode:"fr"},{country:"Madagascar",code:"MG",language:"French",langCode:"fr"},{country:"Mauritius",code:"MU",language:"English",langCode:"en"},{country:"the Seychelles",code:"SC",language:"English",langCode:"en",aliases:["seychelles"]},{country:"Comoros",code:"KM",language:"French",langCode:"fr"},{country:"South Africa",code:"ZA",language:"English",langCode:"en",aliases:["sa"]},{country:"Namibia",code:"NA",language:"English",langCode:"en"},{country:"Botswana",code:"BW",language:"English",langCode:"en"},{country:"Zimbabwe",code:"ZW",language:"English",langCode:"en"},{country:"Zambia",code:"ZM",language:"English",langCode:"en"},{country:"Malawi",code:"MW",language:"English",langCode:"en"},{country:"Mozambique",code:"MZ",language:"Portuguese",langCode:"pt",aliases:["mo\xE7ambique"]},{country:"Angola",code:"AO",language:"Portuguese",langCode:"pt"},{country:"Lesotho",code:"LS",language:"English",langCode:"en"},{country:"Eswatini",code:"SZ",language:"English",langCode:"en",aliases:["swaziland"]}],Ee=[{language:"English",code:"en"},{language:"Italian",code:"it",aliases:["italiano"]},{language:"Spanish",code:"es",aliases:["espa\xF1ol","espanol","castellano"]},{language:"French",code:"fr",aliases:["fran\xE7ais","francais"]},{language:"German",code:"de",aliases:["deutsch"]},{language:"Portuguese",code:"pt",aliases:["portugu\xEAs","portugues"]},{language:"Dutch",code:"nl",aliases:["nederlands","flemish"]},{language:"Swedish",code:"sv",aliases:["svenska"]},{language:"Norwegian",code:"no",aliases:["norsk"]},{language:"Danish",code:"da",aliases:["dansk"]},{language:"Icelandic",code:"is",aliases:["\xEDslenska"]},{language:"Catalan",code:"ca",aliases:["catal\xE0"]},{language:"Romanian",code:"ro",aliases:["rom\xE2n\u0103","romana"]},{language:"Polish",code:"pl",aliases:["polski"]},{language:"Czech",code:"cs",aliases:["\u010De\u0161tina","cestina"]},{language:"Slovak",code:"sk",aliases:["sloven\u010Dina"]},{language:"Slovenian",code:"sl",aliases:["sloven\u0161\u010Dina"]},{language:"Croatian",code:"hr",aliases:["hrvatski"]},{language:"Bosnian",code:"bs",aliases:["bosanski"]},{language:"Serbian",code:"sr",aliases:["\u0441\u0440\u043F\u0441\u043A\u0438"]},{language:"Montenegrin",code:"sr",aliases:["crnogorski"]},{language:"Macedonian",code:"mk",aliases:["\u043C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438"]},{language:"Bulgarian",code:"bg",aliases:["\u0431\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"]},{language:"Russian",code:"ru",aliases:["\u0440\u0443\u0441\u0441\u043A\u0438\u0439"]},{language:"Ukrainian",code:"uk",aliases:["\u0443\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"]},{language:"Belarusian",code:"be",aliases:["\u0431\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F"]},{language:"Latvian",code:"lv",aliases:["latvie\u0161u"]},{language:"Lithuanian",code:"lt",aliases:["lietuvi\u0173"]},{language:"Greek",code:"el",aliases:["\u03B5\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC","ellinik\xE1"]},{language:"Albanian",code:"sq",aliases:["shqip"]},{language:"Armenian",code:"hy",aliases:["\u0570\u0561\u0575\u0565\u0580\u0565\u0576"]},{language:"Persian",code:"fa",aliases:["farsi","dari","\u0641\u0627\u0631\u0633\u06CC"]},{language:"Hindi",code:"hi",aliases:["\u0939\u093F\u0928\u094D\u0926\u0940"]},{language:"Urdu",code:"ur",aliases:["\u0627\u0631\u062F\u0648"]},{language:"Bengali",code:"bn",aliases:["bangla","\u09AC\u09BE\u0982\u09B2\u09BE"]},{language:"Nepali",code:"ne",aliases:["\u0928\u0947\u092A\u093E\u0932\u0940"]},{language:"Sinhala",code:"si",aliases:["\u0DC3\u0DD2\u0D82\u0DC4\u0DBD","sinhalese"]},{language:"Finnish",code:"fi",aliases:["suomi"]},{language:"Estonian",code:"et",aliases:["eesti"]},{language:"Hungarian",code:"hu",aliases:["magyar"]},{language:"Turkish",code:"tr",aliases:["t\xFCrk\xE7e","turkce"]},{language:"Azerbaijani",code:"az",aliases:["az\u0259rbaycan dili","azeri"]},{language:"Kazakh",code:"kk",aliases:["\u049B\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456"]},{language:"Uzbek",code:"uz",aliases:["o'zbek"]},{language:"Kyrgyz",code:"ky",aliases:["\u043A\u044B\u0440\u0433\u044B\u0437\u0447\u0430"]},{language:"Turkmen",code:"tk",aliases:["t\xFCrkmen\xE7e"]},{language:"Arabic",code:"ar",aliases:["\u0627\u0644\u0639\u0631\u0628\u064A\u0629"]},{language:"Hebrew",code:"he",aliases:["\u05E2\u05D1\u05E8\u05D9\u05EA","ivrit"]},{language:"Amharic",code:"am",aliases:["\u12A0\u121B\u122D\u129B"]},{language:"Tigrinya",code:"ti",aliases:["\u1275\u130D\u122D\u129B"]},{language:"Chinese",code:"zh",aliases:["mandarin","\u4E2D\u6587","\u6C49\u8BED","putonghua"]},{language:"Japanese",code:"ja",aliases:["\u65E5\u672C\u8A9E","nihongo"]},{language:"Korean",code:"ko",aliases:["\uD55C\uAD6D\uC5B4"]},{language:"Thai",code:"th",aliases:["\u0E44\u0E17\u0E22"]},{language:"Vietnamese",code:"vi",aliases:["ti\u1EBFng vi\u1EC7t"]},{language:"Khmer",code:"km",aliases:["\u1781\u17D2\u1798\u17C2\u179A","cambodian"]},{language:"Lao",code:"lo",aliases:["\u0EA5\u0EB2\u0EA7"]},{language:"Burmese",code:"my",aliases:["\u1019\u103C\u1014\u103A\u1019\u102C","myanmar"]},{language:"Dzongkha",code:"dz",aliases:["\u0F62\u0FAB\u0F7C\u0F44\u0F0B\u0F41"]},{language:"Mongolian",code:"mn",aliases:["\u043C\u043E\u043D\u0433\u043E\u043B"]},{language:"Georgian",code:"ka",aliases:["\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8"]},{language:"Tajik",code:"tg",aliases:["\u0442\u043E\u04B7\u0438\u043A\u04E3"]},{language:"Malay",code:"ms",aliases:["bahasa malaysia","bahasa melayu"]},{language:"Indonesian",code:"id",aliases:["bahasa indonesia"]},{language:"Filipino",code:"fil",aliases:["tagalog","pilipino"]},{language:"Swahili",code:"sw",aliases:["kiswahili"]},{language:"Somali",code:"so",aliases:["af soomaali"]},{language:"Yoruba",code:"yo",aliases:["yor\xF9b\xE1"]},{language:"Hausa",code:"ha",aliases:["harshen hausa"]},{language:"Zulu",code:"zu",aliases:["isizulu"]},{language:"Afrikaans",code:"af"}];function O(e){return e.trim().toLowerCase()}function he(e){if(!e)return;let a=O(e);for(let t of Te)if(O(t.country)===a||t.aliases?.some(n=>O(n)===a))return t}function pe(e){if(!e)return;let a=O(e);for(let t of Ee)if(O(t.language)===a||t.aliases?.some(n=>O(n)===a))return t}var z=class extends Error{constructor(){super("user pressed back"),this.name="BackSignal"}},_=class extends Error{constructor(){super("user cancelled"),this.name="CancelSignal"}},xe="Include the country code with a + (e.g. +12025550123 for US, +447123456789 for UK)",ye=e=>/^\+\d{8,15}$/.test(e)?void 0:xe,Me=e=>/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e)?void 0:"Enter a valid email",M=e=>a=>a.trim().length===0?`${e} is required`:void 0,Ne=/[\u2022\u2023\u2024\u2027\u00B7\u2219\u22C5\u25CF\u25CB\u25AA\u25AB\u204E\u2217\uFE61\u25E6\u2218]/,Be="That looks like the masked \u2022\u2022\u2022\u2022\u2022 value your screen shows, not the token itself. Click the reveal/copy icon next to it and paste the real value (letters and numbers).",X=e=>Ne.test(e)?Be:void 0,Ke=e=>a=>X(a)??(a.trim().length===0?`${e} is required`:void 0),Oe=e=>{let a=e.replace(/\s+/g,"");return a.length===0?"Personal access token is required":X(a)??(/^sbp_[A-Za-z0-9._~+\/=-]{20,}$/.test(a)?void 0:"Doesn't look like a valid token \u2014 it should be 'sbp_' followed by letters and numbers.")},Re="one-off, no monthly fees",me="per month";function H(e){if(!e)return!0;let a=e.trim();if(a==="")return!0;let t=a.replace(/[^\d.]/g,"");if(t==="")return/^\s*free\s*$/i.test(a);let n=parseFloat(t);return!isNaN(n)&&n===0}var Le={id:"ai-agent",title:"AI coding agent",isApplicable:()=>!0,execute:async(e,{prompt:a,info:t})=>(t({title:"Which AI coding agent do you use?",body:`Klaudius works with two AI coding agents in your terminal \u2014 Claude Code
|
|
2
2
|
(Anthropic) or Codex (OpenAI). Pick whichever you already pay for.
|
|
3
3
|
|
|
4
4
|
This choice only changes which agent runs the pipeline. Everything else \u2014
|
|
@@ -19,7 +19,7 @@ ISO 3166 sovereign states + common territories like Hong Kong and
|
|
|
19
19
|
Puerto Rico). If we don't recognise the name, we'll ask you to type
|
|
20
20
|
the 2-letter ISO country code directly on the next prompt \u2014 the
|
|
21
21
|
same code Google Places uses for region biasing. Aliases like 'uk',
|
|
22
|
-
'usa', 'italia', 'maroc' all match.`}}):r=u;let l=
|
|
22
|
+
'usa', 'italia', 'maroc' all match.`}}):r=u;let l=he(r),c;l?c=l.code:c=(await a({type:"text",message:`What's the 2-letter ISO country code for ${r}?`,placeholder:"e.g. ID for Indonesia, ZA for South Africa, JO for Jordan",initialValue:e.countryCode??"",validate:b=>{let x=b.trim().toUpperCase();if(!/^[A-Z]{2}$/.test(x))return"Must be exactly 2 letters (ISO 3166-1 alpha-2 format)"},note:{title:`ISO code for ${r}`,body:`We didn't recognise "${r}" in our country lookup, so we need the
|
|
23
23
|
2-letter ISO 3166-1 alpha-2 code directly. Google Places uses this
|
|
24
24
|
for region biasing on every search.
|
|
25
25
|
|
|
@@ -35,7 +35,7 @@ to localise everything, or might pick "English" to keep their own voice.
|
|
|
35
35
|
Klaudius will use this language for every outreach message it sends and
|
|
36
36
|
every website it builds.`:`Pick the language you want every outreach message and every built
|
|
37
37
|
website to be written in. If we don't recognise the language name
|
|
38
|
-
we'll ask for the ISO language code on the next prompt.`}}),g=
|
|
38
|
+
we'll ask for the ISO language code on the next prompt.`}}),g=pe(m),S;return g?S=g.code:S=(await a({type:"text",message:`What's the ISO language code for ${m}?`,placeholder:"e.g. id for Indonesian, sw for Swahili, fil for Filipino",initialValue:e.languageCode??"",validate:b=>{let x=b.trim().toLowerCase();if(!/^[a-z]{2,3}$/.test(x))return"Must be 2 or 3 lowercase letters (ISO 639-1 or BCP 47 code)"},note:{title:`ISO code for ${m}`,body:`We didn't recognise "${m}" in our language lookup, so we need
|
|
39
39
|
the ISO language code directly. Google Places uses this for response
|
|
40
40
|
language, and it becomes the <html lang="..."> value on every built
|
|
41
41
|
site.
|
|
@@ -43,7 +43,7 @@ site.
|
|
|
43
43
|
Most languages have a 2-letter ISO 639-1 code. A few (Filipino \u2192
|
|
44
44
|
"fil") use the 3-letter ISO 639-3 / BCP 47 code instead.
|
|
45
45
|
|
|
46
|
-
Full list: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes`}})).trim().toLowerCase(),{country:l?l.country:r.trim(),countryCode:c,language:g?g.language:m.trim(),languageCode:S}}},Fe={id:"pricing",title:"Pricing",isApplicable:()=>!0,execute:async(e,{prompt:a})=>{let t=e.pricingTerms===
|
|
46
|
+
Full list: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes`}})).trim().toLowerCase(),{country:l?l.country:r.trim(),countryCode:c,language:g?g.language:m.trim(),languageCode:S}}},Fe={id:"pricing",title:"Pricing",isApplicable:()=>!0,execute:async(e,{prompt:a})=>{let t=e.pricingTerms===me,n=t?"":e.pricing??"$999",s=e.pricingMonthly??(t?e.pricing??"":""),i=await a({type:"text",message:"What's the upfront fee you'll charge clients per site?",placeholder:"e.g. $999, \xA3799, \u20AC899 \u2014 or 0 for monthly-only billing",initialValue:n,note:{title:"Upfront fee",body:`The one-time amount charged when a client signs up. Type 0 (or
|
|
47
47
|
leave blank) if you only want to charge a monthly fee. You can
|
|
48
48
|
also add a recurring monthly fee on the next prompt \u2014 combining
|
|
49
49
|
the two is fine (e.g. $499 upfront + $49/month).
|
|
@@ -51,7 +51,7 @@ the two is fine (e.g. $499 upfront + $49/month).
|
|
|
51
51
|
Use the currency that matches your clients' region. Klaudius
|
|
52
52
|
uses this string verbatim throughout outreach.`}}),o=await a({type:"text",message:"What's the monthly fee? (optional \u2014 leave blank for one-off only)",placeholder:"e.g. $49, \xA339, \u20AC45 \u2014 or blank for none",initialValue:s,validate:h=>{if(H(i)&&H(h))return"Set an upfront fee, a monthly fee, or both \u2014 they can't both be zero."},note:{title:"Monthly fee (optional)",body:`Leave blank to charge a one-off fee only. Fill it in to charge
|
|
53
53
|
a recurring monthly fee \u2014 either on its own (if upfront was 0)
|
|
54
|
-
or alongside the upfront fee.`}}),d=H(i),u=H(o),r,l,c;return d&&!u?(r=o.trim(),l=
|
|
54
|
+
or alongside the upfront fee.`}}),d=H(i),u=H(o),r,l,c;return d&&!u?(r=o.trim(),l=me,c=o.trim()):!d&&u?(r=i.trim(),l=Re,c=void 0):(r=i.trim(),l=`upfront, then ${o.trim()}/month`,c=o.trim()),{pricing:r,pricingTerms:l,pricingMonthly:c}}},Ge={id:"outreach-enabled",title:"Automated outreach",isApplicable:()=>!0,execute:async(e,{prompt:a})=>({outreachEnabled:await a({type:"confirm",message:"Use Klaudius's automated outreach features?",initialValue:e.outreachEnabled??!0,note:{title:"Automated outreach features",body:`After finding candidates and building websites for them, Klaudius can
|
|
55
55
|
run outreach to them automatically (email, SMS, or WhatsApp).
|
|
56
56
|
If you'd rather handle outreach manually, you can skip this here.`}})})},ze={id:"operator-name",title:"Sign-off name",isApplicable:e=>e.outreachEnabled===!0,execute:async(e,{prompt:a})=>({name:await a({type:"text",message:"What name should sign off your outreach messages?",placeholder:"e.g. Mike Smith \u2014 or your business name if you'd rather",initialValue:e.name??e.emailFromName??"",validate:M("Name"),note:{title:"Sign-off name",body:`Klaudius signs off every outreach message and follow-up with this
|
|
57
57
|
name \u2014 e.g. "Cordiali saluti, Marco" in Italian, "Best, Mike" in
|
|
@@ -77,7 +77,7 @@ when one channel doesn't work.
|
|
|
77
77
|
You'll be asked to pick your first-choice channel now, then optionally a
|
|
78
78
|
second and third. The order matters: it's the order Klaudius tries.`});let n={email:"Email",sms:"SMS (iMessage or Twilio, configured next)",whatsapp:"WhatsApp (Baileys / phone-linked device)"},s=["email","sms","whatsapp"],i=e.outreachPriority??[],o=[],d=await a({type:"select",message:"Which channel should Klaudius try FIRST for each candidate?",initialValue:i[0]??"email",options:s.map(u=>({value:u,label:n[u]}))});for(o.push(d);o.length<s.length;){let u=s.filter(m=>!o.includes(m)),r=o.length===1?"second":"third",l=o[o.length-1],c=n[l].replace(/\s*\(.*\)$/,"").toLowerCase(),h=await a({type:"select",message:`Should Klaudius use another channel as ${r} priority (for candidates where ${c} isn't viable or fails)?`,initialValue:i[o.length]??"no",options:[...u.map(m=>({value:m,label:`Yes \u2014 also use ${n[m]}`})),{value:"no",label:"No, that's all"}]});if(h==="no")break;o.push(h)}return{outreachChannels:o,outreachPriority:o}}},De={id:"email",title:"Email setup",isApplicable:e=>e.outreachChannels?.includes("email")===!0,execute:async(e,{prompt:a,info:t})=>{t({title:"Email setup",body:`Klaudius needs an email account to send outreach FROM. This is the
|
|
79
79
|
address candidates will see as the sender. Use a domain you control
|
|
80
|
-
(your own, your business's) \u2014 not your personal address.`});let n=await a({type:"select",message:"Who hosts the email account you'll send outreach from?",initialValue:e.emailProvider??"gmail",options:[{value:"gmail",label:"Gmail"},{value:"fastmail",label:"Fastmail"},{value:"outlook",label:"Outlook / Office 365"},{value:"zoho",label:"Zoho Mail"},{value:"ionos",label:"IONOS"},{value:"custom",label:"Custom / other (enter SMTP/IMAP details manually)"}]}),s=n!=="custom"?
|
|
80
|
+
(your own, your business's) \u2014 not your personal address.`});let n=await a({type:"select",message:"Who hosts the email account you'll send outreach from?",initialValue:e.emailProvider??"gmail",options:[{value:"gmail",label:"Gmail"},{value:"fastmail",label:"Fastmail"},{value:"outlook",label:"Outlook / Office 365"},{value:"zoho",label:"Zoho Mail"},{value:"ionos",label:"IONOS"},{value:"custom",label:"Custom / other (enter SMTP/IMAP details manually)"}]}),s=n!=="custom"?le[n]:void 0,i=await a({type:"text",message:"Email address to send outreach from",placeholder:"you@yourbusiness.com",initialValue:e.emailAddress??"",validate:Me}),o=s?.appPasswordHelp??ue,d=await a({type:"password",message:"Paste the app password",initialValue:e.emailPassword??"",validate:M("App password"),note:{title:"App password",body:`An app password is a separate, single-purpose password that your
|
|
81
81
|
email provider issues for third-party apps like Klaudius. It is NOT
|
|
82
82
|
your normal account login password.
|
|
83
83
|
|
|
@@ -85,7 +85,7 @@ your normal account login password.
|
|
|
85
85
|
|
|
86
86
|
Once generated, it's stored locally in this project's .env file.
|
|
87
87
|
It is never sent to Klaudius's servers \u2014 only to your email
|
|
88
|
-
provider when sending outreach.`}}),u,r,l,c,h,m;if(n==="custom"){u=await a({type:"text",message:"SMTP host (the server Klaudius connects to for sending)",placeholder:"e.g. smtp.yourprovider.com",initialValue:e.emailSmtpHost??"",validate:M("SMTP host")});let g=await a({type:"text",message:"SMTP port (usually 587 for STARTTLS or 465 for SSL)",initialValue:String(e.emailSmtpPort??587),validate:b=>/^\d+$/.test(b)?void 0:"Must be a number"});r=parseInt(g,10),l=await a({type:"text",message:"IMAP host (the server Klaudius connects to for reading replies)",placeholder:"e.g. imap.yourprovider.com",initialValue:e.emailImapHost??"",validate:M("IMAP host")});let S=await a({type:"text",message:"IMAP port (usually 993 for SSL)",initialValue:String(e.emailImapPort??993),validate:b=>/^\d+$/.test(b)?void 0:"Must be a number"});c=parseInt(S,10),h=await a({type:"text",message:"Sent folder name (so SMTP-sent messages also appear in your email client's Sent folder)",placeholder:'e.g. "Sent", "Sent Items"',initialValue:e.emailSentFolder??"Sent"}),m=await a({type:"text",message:"Inbox folder name (almost always INBOX)",initialValue:e.emailInboxFolder??"INBOX"})}else{let g=s,S=n===e.emailProvider,b=S?e.emailSmtpHost:void 0,x=S?e.emailSmtpPort:void 0,
|
|
88
|
+
provider when sending outreach.`}}),u,r,l,c,h,m;if(n==="custom"){u=await a({type:"text",message:"SMTP host (the server Klaudius connects to for sending)",placeholder:"e.g. smtp.yourprovider.com",initialValue:e.emailSmtpHost??"",validate:M("SMTP host")});let g=await a({type:"text",message:"SMTP port (usually 587 for STARTTLS or 465 for SSL)",initialValue:String(e.emailSmtpPort??587),validate:b=>/^\d+$/.test(b)?void 0:"Must be a number"});r=parseInt(g,10),l=await a({type:"text",message:"IMAP host (the server Klaudius connects to for reading replies)",placeholder:"e.g. imap.yourprovider.com",initialValue:e.emailImapHost??"",validate:M("IMAP host")});let S=await a({type:"text",message:"IMAP port (usually 993 for SSL)",initialValue:String(e.emailImapPort??993),validate:b=>/^\d+$/.test(b)?void 0:"Must be a number"});c=parseInt(S,10),h=await a({type:"text",message:"Sent folder name (so SMTP-sent messages also appear in your email client's Sent folder)",placeholder:'e.g. "Sent", "Sent Items"',initialValue:e.emailSentFolder??"Sent"}),m=await a({type:"text",message:"Inbox folder name (almost always INBOX)",initialValue:e.emailInboxFolder??"INBOX"})}else{let g=s,S=n===e.emailProvider,b=S?e.emailSmtpHost:void 0,x=S?e.emailSmtpPort:void 0,L=S?e.emailImapHost:void 0,V=S?e.emailImapPort:void 0,Z=!!b&&b!==g.smtpHost||!!L&&L!==g.imapHost;if(await a({type:"select",message:`Server settings for ${g.label}`,initialValue:Z?"manual":"standard",options:[{value:"standard",label:`Use the standard ${g.label} servers \u2014 ${g.smtpHost} (Recommended)`},{value:"manual",label:"Enter servers manually (regional accounts, custom setups)"}],note:g.serverHelp?{title:"Server settings",body:g.serverHelp}:void 0})==="manual"){u=await a({type:"text",message:"SMTP host (the server Klaudius connects to for sending)",initialValue:b??g.smtpHost,validate:M("SMTP host")});let F=await a({type:"text",message:"SMTP port (usually 587 for STARTTLS or 465 for SSL)",initialValue:String(x??g.smtpPort),validate:y=>/^\d+$/.test(y)?void 0:"Must be a number"});r=parseInt(F,10),l=await a({type:"text",message:"IMAP host (the server Klaudius connects to for reading replies)",initialValue:L??g.imapHost,validate:M("IMAP host")});let J=await a({type:"text",message:"IMAP port (usually 993 for SSL)",initialValue:String(V??g.imapPort),validate:y=>/^\d+$/.test(y)?void 0:"Must be a number"});c=parseInt(J,10),h=(S?e.emailSentFolder:void 0)??g.sentFolder,m=(S?e.emailInboxFolder:void 0)??g.inboxFolder}else u=g.smtpHost,r=g.smtpPort,l=g.imapHost,c=g.imapPort,h=g.sentFolder,m=g.inboxFolder}return{emailProvider:n,emailAddress:i,emailPassword:d,emailFromName:e.name,emailSmtpHost:u,emailSmtpPort:r,emailImapHost:l,emailImapPort:c,emailSentFolder:h,emailInboxFolder:m}}},We={id:"sms",title:"SMS setup",isApplicable:e=>e.outreachChannels?.includes("sms")===!0,execute:async(e,{prompt:a,info:t})=>{t({title:"SMS setup",body:`Klaudius can send SMS one of two ways:
|
|
89
89
|
|
|
90
90
|
\u2022 macOS iMessage \u2014 free, uses Messages.app on your Mac.
|
|
91
91
|
Reaches other Apple users as iMessage for free. To reach
|
|
@@ -101,7 +101,7 @@ provider when sending outreach.`}}),u,r,l,c,h,m;if(n==="custom"){u=await a({type
|
|
|
101
101
|
|
|
102
102
|
\u2022 Twilio \u2014 cross-platform, ~$0.01 per SMS. Sender is a phone
|
|
103
103
|
number you buy from Twilio. Works on any OS, reaches any
|
|
104
|
-
phone, no iPhone required. Recommended for consistent delivery.`});let n=await a({type:"select",message:"Which SMS provider?",initialValue:e.smsProvider??(process.platform==="darwin"?"imessage":"twilio"),options:[{value:"imessage",label:"macOS iMessage (free, Mac only)"},{value:"twilio",label:"Twilio (cross-platform, paid per-message \u2014 recommended)"}]}),s=await a({type:"text",message:"Your mobile number (used as a safe target for test sends so Klaudius doesn't accidentally message real candidates while you're testing)",placeholder:"+12025550123",initialValue:e.testPhone??"",validate:
|
|
104
|
+
phone, no iPhone required. Recommended for consistent delivery.`});let n=await a({type:"select",message:"Which SMS provider?",initialValue:e.smsProvider??(process.platform==="darwin"?"imessage":"twilio"),options:[{value:"imessage",label:"macOS iMessage (free, Mac only)"},{value:"twilio",label:"Twilio (cross-platform, paid per-message \u2014 recommended)"}]}),s=await a({type:"text",message:"Your mobile number (used as a safe target for test sends so Klaudius doesn't accidentally message real candidates while you're testing)",placeholder:"+12025550123",initialValue:e.testPhone??"",validate:ye}),i={smsProvider:n,testPhone:s};return n==="twilio"&&(i.twilioAccountSid=await a({type:"text",message:"Twilio Account SID (starts with AC...)",initialValue:e.twilioAccountSid??"",validate:o=>/^AC[a-zA-Z0-9]+$/.test(o)?void 0:"Should start with 'AC'"}),i.twilioAuthToken=await a({type:"password",message:"Twilio Auth Token",initialValue:e.twilioAuthToken??"",validate:Ke("Twilio Auth Token")}),i.twilioPhoneNumber=await a({type:"text",message:"Twilio phone number (the number outreach will be sent FROM)",placeholder:"+15551234567",initialValue:e.twilioPhoneNumber??"",validate:ye})),i}},He={id:"whatsapp",title:"WhatsApp setup",isApplicable:e=>e.outreachPriority?.includes("whatsapp")===!0,execute:async(e,{prompt:a,info:t})=>{t({title:"WhatsApp setup",body:`Klaudius connects to WhatsApp as a linked device on your phone \u2014 same way
|
|
105
105
|
WhatsApp Web works. Setup is a one-time QR scan from the WhatsApp app on
|
|
106
106
|
the phone whose number you want to use. Klaudius will guide you through
|
|
107
107
|
that AFTER this wizard, once npm dependencies are installed.
|
|
@@ -251,7 +251,7 @@ in another tab/app and paste this prompt verbatim:
|
|
|
251
251
|
Settings \u2192 Data API \u2192 'API URL'
|
|
252
252
|
|
|
253
253
|
It looks like https://xxxx.supabase.co. Click to copy and paste
|
|
254
|
-
below.`}})).trim().replace(/\/rest\/v1\/?$/i,"").replace(/\/$/,""),i=s.match(/^https:\/\/([a-z0-9]+)\.supabase\.co/i)?.[1]??"",d=(await a({type:"password",message:"Paste the Supabase secret key (sb_secret_\u2026)",initialValue:e.supabaseServiceKey??"",validate:l=>{let c=l.trim(),h=
|
|
254
|
+
below.`}})).trim().replace(/\/rest\/v1\/?$/i,"").replace(/\/$/,""),i=s.match(/^https:\/\/([a-z0-9]+)\.supabase\.co/i)?.[1]??"",d=(await a({type:"password",message:"Paste the Supabase secret key (sb_secret_\u2026)",initialValue:e.supabaseServiceKey??"",validate:l=>{let c=l.trim(),h=X(c);if(h)return h;if(c.length<20)return"Looks too short";if(c.startsWith("sb_publishable_"))return"That's the publishable key. Klaudius needs the 'sb_secret_\u2026' key on the same page (different row, below the publishable one).";if(!c.startsWith("sb_secret_")&&!c.startsWith("eyJ"))return"Doesn't look like a Supabase secret key. Expected 'sb_secret_\u2026' (or a legacy JWT starting with 'eyJ\u2026' on older projects)."},note:{title:"Secret key",body:`Open this exact page:
|
|
255
255
|
https://supabase.com/dashboard/project/${i}/settings/api-keys
|
|
256
256
|
|
|
257
257
|
Under 'Secret keys', find the row whose value starts with
|
|
@@ -263,7 +263,7 @@ are client-side keys with no write permissions).
|
|
|
263
263
|
Don't confuse this page with 'Edge Functions \u2192 Secrets' in the
|
|
264
264
|
left sidebar \u2014 that's an unrelated feature (env vars for Edge
|
|
265
265
|
Functions). The page you want is Settings (gear icon, bottom
|
|
266
|
-
of the left sidebar) \u2192 API Keys.`}})).replace(/\s+/g,""),r=(await a({type:"password",message:"Paste the Supabase personal access token",initialValue:e.supabasePat??"",validate:
|
|
266
|
+
of the left sidebar) \u2192 API Keys.`}})).replace(/\s+/g,""),r=(await a({type:"password",message:"Paste the Supabase personal access token",initialValue:e.supabasePat??"",validate:Oe,note:{title:"Personal access token",body:`This is a separate credential from the secret key above \u2014 it's an
|
|
267
267
|
ACCOUNT-wide token (not project-scoped) used by the Supabase MCP and
|
|
268
268
|
by Klaudius's schema migration.
|
|
269
269
|
|
|
@@ -273,7 +273,7 @@ Open this exact page:
|
|
|
273
273
|
Click 'Generate new token', name it 'Klaudius', and set the
|
|
274
274
|
expiration to 'Never' (recommended \u2014 saves you having to rotate
|
|
275
275
|
it later). Copy the value (starts with 'sbp_') and paste it
|
|
276
|
-
below.`}})).replace(/\s+/g,"");return{supabaseUrl:s,supabaseServiceKey:d,supabasePat:r,supabaseProjectRef:i}}},Ze={id:"google-places",title:"Google Places API",isApplicable:()=>!0,execute:async(e,{prompt:a})=>{let t=await a({type:"password",message:"Paste your Google Places API key",placeholder:"AIzaSy\u2026",initialValue:e.googlePlacesApiKey??"",validate:s=>
|
|
276
|
+
below.`}})).replace(/\s+/g,"");return{supabaseUrl:s,supabaseServiceKey:d,supabasePat:r,supabaseProjectRef:i}}},Ze={id:"google-places",title:"Google Places API",isApplicable:()=>!0,execute:async(e,{prompt:a})=>{let t=await a({type:"password",message:"Paste your Google Places API key",placeholder:"AIzaSy\u2026",initialValue:e.googlePlacesApiKey??"",validate:s=>ge(s),note:{title:"Google Places API key",body:`Klaudius's /find skill queries Google's Places API to discover businesses
|
|
277
277
|
without websites in your target region. Without a key, the pipeline has
|
|
278
278
|
no source of leads \u2014 so this is required.
|
|
279
279
|
|
|
@@ -309,7 +309,7 @@ STUCK? Open Claude (or any LLM) in another tab/app and paste this prompt:
|
|
|
309
309
|
"I need a Google Places API (New) key for a CLI tool called
|
|
310
310
|
Klaudius. Walk me through claiming the $300 Google Cloud free trial
|
|
311
311
|
and getting the API key Google auto-generates after enabling
|
|
312
|
-
Places API (New), including any signup gotchas."`}});return{googlePlacesApiKey:
|
|
312
|
+
Places API (New), including any signup gotchas."`}});return{googlePlacesApiKey:de(t).value}}},Je={id:"telegram",title:"Telegram (optional)",isApplicable:()=>!0,clearOnSkip:["telegramBotToken","telegramChatId"],execute:async(e,{prompt:a})=>{if(!await a({type:"confirm",message:"Set up Telegram notifications? (sends a ping when outreach lands)",initialValue:!!e.telegramBotToken,note:{title:"Telegram notifications (optional)",body:`Klaudius can ping a Telegram chat when outreach is sent or when a
|
|
313
313
|
candidate replies. This is OPTIONAL \u2014 skip it if you'd rather check
|
|
314
314
|
the Supabase dashboard manually.
|
|
315
315
|
|
|
@@ -346,5 +346,5 @@ any messages your bot has received. To make that work:
|
|
|
346
346
|
If the chat starts with a 'Start' button, tap that first,
|
|
347
347
|
THEN send 'hi'. /start alone doesn't always show up.
|
|
348
348
|
3. Press Enter below \u2014 Klaudius will detect the chat ID for
|
|
349
|
-
you.`}});let l=await
|
|
350
|
-
`);return ua(Ae,{flexDirection:"column",borderStyle:"round",borderColor:"gray",paddingX:1,children:[
|
|
349
|
+
you.`}});let l=await ce({botToken:n});if(l.ok&&l.chatId)s=l.chatId;else if(l.reason==="no_messages")o="No messages from you to your bot have been picked up yet.",d="no_messages";else if(l.reason==="network")o=l.message??"Could not reach Telegram.",d="network";else throw new Error(`Telegram chat ID auto-detect failed: ${l.message??"unknown error"}`)}return{telegramBotToken:n,telegramChatId:s}}},N=[Le,Ve,Fe,Ge,ze,Ue,De,We,He,_e,$e,je,Ye,qe,Ze,Je];import{Box as fe,Text as Qe}from"ink";import{jsx as be,jsxs as aa}from"react/jsx-runtime";var Xe={pending:"\u25CB",current:"\u25C9",done:"\u2713",skipped:"\xB7"},ea={pending:void 0,current:"cyan",done:"green",skipped:void 0};function Ce({items:e}){return be(fe,{flexDirection:"column",width:28,flexShrink:0,children:e.map(a=>{let t=a.status==="skipped"||a.status==="pending";return be(fe,{children:aa(Qe,{color:ea[a.status],bold:a.status==="current",dimColor:t&&a.status!=="current",children:[Xe[a.status]," ",a.title]})},a.id)})})}import{useEffect as na,useState as we}from"react";import{Box as ee,Text as $,useInput as ta}from"ink";import oa from"ink-text-input";import{jsx as U,jsxs as ae}from"react/jsx-runtime";function Se({spec:e,masked:a,onSubmit:t,onBack:n}){let s=typeof e.initialValue=="string"?e.initialValue:"",i=a&&s.length>0,[o,d]=we(i?"":s),[u,r]=we(null);na(()=>(w("TextPromptUI:mount",{masked:a,message:e.message.slice(0,60),initial:typeof e.initialValue=="string"?e.initialValue.slice(0,30):null}),()=>{w("TextPromptUI:unmount")}),[a,e.message,e.initialValue]),ta((c,h)=>{w("TextPromptUI:useInput fired",{input:c,ctrl:h.ctrl,escape:h.escape,return:h.return}),h.escape&&n()});let l=c=>{w("TextPromptUI:handleSubmit",{raw:c.slice(0,30)});let h=c.length===0&&i?s:c;if(e.validate){let m=e.validate(h);if(m){w("TextPromptUI:validate failed",{err:m}),r(m);return}}r(null),t(h)};return ae(ee,{flexDirection:"column",children:[ae($,{children:[U($,{color:"cyan",children:"?"})," ",e.message]}),ae(ee,{children:[U($,{color:"green",children:"\u203A "}),U(oa,{value:o,onChange:d,onSubmit:l,placeholder:i?"type or paste a new value \u2014 or press Enter to keep the current one":e.placeholder,mask:a?"\u2022":void 0})]}),u&&U(ee,{marginTop:0,children:U($,{color:"red",children:u})})]})}import{useState as ia}from"react";import{Box as ne,Text as j,useInput as sa}from"ink";import{jsx as Y,jsxs as te}from"react/jsx-runtime";function ke({spec:e,onSubmit:a,onBack:t}){let n=e.options??[],s=typeof e.initialValue=="string"?Math.max(0,n.findIndex(d=>d.value===e.initialValue)):0,[i,o]=ia(s===-1?0:s);return sa((d,u)=>{if(u.escape)t();else if(u.upArrow)o(r=>(r-1+n.length)%n.length);else if(u.downArrow)o(r=>(r+1)%n.length);else if(u.return){let r=n[i];r&&a(r.value)}}),te(ne,{flexDirection:"column",children:[te(j,{children:[Y(j,{color:"cyan",children:"?"})," ",e.message]}),Y(ne,{flexDirection:"column",marginTop:0,children:n.map((d,u)=>{let r=u===i;return te(j,{color:r?"cyan":void 0,bold:r,children:[r?"\u25CF ":"\u25CB ",d.label]},d.value)})}),Y(ne,{marginTop:1,children:Y(j,{dimColor:!0,children:"Use the \u2191 \u2193 arrow keys to choose, then press Enter"})})]})}import{useState as ra}from"react";import{Box as oe,Text as R,useInput as la}from"ink";import{jsx as q,jsxs as D}from"react/jsx-runtime";function ve({spec:e,onSubmit:a,onBack:t}){let[n,s]=ra(typeof e.initialValue=="boolean"?e.initialValue:!0);return la((i,o)=>{o.escape?t():o.leftArrow||o.rightArrow?s(d=>!d):i==="y"||i==="Y"?s(!0):i==="n"||i==="N"?s(!1):o.return&&a(n)}),D(oe,{flexDirection:"column",children:[D(R,{children:[q(R,{color:"cyan",children:"?"})," ",e.message]}),D(oe,{marginTop:0,children:[D(R,{color:n?"cyan":void 0,bold:n,children:[n?"\u25CF ":"\u25CB ","Yes"]}),q(R,{children:" "}),D(R,{color:n?void 0:"cyan",bold:!n,children:[n?"\u25CB ":"\u25CF ","No"]})]}),q(oe,{marginTop:1,children:q(R,{dimColor:!0,children:"Use the \u2190 \u2192 arrow keys (or y / n) to choose, then press Enter"})})]})}import{Box as Ae,Text as Pe}from"ink";import{jsx as ie,jsxs as ua}from"react/jsx-runtime";function se({title:e,body:a}){let t=a.split(`
|
|
350
|
+
`);return ua(Ae,{flexDirection:"column",borderStyle:"round",borderColor:"gray",paddingX:1,children:[ie(Pe,{color:"cyan",bold:!0,children:e}),ie(Ae,{flexDirection:"column",marginTop:0,children:t.map((n,s)=>ie(Pe,{dimColor:!1,children:n.length===0?" ":n},s))})]})}import{jsx as f,jsxs as W}from"react/jsx-runtime";function an({defaults:e,onComplete:a,onlySection:t,banner:n}){let{exit:s}=ga(),i=re({...e}),o=re(new Map),[,d]=B(0),u=()=>d(y=>y+1),[r,l]=B(null),[c,h]=B(null),[m,g]=B([]),[S,b]=B(null),[x,L]=B(!1),[V,Z]=B({current:0,total:0}),K=()=>{let y=o.current;for(let k of N){let Q=k.isApplicable(i.current),p=y.get(k.id);Q?t&&k.id!==t?p!=="current"&&y.set(k.id,"done"):(p==="skipped"||!p)&&y.set(k.id,"pending"):y.set(k.id,"skipped")}};o.current.size===0&&K();let F=re(!1);ca(()=>{if(w("WizardApp:useEffect fired",{startedAlready:F.current}),F.current){w("WizardApp:useEffect returning early (startedRef true)");return}F.current=!0,w("WizardApp:orchestrator starting");let y=0,k=p=>{let I=++y;return w("orchestrator:promptFn called",{id:I,type:p.type,message:p.message.slice(0,60)}),b(null),new Promise((v,C)=>{h({id:I,spec:p,resolve:T=>{w("orchestrator:prompt resolved",{id:I,type:p.type,value:typeof T=="string"?T.slice(0,30):T}),v(T)},reject:T=>{w("orchestrator:prompt rejected",{id:I,reason:T.message}),C(T)}})})},Q=p=>{g(I=>[...I,p])};return(async()=>{try{let p=t?N.filter(C=>C.id===t):N,I=()=>p.filter(C=>C.isApplicable(i.current)).length,v=0;for(;v<p.length;){let C=p[v];if(!C.isApplicable(i.current)){o.current.set(C.id,"skipped"),v++,K(),u();continue}g([]);for(let A of N)A.id===C.id?o.current.set(A.id,"current"):o.current.get(A.id)==="current"&&o.current.set(A.id,"pending");l(C.id);let T=p.slice(0,v+1).filter(A=>A.isApplicable(i.current)).length;Z({current:T,total:I()}),u();try{let A=await C.execute(i.current,{prompt:k,info:Q});i.current={...i.current,...A},o.current.set(C.id,"done"),K(),v++}catch(A){if(A instanceof z){if(t&&C.clearOnSkip){for(let Ie of C.clearOnSkip)i.current[Ie]=void 0;o.current.set(C.id,"skipped"),K(),v++;continue}if(t)continue;o.current.set(C.id,"pending");let G=v-1;for(;G>=0&&!p[G].isApplicable(i.current);)G--;G<0||(v=G,o.current.set(p[v].id,"pending")),K(),u();continue}throw A}}w("orchestrator:all sections done, calling onComplete + exit"),L(!0),h(null),l(null),u(),await new Promise(C=>setTimeout(C,200)),a(i.current),s()}catch(p){w("orchestrator:caught error",{name:p?.name,message:p?.message}),p instanceof _&&(s(),process.exit(0));let I=p instanceof Error?p.message:String(p);b(`Setup error: ${I}`),u()}})(),()=>{w("WizardApp:useEffect cleanup ran (component unmounting)")}},[s,a]),ha((y,k)=>{w("WizardApp:useInput fired",{input:y,ctrl:k.ctrl,escape:k.escape,return:k.return}),k.ctrl&&y==="c"&&(w("WizardApp:Ctrl+C \u2192 exiting"),s(),process.exit(0))});let J=da(()=>N.map(y=>({id:y.id,title:y.title,status:o.current.get(y.id)??"pending"})),[r,x,S]);return W(P,{flexDirection:"column",paddingY:1,children:[W(P,{marginBottom:1,children:[f(E,{bold:!0,color:"cyan",children:"Klaudius setup"}),f(E,{dimColor:!0,children:" \xB7 "}),f(E,{dimColor:!0,children:V.total>0?`Step ${V.current} of ${V.total}`:"Loading\u2026"})]}),W(P,{children:[f(Ce,{items:J}),W(P,{flexDirection:"column",flexGrow:1,marginLeft:2,children:[n&&W(P,{marginBottom:1,borderStyle:"round",borderColor:"red",paddingX:1,flexDirection:"column",children:[f(E,{color:"red",bold:!0,children:"\u26A0 Heads up"}),f(E,{children:n})]}),!t&&r!==null&&r!=="ai-agent"&&f(P,{marginBottom:1,children:f(E,{color:"green",children:"Nothing here is permanent, you can customize any of this later."})}),m.map((y,k)=>f(P,{marginBottom:1,children:f(se,{title:y.title,body:y.body})},k)),c?.spec.note&&f(P,{marginBottom:1,children:f(se,{title:c.spec.note.title,body:c.spec.note.body})}),c&&ya(c),S&&f(P,{marginTop:1,children:f(E,{color:"red",children:S})}),x&&f(P,{marginTop:1,children:f(E,{color:"green",bold:!0,children:"\u2713 Setup complete. Continuing\u2026"})})]})]}),f(P,{marginTop:1,children:f(E,{dimColor:!0,children:pa(t,r)})})]})}function pa(e,a){if(e){let t=N.find(n=>n.id===a);return t?.clearOnSkip&&t.clearOnSkip.length>0?"\u21B5 confirm esc skip this section ctrl-c cancel":"\u21B5 confirm ctrl-c cancel"}return"\u21B5 confirm esc back to previous section ctrl-c cancel"}function ya(e){let a=n=>e.resolve(n),t=()=>e.reject(new z);switch(e.spec.type){case"text":case"password":return f(Se,{spec:e.spec,masked:e.spec.type==="password",onSubmit:a,onBack:t},e.id);case"select":return f(ke,{spec:e.spec,onSubmit:a,onBack:t},e.id);case"confirm":return f(ve,{spec:e.spec,onSubmit:a,onBack:t},e.id)}}export{an as WizardApp};
|
package/dist/bin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{a as se,b as ot,c as st,d as we,e as z,g as T,i as it,j as at,l as q,m as rt,n as lt}from"./chunk-H6TMU6MK.js";import{Command as ss}from"commander";import{spawn as ct}from"child_process";import _ from"picocolors";function J(){let e=process.version,t=/^v(\d+)\.(\d+)\.(\d+)/.exec(e);if(!t)return{ok:!1,message:`Could not parse the Node.js version string ("${e}"). Klaudius requires Node.js 22.15 or newer \u2014 install from https://nodejs.org/.`};let o=parseInt(t[1],10),n=parseInt(t[2],10),a=parseInt(t[3],10),i=`${o}.${n}.${a}`;return o<22||o===22&&n<15?{ok:!1,version:i,major:o,minor:n,message:`Your installed Node.js is ${i}. Klaudius requires Node.js 22.15 or newer (the dependency installer relies on the --use-system-ca flag, which was added in 22.15 to handle Windows machines where antivirus or corporate-proxy software MITMs HTTPS). Install a newer Node.js from https://nodejs.org/ \u2014 after installing, close every Terminal window, open a new one, then re-run klaudius.`}:{ok:!0,version:i,major:o,minor:n}}import{spawn as fn}from"child_process";var me=3,Ae=10,mn=[["python3"],["python"],["py","-3"]];async function he(){for(let e of mn){let t=await gn(e[0],[...e.slice(1),"--version"]),o=(t.stdout+t.stderr).trim();if(/Python was not found/i.test(o)||t.code!==0)continue;let n=/Python\s+(\d+)\.(\d+)(?:\.(\d+))?/.exec(o);if(!n)continue;let a=parseInt(n[1],10),i=parseInt(n[2],10),l=n[3]?`${a}.${i}.${n[3]}`:`${a}.${i}`;return{command:[...e],version:l,major:a,minor:i}}return null}async function ie(){let e=hn(),t=await he();if(!t){let l=process.platform==="win32"?` On Windows the \`python3\` / \`python\` commands are often the Microsoft Store placeholder, not a real interpreter \u2014 install from ${e} (tick "Add python.exe to PATH"), or disable the alias under Settings \u2192 Apps \u2192 Advanced app settings \u2192 App execution aliases.`:"";return{ok:!1,message:`Python ${me}.${Ae}+ is not installed (or not on PATH). Install it from ${e}.`+l}}let{command:o,version:n,major:a,minor:i}=t;return a<me||a===me&&i<Ae?{ok:!1,version:n,major:a,minor:i,command:o,message:`Your installed Python is ${n}. Klaudius needs Python ${me}.${Ae} or newer (the pipeline depends on packages that only ship wheels for ${me}.${Ae}+). Install a newer Python from ${e} \u2014 it lives alongside your existing Python, nothing breaks. After installing, close every Terminal window, open a new one, then re-run klaudius.`}:{ok:!0,version:n,major:a,minor:i,command:o}}function hn(){switch(process.platform){case"win32":return"https://www.python.org/downloads/windows/";case"darwin":return"https://www.python.org/downloads/macos/";default:return"https://www.python.org/downloads/"}}function gn(e,t){return new Promise(o=>{let n=fn(e,t,{stdio:["ignore","pipe","pipe"],shell:!1}),a="",i="";n.stdout?.on("data",l=>{a+=l.toString()}),n.stderr?.on("data",l=>{i+=l.toString()}),n.on("close",l=>o({code:l??1,stdout:a,stderr:i})),n.on("error",()=>o({code:1,stdout:a,stderr:i}))})}var dt=(process.env.KLAUDIUS_API_URL??"https://klaudius.dev").replace(/\/$/,"");async function ut(e={}){console.log(_.bold(`Klaudius preflight \u2014 checking your machine\u2026
|
|
3
3
|
`));let t=[];t.push(yn());let o=await ie();t.push(kn(o)),t.push(await wn(o.command)),t.push(await An()),t.push(await En());for(let a of t){let i=a.status==="ok"?_.green("\u2713"):_.red("\u2717");console.log(` ${i} ${a.name}${a.detail?_.dim(` \u2014 ${a.detail}`):""}`),a.nextAction&&console.log(` ${_.dim("\u2192")} ${_.cyan(a.nextAction)}`)}console.log();let n=t.filter(a=>a.status==="fail");if(n.length===0){Pn();return}console.log(_.red(_.bold(`${n.length} check${n.length===1?"":"s"} failed \u2014 fix the \u2192 items above, then re-run \`npx klaudius@latest preflight\`.`))),console.log(),console.log(_.dim(" AI assistant: install or upgrade whatever's marked \u2717 above for the")),console.log(_.dim(" user, then re-run `npx klaudius@latest preflight` until every check passes.")),console.log(),process.exitCode=1}function yn(){let e=J();return e.ok?{name:"Node.js \u2265 22.15",status:"ok",detail:e.version}:{name:"Node.js \u2265 22.15",status:"fail",detail:e.version??"not detected",nextAction:"Install Node.js 22.15+ from https://nodejs.org/ \u2014 then open a NEW terminal before re-running."}}function kn(e){return e.ok?{name:"Python \u2265 3.10",status:"ok",detail:e.version}:{name:"Python \u2265 3.10",status:"fail",detail:e.version??"not found",nextAction:e.message??"Install Python 3.10+ from https://www.python.org/downloads/"}}async function wn(e){let t=e??["python3"],o=await Fe(t[0],[...t.slice(1),"-m","pip","--version"]);return o.code===0?{name:"pip available",status:"ok",detail:(o.stdout||o.stderr).trim().split(`
|
|
4
|
-
`)[0]||"ok"}:{name:"pip available",status:"fail",detail:`${t.join(" ")} -m pip not runnable`,nextAction:`Add pip to your Python: \`${t.join(" ")} -m ensurepip --upgrade\` (or reinstall Python from python.org, which bundles pip).`}}async function An(){let e=process.platform==="win32",t=await Fe("npm",["--version"],e);return t.code!==0?{name:"npm / npx available",status:"fail",detail:"npm not found",nextAction:"npm ships with Node.js \u2014 reinstall Node from https://nodejs.org/."}:(await Fe("npx",["--version"],e)).code!==0?{name:"npm / npx available",status:"fail",detail:`npm ${t.stdout.trim()} ok, npx missing`,nextAction:"npx ships with npm 5.2+ \u2014 reinstall Node from https://nodejs.org/."}:{name:"npm / npx available",status:"ok",detail:`npm ${t.stdout.trim()}`}}async function En(){try{return await fetch(dt,{method:"HEAD",signal:AbortSignal.timeout(8e3)}),{name:"klaudius.dev reachable",status:"ok",detail:dt}}catch(e){return{name:"klaudius.dev reachable",status:"fail",detail:e.name==="TimeoutError"?"timed out":"could not connect",nextAction:"Check your internet connection, VPN, or firewall \u2014 init needs klaudius.dev to validate your license and download the template."}}}function Pn(){console.log(_.green(_.bold("All checks passed \u2014 your machine is ready."))),console.log(),console.log(_.bold("NEXT STEP \u2014 this one is for you to run, not the AI assistant:")),console.log(" It's an interactive wizard (it asks for your license key and passwords),"),console.log(" so the assistant can't fill it in. Open a NEW terminal tab and run:"),console.log(),console.log(` ${_.cyan("npx klaudius@latest init my-agency")}`),console.log(),console.log(_.dim(" AI assistant: stop here. Do not run init yourself \u2014 tell the user to")),console.log(_.dim(" run it in a new terminal.")),console.log()}function Fe(e,t,o=!1){return new Promise(n=>{let a=o?ct([e,...t].join(" "),{stdio:["ignore","pipe","pipe"],shell:!0}):ct(e,t,{stdio:["ignore","pipe","pipe"],shell:!1}),i="",l="";a.stdout?.on("data",c=>{i+=c.toString()}),a.stderr?.on("data",c=>{l+=c.toString()}),a.on("close",c=>n({code:c??1,stdout:i,stderr:l})),a.on("error",()=>n({code:1,stdout:i,stderr:l}))})}import{mkdir as qe,readdir as Wt,readFile as Gt,stat as Je,writeFile as ze}from"fs/promises";import{spawnSync as Yt}from"child_process";import{homedir as yo}from"os";import{resolve as ko,isAbsolute as wo,join as H,normalize as Ao}from"path";import*as y from"@clack/prompts";import d from"picocolors";import bn from"react";import{render as Tn}from"ink";async function I(e={},t={}){if(!process.stdin.isTTY)throw new Error("Klaudius's interactive wizard requires a terminal (TTY). Run `npx klaudius@latest init` directly from your terminal \u2014 not through a pipe, file redirect, or non-interactive shell context.");let{WizardApp:o}=await import("./WizardApp-
|
|
4
|
+
`)[0]||"ok"}:{name:"pip available",status:"fail",detail:`${t.join(" ")} -m pip not runnable`,nextAction:`Add pip to your Python: \`${t.join(" ")} -m ensurepip --upgrade\` (or reinstall Python from python.org, which bundles pip).`}}async function An(){let e=process.platform==="win32",t=await Fe("npm",["--version"],e);return t.code!==0?{name:"npm / npx available",status:"fail",detail:"npm not found",nextAction:"npm ships with Node.js \u2014 reinstall Node from https://nodejs.org/."}:(await Fe("npx",["--version"],e)).code!==0?{name:"npm / npx available",status:"fail",detail:`npm ${t.stdout.trim()} ok, npx missing`,nextAction:"npx ships with npm 5.2+ \u2014 reinstall Node from https://nodejs.org/."}:{name:"npm / npx available",status:"ok",detail:`npm ${t.stdout.trim()}`}}async function En(){try{return await fetch(dt,{method:"HEAD",signal:AbortSignal.timeout(8e3)}),{name:"klaudius.dev reachable",status:"ok",detail:dt}}catch(e){return{name:"klaudius.dev reachable",status:"fail",detail:e.name==="TimeoutError"?"timed out":"could not connect",nextAction:"Check your internet connection, VPN, or firewall \u2014 init needs klaudius.dev to validate your license and download the template."}}}function Pn(){console.log(_.green(_.bold("All checks passed \u2014 your machine is ready."))),console.log(),console.log(_.bold("NEXT STEP \u2014 this one is for you to run, not the AI assistant:")),console.log(" It's an interactive wizard (it asks for your license key and passwords),"),console.log(" so the assistant can't fill it in. Open a NEW terminal tab and run:"),console.log(),console.log(` ${_.cyan("npx klaudius@latest init my-agency")}`),console.log(),console.log(_.dim(" AI assistant: stop here. Do not run init yourself \u2014 tell the user to")),console.log(_.dim(" run it in a new terminal.")),console.log()}function Fe(e,t,o=!1){return new Promise(n=>{let a=o?ct([e,...t].join(" "),{stdio:["ignore","pipe","pipe"],shell:!0}):ct(e,t,{stdio:["ignore","pipe","pipe"],shell:!1}),i="",l="";a.stdout?.on("data",c=>{i+=c.toString()}),a.stderr?.on("data",c=>{l+=c.toString()}),a.on("close",c=>n({code:c??1,stdout:i,stderr:l})),a.on("error",()=>n({code:1,stdout:i,stderr:l}))})}import{mkdir as qe,readdir as Wt,readFile as Gt,stat as Je,writeFile as ze}from"fs/promises";import{spawnSync as Yt}from"child_process";import{homedir as yo}from"os";import{resolve as ko,isAbsolute as wo,join as H,normalize as Ao}from"path";import*as y from"@clack/prompts";import d from"picocolors";import bn from"react";import{render as Tn}from"ink";async function I(e={},t={}){if(!process.stdin.isTTY)throw new Error("Klaudius's interactive wizard requires a terminal (TTY). Run `npx klaudius@latest init` directly from your terminal \u2014 not through a pipe, file redirect, or non-interactive shell context.");let{WizardApp:o}=await import("./WizardApp-RUIFVZWE.js"),n=null;se("runWizard:start",{onlySection:t.onlySection,hasDefaults:Object.keys(e).length>0}),st(),await new Promise(i=>setImmediate(i)),await new Promise(i=>setTimeout(i,0)),se("runWizard:event loop drained, mounting Ink");let a=Tn(bn.createElement(o,{defaults:e,onlySection:t.onlySection,banner:t.banner,onComplete:i=>{se("runWizard:onComplete called",{keys:Object.keys(i).length}),n=i}}),{stdout:process.stdout,stderr:process.stderr,stdin:process.stdin,exitOnCtrlC:!1});if(se("runWizard:render returned, awaiting exit"),await a.waitUntilExit(),se("runWizard:waitUntilExit resolved",{resultIsNull:n===null}),!n)throw new Error(`Wizard exited without completing. Diagnostic log: ${ot}
|
|
5
5
|
Please share that file so we can trace what happened.`);return n}var Ge="claude-code";function pt(e){if(e==="claude-code"||e==="codex")return e}var Ve="vercel";function ft(e){if(e==="vercel"||e==="cloudflare"||e==="netlify")return e}function _n(e){if(e==="custom"||e!==void 0&&Object.hasOwn(z,e))return e}function Ee(e){let t=_n(e.EMAIL_PROVIDER);if(t)return t;let o=e.EMAIL_SMTP_HOST;if(o){for(let[n,a]of Object.entries(z))if(a.smtpHost===o)return n;return"custom"}}function Pe(e){let t=[],o=a=>{t.push(""),t.push("# "+"=".repeat(60)),t.push(`# ${a}`),t.push("# "+"=".repeat(60)),t.push("")},n=(a,i)=>{if(i==null||i===""){t.push(`# ${a}=`);return}let l=String(i);if(/[\s"'`$\\#&|<>;()*?\[\]{}!~]/.test(l)){let c=l.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`");t.push(`${a}="${c}"`)}else t.push(`${a}=${l}`)};return t.push("# Klaudius configuration"),t.push("# Generated by `npx klaudius init`. Edit freely."),t.push("# NEVER commit this file. .gitignore already excludes it."),o("Klaudius licence"),n("KLAUDIUS_LICENSE_KEY",e.licenseKey),o("AI coding agent"),n("AI_AGENT",e.aiAgent??Ge),o("Operating country and language"),n("OPERATOR_COUNTRY",e.country),n("OPERATOR_COUNTRY_CODE",e.countryCode),n("OPERATOR_LANGUAGE",e.language),n("OPERATOR_LANGUAGE_CODE",e.languageCode),o("Pricing"),n("PRICING",e.pricing),n("PRICING_TERMS",e.pricingTerms),n("PRICING_MONTHLY",e.pricingMonthly),o("Automated outreach features"),n("OUTREACH_ENABLED",e.outreachEnabled?"true":"false"),n("OPERATOR_NAME",e.name),n("SIGNATURE",e.signature),n("OUTREACH_CHANNELS",e.outreachChannels?.join(",")),n("OUTREACH_PRIORITY",e.outreachPriority?.join(",")),o("Email outreach"),n("EMAIL_PROVIDER",e.emailProvider),n("EMAIL_ADDRESS",e.emailAddress),n("EMAIL_PASSWORD",e.emailPassword),n("EMAIL_FROM_NAME",e.emailFromName),n("EMAIL_SMTP_HOST",e.emailSmtpHost),n("EMAIL_SMTP_PORT",e.emailSmtpPort),n("EMAIL_IMAP_HOST",e.emailImapHost),n("EMAIL_IMAP_PORT",e.emailImapPort),n("EMAIL_SENT_FOLDER",e.emailSentFolder),n("EMAIL_INBOX_FOLDER",e.emailInboxFolder),o("SMS outreach"),n("SMS_PROVIDER",e.smsProvider),n("TEST_PHONE",e.testPhone),n("TWILIO_ACCOUNT_SID",e.twilioAccountSid),n("TWILIO_AUTH_TOKEN",e.twilioAuthToken),n("TWILIO_PHONE_NUMBER",e.twilioPhoneNumber),o("WhatsApp outreach"),n("WHATSAPP_ACCOUNTS",e.whatsappAccounts?.join(",")),o("Supabase (pipeline state)"),n("SUPABASE_URL",e.supabaseUrl),n("SUPABASE_SERVICE_KEY",e.supabaseServiceKey),n("SUPABASE_PAT",e.supabasePat),n("SUPABASE_PROJECT_REF",e.supabaseProjectRef),o("Deployment"),n("DEPLOY_PROVIDER",e.deployProvider??Ve),n("VERCEL_TOKEN",e.vercelToken),n("VERCEL_SCOPE",e.vercelScope??""),n("CLOUDFLARE_API_TOKEN",e.cloudflareApiToken),n("CLOUDFLARE_ACCOUNT_ID",e.cloudflareAccountId),n("NETLIFY_AUTH_TOKEN",e.netlifyAuthToken),n("NETLIFY_ACCOUNT_SLUG",e.netlifyAccountSlug??""),o("Search APIs"),n("GOOGLE_PLACES_API_KEY",e.googlePlacesApiKey),o("Telegram notifications (optional)"),n("TELEGRAM_BOT_TOKEN",e.telegramBotToken),n("TELEGRAM_CHAT_ID",e.telegramChatId),t.join(`
|
|
6
6
|
`)+`
|
|
7
7
|
`}function be(e){let t={mcpServers:{supabase:{command:"npx",args:["-y","@supabase/mcp-server-supabase@latest",`--project-ref=${e.supabaseProjectRef}`],env:{SUPABASE_ACCESS_TOKEN:e.supabasePat,NODE_OPTIONS:"--use-system-ca"}}}};return JSON.stringify(t,null,2)+`
|
|
@@ -12,15 +12,15 @@ Please share that file so we can trace what happened.`);return n}var Ge="claude-
|
|
|
12
12
|
`)+`
|
|
13
13
|
`}function Cn(e){return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1).replace(/\\\\/g,"\\").replace(/\\"/g,'"').replace(/\\\$/g,"$").replace(/\\`/g,"`"):e.length>=2&&e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function U(e){let t={};for(let o of e.split(`
|
|
14
14
|
`)){let n=o.trim();if(!n||n.startsWith("#"))continue;let a=n.indexOf("=");if(a===-1)continue;let i=n.slice(0,a).trim(),l=Cn(n.slice(a+1).trim());t[i]=l}return t}function gt(e){let t=c=>{let p=e[c];if(!p)return;let m=parseInt(p,10);return isNaN(m)?void 0:m},o=e.SMS_PROVIDER,n=c=>c==="email"||c==="sms"||c==="whatsapp",a=e.OUTREACH_CHANNELS?.split(",").map(c=>c.trim()).filter(n),i=e.OUTREACH_PRIORITY?.split(",").map(c=>c.trim()).filter(n),l=e.WHATSAPP_ACCOUNTS?.split(",").map(c=>c.trim()).filter(c=>c.length>0);return{licenseKey:e.KLAUDIUS_LICENSE_KEY,aiAgent:pt(e.AI_AGENT)??Ge,country:e.OPERATOR_COUNTRY||void 0,countryCode:e.OPERATOR_COUNTRY_CODE||void 0,language:e.OPERATOR_LANGUAGE||void 0,languageCode:e.OPERATOR_LANGUAGE_CODE||void 0,pricing:e.PRICING,pricingTerms:e.PRICING_TERMS,pricingMonthly:e.PRICING_MONTHLY||void 0,outreachEnabled:e.OUTREACH_ENABLED?e.OUTREACH_ENABLED.toLowerCase()==="true":void 0,name:e.OPERATOR_NAME,signature:e.SIGNATURE,outreachChannels:a&&a.length>0?a:void 0,outreachPriority:i&&i.length>0?i:void 0,whatsappAccounts:l&&l.length>0?l:void 0,emailProvider:Ee(e),emailAddress:e.EMAIL_ADDRESS,emailFromName:e.EMAIL_FROM_NAME,emailSmtpHost:e.EMAIL_SMTP_HOST,emailSmtpPort:t("EMAIL_SMTP_PORT"),emailImapHost:e.EMAIL_IMAP_HOST,emailImapPort:t("EMAIL_IMAP_PORT"),emailSentFolder:e.EMAIL_SENT_FOLDER,emailInboxFolder:e.EMAIL_INBOX_FOLDER,smsProvider:o==="imessage"||o==="twilio"?o:void 0,testPhone:e.TEST_PHONE,twilioAccountSid:e.TWILIO_ACCOUNT_SID,twilioPhoneNumber:e.TWILIO_PHONE_NUMBER,twilioAuthToken:e.TWILIO_AUTH_TOKEN,supabaseUrl:e.SUPABASE_URL,supabaseProjectRef:e.SUPABASE_PROJECT_REF,supabaseServiceKey:e.SUPABASE_SERVICE_KEY,supabasePat:e.SUPABASE_PAT,deployProvider:ft(e.DEPLOY_PROVIDER)??Ve,vercelToken:e.VERCEL_TOKEN,vercelScope:e.VERCEL_SCOPE||void 0,cloudflareApiToken:e.CLOUDFLARE_API_TOKEN||void 0,cloudflareAccountId:e.CLOUDFLARE_ACCOUNT_ID||void 0,netlifyAuthToken:e.NETLIFY_AUTH_TOKEN||void 0,netlifyAccountSlug:e.NETLIFY_ACCOUNT_SLUG||void 0,googlePlacesApiKey:e.GOOGLE_PLACES_API_KEY,emailPassword:e.EMAIL_PASSWORD,telegramBotToken:e.TELEGRAM_BOT_TOKEN,telegramChatId:e.TELEGRAM_CHAT_ID}}function Be(e){let t=P=>{let $=e[P];if(!$)return;let k=parseInt($,10);return isNaN(k)?void 0:k},o=e.SUPABASE_URL,n=e.SUPABASE_SERVICE_KEY?.replace(/\s+/g,""),a=e.SUPABASE_PAT?.replace(/\s+/g,""),i=e.SUPABASE_PROJECT_REF,l=e.PRICING,c=e.PRICING_TERMS||"one-off, no monthly fees",p=ft(e.DEPLOY_PROVIDER)??Ve,m=e.VERCEL_TOKEN,r=e.CLOUDFLARE_API_TOKEN,w=e.CLOUDFLARE_ACCOUNT_ID,g=e.NETLIFY_AUTH_TOKEN;if(!l||!o||!n||!a||!i||!(p==="cloudflare"?!!r&&!!w:p==="netlify"?!!g:!!m))return null;let v=e.SMS_PROVIDER,oe=P=>P==="email"||P==="sms"||P==="whatsapp",M=e.OUTREACH_CHANNELS?.split(",").map(P=>P.trim()).filter(oe),Y=e.OUTREACH_PRIORITY?.split(",").map(P=>P.trim()).filter(oe),b=e.WHATSAPP_ACCOUNTS?.split(",").map(P=>P.trim()).filter(P=>P.length>0);return{licenseKey:e.KLAUDIUS_LICENSE_KEY,aiAgent:pt(e.AI_AGENT)??Ge,country:e.OPERATOR_COUNTRY||void 0,countryCode:e.OPERATOR_COUNTRY_CODE||void 0,language:e.OPERATOR_LANGUAGE||void 0,languageCode:e.OPERATOR_LANGUAGE_CODE||void 0,pricing:l,pricingTerms:c,pricingMonthly:e.PRICING_MONTHLY||void 0,outreachEnabled:e.OUTREACH_ENABLED?.toLowerCase()==="true",name:e.OPERATOR_NAME,signature:e.SIGNATURE,outreachChannels:M&&M.length>0?M:void 0,outreachPriority:Y&&Y.length>0?Y:void 0,whatsappAccounts:b&&b.length>0?b:void 0,emailProvider:Ee(e),emailAddress:e.EMAIL_ADDRESS,emailPassword:e.EMAIL_PASSWORD,emailFromName:e.EMAIL_FROM_NAME,emailSmtpHost:e.EMAIL_SMTP_HOST,emailSmtpPort:t("EMAIL_SMTP_PORT"),emailImapHost:e.EMAIL_IMAP_HOST,emailImapPort:t("EMAIL_IMAP_PORT"),emailSentFolder:e.EMAIL_SENT_FOLDER,emailInboxFolder:e.EMAIL_INBOX_FOLDER,smsProvider:v==="imessage"||v==="twilio"?v:void 0,testPhone:e.TEST_PHONE,twilioAccountSid:e.TWILIO_ACCOUNT_SID,twilioAuthToken:e.TWILIO_AUTH_TOKEN,twilioPhoneNumber:e.TWILIO_PHONE_NUMBER,deployProvider:p,vercelToken:m,vercelScope:e.VERCEL_SCOPE||void 0,cloudflareApiToken:r||void 0,cloudflareAccountId:w||void 0,netlifyAuthToken:g||void 0,netlifyAccountSlug:e.NETLIFY_ACCOUNT_SLUG||void 0,supabaseUrl:o,supabaseServiceKey:n,supabasePat:a,supabaseProjectRef:i,googlePlacesApiKey:e.GOOGLE_PLACES_API_KEY,telegramBotToken:e.TELEGRAM_BOT_TOKEN,telegramChatId:e.TELEGRAM_CHAT_ID}}import{copyFile as Is,mkdir as Cs,readdir as Dn,stat as Rs}from"fs/promises";import{dirname as xs,join as Et,relative as Un}from"path";import{fileURLToPath as $s}from"url";import{createHash as Rn}from"crypto";import{readFile as vn}from"fs/promises";async function ae(e){let t=await vn(e);return Rn("sha256").update(t).digest("hex")}import{mkdir as xn,readFile as On,writeFile as $n,access as Nn}from"fs/promises";import{dirname as Ln,join as yt}from"path";var Mn=".klaudius",kt=`${Mn}/manifest.json`,_e=new Set([".env",".mcp.json",".claude/settings.json",".codex/config.toml"]);async function wt(e){let t=yt(e,kt);try{await Nn(t)}catch{return null}let o=await On(t,"utf-8");return JSON.parse(o)}async function Se(e,t){let o=yt(e,kt);await xn(Ln(o),{recursive:!0}),await $n(o,JSON.stringify(t,null,2)+`
|
|
15
|
-
`,"utf-8")}function At(e,t){let o=new Date().toISOString();return{version:1,templateVersion:e,installedAt:o,updatedAt:o,files:t}}async function Ie(e,t=e){let o=await Dn(e,{withFileTypes:!0}),n=[];for(let a of o){let i=Et(e,a.name);a.isDirectory()?n.push(...await Ie(i,t)):a.isFile()&&n.push(Un(t,i))}return n}async function Pt(e){let t=await Ie(e),o={};for(let n of t)_e.has(n)||(o[n]=await ae(Et(e,n)));return o}import{copyFile as jn,mkdir as bt,mkdtemp as Hn,readdir as Tt,rm as _t}from"fs/promises";import{tmpdir as Kn}from"os";import{dirname as Fn,join as Ce}from"path";import{Readable as Gn}from"stream";import*as St from"tar";var Vn="https://klaudius.dev/api/template";function Bn(e){return Gn.fromWeb(e)}async function Re(e){let t=process.env.KLAUDIUS_TEMPLATE_URL??Vn,o="0.19.
|
|
16
|
-
`+X.bold(X.cyan(e))),detail:e=>console.log(X.dim(" "+e))};var Wn="https://registry.npmjs.org/klaudius/latest";async function Yn(e=1500){let t=new AbortController,o=setTimeout(()=>t.abort(),e);try{let n=await fetch(Wn,{signal:t.signal,headers:{accept:"application/json"}});if(!n.ok)return null;let a=await n.json();return typeof a.version=="string"?a.version:null}catch{return null}finally{clearTimeout(o)}}function zn(e,t){let o=i=>i.split("-")[0].split(".").map(l=>Number.parseInt(l,10)),n=o(e),a=o(t);if(n.length<3||a.length<3)return!1;for(let i=0;i<3;i++){if(Number.isNaN(n[i])||Number.isNaN(a[i]))return!1;if(n[i]>a[i])return!0;if(n[i]<a[i])return!1}return!1}async function ve(e,t){if(t==="dev"||process.env.CI||process.env.NO_UPDATE_NOTIFIER)return;let o=await Yn();!o||!zn(o,t)||(s.blank(),s.warn(`A newer Klaudius CLI is available: you have ${t}, latest is ${o}.`),e==="update"&&(s.detail("Your project content is fetched fresh either way, so you're not missing any"),s.detail("pipeline updates. But the CLI itself, including its update logic, is behind.")),s.detail(`Re-run with \`npx klaudius@latest ${e}\` to use the latest CLI.`),s.blank())}import{createHash as qn}from"crypto";import{hostname as It,userInfo as Jn,platform as Ct,arch as Rt}from"os";var Xn="https://klaudius.dev",Qn="/api/licenses/validate",Zn="0.19.
|
|
15
|
+
`,"utf-8")}function At(e,t){let o=new Date().toISOString();return{version:1,templateVersion:e,installedAt:o,updatedAt:o,files:t}}async function Ie(e,t=e){let o=await Dn(e,{withFileTypes:!0}),n=[];for(let a of o){let i=Et(e,a.name);a.isDirectory()?n.push(...await Ie(i,t)):a.isFile()&&n.push(Un(t,i))}return n}async function Pt(e){let t=await Ie(e),o={};for(let n of t)_e.has(n)||(o[n]=await ae(Et(e,n)));return o}import{copyFile as jn,mkdir as bt,mkdtemp as Hn,readdir as Tt,rm as _t}from"fs/promises";import{tmpdir as Kn}from"os";import{dirname as Fn,join as Ce}from"path";import{Readable as Gn}from"stream";import*as St from"tar";var Vn="https://klaudius.dev/api/template";function Bn(e){return Gn.fromWeb(e)}async function Re(e){let t=process.env.KLAUDIUS_TEMPLATE_URL??Vn,o="0.19.1",n;try{n=await fetch(t,{method:"POST",headers:{Authorization:`Bearer ${e.licenseKey}`,"Content-Type":"application/json"},body:JSON.stringify({machine_id:e.machineId,hostname:e.hostname,os:e.os,cli_version:o,...e.agent==="codex"?{agent:"codex"}:{}})})}catch(c){throw new Error(`Could not reach klaudius.dev to download the template: ${T(c)}`)}if(!n.ok){let c="";try{let p=await n.json();c=p.reason?` (${p.reason})`:""}catch{}throw new Error(`Template download failed: HTTP ${n.status}${c}`)}if(!n.body)throw new Error("Template download succeeded but response had no body");let a=n.headers.get("x-klaudius-tier"),i=await Hn(Ce(Kn(),"klaudius-template-")),l=0;try{try{await new Promise((m,r)=>{let w=St.extract({cwd:i,strict:!0});w.on("finish",m),w.on("error",r),Bn(n.body).on("error",r).pipe(w)})}catch(m){throw new Error(`Failed to extract template archive: ${m.message}`)}await bt(e.destDir,{recursive:!0});let c=new Set(await Tt(e.destDir)),p=await Ie(i);try{for(let m of p){let r=Ce(e.destDir,m);await bt(Fn(r),{recursive:!0}),await jn(Ce(i,m),r),l++}}catch(m){let r=await Tt(e.destDir).catch(()=>[]);for(let w of r)c.has(w)||await _t(Ce(e.destDir,w),{recursive:!0,force:!0}).catch(()=>{});throw new Error(`Downloaded the template but couldn't copy it into ${e.destDir}: ${m.message}`)}}finally{await _t(i,{recursive:!0,force:!0}).catch(()=>{})}return{filesExtracted:l,tier:a}}import X from"picocolors";var s={info:e=>console.log(X.cyan("\u2139"),e),success:e=>console.log(X.green("\u2713"),e),warn:e=>console.log(X.yellow("\u26A0"),e),error:e=>console.error(X.red("\u2717"),e),step:e=>console.log(X.dim("\u2192"),e),blank:()=>console.log(""),heading:e=>console.log(`
|
|
16
|
+
`+X.bold(X.cyan(e))),detail:e=>console.log(X.dim(" "+e))};var Wn="https://registry.npmjs.org/klaudius/latest";async function Yn(e=1500){let t=new AbortController,o=setTimeout(()=>t.abort(),e);try{let n=await fetch(Wn,{signal:t.signal,headers:{accept:"application/json"}});if(!n.ok)return null;let a=await n.json();return typeof a.version=="string"?a.version:null}catch{return null}finally{clearTimeout(o)}}function zn(e,t){let o=i=>i.split("-")[0].split(".").map(l=>Number.parseInt(l,10)),n=o(e),a=o(t);if(n.length<3||a.length<3)return!1;for(let i=0;i<3;i++){if(Number.isNaN(n[i])||Number.isNaN(a[i]))return!1;if(n[i]>a[i])return!0;if(n[i]<a[i])return!1}return!1}async function ve(e,t){if(t==="dev"||process.env.CI||process.env.NO_UPDATE_NOTIFIER)return;let o=await Yn();!o||!zn(o,t)||(s.blank(),s.warn(`A newer Klaudius CLI is available: you have ${t}, latest is ${o}.`),e==="update"&&(s.detail("Your project content is fetched fresh either way, so you're not missing any"),s.detail("pipeline updates. But the CLI itself, including its update logic, is behind.")),s.detail(`Re-run with \`npx klaudius@latest ${e}\` to use the latest CLI.`),s.blank())}import{createHash as qn}from"crypto";import{hostname as It,userInfo as Jn,platform as Ct,arch as Rt}from"os";var Xn="https://klaudius.dev",Qn="/api/licenses/validate",Zn="0.19.1";async function vt(e){if(!e||e.trim().length===0)return{ok:!1,reason:"No license key provided. Pass one via --license <key> or paste it when prompted."};let t=e.trim(),n=(process.env.KLAUDIUS_API_URL??Xn).replace(/\/$/,"")+Qn,a=ge(),i;try{i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({license_key:t,machine_id:a,hostname:It(),os:`${Ct()}-${Rt()}`,cli_version:Zn})})}catch(c){return{ok:!1,reason:`Could not reach the Klaudius license server (${T(c)}). Check your internet connection or try again later.`}}let l;try{l=await i.json()}catch{return{ok:!1,reason:`License server returned an unparseable response (HTTP ${i.status}).`}}return l.ok?{ok:!0,tier:l.tier??"core"}:{ok:!1,reason:l.reason??`License rejected (HTTP ${i.status}).`}}function ge(){let e=[It(),Jn().username,Ct(),Rt()].join("|");return qn("sha256").update(e).digest("hex").slice(0,32)}import{readFile as eo}from"fs/promises";import{join as to}from"path";async function re(e){let t=e.serviceKey.replace(/\s+/g,"");try{let o=await fetch(e.url+"/rest/v1/",{headers:{apikey:t,Authorization:`Bearer ${t}`}});return o.status===401||o.status===403?{ok:!1,message:`Supabase rejected auth (HTTP ${o.status}). Check SUPABASE_SERVICE_KEY.`}:{ok:!0}}catch(o){return{ok:!1,message:`Could not reach Supabase: ${T(o)}`}}}async function xt(e){let t;try{t=await eo(to(e.projectRoot,"scripts","schema.sql"),"utf-8")}catch(n){return{ok:!1,message:`Could not read scripts/schema.sql: ${n.message}`}}let o=e.pat.replace(/\s+/g,"");try{let n=await fetch(`https://api.supabase.com/v1/projects/${e.projectRef}/database/query`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({query:t})});if(n.ok)return{ok:!0};let a=await n.text();return a.includes("already exists")||a.includes('relation "clients" already exists')||a.includes("duplicate")?(s.detail("Schema appears already applied (tables exist). Skipping."),{ok:!0}):{ok:!1,message:`Supabase Management API rejected schema (HTTP ${n.status}): ${a.slice(0,300)}`}}catch(n){return{ok:!1,message:`Schema apply failed: ${n.message}`}}}async function xe(e){try{let t=await fetch("https://api.vercel.com/v2/user",{headers:{Authorization:`Bearer ${e}`}});if(t.status===401||t.status===403)return{ok:!1,message:`Vercel rejected the token (HTTP ${t.status}). The token is invalid, expired, or has been revoked.`};if(!t.ok)return{ok:!1,message:`Vercel API returned HTTP ${t.status}. Try again or check status.vercel.com.`};let o=await t.json();return{ok:!0,username:o.user?.username??o.user?.email}}catch(t){return{ok:!1,message:`Could not reach Vercel: ${T(t)}`}}}var Ot="https://api.cloudflare.com/client/v4";function $t(e){let t=e?.errors?.[0];if(t)return t.message?`${t.message}${t.code?` (code ${t.code})`:""}`:void 0}async function Oe(e){let{token:t,accountId:o}=e,n={Authorization:`Bearer ${t}`,"Content-Type":"application/json"};try{let a=await fetch(`${Ot}/user/tokens/verify`,{headers:n});if(a.status===401||a.status===403)return{ok:!1,message:`Cloudflare rejected the token (HTTP ${a.status}). The token is invalid, expired, or has been revoked. Create a fresh one at https://dash.cloudflare.com/profile/api-tokens.`};if(!a.ok)return{ok:!1,message:`Cloudflare API returned HTTP ${a.status} verifying the token. Try again or check cloudflarestatus.com.`};let i=await a.json(),l=i.result?.status;if(i.success===!1||l&&l!=="active")return{ok:!1,message:`Cloudflare reports the token is not active${l?` (status: ${l})`:""}. ${$t(i)??"Create a fresh token at https://dash.cloudflare.com/profile/api-tokens."}`}}catch(a){return{ok:!1,message:`Could not reach Cloudflare: ${T(a)}`}}try{let a=await fetch(`${Ot}/accounts/${encodeURIComponent(o)}/pages/projects`,{headers:n});if(a.status===403)return{ok:!1,message:`The token is valid but can't manage Pages in account ${o} (HTTP 403). Most likely the token is missing the "Account \u2192 Cloudflare Pages \u2192 Edit" permission, or the Account ID belongs to a different account than the token. Re-create the token with that exact permission and your account selected under "Account Resources".`};if(a.status===404)return{ok:!1,message:`Account ${o} was not found (HTTP 404). Double-check the Account ID \u2014 it's the 32-character hex string in the dashboard URL (dash.cloudflare.com/<ID>).`};if(!a.ok)return{ok:!1,message:`Cloudflare API returned HTTP ${a.status} listing Pages projects. Try again or check cloudflarestatus.com.`};let i=await a.json();return i.success===!1?{ok:!1,message:$t(i)??"Cloudflare rejected the Pages project listing request."}:{ok:!0,projectCount:Array.isArray(i.result)?i.result.length:void 0}}catch(a){return{ok:!1,message:`Could not reach Cloudflare: ${T(a)}`}}}var Nt="https://api.netlify.com/api/v1";async function $e(e){let{token:t}=e,o={Authorization:`Bearer ${t}`};try{let n=await fetch(`${Nt}/user`,{headers:o});if(n.status===401||n.status===403)return{ok:!1,message:`Netlify rejected the token (HTTP ${n.status}). The token is invalid, expired, or has been revoked. Create a fresh one at https://app.netlify.com/user/applications#personal-access-tokens.`};if(!n.ok)return{ok:!1,message:`Netlify API returned HTTP ${n.status} verifying the token. Try again or check netlifystatus.com.`}}catch(n){return{ok:!1,message:`Could not reach Netlify: ${T(n)}`}}try{let n=await fetch(`${Nt}/accounts`,{headers:o});if(!n.ok)return{ok:!1,message:`Netlify API returned HTTP ${n.status} listing your teams. Try again or check netlifystatus.com.`};let a=await n.json(),i=Array.isArray(a)?a:[];if(i.length===0)return{ok:!1,message:"The token is valid but isn't a member of any Netlify team. Klaudius creates each client's site under a team, so it needs at least one. Open https://app.netlify.com and confirm your account has a team."};let l=typeof i[0]?.slug=="string"?i[0].slug:void 0;return{ok:!0,accountCount:i.length,accountSlug:l}}catch(n){return{ok:!1,message:`Could not reach Netlify: ${T(n)}`}}}async function le(e){let t=rt(e);if(t)return{ok:!1,message:t};let o=q(e),n=o.value,a=i=>{let l=[i],c=lt(e);return c&&l.push(c),o.repairs.length>0&&l.push(`Note: we corrected ${o.repairs.length} look-alike character(s) in this key before sending it (${o.repairs.join("; ")}). Some look-alikes are ambiguous, so if the key is otherwise correct, re-copy it with the copy button in the Cloud Console rather than retyping it.`),l.join(`
|
|
17
17
|
`)};try{let i=await fetch("https://places.googleapis.com/v1/places:searchText",{method:"POST",headers:{"Content-Type":"application/json","X-Goog-Api-Key":n,"X-Goog-FieldMask":"places.id"},body:JSON.stringify({textQuery:"x"})});if(i.ok)return{ok:!0};if(i.status===429)return{ok:!0};let l={};try{l=await i.json()}catch{}let c=l.error?.message??"",p=l.error?.status??"";return i.status===400&&(p==="PERMISSION_DENIED"||/Places API \(New\) has not been enabled|API_KEY_SERVICE_BLOCKED/i.test(c))?{ok:!1,message:"Key is valid, but Places API (New) is not enabled on its Cloud project. Open https://console.cloud.google.com/apis/library and enable 'Places API (New)' for the project this key belongs to, then try again."}:i.status===401||i.status===403?{ok:!1,message:a(c||`Google rejected the key (HTTP ${i.status}). Common causes: invalid key, billing not enabled on the Cloud project, or API key restrictions blocking this caller.`)}:{ok:!1,message:a(`Google API returned HTTP ${i.status}${c?`: ${c}`:""}.`)}}catch(i){return{ok:!1,message:`Could not reach Google: ${T(i)}`}}}import no from"nodemailer";import{ImapFlow as oo}from"imapflow";function Lt(e){let t=e;if(t?.authenticationFailed)return"auth";let o=typeof t?.code=="string"?t.code.toUpperCase():"";if(o==="EAUTH")return"auth";if(["ETIMEDOUT","ESOCKET","ECONNECTION","EDNS","ECONNREFUSED","ENOTFOUND","EHOSTUNREACH","ECONNRESET"].includes(o))return"network";let n=(typeof t?.message=="string"?t.message:String(e)).toLowerCase();return n.includes("invalid credentials")||n.includes("authentication failed")||n.includes("auth failed")||n.includes("login failed")||n.includes("invalid login")?"auth":n.includes("etimedout")||n.includes("timeout")||n.includes("enotfound")||n.includes("getaddrinfo")||n.includes("econnrefused")||n.includes("econnreset")?"network":"other"}async function ce(e){let t=no.createTransport({host:e.emailSmtpHost,port:e.emailSmtpPort,secure:e.emailSmtpPort===465,auth:{user:e.emailAddress,pass:e.emailPassword},connectionTimeout:1e4,greetingTimeout:5e3,socketTimeout:1e4});try{await t.verify()}catch(n){return{ok:!1,failedAt:"smtp",message:Mt(n,"SMTP"),failureKind:Lt(n)}}finally{t.close()}let o=new oo({host:e.emailImapHost,port:e.emailImapPort,secure:e.emailImapPort===993,auth:{user:e.emailAddress,pass:e.emailPassword},logger:!1,connectionTimeout:1e4,greetingTimeout:5e3,socketTimeout:1e4});try{await o.connect(),await o.logout()}catch(n){try{await o.logout()}catch{}return{ok:!1,failedAt:"imap",message:Mt(n,"IMAP"),failureKind:Lt(n)}}return{ok:!0}}function Mt(e,t){let o=e instanceof Error?e.message:String(e),n=o.toLowerCase();return n.includes("invalid credentials")||n.includes("authentication failed")||n.includes("auth failed")||n.includes("login failed")?`${t} rejected the credentials. Most common causes:
|
|
18
18
|
\u2022 The app password is wrong, expired, or for a different provider.
|
|
19
19
|
\u2022 The email address doesn't match the account that issued the password.
|
|
20
20
|
\u2022 2FA is required but no app-specific password was generated.`:n.includes("etimedout")||n.includes("timeout")?`${t} server didn't respond in time. Check the host/port, or your network.`:n.includes("enotfound")||n.includes("getaddrinfo")?`${t} host could not be resolved. Check the host setting.`:`${t} check failed: ${o}`}async function Dt(e){if(!e.accountSid||!e.authToken)return{ok:!1,message:"Missing Twilio Account SID or Auth Token."};let t=`https://api.twilio.com/2010-04-01/Accounts/${encodeURIComponent(e.accountSid)}.json`,o=Buffer.from(`${e.accountSid}:${e.authToken}`).toString("base64");try{let n=await fetch(t,{headers:{Authorization:`Basic ${o}`}});if(n.status===401)return{ok:!1,message:"Twilio rejected the credentials (401). Check the Account SID and Auth Token from https://console.twilio.com/ \u2014 the Auth Token shown there is the value to paste."};if(!n.ok)return{ok:!1,message:`Twilio API returned HTTP ${n.status}. Try again or check status.twilio.com.`};let a=await n.json();return a.status&&a.status!=="active"?{ok:!1,message:`Twilio account is in '${a.status}' state. Check the console for any holds before sending SMS.`}:{ok:!0,friendlyName:a.friendly_name}}catch(n){return{ok:!1,message:`Could not reach Twilio: ${T(n)}`}}}import{spawn as so}from"child_process";async function Ut(e){if(process.platform!=="darwin")return{ok:!1,message:"iMessage send is only supported on macOS. To run init from a non-Mac, switch the SMS provider to Twilio in the wizard."};let o=`tell application "Messages" to send "Klaudius connected (setup ping; ignore)." to buddy "${e.testPhone.replace(/"/g,"")}"`,n=await io(o);if(n.code===0)return{ok:!0};let a=n.stderr.toLowerCase();return a.includes("can't get application")||a.includes("isn't running")||a.includes("can't make some data")?{ok:!1,message:"Messages.app didn't respond. Open Messages on your Mac and sign in with your Apple ID, then retry."}:a.includes("(-1728)")||a.includes("not found")||a.includes("buddy")?{ok:!1,message:`Couldn't reach ${e.testPhone}. Either the number format is wrong (use the international format with a leading +) or this Mac doesn't have a path to that number. If TEST_PHONE is a non-Apple phone (Android), you need an iPhone signed into the same Apple ID with Settings \u2192 Messages \u2192 Text Message Forwarding turned ON for this Mac.`}:a.includes("(-1719)")||a.includes("(-25006)")?{ok:!1,message:"Messages.app refused the send \u2014 usually means iMessage isn't configured on this Mac. Open Messages \u2192 Settings \u2192 iMessage and sign in with your Apple ID."}:{ok:!1,message:`osascript error: ${n.stderr.trim()||`exit code ${n.code}`}`}}function io(e){return new Promise(t=>{let o=so("osascript",["-e",e],{stdio:["ignore","ignore","pipe"]}),n="";o.stderr.on("data",a=>{n+=a.toString()}),o.on("close",a=>t({code:a??1,stderr:n})),o.on("error",a=>t({code:1,stderr:a.message}))})}import{spawn as Ye}from"child_process";function ao(){let e=process.env.NODE_OPTIONS?.trim(),t=e?`${e} --use-system-ca`:"--use-system-ca";return{...process.env,NODE_OPTIONS:t}}var de=2,jt=2e3,ro=[/ECONNRESET/,/ETIMEDOUT/,/ENOTFOUND/,/EAI_AGAIN/,/socket hang up/i,/Connection reset/i,/network timeout/i,/could not resolve host/i];function Ht(e,t){let o=e+`
|
|
21
21
|
`+t;return ro.some(n=>n.test(o))}function Kt(e){return new Promise(t=>setTimeout(t,e))}function lo(e,t,o){return new Promise(n=>{let a=o.shell?Ye([e,...t].join(" "),{cwd:o.cwd,stdio:["ignore","pipe","pipe"],shell:!0,env:o.env??process.env}):Ye(e,t,{cwd:o.cwd,stdio:["ignore","pipe","pipe"],shell:!1,env:o.env??process.env}),i="",l="";a.stdout?.on("data",c=>{let p=c.toString();i+=p,process.stdout.write(p)}),a.stderr?.on("data",c=>{let p=c.toString();l+=p,process.stderr.write(p)}),a.on("close",c=>n({code:c??1,stdout:i,stderr:l})),a.on("error",c=>n({code:1,stdout:i,stderr:l+c.message}))})}async function We(e,t,o){let n={code:0,stdout:"",stderr:""};for(let a=0;a<=de;a++){if(n=await lo(e,t,{cwd:o.cwd,env:o.env,shell:o.shell}),n.code===0||!Ht(n.stderr,n.stdout))return n;a<de&&(s.detail(`${o.label} failed with a transient network error \u2014 retrying (${a+2}/${de+1})\u2026`),await Kt(jt))}return n}function co(e,t,o){return new Promise(n=>{let a=Ye(e,t,{cwd:o.cwd,stdio:["ignore","pipe","pipe"],shell:!1}),i="",l="";a.stdout?.on("data",c=>{i+=c.toString()}),a.stderr?.on("data",c=>{l+=c.toString()}),a.on("close",c=>n({code:c??1,stdout:i,stderr:l})),a.on("error",c=>n({code:1,stdout:i,stderr:l+c.message}))})}var uo=[{pattern:/UNABLE_TO_VERIFY_LEAF_SIGNATURE|unable to verify the first certificate/i,hint:"TLS-handshake error \u2014 your machine appears to be intercepting HTTPS (antivirus, corporate proxy, or VPN re-signing traffic with its own root CA). We work around this with NODE_OPTIONS=--use-system-ca, which needs Node 22.15+. Run `node --version` to verify, upgrade if older, then re-run setup."},{pattern:/Microsoft Visual C\+\+ 14\.0 or greater is required/i,hint:"Python tried to compile a package from source and couldn't find the Microsoft C++ Build Tools. The latest Klaudius pins supabase<2.26 to skip the offending dependency entirely. Re-run with `npx klaudius@latest init` (pulls the latest) \u2014 that should bypass the source build."}];function po(e){let t=`${e.stderr??""}
|
|
22
22
|
${e.stdout??""}`;return uo.find(n=>n.pattern.test(t))?.hint}async function fo(e){let t=["supabase<2.26","python-dotenv","requests","httpx","Pillow","truststore"],o=["-m","pip","install","--quiet","--user","--prefer-binary"],a=(await he())?.command??["python3"],i=async c=>{let p={code:0,stdout:"",stderr:""};for(let m=0;m<=de;m++){if(p=await co(a[0],[...a.slice(1),...c],{cwd:e}),p.code===0||!Ht(p.stderr,p.stdout))return p;m<de&&(s.detail(`pip install hit a transient network error \u2014 retrying (${m+2}/${de+1})\u2026`),await Kt(jt))}return p},l=await i([...o,"--break-system-packages",...t]);return l.code!==0&&/no such option:.*break-system-packages/i.test(l.stderr)&&(s.detail("Older pip detected; retrying without --break-system-packages"),l=await i([...o,...t])),l.code!==0&&(l.stderr.trim()&&process.stderr.write(l.stderr),l.stdout.trim()&&process.stdout.write(l.stdout)),l}async function Ne(e){let t={npm:"skipped",pip:"skipped",playwright:"skipped",patchright:"skipped"},o=ao(),n=process.platform==="win32",a=(m,r)=>{let w=po(r);w&&((t.hints??={})[m]=w)};s.step("Running npm install (Next.js, Playwright JS, etc.)...");let i=await We("npm",["install"],{cwd:e,label:"npm install",env:o,shell:n});t.npm=i.code===0?"ok":"failed",i.code!==0&&a("npm",i),s.step("Installing Python packages (supabase, dotenv, requests, httpx, Pillow)...");let l=await fo(e);t.pip=l.code===0?"ok":"failed",l.code!==0&&a("pip",l),s.step("Installing Playwright browser (chromium ~200MB; one-time)...");let c=await We("npx",["playwright","install","chromium"],{cwd:e,label:"playwright install",env:o,shell:n});t.playwright=c.code===0?"ok":"failed",c.code!==0&&a("playwright",c),s.step("Installing Patchright browser (chromium ~200MB; one-time)...");let p=await We("npx",["patchright","install","chromium"],{cwd:e,label:"patchright install",env:o,shell:n});return t.patchright=p.code===0?"ok":"failed",p.code!==0&&a("patchright",p),t}import{mkdir as mo,readFile as ho,writeFile as go}from"fs/promises";import{join as Ft}from"path";async function Le(e,t){let o=Ft(e,".claude");await mo(o,{recursive:!0});let n=Ft(o,"settings.json"),a={};try{let p=await ho(n,"utf-8"),m=JSON.parse(p);m&&typeof m=="object"&&!Array.isArray(m)&&(a=m)}catch{}let i=a.enabledMcpjsonServers,l=Array.isArray(i)?i.filter(p=>typeof p=="string"):[];l.includes(t)||l.push(t);let c={...a,enabledMcpjsonServers:l};await go(n,JSON.stringify(c,null,2)+`
|
|
23
|
-
`,"utf-8")}var Vt="0.19.
|
|
23
|
+
`,"utf-8")}var Vt="0.19.1",C=5;function ne(e){return`npx klaudius@latest init ${Me(ue(e))}`}function ue(e){if(process.platform==="win32")return e;let t=yo();return e===t?"~":e.startsWith(t+"/")?`~/${e.slice(t.length+1)}`:e}async function Eo(e){let t=[];try{let n=(await Wt(e,{withFileTypes:!0})).filter(a=>a.isDirectory()&&!a.name.startsWith(".")).slice(0,200);for(let a of n){let i=H(e,a.name);if(!await Bt(H(i,".env")))continue;let l=await Bt(H(i,".klaudius","manifest.json"));if(t.push({path:i,finished:l}),t.length>=3)break}}catch{}return t}async function Bt(e){try{return await Je(e),!0}catch{return!1}}function Me(e){return/\s/.test(e)?`"${e}"`:e}function te(e,t,o){s.blank(),s.error(`${t} validation failed ${C} times in a row. Pausing setup so you don't get stuck in a loop.`),s.detail(`Last error: ${o}`),s.blank(),s.detail("Your credentials are saved in `.env`. Two ways forward:"),s.detail(" \u2022 Fix the value, then re-run setup and pick Resume \u2014 it keeps everything else you've entered:"),s.blank(),console.log(` ${d.cyan(ne(e))}`),s.blank(),s.detail(` (Your .env is at ${ue(H(e,".env"))} \u2014 open it in any text editor.)`),s.detail(" \u2022 Or email hello@klaudius.dev with the error above and we'll dig in."),s.blank(),process.exit(1)}async function zt(e){let t=e.target??".",o=wo(t)?t:ko(process.cwd(),t),n=_o(o);n&&(s.error("Klaudius can't be installed inside a protected system folder."),s.detail(`Path: ${o}`),s.detail(`Reason: ${n}`),s.blank(),s.detail("Pick a normal user folder instead \u2014 Documents and Desktop are the safe defaults."),s.blank(),process.platform==="win32"?(s.detail("For example, open a fresh PowerShell window (not 'Run as Administrator') and run:"),console.log(` ${d.cyan("cd $HOME\\Documents")}`),console.log(` ${d.cyan("npx klaudius@latest init my-agency")}`)):(s.detail("For example:"),console.log(` ${d.cyan("cd ~/Documents")}`),console.log(` ${d.cyan("npx klaudius@latest init my-agency")}`)),s.blank(),process.exit(1)),process.platform==="win32"&&So()&&(s.warn("You appear to be running in an elevated (Administrator) PowerShell."),s.detail("This isn't fatal, but Python paths and Playwright's browser cache will land in a different location than a normal user shell, which often causes installs to fail or run-time scripts to break. Easiest fix: close this window, open a new regular PowerShell (NOT 'Run as Administrator'), then re-run npx klaudius@latest init."),s.blank()),await ve("init",Vt);let a=await Po(o);if(a.kind==="scaffolded"){s.blank(),s.warn(`Found an existing Klaudius project at ${d.bold(o)}.`),s.detail("(Your .env and project files are in place.)"),s.blank(),a.nodeModulesMissing?(s.detail("It looks like a previous setup didn't finish installing dependencies."),s.detail("To pick up where it left off, run:"),s.blank(),o!==process.cwd()&&console.log(` ${d.cyan(`cd ${Me(t)}`)}`),console.log(` ${d.cyan("npx klaudius@latest install")} ${d.dim("# retries npm + pip + browsers; idempotent")}`),s.blank(),s.detail("Then verify with:"),s.blank(),console.log(` ${d.cyan("npx klaudius@latest doctor")} ${d.dim("# checks Node / Python / installers / credentials")}`),s.blank()):(s.detail("Everything is scaffolded and dependencies look installed."),s.detail("Pick the action you wanted:"),s.blank(),console.log(` ${d.cyan("npx klaudius@latest doctor")} ${d.dim("# verify Node / Python / installers / credentials")}`),console.log(` ${d.cyan("npx klaudius@latest configure")} ${d.dim("# change a credential / API key")}`),console.log(` ${d.cyan("npx klaudius@latest update")} ${d.dim("# pull the latest skills, scripts, lessons")}`),s.blank()),s.detail("If you wanted to start over from scratch, delete this folder and re-run `npx klaudius@latest init`."),s.blank();return}if(a.kind==="occupied"){let u=t===".",h=await Eo(o);if(h.length>0){s.warn("You're not inside your Klaudius project \u2014 it's in a folder below this one."),s.detail(`You're in: ${ue(o)}`),s.blank();for(let f of h)s.detail(f.finished?`Found a finished project at ${ue(f.path)}. To work in it:`:`Found an unfinished setup at ${ue(f.path)}. To pick up where it left off:`),s.blank(),f.finished?(console.log(` ${d.cyan(`cd ${ue(f.path)}`)}`),console.log(` ${d.cyan("claude")} ${d.dim("# open Claude Code in the project")}`)):console.log(` ${d.cyan(ne(f.path))} ${d.dim("# then pick Resume")}`),s.blank();process.exit(1)}s.error("Klaudius needs an empty folder to scaffold into. This directory isn't empty."),s.detail(`Path: ${o}`),s.detail(`Contains: ${a.entries.slice(0,5).join(", ")}${a.entries.length>5?`, \u2026 (+${a.entries.length-5} more)`:""}`),s.blank(),u?(s.detail("Two ways forward:"),s.blank(),s.detail("1. Pass a folder name and Klaudius creates it for you:"),console.log(` ${d.cyan("npx klaudius@latest init my-agency")}`),s.blank(),s.detail("2. Or cd into an empty folder first, then re-run:"),console.log(` ${d.cyan("mkdir my-agency && cd my-agency && npx klaudius@latest init")}`)):(s.detail(`The folder '${t}' already exists and isn't empty.`),s.detail("Either pick a different name:"),console.log(` ${d.cyan(`npx klaudius@latest init ${t}-2`)}`),s.detail("\u2026or delete the existing folder if it's safe to remove.")),process.exit(1)}let i=await To(e.license),l=y.spinner();l.start("Validating license");let c=await vt(i);c.ok||(l.stop(`License invalid: ${c.reason??"unknown"}`,2),s.detail("If you believe this is in error, email hello@klaudius.dev with your purchase details."),process.exit(1)),l.stop(`License valid (${c.tier??"core"} tier)`);let p=await ie();p.ok||(s.error(p.message??"Python version check failed."),s.blank(),s.detail(`Once you've installed Python 3.10+, re-run the same command: ${ne(o)}`),process.exit(1));let m=J();m.ok||(s.error(m.message??"Node.js version check failed."),s.blank(),s.detail(`Once you've installed Node.js 22.15+, re-run the same command: ${ne(o)}`),process.exit(1));let r,w=!1;if(a.kind==="partial")if(await bo(o)==="resume"){let h=await Gt(a.envPath,"utf-8"),f=Be(U(h));f?(s.success("Resuming with values from your existing .env"),s.detail("(Skipping the wizard \u2014 edit .env directly if you need to change anything.)"),r=f,w=!0):(s.warn("Existing .env was missing required fields \u2014 starting wizard fresh."),r=await I())}else{let h=await Gt(a.envPath,"utf-8"),f=Be(U(h));r=await I(f??{})}else r=await I();r.licenseKey=i,await x(o,r),w||(s.success("Saved .env"),s.success(r.aiAgent==="codex"?"Saved .codex/config.toml":"Saved .mcp.json")),s.blank();for(let u=1;;u++){let h=y.spinner();h.start("Validating Supabase credentials");let f=await re({url:r.supabaseUrl,serviceKey:r.supabaseServiceKey});if(f.ok){h.stop("Supabase credentials accepted");break}h.stop(f.message??"Supabase check failed",2),u>=C&&te(o,"Supabase",f.message??"Supabase check failed");let A=f.message??"Supabase check failed";s.blank(),s.warn(`Bouncing you back into the Supabase section so you can fix it in place. (attempt ${u+1} of ${C})`),s.detail("(Press Enter through any field to keep its current value. Ctrl+C to exit.)"),s.blank(),r=await I(r,{onlySection:"supabase",banner:`Supabase rejected your credentials:
|
|
24
24
|
${A}
|
|
25
25
|
|
|
26
26
|
Re-enter the URL, secret key, or PAT below. Press Enter on any
|
|
@@ -45,7 +45,7 @@ Generate (or fix) the key at https://console.cloud.google.com
|
|
|
45
45
|
and paste it below. Press Enter to keep the current value.`}),await x(o,r)}let g=!1;if(r.outreachEnabled&&r.outreachChannels?.includes("email")&&r.emailAddress&&r.emailPassword&&r.emailSmtpHost&&r.emailSmtpPort&&r.emailImapHost&&r.emailImapPort){s.blank();let u=0,h=!1,f;for(;!h;){u++;let A=y.spinner();A.start("Validating email credentials (SMTP + IMAP)");let K=await ce({emailAddress:r.emailAddress,emailPassword:r.emailPassword,emailSmtpHost:r.emailSmtpHost,emailSmtpPort:r.emailSmtpPort,emailImapHost:r.emailImapHost,emailImapPort:r.emailImapPort});if(K.ok){A.stop("Email credentials accepted (SMTP + IMAP)");break}A.stop(K.message??"Email check failed",2);let S=r.emailProvider,j=S&&S!=="custom"?z[S]:void 0,ke=`${S}\0${r.emailAddress}\0${r.emailPassword}`;if(j&&K.failureKind!=="network"&&f!==ke){f=ke;let Z=we(S,r.emailSmtpHost,r.emailImapHost),ee,nt=0;if(Z.length>0){s.blank(),s.warn(`That server rejected the login. ${j.label} runs several regional servers \u2014 trying the others with the same credentials...`);for(let D of Z){let He=y.spinner();He.start(`Trying ${D.label} (${D.smtpHost})`);let Ke=await ce({emailAddress:r.emailAddress,emailPassword:r.emailPassword,emailSmtpHost:D.smtpHost,emailSmtpPort:r.emailSmtpPort,emailImapHost:D.imapHost,emailImapPort:r.emailImapPort});if(Ke.ok){He.stop(`${D.label}: your login works here (${D.smtpHost})`),ee=D;break}Ke.failureKind!=="network"&&nt++,He.stop(Ke.failureKind==="network"?`${D.label}: unreachable`:`${D.label}: rejected too`,2)}}if(ee){s.blank(),s.success("Found it \u2014 your password was right all along; the server was the only problem.");let D=await y.confirm({message:`Use the ${ee.label} servers (${ee.smtpHost} / ${ee.imapHost})?`,initialValue:!0});if(y.isCancel(D)&&(y.cancel(`Setup cancelled. Your .env is saved \u2014 resume with:
|
|
46
46
|
|
|
47
47
|
${ne(o)}
|
|
48
|
-
`),process.exit(0)),D){r.emailSmtpHost=ee.smtpHost,r.emailImapHost=ee.imapHost,await x(o,r);continue}}else Z.length>0&&(s.blank(),nt===0?s.warn("Couldn't reach any of the alternate servers \u2014 this looks like a network problem, not a credential problem. Check your connection and retry."):j.noAltWorkedHint&&s.warn(j.noAltWorkedHint))}let pn=K.message??"Email check failed";s.blank(),s.warn("Email isn't required to finish setup \u2014 the rest of Klaudius (finding businesses, building, deploying) works without it."),s.detail("You can skip it now and wire it up later from inside the project."),s.blank();let je=await y.select({message
|
|
48
|
+
`),process.exit(0)),D){r.emailSmtpHost=ee.smtpHost,r.emailImapHost=ee.imapHost,await x(o,r);continue}}else Z.length>0&&(s.blank(),nt===0?s.warn("Couldn't reach any of the alternate servers \u2014 this looks like a network problem, not a credential problem. Check your connection and retry."):j.noAltWorkedHint&&s.warn(j.noAltWorkedHint))}let pn=K.message??"Email check failed";s.blank(),s.warn("Email isn't required to finish setup \u2014 the rest of Klaudius (finding businesses, building, deploying) works without it."),s.detail("You can skip it now and wire it up later from inside the project."),s.blank();let je=await y.select({message:`What would you like to do? ${d.dim("(\u2191 \u2193 arrow keys, then Enter)")}`,initialValue:u>=3?"skip":u>=2?"edit":"retry",options:[{value:"retry",label:"Retry the check (good if it was a momentary network blip)"},{value:"edit",label:"Edit my email details and retry"},{value:"skip",label:"Skip email for now (finish setup; wire email up later)"}]});if(y.isCancel(je)&&(y.cancel(`Setup cancelled. Your .env is saved \u2014 resume with:
|
|
49
49
|
|
|
50
50
|
${ne(o)}
|
|
51
51
|
`),process.exit(0)),je==="skip"){r.outreachChannels=(r.outreachChannels??[]).filter(Z=>Z!=="email"),r.outreachPriority=(r.outreachPriority??[]).filter(Z=>Z!=="email"),r.outreachChannels.length===0&&(r.outreachEnabled=!1),await x(o,r),g=!0,s.success("Skipped email for now. Setup will continue."),r.outreachEnabled?s.detail("Outreach will use your other channel(s); email stays off until it's fixed."):s.detail("Automated outreach is off until email is fixed \u2014 everything else works."),h=!0;break}je==="edit"&&(s.blank(),r=await I(r,{onlySection:"email",banner:`${K.failedAt==="imap"?"IMAP":"SMTP"} check failed:
|
|
@@ -64,7 +64,7 @@ ${A}
|
|
|
64
64
|
|
|
65
65
|
Either fix the underlying issue (sign in to Messages.app, configure
|
|
66
66
|
Text Message Forwarding) and press Enter through, or change SMS
|
|
67
|
-
provider to Twilio.`}),await x(o,r)}}if(r.telegramBotToken&&r.telegramChatId){s.blank();let u=0,h=!1;for(;!h;){u++;let f=y.spinner();f.start("Validating Telegram bot + chat (sending a test ping)");let A=await at({botToken:r.telegramBotToken,chatId:r.telegramChatId});if(A.ok){f.stop(A.botHandle?`Telegram bot ${A.botHandle} accepted, test message delivered`:"Telegram credentials accepted, test message delivered"),h=!0;break}f.stop(A.message??"Telegram check failed",2);let K=A.message??"Telegram check failed";s.blank(),s.warn("Telegram is optional \u2014 you can skip it now and wire it up later by editing `.env`."),s.blank();let S=await y.select({message
|
|
67
|
+
provider to Twilio.`}),await x(o,r)}}if(r.telegramBotToken&&r.telegramChatId){s.blank();let u=0,h=!1;for(;!h;){u++;let f=y.spinner();f.start("Validating Telegram bot + chat (sending a test ping)");let A=await at({botToken:r.telegramBotToken,chatId:r.telegramChatId});if(A.ok){f.stop(A.botHandle?`Telegram bot ${A.botHandle} accepted, test message delivered`:"Telegram credentials accepted, test message delivered"),h=!0;break}f.stop(A.message??"Telegram check failed",2);let K=A.message??"Telegram check failed";s.blank(),s.warn("Telegram is optional \u2014 you can skip it now and wire it up later by editing `.env`."),s.blank();let S=await y.select({message:`What would you like to do? ${d.dim("(\u2191 \u2193 arrow keys, then Enter)")}`,initialValue:u>=2?"skip":"retry",options:[{value:"retry",label:"Retry the check (good if it was a momentary network blip)"},{value:"edit",label:"Edit my bot token / chat ID and retry"},{value:"skip",label:"Skip Telegram for now (I'll add it later by editing .env)"}]});if(y.isCancel(S)&&(y.cancel(`Setup cancelled. Your .env is saved \u2014 resume with:
|
|
68
68
|
|
|
69
69
|
${ne(o)}
|
|
70
70
|
`),process.exit(0)),S==="skip"){r.telegramBotToken=void 0,r.telegramChatId=void 0,await x(o,r),s.success("Skipped Telegram. Setup will continue."),s.detail("Wire it up later by pasting your bot token and chat ID into the TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID lines of `.env`."),h=!0;break}if(S==="edit"&&(s.blank(),r=await I(r,{onlySection:"telegram",banner:`Telegram check failed:
|
|
@@ -74,7 +74,7 @@ Re-enter the bot token or chat_id below.
|
|
|
74
74
|
Press Enter on any field to keep its current value.`}),await x(o,r),!r.telegramBotToken||!r.telegramChatId)){s.success("Skipped Telegram. Setup will continue."),h=!0;break}}}s.blank();let E=y.spinner();E.start("Downloading Klaudius template");let v;try{v=(await Re({licenseKey:i,machineId:ge(),hostname:process.platform==="win32"?process.env.COMPUTERNAME:void 0,os:`${process.platform}-${process.arch}`,agent:r.aiAgent,destDir:o})).filesExtracted,E.stop(`Downloaded ${v} files into ${d.bold(o)}`)}catch(u){E.stop(u.message,2);let h=r.aiAgent==="codex"?".codex/config.toml":".mcp.json";s.detail(`Your .env / ${h} are saved. Re-run init once the issue is resolved to retry the download.`),process.exit(1)}await qe(H(o,"clients"),{recursive:!0});let oe=await Pt(o);await Se(o,At(Vt,oe)),s.success("Wrote .klaudius/manifest.json");let M=!1,Y="";if(e.skipSchema)s.warn("--skip-schema set; not applying scripts/schema.sql to your Supabase project."),s.detail(`Apply manually later via the SQL editor: ${r.supabaseUrl.replace("https://","https://supabase.com/dashboard/project/"+r.supabaseProjectRef+"/sql/new").replace(r.supabaseProjectRef+".supabase.co","")}`);else{s.blank();let u=y.spinner();u.start("Applying schema to Supabase");let h=await xt({projectRoot:o,pat:r.supabasePat,projectRef:r.supabaseProjectRef});h.ok?u.stop("Schema applied (or already present)"):(u.stop(h.message??"Schema apply failed",2),M=!0,Y=`https://supabase.com/dashboard/project/${r.supabaseProjectRef}/sql/new`)}let b=[],P={};if(e.skipInstall)s.warn("--skip-install set; you'll need to run npm install + pip install + playwright/patchright install yourself.");else{s.blank(),s.heading("Installing dependencies");let u=await Ne(o);s.detail(`npm: ${u.npm}, pip: ${u.pip}, playwright: ${u.playwright}, patchright: ${u.patchright}`),u.npm==="failed"&&b.push("npm"),u.pip==="failed"&&b.push("pip"),u.playwright==="failed"&&b.push("playwright"),u.patchright==="failed"&&b.push("patchright"),P=u.hints??{}}let $=r.outreachEnabled&&r.outreachPriority?.includes("whatsapp")&&(r.whatsappAccounts?.length??0)>0,k=!e.skipInstall&&!b.includes("npm");if($&&k){s.blank(),s.heading("Linking WhatsApp accounts"),console.log(d.dim(`You'll be prompted to scan one QR per linked number. Open WhatsApp on the
|
|
75
75
|
phone whose number you want to link, then Settings \u2192 Linked Devices \u2192
|
|
76
76
|
Link a Device, and point it at the QR shown in this terminal.`)),s.blank();for(let u of r.whatsappAccounts){console.log(d.cyan(`Pairing WhatsApp account '${u}'...`)),console.log(d.dim(`(Ctrl-C abandons init but your .env is already saved \u2014 finish later via: npx klaudius@latest pair-whatsapp --label ${u})`));let h=Yt(process.execPath,["scripts/whatsapp.mjs","pair","--account",u],{cwd:o,stdio:"inherit"});h.status===0?s.detail(`Paired '${u}'.`):(console.log(d.yellow(`'${u}' did not pair (exit ${h.status??"signalled"}). You can finish later via:`)),console.log(d.cyan(` npx klaudius@latest pair-whatsapp --label ${u}`))),s.blank()}}else if($&&!k){s.blank(),console.log(d.yellow("Skipping WhatsApp pairing \u2014 baileys isn't installed yet (npm install failed earlier or was skipped).")),console.log(d.dim("Once `npx klaudius@latest install` completes successfully, pair via:"));for(let u of r.whatsappAccounts)console.log(d.cyan(` npx klaudius@latest pair-whatsapp --label ${u}`))}s.blank();let G=[...b,...M?["schema"]:[]];if(G.length>0){y.outro(d.yellow(d.bold(`Setup paused \u2014 ${G.join(", ")} failed.`))),console.log(d.dim("Your credentials and project files are all saved.")),s.blank();for(let[j,ke]of Object.entries(P))console.log(d.yellow(`Likely cause of ${j} failure:`)),console.log(d.dim(` ${ke}`)),s.blank();let u=o!==process.cwd()&&e.target?` ${d.cyan(`cd ${Me(e.target)}`)}
|
|
77
|
-
`:"",h=r.aiAgent==="codex"?"codex":"claude",f=r.aiAgent==="codex"?"Codex":"Claude Code",A=r.aiAgent==="codex"?"npm install -g @openai/codex":"npm install -g @anthropic-ai/claude-code";b.length>0&&(console.log(d.dim(`Easiest fix \u2014 let ${f} finish it for you:`)),s.blank(),u&&process.stdout.write(u),console.log(` ${d.cyan(h)} ${d.dim(`# open ${f} in this folder`)}`),console.log(d.dim(" Then paste:")),console.log(d.cyan(` "Finish my Klaudius install \u2014 ${b.join(", ")} failed during setup. Debug the install output, retry, then run npx klaudius@latest doctor."`)),s.blank(),console.log(d.dim(` (Don't have ${f} yet? Install with: \`${A}\`)`)),s.blank(),console.log(d.dim("Or do it yourself:")),s.blank(),u&&process.stdout.write(u),console.log(` ${d.cyan("npx klaudius@latest install")} ${d.dim("# retry the failing installers")}`),console.log(` ${d.cyan("npx klaudius@latest doctor")} ${d.dim("# verify everything")}`),s.blank()),M&&(console.log(d.dim("For the schema failure specifically, apply scripts/schema.sql in the Supabase SQL editor:")),console.log(` ${d.cyan(Y)}`),console.log(d.dim(" Open scripts/schema.sql, copy the contents, paste into the editor, click Run.")),s.blank()),b.includes("pip")&&!P.pip&&(console.log(d.dim("If pip fails again with a build error, check `python3 --version` \u2014 Klaudius needs")),console.log(d.dim(`Python 3.10+. Install a newer one from ${Io()}`)),console.log(d.dim("and open a fresh Terminal before retrying.")),s.blank());let S=["npm","playwright","patchright"].filter(j=>b.includes(j)&&!P[j]);if(S.length>0){let j=S.length===1?"keeps":"keep";console.log(d.dim(`If ${S.join(" / ")} ${j} failing with network errors (ECONNRESET,`)),console.log(d.dim("ETIMEDOUT, ENOTFOUND), they're transient \u2014 try a different network or your")),console.log(d.dim("phone's hotspot, then re-run `npx klaudius@latest install`.")),s.blank()}g&&(console.log(d.dim(`Note: email outreach was skipped during setup. Once the install succeeds, ask ${f}`)),console.log(d.dim("to finish setting it up \u2014 your email details are saved in .env.")),s.blank()),console.log(d.dim("Stuck? Email hello@klaudius.dev with the last ~20 lines of the install output.")),s.blank();return}if(Co(r,o,e.target),g){let u=r.aiAgent==="codex"?"Codex":"Claude Code";console.log(d.yellow("Email outreach is parked \u2014 the credential check didn't pass during setup.")),console.log(d.dim(`Your details are saved in .env. To finish it, ask ${u}:`)),console.log(d.cyan(' "Set up my email outreach. My details are in .env (EMAIL_*) but the')),console.log(d.cyan(" SMTP/IMAP check failed during init. Work out the right servers for my")),console.log(d.cyan(" provider, test them with scripts/gmail.py, fix .env, re-add email to")),console.log(d.cyan(" OUTREACH_CHANNELS and OUTREACH_PRIORITY, set OUTREACH_ENABLED=true,")),console.log(d.cyan(' and send a test email to my own address to confirm."')),r.outreachEnabled&&(r.outreachChannels??[]).length>0&&(s.blank(),console.log(d.yellow(`Note: your other channel(s) \u2014 ${(r.outreachChannels??[]).join(", ")} \u2014 are still live, so the pipeline WILL still pitch businesses.`))),s.blank()}}async function x(e,t){await qe(e,{recursive:!0}),await ze(H(e,".env"),Pe(t),"utf-8"),t.aiAgent==="codex"?(await qe(H(e,".codex"),{recursive:!0}),await ze(H(e,".codex","config.toml"),Te(t),"utf-8")):(await ze(H(e,".mcp.json"),be(t),"utf-8"),await Le(e,"supabase"))}async function Po(e){try{(await Je(e)).isDirectory()||(s.error(`Target exists but is not a directory: ${e}`),process.exit(1))}catch{return{kind:"fresh"}}let t=await Wt(e),o=t.filter(c=>!c.startsWith(".DS_Store"));if(o.length===0)return{kind:"fresh"};let n=new Set([".env",".mcp.json",".claude",".codex"]),a=o.every(c=>n.has(c)),i=o.includes(".env"),l=t.includes(".klaudius");if(a&&i&&!l)return{kind:"partial",envPath:H(e,".env")};if(l&&i){let c=!0;try{c=!(await Je(H(e,"node_modules"))).isDirectory()}catch{c=!0}return{kind:"scaffolded",nodeModulesMissing:c}}return{kind:"occupied",entries:o}}async function bo(e){s.blank(),s.warn(`Found a partial setup at ${d.bold(e)}.`),s.detail(`A previous init wrote ${d.bold(".env")} but didn't finish scaffolding.`),s.blank();let t=await y.select({message:"How would you like to proceed?",initialValue:"resume",options:[{value:"resume",label:"Resume \u2014 use my saved .env values, skip the wizard, retry validation"},{value:"redo",label:"Restart \u2014 walk through the wizard again (existing values pre-filled as defaults)"}]});return y.isCancel(t)&&(y.cancel("Setup cancelled. Existing .env left in place."),process.exit(0)),t}async function To(e){if(e&&e.trim().length>0)return e;y.intro("Klaudius");let t=await y.text({message:"Enter your Klaudius license key",placeholder:"KLAU-XXXX-XXXX-XXXX-XXXX",validate:o=>o.trim().length===0?"Required. Check your purchase confirmation email.":void 0});return y.isCancel(t)&&(y.cancel("Setup cancelled. No files written."),process.exit(0)),t}function _o(e){let t=Ao(e);if(process.platform==="win32"){let o=t.toLowerCase();if(o.startsWith("c:\\windows\\"))return"Inside C:\\Windows (Windows system directory).";if(o.startsWith("c:\\program files\\"))return"Inside C:\\Program Files (Windows protected directory).";if(o.startsWith("c:\\program files (x86)\\"))return"Inside C:\\Program Files (x86) (Windows protected directory).";if(o.startsWith("c:\\programdata\\"))return"Inside C:\\ProgramData (Windows protected directory)."}else{let o=["/System/","/usr/","/bin/","/sbin/"];for(let n of o)if(t.startsWith(n))return`Inside ${n.slice(0,-1)} (system-managed directory).`}}function So(){if(process.platform!=="win32")return!1;try{return Yt("net",["session"],{stdio:"ignore",windowsHide:!0}).status===0}catch{return!1}}function Io(){switch(process.platform){case"win32":return"https://www.python.org/downloads/windows/";case"darwin":return"https://www.python.org/downloads/macos/";default:return"https://www.python.org/downloads/"}}function Co(e,t,o){let n=e.aiAgent==="codex"?"codex":"claude",a=e.aiAgent==="codex"?"Codex":"Claude Code";if(y.outro(d.green(d.bold("Project ready."))),console.log(d.bold("Next steps:")),s.blank(),t!==process.cwd()&&o){let i=`cd ${Me(o)}`;console.log(` ${d.cyan(i)}${" ".repeat(Math.max(1,27-i.length))}${d.dim("# go into your project folder")}`)}console.log(` ${d.cyan(n)}${" ".repeat(Math.max(1,27-n.length))}${d.dim(`# opens ${a} in this project`)}`),s.blank(),console.log(d.bold(`Some starter prompts for ${a}:`)),s.blank(),console.log(` ${d.cyan(`"Run klaudius doctor and fix anything that's missing or broken, so`)}`),console.log(` ${d.cyan(`I know I'm ready to start using Klaudius."`)}`),s.blank(),console.log(` ${d.cyan('"Open DOCS.html in my browser so I can read the docs."')}`),s.blank(),console.log(` ${d.cyan('"Run the pipeline for one client."')}`),console.log(d.dim(e.outreachEnabled?" \u2192 finds a business, builds their site, deploys it, and pitches them.":" \u2192 finds a business, builds their site, deploys it. Outreach is off \u2014 nothing is sent.")),s.blank(),e.aiAgent!=="codex"&&(console.log(d.dim("Prefer a more comfortable interface than a terminal? Claude Code also comes as")),console.log(d.dim("a desktop app \u2014 same tool, friendlier: https://code.claude.com/docs/en/setup")),s.blank())}import{access as Ro,readFile as vo}from"fs/promises";import{join as Xe,resolve as xo}from"path";import N from"picocolors";async function Jt(e){let t=e.target?xo(process.cwd(),e.target):process.cwd(),o=await qt(Xe(t,".env")),n=await qt(Xe(t,"package.json"));(!o||!n)&&(s.error("This doesn't look like a Klaudius project."),s.detail(`Path: ${t}`),o||s.detail("Missing: .env"),n||s.detail("Missing: package.json"),s.blank(),s.detail("Run `npx klaudius@latest init` to scaffold a new project first,"),s.detail("or cd into an existing project directory and re-run this command."),process.exit(1));let a="claude-code";try{U(await vo(Xe(t,".env"),"utf-8")).AI_AGENT==="codex"&&(a="codex")}catch{}s.heading("Installing dependencies");let i=await Ne(t);s.blank(),s.detail(`npm: ${i.npm}, pip: ${i.pip}, playwright: ${i.playwright}, patchright: ${i.patchright}`);let l=[];if(i.npm==="failed"&&l.push("npm"),i.pip==="failed"&&l.push("pip"),i.playwright==="failed"&&l.push("playwright"),i.patchright==="failed"&&l.push("patchright"),l.length===0){s.blank(),console.log(N.green(N.bold("All dependencies installed."))),console.log(N.dim("Run `npx klaudius@latest doctor` to verify everything else (credentials, files).")),s.blank();return}s.blank(),console.log(N.yellow(N.bold(`${l.join(", ")} still failing.`))),s.blank();for(let[r,w]of Object.entries(i.hints??{}))console.log(N.yellow(`Likely cause of ${r} failure:`)),console.log(N.dim(` ${w}`)),s.blank();let c=a==="codex"?"codex":"claude",p=a==="codex"?"Codex":"Claude Code",m=a==="codex"?"npm install -g @openai/codex":"npm install -g @anthropic-ai/claude-code";console.log(N.dim("Options:")),console.log(N.dim(` \u2022 Open ${p} in this folder (\`${c}\`) and paste:`)),console.log(N.cyan(` "Finish my Klaudius install \u2014 ${l.join(", ")} failed. Debug the install output, retry, then run npx klaudius@latest doctor."`)),console.log(N.dim(` (Don't have ${p} yet? Install with: \`${m}\`)`)),console.log(N.dim(" \u2022 Or run `npx klaudius@latest doctor` for a structured diagnostic.")),console.log(N.dim(" \u2022 Or email hello@klaudius.dev with the last ~20 lines of the install output above.")),s.blank(),process.exitCode=1}async function qt(e){try{return await Ro(e),!0}catch{return!1}}import{readFile as Oo,writeFile as Qe,access as $o}from"fs/promises";import{join as pe}from"path";import*as De from"@clack/prompts";import V from"picocolors";import{mkdir as No}from"fs/promises";async function Xt(e){let t=e.projectRoot??process.cwd(),o=pe(t,".env"),n=pe(t,".mcp.json"),a=pe(t,".codex","config.toml"),i=await Ze(pe(t,".klaudius","manifest.json")),l=await Ze(o);!i&&!l&&(s.error("This doesn't look like a Klaudius project."),s.detail("Expected `.klaudius/manifest.json` or `.env` in this folder. Run `npx klaudius@latest init` first."),process.exit(1));let c=J();c.ok||(s.error(c.message??"Node.js version check failed."),s.blank(),s.detail("Once you've installed Node.js 22.15+, re-run `npx klaudius@latest configure` in this folder."),process.exit(1));let p={};try{let E=await Oo(o,"utf-8");p=U(E)}catch{s.warn("No .env found. Starting from an empty configuration.")}let m=gt(p);De.intro("Reconfigure Klaudius"),s.detail("Press Enter on any prompt to keep its current value."),s.blank();let r=await I(m),w=m.aiAgent??"claude-code";if(r.aiAgent&&r.aiAgent!==w&&(s.error(`Switching AI coding agent (${w} \u2192 ${r.aiAgent}) isn't supported via configure.`),s.detail("configure only rewrites .env / MCP config \u2014 it doesn't restructure the scaffolded files. To switch, run:"),s.blank(),console.log(` ${V.cyan("npx klaudius@latest init <new-folder>")} ${V.dim("# pick the new agent in the wizard")}`),s.blank(),s.detail(".env is unchanged."),process.exit(1)),r.supabaseUrl!==p.SUPABASE_URL||r.supabaseServiceKey!==p.SUPABASE_SERVICE_KEY){s.heading("Re-validating Supabase credentials");let E=await re({url:r.supabaseUrl,serviceKey:r.supabaseServiceKey});E.ok||(s.error(E.message??"Supabase check failed"),s.warn("Aborting. .env not modified."),process.exit(1)),s.success("Supabase credentials accepted")}let g=q(r.googlePlacesApiKey??"");if(g.changed&&r.googlePlacesApiKey){s.heading("Checking your Google Places API key");let E=await le(r.googlePlacesApiKey);if(E.ok){if(g.repairs.length>0){s.warn("Corrected look-alike characters in your Google Places API key:");for(let v of g.repairs)s.detail(` ${v}`);s.detail("These come from keys that were transcribed rather than copied.")}r.googlePlacesApiKey=g.value,s.success("Google accepted the key \u2014 writing the corrected value to .env")}else s.error(E.message??"Google rejected the Google Places API key"),s.warn("Writing the key exactly as you entered it \u2014 nothing has been guessed on your behalf."),s.detail("Re-run `npx klaudius@latest configure` with a key copied straight from the Cloud Console's copy button.")}await Qe(o,Pe(r),"utf-8"),s.success("Updated .env"),r.aiAgent==="codex"?(await No(pe(t,".codex"),{recursive:!0}),await Qe(a,Te(r),"utf-8"),s.success("Updated .codex/config.toml")):(await Qe(n,be(r),"utf-8"),s.success("Updated .mcp.json"),await Le(t,"supabase")),s.blank(),De.outro(V.green("Configuration updated.")),await Lo(t,i)}async function Lo(e,t){let o=await Ze(pe(e,"node_modules"));s.blank(),t?o||(s.detail("Your project files are in place but dependencies aren't installed yet."),s.detail("To finish setup, run:"),s.blank(),console.log(` ${V.cyan("npx klaudius@latest install")} ${V.dim("# (re-)installs npm + pip + browsers; idempotent")}`),s.blank(),s.detail("Then verify with:"),s.blank(),console.log(` ${V.cyan("npx klaudius@latest doctor")} ${V.dim("# checks Node / Python / installers / credentials")}`),s.blank()):(s.detail("Looks like a previous `klaudius init` saved your .env but didn't finish scaffolding."),s.detail("To finish setup, run:"),s.blank(),console.log(` ${V.cyan("npx klaudius@latest init")} ${V.dim("# pick Resume when prompted")}`),s.blank())}async function Ze(e){try{return await $o(e),!0}catch{return!1}}import{copyFile as Qt,mkdir as Zt,readdir as Mo,readFile as Do,rm as ye,writeFile as en,access as tn}from"fs/promises";import{dirname as nn,join as L,relative as Uo}from"path";import{tmpdir as jo}from"os";import*as fe from"@clack/prompts";import et from"picocolors";var Ue="0.19.0";async function on(e){let t=e.projectRoot??process.cwd(),o=await wt(t);o||(s.error("This doesn't look like a Klaudius project."),s.detail("Expected `.klaudius/manifest.json`. Run `npx klaudius@latest init` first."),process.exit(1));for(let k of _e)delete o.files[k];let n,a=L(t,".env"),i,l;try{i=await Do(a,"utf-8"),l=U(i)}catch{s.error("Couldn't read .env from this directory."),s.detail("Are you running `klaudius update` from inside a Klaudius project?"),process.exit(1)}n=l.KLAUDIUS_LICENSE_KEY??"",n||(s.error("Couldn't find KLAUDIUS_LICENSE_KEY in your .env file."),s.detail("This file is created by `npx klaudius@latest init`. If your project predates"),s.detail("the licence-gated template (CLI version 0.1.x), re-run `npx klaudius@latest init`"),s.detail("in a sibling directory, then copy KLAUDIUS_LICENSE_KEY from its .env."),process.exit(1));let c=ht(i,l,mt);c!==null&&(await en(a,c,"utf-8"),s.detail("Backfilled new env keys")),await ve("update",Ue),fe.intro(`Update from ${o.templateVersion} \u2192 ${Ue}`);let m=l.AI_AGENT==="codex"?"codex":"claude-code",r=L(jo(),`klaudius-update-${process.pid}-${Date.now()}`),w;try{s.heading("Downloading the latest Klaudius template");let k=await Re({licenseKey:n,machineId:ge(),hostname:process.env.HOSTNAME??process.env.COMPUTERNAME,os:`${process.platform}-${process.arch}`,agent:m,destDir:r});s.success(`Fetched ${k.filesExtracted} canonical files`),w=r}catch(k){s.error(k.message),s.detail("Update aborted. Your project is unchanged."),await ye(r,{recursive:!0,force:!0}).catch(()=>{}),process.exit(1)}let g=await Ho(w,t,o),E=g.filter(k=>k.state==="new"),v=g.filter(k=>k.state==="clean-update"),oe=g.filter(k=>k.state==="user-only"),M=g.filter(k=>k.state==="conflict"),Y=g.filter(k=>k.state==="no-change"),b=g.filter(k=>k.state==="removed-clean"),P=g.filter(k=>k.state==="removed-modified"),$=[...M,...P];if(s.blank(),s.heading("Change summary"),s.detail(`${B(Y.length,"file")} unchanged`),s.detail(`${B(E.length,"new file")}`),s.detail(`${B(v.length,"file")} updated cleanly (no local edits)`),s.detail(`${B(oe.length,"file")} you've edited (no upstream change \u2014 left alone)`),s.detail(`${B(b.length,"file")} removed upstream (deleted cleanly)`),s.detail(`${B(M.length,"file")} with conflicts (you edited AND we have a new version)`),s.detail(`${B(P.length,"file")} removed upstream but edited locally (need your decision)`),E.length===0&&v.length===0&&b.length===0&&$.length===0){s.blank(),fe.outro(et.green("Already up to date.")),await ye(r,{recursive:!0,force:!0}).catch(()=>{});return}s.blank(),s.heading("Applying clean updates");for(let k of[...E,...v]){let G=L(w,k.path),u=L(t,k.path);await Zt(nn(u),{recursive:!0}),await Qt(G,u),o.files[k.path]=k.canonicalHash}E.length+v.length>0&&s.success(`Wrote ${B(E.length+v.length,"file")}`);for(let k of b){let G=L(t,k.path);await ye(G,{force:!0}),delete o.files[k.path]}if(b.length>0&&s.success(`Deleted ${B(b.length,"file")} removed upstream`),$.length>0){s.blank(),s.heading(`${$.length} conflict(s) need resolution`);let k=L(t,".klaudius","incoming");try{await ye(k,{recursive:!0,force:!0})}catch{}for(let G of M){let u=L(w,G.path),h=L(k,G.path);await Zt(nn(h),{recursive:!0}),await Qt(u,h)}await en(L(t,".klaudius","conflicts.md"),Ko($,o.templateVersion,Ue),"utf-8"),M.length>0&&s.detail("Staged canonical versions to .klaudius/incoming/"),s.detail("Wrote conflict report to .klaudius/conflicts.md")}if(o.updatedAt=new Date().toISOString(),$.length===0&&(o.templateVersion=Ue),await Se(t,o),s.blank(),$.length===0)fe.outro(et.green("Update complete."));else{let k=m==="codex"?"Codex":"Claude Code";fe.outro(et.yellow(`${$.length} conflict(s) staged. Open ${k} in this project and ask:
|
|
77
|
+
`:"",h=r.aiAgent==="codex"?"codex":"claude",f=r.aiAgent==="codex"?"Codex":"Claude Code",A=r.aiAgent==="codex"?"npm install -g @openai/codex":"npm install -g @anthropic-ai/claude-code";b.length>0&&(console.log(d.dim(`Easiest fix \u2014 let ${f} finish it for you:`)),s.blank(),u&&process.stdout.write(u),console.log(` ${d.cyan(h)} ${d.dim(`# open ${f} in this folder`)}`),console.log(d.dim(" Then paste:")),console.log(d.cyan(` "Finish my Klaudius install \u2014 ${b.join(", ")} failed during setup. Debug the install output, retry, then run npx klaudius@latest doctor."`)),s.blank(),console.log(d.dim(` (Don't have ${f} yet? Install with: \`${A}\`)`)),s.blank(),console.log(d.dim("Or do it yourself:")),s.blank(),u&&process.stdout.write(u),console.log(` ${d.cyan("npx klaudius@latest install")} ${d.dim("# retry the failing installers")}`),console.log(` ${d.cyan("npx klaudius@latest doctor")} ${d.dim("# verify everything")}`),s.blank()),M&&(console.log(d.dim("For the schema failure specifically, apply scripts/schema.sql in the Supabase SQL editor:")),console.log(` ${d.cyan(Y)}`),console.log(d.dim(" Open scripts/schema.sql, copy the contents, paste into the editor, click Run.")),s.blank()),b.includes("pip")&&!P.pip&&(console.log(d.dim("If pip fails again with a build error, check `python3 --version` \u2014 Klaudius needs")),console.log(d.dim(`Python 3.10+. Install a newer one from ${Io()}`)),console.log(d.dim("and open a fresh Terminal before retrying.")),s.blank());let S=["npm","playwright","patchright"].filter(j=>b.includes(j)&&!P[j]);if(S.length>0){let j=S.length===1?"keeps":"keep";console.log(d.dim(`If ${S.join(" / ")} ${j} failing with network errors (ECONNRESET,`)),console.log(d.dim("ETIMEDOUT, ENOTFOUND), they're transient \u2014 try a different network or your")),console.log(d.dim("phone's hotspot, then re-run `npx klaudius@latest install`.")),s.blank()}g&&(console.log(d.dim(`Note: email outreach was skipped during setup. Once the install succeeds, ask ${f}`)),console.log(d.dim("to finish setting it up \u2014 your email details are saved in .env.")),s.blank()),console.log(d.dim("Stuck? Email hello@klaudius.dev with the last ~20 lines of the install output.")),s.blank();return}if(Co(r,o,e.target),g){let u=r.aiAgent==="codex"?"Codex":"Claude Code";console.log(d.yellow("Email outreach is parked \u2014 the credential check didn't pass during setup.")),console.log(d.dim(`Your details are saved in .env. To finish it, ask ${u}:`)),console.log(d.cyan(' "Set up my email outreach. My details are in .env (EMAIL_*) but the')),console.log(d.cyan(" SMTP/IMAP check failed during init. Work out the right servers for my")),console.log(d.cyan(" provider, test them with scripts/gmail.py, fix .env, re-add email to")),console.log(d.cyan(" OUTREACH_CHANNELS and OUTREACH_PRIORITY, set OUTREACH_ENABLED=true,")),console.log(d.cyan(' and send a test email to my own address to confirm."')),r.outreachEnabled&&(r.outreachChannels??[]).length>0&&(s.blank(),console.log(d.yellow(`Note: your other channel(s) \u2014 ${(r.outreachChannels??[]).join(", ")} \u2014 are still live, so the pipeline WILL still pitch businesses.`))),s.blank()}}async function x(e,t){await qe(e,{recursive:!0}),await ze(H(e,".env"),Pe(t),"utf-8"),t.aiAgent==="codex"?(await qe(H(e,".codex"),{recursive:!0}),await ze(H(e,".codex","config.toml"),Te(t),"utf-8")):(await ze(H(e,".mcp.json"),be(t),"utf-8"),await Le(e,"supabase"))}async function Po(e){try{(await Je(e)).isDirectory()||(s.error(`Target exists but is not a directory: ${e}`),process.exit(1))}catch{return{kind:"fresh"}}let t=await Wt(e),o=t.filter(c=>!c.startsWith(".DS_Store"));if(o.length===0)return{kind:"fresh"};let n=new Set([".env",".mcp.json",".claude",".codex"]),a=o.every(c=>n.has(c)),i=o.includes(".env"),l=t.includes(".klaudius");if(a&&i&&!l)return{kind:"partial",envPath:H(e,".env")};if(l&&i){let c=!0;try{c=!(await Je(H(e,"node_modules"))).isDirectory()}catch{c=!0}return{kind:"scaffolded",nodeModulesMissing:c}}return{kind:"occupied",entries:o}}async function bo(e){s.blank(),s.warn(`Found a partial setup at ${d.bold(e)}.`),s.detail(`A previous init wrote ${d.bold(".env")} but didn't finish scaffolding.`),s.blank();let t=await y.select({message:`How would you like to proceed? ${d.dim("(\u2191 \u2193 arrow keys, then Enter)")}`,initialValue:"resume",options:[{value:"resume",label:"Resume \u2014 use my saved .env values, skip the wizard, retry validation"},{value:"redo",label:"Restart \u2014 walk through the wizard again (existing values pre-filled as defaults)"}]});return y.isCancel(t)&&(y.cancel("Setup cancelled. Existing .env left in place."),process.exit(0)),t}async function To(e){if(e&&e.trim().length>0)return e;y.intro("Klaudius");let t=await y.text({message:"Enter your Klaudius license key",placeholder:"KLAU-XXXX-XXXX-XXXX-XXXX",validate:o=>o.trim().length===0?"Required. Check your purchase confirmation email.":void 0});return y.isCancel(t)&&(y.cancel("Setup cancelled. No files written."),process.exit(0)),t}function _o(e){let t=Ao(e);if(process.platform==="win32"){let o=t.toLowerCase();if(o.startsWith("c:\\windows\\"))return"Inside C:\\Windows (Windows system directory).";if(o.startsWith("c:\\program files\\"))return"Inside C:\\Program Files (Windows protected directory).";if(o.startsWith("c:\\program files (x86)\\"))return"Inside C:\\Program Files (x86) (Windows protected directory).";if(o.startsWith("c:\\programdata\\"))return"Inside C:\\ProgramData (Windows protected directory)."}else{let o=["/System/","/usr/","/bin/","/sbin/"];for(let n of o)if(t.startsWith(n))return`Inside ${n.slice(0,-1)} (system-managed directory).`}}function So(){if(process.platform!=="win32")return!1;try{return Yt("net",["session"],{stdio:"ignore",windowsHide:!0}).status===0}catch{return!1}}function Io(){switch(process.platform){case"win32":return"https://www.python.org/downloads/windows/";case"darwin":return"https://www.python.org/downloads/macos/";default:return"https://www.python.org/downloads/"}}function Co(e,t,o){let n=e.aiAgent==="codex"?"codex":"claude",a=e.aiAgent==="codex"?"Codex":"Claude Code";if(y.outro(d.green(d.bold("Project ready."))),console.log(d.bold("Next steps:")),s.blank(),t!==process.cwd()&&o){let i=`cd ${Me(o)}`;console.log(` ${d.cyan(i)}${" ".repeat(Math.max(1,27-i.length))}${d.dim("# go into your project folder")}`)}console.log(` ${d.cyan(n)}${" ".repeat(Math.max(1,27-n.length))}${d.dim(`# opens ${a} in this project`)}`),s.blank(),console.log(d.bold(`Some starter prompts for ${a}:`)),s.blank(),console.log(` ${d.cyan(`"Run klaudius doctor and fix anything that's missing or broken, so`)}`),console.log(` ${d.cyan(`I know I'm ready to start using Klaudius."`)}`),s.blank(),console.log(` ${d.cyan('"Open DOCS.html in my browser so I can read the docs."')}`),s.blank(),console.log(` ${d.cyan('"Run the pipeline for one client."')}`),console.log(d.dim(e.outreachEnabled?" \u2192 finds a business, builds their site, deploys it, and pitches them.":" \u2192 finds a business, builds their site, deploys it. Outreach is off \u2014 nothing is sent.")),s.blank(),e.aiAgent!=="codex"&&(console.log(d.dim("Prefer a more comfortable interface than a terminal? Claude Code also comes as")),console.log(d.dim("a desktop app \u2014 same tool, friendlier: https://code.claude.com/docs/en/setup")),s.blank())}import{access as Ro,readFile as vo}from"fs/promises";import{join as Xe,resolve as xo}from"path";import N from"picocolors";async function Jt(e){let t=e.target?xo(process.cwd(),e.target):process.cwd(),o=await qt(Xe(t,".env")),n=await qt(Xe(t,"package.json"));(!o||!n)&&(s.error("This doesn't look like a Klaudius project."),s.detail(`Path: ${t}`),o||s.detail("Missing: .env"),n||s.detail("Missing: package.json"),s.blank(),s.detail("Run `npx klaudius@latest init` to scaffold a new project first,"),s.detail("or cd into an existing project directory and re-run this command."),process.exit(1));let a="claude-code";try{U(await vo(Xe(t,".env"),"utf-8")).AI_AGENT==="codex"&&(a="codex")}catch{}s.heading("Installing dependencies");let i=await Ne(t);s.blank(),s.detail(`npm: ${i.npm}, pip: ${i.pip}, playwright: ${i.playwright}, patchright: ${i.patchright}`);let l=[];if(i.npm==="failed"&&l.push("npm"),i.pip==="failed"&&l.push("pip"),i.playwright==="failed"&&l.push("playwright"),i.patchright==="failed"&&l.push("patchright"),l.length===0){s.blank(),console.log(N.green(N.bold("All dependencies installed."))),console.log(N.dim("Run `npx klaudius@latest doctor` to verify everything else (credentials, files).")),s.blank();return}s.blank(),console.log(N.yellow(N.bold(`${l.join(", ")} still failing.`))),s.blank();for(let[r,w]of Object.entries(i.hints??{}))console.log(N.yellow(`Likely cause of ${r} failure:`)),console.log(N.dim(` ${w}`)),s.blank();let c=a==="codex"?"codex":"claude",p=a==="codex"?"Codex":"Claude Code",m=a==="codex"?"npm install -g @openai/codex":"npm install -g @anthropic-ai/claude-code";console.log(N.dim("Options:")),console.log(N.dim(` \u2022 Open ${p} in this folder (\`${c}\`) and paste:`)),console.log(N.cyan(` "Finish my Klaudius install \u2014 ${l.join(", ")} failed. Debug the install output, retry, then run npx klaudius@latest doctor."`)),console.log(N.dim(` (Don't have ${p} yet? Install with: \`${m}\`)`)),console.log(N.dim(" \u2022 Or run `npx klaudius@latest doctor` for a structured diagnostic.")),console.log(N.dim(" \u2022 Or email hello@klaudius.dev with the last ~20 lines of the install output above.")),s.blank(),process.exitCode=1}async function qt(e){try{return await Ro(e),!0}catch{return!1}}import{readFile as Oo,writeFile as Qe,access as $o}from"fs/promises";import{join as pe}from"path";import*as De from"@clack/prompts";import V from"picocolors";import{mkdir as No}from"fs/promises";async function Xt(e){let t=e.projectRoot??process.cwd(),o=pe(t,".env"),n=pe(t,".mcp.json"),a=pe(t,".codex","config.toml"),i=await Ze(pe(t,".klaudius","manifest.json")),l=await Ze(o);!i&&!l&&(s.error("This doesn't look like a Klaudius project."),s.detail("Expected `.klaudius/manifest.json` or `.env` in this folder. Run `npx klaudius@latest init` first."),process.exit(1));let c=J();c.ok||(s.error(c.message??"Node.js version check failed."),s.blank(),s.detail("Once you've installed Node.js 22.15+, re-run `npx klaudius@latest configure` in this folder."),process.exit(1));let p={};try{let E=await Oo(o,"utf-8");p=U(E)}catch{s.warn("No .env found. Starting from an empty configuration.")}let m=gt(p);De.intro("Reconfigure Klaudius"),s.detail("Press Enter on any prompt to keep its current value."),s.blank();let r=await I(m),w=m.aiAgent??"claude-code";if(r.aiAgent&&r.aiAgent!==w&&(s.error(`Switching AI coding agent (${w} \u2192 ${r.aiAgent}) isn't supported via configure.`),s.detail("configure only rewrites .env / MCP config \u2014 it doesn't restructure the scaffolded files. To switch, run:"),s.blank(),console.log(` ${V.cyan("npx klaudius@latest init <new-folder>")} ${V.dim("# pick the new agent in the wizard")}`),s.blank(),s.detail(".env is unchanged."),process.exit(1)),r.supabaseUrl!==p.SUPABASE_URL||r.supabaseServiceKey!==p.SUPABASE_SERVICE_KEY){s.heading("Re-validating Supabase credentials");let E=await re({url:r.supabaseUrl,serviceKey:r.supabaseServiceKey});E.ok||(s.error(E.message??"Supabase check failed"),s.warn("Aborting. .env not modified."),process.exit(1)),s.success("Supabase credentials accepted")}let g=q(r.googlePlacesApiKey??"");if(g.changed&&r.googlePlacesApiKey){s.heading("Checking your Google Places API key");let E=await le(r.googlePlacesApiKey);if(E.ok){if(g.repairs.length>0){s.warn("Corrected look-alike characters in your Google Places API key:");for(let v of g.repairs)s.detail(` ${v}`);s.detail("These come from keys that were transcribed rather than copied.")}r.googlePlacesApiKey=g.value,s.success("Google accepted the key \u2014 writing the corrected value to .env")}else s.error(E.message??"Google rejected the Google Places API key"),s.warn("Writing the key exactly as you entered it \u2014 nothing has been guessed on your behalf."),s.detail("Re-run `npx klaudius@latest configure` with a key copied straight from the Cloud Console's copy button.")}await Qe(o,Pe(r),"utf-8"),s.success("Updated .env"),r.aiAgent==="codex"?(await No(pe(t,".codex"),{recursive:!0}),await Qe(a,Te(r),"utf-8"),s.success("Updated .codex/config.toml")):(await Qe(n,be(r),"utf-8"),s.success("Updated .mcp.json"),await Le(t,"supabase")),s.blank(),De.outro(V.green("Configuration updated.")),await Lo(t,i)}async function Lo(e,t){let o=await Ze(pe(e,"node_modules"));s.blank(),t?o||(s.detail("Your project files are in place but dependencies aren't installed yet."),s.detail("To finish setup, run:"),s.blank(),console.log(` ${V.cyan("npx klaudius@latest install")} ${V.dim("# (re-)installs npm + pip + browsers; idempotent")}`),s.blank(),s.detail("Then verify with:"),s.blank(),console.log(` ${V.cyan("npx klaudius@latest doctor")} ${V.dim("# checks Node / Python / installers / credentials")}`),s.blank()):(s.detail("Looks like a previous `klaudius init` saved your .env but didn't finish scaffolding."),s.detail("To finish setup, run:"),s.blank(),console.log(` ${V.cyan("npx klaudius@latest init")} ${V.dim("# pick Resume when prompted")}`),s.blank())}async function Ze(e){try{return await $o(e),!0}catch{return!1}}import{copyFile as Qt,mkdir as Zt,readdir as Mo,readFile as Do,rm as ye,writeFile as en,access as tn}from"fs/promises";import{dirname as nn,join as L,relative as Uo}from"path";import{tmpdir as jo}from"os";import*as fe from"@clack/prompts";import et from"picocolors";var Ue="0.19.1";async function on(e){let t=e.projectRoot??process.cwd(),o=await wt(t);o||(s.error("This doesn't look like a Klaudius project."),s.detail("Expected `.klaudius/manifest.json`. Run `npx klaudius@latest init` first."),process.exit(1));for(let k of _e)delete o.files[k];let n,a=L(t,".env"),i,l;try{i=await Do(a,"utf-8"),l=U(i)}catch{s.error("Couldn't read .env from this directory."),s.detail("Are you running `klaudius update` from inside a Klaudius project?"),process.exit(1)}n=l.KLAUDIUS_LICENSE_KEY??"",n||(s.error("Couldn't find KLAUDIUS_LICENSE_KEY in your .env file."),s.detail("This file is created by `npx klaudius@latest init`. If your project predates"),s.detail("the licence-gated template (CLI version 0.1.x), re-run `npx klaudius@latest init`"),s.detail("in a sibling directory, then copy KLAUDIUS_LICENSE_KEY from its .env."),process.exit(1));let c=ht(i,l,mt);c!==null&&(await en(a,c,"utf-8"),s.detail("Backfilled new env keys")),await ve("update",Ue),fe.intro(`Update from ${o.templateVersion} \u2192 ${Ue}`);let m=l.AI_AGENT==="codex"?"codex":"claude-code",r=L(jo(),`klaudius-update-${process.pid}-${Date.now()}`),w;try{s.heading("Downloading the latest Klaudius template");let k=await Re({licenseKey:n,machineId:ge(),hostname:process.env.HOSTNAME??process.env.COMPUTERNAME,os:`${process.platform}-${process.arch}`,agent:m,destDir:r});s.success(`Fetched ${k.filesExtracted} canonical files`),w=r}catch(k){s.error(k.message),s.detail("Update aborted. Your project is unchanged."),await ye(r,{recursive:!0,force:!0}).catch(()=>{}),process.exit(1)}let g=await Ho(w,t,o),E=g.filter(k=>k.state==="new"),v=g.filter(k=>k.state==="clean-update"),oe=g.filter(k=>k.state==="user-only"),M=g.filter(k=>k.state==="conflict"),Y=g.filter(k=>k.state==="no-change"),b=g.filter(k=>k.state==="removed-clean"),P=g.filter(k=>k.state==="removed-modified"),$=[...M,...P];if(s.blank(),s.heading("Change summary"),s.detail(`${B(Y.length,"file")} unchanged`),s.detail(`${B(E.length,"new file")}`),s.detail(`${B(v.length,"file")} updated cleanly (no local edits)`),s.detail(`${B(oe.length,"file")} you've edited (no upstream change \u2014 left alone)`),s.detail(`${B(b.length,"file")} removed upstream (deleted cleanly)`),s.detail(`${B(M.length,"file")} with conflicts (you edited AND we have a new version)`),s.detail(`${B(P.length,"file")} removed upstream but edited locally (need your decision)`),E.length===0&&v.length===0&&b.length===0&&$.length===0){s.blank(),fe.outro(et.green("Already up to date.")),await ye(r,{recursive:!0,force:!0}).catch(()=>{});return}s.blank(),s.heading("Applying clean updates");for(let k of[...E,...v]){let G=L(w,k.path),u=L(t,k.path);await Zt(nn(u),{recursive:!0}),await Qt(G,u),o.files[k.path]=k.canonicalHash}E.length+v.length>0&&s.success(`Wrote ${B(E.length+v.length,"file")}`);for(let k of b){let G=L(t,k.path);await ye(G,{force:!0}),delete o.files[k.path]}if(b.length>0&&s.success(`Deleted ${B(b.length,"file")} removed upstream`),$.length>0){s.blank(),s.heading(`${$.length} conflict(s) need resolution`);let k=L(t,".klaudius","incoming");try{await ye(k,{recursive:!0,force:!0})}catch{}for(let G of M){let u=L(w,G.path),h=L(k,G.path);await Zt(nn(h),{recursive:!0}),await Qt(u,h)}await en(L(t,".klaudius","conflicts.md"),Ko($,o.templateVersion,Ue),"utf-8"),M.length>0&&s.detail("Staged canonical versions to .klaudius/incoming/"),s.detail("Wrote conflict report to .klaudius/conflicts.md")}if(o.updatedAt=new Date().toISOString(),$.length===0&&(o.templateVersion=Ue),await Se(t,o),s.blank(),$.length===0)fe.outro(et.green("Update complete."));else{let k=m==="codex"?"Codex":"Claude Code";fe.outro(et.yellow(`${$.length} conflict(s) staged. Open ${k} in this project and ask:
|
|
78
78
|
"Run /resolve-conflicts"`))}await ye(r,{recursive:!0,force:!0}).catch(()=>{})}async function Ho(e,t,o){let n=await sn(e),a=new Set(n),i=[];for(let l of n){let c=await ae(L(e,l)),p=o.files[l],m=L(t,l),r;try{await tn(m),r=await ae(m)}catch{i.push({path:l,state:"new",canonicalHash:c,manifestHash:p});continue}c===p?r===p?i.push({path:l,state:"no-change",canonicalHash:c,localHash:r,manifestHash:p}):i.push({path:l,state:"user-only",canonicalHash:c,localHash:r,manifestHash:p}):r===p?i.push({path:l,state:"clean-update",canonicalHash:c,localHash:r,manifestHash:p}):i.push({path:l,state:"conflict",canonicalHash:c,localHash:r,manifestHash:p})}for(let l of Object.keys(o.files)){if(a.has(l))continue;let c=o.files[l],p=L(t,l),m;try{await tn(p),m=await ae(p)}catch{delete o.files[l];continue}m===c?i.push({path:l,state:"removed-clean",localHash:m,manifestHash:c}):i.push({path:l,state:"removed-modified",localHash:m,manifestHash:c})}return i}function B(e,t){return`${e} ${t}${e===1?"":"s"}`}async function sn(e,t=e){let o=await Mo(e,{withFileTypes:!0}),n=[];for(let a of o){let i=L(e,a.name);a.isDirectory()?n.push(...await sn(i,t)):a.isFile()&&n.push(Uo(t,i))}return n}function Ko(e,t,o){let n=e.filter(c=>c.state==="conflict").length,a=e.filter(c=>c.state==="removed-modified").length,i=[];i.push("# Update Conflicts"),i.push(""),i.push(`Generated by \`npx klaudius@latest update\` on ${new Date().toISOString()}.`),i.push(`Updating from canonical version **${t}** to **${o}**.`),i.push("");let l=[];n>0&&l.push(`${n} file${n===1?"":"s"} ha${n===1?"s":"ve"} BOTH local edits AND upstream changes`),a>0&&l.push(`${a} file${a===1?"":"s"} ${a===1?"was":"were"} removed upstream but edited locally`),i.push(l.join(", and ")+"."),i.push("Open Claude Code in this project and run `/resolve-conflicts` \u2014 that skill walks through each conflict interactively, helping you decide what to keep, take, merge, or delete."),i.push(""),i.push("---"),i.push("");for(let c of e)i.push(`## ${c.path}`),i.push(""),c.state==="removed-modified"?(i.push("**Type:** Removed upstream"),i.push(""),i.push(`- Your local copy: \`${c.path}\``),i.push("- This file no longer exists in the canonical template."),i.push("- You've modified it locally since install."),i.push(`- Hash at last install/update: \`${(c.manifestHash??"(none)").slice(0,16)}\``),i.push(`- Your local hash now: \`${(c.localHash??"(missing)").slice(0,16)}\``),i.push(""),i.push("**Resolution options for the SKILL to walk through:**"),i.push(""),i.push("1. Keep mine \u2014 leave the file in place; stop tracking it in the manifest"),i.push("2. Delete \u2014 remove the file from disk and from the manifest")):(i.push("**Type:** Edit conflict"),i.push(""),i.push(`- Your version (with your local edits): \`${c.path}\``),i.push(`- New canonical version: \`.klaudius/incoming/${c.path}\``),i.push(`- Hash at last install/update: \`${(c.manifestHash??"(none)").slice(0,16)}\``),i.push(`- Your local hash now: \`${(c.localHash??"(missing)").slice(0,16)}\``),i.push(`- New canonical hash: \`${(c.canonicalHash??"(none)").slice(0,16)}\``),i.push(""),i.push("**Resolution options for the SKILL to walk through:**"),i.push(""),i.push("1. Keep mine \u2014 discard the new canonical changes"),i.push("2. Take canonical \u2014 overwrite my edits with the new version"),i.push("3. Merge \u2014 review both side-by-side and produce a combined version")),i.push(""),i.push("---"),i.push("");return i.join(`
|
|
79
79
|
`)}import{access as Fo,readFile as an,stat as Go}from"fs/promises";import{join as F}from"path";import R from"picocolors";import{spawn as rn}from"child_process";async function ln(e){let t=e.projectRoot??process.cwd(),o=[];console.log(R.bold(`Klaudius doctor \u2014 checking your project\u2026
|
|
80
80
|
`)),o.push(await Vo()),o.push(await Bo());let n=F(t,".env"),a=F(t,".klaudius","manifest.json"),i=F(t,".mcp.json"),l=F(t,".codex","config.toml"),c=await Q(n),p=await Q(a),m="claude-code";if(c)try{U(await an(n,"utf-8")).AI_AGENT==="codex"&&(m="codex")}catch{}if(m==="claude-code"){let g=await Q(F(t,"AGENTS.md")),E=!await Q(F(t,".claude"));g&&E&&(m="codex")}if(o.push({name:".env present",status:c?"ok":"fail",detail:c?n:"missing",nextAction:c?void 0:"Run `npx klaudius@latest init` in this folder."}),o.push({name:"Template scaffolded (.klaudius/manifest.json)",status:p?"ok":"fail",detail:p?a:"missing",nextAction:p?void 0:c?"Init didn't finish \u2014 run `npx klaudius@latest init` and pick Resume.":"Run `npx klaudius@latest init`."}),m==="codex"){let g=await Q(l);o.push({name:".codex/config.toml present",status:g?"ok":"warn",detail:g?l:"missing",nextAction:g?void 0:"Run `npx klaudius@latest configure` to regenerate."})}else{let g=await Q(i);o.push({name:".mcp.json present",status:g?"ok":"warn",detail:g?i:"missing",nextAction:g?void 0:"Run `npx klaudius@latest configure` to regenerate."})}if(o.push(await Qo(m)),o.push(await Wo(t)),o.push(await Yo(t)),o.push(await zo()),!c)o.push({name:"Credential validations",status:"skip",detail:".env missing"});else if(e.offline)o.push({name:"Credential validations",status:"skip",detail:"--offline set"});else{let g=await an(n,"utf-8"),E=U(g);await qo(E,o)}console.log();for(let g of o){let E=g.status==="ok"?R.green("\u2713"):g.status==="warn"?R.yellow("\u26A0"):g.status==="skip"?R.dim("\xB7"):R.red("\u2717");console.log(` ${E} ${g.name}${g.detail?R.dim(` \u2014 ${g.detail}`):""}`),g.nextAction&&console.log(` ${R.dim("\u2192")} ${R.cyan(g.nextAction)}`)}let r=o.filter(g=>g.status==="fail").length,w=o.filter(g=>g.status==="warn").length;console.log(),r===0&&w===0?console.log(R.green(R.bold("Everything checks out. You're good to go."))):r===0?console.log(R.yellow(R.bold(`${w} warning${w===1?"":"s"} \u2014 review above.`))):(console.log(R.red(R.bold(`${r} failed check${r===1?"":"s"} \u2014 see the \u2192 next actions above.`))),process.exitCode=1),console.log()}async function Q(e){try{return await Fo(e),!0}catch{return!1}}async function Vo(){let e=await ie();return e.ok?{name:"Python \u2265 3.10",status:"ok",detail:e.version}:{name:"Python \u2265 3.10",status:"fail",detail:e.version??"not found",nextAction:"Install Python 3.10+ from https://www.python.org/downloads/"}}async function Bo(){let e=process.version,t=/^v(\d+)\.(\d+)\.(\d+)$/.exec(e);if(!t)return{name:"Node \u2265 22.15",status:"warn",detail:e};let o=parseInt(t[1],10),n=parseInt(t[2],10);return o<22||o===22&&n<15?{name:"Node \u2265 22.15",status:"fail",detail:e,nextAction:"Upgrade Node.js to 22.15+ from https://nodejs.org/"}:{name:"Node \u2265 22.15",status:"ok",detail:e}}async function Wo(e){let t=F(e,"node_modules");if(!await Q(t))return{name:"node_modules installed",status:"fail",detail:"missing",nextAction:"Run `npx klaudius@latest install` in this folder."};try{if(!(await Go(t)).isDirectory())return{name:"node_modules installed",status:"warn",detail:"exists but isn't a directory"}}catch{}return{name:"node_modules installed",status:"ok"}}async function Yo(e){let t=process.platform==="darwin"?F(process.env.HOME??"","Library","Caches","ms-playwright"):process.platform==="win32"?F(process.env.USERPROFILE??"","AppData","Local","ms-playwright"):F(process.env.HOME??"",".cache","ms-playwright");return await Q(t)?{name:"Playwright browser installed",status:"ok",detail:t}:{name:"Playwright browser installed",status:"fail",detail:"no browser cache found",nextAction:"Run `npx playwright install chromium` in this folder."}}async function zo(){let e=["supabase","dotenv","requests","httpx","PIL"],t=`import sys
|
|
@@ -90,4 +90,4 @@ except Exception as e:
|
|
|
90
90
|
`));let i=es(process.execPath,[o,"pair","--account",a],{cwd:t,stdio:"inherit"});if(i.status===0){console.log(O.green(`Paired '${a}'.`)),console.log(O.dim(`
|
|
91
91
|
If you haven't already, add '${a}' to WHATSAPP_ACCOUNTS in .env so /outreach round-robins to it. Example:
|
|
92
92
|
WHATSAPP_ACCOUNTS=primary,${a}
|
|
93
|
-
(Skip this if '${a}' is already there or you set it via the init wizard.)`));return}i.error?console.error(O.red(`Pair failed: ${i.error.message}`)):(console.error(O.red(`Pair did not complete (exit ${i.status??"signalled"}). Common causes:`)),console.error(O.dim(" - QR scan window timed out: re-run and scan promptly.")),console.error(O.dim(" - WhatsApp's 4-linked-device limit: open WhatsApp \u2192 Settings \u2192 Linked Devices, unlink an unused entry, then re-run.")),console.error(O.dim(` - Existing daemon couldn't be stopped: check the log at ~/.klaudius/whatsapp/${a}/daemon.log`))),process.exit(i.status??1)}import{spawnSync as os}from"child_process";var tt="--use-system-ca";function un(){let e=process.env.NODE_OPTIONS??"";if(e.includes(tt)||!J().ok)return;let o=e?`${e} ${tt}`:tt,n=os(process.execPath,[...process.execArgv,...process.argv.slice(1)],{env:{...process.env,NODE_OPTIONS:o},stdio:"inherit"});n.signal&&(process.kill(process.pid,n.signal),process.exit(1)),process.exit(n.status??1)}un();var is="0.19.
|
|
93
|
+
(Skip this if '${a}' is already there or you set it via the init wizard.)`));return}i.error?console.error(O.red(`Pair failed: ${i.error.message}`)):(console.error(O.red(`Pair did not complete (exit ${i.status??"signalled"}). Common causes:`)),console.error(O.dim(" - QR scan window timed out: re-run and scan promptly.")),console.error(O.dim(" - WhatsApp's 4-linked-device limit: open WhatsApp \u2192 Settings \u2192 Linked Devices, unlink an unused entry, then re-run.")),console.error(O.dim(` - Existing daemon couldn't be stopped: check the log at ~/.klaudius/whatsapp/${a}/daemon.log`))),process.exit(i.status??1)}import{spawnSync as os}from"child_process";var tt="--use-system-ca";function un(){let e=process.env.NODE_OPTIONS??"";if(e.includes(tt)||!J().ok)return;let o=e?`${e} ${tt}`:tt,n=os(process.execPath,[...process.execArgv,...process.argv.slice(1)],{env:{...process.env,NODE_OPTIONS:o},stdio:"inherit"});n.signal&&(process.kill(process.pid,n.signal),process.exit(1)),process.exit(n.status??1)}un();var is="0.19.1",W=new ss;W.name("klaudius").description("Scaffold and maintain a Klaudius pipeline project").version(is);W.command("preflight").description("Check this machine can run Klaudius (Node, Python, pip, npm, network) \u2014 no project or license needed. Safe for an AI assistant to run, fix, and re-run before init.").action(async()=>{try{await ut({})}catch(e){console.error("preflight failed:",e.message),process.exit(1)}});W.command("init").description("Scaffold a new Klaudius project").argument("[target]","Directory to create (defaults to current directory)",".").option("--license <key>","License key (received in your purchase confirmation email)").option("--skip-install","Skip npm/pip/playwright installation").option("--skip-schema","Skip applying schema.sql to your Supabase project").action(async(e,t)=>{try{await zt({target:e,license:t.license,skipInstall:!!t.skipInstall,skipSchema:!!t.skipSchema})}catch(o){console.error("init failed:",o.message),process.exit(1)}});W.command("install").description("Re-run dependency installers against an already-scaffolded project (npm, pip, playwright, patchright)").argument("[target]","Project directory (defaults to current directory)").action(async e=>{try{await Jt({target:e})}catch(t){console.error("install failed:",t.message),process.exit(1)}});W.command("configure").description("Re-run the setup wizard with current values pre-filled").action(async()=>{try{await Xt({})}catch(e){console.error("configure failed:",e.message),process.exit(1)}});W.command("update").description("Pull latest template; produce a conflicts report for any files you've modified").action(async()=>{try{await on({})}catch(e){console.error("update failed:",e.message),process.exit(1)}});W.command("doctor").description("Diagnose a broken install \u2014 env versions, files, installed deps, credentials").option("--offline","Skip credential validations that require network calls").action(async e=>{try{await ln({offline:!!e.offline})}catch(t){console.error("doctor failed:",t.message),process.exit(1)}});W.command("pair-whatsapp").description("Link a WhatsApp account to this project (or re-pair if it logged out)").option("--label <name>","Account label (default: primary). Should match a value in WHATSAPP_ACCOUNTS.","primary").action(async e=>{try{await dn({label:e.label})}catch(t){console.error("pair-whatsapp failed:",t.message),process.exit(1)}});W.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "klaudius",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Scaffold and maintain a Klaudius project — an autonomous web agency pipeline that runs on Claude Code (find, build, deploy, outreach end-to-end).",
|
|
5
5
|
"homepage": "https://klaudius.dev",
|
|
6
6
|
"bugs": {
|