@builder.io/dev-tools 1.68.1-dev.202606240747.8e3d8e293 → 1.68.1-dev.202606251237.e0a89fd34
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/cli/index.cjs +144 -49
- package/cli/index.cjs.map +3 -3
- package/core/index.cjs +1 -1
- package/core/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +1 -1
- package/server/index.cjs +16 -9
- package/server/index.mjs +16 -9
- package/types/_tests_/codegen-orphan-tool-sweep.test.d.ts +1 -0
- package/types/_tests_/figma-generate.e2e.d.ts +1 -0
- package/types/_tests_/launch-mcp-http.e2e.d.ts +11 -0
- package/types/_tests_/launch-mcp-mixed.e2e.d.ts +10 -0
- package/types/_tests_/launch-mcp-sse.e2e.d.ts +10 -0
- package/types/_tests_/launch-mcp-stdio.e2e.d.ts +10 -0
- package/types/_tests_/mcp-retry.e2e.d.ts +1 -0
- package/types/_tests_/mcp-test-server-http.d.ts +22 -0
- package/types/_tests_/mcp-test-server-sse.d.ts +24 -0
- package/types/_tests_/mcp-test-server-stdio.d.ts +18 -0
- package/types/cli/debug-mcp.d.ts +19 -0
- package/types/cli/generate.d.ts +16 -0
- package/types/cli/launch/InitStateMachine.d.ts +1 -1
- package/types/cli/utils/acl-denial.d.ts +7 -0
- package/types/cli/utils/browser-testing-agent.d.ts +2 -0
- package/types/cli/utils/file-search-client.d.ts +31 -0
- package/types/cli/utils/file-search-worker.d.ts +1 -0
- package/types/cli/utils/file-search-worker.generated.d.ts +1 -0
- package/types/cli/utils/git.d.ts +6 -1
- package/types/cli/utils/git.test.d.ts +1 -0
- package/types/cli/utils/project-configuration-agent.d.ts +2 -0
- package/types/cli/utils/rules-parser.d.ts +17 -0
- package/types/cli/utils/rules-parser.test.d.ts +1 -0
- package/types/cli/utils/yaml-frontmatter.d.ts +32 -0
- package/types/cli/utils/yaml-frontmatter.test.d.ts +1 -0
- package/types/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E Tests for MCP Connections - HTTP Transport (Streamable HTTP)
|
|
3
|
+
*
|
|
4
|
+
* These tests verify:
|
|
5
|
+
* - Successful connection and tool execution with HTTP MCP servers
|
|
6
|
+
* - Initial connection retry on network failure
|
|
7
|
+
* - Reconnection after network interruption
|
|
8
|
+
* - Server shutdown during session
|
|
9
|
+
* - Slow network simulation
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E Tests for MCP Connections - Mixed Transport & Edge Cases
|
|
3
|
+
*
|
|
4
|
+
* These tests verify:
|
|
5
|
+
* - Multiple MCP servers with different transport types
|
|
6
|
+
* - Partial failure scenarios (some servers connect, some fail)
|
|
7
|
+
* - Resource discovery across different transports
|
|
8
|
+
* - Complex configuration scenarios
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E Tests for MCP Connections - SSE Transport
|
|
3
|
+
*
|
|
4
|
+
* These tests verify:
|
|
5
|
+
* - Successful SSE connection and tool execution
|
|
6
|
+
* - SSE reconnection on stream interruption
|
|
7
|
+
* - Server shutdown with SSE
|
|
8
|
+
* - Connection handling for SSE-specific scenarios
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E Tests for MCP Connections - Stdio Transport
|
|
3
|
+
*
|
|
4
|
+
* These tests verify:
|
|
5
|
+
* - Successful connection and tool execution with stdio MCP servers
|
|
6
|
+
* - Invalid command handling (initial connection failure)
|
|
7
|
+
* - Server process crash during operation
|
|
8
|
+
* - Server becomes unresponsive (hang simulation)
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Mock MCP Server for E2E Testing - HTTP Transport (Streamable HTTP)
|
|
4
|
+
*
|
|
5
|
+
* This server implements the MCP protocol using HTTP transport for testing purposes.
|
|
6
|
+
* It provides controllable test tools and can simulate various failure scenarios.
|
|
7
|
+
*
|
|
8
|
+
* Usage: node mcp-test-server-http.js [port]
|
|
9
|
+
*
|
|
10
|
+
* The server outputs its port number to stdout on startup for test coordination.
|
|
11
|
+
*
|
|
12
|
+
* Test tools:
|
|
13
|
+
* - echo: Returns the input message
|
|
14
|
+
* - add_numbers: Adds two numbers
|
|
15
|
+
* - get_timestamp: Returns current timestamp
|
|
16
|
+
*
|
|
17
|
+
* Control endpoints:
|
|
18
|
+
* - POST /test/kill - Shuts down the server
|
|
19
|
+
* - POST /test/delay/:ms - Adds delay to next N requests
|
|
20
|
+
* - POST /test/error/:code - Returns HTTP error code for next request
|
|
21
|
+
*/
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Mock MCP Server for E2E Testing - SSE Transport
|
|
4
|
+
*
|
|
5
|
+
* This server implements the MCP protocol using Server-Sent Events (SSE) transport
|
|
6
|
+
* for testing purposes. It provides controllable test tools and can simulate
|
|
7
|
+
* various failure scenarios.
|
|
8
|
+
*
|
|
9
|
+
* Usage: node mcp-test-server-sse.js [port]
|
|
10
|
+
*
|
|
11
|
+
* The server outputs its port number to stdout on startup for test coordination.
|
|
12
|
+
*
|
|
13
|
+
* Test tools:
|
|
14
|
+
* - echo: Returns the input message
|
|
15
|
+
* - add_numbers: Adds two numbers
|
|
16
|
+
* - get_timestamp: Returns current timestamp
|
|
17
|
+
*
|
|
18
|
+
* Control endpoints:
|
|
19
|
+
* - POST /test/kill - Shuts down the server
|
|
20
|
+
* - POST /test/delay/:ms - Adds delay to next N requests
|
|
21
|
+
* - POST /test/error/:code - Returns HTTP error code for next request
|
|
22
|
+
* - POST /test/disconnect - Forcefully disconnects all SSE clients
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Mock MCP Server for E2E Testing - Stdio Transport
|
|
4
|
+
*
|
|
5
|
+
* This server implements the MCP protocol using stdio transport for testing purposes.
|
|
6
|
+
* It provides controllable test tools and can simulate various failure scenarios.
|
|
7
|
+
*
|
|
8
|
+
* Usage: node mcp-test-server-stdio.js
|
|
9
|
+
*
|
|
10
|
+
* Test tools:
|
|
11
|
+
* - echo: Returns the input message
|
|
12
|
+
* - add_numbers: Adds two numbers
|
|
13
|
+
* - get_timestamp: Returns current timestamp
|
|
14
|
+
* - __test_exit__: Causes immediate process exit (simulates crash)
|
|
15
|
+
* - __test_hang__: Stops responding (simulates freeze)
|
|
16
|
+
* - __test_slow__: Adds delay to response (simulates slow network)
|
|
17
|
+
*/
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Connection Debugging Command
|
|
3
|
+
*
|
|
4
|
+
* This command helps debug MCP (Model Context Protocol) server connection issues.
|
|
5
|
+
* It mimics exactly how the dev-tools CLI connects to MCP servers, making it useful
|
|
6
|
+
* for diagnosing problems like "invalid session ID" errors.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* npx builder.io debug-mcp [--server <name>] [--verbose]
|
|
10
|
+
*/
|
|
11
|
+
import type { DevToolsSys } from "../core";
|
|
12
|
+
import type { CLIArgs } from "./index";
|
|
13
|
+
export interface DebugMcpArgs extends CLIArgs {
|
|
14
|
+
/** Test only a specific server by name */
|
|
15
|
+
server?: string;
|
|
16
|
+
/** Show verbose/detailed output */
|
|
17
|
+
verbose?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function runDebugMcpCommand(sys: DevToolsSys, args: DebugMcpArgs): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentInfo, ComponentRegistry, DevToolsSys } from "../types";
|
|
2
|
+
import type { CLIArgs } from "./index";
|
|
3
|
+
import { type FigmaComponentInfo, type UserContext } from "$/ai-utils";
|
|
4
|
+
export declare const runFigmaGenerate: (sys: DevToolsSys, args: CLIArgs) => Promise<undefined>;
|
|
5
|
+
export interface MappingCodeV3 {
|
|
6
|
+
figmaNode?: FigmaComponentInfo;
|
|
7
|
+
registry?: ComponentRegistry;
|
|
8
|
+
userContext?: UserContext;
|
|
9
|
+
figmaUrl?: string;
|
|
10
|
+
docsUrl?: string;
|
|
11
|
+
registeredCmp?: ComponentInfo;
|
|
12
|
+
previousCompletion?: string;
|
|
13
|
+
userPrompt?: string;
|
|
14
|
+
token?: string;
|
|
15
|
+
pragma?: string;
|
|
16
|
+
}
|
|
@@ -29,7 +29,7 @@ export declare class InitStateMachine {
|
|
|
29
29
|
constructor(config: InitConfig);
|
|
30
30
|
checkout(branchName: string, ref: string | undefined, repoPath: string): Promise<void>;
|
|
31
31
|
execAsync(exec: string, args: string[], cwd?: string, retry?: number): Promise<string>;
|
|
32
|
-
git(args: string[], cwd: string, retry?: number, timeout?: number, skipLogging?: boolean): Promise<string>;
|
|
32
|
+
git(args: string[], cwd: string, retry?: number, timeout?: number, skipLogging?: boolean, httpExtraHeader?: string): Promise<string>;
|
|
33
33
|
performBackup({ sys, credentials, fusionConfig, volumePath, repositories, isConnectedToProvider, forcedFullBackup }: {
|
|
34
34
|
sys: DevToolsSys;
|
|
35
35
|
credentials: Credentials;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AccessResult, AclDenial } from "#ai-utils";
|
|
2
|
+
/**
|
|
3
|
+
* Builds a structured ACL denial from an {@link AccessResult} produced by
|
|
4
|
+
* `evaluateAccess`. Travels with the tool result so internal tools can show
|
|
5
|
+
* admins which rule blocked a file operation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildFileAccessDenial(result: AccessResult): AclDenial;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface FileSearchMatch {
|
|
2
|
+
filePath: string;
|
|
3
|
+
fileName: string;
|
|
4
|
+
parentPath: string;
|
|
5
|
+
matchIndices: number[];
|
|
6
|
+
}
|
|
7
|
+
export interface FileSearchResult {
|
|
8
|
+
matches: FileSearchMatch[];
|
|
9
|
+
totalMatches: number;
|
|
10
|
+
truncated: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Runs the CPU-heavy Fuse index build and searches in a worker thread so the
|
|
14
|
+
* CLI's UI thread never blocks. Falls back to an in-process index if the worker
|
|
15
|
+
* cannot be spawned (unusual runtimes), so search keeps working everywhere.
|
|
16
|
+
*/
|
|
17
|
+
export declare class FileSearchClient {
|
|
18
|
+
#private;
|
|
19
|
+
constructor(ttlMs: number);
|
|
20
|
+
/** True once an index has been built and is ready to serve searches. */
|
|
21
|
+
get ready(): boolean;
|
|
22
|
+
/** Which backend last built/served the index ("worker" | "in-process"). */
|
|
23
|
+
get backend(): "worker" | "in-process" | null;
|
|
24
|
+
/** True when the current index is older than the TTL and should be rebuilt. */
|
|
25
|
+
isStale(): boolean;
|
|
26
|
+
/** Build (or rebuild) the index from the given file list. */
|
|
27
|
+
build(files: string[]): Promise<void>;
|
|
28
|
+
/** Run a fuzzy search against the built index. */
|
|
29
|
+
search(query: string, maxResults: number): Promise<FileSearchResult>;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FILE_SEARCH_WORKER_SOURCE = "\"use strict\";var ie=require(\"node:worker_threads\");function y(t){return Array.isArray?Array.isArray(t):Ae(t)===\"[object Array]\"}var Be=1/0;function Me(t){if(typeof t==\"string\")return t;let e=t+\"\";return e==\"0\"&&1/t==-Be?\"-0\":e}function ye(t){return t==null?\"\":Me(t)}function D(t){return typeof t==\"string\"}function de(t){return typeof t==\"number\"}function Ie(t){return t===!0||t===!1||_e(t)&&Ae(t)==\"[object Boolean]\"}function ge(t){return typeof t==\"object\"}function _e(t){return ge(t)&&t!==null}function m(t){return t!=null}function H(t){return!t.trim().length}function Ae(t){return t==null?t===void 0?\"[object Undefined]\":\"[object Null]\":Object.prototype.toString.call(t)}var Se=\"Incorrect 'index' type\",xe=t=>`Invalid value for key ${t}`,Re=t=>`Pattern length exceeds max of ${t}.`,be=t=>`Missing ${t} property in key`,we=t=>`Property 'weight' in key '${t}' must be a positive integer`,oe=Object.prototype.hasOwnProperty,Y=class{constructor(e){this._keys=[],this._keyMap={};let s=0;e.forEach(n=>{let r=pe(n);this._keys.push(r),this._keyMap[r.id]=r,s+=r.weight}),this._keys.forEach(n=>{n.weight/=s})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function pe(t){let e=null,s=null,n=null,r=1,i=null;if(D(t)||y(t))n=t,e=he(t),s=z(t);else{if(!oe.call(t,\"name\"))throw new Error(be(\"name\"));let u=t.name;if(n=u,oe.call(t,\"weight\")&&(r=t.weight,r<=0))throw new Error(we(u));e=he(u),s=z(u),i=t.getFn}return{path:e,id:s,weight:r,src:n,getFn:i}}function he(t){return y(t)?t:t.split(\".\")}function z(t){return y(t)?t.join(\".\"):t}function Le(t,e){let s=[],n=!1,r=(i,u,c)=>{if(m(i))if(!u[c])s.push(i);else{let o=u[c],h=i[o];if(!m(h))return;if(c===u.length-1&&(D(h)||de(h)||Ie(h)))s.push(ye(h));else if(y(h)){n=!0;for(let a=0,f=h.length;a<f;a+=1)r(h[a],u,c+1)}else u.length&&r(h,u,c+1)}};return r(t,D(e)?e.split(\".\"):e,0),n?s:s[0]}var ke={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Oe={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},Ne={location:0,threshold:.6,distance:100},$e={useExtendedSearch:!1,getFn:Le,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},l={...Oe,...ke,...Ne,...$e},Te=/[^ ]+/g;function Pe(t=1,e=3){let s=new Map,n=Math.pow(10,e);return{get(r){let i=r.match(Te).length;if(s.has(i))return s.get(i);let u=1/Math.pow(i,.5*t),c=parseFloat(Math.round(u*n)/n);return s.set(i,c),c},clear(){s.clear()}}}var k=class{constructor({getFn:e=l.getFn,fieldNormWeight:s=l.fieldNormWeight}={}){this.norm=Pe(s,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((s,n)=>{this._keysMap[s.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,D(this.docs[0])?this.docs.forEach((e,s)=>{this._addString(e,s)}):this.docs.forEach((e,s)=>{this._addObject(e,s)}),this.norm.clear())}add(e){let s=this.size();D(e)?this._addString(e,s):this._addObject(e,s)}removeAt(e){this.records.splice(e,1);for(let s=e,n=this.size();s<n;s+=1)this.records[s].i-=1}getValueForItemAtKeyId(e,s){return e[this._keysMap[s]]}size(){return this.records.length}_addString(e,s){if(!m(e)||H(e))return;let n={v:e,i:s,n:this.norm.get(e)};this.records.push(n)}_addObject(e,s){let n={i:s,$:{}};this.keys.forEach((r,i)=>{let u=r.getFn?r.getFn(e):this.getFn(e,r.path);if(m(u)){if(y(u)){let c=[],o=[{nestedArrIndex:-1,value:u}];for(;o.length;){let{nestedArrIndex:h,value:a}=o.pop();if(m(a))if(D(a)&&!H(a)){let f={v:a,i:h,n:this.norm.get(a)};c.push(f)}else y(a)&&a.forEach((f,d)=>{o.push({nestedArrIndex:d,value:f})})}n.$[i]=c}else if(D(u)&&!H(u)){let c={v:u,n:this.norm.get(u)};n.$[i]=c}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}};function me(t,e,{getFn:s=l.getFn,fieldNormWeight:n=l.fieldNormWeight}={}){let r=new k({getFn:s,fieldNormWeight:n});return r.setKeys(t.map(pe)),r.setSources(e),r.create(),r}function ve(t,{getFn:e=l.getFn,fieldNormWeight:s=l.fieldNormWeight}={}){let{keys:n,records:r}=t,i=new k({getFn:e,fieldNormWeight:s});return i.setKeys(n),i.setIndexRecords(r),i}function N(t,{errors:e=0,currentLocation:s=0,expectedLocation:n=0,distance:r=l.distance,ignoreLocation:i=l.ignoreLocation}={}){let u=e/t.length;if(i)return u;let c=Math.abs(n-s);return r?u+c/r:c?1:u}function We(t=[],e=l.minMatchCharLength){let s=[],n=-1,r=-1,i=0;for(let u=t.length;i<u;i+=1){let c=t[i];c&&n===-1?n=i:!c&&n!==-1&&(r=i-1,r-n+1>=e&&s.push([n,r]),n=-1)}return t[i-1]&&i-n>=e&&s.push([n,i-1]),s}var b=32;function je(t,e,s,{location:n=l.location,distance:r=l.distance,threshold:i=l.threshold,findAllMatches:u=l.findAllMatches,minMatchCharLength:c=l.minMatchCharLength,includeMatches:o=l.includeMatches,ignoreLocation:h=l.ignoreLocation}={}){if(e.length>b)throw new Error(Re(b));let a=e.length,f=t.length,d=Math.max(0,Math.min(n,f)),g=i,A=d,p=c>1||o,C=p?Array(f):[],_;for(;(_=t.indexOf(e,A))>-1;){let E=N(e,{currentLocation:_,expectedLocation:d,distance:r,ignoreLocation:h});if(g=Math.min(E,g),A=_+a,p){let S=0;for(;S<a;)C[_+S]=1,S+=1}}A=-1;let M=[],w=1,R=a+f,De=1<<a-1;for(let E=0;E<a;E+=1){let S=0,x=R;for(;S<x;)N(e,{errors:E,currentLocation:d+x,expectedLocation:d,distance:r,ignoreLocation:h})<=g?S=x:R=x,x=Math.floor((R-S)/2+S);R=x;let ue=Math.max(1,d-x+1),K=u?f:Math.min(d+x,f)+a,L=Array(K+2);L[K+1]=(1<<E)-1;for(let F=K;F>=ue;F-=1){let O=F-1,ce=s[t.charAt(O)];if(p&&(C[O]=+!!ce),L[F]=(L[F+1]<<1|1)&ce,E&&(L[F]|=(M[F+1]|M[F])<<1|1|M[F+1]),L[F]&De&&(w=N(e,{errors:E,currentLocation:O,expectedLocation:d,distance:r,ignoreLocation:h}),w<=g)){if(g=w,A=O,A<=d)break;ue=Math.max(1,2*d-A)}}if(N(e,{errors:E+1,currentLocation:d,expectedLocation:d,distance:r,ignoreLocation:h})>g)break;M=L}let j={isMatch:A>=0,score:Math.max(.001,w)};if(p){let E=We(C,c);E.length?o&&(j.indices=E):j.isMatch=!1}return j}function Ke(t){let e={};for(let s=0,n=t.length;s<n;s+=1){let r=t.charAt(s);e[r]=(e[r]||0)|1<<n-s-1}return e}var $=String.prototype.normalize?(t=>t.normalize(\"NFD\").replace(/[\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u08D3-\\u08E1\\u08E3-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0D62\\u0D63\\u0D82\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102B-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1062-\\u1064\\u1067-\\u106D\\u1071-\\u1074\\u1082-\\u108D\\u108F\\u109A-\\u109D\\u135D-\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u1885\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60-\\u1A7C\\u1A7F\\u1AB0-\\u1ABE\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF2-\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DF9\\u1DFB-\\u1DFF\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7B-\\uAA7D\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F]/g,\"\")):(t=>t),T=class{constructor(e,{location:s=l.location,threshold:n=l.threshold,distance:r=l.distance,includeMatches:i=l.includeMatches,findAllMatches:u=l.findAllMatches,minMatchCharLength:c=l.minMatchCharLength,isCaseSensitive:o=l.isCaseSensitive,ignoreDiacritics:h=l.ignoreDiacritics,ignoreLocation:a=l.ignoreLocation}={}){if(this.options={location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:u,minMatchCharLength:c,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:a},e=o?e:e.toLowerCase(),e=h?$(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let f=(g,A)=>{this.chunks.push({pattern:g,alphabet:Ke(g),startIndex:A})},d=this.pattern.length;if(d>b){let g=0,A=d%b,p=d-A;for(;g<p;)f(this.pattern.substr(g,b),g),g+=b;if(A){let C=d-b;f(this.pattern.substr(C),C)}}else f(this.pattern,0)}searchIn(e){let{isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=s?e:e.toLowerCase(),e=n?$(e):e,this.pattern===e){let p={isMatch:!0,score:0};return r&&(p.indices=[[0,e.length-1]]),p}let{location:i,distance:u,threshold:c,findAllMatches:o,minMatchCharLength:h,ignoreLocation:a}=this.options,f=[],d=0,g=!1;this.chunks.forEach(({pattern:p,alphabet:C,startIndex:_})=>{let{isMatch:M,score:w,indices:R}=je(e,p,C,{location:i+_,distance:u,threshold:c,findAllMatches:o,minMatchCharLength:h,includeMatches:r,ignoreLocation:a});M&&(g=!0),d+=w,M&&R&&(f=[...f,...R])});let A={isMatch:g,score:g?d/this.chunks.length:1};return g&&r&&(A.indices=f),A}},B=class{constructor(e){this.pattern=e}static isMultiMatch(e){return ae(e,this.multiRegex)}static isSingleMatch(e){return ae(e,this.singleRegex)}search(){}};function ae(t,e){let s=t.match(e);return s?s[1]:null}var V=class extends B{constructor(e){super(e)}static get type(){return\"exact\"}static get multiRegex(){return/^=\"(.*)\"$/}static get singleRegex(){return/^=(.*)$/}search(e){let s=e===this.pattern;return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}},G=class extends B{constructor(e){super(e)}static get type(){return\"inverse-exact\"}static get multiRegex(){return/^!\"(.*)\"$/}static get singleRegex(){return/^!(.*)$/}search(e){let n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}},U=class extends B{constructor(e){super(e)}static get type(){return\"prefix-exact\"}static get multiRegex(){return/^\\^\"(.*)\"$/}static get singleRegex(){return/^\\^(.*)$/}search(e){let s=e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,this.pattern.length-1]}}},Q=class extends B{constructor(e){super(e)}static get type(){return\"inverse-prefix-exact\"}static get multiRegex(){return/^!\\^\"(.*)\"$/}static get singleRegex(){return/^!\\^(.*)$/}search(e){let s=!e.startsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}},X=class extends B{constructor(e){super(e)}static get type(){return\"suffix-exact\"}static get multiRegex(){return/^\"(.*)\"\\$$/}static get singleRegex(){return/^(.*)\\$$/}search(e){let s=e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},J=class extends B{constructor(e){super(e)}static get type(){return\"inverse-suffix-exact\"}static get multiRegex(){return/^!\"(.*)\"\\$$/}static get singleRegex(){return/^!(.*)\\$$/}search(e){let s=!e.endsWith(this.pattern);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}},P=class extends B{constructor(e,{location:s=l.location,threshold:n=l.threshold,distance:r=l.distance,includeMatches:i=l.includeMatches,findAllMatches:u=l.findAllMatches,minMatchCharLength:c=l.minMatchCharLength,isCaseSensitive:o=l.isCaseSensitive,ignoreDiacritics:h=l.ignoreDiacritics,ignoreLocation:a=l.ignoreLocation}={}){super(e),this._bitapSearch=new T(e,{location:s,threshold:n,distance:r,includeMatches:i,findAllMatches:u,minMatchCharLength:c,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:a})}static get type(){return\"fuzzy\"}static get multiRegex(){return/^\"(.*)\"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}},v=class extends B{constructor(e){super(e)}static get type(){return\"include\"}static get multiRegex(){return/^'\"(.*)\"$/}static get singleRegex(){return/^'(.*)$/}search(e){let s=0,n,r=[],i=this.pattern.length;for(;(n=e.indexOf(this.pattern,s))>-1;)s=n+i,r.push([n,s-1]);let u=!!r.length;return{isMatch:u,score:u?0:1,indices:r}}},Z=[V,v,U,Q,J,X,G,P],le=Z.length,He=/ +(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)/,Ye=\"|\";function ze(t,e={}){return t.split(Ye).map(s=>{let n=s.trim().split(He).filter(i=>i&&!!i.trim()),r=[];for(let i=0,u=n.length;i<u;i+=1){let c=n[i],o=!1,h=-1;for(;!o&&++h<le;){let a=Z[h],f=a.isMultiMatch(c);f&&(r.push(new a(f,e)),o=!0)}if(!o)for(h=-1;++h<le;){let a=Z[h],f=a.isSingleMatch(c);if(f){r.push(new a(f,e));break}}}return r})}var Ve=new Set([P.type,v.type]),q=class{constructor(e,{isCaseSensitive:s=l.isCaseSensitive,ignoreDiacritics:n=l.ignoreDiacritics,includeMatches:r=l.includeMatches,minMatchCharLength:i=l.minMatchCharLength,ignoreLocation:u=l.ignoreLocation,findAllMatches:c=l.findAllMatches,location:o=l.location,threshold:h=l.threshold,distance:a=l.distance}={}){this.query=null,this.options={isCaseSensitive:s,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:c,ignoreLocation:u,location:o,threshold:h,distance:a},e=s?e:e.toLowerCase(),e=n?$(e):e,this.pattern=e,this.query=ze(this.pattern,this.options)}static condition(e,s){return s.useExtendedSearch}searchIn(e){let s=this.query;if(!s)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?$(e):e;let u=0,c=[],o=0;for(let h=0,a=s.length;h<a;h+=1){let f=s[h];c.length=0,u=0;for(let d=0,g=f.length;d<g;d+=1){let A=f[d],{isMatch:p,indices:C,score:_}=A.search(e);if(p){if(u+=1,o+=_,n){let M=A.constructor.type;Ve.has(M)?c=[...c,...C]:c.push(C)}}else{o=0,u=0,c.length=0;break}}if(u){let d={isMatch:!0,score:o/u};return n&&(d.indices=c),d}}return{isMatch:!1,score:1}}},ee=[];function Ge(...t){ee.push(...t)}function te(t,e){for(let s=0,n=ee.length;s<n;s+=1){let r=ee[s];if(r.condition(t,e))return new r(t,e)}return new T(t,e)}var W={AND:\"$and\",OR:\"$or\"},se={PATH:\"$path\",PATTERN:\"$val\"},ne=t=>!!(t[W.AND]||t[W.OR]),Ue=t=>!!t[se.PATH],Qe=t=>!y(t)&&ge(t)&&!ne(t),fe=t=>({[W.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function Ee(t,e,{auto:s=!0}={}){let n=r=>{let i=Object.keys(r),u=Ue(r);if(!u&&i.length>1&&!ne(r))return n(fe(r));if(Qe(r)){let o=u?r[se.PATH]:i[0],h=u?r[se.PATTERN]:r[o];if(!D(h))throw new Error(xe(o));let a={keyId:z(o),pattern:h};return s&&(a.searcher=te(h,e)),a}let c={children:[],operator:i[0]};return i.forEach(o=>{let h=r[o];y(h)&&h.forEach(a=>{c.children.push(n(a))})}),c};return ne(t)||(t=fe(t)),n(t)}function Xe(t,{ignoreFieldNorm:e=l.ignoreFieldNorm}){t.forEach(s=>{let n=1;s.matches.forEach(({key:r,norm:i,score:u})=>{let c=r?r.weight:null;n*=Math.pow(u===0&&c?Number.EPSILON:u,(c||1)*(e?1:i))}),s.score=n})}function Je(t,e){let s=t.matches;e.matches=[],m(s)&&s.forEach(n=>{if(!m(n.indices)||!n.indices.length)return;let{indices:r,value:i}=n,u={indices:r,value:i};n.key&&(u.key=n.key.src),n.idx>-1&&(u.refIndex=n.idx),e.matches.push(u)})}function Ze(t,e){e.score=t.score}function qe(t,e,{includeMatches:s=l.includeMatches,includeScore:n=l.includeScore}={}){let r=[];return s&&r.push(Je),n&&r.push(Ze),t.map(i=>{let{idx:u}=i,c={item:e[u],refIndex:u};return r.length&&r.forEach(o=>{o(i,c)}),c})}var I=class{constructor(e,s={},n){this.options={...l,...s},this.options.useExtendedSearch,this._keyStore=new Y(this.options.keys),this.setCollection(e,n)}setCollection(e,s){if(this._docs=e,s&&!(s instanceof k))throw new Error(Se);this._myIndex=s||me(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){m(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){let s=[];for(let n=0,r=this._docs.length;n<r;n+=1){let i=this._docs[n];e(i,n)&&(this.removeAt(n),n-=1,r-=1,s.push(i))}return s}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:s=-1}={}){let{includeMatches:n,includeScore:r,shouldSort:i,sortFn:u,ignoreFieldNorm:c}=this.options,o=D(e)?D(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return Xe(o,{ignoreFieldNorm:c}),i&&o.sort(u),de(s)&&s>-1&&(o=o.slice(0,s)),qe(o,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){let s=te(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:i,i:u,n:c})=>{if(!m(i))return;let{isMatch:o,score:h,indices:a}=s.searchIn(i);o&&r.push({item:i,idx:u,matches:[{score:h,value:i,norm:c,indices:a}]})}),r}_searchLogical(e){let s=Ee(e,this.options),n=(c,o,h)=>{if(!c.children){let{keyId:f,searcher:d}=c,g=this._findMatches({key:this._keyStore.get(f),value:this._myIndex.getValueForItemAtKeyId(o,f),searcher:d});return g&&g.length?[{idx:h,item:o,matches:g}]:[]}let a=[];for(let f=0,d=c.children.length;f<d;f+=1){let g=c.children[f],A=n(g,o,h);if(A.length)a.push(...A);else if(c.operator===W.AND)return[]}return a},r=this._myIndex.records,i={},u=[];return r.forEach(({$:c,i:o})=>{if(m(c)){let h=n(s,c,o);h.length&&(i[o]||(i[o]={idx:o,item:c,matches:[]},u.push(i[o])),h.forEach(({matches:a})=>{i[o].matches.push(...a)}))}}),u}_searchObjectList(e){let s=te(e,this.options),{keys:n,records:r}=this._myIndex,i=[];return r.forEach(({$:u,i:c})=>{if(!m(u))return;let o=[];n.forEach((h,a)=>{o.push(...this._findMatches({key:h,value:u[a],searcher:s}))}),o.length&&i.push({idx:c,item:u,matches:o})}),i}_findMatches({key:e,value:s,searcher:n}){if(!m(s))return[];let r=[];if(y(s))s.forEach(({v:i,i:u,n:c})=>{if(!m(i))return;let{isMatch:o,score:h,indices:a}=n.searchIn(i);o&&r.push({score:h,key:e,value:i,idx:u,norm:c,indices:a})});else{let{v:i,n:u}=s,{isMatch:c,score:o,indices:h}=n.searchIn(i);c&&r.push({score:o,key:e,value:i,norm:u,indices:h})}return r}};I.version=\"7.1.0\";I.createIndex=me;I.parseIndex=ve;I.config=l;I.parseQuery=Ee;Ge(q);var et=[{name:\"filenameWithoutExt\",weight:3},{name:\"basename\",weight:2},{name:\"fullPath\",weight:.5},{name:\"dirname\",weight:.3}];function tt(t){if(t.startsWith(\".\")){let e=t.slice(1),s=e.lastIndexOf(\".\");return s<0?t:\".\"+e.slice(0,s)}return t.replace(/\\.[^.]+$/,\"\")}function st(t){return t.map(e=>{let s=e.lastIndexOf(\"/\"),n=s>=0?e.slice(s+1):e,r=tt(n),i=s>=0?e.slice(0,s):\"\";return{fullPath:e,basename:n,filenameWithoutExt:r,dirname:i}})}function Ce(t){let e=st(t);return new I(e,{includeScore:!0,includeMatches:!0,threshold:.3,ignoreLocation:!0,minMatchCharLength:1,keys:et})}function Fe(t){let{fullPath:e,basename:s}=t.item,n=e.length-s.length,r=[\"fullPath\",\"filenameWithoutExt\",\"basename\",\"dirname\"];for(let i of r){let u=t.matches?.find(h=>h.key===i);if(!u?.indices?.length)continue;let c=i===\"basename\"||i===\"filenameWithoutExt\"?n:0,o=[];for(let[h,a]of u.indices)for(let f=h;f<=a;f++)o.push(f+c);return o}return[]}var re=null;if(ie.parentPort){let t=ie.parentPort;t.on(\"message\",e=>{if(e.type===\"build\"){try{re=Ce(e.files),t.postMessage({id:e.id,ok:!0})}catch(s){t.postMessage({id:e.id,ok:!1,error:String(s)})}return}if(e.type===\"search\"){if(!re){t.postMessage({id:e.id,indexing:!0});return}let s=re.search(e.query,{limit:e.maxResults}),n=s.map(r=>{let{fullPath:i,basename:u,dirname:c}=r.item;return{filePath:i,fileName:u,parentPath:c,matchIndices:Fe(r)}});t.postMessage({id:e.id,matches:n,totalMatches:s.length,truncated:s.length>=e.maxResults})}})}\n";
|
package/types/cli/utils/git.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DevToolsSys } from "../../types";
|
|
2
2
|
import type { Credentials } from "../credentials";
|
|
3
|
-
import type { GitConfigs, GitDiagnostics } from "#ai-utils";
|
|
3
|
+
import type { GitConfig, GitConfigs, GitDiagnostics, WorkspaceFolder } from "#ai-utils";
|
|
4
4
|
export interface RunCommandOptions {
|
|
5
5
|
cwd?: string;
|
|
6
6
|
sys?: DevToolsSys;
|
|
@@ -17,7 +17,12 @@ type FetchGitConfigsResult = {
|
|
|
17
17
|
error: Error;
|
|
18
18
|
gitDiagnostics?: GitDiagnostics;
|
|
19
19
|
};
|
|
20
|
+
export declare function scrubGitConfigForTelemetry(config: GitConfig): GitConfig;
|
|
21
|
+
export declare function scrubGitConfigsForTelemetry(gitConfigs: GitConfigs | undefined): GitConfigs | undefined;
|
|
22
|
+
export declare function scrubWorkspaceFolderForTelemetry(folder: WorkspaceFolder): WorkspaceFolder;
|
|
23
|
+
export declare function scrubWorkspaceFoldersForTelemetry(folders: WorkspaceFolder[] | undefined): WorkspaceFolder[] | undefined;
|
|
20
24
|
export declare function runCommand(cmd: string, args: string[], opts: RunCommandOptions): Promise<string>;
|
|
25
|
+
export declare function configureGitHttpAuth(repoPath: string, authHeader: string, opts?: Pick<RunCommandOptions, "sys" | "skipLogging">): Promise<void>;
|
|
21
26
|
export declare function getMonotonicId(): string;
|
|
22
27
|
/**
|
|
23
28
|
* Returns true when the working tree has no uncommitted changes.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom instruction/rules parsing utilities
|
|
3
|
+
* Handles parsing of custom instruction files (.mdc, .cursorrules, etc.)
|
|
4
|
+
*/
|
|
5
|
+
import type { CustomInstruction } from "$/ai-utils";
|
|
6
|
+
/**
|
|
7
|
+
* Parse a custom instruction file
|
|
8
|
+
* Supports both:
|
|
9
|
+
* - .mdc files with YAML frontmatter
|
|
10
|
+
* - Plain text files (.cursorrules, .builderrules, etc.)
|
|
11
|
+
*
|
|
12
|
+
* @param fileContent - Raw file content
|
|
13
|
+
* @param filePath - File path (for generating name and id)
|
|
14
|
+
* @param hashFunction - Optional hash function for generating unique IDs
|
|
15
|
+
* @returns Parsed CustomInstruction or null
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseCustomInstructionFile(fileContent: string, filePath: string, hashFunction?: (content: string) => string): CustomInstruction | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic YAML frontmatter parser for Markdown files
|
|
3
|
+
* Supports both simple key-value pairs and arrays
|
|
4
|
+
*/
|
|
5
|
+
export interface YamlFrontmatterResult<T = Record<string, any>> {
|
|
6
|
+
frontmatter: T;
|
|
7
|
+
body: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Checks if content has YAML frontmatter
|
|
11
|
+
*/
|
|
12
|
+
export declare function hasYamlFrontmatter(content: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Parses YAML frontmatter from a string
|
|
15
|
+
* Handles simple YAML: key-value pairs, arrays, and comments
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseYamlFrontmatter(yamlContent: string): Record<string, any>;
|
|
18
|
+
/**
|
|
19
|
+
* Extracts YAML frontmatter and body from Markdown content
|
|
20
|
+
* @param content - The raw Markdown content with frontmatter
|
|
21
|
+
* @returns Object with frontmatter and body, or null if no frontmatter found
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractYamlFrontmatter(content: string): {
|
|
24
|
+
frontmatterContent: string;
|
|
25
|
+
body: string;
|
|
26
|
+
} | null;
|
|
27
|
+
/**
|
|
28
|
+
* Parse Markdown file with YAML frontmatter
|
|
29
|
+
* @param content - The raw file content
|
|
30
|
+
* @returns Parsed frontmatter and body
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseMarkdownWithYaml<T = Record<string, any>>(content: string): YamlFrontmatterResult<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|