@haposoft/cafekit 0.9.4 → 0.9.5
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/bin/install.js +30 -54
- package/package.json +1 -1
- package/src/claude/CLAUDE.md +5 -7
package/bin/install.js
CHANGED
|
@@ -1024,47 +1024,25 @@ async function promptAddressingConfig() {
|
|
|
1024
1024
|
output: process.stdout
|
|
1025
1025
|
});
|
|
1026
1026
|
|
|
1027
|
-
console.log('\n🎯 Xưng hô (Addressing Configuration)');
|
|
1028
|
-
console.log(' CafeKit có thể cấu hình cách AI xưng hô khi giao tiếp tiếng Việt');
|
|
1029
|
-
console.log(' • Mục đích: Phát hiện context overflow (khi AI đột nhiên đổi cách xưng hô)');
|
|
1030
|
-
console.log(' • Để trống = dùng mặc định (em/anh)');
|
|
1031
|
-
console.log();
|
|
1032
|
-
|
|
1033
1027
|
return new Promise((resolve) => {
|
|
1034
|
-
rl.question('AI
|
|
1035
|
-
|
|
1028
|
+
rl.question('\nHow should the AI address you? (e.g. boss, sir, master - Enter to skip): ', (answer) => {
|
|
1029
|
+
rl.close();
|
|
1030
|
+
const userAddress = answer.trim();
|
|
1036
1031
|
|
|
1037
|
-
//
|
|
1038
|
-
if (!
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
}
|
|
1042
|
-
firstPerson = 'em';
|
|
1032
|
+
// Blank = skip, no addressing configured
|
|
1033
|
+
if (!userAddress || userAddress.length === 0) {
|
|
1034
|
+
resolve({ enabled: false, userAddress: '' });
|
|
1035
|
+
return;
|
|
1043
1036
|
}
|
|
1044
1037
|
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
console.log(' ⚠ Xưng hô không hợp lệ, dùng mặc định: anh');
|
|
1052
|
-
}
|
|
1053
|
-
secondPerson = 'anh';
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
rl.question('Bật xưng hô? (Y/n, Enter=Y): ', (enableAnswer) => {
|
|
1057
|
-
rl.close();
|
|
1058
|
-
const enabled = enableAnswer.trim().toLowerCase();
|
|
1059
|
-
const isEnabled = enabled === '' || enabled === 'y' || enabled === 'yes';
|
|
1038
|
+
// Validate: letters and spaces only
|
|
1039
|
+
if (/[^a-zA-ZÀ-ỹ\s]/.test(userAddress)) {
|
|
1040
|
+
console.log(' ⚠ Invalid input (letters only), skipping addressing setup');
|
|
1041
|
+
resolve({ enabled: false, userAddress: '' });
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1060
1044
|
|
|
1061
|
-
|
|
1062
|
-
enabled: isEnabled,
|
|
1063
|
-
firstPerson: firstPerson,
|
|
1064
|
-
secondPerson: secondPerson
|
|
1065
|
-
});
|
|
1066
|
-
});
|
|
1067
|
-
});
|
|
1045
|
+
resolve({ enabled: true, userAddress: userAddress });
|
|
1068
1046
|
});
|
|
1069
1047
|
});
|
|
1070
1048
|
}
|
|
@@ -1078,14 +1056,20 @@ function configureAddressing(addressingConfig, platforms = ['claude']) {
|
|
|
1078
1056
|
targets.push('.claude');
|
|
1079
1057
|
}
|
|
1080
1058
|
|
|
1081
|
-
// Helper function to safely capitalize
|
|
1059
|
+
// Helper function to safely capitalize first letter
|
|
1082
1060
|
function capitalize(str) {
|
|
1083
1061
|
if (!str || str.length === 0) return str;
|
|
1084
1062
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1085
1063
|
}
|
|
1086
1064
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1065
|
+
// Skip if addressing not enabled (user left blank or invalid input)
|
|
1066
|
+
if (!addressingConfig.enabled || !addressingConfig.userAddress) {
|
|
1067
|
+
console.log(' → Bỏ qua thiết lập xưng hô');
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
const userAddress = addressingConfig.userAddress;
|
|
1072
|
+
const userAddressCap = capitalize(userAddress);
|
|
1089
1073
|
|
|
1090
1074
|
for (const folder of targets) {
|
|
1091
1075
|
try {
|
|
@@ -1102,21 +1086,18 @@ function configureAddressing(addressingConfig, platforms = ['claude']) {
|
|
|
1102
1086
|
// Build the addressing section
|
|
1103
1087
|
const addressingSection = `## Xưng hô (Addressing - Context Overflow Indicator)
|
|
1104
1088
|
|
|
1105
|
-
Khi giao tiếp bằng tiếng Việt
|
|
1106
|
-
|
|
1107
|
-
- Luôn hô "${addressingConfig.secondPerson}" (người dùng)
|
|
1108
|
-
- Duy trì xưng hô nhất quán trong toàn bộ conversation
|
|
1089
|
+
Khi giao tiếp bằng tiếng Việt, AI luôn gọi người dùng là "${userAddress}".
|
|
1090
|
+
Duy trì cách gọi này nhất quán trong toàn bộ conversation.
|
|
1109
1091
|
|
|
1110
|
-
**Ví dụ:** "${
|
|
1092
|
+
**Ví dụ:** "${userAddressCap} cần sửa dòng 45 trong file này."
|
|
1111
1093
|
|
|
1112
1094
|
**⚠️ Context Overflow Detection:**
|
|
1113
|
-
Nếu
|
|
1114
|
-
"
|
|
1095
|
+
Nếu AI đột nhiên không còn gọi người dùng là "${userAddress}", đây là dấu hiệu context window đã bị compact/truncate. Hãy thông báo ngay:
|
|
1096
|
+
"Context có thể đã bị compact. ${userAddressCap} có thể cần /clear để reset session."
|
|
1115
1097
|
|
|
1116
1098
|
**Lưu ý:** Xưng hô được thiết lập khi cài đặt CafeKit và lưu trực tiếp trong file CLAUDE.md này. Để thay đổi, chỉnh sửa section này hoặc chạy lại installer.`;
|
|
1117
1099
|
|
|
1118
|
-
// Match from ## Xưng hô to the
|
|
1119
|
-
// This regex matches the entire section including the final newline after "Lưu ý:" paragraph
|
|
1100
|
+
// Match from ## Xưng hô to the next ## header or end of file
|
|
1120
1101
|
const regex = /## Xưng hô \(Addressing - Context Overflow Indicator\)[\s\S]*?(?=\n##|\n*$)/;
|
|
1121
1102
|
|
|
1122
1103
|
if (regex.test(content)) {
|
|
@@ -1131,12 +1112,7 @@ Nếu bạn (AI) đột nhiên không thể nhớ hoặc tuân thủ quy tắc x
|
|
|
1131
1112
|
}
|
|
1132
1113
|
|
|
1133
1114
|
fs.writeFileSync(claudeMdFile, content, 'utf8');
|
|
1134
|
-
|
|
1135
|
-
if (addressingConfig.enabled) {
|
|
1136
|
-
console.log(` ✓ Xưng hô configured in CLAUDE.md: ${addressingConfig.firstPerson}/${addressingConfig.secondPerson}`);
|
|
1137
|
-
} else {
|
|
1138
|
-
console.log(` ✓ Xưng hô disabled in CLAUDE.md`);
|
|
1139
|
-
}
|
|
1115
|
+
console.log(` ✓ Xưng hô configured in CLAUDE.md: AI gọi user là "${userAddress}"`);
|
|
1140
1116
|
} catch (error) {
|
|
1141
1117
|
console.error(` ✗ Failed to configure addressing in ${folder}/CLAUDE.md`);
|
|
1142
1118
|
console.error(` Error: ${error.message}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haposoft/cafekit",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"description": "Claude Code-first spec-driven workflow for AI coding assistants. Bundles CafeKit hapo: skills, runtime hooks, agents, and installer scaffolding.",
|
|
5
5
|
"author": "Haposoft <nghialt@haposoft.com>",
|
|
6
6
|
"license": "MIT",
|
package/src/claude/CLAUDE.md
CHANGED
|
@@ -129,15 +129,13 @@ When generating specs or structured project output, use the user's preferred lan
|
|
|
129
129
|
|
|
130
130
|
## Xưng hô (Addressing - Context Overflow Indicator)
|
|
131
131
|
|
|
132
|
-
Khi giao tiếp bằng tiếng Việt
|
|
133
|
-
|
|
134
|
-
- Luôn hô "anh" (người dùng)
|
|
135
|
-
- Duy trì xưng hô nhất quán trong toàn bộ conversation
|
|
132
|
+
Khi giao tiếp bằng tiếng Việt, AI luôn gọi người dùng là "anh".
|
|
133
|
+
Duy trì cách gọi này nhất quán trong toàn bộ conversation.
|
|
136
134
|
|
|
137
|
-
**Ví dụ:** "
|
|
135
|
+
**Ví dụ:** "Anh cần sửa dòng 45 trong file này."
|
|
138
136
|
|
|
139
137
|
**⚠️ Context Overflow Detection:**
|
|
140
|
-
Nếu
|
|
141
|
-
"
|
|
138
|
+
Nếu AI đột nhiên không còn gọi người dùng là "anh", đây là dấu hiệu context window đã bị compact/truncate. Hãy thông báo ngay:
|
|
139
|
+
"Context có thể đã bị compact. Anh có thể cần /clear để reset session."
|
|
142
140
|
|
|
143
141
|
**Lưu ý:** Xưng hô được thiết lập khi cài đặt CafeKit và lưu trực tiếp trong file CLAUDE.md này. Để thay đổi, chỉnh sửa section này hoặc chạy lại installer.
|