@haposoft/cafekit 0.9.5 → 0.9.7
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 +34 -53
- package/package.json +1 -1
- package/src/claude/CLAUDE.md +2 -11
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,45 @@ 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 = `## Addressing (Context Overflow Indicator)
|
|
1097
1077
|
|
|
1098
|
-
|
|
1078
|
+
The AI always addresses the user as "${userAddress}" throughout the conversation. If the AI stops doing so, it is a sign the context has been compacted/truncated — tell the user to consider \`/clear\`.`;
|
|
1099
1079
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1080
|
+
// Match the addressing section by its shared marker ("Context Overflow
|
|
1081
|
+
// Indicator"), covering both the older Vietnamese heading and the new one,
|
|
1082
|
+
// up to the next ## header or end of file. Keeps reinstall idempotent.
|
|
1083
|
+
const regex = /##[^\n]*Context Overflow Indicator[^\n]*[\s\S]*?(?=\n##|\n*$)/;
|
|
1102
1084
|
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
}
|
|
1111
|
-
content += '\n' + addressingSection + '\n';
|
|
1085
|
+
if (regex.test(content)) {
|
|
1086
|
+
// Replace existing section
|
|
1087
|
+
content = content.replace(regex, addressingSection);
|
|
1088
|
+
} else {
|
|
1089
|
+
// Append at the end
|
|
1090
|
+
if (!content.endsWith('\n')) {
|
|
1091
|
+
content += '\n';
|
|
1112
1092
|
}
|
|
1093
|
+
content += '\n' + addressingSection + '\n';
|
|
1094
|
+
}
|
|
1113
1095
|
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
}
|
|
1096
|
+
fs.writeFileSync(claudeMdFile, content, 'utf8');
|
|
1097
|
+
console.log(` ✓ Addressing configured in CLAUDE.md: AI calls the user "${userAddress}"`);
|
|
1098
|
+
} catch (error) {
|
|
1099
|
+
console.error(' ✗ Failed to configure addressing in CLAUDE.md');
|
|
1100
|
+
console.error(` Error: ${error.message}`);
|
|
1101
|
+
if (process.env.DEBUG) {
|
|
1102
|
+
console.error(error.stack);
|
|
1122
1103
|
}
|
|
1123
1104
|
}
|
|
1124
1105
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haposoft/cafekit",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
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
|
@@ -127,15 +127,6 @@ When generating specs or structured project output, use the user's preferred lan
|
|
|
127
127
|
- Do not provide unsolicited code explanations unless asked.
|
|
128
128
|
- Do not apologize; correct the issue and continue.
|
|
129
129
|
|
|
130
|
-
##
|
|
130
|
+
## 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
|
+
The AI always addresses the user as "anh" throughout the conversation. If the AI stops doing so, it is a sign the context has been compacted/truncated — tell the user to consider `/clear`.
|