natureco-cli 5.6.22 → 5.6.23

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/tools/git.js +48 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "5.6.22",
3
+ "version": "5.6.23",
4
4
  "description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
package/src/tools/git.js CHANGED
@@ -18,8 +18,8 @@ module.exports = {
18
18
  },
19
19
 
20
20
  execute({ operation, args = '', message = '' }) {
21
- // v5.6.22: Git repo otomatik bul - cwd'de yoksa ust dizinleri kontrol et
22
- const cwd = this._findGitRepo();
21
+ // v5.6.22: Git repo otomatik bul - this baglami kayboldugu icin module-level helper kullan
22
+ const cwd = findGitRepo();
23
23
  try {
24
24
  let cmd;
25
25
  switch (operation) {
@@ -88,3 +88,49 @@ module.exports = {
88
88
  return process.cwd();
89
89
  }
90
90
  };
91
+
92
+
93
+ /**
94
+ * Git repo bul - cwd'de yoksa ~/Projects ve parent dizinleri tara
95
+ */
96
+ function findGitRepo() {
97
+ const fs = require('fs');
98
+ const path = require('path');
99
+ const os = require('os');
100
+
101
+ if (fs.existsSync(path.join(process.cwd(), '.git'))) {
102
+ return process.cwd();
103
+ }
104
+
105
+ const home = os.homedir();
106
+ const candidates = [
107
+ path.join(home, 'Projects', 'natureco-cli'),
108
+ path.join(home, 'Projects'),
109
+ path.join(home, 'projects'),
110
+ path.join(home, 'code'),
111
+ path.join(home, 'dev'),
112
+ path.join(home, 'src'),
113
+ ];
114
+
115
+ for (const dir of candidates) {
116
+ try {
117
+ if (fs.existsSync(path.join(dir, '.git'))) {
118
+ return dir;
119
+ }
120
+ } catch {}
121
+ }
122
+
123
+ let current = process.cwd();
124
+ for (let i = 0; i < 5; i++) {
125
+ const parent = path.dirname(current);
126
+ if (parent === current) break;
127
+ try {
128
+ if (fs.existsSync(path.join(parent, '.git'))) {
129
+ return parent;
130
+ }
131
+ } catch {}
132
+ current = parent;
133
+ }
134
+
135
+ return process.cwd();
136
+ }