natureco-cli 5.19.0 → 5.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/package.json +1 -1
- package/skills/a-b-testing/SKILL.md +34 -0
- package/skills/accessibility-audit/SKILL.md +34 -0
- package/skills/agent-memory/SKILL.md +34 -0
- package/skills/agent-orchestration/SKILL.md +34 -0
- package/skills/analytics-setup/SKILL.md +34 -0
- package/skills/api-design/SKILL.md +34 -0
- package/skills/api-versioning/SKILL.md +34 -0
- package/skills/audio-transcription/SKILL.md +34 -0
- package/skills/authentication-patterns/SKILL.md +34 -0
- package/skills/authorization-rbac/SKILL.md +34 -0
- package/skills/backup-strategy/SKILL.md +34 -0
- package/skills/bash-scripting/SKILL.md +34 -0
- package/skills/batch-api-calls/SKILL.md +34 -0
- package/skills/batch-processing/SKILL.md +34 -0
- package/skills/bulk-file-operations/SKILL.md +34 -0
- package/skills/cache-responses/SKILL.md +34 -0
- package/skills/caching-strategy/SKILL.md +34 -0
- package/skills/calendar-optimization/SKILL.md +34 -0
- package/skills/changelog-generation/SKILL.md +34 -0
- package/skills/chat-bot-design/SKILL.md +34 -0
- package/skills/chunking-strategy/SKILL.md +34 -0
- package/skills/ci-cd-pipeline/SKILL.md +34 -0
- package/skills/classification-pipeline/SKILL.md +34 -0
- package/skills/clipboard-master/SKILL.md +34 -0
- package/skills/code-explanation/SKILL.md +34 -0
- package/skills/code-generation/SKILL.md +34 -0
- package/skills/code-migration/SKILL.md +34 -0
- package/skills/code-review-checklist/SKILL.md +34 -0
- package/skills/contact-management/SKILL.md +34 -0
- package/skills/content-generation/SKILL.md +34 -0
- package/skills/context-pruning/SKILL.md +34 -0
- package/skills/context-window-management/SKILL.md +34 -0
- package/skills/continuous-improvement/SKILL.md +34 -0
- package/skills/cron-scheduling/SKILL.md +34 -0
- package/skills/cross-platform-compat/SKILL.md +34 -0
- package/skills/csv-processing/SKILL.md +34 -0
- package/skills/daily-journal/SKILL.md +34 -0
- package/skills/data-analysis/SKILL.md +34 -0
- package/skills/data-backup/SKILL.md +34 -0
- package/skills/data-cleaning/SKILL.md +34 -0
- package/skills/data-extraction/SKILL.md +34 -0
- package/skills/data-validation/SKILL.md +34 -0
- package/skills/database-migrations/SKILL.md +34 -0
- package/skills/database-schema-design/SKILL.md +34 -0
- package/skills/decision-matrix/SKILL.md +34 -0
- package/skills/dependency-management/SKILL.md +34 -0
- package/skills/dev-environment-setup/SKILL.md +34 -0
- package/skills/distraction-blocker/SKILL.md +34 -0
- package/skills/docker-optimization/SKILL.md +34 -0
- package/skills/document-template/SKILL.md +34 -0
- package/skills/documentation-gen/SKILL.md +34 -0
- package/skills/efficient-formatting/SKILL.md +34 -0
- package/skills/email-management/SKILL.md +34 -0
- package/skills/email-service/SKILL.md +34 -0
- package/skills/embedding-generation/SKILL.md +34 -0
- package/skills/entity-extraction/SKILL.md +34 -0
- package/skills/environment-config/SKILL.md +34 -0
- package/skills/error-handling/SKILL.md +34 -0
- package/skills/estimation-techniques/SKILL.md +34 -0
- package/skills/event-driven-architecture/SKILL.md +34 -0
- package/skills/excel-automation/SKILL.md +34 -0
- package/skills/execution-monitoring/SKILL.md +34 -0
- package/skills/expense-tracking/SKILL.md +34 -0
- package/skills/feature-engineering/SKILL.md +34 -0
- package/skills/feature-flags/SKILL.md +34 -0
- package/skills/file-conversion/SKILL.md +34 -0
- package/skills/file-upload-handling/SKILL.md +34 -0
- package/skills/fine-tuning-prep/SKILL.md +34 -0
- package/skills/focus-mode/SKILL.md +34 -0
- package/skills/form-validation/SKILL.md +34 -0
- package/skills/function-calling/SKILL.md +34 -0
- package/skills/git-workflow/SKILL.md +34 -0
- package/skills/goal-setting/SKILL.md +34 -0
- package/skills/graphql-design/SKILL.md +34 -0
- package/skills/habit-tracker/SKILL.md +34 -0
- package/skills/hallucination-detection/SKILL.md +34 -0
- package/skills/image-processing/SKILL.md +34 -0
- package/skills/json-transformation/SKILL.md +34 -0
- package/skills/keyboard-shortcuts/SKILL.md +34 -0
- package/skills/knowledge-base/SKILL.md +34 -0
- package/skills/knowledge-graph/SKILL.md +34 -0
- package/skills/kubernetes-deployment/SKILL.md +34 -0
- package/skills/language-translation/SKILL.md +34 -0
- package/skills/llm-chaining/SKILL.md +34 -0
- package/skills/localization-i18n/SKILL.md +34 -0
- package/skills/logging-best-practices/SKILL.md +34 -0
- package/skills/machine-learning-pipeline/SKILL.md +34 -0
- package/skills/meeting-notes/SKILL.md +34 -0
- package/skills/meeting-scheduler/SKILL.md +34 -0
- package/skills/message-queues/SKILL.md +34 -0
- package/skills/message-summarization/SKILL.md +34 -0
- package/skills/microservices-architecture/SKILL.md +34 -0
- package/skills/milestone-tracking/SKILL.md +34 -0
- package/skills/model-deployment/SKILL.md +34 -0
- package/skills/model-evaluation/SKILL.md +34 -0
- package/skills/monitoring-setup/SKILL.md +34 -0
- package/skills/monorepo-setup/SKILL.md +34 -0
- package/skills/multi-agent-systems/SKILL.md +34 -0
- package/skills/network-troubleshooting/SKILL.md +34 -0
- package/skills/note-organization/SKILL.md +34 -0
- package/skills/package-publishing/SKILL.md +34 -0
- package/skills/password-generator/SKILL.md +34 -0
- package/skills/pdf-processing/SKILL.md +34 -0
- package/skills/performance-optimization/SKILL.md +34 -0
- package/skills/pomodoro-timer/SKILL.md +34 -0
- package/skills/powershell-automation/SKILL.md +34 -0
- package/skills/priority-filtering/SKILL.md +34 -0
- package/skills/project-tracking/SKILL.md +34 -0
- package/skills/prompt-compression/SKILL.md +34 -0
- package/skills/prompt-engineering/SKILL.md +34 -0
- package/skills/push-notifications/SKILL.md +34 -0
- package/skills/rag-implementation/SKILL.md +34 -0
- package/skills/rate-limiting/SKILL.md +34 -0
- package/skills/real-time-communication/SKILL.md +34 -0
- package/skills/refactoring-strategy/SKILL.md +34 -0
- package/skills/regex-mastery/SKILL.md +34 -0
- package/skills/report-generation/SKILL.md +34 -0
- package/skills/research-compiler/SKILL.md +34 -0
- package/skills/responsive-design/SKILL.md +34 -0
- package/skills/rest-api-patterns/SKILL.md +34 -0
- package/skills/retrospectives/SKILL.md +34 -0
- package/skills/risk-assessment/SKILL.md +34 -0
- package/skills/roadmap-creation/SKILL.md +34 -0
- package/skills/search-implementation/SKILL.md +34 -0
- package/skills/secrets-management/SKILL.md +34 -0
- package/skills/security-audit/SKILL.md +34 -0
- package/skills/selective-memory/SKILL.md +34 -0
- package/skills/semantic-search/SKILL.md +34 -0
- package/skills/semantic-versioning/SKILL.md +34 -0
- package/skills/sentiment-analysis/SKILL.md +34 -0
- package/skills/seo-optimization/SKILL.md +34 -0
- package/skills/snippet-manager/SKILL.md +34 -0
- package/skills/sprint-planning/SKILL.md +34 -0
- package/skills/sql-query-optimization/SKILL.md +34 -0
- package/skills/stakeholder-communication/SKILL.md +34 -0
- package/skills/state-management/SKILL.md +34 -0
- package/skills/statistical-analysis/SKILL.md +34 -0
- package/skills/streaming-responses/SKILL.md +34 -0
- package/skills/structured-output/SKILL.md +34 -0
- package/skills/summarization-techniques/SKILL.md +34 -0
- package/skills/system-diagnostics/SKILL.md +34 -0
- package/skills/task-decomposition/SKILL.md +34 -0
- package/skills/task-prioritization/SKILL.md +34 -0
- package/skills/template-library/SKILL.md +34 -0
- package/skills/test-generation/SKILL.md +34 -0
- package/skills/testing-strategy/SKILL.md +34 -0
- package/skills/text-expansion/SKILL.md +34 -0
- package/skills/time-blocking/SKILL.md +34 -0
- package/skills/token-budgeting/SKILL.md +34 -0
- package/skills/token-optimization/SKILL.md +34 -0
- package/skills/tool-calling-patterns/SKILL.md +34 -0
- package/skills/vector-database-setup/SKILL.md +34 -0
- package/skills/video-editing/SKILL.md +34 -0
- package/skills/visualization-creation/SKILL.md +34 -0
- package/skills/web-scraping/SKILL.md +34 -0
- package/skills/webhook-handling/SKILL.md +34 -0
- package/skills/weekly-review/SKILL.md +34 -0
- package/skills/workflow-automation/SKILL.md +34 -0
- package/src/commands/code_v5.js +377 -73
- package/src/commands/help.js +3 -1
- package/src/commands/naturehub.js +105 -55
- package/src/commands/repl.js +506 -87
- package/src/providers/model/anthropic.js +84 -0
- package/src/providers/model/gemini.js +49 -0
- package/src/providers/model/minimax.js +48 -0
- package/src/providers/model/ollama.js +42 -0
- package/src/providers/model/openai.js +49 -0
- package/src/providers/search/duckduckgo.js +45 -0
- package/src/providers/search/exa.js +52 -0
- package/src/providers/search/searxng.js +51 -0
- package/src/providers/search/tavily.js +47 -0
- package/src/tools/model_provider.js +71 -0
- package/src/tools/parallel_search.js +40 -49
- package/src/tools/search_provider.js +79 -0
- package/src/tools/web_search.js +42 -62
- package/src/tools/workflow.js +27 -10
- package/src/utils/cron.js +82 -126
- package/src/utils/effort-levels.js +42 -0
- package/src/utils/fallback-chain.js +72 -0
- package/src/utils/file-history.js +78 -0
- package/src/utils/model-provider.js +113 -0
- package/src/utils/permissions.js +147 -0
- package/src/utils/plan-mode.js +164 -0
- package/src/utils/provider-detect.js +7 -32
- package/src/utils/sandbox.js +60 -0
- package/src/utils/search-provider.js +62 -0
- package/src/utils/session-search.js +66 -0
- package/src/utils/structured-output.js +20 -0
- package/src/utils/system-prompt.js +28 -2
- package/src/utils/tasks.js +132 -0
- package/src/utils/tool-hooks.js +154 -0
- package/src/utils/tools.js +16 -0
- package/src/utils/ultra-review.js +59 -0
- package/src/utils/worktree.js +192 -0
|
@@ -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 };
|