abapgit-agent 1.13.0 → 1.13.1

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": "abapgit-agent",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "ABAP Git Agent - Pull and activate ABAP code via abapGit from any git repository",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -4,18 +4,6 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const readline = require('readline');
6
6
 
7
- // Marker present in the old full-guide CLAUDE.md (copied by init before this feature)
8
- const FULL_GUIDE_MARKER = 'Claude Code Instructions';
9
-
10
- // Marker present in the slim stub (so we can detect it's already migrated)
11
- const SLIM_STUB_MARKER = 'abapgit-agent guide';
12
-
13
- // Marker present in the old full copilot-instructions.md
14
- const COPILOT_FULL_MARKER = '# ABAP Development with abapGit';
15
-
16
- // Marker present in the slim copilot stub
17
- const COPILOT_SLIM_MARKER = 'abapgit-agent guide';
18
-
19
7
  module.exports = {
20
8
  name: 'guide',
21
9
  description: 'Show bundled ABAP development guide',
@@ -45,18 +33,6 @@ module.exports = {
45
33
  return candidates.find(p => fs.existsSync(p)) || null;
46
34
  },
47
35
 
48
- _getBundledGuidelineNames() {
49
- const candidates = [
50
- path.join(__dirname, '..', '..', 'abap', 'guidelines'),
51
- path.join(__dirname, '..', '..', '..', 'abap', 'guidelines')
52
- ];
53
- const guidelinesDir = candidates.find(p => fs.existsSync(p));
54
- if (!guidelinesDir) return new Set();
55
- return new Set(
56
- fs.readdirSync(guidelinesDir).filter(f => f.endsWith('.md'))
57
- );
58
- },
59
-
60
36
  async _confirm(question) {
61
37
  return new Promise((resolve) => {
62
38
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
@@ -73,78 +49,38 @@ module.exports = {
73
49
  const yes = args.includes('--yes') || args.includes('-y');
74
50
  const cwd = process.cwd();
75
51
 
76
- const bundledNames = this._getBundledGuidelineNames();
77
52
  const slimStubPath = this._findSlimStub();
78
53
  const copilotSlimStubPath = this._findCopilotSlimStub();
79
54
 
80
- // --- Scan guidelines/ ---
55
+ // --- Scan guidelines/: delete all *.md except *.local.md ---
81
56
  const guidelinesDir = path.join(cwd, 'guidelines');
82
- const toDelete = []; // standard files matching bundled names
83
- const toKeep = []; // *.local.md or other non-standard files
57
+ const toDelete = [];
58
+ const toKeep = [];
84
59
 
85
60
  if (fs.existsSync(guidelinesDir)) {
86
61
  for (const name of fs.readdirSync(guidelinesDir)) {
87
62
  if (!name.endsWith('.md')) continue;
88
- if (bundledNames.has(name)) {
89
- toDelete.push(path.join(guidelinesDir, name));
90
- } else {
63
+ if (name.endsWith('.local.md')) {
91
64
  toKeep.push(name);
65
+ } else {
66
+ toDelete.push(path.join(guidelinesDir, name));
92
67
  }
93
68
  }
94
69
  }
95
70
 
96
- // --- Scan CLAUDE.md ---
71
+ // --- CLAUDE.md: replace if it exists ---
97
72
  const claudeMdPath = path.join(cwd, 'CLAUDE.md');
98
- let claudeMdAction = 'none'; // 'replace' | 'already-slim' | 'custom' | 'missing'
99
- if (fs.existsSync(claudeMdPath)) {
100
- const content = fs.readFileSync(claudeMdPath, 'utf8');
101
- if (content.includes(SLIM_STUB_MARKER)) {
102
- claudeMdAction = 'already-slim';
103
- } else if (content.includes(FULL_GUIDE_MARKER)) {
104
- claudeMdAction = 'replace';
105
- } else {
106
- claudeMdAction = 'custom';
107
- }
108
- } else {
109
- claudeMdAction = 'missing';
110
- }
73
+ const claudeExists = fs.existsSync(claudeMdPath);
111
74
 
112
- // --- Scan .github/copilot-instructions.md ---
75
+ // --- .github/copilot-instructions.md: replace if it exists ---
113
76
  const copilotMdPath = path.join(cwd, '.github', 'copilot-instructions.md');
114
- let copilotAction = 'none'; // 'replace' | 'already-slim' | 'custom' | 'missing'
115
- if (fs.existsSync(copilotMdPath)) {
116
- const content = fs.readFileSync(copilotMdPath, 'utf8');
117
- if (content.includes(COPILOT_SLIM_MARKER)) {
118
- copilotAction = 'already-slim';
119
- } else if (content.includes(COPILOT_FULL_MARKER)) {
120
- copilotAction = 'replace';
121
- } else {
122
- copilotAction = 'custom';
123
- }
124
- } else {
125
- copilotAction = 'missing';
126
- }
77
+ const copilotExists = fs.existsSync(copilotMdPath);
127
78
 
128
79
  // --- Nothing to do? ---
129
- const nothingToDo = toDelete.length === 0 && claudeMdAction !== 'replace' && copilotAction !== 'replace';
80
+ const nothingToDo = toDelete.length === 0 && !claudeExists && !copilotExists;
130
81
  if (nothingToDo) {
131
82
  console.log('');
132
- console.log('✅ Already cleannothing to migrate.');
133
- if (claudeMdAction === 'already-slim') {
134
- console.log(' CLAUDE.md is already the slim stub.');
135
- } else if (claudeMdAction === 'custom') {
136
- console.log(' CLAUDE.md has custom content — left untouched.');
137
- } else if (claudeMdAction === 'missing') {
138
- console.log(' No CLAUDE.md found.');
139
- }
140
- if (copilotAction === 'already-slim') {
141
- console.log(' .github/copilot-instructions.md is already the slim stub.');
142
- } else if (copilotAction === 'custom') {
143
- console.log(' .github/copilot-instructions.md has custom content — left untouched.');
144
- }
145
- if (toDelete.length === 0 && fs.existsSync(guidelinesDir)) {
146
- console.log(' No standard guideline files found in guidelines/.');
147
- }
83
+ console.log('✅ Nothing to migrate no guideline files, CLAUDE.md, or copilot-instructions.md found.');
148
84
  console.log('');
149
85
  return;
150
86
  }
@@ -155,7 +91,7 @@ module.exports = {
155
91
  console.log('');
156
92
 
157
93
  if (toDelete.length > 0) {
158
- console.log(`Files to remove (${toDelete.length} standard guideline file${toDelete.length > 1 ? 's' : ''}):`);
94
+ console.log(`Files to remove (${toDelete.length} guideline file${toDelete.length > 1 ? 's' : ''}):`);
159
95
  toDelete.forEach(f => console.log(` ${path.relative(cwd, f)}`));
160
96
  console.log('');
161
97
  }
@@ -166,27 +102,25 @@ module.exports = {
166
102
  console.log('');
167
103
  }
168
104
 
169
- if (claudeMdAction === 'replace') {
105
+ if (claudeExists) {
170
106
  if (slimStubPath) {
171
- console.log('CLAUDE.md: detected as full guide → will replace with slim stub');
107
+ console.log('CLAUDE.md → will replace with slim stub');
172
108
  console.log(" (run 'abapgit-agent guide' to read the full guide on demand)");
173
109
  } else {
174
- console.log('CLAUDE.md: detected as full guide → ⚠️ slim stub not found, will skip');
110
+ console.log('CLAUDE.md → ⚠️ slim stub not found, will skip');
175
111
  }
176
112
  console.log('');
177
113
  }
178
114
 
179
- if (copilotAction === 'replace') {
115
+ if (copilotExists) {
180
116
  if (copilotSlimStubPath) {
181
- console.log('.github/copilot-instructions.md: detected as full guide → will replace with slim stub');
182
- console.log(' (Copilot uses the slim stub; full guide available online)');
117
+ console.log('.github/copilot-instructions.md → will replace with slim stub');
183
118
  } else {
184
- console.log('.github/copilot-instructions.md: detected as full guide → ⚠️ slim stub not found, will skip');
119
+ console.log('.github/copilot-instructions.md → ⚠️ slim stub not found, will skip');
185
120
  }
186
121
  console.log('');
187
122
  }
188
123
 
189
- // After deletions, would guidelines/ be empty?
190
124
  const dirWillBeEmpty = fs.existsSync(guidelinesDir) && toKeep.length === 0;
191
125
  if (dirWillBeEmpty) {
192
126
  console.log('guidelines/ will be removed (no project-specific files remain).');
@@ -211,16 +145,13 @@ module.exports = {
211
145
 
212
146
  // --- Execute ---
213
147
  console.log('');
214
- let deletedCount = 0;
215
148
 
216
149
  for (const filePath of toDelete) {
217
150
  fs.unlinkSync(filePath);
218
151
  console.log(`🗑️ Removed ${path.relative(cwd, filePath)}`);
219
- deletedCount++;
220
152
  }
221
153
 
222
154
  if (dirWillBeEmpty) {
223
- // Verify no other files remain before removing the directory
224
155
  const remaining = fs.readdirSync(guidelinesDir);
225
156
  if (remaining.length === 0) {
226
157
  fs.rmdirSync(guidelinesDir);
@@ -228,13 +159,13 @@ module.exports = {
228
159
  }
229
160
  }
230
161
 
231
- if (claudeMdAction === 'replace' && slimStubPath) {
162
+ if (claudeExists && slimStubPath) {
232
163
  const slimContent = fs.readFileSync(slimStubPath, 'utf8');
233
164
  fs.writeFileSync(claudeMdPath, slimContent);
234
165
  console.log('✅ Replaced CLAUDE.md with slim stub');
235
166
  }
236
167
 
237
- if (copilotAction === 'replace' && copilotSlimStubPath) {
168
+ if (copilotExists && copilotSlimStubPath) {
238
169
  const slimContent = fs.readFileSync(copilotSlimStubPath, 'utf8');
239
170
  fs.writeFileSync(copilotMdPath, slimContent);
240
171
  console.log('✅ Replaced .github/copilot-instructions.md with slim stub');