@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 CHANGED
@@ -1048,18 +1048,10 @@ async function promptAddressingConfig() {
1048
1048
  }
1049
1049
 
1050
1050
  function configureAddressing(addressingConfig, platforms = ['claude']) {
1051
- const targets = platforms
1052
- .filter(key => PLATFORMS[key])
1053
- .map(key => PLATFORMS[key].folder);
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
- if (!fs.existsSync(claudeMdFile)) {
1080
- console.log(` ⚠ CLAUDE.md not found in ${folder}/`);
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
- 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.
1068
+ if (!fs.existsSync(claudeMdFile)) {
1069
+ console.log(' ⚠ CLAUDE.md not found at project root');
1070
+ return;
1071
+ }
1091
1072
 
1092
- **Ví dụ:** "${userAddressCap} cần sửa dòng 45 trong file này."
1073
+ let content = fs.readFileSync(claudeMdFile, 'utf8');
1093
1074
 
1094
- **⚠️ Context Overflow Detection:**
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."
1075
+ // Build the addressing section (short instruction + user-chosen term)
1076
+ const addressingSection = `## Xưng hô (Addressing - Context Overflow Indicator)
1097
1077
 
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.`;
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
- // Match from ## Xưng hô to the next ## header or end of file
1101
- const regex = /## Xưng hô \(Addressing - Context Overflow Indicator\)[\s\S]*?(?=\n##|\n*$)/;
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
- if (regex.test(content)) {
1104
- // Replace existing section
1105
- content = content.replace(regex, addressingSection);
1106
- } else {
1107
- // Append at the end
1108
- if (!content.endsWith('\n')) {
1109
- content += '\n';
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
- fs.writeFileSync(claudeMdFile, content, 'utf8');
1115
- console.log(` ✓ Xưng hô configured in CLAUDE.md: AI gọi user là "${userAddress}"`);
1116
- } catch (error) {
1117
- console.error(` ✗ Failed to configure addressing in ${folder}/CLAUDE.md`);
1118
- console.error(` Error: ${error.message}`);
1119
- if (process.env.DEBUG) {
1120
- console.error(error.stack);
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.5",
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",
@@ -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
- 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.
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`.