taist 0.1.10 → 0.1.11

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.
@@ -77,12 +77,14 @@ export function shouldInstrument(modulePath, config) {
77
77
  * Simple glob matching (supports * and **)
78
78
  */
79
79
  export function matchGlob(str, pattern) {
80
- // Convert glob pattern to regex
80
+ // Convert glob pattern to regex using placeholders to prevent double-replacement
81
81
  const regexPattern = pattern
82
82
  .replace(/[.+^${}()|[\]\\]/g, "\\$&") // Escape special chars
83
- .replace(/\*\*\//g, "(?:.*\\/)?") // **/ matches zero or more directories
84
- .replace(/\*\*/g, ".*") // ** matches anything
85
- .replace(/\*/g, "[^/]*"); // * matches any chars except /
83
+ .replace(/\*\*\//g, "\0ANYDIR\0") // Placeholder for **/
84
+ .replace(/\*\*/g, "\0ANY\0") // Placeholder for **
85
+ .replace(/\*/g, "[^/]*") // * matches any chars except /
86
+ .replace(/\0ANYDIR\0/g, "(?:.*\\/)?") // Restore **/ - matches zero or more directories
87
+ .replace(/\0ANY\0/g, ".*"); // Restore ** - matches anything
86
88
 
87
89
  const regex = new RegExp(`^${regexPattern}$`);
88
90
  return regex.test(str);
@@ -70,15 +70,6 @@ export class ToonFormatter {
70
70
  });
71
71
  }
72
72
 
73
- // Trace
74
- if (results.trace && results.trace.length > 0) {
75
- lines.push('');
76
- lines.push('TRACE:');
77
- results.trace.forEach(entry => {
78
- lines.push(this.formatTraceEntry(entry));
79
- });
80
- }
81
-
82
73
  // Coverage
83
74
  if (results.coverage) {
84
75
  lines.push('');
@@ -154,46 +145,6 @@ export class ToonFormatter {
154
145
  return lines;
155
146
  }
156
147
 
157
- /**
158
- * Format trace entry with depth-based indentation for execution tree
159
- */
160
- formatTraceEntry(entry) {
161
- const parts = [];
162
-
163
- // Function name
164
- parts.push(`fn:${this.abbreviateFunctionName(entry.name)}`);
165
-
166
- // Duration
167
- if (entry.duration !== undefined) {
168
- parts.push(`ms:${Math.round(entry.duration)}`);
169
- }
170
-
171
- // Arguments (if present)
172
- if (entry.args && entry.args.length > 0) {
173
- const args = entry.args
174
- .slice(0, this.options.maxArrayItems)
175
- .map(arg => this.formatValue(arg))
176
- .join(',');
177
- parts.push(`args:[${args}]`);
178
- }
179
-
180
- // Return value (if present and not undefined)
181
- if (entry.result !== undefined) {
182
- parts.push(`ret:${this.formatValue(entry.result)}`);
183
- }
184
-
185
- // Error (if present)
186
- if (entry.error) {
187
- parts.push(`err:${this.cleanErrorMessage(entry.error)}`);
188
- }
189
-
190
- // Calculate indentation based on depth (2 spaces base + 2 per depth level)
191
- const depth = entry.depth || 0;
192
- const indent = ' ' + ' '.repeat(depth);
193
-
194
- return `${indent}${parts.join(' ')}`;
195
- }
196
-
197
148
  /**
198
149
  * Abbreviate function name for compact output
199
150
  */
package/lib/transform.js CHANGED
@@ -134,6 +134,10 @@ export function transformSource(source, moduleNameOrOptions, tracerImportPath) {
134
134
  import { getGlobalReporter as __taist_getReporter } from "${reporterPath}";
135
135
  import { getContext as __taist_getContext, runWithContext as __taist_runWithContext, generateId as __taist_generateId } from "${traceContextPath}";
136
136
  const __taist_reporter = __taist_getReporter();
137
+ // Eagerly connect to collector if socket path is set (build-time instrumentation)
138
+ if (process.env.TAIST_COLLECTOR_SOCKET && !__taist_reporter.isConnected()) {
139
+ __taist_reporter.connectEager();
140
+ }
137
141
  const __taist_wrap = (fn, name) => {
138
142
  if (typeof fn !== 'function') return fn;
139
143
  const wrapped = function(...args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taist",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Token-Optimized Testing Framework for AI-Assisted Development",
5
5
  "main": "index.js",
6
6
  "type": "module",