natureco-cli 5.18.3 → 5.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +1 -1
  3. package/skills/a-b-testing/SKILL.md +34 -0
  4. package/skills/accessibility-audit/SKILL.md +34 -0
  5. package/skills/agent-memory/SKILL.md +34 -0
  6. package/skills/agent-orchestration/SKILL.md +34 -0
  7. package/skills/airunway-aks-setup/SKILL.md +73 -0
  8. package/skills/algorithmic-art/SKILL.md +405 -0
  9. package/skills/analytics-setup/SKILL.md +34 -0
  10. package/skills/api-design/SKILL.md +34 -0
  11. package/skills/api-versioning/SKILL.md +34 -0
  12. package/skills/appinsights-instrumentation/SKILL.md +76 -0
  13. package/skills/audio-transcription/SKILL.md +34 -0
  14. package/skills/authentication-patterns/SKILL.md +34 -0
  15. package/skills/authorization-rbac/SKILL.md +34 -0
  16. package/skills/azure-ai/SKILL.md +71 -0
  17. package/skills/azure-aigateway/SKILL.md +129 -0
  18. package/skills/azure-cloud-migrate/SKILL.md +52 -0
  19. package/skills/azure-compliance/SKILL.md +108 -0
  20. package/skills/azure-compute/SKILL.md +46 -0
  21. package/skills/azure-cost/SKILL.md +45 -0
  22. package/skills/azure-deploy/SKILL.md +97 -0
  23. package/skills/azure-diagnostics/SKILL.md +151 -0
  24. package/skills/azure-enterprise-infra-planner/SKILL.md +54 -0
  25. package/skills/azure-hosted-copilot-sdk/SKILL.md +89 -0
  26. package/skills/azure-kubernetes/SKILL.md +153 -0
  27. package/skills/azure-kusto/SKILL.md +231 -0
  28. package/skills/azure-messaging/SKILL.md +57 -0
  29. package/skills/azure-prepare/SKILL.md +165 -0
  30. package/skills/azure-quotas/SKILL.md +276 -0
  31. package/skills/azure-rbac/SKILL.md +17 -0
  32. package/skills/azure-reliability/SKILL.md +387 -0
  33. package/skills/azure-resource-lookup/SKILL.md +108 -0
  34. package/skills/azure-resource-visualizer/SKILL.md +183 -0
  35. package/skills/azure-storage/SKILL.md +100 -0
  36. package/skills/azure-upgrade/SKILL.md +91 -0
  37. package/skills/azure-validate/SKILL.md +72 -0
  38. package/skills/backup-strategy/SKILL.md +34 -0
  39. package/skills/bash-scripting/SKILL.md +34 -0
  40. package/skills/batch-api-calls/SKILL.md +34 -0
  41. package/skills/batch-processing/SKILL.md +34 -0
  42. package/skills/brainstorming/SKILL.md +159 -0
  43. package/skills/brand-guidelines/SKILL.md +73 -0
  44. package/skills/brandkit/SKILL.md +798 -0
  45. package/skills/brutalist-skill/SKILL.md +92 -0
  46. package/skills/bulk-file-operations/SKILL.md +34 -0
  47. package/skills/cache-responses/SKILL.md +34 -0
  48. package/skills/caching-strategy/SKILL.md +34 -0
  49. package/skills/calendar-optimization/SKILL.md +34 -0
  50. package/skills/canvas-design/SKILL.md +130 -0
  51. package/skills/cavecrew/SKILL.md +82 -0
  52. package/skills/caveman-commit/SKILL.md +65 -0
  53. package/skills/caveman-help/SKILL.md +63 -0
  54. package/skills/caveman-review/SKILL.md +55 -0
  55. package/skills/caveman-stats/SKILL.md +10 -0
  56. package/skills/changelog-generation/SKILL.md +34 -0
  57. package/skills/chat-bot-design/SKILL.md +34 -0
  58. package/skills/chunking-strategy/SKILL.md +34 -0
  59. package/skills/ci-cd-pipeline/SKILL.md +34 -0
  60. package/skills/classification-pipeline/SKILL.md +34 -0
  61. package/skills/claude-api/SKILL.md +356 -0
  62. package/skills/clipboard-master/SKILL.md +34 -0
  63. package/skills/code-explanation/SKILL.md +34 -0
  64. package/skills/code-generation/SKILL.md +34 -0
  65. package/skills/code-migration/SKILL.md +34 -0
  66. package/skills/code-review-checklist/SKILL.md +34 -0
  67. package/skills/composition-patterns/SKILL.md +89 -0
  68. package/skills/contact-management/SKILL.md +34 -0
  69. package/skills/content-generation/SKILL.md +34 -0
  70. package/skills/context-pruning/SKILL.md +34 -0
  71. package/skills/context-window-management/SKILL.md +34 -0
  72. package/skills/continuous-improvement/SKILL.md +34 -0
  73. package/skills/cron-scheduling/SKILL.md +34 -0
  74. package/skills/cross-platform-compat/SKILL.md +34 -0
  75. package/skills/csv-processing/SKILL.md +34 -0
  76. package/skills/daily-journal/SKILL.md +34 -0
  77. package/skills/data-analysis/SKILL.md +34 -0
  78. package/skills/data-backup/SKILL.md +34 -0
  79. package/skills/data-cleaning/SKILL.md +34 -0
  80. package/skills/data-extraction/SKILL.md +34 -0
  81. package/skills/data-validation/SKILL.md +34 -0
  82. package/skills/database-migrations/SKILL.md +34 -0
  83. package/skills/database-schema-design/SKILL.md +34 -0
  84. package/skills/decision-mapping/SKILL.md +84 -0
  85. package/skills/decision-matrix/SKILL.md +34 -0
  86. package/skills/dependency-management/SKILL.md +34 -0
  87. package/skills/deploy-to-vercel/SKILL.md +296 -0
  88. package/skills/design-an-interface/SKILL.md +94 -0
  89. package/skills/design-doc-mermaid/SKILL.md +498 -0
  90. package/skills/dev-environment-setup/SKILL.md +34 -0
  91. package/skills/develop-userscripts/SKILL.md +84 -0
  92. package/skills/distraction-blocker/SKILL.md +34 -0
  93. package/skills/doc-coauthoring/SKILL.md +375 -0
  94. package/skills/docker-optimization/SKILL.md +34 -0
  95. package/skills/document-template/SKILL.md +34 -0
  96. package/skills/documentation/SKILL.md +109 -0
  97. package/skills/documentation-gen/SKILL.md +34 -0
  98. package/skills/docx/SKILL.md +590 -0
  99. package/skills/edit-article/SKILL.md +15 -0
  100. package/skills/efficient-formatting/SKILL.md +34 -0
  101. package/skills/email-management/SKILL.md +34 -0
  102. package/skills/email-service/SKILL.md +34 -0
  103. package/skills/embedding-generation/SKILL.md +34 -0
  104. package/skills/entity-extraction/SKILL.md +34 -0
  105. package/skills/entra-agent-id/SKILL.md +356 -0
  106. package/skills/entra-app-registration/SKILL.md +191 -0
  107. package/skills/environment-config/SKILL.md +34 -0
  108. package/skills/error-handling/SKILL.md +34 -0
  109. package/skills/estimation-techniques/SKILL.md +34 -0
  110. package/skills/event-driven-architecture/SKILL.md +34 -0
  111. package/skills/excel-automation/SKILL.md +34 -0
  112. package/skills/execution-monitoring/SKILL.md +34 -0
  113. package/skills/expense-tracking/SKILL.md +34 -0
  114. package/skills/faceless-explainer/SKILL.md +202 -0
  115. package/skills/fastify/SKILL.md +75 -0
  116. package/skills/feature-engineering/SKILL.md +34 -0
  117. package/skills/feature-flags/SKILL.md +34 -0
  118. package/skills/file-conversion/SKILL.md +34 -0
  119. package/skills/file-upload-handling/SKILL.md +34 -0
  120. package/skills/fine-tuning-prep/SKILL.md +34 -0
  121. package/skills/focus-mode/SKILL.md +34 -0
  122. package/skills/form-validation/SKILL.md +34 -0
  123. package/skills/function-calling/SKILL.md +34 -0
  124. package/skills/general-video/SKILL.md +143 -0
  125. package/skills/git-guardrails-claude-code/SKILL.md +95 -0
  126. package/skills/git-workflow/SKILL.md +34 -0
  127. package/skills/github-actions-docs/SKILL.md +98 -0
  128. package/skills/goal-setting/SKILL.md +34 -0
  129. package/skills/gpt-tasteskill/SKILL.md +74 -0
  130. package/skills/graphql-design/SKILL.md +34 -0
  131. package/skills/grill-me/SKILL.md +7 -0
  132. package/skills/grilling/SKILL.md +10 -0
  133. package/skills/habit-tracker/SKILL.md +34 -0
  134. package/skills/hallucination-detection/SKILL.md +34 -0
  135. package/skills/handoff/SKILL.md +16 -0
  136. package/skills/hyperframes/SKILL.md +152 -0
  137. package/skills/hyperframes-animation/SKILL.md +82 -0
  138. package/skills/hyperframes-cli/SKILL.md +109 -0
  139. package/skills/hyperframes-core/SKILL.md +78 -0
  140. package/skills/hyperframes-creative/SKILL.md +68 -0
  141. package/skills/hyperframes-media/SKILL.md +97 -0
  142. package/skills/image-processing/SKILL.md +34 -0
  143. package/skills/image-to-code-skill/SKILL.md +1228 -0
  144. package/skills/imagegen-frontend-mobile/SKILL.md +1465 -0
  145. package/skills/imagegen-frontend-web/SKILL.md +987 -0
  146. package/skills/implement/SKILL.md +15 -0
  147. package/skills/init/SKILL.md +91 -0
  148. package/skills/internal-comms/SKILL.md +32 -0
  149. package/skills/json-transformation/SKILL.md +34 -0
  150. package/skills/keyboard-shortcuts/SKILL.md +34 -0
  151. package/skills/knowledge-base/SKILL.md +34 -0
  152. package/skills/knowledge-graph/SKILL.md +34 -0
  153. package/skills/kubernetes-deployment/SKILL.md +34 -0
  154. package/skills/language-translation/SKILL.md +34 -0
  155. package/skills/lark-approval/SKILL.md +56 -0
  156. package/skills/lark-base/SKILL.md +157 -0
  157. package/skills/lark-doc/SKILL.md +81 -0
  158. package/skills/lark-shared/SKILL.md +168 -0
  159. package/skills/lark-workflow-meeting-summary/SKILL.md +122 -0
  160. package/skills/linting-neostandard-eslint9/SKILL.md +64 -0
  161. package/skills/llm-chaining/SKILL.md +34 -0
  162. package/skills/localization-i18n/SKILL.md +34 -0
  163. package/skills/logging-best-practices/SKILL.md +34 -0
  164. package/skills/loop-me/SKILL.md +32 -0
  165. package/skills/machine-learning-pipeline/SKILL.md +34 -0
  166. package/skills/meeting-notes/SKILL.md +34 -0
  167. package/skills/meeting-scheduler/SKILL.md +34 -0
  168. package/skills/message-queues/SKILL.md +34 -0
  169. package/skills/message-summarization/SKILL.md +34 -0
  170. package/skills/microservices-architecture/SKILL.md +34 -0
  171. package/skills/microsoft-foundry/SKILL.md +262 -0
  172. package/skills/migrate-to-shoehorn/SKILL.md +118 -0
  173. package/skills/milestone-tracking/SKILL.md +34 -0
  174. package/skills/minimalist-skill/SKILL.md +85 -0
  175. package/skills/model-deployment/SKILL.md +34 -0
  176. package/skills/model-evaluation/SKILL.md +34 -0
  177. package/skills/monitoring-setup/SKILL.md +34 -0
  178. package/skills/monorepo-setup/SKILL.md +34 -0
  179. package/skills/motion-graphics/SKILL.md +170 -0
  180. package/skills/multi-agent-systems/SKILL.md +34 -0
  181. package/skills/music-to-video/SKILL.md +197 -0
  182. package/skills/network-troubleshooting/SKILL.md +34 -0
  183. package/skills/node/SKILL.md +94 -0
  184. package/skills/nodejs-core/SKILL.md +156 -0
  185. package/skills/note-organization/SKILL.md +34 -0
  186. package/skills/oauth/SKILL.md +186 -0
  187. package/skills/obsidian-vault/SKILL.md +59 -0
  188. package/skills/octocat/SKILL.md +93 -0
  189. package/skills/openclaw-secure-linux-cloud/SKILL.md +157 -0
  190. package/skills/opensource-guide-coach/SKILL.md +218 -0
  191. package/skills/output-skill/SKILL.md +49 -0
  192. package/skills/package-publishing/SKILL.md +34 -0
  193. package/skills/password-generator/SKILL.md +34 -0
  194. package/skills/pdf/SKILL.md +314 -0
  195. package/skills/pdf-processing/SKILL.md +34 -0
  196. package/skills/performance-optimization/SKILL.md +34 -0
  197. package/skills/pomodoro-timer/SKILL.md +34 -0
  198. package/skills/powershell-automation/SKILL.md +34 -0
  199. package/skills/pptx/SKILL.md +232 -0
  200. package/skills/pr-to-video/SKILL.md +235 -0
  201. package/skills/priority-filtering/SKILL.md +34 -0
  202. package/skills/product-launch-video/SKILL.md +205 -0
  203. package/skills/project-tracking/SKILL.md +34 -0
  204. package/skills/prompt-compression/SKILL.md +34 -0
  205. package/skills/prompt-engineering/SKILL.md +34 -0
  206. package/skills/push-notifications/SKILL.md +34 -0
  207. package/skills/python-appservice-deploy/SKILL.md +36 -0
  208. package/skills/qa/SKILL.md +130 -0
  209. package/skills/rag-implementation/SKILL.md +34 -0
  210. package/skills/rate-limiting/SKILL.md +34 -0
  211. package/skills/react-best-practices/SKILL.md +149 -0
  212. package/skills/react-native-skills/SKILL.md +121 -0
  213. package/skills/react-view-transitions/SKILL.md +320 -0
  214. package/skills/readme-i18n/SKILL.md +176 -0
  215. package/skills/real-time-communication/SKILL.md +34 -0
  216. package/skills/redesign-skill/SKILL.md +178 -0
  217. package/skills/refactoring-strategy/SKILL.md +34 -0
  218. package/skills/regex-mastery/SKILL.md +34 -0
  219. package/skills/remotion/SKILL.md +364 -0
  220. package/skills/report-generation/SKILL.md +34 -0
  221. package/skills/request-refactor-plan/SKILL.md +68 -0
  222. package/skills/research-compiler/SKILL.md +34 -0
  223. package/skills/resolving-merge-conflicts/SKILL.md +14 -0
  224. package/skills/responsive-design/SKILL.md +34 -0
  225. package/skills/rest-api-patterns/SKILL.md +34 -0
  226. package/skills/retrospectives/SKILL.md +34 -0
  227. package/skills/risk-assessment/SKILL.md +34 -0
  228. package/skills/roadmap-creation/SKILL.md +34 -0
  229. package/skills/running-claude-code-via-litellm-copilot/SKILL.md +263 -0
  230. package/skills/scaffold-exercises/SKILL.md +106 -0
  231. package/skills/search-implementation/SKILL.md +34 -0
  232. package/skills/secrets-management/SKILL.md +34 -0
  233. package/skills/secure-linux-web-hosting/SKILL.md +162 -0
  234. package/skills/security-audit/SKILL.md +34 -0
  235. package/skills/selective-memory/SKILL.md +34 -0
  236. package/skills/semantic-search/SKILL.md +34 -0
  237. package/skills/semantic-versioning/SKILL.md +34 -0
  238. package/skills/sentiment-analysis/SKILL.md +34 -0
  239. package/skills/seo-optimization/SKILL.md +34 -0
  240. package/skills/setup-pre-commit/SKILL.md +91 -0
  241. package/skills/shadcn/SKILL.md +267 -0
  242. package/skills/simple/SKILL.md +52 -0
  243. package/skills/skill-creator/SKILL.md +485 -0
  244. package/skills/skill-optimizer/SKILL.md +47 -0
  245. package/skills/skills-cli/SKILL.md +281 -0
  246. package/skills/slack-gif-creator/SKILL.md +254 -0
  247. package/skills/snipgrapher/SKILL.md +58 -0
  248. package/skills/snippet-manager/SKILL.md +34 -0
  249. package/skills/soft-skill/SKILL.md +98 -0
  250. package/skills/sprint-planning/SKILL.md +34 -0
  251. package/skills/sql-query-optimization/SKILL.md +34 -0
  252. package/skills/stakeholder-communication/SKILL.md +34 -0
  253. package/skills/state-management/SKILL.md +34 -0
  254. package/skills/statistical-analysis/SKILL.md +34 -0
  255. package/skills/stitch-skill/SKILL.md +184 -0
  256. package/skills/streaming-responses/SKILL.md +34 -0
  257. package/skills/structured-output/SKILL.md +34 -0
  258. package/skills/summarization-techniques/SKILL.md +34 -0
  259. package/skills/supabase/SKILL.md +135 -0
  260. package/skills/supabase-postgres-best-practices/SKILL.md +64 -0
  261. package/skills/system-diagnostics/SKILL.md +34 -0
  262. package/skills/systematic-debugging/SKILL.md +296 -0
  263. package/skills/talking-head-recut/SKILL.md +1191 -0
  264. package/skills/task-decomposition/SKILL.md +34 -0
  265. package/skills/task-prioritization/SKILL.md +34 -0
  266. package/skills/taste-skill/SKILL.md +1206 -0
  267. package/skills/taste-skill-v1/SKILL.md +226 -0
  268. package/skills/tdd/SKILL.md +108 -0
  269. package/skills/teach/SKILL.md +140 -0
  270. package/skills/template-library/SKILL.md +34 -0
  271. package/skills/test-driven-development/SKILL.md +371 -0
  272. package/skills/test-generation/SKILL.md +34 -0
  273. package/skills/testing-strategy/SKILL.md +34 -0
  274. package/skills/text-expansion/SKILL.md +34 -0
  275. package/skills/theme-factory/SKILL.md +59 -0
  276. package/skills/time-blocking/SKILL.md +34 -0
  277. package/skills/to-prd/SKILL.md +75 -0
  278. package/skills/token-budgeting/SKILL.md +34 -0
  279. package/skills/token-optimization/SKILL.md +34 -0
  280. package/skills/tool-calling-patterns/SKILL.md +34 -0
  281. package/skills/typescript-magician/SKILL.md +117 -0
  282. package/skills/tzst/SKILL.md +68 -0
  283. package/skills/ubiquitous-language/SKILL.md +93 -0
  284. package/skills/use-my-browser/SKILL.md +110 -0
  285. package/skills/using-superpowers/SKILL.md +121 -0
  286. package/skills/vector-database-setup/SKILL.md +34 -0
  287. package/skills/vercel-cli-with-tokens/SKILL.md +353 -0
  288. package/skills/vercel-optimize/SKILL.md +322 -0
  289. package/skills/video-editing/SKILL.md +34 -0
  290. package/skills/viral-instagram-reels/SKILL.md +180 -0
  291. package/skills/viral-short-form/SKILL.md +147 -0
  292. package/skills/viral-short-form-ideas/SKILL.md +184 -0
  293. package/skills/viral-tiktok-content/SKILL.md +180 -0
  294. package/skills/visualization-creation/SKILL.md +34 -0
  295. package/skills/web-artifacts-builder/SKILL.md +74 -0
  296. package/skills/web-design-guidelines/SKILL.md +39 -0
  297. package/skills/web-scraping/SKILL.md +34 -0
  298. package/skills/webapp-testing/SKILL.md +96 -0
  299. package/skills/webhook-handling/SKILL.md +34 -0
  300. package/skills/website-to-video/SKILL.md +145 -0
  301. package/skills/weekly-review/SKILL.md +34 -0
  302. package/skills/workflow-automation/SKILL.md +34 -0
  303. package/skills/writing-beats/SKILL.md +67 -0
  304. package/skills/writing-fragments/SKILL.md +79 -0
  305. package/skills/writing-great-skills/SKILL.md +82 -0
  306. package/skills/writing-guidelines/SKILL.md +39 -0
  307. package/skills/writing-plans/SKILL.md +174 -0
  308. package/skills/writing-shape/SKILL.md +79 -0
  309. package/skills/xdrop/SKILL.md +78 -0
  310. package/skills/xget/SKILL.md +87 -0
  311. package/skills/xlsx/SKILL.md +292 -0
  312. package/src/commands/code_v5.js +377 -73
  313. package/src/commands/repl.js +505 -86
  314. package/src/providers/model/anthropic.js +84 -0
  315. package/src/providers/model/gemini.js +49 -0
  316. package/src/providers/model/minimax.js +48 -0
  317. package/src/providers/model/ollama.js +42 -0
  318. package/src/providers/model/openai.js +49 -0
  319. package/src/providers/search/duckduckgo.js +45 -0
  320. package/src/providers/search/exa.js +52 -0
  321. package/src/providers/search/searxng.js +51 -0
  322. package/src/providers/search/tavily.js +47 -0
  323. package/src/tools/model_provider.js +71 -0
  324. package/src/tools/parallel_search.js +40 -49
  325. package/src/tools/search_provider.js +79 -0
  326. package/src/tools/skills_download.js +217 -0
  327. package/src/tools/web_search.js +42 -62
  328. package/src/tools/workflow.js +21 -9
  329. package/src/utils/cron.js +82 -126
  330. package/src/utils/effort-levels.js +42 -0
  331. package/src/utils/fallback-chain.js +72 -0
  332. package/src/utils/file-history.js +78 -0
  333. package/src/utils/model-provider.js +113 -0
  334. package/src/utils/permissions.js +147 -0
  335. package/src/utils/plan-mode.js +164 -0
  336. package/src/utils/provider-detect.js +7 -32
  337. package/src/utils/sandbox.js +60 -0
  338. package/src/utils/search-provider.js +62 -0
  339. package/src/utils/session-search.js +66 -0
  340. package/src/utils/structured-output.js +20 -0
  341. package/src/utils/system-prompt.js +28 -2
  342. package/src/utils/tasks.js +132 -0
  343. package/src/utils/tool-hooks.js +154 -0
  344. package/src/utils/tools.js +18 -2
  345. package/src/utils/ultra-review.js +59 -0
  346. package/src/utils/worktree.js +192 -0
@@ -0,0 +1,154 @@
1
+ /**
2
+ * tool-hooks — Pattern-based pre/post tool execution hooks (Claude Code style)
3
+ *
4
+ * Hooks defined in config under `toolHooks` key:
5
+ * pre: { "ToolName(pattern)": "allow" | "deny" | "ask" }
6
+ * post: { "ToolName(pattern)": "notify" | "record" }
7
+ *
8
+ * Pattern syntax:
9
+ * Bash(git *) — Bash tool, args start with "git"
10
+ * Read(src/**) — Read tool, path starts with "src/"
11
+ * Write(.env*) — Write tool, path starts with ".env"
12
+ * Edit(*) — Edit tool, any path
13
+ * * — All tools
14
+ */
15
+
16
+ const fs = require('fs');
17
+ const path = require('path');
18
+ const os = require('os');
19
+
20
+ function loadRules() {
21
+ const rules = { pre: [], post: [] };
22
+ try {
23
+ const cfgPath = path.join(os.homedir(), '.natureco', 'config.json');
24
+ if (fs.existsSync(cfgPath)) {
25
+ const cfg = JSON.parse(fs.readFileSync(cfgPath, 'utf8'));
26
+ if (cfg.toolHooks) {
27
+ if (cfg.toolHooks.pre) {
28
+ for (const [pattern, action] of Object.entries(cfg.toolHooks.pre)) {
29
+ rules.pre.push(parseRule(pattern, action));
30
+ }
31
+ }
32
+ if (cfg.toolHooks.post) {
33
+ for (const [pattern, action] of Object.entries(cfg.toolHooks.post)) {
34
+ rules.post.push(parseRule(pattern, action));
35
+ }
36
+ }
37
+ }
38
+ }
39
+ } catch {}
40
+ // Check project-level hooks.json
41
+ try {
42
+ const projectCfg = path.join(process.cwd(), '.natureco', 'hooks.json');
43
+ if (fs.existsSync(projectCfg)) {
44
+ const pCfg = JSON.parse(fs.readFileSync(projectCfg, 'utf8'));
45
+ if (pCfg.pre) {
46
+ for (const [pattern, action] of Object.entries(pCfg.pre)) {
47
+ rules.pre.push(parseRule(pattern, action));
48
+ }
49
+ }
50
+ if (pCfg.post) {
51
+ for (const [pattern, action] of Object.entries(pCfg.post)) {
52
+ rules.post.push(parseRule(pattern, action));
53
+ }
54
+ }
55
+ }
56
+ } catch {}
57
+ return rules;
58
+ }
59
+
60
+ function parseRule(pattern, action) {
61
+ // Pattern: ToolName(glob) or * for all
62
+ const match = pattern.match(/^(\*|[a-zA-Z_]+)\((.+)\)$/);
63
+ let toolName = '*';
64
+ let glob = '*';
65
+ if (match) {
66
+ toolName = match[1];
67
+ glob = match[2];
68
+ } else if (pattern !== '*') {
69
+ toolName = pattern;
70
+ }
71
+ return { toolName, glob, action, raw: pattern };
72
+ }
73
+
74
+ function matchGlob(str, glob) {
75
+ if (glob === '*') return true;
76
+ // Both * and ** match .* since we're matching flat arg strings, not file paths
77
+ const escaped = glob
78
+ .replace(/[.+^${}()|[\]\\]/g, '\\$&')
79
+ .replace(/\*\*/g, '.*')
80
+ .replace(/\*/g, '.*');
81
+ return new RegExp('^' + escaped + '$').test(str);
82
+ }
83
+
84
+ function flattenArgs(args) {
85
+ if (typeof args === 'string') return args;
86
+ if (args === null || args === undefined) return '';
87
+ const parts = [];
88
+ for (const [k, v] of Object.entries(args)) {
89
+ if (typeof v === 'string') parts.push(v);
90
+ else if (Array.isArray(v)) parts.push(...v.filter(x => typeof x === 'string'));
91
+ else if (typeof v === 'object' && v !== null) parts.push(JSON.stringify(v));
92
+ }
93
+ return parts.join(' ');
94
+ }
95
+
96
+ function matchRule(rule, toolName, args) {
97
+ if (rule.toolName !== '*' && rule.toolName !== toolName) return false;
98
+ // Try matching against flattened args first, then tool name
99
+ const flat = flattenArgs(args);
100
+ return matchGlob(flat, rule.glob) || matchGlob(toolName, rule.glob);
101
+ }
102
+
103
+ /**
104
+ * Check pre-hooks before tool execution.
105
+ * Returns { action: 'allow'|'deny'|'ask', rule, reason }
106
+ */
107
+ function checkPreHooks(toolName, args) {
108
+ const rules = loadRules();
109
+ for (const rule of rules.pre) {
110
+ if (matchRule(rule, toolName, args)) {
111
+ if (rule.action === 'deny') {
112
+ return { action: 'deny', rule, reason: `Hook engelledi: ${rule.raw}` };
113
+ }
114
+ if (rule.action === 'ask') {
115
+ return { action: 'ask', rule, reason: `Hook onay gerektiriyor: ${rule.raw}` };
116
+ }
117
+ if (rule.action === 'allow') {
118
+ return { action: 'allow', rule, reason: '' };
119
+ }
120
+ }
121
+ }
122
+ return { action: 'allow', rule: null, reason: '' };
123
+ }
124
+
125
+ /**
126
+ * Run post-hooks after tool execution.
127
+ * Returns enriched result or original.
128
+ */
129
+ function runPostHooks(toolName, args, result) {
130
+ const rules = loadRules();
131
+ for (const rule of rules.post) {
132
+ if (matchRule(rule, toolName, args)) {
133
+ try {
134
+ const hook = require(path.join(os.homedir(), '.natureco', 'hooks', rule.action));
135
+ if (typeof hook === 'function') {
136
+ return hook({ toolName, args, result }) || result;
137
+ }
138
+ } catch {}
139
+ }
140
+ }
141
+ return result;
142
+ }
143
+
144
+ /**
145
+ * Convert args to string for CLI permission display.
146
+ */
147
+ function permissionSummary(rule, toolName, args) {
148
+ const argsStr = Object.entries(args || {})
149
+ .map(([k, v]) => `${k}=${String(v).slice(0, 60)}`)
150
+ .join(', ');
151
+ return `${toolName}(${argsStr}) — ${rule.raw}`;
152
+ }
153
+
154
+ module.exports = { checkPreHooks, runPostHooks, loadRules, matchGlob, matchRule, permissionSummary, flattenArgs };
@@ -8,6 +8,12 @@
8
8
  const fs = require('fs');
9
9
  const path = require('path');
10
10
  const { globalRegistry } = require('./registry');
11
+ const sandbox = require('./sandbox');
12
+
13
+ // Lazy config read — avoids circular deps
14
+ function _getSandboxLevel() {
15
+ try { return sandbox.getLevel(require('./config').getConfig()); } catch { return 'none'; }
16
+ }
11
17
 
12
18
  const TOOLS_DIR = path.join(__dirname, '..', 'tools');
13
19
 
@@ -24,7 +30,7 @@ const EMOJI_MAP = {
24
30
  // Memory
25
31
  memory: '🧠', memory_write: '🧠', memory_search: '🔍',
26
32
  // Skills
27
- skill_view: '📚', skills_list: '📋', skill_generate: '✨', skills_autoload: '🔄', skills_marketplace: '🏪', skill_manage: '🛠️',
33
+ skill_view: '📚', skills_list: '📋', skill_generate: '✨', skills_autoload: '🔄', skills_marketplace: '🏪', skill_manage: '🛠️', skills_download: '📥',
28
34
  // Agent
29
35
  delegate_task: '👥', llm_task: '🤖', sub_agent: '👤',
30
36
  // Documents
@@ -89,7 +95,7 @@ const TOOLSET_MAP = {
89
95
  memory: 'memory', memory_write: 'memory', memory_search: 'memory',
90
96
  // Skills
91
97
  skill_view: 'skills', skills_list: 'skills', skill_generate: 'skills',
92
- skills_autoload: 'skills', skills_marketplace: 'skills', skill_manage: 'skills',
98
+ skills_autoload: 'skills', skills_marketplace: 'skills', skill_manage: 'skills', skills_download: 'skills',
93
99
  // Agent
94
100
  delegate_task: 'agent', llm_task: 'agent',
95
101
  // Documents
@@ -294,6 +300,16 @@ async function executeTool(toolName, args, toolDefs) {
294
300
  return { error: `${toolName} şu anda kullanılamıyor (check_fn engelledi)` };
295
301
  }
296
302
  }
303
+
304
+ // Sandbox restrictions for bash/shell_command
305
+ if (toolName === 'bash' || toolName === 'shell_command') {
306
+ const level = _getSandboxLevel();
307
+ const cmd = (args && args.command) || '';
308
+ if (level === 'strict' && sandbox.isNetworkCommand(cmd)) {
309
+ return { error: 'strict sandbox: network komutları engellendi. Daha düşük sandbox seviyesi kullanın.' };
310
+ }
311
+ }
312
+
297
313
  try {
298
314
  const result = await tool.execute(args || {});
299
315
  return { result };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * ultra-review — Multi-agent code review
3
+ *
4
+ * Spawns parallel review agents focused on different aspects:
5
+ * - Security: secret scanning, injection risks
6
+ * - Style: code conventions, formatting
7
+ * - Logic: correctness, edge cases
8
+ * - Performance: optimization opportunities
9
+ *
10
+ * Uses natureco's existing agent system for reviews.
11
+ */
12
+
13
+ const path = require('path');
14
+
15
+ const REVIEW_FOCUS = {
16
+ security: {
17
+ name: 'Security Review',
18
+ prompt: 'Review the following code for security issues: secret exposure, injection vulnerabilities, unsafe deserialization, path traversal, command injection. Return issues with severity (high/medium/low) and line references.',
19
+ },
20
+ style: {
21
+ name: 'Style Review',
22
+ prompt: 'Review the following code for style issues: naming conventions, formatting consistency, code organization, documentation quality, adherence to project conventions.',
23
+ },
24
+ logic: {
25
+ name: 'Logic Review',
26
+ prompt: 'Review the following code for logic issues: correctness, edge cases, error handling, race conditions, type safety, off-by-one errors, boundary conditions.',
27
+ },
28
+ performance: {
29
+ name: 'Performance Review',
30
+ prompt: 'Review the following code for performance issues: unnecessary allocations, O(n²) algorithms, memory leaks, blocking operations, caching opportunities, bundle size impact.',
31
+ },
32
+ };
33
+
34
+ function reviewFile(filePath, content) {
35
+ const issues = [];
36
+ for (const [focus, info] of Object.entries(REVIEW_FOCUS)) {
37
+ issues.push({
38
+ focus,
39
+ title: info.name,
40
+ prompt: info.prompt,
41
+ file: filePath,
42
+ });
43
+ }
44
+ return { file: filePath, size: content.length, reviews: issues };
45
+ }
46
+
47
+ function reviewDiff(diffContent) {
48
+ const issues = [];
49
+ for (const [focus, info] of Object.entries(REVIEW_FOCUS)) {
50
+ issues.push({
51
+ focus,
52
+ title: info.name,
53
+ prompt: info.prompt + `\n\nDiff:\n${diffContent.slice(0, 8000)}`,
54
+ });
55
+ }
56
+ return { reviews: issues };
57
+ }
58
+
59
+ module.exports = { reviewFile, reviewDiff, REVIEW_FOCUS };
@@ -0,0 +1,192 @@
1
+ /**
2
+ * worktree — Isolated development worktrees (Claude Code EnterWorktree/ExitWorktree)
3
+ *
4
+ * Creates temporary git worktrees for experimental changes without
5
+ * affecting the main working directory.
6
+ *
7
+ * Tools:
8
+ * EnterWorktree — create a temp branch + worktree at .natureco/worktrees/<id>
9
+ * ExitWorktree — merge/collapse worktree changes back
10
+ *
11
+ * Falls back to a copytree (non-git) strategy when not in a git repo.
12
+ */
13
+
14
+ const fs = require('fs');
15
+ const path = require('path');
16
+ const os = require('os');
17
+ const { execSync } = require('child_process');
18
+
19
+ const WORKTREE_DIR = path.join(process.cwd(), '.natureco', 'worktrees');
20
+
21
+ class Worktree {
22
+ constructor() {
23
+ this.active = null; // { id, branch, dir, strategy }
24
+ this.history = [];
25
+ this._mockGitRepo = null; // For testing override
26
+ }
27
+
28
+ get isGitRepo() {
29
+ if (this._mockGitRepo !== null) return this._mockGitRepo;
30
+ try {
31
+ execSync('git rev-parse --git-dir', { cwd: process.cwd(), stdio: 'pipe' });
32
+ return true;
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
37
+
38
+ get currentBranch() {
39
+ try {
40
+ return execSync('git rev-parse --abbrev-ref HEAD', { cwd: process.cwd(), stdio: 'pipe' }).toString().trim();
41
+ } catch {
42
+ return 'main';
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Enter worktree — create isolated copy for experimentation.
48
+ */
49
+ enter(opts = {}) {
50
+ if (this.active) return { error: `Zaten worktree aktif: ${this.active.id}` };
51
+
52
+ const id = opts.id || `wt-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
53
+ const branch = opts.branch || `wt/${id}`;
54
+ const targetDir = path.join(WORKTREE_DIR, id);
55
+
56
+ fs.mkdirSync(targetDir, { recursive: true });
57
+
58
+ if (this.isGitRepo) {
59
+ try {
60
+ // Create orphan branch + worktree
61
+ execSync(`git branch -f "${branch}" HEAD`, { cwd: process.cwd(), stdio: 'pipe' });
62
+ execSync(`git worktree add --detach "${targetDir}" "${branch}"`, { cwd: process.cwd(), stdio: 'pipe' });
63
+ this.active = { id, branch, dir: targetDir, strategy: 'git-worktree' };
64
+ } catch (e) {
65
+ // Fallback: simple copy
66
+ this._copyTree(process.cwd(), targetDir);
67
+ this.active = { id, branch: null, dir: targetDir, strategy: 'copytree' };
68
+ }
69
+ } else {
70
+ this._copyTree(process.cwd(), targetDir);
71
+ this.active = { id, branch: null, dir: targetDir, strategy: 'copytree' };
72
+ }
73
+
74
+ this.history.push({ action: 'enter', id, at: Date.now() });
75
+ return {
76
+ result: `Worktree oluşturuldu: ${id}\nDizin: ${targetDir}\nStrateji: ${this.active.strategy}${this.active.branch ? `\nBranch: ${this.active.branch}` : ''}`,
77
+ worktreeId: id,
78
+ worktreeDir: targetDir,
79
+ };
80
+ }
81
+
82
+ /**
83
+ * Exit worktree — merge changes back and clean up.
84
+ */
85
+ exit(opts = {}) {
86
+ if (!this.active) return { error: 'Aktif worktree yok.' };
87
+
88
+ const merge = opts.merge !== false;
89
+ const result = { merged: false, changes: [] };
90
+
91
+ if (merge && this.active.strategy === 'git-worktree') {
92
+ try {
93
+ // Diff the worktree against current HEAD
94
+ const diff = execSync(`git diff HEAD --name-status`, { cwd: this.active.dir, stdio: 'pipe' }).toString().trim();
95
+ if (diff) {
96
+ result.changes = diff.split('\n').filter(Boolean);
97
+ // Cherry-pick changes if any commits were made
98
+ const log = execSync(`git log --oneline HEAD --not --all`, { cwd: this.active.dir, stdio: 'pipe' }).toString().trim();
99
+ if (log) {
100
+ execSync(`git fetch . "${this.active.branch}"`, { cwd: process.cwd(), stdio: 'pipe' });
101
+ result.merged = true;
102
+ }
103
+ }
104
+ } catch (e) {
105
+ result.mergeError = e.message;
106
+ }
107
+ }
108
+
109
+ // Cleanup
110
+ this._cleanup();
111
+ this.history.push({ action: 'exit', id: this.active.id, merged: result.merged, at: Date.now() });
112
+ this.active = null;
113
+
114
+ return {
115
+ result: `Worktree kapatıldı.${result.merged ? ' Değişiklikler merge edildi.' : ' Değişiklikler atıldı.'}` +
116
+ (result.changes.length ? `\nDeğişiklikler:\n${result.changes.join('\n')}` : ''),
117
+ ...result,
118
+ };
119
+ }
120
+
121
+ /**
122
+ * Get current worktree info.
123
+ */
124
+ status() {
125
+ if (!this.active) return { active: false };
126
+ return {
127
+ active: true,
128
+ id: this.active.id,
129
+ dir: this.active.dir,
130
+ branch: this.active.branch,
131
+ strategy: this.active.strategy,
132
+ };
133
+ }
134
+
135
+ /**
136
+ * Validate if a tool call is operating within the worktree.
137
+ * If active, redirect file paths from cwd to worktree dir.
138
+ */
139
+ resolvePath(filePath) {
140
+ if (!this.active || !filePath) return filePath;
141
+ const abs = path.resolve(filePath);
142
+ const cwd = process.cwd();
143
+ if (abs.startsWith(cwd)) {
144
+ const rel = path.relative(cwd, abs);
145
+ return path.join(this.active.dir, rel);
146
+ }
147
+ return filePath;
148
+ }
149
+
150
+ /**
151
+ * Copy entire directory tree (fallback for non-git repos).
152
+ */
153
+ _copyTree(src, dest) {
154
+ const skipDirs = new Set(['node_modules', '.git', '.natureco']);
155
+ const entries = fs.readdirSync(src, { withFileTypes: true });
156
+ for (const entry of entries) {
157
+ if (entry.name.startsWith('.') || skipDirs.has(entry.name)) continue;
158
+ const s = path.join(src, entry.name);
159
+ const d = path.join(dest, entry.name);
160
+ if (entry.isDirectory()) {
161
+ fs.mkdirSync(d, { recursive: true });
162
+ this._copyTree(s, d);
163
+ } else if (entry.isFile()) {
164
+ try { fs.copyFileSync(s, d); } catch {}
165
+ }
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Clean up worktree files.
171
+ */
172
+ _cleanup() {
173
+ if (!this.active) return;
174
+ try {
175
+ if (this.active.strategy === 'git-worktree') {
176
+ execSync(`git worktree remove --force "${this.active.dir}"`, { stdio: 'pipe' });
177
+ execSync(`git branch -D "${this.active.branch}" 2>/dev/null`, { stdio: 'pipe' });
178
+ }
179
+ if (fs.existsSync(this.active.dir)) {
180
+ fs.rmSync(this.active.dir, { recursive: true, force: true });
181
+ }
182
+ } catch {}
183
+ }
184
+ }
185
+
186
+ let _instance = null;
187
+ function getWorktree() {
188
+ if (!_instance) _instance = new Worktree();
189
+ return _instance;
190
+ }
191
+
192
+ module.exports = { Worktree, getWorktree };