@linhnguyen96114/agentkit-engineer 1.4.2 → 1.4.3

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/bin/agentkit.js +1 -1
  3. package/package.json +2 -2
  4. package/scripts-dist/cli/agentkit-clear.js +18 -0
  5. package/scripts-dist/{agentkit-config.js → cli/agentkit-config.js} +3 -3
  6. package/scripts-dist/cli/agentkit-dashboard.js +19 -0
  7. package/scripts-dist/{agentkit-decide.js → cli/agentkit-decide.js} +1 -1
  8. package/scripts-dist/cli/agentkit-doctor.js +20 -0
  9. package/scripts-dist/cli/agentkit-hooks.js +36 -0
  10. package/scripts-dist/cli/agentkit-init.js +39 -0
  11. package/scripts-dist/{agentkit-login.js → cli/agentkit-login.js} +2 -2
  12. package/scripts-dist/{agentkit-logout.js → cli/agentkit-logout.js} +2 -2
  13. package/scripts-dist/cli/agentkit-profile.js +4 -0
  14. package/scripts-dist/cli/agentkit-skills.js +25 -0
  15. package/scripts-dist/cli/agentkit-status.js +22 -0
  16. package/scripts-dist/cli/agentkit-uninstall.js +18 -0
  17. package/scripts-dist/cli/agentkit-update.js +17 -0
  18. package/scripts-dist/{agentkit-whoami.js → cli/agentkit-whoami.js} +2 -2
  19. package/scripts-dist/{check-upstream.js → gen/check-upstream.js} +1 -1
  20. package/scripts-dist/gen/generate-agentkit-configs.js +2 -0
  21. package/scripts-dist/gen/generate-catalogs.js +10 -0
  22. package/scripts-dist/{run-skill-tests.js → gen/run-skill-tests.js} +1 -1
  23. package/scripts-dist/gen/update-check-worker.js +2 -0
  24. package/scripts-dist/{validate-agents-registry.js → gen/validate-agents-registry.js} +1 -1
  25. package/scripts-dist/lib/clear/cli.js +4 -0
  26. package/scripts-dist/lib/cli.js +3 -0
  27. package/scripts-dist/lib/doctor/checks-hooks.js +2 -2
  28. package/scripts-dist/lib/doctor/checks-rules.js +1 -1
  29. package/scripts-dist/lib/doctor/checks-skills.js +1 -1
  30. package/scripts-dist/lib/doctor/checks-soul.js +1 -1
  31. package/scripts-dist/lib/doctor/profile-resolution.js +1 -1
  32. package/scripts-dist/lib/file-operations.js +2 -2
  33. package/scripts-dist/lib/frontmatter.js +2 -0
  34. package/scripts-dist/lib/gitignore.js +5 -5
  35. package/scripts-dist/lib/global-clear-targets.js +1 -1
  36. package/scripts-dist/lib/hook-toggle-registry.js +1 -1
  37. package/scripts-dist/lib/hooks/cli.js +1 -0
  38. package/scripts-dist/lib/init/cli.js +1 -0
  39. package/scripts-dist/lib/install-profile-config.js +1 -1
  40. package/scripts-dist/lib/kit-install-dispatch.js +1 -1
  41. package/scripts-dist/lib/kit-remover.js +1 -1
  42. package/scripts-dist/lib/kit-scan.js +1 -1
  43. package/scripts-dist/lib/kits.js +1 -1
  44. package/scripts-dist/lib/payload/extract.js +1 -1
  45. package/scripts-dist/lib/payload-roots.js +1 -0
  46. package/scripts-dist/lib/profile-block.js +2 -2
  47. package/scripts-dist/lib/profile-remove.js +1 -1
  48. package/scripts-dist/lib/profile-rules.js +1 -1
  49. package/scripts-dist/lib/profile-switch-confirm.js +1 -1
  50. package/scripts-dist/lib/publish/payload-manifest.js +1 -1
  51. package/scripts-dist/lib/publish/public-client-manifest.js +1 -1
  52. package/scripts-dist/lib/server/kit-actions.js +1 -1
  53. package/scripts-dist/lib/skill-profiles.js +1 -1
  54. package/scripts-dist/lib/skill-tests.js +1 -1
  55. package/scripts-dist/lib/skills/cli.js +1 -0
  56. package/scripts-dist/lib/update/cli.js +4 -0
  57. package/scripts-dist/lib/update-notifier.js +1 -1
  58. package/scripts-dist/{build-hermes-distribution.js → ops/build-hermes-distribution.js} +1 -1
  59. package/scripts-dist/agentkit-clear.js +0 -21
  60. package/scripts-dist/agentkit-dashboard.js +0 -19
  61. package/scripts-dist/agentkit-doctor.js +0 -20
  62. package/scripts-dist/agentkit-hooks.js +0 -36
  63. package/scripts-dist/agentkit-init.js +0 -39
  64. package/scripts-dist/agentkit-profile.js +0 -4
  65. package/scripts-dist/agentkit-skills.js +0 -25
  66. package/scripts-dist/agentkit-status.js +0 -22
  67. package/scripts-dist/agentkit-uninstall.js +0 -18
  68. package/scripts-dist/agentkit-update.js +0 -20
  69. package/scripts-dist/generate-agentkit-configs.js +0 -2
  70. package/scripts-dist/generate-catalogs.js +0 -10
  71. package/scripts-dist/update-check-worker.js +0 -2
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(o,e,s,i){i===void 0&&(i=s);var n=Object.getOwnPropertyDescriptor(e,s);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[s]}}),Object.defineProperty(o,i,n)}):(function(o,e,s,i){i===void 0&&(i=s),o[i]=e[s]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(o,e){Object.defineProperty(o,"default",{enumerable:!0,value:e})}):function(o,e){o.default=e}),__importStar=this&&this.__importStar||(function(){var o=function(e){return o=Object.getOwnPropertyNames||function(s){var i=[];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i[i.length]=n);return i},o(e)};return function(e){if(e&&e.__esModule)return e;var s={};if(e!=null)for(var i=o(e),n=0;n<i.length;n++)i[n]!=="default"&&__createBinding(s,e,i[n]);return __setModuleDefault(s,e),s}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.kitRemovalPaths=kitRemovalPaths,exports.removePiExtras=removePiExtras,exports.removeKit=removeKit;const fs=__importStar(require("fs")),path=__importStar(require("path")),kits_1=require("./kits"),file_operations_1=require("./file-operations"),package_root_1=require("./package-root"),gitignore_1=require("./gitignore"),logger_1=require("./logger"),codex_agents_1=require("./codex-agents"),claude_instructions_1=require("./claude-instructions"),kimi_hooks_toml_1=require("./kit-installers/kimi-hooks-toml"),kimi_1=require("./kit-installers/kimi"),omp_managed_1=require("./kit-installers/omp-managed"),pi_config_json_1=require("./kit-installers/pi-config-json"),pi_packages_1=require("./kit-installers/pi-packages"),devin_hooks_1=require("./kit-installers/devin-hooks"),devin_rules_1=require("./kit-installers/devin-rules"),devin_agents_1=require("./kit-installers/devin-agents"),commands_to_skills_1=require("./kit-installers/commands-to-skills"),retired_skills_1=require("./retired-skills"),dropped_mcp_servers_1=require("./dropped-mcp-servers"),pi_home_1=require("./pi-home"),context_mode_remover_1=require("./context-mode-remover"),install_manifest_1=require("./install-manifest");function isFileClaimedByOtherKit(o,e,s,i=[]){return Object.entries(kits_1.kitDefinitions).some(([n,t])=>n!==e&&(t.files.includes(o)||(t.claims??[]).includes(o))&&!i.includes(t.dir)&&fs.existsSync(path.join(s,t.dir)))}function kitRemovalPaths(o,e){const s=kits_1.kitDefinitions[o];if(!s)return[];const i=[],n=t=>{i.includes(t)||i.push(t)};fs.existsSync(path.join(e,s.dir))&&n(`${s.dir}/`);for(const t of s.files)fs.existsSync(path.join(e,t))&&!isFileClaimedByOtherKit(t,o,e,[s.dir])&&n(t);if(o==="claude"){const t=path.join(e,"AGENTS.md");if(fs.existsSync(t))try{(0,claude_instructions_1.hasAikitClaudeBlock)(fs.readFileSync(t,"utf-8"))&&n("AGENTS.md")}catch{}const r=path.join(e,"CLAUDE.md");if(fs.existsSync(r))try{(0,claude_instructions_1.stripAikitClaudeBlock)(fs.readFileSync(r,"utf-8")).removedWholeFile&&n("CLAUDE.md")}catch{}}if(o==="codex"){fs.existsSync(path.join(e,".agents"))&&n(".agents/");const t=path.join(e,"AGENTS.md");if(fs.existsSync(t))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(t,"utf-8"))&&n("AGENTS.md")}catch{}}if(o==="kimi"){const t=path.join(e,"AGENTS.md");if(fs.existsSync(t))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(t,"utf-8"))&&n("AGENTS.md")}catch{}}if(o==="hermes"){const t=path.join(e,"AGENTS.md");if(fs.existsSync(t))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(t,"utf-8"))&&n("AGENTS.md")}catch{}}if(o==="devin"){const t=path.join(e,"AGENTS.md");if(fs.existsSync(t))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(t,"utf-8"))&&n("AGENTS.md")}catch{}const r=i.indexOf(`${s.dir}/`);r>=0&&i.splice(r,1);for(const c of["hooks","scripts","schemas"])fs.existsSync(path.join(e,s.dir,c))&&n(`${s.dir}/${c}/`);for(const c of(0,devin_rules_1.devinOwnedRuleNames)(path.join(e,s.dir,"rules")))n(`${s.dir}/rules/${c}`);for(const c of(0,devin_agents_1.devinOwnedAgentNames)(path.join(e,s.dir,"agents")))n(`${s.dir}/agents/${c}`);for(const c of(0,file_operations_1.shippedSkillEntries)((0,package_root_1.packageRoot)()))fs.existsSync(path.join(e,s.dir,"skills",c.name))&&n(`${s.dir}/skills/${c.name}`);for(const c of["hooks.v1.json","mcp_config.json",".agentkit.json",".agentkitignore"])fs.existsSync(path.join(e,s.dir,c))&&n(`${s.dir}/${c}`)}if(o==="claude"&&fs.existsSync(path.join(e,".mcp.json"))&&n(".mcp.json"),o==="pi"){const t=path.join(e,pi_home_1.PI_PROJECT_DIR),r=path.join(e,"AGENTS.md");if(fs.existsSync(r))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(r,"utf-8"))&&n("AGENTS.md")}catch{}for(const c of[pi_home_1.PI_EXTENSION_FILE,pi_home_1.PI_SUBAGENT_EXTENSION_FILE])fs.existsSync(path.join(t,c))&&n(path.join(".pi",c));for(const c of[pi_home_1.PI_PROMPTS_DIR,pi_home_1.PI_AGENTS_DIR])for(const d of(0,omp_managed_1.ompManagedFileNames)(path.join(t,c)))n(path.join(".pi",c,d))}return o==="cursor"&&fs.existsSync(path.join(e,"plugins","local","context-mode"))&&n(path.join("plugins","local","context-mode")),i}function stripAgentkitBlockFrom(o,e="codex"){if(!fs.existsSync(o))return!1;const s=fs.readFileSync(o,"utf-8");if(!(e==="claude"?claude_instructions_1.hasAikitClaudeBlock:codex_agents_1.hasAikitCodexBlock)(s))return!1;const n=e==="claude"?(0,claude_instructions_1.stripAikitClaudeBlock)(s):(0,codex_agents_1.stripAikitCodexBlock)(s);return n.removedWholeFile?(0,file_operations_1.removeFile)(o)?((0,logger_1.printSuccess)(`Removed ${path.basename(o)}`),!0):!1:n.removed?(fs.writeFileSync(o,n.content,"utf8"),(0,logger_1.printSuccess)(`Removed Agentkit block from ${path.basename(o)}`),!0):!1}function removePiExtras(o,e){let s=!1;stripAgentkitBlockFrom(e)&&(s=!0);for(const r of[pi_home_1.PI_EXTENSION_FILE,pi_home_1.PI_SUBAGENT_EXTENSION_FILE]){const c=path.join(o,r);fs.existsSync(c)&&(0,file_operations_1.removeFile)(c)&&((0,logger_1.printSuccess)(`Removed ${r}`),s=!0)}for(const r of[pi_home_1.PI_PROMPTS_DIR,pi_home_1.PI_AGENTS_DIR])for(const c of(0,omp_managed_1.ompManagedFileNames)(path.join(o,r)))(0,file_operations_1.removeFile)(path.join(o,r,c))&&((0,logger_1.printSuccess)(`Removed ${path.join(r,c)}`),s=!0);const i=(0,pi_home_1.piConfigPath)(o),n=(0,pi_config_json_1.unregisterPiSkillsDir)(i,path.join(o,pi_home_1.PI_SKILLS_SUBDIR));for(const r of n.warnings)(0,logger_1.printWarning)(r);n.removed.length>0&&n.written?((0,logger_1.printSuccess)(`Unregistered the Agentkit skills directory from ${i}`),s=!0):n.warnings.length>0&&fs.existsSync(i)&&(0,logger_1.printWarning)(`Could not update ${i} \u2014 it may still register the skills directory this removal deleted. Edit it by hand, or pi will scan a path that is no longer there.`);const t=(0,pi_config_json_1.unregisterPiPackages)(i,pi_packages_1.PI_PACKAGE_SPECS);for(const r of t.warnings)(0,logger_1.printWarning)(r);return t.removed.length>0&&t.written?((0,logger_1.printSuccess)(`Unregistered ${t.removed.length} Pi extension packages from ${i}`),(0,logger_1.printWarning)(`Their files stay under ${path.join(o,"npm")} \u2014 \`pi remove <spec>\` is the command that reconciles and can take them off disk.`),s=!0):t.warnings.length>0&&fs.existsSync(i)&&(0,logger_1.printWarning)(`Could not update ${i} \u2014 it may still declare this kit's Pi extension packages. Edit it by hand, or Pi will keep loading them.`),s}function removeKit(o,e){const s=kits_1.kitDefinitions[o];if(!s)return(0,logger_1.printWarning)(`Unknown kit: ${o}`),!1;let i=!1;const n=[];(0,context_mode_remover_1.removeContextMode)({scope:"project",platform:o,rootDir:path.join(e,s.dir)});const t=path.join(e,s.dir);o!=="devin"&&fs.existsSync(t)&&(0,file_operations_1.removeDir)(t)&&((0,logger_1.printSuccess)(`Removed ${s.dir}/`),i=!0,n.push(s.dir+"/"));for(const r of s.files){const c=path.join(e,r);!fs.existsSync(c)||isFileClaimedByOtherKit(r,o,e)||(0,file_operations_1.removeFile)(c)&&((0,logger_1.printSuccess)(`Removed ${r}`),i=!0,n.push(r))}if(o==="claude"){stripAgentkitBlockFrom(path.join(e,"AGENTS.md"),"claude")&&(i=!0);const r=path.join(e,"CLAUDE.md");if(fs.existsSync(r)){const c=(0,claude_instructions_1.stripAikitClaudeBlock)(fs.readFileSync(r,"utf-8"));c.removedWholeFile?(0,file_operations_1.removeFile)(r)&&((0,logger_1.printSuccess)("Removed CLAUDE.md"),i=!0,n.push("CLAUDE.md")):c.removed&&(fs.writeFileSync(r,c.content,"utf8"),(0,logger_1.printSuccess)("Removed Agentkit import from CLAUDE.md"),i=!0)}}if(o==="codex"){const r=path.join(e,".agents");fs.existsSync(r)&&(0,file_operations_1.removeDir)(r)&&((0,logger_1.printSuccess)("Removed .agents/"),i=!0,n.push(".agents/")),stripAgentkitBlockFrom(path.join(e,"AGENTS.md"))&&(i=!0)}if(o==="kimi"&&(stripAgentkitBlockFrom(path.join(e,"AGENTS.md"))&&(i=!0),(0,kimi_hooks_toml_1.removeKimiHooks)((0,kimi_1.resolveKimiHomeConfig)())&&((0,logger_1.printSuccess)("Removed Agentkit hooks from the Kimi user config"),i=!0)),o==="hermes"&&stripAgentkitBlockFrom(path.join(e,"AGENTS.md"))&&(i=!0),o==="pi"&&removePiExtras(path.join(e,pi_home_1.PI_PROJECT_DIR),path.join(e,"AGENTS.md"))&&(i=!0),o==="devin"){stripAgentkitBlockFrom(path.join(e,"AGENTS.md"))&&(i=!0),(0,devin_hooks_1.removeDevinHooks)(path.join(t,"hooks.v1.json"),"whole")&&((0,logger_1.printSuccess)("Removed Agentkit hook handlers from .devin/hooks.v1.json"),i=!0);for(const l of["scripts","schemas"])(0,file_operations_1.removeDir)(path.join(t,l))&&((0,logger_1.printSuccess)(`Removed .devin/${l}/`),i=!0);const r=(0,devin_hooks_1.devinHookFileNames)();let c=0;for(const l of r)(0,file_operations_1.removeFile)(path.join(t,l))&&(c+=1);c>0&&((0,logger_1.printSuccess)(`Removed ${c} hook file(s) from .devin/hooks/`),i=!0);const d=[{dir:"rules",names:(0,devin_rules_1.devinOwnedRuleNames)(path.join(t,"rules"))},{dir:"agents",names:(0,devin_agents_1.devinOwnedAgentNames)(path.join(t,"agents"))}].filter(({dir:l,names:f})=>{for(const p of f)(0,file_operations_1.removeFile)(path.join(t,l,p));return f.length>0});for(const{dir:l,names:f}of d)(0,logger_1.printSuccess)(`Removed ${f.length} Agentkit file(s) from .devin/${l}/`),i=!0;const u=[...(0,file_operations_1.shippedSkillEntries)((0,package_root_1.packageRoot)()).map(l=>l.name),...(0,commands_to_skills_1.commandSkillNames)(path.join((0,package_root_1.packageRoot)(),"command")),...(0,retired_skills_1.retiredSkillNames)()];let a=0;for(const l of u)(0,file_operations_1.removeDir)(path.join(t,"skills",l))&&(a+=1);a>0&&((0,logger_1.printSuccess)(`Removed ${a} skill(s) from .devin/skills/`),i=!0);const m=path.join(t,"mcp_config.json");if(fs.existsSync(m)){const{remaining:l}=(0,dropped_mcp_servers_1.removeAgentkitMcpServers)(m);l===0?((0,file_operations_1.removeFile)(m),(0,logger_1.printSuccess)("Removed .devin/mcp_config.json")):l===null?(0,logger_1.printWarning)("Kept .devin/mcp_config.json \u2014 it could not be read as an mcpServers map"):(0,logger_1.printWarning)(`Kept .devin/mcp_config.json \u2014 it still holds ${l} of your own server(s)`),i=!0}for(const l of[".agentkit.json",".agentkitignore",install_manifest_1.MANIFEST_FILENAME])(0,file_operations_1.removeFile)(path.join(t,l))&&(i=!0);for(const l of["skills","agents","rules","hooks/scout-block/vendor","hooks/scout-block","hooks/lib","hooks",""]){const f=l?path.join(t,l):t;try{fs.existsSync(f)&&fs.readdirSync(f).length===0&&(fs.rmdirSync(f),l||n.push(`${s.dir}/`))}catch{}}}if(o==="claude"){const r=path.join(e,".mcp.json");fs.existsSync(r)&&(0,file_operations_1.removeFile)(r)&&((0,logger_1.printSuccess)("Removed .mcp.json from project root"),i=!0,n.push(".mcp.json"))}if(o==="cursor"){const r=path.join(e,".cursor","mcp.json");fs.existsSync(r)&&(0,file_operations_1.removeFile)(r)&&((0,logger_1.printSuccess)("Removed mcp.json from .cursor/"),i=!0,n.push(".cursor/mcp.json"));const c=path.join(e,".cursor","hooks.json");fs.existsSync(c)&&(0,file_operations_1.removeFile)(c)&&((0,logger_1.printSuccess)("Removed hooks.json from .cursor/"),i=!0,n.push(".cursor/hooks.json"));const d=path.join(e,"plugins","local","context-mode");fs.existsSync(d)&&(0,file_operations_1.removeDir)(d)&&((0,logger_1.printSuccess)("Removed context-mode from Cursor local plugins directory"),i=!0);const u=path.join(e,".cursor");fs.existsSync(u)&&fs.readdirSync(u).length===0&&(0,file_operations_1.removeDir)(u)&&((0,logger_1.printSuccess)("Removed empty .cursor/ directory"),i=!0,n.push(".cursor/"))}return n.length>0&&(0,gitignore_1.cleanupGitignore)(n,e),i}
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(o,e,s,i){i===void 0&&(i=s);var n=Object.getOwnPropertyDescriptor(e,s);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[s]}}),Object.defineProperty(o,i,n)}):(function(o,e,s,i){i===void 0&&(i=s),o[i]=e[s]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(o,e){Object.defineProperty(o,"default",{enumerable:!0,value:e})}):function(o,e){o.default=e}),__importStar=this&&this.__importStar||(function(){var o=function(e){return o=Object.getOwnPropertyNames||function(s){var i=[];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i[i.length]=n);return i},o(e)};return function(e){if(e&&e.__esModule)return e;var s={};if(e!=null)for(var i=o(e),n=0;n<i.length;n++)i[n]!=="default"&&__createBinding(s,e,i[n]);return __setModuleDefault(s,e),s}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.kitRemovalPaths=kitRemovalPaths,exports.removePiExtras=removePiExtras,exports.removeKit=removeKit;const fs=__importStar(require("fs")),path=__importStar(require("path")),kits_1=require("./kits"),file_operations_1=require("./file-operations"),package_root_1=require("./package-root"),gitignore_1=require("./gitignore"),logger_1=require("./logger"),codex_agents_1=require("./codex-agents"),claude_instructions_1=require("./claude-instructions"),kimi_hooks_toml_1=require("./kit-installers/kimi-hooks-toml"),kimi_1=require("./kit-installers/kimi"),omp_managed_1=require("./kit-installers/omp-managed"),pi_config_json_1=require("./kit-installers/pi-config-json"),pi_packages_1=require("./kit-installers/pi-packages"),devin_hooks_1=require("./kit-installers/devin-hooks"),devin_rules_1=require("./kit-installers/devin-rules"),devin_agents_1=require("./kit-installers/devin-agents"),commands_to_skills_1=require("./kit-installers/commands-to-skills"),retired_skills_1=require("./retired-skills"),dropped_mcp_servers_1=require("./dropped-mcp-servers"),pi_home_1=require("./pi-home"),context_mode_remover_1=require("./context-mode-remover"),install_manifest_1=require("./install-manifest"),payload_roots_1=require("./payload-roots");function isFileClaimedByOtherKit(o,e,s,i=[]){return Object.entries(kits_1.kitDefinitions).some(([n,t])=>n!==e&&(t.files.includes(o)||(t.claims??[]).includes(o))&&!i.includes(t.dir)&&fs.existsSync(path.join(s,t.dir)))}function kitRemovalPaths(o,e){const s=kits_1.kitDefinitions[o];if(!s)return[];const i=[],n=t=>{i.includes(t)||i.push(t)};fs.existsSync(path.join(e,s.dir))&&n(`${s.dir}/`);for(const t of s.files)fs.existsSync(path.join(e,t))&&!isFileClaimedByOtherKit(t,o,e,[s.dir])&&n(t);if(o==="claude"){const t=path.join(e,"AGENTS.md");if(fs.existsSync(t))try{(0,claude_instructions_1.hasAikitClaudeBlock)(fs.readFileSync(t,"utf-8"))&&n("AGENTS.md")}catch{}const r=path.join(e,"CLAUDE.md");if(fs.existsSync(r))try{(0,claude_instructions_1.stripAikitClaudeBlock)(fs.readFileSync(r,"utf-8")).removedWholeFile&&n("CLAUDE.md")}catch{}}if(o==="codex"){fs.existsSync(path.join(e,".agents"))&&n(".agents/");const t=path.join(e,"AGENTS.md");if(fs.existsSync(t))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(t,"utf-8"))&&n("AGENTS.md")}catch{}}if(o==="kimi"){const t=path.join(e,"AGENTS.md");if(fs.existsSync(t))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(t,"utf-8"))&&n("AGENTS.md")}catch{}}if(o==="hermes"){const t=path.join(e,"AGENTS.md");if(fs.existsSync(t))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(t,"utf-8"))&&n("AGENTS.md")}catch{}}if(o==="devin"){const t=path.join(e,"AGENTS.md");if(fs.existsSync(t))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(t,"utf-8"))&&n("AGENTS.md")}catch{}const r=i.indexOf(`${s.dir}/`);r>=0&&i.splice(r,1);for(const c of["hooks","scripts","schemas"])fs.existsSync(path.join(e,s.dir,c))&&n(`${s.dir}/${c}/`);for(const c of(0,devin_rules_1.devinOwnedRuleNames)(path.join(e,s.dir,"rules")))n(`${s.dir}/rules/${c}`);for(const c of(0,devin_agents_1.devinOwnedAgentNames)(path.join(e,s.dir,"agents")))n(`${s.dir}/agents/${c}`);for(const c of(0,file_operations_1.shippedSkillEntries)((0,package_root_1.packageRoot)()))fs.existsSync(path.join(e,s.dir,"skills",c.name))&&n(`${s.dir}/skills/${c.name}`);for(const c of["hooks.v1.json","mcp_config.json",".agentkit.json",".agentkitignore"])fs.existsSync(path.join(e,s.dir,c))&&n(`${s.dir}/${c}`)}if(o==="claude"&&fs.existsSync(path.join(e,".mcp.json"))&&n(".mcp.json"),o==="pi"){const t=path.join(e,pi_home_1.PI_PROJECT_DIR),r=path.join(e,"AGENTS.md");if(fs.existsSync(r))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(r,"utf-8"))&&n("AGENTS.md")}catch{}for(const c of[pi_home_1.PI_EXTENSION_FILE,pi_home_1.PI_SUBAGENT_EXTENSION_FILE])fs.existsSync(path.join(t,c))&&n(path.join(".pi",c));for(const c of[pi_home_1.PI_PROMPTS_DIR,pi_home_1.PI_AGENTS_DIR])for(const f of(0,omp_managed_1.ompManagedFileNames)(path.join(t,c)))n(path.join(".pi",c,f))}return o==="cursor"&&fs.existsSync(path.join(e,"plugins","local","context-mode"))&&n(path.join("plugins","local","context-mode")),i}function stripAgentkitBlockFrom(o,e="codex"){if(!fs.existsSync(o))return!1;const s=fs.readFileSync(o,"utf-8");if(!(e==="claude"?claude_instructions_1.hasAikitClaudeBlock:codex_agents_1.hasAikitCodexBlock)(s))return!1;const n=e==="claude"?(0,claude_instructions_1.stripAikitClaudeBlock)(s):(0,codex_agents_1.stripAikitCodexBlock)(s);return n.removedWholeFile?(0,file_operations_1.removeFile)(o)?((0,logger_1.printSuccess)(`Removed ${path.basename(o)}`),!0):!1:n.removed?(fs.writeFileSync(o,n.content,"utf8"),(0,logger_1.printSuccess)(`Removed Agentkit block from ${path.basename(o)}`),!0):!1}function removePiExtras(o,e){let s=!1;stripAgentkitBlockFrom(e)&&(s=!0);for(const r of[pi_home_1.PI_EXTENSION_FILE,pi_home_1.PI_SUBAGENT_EXTENSION_FILE]){const c=path.join(o,r);fs.existsSync(c)&&(0,file_operations_1.removeFile)(c)&&((0,logger_1.printSuccess)(`Removed ${r}`),s=!0)}for(const r of[pi_home_1.PI_PROMPTS_DIR,pi_home_1.PI_AGENTS_DIR])for(const c of(0,omp_managed_1.ompManagedFileNames)(path.join(o,r)))(0,file_operations_1.removeFile)(path.join(o,r,c))&&((0,logger_1.printSuccess)(`Removed ${path.join(r,c)}`),s=!0);const i=(0,pi_home_1.piConfigPath)(o),n=(0,pi_config_json_1.unregisterPiSkillsDir)(i,path.join(o,pi_home_1.PI_SKILLS_SUBDIR));for(const r of n.warnings)(0,logger_1.printWarning)(r);n.removed.length>0&&n.written?((0,logger_1.printSuccess)(`Unregistered the Agentkit skills directory from ${i}`),s=!0):n.warnings.length>0&&fs.existsSync(i)&&(0,logger_1.printWarning)(`Could not update ${i} \u2014 it may still register the skills directory this removal deleted. Edit it by hand, or pi will scan a path that is no longer there.`);const t=(0,pi_config_json_1.unregisterPiPackages)(i,pi_packages_1.PI_PACKAGE_SPECS);for(const r of t.warnings)(0,logger_1.printWarning)(r);return t.removed.length>0&&t.written?((0,logger_1.printSuccess)(`Unregistered ${t.removed.length} Pi extension packages from ${i}`),(0,logger_1.printWarning)(`Their files stay under ${path.join(o,"npm")} \u2014 \`pi remove <spec>\` is the command that reconciles and can take them off disk.`),s=!0):t.warnings.length>0&&fs.existsSync(i)&&(0,logger_1.printWarning)(`Could not update ${i} \u2014 it may still declare this kit's Pi extension packages. Edit it by hand, or Pi will keep loading them.`),s}function removeKit(o,e){const s=kits_1.kitDefinitions[o];if(!s)return(0,logger_1.printWarning)(`Unknown kit: ${o}`),!1;let i=!1;const n=[];(0,context_mode_remover_1.removeContextMode)({scope:"project",platform:o,rootDir:path.join(e,s.dir)});const t=path.join(e,s.dir);o!=="devin"&&fs.existsSync(t)&&(0,file_operations_1.removeDir)(t)&&((0,logger_1.printSuccess)(`Removed ${s.dir}/`),i=!0,n.push(s.dir+"/"));for(const r of s.files){const c=path.join(e,r);!fs.existsSync(c)||isFileClaimedByOtherKit(r,o,e)||(0,file_operations_1.removeFile)(c)&&((0,logger_1.printSuccess)(`Removed ${r}`),i=!0,n.push(r))}if(o==="claude"){stripAgentkitBlockFrom(path.join(e,"AGENTS.md"),"claude")&&(i=!0);const r=path.join(e,"CLAUDE.md");if(fs.existsSync(r)){const c=(0,claude_instructions_1.stripAikitClaudeBlock)(fs.readFileSync(r,"utf-8"));c.removedWholeFile?(0,file_operations_1.removeFile)(r)&&((0,logger_1.printSuccess)("Removed CLAUDE.md"),i=!0,n.push("CLAUDE.md")):c.removed&&(fs.writeFileSync(r,c.content,"utf8"),(0,logger_1.printSuccess)("Removed Agentkit import from CLAUDE.md"),i=!0)}}if(o==="codex"){const r=path.join(e,".agents");fs.existsSync(r)&&(0,file_operations_1.removeDir)(r)&&((0,logger_1.printSuccess)("Removed .agents/"),i=!0,n.push(".agents/")),stripAgentkitBlockFrom(path.join(e,"AGENTS.md"))&&(i=!0)}if(o==="kimi"&&(stripAgentkitBlockFrom(path.join(e,"AGENTS.md"))&&(i=!0),(0,kimi_hooks_toml_1.removeKimiHooks)((0,kimi_1.resolveKimiHomeConfig)())&&((0,logger_1.printSuccess)("Removed Agentkit hooks from the Kimi user config"),i=!0)),o==="hermes"&&stripAgentkitBlockFrom(path.join(e,"AGENTS.md"))&&(i=!0),o==="pi"&&removePiExtras(path.join(e,pi_home_1.PI_PROJECT_DIR),path.join(e,"AGENTS.md"))&&(i=!0),o==="devin"){stripAgentkitBlockFrom(path.join(e,"AGENTS.md"))&&(i=!0),(0,devin_hooks_1.removeDevinHooks)(path.join(t,"hooks.v1.json"),"whole")&&((0,logger_1.printSuccess)("Removed Agentkit hook handlers from .devin/hooks.v1.json"),i=!0);for(const l of["scripts","schemas"])(0,file_operations_1.removeDir)(path.join(t,l))&&((0,logger_1.printSuccess)(`Removed .devin/${l}/`),i=!0);const r=(0,devin_hooks_1.devinHookFileNames)();let c=0;for(const l of r)(0,file_operations_1.removeFile)(path.join(t,l))&&(c+=1);c>0&&((0,logger_1.printSuccess)(`Removed ${c} hook file(s) from .devin/hooks/`),i=!0);const f=[{dir:"rules",names:(0,devin_rules_1.devinOwnedRuleNames)(path.join(t,"rules"))},{dir:"agents",names:(0,devin_agents_1.devinOwnedAgentNames)(path.join(t,"agents"))}].filter(({dir:l,names:d})=>{for(const p of d)(0,file_operations_1.removeFile)(path.join(t,l,p));return d.length>0});for(const{dir:l,names:d}of f)(0,logger_1.printSuccess)(`Removed ${d.length} Agentkit file(s) from .devin/${l}/`),i=!0;const u=[...(0,file_operations_1.shippedSkillEntries)((0,package_root_1.packageRoot)()).map(l=>l.name),...(0,commands_to_skills_1.commandSkillNames)(path.join((0,package_root_1.packageRoot)(),payload_roots_1.COMMAND_SOURCE_DIR)),...(0,retired_skills_1.retiredSkillNames)()];let a=0;for(const l of u)(0,file_operations_1.removeDir)(path.join(t,"skills",l))&&(a+=1);a>0&&((0,logger_1.printSuccess)(`Removed ${a} skill(s) from .devin/skills/`),i=!0);const m=path.join(t,"mcp_config.json");if(fs.existsSync(m)){const{remaining:l}=(0,dropped_mcp_servers_1.removeAgentkitMcpServers)(m);l===0?((0,file_operations_1.removeFile)(m),(0,logger_1.printSuccess)("Removed .devin/mcp_config.json")):l===null?(0,logger_1.printWarning)("Kept .devin/mcp_config.json \u2014 it could not be read as an mcpServers map"):(0,logger_1.printWarning)(`Kept .devin/mcp_config.json \u2014 it still holds ${l} of your own server(s)`),i=!0}for(const l of[".agentkit.json",".agentkitignore",install_manifest_1.MANIFEST_FILENAME])(0,file_operations_1.removeFile)(path.join(t,l))&&(i=!0);for(const l of["skills","agents","rules","hooks/scout-block/vendor","hooks/scout-block","hooks/lib","hooks",""]){const d=l?path.join(t,l):t;try{fs.existsSync(d)&&fs.readdirSync(d).length===0&&(fs.rmdirSync(d),l||n.push(`${s.dir}/`))}catch{}}}if(o==="claude"){const r=path.join(e,".mcp.json");fs.existsSync(r)&&(0,file_operations_1.removeFile)(r)&&((0,logger_1.printSuccess)("Removed .mcp.json from project root"),i=!0,n.push(".mcp.json"))}if(o==="cursor"){const r=path.join(e,".cursor","mcp.json");fs.existsSync(r)&&(0,file_operations_1.removeFile)(r)&&((0,logger_1.printSuccess)("Removed mcp.json from .cursor/"),i=!0,n.push(".cursor/mcp.json"));const c=path.join(e,".cursor","hooks.json");fs.existsSync(c)&&(0,file_operations_1.removeFile)(c)&&((0,logger_1.printSuccess)("Removed hooks.json from .cursor/"),i=!0,n.push(".cursor/hooks.json"));const f=path.join(e,"plugins","local","context-mode");fs.existsSync(f)&&(0,file_operations_1.removeDir)(f)&&((0,logger_1.printSuccess)("Removed context-mode from Cursor local plugins directory"),i=!0);const u=path.join(e,".cursor");fs.existsSync(u)&&fs.readdirSync(u).length===0&&(0,file_operations_1.removeDir)(u)&&((0,logger_1.printSuccess)("Removed empty .cursor/ directory"),i=!0,n.push(".cursor/"))}return n.length>0&&(0,gitignore_1.cleanupGitignore)(n,e),i}
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),__importStar=this&&this.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var r=t(e),i=0;i<r.length;i++)r[i]!=="default"&&__createBinding(n,e,r[i]);return __setModuleDefault(n,e),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.PROJECT_KITS=void 0,exports.scanForInstalls=scanForInstalls,exports.probeGlobalInstalls=probeGlobalInstalls;const fs=__importStar(require("fs")),path=__importStar(require("path")),kit_context_1=require("./kit-context"),init_install_scope_1=require("./init-install-scope"),install_profile_config_1=require("./install-profile-config"),kits_1=require("./kits");exports.PROJECT_KITS=["claude","opencode","cursor","antigravity","codex","kimi","hermes","openclaw","grok","pi","devin"];const DEFAULT_MAX_DEPTH=4,SKIP_DIRS=new Set(["node_modules",".git","dist","build","coverage",".next",".turbo","vendor","Library"]);function recordFor(t,e,n,r){const i=new Date().toISOString(),{version:o}=(0,install_profile_config_1.readInstallSettings)(path.join(r,".agentkit.json"));return{path:n,kit:t,scope:e,kitRoot:r,...o?{version:o}:{},installedAt:i,updatedAt:i}}function installsIn(t){const e=[];for(const n of exports.PROJECT_KITS)(0,init_install_scope_1.isKitInstalledInProject)(n,t)&&e.push(recordFor(n,"project",t,path.join(t,kits_1.kitDefinitions[n].dir)));return e}function scanForInstalls(t,{maxDepth:e=DEFAULT_MAX_DEPTH}={}){const n=[],r=new Set;let i=t.map(o=>path.resolve(o)).filter(o=>!r.has(o));for(let o=0;o<=e&&i.length>0;o+=1){const c=[];for(const s of i){if(r.has(s)||(r.add(s),n.push(...installsIn(s)),o===e))continue;let l;try{l=fs.readdirSync(s,{withFileTypes:!0})}catch{continue}for(const a of l)!a.isDirectory()||a.isSymbolicLink()||a.name.startsWith(".")||SKIP_DIRS.has(a.name)||c.push(path.join(s,a.name))}i=c}return n}function probeGlobalInstalls(){return kit_context_1.GLOBAL_KITS.filter(init_install_scope_1.isKitInstalledGlobally).map(t=>{const e=(0,kit_context_1.globalBaseDir)(t);return recordFor(t,"global",e,e)})}
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),__importStar=this&&this.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i<r.length;i++)r[i]!=="default"&&__createBinding(n,t,r[i]);return __setModuleDefault(n,t),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.scanForInstalls=scanForInstalls,exports.probeGlobalInstalls=probeGlobalInstalls;const fs=__importStar(require("fs")),path=__importStar(require("path")),kit_context_1=require("./kit-context"),init_install_scope_1=require("./init-install-scope"),install_profile_config_1=require("./install-profile-config"),kits_1=require("./kits"),DEFAULT_MAX_DEPTH=4,SKIP_DIRS=new Set(["node_modules",".git","dist","build","coverage",".next",".turbo","vendor","Library"]);function recordFor(e,t,n,r){const i=new Date().toISOString(),{version:o}=(0,install_profile_config_1.readInstallSettings)(path.join(r,".agentkit.json"));return{path:n,kit:e,scope:t,kitRoot:r,...o?{version:o}:{},installedAt:i,updatedAt:i}}function installsIn(e){const t=[];for(const n of kits_1.PROJECT_KITS)(0,init_install_scope_1.isKitInstalledInProject)(n,e)&&t.push(recordFor(n,"project",e,path.join(e,kits_1.kitDefinitions[n].dir)));return t}function scanForInstalls(e,{maxDepth:t=DEFAULT_MAX_DEPTH}={}){const n=[],r=new Set;let i=e.map(o=>path.resolve(o)).filter(o=>!r.has(o));for(let o=0;o<=t&&i.length>0;o+=1){const a=[];for(const s of i){if(r.has(s)||(r.add(s),n.push(...installsIn(s)),o===t))continue;let c;try{c=fs.readdirSync(s,{withFileTypes:!0})}catch{continue}for(const l of c)!l.isDirectory()||l.isSymbolicLink()||l.name.startsWith(".")||SKIP_DIRS.has(l.name)||a.push(path.join(s,l.name))}i=a}return n}function probeGlobalInstalls(){return kit_context_1.GLOBAL_KITS.filter(init_install_scope_1.isKitInstalledGlobally).map(e=>{const t=(0,kit_context_1.globalBaseDir)(e);return recordFor(e,"global",t,t)})}
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(e,i,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(i,n);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[n]}}),Object.defineProperty(e,r,o)}):(function(e,i,n,r){r===void 0&&(r=n),e[r]=i[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}):function(e,i){e.default=i}),__importStar=this&&this.__importStar||(function(){var e=function(i){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(i)};return function(i){if(i&&i.__esModule)return i;var n={};if(i!=null)for(var r=e(i),o=0;o<r.length;o++)r[o]!=="default"&&__createBinding(n,i,r[o]);return __setModuleDefault(n,i),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.ALL_KIT_NAMES=exports.PROJECT_ONLY_INSTALL_KITS=exports.GLOBAL_ONLY_INSTALL_KITS=exports.HOST_DETECTION=exports.kitDefinitions=void 0,exports.supportsProjectInstall=supportsProjectInstall,exports.supportsGlobalInstall=supportsGlobalInstall,exports.isHostInstalled=isHostInstalled,exports.detectAllGlobalCLIs=detectAllGlobalCLIs,exports.detectCurrentKit=detectCurrentKit,exports.choiceToKit=choiceToKit,exports.isKitName=isKitName,exports.normalizeKitName=normalizeKitName;const fs=__importStar(require("fs")),path=__importStar(require("path")),os=__importStar(require("os")),child_process_1=require("child_process");exports.kitDefinitions={claude:{name:"Claude Code",dir:".claude",files:[".mcp.json"],claims:["CLAUDE.md","AGENTS.md"]},cursor:{name:"Cursor AI",dir:".cursor",files:["AGENTS.md"]},augment:{name:"Augment Code",dir:".claude",files:["CLAUDE.md"]},antigravity:{name:"Antigravity",dir:".agents",files:["GEMINI.md"]},opencode:{name:"OpenCode",dir:".opencode",files:[]},codex:{name:"OpenAI Codex",dir:".codex",files:[]},kimi:{name:"Kimi Code",dir:".kimi-code",files:[]},hermes:{name:"Hermes Agent",dir:".hermes-kit",files:[]},openclaw:{name:"OpenClaw",dir:".openclaw-kit",files:[]},omp:{name:"Oh My Pi",dir:".omp",files:[]},grok:{name:"Grok Build",dir:".grok",files:[]},pi:{name:"Pi",dir:path.join(".pi","agentkit"),files:[]},devin:{name:"Devin CLI",dir:".devin",files:[]}};function checkCommandExists(e){try{return(0,child_process_1.execSync)(`command -v ${e}`,{stdio:"ignore"}),!0}catch{return!1}}function checkMacApp(e){return process.platform!=="darwin"?!1:[path.join("/Applications",`${e}.app`),path.join(os.homedir(),"Applications",`${e}.app`)].some(i=>fs.existsSync(i))}exports.HOST_DETECTION={claude:{commands:["claude","augment"]},opencode:{commands:["opencode"]},cursor:{commands:["cursor"],macApps:["Cursor"]},antigravity:{commands:["antigravity","gemini"],macApps:["Antigravity","Antigravity IDE"]},codex:{commands:["codex"]},kimi:{commands:["kimi"]},hermes:{commands:["hermes"]},openclaw:{commands:["openclaw"]},omp:{commands:["omp"]},grok:{commands:["grok"]},pi:{commands:["pi"]},devin:{commands:["devin"]}},exports.GLOBAL_ONLY_INSTALL_KITS=["hermes","openclaw","omp"],exports.PROJECT_ONLY_INSTALL_KITS=["augment"];function supportsProjectInstall(e){return!exports.GLOBAL_ONLY_INSTALL_KITS.includes(e)}function supportsGlobalInstall(e){return!exports.PROJECT_ONLY_INSTALL_KITS.includes(e)}function isHostInstalled(e){const i=exports.HOST_DETECTION[e];return i?(i.commands??[]).some(checkCommandExists)||(i.macApps??[]).some(checkMacApp):!1}function detectAllGlobalCLIs(){return Object.keys(exports.HOST_DETECTION).filter(e=>isHostInstalled(e))}function detectGlobalCLI(){const e=detectAllGlobalCLIs();return e.length>1?null:e[0]??null}function detectCurrentKit(e){const i=os.homedir();if(!(path.resolve(e)===path.resolve(i))){const o=[{kit:"cursor",dir:path.join(".cursor","rules"),number:"3"},{kit:"antigravity",dir:".agents",number:"4"},{kit:"opencode",dir:".opencode",number:"2"},{kit:"codex",dir:".codex",number:"5"},{kit:"kimi",dir:".kimi-code",number:"6"},{kit:"hermes",dir:".hermes-kit",number:"7"},{kit:"openclaw",dir:".openclaw-kit",number:"8"},{kit:"grok",dir:path.join(".grok","rules"),number:"10"},{kit:"pi",dir:path.join(".pi","agentkit"),number:"11"},{kit:"devin",dir:path.join(".devin","rules"),number:"12"},{kit:"claude",dir:".claude",number:"1"}],c=path.join(e,".cursorrules"),s=path.join(e,".claude");if(fs.existsSync(c)&&fs.existsSync(s))return{kit:"cursor",number:"3"};for(const{kit:a,dir:u,number:d}of o){const t=path.join(e,u);if(fs.existsSync(t)){const l=fs.statSync(t).isDirectory(),m=fs.statSync(t).isFile();if(l||m)return{kit:a,number:d}}}}const r=detectGlobalCLI();return r?{kit:r,number:{claude:"1",opencode:"2",cursor:"3",antigravity:"4",codex:"5",kimi:"6",augment:"1",hermes:"7",openclaw:"8",omp:"9",grok:"10",pi:"11",devin:"12"}[r]}:null}function choiceToKit(e){return{1:"claude",2:"opencode",3:"cursor",4:"antigravity",5:"codex",6:"kimi"}[e]||null}exports.ALL_KIT_NAMES=["claude","cursor","augment","antigravity","opencode","codex","kimi","hermes","openclaw","omp","grok","pi","devin"];function isKitName(e){return exports.ALL_KIT_NAMES.includes(e)}const KIT_NAME_ALIASES={claude:"claude","claude-code":"claude",claudecode:"claude",claude_code:"claude",cursor:"cursor","cursor-ai":"cursor",cursorai:"cursor",cursor_ai:"cursor",augment:"augment","augment-code":"augment",augmentcode:"augment",antigravity:"antigravity",gemini:"antigravity",google:"antigravity","google-antigravity":"antigravity",opencode:"opencode","open-code":"opencode",codex:"codex",openai:"codex","openai-codex":"codex",openai_codex:"codex",kimi:"kimi","kimi-code":"kimi",kimicode:"kimi",moonshot:"kimi",hermes:"hermes","hermes-agent":"hermes",hermesagent:"hermes",openclaw:"openclaw","open-claw":"openclaw",omp:"omp","oh-my-pi":"omp",ohmypi:"omp",oh_my_pi:"omp",pi:"pi","pi-agent":"pi",piagent:"pi","pi-coding-agent":"pi",picodingagent:"pi",earendil:"pi",grok:"grok","grok-build":"grok",grokbuild:"grok",xai:"grok",devin:"devin","devin-cli":"devin",devincli:"devin",cognition:"devin"};function normalizeKitName(e){if(!e||typeof e!="string")return null;const i=e.trim().toLowerCase();return KIT_NAME_ALIASES[i]??null}
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(e,i,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(i,n);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[n]}}),Object.defineProperty(e,r,o)}):(function(e,i,n,r){r===void 0&&(r=n),e[r]=i[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}):function(e,i){e.default=i}),__importStar=this&&this.__importStar||(function(){var e=function(i){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},e(i)};return function(i){if(i&&i.__esModule)return i;var n={};if(i!=null)for(var r=e(i),o=0;o<r.length;o++)r[o]!=="default"&&__createBinding(n,i,r[o]);return __setModuleDefault(n,i),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.ALL_KIT_NAMES=exports.PROJECT_KITS=exports.PROJECT_ONLY_INSTALL_KITS=exports.GLOBAL_ONLY_INSTALL_KITS=exports.HOST_DETECTION=exports.kitDefinitions=void 0,exports.supportsProjectInstall=supportsProjectInstall,exports.supportsGlobalInstall=supportsGlobalInstall,exports.isHostInstalled=isHostInstalled,exports.detectAllGlobalCLIs=detectAllGlobalCLIs,exports.detectCurrentKit=detectCurrentKit,exports.choiceToKit=choiceToKit,exports.isKitName=isKitName,exports.normalizeKitName=normalizeKitName;const fs=__importStar(require("fs")),path=__importStar(require("path")),os=__importStar(require("os")),child_process_1=require("child_process");exports.kitDefinitions={claude:{name:"Claude Code",dir:".claude",files:[".mcp.json"],claims:["CLAUDE.md","AGENTS.md"]},cursor:{name:"Cursor AI",dir:".cursor",files:["AGENTS.md"]},augment:{name:"Augment Code",dir:".claude",files:["CLAUDE.md"]},antigravity:{name:"Antigravity",dir:".agents",files:["GEMINI.md"]},opencode:{name:"OpenCode",dir:".opencode",files:[]},codex:{name:"OpenAI Codex",dir:".codex",files:[]},kimi:{name:"Kimi Code",dir:".kimi-code",files:[]},hermes:{name:"Hermes Agent",dir:".hermes-kit",files:[]},openclaw:{name:"OpenClaw",dir:".openclaw-kit",files:[]},omp:{name:"Oh My Pi",dir:".omp",files:[]},grok:{name:"Grok Build",dir:".grok",files:[]},pi:{name:"Pi",dir:path.join(".pi","agentkit"),files:[]},devin:{name:"Devin CLI",dir:".devin",files:[]}};function checkCommandExists(e){try{return(0,child_process_1.execSync)(`command -v ${e}`,{stdio:"ignore"}),!0}catch{return!1}}function checkMacApp(e){return process.platform!=="darwin"?!1:[path.join("/Applications",`${e}.app`),path.join(os.homedir(),"Applications",`${e}.app`)].some(i=>fs.existsSync(i))}exports.HOST_DETECTION={claude:{commands:["claude","augment"]},opencode:{commands:["opencode"]},cursor:{commands:["cursor"],macApps:["Cursor"]},antigravity:{commands:["antigravity","gemini"],macApps:["Antigravity","Antigravity IDE"]},codex:{commands:["codex"]},kimi:{commands:["kimi"]},hermes:{commands:["hermes"]},openclaw:{commands:["openclaw"]},omp:{commands:["omp"]},grok:{commands:["grok"]},pi:{commands:["pi"]},devin:{commands:["devin"]}},exports.GLOBAL_ONLY_INSTALL_KITS=["hermes","openclaw","omp"],exports.PROJECT_ONLY_INSTALL_KITS=["augment"],exports.PROJECT_KITS=["claude","opencode","cursor","antigravity","codex","kimi","hermes","openclaw","grok","pi","devin"];function supportsProjectInstall(e){return!exports.GLOBAL_ONLY_INSTALL_KITS.includes(e)}function supportsGlobalInstall(e){return!exports.PROJECT_ONLY_INSTALL_KITS.includes(e)}function isHostInstalled(e){const i=exports.HOST_DETECTION[e];return i?(i.commands??[]).some(checkCommandExists)||(i.macApps??[]).some(checkMacApp):!1}function detectAllGlobalCLIs(){return Object.keys(exports.HOST_DETECTION).filter(e=>isHostInstalled(e))}function detectGlobalCLI(){const e=detectAllGlobalCLIs();return e.length>1?null:e[0]??null}function detectCurrentKit(e){const i=os.homedir();if(!(path.resolve(e)===path.resolve(i))){const o=[{kit:"cursor",dir:path.join(".cursor","rules"),number:"3"},{kit:"antigravity",dir:".agents",number:"4"},{kit:"opencode",dir:".opencode",number:"2"},{kit:"codex",dir:".codex",number:"5"},{kit:"kimi",dir:".kimi-code",number:"6"},{kit:"hermes",dir:".hermes-kit",number:"7"},{kit:"openclaw",dir:".openclaw-kit",number:"8"},{kit:"grok",dir:path.join(".grok","rules"),number:"10"},{kit:"pi",dir:path.join(".pi","agentkit"),number:"11"},{kit:"devin",dir:path.join(".devin","rules"),number:"12"},{kit:"claude",dir:".claude",number:"1"}],c=path.join(e,".cursorrules"),s=path.join(e,".claude");if(fs.existsSync(c)&&fs.existsSync(s))return{kit:"cursor",number:"3"};for(const{kit:a,dir:u,number:d}of o){const t=path.join(e,u);if(fs.existsSync(t)){const l=fs.statSync(t).isDirectory(),m=fs.statSync(t).isFile();if(l||m)return{kit:a,number:d}}}}const r=detectGlobalCLI();return r?{kit:r,number:{claude:"1",opencode:"2",cursor:"3",antigravity:"4",codex:"5",kimi:"6",augment:"1",hermes:"7",openclaw:"8",omp:"9",grok:"10",pi:"11",devin:"12"}[r]}:null}function choiceToKit(e){return{1:"claude",2:"opencode",3:"cursor",4:"antigravity",5:"codex",6:"kimi"}[e]||null}exports.ALL_KIT_NAMES=["claude","cursor","augment","antigravity","opencode","codex","kimi","hermes","openclaw","omp","grok","pi","devin"];function isKitName(e){return exports.ALL_KIT_NAMES.includes(e)}const KIT_NAME_ALIASES={claude:"claude","claude-code":"claude",claudecode:"claude",claude_code:"claude",cursor:"cursor","cursor-ai":"cursor",cursorai:"cursor",cursor_ai:"cursor",augment:"augment","augment-code":"augment",augmentcode:"augment",antigravity:"antigravity",gemini:"antigravity",google:"antigravity","google-antigravity":"antigravity",opencode:"opencode","open-code":"opencode",codex:"codex",openai:"codex","openai-codex":"codex",openai_codex:"codex",kimi:"kimi","kimi-code":"kimi",kimicode:"kimi",moonshot:"kimi",hermes:"hermes","hermes-agent":"hermes",hermesagent:"hermes",openclaw:"openclaw","open-claw":"openclaw",omp:"omp","oh-my-pi":"omp",ohmypi:"omp",oh_my_pi:"omp",pi:"pi","pi-agent":"pi",piagent:"pi","pi-coding-agent":"pi",picodingagent:"pi",earendil:"pi",grok:"grok","grok-build":"grok",grokbuild:"grok",xai:"grok",devin:"devin","devin-cli":"devin",devincli:"devin",cognition:"devin"};function normalizeKitName(e){if(!e||typeof e!="string")return null;const i=e.trim().toLowerCase();return KIT_NAME_ALIASES[i]??null}
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),__importStar=this&&this.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[n.length]=o);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),o=0;o<n.length;o++)n[o]!=="default"&&__createBinding(t,e,n[o]);return __setModuleDefault(t,e),t}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.PAYLOAD_ROOTS=void 0,exports.verifyTree=verifyTree,exports.verifyInstalledTree=verifyInstalledTree,exports.installPayloadTree=installPayloadTree;const crypto=__importStar(require("crypto")),fs=__importStar(require("fs")),path=__importStar(require("path")),zlib=__importStar(require("zlib")),agentkit_home_1=require("../agentkit-home"),repo_identity_1=require("../repo-identity");exports.PAYLOAD_ROOTS=["skills","rules","agents","agent-kit"];const ROOT_SHAPE=new RegExp(`^[^/]+-${repo_identity_1.REPO_NAME}-[0-9a-f]+$`),SHA_SHAPE=/^[0-9a-f]{7,40}$/,SKIPPED_TREES={demo:!0,tests:!0,dashboard:!0},BLOCK=512;function readString(r,e,t){const n=r.indexOf(0,e);return r.toString("utf8",e,n===-1||n>e+t?e+t:n)}function readOctal(r,e,t){if(r[e]&128){let o=0;for(let i=e+1;i<e+t;i++)o=o*256+r[i];return o}const n=readString(r,e,t).trim();return n?parseInt(n,8):0}function paxPath(r){let e=0;for(;e<r.length;){const t=r.indexOf(32,e);if(t===-1)break;const n=Number(r.toString("ascii",e,t));if(!n||e+n>r.length)break;const o=r.toString("utf8",t+1,e+n-1);if(o.startsWith("path="))return o.slice(5);e+=n}return null}function assertSafeName(r){if(!r||r.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(r)||r.includes("\\")||r.split("/").includes(".."))throw new Error(`Tarball entry escapes the staging directory: ${r}`)}function extractTar(r,e){let t=0,n=null,o=0,i=null;for(;t+BLOCK<=r.length;){const s=r.subarray(t,t+BLOCK);if(s.every(g=>g===0))break;const l=readOctal(s,124,12);if(!Number.isFinite(l)||l<0)throw new Error("Corrupt tarball header.");const S=readOctal(s,100,8),c=String.fromCharCode(s[156]||48),d=s.toString("ascii",263,265)==="00"?readString(s,345,155):"",u=t+BLOCK,a=u+l;if(a>r.length)throw new Error("Truncated tarball.");const p=r.subarray(u,a),f=i??(d?`${d}/${readString(s,0,100)}`:readString(s,0,100));if(i=null,c==="L"){i=p.toString("utf8").replace(/\0.*$/s,""),t=u+Math.ceil(l/BLOCK)*BLOCK;continue}if(c==="x"||c==="g"){c==="x"&&(i=paxPath(p)),t=u+Math.ceil(l/BLOCK)*BLOCK;continue}assertSafeName(f);const h=f.indexOf("/");if(h===-1)n===null&&(n=f);else{const g=f.slice(0,h);if(n===null)n=g;else if(g!==n)throw new Error(`Tarball holds more than one root directory (${n}, ${g}).`)}if(h!==-1&&SKIPPED_TREES[f.slice(h+1).split("/",1)[0]]){t=u+Math.ceil(l/BLOCK)*BLOCK;continue}const y=path.join(e,f);c==="5"?fs.mkdirSync(y,{recursive:!0,mode:493}):(c==="0"||c==="7")&&(fs.mkdirSync(path.dirname(y),{recursive:!0}),fs.writeFileSync(y,p,{mode:S&73?493:420}),o++),t=u+Math.ceil(l/BLOCK)*BLOCK}if(!n)throw new Error("Tarball contains no root directory.");if(o===0)throw new Error("Tarball contains no files.");return{rootDir:n,files:o}}function verifyTree(r,e){if(!ROOT_SHAPE.test(e))throw new Error(`Unexpected tarball root directory: ${e}`);const t=e.slice(e.lastIndexOf("-")+1);if(!SHA_SHAPE.test(t))throw new Error(`Tarball root names no commit sha: ${e}`);for(const n of exports.PAYLOAD_ROOTS){const o=path.join(r,e,n);if(!fs.existsSync(o)||!fs.statSync(o).isDirectory())throw new Error(`Payload is missing ${n}/.`)}return t}function verifyInstalledTree(r){try{const e=fs.statSync(r);if(!e.isDirectory()||typeof process.getuid=="function"&&e.uid!==process.getuid())return null;const t=JSON.parse(fs.readFileSync(path.join(r,".complete"),"utf8"));if(typeof t.ref!="string"||typeof t.commitSha!="string"||typeof t.rootDir!="string"||typeof t.tarDigest!="string"||typeof t.fetchedAt!="number"||t.commitSha!==t.rootDir.slice(t.rootDir.lastIndexOf("-")+1)||verifyTree(r,t.rootDir)!==t.commitSha)return null;const n=path.join(r,".payload.tar.gz");return crypto.createHash("sha256").update(fs.readFileSync(n)).digest("hex")!==t.tarDigest?null:{dir:r,marker:t}}catch{return null}}function installPayloadTree(r,e,t,n=(0,agentkit_home_1.loadAgentkitHomeCore)()){const o=n.getPayloadDir();fs.mkdirSync(o,{recursive:!0,mode:448});try{fs.chmodSync(o,448)}catch{}const i=path.join(o,r),s=`${i}.partial`,l=n.lockPathFor(i),S=n.withFileLock(l,()=>{const c=verifyInstalledTree(i);if(c&&c.marker.ref===e)return{tree:c,fetchedThisRun:!1};if(fs.existsSync(i)){const a=fs.statSync(i);if(typeof process.getuid=="function"&&a.uid!==process.getuid())throw new Error(`Payload tree at ${i} is owned by uid ${a.uid}, not ${process.getuid()} \u2014 refusing to touch it.`);fs.rmSync(i,{recursive:!0,force:!0})}const d=()=>{try{fs.rmSync(s,{recursive:!0,force:!0})}catch{}};d(),fs.mkdirSync(s,{recursive:!0,mode:448});const u=()=>{d(),process.exit(130)};process.once("SIGINT",u);try{const{rootDir:a}=extractTar(zlib.gunzipSync(t),s),p=verifyTree(s,a),f={ref:e,commitSha:p,rootDir:a,tarDigest:crypto.createHash("sha256").update(t).digest("hex"),fetchedAt:Date.now()};fs.writeFileSync(path.join(s,".payload.tar.gz"),t),fs.writeFileSync(path.join(s,".complete"),JSON.stringify(f,null,2));try{fs.renameSync(s,i)}catch(h){const y=verifyInstalledTree(i);if(y)return{tree:y,fetchedThisRun:!1};throw h}return{tree:{dir:i,marker:f},fetchedThisRun:!0}}catch(a){throw d(),a}finally{process.removeListener("SIGINT",u)}},{timeoutMs:6e4,staleMs:12e4});if(S===null)throw new Error("Could not acquire the payload lock within 60s \u2014 another fetch may be wedged.");return S}
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),__importStar=this&&this.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[n.length]=o);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),o=0;o<n.length;o++)n[o]!=="default"&&__createBinding(t,e,n[o]);return __setModuleDefault(t,e),t}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.PAYLOAD_ROOTS=void 0,exports.verifyTree=verifyTree,exports.verifyInstalledTree=verifyInstalledTree,exports.installPayloadTree=installPayloadTree;const crypto=__importStar(require("crypto")),fs=__importStar(require("fs")),path=__importStar(require("path")),zlib=__importStar(require("zlib")),agentkit_home_1=require("../agentkit-home"),repo_identity_1=require("../repo-identity"),payload_roots_1=require("../payload-roots");Object.defineProperty(exports,"PAYLOAD_ROOTS",{enumerable:!0,get:function(){return payload_roots_1.PAYLOAD_ROOTS}});const ROOT_SHAPE=new RegExp(`^[^/]+-${repo_identity_1.REPO_NAME}-[0-9a-f]+$`),SHA_SHAPE=/^[0-9a-f]{7,40}$/,SKIPPED_TREES={dev:!0,tests:!0,dashboard:!0},BLOCK=512;function readString(r,e,t){const n=r.indexOf(0,e);return r.toString("utf8",e,n===-1||n>e+t?e+t:n)}function readOctal(r,e,t){if(r[e]&128){let o=0;for(let i=e+1;i<e+t;i++)o=o*256+r[i];return o}const n=readString(r,e,t).trim();return n?parseInt(n,8):0}function paxPath(r){let e=0;for(;e<r.length;){const t=r.indexOf(32,e);if(t===-1)break;const n=Number(r.toString("ascii",e,t));if(!n||e+n>r.length)break;const o=r.toString("utf8",t+1,e+n-1);if(o.startsWith("path="))return o.slice(5);e+=n}return null}function assertSafeName(r){if(!r||r.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(r)||r.includes("\\")||r.split("/").includes(".."))throw new Error(`Tarball entry escapes the staging directory: ${r}`)}function extractTar(r,e){let t=0,n=null,o=0,i=null;for(;t+BLOCK<=r.length;){const s=r.subarray(t,t+BLOCK);if(s.every(g=>g===0))break;const l=readOctal(s,124,12);if(!Number.isFinite(l)||l<0)throw new Error("Corrupt tarball header.");const S=readOctal(s,100,8),c=String.fromCharCode(s[156]||48),d=s.toString("ascii",263,265)==="00"?readString(s,345,155):"",u=t+BLOCK,a=u+l;if(a>r.length)throw new Error("Truncated tarball.");const p=r.subarray(u,a),f=i??(d?`${d}/${readString(s,0,100)}`:readString(s,0,100));if(i=null,c==="L"){i=p.toString("utf8").replace(/\0.*$/s,""),t=u+Math.ceil(l/BLOCK)*BLOCK;continue}if(c==="x"||c==="g"){c==="x"&&(i=paxPath(p)),t=u+Math.ceil(l/BLOCK)*BLOCK;continue}assertSafeName(f);const h=f.indexOf("/");if(h===-1)n===null&&(n=f);else{const g=f.slice(0,h);if(n===null)n=g;else if(g!==n)throw new Error(`Tarball holds more than one root directory (${n}, ${g}).`)}if(h!==-1&&SKIPPED_TREES[f.slice(h+1).split("/",1)[0]]){t=u+Math.ceil(l/BLOCK)*BLOCK;continue}const y=path.join(e,f);c==="5"?fs.mkdirSync(y,{recursive:!0,mode:493}):(c==="0"||c==="7")&&(fs.mkdirSync(path.dirname(y),{recursive:!0}),fs.writeFileSync(y,p,{mode:S&73?493:420}),o++),t=u+Math.ceil(l/BLOCK)*BLOCK}if(!n)throw new Error("Tarball contains no root directory.");if(o===0)throw new Error("Tarball contains no files.");return{rootDir:n,files:o}}function verifyTree(r,e){if(!ROOT_SHAPE.test(e))throw new Error(`Unexpected tarball root directory: ${e}`);const t=e.slice(e.lastIndexOf("-")+1);if(!SHA_SHAPE.test(t))throw new Error(`Tarball root names no commit sha: ${e}`);for(const n of payload_roots_1.PAYLOAD_ROOTS){const o=path.join(r,e,n);if(!fs.existsSync(o)||!fs.statSync(o).isDirectory())throw new Error(`Payload is missing ${n}/.`)}return t}function verifyInstalledTree(r){try{const e=fs.statSync(r);if(!e.isDirectory()||typeof process.getuid=="function"&&e.uid!==process.getuid())return null;const t=JSON.parse(fs.readFileSync(path.join(r,".complete"),"utf8"));if(typeof t.ref!="string"||typeof t.commitSha!="string"||typeof t.rootDir!="string"||typeof t.tarDigest!="string"||typeof t.fetchedAt!="number"||t.commitSha!==t.rootDir.slice(t.rootDir.lastIndexOf("-")+1)||verifyTree(r,t.rootDir)!==t.commitSha)return null;const n=path.join(r,".payload.tar.gz");return crypto.createHash("sha256").update(fs.readFileSync(n)).digest("hex")!==t.tarDigest?null:{dir:r,marker:t}}catch{return null}}function installPayloadTree(r,e,t,n=(0,agentkit_home_1.loadAgentkitHomeCore)()){const o=n.getPayloadDir();fs.mkdirSync(o,{recursive:!0,mode:448});try{fs.chmodSync(o,448)}catch{}const i=path.join(o,r),s=`${i}.partial`,l=n.lockPathFor(i),S=n.withFileLock(l,()=>{const c=verifyInstalledTree(i);if(c&&c.marker.ref===e)return{tree:c,fetchedThisRun:!1};if(fs.existsSync(i)){const a=fs.statSync(i);if(typeof process.getuid=="function"&&a.uid!==process.getuid())throw new Error(`Payload tree at ${i} is owned by uid ${a.uid}, not ${process.getuid()} \u2014 refusing to touch it.`);fs.rmSync(i,{recursive:!0,force:!0})}const d=()=>{try{fs.rmSync(s,{recursive:!0,force:!0})}catch{}};d(),fs.mkdirSync(s,{recursive:!0,mode:448});const u=()=>{d(),process.exit(130)};process.once("SIGINT",u);try{const{rootDir:a}=extractTar(zlib.gunzipSync(t),s),p=verifyTree(s,a),f={ref:e,commitSha:p,rootDir:a,tarDigest:crypto.createHash("sha256").update(t).digest("hex"),fetchedAt:Date.now()};fs.writeFileSync(path.join(s,".payload.tar.gz"),t),fs.writeFileSync(path.join(s,".complete"),JSON.stringify(f,null,2));try{fs.renameSync(s,i)}catch(h){const y=verifyInstalledTree(i);if(y)return{tree:y,fetchedThisRun:!1};throw h}return{tree:{dir:i,marker:f},fetchedThisRun:!0}}catch(a){throw d(),a}finally{process.removeListener("SIGINT",u)}},{timeoutMs:6e4,staleMs:12e4});if(S===null)throw new Error("Could not acquire the payload lock within 60s \u2014 another fetch may be wedged.");return S}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TEMPLATES_DIR=exports.GUIDE_DIR=exports.AGENT_SCRIPTS_DIR=exports.AGENT_KIT_DIR=exports.COMMAND_SOURCE_DIR=exports.AGENTS_SOURCE_DIR=exports.RULES_SOURCE_DIR=exports.SKILL_SOURCE_DIR=exports.PAYLOAD_ROOTS=void 0,exports.PAYLOAD_ROOTS=["skills","rules","agents","agent-kit"],exports.SKILL_SOURCE_DIR="skills",exports.RULES_SOURCE_DIR="rules",exports.AGENTS_SOURCE_DIR="agents",exports.COMMAND_SOURCE_DIR="command",exports.AGENT_KIT_DIR="agent-kit",exports.AGENT_SCRIPTS_DIR="agent-scripts",exports.GUIDE_DIR="guide",exports.TEMPLATES_DIR="templates";
@@ -1,5 +1,5 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(n,e,r,t){t===void 0&&(t=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(n,t,i)}):(function(n,e,r,t){t===void 0&&(t=r),n[t]=e[r]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),__importStar=this&&this.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(r){var t=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[t.length]=i);return t},n(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t=n(e),i=0;i<t.length;i++)t[i]!=="default"&&__createBinding(r,e,t[i]);return __setModuleDefault(r,e),r}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.MissingProfileProseError=exports.PROFILE_BLOCK_MAX_BYTES=void 0,exports.installedSkillsForProfile=installedSkillsForProfile,exports.renderProfileBlock=renderProfileBlock;const fs=__importStar(require("fs")),path=__importStar(require("path")),generate_catalogs_1=require("../generate-catalogs"),skill_profiles_1=require("./skill-profiles");exports.PROFILE_BLOCK_MAX_BYTES=1800;class MissingProfileProseError extends Error{constructor(e,r){super(`profile block: no prose for the "${e}" profile \u2014 expected ${r}`),this.profile=e,this.file=r,this.name="MissingProfileProseError"}}exports.MissingProfileProseError=MissingProfileProseError;function installedSkillsForProfile(n,e){const r=new Set((0,skill_profiles_1.profileToSkipDirs)(n,e));return(0,generate_catalogs_1.collectSkills)(n).map(t=>t.name).filter(t=>!r.has(t))}function renderProfileBlock(n){const{repoRoot:e,profile:r,activeRules:t}=n,i=n.droppedRules??[];if(r==="core"||r==="full"||r===skill_profiles_1.UNRECORDED_PROFILE)return null;const u=readProfileProse(e,r),l=installedSkillsForProfile(e,r),o=(0,skill_profiles_1.isNameOnlyProfile)(r),a=o?l:l.filter(p=>!skill_profiles_1.CORE_SKILLS.has(p)),f=l.length-a.length,c=o?`${l.length} named skills \u2014 this profile installs by name rather than by category \u2014 and ${t.length} rules.`:`${l.length} skills (${a.length} from ${(0,skill_profiles_1.profileIncludeCategories)(r).join(", ")}, ${f} shared core) and ${t.length} rules.`,s=[`### Installed: \`${r}\` profile`,"",c,`${o?"Skills":"Profile skills"}: ${a.join(", ")}.`];return s.push(t.length>0?`Rules: ${t.join(", ")}.`:"No rules ship with this profile."),i.length>0&&s.push(`Rules left out: ${i.join(", ")}.`),s.push("`agentkit skills add <name>` restores a skill; `agentkit init --profile full` installs everything, rules included."),`${s.join(`
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(n,e,r,t){t===void 0&&(t=r);var l=Object.getOwnPropertyDescriptor(e,r);(!l||("get"in l?!e.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(n,t,l)}):(function(n,e,r,t){t===void 0&&(t=r),n[t]=e[r]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),__importStar=this&&this.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(r){var t=[];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(t[t.length]=l);return t},n(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t=n(e),l=0;l<t.length;l++)t[l]!=="default"&&__createBinding(r,e,t[l]);return __setModuleDefault(r,e),r}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.MissingProfileProseError=exports.PROFILE_BLOCK_MAX_BYTES=void 0,exports.installedSkillsForProfile=installedSkillsForProfile,exports.renderProfileBlock=renderProfileBlock;const fs=__importStar(require("fs")),path=__importStar(require("path")),generate_catalogs_1=require("../gen/generate-catalogs"),skill_profiles_1=require("./skill-profiles"),payload_roots_1=require("./payload-roots");exports.PROFILE_BLOCK_MAX_BYTES=1800;class MissingProfileProseError extends Error{constructor(e,r){super(`profile block: no prose for the "${e}" profile \u2014 expected ${r}`),this.profile=e,this.file=r,this.name="MissingProfileProseError"}}exports.MissingProfileProseError=MissingProfileProseError;function installedSkillsForProfile(n,e){const r=new Set((0,skill_profiles_1.profileToSkipDirs)(n,e));return(0,generate_catalogs_1.collectSkills)(n).map(t=>t.name).filter(t=>!r.has(t))}function renderProfileBlock(n){const{repoRoot:e,profile:r,activeRules:t}=n,l=n.droppedRules??[];if(r==="core"||r==="full")return null;const u=readProfileProse(e,r),i=installedSkillsForProfile(e,r),o=(0,skill_profiles_1.isNameOnlyProfile)(r),a=o?i:i.filter(p=>!skill_profiles_1.CORE_SKILLS.has(p)),f=i.length-a.length,c=o?`${i.length} named skills \u2014 this profile installs by name rather than by category \u2014 and ${t.length} rules.`:`${i.length} skills (${a.length} from ${(0,skill_profiles_1.profileIncludeCategories)(r).join(", ")}, ${f} shared core) and ${t.length} rules.`,s=[`### Installed: \`${r}\` profile`,"",c,`${o?"Skills":"Profile skills"}: ${a.join(", ")}.`];return s.push(t.length>0?`Rules: ${t.join(", ")}.`:"No rules ship with this profile."),l.length>0&&s.push(`Rules left out: ${l.join(", ")}.`),s.push("`agentkit skills add <name>` restores a skill; `agentkit init --profile full` installs everything, rules included."),`${s.join(`
2
2
  `)}
3
3
 
4
4
  ${u}
5
- `}function readProfileProse(n,e){const r=path.join(n,"agent-kit","shared","profiles",`${e}.md`);let t;try{t=fs.readFileSync(r,"utf8").trim()}catch{throw new MissingProfileProseError(e,r)}if(t.length===0)throw new MissingProfileProseError(e,r);return t}
5
+ `}function readProfileProse(n,e){const r=path.join(n,payload_roots_1.AGENT_KIT_DIR,"shared","profiles",`${e}.md`);let t;try{t=fs.readFileSync(r,"utf8").trim()}catch{throw new MissingProfileProseError(e,r)}if(t.length===0)throw new MissingProfileProseError(e,r);return t}
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(i,e,r,t){t===void 0&&(t=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(i,t,n)}):(function(i,e,r,t){t===void 0&&(t=r),i[t]=e[r]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}):function(i,e){i.default=e}),__importStar=this&&this.__importStar||(function(){var i=function(e){return i=Object.getOwnPropertyNames||function(r){var t=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[t.length]=n);return t},i(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t=i(e),n=0;n<t.length;n++)t[n]!=="default"&&__createBinding(r,e,t[n]);return __setModuleDefault(r,e),r}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveRemovalContexts=resolveRemovalContexts,exports.planProfileRemovals=planProfileRemovals,exports.applyProfileRemoval=applyProfileRemoval;const p=__importStar(require("@clack/prompts")),init_install_scope_1=require("./init-install-scope"),home_dir_1=require("./home-dir"),kit_context_1=require("./kit-context"),kit_install_dispatch_1=require("./kit-install-dispatch"),profile_context_1=require("./kit-installers/profile-context"),install_manifest_1=require("./install-manifest"),install_profile_config_1=require("./install-profile-config"),kits_1=require("./kits"),logger_1=require("./logger"),skill_profiles_1=require("./skill-profiles");function resolveRemovalContexts(i,e,r){return e?r?(0,init_install_scope_1.isKitInstalledGlobally)(e)?[(0,kit_context_1.globalContext)(e)]:[]:!(0,home_dir_1.isHomeDir)(i)&&(0,init_install_scope_1.isKitInstalledInProject)(e,i)?[(0,kit_context_1.projectContext)(e,i)]:(0,init_install_scope_1.isKitInstalledGlobally)(e)?[(0,kit_context_1.globalContext)(e)]:[]:r?kit_context_1.GLOBAL_KITS.filter(t=>(0,init_install_scope_1.isKitInstalledGlobally)(t)).map(kit_context_1.globalContext):(0,kit_context_1.candidateContexts)(i)}async function planProfileRemovals(i,e=!!(process.stdin.isTTY&&process.stdout.isTTY)){const r=[],t=[];if(!e)return(0,logger_1.printError)("Refusing to remove profiles: this is not an interactive terminal."),{removals:r,noops:t,proceed:!1,refuseReason:"non-tty"};for(const n of i){const o=(0,install_profile_config_1.readInstallSettings)(n.configPath),l=(0,install_profile_config_1.hasPersistedProfile)(n.configPath);if(!l||o.profile==="core"){t.push({context:n,reason:l?"already-core":"no-persisted-profile"});continue}const s=await p.confirm({message:`Remove profile ${o.profile} from ${kits_1.kitDefinitions[n.kit].name} and reinstall with core?`,initialValue:!1});if(p.isCancel(s)||!s)return(0,logger_1.printInfo)("Profile removal cancelled. Nothing was changed."),{removals:r,noops:t,proceed:!1,refuseReason:"declined"};r.push({context:n,existingProfile:o.profile,agentModels:o.agentModels})}for(const n of t){const o=n.reason==="already-core"?"already uses the core profile":"has no profile to remove";(0,logger_1.printInfo)(`${kits_1.kitDefinitions[n.context.kit].name} ${o}.`)}return{removals:r,noops:t,proceed:!0}}function applyProfileRemoval(i,e,r){const{context:t}=i,n=(0,skill_profiles_1.resolveSkipDirs)(e,"core"),o={profileContext:(0,profile_context_1.buildProfileInstallContext)(e,"core"),agentModels:i.agentModels},l=t.scope==="global"?(0,kit_install_dispatch_1.installGlobalKit)(t.kit,e,(0,init_install_scope_1.resolveGlobalRoot)(t.kit,r),n,o):(0,kit_install_dispatch_1.installProjectKit)(t.kit,e,r,n,o);if(!l.ok)return(0,logger_1.printError)(l.reason),!1;const s=(0,install_profile_config_1.readCliVersion)(e);return s&&(0,install_profile_config_1.stampInstallVersion)(t.configPath,s),(0,install_profile_config_1.writeInstallSettings)(t.configPath,{profile:"core",extraSkills:[]}),(0,install_manifest_1.writeManifest)(t,s),(0,logger_1.printSuccess)(`${kits_1.kitDefinitions[t.kit].name} now uses the core profile.`),!0}
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(i,e,r,t){t===void 0&&(t=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(i,t,n)}):(function(i,e,r,t){t===void 0&&(t=r),i[t]=e[r]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}):function(i,e){i.default=e}),__importStar=this&&this.__importStar||(function(){var i=function(e){return i=Object.getOwnPropertyNames||function(r){var t=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[t.length]=n);return t},i(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t=i(e),n=0;n<t.length;n++)t[n]!=="default"&&__createBinding(r,e,t[n]);return __setModuleDefault(r,e),r}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveRemovalContexts=resolveRemovalContexts,exports.planProfileRemovals=planProfileRemovals,exports.applyProfileRemoval=applyProfileRemoval;const p=__importStar(require("@clack/prompts")),init_install_scope_1=require("./init-install-scope"),home_dir_1=require("./home-dir"),kit_context_1=require("./kit-context"),kit_install_dispatch_1=require("./kit-install-dispatch"),profile_context_1=require("./kit-installers/profile-context"),install_manifest_1=require("./install-manifest"),install_profile_config_1=require("./install-profile-config"),kits_1=require("./kits"),logger_1=require("./logger"),skill_profiles_1=require("./skill-profiles");function resolveRemovalContexts(i,e,r){return e?r?(0,init_install_scope_1.isKitInstalledGlobally)(e)?[(0,kit_context_1.globalContext)(e)]:[]:!(0,home_dir_1.isHomeDir)(i)&&(0,init_install_scope_1.isKitInstalledInProject)(e,i)?[(0,kit_context_1.projectContext)(e,i)]:(0,init_install_scope_1.isKitInstalledGlobally)(e)?[(0,kit_context_1.globalContext)(e)]:[]:r?kit_context_1.GLOBAL_KITS.filter(t=>(0,init_install_scope_1.isKitInstalledGlobally)(t)).map(kit_context_1.globalContext):(0,kit_context_1.candidateContexts)(i)}async function planProfileRemovals(i,e=!!(process.stdin.isTTY&&process.stdout.isTTY)){const r=[],t=[];if(!e)return(0,logger_1.printError)("Refusing to remove profiles: this is not an interactive terminal."),{removals:r,noops:t,proceed:!1,refuseReason:"non-tty"};for(const n of i){const o=(0,install_profile_config_1.readInstallSettings)(n.configPath);if(o.profile===null||o.profile==="core"){t.push({context:n,reason:o.profile==="core"?"already-core":"no-persisted-profile"});continue}const s=await p.confirm({message:`Remove profile ${o.profile} from ${kits_1.kitDefinitions[n.kit].name} and reinstall with core?`,initialValue:!1});if(p.isCancel(s)||!s)return(0,logger_1.printInfo)("Profile removal cancelled. Nothing was changed."),{removals:r,noops:t,proceed:!1,refuseReason:"declined"};r.push({context:n,existingProfile:o.profile,agentModels:o.agentModels})}for(const n of t){const o=n.reason==="already-core"?"already uses the core profile":"has no profile to remove";(0,logger_1.printInfo)(`${kits_1.kitDefinitions[n.context.kit].name} ${o}.`)}return{removals:r,noops:t,proceed:!0}}function applyProfileRemoval(i,e,r){const{context:t}=i,n=(0,skill_profiles_1.resolveSkipDirs)(e,"core"),o={profileContext:(0,profile_context_1.buildProfileInstallContext)(e,"core"),agentModels:i.agentModels},s=t.scope==="global"?(0,kit_install_dispatch_1.installGlobalKit)(t.kit,e,(0,init_install_scope_1.resolveGlobalRoot)(t.kit,r),n,o):(0,kit_install_dispatch_1.installProjectKit)(t.kit,e,r,n,o);if(!s.ok)return(0,logger_1.printError)(s.reason),!1;const l=(0,install_profile_config_1.readCliVersion)(e);return l&&(0,install_profile_config_1.stampInstallVersion)(t.configPath,l),(0,install_profile_config_1.writeInstallSettings)(t.configPath,{profile:"core",extraSkills:[]}),(0,install_manifest_1.writeManifest)(t,l),(0,logger_1.printSuccess)(`${kits_1.kitDefinitions[t.kit].name} now uses the core profile.`),!0}
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(r,e,n,t){t===void 0&&(t=n);var a=Object.getOwnPropertyDescriptor(e,n);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(r,t,a)}):(function(r,e,n,t){t===void 0&&(t=n),r[t]=e[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),__importStar=this&&this.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(n){var t=[];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[t.length]=a);return t},r(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var t=r(e),a=0;a<t.length;a++)t[a]!=="default"&&__createBinding(n,e,t[a]);return __setModuleDefault(n,e),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.PROFILE_RULE_SKIP=void 0,exports.ruleSkipFor=ruleSkipFor,exports.rulesForProfile=rulesForProfile;const path=__importStar(require("path")),rule_metadata_1=require("./kit-installers/rule-metadata");exports.PROFILE_RULE_SKIP={frontend:["database-security","team-coordination-rules"],backend:["dart","kotlin","swift","team-coordination-rules"],mobile:["database-security","team-coordination-rules"],fullstack:["team-coordination-rules"],marketing:["dart","kotlin","swift","database-security","team-coordination-rules"],assistant:["dart","kotlin","swift","database-security","team-coordination-rules"]};function ruleSkipFor(r){return r==="core"||r==="full"?[]:exports.PROFILE_RULE_SKIP[r]}function rulesForProfile(r,e){const n=new Set(ruleSkipFor(e));return(0,rule_metadata_1.readRulesDir)(path.join(r,"rules")).rules.map(t=>t.name).filter(t=>!n.has(t))}
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(r,e,n,t){t===void 0&&(t=n);var a=Object.getOwnPropertyDescriptor(e,n);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(r,t,a)}):(function(r,e,n,t){t===void 0&&(t=n),r[t]=e[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),__importStar=this&&this.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(n){var t=[];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[t.length]=a);return t},r(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var t=r(e),a=0;a<t.length;a++)t[a]!=="default"&&__createBinding(n,e,t[a]);return __setModuleDefault(n,e),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.PROFILE_RULE_SKIP=void 0,exports.ruleSkipFor=ruleSkipFor,exports.rulesForProfile=rulesForProfile;const path=__importStar(require("path")),rule_metadata_1=require("./kit-installers/rule-metadata"),payload_roots_1=require("./payload-roots");exports.PROFILE_RULE_SKIP={frontend:["database-security","team-coordination-rules"],backend:["dart","kotlin","swift","team-coordination-rules"],mobile:["database-security","team-coordination-rules"],fullstack:["team-coordination-rules"],marketing:["dart","kotlin","swift","database-security","team-coordination-rules"],assistant:["dart","kotlin","swift","database-security","team-coordination-rules"]};function ruleSkipFor(r){return r==="core"||r==="full"?[]:exports.PROFILE_RULE_SKIP[r]}function rulesForProfile(r,e){const n=new Set(ruleSkipFor(e));return(0,rule_metadata_1.readRulesDir)(path.join(r,payload_roots_1.RULES_SOURCE_DIR)).rules.map(t=>t.name).filter(t=>!n.has(t))}
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(n,e,i,r){r===void 0&&(r=i);var t=Object.getOwnPropertyDescriptor(e,i);(!t||("get"in t?!e.__esModule:t.writable||t.configurable))&&(t={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(n,r,t)}):(function(n,e,i,r){r===void 0&&(r=i),n[r]=e[i]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}):function(n,e){n.default=e}),__importStar=this&&this.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(i){var r=[];for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(r[r.length]=t);return r},n(e)};return function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var r=n(e),t=0;t<r.length;t++)r[t]!=="default"&&__createBinding(i,e,r[t]);return __setModuleDefault(i,e),i}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.confirmProfileSwitch=confirmProfileSwitch;const p=__importStar(require("@clack/prompts")),logger_1=require("./logger");async function confirmProfileSwitch({existingProfile:n,newProfile:e,kitConfigPath:i,kitName:r,targetDir:t,isTTY:a=!!(process.stdin.isTTY&&process.stdout.isTTY)}){if(!a)return(0,logger_1.printError)(`Refusing to switch ${r} from profile ${n} to ${e}: this is not an interactive terminal.`),(0,logger_1.printInfo)(`No changes were made to ${i} or ${t}.`),{proceed:!1,reason:"non-tty"};(0,logger_1.printWarning)(`Switching ${r} removes the ${n} profile and replaces it with ${e}.`);const o=await p.confirm({message:`Replace profile ${n} with ${e}?`,initialValue:!1});return p.isCancel(o)||!o?{proceed:!1,reason:"declined"}:{proceed:!0,reason:"confirmed"}}
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(i,e,n,t){t===void 0&&(t=n);var r=Object.getOwnPropertyDescriptor(e,n);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(i,t,r)}):(function(i,e,n,t){t===void 0&&(t=n),i[t]=e[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}):function(i,e){i.default=e}),__importStar=this&&this.__importStar||(function(){var i=function(e){return i=Object.getOwnPropertyNames||function(n){var t=[];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[t.length]=r);return t},i(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var t=i(e),r=0;r<t.length;r++)t[r]!=="default"&&__createBinding(n,e,t[r]);return __setModuleDefault(n,e),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.confirmProfileSwitch=confirmProfileSwitch;const p=__importStar(require("@clack/prompts")),logger_1=require("./logger");async function confirmProfileSwitch({existingProfile:i,newProfile:e,kitConfigPath:n,kitName:t,targetDir:r,isTTY:c=!!(process.stdin.isTTY&&process.stdout.isTTY)}){const o=i??"unrecorded (legacy install)";if(!c)return(0,logger_1.printError)(`Refusing to switch ${t} from profile ${o} to ${e}: this is not an interactive terminal.`),(0,logger_1.printInfo)(`No changes were made to ${n} or ${r}.`),{proceed:!1,reason:"non-tty"};(0,logger_1.printWarning)(`Switching ${t} removes the ${o} profile and replaces it with ${e}.`);const a=await p.confirm({message:`Replace profile ${o} with ${e}?`,initialValue:!1});return p.isCancel(a)||!a?{proceed:!1,reason:"declined"}:{proceed:!0,reason:"confirmed"}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PAYLOAD_FILES=exports.PAYLOAD_DIRS=void 0,exports.isPayloadPath=isPayloadPath,exports.PAYLOAD_DIRS=["agent-kit/",".agents/","agents/","bin/","command/","dashboard-dist/","guide/","rules/","scripts-agentkit/","scripts-dist/","skills/"],exports.PAYLOAD_FILES=["package.json","install.sh","install.ps1","tsconfig.json","AGENTS.md","CLAUDE.md","GEMINI.md","README.md","CHANGELOG.md","LICENSE",".mcp.json",".repomixignore"];const DEV_TREES=["scripts-dist/","scripts-agentkit/","src/"],DEV_NOISE_RE=/\/__tests__\/|\.test\.[^/]*$|\.map$|\.d\.ts$/,LITTER_RE=/(^|\/)\.DS_Store$/,norm=e=>e.replace(/\\/g,"/").replace(/^\.\//,"");function isPayloadPath(e){const s=norm(e);return LITTER_RE.test(s)||DEV_TREES.some(t=>s.startsWith(t))&&DEV_NOISE_RE.test(s)?!1:exports.PAYLOAD_FILES.includes(s)?!0:exports.PAYLOAD_DIRS.some(t=>s===t.slice(0,-1)||s.startsWith(t))}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PAYLOAD_FILES=exports.PAYLOAD_DIRS=void 0,exports.isPayloadPath=isPayloadPath;const payload_roots_1=require("../payload-roots");exports.PAYLOAD_DIRS=[`${payload_roots_1.AGENT_KIT_DIR}/`,".agents/",`${payload_roots_1.AGENTS_SOURCE_DIR}/`,"bin/",`${payload_roots_1.COMMAND_SOURCE_DIR}/`,"dashboard-dist/",`${payload_roots_1.GUIDE_DIR}/`,`${payload_roots_1.RULES_SOURCE_DIR}/`,`${payload_roots_1.AGENT_SCRIPTS_DIR}/`,"scripts-dist/",`${payload_roots_1.SKILL_SOURCE_DIR}/`],exports.PAYLOAD_FILES=["package.json","install.sh","install.ps1","tsconfig.json","AGENTS.md","CLAUDE.md","GEMINI.md","README.md","CHANGELOG.md","LICENSE",".mcp.json",".repomixignore"];const DEV_TREES=["scripts-dist/",`${payload_roots_1.AGENT_SCRIPTS_DIR}/`,"src/"],DEV_NOISE_RE=/\/__tests__\/|\.test\.[^/]*$|\.map$|\.d\.ts$/,LITTER_RE=/(^|\/)\.DS_Store$/,norm=e=>e.replace(/\\/g,"/").replace(/^\.\//,"");function isPayloadPath(e){const s=norm(e);return LITTER_RE.test(s)||DEV_TREES.some(t=>s.startsWith(t))&&DEV_NOISE_RE.test(s)?!1:exports.PAYLOAD_FILES.includes(s)?!0:exports.PAYLOAD_DIRS.some(t=>s===t.slice(0,-1)||s.startsWith(t))}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GATED_PATHS=exports.ALLOWED_IN_GATED=exports.PUBLIC_CLIENT_DIRS=exports.PUBLIC_CLIENT_FILES=void 0,exports.isGated=isGated,exports.isAllowed=isAllowed,exports.gatedPathsIn=gatedPathsIn,exports.PUBLIC_CLIENT_FILES=["bin/agentkit.js","CHANGELOG.md"],exports.PUBLIC_CLIENT_DIRS=["scripts-dist/"],exports.ALLOWED_IN_GATED=["scripts-dist/lib/kit-installers/shared-hooks-source.js"],exports.GATED_PATHS=["agent-kit/","skills/","rules/","agents/",".agents/","command/","docs/","guide/","plans/","scripts/","src/","dashboard/","dashboard-dist/","templates/","schemas/","types/","utils/","scripts-agentkit/","scripts-dist/lib/kit-installers/"];const EXCLUDED_RE=[/\/__tests__\//,/\.test\.[^/]*$/,/\.d\.ts$/,/\.map$/],norm=t=>t.replace(/\\/g,"/").replace(/^\.\//,"");function isGated(t){const s=norm(t);return exports.ALLOWED_IN_GATED.includes(s)?!1:exports.GATED_PATHS.some(e=>s===e.slice(0,-1)||s.startsWith(e))}function isAllowed(t){const s=norm(t);return EXCLUDED_RE.some(e=>e.test(s))||isGated(s)?!1:exports.PUBLIC_CLIENT_FILES.includes(s)||s==="package.json"||s==="LICENSE"||s==="README.md"?!0:exports.PUBLIC_CLIENT_DIRS.some(e=>s.startsWith(e))}function gatedPathsIn(t){return t.filter(isGated)}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GATED_PATHS=exports.ALLOWED_IN_GATED=exports.PUBLIC_CLIENT_DIRS=exports.PUBLIC_CLIENT_FILES=void 0,exports.isGated=isGated,exports.isAllowed=isAllowed,exports.gatedPathsIn=gatedPathsIn,exports.PUBLIC_CLIENT_FILES=["bin/agentkit.js","CHANGELOG.md"],exports.PUBLIC_CLIENT_DIRS=["scripts-dist/"],exports.ALLOWED_IN_GATED=["scripts-dist/lib/kit-installers/shared-hooks-source.js"];const payload_roots_1=require("../payload-roots");exports.GATED_PATHS=[`${payload_roots_1.AGENT_KIT_DIR}/`,`${payload_roots_1.SKILL_SOURCE_DIR}/`,`${payload_roots_1.RULES_SOURCE_DIR}/`,`${payload_roots_1.AGENTS_SOURCE_DIR}/`,".agents/",`${payload_roots_1.COMMAND_SOURCE_DIR}/`,"docs/",`${payload_roots_1.GUIDE_DIR}/`,"plans/","scripts/","src/","dashboard/","dashboard-dist/",`${payload_roots_1.TEMPLATES_DIR}/`,"schemas/","types/","utils/",`${payload_roots_1.AGENT_SCRIPTS_DIR}/`,"scripts-dist/lib/kit-installers/"];const EXCLUDED_RE=[/\/__tests__\//,/\.test\.[^/]*$/,/\.d\.ts$/,/\.map$/],norm=t=>t.replace(/\\/g,"/").replace(/^\.\//,"");function isGated(t){const s=norm(t);return exports.ALLOWED_IN_GATED.includes(s)?!1:exports.GATED_PATHS.some(e=>s===e.slice(0,-1)||s.startsWith(e))}function isAllowed(t){const s=norm(t);return EXCLUDED_RE.some(e=>e.test(s))||isGated(s)?!1:exports.PUBLIC_CLIENT_FILES.includes(s)||s==="package.json"||s==="LICENSE"||s==="README.md"?!0:exports.PUBLIC_CLIENT_DIRS.some(e=>s.startsWith(e))}function gatedPathsIn(t){return t.filter(isGated)}
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(i,e,t,r){r===void 0&&(r=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,r,o)}):(function(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}):function(i,e){i.default=e}),__importStar=this&&this.__importStar||(function(){var i=function(e){return i=Object.getOwnPropertyNames||function(t){var r=[];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[r.length]=o);return r},i(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=i(e),o=0;o<r.length;o++)r[o]!=="default"&&__createBinding(t,e,r[o]);return __setModuleDefault(t,e),t}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.MASTER_HOOK=void 0,exports.setHook=setHook,exports.refreshKit=refreshKit,exports.previewKitRemoval=previewKitRemoval,exports.removeKitInstall=removeKitInstall;const path=__importStar(require("path")),agentkit_config_file_1=require("../agentkit-config-file"),hook_toggle_registry_1=require("../hook-toggle-registry"),agentkit_home_1=require("../agentkit-home"),init_install_scope_1=require("../init-install-scope"),install_registry_1=require("../install-registry"),kit_remover_1=require("../kit-remover"),kit_install_dispatch_1=require("../kit-install-dispatch"),profile_context_1=require("../kit-installers/profile-context"),install_manifest_1=require("../install-manifest"),install_profile_config_1=require("../install-profile-config"),skill_profiles_1=require("../skill-profiles"),hooks_write_policy_1=require("../hooks-write-policy"),kits_1=require("../kits"),kits_endpoint_1=require("./kits-endpoint"),kit_target_1=require("./kit-target");exports.MASTER_HOOK="*";function refused(i,e,t){return{status:i,body:{ok:!1,error:e,...t?{hint:t}:{}}}}function setHook(i,e){const t=(0,kit_target_1.targetFrom)(e);if(!t.ok)return refused(t.status,t.error);const r=e,o=r.hook,n=r.enabled;if(typeof o!="string"||!o)return refused(400,"hook is required");if(typeof n!="boolean")return refused(400,"enabled must be true or false");const{record:c,context:u}=t.target;if(o===exports.MASTER_HOOK){try{(0,agentkit_config_file_1.writeHooksEnabled)(u.configPath,n)}catch(l){return refused(500,`could not write the kit config: ${l.message}`)}return(0,kits_endpoint_1.clearKitsCache)(),{status:200,body:{ok:!0,hook:o,enabled:n}}}const s=(0,hook_toggle_registry_1.hookRegistry)(i).find(l=>l.name===o);if(!s)return refused(404,"no such hook");const a=(0,hooks_write_policy_1.decideWrite)(c.kit,c.scope,o,s.readBy,kits_1.kitDefinitions[c.kit].name);if(!a.allowed)return refused(409,a.reason,a.hint);try{(0,agentkit_config_file_1.updateSection)(u.configPath,"hooks",l=>{l[o]=n})}catch(l){return refused(500,`could not write the kit config: ${l.message}`)}return(0,kits_endpoint_1.clearKitsCache)(),{status:200,body:{ok:!0,hook:o,enabled:n,...a.warning?{warning:a.warning}:{}}}}function refreshKit(i,e){const t=(0,kit_target_1.targetFrom)(e);if(!t.ok)return refused(t.status,t.error);const{record:r,context:o}=t.target,n=(0,install_profile_config_1.readInstallSettings)(o.configPath),c=(0,skill_profiles_1.resolveSkipDirs)(i,n.profile,n.extraSkills),u={...n.agentModels?{agentModels:n.agentModels}:{},profileContext:(0,profile_context_1.buildProfileInstallContext)(i,n.profile)},f=r.scope==="global"?(0,kit_install_dispatch_1.installGlobalKit)(r.kit,i,(0,init_install_scope_1.resolveGlobalRoot)(r.kit,""),c,u):(0,kit_install_dispatch_1.installProjectKit)(r.kit,i,r.path,c,u);if(!f.ok)return refused(409,f.reason);const s=(0,install_profile_config_1.readCliVersion)(i);try{s&&(0,install_profile_config_1.stampInstallVersion)(o.configPath,s),(0,install_profile_config_1.writeInstallSettings)(o.configPath,{profile:n.profile,extraSkills:n.extraSkills,...n.agentModels?{agentModels:n.agentModels}:{}}),(0,install_manifest_1.writeManifest)(o,s)}catch(a){return refused(500,`the kit was refreshed but not stamped: ${a.message}`)}return(0,kits_endpoint_1.clearKitsCache)(),{status:200,body:{ok:!0,kit:r.kit,version:s}}}function previewKitRemoval(i){const e=(0,kit_target_1.targetFrom)(i);if(!e.ok)return refused(e.status,e.error);const{record:t}=e.target,r=removalRefusal(t.scope);if(r)return r;const o=(0,agentkit_home_1.loadAgentkitHome)();return{status:200,body:{ok:!0,paths:(0,kit_remover_1.kitRemovalPaths)(t.kit,t.path).map(n=>o.toDisplayPath(path.join(t.path,n)))}}}function removalRefusal(i){return i!=="global"?null:refused(409,"Global installs cannot be removed from the dashboard.","Delete the kit directory yourself if you mean to; nothing here will do it for you.")}function removeKitInstall(i){const e=(0,kit_target_1.targetFrom)(i);if(!e.ok)return refused(e.status,e.error);const{record:t}=e.target,r=removalRefusal(t.scope);if(r)return r;if(i.confirmKitRoot!==(0,kit_target_1.wireRoot)(t.kitRoot))return refused(400,"confirmKitRoot must repeat the install root exactly");if(!(0,kit_remover_1.removeKit)(t.kit,t.path))return refused(500,"nothing was removed \u2014 the install may already be gone");try{(0,install_registry_1.removeInstall)(t.kitRoot,t.kit)}catch{}return(0,kits_endpoint_1.clearKitsCache)(),{status:200,body:{ok:!0,kit:t.kit}}}
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(i,e,t,r){r===void 0&&(r=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,r,o)}):(function(i,e,t,r){r===void 0&&(r=t),i[r]=e[t]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}):function(i,e){i.default=e}),__importStar=this&&this.__importStar||(function(){var i=function(e){return i=Object.getOwnPropertyNames||function(t){var r=[];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[r.length]=o);return r},i(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=i(e),o=0;o<r.length;o++)r[o]!=="default"&&__createBinding(t,e,r[o]);return __setModuleDefault(t,e),t}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.MASTER_HOOK=void 0,exports.setHook=setHook,exports.refreshKit=refreshKit,exports.previewKitRemoval=previewKitRemoval,exports.removeKitInstall=removeKitInstall;const path=__importStar(require("path")),agentkit_config_file_1=require("../agentkit-config-file"),hook_toggle_registry_1=require("../hook-toggle-registry"),agentkit_home_1=require("../agentkit-home"),init_install_scope_1=require("../init-install-scope"),install_registry_1=require("../install-registry"),kit_remover_1=require("../kit-remover"),kit_install_dispatch_1=require("../kit-install-dispatch"),profile_context_1=require("../kit-installers/profile-context"),install_manifest_1=require("../install-manifest"),install_profile_config_1=require("../install-profile-config"),profile_resolution_1=require("../doctor/profile-resolution"),skill_profiles_1=require("../skill-profiles"),hooks_write_policy_1=require("../hooks-write-policy"),kits_1=require("../kits"),kits_endpoint_1=require("./kits-endpoint"),kit_target_1=require("./kit-target");exports.MASTER_HOOK="*";function refused(i,e,t){return{status:i,body:{ok:!1,error:e,...t?{hint:t}:{}}}}function setHook(i,e){const t=(0,kit_target_1.targetFrom)(e);if(!t.ok)return refused(t.status,t.error);const r=e,o=r.hook,n=r.enabled;if(typeof o!="string"||!o)return refused(400,"hook is required");if(typeof n!="boolean")return refused(400,"enabled must be true or false");const{record:l,context:c}=t.target;if(o===exports.MASTER_HOOK){try{(0,agentkit_config_file_1.writeHooksEnabled)(c.configPath,n)}catch(a){return refused(500,`could not write the kit config: ${a.message}`)}return(0,kits_endpoint_1.clearKitsCache)(),{status:200,body:{ok:!0,hook:o,enabled:n}}}const u=(0,hook_toggle_registry_1.hookRegistry)(i).find(a=>a.name===o);if(!u)return refused(404,"no such hook");const s=(0,hooks_write_policy_1.decideWrite)(l.kit,l.scope,o,u.readBy,kits_1.kitDefinitions[l.kit].name);if(!s.allowed)return refused(409,s.reason,s.hint);try{(0,agentkit_config_file_1.updateSection)(c.configPath,"hooks",a=>{a[o]=n})}catch(a){return refused(500,`could not write the kit config: ${a.message}`)}return(0,kits_endpoint_1.clearKitsCache)(),{status:200,body:{ok:!0,hook:o,enabled:n,...s.warning?{warning:s.warning}:{}}}}function refreshKit(i,e){const t=(0,kit_target_1.targetFrom)(e);if(!t.ok)return refused(t.status,t.error);const{record:r,context:o}=t.target,n=(0,install_profile_config_1.readInstallSettings)(o.configPath),l=n.profile??(0,profile_resolution_1.resolveCheckProfile)(o,i).profile;if(!l)return refused(409,`${kits_1.kitDefinitions[r.kit].name} never recorded a profile and its installed skill set is ambiguous \u2014 run \`agentkit init\` to choose one before refreshing.`);const c=(0,skill_profiles_1.resolveSkipDirs)(i,l,n.extraSkills),f={...n.agentModels?{agentModels:n.agentModels}:{},profileContext:(0,profile_context_1.buildProfileInstallContext)(i,l)},u=r.scope==="global"?(0,kit_install_dispatch_1.installGlobalKit)(r.kit,i,(0,init_install_scope_1.resolveGlobalRoot)(r.kit,""),c,f):(0,kit_install_dispatch_1.installProjectKit)(r.kit,i,r.path,c,f);if(!u.ok)return refused(409,u.reason);const s=(0,install_profile_config_1.readCliVersion)(i);try{s&&(0,install_profile_config_1.stampInstallVersion)(o.configPath,s),(0,install_profile_config_1.writeInstallSettings)(o.configPath,{profile:n.profile??void 0,extraSkills:n.extraSkills,...n.agentModels?{agentModels:n.agentModels}:{}}),(0,install_manifest_1.writeManifest)(o,s)}catch(a){return refused(500,`the kit was refreshed but not stamped: ${a.message}`)}return(0,kits_endpoint_1.clearKitsCache)(),{status:200,body:{ok:!0,kit:r.kit,version:s}}}function previewKitRemoval(i){const e=(0,kit_target_1.targetFrom)(i);if(!e.ok)return refused(e.status,e.error);const{record:t}=e.target,r=removalRefusal(t.scope);if(r)return r;const o=(0,agentkit_home_1.loadAgentkitHome)();return{status:200,body:{ok:!0,paths:(0,kit_remover_1.kitRemovalPaths)(t.kit,t.path).map(n=>o.toDisplayPath(path.join(t.path,n)))}}}function removalRefusal(i){return i!=="global"?null:refused(409,"Global installs cannot be removed from the dashboard.","Delete the kit directory yourself if you mean to; nothing here will do it for you.")}function removeKitInstall(i){const e=(0,kit_target_1.targetFrom)(i);if(!e.ok)return refused(e.status,e.error);const{record:t}=e.target,r=removalRefusal(t.scope);if(r)return r;if(i.confirmKitRoot!==(0,kit_target_1.wireRoot)(t.kitRoot))return refused(400,"confirmKitRoot must repeat the install root exactly");if(!(0,kit_remover_1.removeKit)(t.kit,t.path))return refused(500,"nothing was removed \u2014 the install may already be gone");try{(0,install_registry_1.removeInstall)(t.kitRoot,t.kit)}catch{}return(0,kits_endpoint_1.clearKitsCache)(),{status:200,body:{ok:!0,kit:t.kit}}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SKILL_DEPENDENCIES=exports.DEFAULT_EXCLUDED_SKILLS=exports.CORE_SKILLS=exports.UNRECORDED_PROFILE=exports.DEFAULT_PROFILE=exports.PROFILES=void 0,exports.defaultProfileForKit=defaultProfileForKit,exports.resolveEffectiveProfile=resolveEffectiveProfile,exports.withDependencies=withDependencies,exports.isNameOnlyProfile=isNameOnlyProfile,exports.profileSkillNames=profileSkillNames,exports.profileIncludeCategories=profileIncludeCategories,exports.profileExtraSkills=profileExtraSkills,exports.isValidProfile=isValidProfile,exports.profileToSkipDirs=profileToSkipDirs,exports.resolveSkipDirs=resolveSkipDirs;const generate_catalogs_1=require("../generate-catalogs"),retired_skills_1=require("./retired-skills");exports.PROFILES=["core","full","frontend","backend","mobile","fullstack","marketing","assistant"],exports.DEFAULT_PROFILE="core",exports.UNRECORDED_PROFILE="full";function defaultProfileForKit(e){return ASSISTANT_PROFILE_KITS.has(e)?"assistant":exports.DEFAULT_PROFILE}function resolveEffectiveProfile(e,t,s,n){return e??(t?s:defaultProfileForKit(n))}const ASSISTANT_PROFILE_KITS=new Set(["hermes","openclaw"]);exports.CORE_SKILLS=new Set(["ak-plan","cook","ak-fix","test","ak-code-review","ak-debug","scout","brainstorm","ship","journal","git","worktree","docs","docs-seeker","find-skills","problem-solving","refactor","context-engineering","research","preview","mermaidjs-v11"]),exports.DEFAULT_EXCLUDED_SKILLS=new Set(["twilio","typesafe-ai","expo","flutter","gsap","shopify","zalo-mini-app","stitch","remotion","shader","threejs","clone-website","pentester","cti-expert","ai-artist","chrome-devtools","chrome-profile","xia","agentize","show-off","mintlify","seo","social-calendar","email-marketing","paid-ads","marketing-analytics","product-marketing","campaign-plan","crm-automation","pr-outreach","growth-referral","aso-app-marketing","video-content-repurposing","fomo-cc","enhance-ux-ax"]);const PROFILE_INCLUDES={frontend:["frontend","design","frameworks"],backend:["backend","database","infrastructure","security"],mobile:["frontend","frameworks","design"],fullstack:["frontend","backend","database","infrastructure","frameworks","design"],marketing:["marketing","design","seo","documents","multimedia","ai-ml"],assistant:[]},PROFILE_EXTRA_SKILLS={marketing:["copywriting","show-off","project-management","frontend-design","agent-browser","project-organization","ak-sowat","enhance-ux-ax"]};exports.SKILL_DEPENDENCIES={"enhance-ux-ax":["seo"]};function withDependencies(e){const t=new Set(e);let s=!0;for(;s;){s=!1;for(const n of[...t])for(const i of exports.SKILL_DEPENDENCIES[n]??[])t.has(i)||(t.add(i),s=!0)}return t}const NAME_ONLY_PROFILES=new Set(["assistant"]),PROFILE_SKILL_NAMES={assistant:["research","problem-solving","brainstorm","context-engineering","ak-advise","ak-plan","project-organization","retro","git","test","document-skills","docs-seeker","media-processing","copywriting","mermaidjs-v11"]};function isNameOnlyProfile(e){return NAME_ONLY_PROFILES.has(e)}function profileSkillNames(e){return e==="full"||e==="core"?[]:PROFILE_SKILL_NAMES[e]??[]}function profileIncludeCategories(e){return e==="full"||e==="core"?[]:PROFILE_INCLUDES[e]}function profileExtraSkills(e){return e==="full"||e==="core"?[]:PROFILE_EXTRA_SKILLS[e]??[]}function isValidProfile(e){return exports.PROFILES.includes(e)}function profileToSkipDirs(e,t){if(t==="full")return[];if(t==="core"){const r=(0,generate_catalogs_1.collectSkills)(e),a=withDependencies(r.filter(o=>!exports.DEFAULT_EXCLUDED_SKILLS.has(o.name)).map(o=>o.name));return r.filter(o=>!a.has(o.name)).map(o=>o.name).sort()}if(NAME_ONLY_PROFILES.has(t)){const r=withDependencies(PROFILE_SKILL_NAMES[t]??[]);return(0,generate_catalogs_1.collectSkills)(e).filter(a=>!r.has(a.name)).map(a=>a.name).sort()}const s=new Set(PROFILE_INCLUDES[t]),n=new Set(PROFILE_EXTRA_SKILLS[t]??[]),i=(0,generate_catalogs_1.collectSkills)(e),l=withDependencies(i.filter(r=>s.has(r.category)||exports.CORE_SKILLS.has(r.name)||n.has(r.name)).map(r=>r.name));return i.filter(r=>!l.has(r.name)).map(r=>r.name).sort()}function resolveSkipDirs(e,t,s=[]){const n=withDependencies(s);return[...new Set([...profileToSkipDirs(e,t),...retired_skills_1.RETIRED_SKILLS])].filter(l=>!n.has(l)).sort()}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SKILL_DEPENDENCIES=exports.DEFAULT_EXCLUDED_SKILLS=exports.CORE_SKILLS=exports.DEFAULT_PROFILE=exports.PROFILES=void 0,exports.defaultProfileForKit=defaultProfileForKit,exports.resolveEffectiveProfile=resolveEffectiveProfile,exports.withDependencies=withDependencies,exports.isNameOnlyProfile=isNameOnlyProfile,exports.profileSkillNames=profileSkillNames,exports.profileIncludeCategories=profileIncludeCategories,exports.profileExtraSkills=profileExtraSkills,exports.isValidProfile=isValidProfile,exports.profileToSkipDirs=profileToSkipDirs,exports.resolveSkipDirs=resolveSkipDirs;const generate_catalogs_1=require("../gen/generate-catalogs"),retired_skills_1=require("./retired-skills");exports.PROFILES=["core","full","frontend","backend","mobile","fullstack","marketing","assistant"],exports.DEFAULT_PROFILE="core";function defaultProfileForKit(e){return ASSISTANT_PROFILE_KITS.has(e)?"assistant":exports.DEFAULT_PROFILE}function resolveEffectiveProfile(e,t,s,n){return e??(t?s:null)??defaultProfileForKit(n)}const ASSISTANT_PROFILE_KITS=new Set(["hermes","openclaw"]);exports.CORE_SKILLS=new Set(["ak-plan","cook","ak-fix","test","ak-code-review","ak-debug","scout","brainstorm","ship","journal","git","worktree","docs","docs-seeker","find-skills","problem-solving","refactor","context-engineering","research","preview","mermaidjs-v11"]),exports.DEFAULT_EXCLUDED_SKILLS=new Set(["twilio","typesafe-ai","expo","flutter","gsap","shopify","zalo-mini-app","stitch","remotion","shader","threejs","clone-website","pentester","cti-expert","ai-artist","chrome-devtools","chrome-profile","xia","agentize","show-off","mintlify","seo","social-calendar","email-marketing","paid-ads","marketing-analytics","product-marketing","campaign-plan","crm-automation","pr-outreach","growth-referral","aso-app-marketing","video-content-repurposing","fomo-cc","enhance-ux-ax"]);const PROFILE_INCLUDES={frontend:["frontend","design","frameworks"],backend:["backend","database","infrastructure","security"],mobile:["frontend","frameworks","design"],fullstack:["frontend","backend","database","infrastructure","frameworks","design"],marketing:["marketing","design","seo","documents","multimedia","ai-ml"],assistant:[]},PROFILE_EXTRA_SKILLS={marketing:["copywriting","show-off","project-management","frontend-design","agent-browser","project-organization","ak-sowat","enhance-ux-ax"]};exports.SKILL_DEPENDENCIES={"enhance-ux-ax":["seo"]};function withDependencies(e){const t=new Set(e);let s=!0;for(;s;){s=!1;for(const n of[...t])for(const i of exports.SKILL_DEPENDENCIES[n]??[])t.has(i)||(t.add(i),s=!0)}return t}const NAME_ONLY_PROFILES=new Set(["assistant"]),PROFILE_SKILL_NAMES={assistant:["research","problem-solving","brainstorm","context-engineering","ak-advise","ak-plan","project-organization","retro","git","test","document-skills","docs-seeker","media-processing","copywriting","mermaidjs-v11"]};function isNameOnlyProfile(e){return NAME_ONLY_PROFILES.has(e)}function profileSkillNames(e){return e==="full"||e==="core"?[]:PROFILE_SKILL_NAMES[e]??[]}function profileIncludeCategories(e){return e==="full"||e==="core"?[]:PROFILE_INCLUDES[e]}function profileExtraSkills(e){return e==="full"||e==="core"?[]:PROFILE_EXTRA_SKILLS[e]??[]}function isValidProfile(e){return exports.PROFILES.includes(e)}function profileToSkipDirs(e,t){if(t==="full")return[];if(t==="core"){const r=(0,generate_catalogs_1.collectSkills)(e),a=withDependencies(r.filter(o=>!exports.DEFAULT_EXCLUDED_SKILLS.has(o.name)).map(o=>o.name));return r.filter(o=>!a.has(o.name)).map(o=>o.name).sort()}if(NAME_ONLY_PROFILES.has(t)){const r=withDependencies(PROFILE_SKILL_NAMES[t]??[]);return(0,generate_catalogs_1.collectSkills)(e).filter(a=>!r.has(a.name)).map(a=>a.name).sort()}const s=new Set(PROFILE_INCLUDES[t]),n=new Set(PROFILE_EXTRA_SKILLS[t]??[]),i=(0,generate_catalogs_1.collectSkills)(e),l=withDependencies(i.filter(r=>s.has(r.category)||exports.CORE_SKILLS.has(r.name)||n.has(r.name)).map(r=>r.name));return i.filter(r=>!l.has(r.name)).map(r=>r.name).sort()}function resolveSkipDirs(e,t,s=[]){const n=withDependencies(s);return[...new Set([...profileToSkipDirs(e,t),...retired_skills_1.RETIRED_SKILLS])].filter(l=>!n.has(l)).sort()}
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(t,e,s,r){r===void 0&&(r=s);var n=Object.getOwnPropertyDescriptor(e,s);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[s]}}),Object.defineProperty(t,r,n)}):(function(t,e,s,r){r===void 0&&(r=s),t[r]=e[s]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),__importStar=this&&this.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(s){var r=[];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(r[r.length]=n);return r},t(e)};return function(e){if(e&&e.__esModule)return e;var s={};if(e!=null)for(var r=t(e),n=0;n<r.length;n++)r[n]!=="default"&&__createBinding(s,e,r[n]);return __setModuleDefault(s,e),s}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.KNOWN_UNTESTED=exports.KNOWN_UNWIRED=exports.PYTHON_RUNNERS=exports.WIRED_RUNNERS=exports.SKILLS_DIR=exports.REPO_ROOT=void 0,exports.allowlistReason=allowlistReason,exports.allowlistPath=allowlistPath,exports.runnerFor=runnerFor,exports.isVendoredSkill=isVendoredSkill,exports.isUnderVendoredSkill=isUnderVendoredSkill,exports.inScopeSkills=inScopeSkills,exports.summarizeSkills=summarizeSkills,exports.discoverSkillTests=discoverSkillTests;const fs=__importStar(require("fs")),path=__importStar(require("path"));exports.REPO_ROOT=path.resolve(__dirname,"..",".."),exports.SKILLS_DIR=path.join(exports.REPO_ROOT,"skills");const NOT_SKILLS=new Set(["common"]),CODE_EXT=new Set([".py",".cjs",".js",".mjs",".ts",".sh",".ps1"]),SKIP_DIRS=new Set(["__pycache__","node_modules",".git",".pytest_cache",".venv","venv"]),TEST_DIR=new Set(["tests","test","__tests__"]),TEST_NAME=/(^test[-_.]|[-_.]test\.|_test\.|^run\.sh$)/i;exports.WIRED_RUNNERS=["pytest","python:unittest","node:test","node:bespoke","shell"],exports.PYTHON_RUNNERS=["pytest","python:unittest"],exports.KNOWN_UNWIRED=new Set(["skills/pentester/tests/lib/assert.sh # W16 harness","skills/pentester/tests/lib/manifest.sh # W16 harness","skills/pentester/tests/run.sh # W16 harness","skills/use-mcp/scripts/smoke-test.sh # W10 runner","skills/docs-seeker/scripts/tests/run-tests.js # W17 harness"]);function allowlistReason(t){return(t.split(" # ")[1]??"").split(" ").slice(1).join(" ")}exports.KNOWN_UNTESTED=new Set([]);function allowlistPath(t){return t.split(" # ")[0]}function readIfPossible(t){try{return fs.readFileSync(t,"utf8")}catch{return null}}function runnerFor(t){const e=path.extname(t);if(e===".py"){const s=readIfPossible(t);return s===null?"python:unreadable":/^\s*import pytest|^\s*from pytest/m.test(s)?"pytest":s.includes("unittest")?"python:unittest":"python:plain"}if(e===".cjs"||e===".mjs"||e===".js"){const s=readIfPossible(t);return s===null?"node:unreadable":/require\(['"]node:test['"]\)|from ['"]node:test['"]/.test(s)?"node:test":"node:bespoke"}return e===".sh"?"shell":`unknown:${e}`}function isVendoredSkill(t,e=exports.SKILLS_DIR){const s=path.join(e,t,"SKILL.md");if(!fs.existsSync(s))return!1;const r=fs.readFileSync(s,"utf8").match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1]??"";return/^upstream:/m.test(r)}function isUnderVendoredSkill(t){const e=t.replace(/\\/g,"/").split("/");return e[0]==="skills"&&e.length>=2&&isVendoredSkill(e[1])}function inScopeSkills(t=exports.SKILLS_DIR){return fs.existsSync(t)?fs.readdirSync(t,{withFileTypes:!0}).filter(e=>e.isDirectory()&&!e.name.startsWith(".")&&!NOT_SKILLS.has(e.name)).map(e=>e.name).filter(e=>{const s=path.join(t,e,"SKILL.md");return fs.existsSync(s)&&!isVendoredSkill(e,t)}).sort():[]}function walk(t,e){let s;try{s=fs.readdirSync(t,{withFileTypes:!0})}catch(r){console.error(`skill-tests: cannot read ${path.relative(exports.REPO_ROOT,t)} \u2014 ${String(r)}`);return}for(const r of s){const n=path.join(t,r.name);if(r.isDirectory()){if(SKIP_DIRS.has(r.name))continue;walk(n,e)}else r.isFile()&&e.push(n)}}function isTestFile(t,e){const s=path.relative(t,e);return path.dirname(s).split(path.sep).some(n=>TEST_DIR.has(n))?!0:TEST_NAME.test(path.basename(e))}function repoRelative(t){return path.relative(exports.REPO_ROOT,t).split(path.sep).join("/")}function summarizeSkills(t=exports.SKILLS_DIR){return inScopeSkills(t).map(e=>{const s=path.join(t,e),r=[];walk(s,r);const n=[],i=[];for(const o of r.sort())CODE_EXT.has(path.extname(o))&&(isTestFile(s,o)?i:n).push(repoRelative(o));return{skill:e,codeFiles:n,testFiles:i}})}function discoverSkillTests(t=exports.SKILLS_DIR){const e=[];for(const{skill:s,testFiles:r}of summarizeSkills(t)){const n=path.join(t,s);for(const i of r){const o=path.join(exports.REPO_ROOT,i);e.push({file:i,skill:s,dir:path.dirname(path.relative(n,o)).split(path.sep).join("/"),runner:runnerFor(o)})}}return e}
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(t,e,s,r){r===void 0&&(r=s);var n=Object.getOwnPropertyDescriptor(e,s);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[s]}}),Object.defineProperty(t,r,n)}):(function(t,e,s,r){r===void 0&&(r=s),t[r]=e[s]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),__importStar=this&&this.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(s){var r=[];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(r[r.length]=n);return r},t(e)};return function(e){if(e&&e.__esModule)return e;var s={};if(e!=null)for(var r=t(e),n=0;n<r.length;n++)r[n]!=="default"&&__createBinding(s,e,r[n]);return __setModuleDefault(s,e),s}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.KNOWN_UNTESTED=exports.KNOWN_UNWIRED=exports.PYTHON_RUNNERS=exports.WIRED_RUNNERS=exports.SKILLS_DIR=exports.REPO_ROOT=void 0,exports.allowlistReason=allowlistReason,exports.allowlistPath=allowlistPath,exports.runnerFor=runnerFor,exports.isVendoredSkill=isVendoredSkill,exports.isUnderVendoredSkill=isUnderVendoredSkill,exports.inScopeSkills=inScopeSkills,exports.summarizeSkills=summarizeSkills,exports.discoverSkillTests=discoverSkillTests;const fs=__importStar(require("fs")),path=__importStar(require("path")),payload_roots_1=require("./payload-roots");exports.REPO_ROOT=path.resolve(__dirname,"..",".."),exports.SKILLS_DIR=path.join(exports.REPO_ROOT,payload_roots_1.SKILL_SOURCE_DIR);const NOT_SKILLS=new Set(["common"]),CODE_EXT=new Set([".py",".cjs",".js",".mjs",".ts",".sh",".ps1"]),SKIP_DIRS=new Set(["__pycache__","node_modules",".git",".pytest_cache",".venv","venv"]),TEST_DIR=new Set(["tests","test","__tests__"]),TEST_NAME=/(^test[-_.]|[-_.]test\.|_test\.|^run\.sh$)/i;exports.WIRED_RUNNERS=["pytest","python:unittest","node:test","node:bespoke","shell"],exports.PYTHON_RUNNERS=["pytest","python:unittest"],exports.KNOWN_UNWIRED=new Set(["skills/pentester/tests/lib/assert.sh # W16 harness","skills/pentester/tests/lib/manifest.sh # W16 harness","skills/pentester/tests/run.sh # W16 harness","skills/use-mcp/scripts/smoke-test.sh # W10 runner","skills/docs-seeker/scripts/tests/run-tests.js # W17 harness"]);function allowlistReason(t){return(t.split(" # ")[1]??"").split(" ").slice(1).join(" ")}exports.KNOWN_UNTESTED=new Set([]);function allowlistPath(t){return t.split(" # ")[0]}function readIfPossible(t){try{return fs.readFileSync(t,"utf8")}catch{return null}}function runnerFor(t){const e=path.extname(t);if(e===".py"){const s=readIfPossible(t);return s===null?"python:unreadable":/^\s*import pytest|^\s*from pytest/m.test(s)?"pytest":s.includes("unittest")?"python:unittest":"python:plain"}if(e===".cjs"||e===".mjs"||e===".js"){const s=readIfPossible(t);return s===null?"node:unreadable":/require\(['"]node:test['"]\)|from ['"]node:test['"]/.test(s)?"node:test":"node:bespoke"}return e===".sh"?"shell":`unknown:${e}`}function isVendoredSkill(t,e=exports.SKILLS_DIR){const s=path.join(e,t,"SKILL.md");if(!fs.existsSync(s))return!1;const r=fs.readFileSync(s,"utf8").match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1]??"";return/^upstream:/m.test(r)}function isUnderVendoredSkill(t){const e=t.replace(/\\/g,"/").split("/");return e[0]==="skills"&&e.length>=2&&isVendoredSkill(e[1])}function inScopeSkills(t=exports.SKILLS_DIR){return fs.existsSync(t)?fs.readdirSync(t,{withFileTypes:!0}).filter(e=>e.isDirectory()&&!e.name.startsWith(".")&&!NOT_SKILLS.has(e.name)).map(e=>e.name).filter(e=>{const s=path.join(t,e,"SKILL.md");return fs.existsSync(s)&&!isVendoredSkill(e,t)}).sort():[]}function walk(t,e){let s;try{s=fs.readdirSync(t,{withFileTypes:!0})}catch(r){console.error(`skill-tests: cannot read ${path.relative(exports.REPO_ROOT,t)} \u2014 ${String(r)}`);return}for(const r of s){const n=path.join(t,r.name);if(r.isDirectory()){if(SKIP_DIRS.has(r.name))continue;walk(n,e)}else r.isFile()&&e.push(n)}}function isTestFile(t,e){const s=path.relative(t,e);return path.dirname(s).split(path.sep).some(n=>TEST_DIR.has(n))?!0:TEST_NAME.test(path.basename(e))}function repoRelative(t){return path.relative(exports.REPO_ROOT,t).split(path.sep).join("/")}function summarizeSkills(t=exports.SKILLS_DIR){return inScopeSkills(t).map(e=>{const s=path.join(t,e),r=[];walk(s,r);const n=[],i=[];for(const o of r.sort())CODE_EXT.has(path.extname(o))&&(isTestFile(s,o)?i:n).push(repoRelative(o));return{skill:e,codeFiles:n,testFiles:i}})}function discoverSkillTests(t=exports.SKILLS_DIR){const e=[];for(const{skill:s,testFiles:r}of summarizeSkills(t)){const n=path.join(t,s);for(const i of r){const o=path.join(exports.REPO_ROOT,i);e.push({file:i,skill:s,dir:path.dirname(path.relative(n,o)).split(path.sep).join("/"),runner:runnerFor(o)})}}return e}
@@ -0,0 +1 @@
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(r,e,i,t){t===void 0&&(t=i);var n=Object.getOwnPropertyDescriptor(e,i);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(r,t,n)}):(function(r,e,i,t){t===void 0&&(t=i),r[t]=e[i]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),__importStar=this&&this.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(i){var t=[];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[t.length]=n);return t},r(e)};return function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var t=r(e),n=0;n<t.length;n++)t[n]!=="default"&&__createBinding(i,e,t[n]);return __setModuleDefault(i,e),i}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.runSkills=runSkills;const fs=__importStar(require("fs")),path=__importStar(require("path")),p=__importStar(require("@clack/prompts")),file_operations_1=require("../file-operations"),install_profile_config_1=require("../install-profile-config"),kit_context_1=require("../kit-context"),kits_1=require("../kits"),logger_1=require("../logger"),install_manifest_1=require("../install-manifest"),skills_remove_1=require("../skills-remove"),skill_profiles_1=require("../skill-profiles"),generate_catalogs_1=require("../../gen/generate-catalogs"),payload_roots_1=require("../payload-roots");function installedSkillNames(r){return fs.existsSync(r)?new Set(fs.readdirSync(r,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name)):new Set}function closeMatches(r,e){const i=r.toLowerCase();return e.filter(t=>t.includes(i)||i.includes(t)||t.slice(0,3)===i.slice(0,3)).slice(0,5)}function usage(){(0,logger_1.printInfo)("Usage:"),(0,logger_1.printInfo)(" agentkit skills pick skills to install (interactive)"),(0,logger_1.printInfo)(" agentkit skills list show the full skill catalog"),(0,logger_1.printInfo)(" agentkit skills add <name\u2026> install one or more named skills"),(0,logger_1.printInfo)(" agentkit skills remove <name\u2026> remove skills added with `add`"),(0,logger_1.printInfo)(" agentkit skills help show full help message")}function printList(r,e){(0,logger_1.printSection)(`Skill catalog (${r.length})`);const i=new Map;for(const t of r)(i.get(t.category)??i.set(t.category,[]).get(t.category)).push(t);for(const t of Object.keys(generate_catalogs_1.CATEGORY_TITLES)){const n=i.get(t);if(!(!n||n.length===0)){console.log(""),console.log(` ${generate_catalogs_1.CATEGORY_TITLES[t]} (${n.length})`);for(const s of n){const c=e.has(s.name)?" \u2713":" ",u=s.description?` \u2014 ${s.description}`:"";console.log(` ${c} ${s.name}${u}`)}}}console.log("")}function installSkills(r,e,i){const t=new Set(r),n=[...(0,skill_profiles_1.withDependencies)(r)].sort(),s=n.filter(l=>!fs.existsSync(path.join(i,payload_roots_1.SKILL_SOURCE_DIR,l)));if(s.length>0)return(0,logger_1.printError)(`Cannot install: ${s.join(", ")} missing from the shipped skills/.`),1;fs.mkdirSync(e.destSkillsDir,{recursive:!0});for(const l of n){const f=path.join(i,payload_roots_1.SKILL_SOURCE_DIR,l);(0,file_operations_1.copyDir)(f,path.join(e.destSkillsDir,l),{suppressSymlinkWarnings:!0})}const c=(0,install_profile_config_1.readInstallSettings)(e.configPath),u=c.profile??(0,skill_profiles_1.defaultProfileForKit)(e.kit),d=[...new Set([...c.extraSkills,...n])].sort();(0,install_profile_config_1.writeInstallSettings)(e.configPath,{profile:c.profile??void 0,extraSkills:d});const o=(0,install_profile_config_1.readCliVersion)(i);o&&(0,install_profile_config_1.stampInstallVersion)(e.configPath,o),(0,install_manifest_1.writeManifest)(e,o);for(const l of r)(0,logger_1.printSuccess)(`Installed ${l} into ${kits_1.kitDefinitions[e.kit].name} (${e.scope}).`);for(const l of n.filter(f=>!t.has(f))){const f=r.filter(g=>(0,skill_profiles_1.withDependencies)([g]).has(l));(0,logger_1.printInfo)(`Also installed ${l} \u2014 required by ${f.join(", ")}.`)}return(0,logger_1.printInfo)(`Recorded in install.extraSkills so re-install keeps them on the ${u} profile.`),0}async function removeSkills(r,e,i,t){const n=(0,install_profile_config_1.readInstallSettings)(e.configPath),s=n.profile??(0,skill_profiles_1.defaultProfileForKit)(e.kit),{extras:c,profileOwned:u}=(0,skills_remove_1.planRemoval)(r,n.extraSkills);for(const a of u)(0,logger_1.printError)(`${a} comes from the ${s} profile, not \`agentkit skills add\`.`),(0,logger_1.printInfo)("Removing it would not stick \u2014 the next `agentkit init` copies it back."),(0,logger_1.printInfo)("Install a narrower profile instead: agentkit init --profile <name>");if(c.length===0)return u.length>0?1:0;if(t.isTTY){const a=await t.confirm({message:`Delete ${c.map(m=>path.join(e.destSkillsDir,m)).join(", ")}?`,initialValue:!1});if(p.isCancel(a)||!a)return(0,logger_1.printInfo)("Nothing removed."),0}const d=(0,skills_remove_1.removeSkillDirs)(c,e.destSkillsDir);for(const a of d.rejected)(0,logger_1.printError)(`Refused to delete ${a}: it does not resolve inside ${e.destSkillsDir}.`);const o=[...d.removed,...d.missing],l=n.extraSkills.filter(a=>!o.includes(a));(0,install_profile_config_1.writeInstallSettings)(e.configPath,{profile:n.profile??void 0,extraSkills:l});const f=(0,install_profile_config_1.readCliVersion)(i);f&&(0,install_profile_config_1.stampInstallVersion)(e.configPath,f),(0,install_manifest_1.writeManifest)(e,f);for(const a of d.removed)(0,logger_1.printSuccess)(`Removed ${a} from ${kits_1.kitDefinitions[e.kit].name} (${e.scope}).`);for(const a of d.missing)(0,logger_1.printInfo)(`${a} was already gone from disk; cleared its install.extraSkills entry.`);const g=installedSkillNames(e.destSkillsDir);for(const[a,m]of(0,skills_remove_1.danglingDependencies)(o,g,skill_profiles_1.SKILL_DEPENDENCIES)){const k=n.extraSkills.includes(a)?`remove ${a} too`:`narrow the ${s} profile that carries it`;(0,logger_1.printWarning)(`${a} is still installed and requires ${m} \u2014 re-add it (\`agentkit skills add ${m}\`), or ${k}. The next \`agentkit init\` re-adds ${m} while ${a} stays installed.`)}return d.rejected.length>0||u.length>0?1:0}async function interactivePick(r,e,i){const t=installedSkillNames(e.destSkillsDir),n=await p.autocompleteMultiselect({message:"Select skills to install",placeholder:"Type to search by name, category, or description",required:!1,options:r.map(s=>({value:s.name,label:`${s.name}${t.has(s.name)?" \u2713":""}`,hint:`[${s.category}] ${s.description}`.slice(0,80)}))});return p.isCancel(n)||n.length===0?((0,logger_1.printInfo)("Nothing selected."),0):installSkills(n,e,i)}async function runSkills(r,e={}){const i=e.cwd??process.cwd(),t=e.repoRoot??path.resolve(__dirname,"..","..",".."),n={confirm:e.confirm??p.confirm,isTTY:e.isTTY??process.stdout.isTTY},[s,...c]=r,u=(0,generate_catalogs_1.collectSkills)(t),d=u.map(o=>o.name);if(s==="list"){const o=(0,kit_context_1.soleContext)(i);return printList(u,o?installedSkillNames(o.destSkillsDir):new Set),0}if(s==="add"||s==="remove"){if(c.length===0)return usage(),1;const o=c.filter(f=>!d.includes(f));if(o.length>0){(0,logger_1.printError)(`Unknown skill(s): ${o.join(", ")}`);for(const f of o){const g=closeMatches(f,d);g.length>0&&(0,logger_1.printInfo)(`Did you mean (for ${f}): ${g.join(", ")}?`)}return(0,logger_1.printInfo)("Run `agentkit skills list` to see the catalog."),1}const l=await(0,kit_context_1.resolveContext)(i);return l?s==="remove"?removeSkills(c,l,t,n):installSkills(c,l,t):1}if(!s){if(!n.isTTY){const l=(0,kit_context_1.soleContext)(i);return printList(u,l?installedSkillNames(l.destSkillsDir):new Set),usage(),0}const o=await(0,kit_context_1.resolveContext)(i);return o?interactivePick(u,o,t):1}return(0,logger_1.printError)(`Unknown subcommand: ${s}`),usage(),1}
@@ -0,0 +1,4 @@
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(r,t,e,n){n===void 0&&(n=e);var o=Object.getOwnPropertyDescriptor(t,e);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,n,o)}):(function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}):function(r,t){r.default=t}),__importStar=this&&this.__importStar||(function(){var r=function(t){return r=Object.getOwnPropertyNames||function(e){var n=[];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[n.length]=o);return n},r(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=r(t),o=0;o<n.length;o++)n[o]!=="default"&&__createBinding(e,t,n[o]);return __setModuleDefault(e,t),e}})(),__importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.runUpdate=runUpdate;const p=__importStar(require("@clack/prompts")),fs=__importStar(require("fs")),path=__importStar(require("path")),child_process_1=require("child_process"),chalk_1=__importDefault(require("chalk")),logger_1=require("../logger"),exec_1=require("../payload/exec"),source_1=require("../payload/source"),agentkit_home_1=require("../agentkit-home"),version_check_1=require("../version-check"),update_notifier_1=require("../update-notifier"),MAX_NOTES_SHOWN=5,MAX_NOTE_LINES=15;async function updateNpmClient(r,t,e){let n;try{n=JSON.parse(fs.readFileSync(path.join(t,"package.json"),"utf8"))}catch{return}if(typeof n.payloadVersion!="string"||typeof n.name!="string")return;const o=typeof n.version=="string"?n.version:"0.0.0";(0,logger_1.printProgress)("Checking npm for client updates...");let a=null;try{const u=await fetch(`https://registry.npmjs.org/${n.name.replace("/","%2F")}/latest`,{headers:{Accept:"application/json"},signal:AbortSignal.timeout(version_check_1.REQUEST_TIMEOUT_MS)});if(u.ok){const f=await u.json();a=typeof f.version=="string"?f.version:null}}catch{}if(!a)return;if((0,version_check_1.compareVersions)(a,o)<=0){(0,logger_1.printInfo)(`Client is latest (v${o}).`);return}(0,logger_1.printInfo)(`Client update available: v${o} \u2192 v${a}`);const l=r?!0:await e({message:"Update the client package now?"});if(p.isCancel(l)||!l)return;const c=process.platform==="win32"?"npm.cmd":"npm";(0,child_process_1.spawnSync)(c,["install","-g",`${n.name}@latest`],{stdio:"inherit"}).status===0?(0,logger_1.printSuccess)(`Client updated to v${a}.`):(0,logger_1.printError)(`npm install failed \u2014 run \`npm i -g ${n.name}@latest\` manually.`)}async function executeCliUpdate(r,t){try{(0,logger_1.printProgress)("Resolving the payload...");const e=await(0,source_1.resolveInstallSource)({version:r,...t?{ref:t}:{},interactive:!1});e.origin!=="local"&&(0,logger_1.printInfo)(`Payload ${e.version} (${e.ref}) \u2014 ${e.origin} tree.`),(0,logger_1.printProgress)("Running the installation script...");const n=process.platform==="win32"?(0,exec_1.execPayload)("powershell",["-ExecutionPolicy","Bypass","-File",path.join(e.root,"install.ps1")]):(0,exec_1.execPayload)("bash",[path.join(e.root,"install.sh")]);return n.status!==0?((0,logger_1.printError)(n.error?`The installer could not start: ${n.error.message}`:"The installer exited non-zero."),!1):!0}catch(e){return e instanceof source_1.NoAccessError?(0,logger_1.printError)(e.message):(0,logger_1.printError)(`Failed to update CLI: ${e.message}`),!1}}function printReleaseNotes(r){console.log(""),(0,logger_1.printSection)("Release Notes");for(const t of r.slice(0,MAX_NOTES_SHOWN)){console.log(`
2
+ ${chalk_1.default.bold.cyan(`\u2501\u2501\u2501 v${(0,version_check_1.normalizeVersion)(t.tag_name)} \u2501\u2501\u2501`)}`);const e=(t.body||"").split(`
3
+ `);t.body?(console.log(chalk_1.default.dim(e.slice(0,MAX_NOTE_LINES).join(`
4
+ `))),e.length>MAX_NOTE_LINES&&(0,logger_1.printInfo)(`... (full notes: ${t.html_url})`)):(0,logger_1.printInfo)("(No release notes)"),console.log("")}r.length>MAX_NOTES_SHOWN&&(0,logger_1.printInfo)(`... and ${r.length-MAX_NOTES_SHOWN} more release(s)`)}async function runUpdate(r,t={}){const e=t.repoRoot??path.resolve(__dirname,"..","..",".."),n=t.confirm??p.confirm,o=r.includes("--yes")||r.includes("-y"),a=r.indexOf("--ref"),l=a!==-1?r[a+1]:void 0;if(a!==-1&&(!l||l.startsWith("--")))return(0,logger_1.printError)("--ref needs a value: agentkit update --ref <tag|branch|sha>"),1;const c=a!==-1?l:void 0,i=(0,source_1.newestTagInstalledTree)((0,agentkit_home_1.loadAgentkitHomeCore)())?.version??(0,version_check_1.getPayloadVersion)(e);if(!i)return(0,logger_1.printBanner)("CLI Update Manager"),(0,logger_1.printSection)("Checking CLI Version"),(0,logger_1.printError)("Could not determine current CLI version."),(0,logger_1.printInfo)("Please ensure Agentkit CLI is properly installed."),console.log(""),1;if(c)return(0,logger_1.printBanner)("CLI Update Manager"),(0,logger_1.printSection)("Updating CLI Tool"),(0,logger_1.printInfo)(`Installing ref ${c} over v${i}`),await executeCliUpdate(i,c)?((0,update_notifier_1.suppressUpdateNotice)(),console.log(""),(0,logger_1.printSuccess)(`Update completed from ref ${c}.`),console.log(""),0):(console.log(""),(0,logger_1.printError)("Update failed."),console.log(""),1);(0,logger_1.printBanner)("CLI Update Manager"),(0,logger_1.printSection)("Checking for Updates"),(0,logger_1.printInfo)(`Current version: v${i}`),await updateNpmClient(o,e,n),(0,logger_1.printProgress)("Fetching release info from GitHub...");let u;try{if(u=await(0,version_check_1.fetchReleases)(),u.length===0)throw new Error("No releases found")}catch(s){return(0,logger_1.printError)(`Failed to check for updates: ${s.message}`),(0,logger_1.printInfo)("Please check your internet connection and try again."),console.log(""),1}const f=u.filter(s=>!s.draft&&!s.prerelease);if(f.length===0)return(0,logger_1.printError)("No published releases found."),console.log(""),1;const m=[...f].sort((s,v)=>(0,version_check_1.compareVersions)(v.tag_name,s.tag_name)),g=m[0],d=(0,version_check_1.normalizeVersion)(g.tag_name);if((0,version_check_1.writeUpdateCache)({lastUpdateCheck:Date.now(),latestVersion:d}),(0,version_check_1.compareVersions)(i,d)>=0)return(0,logger_1.printSuccess)(`You are already on the latest version (v${i})`),console.log(""),0;const _=m.filter(s=>(0,version_check_1.compareVersions)(s.tag_name,i)>0);if(console.log(""),(0,logger_1.printSection)("Update Available"),(0,logger_1.printWarning)(`A new version is available: v${d}`),(0,logger_1.printInfo)(`Current version: v${i}`),(0,logger_1.printInfo)(`Versions behind: ${_.length}`),printReleaseNotes(_),(0,logger_1.printInfo)(`See ${g.html_url} for the full changelog`),console.log(""),!o){const s=await n({message:"Do you want to update the CLI tool now?"});if(p.isCancel(s)||!s)return console.log(""),(0,logger_1.printInfo)("Update cancelled."),(0,logger_1.printInfo)(`You can update manually later from: ${g.html_url}`),console.log(""),0}if((0,logger_1.printSection)("Updating CLI Tool"),!await executeCliUpdate(d))return console.log(""),(0,logger_1.printError)("Update failed. Please try updating manually."),console.log(""),1;(0,update_notifier_1.suppressUpdateNotice)(),console.log(""),(0,logger_1.printSection)("Verification");const h=(0,version_check_1.getPayloadVersion)(e);return h&&(0,version_check_1.compareVersions)(h,i)>0?(0,logger_1.printSuccess)(`CLI tool updated: v${i} \u2192 v${h}`):((0,logger_1.printSuccess)("Update completed."),(0,logger_1.printInfo)("Run 'agentkit -v' to confirm the installed version.")),console.log(""),0}
@@ -1,3 +1,3 @@
1
1
  "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),__importStar=this&&this.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},e(t)};return function(t){if(t&&t.__esModule)return t;var n={};if(t!=null)for(var r=e(t),i=0;i<r.length;i++)r[i]!=="default"&&__createBinding(n,t,r[i]);return __setModuleDefault(n,t),n}})(),__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.isEnvironmentSuppressed=isEnvironmentSuppressed,exports.renderNotice=renderNotice,exports.workerPath=workerPath,exports.suppressUpdateNotice=suppressUpdateNotice,exports.maybeNotifyUpdate=maybeNotifyUpdate;const child_process_1=require("child_process"),fs=__importStar(require("fs")),path=__importStar(require("path")),chalk_1=__importDefault(require("chalk")),version_check_1=require("./version-check");function defaultEnvironment(){return{isTTY:!!process.stderr.isTTY,env:process.env}}function isEnvironmentSuppressed(e){return e.isTTY?!!e.env.CI:!0}function renderNotice(e,t){return["",`${chalk_1.default.yellow("Update available")} ${chalk_1.default.dim(e)} ${chalk_1.default.dim("\u2192")} ${chalk_1.default.green(t)}`,`Run ${chalk_1.default.cyan("agentkit update")} to install it.`,""].join(`
2
- `)}function workerPath(){return path.join(__dirname,"..","update-check-worker.js")}let noticeSuppressed=!1;function suppressUpdateNotice(){noticeSuppressed=!0}function spawnBackgroundCheck(){try{const e=(0,child_process_1.spawn)(process.execPath,[workerPath()],{detached:!0,stdio:"ignore",windowsHide:!0});e.on("error",()=>{}),e.unref()}catch{}}function writeToStderr(e){try{fs.writeSync(2,`${e}
2
+ `)}function workerPath(){return path.join(__dirname,"..","gen","update-check-worker.js")}let noticeSuppressed=!1;function suppressUpdateNotice(){noticeSuppressed=!0}function spawnBackgroundCheck(){try{const e=(0,child_process_1.spawn)(process.execPath,[workerPath()],{detached:!0,stdio:"ignore",windowsHide:!0});e.on("error",()=>{}),e.unref()}catch{}}function writeToStderr(e){try{fs.writeSync(2,`${e}
3
3
  `)}catch{}}function maybeNotifyUpdate(e){noticeSuppressed=!1;const t=e.environment??defaultEnvironment();if(isEnvironmentSuppressed(t))return null;const n=(0,version_check_1.readUpdateCache)();if(n.autoUpdate===!1)return null;(0,version_check_1.isCacheStale)(n,e.now??Date.now())&&(e.spawnCheck??spawnBackgroundCheck)();const{currentVersion:r}=e;if(!r)return null;const i=e.onNotice??writeToStderr;return process.on("exit",()=>{if(noticeSuppressed)return;const s=(0,version_check_1.readUpdateCache)();s.latestVersion&&(0,version_check_1.compareVersions)(r,s.latestVersion)<0&&i(renderNotice(r,s.latestVersion))}),!n.latestVersion||(0,version_check_1.compareVersions)(r,n.latestVersion)>=0?null:renderNotice(r,n.latestVersion)}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env tsx
2
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(t,e,i,n){n===void 0&&(n=i);var r=Object.getOwnPropertyDescriptor(e,i);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,r)}):(function(t,e,i,n){n===void 0&&(n=i),t[n]=e[i]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),__importStar=this&&this.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(i){var n=[];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[n.length]=r);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var n=t(e),r=0;r<n.length;r++)n[r]!=="default"&&__createBinding(i,e,n[r]);return __setModuleDefault(i,e),i}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.assertOutsideRepo=assertOutsideRepo,exports.assertReleaseDestination=assertReleaseDestination,exports.findSecretShapes=findSecretShapes;const child_process_1=require("child_process"),fs=__importStar(require("fs")),os=__importStar(require("os")),path=__importStar(require("path")),yaml=__importStar(require("js-yaml")),hermes_distribution_1=require("./lib/kit-installers/hermes-distribution"),logger_1=require("./lib/logger"),skill_profiles_1=require("./lib/skill-profiles"),REPO_ROOT=path.resolve(__dirname,".."),FORBIDDEN_NAMES=[".env",".env.local","auth.json","state.db","state.db-wal","state.db-shm"],FORBIDDEN_DIRS=["memories","sessions","logs"],SECRET_SHAPES=[{name:"private key block",regex:/-----BEGIN (?:RSA |EC |OPENSSH |PGP |DSA )?PRIVATE KEY-----[\s\S]{0,120}?[A-Za-z0-9+/=]{40}/,whole:!0},{name:"OpenAI-style key",regex:/\bsk-(?:ant-)?[A-Za-z0-9_-]{24,}/},{name:"GitHub token",regex:/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{30,}|\bgithub_pat_[A-Za-z0-9_]{20,}/},{name:"AWS access key id",regex:/\bAKIA(?!IOSFODNN7EXAMPLE)[0-9A-Z]{16}\b/},{name:"Slack token",regex:/\bxox[baprs]-[A-Za-z0-9-]{10,}/},{name:"Google API key",regex:/\bAIza[0-9A-Za-z_-]{35}\b/},{name:"assigned opaque literal",regex:/(api[_-]?key|token|secret|password)["']?\s*[:=]\s*["'][A-Za-z0-9_\-.]{24,}["']/i},{name:"credentials embedded in a URL",regex:/https?:\/\/[^/\s:@]+:[^@\s/]+@/}],BINARY_EXTENSIONS=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".svgz",".avif",".heic",".pdf",".zip",".gz",".tgz",".bz2",".xz",".7z",".tar",".jar",".whl",".mp3",".mp4",".wav",".ogg",".webm",".mov",".avi",".flac",".m4a",".ttf",".otf",".woff",".woff2",".eot",".so",".dylib",".dll",".exe",".bin",".wasm",".node",".pyc",".class",".db",".sqlite",".sqlite3"]),MAX_SCAN_BYTES=2*1024*1024;function parseArgs(t){const e={},i=[];for(let n=0;n<t.length;n+=1){const r=t[n];if(r==="--")continue;if(!r.startsWith("--")){i.push(r);continue}const s=r.indexOf("=");if(s!==-1){e[r.slice(2,s)]=r.slice(s+1);continue}e[r.slice(2)]=t[n+1]??"",n+=1}if(i.length!==1)throw new Error("Usage: pnpm build:hermes-dist -- <outDir> [--version X] [--source URL]");return{outDir:path.resolve(i[0]),version:e.version,source:e.source}}function assertPrivateRemote(t){let e;try{e=(0,child_process_1.execFileSync)("git",["-C",t,"remote","get-url","origin"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{(0,logger_1.printInfo)("No git remote on the output directory yet \u2014 privacy check skipped.");return}const i=/[:/]([^/:]+\/[^/]+?)(?:\.git)?$/.exec(e)?.[1];if(!i){(0,logger_1.printWarning)(`Could not read an owner/repo out of ${e} \u2014 verify privacy by hand.`);return}let n;try{n=JSON.parse((0,child_process_1.execFileSync)("gh",["repo","view",i,"--json","isPrivate"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]})).isPrivate}catch{(0,logger_1.printWarning)(`Could not ask gh whether ${i} is private. Verify it by hand before pushing \u2014 this payload is meant for a private repo.`);return}if(n!==!0)throw new Error(`${i} is PUBLIC. This distribution is built for a private team repo; publishing it would hand the payload, and every path in it, to anyone.`);(0,logger_1.printSuccess)(`${i} is private`)}function assertOutsideRepo(t){const e=path.relative(REPO_ROOT,t);if(e===""||!e.startsWith("..")&&!path.isAbsolute(e))throw new Error(`${t} is inside this repository. The release repo is separate: \`hermes profile install\` requires distribution.yaml at the CLONE ROOT.`)}function assertReleaseDestination(t){if(!fs.existsSync(t))return;const e=fs.readdirSync(t).filter(i=>i!==".git");if(e.length!==0&&!e.includes("distribution.yaml"))throw new Error(`${t} is not empty and holds no distribution.yaml, so it is not a release repo \u2014 and this script empties its destination. Point it at a fresh clone of the release repo, or at an empty directory.`)}function walk(t,e,i=t){for(const n of fs.readdirSync(t,{withFileTypes:!0})){const r=path.join(t,n.name);e(r,path.relative(i,r)),n.isDirectory()&&walk(r,e,i)}}function assertNoUserData(t){const e=[];if(walk(t,(i,n)=>{const r=path.basename(n);FORBIDDEN_NAMES.includes(r)&&e.push(n),FORBIDDEN_DIRS.includes(r)&&fs.statSync(i).isDirectory()&&e.push(`${n}/`)}),e.length>0)throw new Error(`The built payload contains user data or credentials: ${e.join(", ")}. A released distribution is cloned by everyone on the team.`)}function findSecretShapes(t){const e=[];return walk(t,(i,n)=>{const r=fs.statSync(i);if(!r.isFile()||BINARY_EXTENSIONS.has(path.extname(i).toLowerCase())||r.size>MAX_SCAN_BYTES)return;const s=fs.readFileSync(i);if(s.includes(0))return;const a=s.toString("utf8"),c=a.split(`
2
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(t,e,i,n){n===void 0&&(n=i);var r=Object.getOwnPropertyDescriptor(e,i);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,r)}):(function(t,e,i,n){n===void 0&&(n=i),t[n]=e[i]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),__importStar=this&&this.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(i){var n=[];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[n.length]=r);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var n=t(e),r=0;r<n.length;r++)n[r]!=="default"&&__createBinding(i,e,n[r]);return __setModuleDefault(i,e),i}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.assertOutsideRepo=assertOutsideRepo,exports.assertReleaseDestination=assertReleaseDestination,exports.findSecretShapes=findSecretShapes;const child_process_1=require("child_process"),fs=__importStar(require("fs")),os=__importStar(require("os")),path=__importStar(require("path")),yaml=__importStar(require("js-yaml")),hermes_distribution_1=require("../lib/kit-installers/hermes-distribution"),logger_1=require("../lib/logger"),skill_profiles_1=require("../lib/skill-profiles"),REPO_ROOT=path.resolve(__dirname,"..",".."),FORBIDDEN_NAMES=[".env",".env.local","auth.json","state.db","state.db-wal","state.db-shm"],FORBIDDEN_DIRS=["memories","sessions","logs"],SECRET_SHAPES=[{name:"private key block",regex:/-----BEGIN (?:RSA |EC |OPENSSH |PGP |DSA )?PRIVATE KEY-----[\s\S]{0,120}?[A-Za-z0-9+/=]{40}/,whole:!0},{name:"OpenAI-style key",regex:/\bsk-(?:ant-)?[A-Za-z0-9_-]{24,}/},{name:"GitHub token",regex:/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{30,}|\bgithub_pat_[A-Za-z0-9_]{20,}/},{name:"AWS access key id",regex:/\bAKIA(?!IOSFODNN7EXAMPLE)[0-9A-Z]{16}\b/},{name:"Slack token",regex:/\bxox[baprs]-[A-Za-z0-9-]{10,}/},{name:"Google API key",regex:/\bAIza[0-9A-Za-z_-]{35}\b/},{name:"assigned opaque literal",regex:/(api[_-]?key|token|secret|password)["']?\s*[:=]\s*["'][A-Za-z0-9_\-.]{24,}["']/i},{name:"credentials embedded in a URL",regex:/https?:\/\/[^/\s:@]+:[^@\s/]+@/}],BINARY_EXTENSIONS=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".svgz",".avif",".heic",".pdf",".zip",".gz",".tgz",".bz2",".xz",".7z",".tar",".jar",".whl",".mp3",".mp4",".wav",".ogg",".webm",".mov",".avi",".flac",".m4a",".ttf",".otf",".woff",".woff2",".eot",".so",".dylib",".dll",".exe",".bin",".wasm",".node",".pyc",".class",".db",".sqlite",".sqlite3"]),MAX_SCAN_BYTES=2*1024*1024;function parseArgs(t){const e={},i=[];for(let n=0;n<t.length;n+=1){const r=t[n];if(r==="--")continue;if(!r.startsWith("--")){i.push(r);continue}const s=r.indexOf("=");if(s!==-1){e[r.slice(2,s)]=r.slice(s+1);continue}e[r.slice(2)]=t[n+1]??"",n+=1}if(i.length!==1)throw new Error("Usage: pnpm build:hermes-dist -- <outDir> [--version X] [--source URL]");return{outDir:path.resolve(i[0]),version:e.version,source:e.source}}function assertPrivateRemote(t){let e;try{e=(0,child_process_1.execFileSync)("git",["-C",t,"remote","get-url","origin"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{(0,logger_1.printInfo)("No git remote on the output directory yet \u2014 privacy check skipped.");return}const i=/[:/]([^/:]+\/[^/]+?)(?:\.git)?$/.exec(e)?.[1];if(!i){(0,logger_1.printWarning)(`Could not read an owner/repo out of ${e} \u2014 verify privacy by hand.`);return}let n;try{n=JSON.parse((0,child_process_1.execFileSync)("gh",["repo","view",i,"--json","isPrivate"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]})).isPrivate}catch{(0,logger_1.printWarning)(`Could not ask gh whether ${i} is private. Verify it by hand before pushing \u2014 this payload is meant for a private repo.`);return}if(n!==!0)throw new Error(`${i} is PUBLIC. This distribution is built for a private team repo; publishing it would hand the payload, and every path in it, to anyone.`);(0,logger_1.printSuccess)(`${i} is private`)}function assertOutsideRepo(t){const e=path.relative(REPO_ROOT,t);if(e===""||!e.startsWith("..")&&!path.isAbsolute(e))throw new Error(`${t} is inside this repository. The release repo is separate: \`hermes profile install\` requires distribution.yaml at the CLONE ROOT.`)}function assertReleaseDestination(t){if(!fs.existsSync(t))return;const e=fs.readdirSync(t).filter(i=>i!==".git");if(e.length!==0&&!e.includes("distribution.yaml"))throw new Error(`${t} is not empty and holds no distribution.yaml, so it is not a release repo \u2014 and this script empties its destination. Point it at a fresh clone of the release repo, or at an empty directory.`)}function walk(t,e,i=t){for(const n of fs.readdirSync(t,{withFileTypes:!0})){const r=path.join(t,n.name);e(r,path.relative(i,r)),n.isDirectory()&&walk(r,e,i)}}function assertNoUserData(t){const e=[];if(walk(t,(i,n)=>{const r=path.basename(n);FORBIDDEN_NAMES.includes(r)&&e.push(n),FORBIDDEN_DIRS.includes(r)&&fs.statSync(i).isDirectory()&&e.push(`${n}/`)}),e.length>0)throw new Error(`The built payload contains user data or credentials: ${e.join(", ")}. A released distribution is cloned by everyone on the team.`)}function findSecretShapes(t){const e=[];return walk(t,(i,n)=>{const r=fs.statSync(i);if(!r.isFile()||BINARY_EXTENSIONS.has(path.extname(i).toLowerCase())||r.size>MAX_SCAN_BYTES)return;const s=fs.readFileSync(i);if(s.includes(0))return;const a=s.toString("utf8"),c=a.split(`
3
3
  `);for(const o of SECRET_SHAPES){if(o.whole){o.regex.test(a)&&e.push(`${n} \u2014 ${o.name}`);continue}for(const[l,u]of c.entries())o.regex.test(u)&&e.push(`${n}:${l+1} \u2014 ${o.name}`)}}),e}function assertNoSecrets(t){const e=findSecretShapes(t);if(e.length>0)throw new Error(`Credential-shaped values in the built payload:
4
4
  ${e.join(`
5
5
  `)}
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(e,i,t,o){o===void 0&&(o=t);var r=Object.getOwnPropertyDescriptor(i,t);(!r||("get"in r?!i.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return i[t]}}),Object.defineProperty(e,o,r)}):(function(e,i,t,o){o===void 0&&(o=t),e[o]=i[t]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(e,i){Object.defineProperty(e,"default",{enumerable:!0,value:i})}):function(e,i){e.default=i}),__importStar=this&&this.__importStar||(function(){var e=function(i){return e=Object.getOwnPropertyNames||function(t){var o=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(o[o.length]=r);return o},e(i)};return function(i){if(i&&i.__esModule)return i;var t={};if(i!=null)for(var o=e(i),r=0;r<o.length;r++)o[r]!=="default"&&__createBinding(t,i,o[r]);return __setModuleDefault(t,i),t}})();Object.defineProperty(exports,"__esModule",{value:!0});const fs=__importStar(require("fs")),path=__importStar(require("path")),readline=__importStar(require("readline")),os=__importStar(require("os")),install_registry_1=require("./lib/install-registry"),logger_1=require("./lib/logger"),ui_1=require("./lib/ui"),codex_agents_1=require("./lib/codex-agents"),kimi_hooks_toml_1=require("./lib/kit-installers/kimi-hooks-toml"),kimi_1=require("./lib/kit-installers/kimi"),grok_config_toml_1=require("./lib/kit-installers/grok-config-toml"),grok_session_toml_1=require("./lib/kit-installers/grok-session-toml"),hermes_hooks_yaml_1=require("./lib/kit-installers/hermes-hooks-yaml"),openclaw_config_json_1=require("./lib/kit-installers/openclaw-config-json"),omp_config_yml_1=require("./lib/kit-installers/omp-config-yml"),omp_home_1=require("./lib/omp-home"),pi_home_1=require("./lib/pi-home"),devin_hooks_1=require("./lib/kit-installers/devin-hooks"),devin_home_1=require("./lib/kit-installers/devin-home"),dropped_mcp_servers_1=require("./lib/dropped-mcp-servers"),retired_skills_1=require("./lib/retired-skills"),devin_rules_1=require("./lib/kit-installers/devin-rules"),devin_agents_1=require("./lib/kit-installers/devin-agents"),devin_hooks_2=require("./lib/kit-installers/devin-hooks"),commands_to_skills_1=require("./lib/kit-installers/commands-to-skills"),file_operations_1=require("./lib/file-operations"),package_root_1=require("./lib/package-root"),install_manifest_1=require("./lib/install-manifest"),kit_remover_1=require("./lib/kit-remover"),openclaw_home_1=require("./lib/openclaw-home"),hermes_clear_targets_1=require("./lib/hermes-clear-targets"),global_clear_targets_1=require("./lib/global-clear-targets"),hermes_home_context_1=require("./lib/kit-installers/hermes-home-context"),colors={reset:"\x1B[0m",yellow:"\x1B[33m",cyan:"\x1B[36m"},cwd=process.cwd(),homeDir=os.homedir(),projectPlatformDefs=[{key:"claude",name:"Claude Code",dirPath:path.join(cwd,".claude"),filePaths:[path.join(cwd,"CLAUDE.md")]},{key:"cursor",name:"Cursor AI",dirPath:path.join(cwd,".cursor"),filePaths:[path.join(cwd,"AGENTS.md"),path.join(cwd,".cursorrules"),path.join(cwd,"CLAUDE.md")]},{key:"augment",name:"Augment Code",dirPath:path.join(cwd,".claude"),filePaths:[path.join(cwd,"CLAUDE.md")]},{key:"antigravity",name:"Antigravity",dirPath:path.join(cwd,".agents"),filePaths:[path.join(cwd,"GEMINI.md")]},{key:"opencode",name:"OpenCode",dirPath:path.join(cwd,".opencode"),filePaths:[]},{key:"codex",name:"OpenAI Codex",dirPath:path.join(cwd,".codex"),filePaths:[]},{key:"kimi",name:"Kimi Code",dirPath:path.join(cwd,".kimi-code"),filePaths:[]},{key:"hermes",name:"Hermes Agent",dirPath:path.join(cwd,".hermes-kit"),filePaths:[],group:(0,ui_1.kitGroup)("hermes")},{key:"openclaw",name:"OpenClaw",dirPath:path.join(cwd,".openclaw-kit"),filePaths:[],group:(0,ui_1.kitGroup)("openclaw")},{key:"grok",name:"Grok Build",dirPath:path.join(cwd,".grok"),filePaths:[]},{key:"pi",name:"Pi",dirPath:path.join(cwd,".pi","agentkit"),filePaths:[]},{key:"devin",name:"Devin CLI",dirPath:path.join(cwd,".devin"),filePaths:[],requiresMarker:path.join(cwd,".devin",".agentkit.json"),ownedPaths:[...(0,devin_rules_1.devinOwnedRuleNames)(path.join(cwd,".devin","rules")).map(e=>path.join(cwd,".devin","rules",e)),...(0,devin_agents_1.devinOwnedAgentNames)(path.join(cwd,".devin","agents")).map(e=>path.join(cwd,".devin","agents",e)),...(0,file_operations_1.shippedSkillEntries)((0,package_root_1.packageRoot)()).map(e=>path.join(cwd,".devin","skills",e.name)),...(0,commands_to_skills_1.commandSkillNames)(path.join((0,package_root_1.packageRoot)(),"command")).map(e=>path.join(cwd,".devin","skills",e)),...(0,retired_skills_1.retiredSkillNames)().map(e=>path.join(cwd,".devin","skills",e)),path.join(cwd,".devin","scripts"),...(0,devin_hooks_2.devinHookFileNames)().map(e=>path.join(cwd,".devin",e)),path.join(cwd,".devin","schemas"),path.join(cwd,".devin",".agentkit.json"),path.join(cwd,".devin",".agentkitignore"),path.join(cwd,".devin",install_manifest_1.MANIFEST_FILENAME)]}],globalPlatformDefs=[...(0,global_clear_targets_1.globalClearTargets)().map(e=>({...e,filePaths:[]})),...(0,hermes_clear_targets_1.hermesProfileClearTargets)().map(e=>({...e,filePaths:[],group:(0,ui_1.kitGroup)("hermes")}))],sharedDirs=["docs","plans"],MAX_LISTED_PATHS=6;function print(e,i="reset"){console.log(`${colors[i]}${e}${colors.reset}`)}function isProjectDir(e){const i=fs.existsSync(path.join(e,"package.json")),t=fs.existsSync(path.join(e,".git"));return i||t}function parseScopeFromArgs(){const e=process.argv.slice(2);return e.includes("--global")||e.includes("-g")?"global":e.includes("--project")||e.includes("-p")?"project":null}async function askScope(){const e=readline.createInterface({input:process.stdin,output:process.stdout});return console.log(""),(0,logger_1.printSection)("Clear Scope"),console.log(" 1) Current project"),console.log(" 2) Global (user machine)"),console.log(""),new Promise(i=>{e.question("Select scope [1-2] (default: 1): ",t=>{e.close(),i(t.trim()==="2"?"global":"project")})})}function detectInstalledPlatforms(e){return(e==="global"?globalPlatformDefs:projectPlatformDefs).map(t=>{const o=!t.requiresMarker||fs.existsSync(t.requiresMarker),r=t.ownedPaths?o&&t.ownedPaths.some(g=>fs.existsSync(g)):fs.existsSync(t.dirPath),u=t.filePaths.some(g=>fs.existsSync(g));return{...t,hasDir:r,hasFiles:u}}).filter(t=>t.hasDir||t.hasFiles)}function detectSharedDirs(){return sharedDirs.filter(e=>fs.existsSync(path.join(cwd,e)))}function removeDir(e){if(!fs.existsSync(e))return!1;try{return fs.rmSync(e,{recursive:!0,force:!0}),!0}catch(i){return(0,logger_1.printError)(`Failed to remove ${e}: ${i.message}`),!1}}function removeFile(e){if(!fs.existsSync(e))return!1;try{return fs.unlinkSync(e),!0}catch{return!1}}function cleanupGitignore(e){const i=path.join(cwd,".gitignore");if(!fs.existsSync(i))return!1;const t=fs.readFileSync(i,"utf-8").split(`
3
- `),o=new Set;e.forEach(g=>{const d=g.trim();o.add(d),o.add(d.endsWith("/")?d.slice(0,-1):`${d}/`)});let r=0;const u=t.filter(g=>{const d=g.trim();if(d===""||d.startsWith("#"))return!0;const m=d.endsWith("/")?d.slice(0,-1):d;for(const h of o){const n=h.endsWith("/")?h.slice(0,-1):h;if(m===n)return r++,!1}return!0});return fs.writeFileSync(i,`${u.join(`
4
- `).replace(/\n+$/,"")}
5
- `),r>0}async function askConfirmation(e){const i=readline.createInterface({input:process.stdin,output:process.stdout});return new Promise(t=>{i.question(e,o=>{i.close();const r=o.trim().toLowerCase();t(r==="y"||r==="yes")})})}function removeAgentkitAgentsBlock(e,i="AGENTS.md"){const t=path.join(e,i);if(!fs.existsSync(t))return!1;const o=fs.readFileSync(t,"utf-8");if(!(0,codex_agents_1.hasAikitCodexBlock)(o))return!1;const r=(0,codex_agents_1.stripAikitCodexBlock)(o);return r.removedWholeFile?removeFile(t)?((0,logger_1.printSuccess)(`Removed ${t} \u2014 it held nothing but the Agentkit block`),!0):!1:r.removed?(fs.writeFileSync(t,r.content),(0,logger_1.printSuccess)(`Removed the Agentkit block from ${t}`),!0):!1}function displayItems(e,i){const t=[];if(e.hasDir&&e.ownedPaths){const o=e.ownedPaths.filter(u=>fs.existsSync(u)),r=o.slice(0,MAX_LISTED_PATHS).map(u=>path.relative(e.dirPath,u));o.length>r.length&&r.push(`+${o.length-r.length} more`),t.push(`${e.dirPath}/{${r.join(", ")}}`)}else e.hasDir&&t.push(i==="global"?e.dirPath:`${path.basename(e.dirPath)}/`);if(e.hasFiles&&t.push(...e.filePaths.map(o=>path.basename(o))),i==="project"&&e.key==="codex"&&fs.existsSync(path.join(cwd,".agents"))&&t.push(".agents/"),i==="project"&&(e.key==="codex"||e.key==="kimi"||e.key==="grok"||e.key==="devin")&&fs.existsSync(path.join(cwd,"AGENTS.md"))){const o=fs.readFileSync(path.join(cwd,"AGENTS.md"),"utf-8");(0,codex_agents_1.hasAikitCodexBlock)(o)&&t.push("AGENTS.md")}if(e.key==="pi"||e.key==="pi-global"){const o=e.key==="pi"?path.join(cwd,"AGENTS.md"):path.join(e.dirPath,"AGENTS.md");if(fs.existsSync(o))try{(0,codex_agents_1.hasAikitCodexBlock)(fs.readFileSync(o,"utf-8"))&&t.push(path.relative(cwd,o))}catch{}}return t.join(", ")}function printHelp(){console.log(`
6
- Agentkit Clear
7
- Remove Agentkit installations from current project or global user directories
8
-
9
- Usage:
10
- agentkit clear [options]
11
-
12
- Options:
13
- --project, -p Remove Agentkit from the current project
14
- --global, -g Remove Agentkit from global user directories
15
- --help, -h Show this help message
16
-
17
- Examples:
18
- agentkit clear # Interactive removal picker
19
- agentkit clear --project # Clear project-scoped files
20
- agentkit clear --global # Clear globally-installed platforms
21
- `)}async function main(){const e=process.argv.slice(2);if(e.includes("--help")||e.includes("-h")||e.includes("help")){printHelp();return}(0,logger_1.printSection)("Agentkit Clear - Remove Installations");let i=parseScopeFromArgs();i||(!isProjectDir(cwd)&&cwd===homeDir?i="global":i=await askScope()),(0,logger_1.printInfo)(`Scanning for Agentkit installations (${i})...`);const t=detectInstalledPlatforms(i),o=i==="project"?detectSharedDirs():[];if(t.length===0&&o.length===0){console.log(""),(0,logger_1.printInfo)(`No Agentkit installations found in ${i==="global"?"global scope":"this project"}.`),console.log("");return}if(console.log(""),(0,logger_1.printWarning)("Found the following Agentkit installations:"),console.log(""),i==="project"&&o.length>0){print("Shared Directories:","yellow");for(const n of o)print(` \u2022 ${n}/`,"cyan");console.log("")}(0,logger_1.printWarning)("WARNING: This action cannot be undone!"),console.log("");let r=[];if(t.length>0){const n=await(0,ui_1.selectTargetsToRemove)(t.map(s=>({value:s.key,label:s.name,group:s.group??"coding"})));if(n===null){console.log(""),(0,logger_1.printInfo)("Operation cancelled. No files were removed."),console.log("");return}r=t.filter(s=>n.includes(s.key))}if(r.length===0&&o.length===0){console.log(""),(0,logger_1.printInfo)("Nothing selected \u2014 no files were removed."),console.log("");return}if(r.length>0){console.log("");for(const s of r)print(` \u2022 ${s.name}: ${displayItems(s,i)}`,"cyan");if(console.log(""),!await askConfirmation(`Remove ${r.length} selected installation${r.length===1?"":"s"}? (y/n): `)){console.log(""),(0,logger_1.printInfo)("Operation cancelled. No files were removed."),console.log("");return}}const u=n=>(0,hermes_clear_targets_1.isHermesProfileKey)(n.key),g=r.filter(u).length,d=g>0&&g===t.filter(u).length;console.log(""),(0,logger_1.printSection)("Removing Agentkit Installations");const m=[];let h=0;for(const n of r){let s=!1;if(n.ownedPaths)for(const l of n.ownedPaths)fs.existsSync(l)&&removeDir(l)&&((0,logger_1.printSuccess)(`Removed ${l}`),s=!0);else n.hasDir&&removeDir(n.dirPath)&&((0,logger_1.printSuccess)(`Removed ${i==="global"?n.dirPath:`${path.basename(n.dirPath)}/`}`),s=!0,i==="project"&&m.push(`${path.basename(n.dirPath)}/`));if(i==="project"&&n.key==="codex"){const l=path.join(cwd,".agents");fs.existsSync(l)&&removeDir(l)&&((0,logger_1.printSuccess)("Removed .agents/"),s=!0,m.push(".agents/"));const c=path.join(cwd,"AGENTS.md");if(fs.existsSync(c)){const a=fs.readFileSync(c,"utf-8");if((0,codex_agents_1.hasAikitCodexBlock)(a)){const f=(0,codex_agents_1.stripAikitCodexBlock)(a);f.removedWholeFile?removeFile(c)&&((0,logger_1.printSuccess)("Removed AGENTS.md"),s=!0):f.removed&&(fs.writeFileSync(c,f.content),(0,logger_1.printSuccess)("Removed Agentkit Codex block from AGENTS.md"),s=!0)}}}if(n.key==="grok"||n.key==="grok-global"){i==="project"&&removeAgentkitAgentsBlock(cwd)&&(s=!0);const l=path.join(i==="global"?n.dirPath:path.join(cwd,".grok"),"config.toml");(0,grok_config_toml_1.removeGrokMcpServers)(l)&&((0,logger_1.printSuccess)(`Removed the Agentkit MCP block from ${l}`),s=!0),(0,grok_session_toml_1.removeGrokSessionDefaults)(l)&&((0,logger_1.printSuccess)(`Removed the Agentkit session block from ${l}`),s=!0)}if((n.key==="kimi"||n.key==="kimi-global")&&(i==="project"&&removeAgentkitAgentsBlock(cwd)&&(s=!0),(0,kimi_hooks_toml_1.removeKimiHooks)((0,kimi_1.resolveKimiHomeConfig)())&&((0,logger_1.printSuccess)("Removed Agentkit hooks from the Kimi user config"),s=!0)),n.key==="devin"||n.key==="devin-global"){i==="project"&&removeAgentkitAgentsBlock(cwd)&&(s=!0);const l=path.join(i==="global"?n.dirPath:path.join(cwd,".devin"),i==="global"?"config.json":"hooks.v1.json");if((0,devin_hooks_1.removeDevinHooks)(l,i==="global"?"hooksKey":"whole")&&((0,logger_1.printSuccess)(`Removed Agentkit hook handlers from ${l}`),s=!0),i==="global"){const a=path.join((0,devin_home_1.resolveDevinHomeDir)(),"rules");let f=0;for(const p of(0,devin_rules_1.devinOwnedRuleNames)(a))removeFile(path.join(a,p))&&(f+=1);f>0&&((0,logger_1.printSuccess)(`Removed ${f} rule(s) from ~/.devin/rules`),s=!0)}const c=path.join(i==="global"?n.dirPath:path.join(cwd,".devin"),"mcp_config.json");if(fs.existsSync(c)){const{remaining:a}=(0,dropped_mcp_servers_1.removeAgentkitMcpServers)(c);a===0?(removeFile(c),(0,logger_1.printSuccess)(`Removed ${c}`)):a===null?(0,logger_1.printWarning)(`Kept ${c} \u2014 it could not be read as an mcpServers map`):(0,logger_1.printWarning)(`Kept ${c} \u2014 it still holds ${a} of your own server(s)`),s=!0}}if(n.key==="hermes"&&removeAgentkitAgentsBlock(cwd)&&(s=!0),n.key==="openclaw-global"){const l=(0,openclaw_home_1.openClawWorkspaceDir)(n.dirPath);removeAgentkitAgentsBlock(l)&&(s=!0);const c=(0,openclaw_config_json_1.unregisterOpenClawKit)((0,openclaw_home_1.openClawConfigPath)(n.dirPath),{skills:path.join(n.dirPath,openclaw_home_1.OPENCLAW_SKILLS_SUBDIR),plugin:path.join(n.dirPath,openclaw_home_1.OPENCLAW_PLUGIN_SUBDIR),legacyHooks:path.join(n.dirPath,openclaw_home_1.OPENCLAW_HOOKS_SUBDIR)});for(const a of c.warnings)(0,logger_1.printWarning)(a);c.removed.length>0&&c.written?((0,logger_1.printSuccess)(`Unregistered ${c.removed.length} directories from openclaw.json`),s=!0):c.removed.length>0&&(0,logger_1.printWarning)(`Could not update ${(0,openclaw_home_1.openClawConfigPath)(n.dirPath)} \u2014 it still registers ${c.removed.length} directories this removal deleted. Edit it by hand, or OpenClaw will scan paths that are no longer there.`)}if(n.key==="omp-global"){removeAgentkitAgentsBlock(n.dirPath)&&(s=!0),removeAgentkitAgentsBlock(n.dirPath,"RULES.md")&&(s=!0);const l=(0,omp_config_yml_1.resolveOmpConfigFile)(n.dirPath),c=(0,omp_config_yml_1.removeOmpSkillsDir)(l,path.join(n.dirPath,omp_home_1.OMP_SKILLS_SUBDIR));for(const a of c.warnings)(0,logger_1.printWarning)(a);c.added.length>0&&c.written?((0,logger_1.printSuccess)(`Unregistered the Agentkit skills directory from ${l}`),s=!0):!c.written&&fs.existsSync(l)&&(0,logger_1.printWarning)(`Could not update ${l} \u2014 it may still register the skills directory this removal deleted. Edit it by hand, or omp will scan a path that is no longer there.`);try{const a=path.join(n.dirPath,omp_home_1.OMP_KIT_SUBDIR);fs.readdirSync(a).length===0&&fs.rmdirSync(a)}catch{}}if((0,hermes_clear_targets_1.isHermesProfileKey)(n.key)){const l=path.join(n.dirPath,"config.yaml");fs.existsSync(l)&&(0,hermes_hooks_yaml_1.removeHermesHooks)(l)&&((0,logger_1.printSuccess)(`Removed Agentkit hooks from ${n.name}'s config`),s=!0),fs.existsSync(l)&&(0,hermes_hooks_yaml_1.removeHermesPlugins)(l)&&((0,logger_1.printSuccess)(`Removed Agentkit plugin registration from ${n.name}'s config`),s=!0),d&&(0,hermes_home_context_1.removeHermesHomeContext)(homeDir)&&((0,logger_1.printSuccess)(`Removed ${hermes_home_context_1.HERMES_HOME_CONTEXT_FILE} from ${homeDir}`),s=!0)}if(n.key==="pi"||n.key==="pi-global"){const l=n.key==="pi-global",c=l?n.dirPath:path.dirname(n.dirPath),a=l?path.join(c,"AGENTS.md"):path.join(cwd,"AGENTS.md");if((0,kit_remover_1.removePiExtras)(c,a)&&(s=!0),l)try{const f=path.join(c,pi_home_1.PI_KIT_SUBDIR);fs.readdirSync(f).length===0&&fs.rmdirSync(f)}catch{}}for(const l of n.filePaths)removeFile(l)&&((0,logger_1.printSuccess)(`Removed ${path.basename(l)}`),s=!0,i==="project"&&m.push(path.basename(l)));s&&h++}if(i==="project"&&o.length>0)if(console.log(""),(0,logger_1.printWarning)("Shared directories (docs/, plans/) may contain your content."),await askConfirmation("Do you want to remove shared directories too? (y/n): "))for(const s of o){const l=path.join(cwd,s);removeDir(l)&&((0,logger_1.printSuccess)(`Removed ${s}/`),m.push(`${s}/`))}else(0,logger_1.printInfo)("Shared directories preserved.");i==="project"&&(console.log(""),(0,logger_1.printInfo)("Cleaning up .gitignore..."),cleanupGitignore(m)?(0,logger_1.printSuccess)(".gitignore cleaned"):(0,logger_1.printInfo)(".gitignore already clean"));try{(0,install_registry_1.pruneRegistry)()}catch{}console.log(""),(0,logger_1.printSection)("Removal Complete"),(0,logger_1.printSuccess)(`Removed ${h} Agentkit platform(s)`),console.log(""),(0,logger_1.printInfo)(`Agentkit ${i} scope is now clean.`),console.log("")}main().catch(e=>{(0,logger_1.printError)(`Error: ${e.message}`),process.exit(1)});
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),__importStar=this&&this.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var r=t(e),o=0;o<r.length;o++)r[o]!=="default"&&__createBinding(n,e,r[o]);return __setModuleDefault(n,e),n}})();Object.defineProperty(exports,"__esModule",{value:!0});const fs=__importStar(require("fs")),path=__importStar(require("path")),agentkit_home_1=require("./lib/agentkit-home"),logger_1=require("./lib/logger"),open_browser_1=require("./lib/open-browser"),auth_token_1=require("./lib/server/auth-token"),bundle_info_1=require("./lib/server/bundle-info"),http_server_1=require("./lib/server/http-server"),instance_lock_1=require("./lib/server/instance-lock"),repoRoot=path.dirname(__dirname);function parseFlags(t){const e=t.indexOf("--port"),n=t.indexOf("--token-file"),r=e>=0?Number(t[e+1]):0;return{port:Number.isInteger(r)&&r>=0&&r<=65535?r:0,open:!t.includes("--no-open"),tokenFile:n>=0?t[n+1]??null:null}}function resolveServeRoot(){const t=(0,bundle_info_1.bundleRoot)(repoRoot);return fs.existsSync(path.join(t,"index.html"))||((0,logger_1.printError)("The dashboard UI is missing. Run: pnpm build:dashboard"),process.exit(1)),t}function printHelp(){console.log(`
3
- Agentkit Dashboard
4
- Open the local observability dashboard in your browser
5
-
6
- Usage:
7
- agentkit dashboard [options]
8
-
9
- Options:
10
- --port <number> Bind to a specific port (default: auto-assigned / 4321)
11
- --no-open Do not automatically open the dashboard in browser
12
- --token-file <path> Write authentication token to a specific file
13
- --help, -h Show this help message
14
-
15
- Examples:
16
- agentkit dashboard # Start server and open dashboard in browser
17
- agentkit dashboard --port 3000 # Use custom port 3000
18
- agentkit dashboard --no-open # Start server without launching browser
19
- `)}async function main(){const t=process.argv.slice(2);if(t.includes("--help")||t.includes("-h")||t.includes("help")){printHelp();return}const e=parseFlags(t);(0,agentkit_home_1.loadAgentkitHomeCore)().ensureHome();const n=(0,instance_lock_1.readLiveLock)();n&&((0,logger_1.printInfo)(`A dashboard is already running: http://127.0.0.1:${n.port}/`),(0,logger_1.printInfo)("Stop it with Ctrl+C in its terminal, then start a new one."),process.exit(0));const r=process.env.AGENTKIT_DASHBOARD_TOKEN||(0,auth_token_1.generateToken)();let o;try{o=await(0,http_server_1.startServer)({serveRoot:resolveServeRoot(),port:e.port,context:{repoRoot,token:r,startedAt:new Date().toISOString(),bundleGitSha:(0,bundle_info_1.readBundleGitSha)(repoRoot)}})}catch(i){i.code==="EADDRINUSE"?(0,logger_1.printError)(`port ${e.port} is in use \u2014 omit --port to pick a free one`):(0,logger_1.printError)(`Could not start the dashboard: ${i.message}`),process.exit(1)}if((0,instance_lock_1.writeLock)(o.port),e.tokenFile)try{fs.rmSync(e.tokenFile,{force:!0}),fs.writeFileSync(e.tokenFile,r,{mode:384})}catch(i){(0,logger_1.printError)(`Could not write the token file: ${i.message}`)}const s=`http://127.0.0.1:${o.port}/#t=${r}`;(0,logger_1.printSuccess)(`Dashboard: ${s}`),(0,logger_1.printInfo)("Press Ctrl+C to stop");for(const i of["SIGINT","SIGTERM"])process.on(i,()=>{if(e.tokenFile)try{fs.rmSync(e.tokenFile,{force:!0})}catch{}o.shutdown()});process.on("exit",instance_lock_1.removeLock),e.open&&(0,open_browser_1.openBrowser)(s)}main().catch(t=>{(0,logger_1.printError)(`Error: ${t.message}`),process.exit(1)});