@maccesar/titools 2.0.6 → 2.0.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.
@@ -102,7 +102,7 @@ Example output:
102
102
 
103
103
  ```html
104
104
  <!-- TITANIUM-KNOWLEDGE-START -->
105
- <!-- Version: v2.0.6 -->
105
+ <!-- Version: v2.0.7 -->
106
106
  <!--
107
107
  Titanium SDK Knowledge Index
108
108
  Generated by titools -->
package/lib/utils.js CHANGED
@@ -125,21 +125,12 @@ export function addOrUpdateBlock(filePath) {
125
125
 
126
126
  const block = createKnowledgeBlock();
127
127
 
128
- // Regex to find any existing block (old versioned or new static)
129
- // Group 1 matches the version/START, Group 2 matches the END marker
130
- const blockRegex = /<!-- TITANIUM-KNOWLEDGE-(v[\d.]+|START) -->[\s\S]*?<!-- (END-TITANIUM-KNOWLEDGE|TITANIUM-KNOWLEDGE-END) -->/;
131
- const match = content.match(blockRegex);
132
-
133
- if (match) {
134
- const startIndex = match.index;
135
- const matchText = match[0];
136
- const endIndex = startIndex + matchText.length;
137
-
138
- // Remove the entire block and handle trailing newlines
139
- const afterBlock = content.substring(endIndex);
140
- const trimmedAfter = afterBlock.replace(/^\n+/, '');
141
- content = content.substring(0, startIndex) + '\n\n' + trimmedAfter;
142
- }
128
+ // Regex to find ALL existing blocks (old versioned or new static)
129
+ // Global flag /g is CRITICAL here to remove every single occurrence
130
+ const globalBlockRegex = /<!-- TITANIUM-KNOWLEDGE-(v[\d.]+|START) -->[\s\S]*?<!-- (END-TITANIUM-KNOWLEDGE|TITANIUM-KNOWLEDGE-END) -->/g;
131
+
132
+ // Clean up all existing blocks to prevent accumulation
133
+ content = content.replace(globalBlockRegex, '').trim();
143
134
 
144
135
  // Add new block at the end (preserve existing content)
145
136
  content = content.trimEnd() + '\n\n' + block + '\n';
@@ -147,7 +138,6 @@ export function addOrUpdateBlock(filePath) {
147
138
  writeFileSync(filePath, content, 'utf8');
148
139
  return true;
149
140
  }
150
-
151
141
  /**
152
142
  * Detect Titanium SDK version from tiapp.xml
153
143
  * @param {string} projectDir - Path to project directory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maccesar/titools",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Titanium SDK skills and agents for AI coding assistants (Claude Code, Gemini CLI, Codex CLI)",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",