@haposoft/cafekit 0.9.5 → 0.9.6
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 +32 -53
- package/package.json +1 -1
- package/src/claude/CLAUDE.md +1 -10
package/bin/install.js
CHANGED
|
@@ -1048,18 +1048,10 @@ async function promptAddressingConfig() {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
|
|
1050
1050
|
function configureAddressing(addressingConfig, platforms = ['claude']) {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
if (targets.length === 0) {
|
|
1056
|
-
targets.push('.claude');
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
// Helper function to safely capitalize first letter
|
|
1060
|
-
function capitalize(str) {
|
|
1061
|
-
if (!str || str.length === 0) return str;
|
|
1062
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1051
|
+
// CLAUDE.md is installed at the project root (see copyClaudeMdFile),
|
|
1052
|
+
// and only the Claude platform ships it. Skip if Claude isn't installed.
|
|
1053
|
+
if (!platforms.includes('claude')) {
|
|
1054
|
+
return;
|
|
1063
1055
|
}
|
|
1064
1056
|
|
|
1065
1057
|
// Skip if addressing not enabled (user left blank or invalid input)
|
|
@@ -1069,56 +1061,43 @@ function configureAddressing(addressingConfig, platforms = ['claude']) {
|
|
|
1069
1061
|
}
|
|
1070
1062
|
|
|
1071
1063
|
const userAddress = addressingConfig.userAddress;
|
|
1072
|
-
const userAddressCap = capitalize(userAddress);
|
|
1073
|
-
|
|
1074
|
-
for (const folder of targets) {
|
|
1075
|
-
try {
|
|
1076
|
-
const targetDir = path.join(process.cwd(), folder);
|
|
1077
|
-
const claudeMdFile = path.join(targetDir, 'CLAUDE.md');
|
|
1078
1064
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
continue;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
let content = fs.readFileSync(claudeMdFile, 'utf8');
|
|
1085
|
-
|
|
1086
|
-
// Build the addressing section
|
|
1087
|
-
const addressingSection = `## Xưng hô (Addressing - Context Overflow Indicator)
|
|
1065
|
+
try {
|
|
1066
|
+
const claudeMdFile = path.join(process.cwd(), 'CLAUDE.md');
|
|
1088
1067
|
|
|
1089
|
-
|
|
1090
|
-
|
|
1068
|
+
if (!fs.existsSync(claudeMdFile)) {
|
|
1069
|
+
console.log(' ⚠ CLAUDE.md not found at project root');
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1091
1072
|
|
|
1092
|
-
|
|
1073
|
+
let content = fs.readFileSync(claudeMdFile, 'utf8');
|
|
1093
1074
|
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
"Context có thể đã bị compact. ${userAddressCap} có thể cần /clear để reset session."
|
|
1075
|
+
// Build the addressing section (short instruction + user-chosen term)
|
|
1076
|
+
const addressingSection = `## Xưng hô (Addressing - Context Overflow Indicator)
|
|
1097
1077
|
|
|
1098
|
-
|
|
1078
|
+
AI luôn gọi người dùng là "${userAddress}" trong suốt conversation. Nếu AI ngừng gọi như vậy, đó là dấu hiệu context đã bị compact — hãy báo người dùng cân nhắc \`/clear\`.`;
|
|
1099
1079
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1080
|
+
// Match from ## Xưng hô to the next ## header or end of file
|
|
1081
|
+
const regex = /## Xưng hô \(Addressing - Context Overflow Indicator\)[\s\S]*?(?=\n##|\n*$)/;
|
|
1102
1082
|
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
}
|
|
1111
|
-
content += '\n' + addressingSection + '\n';
|
|
1083
|
+
if (regex.test(content)) {
|
|
1084
|
+
// Replace existing section
|
|
1085
|
+
content = content.replace(regex, addressingSection);
|
|
1086
|
+
} else {
|
|
1087
|
+
// Append at the end
|
|
1088
|
+
if (!content.endsWith('\n')) {
|
|
1089
|
+
content += '\n';
|
|
1112
1090
|
}
|
|
1091
|
+
content += '\n' + addressingSection + '\n';
|
|
1092
|
+
}
|
|
1113
1093
|
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
}
|
|
1094
|
+
fs.writeFileSync(claudeMdFile, content, 'utf8');
|
|
1095
|
+
console.log(` ✓ Xưng hô configured in CLAUDE.md: AI gọi user là "${userAddress}"`);
|
|
1096
|
+
} catch (error) {
|
|
1097
|
+
console.error(' ✗ Failed to configure addressing in CLAUDE.md');
|
|
1098
|
+
console.error(` Error: ${error.message}`);
|
|
1099
|
+
if (process.env.DEBUG) {
|
|
1100
|
+
console.error(error.stack);
|
|
1122
1101
|
}
|
|
1123
1102
|
}
|
|
1124
1103
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haposoft/cafekit",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
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,13 +129,4 @@ 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
|
-
|
|
133
|
-
Duy trì cách gọi này nhất quán trong toàn bộ conversation.
|
|
134
|
-
|
|
135
|
-
**Ví dụ:** "Anh cần sửa dòng 45 trong file này."
|
|
136
|
-
|
|
137
|
-
**⚠️ Context Overflow Detection:**
|
|
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."
|
|
140
|
-
|
|
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.
|
|
132
|
+
AI luôn gọi người dùng là "anh" trong suốt conversation. Nếu AI ngừng gọi như vậy, đó là dấu hiệu context đã bị compact — hãy báo người dùng cân nhắc `/clear`.
|