vibecodingmachine-core 2025.12.22-2230 → 2025.12.24-2348

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibecodingmachine-core",
3
- "version": "2025.12.22-2230",
3
+ "version": "2025.12.24-2348",
4
4
  "description": "Shared core logic for Vibe Coding Machine IDE integration",
5
5
  "main": "src/index.cjs",
6
6
  "module": "src/index.js",
@@ -2,6 +2,7 @@
2
2
  // Handles AppleScript-based interactions with IDEs that don't support CDP
3
3
 
4
4
  const { execSync } = require('child_process');
5
+ const { t } = require('../localization');
5
6
 
6
7
  /**
7
8
  * AppleScript Manager for IDE interactions
@@ -336,7 +337,7 @@ class AppleScriptManager {
336
337
 
337
338
  const ideName = ide === 'windsurf' ? 'Windsurf' : ide === 'cursor' ? 'Cursor' : ide === 'antigravity' ? 'Antigravity' : ide === 'kiro' ? 'AWS Kiro' : 'Unknown IDE';
338
339
 
339
- this.logger.log(`${ideName} detected - using AppleScript for reliable text sending`);
340
+ this.logger.log(t('auto.direct.ide.detected', { ide: ideName }));
340
341
 
341
342
  try {
342
343
  let appleScript;
@@ -489,7 +490,7 @@ class AppleScriptManager {
489
490
 
490
491
  execSync(`osascript -e '${appleScript}'`, { stdio: 'pipe' });
491
492
 
492
- this.logger.log(`Successfully sent message to ${ideName} via AppleScript`);
493
+ this.logger.log(t('auto.direct.ide.sent.applescript', { ide: ideName }));
493
494
  return {
494
495
  success: true,
495
496
  method: 'applescript',
package/src/index.cjs CHANGED
@@ -22,6 +22,7 @@ const requirementHelpers = require('./utils/requirement-helpers.js');
22
22
  const requirementsParser = require('./utils/requirements-parser.js');
23
23
  const updateChecker = require('./utils/update-checker.js');
24
24
  const electronUpdateChecker = require('./utils/electron-update-checker.js');
25
+ const localization = require('./localization/index.js');
25
26
 
26
27
  module.exports = {
27
28
  CDPManager,
@@ -45,5 +46,6 @@ module.exports = {
45
46
  ...requirementHelpers,
46
47
  ...requirementsParser,
47
48
  ...updateChecker,
48
- ...electronUpdateChecker
49
+ ...electronUpdateChecker,
50
+ ...localization
49
51
  };
package/src/index.js CHANGED
@@ -21,3 +21,6 @@ export { CompliancePrompt };
21
21
  export * from './ui/ButtonComponents.js';
22
22
  export * from './ui/StateManager.js';
23
23
  export { ChatInterface } from './ui/ChatInterface.js';
24
+
25
+ // Localization
26
+ export * from './localization/index.js';
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Shared Localization System for Vibe Coding Machine
3
+ * Used by both CLI and GUI applications
4
+ */
5
+
6
+ const os = require('os');
7
+
8
+ // Supported locales
9
+ const SUPPORTED_LOCALES = ['en', 'es'];
10
+ const DEFAULT_LOCALE = 'en';
11
+
12
+ // Language names mapping
13
+ const LANGUAGE_NAMES = {
14
+ 'en': 'English',
15
+ 'es': 'Spanish'
16
+ };
17
+
18
+ /**
19
+ * Get supported language names
20
+ * @returns {Object} Object mapping locale codes to language names
21
+ */
22
+ function getSupportedLanguageNames() {
23
+ return { ...LANGUAGE_NAMES };
24
+ }
25
+
26
+ /**
27
+ * Get language display name
28
+ * @param {string} languageCode - Language code
29
+ * @returns {string} Display name for the language
30
+ */
31
+ function getLanguageDisplayName(languageCode) {
32
+ if (!languageCode) return 'Not Set';
33
+ return LANGUAGE_NAMES[languageCode] || languageCode;
34
+ }
35
+
36
+ /**
37
+ * Check if a language is supported
38
+ * @param {string} languageCode - Language code to check
39
+ * @returns {boolean} True if language is supported
40
+ */
41
+ function isLanguageSupported(languageCode) {
42
+ return SUPPORTED_LOCALES.includes(languageCode);
43
+ }
44
+
45
+ /**
46
+ * Detect user's preferred locale
47
+ * @returns {string} Locale code (e.g., 'en', 'es')
48
+ */
49
+ function detectLocale() {
50
+ // Check environment variables first
51
+ const envLocale = process.env.LANG || process.env.LC_ALL || process.env.LC_MESSAGES;
52
+ if (envLocale) {
53
+ const locale = envLocale.split('.')[0].split('_')[0].toLowerCase();
54
+ if (SUPPORTED_LOCALES.includes(locale)) {
55
+ return locale;
56
+ }
57
+ }
58
+
59
+ // Check system locale (Node.js)
60
+ try {
61
+ const systemLocale = Intl.DateTimeFormat().resolvedOptions().locale;
62
+ const locale = systemLocale.split('-')[0].toLowerCase();
63
+ if (SUPPORTED_LOCALES.includes(locale)) {
64
+ return locale;
65
+ }
66
+ } catch (error) {
67
+ // Fallback if Intl is not available
68
+ }
69
+
70
+ return DEFAULT_LOCALE;
71
+ }
72
+
73
+ /**
74
+ * Get current locale
75
+ * @returns {string} Current locale
76
+ */
77
+ function getCurrentLocale() {
78
+ return global._vibecodingmachine_locale || detectLocale();
79
+ }
80
+
81
+ /**
82
+ * Set current locale
83
+ * @param {string} locale - Locale to set
84
+ */
85
+ function setLocale(locale) {
86
+ if (SUPPORTED_LOCALES.includes(locale)) {
87
+ global._vibecodingmachine_locale = locale;
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Translate a text string
93
+ * @param {string} key - Translation key
94
+ * @param {Object} params - Parameters for interpolation
95
+ * @returns {string} Translated text
96
+ */
97
+ function t(key, params = {}) {
98
+ const locale = getCurrentLocale();
99
+ const translations = getTranslations(locale);
100
+
101
+ let text = translations[key] || key;
102
+
103
+ // Simple parameter interpolation
104
+ if (params && typeof params === 'object') {
105
+ Object.keys(params).forEach(param => {
106
+ text = text.replace(new RegExp(`\\{${param}\\}`, 'g'), params[param]);
107
+ });
108
+ }
109
+
110
+ return text;
111
+ }
112
+
113
+ /**
114
+ * Get translations for a specific locale
115
+ * @param {string} locale - Locale code
116
+ * @returns {Object} Translation object
117
+ */
118
+ function getTranslations(locale) {
119
+ switch (locale) {
120
+ case 'es':
121
+ return require('./translations/es');
122
+ case 'en':
123
+ default:
124
+ return require('./translations/en');
125
+ }
126
+ }
127
+
128
+ /**
129
+ * Get available locales
130
+ * @returns {Array} Array of supported locale codes
131
+ */
132
+ function getAvailableLocales() {
133
+ return [...SUPPORTED_LOCALES];
134
+ }
135
+
136
+ module.exports = {
137
+ t,
138
+ getCurrentLocale,
139
+ setLocale,
140
+ detectLocale,
141
+ getAvailableLocales,
142
+ getSupportedLanguageNames,
143
+ getLanguageDisplayName,
144
+ isLanguageSupported,
145
+ SUPPORTED_LOCALES,
146
+ DEFAULT_LOCALE,
147
+ LANGUAGE_NAMES
148
+ };