@onurege3467/zerohelper 6.1.0 → 7.0.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.
@@ -0,0 +1,151 @@
1
+ {
2
+ "excluded_patterns": [
3
+ ".git",
4
+ ".gitignore",
5
+ "gradle",
6
+ "gradlew",
7
+ "gradlew.*",
8
+ "node_modules",
9
+ ".snapshots",
10
+ ".idea",
11
+ ".vscode",
12
+ "*.log",
13
+ "*.tmp",
14
+ "target",
15
+ "dist",
16
+ "build",
17
+ ".DS_Store",
18
+ "*.bak",
19
+ "*.swp",
20
+ "*.swo",
21
+ "*.lock",
22
+ "*.iml",
23
+ "coverage",
24
+ "*.min.js",
25
+ "*.min.css",
26
+ "__pycache__",
27
+ ".marketing",
28
+ ".env",
29
+ ".env.*",
30
+ "*.jpg",
31
+ "*.jpeg",
32
+ "*.png",
33
+ "*.gif",
34
+ "*.bmp",
35
+ "*.tiff",
36
+ "*.ico",
37
+ "*.svg",
38
+ "*.webp",
39
+ "*.psd",
40
+ "*.ai",
41
+ "*.eps",
42
+ "*.indd",
43
+ "*.raw",
44
+ "*.cr2",
45
+ "*.nef",
46
+ "*.mp4",
47
+ "*.mov",
48
+ "*.avi",
49
+ "*.wmv",
50
+ "*.flv",
51
+ "*.mkv",
52
+ "*.webm",
53
+ "*.m4v",
54
+ "*.wfp",
55
+ "*.prproj",
56
+ "*.aep",
57
+ "*.psb",
58
+ "*.xcf",
59
+ "*.sketch",
60
+ "*.fig",
61
+ "*.xd",
62
+ "*.db",
63
+ "*.sqlite",
64
+ "*.sqlite3",
65
+ "*.mdb",
66
+ "*.accdb",
67
+ "*.frm",
68
+ "*.myd",
69
+ "*.myi",
70
+ "*.ibd",
71
+ "*.dbf",
72
+ "*.rdb",
73
+ "*.aof",
74
+ "*.pdb",
75
+ "*.sdb",
76
+ "*.s3db",
77
+ "*.ddb",
78
+ "*.db-shm",
79
+ "*.db-wal",
80
+ "*.sqlitedb",
81
+ "*.sql.gz",
82
+ "*.bak.sql",
83
+ "dump.sql",
84
+ "dump.rdb",
85
+ "*.vsix",
86
+ "*.jar",
87
+ "*.war",
88
+ "*.ear",
89
+ "*.zip",
90
+ "*.tar",
91
+ "*.tar.gz",
92
+ "*.tgz",
93
+ "*.rar",
94
+ "*.7z",
95
+ "*.exe",
96
+ "*.dll",
97
+ "*.so",
98
+ "*.dylib",
99
+ "*.app",
100
+ "*.dmg",
101
+ "*.iso",
102
+ "*.msi",
103
+ "*.deb",
104
+ "*.rpm",
105
+ "*.apk",
106
+ "*.aab",
107
+ "*.ipa",
108
+ "*.pkg",
109
+ "*.nupkg",
110
+ "*.snap",
111
+ "*.whl",
112
+ "*.gem",
113
+ "*.pyc",
114
+ "*.pyo",
115
+ "*.pyd",
116
+ "*.class",
117
+ "*.o",
118
+ "*.obj",
119
+ "*.lib",
120
+ "*.a",
121
+ "*.map",
122
+ ".npmrc"
123
+ ],
124
+ "default": {
125
+ "default_prompt": "Enter your prompt here",
126
+ "default_include_all_files": false,
127
+ "default_include_entire_project_structure": true
128
+ },
129
+ "included_patterns": [
130
+ "build.gradle",
131
+ "settings.gradle",
132
+ "gradle.properties",
133
+ "pom.xml",
134
+ "Makefile",
135
+ "CMakeLists.txt",
136
+ "package.json",
137
+ "requirements.txt",
138
+ "Pipfile",
139
+ "Gemfile",
140
+ "composer.json",
141
+ ".editorconfig",
142
+ ".eslintrc.json",
143
+ ".eslintrc.js",
144
+ ".prettierrc",
145
+ ".babelrc",
146
+ ".dockerignore",
147
+ ".gitattributes",
148
+ ".stylelintrc",
149
+ ".npmrc"
150
+ ]
151
+ }
@@ -0,0 +1,11 @@
1
+ # Snapshots Directory
2
+
3
+ This directory contains snapshots of your code for AI interactions. Each snapshot is a markdown file that includes relevant code context and project structure information.
4
+
5
+ ## What's included in snapshots?
6
+ - Selected code files and their contents
7
+ - Project structure (if enabled)
8
+ - Your prompt/question for the AI
9
+
10
+ ## Configuration
11
+ You can customize snapshot behavior in `config.json`.
@@ -0,0 +1,44 @@
1
+ # Thank you for using Snapshots for AI
2
+
3
+ Thanks for using Snapshots for AI. We hope this tool has helped you solve a problem or two.
4
+
5
+ If you would like to support our work, please help us by considering the following offers and requests:
6
+
7
+ ## Ways to Support
8
+
9
+ ### Join the GBTI Network!!! 🙏🙏🙏
10
+ The GBTI Network is a community of developers who are passionate about open source and community-driven development. Members enjoy access to exclussive tools, resources, a private MineCraft server, a listing in our members directory, co-op opportunities and more.
11
+
12
+ - Support our work by becoming a [GBTI Network member](https://gbti.network/membership/).
13
+
14
+ ### Try out BugHerd 🐛
15
+ BugHerd is a visual feedback and bug-tracking tool designed to streamline website development by enabling users to pin feedback directly onto web pages. This approach facilitates clear communication among clients, designers, developers, and project managers.
16
+
17
+ - Start your free trial with [BugHerd](https://partners.bugherd.com/55z6c8az8rvr) today.
18
+
19
+ ### Hire Developers from Codeable 👥
20
+ Codeable connects you with top-tier professionals skilled in frameworks and technologies such as Laravel, React, Django, Node, Vue.js, Angular, Ruby on Rails, and Node.js. Don't let the WordPress focus discourage you. Codeable experts do it all.
21
+
22
+ - Visit [Codeable](https://www.codeable.io/developers/?ref=z8h3e) to hire your next team member.
23
+
24
+ ### Lead positive reviews on our marketplace listing ⭐⭐⭐⭐⭐
25
+ - Rate us on [VSCode marketplace](https://marketplace.visualstudio.com/items?itemName=GBTI.snapshots-for-ai)
26
+ - Review us on [Cursor marketplace](https://open-vsx.org/extension/GBTI/snapshots-for-ai)
27
+
28
+ ### Star Our GitHub Repository ⭐
29
+ - Star and watch our [repository](https://github.com/gbti-network/vscode-snapshots-for-ai)
30
+
31
+ ### 📡 Stay Connected
32
+ Follow us on your favorite platforms for updates, news, and community discussions:
33
+ - **[Twitter/X](https://twitter.com/gbti_network)**
34
+ - **[GitHub](https://github.com/gbti-network)**
35
+ - **[YouTube](https://www.youtube.com/channel/UCh4FjB6r4oWQW-QFiwqv-UA)**
36
+ - **[Dev.to](https://dev.to/gbti)**
37
+ - **[Daily.dev](https://dly.to/zfCriM6JfRF)**
38
+ - **[Hashnode](https://gbti.hashnode.dev/)**
39
+ - **[Discord Community](https://gbti.network)**
40
+ - **[Reddit Community](https://www.reddit.com/r/GBTI_network)**
41
+
42
+ ---
43
+
44
+ Thank you for supporting open source software! 🙏
@@ -0,0 +1,3 @@
1
+ {
2
+ "users": []
3
+ }
Binary file
Binary file
package/database/index.js CHANGED
@@ -3,12 +3,14 @@ const MySQLDatabase = require('./mysql');
3
3
  const SQLiteDatabase = require('./sqlite');
4
4
  const MongoDBDatabase = require('./mongodb');
5
5
  const JsonDatabase = require('./json');
6
+ const PostgreSQLDatabase = require('./pg');
6
7
  const CacheWrapper = require('./cacheWrapper');
7
8
 
8
9
  const adapters = {
9
10
  mysql: MySQLDatabase,
10
11
  sqlite: SQLiteDatabase,
11
12
  mongodb: MongoDBDatabase,
13
+ postgres: PostgreSQLDatabase,
12
14
  json: JsonDatabase,
13
15
  };
14
16
 
package/database/mysql.js CHANGED
@@ -64,6 +64,111 @@ class MySQLDatabase extends IDatabase{
64
64
  });
65
65
  }
66
66
 
67
+ /**
68
+ * Değerin türüne göre MySQL column türünü otomatik belirler
69
+ */
70
+ _getColumnType(value) {
71
+ if (value === null || value === undefined) {
72
+ return 'TEXT'; // Null değerler için varsayılan
73
+ }
74
+
75
+ if (typeof value === 'boolean') {
76
+ return 'BOOLEAN';
77
+ }
78
+
79
+ if (typeof value === 'number') {
80
+ if (Number.isInteger(value)) {
81
+ // Integer range kontrolü
82
+ if (value >= -128 && value <= 127) {
83
+ return 'TINYINT';
84
+ } else if (value >= -32768 && value <= 32767) {
85
+ return 'SMALLINT';
86
+ } else if (value >= -2147483648 && value <= 2147483647) {
87
+ return 'INT';
88
+ } else {
89
+ return 'BIGINT';
90
+ }
91
+ } else {
92
+ // Float/Double için
93
+ return 'DOUBLE';
94
+ }
95
+ }
96
+
97
+ if (typeof value === 'string') {
98
+ const length = value.length;
99
+ if (length <= 255) {
100
+ return 'VARCHAR(255)';
101
+ } else if (length <= 65535) {
102
+ return 'TEXT';
103
+ } else if (length <= 16777215) {
104
+ return 'MEDIUMTEXT';
105
+ } else {
106
+ return 'LONGTEXT';
107
+ }
108
+ }
109
+
110
+ if (typeof value === 'object') {
111
+ // Array ve Object'ler JSON olarak saklanır
112
+ const jsonString = JSON.stringify(value);
113
+ const length = jsonString.length;
114
+ if (length <= 65535) {
115
+ return 'JSON';
116
+ } else {
117
+ return 'LONGTEXT';
118
+ }
119
+ }
120
+
121
+ if (value instanceof Date) {
122
+ return 'DATETIME';
123
+ }
124
+
125
+ // Varsayılan
126
+ return 'TEXT';
127
+ }
128
+
129
+ /**
130
+ * Birden fazla değere göre en uygun column türünü belirler
131
+ */
132
+ _getBestColumnType(values) {
133
+ const types = values.map(val => this._getColumnType(val));
134
+ const uniqueTypes = [...new Set(types)];
135
+
136
+ // Eğer hepsi aynı türse, o türü kullan
137
+ if (uniqueTypes.length === 1) {
138
+ return uniqueTypes[0];
139
+ }
140
+
141
+ // Mixed türler için öncelik sırası
142
+ const typePriority = {
143
+ 'LONGTEXT': 10,
144
+ 'MEDIUMTEXT': 9,
145
+ 'TEXT': 8,
146
+ 'JSON': 7,
147
+ 'VARCHAR(255)': 6,
148
+ 'DATETIME': 5,
149
+ 'DOUBLE': 4,
150
+ 'BIGINT': 3,
151
+ 'INT': 2,
152
+ 'SMALLINT': 1,
153
+ 'TINYINT': 0,
154
+ 'BOOLEAN': -1
155
+ };
156
+
157
+ // En yüksek öncelikli türü seç
158
+ let bestType = uniqueTypes[0];
159
+ let bestPriority = typePriority[bestType] || 0;
160
+
161
+ for (const type of uniqueTypes) {
162
+ const priority = typePriority[type] || 0;
163
+ if (priority > bestPriority) {
164
+ bestType = type;
165
+ bestPriority = priority;
166
+ }
167
+ }
168
+
169
+ return bestType;
170
+ }
171
+
67
172
  async _queueRequest(operation) {
68
173
  if (this._connected) {
69
174
  return operation();
@@ -98,15 +203,25 @@ class MySQLDatabase extends IDatabase{
98
203
 
99
204
  async ensureTable(table, data = {}) {
100
205
  return this._queueRequest(async () => {
101
-
102
-
103
206
  const escapedTable = mysql.escape(table);
104
207
  const tables = await this.query(`SHOW TABLES LIKE ${escapedTable}`);
105
208
  if (tables.length === 0) {
106
209
  const columnDefinitions = Object.keys(data).map(col => {
107
- const columnType = col.startsWith('int_') ? 'INT' : 'VARCHAR(255)';
210
+ const columnType = this._getColumnType(data[col]);
108
211
  return `\`${col}\` ${columnType}`;
109
- }); let columnsPart = ''; if (columnDefinitions.length > 0) { columnsPart = ', ' + columnDefinitions.join(", "); } const createTableSQL = ` CREATE TABLE \`${table}\` ( _id INT PRIMARY KEY AUTO_INCREMENT ${columnsPart} ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 `;
212
+ });
213
+
214
+ let columnsPart = '';
215
+ if (columnDefinitions.length > 0) {
216
+ columnsPart = ', ' + columnDefinitions.join(", ");
217
+ }
218
+
219
+ const createTableSQL = `
220
+ CREATE TABLE \`${table}\` (
221
+ _id INT PRIMARY KEY AUTO_INCREMENT
222
+ ${columnsPart}
223
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
224
+ `;
110
225
  await this.query(createTableSQL);
111
226
  }
112
227
  });
@@ -128,9 +243,10 @@ class MySQLDatabase extends IDatabase{
128
243
  delete insertData[primaryKeyColumn.Field];
129
244
  }
130
245
 
131
- for (const key of Object.keys(insertData)) { // Iterate over insertData keys
246
+ for (const key of Object.keys(insertData)) {
132
247
  if (!existingNames.includes(key)) {
133
- await this.query(`ALTER TABLE \`${table}\` ADD COLUMN \`${key}\` VARCHAR(255)`);
248
+ const columnType = this._getColumnType(insertData[key]);
249
+ await this.query(`ALTER TABLE \`${table}\` ADD COLUMN \`${key}\` ${columnType}`);
134
250
  }
135
251
  }
136
252
 
@@ -153,9 +269,10 @@ class MySQLDatabase extends IDatabase{
153
269
  const existingColumnNames = existingColumns.map(col => col.Field);
154
270
  for (const key of Object.keys(data)) {
155
271
  if (!existingColumnNames.includes(key)) {
156
- const alterSQL = `ALTER TABLE \`${table}\` ADD COLUMN \`${key}\` VARCHAR(255)`;
272
+ const columnType = this._getColumnType(data[key]);
273
+ const alterSQL = `ALTER TABLE \`${table}\` ADD COLUMN \`${key}\` ${columnType}`;
157
274
  await this.query(alterSQL);
158
- console.log(`Added missing column '${key}' to table '${table}'`);
275
+ console.log(`Added missing column '${key}' to table '${table}' with type ${columnType}`);
159
276
  }
160
277
  }
161
278
  const setString = Object.keys(data).map(k => `\`${k}\` = ?`).join(", ");
@@ -208,9 +325,10 @@ class MySQLDatabase extends IDatabase{
208
325
  const existingColumnNames = existingColumns.map(col => col.Field);
209
326
  for (const key of Object.keys(data)) {
210
327
  if (!existingColumnNames.includes(key)) {
211
- const alterSQL = `ALTER TABLE \`${table}\` ADD COLUMN \`${key}\` VARCHAR(255)`;
328
+ const columnType = this._getColumnType(data[key]);
329
+ const alterSQL = `ALTER TABLE \`${table}\` ADD COLUMN \`${key}\` ${columnType}`;
212
330
  await this.query(alterSQL);
213
- console.log(`Added missing column '${key}' to table '${table}'`);
331
+ console.log(`Added missing column '${key}' to table '${table}' with type ${columnType}`);
214
332
  }
215
333
  }
216
334
  const existing = await this.select(table, where);
@@ -256,9 +374,10 @@ class MySQLDatabase extends IDatabase{
256
374
  const existingColumnNames = existingColumns.map(col => col.Field);
257
375
  for (const key of Object.keys(data)) {
258
376
  if (!existingColumnNames.includes(key)) {
259
- const alterSQL = `ALTER TABLE \`${table}\` ADD COLUMN \`${key}\` VARCHAR(255)`;
377
+ const columnType = this._getColumnType(data[key]);
378
+ const alterSQL = `ALTER TABLE \`${table}\` ADD COLUMN \`${key}\` ${columnType}`;
260
379
  await this.query(alterSQL);
261
- console.log(`Added missing column '${key}' to table '${table}'`);
380
+ console.log(`Added missing column '${key}' to table '${table}' with type ${columnType}`);
262
381
  }
263
382
  }
264
383
  const setString = Object.keys(data).map(k => `\`${k}\` = ?`).join(", ");
@@ -278,15 +397,18 @@ class MySQLDatabase extends IDatabase{
278
397
  const existingColumnNames = existingColumns.map(col => col.Field);
279
398
  const keys = Object.keys(dataArray[0]);
280
399
 
281
- // Eksik kolonları sadece ilk elemana göre kontrol et
400
+ // Eksik kolonları kontrol et ve ekle
282
401
  for (const key of keys) {
283
402
  if (!existingColumnNames.includes(key)) {
284
- await this.query(`ALTER TABLE \`${table}\` ADD COLUMN \`${key}\` VARCHAR(255)`);
403
+ // Tüm değerleri kontrol ederek en uygun türü belirle
404
+ const columnValues = dataArray.map(obj => obj[key]).filter(val => val !== undefined && val !== null);
405
+ const columnType = columnValues.length > 0 ? this._getBestColumnType(columnValues) : 'TEXT';
406
+ await this.query(`ALTER TABLE \`${table}\` ADD COLUMN \`${key}\` ${columnType}`);
285
407
  }
286
408
  }
287
409
 
288
410
  const placeholders = dataArray.map(() => `(${keys.map(() => '?').join(',')})`).join(',');
289
- const values = dataArray.flatMap(obj => keys.map(k => obj[k]));
411
+ const values = dataArray.flatMap(obj => keys.map(k => this._serializeValue(obj[k])));
290
412
  const sql = `INSERT INTO \`${table}\` (${keys.map(k => `\`${k}\``).join(",")}) VALUES ${placeholders}`;
291
413
 
292
414
  const result = await this.query(sql, values);
@@ -300,6 +422,9 @@ class MySQLDatabase extends IDatabase{
300
422
 
301
423
  // Helper to serialize values for storage
302
424
  _serializeValue(value) {
425
+ if (value instanceof Date) {
426
+ return value.toISOString().slice(0, 19).replace('T', ' '); // MySQL DATETIME format
427
+ }
303
428
  if (Array.isArray(value) || (typeof value === 'object' && value !== null)) {
304
429
  return JSON.stringify(value);
305
430
  }