klaudius 0.12.3 → 0.13.0
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 y,e as ee}from"./chunk-SZ4KCTSL.js";import{useEffect as
|
|
1
|
+
import{a as y,e as ee}from"./chunk-SZ4KCTSL.js";import{useEffect as ea,useMemo as aa,useRef as Q,useState as M}from"react";import{Box as P,Text as E,useApp as na,useInput as ta}from"ink";var ae={gmail:{label:"Gmail",smtpHost:"smtp.gmail.com",smtpPort:587,imapHost:"imap.gmail.com",imapPort:993,sentFolder:"[Gmail]/Sent Mail",inboxFolder:"INBOX",appPasswordHelp:`Generate at https://myaccount.google.com/apppasswords
|
|
2
2
|
(2-step verification must be enabled on your Google account first;
|
|
3
3
|
Google won't accept your normal account password from third-party apps).`},outlook:{label:"Outlook / Office 365",smtpHost:"smtp-mail.outlook.com",smtpPort:587,imapHost:"outlook.office365.com",imapPort:993,sentFolder:"Sent Items",inboxFolder:"INBOX",appPasswordHelp:`Generate at https://account.microsoft.com/security \u2192 Advanced security options \u2192 App passwords
|
|
4
4
|
(2-step verification must be enabled first).`},ionos:{label:"IONOS",smtpHost:"smtp.ionos.co.uk",smtpPort:587,imapHost:"imap.ionos.co.uk",imapPort:993,sentFolder:"Sent Items",inboxFolder:"INBOX",appPasswordHelp:`Use your normal IONOS mailbox password.
|
|
@@ -6,7 +6,14 @@ Google won't accept your normal account password from third-party apps).`},outlo
|
|
|
6
6
|
(Fastmail requires app passwords for IMAP/SMTP regardless of 2FA setting.)`},zoho:{label:"Zoho Mail",smtpHost:"smtp.zoho.com",smtpPort:587,imapHost:"imap.zoho.com",imapPort:993,sentFolder:"Sent",inboxFolder:"INBOX",appPasswordHelp:`Generate at https://accounts.zoho.com/u/h#security/app_passwords
|
|
7
7
|
(Zoho requires app passwords for IMAP/SMTP \u2014 your normal account password won't work.)`}},ne=`Use the app-specific password your provider issues for SMTP/IMAP
|
|
8
8
|
(check their security settings \u2014 most providers require a generated password
|
|
9
|
-
rather than your normal account password).`;var Pe=[{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"]}],Ae=[{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 te(e){if(!e)return;let a=B(e);for(let t of Pe)if(B(t.country)===a||t.aliases?.some(n=>B(n)===a))return t}function oe(e){if(!e)return;let a=B(e);for(let t of Ae)if(B(t.language)===a||t.aliases?.some(n=>B(n)===a))return t}var L=class extends Error{constructor(){super("user pressed back"),this.name="BackSignal"}},H=class extends Error{constructor(){super("user cancelled"),this.name="CancelSignal"}},Ie="Include the country code with a + (e.g. +12025550123 for US, +447123456789 for UK)",se=e=>/^\+\d{8,15}$/.test(e)?void 0:Ie,Te=e=>/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e)?void 0:"Enter a valid email",N=e=>a=>a.trim().length===0?`${e} is required`:void 0,Ee="one-off, no monthly fees",ie="per month";function U(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 xe={id:"location",title:"Location & language",isApplicable:()=>!0,execute:async(e,{prompt:a,info:t})=>{t({title:"Which country are you finding businesses in?",body:`Klaudius searches Google Maps in this country, writes outreach in
|
|
9
|
+
rather than your normal account password).`;var Pe=[{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"]}],Ae=[{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 te(e){if(!e)return;let a=B(e);for(let t of Pe)if(B(t.country)===a||t.aliases?.some(n=>B(n)===a))return t}function oe(e){if(!e)return;let a=B(e);for(let t of Ae)if(B(t.language)===a||t.aliases?.some(n=>B(n)===a))return t}var L=class extends Error{constructor(){super("user pressed back"),this.name="BackSignal"}},H=class extends Error{constructor(){super("user cancelled"),this.name="CancelSignal"}},Ie="Include the country code with a + (e.g. +12025550123 for US, +447123456789 for UK)",ie=e=>/^\+\d{8,15}$/.test(e)?void 0:Ie,Te=e=>/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e)?void 0:"Enter a valid email",N=e=>a=>a.trim().length===0?`${e} is required`:void 0,Ee="one-off, no monthly fees",se="per month";function U(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 xe={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
|
|
10
|
+
(Anthropic) and Codex (OpenAI). Pick whichever you already pay for, or
|
|
11
|
+
default to Claude Code if you don't have either yet (it's the most-tested
|
|
12
|
+
path, and the one the docs are written for).
|
|
13
|
+
|
|
14
|
+
This choice only changes which agent runs the pipeline. Everything else \u2014
|
|
15
|
+
the businesses found, the websites built, the outreach sent \u2014 is identical
|
|
16
|
+
either way. You can switch later by re-running init in a fresh folder.`}),{aiAgent:await a({type:"select",message:"Which AI coding agent will drive Klaudius?",initialValue:e.aiAgent??"claude-code",options:[{value:"claude-code",label:"Claude Code (Anthropic) \u2014 default, most tested"},{value:"codex",label:"Codex (OpenAI)"}]})})},Me={id:"location",title:"Location & language",isApplicable:()=>!0,execute:async(e,{prompt:a,info:t})=>{t({title:"Which country are you finding businesses in?",body:`Klaudius searches Google Maps in this country, writes outreach in
|
|
10
17
|
this country's language, and builds sites in this country's language.
|
|
11
18
|
This is the country your customers are in \u2014 not necessarily where
|
|
12
19
|
you live.
|
|
@@ -18,12 +25,12 @@ You can run the pipeline against more than one country from the same
|
|
|
18
25
|
install (\`/find Barcelona\` from a UK install works fine), but
|
|
19
26
|
starting with one market makes it easier to learn that market's
|
|
20
27
|
outreach rhythm. You can change this any time via
|
|
21
|
-
\`npx klaudius configure\`.`});let n="__other__",r=[{value:"the United Kingdom",label:"United Kingdom"},{value:"the United States",label:"United States"},{value:"Italy",label:"Italy"},{value:"Spain",label:"Spain"},{value:"France",label:"France"},{value:"Germany",label:"Germany"},{value:"Ireland",label:"Ireland"},{value:"the Netherlands",label:"Netherlands"},{value:"Belgium",label:"Belgium"},{value:"Portugal",label:"Portugal"},{value:"Switzerland",label:"Switzerland"},{value:"Austria",label:"Austria"},{value:"Canada",label:"Canada"},{value:"Australia",label:"Australia"},{value:"New Zealand",label:"New Zealand"},{value:"Mexico",label:"Mexico"},{value:"Brazil",label:"Brazil"},{value:"Sweden",label:"Sweden"},{value:"Poland",label:"Poland"},{value:n,label:"Other (type it in)"}],
|
|
28
|
+
\`npx klaudius configure\`.`});let n="__other__",r=[{value:"the United Kingdom",label:"United Kingdom"},{value:"the United States",label:"United States"},{value:"Italy",label:"Italy"},{value:"Spain",label:"Spain"},{value:"France",label:"France"},{value:"Germany",label:"Germany"},{value:"Ireland",label:"Ireland"},{value:"the Netherlands",label:"Netherlands"},{value:"Belgium",label:"Belgium"},{value:"Portugal",label:"Portugal"},{value:"Switzerland",label:"Switzerland"},{value:"Austria",label:"Austria"},{value:"Canada",label:"Canada"},{value:"Australia",label:"Australia"},{value:"New Zealand",label:"New Zealand"},{value:"Mexico",label:"Mexico"},{value:"Brazil",label:"Brazil"},{value:"Sweden",label:"Sweden"},{value:"Poland",label:"Poland"},{value:n,label:"Other (type it in)"}],i=e.country??"",o=r.some(b=>b.value===i),u=await a({type:"select",message:"Which country's businesses will Klaudius search for?",initialValue:o?i:i?n:"the United Kingdom",options:r}),s;u===n?s=await a({type:"text",message:"Type the country name (any common form is fine)",placeholder:"e.g. South Africa, Greece, Brazil",initialValue:o?"":i,validate:b=>b.trim().length===0?"Country is required":void 0,note:{title:"Free-form country",body:`We'll match what you type against our country lookup (covers all
|
|
22
29
|
ISO 3166 sovereign states + common territories like Hong Kong and
|
|
23
30
|
Puerto Rico). If we don't recognise the name, we'll ask you to type
|
|
24
31
|
the 2-letter ISO country code directly on the next prompt \u2014 the
|
|
25
32
|
same code Google Places uses for region biasing. Aliases like 'uk',
|
|
26
|
-
'usa', 'italia', 'maroc' all match.`}}):
|
|
33
|
+
'usa', 'italia', 'maroc' all match.`}}):s=u;let l=te(s),d;l?d=l.code:d=(await a({type:"text",message:`What's the 2-letter ISO country code for ${s}?`,placeholder:"e.g. ID for Indonesia, ZA for South Africa, JO for Jordan",initialValue:e.countryCode??"",validate:b=>{let O=b.trim().toUpperCase();if(!/^[A-Z]{2}$/.test(O))return"Must be exactly 2 letters (ISO 3166-1 alpha-2 format)"},note:{title:`ISO code for ${s}`,body:`We didn't recognise "${s}" in our country lookup, so we need the
|
|
27
34
|
2-letter ISO 3166-1 alpha-2 code directly. Google Places uses this
|
|
28
35
|
for region biasing on every search.
|
|
29
36
|
|
|
@@ -33,7 +40,7 @@ Quick reference for less common markets:
|
|
|
33
40
|
Indonesia \u2192 ID Vietnam \u2192 VN Thailand \u2192 TH Egypt \u2192 EG
|
|
34
41
|
Kenya \u2192 KE Nigeria \u2192 NG Pakistan \u2192 PK Iran \u2192 IR
|
|
35
42
|
Saudi Arabia \u2192 SA Russia \u2192 RU Ukraine \u2192 UA Israel \u2192 IL`}})).trim().toUpperCase();let w=e.language??l?.language??"English",f=await a({type:"text",message:"What language should outreach + websites be written in?",placeholder:"e.g. Italian, Spanish, English",initialValue:w,validate:b=>b.trim().length===0?"Language is required":void 0,note:{title:"Outreach + website language",body:l?`Defaulting to ${w} (the usual operator-facing language
|
|
36
|
-
for ${
|
|
43
|
+
for ${s}). Edit this if you'd rather write in something else \u2014
|
|
37
44
|
e.g. an English-speaking operator running on Spain might pick "Spanish"
|
|
38
45
|
to localise everything, or might pick "English" to keep their own voice.
|
|
39
46
|
Klaudius will use this language for every outreach message it sends and
|
|
@@ -47,17 +54,17 @@ site.
|
|
|
47
54
|
Most languages have a 2-letter ISO 639-1 code. A few (Filipino \u2192
|
|
48
55
|
"fil") use the 3-letter ISO 639-3 / BCP 47 code instead.
|
|
49
56
|
|
|
50
|
-
Full list: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes`}})).trim().toLowerCase(),{country:l?l.country:
|
|
57
|
+
Full list: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes`}})).trim().toLowerCase(),{country:l?l.country:s.trim(),countryCode:d,language:A?A.language:f.trim(),languageCode:I}}},Oe={id:"pricing",title:"Pricing",isApplicable:()=>!0,execute:async(e,{prompt:a})=>{let t=e.pricingTerms===se,n=t?"":e.pricing??"$999",r=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
|
|
51
58
|
leave blank) if you only want to charge a monthly fee. You can
|
|
52
59
|
also add a recurring monthly fee on the next prompt \u2014 combining
|
|
53
60
|
the two is fine (e.g. $499 upfront + $49/month).
|
|
54
61
|
|
|
55
62
|
Use the currency that matches your clients' region. Klaudius
|
|
56
|
-
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:r,validate:w=>{if(U(
|
|
63
|
+
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:r,validate:w=>{if(U(i)&&U(w))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
|
|
57
64
|
a recurring monthly fee \u2014 either on its own (if upfront was 0)
|
|
58
|
-
or alongside the upfront fee.`}}),c=U(
|
|
65
|
+
or alongside the upfront fee.`}}),c=U(i),u=U(o),s,l,d;return c&&!u?(s=o.trim(),l=se,d=o.trim()):!c&&u?(s=i.trim(),l=Ee,d=void 0):(s=i.trim(),l=`upfront, then ${o.trim()}/month`,d=o.trim()),{pricing:s,pricingTerms:l,pricingMonthly:d}}},Be={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
|
|
59
66
|
run outreach to them automatically (email and/or SMS).
|
|
60
|
-
If you'd rather handle outreach manually, you can skip this here.`}})})},
|
|
67
|
+
If you'd rather handle outreach manually, you can skip this here.`}})})},Ne={id:"operator-name",title:"Sign-off name",isApplicable:e=>e.outreachEnabled===!0,execute:async(e,{prompt:a,info:t})=>(t({title:"Sign-off name",body:`Outreach messages need a sender. Klaudius signs every email, SMS,
|
|
61
68
|
and WhatsApp it sends with this name \u2014 so the businesses you pitch
|
|
62
69
|
see a real human at the bottom of the message, not a generic
|
|
63
70
|
automation.`}),{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:N("Name"),note:{title:"Sign-off name",body:`Klaudius signs off every outreach message and follow-up with this
|
|
@@ -65,10 +72,10 @@ name \u2014 e.g. "Cordiali saluti, Marco" in Italian, "Best, Mike" in
|
|
|
65
72
|
English. Use your first name, your full name, or your business name \u2014
|
|
66
73
|
whatever you want clients to see as the sender.
|
|
67
74
|
|
|
68
|
-
|
|
75
|
+
Klaudius composes the actual sign-off line at message time, picking
|
|
69
76
|
natural phrasing for your language. If you'd rather pin an exact
|
|
70
77
|
sign-off string instead, set SIGNATURE in .env after init (or ask
|
|
71
|
-
|
|
78
|
+
Klaudius to do it for you).`}}),signature:e.signature})},Re={id:"channels",title:"Outreach channels & priority",isApplicable:e=>e.outreachEnabled===!0,execute:async(e,{prompt:a,info:t})=>{t({title:"Outreach channels & priority",body:`Different businesses have different contact methods publicly available \u2014 some
|
|
72
79
|
list only an email, others only a phone number, others use WhatsApp as their
|
|
73
80
|
primary channel. Klaudius lets you opt into multiple channels so it can reach
|
|
74
81
|
more candidates, and you set a priority order for when a candidate has
|
|
@@ -82,9 +89,9 @@ candidate \u2014 so opting into multiple channels also gives you fallback covera
|
|
|
82
89
|
when one channel doesn't work.
|
|
83
90
|
|
|
84
91
|
You'll be asked to pick your first-choice channel now, then optionally a
|
|
85
|
-
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)"},r=["email","sms","whatsapp"],
|
|
92
|
+
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)"},r=["email","sms","whatsapp"],i=e.outreachPriority??[],o=[],c=await a({type:"select",message:"Which channel should Klaudius try FIRST for each candidate?",initialValue:i[0]??"email",options:r.map(u=>({value:u,label:n[u]}))});for(o.push(c);o.length<r.length;){let u=r.filter(f=>!o.includes(f)),s=o.length===1?"second":"third",l=o[o.length-1],d=n[l].replace(/\s*\(.*\)$/,"").toLowerCase(),w=await a({type:"select",message:`Should Klaudius use another channel as ${s} priority (for candidates where ${d} isn't viable or fails)?`,initialValue:i[o.length]??"no",options:[...u.map(f=>({value:f,label:`Yes \u2014 also use ${n[f]}`})),{value:"no",label:"No, that's all"}]});if(w==="no")break;o.push(w)}return{outreachChannels:o,outreachPriority:o}}},Ke={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
|
|
86
93
|
address candidates will see as the sender. Use a domain you control
|
|
87
|
-
(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)"}]}),r=n!=="custom"?ae[n]:void 0,
|
|
94
|
+
(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)"}]}),r=n!=="custom"?ae[n]:void 0,i=await a({type:"text",message:"Email address to send outreach from",placeholder:"you@yourbusiness.com",initialValue:e.emailAddress??"",validate:Te}),o=r?.appPasswordHelp??ne,c=await a({type:"password",message:"Paste the app password",initialValue:e.emailPassword??"",validate:N("App password"),note:{title:"App password",body:`An app password is a separate, single-purpose password that your
|
|
88
95
|
email provider issues for third-party apps like Klaudius. It is NOT
|
|
89
96
|
your normal account login password.
|
|
90
97
|
|
|
@@ -92,7 +99,7 @@ your normal account login password.
|
|
|
92
99
|
|
|
93
100
|
Once generated, it's stored locally in this project's .env file.
|
|
94
101
|
It is never sent to Klaudius's servers \u2014 only to your email
|
|
95
|
-
provider when sending outreach.`}}),u,
|
|
102
|
+
provider when sending outreach.`}}),u,s,l,d,w,f;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:N("SMTP host")});let A=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"});s=parseInt(A,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:N("IMAP host")});let I=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"});d=parseInt(I,10),w=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"}),f=await a({type:"text",message:"Inbox folder name (almost always INBOX)",initialValue:e.emailInboxFolder??"INBOX"})}else u=r.smtpHost,s=r.smtpPort,l=r.imapHost,d=r.imapPort,w=r.sentFolder,f=r.inboxFolder;return{emailProvider:n,emailAddress:i,emailPassword:c,emailFromName:e.name,emailSmtpHost:u,emailSmtpPort:s,emailImapHost:l,emailImapPort:d,emailSentFolder:w,emailInboxFolder:f}}},Le={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:
|
|
96
103
|
|
|
97
104
|
\u2022 macOS iMessage \u2014 free, uses Messages.app on your Mac.
|
|
98
105
|
Reaches other Apple users as iMessage for free. To reach
|
|
@@ -108,7 +115,7 @@ provider when sending outreach.`}}),u,i,l,d,w,f;if(n==="custom"){u=await a({type
|
|
|
108
115
|
|
|
109
116
|
\u2022 Twilio \u2014 cross-platform, ~$0.01 per SMS. Sender is a phone
|
|
110
117
|
number you buy from Twilio. Works on any OS, reaches any
|
|
111
|
-
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)"}]}),r=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:
|
|
118
|
+
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)"}]}),r=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:ie}),i={smsProvider:n,testPhone:r};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:N("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:ie})),i}},Fe={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
|
|
112
119
|
WhatsApp Web works. Setup is a one-time QR scan from the WhatsApp app on
|
|
113
120
|
the phone whose number you want to use. Klaudius will guide you through
|
|
114
121
|
that AFTER this wizard, once npm dependencies are installed.
|
|
@@ -126,7 +133,7 @@ number unless you're comfortable with that.
|
|
|
126
133
|
|
|
127
134
|
You'll be asked how many accounts to link and a short label for each
|
|
128
135
|
(used only locally \u2014 appears in logs, in the .env file, and in this
|
|
129
|
-
project's per-account directory under ~/.klaudius/whatsapp/).`});let n=await a({type:"select",message:"How many WhatsApp numbers do you want to link?",initialValue:String(e.whatsappAccounts?.length??1),options:[{value:"1",label:"1 number (recommended starting point)"},{value:"2",label:"2 numbers (spread load across two)"},{value:"3",label:"3 numbers"},{value:"4",label:"4 numbers"},{value:"5",label:"5 numbers (maximum)"}]}),r=parseInt(n,10),
|
|
136
|
+
project's per-account directory under ~/.klaudius/whatsapp/).`});let n=await a({type:"select",message:"How many WhatsApp numbers do you want to link?",initialValue:String(e.whatsappAccounts?.length??1),options:[{value:"1",label:"1 number (recommended starting point)"},{value:"2",label:"2 numbers (spread load across two)"},{value:"3",label:"3 numbers"},{value:"4",label:"4 numbers"},{value:"5",label:"5 numbers (maximum)"}]}),r=parseInt(n,10),i=["primary","secondary","tertiary","quaternary","quinary"],o=[];for(let c=0;c<r;c++){let u=await a({type:"text",message:r===1?"Label for this WhatsApp account (used only locally \u2014 'primary' is fine)":`Label for WhatsApp account ${c+1} of ${r} (e.g. 'primary', 'uk-1', 'us-east')`,initialValue:e.whatsappAccounts?.[c]??i[c],validate:s=>{let l=s.trim();if(!l)return"Required";if(l.length>30)return"Too long (max 30 characters)";if(l.startsWith("-")||l.endsWith("-"))return"Can't start or end with a hyphen";if(!/^[A-Za-z0-9_-]+$/.test(l))return"Letters, digits, underscore, hyphen only (no spaces)";if(o.includes(l))return"Duplicate label"}});o.push(u.trim())}return{whatsappAccounts:o}}},Ge={id:"vercel",title:"Vercel deployment",isApplicable:()=>!0,execute:async(e,{prompt:a})=>({vercelToken:await a({type:"password",message:"Paste your Vercel API token",initialValue:e.vercelToken??"",validate:n=>n.trim().length===0?"Required \u2014 without this Klaudius can't deploy generated sites":void 0,note:{title:"Vercel deployment",body:`Klaudius deploys every generated client site to Vercel. We use a
|
|
130
137
|
Vercel API token to do this without an interactive login.
|
|
131
138
|
|
|
132
139
|
How to get one (one-time, ~30 seconds):
|
|
@@ -149,7 +156,7 @@ STUCK? Open Claude (or any LLM) in another tab/app and paste:
|
|
|
149
156
|
"I need to create a personal Vercel API token for the
|
|
150
157
|
Klaudius CLI tool. Walk me through generating one at
|
|
151
158
|
vercel.com/account/tokens, including which scope and
|
|
152
|
-
expiration to choose."`}})})},
|
|
159
|
+
expiration to choose."`}})})},ze={id:"supabase",title:"Supabase",isApplicable:()=>!0,execute:async(e,{prompt:a,info:t})=>{t({title:"Supabase setup",body:`Supabase is your CRM. It's where Klaudius records every business it
|
|
153
160
|
finds, where each one sits in your funnel (gathered \u2192 built \u2192 deployed
|
|
154
161
|
\u2192 outreach sent \u2192 responded), and the follow-up state for every lead.
|
|
155
162
|
You can browse it at any time from the Supabase dashboard, or ask
|
|
@@ -187,8 +194,8 @@ in another tab/app and paste this prompt verbatim:
|
|
|
187
194
|
Settings \u2192 Data API \u2192 'API URL'
|
|
188
195
|
|
|
189
196
|
It looks like https://xxxx.supabase.co. Click to copy and paste
|
|
190
|
-
below.`}})).trim().replace(/\/rest\/v1\/?$/i,"").replace(/\/$/,""),
|
|
191
|
-
https://supabase.com/dashboard/project/${
|
|
197
|
+
below.`}})).trim().replace(/\/rest\/v1\/?$/i,"").replace(/\/$/,""),i=r.match(/^https:\/\/([a-z0-9]+)\.supabase\.co/i)?.[1]??"",o=await a({type:"password",message:"Paste the Supabase secret key (sb_secret_\u2026)",initialValue:e.supabaseServiceKey??"",validate:u=>{let s=u.trim();if(s.length<20)return"Looks too short";if(s.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(!s.startsWith("sb_secret_")&&!s.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:
|
|
198
|
+
https://supabase.com/dashboard/project/${i}/settings/api-keys
|
|
192
199
|
|
|
193
200
|
Under 'Secret keys', find the row whose value starts with
|
|
194
201
|
'sb_secret_'. Click to copy the full value.
|
|
@@ -209,7 +216,7 @@ Open this exact page:
|
|
|
209
216
|
Click 'Generate new token', name it 'Klaudius', and set the
|
|
210
217
|
expiration to 'Never' (recommended \u2014 saves you having to rotate
|
|
211
218
|
it later). Copy the value (starts with 'sbp_') and paste it
|
|
212
|
-
below.`}});return{supabaseUrl:r,supabaseServiceKey:o,supabasePat:c,supabaseProjectRef:
|
|
219
|
+
below.`}});return{supabaseUrl:r,supabaseServiceKey:o,supabasePat:c,supabaseProjectRef:i}}},Ve={id:"google-places",title:"Google Places API",isApplicable:()=>!0,execute:async(e,{prompt:a})=>({googlePlacesApiKey:await a({type:"password",message:"Paste your Google Places API key",placeholder:"AIzaSy\u2026",initialValue:e.googlePlacesApiKey??"",validate:n=>n.trim().length===0?"Required \u2014 without this Klaudius can't find candidates":void 0,note:{title:"Google Places API key",body:`Klaudius's /find skill queries Google's Places API to discover businesses
|
|
213
220
|
without websites in your target region. Without a key, the pipeline has
|
|
214
221
|
no source of leads \u2014 so this is required.
|
|
215
222
|
|
|
@@ -245,7 +252,7 @@ STUCK? Open Claude (or any LLM) in another tab/app and paste this prompt:
|
|
|
245
252
|
"I need a Google Places API (New) key for a CLI tool called
|
|
246
253
|
Klaudius. Walk me through claiming the $300 Google Cloud free trial
|
|
247
254
|
and getting the API key Google auto-generates after enabling
|
|
248
|
-
Places API (New), including any signup gotchas."`}})})},
|
|
255
|
+
Places API (New), including any signup gotchas."`}})})},Ue={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
|
|
249
256
|
candidate replies. This is OPTIONAL \u2014 skip it if you'd rather check
|
|
250
257
|
the Supabase dashboard manually.
|
|
251
258
|
|
|
@@ -264,7 +271,7 @@ How to create one:
|
|
|
264
271
|
'KlaudiusNotifierBot'). Each username has to be globally
|
|
265
272
|
unique, so add a personal suffix if it's taken.
|
|
266
273
|
6. BotFather replies with a token like
|
|
267
|
-
'1234567890:AAEhBP_yourtokenhere\u2026'. Copy it and paste below.`}}),r=null,
|
|
274
|
+
'1234567890:AAEhBP_yourtokenhere\u2026'. Copy it and paste below.`}}),r=null,i=0,o=null,c=null;for(;r===null;){i++;let u=i>1,s=c==="network"?`${o}
|
|
268
275
|
|
|
269
276
|
This is usually a network problem on your end (corporate WiFi or VPN
|
|
270
277
|
blocking Telegram, ISP DNS issue, a momentary drop). Check your
|
|
@@ -273,7 +280,7 @@ to retry.`:`${o}
|
|
|
273
280
|
|
|
274
281
|
Make sure you sent a regular text message (e.g. 'hi'), not
|
|
275
282
|
just a /start tap \u2014 /start alone doesn't always register.
|
|
276
|
-
Then press Enter to retry.`;await a({type:"text",message:u?c==="network"?"Check your network, then press Enter to retry":"Send another message to the bot, then press Enter to retry":"Send a message to your bot, then press Enter to detect chat ID",initialValue:"",placeholder:"(press Enter when you've sent the message)",validate:()=>{},note:{title:u?"Detect chat ID \u2014 retry":"Detect chat ID",body:u?
|
|
283
|
+
Then press Enter to retry.`;await a({type:"text",message:u?c==="network"?"Check your network, then press Enter to retry":"Send another message to the bot, then press Enter to retry":"Send a message to your bot, then press Enter to detect chat ID",initialValue:"",placeholder:"(press Enter when you've sent the message)",validate:()=>{},note:{title:u?"Detect chat ID \u2014 retry":"Detect chat ID",body:u?s:`Klaudius will auto-detect your chat ID by asking Telegram for
|
|
277
284
|
any messages your bot has received. To make that work:
|
|
278
285
|
|
|
279
286
|
1. In the Telegram app, search for the bot you just created
|
|
@@ -282,5 +289,5 @@ any messages your bot has received. To make that work:
|
|
|
282
289
|
If the chat starts with a 'Start' button, tap that first,
|
|
283
290
|
THEN send 'hi'. /start alone doesn't always show up.
|
|
284
291
|
3. Press Enter below \u2014 Klaudius will detect the chat ID for
|
|
285
|
-
you.`}});let l=await ee({botToken:n});if(l.ok&&l.chatId)r=l.chatId;else if(l.reason==="no_messages")o="No messages from you to your bot have been picked up yet.",c="no_messages";else if(l.reason==="network")o=l.message??"Could not reach Telegram.",c="network";else throw new Error(`Telegram chat ID auto-detect failed: ${l.message??"unknown error"}`)}return{telegramBotToken:n,telegramChatId:r}}},x=[xe,Me,Oe,Be,Ne,Re,Ke,Le,Fe,Ge,ze,Ve];import{Box as re,Text as
|
|
286
|
-
`);return
|
|
292
|
+
you.`}});let l=await ee({botToken:n});if(l.ok&&l.chatId)r=l.chatId;else if(l.reason==="no_messages")o="No messages from you to your bot have been picked up yet.",c="no_messages";else if(l.reason==="network")o=l.message??"Could not reach Telegram.",c="network";else throw new Error(`Telegram chat ID auto-detect failed: ${l.message??"unknown error"}`)}return{telegramBotToken:n,telegramChatId:r}}},x=[xe,Me,Oe,Be,Ne,Re,Ke,Le,Fe,Ge,ze,Ve,Ue];import{Box as re,Text as He}from"ink";import{jsx as le,jsxs as _e}from"react/jsx-runtime";var De={pending:"\u25CB",current:"\u25C9",done:"\u2713",skipped:"\xB7"},We={pending:void 0,current:"cyan",done:"green",skipped:void 0};function ue({items:e}){return le(re,{flexDirection:"column",width:28,flexShrink:0,children:e.map(a=>{let t=a.status==="skipped"||a.status==="pending";return le(re,{children:_e(He,{color:We[a.status],bold:a.status==="current",dimColor:t&&a.status!=="current",children:[De[a.status]," ",a.title]})},a.id)})})}import{useEffect as $e,useState as ce}from"react";import{Box as j,Text as D,useInput as je}from"ink";import qe from"ink-text-input";import{jsx as F,jsxs as q}from"react/jsx-runtime";function de({spec:e,masked:a,onSubmit:t,onBack:n}){let[r,i]=ce(typeof e.initialValue=="string"?e.initialValue:""),[o,c]=ce(null);$e(()=>(y("TextPromptUI:mount",{masked:a,message:e.message.slice(0,60),initial:typeof e.initialValue=="string"?e.initialValue.slice(0,30):null}),()=>{y("TextPromptUI:unmount")}),[a,e.message,e.initialValue]),je((s,l)=>{y("TextPromptUI:useInput fired",{input:s,ctrl:l.ctrl,escape:l.escape,return:l.return}),l.escape&&n()});let u=s=>{y("TextPromptUI:handleSubmit",{raw:s.slice(0,30)});let l=s;if(e.validate){let d=e.validate(l);if(d){y("TextPromptUI:validate failed",{err:d}),c(d);return}}c(null),t(l)};return q(j,{flexDirection:"column",children:[q(D,{children:[F(D,{color:"cyan",children:"?"})," ",e.message]}),q(j,{children:[F(D,{color:"green",children:"\u203A "}),F(qe,{value:r,onChange:i,onSubmit:u,placeholder:e.placeholder,mask:a?"\u2022":void 0})]}),o&&F(j,{marginTop:0,children:F(D,{color:"red",children:o})})]})}import{useState as Ye}from"react";import{Box as ge,Text as Y,useInput as Ze}from"ink";import{jsx as pe,jsxs as Z}from"react/jsx-runtime";function he({spec:e,onSubmit:a,onBack:t}){let n=e.options??[],r=typeof e.initialValue=="string"?Math.max(0,n.findIndex(c=>c.value===e.initialValue)):0,[i,o]=Ye(r===-1?0:r);return Ze((c,u)=>{if(u.escape)t();else if(u.upArrow)o(s=>(s-1+n.length)%n.length);else if(u.downArrow)o(s=>(s+1)%n.length);else if(u.return){let s=n[i];s&&a(s.value)}}),Z(ge,{flexDirection:"column",children:[Z(Y,{children:[pe(Y,{color:"cyan",children:"?"})," ",e.message]}),pe(ge,{flexDirection:"column",marginTop:0,children:n.map((c,u)=>{let s=u===i;return Z(Y,{color:s?"cyan":void 0,bold:s,children:[s?"\u25CF ":"\u25CB ",c.label]},c.value)})})]})}import{useState as Je}from"react";import{Box as me,Text as G,useInput as Xe}from"ink";import{jsx as ye,jsxs as z}from"react/jsx-runtime";function fe({spec:e,onSubmit:a,onBack:t}){let[n,r]=Je(typeof e.initialValue=="boolean"?e.initialValue:!0);return Xe((i,o)=>{o.escape?t():o.leftArrow||o.rightArrow?r(c=>!c):i==="y"||i==="Y"?r(!0):i==="n"||i==="N"?r(!1):o.return&&a(n)}),z(me,{flexDirection:"column",children:[z(G,{children:[ye(G,{color:"cyan",children:"?"})," ",e.message]}),z(me,{marginTop:0,children:[z(G,{color:n?"cyan":void 0,bold:n,children:[n?"\u25CF ":"\u25CB ","Yes"]}),ye(G,{children:" "}),z(G,{color:n?void 0:"cyan",bold:!n,children:[n?"\u25CB ":"\u25CF ","No"]})]})]})}import{Box as be,Text as Ce}from"ink";import{jsx as J,jsxs as Qe}from"react/jsx-runtime";function X({title:e,body:a}){let t=a.split(`
|
|
293
|
+
`);return Qe(be,{flexDirection:"column",borderStyle:"round",borderColor:"gray",paddingX:1,children:[J(Ce,{color:"cyan",bold:!0,children:e}),J(be,{flexDirection:"column",marginTop:0,children:t.map((n,r)=>J(Ce,{dimColor:!1,children:n.length===0?" ":n},r))})]})}import{jsx as p,jsxs as V}from"react/jsx-runtime";function _a({defaults:e,onComplete:a,onlySection:t,banner:n}){let{exit:r}=na(),i=Q({...e}),o=Q(new Map),[,c]=M(0),u=()=>c(h=>h+1),[s,l]=M(null),[d,w]=M(null),[f,A]=M([]),[I,b]=M(null),[O,we]=M(!1),[W,Se]=M({current:0,total:0}),R=()=>{let h=o.current;for(let C of x){let $=C.isApplicable(i.current),g=h.get(C.id);$?t&&C.id!==t?g!=="current"&&h.set(C.id,"done"):(g==="skipped"||!g)&&h.set(C.id,"pending"):h.set(C.id,"skipped")}};o.current.size===0&&R();let _=Q(!1);ea(()=>{if(y("WizardApp:useEffect fired",{startedAlready:_.current}),_.current){y("WizardApp:useEffect returning early (startedRef true)");return}_.current=!0,y("WizardApp:orchestrator starting");let h=0,C=g=>{let v=++h;return y("orchestrator:promptFn called",{id:v,type:g.type,message:g.message.slice(0,60)}),b(null),new Promise((S,m)=>{w({id:v,spec:g,resolve:T=>{y("orchestrator:prompt resolved",{id:v,type:g.type,value:typeof T=="string"?T.slice(0,30):T}),S(T)},reject:T=>{y("orchestrator:prompt rejected",{id:v,reason:T.message}),m(T)}})})},$=g=>{A(v=>[...v,g])};return(async()=>{try{let g=t?x.filter(m=>m.id===t):x,v=()=>g.filter(m=>m.isApplicable(i.current)).length,S=0;for(;S<g.length;){let m=g[S];if(!m.isApplicable(i.current)){o.current.set(m.id,"skipped"),S++,R(),u();continue}A([]);for(let k of x)k.id===m.id?o.current.set(k.id,"current"):o.current.get(k.id)==="current"&&o.current.set(k.id,"pending");l(m.id);let T=g.slice(0,S+1).filter(k=>k.isApplicable(i.current)).length;Se({current:T,total:v()}),u();try{let k=await m.execute(i.current,{prompt:C,info:$});i.current={...i.current,...k},o.current.set(m.id,"done"),R(),S++}catch(k){if(k instanceof L){if(t&&m.clearOnSkip){for(let ve of m.clearOnSkip)i.current[ve]=void 0;o.current.set(m.id,"skipped"),R(),S++;continue}if(t)continue;o.current.set(m.id,"pending");let K=S-1;for(;K>=0&&!g[K].isApplicable(i.current);)K--;K<0||(S=K,o.current.set(g[S].id,"pending")),R(),u();continue}throw k}}y("orchestrator:all sections done, calling onComplete + exit"),we(!0),w(null),l(null),u(),await new Promise(m=>setTimeout(m,200)),a(i.current),r()}catch(g){y("orchestrator:caught error",{name:g?.name,message:g?.message}),g instanceof H&&(r(),process.exit(0));let v=g instanceof Error?g.message:String(g);b(`Setup error: ${v}`),u()}})(),()=>{y("WizardApp:useEffect cleanup ran (component unmounting)")}},[r,a]),ta((h,C)=>{y("WizardApp:useInput fired",{input:h,ctrl:C.ctrl,escape:C.escape,return:C.return}),C.ctrl&&h==="c"&&(y("WizardApp:Ctrl+C \u2192 exiting"),r(),process.exit(0))});let ke=aa(()=>x.map(h=>({id:h.id,title:h.title,status:o.current.get(h.id)??"pending"})),[s,O,I]);return V(P,{flexDirection:"column",paddingY:1,children:[V(P,{marginBottom:1,children:[p(E,{bold:!0,color:"cyan",children:"Klaudius setup"}),p(E,{dimColor:!0,children:" \xB7 "}),p(E,{dimColor:!0,children:W.total>0?`Step ${W.current} of ${W.total}`:"Loading\u2026"})]}),V(P,{children:[p(ue,{items:ke}),V(P,{flexDirection:"column",flexGrow:1,marginLeft:2,children:[n&&V(P,{marginBottom:1,borderStyle:"round",borderColor:"red",paddingX:1,flexDirection:"column",children:[p(E,{color:"red",bold:!0,children:"\u26A0 Heads up"}),p(E,{children:n})]}),f.map((h,C)=>p(P,{marginBottom:1,children:p(X,{title:h.title,body:h.body})},C)),d?.spec.note&&p(P,{marginBottom:1,children:p(X,{title:d.spec.note.title,body:d.spec.note.body})}),d&&ia(d),I&&p(P,{marginTop:1,children:p(E,{color:"red",children:I})}),O&&p(P,{marginTop:1,children:p(E,{color:"green",bold:!0,children:"\u2713 Setup complete. Continuing\u2026"})})]})]}),p(P,{marginTop:1,children:p(E,{dimColor:!0,children:oa(t,s)})})]})}function oa(e,a){if(e){let t=x.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 ia(e){let a=n=>e.resolve(n),t=()=>e.reject(new L);switch(e.spec.type){case"text":case"password":return p(de,{spec:e.spec,masked:e.spec.type==="password",onSubmit:a,onBack:t},e.id);case"select":return p(he,{spec:e.spec,onSubmit:a,onBack:t},e.id);case"confirm":return p(fe,{spec:e.spec,onSubmit:a,onBack:t},e.id)}}export{_a as WizardApp};
|
package/dist/bin.js
CHANGED
|
@@ -1,66 +1,67 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as
|
|
3
|
-
Please share that file so we can trace what happened.`);return i}function
|
|
2
|
+
import{a as z,b as $e,c as Ne,d as x,f as Le,g as Me}from"./chunk-SZ4KCTSL.js";import{a as re,b as Ue,c as De,d as le,e as je,i as Ke}from"./chunk-ZTT5HVYU.js";import{Command as Bn}from"commander";import{mkdir as Te,readdir as an,readFile as at,stat as rt,writeFile as be}from"fs/promises";import{spawnSync as lt}from"child_process";import{resolve as rn,isAbsolute as ln,join as B,normalize as cn}from"path";import*as w from"@clack/prompts";import d from"picocolors";import St from"react";import{render as It}from"ink";async function _(e={},t={}){if(!process.stdin.isTTY)throw new Error("Klaudius's interactive wizard requires a terminal (TTY). Run `npx klaudius init` directly from your terminal \u2014 not through a pipe, file redirect, or non-interactive shell context.");let{WizardApp:n}=await import("./WizardApp-T4BWV42P.js"),i=null;z("runWizard:start",{onlySection:t.onlySection,hasDefaults:Object.keys(e).length>0}),Ne(),await new Promise(o=>setImmediate(o)),await new Promise(o=>setTimeout(o,0)),z("runWizard:event loop drained, mounting Ink");let a=It(St.createElement(n,{defaults:e,onlySection:t.onlySection,banner:t.banner,onComplete:o=>{z("runWizard:onComplete called",{keys:Object.keys(o).length}),i=o}}),{stdout:process.stdout,stderr:process.stderr,stdin:process.stdin,exitOnCtrlC:!1});if(z("runWizard:render returned, awaiting exit"),await a.waitUntilExit(),z("runWizard:waitUntilExit resolved",{resultIsNull:i===null}),!i)throw new Error(`Wizard exited without completing. Diagnostic log: ${$e}
|
|
3
|
+
Please share that file so we can trace what happened.`);return i}var ke="claude-code";function He(e){if(e==="claude-code"||e==="codex")return e}function ce(e){let t=[],n=a=>{t.push(""),t.push("# "+"=".repeat(60)),t.push(`# ${a}`),t.push("# "+"=".repeat(60)),t.push("")},i=(a,o)=>{if(o==null||o===""){t.push(`# ${a}=`);return}let l=String(o);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."),n("Klaudius licence"),i("KLAUDIUS_LICENSE_KEY",e.licenseKey),n("AI coding agent"),i("AI_AGENT",e.aiAgent??ke),n("Operating country and language"),i("OPERATOR_COUNTRY",e.country),i("OPERATOR_COUNTRY_CODE",e.countryCode),i("OPERATOR_LANGUAGE",e.language),i("OPERATOR_LANGUAGE_CODE",e.languageCode),n("Pricing"),i("PRICING",e.pricing),i("PRICING_TERMS",e.pricingTerms),i("PRICING_MONTHLY",e.pricingMonthly),n("Automated outreach features"),i("OUTREACH_ENABLED",e.outreachEnabled?"true":"false"),i("OPERATOR_NAME",e.name),i("SIGNATURE",e.signature),i("OUTREACH_CHANNELS",e.outreachChannels?.join(",")),i("OUTREACH_PRIORITY",e.outreachPriority?.join(",")),n("Email outreach"),i("EMAIL_ADDRESS",e.emailAddress),i("EMAIL_PASSWORD",e.emailPassword),i("EMAIL_FROM_NAME",e.emailFromName),i("EMAIL_SMTP_HOST",e.emailSmtpHost),i("EMAIL_SMTP_PORT",e.emailSmtpPort),i("EMAIL_IMAP_HOST",e.emailImapHost),i("EMAIL_IMAP_PORT",e.emailImapPort),i("EMAIL_SENT_FOLDER",e.emailSentFolder),i("EMAIL_INBOX_FOLDER",e.emailInboxFolder),n("SMS outreach"),i("SMS_PROVIDER",e.smsProvider),i("TEST_PHONE",e.testPhone),i("TWILIO_ACCOUNT_SID",e.twilioAccountSid),i("TWILIO_AUTH_TOKEN",e.twilioAuthToken),i("TWILIO_PHONE_NUMBER",e.twilioPhoneNumber),n("WhatsApp outreach"),i("WHATSAPP_ACCOUNTS",e.whatsappAccounts?.join(",")),n("Supabase (pipeline state)"),i("SUPABASE_URL",e.supabaseUrl),i("SUPABASE_SERVICE_KEY",e.supabaseServiceKey),i("SUPABASE_PAT",e.supabasePat),i("SUPABASE_PROJECT_REF",e.supabaseProjectRef),n("Vercel (deployment)"),i("VERCEL_TOKEN",e.vercelToken),i("VERCEL_SCOPE",e.vercelScope??""),n("Search APIs"),i("GOOGLE_PLACES_API_KEY",e.googlePlacesApiKey),i("SERPAPI_KEY",e.serpapiKey),n("Telegram notifications (optional)"),i("TELEGRAM_BOT_TOKEN",e.telegramBotToken),i("TELEGRAM_CHAT_ID",e.telegramChatId),n("Rate limiting (sensible defaults)"),i("REQUESTS_PER_MINUTE",10),i("REQUEST_DELAY",2),t.join(`
|
|
4
4
|
`)+`
|
|
5
|
-
`}function
|
|
6
|
-
`}
|
|
5
|
+
`}function de(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)+`
|
|
6
|
+
`}function ue(e){let t=e.supabaseProjectRef,n=Rt(e.supabasePat);return["# Codex MCP config \u2014 generated by `npx klaudius init` / `configure`.","# Edit freely. NEVER commit this file \u2014 .gitignore already excludes it.","# See `.codex/config.toml.example` for the documented format.","","[mcp_servers.supabase]",'command = "npx"',`args = ["-y", "@supabase/mcp-server-supabase@latest", "--project-ref=${t}"]`,`env = { SUPABASE_ACCESS_TOKEN = "${n}", NODE_OPTIONS = "--use-system-ca" }`,""].join(`
|
|
7
|
+
`)}function Rt(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}var Fe=[{key:"AI_AGENT",value:"claude-code",comment:"Which AI coding agent drives this install. Pre-codex installs were Claude Code by default \u2014 this records that explicitly so `update` re-fetches the matching template tarball and `doctor` checks the right CLI."},{key:"PRICING_TERMS",value:"one-off, no monthly fees",comment:"Phrasing slotted next to ${PRICING} in outreach copy. See template/CLAUDE.md."},{key:"VERCEL_SCOPE",value:"",comment:"Vercel team slug. Leave blank unless `vercel link` errors about scope (post-2024 multi-team Vercel accounts)."},{key:"OPERATOR_COUNTRY",value:"the United Kingdom",comment:"Operating country (canonical full name). Used as the default region for /find."},{key:"OPERATOR_COUNTRY_CODE",value:"GB",comment:"ISO 3166-1 alpha-2 code. Passed to the Google Places API for region biasing."},{key:"OPERATOR_LANGUAGE",value:"English",comment:"Language all outreach + websites are written in."},{key:"OPERATOR_LANGUAGE_CODE",value:"en",comment:'ISO 639-1 code. Used by Google Places + <html lang="..."> on built sites.'}];function Ct(e,t){if(/[\s"'`$\\#&|<>;()*?\[\]{}!~]/.test(t)){let n=t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`");return`${e}="${n}"`}return`${e}=${t}`}function Ge(e,t,n){let i=n.filter(l=>!(l.key in t));if(i.length===0)return null;let a=e.endsWith(`
|
|
7
8
|
`)?"":`
|
|
8
|
-
`,o=["","# "+"=".repeat(60),"# Backfilled by `klaudius update` (new template env keys)","# "+"=".repeat(60)];for(let l of i)o.push(""),l.comment&&o.push(`# ${l.comment}`),o.push(
|
|
9
|
+
`,o=["","# "+"=".repeat(60),"# Backfilled by `klaudius update` (new template env keys)","# "+"=".repeat(60)];for(let l of i)o.push(""),l.comment&&o.push(`# ${l.comment}`),o.push(Ct(l.key,l.value));return e+a+o.join(`
|
|
9
10
|
`)+`
|
|
10
|
-
`}function
|
|
11
|
-
`)){let i=
|
|
12
|
-
|
|
13
|
-
`+D.bold(D.cyan(e))),detail:e=>console.log(D.dim(" "+e))};var Lt="https://klaudius.dev",Mt="/api/licenses/validate",Ut="0.12.3";async function je(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 n=e.trim(),i=(process.env.KLAUDIUS_API_URL??Lt).replace(/\/$/,"")+Mt,r=X(),o;try{o=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({license_key:n,machine_id:r,hostname:Me(),os:`${Ue()}-${De()}`,cli_version:Ut})})}catch(a){return{ok:!1,reason:`Could not reach the Klaudius license server (${v(a)}). Check your internet connection or try again later.`}}let l;try{l=await o.json()}catch{return{ok:!1,reason:`License server returned an unparseable response (HTTP ${o.status}).`}}return l.ok?{ok:!0,tier:l.tier??"core"}:{ok:!1,reason:l.reason??`License rejected (HTTP ${o.status}).`}}function X(){let e=[Me(),Nt().username,Ue(),De()].join("|");return xt("sha256").update(e).digest("hex").slice(0,32)}import{readFile as Dt}from"fs/promises";import{join as jt}from"path";async function B(e){try{let n=await fetch(e.url+"/rest/v1/",{headers:{apikey:e.serviceKey,Authorization:`Bearer ${e.serviceKey}`}});return n.status===401||n.status===403?{ok:!1,message:`Supabase rejected auth (HTTP ${n.status}). Check SUPABASE_SERVICE_KEY.`}:{ok:!0}}catch(n){return{ok:!1,message:`Could not reach Supabase: ${v(n)}`}}}async function Ke(e){let n;try{n=await Dt(jt(e.projectRoot,"scripts","schema.sql"),"utf-8")}catch(t){return{ok:!1,message:`Could not read scripts/schema.sql: ${t.message}`}}try{let t=await fetch(`https://api.supabase.com/v1/projects/${e.projectRef}/database/query`,{method:"POST",headers:{Authorization:`Bearer ${e.pat}`,"Content-Type":"application/json"},body:JSON.stringify({query:n})});if(t.ok)return{ok:!0};let i=await t.text();return i.includes("already exists")||i.includes('relation "clients" already exists')||i.includes("duplicate")?(s.detail("Schema appears already applied (tables exist). Skipping."),{ok:!0}):{ok:!1,message:`Supabase Management API rejected schema (HTTP ${t.status}): ${i.slice(0,300)}`}}catch(t){return{ok:!1,message:`Schema apply failed: ${t.message}`}}}async function ae(e){try{let n=await fetch("https://api.vercel.com/v2/user",{headers:{Authorization:`Bearer ${e}`}});if(n.status===401||n.status===403)return{ok:!1,message:`Vercel rejected the token (HTTP ${n.status}). The token is invalid, expired, or has been revoked.`};if(!n.ok)return{ok:!1,message:`Vercel API returned HTTP ${n.status}. Try again or check status.vercel.com.`};let t=await n.json();return{ok:!0,username:t.user?.username??t.user?.email}}catch(n){return{ok:!1,message:`Could not reach Vercel: ${v(n)}`}}}async function le(e){try{let n=await fetch("https://places.googleapis.com/v1/places:searchText",{method:"POST",headers:{"Content-Type":"application/json","X-Goog-Api-Key":e,"X-Goog-FieldMask":"places.id"},body:JSON.stringify({textQuery:"x"})});if(n.ok)return{ok:!0};if(n.status===429)return{ok:!0};let t={};try{t=await n.json()}catch{}let i=t.error?.message??"",r=t.error?.status??"";return n.status===400&&(r==="PERMISSION_DENIED"||/Places API \(New\) has not been enabled|API_KEY_SERVICE_BLOCKED/i.test(i))?{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."}:n.status===401||n.status===403?{ok:!1,message:i||`Google rejected the key (HTTP ${n.status}). Common causes: invalid key, billing not enabled on the Cloud project, or API key restrictions blocking this caller.`}:{ok:!1,message:`Google API returned HTTP ${n.status}${i?`: ${i}`:""}.`}}catch(n){return{ok:!1,message:`Could not reach Google: ${v(n)}`}}}import Kt from"nodemailer";import{ImapFlow as Ht}from"imapflow";async function Fe(e){let n=Kt.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 n.verify()}catch(i){return{ok:!1,failedAt:"smtp",message:He(i,"SMTP")}}finally{n.close()}let t=new Ht({host:e.emailImapHost,port:e.emailImapPort,secure:e.emailImapPort===993,auth:{user:e.emailAddress,pass:e.emailPassword},logger:!1});try{await t.connect(),await t.logout()}catch(i){try{await t.logout()}catch{}return{ok:!1,failedAt:"imap",message:He(i,"IMAP")}}return{ok:!0}}function He(e,n){let t=e instanceof Error?e.message:String(e),i=t.toLowerCase();return i.includes("invalid credentials")||i.includes("authentication failed")||i.includes("auth failed")||i.includes("login failed")?`${n} rejected the credentials. Most common causes:
|
|
11
|
+
`}function xt(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 v(e){let t={};for(let n of e.split(`
|
|
12
|
+
`)){let i=n.trim();if(!i||i.startsWith("#"))continue;let a=i.indexOf("=");if(a===-1)continue;let o=i.slice(0,a).trim(),l=xt(i.slice(a+1).trim());t[o]=l}return t}function Ve(e){let t=c=>{let p=e[c];if(!p)return;let g=parseInt(p,10);return isNaN(g)?void 0:g},n=e.SMS_PROVIDER,i=c=>c==="email"||c==="sms"||c==="whatsapp",a=e.OUTREACH_CHANNELS?.split(",").map(c=>c.trim()).filter(i),o=e.OUTREACH_PRIORITY?.split(",").map(c=>c.trim()).filter(i),l=e.WHATSAPP_ACCOUNTS?.split(",").map(c=>c.trim()).filter(c=>c.length>0);return{licenseKey:e.KLAUDIUS_LICENSE_KEY,aiAgent:He(e.AI_AGENT)??ke,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:o&&o.length>0?o:void 0,whatsappAccounts:l&&l.length>0?l:void 0,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:n==="imessage"||n==="twilio"?n: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,vercelToken:e.VERCEL_TOKEN,vercelScope:e.VERCEL_SCOPE||void 0,googlePlacesApiKey:e.GOOGLE_PLACES_API_KEY,serpapiKey:e.SERPAPI_KEY,emailPassword:e.EMAIL_PASSWORD,telegramBotToken:e.TELEGRAM_BOT_TOKEN,telegramChatId:e.TELEGRAM_CHAT_ID}}function Ee(e){let t=k=>{let K=e[k];if(!K)return;let O=parseInt(K,10);return isNaN(O)?void 0:O},n=e.SUPABASE_URL,i=e.SUPABASE_SERVICE_KEY,a=e.SUPABASE_PAT,o=e.SUPABASE_PROJECT_REF,l=e.PRICING,c=e.PRICING_TERMS||"one-off, no monthly fees",p=e.VERCEL_TOKEN;if(!l||!n||!i||!a||!o||!p)return null;let g=e.SMS_PROVIDER,r=k=>k==="email"||k==="sms"||k==="whatsapp",E=e.OUTREACH_CHANNELS?.split(",").map(k=>k.trim()).filter(r),f=e.OUTREACH_PRIORITY?.split(",").map(k=>k.trim()).filter(r),P=e.WHATSAPP_ACCOUNTS?.split(",").map(k=>k.trim()).filter(k=>k.length>0);return{licenseKey:e.KLAUDIUS_LICENSE_KEY,aiAgent:He(e.AI_AGENT)??ke,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:E&&E.length>0?E:void 0,outreachPriority:f&&f.length>0?f:void 0,whatsappAccounts:P&&P.length>0?P:void 0,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:g==="imessage"||g==="twilio"?g:void 0,testPhone:e.TEST_PHONE,twilioAccountSid:e.TWILIO_ACCOUNT_SID,twilioAuthToken:e.TWILIO_AUTH_TOKEN,twilioPhoneNumber:e.TWILIO_PHONE_NUMBER,vercelToken:p,vercelScope:e.VERCEL_SCOPE||void 0,supabaseUrl:n,supabaseServiceKey:i,supabasePat:a,supabaseProjectRef:o,googlePlacesApiKey:e.GOOGLE_PLACES_API_KEY,serpapiKey:e.SERPAPI_KEY,telegramBotToken:e.TELEGRAM_BOT_TOKEN,telegramChatId:e.TELEGRAM_CHAT_ID}}import{mkdir as vt,rm as Ot}from"fs/promises";import{Readable as $t}from"stream";import*as Be from"tar";var Nt="https://klaudius.dev/api/template";function Lt(e){return $t.fromWeb(e)}async function pe(e){let t=process.env.KLAUDIUS_TEMPLATE_URL??Nt,n="0.13.0",i;try{i=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:n,...e.agent==="codex"?{agent:"codex"}:{}})})}catch(l){throw new Error(`Could not reach klaudius.dev to download the template: ${x(l)}`)}if(!i.ok){let l="";try{let c=await i.json();l=c.reason?` (${c.reason})`:""}catch{}throw new Error(`Template download failed: HTTP ${i.status}${l}`)}if(!i.body)throw new Error("Template download succeeded but response had no body");let a=i.headers.get("x-klaudius-tier");await vt(e.destDir,{recursive:!0});let o=0;try{await new Promise((l,c)=>{let p=Be.extract({cwd:e.destDir,strict:!0,onReadEntry:()=>{o++}});p.on("finish",l),p.on("error",c),Lt(i.body).on("error",c).pipe(p)})}catch(l){throw await Ot(e.destDir,{recursive:!0,force:!0}).catch(()=>{}),new Error(`Failed to extract template archive: ${l.message}`)}return{filesExtracted:o,tier:a}}import{createHash as Mt}from"crypto";import{hostname as We,userInfo as Ut,platform as Ye,arch as ze}from"os";import H from"picocolors";var s={info:e=>console.log(H.cyan("\u2139"),e),success:e=>console.log(H.green("\u2713"),e),warn:e=>console.log(H.yellow("\u26A0"),e),error:e=>console.error(H.red("\u2717"),e),step:e=>console.log(H.dim("\u2192"),e),blank:()=>console.log(""),heading:e=>console.log(`
|
|
13
|
+
`+H.bold(H.cyan(e))),detail:e=>console.log(H.dim(" "+e))};var Dt="https://klaudius.dev",jt="/api/licenses/validate",Kt="0.13.0";async function qe(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(),i=(process.env.KLAUDIUS_API_URL??Dt).replace(/\/$/,"")+jt,a=se(),o;try{o=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({license_key:t,machine_id:a,hostname:We(),os:`${Ye()}-${ze()}`,cli_version:Kt})})}catch(c){return{ok:!1,reason:`Could not reach the Klaudius license server (${x(c)}). Check your internet connection or try again later.`}}let l;try{l=await o.json()}catch{return{ok:!1,reason:`License server returned an unparseable response (HTTP ${o.status}).`}}return l.ok?{ok:!0,tier:l.tier??"core"}:{ok:!1,reason:l.reason??`License rejected (HTTP ${o.status}).`}}function se(){let e=[We(),Ut().username,Ye(),ze()].join("|");return Mt("sha256").update(e).digest("hex").slice(0,32)}import{readFile as Ht}from"fs/promises";import{join as Ft}from"path";async function q(e){try{let t=await fetch(e.url+"/rest/v1/",{headers:{apikey:e.serviceKey,Authorization:`Bearer ${e.serviceKey}`}});return t.status===401||t.status===403?{ok:!1,message:`Supabase rejected auth (HTTP ${t.status}). Check SUPABASE_SERVICE_KEY.`}:{ok:!0}}catch(t){return{ok:!1,message:`Could not reach Supabase: ${x(t)}`}}}async function Je(e){let t;try{t=await Ht(Ft(e.projectRoot,"scripts","schema.sql"),"utf-8")}catch(n){return{ok:!1,message:`Could not read scripts/schema.sql: ${n.message}`}}try{let n=await fetch(`https://api.supabase.com/v1/projects/${e.projectRef}/database/query`,{method:"POST",headers:{Authorization:`Bearer ${e.pat}`,"Content-Type":"application/json"},body:JSON.stringify({query:t})});if(n.ok)return{ok:!0};let i=await n.text();return i.includes("already exists")||i.includes('relation "clients" already exists')||i.includes("duplicate")?(s.detail("Schema appears already applied (tables exist). Skipping."),{ok:!0}):{ok:!1,message:`Supabase Management API rejected schema (HTTP ${n.status}): ${i.slice(0,300)}`}}catch(n){return{ok:!1,message:`Schema apply failed: ${n.message}`}}}async function me(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 n=await t.json();return{ok:!0,username:n.user?.username??n.user?.email}}catch(t){return{ok:!1,message:`Could not reach Vercel: ${x(t)}`}}}async function fe(e){try{let t=await fetch("https://places.googleapis.com/v1/places:searchText",{method:"POST",headers:{"Content-Type":"application/json","X-Goog-Api-Key":e,"X-Goog-FieldMask":"places.id"},body:JSON.stringify({textQuery:"x"})});if(t.ok)return{ok:!0};if(t.status===429)return{ok:!0};let n={};try{n=await t.json()}catch{}let i=n.error?.message??"",a=n.error?.status??"";return t.status===400&&(a==="PERMISSION_DENIED"||/Places API \(New\) has not been enabled|API_KEY_SERVICE_BLOCKED/i.test(i))?{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."}:t.status===401||t.status===403?{ok:!1,message:i||`Google rejected the key (HTTP ${t.status}). Common causes: invalid key, billing not enabled on the Cloud project, or API key restrictions blocking this caller.`}:{ok:!1,message:`Google API returned HTTP ${t.status}${i?`: ${i}`:""}.`}}catch(t){return{ok:!1,message:`Could not reach Google: ${x(t)}`}}}import Gt from"nodemailer";import{ImapFlow as Vt}from"imapflow";async function Qe(e){let t=Gt.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(i){return{ok:!1,failedAt:"smtp",message:Xe(i,"SMTP")}}finally{t.close()}let n=new Vt({host:e.emailImapHost,port:e.emailImapPort,secure:e.emailImapPort===993,auth:{user:e.emailAddress,pass:e.emailPassword},logger:!1});try{await n.connect(),await n.logout()}catch(i){try{await n.logout()}catch{}return{ok:!1,failedAt:"imap",message:Xe(i,"IMAP")}}return{ok:!0}}function Xe(e,t){let n=e instanceof Error?e.message:String(e),i=n.toLowerCase();return i.includes("invalid credentials")||i.includes("authentication failed")||i.includes("auth failed")||i.includes("login failed")?`${t} rejected the credentials. Most common causes:
|
|
14
14
|
\u2022 The app password is wrong, expired, or for a different provider.
|
|
15
15
|
\u2022 The email address doesn't match the account that issued the password.
|
|
16
|
-
\u2022 2FA is required but no app-specific password was generated.`:i.includes("etimedout")||i.includes("timeout")?`${
|
|
17
|
-
`+
|
|
18
|
-
${e.stdout??""}`;return
|
|
19
|
-
`,"utf-8")}var
|
|
20
|
-
${
|
|
16
|
+
\u2022 2FA is required but no app-specific password was generated.`:i.includes("etimedout")||i.includes("timeout")?`${t} server didn't respond in time. Check the host/port, or your network.`:i.includes("enotfound")||i.includes("getaddrinfo")?`${t} host could not be resolved. Check the host setting.`:`${t} check failed: ${n}`}async function Ze(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`,n=Buffer.from(`${e.accountSid}:${e.authToken}`).toString("base64");try{let i=await fetch(t,{headers:{Authorization:`Basic ${n}`}});if(i.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(!i.ok)return{ok:!1,message:`Twilio API returned HTTP ${i.status}. Try again or check status.twilio.com.`};let a=await i.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(i){return{ok:!1,message:`Could not reach Twilio: ${x(i)}`}}}import{spawn as Bt}from"child_process";async function et(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 n=`tell application "Messages" to send "Klaudius connected (setup ping; ignore)." to buddy "${e.testPhone.replace(/"/g,"")}"`,i=await Wt(n);if(i.code===0)return{ok:!0};let a=i.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: ${i.stderr.trim()||`exit code ${i.code}`}`}}function Wt(e){return new Promise(t=>{let n=Bt("osascript",["-e",e],{stdio:["ignore","ignore","pipe"]}),i="";n.stderr.on("data",a=>{i+=a.toString()}),n.on("close",a=>t({code:a??1,stderr:i})),n.on("error",a=>t({code:1,stderr:a.message}))})}import{spawn as tt}from"child_process";function Yt(){let e=process.env.NODE_OPTIONS?.trim(),t=e?`${e} --use-system-ca`:"--use-system-ca";return{...process.env,NODE_OPTIONS:t}}var J=2,nt=2e3,zt=[/ECONNRESET/,/ETIMEDOUT/,/ENOTFOUND/,/EAI_AGAIN/,/socket hang up/i,/Connection reset/i,/network timeout/i,/could not resolve host/i];function st(e,t){let n=e+`
|
|
17
|
+
`+t;return zt.some(i=>i.test(n))}function it(e){return new Promise(t=>setTimeout(t,e))}function qt(e,t,n){return new Promise(i=>{let a=tt(e,t,{cwd:n.cwd,stdio:["ignore","pipe","pipe"],shell:!1,env:n.env??process.env}),o="",l="";a.stdout?.on("data",c=>{let p=c.toString();o+=p,process.stdout.write(p)}),a.stderr?.on("data",c=>{let p=c.toString();l+=p,process.stderr.write(p)}),a.on("close",c=>i({code:c??1,stdout:o,stderr:l})),a.on("error",c=>i({code:1,stdout:o,stderr:l+c.message}))})}async function Ae(e,t,n){let i={code:0,stdout:"",stderr:""};for(let a=0;a<=J;a++){if(i=await qt(e,t,{cwd:n.cwd,env:n.env}),i.code===0||!st(i.stderr,i.stdout))return i;a<J&&(s.detail(`${n.label} failed with a transient network error \u2014 retrying (${a+2}/${J+1})\u2026`),await it(nt))}return i}function Pe(e,t,n){return new Promise(i=>{let a=tt(e,t,{cwd:n.cwd,stdio:["ignore","pipe","pipe"],shell:!1}),o="",l="";a.stdout?.on("data",c=>{o+=c.toString()}),a.stderr?.on("data",c=>{l+=c.toString()}),a.on("close",c=>i({code:c??1,stdout:o,stderr:l})),a.on("error",c=>i({code:1,stdout:o,stderr:l+c.message}))})}var Jt=[{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. Update with `npm install -g klaudius@latest` and re-run init \u2014 that should bypass the source build."}];function Xt(e){let t=`${e.stderr??""}
|
|
18
|
+
${e.stdout??""}`;return Jt.find(i=>i.pattern.test(t))?.hint}async function Qt(e){let t=["supabase<2.26","python-dotenv","requests","httpx","Pillow","truststore"],n=["-m","pip","install","--quiet","--user"],i=null,a=async l=>{let c={code:0,stdout:"",stderr:""};for(let p=0;p<=J;p++){if(i===null&&(i=(await Pe("python3",["--version"],{cwd:e})).code===0?"python3":"python"),c=await Pe(i,l,{cwd:e}),c.code===0||/ENOENT|not recognized as an internal or external command/i.test(c.stderr)&&i==="python3"&&(i="python",c=await Pe(i,l,{cwd:e}),c.code===0)||!st(c.stderr,c.stdout))return c;p<J&&(s.detail(`pip install hit a transient network error \u2014 retrying (${p+2}/${J+1})\u2026`),await it(nt))}return c},o=await a([...n,"--break-system-packages",...t]);return o.code!==0&&/no such option:.*break-system-packages/i.test(o.stderr)&&(s.detail("Older pip detected; retrying without --break-system-packages"),o=await a([...n,...t])),o.code!==0&&(o.stderr.trim()&&process.stderr.write(o.stderr),o.stdout.trim()&&process.stdout.write(o.stdout)),o}async function he(e){let t={npm:"skipped",pip:"skipped",playwright:"skipped",patchright:"skipped"},n=Yt(),i=(p,g)=>{let r=Xt(g);r&&((t.hints??={})[p]=r)};s.step("Running npm install (Next.js, Playwright JS, etc.)...");let a=await Ae("npm",["install"],{cwd:e,label:"npm install",env:n});t.npm=a.code===0?"ok":"failed",a.code!==0&&i("npm",a),s.step("Installing Python packages (supabase, dotenv, requests, httpx, Pillow)...");let o=await Qt(e);t.pip=o.code===0?"ok":"failed",o.code!==0&&i("pip",o),s.step("Installing Playwright browser (chromium ~200MB; one-time)...");let l=await Ae("npx",["playwright","install","chromium"],{cwd:e,label:"playwright install",env:n});t.playwright=l.code===0?"ok":"failed",l.code!==0&&i("playwright",l),s.step("Installing Patchright browser (chromium ~200MB; one-time)...");let c=await Ae("npx",["patchright","install","chromium"],{cwd:e,label:"patchright install",env:n});return t.patchright=c.code===0?"ok":"failed",c.code!==0&&i("patchright",c),t}import{spawn as Zt}from"child_process";var X=3,ie=10;function en(){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/"}}async function ge(){let e=await tn("python3",["--version"]),t=en();if(e.code!==0)return{ok:!1,message:`python3 is not installed (or not on PATH). Install Python ${X}.${ie} or newer from ${t}`};let n=(e.stdout+e.stderr).trim(),i=/Python\s+(\d+)\.(\d+)(?:\.(\d+))?/.exec(n);if(!i)return{ok:!1,message:`Could not parse the python3 version string ("${n}"). Install Python ${X}.${ie} or newer from ${t}`};let a=parseInt(i[1],10),o=parseInt(i[2],10),l=i[3]?`${a}.${o}.${i[3]}`:`${a}.${o}`;return a<X||a===X&&o<ie?{ok:!1,version:l,major:a,minor:o,message:`Your installed Python is ${l}. Klaudius needs Python ${X}.${ie} or newer (the pipeline depends on packages that only ship wheels for ${X}.${ie}+). Install a newer Python from ${t} \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:l,major:a,minor:o}}function tn(e,t){return new Promise(n=>{let i=Zt(e,t,{stdio:["ignore","pipe","pipe"],shell:!1}),a="",o="";i.stdout?.on("data",l=>{a+=l.toString()}),i.stderr?.on("data",l=>{o+=l.toString()}),i.on("close",l=>n({code:l??1,stdout:a,stderr:o})),i.on("error",()=>n({code:1,stdout:a,stderr:o}))})}function Q(){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 n=parseInt(t[1],10),i=parseInt(t[2],10),a=parseInt(t[3],10),o=`${n}.${i}.${a}`;return n<22||n===22&&i<15?{ok:!1,version:o,major:n,minor:i,message:`Your installed Node.js is ${o}. 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:o,major:n,minor:i}}import{mkdir as nn,readFile as sn,writeFile as on}from"fs/promises";import{join as ot}from"path";async function ye(e,t){let n=ot(e,".claude");await nn(n,{recursive:!0});let i=ot(n,"settings.json"),a={};try{let p=await sn(i,"utf-8"),g=JSON.parse(p);g&&typeof g=="object"&&!Array.isArray(g)&&(a=g)}catch{}let o=a.enabledMcpjsonServers,l=Array.isArray(o)?o.filter(p=>typeof p=="string"):[];l.includes(t)||l.push(t);let c={...a,enabledMcpjsonServers:l};await on(i,JSON.stringify(c,null,2)+`
|
|
19
|
+
`,"utf-8")}var dn="0.13.0",S=5;function Z(e,t){s.blank(),s.error(`${e} validation failed ${S} times in a row. Pausing setup so you don't get stuck in a loop.`),s.detail(`Last error: ${t}`),s.blank(),s.detail("Your credentials are saved in `.env`. Two ways forward:"),s.detail(" \u2022 Open `.env` in any text editor, fix the value, re-run `klaudius init` and pick Resume."),s.detail(" \u2022 Or email hello@klaudius.dev with the error above and we'll dig in."),s.blank(),process.exit(1)}async function ct(e){let t=e.target??".",n=ln(t)?t:rn(process.cwd(),t),i=fn(n);i&&(s.error("Klaudius can't be installed inside a protected system folder."),s.detail(`Path: ${n}`),s.detail(`Reason: ${i}`),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 init my-agency")}`)):(s.detail("For example:"),console.log(` ${d.cyan("cd ~/Documents")}`),console.log(` ${d.cyan("npx klaudius init my-agency")}`)),s.blank(),process.exit(1)),process.platform==="win32"&&hn()&&(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 klaudius init."),s.blank());let a=await un(n);if(a.kind==="scaffolded"){s.blank(),s.warn(`Found an existing Klaudius project at ${d.bold(n)}.`),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(),n!==process.cwd()&&console.log(` ${d.cyan(`cd ${t}`)}`),console.log(` ${d.cyan("npx klaudius install")} ${d.dim("# retries npm + pip + browsers; idempotent")}`),s.blank(),s.detail("Then verify with:"),s.blank(),console.log(` ${d.cyan("npx klaudius 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 doctor")} ${d.dim("# verify Node / Python / installers / credentials")}`),console.log(` ${d.cyan("npx klaudius configure")} ${d.dim("# change a credential / API key")}`),console.log(` ${d.cyan("npx klaudius 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 init`."),s.blank();return}if(a.kind==="occupied"){let u=t===".";s.error("Klaudius needs an empty folder to scaffold into. This directory isn't empty."),s.detail(`Path: ${n}`),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 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 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 init ${t}-2`)}`),s.detail("\u2026or delete the existing folder if it's safe to remove.")),process.exit(1)}let o=await mn(e.license),l=w.spinner();l.start("Validating license");let c=await qe(o);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 ge();p.ok||(s.error(p.message??"Python version check failed."),s.blank(),s.detail("Once you've installed Python 3.10+, re-run `klaudius init` in this folder."),process.exit(1));let g=Q();g.ok||(s.error(g.message??"Node.js version check failed."),s.blank(),s.detail("Once you've installed Node.js 22.15+, re-run `klaudius init` in this folder."),process.exit(1));let r,E=!1;if(a.kind==="partial")if(await pn(n)==="resume"){let h=await at(a.envPath,"utf-8"),m=Ee(v(h));m?(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=m,E=!0):(s.warn("Existing .env was missing required fields \u2014 starting wizard fresh."),r=await _())}else{let h=await at(a.envPath,"utf-8"),m=Ee(v(h));r=await _(m??{})}else r=await _();r.licenseKey=o,await U(n,r),E||(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=w.spinner();h.start("Validating Supabase credentials");let m=await q({url:r.supabaseUrl,serviceKey:r.supabaseServiceKey});if(m.ok){h.stop("Supabase credentials accepted");break}h.stop(m.message??"Supabase check failed",2),u>=S&&Z("Supabase",m.message??"Supabase check failed");let A=m.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 ${S})`),s.detail("(Press Enter through any field to keep its current value. Ctrl+C to exit.)"),s.blank(),r=await _(r,{onlySection:"supabase",banner:`Supabase rejected your credentials:
|
|
20
|
+
${A}
|
|
21
21
|
|
|
22
22
|
Re-enter the URL, secret key, or PAT below. Press Enter on any
|
|
23
|
-
field to keep what's already there.`}),await
|
|
24
|
-
${
|
|
23
|
+
field to keep what's already there.`}),await U(n,r)}s.blank();for(let u=1;;u++){let h=w.spinner();h.start("Validating Vercel token");let m=await me(r.vercelToken);if(m.ok){h.stop(m.username?`Vercel token accepted (signed in as ${m.username})`:"Vercel token accepted");break}h.stop(m.message??"Vercel check failed",2),u>=S&&Z("Vercel",m.message??"Vercel check failed");let A=m.message??"Vercel check failed";s.blank(),s.warn(`Bouncing you back into the Vercel section so you can fix it in place. (attempt ${u+1} of ${S})`),s.detail("(Press Enter on the field to keep its current value. Ctrl+C to exit.)"),s.blank(),r=await _(r,{onlySection:"vercel",banner:`Vercel rejected the token:
|
|
24
|
+
${A}
|
|
25
25
|
|
|
26
26
|
Generate a new token at https://vercel.com/account/tokens and
|
|
27
|
-
paste it below. Press Enter to keep the current value.`}),await
|
|
28
|
-
${
|
|
27
|
+
paste it below. Press Enter to keep the current value.`}),await U(n,r)}s.blank();for(let u=1;;u++){let h=w.spinner();h.start("Validating Google Places API key");let m=await fe(r.googlePlacesApiKey??"");if(m.ok){h.stop("Google Places API key accepted");break}h.stop(m.message??"Google Places check failed",2),u>=S&&Z("Google Places",m.message??"Google Places check failed");let A=m.message??"Google Places check failed";s.blank(),s.warn(`Bouncing you back into the Google Places section so you can fix it in place. (attempt ${u+1} of ${S})`),s.detail("(Press Enter on the field to keep its current value. Ctrl+C to exit.)"),s.blank(),r=await _(r,{onlySection:"google-places",banner:`Google rejected the key:
|
|
28
|
+
${A}
|
|
29
29
|
|
|
30
30
|
Generate (or fix) the key at https://console.cloud.google.com
|
|
31
|
-
and paste it below. Press Enter to keep the current value.`}),await
|
|
32
|
-
${
|
|
31
|
+
and paste it below. Press Enter to keep the current value.`}),await U(n,r)}if(r.outreachEnabled&&r.outreachChannels?.includes("email")&&r.emailAddress&&r.emailPassword&&r.emailSmtpHost&&r.emailSmtpPort&&r.emailImapHost&&r.emailImapPort){s.blank();for(let u=1;;u++){let h=w.spinner();h.start("Validating email credentials (SMTP + IMAP)");let m=await Qe({emailAddress:r.emailAddress,emailPassword:r.emailPassword,emailSmtpHost:r.emailSmtpHost,emailSmtpPort:r.emailSmtpPort,emailImapHost:r.emailImapHost,emailImapPort:r.emailImapPort});if(m.ok){h.stop("Email credentials accepted (SMTP + IMAP)");break}h.stop(m.message??"Email check failed",2),u>=S&&Z("Email",m.message??"Email check failed");let A=m.message??"Email check failed";s.blank(),s.warn(`Bouncing you back into the email section so you can fix it in place. (attempt ${u+1} of ${S})`),s.detail("(Press Enter on any field to keep its current value. Ctrl+C to exit.)"),s.blank(),r=await _(r,{onlySection:"email",banner:`${m.failedAt==="imap"?"IMAP":"SMTP"} check failed:
|
|
32
|
+
${A}
|
|
33
33
|
|
|
34
34
|
Re-enter the email address, app password, or host details below.
|
|
35
|
-
Press Enter on any field to keep its current value.`}),await
|
|
36
|
-
${
|
|
35
|
+
Press Enter on any field to keep its current value.`}),await U(n,r)}}if(r.outreachEnabled&&r.outreachChannels?.includes("sms")&&r.smsProvider==="twilio"&&r.twilioAccountSid&&r.twilioAuthToken){s.blank();for(let u=1;;u++){let h=w.spinner();h.start("Validating Twilio credentials");let m=await Ze({accountSid:r.twilioAccountSid,authToken:r.twilioAuthToken});if(m.ok){h.stop(m.friendlyName?`Twilio credentials accepted (${m.friendlyName})`:"Twilio credentials accepted");break}h.stop(m.message??"Twilio check failed",2),u>=S&&Z("Twilio",m.message??"Twilio check failed");let A=m.message??"Twilio check failed";s.blank(),s.warn(`Bouncing you back into the SMS section so you can fix it in place. (attempt ${u+1} of ${S})`),s.detail("(Press Enter on any field to keep its current value. Ctrl+C to exit.)"),s.blank(),r=await _(r,{onlySection:"sms",banner:`Twilio rejected the credentials:
|
|
36
|
+
${A}
|
|
37
37
|
|
|
38
38
|
Re-enter the Account SID or Auth Token below.
|
|
39
|
-
Press Enter on any field to keep its current value.`}),await
|
|
40
|
-
${
|
|
39
|
+
Press Enter on any field to keep its current value.`}),await U(n,r)}}if(r.outreachEnabled&&r.outreachChannels?.includes("sms")&&r.smsProvider==="imessage"&&r.testPhone){s.blank();for(let u=1;;u++){let h=w.spinner();h.start("Validating iMessage setup (sending a test ping)");let m=await et({testPhone:r.testPhone});if(m.ok){h.stop("iMessage dispatched (check your phone for the test ping)");break}h.stop(m.message??"iMessage check failed",2),u>=S&&Z("iMessage",m.message??"iMessage check failed");let A=m.message??"iMessage check failed";s.blank(),s.warn(`Bouncing you back into the SMS section so you can fix it in place. (attempt ${u+1} of ${S})`),s.detail("(Press Enter on any field to keep its current value. Ctrl+C to exit.)"),s.blank(),r=await _(r,{onlySection:"sms",banner:`iMessage check failed:
|
|
40
|
+
${A}
|
|
41
41
|
|
|
42
42
|
Either fix the underlying issue (sign in to Messages.app, configure
|
|
43
43
|
Text Message Forwarding) and press Enter through, or change SMS
|
|
44
|
-
provider to Twilio.`}),await
|
|
45
|
-
${
|
|
44
|
+
provider to Twilio.`}),await U(n,r)}}if(r.telegramBotToken&&r.telegramChatId){s.blank();let u=0,h=!1;for(;!h;){u++;let m=w.spinner();m.start("Validating Telegram bot + chat (sending a test ping)");let A=await Me({botToken:r.telegramBotToken,chatId:r.telegramChatId});if(A.ok){m.stop(A.botHandle?`Telegram bot ${A.botHandle} accepted, test message delivered`:"Telegram credentials accepted, test message delivered"),h=!0;break}m.stop(A.message??"Telegram check failed",2);let Oe=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 V=await w.select({message:"What would you like to do?",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(w.isCancel(V)&&(w.cancel("Setup cancelled. Your .env is saved \u2014 re-run `klaudius init` to resume."),process.exit(0)),V==="skip"){r.telegramBotToken=void 0,r.telegramChatId=void 0,await U(n,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(V==="edit"&&(s.blank(),r=await _(r,{onlySection:"telegram",banner:`Telegram check failed:
|
|
45
|
+
${Oe}
|
|
46
46
|
|
|
47
47
|
Re-enter the bot token or chat_id below.
|
|
48
|
-
Press Enter on any field to keep its current value.`}),await
|
|
48
|
+
Press Enter on any field to keep its current value.`}),await U(n,r),!r.telegramBotToken||!r.telegramChatId)){s.success("Skipped Telegram. Setup will continue."),h=!0;break}}}s.blank();let f=w.spinner();f.start("Downloading Klaudius template");let P;try{P=(await pe({licenseKey:o,machineId:se(),hostname:process.platform==="win32"?process.env.COMPUTERNAME:void 0,os:`${process.platform}-${process.arch}`,agent:r.aiAgent,destDir:n})).filesExtracted,f.stop(`Downloaded ${P} files into ${d.bold(n)}`)}catch(u){f.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 Te(B(n,"clients"),{recursive:!0});let k=await Ke(n);await le(n,je(dn,k)),s.success("Wrote .klaudius/manifest.json");let K=!1,O="";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=w.spinner();u.start("Applying schema to Supabase");let h=await Je({projectRoot:n,pat:r.supabasePat,projectRef:r.supabaseProjectRef});h.ok?u.stop("Schema applied (or already present)"):(u.stop(h.message??"Schema apply failed",2),K=!0,O=`https://supabase.com/dashboard/project/${r.supabaseProjectRef}/sql/new`)}let C=[],$={};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 he(n);s.detail(`npm: ${u.npm}, pip: ${u.pip}, playwright: ${u.playwright}, patchright: ${u.patchright}`),u.npm==="failed"&&C.push("npm"),u.pip==="failed"&&C.push("pip"),u.playwright==="failed"&&C.push("playwright"),u.patchright==="failed"&&C.push("patchright"),$=u.hints??{}}let ne=r.outreachEnabled&&r.outreachPriority?.includes("whatsapp")&&(r.whatsappAccounts?.length??0)>0,N=!e.skipInstall&&!C.includes("npm");if(ne&&N){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
|
|
49
49
|
phone whose number you want to link, then Settings \u2192 Linked Devices \u2192
|
|
50
|
-
Link a Device, and point it at the QR shown in this terminal.`)),s.blank();for(let u of
|
|
51
|
-
`:"";S.length>0&&(console.log(d.dim("Easiest fix \u2014 let Claude finish it for you:")),s.blank(),u&&process.stdout.write(u),console.log(` ${d.cyan("claude")} ${d.dim("# open Claude Code in this folder")}`),console.log(d.dim(" Then paste:")),console.log(d.cyan(` "Finish my Klaudius install \u2014 ${S.join(", ")} failed during setup. Debug the install output, retry, then run npx klaudius doctor."`)),s.blank(),console.log(d.dim(" (Don't have Claude Code yet? Install with: `npm install -g @anthropic-ai/claude-code`)")),s.blank(),console.log(d.dim("Or do it yourself:")),s.blank(),u&&process.stdout.write(u),console.log(` ${d.cyan("npx klaudius install")} ${d.dim("# retry the failing installers")}`),console.log(` ${d.cyan("npx klaudius doctor")} ${d.dim("# verify everything")}`),s.blank()),U&&(console.log(d.dim("For the schema failure specifically, apply scripts/schema.sql in the Supabase SQL editor:")),console.log(` ${d.cyan(O)}`),console.log(d.dim(" Open scripts/schema.sql, copy the contents, paste into the editor, click Run.")),s.blank()),S.includes("pip")&&!C.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 ${mn()}`)),console.log(d.dim("and open a fresh Terminal before retrying.")),s.blank());let m=["npm","playwright","patchright"].filter(k=>S.includes(k)&&!C[k]);if(m.length>0){let k=m.length===1?"keeps":"keep";console.log(d.dim(`If ${m.join(" / ")} ${k} 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 install`.")),s.blank()}console.log(d.dim("Stuck? Email hello@klaudius.dev with the last ~20 lines of the install output.")),s.blank();return}y.outro(d.green(d.bold("Project ready."))),console.log(d.dim("Next steps:")),t!==process.cwd()&&console.log(` ${d.cyan(`cd ${e.target}`)}`);let J=process.platform==="win32"?"start":process.platform==="linux"?"xdg-open":"open",yt=d.dim("# read this first \u2014 operator basics + commands");console.log(` ${d.cyan(`${J} DOCS.html`)}${" ".repeat(Math.max(1,17-J.length))}${yt}`),console.log(` ${d.cyan("claude")} ${d.dim("# open Claude Code in this project")}`),console.log(` ${d.dim("then ask Claude:")}`),console.log(` ${d.cyan(' "Run the pipeline."')}`),s.blank()}async function N(e,n){await Ze(e,{recursive:!0}),await Qe(Z(e,".env"),se(n),"utf-8"),await Qe(Z(e,".mcp.json"),ie(n),"utf-8"),await ue(e,"supabase")}async function ln(e){try{(await Xe(e)).isDirectory()||(s.error(`Target exists but is not a directory: ${e}`),process.exit(1))}catch{return{kind:"fresh"}}let n=await nn(e),t=n.filter(a=>!a.startsWith(".DS_Store"));if(t.length===0)return{kind:"fresh"};let i=new Set([".env",".mcp.json",".claude"]),r=t.every(a=>i.has(a)),o=t.includes(".env"),l=n.includes(".klaudius");if(r&&o&&!l)return{kind:"partial",envPath:Z(e,".env")};if(l&&o){let a=!0;try{a=!(await Xe(Z(e,"node_modules"))).isDirectory()}catch{a=!0}return{kind:"scaffolded",nodeModulesMissing:a}}return{kind:"occupied",entries:t}}async function cn(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 n=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(n)&&(y.cancel("Setup cancelled. Existing .env left in place."),process.exit(0)),n}async function dn(e){if(e&&e.trim().length>0)return e;y.intro("Klaudius");let n=await y.text({message:"Enter your Klaudius license key",placeholder:"KLAU-XXXX-XXXX-XXXX-XXXX",validate:t=>t.trim().length===0?"Required. Check your purchase confirmation email.":void 0});return y.isCancel(n)&&(y.cancel("Setup cancelled. No files written."),process.exit(0)),n}function un(e){let n=rn(e);if(process.platform==="win32"){let t=n.toLowerCase();if(t.startsWith("c:\\windows\\"))return"Inside C:\\Windows (Windows system directory).";if(t.startsWith("c:\\program files\\"))return"Inside C:\\Program Files (Windows protected directory).";if(t.startsWith("c:\\program files (x86)\\"))return"Inside C:\\Program Files (x86) (Windows protected directory).";if(t.startsWith("c:\\programdata\\"))return"Inside C:\\ProgramData (Windows protected directory)."}else{let t=["/System/","/usr/","/bin/","/sbin/"];for(let i of t)if(n.startsWith(i))return`Inside ${i.slice(0,-1)} (system-managed directory).`}}function pn(){if(process.platform!=="win32")return!1;try{return et("net",["session"],{stdio:"ignore",windowsHide:!0}).status===0}catch{return!1}}function mn(){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/"}}import{access as fn}from"fs/promises";import{join as nt,resolve as hn}from"path";import R from"picocolors";async function it(e){let n=e.target?hn(process.cwd(),e.target):process.cwd(),t=await st(nt(n,".env")),i=await st(nt(n,"package.json"));(!t||!i)&&(s.error("This doesn't look like a Klaudius project."),s.detail(`Path: ${n}`),t||s.detail("Missing: .env"),i||s.detail("Missing: package.json"),s.blank(),s.detail("Run `npx klaudius init` to scaffold a new project first,"),s.detail("or cd into an existing project directory and re-run this command."),process.exit(1)),s.heading("Installing dependencies");let r=await ce(n);s.blank(),s.detail(`npm: ${r.npm}, pip: ${r.pip}, playwright: ${r.playwright}, patchright: ${r.patchright}`);let o=[];if(r.npm==="failed"&&o.push("npm"),r.pip==="failed"&&o.push("pip"),r.playwright==="failed"&&o.push("playwright"),r.patchright==="failed"&&o.push("patchright"),o.length===0){s.blank(),console.log(R.green(R.bold("All dependencies installed."))),console.log(R.dim("Run `npx klaudius doctor` to verify everything else (credentials, files).")),s.blank();return}s.blank(),console.log(R.yellow(R.bold(`${o.join(", ")} still failing.`))),s.blank();for(let[l,a]of Object.entries(r.hints??{}))console.log(R.yellow(`Likely cause of ${l} failure:`)),console.log(R.dim(` ${a}`)),s.blank();console.log(R.dim("Options:")),console.log(R.dim(" \u2022 Open Claude Code in this folder (`claude`) and paste:")),console.log(R.cyan(` "Finish my Klaudius install \u2014 ${o.join(", ")} failed. Debug the install output, retry, then run npx klaudius doctor."`)),console.log(R.dim(" (Don't have Claude Code yet? Install with: `npm install -g @anthropic-ai/claude-code`)")),console.log(R.dim(" \u2022 Or run `npx klaudius doctor` for a structured diagnostic.")),console.log(R.dim(" \u2022 Or email hello@klaudius.dev with the last ~20 lines of the install output above.")),s.blank(),process.exitCode=1}async function st(e){try{return await fn(e),!0}catch{return!1}}import{readFile as gn,writeFile as ot,access as yn}from"fs/promises";import{join as pe}from"path";import*as me from"@clack/prompts";import H from"picocolors";async function rt(e){let n=e.projectRoot??process.cwd(),t=pe(n,".env"),i=pe(n,".mcp.json"),r=await ke(pe(n,".klaudius","manifest.json")),o=await ke(t);!r&&!o&&(s.error("This doesn't look like a Klaudius project."),s.detail("Expected `.klaudius/manifest.json` or `.env` in this folder. Run `npx klaudius init` first."),process.exit(1));let l=Y();l.ok||(s.error(l.message??"Node.js version check failed."),s.blank(),s.detail("Once you've installed Node.js 22.15+, re-run `klaudius configure` in this folder."),process.exit(1));let a={};try{let c=await gn(t,"utf-8");a=x(c)}catch{s.warn("No .env found. Starting from an empty configuration.")}let p=ve(a);me.intro("Reconfigure Klaudius"),s.detail("Press Enter on any prompt to keep its current value."),s.blank();let f=await _(p);if(f.supabaseUrl!==a.SUPABASE_URL||f.supabaseServiceKey!==a.SUPABASE_SERVICE_KEY){s.heading("Re-validating Supabase credentials");let c=await B({url:f.supabaseUrl,serviceKey:f.supabaseServiceKey});c.ok||(s.error(c.message??"Supabase check failed"),s.warn("Aborting. .env not modified."),process.exit(1)),s.success("Supabase credentials accepted")}await ot(t,se(f),"utf-8"),s.success("Updated .env"),await ot(i,ie(f),"utf-8"),s.success("Updated .mcp.json"),await ue(n,"supabase"),s.blank(),me.outro(H.green("Configuration updated.")),await wn(n,r)}async function wn(e,n){let t=await ke(pe(e,"node_modules"));s.blank(),n?t||(s.detail("Your project files are in place but dependencies aren't installed yet."),s.detail("To finish setup, run:"),s.blank(),console.log(` ${H.cyan("npx klaudius install")} ${H.dim("# (re-)installs npm + pip + browsers; idempotent")}`),s.blank(),s.detail("Then verify with:"),s.blank(),console.log(` ${H.cyan("npx klaudius doctor")} ${H.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(` ${H.cyan("npx klaudius init")} ${H.dim("# pick Resume when prompted")}`),s.blank())}async function ke(e){try{return await yn(e),!0}catch{return!1}}import{copyFile as at,mkdir as lt,readdir as kn,readFile as En,rm as ee,writeFile as ct,access as dt}from"fs/promises";import{dirname as ut,join as I,relative as Pn}from"path";import{tmpdir as bn}from"os";import*as q from"@clack/prompts";import Ee from"picocolors";var Pe="0.12.3";async function pt(e){let n=e.projectRoot??process.cwd(),t=await Ne(n);t||(s.error("This doesn't look like a Klaudius project."),s.detail("Expected `.klaudius/manifest.json`. Run `npx klaudius init` first."),process.exit(1));let i,r=I(n,".env"),o,l;try{o=await En(r,"utf-8"),l=x(o)}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)}i=l.KLAUDIUS_LICENSE_KEY??"",i||(s.error("Couldn't find KLAUDIUS_LICENSE_KEY in your .env file."),s.detail("This file is created by `npx klaudius init`. If your project predates"),s.detail("the licence-gated template (CLI version 0.1.x), re-run `npx klaudius init`"),s.detail("in a sibling directory, then copy KLAUDIUS_LICENSE_KEY from its .env."),process.exit(1));let a=Ce(o,l,Ie);a!==null&&(await ct(r,a,"utf-8"),s.detail("Backfilled new env keys")),q.intro(`Update from ${t.templateVersion} \u2192 ${Pe}`);let p=I(bn(),`klaudius-update-${process.pid}-${Date.now()}`),f;try{s.heading("Downloading the latest Klaudius template");let g=await oe({licenseKey:i,machineId:X(),hostname:process.env.HOSTNAME??process.env.COMPUTERNAME,os:`${process.platform}-${process.arch}`,destDir:p});s.success(`Fetched ${g.filesExtracted} canonical files`),f=p}catch(g){s.error(g.message),s.detail("Update aborted. Your project is unchanged."),await ee(p,{recursive:!0,force:!0}).catch(()=>{}),process.exit(1)}let c=await An(f,n,t),w=c.filter(g=>g.state==="new"),P=c.filter(g=>g.state==="clean-update"),M=c.filter(g=>g.state==="user-only"),E=c.filter(g=>g.state==="conflict"),U=c.filter(g=>g.state==="no-change"),O=c.filter(g=>g.state==="removed-clean"),S=c.filter(g=>g.state==="removed-modified"),C=[...E,...S];if(s.blank(),s.heading("Change summary"),s.detail(`${L(U.length,"file")} unchanged`),s.detail(`${L(w.length,"new file")}`),s.detail(`${L(P.length,"file")} updated cleanly (no local edits)`),s.detail(`${L(M.length,"file")} you've edited (no upstream change \u2014 left alone)`),s.detail(`${L(O.length,"file")} removed upstream (deleted cleanly)`),s.detail(`${L(E.length,"file")} with conflicts (you edited AND we have a new version)`),s.detail(`${L(S.length,"file")} removed upstream but edited locally (need your decision)`),w.length===0&&P.length===0&&O.length===0&&C.length===0){s.blank(),q.outro(Ee.green("Already up to date.")),await ee(p,{recursive:!0,force:!0}).catch(()=>{});return}s.blank(),s.heading("Applying clean updates");for(let g of[...w,...P]){let $=I(f,g.path),K=I(n,g.path);await lt(ut(K),{recursive:!0}),await at($,K),t.files[g.path]=g.canonicalHash}w.length+P.length>0&&s.success(`Wrote ${L(w.length+P.length,"file")}`);for(let g of O){let $=I(n,g.path);await ee($,{force:!0}),delete t.files[g.path]}if(O.length>0&&s.success(`Deleted ${L(O.length,"file")} removed upstream`),C.length>0){s.blank(),s.heading(`${C.length} conflict(s) need resolution`);let g=I(n,".klaudius","incoming");try{await ee(g,{recursive:!0,force:!0})}catch{}for(let $ of E){let K=I(f,$.path),J=I(g,$.path);await lt(ut(J),{recursive:!0}),await at(K,J)}await ct(I(n,".klaudius","conflicts.md"),Sn(C,t.templateVersion,Pe),"utf-8"),E.length>0&&s.detail("Staged canonical versions to .klaudius/incoming/"),s.detail("Wrote conflict report to .klaudius/conflicts.md")}t.updatedAt=new Date().toISOString(),C.length===0&&(t.templateVersion=Pe),await re(n,t),s.blank(),C.length===0?q.outro(Ee.green("Update complete.")):q.outro(Ee.yellow(`${C.length} conflict(s) staged. Open Claude Code in this project and ask:
|
|
52
|
-
"Run /resolve-conflicts"`))
|
|
53
|
-
`)}import{access as
|
|
54
|
-
`)),
|
|
50
|
+
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 pair-whatsapp --label ${u})`));let h=lt(process.execPath,["scripts/whatsapp.mjs","pair","--account",u],{cwd:n,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 pair-whatsapp --label ${u}`))),s.blank()}}else if(ne&&!N){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 install` completes successfully, pair via:"));for(let u of r.whatsappAccounts)console.log(d.cyan(` npx klaudius pair-whatsapp --label ${u}`))}s.blank();let y=[...C,...K?["schema"]:[]];if(y.length>0){w.outro(d.yellow(d.bold(`Setup paused \u2014 ${y.join(", ")} failed.`))),console.log(d.dim("Your credentials and project files are all saved.")),s.blank();for(let[Y,_t]of Object.entries($))console.log(d.yellow(`Likely cause of ${Y} failure:`)),console.log(d.dim(` ${_t}`)),s.blank();let u=n!==process.cwd()?` ${d.cyan(`cd ${e.target}`)}
|
|
51
|
+
`:"",h=r.aiAgent==="codex"?"codex":"claude",m=r.aiAgent==="codex"?"Codex":"Claude Code",A=r.aiAgent==="codex"?"npm install -g @openai/codex":"npm install -g @anthropic-ai/claude-code";C.length>0&&(console.log(d.dim(`Easiest fix \u2014 let ${m} finish it for you:`)),s.blank(),u&&process.stdout.write(u),console.log(` ${d.cyan(h)} ${d.dim(`# open ${m} in this folder`)}`),console.log(d.dim(" Then paste:")),console.log(d.cyan(` "Finish my Klaudius install \u2014 ${C.join(", ")} failed during setup. Debug the install output, retry, then run npx klaudius doctor."`)),s.blank(),console.log(d.dim(` (Don't have ${m} 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 install")} ${d.dim("# retry the failing installers")}`),console.log(` ${d.cyan("npx klaudius doctor")} ${d.dim("# verify everything")}`),s.blank()),K&&(console.log(d.dim("For the schema failure specifically, apply scripts/schema.sql in the Supabase SQL editor:")),console.log(` ${d.cyan(O)}`),console.log(d.dim(" Open scripts/schema.sql, copy the contents, paste into the editor, click Run.")),s.blank()),C.includes("pip")&&!$.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 ${gn()}`)),console.log(d.dim("and open a fresh Terminal before retrying.")),s.blank());let V=["npm","playwright","patchright"].filter(Y=>C.includes(Y)&&!$[Y]);if(V.length>0){let Y=V.length===1?"keeps":"keep";console.log(d.dim(`If ${V.join(" / ")} ${Y} 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 install`.")),s.blank()}console.log(d.dim("Stuck? Email hello@klaudius.dev with the last ~20 lines of the install output.")),s.blank();return}w.outro(d.green(d.bold("Project ready."))),console.log(d.dim("Next steps:")),n!==process.cwd()&&console.log(` ${d.cyan(`cd ${e.target}`)}`);let M=process.platform==="win32"?"start":process.platform==="linux"?"xdg-open":"open",W=d.dim("# read this first \u2014 operator basics + commands");console.log(` ${d.cyan(`${M} DOCS.html`)}${" ".repeat(Math.max(1,17-M.length))}${W}`);let ae=r.aiAgent==="codex"?"codex":"claude",ve=r.aiAgent==="codex"?"Codex":"Claude Code";console.log(` ${d.cyan(ae)} ${d.dim(`# open ${ve} in this project`)}`),console.log(` ${d.dim(`then ask ${ve}:`)}`),console.log(` ${d.cyan(' "Run the pipeline."')}`),s.blank()}async function U(e,t){await Te(e,{recursive:!0}),await be(B(e,".env"),ce(t),"utf-8"),t.aiAgent==="codex"?(await Te(B(e,".codex"),{recursive:!0}),await be(B(e,".codex","config.toml"),ue(t),"utf-8")):(await be(B(e,".mcp.json"),de(t),"utf-8"),await ye(e,"supabase"))}async function un(e){try{(await rt(e)).isDirectory()||(s.error(`Target exists but is not a directory: ${e}`),process.exit(1))}catch{return{kind:"fresh"}}let t=await an(e),n=t.filter(c=>!c.startsWith(".DS_Store"));if(n.length===0)return{kind:"fresh"};let i=new Set([".env",".mcp.json",".claude",".codex"]),a=n.every(c=>i.has(c)),o=n.includes(".env"),l=t.includes(".klaudius");if(a&&o&&!l)return{kind:"partial",envPath:B(e,".env")};if(l&&o){let c=!0;try{c=!(await rt(B(e,"node_modules"))).isDirectory()}catch{c=!0}return{kind:"scaffolded",nodeModulesMissing:c}}return{kind:"occupied",entries:n}}async function pn(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 w.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 w.isCancel(t)&&(w.cancel("Setup cancelled. Existing .env left in place."),process.exit(0)),t}async function mn(e){if(e&&e.trim().length>0)return e;w.intro("Klaudius");let t=await w.text({message:"Enter your Klaudius license key",placeholder:"KLAU-XXXX-XXXX-XXXX-XXXX",validate:n=>n.trim().length===0?"Required. Check your purchase confirmation email.":void 0});return w.isCancel(t)&&(w.cancel("Setup cancelled. No files written."),process.exit(0)),t}function fn(e){let t=cn(e);if(process.platform==="win32"){let n=t.toLowerCase();if(n.startsWith("c:\\windows\\"))return"Inside C:\\Windows (Windows system directory).";if(n.startsWith("c:\\program files\\"))return"Inside C:\\Program Files (Windows protected directory).";if(n.startsWith("c:\\program files (x86)\\"))return"Inside C:\\Program Files (x86) (Windows protected directory).";if(n.startsWith("c:\\programdata\\"))return"Inside C:\\ProgramData (Windows protected directory)."}else{let n=["/System/","/usr/","/bin/","/sbin/"];for(let i of n)if(t.startsWith(i))return`Inside ${i.slice(0,-1)} (system-managed directory).`}}function hn(){if(process.platform!=="win32")return!1;try{return lt("net",["session"],{stdio:"ignore",windowsHide:!0}).status===0}catch{return!1}}function gn(){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/"}}import{access as yn,readFile as wn}from"fs/promises";import{join as _e,resolve as kn}from"path";import I from"picocolors";async function ut(e){let t=e.target?kn(process.cwd(),e.target):process.cwd(),n=await dt(_e(t,".env")),i=await dt(_e(t,"package.json"));(!n||!i)&&(s.error("This doesn't look like a Klaudius project."),s.detail(`Path: ${t}`),n||s.detail("Missing: .env"),i||s.detail("Missing: package.json"),s.blank(),s.detail("Run `npx klaudius 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{v(await wn(_e(t,".env"),"utf-8")).AI_AGENT==="codex"&&(a="codex")}catch{}s.heading("Installing dependencies");let o=await he(t);s.blank(),s.detail(`npm: ${o.npm}, pip: ${o.pip}, playwright: ${o.playwright}, patchright: ${o.patchright}`);let l=[];if(o.npm==="failed"&&l.push("npm"),o.pip==="failed"&&l.push("pip"),o.playwright==="failed"&&l.push("playwright"),o.patchright==="failed"&&l.push("patchright"),l.length===0){s.blank(),console.log(I.green(I.bold("All dependencies installed."))),console.log(I.dim("Run `npx klaudius doctor` to verify everything else (credentials, files).")),s.blank();return}s.blank(),console.log(I.yellow(I.bold(`${l.join(", ")} still failing.`))),s.blank();for(let[r,E]of Object.entries(o.hints??{}))console.log(I.yellow(`Likely cause of ${r} failure:`)),console.log(I.dim(` ${E}`)),s.blank();let c=a==="codex"?"codex":"claude",p=a==="codex"?"Codex":"Claude Code",g=a==="codex"?"npm install -g @openai/codex":"npm install -g @anthropic-ai/claude-code";console.log(I.dim("Options:")),console.log(I.dim(` \u2022 Open ${p} in this folder (\`${c}\`) and paste:`)),console.log(I.cyan(` "Finish my Klaudius install \u2014 ${l.join(", ")} failed. Debug the install output, retry, then run npx klaudius doctor."`)),console.log(I.dim(` (Don't have ${p} yet? Install with: \`${g}\`)`)),console.log(I.dim(" \u2022 Or run `npx klaudius doctor` for a structured diagnostic.")),console.log(I.dim(" \u2022 Or email hello@klaudius.dev with the last ~20 lines of the install output above.")),s.blank(),process.exitCode=1}async function dt(e){try{return await yn(e),!0}catch{return!1}}import{readFile as En,writeFile as Se,access as An}from"fs/promises";import{join as ee}from"path";import*as we from"@clack/prompts";import D from"picocolors";import{mkdir as Pn}from"fs/promises";async function pt(e){let t=e.projectRoot??process.cwd(),n=ee(t,".env"),i=ee(t,".mcp.json"),a=ee(t,".codex","config.toml"),o=await Ie(ee(t,".klaudius","manifest.json")),l=await Ie(n);!o&&!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 init` first."),process.exit(1));let c=Q();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 `klaudius configure` in this folder."),process.exit(1));let p={};try{let f=await En(n,"utf-8");p=v(f)}catch{s.warn("No .env found. Starting from an empty configuration.")}let g=Ve(p);we.intro("Reconfigure Klaudius"),s.detail("Press Enter on any prompt to keep its current value."),s.blank();let r=await _(g),E=g.aiAgent??"claude-code";if(r.aiAgent&&r.aiAgent!==E&&(s.error(`Switching AI coding agent (${E} \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(` ${D.cyan("npx klaudius init <new-folder>")} ${D.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 f=await q({url:r.supabaseUrl,serviceKey:r.supabaseServiceKey});f.ok||(s.error(f.message??"Supabase check failed"),s.warn("Aborting. .env not modified."),process.exit(1)),s.success("Supabase credentials accepted")}await Se(n,ce(r),"utf-8"),s.success("Updated .env"),r.aiAgent==="codex"?(await Pn(ee(t,".codex"),{recursive:!0}),await Se(a,ue(r),"utf-8"),s.success("Updated .codex/config.toml")):(await Se(i,de(r),"utf-8"),s.success("Updated .mcp.json"),await ye(t,"supabase")),s.blank(),we.outro(D.green("Configuration updated.")),await bn(t,o)}async function bn(e,t){let n=await Ie(ee(e,"node_modules"));s.blank(),t?n||(s.detail("Your project files are in place but dependencies aren't installed yet."),s.detail("To finish setup, run:"),s.blank(),console.log(` ${D.cyan("npx klaudius install")} ${D.dim("# (re-)installs npm + pip + browsers; idempotent")}`),s.blank(),s.detail("Then verify with:"),s.blank(),console.log(` ${D.cyan("npx klaudius doctor")} ${D.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(` ${D.cyan("npx klaudius init")} ${D.dim("# pick Resume when prompted")}`),s.blank())}async function Ie(e){try{return await An(e),!0}catch{return!1}}import{copyFile as mt,mkdir as ft,readdir as Tn,readFile as _n,rm as oe,writeFile as ht,access as gt}from"fs/promises";import{dirname as yt,join as R,relative as Sn}from"path";import{tmpdir as In}from"os";import*as te from"@clack/prompts";import Re from"picocolors";var Ce="0.13.0";async function wt(e){let t=e.projectRoot??process.cwd(),n=await De(t);n||(s.error("This doesn't look like a Klaudius project."),s.detail("Expected `.klaudius/manifest.json`. Run `npx klaudius init` first."),process.exit(1));for(let y of Ue)delete n.files[y];let i,a=R(t,".env"),o,l;try{o=await _n(a,"utf-8"),l=v(o)}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)}i=l.KLAUDIUS_LICENSE_KEY??"",i||(s.error("Couldn't find KLAUDIUS_LICENSE_KEY in your .env file."),s.detail("This file is created by `npx klaudius init`. If your project predates"),s.detail("the licence-gated template (CLI version 0.1.x), re-run `npx klaudius init`"),s.detail("in a sibling directory, then copy KLAUDIUS_LICENSE_KEY from its .env."),process.exit(1));let c=Ge(o,l,Fe);c!==null&&(await ht(a,c,"utf-8"),s.detail("Backfilled new env keys")),te.intro(`Update from ${n.templateVersion} \u2192 ${Ce}`);let g=l.AI_AGENT==="codex"?"codex":"claude-code",r=R(In(),`klaudius-update-${process.pid}-${Date.now()}`),E;try{s.heading("Downloading the latest Klaudius template");let y=await pe({licenseKey:i,machineId:se(),hostname:process.env.HOSTNAME??process.env.COMPUTERNAME,os:`${process.platform}-${process.arch}`,agent:g,destDir:r});s.success(`Fetched ${y.filesExtracted} canonical files`),E=r}catch(y){s.error(y.message),s.detail("Update aborted. Your project is unchanged."),await oe(r,{recursive:!0,force:!0}).catch(()=>{}),process.exit(1)}let f=await Rn(E,t,n),P=f.filter(y=>y.state==="new"),k=f.filter(y=>y.state==="clean-update"),K=f.filter(y=>y.state==="user-only"),O=f.filter(y=>y.state==="conflict"),C=f.filter(y=>y.state==="no-change"),$=f.filter(y=>y.state==="removed-clean"),ne=f.filter(y=>y.state==="removed-modified"),N=[...O,...ne];if(s.blank(),s.heading("Change summary"),s.detail(`${j(C.length,"file")} unchanged`),s.detail(`${j(P.length,"new file")}`),s.detail(`${j(k.length,"file")} updated cleanly (no local edits)`),s.detail(`${j(K.length,"file")} you've edited (no upstream change \u2014 left alone)`),s.detail(`${j($.length,"file")} removed upstream (deleted cleanly)`),s.detail(`${j(O.length,"file")} with conflicts (you edited AND we have a new version)`),s.detail(`${j(ne.length,"file")} removed upstream but edited locally (need your decision)`),P.length===0&&k.length===0&&$.length===0&&N.length===0){s.blank(),te.outro(Re.green("Already up to date.")),await oe(r,{recursive:!0,force:!0}).catch(()=>{});return}s.blank(),s.heading("Applying clean updates");for(let y of[...P,...k]){let M=R(E,y.path),W=R(t,y.path);await ft(yt(W),{recursive:!0}),await mt(M,W),n.files[y.path]=y.canonicalHash}P.length+k.length>0&&s.success(`Wrote ${j(P.length+k.length,"file")}`);for(let y of $){let M=R(t,y.path);await oe(M,{force:!0}),delete n.files[y.path]}if($.length>0&&s.success(`Deleted ${j($.length,"file")} removed upstream`),N.length>0){s.blank(),s.heading(`${N.length} conflict(s) need resolution`);let y=R(t,".klaudius","incoming");try{await oe(y,{recursive:!0,force:!0})}catch{}for(let M of O){let W=R(E,M.path),ae=R(y,M.path);await ft(yt(ae),{recursive:!0}),await mt(W,ae)}await ht(R(t,".klaudius","conflicts.md"),Cn(N,n.templateVersion,Ce),"utf-8"),O.length>0&&s.detail("Staged canonical versions to .klaudius/incoming/"),s.detail("Wrote conflict report to .klaudius/conflicts.md")}if(n.updatedAt=new Date().toISOString(),N.length===0&&(n.templateVersion=Ce),await le(t,n),s.blank(),N.length===0)te.outro(Re.green("Update complete."));else{let y=g==="codex"?"Codex":"Claude Code";te.outro(Re.yellow(`${N.length} conflict(s) staged. Open ${y} in this project and ask:
|
|
52
|
+
"Run /resolve-conflicts"`))}await oe(r,{recursive:!0,force:!0}).catch(()=>{})}async function Rn(e,t,n){let i=await kt(e),a=new Set(i),o=[];for(let l of i){let c=await re(R(e,l)),p=n.files[l],g=R(t,l),r;try{await gt(g),r=await re(g)}catch{o.push({path:l,state:"new",canonicalHash:c,manifestHash:p});continue}c===p?r===p?o.push({path:l,state:"no-change",canonicalHash:c,localHash:r,manifestHash:p}):o.push({path:l,state:"user-only",canonicalHash:c,localHash:r,manifestHash:p}):r===p?o.push({path:l,state:"clean-update",canonicalHash:c,localHash:r,manifestHash:p}):o.push({path:l,state:"conflict",canonicalHash:c,localHash:r,manifestHash:p})}for(let l of Object.keys(n.files)){if(a.has(l))continue;let c=n.files[l],p=R(t,l),g;try{await gt(p),g=await re(p)}catch{delete n.files[l];continue}g===c?o.push({path:l,state:"removed-clean",localHash:g,manifestHash:c}):o.push({path:l,state:"removed-modified",localHash:g,manifestHash:c})}return o}function j(e,t){return`${e} ${t}${e===1?"":"s"}`}async function kt(e,t=e){let n=await Tn(e,{withFileTypes:!0}),i=[];for(let a of n){let o=R(e,a.name);a.isDirectory()?i.push(...await kt(o,t)):a.isFile()&&i.push(Sn(t,o))}return i}function Cn(e,t,n){let i=e.filter(c=>c.state==="conflict").length,a=e.filter(c=>c.state==="removed-modified").length,o=[];o.push("# Update Conflicts"),o.push(""),o.push(`Generated by \`npx klaudius update\` on ${new Date().toISOString()}.`),o.push(`Updating from canonical version **${t}** to **${n}**.`),o.push("");let l=[];i>0&&l.push(`${i} file${i===1?"":"s"} ha${i===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`),o.push(l.join(", and ")+"."),o.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."),o.push(""),o.push("---"),o.push("");for(let c of e)o.push(`## ${c.path}`),o.push(""),c.state==="removed-modified"?(o.push("**Type:** Removed upstream"),o.push(""),o.push(`- Your local copy: \`${c.path}\``),o.push("- This file no longer exists in the canonical template."),o.push("- You've modified it locally since install."),o.push(`- Hash at last install/update: \`${(c.manifestHash??"(none)").slice(0,16)}\``),o.push(`- Your local hash now: \`${(c.localHash??"(missing)").slice(0,16)}\``),o.push(""),o.push("**Resolution options for the SKILL to walk through:**"),o.push(""),o.push("1. Keep mine \u2014 leave the file in place; stop tracking it in the manifest"),o.push("2. Delete \u2014 remove the file from disk and from the manifest")):(o.push("**Type:** Edit conflict"),o.push(""),o.push(`- Your version (with your local edits): \`${c.path}\``),o.push(`- New canonical version: \`.klaudius/incoming/${c.path}\``),o.push(`- Hash at last install/update: \`${(c.manifestHash??"(none)").slice(0,16)}\``),o.push(`- Your local hash now: \`${(c.localHash??"(missing)").slice(0,16)}\``),o.push(`- New canonical hash: \`${(c.canonicalHash??"(none)").slice(0,16)}\``),o.push(""),o.push("**Resolution options for the SKILL to walk through:**"),o.push(""),o.push("1. Keep mine \u2014 discard the new canonical changes"),o.push("2. Take canonical \u2014 overwrite my edits with the new version"),o.push("3. Merge \u2014 review both side-by-side and produce a combined version")),o.push(""),o.push("---"),o.push("");return o.join(`
|
|
53
|
+
`)}import{access as xn,readFile as Et,stat as vn}from"fs/promises";import{join as L}from"path";import b from"picocolors";import{spawn as On}from"child_process";async function At(e){let t=e.projectRoot??process.cwd(),n=[];console.log(b.bold(`Klaudius doctor \u2014 checking your project\u2026
|
|
54
|
+
`)),n.push(await $n()),n.push(await Nn());let i=L(t,".env"),a=L(t,".klaudius","manifest.json"),o=L(t,".mcp.json"),l=L(t,".codex","config.toml"),c=await F(i),p=await F(a),g="claude-code";if(c)try{v(await Et(i,"utf-8")).AI_AGENT==="codex"&&(g="codex")}catch{}if(g==="claude-code"){let f=await F(L(t,"AGENTS.md")),P=!await F(L(t,".claude"));f&&P&&(g="codex")}if(n.push({name:".env present",status:c?"ok":"fail",detail:c?i:"missing",nextAction:c?void 0:"Run `klaudius init` in this folder."}),n.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 `klaudius init` and pick Resume.":"Run `klaudius init`."}),g==="codex"){let f=await F(l);n.push({name:".codex/config.toml present",status:f?"ok":"warn",detail:f?l:"missing",nextAction:f?void 0:"Run `klaudius configure` to regenerate."})}else{let f=await F(o);n.push({name:".mcp.json present",status:f?"ok":"warn",detail:f?o:"missing",nextAction:f?void 0:"Run `klaudius configure` to regenerate."})}if(n.push(await jn(g)),n.push(await Ln(t)),n.push(await Mn(t)),n.push(await Un()),!c)n.push({name:"Credential validations",status:"skip",detail:".env missing"});else if(e.offline)n.push({name:"Credential validations",status:"skip",detail:"--offline set"});else{let f=await Et(i,"utf-8"),P=v(f);await Dn(P,n)}console.log();for(let f of n){let P=f.status==="ok"?b.green("\u2713"):f.status==="warn"?b.yellow("\u26A0"):f.status==="skip"?b.dim("\xB7"):b.red("\u2717");console.log(` ${P} ${f.name}${f.detail?b.dim(` \u2014 ${f.detail}`):""}`),f.nextAction&&console.log(` ${b.dim("\u2192")} ${b.cyan(f.nextAction)}`)}let r=n.filter(f=>f.status==="fail").length,E=n.filter(f=>f.status==="warn").length;console.log(),r===0&&E===0?console.log(b.green(b.bold("Everything checks out. You're good to go."))):r===0?console.log(b.yellow(b.bold(`${E} warning${E===1?"":"s"} \u2014 review above.`))):(console.log(b.red(b.bold(`${r} failed check${r===1?"":"s"} \u2014 see the \u2192 next actions above.`))),process.exitCode=1),console.log()}async function F(e){try{return await xn(e),!0}catch{return!1}}async function $n(){let e=await ge();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 Nn(){let e=process.version,t=/^v(\d+)\.(\d+)\.(\d+)$/.exec(e);if(!t)return{name:"Node \u2265 22.15",status:"warn",detail:e};let n=parseInt(t[1],10),i=parseInt(t[2],10);return n<22||n===22&&i<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 Ln(e){let t=L(e,"node_modules");if(!await F(t))return{name:"node_modules installed",status:"fail",detail:"missing",nextAction:"Run `npx klaudius install` in this folder."};try{if(!(await vn(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 Mn(e){let t=process.platform==="darwin"?L(process.env.HOME??"","Library","Caches","ms-playwright"):process.platform==="win32"?L(process.env.USERPROFILE??"","AppData","Local","ms-playwright"):L(process.env.HOME??"",".cache","ms-playwright");return await F(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 Un(){let e=["supabase","dotenv","requests","httpx","PIL"],t=`import sys
|
|
55
55
|
try:
|
|
56
56
|
${e.map(i=>` import ${i}`).join(`
|
|
57
57
|
`)}
|
|
58
58
|
except Exception as e:
|
|
59
59
|
print(str(e))
|
|
60
60
|
sys.exit(1)
|
|
61
|
-
`,
|
|
62
|
-
`).pop()??"import failed",nextAction:"Run `npx klaudius install` in this folder."}}async function
|
|
63
|
-
`))
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
`,n=await Pt("python3",["-c",t]);return n.code===0?{name:"Python packages installed",status:"ok",detail:e.join(", ")}:{name:"Python packages installed",status:"fail",detail:(n.stdout||n.stderr).trim().split(`
|
|
62
|
+
`).pop()??"import failed",nextAction:"Run `npx klaudius install` in this folder."}}async function Dn(e,t){if(e.SUPABASE_URL&&e.SUPABASE_SERVICE_KEY){let n=await q({url:e.SUPABASE_URL,serviceKey:e.SUPABASE_SERVICE_KEY});t.push({name:"Supabase credentials",status:n.ok?"ok":"fail",detail:n.ok?"connected":n.message,nextAction:n.ok?void 0:"Run `klaudius configure` to fix the URL or key."})}else t.push({name:"Supabase credentials",status:"fail",detail:"missing in .env"});if(e.VERCEL_TOKEN){let n=await me(e.VERCEL_TOKEN);t.push({name:"Vercel token",status:n.ok?"ok":"fail",detail:n.ok?n.username??"valid":n.message,nextAction:n.ok?void 0:"Generate a new token at https://vercel.com/account/tokens, then `klaudius configure`."})}else t.push({name:"Vercel token",status:"fail",detail:"missing in .env"});if(e.GOOGLE_PLACES_API_KEY){let n=await fe(e.GOOGLE_PLACES_API_KEY);t.push({name:"Google Places API key",status:n.ok?"ok":"fail",detail:n.ok?"accepted":n.message,nextAction:n.ok?void 0:"Fix the key in https://console.cloud.google.com and `klaudius configure`."})}else t.push({name:"Google Places API key",status:"warn",detail:"not set (find skill will fail until you add one)"});if(e.TELEGRAM_BOT_TOKEN&&e.TELEGRAM_CHAT_ID){let n=await Le({botToken:e.TELEGRAM_BOT_TOKEN});t.push({name:"Telegram bot token",status:n.ok?"ok":"fail",detail:n.ok?`bot ${n.botHandle??"ok"} (chat_id not tested)`:n.message,nextAction:n.ok?void 0:"Fix TELEGRAM_BOT_TOKEN in .env (or blank both Telegram lines to disable)."})}else e.TELEGRAM_BOT_TOKEN||e.TELEGRAM_CHAT_ID?t.push({name:"Telegram credentials",status:"warn",detail:"partial config (one of bot token / chat ID set, other missing)",nextAction:"Either set both, or blank both to disable Telegram notifications."}):t.push({name:"Telegram credentials",status:"skip",detail:"not configured (optional)"})}async function jn(e){let t=e==="codex"?"codex":"claude",n=e==="codex"?"Codex CLI on PATH":"Claude Code CLI on PATH",i=e==="codex"?"Install Codex with `npm install -g @openai/codex` (or your preferred installer).":"Install Claude Code with `npm install -g @anthropic-ai/claude-code`.",a=await Pt(t,["--version"]);return a.code===0?{name:n,status:"ok",detail:(a.stdout||a.stderr).trim().split(`
|
|
63
|
+
`)[0]}:{name:n,status:"warn",detail:"not found",nextAction:i}}function Pt(e,t){return new Promise(n=>{let i=On(e,t,{stdio:["ignore","pipe","pipe"],shell:!1}),a="",o="";i.stdout?.on("data",l=>{a+=l.toString()}),i.stderr?.on("data",l=>{o+=l.toString()}),i.on("close",l=>n({code:l??1,stdout:a,stderr:o})),i.on("error",()=>n({code:1,stdout:a,stderr:o}))})}import{existsSync as Kn}from"fs";import{spawnSync as Hn}from"child_process";import{join as Fn,resolve as Gn}from"path";import T from"picocolors";async function bt(e){let t=Gn(e.projectRoot??process.cwd()),n=Fn(t,"scripts","whatsapp.mjs");Kn(n)||(console.error(T.red("Couldn't find scripts/whatsapp.mjs in this directory.")),console.error(T.dim("Run this command from the root of a Klaudius project (the directory created by `npx klaudius init`).")),console.error(T.dim(`Looked for: ${n}`)),process.exit(1));let i=(e.label??"primary").trim(),a=i.replace(/[^A-Za-z0-9_-]/g,"");a||(console.error(T.red(`Invalid label '${i}'. Use letters, digits, underscore, or hyphen only.`)),process.exit(1)),a!==i&&console.error(T.yellow(`Note: cleaned label '${i}' \u2192 '${a}' (filename-safe characters only).`)),console.log(T.cyan(`Pairing WhatsApp account '${a}'...`)),console.log(T.dim(`If a daemon is already running for this account, it will be stopped automatically before the QR prompt. After the pair completes, the next /outreach send for this account will respawn the daemon with the new auth.
|
|
64
|
+
`));let o=Hn(process.execPath,[n,"pair","--account",a],{cwd:t,stdio:"inherit"});if(o.status===0){console.log(T.green(`Paired '${a}'.`)),console.log(T.dim(`
|
|
65
|
+
If you haven't already, add '${a}' to WHATSAPP_ACCOUNTS in .env so /outreach round-robins to it. Example:
|
|
66
|
+
WHATSAPP_ACCOUNTS=primary,${a}
|
|
67
|
+
(Skip this if '${a}' is already there or you set it via the init wizard.)`));return}o.error?console.error(T.red(`Pair failed: ${o.error.message}`)):(console.error(T.red(`Pair did not complete (exit ${o.status??"signalled"}). Common causes:`)),console.error(T.dim(" - QR scan window timed out: re-run and scan promptly.")),console.error(T.dim(" - WhatsApp's 4-linked-device limit: open WhatsApp \u2192 Settings \u2192 Linked Devices, unlink an unused entry, then re-run.")),console.error(T.dim(` - Existing daemon couldn't be stopped: check the log at ~/.klaudius/whatsapp/${a}/daemon.log`))),process.exit(o.status??1)}import{spawnSync as Vn}from"child_process";var xe="--use-system-ca";function Tt(){let e=process.env.NODE_OPTIONS??"";if(e.includes(xe)||!Q().ok)return;let n=e?`${e} ${xe}`:xe,i=Vn(process.execPath,[...process.execArgv,...process.argv.slice(1)],{env:{...process.env,NODE_OPTIONS:n},stdio:"inherit"});i.signal&&(process.kill(process.pid,i.signal),process.exit(1)),process.exit(i.status??1)}Tt();var Wn="0.13.0",G=new Bn;G.name("klaudius").description("Scaffold and maintain a Klaudius pipeline project").version(Wn);G.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 ct({target:e,license:t.license,skipInstall:!!t.skipInstall,skipSchema:!!t.skipSchema})}catch(n){console.error("init failed:",n.message),process.exit(1)}});G.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 ut({target:e})}catch(t){console.error("install failed:",t.message),process.exit(1)}});G.command("configure").description("Re-run the setup wizard with current values pre-filled").action(async()=>{try{await pt({})}catch(e){console.error("configure failed:",e.message),process.exit(1)}});G.command("update").description("Pull latest template; produce a conflicts report for any files you've modified").action(async()=>{try{await wt({})}catch(e){console.error("update failed:",e.message),process.exit(1)}});G.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 At({offline:!!e.offline})}catch(t){console.error("doctor failed:",t.message),process.exit(1)}});G.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 bt({label:e.label})}catch(t){console.error("pair-whatsapp failed:",t.message),process.exit(1)}});G.parse(process.argv);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{copyFile as M,mkdir as L,readdir as P,stat as h}from"fs/promises";import{dirname as w,join as n,relative as T}from"path";import{fileURLToPath as j}from"url";import{createHash as y}from"crypto";import{readFile as x}from"fs/promises";async function f(t){let r=await x(t);return y("sha256").update(r).digest("hex")}import{mkdir as F,readFile as S,writeFile as R,access as A}from"fs/promises";import{dirname as E,join as m}from"path";var v=".klaudius",d=`${v}/manifest.json`,g=new Set([".env",".mcp.json",".claude/settings.json",".codex/config.toml"]);async function O(t){let r=m(t,d);try{await A(r)}catch{return null}let e=await S(r,"utf-8");return JSON.parse(e)}async function k(t,r){let e=m(t,d);await F(E(e),{recursive:!0}),await R(e,JSON.stringify(r,null,2)+`
|
|
2
|
+
`,"utf-8")}function H(t,r){let e=new Date().toISOString();return{version:1,templateVersion:t,installedAt:e,updatedAt:e,files:r}}async function V(){let t=w(j(import.meta.url)),r=[n(t,"..","template"),n(t,"..","..","..","template"),n(t,"..","..","template")];for(let e of r)try{if((await h(e)).isDirectory())return e}catch{}throw new Error(`Could not find template directory. Searched:
|
|
3
|
+
${r.map(e=>" "+e).join(`
|
|
4
|
+
`)}`)}async function l(t,r=t){let e=await P(t,{withFileTypes:!0}),i=[];for(let s of e){let o=n(t,s.name);s.isDirectory()?i.push(...await l(o,r)):s.isFile()&&i.push(T(r,o))}return i}async function q(t,r,e={}){let i=e.overwrite??!1,s=await l(t),o={},u=0;for(let a of s){let p=n(t,a),c=n(r,a);if(o[a]=await f(p),!i)try{await h(c);continue}catch{}await L(w(c),{recursive:!0}),await M(p,c),u++}return{filesCopied:u,fileHashes:o}}async function z(t){let r=await l(t),e={};for(let i of r)g.has(i)||(e[i]=await f(n(t,i)));return e}export{f as a,g as b,O as c,k as d,H as e,V as f,l as g,q as h,z as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f as a,g as b,h as c,i as d}from"./chunk-ZTT5HVYU.js";export{c as copyTemplate,d as hashAllFiles,a as locateTemplateRoot,b as walkFiles};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "klaudius",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
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": {
|
package/dist/chunk-47ODNABO.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{copyFile as w,mkdir as y,readdir as x,stat as u}from"fs/promises";import{dirname as d,join as s,relative as F}from"path";import{fileURLToPath as R}from"url";import{createHash as h}from"crypto";import{readFile as g}from"fs/promises";async function f(t){let e=await g(t);return h("sha256").update(e).digest("hex")}async function j(){let t=d(R(import.meta.url)),e=[s(t,"..","template"),s(t,"..","..","..","template"),s(t,"..","..","template")];for(let r of e)try{if((await u(r)).isDirectory())return r}catch{}throw new Error(`Could not find template directory. Searched:
|
|
2
|
-
${e.map(r=>" "+r).join(`
|
|
3
|
-
`)}`)}async function l(t,e=t){let r=await x(t,{withFileTypes:!0}),i=[];for(let o of r){let n=s(t,o.name);o.isDirectory()?i.push(...await l(n,e)):o.isFile()&&i.push(F(e,n))}return i}async function k(t,e,r={}){let i=r.overwrite??!1,o=await l(t),n={},p=0;for(let a of o){let m=s(t,a),c=s(e,a);if(n[a]=await f(m),!i)try{await u(c);continue}catch{}await y(d(c),{recursive:!0}),await w(m,c),p++}return{filesCopied:p,fileHashes:n}}async function D(t){let e=await l(t),r={};for(let i of e)r[i]=await f(s(t,i));return r}export{f as a,j as b,l as c,k as d,D as e};
|