@vpxa/aikit 0.1.233 → 0.1.235
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 +1 -1
- package/packages/chunker/dist/index.d.ts +4 -0
- package/packages/chunker/dist/index.js +1 -1
- package/packages/cli/dist/index.js +3 -3
- package/packages/cli/dist/{init-KEqLRZvX.js → init-C0s-ZRbw.js} +1 -1
- package/packages/cli/dist/{templates-DCTrIlP5.js → templates-BcHM0wJo.js} +2 -2
- package/packages/embeddings/dist/index.js +1 -1
- package/packages/server/dist/bin.js +1 -1
- package/packages/server/dist/config-DzZLgNQT.js +2 -0
- package/packages/server/dist/config-Ymr8iMyI.js +1 -0
- package/packages/server/dist/index.d.ts +55 -1
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/{server-BnJ23Hc4.js → server-992x1P0e.js} +113 -113
- package/packages/server/dist/{server-B3q3h9L3.js → server-DUwue6o8.js} +113 -113
- package/scaffold/definitions/mcp-entry.json +1 -1
- package/scaffold/dist/definitions/mcp-entry.json +1 -1
- package/scaffold/dist/definitions/models.mjs +1 -1
- package/scaffold/dist/definitions/protocols.mjs +1 -1
- package/packages/server/dist/config-8WXJx-zc.js +0 -2
- package/packages/server/dist/config-C35F4tJm.js +0 -1
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
"command": "node",
|
|
4
4
|
"args": [
|
|
5
5
|
"-e",
|
|
6
|
-
"const{execSync:x}=require('child_process');const{readdirSync:r,renameSync:m}=require('fs');const{join:j}=require('path');const c=j(process.env.LOCALAPPDATA||process.env.HOME||'','npm-cache');const s={stdio:'inherit'};try{x('npx -y @vpxa/aikit serve',s)}catch{try{r(c).filter(d=>d.startsWith('_npx')).forEach(d=>{try{m(j(c,d),j(c,d+'_'+Date.now()))}catch{}})}catch{};try{x('npm cache verify',{stdio:'ignore',timeout:30000})}catch{};try{x('npx -y @vpxa/aikit serve',s)}catch(e){process.stderr.write('aikit: all recovery attempts failed. Run: npm cache clean --force && npx -y @vpxa/aikit serve');process.exit(1)}}"
|
|
6
|
+
"const{execSync:x}=require('child_process');const{readdirSync:r,renameSync:m}=require('fs');const{join:j}=require('path');const c=j(process.env.LOCALAPPDATA||process.env.HOME||'','npm-cache');const s={stdio:'inherit'};try{x('npx -y @vpxa/aikit@latest serve',s)}catch{try{r(c).filter(d=>d.startsWith('_npx')).forEach(d=>{try{m(j(c,d),j(c,d+'_'+Date.now()))}catch{}})}catch{};try{x('npm cache verify',{stdio:'ignore',timeout:30000})}catch{};try{x('npx -y @vpxa/aikit@latest serve',s)}catch(e){process.stderr.write('aikit: all recovery attempts failed. Run: npm cache clean --force && npx -y @vpxa/aikit@latest serve');process.exit(1)}}"
|
|
7
7
|
]
|
|
8
8
|
}
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
"command": "node",
|
|
4
4
|
"args": [
|
|
5
5
|
"-e",
|
|
6
|
-
"const{execSync:x}=require('child_process');const{readdirSync:r,renameSync:m}=require('fs');const{join:j}=require('path');const c=j(process.env.LOCALAPPDATA||process.env.HOME||'','npm-cache');const s={stdio:'inherit'};try{x('npx -y @vpxa/aikit serve',s)}catch{try{r(c).filter(d=>d.startsWith('_npx')).forEach(d=>{try{m(j(c,d),j(c,d+'_'+Date.now()))}catch{}})}catch{};try{x('npm cache verify',{stdio:'ignore',timeout:30000})}catch{};try{x('npx -y @vpxa/aikit serve',s)}catch(e){process.stderr.write('aikit: all recovery attempts failed. Run: npm cache clean --force && npx -y @vpxa/aikit serve');process.exit(1)}}"
|
|
6
|
+
"const{execSync:x}=require('child_process');const{readdirSync:r,renameSync:m}=require('fs');const{join:j}=require('path');const c=j(process.env.LOCALAPPDATA||process.env.HOME||'','npm-cache');const s={stdio:'inherit'};try{x('npx -y @vpxa/aikit@latest serve',s)}catch{try{r(c).filter(d=>d.startsWith('_npx')).forEach(d=>{try{m(j(c,d),j(c,d+'_'+Date.now()))}catch{}})}catch{};try{x('npm cache verify',{stdio:'ignore',timeout:30000})}catch{};try{x('npx -y @vpxa/aikit@latest serve',s)}catch(e){process.stderr.write('aikit: all recovery attempts failed. Run: npm cache clean --force && npx -y @vpxa/aikit@latest serve');process.exit(1)}}"
|
|
7
7
|
]
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={Orchestrator:[`GPT-5.4 mini (copilot)`,`GPT-5.4 (copilot)`,`Auto (copilot)`],Planner:[`Claude Opus 4.6 (copilot)`,`GPT-5.4 (copilot)`,`Auto (copilot)`],Implementer:[`GPT-5.4 mini (copilot)`,`GPT-5.4 (copilot)`,`GPT-5.3-Codex (copilot)`,`Auto (copilot)`],Frontend:[`GPT-5.4 (copilot)`,`Gemini 3.1 Pro (Preview) (copilot)`,`GPT-5.3-Codex (copilot)`,`Auto (copilot)`],Debugger:[`Claude Opus 4.6 (copilot)`,`GPT-5.4 (copilot)`,`GPT-5.3-Codex (copilot)`,`Auto (copilot)`],Refactor:[`GPT-5.4 (copilot)`,`GPT-5.3-Codex (copilot)`,`Auto (copilot)`],Security:[`Claude Opus 4.6 (copilot)`,`GPT-5.4 (copilot)`,`Auto (copilot)`],Documenter:[`GPT-5 mini (copilot)`,`GPT-5.4 mini (copilot)`,`Auto (copilot)`],Explorer:[`GPT-5 mini (copilot)`,`Gemini 3 Flash (Preview) (copilot)`,`Auto (copilot)`],"Researcher-Alpha":[`Claude Opus 4.6 (copilot)`,`Auto (copilot)`],"Researcher-Beta":[`Claude Sonnet 4.6 (copilot)`,`Auto (copilot)`],"Researcher-Gamma":[`GPT-5.4 (copilot)`,`Auto (copilot)`],"Researcher-Delta":[`Gemini 3.1 Pro (Preview) (copilot)`,`Auto (copilot)`],"Code-Reviewer-Alpha":[`GPT-5.4 (copilot)`,`Auto (copilot)`],"Code-Reviewer-Beta":[`Claude Opus 4.6 (copilot)`,`Auto (copilot)`],"Architect-Reviewer-Alpha":[`GPT-5.4 (copilot)`,`Auto (copilot)`],"Architect-Reviewer-Beta":[`Claude Opus 4.6 (copilot)`,`Auto (copilot)`]},t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(Array.isArray(t)?t[0]:t)?.replace(/ \(copilot\)$/,``)||`Auto`])),n={Researcher:[`Alpha`,`Beta`,`Gamma`,`Delta`],"Code-Reviewer":[`Alpha`,`Beta`],"Architect-Reviewer":[`Alpha`,`Beta`]},r={Researcher:`Alpha`,"Code-Reviewer":`Alpha`,"Architect-Reviewer":`Alpha`};export{t as CLAUDE_MODELS,e as COPILOT_MODELS,r as PRIMARY_VARIANT,n as VARIANT_GROUPS};
|
|
1
|
+
const e={Orchestrator:[`GPT-5.4 mini (copilot)`,`GPT-5.4 (copilot)`,`Auto (copilot)`],Planner:[`Claude Opus 4.6 (copilot)`,`GPT-5.4 (copilot)`,`Auto (copilot)`],Implementer:[`GPT-5.4 mini (copilot)`,`GPT-5.4 (copilot)`,`GPT-5.3-Codex (copilot)`,`Auto (copilot)`],Frontend:[`GPT-5.4 mini (copilot)`,`GPT-5.4 (copilot)`,`Gemini 3.1 Pro (Preview) (copilot)`,`GPT-5.3-Codex (copilot)`,`Auto (copilot)`],Debugger:[`Claude Opus 4.6 (copilot)`,`GPT-5.4 (copilot)`,`GPT-5.3-Codex (copilot)`,`Auto (copilot)`],Refactor:[`GPT-5.4 (copilot)`,`GPT-5.3-Codex (copilot)`,`Auto (copilot)`],Security:[`Claude Opus 4.6 (copilot)`,`GPT-5.4 (copilot)`,`Auto (copilot)`],Documenter:[`GPT-5 mini (copilot)`,`GPT-5.4 mini (copilot)`,`Auto (copilot)`],Explorer:[`GPT-5 mini (copilot)`,`Gemini 3 Flash (Preview) (copilot)`,`Auto (copilot)`],"Researcher-Alpha":[`Claude Opus 4.6 (copilot)`,`Auto (copilot)`],"Researcher-Beta":[`Claude Sonnet 4.6 (copilot)`,`Auto (copilot)`],"Researcher-Gamma":[`GPT-5.4 (copilot)`,`Auto (copilot)`],"Researcher-Delta":[`Gemini 3.1 Pro (Preview) (copilot)`,`Auto (copilot)`],"Code-Reviewer-Alpha":[`GPT-5.4 (copilot)`,`Auto (copilot)`],"Code-Reviewer-Beta":[`Claude Opus 4.6 (copilot)`,`Auto (copilot)`],"Architect-Reviewer-Alpha":[`GPT-5.4 (copilot)`,`Auto (copilot)`],"Architect-Reviewer-Beta":[`Claude Opus 4.6 (copilot)`,`Auto (copilot)`]},t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(Array.isArray(t)?t[0]:t)?.replace(/ \(copilot\)$/,``)||`Auto`])),n={Researcher:[`Alpha`,`Beta`,`Gamma`,`Delta`],"Code-Reviewer":[`Alpha`,`Beta`],"Architect-Reviewer":[`Alpha`,`Beta`]},r={Researcher:`Alpha`,"Code-Reviewer":`Alpha`,"Architect-Reviewer":`Alpha`};export{t as CLAUDE_MODELS,e as COPILOT_MODELS,r as PRIMARY_VARIANT,n as VARIANT_GROUPS};
|
|
@@ -20,7 +20,7 @@ ${e===`<PROFILE>`?`**Profile:** Check your role → implementer | documenter | r
|
|
|
20
20
|
---`}function t(){return"\n## Evidence Citation Protocol (tier-aware)\n\nNo FORGE `task_id` → skip `evidence_map`; use `file:line` citations only.\nDo not create your own `task_id` or run the gate.\n\n| Tier | Your responsibility |\n|------|---------------------|\n| Floor | Findings with `file.ts#Lxx` citations. No `evidence_map`. |\n| Standard | Add 2-4 CRITICAL/HIGH findings with receipts. |\n| Critical | Add all CRITICAL/HIGH findings; tag contract/security claims with `safety_gate`. |\n\n**Every response MUST include:**\n- `**FORGE Task ID:** <task_id>` (passed in by Orchestrator, or state \"not provided\")\n- `**Tier applied:** Floor | Standard | Critical`\n- `**Findings:** <list>` with `file:line` receipts\n- Verdict: `APPROVED` | `CHANGES_REQUESTED` | `BLOCKED`\n\nDo NOT create a new `evidence_map`, run `evidence_map({action:'gate'})`, or add non-critical noise."}function n(...e){return e.filter(Boolean).join(`
|
|
21
21
|
|
|
22
22
|
`)}function r({title:e=`Knowledge Recall`,intro:t,commands:r,followUp:i}={}){return n(`## Pre-Task: ${e} (MANDATORY)`,t,["```",...(Array.isArray(r)?r:[r]).filter(Boolean),"```"].join(`
|
|
23
|
-
`),i)}function i(){return n(`## Post-Task: Capture Lesson`,`**HARD RULE:** Before DONE, capture 1-2 lessons unless change is pure config/formatting.`,'Quick capture:\n```\nknowledge({ action: "lesson", subAction: "create", context: "<what situation you faced>", insight: "<what principle the solution demonstrates>", evidence: "<file:line or commit that proves it>", confidence: 65 })\n```',"If recalled lesson was confirmed/invalid, use `confirm` or `contradict`.")}const a=n(`## Output Rules (HARD RULE)`,"Follow the **Presentation Priority** (1st Inline Visual → 2nd Interactive → 3rd Plain Text). Use `present` for any response longer than 3 lines, especially summaries, comparisons, reports, task plans, verdicts, and progress. Use plain text only for short confirmations, simple questions, or explicitly text-only status updates."),o=n(`## AI Kit Recovery`,"If AI Kit tools are unavailable or missing, run `npx -y @vpxa/aikit init --user`, then reload the client so the `aikit` MCP server and user instructions become available."),s={"code-agent-base":`# Code Agent — Shared Base Instructions
|
|
23
|
+
`),i)}function i(){return n(`## Post-Task: Capture Lesson`,`**HARD RULE:** Before DONE, capture 1-2 lessons unless change is pure config/formatting.`,'Quick capture:\n```\nknowledge({ action: "lesson", subAction: "create", context: "<what situation you faced>", insight: "<what principle the solution demonstrates>", evidence: "<file:line or commit that proves it>", confidence: 65 })\n```',"If recalled lesson was confirmed/invalid, use `confirm` or `contradict`.")}const a=n(`## Output Rules (HARD RULE)`,"Follow the **Presentation Priority** (1st Inline Visual → 2nd Interactive → 3rd Plain Text). Use `present` for any response longer than 3 lines, especially summaries, comparisons, reports, task plans, verdicts, and progress. Use plain text only for short confirmations, simple questions, or explicitly text-only status updates."),o=n(`## AI Kit Recovery`,"If AI Kit tools are unavailable or missing, run `npx -y @vpxa/aikit@latest init --user`, then reload the client so the `aikit` MCP server and user instructions become available."),s={"code-agent-base":`# Code Agent — Shared Base Instructions
|
|
24
24
|
|
|
25
25
|
> Shared protocol for code-writing agents. Agent-specific files should not duplicate it.
|
|
26
26
|
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as e,t}from"./retention-C3tsarCT.js";import{o as n,t as r}from"./supersession-DO_ZROFl.js";import{existsSync as i,readFileSync as a,writeFileSync as o}from"node:fs";import{dirname as s,resolve as c}from"node:path";import{fileURLToPath as l}from"node:url";import{AIKIT_PATHS as u,EMBEDDING_DEFAULTS as d,createLogger as f,getPartitionDir as p,isUserInstalled as m,registerWorkspace as h,serializeError as g}from"../../core/dist/index.js";const _=s(l(import.meta.url)),v=f(`server`),y=[`auto`,`manual`,`smart`],b={model:d.model,dimensions:d.dimensions,childProcess:!0,idleTimeoutMs:6e4};function x(e){return typeof e==`string`&&y.includes(e)}function S(e,t,n){let r=c(e),i=c(t);if(!r.startsWith(i))throw Error(`Config ${n} path escapes workspace root: ${e} is not under ${t}`);return r}function C(e){let t=process.env.AIKIT_INDEX_MODE;if(x(t))return t;if(e.indexMode)return e.indexMode;let n=process.env.AIKIT_AUTO_INDEX;return n===void 0?e.autoIndex===void 0?`smart`:e.autoIndex?`auto`:`manual`:n===`true`?`auto`:`manual`}function w(){let o=process.env.AIKIT_CONFIG_PATH??(i(c(process.cwd(),`aikit.config.json`))?c(process.cwd(),`aikit.config.json`):c(_,`..`,`..`,`..`,`aikit.config.json`));try{if(!i(o))return v.info(`No config file found, using defaults`,{configPath:o}),E();let l=a(o,`utf-8`),d=JSON.parse(l);if(d.embedding={...b,...d.embedding},d.memory={retention:{...t,...d.memory?.retention},lessons:{...n,...d.memory?.lessons},consolidation:{...e,...d.memory?.consolidation},supersession:{...r,...d.memory?.supersession}},!d.sources||!Array.isArray(d.sources)||d.sources.length===0)throw Error(`Config must have at least one source`);if(!d.store?.path)throw Error(`Config must specify store.path`);if(d.autoIndex!==void 0&&typeof d.autoIndex!=`boolean`)throw Error(`Config autoIndex must be a boolean`);if(d.indexMode!==void 0&&!x(d.indexMode))throw Error(`Config indexMode must be one of: ${y.join(`, `)}`);let f=s(o);return d.sources=d.sources.map(e=>({...e,path:S(c(f,e.path),f,`source`)})),d.store.path=S(c(f,d.store.path),f,`store`),d.curated=d.curated??{path:u.aiCurated},d.curated.path=S(c(f,d.curated.path),f,`curated`),O(d,f),D(d,o),d.indexMode=C(d),d}catch(e){return v.error(`Failed to load config`,{configPath:o,...g(e)}),v.warn(`Falling back to default configuration`,{configPath:o}),E()}}const T=[`.git/**`,`**/node_modules/**`,`*.lock`,`pnpm-lock.yaml`,`package-lock.json`,`**/dist/**`,`**/build/**`,`**/out/**`,`**/.output/**`,`**/cdk.out/**`,`**/.next/**`,`**/.nuxt/**`,`**/.vercel/**`,`**/.serverless/**`,`**/.turbo/**`,`**/.cache/**`,`**/.parcel-cache/**`,`**/coverage/**`,`**/.terraform/**`,`**/__pycache__/**`,`**/.venv/**`,`**/.docusaurus/**`,`**/.temp/**`,`**/tmp/**`];function E(){let i=process.env.AIKIT_WORKSPACE_ROOT??process.cwd(),a={sources:[{path:i,excludePatterns:[...T]}],serverName:`aikit`,indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{...b},store:{backend:`sqlite-vec`,path:c(i,u.data)},curated:{path:c(i,u.aiCurated)},memory:{retention:{...t},lessons:{...n},consolidation:{...e},supersession:{...r}},onboardDir:c(i,u.aiContext),stateDir:c(i,u.state)};return O(a,i),a.indexMode=C(a),a}function D(e,t){let n=e.configVersion??0;if(n>=1)return e;if(n<1)for(let t of e.sources){t.excludePatterns=t.excludePatterns??[];let e=new Set(t.excludePatterns);for(let n of T)e.has(n)||t.excludePatterns.push(n)}e.configVersion=1;try{o(t,`${JSON.stringify(e,null,2)}\n`,`utf-8`),v.info(`Config auto-upgraded`,{from:n,to:1,configPath:t})}catch(e){v.warn(`Failed to write upgraded config`,{configPath:t,...g(e)})}return e}function O(e,t){if(!m())return;let n=h(t);e.store.path=c(p(n.partition)),e.onboardDir=c(p(n.partition),`onboard`),e.stateDir=c(p(n.partition),`state`),e.curated={path:c(p(n.partition),`curated`)}}function k(e,t){if(!i(t))throw Error(`Workspace root does not exist: ${t}`);v.info(`Reconfiguring for workspace root`,{workspaceRoot:t});try{process.chdir(t),v.info(`Changed process cwd to workspace root`,{cwd:process.cwd()})}catch(e){v.warn(`Failed to chdir to workspace root`,{workspaceRoot:t,...g(e)})}e.sources=[{path:t,excludePatterns:e.sources[0]?.excludePatterns??[`node_modules/**`,`dist/**`,`.git/**`,`coverage/**`,`*.lock`,`pnpm-lock.yaml`]}],e.store.path=c(t,u.data),e.curated={path:c(t,u.aiCurated)},e.onboardDir=c(t,u.aiContext),e.stateDir=c(t,u.state),O(e,t)}export{T as DEFAULT_EXCLUDE_PATTERNS,w as loadConfig,k as reconfigureForWorkspace,C as resolveIndexMode};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./retention-B4ITAs7F.js";import{o as n,t as r}from"./supersession-CWEne3av.js";import{existsSync as i,readFileSync as a,writeFileSync as o}from"node:fs";import{dirname as s,resolve as c}from"node:path";import{fileURLToPath as l}from"node:url";import{AIKIT_PATHS as u,EMBEDDING_DEFAULTS as d,createLogger as f,getPartitionDir as p,isUserInstalled as m,registerWorkspace as h,serializeError as g}from"../../core/dist/index.js";const _=s(l(import.meta.url)),v=f(`server`),y=[`auto`,`manual`,`smart`],b={model:d.model,dimensions:d.dimensions,childProcess:!0,idleTimeoutMs:6e4};function x(e){return typeof e==`string`&&y.includes(e)}function S(e,t,n){let r=c(e),i=c(t);if(!r.startsWith(i))throw Error(`Config ${n} path escapes workspace root: ${e} is not under ${t}`);return r}function C(e){let t=process.env.AIKIT_INDEX_MODE;if(x(t))return t;if(e.indexMode)return e.indexMode;let n=process.env.AIKIT_AUTO_INDEX;return n===void 0?e.autoIndex===void 0?`smart`:e.autoIndex?`auto`:`manual`:n===`true`?`auto`:`manual`}function w(){let o=process.env.AIKIT_CONFIG_PATH??(i(c(process.cwd(),`aikit.config.json`))?c(process.cwd(),`aikit.config.json`):c(_,`..`,`..`,`..`,`aikit.config.json`));try{if(!i(o))return v.info(`No config file found, using defaults`,{configPath:o}),E();let l=a(o,`utf-8`),d=JSON.parse(l);if(d.embedding={...b,...d.embedding},d.memory={retention:{...t,...d.memory?.retention},lessons:{...n,...d.memory?.lessons},consolidation:{...e,...d.memory?.consolidation},supersession:{...r,...d.memory?.supersession}},!d.sources||!Array.isArray(d.sources)||d.sources.length===0)throw Error(`Config must have at least one source`);if(!d.store?.path)throw Error(`Config must specify store.path`);if(d.autoIndex!==void 0&&typeof d.autoIndex!=`boolean`)throw Error(`Config autoIndex must be a boolean`);if(d.indexMode!==void 0&&!x(d.indexMode))throw Error(`Config indexMode must be one of: ${y.join(`, `)}`);let f=s(o);return d.sources=d.sources.map(e=>({...e,path:S(c(f,e.path),f,`source`)})),d.store.path=S(c(f,d.store.path),f,`store`),d.curated=d.curated??{path:u.aiCurated},d.curated.path=S(c(f,d.curated.path),f,`curated`),O(d,f),D(d,o),d.indexMode=C(d),d}catch(e){return v.error(`Failed to load config`,{configPath:o,...g(e)}),v.warn(`Falling back to default configuration`,{configPath:o}),E()}}const T=[`.git/**`,`**/node_modules/**`,`*.lock`,`pnpm-lock.yaml`,`package-lock.json`,`**/dist/**`,`**/build/**`,`**/out/**`,`**/.output/**`,`**/cdk.out/**`,`**/.next/**`,`**/.nuxt/**`,`**/.vercel/**`,`**/.serverless/**`,`**/.turbo/**`,`**/.cache/**`,`**/.parcel-cache/**`,`**/coverage/**`,`**/.terraform/**`,`**/__pycache__/**`,`**/.venv/**`,`**/.docusaurus/**`,`**/.temp/**`,`**/tmp/**`];function E(){let i=process.env.AIKIT_WORKSPACE_ROOT??process.cwd(),a={sources:[{path:i,excludePatterns:[...T]}],serverName:`aikit`,indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{...b},store:{backend:`sqlite-vec`,path:c(i,u.data)},curated:{path:c(i,u.aiCurated)},memory:{retention:{...t},lessons:{...n},consolidation:{...e},supersession:{...r}},onboardDir:c(i,u.aiContext),stateDir:c(i,u.state)};return O(a,i),a.indexMode=C(a),a}function D(e,t){let n=e.configVersion??0;if(n>=1)return e;if(n<1)for(let t of e.sources){t.excludePatterns=t.excludePatterns??[];let e=new Set(t.excludePatterns);for(let n of T)e.has(n)||t.excludePatterns.push(n)}e.configVersion=1;try{o(t,`${JSON.stringify(e,null,2)}\n`,`utf-8`),v.info(`Config auto-upgraded`,{from:n,to:1,configPath:t})}catch(e){v.warn(`Failed to write upgraded config`,{configPath:t,...g(e)})}return e}function O(e,t){if(!m())return;let n=h(t);e.store.path=c(p(n.partition)),e.onboardDir=c(p(n.partition),`onboard`),e.stateDir=c(p(n.partition),`state`),e.curated={path:c(p(n.partition),`curated`)}}function k(e,t){if(!i(t))throw Error(`Workspace root does not exist: ${t}`);v.info(`Reconfiguring for workspace root`,{workspaceRoot:t});try{process.chdir(t),v.info(`Changed process cwd to workspace root`,{cwd:process.cwd()})}catch(e){v.warn(`Failed to chdir to workspace root`,{workspaceRoot:t,...g(e)})}e.sources=[{path:t,excludePatterns:e.sources[0]?.excludePatterns??[`node_modules/**`,`dist/**`,`.git/**`,`coverage/**`,`*.lock`,`pnpm-lock.yaml`]}],e.store.path=c(t,u.data),e.curated={path:c(t,u.aiCurated)},e.onboardDir=c(t,u.aiContext),e.stateDir=c(t,u.state),O(e,t)}export{T as DEFAULT_EXCLUDE_PATTERNS,w as loadConfig,k as reconfigureForWorkspace,C as resolveIndexMode};
|