@vpxa/aikit 0.1.1 → 0.1.3
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/README.md +8 -8
- package/package.json +1 -1
- package/packages/aikit-client/dist/types.d.ts +3 -3
- package/packages/cli/dist/aikit-init.d.ts +1 -1
- package/packages/cli/dist/aikit-init.js +1 -1
- package/packages/cli/dist/commands/context-cmds.js +1 -1
- package/packages/cli/dist/commands/environment.js +1 -1
- package/packages/cli/dist/commands/init/config.d.ts +1 -1
- package/packages/cli/dist/commands/init/config.js +2 -2
- package/packages/cli/dist/commands/init/constants.d.ts +3 -3
- package/packages/cli/dist/commands/init/index.d.ts +4 -4
- package/packages/cli/dist/commands/init/index.js +4 -4
- package/packages/cli/dist/commands/init/templates.js +12 -12
- package/packages/cli/dist/commands/init/user.d.ts +3 -3
- package/packages/cli/dist/commands/init/user.js +2 -2
- package/packages/cli/dist/commands/search.js +1 -1
- package/packages/cli/dist/commands/system.js +4 -4
- package/packages/cli/dist/commands/upgrade.js +1 -1
- package/packages/cli/dist/commands/workspace.js +1 -1
- package/packages/cli/dist/helpers.js +1 -1
- package/packages/cli/dist/index.d.ts +1 -1
- package/packages/core/dist/constants.d.ts +3 -3
- package/packages/core/dist/global-registry.d.ts +7 -1
- package/packages/core/dist/global-registry.js +1 -1
- package/packages/core/dist/index.d.ts +2 -2
- package/packages/core/dist/index.js +1 -1
- package/packages/core/dist/types.d.ts +6 -2
- package/packages/dashboard/dist/assets/{index-BjA4YODs.js → index-CO2S9BKY.js} +2 -2
- package/packages/dashboard/dist/assets/index-CO2S9BKY.js.map +1 -0
- package/packages/dashboard/dist/index.html +2 -2
- package/packages/enterprise-bridge/dist/er-client.d.ts +1 -1
- package/packages/flows/dist/git.js +1 -1
- package/packages/flows/dist/registry.d.ts +3 -3
- package/packages/flows/dist/registry.js +1 -1
- package/packages/flows/dist/symlinks.js +1 -1
- package/packages/indexer/dist/filesystem-crawler.js +1 -1
- package/packages/indexer/dist/hash-cache.js +1 -1
- package/packages/indexer/dist/incremental-indexer.js +1 -1
- package/packages/kb-client/dist/direct-client.d.ts +37 -0
- package/packages/kb-client/dist/direct-client.js +1 -0
- package/packages/kb-client/dist/index.d.ts +5 -0
- package/packages/kb-client/dist/index.js +1 -0
- package/packages/kb-client/dist/mcp-client.d.ts +19 -0
- package/packages/kb-client/dist/mcp-client.js +4 -0
- package/packages/kb-client/dist/parsers.d.ts +35 -0
- package/packages/kb-client/dist/parsers.js +2 -0
- package/packages/kb-client/dist/types.d.ts +62 -0
- package/packages/kb-client/dist/types.js +1 -0
- package/packages/present/dist/index.html +28 -28
- package/packages/server/dist/background-task.d.ts +47 -0
- package/packages/server/dist/background-task.js +1 -0
- package/packages/server/dist/config.js +1 -1
- package/packages/server/dist/idle-timer.d.ts +33 -0
- package/packages/server/dist/idle-timer.js +1 -0
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/memory-monitor.d.ts +37 -0
- package/packages/server/dist/memory-monitor.js +1 -0
- package/packages/server/dist/prompts.js +5 -5
- package/packages/server/dist/resource-links.d.ts +1 -1
- package/packages/server/dist/resource-links.js +1 -1
- package/packages/server/dist/resources/curated-resources.d.ts +2 -2
- package/packages/server/dist/resources/curated-resources.js +2 -2
- package/packages/server/dist/resources/resource-notifier.d.ts +1 -1
- package/packages/server/dist/resources/resource-notifier.js +1 -1
- package/packages/server/dist/resources/resources.js +1 -1
- package/packages/server/dist/server.d.ts +4 -2
- package/packages/server/dist/server.js +3 -3
- package/packages/server/dist/tool-metadata.d.ts +1 -1
- package/packages/server/dist/tool-metadata.js +1 -1
- package/packages/server/dist/tool-timeout.d.ts +27 -0
- package/packages/server/dist/tool-timeout.js +1 -0
- package/packages/server/dist/tools/bridge.tools.d.ts +1 -1
- package/packages/server/dist/tools/bridge.tools.js +3 -3
- package/packages/server/dist/tools/config.tool.d.ts +8 -0
- package/packages/server/dist/tools/config.tool.js +12 -0
- package/packages/server/dist/tools/evolution.tools.js +1 -1
- package/packages/server/dist/tools/flow.tools.js +1 -1
- package/packages/server/dist/tools/infra.tools.js +1 -1
- package/packages/server/dist/tools/onboard.tool.js +1 -1
- package/packages/server/dist/tools/present/browser.js +9 -9
- package/packages/server/dist/tools/present/tool.js +4 -4
- package/packages/server/dist/tools/reindex.tool.js +1 -1
- package/packages/server/dist/tools/search.tool.js +4 -4
- package/packages/server/dist/tools/status.tool.d.ts +1 -1
- package/packages/server/dist/tools/status.tool.js +3 -3
- package/packages/store/dist/sqlite-graph-store.d.ts +3 -0
- package/packages/store/dist/sqlite-graph-store.js +3 -3
- package/packages/tools/dist/checkpoint.js +1 -1
- package/packages/tools/dist/config-extractor.js +1 -1
- package/packages/tools/dist/evidence-map.js +1 -1
- package/packages/tools/dist/find.d.ts +1 -1
- package/packages/tools/dist/forge-ground.d.ts +1 -1
- package/packages/tools/dist/guide.js +1 -1
- package/packages/tools/dist/lane.js +1 -1
- package/packages/tools/dist/onboard.d.ts +2 -2
- package/packages/tools/dist/onboard.js +2 -2
- package/packages/tools/dist/queue.js +1 -1
- package/packages/tools/dist/replay.js +1 -1
- package/packages/tools/dist/response-envelope.d.ts +1 -1
- package/packages/tools/dist/restore-points.js +1 -1
- package/packages/tools/dist/schema-validate.js +1 -1
- package/packages/tools/dist/snippet.js +1 -1
- package/packages/tools/dist/stash.js +1 -1
- package/packages/tools/dist/synthesis-engine.js +2 -2
- package/packages/tools/dist/workset.js +1 -1
- package/packages/tui/dist/{App-DU2KEylW.js → App-DpjN3iS-.js} +1 -1
- package/packages/tui/dist/App.d.ts +1 -1
- package/packages/tui/dist/App.js +1 -1
- package/packages/tui/dist/LogPanel-Db-SeZhR.js +3 -0
- package/packages/tui/dist/hooks/useKBClient.d.ts +1 -1
- package/packages/tui/dist/{index-BXafekwr.d.ts → index-MXJeXmCf.d.ts} +3 -3
- package/packages/tui/dist/index.d.ts +1 -1
- package/packages/tui/dist/index.js +1 -1
- package/packages/tui/dist/panels/LogPanel.js +1 -1
- package/scaffold/README.md +192 -192
- package/scaffold/definitions/bodies.mjs +16 -16
- package/scaffold/definitions/plugins.mjs +1 -1
- package/scaffold/definitions/prompts.mjs +6 -6
- package/scaffold/definitions/protocols.mjs +12 -12
- package/scaffold/definitions/tools.mjs +1 -1
- package/scaffold/flows/aikit-advanced/skills/execute/SKILL.md +124 -124
- package/scaffold/flows/aikit-advanced/skills/plan/SKILL.md +100 -100
- package/scaffold/flows/aikit-advanced/skills/spec/SKILL.md +100 -100
- package/scaffold/flows/aikit-advanced/skills/task/SKILL.md +99 -99
- package/scaffold/flows/aikit-advanced/skills/verify/SKILL.md +122 -122
- package/scaffold/flows/aikit-basic/skills/assess/SKILL.md +82 -82
- package/scaffold/flows/aikit-basic/skills/implement/SKILL.md +105 -105
- package/scaffold/flows/aikit-basic/skills/verify/SKILL.md +96 -96
- package/scaffold/general/agents/Debugger.agent.md +2 -2
- package/scaffold/general/agents/Documenter.agent.md +2 -2
- package/scaffold/general/agents/Explorer.agent.md +2 -2
- package/scaffold/general/agents/Frontend.agent.md +1 -1
- package/scaffold/general/agents/Implementer.agent.md +2 -2
- package/scaffold/general/agents/Orchestrator.agent.md +1 -1
- package/scaffold/general/agents/Planner.agent.md +2 -2
- package/scaffold/general/agents/Refactor.agent.md +2 -2
- package/scaffold/general/agents/Security.agent.md +2 -2
- package/scaffold/general/agents/_shared/architect-reviewer-base.md +1 -1
- package/scaffold/general/agents/_shared/code-agent-base.md +6 -6
- package/scaffold/general/agents/_shared/code-reviewer-base.md +1 -1
- package/scaffold/general/agents/_shared/forge-protocol.md +1 -1
- package/scaffold/general/agents/_shared/researcher-base.md +3 -3
- package/scaffold/general/prompts/ask.prompt.md +4 -4
- package/scaffold/general/prompts/debug.prompt.md +1 -1
- package/scaffold/general/prompts/plan.prompt.md +1 -1
- package/scaffold/general/skills/aikit/SKILL.md +5 -5
- package/scaffold/general/skills/multi-agents-development/SKILL.md +435 -435
- package/scaffold/general/skills/present/SKILL.md +424 -424
- package/packages/dashboard/dist/assets/index-BjA4YODs.js.map +0 -1
- package/packages/tui/dist/LogPanel-Bo8a8QXB.js +0 -3
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ This is an **MCP (Model Context Protocol) server** that gives AI agents:
|
|
|
23
23
|
8. **Graph auto-population** — during indexing, a lightweight regex extractor builds the knowledge graph automatically from TS/JS source files (functions, classes, interfaces, types, imports)
|
|
24
24
|
9. **Optimized reindex** — full reindex skips redundant hash checks, batches graph writes (flush every 50 files), and skips per-file graph deletes when bulk-cleared
|
|
25
25
|
|
|
26
|
-
The
|
|
26
|
+
The AI Kit auto-indexes configured source directories on startup, stores embeddings in a local LanceDB vector store, and exposes everything through 67 MCP tools, 45 CLI commands, and 2 resources.
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
@@ -62,7 +62,7 @@ npx @vpxa/aikit init --guide # Check which files are outdated
|
|
|
62
62
|
|
|
63
63
|
## User-Level vs Workspace Mode
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
AI Kit supports two installation modes:
|
|
66
66
|
|
|
67
67
|
| | User-Level | Workspace |
|
|
68
68
|
|---|---|---|
|
|
@@ -70,7 +70,7 @@ KB supports two installation modes:
|
|
|
70
70
|
| **MCP config** | User-level (IDE-wide) | `.vscode/mcp.json` (workspace) |
|
|
71
71
|
| **Data store** | `~/.aikit-data/<partition>/` | `.aikit-data/store/` (in project) |
|
|
72
72
|
| **Skills** | `~/.aikit-data/skills/` | `.github/skills/` (in project) |
|
|
73
|
-
| **Config** | Auto defaults per workspace | `
|
|
73
|
+
| **Config** | Auto defaults per workspace | `aikit.config.json` (in project) |
|
|
74
74
|
|
|
75
75
|
### How it works
|
|
76
76
|
|
|
@@ -318,7 +318,7 @@ aikit init [--user|--workspace] [--force] [--guide]
|
|
|
318
318
|
|
|
319
319
|
## Configuration
|
|
320
320
|
|
|
321
|
-
`
|
|
321
|
+
`aikit.config.json`:
|
|
322
322
|
|
|
323
323
|
```json
|
|
324
324
|
{
|
|
@@ -598,7 +598,7 @@ Returns JSON structured parse result with errors, warnings, and file references.
|
|
|
598
598
|
| `task` | string | **yes** | — | Task description |
|
|
599
599
|
| `files` | string[] | **yes** | — | Target files being modified (absolute paths) |
|
|
600
600
|
| `root_path` | string | **yes** | — | Root path of the codebase |
|
|
601
|
-
| `max_constraints` | number (0–10) | no | `3` | Max constraint entries to load from
|
|
601
|
+
| `max_constraints` | number (0–10) | no | `3` | Max constraint entries to load from AI Kit |
|
|
602
602
|
| `force_tier` | enum | no | auto | Force tier: `floor`, `standard`, `critical` (skips auto-classification) |
|
|
603
603
|
| `task_id` | string | no | auto-generated | Custom task ID for evidence map |
|
|
604
604
|
|
|
@@ -996,7 +996,7 @@ Isolated file copies for parallel exploration. Create a lane, make changes, diff
|
|
|
996
996
|
| `goal` | string | **yes** | — | What you want to accomplish |
|
|
997
997
|
| `max_recommendations` | number | no | 5 | Max tools to recommend (1-10) |
|
|
998
998
|
|
|
999
|
-
Given a goal description, recommends which
|
|
999
|
+
Given a goal description, recommends which AI Kit tools to use and in what order. Matches against 10 predefined workflows: onboard, audit, bugfix, implement, refactor, search, context, memory, validate, analyze.
|
|
1000
1000
|
|
|
1001
1001
|
#### `aikit_health` — Run project health checks
|
|
1002
1002
|
|
|
@@ -1037,8 +1037,8 @@ Shows the audit trail of recent tool invocations. Each entry includes tool name,
|
|
|
1037
1037
|
|
|
1038
1038
|
| URI | Name | Description |
|
|
1039
1039
|
|-----|------|-------------|
|
|
1040
|
-
| `
|
|
1041
|
-
| `
|
|
1040
|
+
| `aikit://status` | `aikit-status` | Quick status: record count, file count, last indexed time |
|
|
1041
|
+
| `aikit://file-tree` | `aikit-file-tree` | Sorted list of all indexed source file paths |
|
|
1042
1042
|
|
|
1043
1043
|
---
|
|
1044
1044
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region packages/aikit-client/src/types.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* IKBClient — Unified data access interface for
|
|
3
|
+
* IKBClient — Unified data access interface for AI Kit consumers.
|
|
4
4
|
*
|
|
5
5
|
* Implemented by:
|
|
6
6
|
* - DirectKBClient (in-process, used by TUI)
|
|
@@ -42,9 +42,9 @@ interface KBGraphData {
|
|
|
42
42
|
}>;
|
|
43
43
|
}
|
|
44
44
|
interface IKBClient {
|
|
45
|
-
/** Get
|
|
45
|
+
/** Get AI Kit status. */
|
|
46
46
|
getStatus(): Promise<KBStatus>;
|
|
47
|
-
/** Search
|
|
47
|
+
/** Search AI Kit. */
|
|
48
48
|
search(query: string, options?: {
|
|
49
49
|
limit?: number;
|
|
50
50
|
mode?: 'hybrid' | 'semantic' | 'keyword';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as e,readFileSync as t}from"node:fs";import{dirname as n,resolve as r}from"node:path";import{initializeWasm as i}from"../../chunker/dist/index.js";import{AIKIT_PATHS as a,getPartitionDir as o,isUserInstalled as s,registerWorkspace as c}from"../../core/dist/index.js";import{OnnxEmbedder as l}from"../../embeddings/dist/index.js";import{IncrementalIndexer as u}from"../../indexer/dist/index.js";import{SqliteGraphStore as d,createStore as f}from"../../store/dist/index.js";function p(){let i=process.env.AIKIT_CONFIG_PATH??(e(r(process.cwd(),`
|
|
1
|
+
import{existsSync as e,readFileSync as t}from"node:fs";import{dirname as n,resolve as r}from"node:path";import{initializeWasm as i}from"../../chunker/dist/index.js";import{AIKIT_PATHS as a,getPartitionDir as o,isUserInstalled as s,registerWorkspace as c}from"../../core/dist/index.js";import{OnnxEmbedder as l}from"../../embeddings/dist/index.js";import{IncrementalIndexer as u}from"../../indexer/dist/index.js";import{SqliteGraphStore as d,createStore as f}from"../../store/dist/index.js";function p(){let i=process.env.AIKIT_CONFIG_PATH??(e(r(process.cwd(),`aikit.config.json`))?r(process.cwd(),`aikit.config.json`):null);if(!i)return m();let a=t(i,`utf-8`),o;try{o=JSON.parse(a)}catch{console.error(`Failed to parse ${i} as JSON. Ensure the file contains valid JSON.`),process.exit(1)}let s=n(i);return o.sources=o.sources.map(e=>({...e,path:r(s,e.path)})),o.store.path=r(s,o.store.path),o.curated=o.curated??{path:`curated`},o.curated.path=r(s,o.curated.path),h(o,s),o}function m(){let e=process.env.AIKIT_WORKSPACE_ROOT??process.cwd(),t={sources:[{path:e,excludePatterns:[`node_modules/**`,`dist/**`,`.git/**`,`coverage/**`,`*.lock`,`pnpm-lock.yaml`]}],serverName:`aikit`,indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{model:`mixedbread-ai/mxbai-embed-large-v1`,dimensions:1024},store:{backend:`lancedb`,path:r(e,a.data)},curated:{path:r(e,a.aiCurated)},stateDir:r(e,a.state)};return h(t,e),t}function h(e,t){if(!s())return;let n=c(t);e.store.path=r(o(n.partition)),e.stateDir=r(o(n.partition),`state`),e.curated||={path:r(t,a.aiCurated)}}async function g(){let e=p(),t=new l({model:e.embedding.model,dimensions:e.embedding.dimensions});await t.initialize();let n=await f({backend:e.store.backend,path:e.store.path});await n.initialize();let r=new u(t,n),{CuratedKnowledgeManager:a}=await import(`../../server/dist/curated-manager.js`),o=new a(e.curated.path,n,t),s;try{let t=new d({path:e.store.path});await t.initialize(),s=t,r.setGraphStore(s)}catch(e){console.error(`[aikit] Graph store init failed (non-fatal): ${e.message}`),s={initialize:async()=>{},upsertNode:async()=>{},upsertEdge:async()=>{},upsertNodes:async()=>{},upsertEdges:async()=>{},getNode:async()=>null,getNeighbors:async()=>({nodes:[],edges:[]}),traverse:async()=>({nodes:[],edges:[]}),findNodes:async()=>[],findEdges:async()=>[],deleteNode:async()=>{},deleteBySourcePath:async()=>0,clear:async()=>{},getStats:async()=>({nodeCount:0,edgeCount:0,nodeTypes:{},edgeTypes:{}}),validate:async()=>({valid:!0,orphanNodes:[],danglingEdges:[],stats:{nodeCount:0,edgeCount:0,nodeTypes:{},edgeTypes:{}}}),close:async()=>{}}}return await i().catch(()=>{}),{config:e,embedder:t,store:n,graphStore:s,indexer:r,curated:o}}export{g as initKB};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extractBoolFlag as e,extractNumFlag as t,extractStrFlag as n,parseRecordString as r,printCheckpoint as i,printDiffFiles as a,printFileSummary as o,printGitContext as s,printParsedOutput as c,readStdin as l}from"../helpers.js";import{resolve as u}from"node:path";import{checkpointLatest as d,checkpointList as f,checkpointLoad as p,checkpointSave as m,diffParse as h,fileSummary as g,gitContext as _,parseOutput as v}from"../../../tools/dist/index.js";const y=[{name:`parse-output`,description:`Parse build or tool output from stdin`,usage:`aikit parse-output [--tool tsc|vitest|biome|git-status]`,run:async e=>{let t=n(e,`--tool`,``).trim()||void 0,r=await l();r.trim()||(console.error(`Usage: aikit parse-output [--tool tsc|vitest|biome|git-status]`),process.exit(1)),c(v(r,t))}},{name:`git`,description:`Show git branch, status, recent commits, and optional diff stats`,usage:`aikit git [--cwd path] [--commit-count N] [--diff]`,run:async r=>{s(await _({cwd:n(r,`--cwd`,``).trim()||void 0,commitCount:t(r,`--commit-count`,5),includeDiff:e(r,`--diff`)}))}},{name:`diff`,description:`Parse unified diff text from stdin into structured file changes`,usage:`git diff | aikit diff`,run:async()=>{let e=await l();e.trim()||(console.error(`Usage: git diff | aikit diff`),process.exit(1)),a(h({diff:e}))}},{name:`summarize`,description:`Show a structural summary of a file`,usage:`aikit summarize <path>`,run:async e=>{let t=e.shift()?.trim();t||(console.error(`Usage: aikit summarize <path>`),process.exit(1)),o(await g({path:u(t)}))}},{name:`checkpoint`,description:`Save and restore lightweight session checkpoints`,usage:`aikit checkpoint <save|load|list|latest> [label-or-id] [--data json] [--notes text]`,run:async e=>{let t=e.shift()?.trim();switch(t||(console.error(`Usage: aikit checkpoint <save|load|list|latest> [label-or-id] [--data json] [--notes text]`),process.exit(1)),t){case`save`:{let t=e.shift()?.trim(),a=n(e,`--data`,``),o=n(e,`--notes`,``).trim()||void 0,s=a.trim()?``:await l();t||(console.error(`Usage:
|
|
1
|
+
import{extractBoolFlag as e,extractNumFlag as t,extractStrFlag as n,parseRecordString as r,printCheckpoint as i,printDiffFiles as a,printFileSummary as o,printGitContext as s,printParsedOutput as c,readStdin as l}from"../helpers.js";import{resolve as u}from"node:path";import{checkpointLatest as d,checkpointList as f,checkpointLoad as p,checkpointSave as m,diffParse as h,fileSummary as g,gitContext as _,parseOutput as v}from"../../../tools/dist/index.js";const y=[{name:`parse-output`,description:`Parse build or tool output from stdin`,usage:`aikit parse-output [--tool tsc|vitest|biome|git-status]`,run:async e=>{let t=n(e,`--tool`,``).trim()||void 0,r=await l();r.trim()||(console.error(`Usage: aikit parse-output [--tool tsc|vitest|biome|git-status]`),process.exit(1)),c(v(r,t))}},{name:`git`,description:`Show git branch, status, recent commits, and optional diff stats`,usage:`aikit git [--cwd path] [--commit-count N] [--diff]`,run:async r=>{s(await _({cwd:n(r,`--cwd`,``).trim()||void 0,commitCount:t(r,`--commit-count`,5),includeDiff:e(r,`--diff`)}))}},{name:`diff`,description:`Parse unified diff text from stdin into structured file changes`,usage:`git diff | aikit diff`,run:async()=>{let e=await l();e.trim()||(console.error(`Usage: git diff | aikit diff`),process.exit(1)),a(h({diff:e}))}},{name:`summarize`,description:`Show a structural summary of a file`,usage:`aikit summarize <path>`,run:async e=>{let t=e.shift()?.trim();t||(console.error(`Usage: aikit summarize <path>`),process.exit(1)),o(await g({path:u(t)}))}},{name:`checkpoint`,description:`Save and restore lightweight session checkpoints`,usage:`aikit checkpoint <save|load|list|latest> [label-or-id] [--data json] [--notes text]`,run:async e=>{let t=e.shift()?.trim();switch(t||(console.error(`Usage: aikit checkpoint <save|load|list|latest> [label-or-id] [--data json] [--notes text]`),process.exit(1)),t){case`save`:{let t=e.shift()?.trim(),a=n(e,`--data`,``),o=n(e,`--notes`,``).trim()||void 0,s=a.trim()?``:await l();t||(console.error(`Usage: aikit checkpoint save <label> [--data json] [--notes text]`),process.exit(1)),i(m(t,r(a||s),{notes:o}));return}case`load`:{let t=e.shift()?.trim();t||(console.error(`Usage: aikit checkpoint load <id>`),process.exit(1));let n=p(t);if(!n){console.log(`No checkpoint found: ${t}`);return}i(n);return}case`list`:{let e=f();if(e.length===0){console.log(`No checkpoints saved.`);return}console.log(`Checkpoints (${e.length})`),console.log(`─`.repeat(60));for(let t of e)console.log(`${t.id}`),console.log(` Label: ${t.label}`),console.log(` Created: ${t.createdAt}`);return}case`latest`:{let e=d();if(!e){console.log(`No checkpoints saved.`);return}i(e);return}default:console.error(`Unknown checkpoint action: ${t}`),console.error(`Actions: save, load, list, latest`),process.exit(1)}}}];export{y as contextCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extractNumFlag as e,extractStrFlag as t,printManagedProcess as n,readStdin as r}from"../helpers.js";import{resolve as i}from"node:path";import{readFile as a}from"node:fs/promises";import{delegate as o,delegateListModels as s,processList as c,processLogs as l,processStart as u,processStatus as d,processStop as f,watchList as p,watchStart as m,watchStop as h}from"../../../tools/dist/index.js";const g=[{name:`proc`,description:`Manage in-memory child processes`,usage:`aikit proc <start|stop|status|list|logs> ...`,run:async t=>{let r=t.shift()?.trim()??``;switch(r){case`start`:{let e=t.shift()?.trim(),r=t.shift()?.trim();(!e||!r)&&(console.error(`Usage: aikit proc start <id> <command> [args...]`),process.exit(1)),n(u(e,r,t));return}case`stop`:{let e=t.shift()?.trim();e||(console.error(`Usage: aikit proc stop <id>`),process.exit(1));let r=f(e);if(!r){console.log(`No managed process found: ${e}`);return}n(r);return}case`status`:{let e=t.shift()?.trim();e||(console.error(`Usage: aikit proc status <id>`),process.exit(1));let r=d(e);if(!r){console.log(`No managed process found: ${e}`);return}n(r);return}case`list`:{let e=c();if(e.length===0){console.log(`No managed processes.`);return}for(let t of e)n(t),console.log(``);return}case`logs`:{let n=e(t,`--tail`,50),r=t.shift()?.trim();r||(console.error(`Usage: aikit proc logs <id> [--tail N]`),process.exit(1));let i=l(r,n);if(i.length===0){console.log(`No logs found for process: ${r}`);return}for(let e of i)console.log(e);return}default:console.error(`Unknown proc action: ${r}`),console.error(`Actions: start, stop, status, list, logs`),process.exit(1)}}},{name:`watch`,description:`Manage in-memory filesystem watchers`,usage:`aikit watch <start|stop|list> ...`,run:async e=>{let t=e.shift()?.trim()??``;switch(t){case`start`:{let t=e.shift()?.trim();t||(console.error(`Usage: aikit watch start <path>`),process.exit(1));let n=m({path:i(t)});console.log(`Started watcher: ${n.id}`),console.log(` Path: ${n.path}`),console.log(` Status: ${n.status}`);return}case`stop`:{let t=e.shift()?.trim();t||(console.error(`Usage: aikit watch stop <id>`),process.exit(1));let n=h(t);console.log(n?`Stopped watcher: ${t}`:`Watcher not found: ${t}`);return}case`list`:{let e=p();if(e.length===0){console.log(`No active watchers.`);return}for(let t of e)console.log(`${t.id}`),console.log(` Path: ${t.path}`),console.log(` Status: ${t.status}`),console.log(` Events: ${t.eventCount}`);return}default:console.error(`Unknown watch action: ${t}`),console.error(`Actions: start, stop, list`),process.exit(1)}}},{name:`delegate`,description:`Delegate a task to a local Ollama model`,usage:`
|
|
1
|
+
import{extractNumFlag as e,extractStrFlag as t,printManagedProcess as n,readStdin as r}from"../helpers.js";import{resolve as i}from"node:path";import{readFile as a}from"node:fs/promises";import{delegate as o,delegateListModels as s,processList as c,processLogs as l,processStart as u,processStatus as d,processStop as f,watchList as p,watchStart as m,watchStop as h}from"../../../tools/dist/index.js";const g=[{name:`proc`,description:`Manage in-memory child processes`,usage:`aikit proc <start|stop|status|list|logs> ...`,run:async t=>{let r=t.shift()?.trim()??``;switch(r){case`start`:{let e=t.shift()?.trim(),r=t.shift()?.trim();(!e||!r)&&(console.error(`Usage: aikit proc start <id> <command> [args...]`),process.exit(1)),n(u(e,r,t));return}case`stop`:{let e=t.shift()?.trim();e||(console.error(`Usage: aikit proc stop <id>`),process.exit(1));let r=f(e);if(!r){console.log(`No managed process found: ${e}`);return}n(r);return}case`status`:{let e=t.shift()?.trim();e||(console.error(`Usage: aikit proc status <id>`),process.exit(1));let r=d(e);if(!r){console.log(`No managed process found: ${e}`);return}n(r);return}case`list`:{let e=c();if(e.length===0){console.log(`No managed processes.`);return}for(let t of e)n(t),console.log(``);return}case`logs`:{let n=e(t,`--tail`,50),r=t.shift()?.trim();r||(console.error(`Usage: aikit proc logs <id> [--tail N]`),process.exit(1));let i=l(r,n);if(i.length===0){console.log(`No logs found for process: ${r}`);return}for(let e of i)console.log(e);return}default:console.error(`Unknown proc action: ${r}`),console.error(`Actions: start, stop, status, list, logs`),process.exit(1)}}},{name:`watch`,description:`Manage in-memory filesystem watchers`,usage:`aikit watch <start|stop|list> ...`,run:async e=>{let t=e.shift()?.trim()??``;switch(t){case`start`:{let t=e.shift()?.trim();t||(console.error(`Usage: aikit watch start <path>`),process.exit(1));let n=m({path:i(t)});console.log(`Started watcher: ${n.id}`),console.log(` Path: ${n.path}`),console.log(` Status: ${n.status}`);return}case`stop`:{let t=e.shift()?.trim();t||(console.error(`Usage: aikit watch stop <id>`),process.exit(1));let n=h(t);console.log(n?`Stopped watcher: ${t}`:`Watcher not found: ${t}`);return}case`list`:{let e=p();if(e.length===0){console.log(`No active watchers.`);return}for(let t of e)console.log(`${t.id}`),console.log(` Path: ${t.path}`),console.log(` Status: ${t.status}`),console.log(` Events: ${t.eventCount}`);return}default:console.error(`Unknown watch action: ${t}`),console.error(`Actions: start, stop, list`),process.exit(1)}}},{name:`delegate`,description:`Delegate a task to a local Ollama model`,usage:`aikit delegate [--model name] [--system prompt] [--temp 0.3] <prompt | --stdin>`,run:async n=>{if((n[0]===`models`?n.shift():void 0)===`models`){try{let e=await s();if(e.length===0){console.log(`No Ollama models available. Pull one with: ollama pull qwen2.5-coder:7b`);return}for(let t of e)console.log(t)}catch{console.error(`Ollama is not running. Start it with: ollama serve`),process.exit(1)}return}let c=t(n,`--model`,``),l=t(n,`--system`,``),u=e(n,`--temp`,.3),d=t(n,`--context`,``),f=n.join(` `);f||=await r(),f||(console.error(`Usage: aikit delegate [--model name] <prompt>`),process.exit(1));let p;d&&(p=await a(i(d),`utf-8`));let m=await o({prompt:f,model:c||void 0,system:l||void 0,context:p,temperature:u});m.error&&(console.error(`Error: ${m.error}`),process.exit(1)),console.log(m.response),console.error(`\n(${m.model}, ${m.durationMs}ms, ${m.tokenCount??`?`} tokens)`)}}];export{g as environmentCommands};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region packages/cli/src/commands/init/config.d.ts
|
|
2
2
|
/**
|
|
3
3
|
* Init module — config file creation.
|
|
4
|
-
* Handles
|
|
4
|
+
* Handles aikit.config.json, .gitignore, and MCP config files.
|
|
5
5
|
*/
|
|
6
6
|
declare function writeKbConfig(cwd: string, force: boolean): boolean;
|
|
7
7
|
declare function ensureGitignore(cwd: string): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{SERVER_NAME as e}from"./constants.js";import{appendFileSync as t,existsSync as n,readFileSync as r,writeFileSync as i}from"node:fs";import{resolve as a}from"node:path";import{AIKIT_PATHS as o}from"../../../../core/dist/index.js";const s={serverName:e,sources:[{path:`.`,excludePatterns:[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.git/**`,`**/${o.data}/**`,`**/coverage/**`,`**/*.min.js`,`**/package-lock.json`,`**/pnpm-lock.yaml`]}],indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{model:`mixedbread-ai/mxbai-embed-large-v1`,dimensions:1024},store:{backend:`lancedb`,path:`${o.data}/lance`},curated:{path:o.aiCurated}};function c(e,t){let r=a(e,`
|
|
1
|
+
import{SERVER_NAME as e}from"./constants.js";import{appendFileSync as t,existsSync as n,readFileSync as r,writeFileSync as i}from"node:fs";import{resolve as a}from"node:path";import{AIKIT_PATHS as o}from"../../../../core/dist/index.js";const s={serverName:e,sources:[{path:`.`,excludePatterns:[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.git/**`,`**/${o.data}/**`,`**/coverage/**`,`**/*.min.js`,`**/package-lock.json`,`**/pnpm-lock.yaml`]}],indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{model:`mixedbread-ai/mxbai-embed-large-v1`,dimensions:1024},store:{backend:`lancedb`,path:`${o.data}/lance`},curated:{path:o.aiCurated}};function c(e,t){let r=a(e,`aikit.config.json`);return n(r)&&!t?(console.log(`aikit.config.json already exists. Use --force to overwrite.`),!1):(i(r,`${JSON.stringify(s,null,2)}\n`,`utf-8`),console.log(` Created aikit.config.json`),!0)}function l(e){let s=a(e,`.gitignore`),c=[{dir:`${o.data}/`,label:`AI Kit vector store`},{dir:`${o.state}/`,label:`AI Kit session state`},{dir:`${o.restorePoints}/`,label:`Restore points (codemod/rename undo snapshots)`},{dir:`${o.brainstorm}/`,label:`Brainstorming sessions`},{dir:`${o.handoffs}/`,label:`Handoff documents`}];if(n(s)){let e=r(s,`utf-8`),n=c.filter(t=>!e.includes(t.dir));n.length>0&&(t(s,`\n${n.map(e=>`# ${e.label}\n${e.dir}`).join(`
|
|
2
2
|
`)}\n`,`utf-8`),console.log(` Added ${n.map(e=>e.dir).join(`, `)} to .gitignore`))}else i(s,`${c.map(e=>`# ${e.label}\n${e.dir}`).join(`
|
|
3
|
-
`)}\n`,`utf-8`),console.log(` Created .gitignore with
|
|
3
|
+
`)}\n`,`utf-8`),console.log(` Created .gitignore with AI Kit entries`)}function u(){return s.serverName}export{l as ensureGitignore,u as getServerName,c as writeKbConfig};
|
|
@@ -12,7 +12,7 @@ declare const MCP_SERVER_ENTRY: {
|
|
|
12
12
|
readonly command: "npx";
|
|
13
13
|
readonly args: readonly ["-y", "@vpxa/aikit", "serve"];
|
|
14
14
|
};
|
|
15
|
-
/** Skills shipped with the
|
|
15
|
+
/** Skills shipped with the AI Kit package and installed during init. */
|
|
16
16
|
declare const SKILL_NAMES: readonly ["aikit", "brainstorming", "multi-agents-development", "session-handoff", "requirements-clarity", "lesson-learned", "c4-architecture", "adr-skill", "present"];
|
|
17
17
|
/**
|
|
18
18
|
* VS Code settings merged into each VS Code-family IDE's settings.json.
|
|
@@ -21,7 +21,7 @@ declare const SKILL_NAMES: readonly ["aikit", "brainstorming", "multi-agents-dev
|
|
|
21
21
|
* from ~/.copilot/agents (our scaffold root) and workspace .github/agents/.
|
|
22
22
|
* Without this, VS Code discovers both locations causing duplicates with
|
|
23
23
|
* mismatched tool-name formats.
|
|
24
|
-
* - copilotMemory: Enables Copilot Memory so
|
|
24
|
+
* - copilotMemory: Enables Copilot Memory so AI Kit `remember` persists across sessions.
|
|
25
25
|
* - customAgentInSubagent: Enables custom agents as subagents — required for
|
|
26
26
|
* Orchestrator's multi-agent `runSubagent` workflow.
|
|
27
27
|
* - useNestedAgentsMdFiles: Agents reference _shared/*.md protocol files —
|
|
@@ -33,7 +33,7 @@ declare const SKILL_NAMES: readonly ["aikit", "brainstorming", "multi-agents-dev
|
|
|
33
33
|
* - enableChatTools: Enables integrated-browser tools (openBrowserPage,
|
|
34
34
|
* readPage, screenshotPage, etc.) so agents can open and interact with
|
|
35
35
|
* web pages inside VS Code's built-in browser.
|
|
36
|
-
* - mcpApps: Enables MCP tool apps so
|
|
36
|
+
* - mcpApps: Enables MCP tool apps so AI Kit tools can be consumed by Copilot
|
|
37
37
|
* Chat without requiring manual MCP server configuration.
|
|
38
38
|
*/
|
|
39
39
|
declare const VSCODE_SETTINGS: Record<string, unknown>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//#region packages/cli/src/commands/init/index.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* `aikit init` — scaffold
|
|
3
|
+
* `aikit init` — scaffold AI Kit in the current directory.
|
|
4
4
|
*
|
|
5
|
-
* Creates
|
|
5
|
+
* Creates aikit.config.json, .gitignore entry, IDE-specific config,
|
|
6
6
|
* agent instruction files, skills, scaffold agents/prompts,
|
|
7
7
|
* and curated knowledge directories.
|
|
8
8
|
*
|
|
9
9
|
* This is the main orchestrator that wires together the focused modules:
|
|
10
|
-
* config.ts —
|
|
10
|
+
* config.ts — aikit.config.json + .gitignore
|
|
11
11
|
* adapters.ts — IDE detection + adapter interface
|
|
12
12
|
* scaffold.ts — copy scaffold agents/prompts + skills from package
|
|
13
13
|
* curated.ts — curated knowledge directories
|
|
@@ -25,7 +25,7 @@ declare function initSmart(options: {
|
|
|
25
25
|
/**
|
|
26
26
|
* Scaffold-only init for workspaces when user-level mode is active.
|
|
27
27
|
* Creates instruction files, scaffold agents/prompts, and curated dirs
|
|
28
|
-
* but does NOT create
|
|
28
|
+
* but does NOT create aikit.config.json, mcp.json, or local skills.
|
|
29
29
|
*/
|
|
30
30
|
declare function initScaffoldOnly(options: {
|
|
31
31
|
force: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{SKILL_NAMES as e}from"./constants.js";import{detectIde as t,getAdapter as n}from"./adapters.js";import{ensureGitignore as r,getServerName as i,writeKbConfig as a}from"./config.js";import{createCuratedDirs as o}from"./curated.js";import{guideScaffold as s,guideSkills as c,smartCopyScaffold as l,smartCopySkills as u}from"./scaffold.js";import{readFileSync as d}from"node:fs";import{dirname as f,resolve as p}from"node:path";import{fileURLToPath as m}from"node:url";import{isUserInstalled as h}from"../../../../core/dist/index.js";async function g(s){let c=process.cwd();if(!a(c,s.force))return;r(c);let g=i(),_=n(t(c));_.writeMcpConfig(c,g),_.writeInstructions(c,g),_.writeAgentsMd(c,g);let v=p(f(m(import.meta.url)),`..`,`..`,`..`,`..`,`..`),y=JSON.parse(d(p(v,`package.json`),`utf-8`)).version;u(c,v,[...e],y,s.force),l(c,v,_.scaffoldDir,y,s.force),o(c),console.log(`
|
|
2
|
-
|
|
3
|
-
Note: User-level
|
|
4
|
-
Workspace scaffolded for user-level
|
|
5
|
-
The user-level
|
|
2
|
+
AI Kit initialized! Next steps:`),console.log(` aikit reindex Index your codebase`),console.log(` aikit search Search indexed content`),console.log(` aikit serve Start MCP server for IDE integration`),h()&&console.log(`
|
|
3
|
+
Note: User-level AI Kit is also installed. This workspace uses its own local data store.`)}async function _(e){h()?await v(e):await g(e)}async function v(e){let a=process.cwd(),s=i(),c=n(t(a));c.writeInstructions(a,s),c.writeAgentsMd(a,s);let u=p(f(m(import.meta.url)),`..`,`..`,`..`,`..`,`..`),h=JSON.parse(d(p(u,`package.json`),`utf-8`)).version;l(a,u,c.scaffoldDir,h,e.force),o(a),r(a),console.log(`
|
|
4
|
+
Workspace scaffolded for user-level AI Kit! Files added:`),console.log(` Instruction files (AGENTS.md, copilot-instructions.md, etc.)`),console.log(` .ai/curated/ directories`),console.log(` .github/agents/ & .github/prompts/`),console.log(`
|
|
5
|
+
The user-level AI Kit server will auto-index this workspace when opened in your IDE.`)}async function y(){let r=process.cwd(),i=n(t(r)),a=p(f(m(import.meta.url)),`..`,`..`,`..`,`..`,`..`),o=[...c(r,a,[...e]),...s(r,a,i.scaffoldDir)],l={summary:{total:o.length,new:o.filter(e=>e.status===`new`).length,outdated:o.filter(e=>e.status===`outdated`).length,current:o.filter(e=>e.status===`current`).length},files:o};console.log(JSON.stringify(l,null,2))}export{y as guideProject,g as initProject,v as initScaffoldOnly,_ as initSmart};
|
|
@@ -3,18 +3,18 @@ function e(e,t){return`# ${e} — Copilot Instructions
|
|
|
3
3
|
This project has an MCP server (\`${t}\`) providing 67 tools for search, analysis, memory, and validation.
|
|
4
4
|
**These tools REPLACE most native IDE tools.** You MUST use them.
|
|
5
5
|
|
|
6
|
-
## Step 0: Load
|
|
6
|
+
## Step 0: Load AI Kit Tools
|
|
7
7
|
|
|
8
|
-
Before doing ANYTHING else, load the
|
|
9
|
-
Search for tools matching the server name (e.g. \`
|
|
8
|
+
Before doing ANYTHING else, load the AI Kit MCP tools. They are deferred — you must load them first.
|
|
9
|
+
Search for tools matching the server name (e.g. \`aikit\`):
|
|
10
10
|
\`\`\`
|
|
11
|
-
tool_search_tool_regex({ pattern: "
|
|
11
|
+
tool_search_tool_regex({ pattern: "aikit" }) // loads all 67 AI Kit tools
|
|
12
12
|
\`\`\`
|
|
13
|
-
Once loaded,
|
|
13
|
+
Once loaded, AI Kit tools appear as \`mcp_<server>_<tool>\` (e.g. \`mcp_aikit_search\`).
|
|
14
14
|
|
|
15
|
-
## FORBIDDEN: Native Tools When
|
|
15
|
+
## FORBIDDEN: Native Tools When AI Kit Alternative Exists
|
|
16
16
|
|
|
17
|
-
| NEVER use this | USE THIS
|
|
17
|
+
| NEVER use this | USE THIS AI Kit TOOL INSTEAD | Why |
|
|
18
18
|
|---|---|---|
|
|
19
19
|
| \`read_file\` to understand a file | \`file_summary({ path })\` | Structure, exports, imports — 10x fewer tokens |
|
|
20
20
|
| \`read_file\` to find specific code | \`compact({ path, query })\` | Server-side read + semantic extract — 5-20x reduction |
|
|
@@ -27,7 +27,7 @@ Once loaded, KB tools appear as \`mcp_<server>_<tool>\` (e.g. \`mcp_knowledge-ba
|
|
|
27
27
|
| Manual code tracing | \`trace({ symbol, direction })\` | AST call-graph traversal |
|
|
28
28
|
| Line counting / wc | \`measure({ path })\` | Lines, functions, cognitive complexity |
|
|
29
29
|
| \`fetch_webpage\` | \`web_fetch({ url })\` | Readability extract + token budget — richer output |
|
|
30
|
-
| Web research / browsing | \`web_search({ query })\` | Structured web results without browser — unique to
|
|
30
|
+
| Web research / browsing | \`web_search({ query })\` | Structured web results without browser — unique to AI Kit |
|
|
31
31
|
|
|
32
32
|
**\`read_file\` is ONLY acceptable when you need exact line content FOR EDITING (before \`replace_string_in_file\`).**
|
|
33
33
|
Even then, use \`file_summary\` first to identify which lines to read.
|
|
@@ -73,16 +73,16 @@ This project has specialized agents in \`.github/agents/\`. Use them instead of
|
|
|
73
73
|
Check \`.github/agents/\` for the full list of available agents.
|
|
74
74
|
`}function t(e,t){return`# ${e} — Agent Instructions
|
|
75
75
|
|
|
76
|
-
##
|
|
76
|
+
## AI Kit MCP Server (\`${t}\`)
|
|
77
77
|
|
|
78
78
|
67 tools for search, code analysis, persistent memory, validation, and context compression.
|
|
79
|
-
Load them: \`tool_search_tool_regex({ pattern: "
|
|
79
|
+
Load them: \`tool_search_tool_regex({ pattern: "aikit" })\`
|
|
80
80
|
|
|
81
81
|
### Skills Reference
|
|
82
82
|
|
|
83
83
|
| Context | Skill | Load when |
|
|
84
84
|
|---------|-------|----------|
|
|
85
|
-
|
|
|
85
|
+
| AI Kit search, analysis, memory | \`aikit\` | **Always load at session start.** Tool signatures, workflows, session protocol. |
|
|
86
86
|
| Brainstorming & design | \`brainstorming\` | Before any creative/design work — new features, components, behavior changes. |
|
|
87
87
|
| Session context preservation | \`session-handoff\` | Context window filling up, session ending, or major milestone completed. |
|
|
88
88
|
| Requirements scoring | \`requirements-clarity\` | Before planning vague or complex features — score 0-100 until \u2265 90. |
|
|
@@ -135,7 +135,7 @@ Need to understand a file?
|
|
|
135
135
|
|
|
136
136
|
### Start (do ALL)
|
|
137
137
|
\`\`\`
|
|
138
|
-
status({}) # Check
|
|
138
|
+
status({}) # Check AI Kit health + onboard state
|
|
139
139
|
# If onboard not run → onboard({ path: "." }) # First-time codebase analysis
|
|
140
140
|
list() # See stored knowledge
|
|
141
141
|
search({ query: "SESSION CHECKPOINT", origin: "curated" }) # Resume prior work
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region packages/cli/src/commands/init/user.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* `aikit init --user` — configure
|
|
3
|
+
* `aikit init --user` — configure AI Kit as a user-level MCP server.
|
|
4
4
|
*
|
|
5
5
|
* Auto-detects all installed IDEs, writes user-level mcp.json for each,
|
|
6
6
|
* installs skills to a user-level location, and creates the shared data store.
|
|
@@ -28,8 +28,8 @@ interface UserLevelIdePath {
|
|
|
28
28
|
*/
|
|
29
29
|
declare function detectInstalledIdes(): UserLevelIdePath[];
|
|
30
30
|
/**
|
|
31
|
-
* Write or merge the
|
|
32
|
-
* Preserves all existing non-
|
|
31
|
+
* Write or merge the AI Kit server entry into a user-level mcp.json.
|
|
32
|
+
* Preserves all existing non-AI Kit entries. Backs up existing file before writing.
|
|
33
33
|
*/
|
|
34
34
|
declare function writeUserLevelMcpConfig(idePath: UserLevelIdePath, serverName: string, force?: boolean): void;
|
|
35
35
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{MCP_SERVER_ENTRY as e,SERVER_NAME as t,SKILL_NAMES as n,VSCODE_SETTINGS as r}from"./constants.js";import{buildAgentsMd as i,buildCopilotInstructions as a}from"./templates.js";import{smartCopySubdir as o}from"./scaffold.js";import{existsSync as s,mkdirSync as c,readFileSync as l,writeFileSync as u}from"node:fs";import{dirname as d,resolve as f}from"node:path";import{fileURLToPath as p}from"node:url";import{getGlobalDataDir as m,saveRegistry as h}from"../../../../core/dist/index.js";import{homedir as g}from"node:os";function _(){let e=g(),t=process.platform,n=[],r=f(e,`.copilot`),i=f(r,`instructions`),a=f(e,`.claude`),o=f(e,`.cursor`),c=f(e,`.windsurf`);if(t===`win32`){let t=process.env.APPDATA??f(e,`AppData`,`Roaming`);n.push({ide:`VS Code`,configDir:f(t,`Code`,`User`),mcpConfigPath:f(t,`Code`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VS Code Insiders`,configDir:f(t,`Code - Insiders`,`User`),mcpConfigPath:f(t,`Code - Insiders`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VSCodium`,configDir:f(t,`VSCodium`,`User`),mcpConfigPath:f(t,`VSCodium`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`Cursor`,configDir:f(t,`Cursor`,`User`),mcpConfigPath:f(t,`Cursor`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Cursor Nightly`,configDir:f(t,`Cursor Nightly`,`User`),mcpConfigPath:f(t,`Cursor Nightly`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Windsurf`,configDir:f(t,`Windsurf`,`User`),mcpConfigPath:f(t,`Windsurf`,`User`,`mcp.json`),globalScaffoldRoot:c,instructionsRoot:null})}else if(t===`darwin`){let t=f(e,`Library`,`Application Support`);n.push({ide:`VS Code`,configDir:f(t,`Code`,`User`),mcpConfigPath:f(t,`Code`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VS Code Insiders`,configDir:f(t,`Code - Insiders`,`User`),mcpConfigPath:f(t,`Code - Insiders`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VSCodium`,configDir:f(t,`VSCodium`,`User`),mcpConfigPath:f(t,`VSCodium`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`Cursor`,configDir:f(t,`Cursor`,`User`),mcpConfigPath:f(t,`Cursor`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Cursor Nightly`,configDir:f(t,`Cursor Nightly`,`User`),mcpConfigPath:f(t,`Cursor Nightly`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Windsurf`,configDir:f(t,`Windsurf`,`User`),mcpConfigPath:f(t,`Windsurf`,`User`,`mcp.json`),globalScaffoldRoot:c,instructionsRoot:null})}else{let t=process.env.XDG_CONFIG_HOME??f(e,`.config`);n.push({ide:`VS Code`,configDir:f(t,`Code`,`User`),mcpConfigPath:f(t,`Code`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VS Code Insiders`,configDir:f(t,`Code - Insiders`,`User`),mcpConfigPath:f(t,`Code - Insiders`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`VSCodium`,configDir:f(t,`VSCodium`,`User`),mcpConfigPath:f(t,`VSCodium`,`User`,`mcp.json`),globalScaffoldRoot:r,instructionsRoot:i},{ide:`Cursor`,configDir:f(t,`Cursor`,`User`),mcpConfigPath:f(t,`Cursor`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Cursor Nightly`,configDir:f(t,`Cursor Nightly`,`User`),mcpConfigPath:f(t,`Cursor Nightly`,`User`,`mcp.json`),globalScaffoldRoot:o,instructionsRoot:null},{ide:`Windsurf`,configDir:f(t,`Windsurf`,`User`),mcpConfigPath:f(t,`Windsurf`,`User`,`mcp.json`),globalScaffoldRoot:c,instructionsRoot:null})}return n.push({ide:`Claude Code`,configDir:f(e,`.claude`),mcpConfigPath:f(e,`.claude`,`mcp.json`),globalScaffoldRoot:a,instructionsRoot:null}),n.filter(e=>s(e.configDir))}function v(t,n,r=!1){let{mcpConfigPath:i,configDir:a}=t,o={...e},d={};if(s(i)){try{let e=l(i,`utf-8`);d=JSON.parse(e)}catch{let e=`${i}.bak`;u(e,l(i,`utf-8`),`utf-8`),console.log(` Backed up invalid ${i} to ${e}`),d={}}if((d.servers??d.mcpServers??{})[n]&&!r){console.log(` ${t.ide}: ${n} already configured (use --force to update)`);return}}let f=new Set([`VS Code`,`VS Code Insiders`,`VSCodium`,`Windsurf`]).has(t.ide)?`servers`:`mcpServers`,p=d[f]??{};p[n]=o,d[f]=p,c(a,{recursive:!0}),u(i,`${JSON.stringify(d,null,2)}\n`,`utf-8`),console.log(` ${t.ide}: configured ${n} in ${i}`)}const y=new Set([`VS Code`,`VS Code Insiders`,`VSCodium`]);function b(e,t=!1){if(!y.has(e.ide))return;let n=f(e.configDir,`settings.json`),i={};if(s(n))try{let e=l(n,`utf-8`);i=JSON.parse(e)}catch{console.log(` ${e.ide}: skipped settings.json (invalid JSON)`);return}let a=!1;for(let[e,n]of Object.entries(r))if(typeof n==`object`&&n){let t=typeof i[e]==`object`&&i[e]!==null?i[e]:{},r={...t,...n};JSON.stringify(r)!==JSON.stringify(t)&&(i[e]=r,a=!0)}else (t||!(e in i))&&(i[e]=n,a=!0);a&&(u(n,`${JSON.stringify(i,null,2)}\n`,`utf-8`),console.log(` ${e.ide}: updated settings.json`))}function x(e,t,r,l,d=!1){let p=new Set;for(let e of t)e.globalScaffoldRoot&&p.add(e.globalScaffoldRoot);if(p.size===0){console.log(` No IDEs with global scaffold support detected.`);return}let m=f(e,`scaffold`,`general`);for(let e of p){o(m,e,`agents`,l,d),o(m,e,`prompts`,l,d);let t=0;for(let r of n)s(f(m,`skills`,r))&&(o(m,e,`skills/${r}`,l,d),t++);console.log(` ${e}: scaffold updated (${t} skills)`)}let h=new Set,g=a(`aikit`,r),_=i(`aikit`,r);for(let e of t){if(!e.globalScaffoldRoot)continue;let t=e.globalScaffoldRoot;if(e.ide===`Claude Code`){let e=f(t,`CLAUDE.md`);u(e,`${g}\n---\n\n${_}`,`utf-8`),h.add(e)}else if(e.ide===`VS Code`||e.ide===`VS Code Insiders`||e.ide===`VSCodium`){let n=e.instructionsRoot??t;c(n,{recursive:!0});let r=f(n,`kb.instructions.md`);h.has(r)||(u(r,`---\napplyTo: "**"\n---\n\n${g}\n---\n\n${_}`,`utf-8`),h.add(r))}else if(e.ide===`Cursor`||e.ide===`Cursor Nightly`){let e=f(t,`rules`);c(e,{recursive:!0});let n=f(e,`kb.mdc`);h.has(n)||(u(n,`${g}\n---\n\n${_}`,`utf-8`),h.add(n))}else if(e.ide===`Windsurf`){let e=f(t,`rules`);c(e,{recursive:!0});let n=f(e,`kb.md`);h.has(n)||(u(n,`${g}\n---\n\n${_}`,`utf-8`),h.add(n))}}h.size>0&&console.log(` Instruction files: ${[...h].join(`, `)}`)}async function S(e){let n=t,r=f(d(p(import.meta.url)),`..`,`..`,`..`,`..`,`..`,`package.json`),i=JSON.parse(l(r,`utf-8`)).version;console.log(`Initializing @vpxa/aikit v${i}...\n`);let a=m();c(a,{recursive:!0}),console.log(` Global data store: ${a}`),h({version:1,workspaces:{}}),console.log(` Created registry.json`);let o=_();if(o.length===0)console.log(`
|
|
2
2
|
No supported IDEs detected. You can manually add the MCP server config.`);else{console.log(`\n Detected ${o.length} IDE(s):`);for(let t of o)v(t,n,e.force),b(t,e.force)}let s=f(d(p(import.meta.url)),`..`,`..`,`..`,`..`,`..`);console.log(`
|
|
3
3
|
Installing scaffold files:`),x(s,o,n,i,e.force),console.log(`
|
|
4
|
-
User-level
|
|
5
|
-
Next steps:`),console.log(` 1. Open any workspace in your IDE`),console.log(` 2. The
|
|
4
|
+
User-level AI Kit installation complete!`),console.log(`
|
|
5
|
+
Next steps:`),console.log(` 1. Open any workspace in your IDE`),console.log(` 2. The AI Kit server will auto-start and index the workspace`),console.log(` 3. Agents, prompts, skills & instructions are available globally`),console.log(` 4. No per-workspace init needed — just open a project and start coding`)}export{_ as detectInstalledIdes,S as initUser,x as installGlobalScaffold,v as writeUserLevelMcpConfig,b as writeVscodeSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ctx as e}from"../context.js";import{extractNumFlag as t,extractStrFlag as n,formatFocusRanges as r,printDeadSymbolsResult as i,printExamplesResult as a,printSymbolInfo as o,printTraceResult as s,rrf as c}from"../helpers.js";import{find as l,findDeadSymbols as u,findExamples as d,scopeMap as f,symbol as p,trace as m}from"../../../tools/dist/index.js";const h=[{name:`search`,description:`Search the
|
|
1
|
+
import{ctx as e}from"../context.js";import{extractNumFlag as t,extractStrFlag as n,formatFocusRanges as r,printDeadSymbolsResult as i,printExamplesResult as a,printSymbolInfo as o,printTraceResult as s,rrf as c}from"../helpers.js";import{find as l,findDeadSymbols as u,findExamples as d,scopeMap as f,symbol as p,trace as m}from"../../../tools/dist/index.js";const h=[{name:`search`,description:`Search the AI Kit index`,usage:`aikit search <query> [--limit N] [--mode hybrid|semantic|keyword] [--graph-hops 0-3]`,run:async r=>{let i=t(r,`--limit`,5),a=n(r,`--mode`,`hybrid`),o=t(r,`--graph-hops`,0),s=r.join(` `).trim();s||(console.error(`Usage: aikit search <query>`),process.exit(1));let{embedder:l,store:u,graphStore:d}=await e(),f=await l.embedQuery(s),p;if(a===`keyword`)p=await u.ftsSearch(s,{limit:i});else if(a===`semantic`)p=await u.search(f,{limit:i});else{let[e,t]=await Promise.all([u.search(f,{limit:i*2}),u.ftsSearch(s,{limit:i*2}).catch(()=>[])]);p=c(e,t).slice(0,i)}if(p.length===0){console.log(`No results found.`);return}for(let{record:e,score:t}of p){console.log(`\n${`─`.repeat(60)}`),console.log(`[${(t*100).toFixed(1)}%] ${e.sourcePath}:${e.startLine}-${e.endLine}`),console.log(` Type: ${e.contentType} | Origin: ${e.origin}`),e.tags.length>0&&console.log(` Tags: ${e.tags.join(`, `)}`),console.log(``);let n=e.content.length>500?`${e.content.slice(0,500)}...`:e.content;console.log(n)}if(console.log(`\n${`─`.repeat(60)}`),console.log(`${p.length} result(s) found.`),o>0&&p.length>0)try{let{graphAugmentSearch:e}=await import(`../../../tools/dist/index.js`),t=(await e(d,p.map(e=>({recordId:e.record.id,score:e.score,sourcePath:e.record.sourcePath})),{hops:o,maxPerHit:5})).filter(e=>e.graphContext.nodes.length>0);if(t.length>0){console.log(`\nGraph context (${o} hop${o>1?`s`:``}):\n`);for(let e of t){console.log(` ${e.sourcePath}:`);for(let t of e.graphContext.nodes.slice(0,5))console.log(` → ${t.name} (${t.type})`);for(let t of e.graphContext.edges.slice(0,5))console.log(` → ${t.fromId} --[${t.type}]--> ${t.toId}`)}}}catch(e){console.error(`[graph] augmentation failed: ${e.message}`)}}},{name:`find`,description:`Run federated search across indexed content and files`,usage:`aikit find [query] [--glob <pattern>] [--pattern <regex>] [--limit N]`,run:async r=>{let i=t(r,`--limit`,10),a=n(r,`--glob`,``).trim()||void 0,o=n(r,`--pattern`,``).trim()||void 0,s=r.join(` `).trim()||void 0;!s&&!a&&!o&&(console.error(`Usage: aikit find [query] [--glob <pattern>] [--pattern <regex>] [--limit N]`),process.exit(1));let{embedder:c,store:u}=await e(),d=await l(c,u,{query:s,glob:a,pattern:o,limit:i});if(d.results.length===0){console.log(`No matches found.`);return}console.log(`Strategies: ${d.strategies.join(`, `)}`),console.log(`Results: ${d.results.length} shown (${d.totalFound} total)`);for(let e of d.results){let t=e.lineRange?`:${e.lineRange.start}-${e.lineRange.end}`:``;console.log(`\n[${e.source}] ${e.path}${t}`),console.log(` Score: ${(e.score*100).toFixed(1)}%`),e.preview&&console.log(` ${e.preview.replace(/\s+/g,` `).trim()}`)}}},{name:`scope-map`,description:`Generate a reading plan for a task`,usage:`aikit scope-map <task> [--max-files N]`,run:async n=>{let i=t(n,`--max-files`,15),a=n.join(` `).trim();a||(console.error(`Usage: aikit scope-map <task> [--max-files N]`),process.exit(1));let{embedder:o,store:s}=await e(),c=await f(o,s,{task:a,maxFiles:i});console.log(`Task: ${c.task}`),console.log(`Files: ${c.files.length}`),console.log(`Estimated tokens: ${c.totalEstimatedTokens}`),console.log(``),console.log(`Reading order:`);for(let e of c.readingOrder)console.log(` ${e}`);for(let[e,t]of c.files.entries())console.log(`\n${e+1}. ${t.path}`),console.log(` Relevance: ${(t.relevance*100).toFixed(1)}% | Tokens: ${t.estimatedTokens}`),console.log(` Why: ${t.reason}`),t.focusRanges.length>0&&console.log(` Focus: ${r(t.focusRanges)}`)}},{name:`symbol`,description:`Resolve a symbol definition, imports, and references`,usage:`aikit symbol <name> [--limit N]`,run:async n=>{let r=t(n,`--limit`,20),i=n.join(` `).trim();i||(console.error(`Usage: aikit symbol <name> [--limit N]`),process.exit(1));let{embedder:a,store:s}=await e();o(await p(a,s,{name:i,limit:r}))}},{name:`trace`,description:`Trace forward/backward flow for a symbol or file location`,usage:`aikit trace <start> [--direction forward|backward|both] [--max-depth N]`,run:async r=>{let i=n(r,`--direction`,`both`).trim()||`both`,a=t(r,`--max-depth`,3),o=r.join(` `).trim();(!o||![`forward`,`backward`,`both`].includes(i))&&(console.error(`Usage: aikit trace <start> [--direction forward|backward|both] [--max-depth N]`),process.exit(1));let{embedder:c,store:l}=await e();s(await m(c,l,{start:o,direction:i,maxDepth:a}))}},{name:`examples`,description:`Find real code examples of a symbol or pattern`,usage:`aikit examples <query> [--limit N] [--content-type type]`,run:async r=>{let i=t(r,`--limit`,5),o=n(r,`--content-type`,``).trim()||void 0,s=r.join(` `).trim();s||(console.error(`Usage: aikit examples <query> [--limit N] [--content-type type]`),process.exit(1));let{embedder:c,store:l}=await e();a(await d(c,l,{query:s,limit:i,contentType:o}))}},{name:`dead-symbols`,description:`Find exported symbols that appear to be unused`,usage:`aikit dead-symbols [--limit N]`,run:async n=>{let r=t(n,`--limit`,100),{embedder:a,store:o}=await e();i(await u(a,o,{limit:r}))}},{name:`lookup`,description:`Look up indexed content by record ID or source path`,usage:`aikit lookup <id>`,run:async t=>{let n=t.join(` `).trim();n||(console.error(`Usage: aikit lookup <id>`),process.exit(1));let{store:r}=await e(),i=await r.getById(n);if(i){console.log(i.id),console.log(`─`.repeat(60)),console.log(`Path: ${i.sourcePath}`),console.log(`Chunk: ${i.chunkIndex+1}/${i.totalChunks}`),console.log(`Lines: ${i.startLine}-${i.endLine}`),console.log(`Type: ${i.contentType} | Origin: ${i.origin}`),i.tags.length>0&&console.log(`Tags: ${i.tags.join(`, `)}`),console.log(``),console.log(i.content);return}let a=await r.getBySourcePath(n);if(a.length===0){console.log(`No indexed content found for: ${n}`);return}a.sort((e,t)=>e.chunkIndex-t.chunkIndex),console.log(n),console.log(`─`.repeat(60)),console.log(`Chunks: ${a.length} | Type: ${a[0].contentType}`);for(let e of a){let t=e.startLine?` (lines ${e.startLine}-${e.endLine})`:``;console.log(`\nChunk ${e.chunkIndex+1}/${e.totalChunks}${t}`),console.log(e.content)}}}];export{h as searchCommands};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ctx as e}from"../context.js";import{executeCliBatchOperation as t,extractStrFlag as n,parseBatchPayload as r,printCheckResult as i,readInput as a}from"../helpers.js";import{dirname as o,resolve as s}from"node:path";import{fileURLToPath as c}from"node:url";import{audit as l,batch as u,check as d,guide as f,health as p,replayClear as m,replayList as h,replayTrim as g}from"../../../tools/dist/index.js";import{fork as _}from"node:child_process";const v=o(c(import.meta.url)),y=[{name:`status`,description:`Show
|
|
2
|
-
`)},c;n?(console.log(`Dropping existing index for full reindex...`),c=await i.reindexAll(o,s)):c=await i.index(o,s),console.log(`Done: ${c.filesProcessed} files, ${c.chunksCreated} chunks in ${(c.durationMs/1e3).toFixed(1)}s`),console.log(`Building FTS index...`),await r.createFtsIndex(),console.log(`Re-indexing curated entries...`);let l=await a.reindexAll();console.log(`Curated: ${l.indexed} entries restored`)}},{name:`serve`,description:`Start the MCP server (stdio or HTTP)`,usage:`aikit serve [--transport stdio|http] [--port N]`,run:async e=>{let t=s(v,`..`,`..`,`..`,`server`,`dist`,`index.js`),r=n(e,`--transport`,`stdio`),i=n(e,`--port`,`3210`),a=_(t,[],{stdio:r===`stdio`?[`pipe`,`pipe`,`inherit`,`ipc`]:`inherit`,env:{...process.env,AIKIT_TRANSPORT:r,AIKIT_PORT:i}});r===`stdio`&&a.stdin&&a.stdout&&(process.stdin.pipe(a.stdin),a.stdout.pipe(process.stdout)),a.on(`exit`,e=>process.exit(e??0)),process.on(`SIGINT`,()=>a.kill(`SIGINT`)),process.on(`SIGTERM`,()=>a.kill(`SIGTERM`)),await new Promise(()=>{})}},{name:`init`,description:`Initialize
|
|
3
|
-
Suggested next steps:`);for(let e of c.next)console.log(` → ${e.tool}: ${e.reason}`)}}else console.error(c.error?.message??`Audit failed`),process.exitCode=1}},{name:`guide`,description:`Tool discovery — recommend
|
|
4
|
-
pnpm add -D ink react @types/react`),process.exit(1)),e}}},{name:`dashboard`,description:`Launch web dashboard for knowledge graph visualization`,usage:`aikit dashboard [--port <port>] [--no-open]`,run:async e=>{let t=e.indexOf(`--port`),n=t!==-1&&e[t+1]?Number.parseInt(e[t+1],10):3210,r=Number.isFinite(n)?n:3210,i=e.includes(`--no-open`);console.log(`Starting
|
|
1
|
+
import{ctx as e}from"../context.js";import{executeCliBatchOperation as t,extractStrFlag as n,parseBatchPayload as r,printCheckResult as i,readInput as a}from"../helpers.js";import{dirname as o,resolve as s}from"node:path";import{fileURLToPath as c}from"node:url";import{audit as l,batch as u,check as d,guide as f,health as p,replayClear as m,replayList as h,replayTrim as g}from"../../../tools/dist/index.js";import{fork as _}from"node:child_process";const v=o(c(import.meta.url)),y=[{name:`status`,description:`Show AI Kit index status and statistics`,run:async()=>{let{isUserInstalled:t,getGlobalDataDir:n,computePartitionKey:r,listWorkspaces:i}=await import(`../../../core/dist/index.js`),{existsSync:a}=await import(`node:fs`),o=process.cwd(),c=t(),l=a(s(o,`.vscode`,`mcp.json`)),u,d;if(c&&l)u=`workspace (overrides user-level for this workspace)`,d=s(o,`.aikit-data`);else if(c){let e=r(o);u=a(s(o,`AGENTS.md`))?`user (workspace scaffolded)`:`user (workspace not scaffolded)`,d=s(n(),e)}else u=`workspace`,d=s(o,`.aikit-data`);if(console.log(`AI Kit Status`),console.log(`─`.repeat(40)),console.log(` Mode: ${u}`),console.log(` Data: ${d}`),c&&!l){let e=i();console.log(` Registry: ${e.length} workspace(s) enrolled`)}try{let{store:t}=await e(),n=await t.getStats(),r=await t.listSourcePaths();console.log(` Records: ${n.totalRecords}`),console.log(` Files: ${n.totalFiles}`),console.log(` Indexed: ${n.lastIndexedAt??`Never`}`),console.log(` Backend: ${n.storeBackend}`),console.log(` Model: ${n.embeddingModel}`),console.log(``),console.log(`Content Types:`);for(let[e,t]of Object.entries(n.contentTypeBreakdown))console.log(` ${e}: ${t}`);if(r.length>0){console.log(``),console.log(`Files (${r.length} total):`);for(let e of r.slice(0,20))console.log(` ${e}`);r.length>20&&console.log(` ... and ${r.length-20} more`)}}catch{console.log(``),console.log(" Index not available — run `aikit reindex` to index this workspace.")}c&&!l&&!a(s(o,`AGENTS.md`))&&(console.log(``),console.log(" Action: Run `npx @vpxa/aikit init` to add AGENTS.md and copilot-instructions.md"))}},{name:`reindex`,description:`Re-index the AI Kit index from configured sources`,usage:`aikit reindex [--full]`,run:async t=>{let n=t.includes(`--full`),{store:r,indexer:i,curated:a,config:o}=await e();console.log(`Indexing sources...`);let s=e=>{e.phase===`chunking`&&e.currentFile&&process.stdout.write(`\r [${e.filesProcessed+1}/${e.filesTotal}] ${e.currentFile}`),e.phase===`done`&&process.stdout.write(`
|
|
2
|
+
`)},c;n?(console.log(`Dropping existing index for full reindex...`),c=await i.reindexAll(o,s)):c=await i.index(o,s),console.log(`Done: ${c.filesProcessed} files, ${c.chunksCreated} chunks in ${(c.durationMs/1e3).toFixed(1)}s`),console.log(`Building FTS index...`),await r.createFtsIndex(),console.log(`Re-indexing curated entries...`);let l=await a.reindexAll();console.log(`Curated: ${l.indexed} entries restored`)}},{name:`serve`,description:`Start the MCP server (stdio or HTTP)`,usage:`aikit serve [--transport stdio|http] [--port N]`,run:async e=>{let t=s(v,`..`,`..`,`..`,`server`,`dist`,`index.js`),r=n(e,`--transport`,`stdio`),i=n(e,`--port`,`3210`),a=_(t,[],{stdio:r===`stdio`?[`pipe`,`pipe`,`inherit`,`ipc`]:`inherit`,env:{...process.env,AIKIT_TRANSPORT:r,AIKIT_PORT:i}});r===`stdio`&&a.stdin&&a.stdout&&(process.stdin.pipe(a.stdin),a.stdout.pipe(process.stdout)),a.on(`exit`,e=>process.exit(e??0)),process.on(`SIGINT`,()=>a.kill(`SIGINT`)),process.on(`SIGTERM`,()=>a.kill(`SIGTERM`)),await new Promise(()=>{})}},{name:`init`,description:`Initialize AI Kit in the current directory`,usage:`aikit init [--user|--workspace] [--force] [--guide]`,run:async e=>{let t=e.includes(`--user`),n=e.includes(`--workspace`),r=e.includes(`--guide`),i=e.includes(`--force`);if(t&&n&&(console.error(`Cannot use --user and --workspace together.`),process.exit(1)),r){let{guideProject:e}=await import(`./init/index.js`);await e();return}if(t){let{initUser:e}=await import(`./init/user.js`);await e({force:i})}else if(n){let{initProject:e}=await import(`./init/index.js`);await e({force:i})}else{let{initSmart:e}=await import(`./init/index.js`);await e({force:i})}}},{name:`check`,description:`Run incremental typecheck and lint`,usage:`aikit check [--cwd <dir>] [--files f1,f2] [--skip-types] [--skip-lint] [--detail summary|errors|full]`,run:async e=>{let t=n(e,`--cwd`,``).trim()||void 0,r=n(e,`--files`,``),a=n(e,`--detail`,`full`)||`full`,o=r.split(`,`).map(e=>e.trim()).filter(Boolean),s=!1;e.includes(`--skip-types`)&&(e.splice(e.indexOf(`--skip-types`),1),s=!0);let c=!1;e.includes(`--skip-lint`)&&(e.splice(e.indexOf(`--skip-lint`),1),c=!0);let l=await d({cwd:t,files:o.length>0?o:void 0,skipTypes:s,skipLint:c,detail:a});i(l),l.passed||(process.exitCode=1)}},{name:`batch`,description:`Execute built-in operations from JSON input`,usage:`aikit batch [--file path] [--concurrency N]`,run:async i=>{let o=n(i,`--file`,``).trim()||void 0,s=(()=>{let e=i.indexOf(`--concurrency`);if(e===-1||e+1>=i.length)return 0;let t=Number.parseInt(i.splice(e,2)[1],10);return Number.isNaN(t)?0:t})(),c=await a(o);c.trim()||(console.error(`Usage: aikit batch [--file path] [--concurrency N]`),process.exit(1));let l=r(c),d=s>0?s:l.concurrency,f=l.operations.some(e=>e.type!==`check`)?await e():null,p=await u(l.operations,async e=>t(e,f),{concurrency:d});console.log(JSON.stringify(p,null,2)),p.some(e=>e.status===`error`)&&(process.exitCode=1)}},{name:`health`,description:`Run project health checks on the current directory`,usage:`aikit health [path]`,run:async e=>{let t=p(e.shift());console.log(`Project Health: ${t.path}`),console.log(`─`.repeat(50));for(let e of t.checks){let t=e.status===`pass`?`+`:e.status===`warn`?`~`:`X`;console.log(` [${t}] ${e.name}: ${e.message}`)}console.log(`─`.repeat(50)),console.log(`Score: ${t.score}% — ${t.summary}`)}},{name:`audit`,description:`Run a unified project audit (structure, deps, patterns, health, dead symbols, check)`,usage:`aikit audit [path] [--checks structure,dependencies,patterns,health,dead_symbols,check,entry_points] [--detail summary|full]`,run:async t=>{let{store:r,embedder:i}=await e(),a=n(t,`--detail`,`summary`)||`summary`,o=n(t,`--checks`,``),s=o?o.split(`,`).map(e=>e.trim()):void 0,c=await l(r,i,{path:t.shift()||`.`,checks:s,detail:a});if(c.ok){if(console.log(c.summary),c.next&&c.next.length>0){console.log(`
|
|
3
|
+
Suggested next steps:`);for(let e of c.next)console.log(` → ${e.tool}: ${e.reason}`)}}else console.error(c.error?.message??`Audit failed`),process.exitCode=1}},{name:`guide`,description:`Tool discovery — recommend AI Kit tools for a given goal`,usage:`aikit guide <goal> [--max N]`,run:async e=>{let t=e.indexOf(`--max`),n=5;t!==-1&&t+1<e.length&&(n=Number.parseInt(e.splice(t,2)[1],10)||5);let r=e.join(` `).trim();r||(console.error(`Usage: aikit guide <goal> [--max N]`),console.error(`Example: aikit guide "audit this project"`),process.exit(1));let i=f(r,n);console.log(`Workflow: ${i.workflow}`),console.log(` ${i.description}\n`),console.log(`Recommended tools:`);for(let e of i.tools){let t=e.suggestedArgs?` ${JSON.stringify(e.suggestedArgs)}`:``;console.log(` ${e.order}. ${e.tool} — ${e.reason}${t}`)}i.alternativeWorkflows.length>0&&console.log(`\nAlternatives: ${i.alternativeWorkflows.join(`, `)}`)}},{name:`replay`,description:`Show recent tool invocation audit trail`,usage:`aikit replay [--last N] [--tool <name>] [--source mcp|cli]`,run:async e=>{let t=h({last:Number.parseInt(e[e.indexOf(`--last`)+1],10)||20,tool:e.includes(`--tool`)?e[e.indexOf(`--tool`)+1]:void 0,source:e.includes(`--source`)?e[e.indexOf(`--source`)+1]:void 0});if(t.length===0){console.log(`No replay entries. Activity is logged when tools are invoked.`);return}console.log(`Replay Log (${t.length} entries)\n`);for(let e of t){let t=e.ts.split(`T`)[1]?.split(`.`)[0]??e.ts,n=e.status===`ok`?`✓`:`✗`;console.log(`${t} ${n} ${e.tool} (${e.durationMs}ms) [${e.source}]`),console.log(` in: ${e.input}`),console.log(` out: ${e.output}`)}g().catch(()=>{})}},{name:`replay-clear`,description:`Clear the replay audit trail`,run:async()=>{m(),console.log(`Replay log cleared.`)}},{name:`tui`,description:`Launch interactive terminal dashboard (human monitoring)`,run:async()=>{try{let{launch:t}=await import(`../../../tui/dist/index.js`),{DirectKBClient:n}=await import(`../../../aikit-client/dist/index.js`),{store:r,embedder:i,graphStore:a,curated:o}=await e();t(new n({store:r,embedder:i,graphStore:a,listCurated:async()=>(await o.list()).map(e=>({...e,content:e.contentPreview})),readCurated:e=>o.read(e)}))}catch(e){throw e.code===`ERR_MODULE_NOT_FOUND`&&(console.error(`TUI requires ink and react. Install them with:
|
|
4
|
+
pnpm add -D ink react @types/react`),process.exit(1)),e}}},{name:`dashboard`,description:`Launch web dashboard for knowledge graph visualization`,usage:`aikit dashboard [--port <port>] [--no-open]`,run:async e=>{let t=e.indexOf(`--port`),n=t!==-1&&e[t+1]?Number.parseInt(e[t+1],10):3210,r=Number.isFinite(n)?n:3210,i=e.includes(`--no-open`);console.log(`Starting AI Kit server on port ${r}...`);let{spawn:a}=await import(`node:child_process`),{platform:o}=await import(`node:os`),c=s(v,`..`,`..`,`..`,`server`,`dist`,`index.js`),l=a(process.execPath,[c,`--transport`,`http`,`--port`,String(r)],{stdio:[`ignore`,`pipe`,`pipe`],env:{...process.env,AIKIT_TRANSPORT:`http`,AIKIT_PORT:String(r)}}),u=`http://localhost:${r}/_dashboard/`,d=`http://localhost:${r}/health`,f=!1;for(let e=0;e<30;e+=1){try{if((await fetch(d)).ok){f=!0;break}}catch{}await new Promise(e=>setTimeout(e,1e3))}if(f||(console.error(`Server failed to start within 30 seconds.`),l.kill(),process.exit(1)),console.log(`AI Kit Dashboard: ${u}`),console.log(`Press Ctrl+C to stop.`),!i){let e=o();e===`win32`?a(`cmd`,[`/c`,`start`,``,u],{stdio:`ignore`,detached:!0}).unref():a(e===`darwin`?`open`:`xdg-open`,[u],{stdio:`ignore`,detached:!0}).unref()}let p=()=>{l.kill(),process.exit(0)};process.on(`SIGINT`,p),process.on(`SIGTERM`,p),await new Promise(e=>{l.on(`exit`,()=>e())})}}];export{y as systemCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SKILL_NAMES as e}from"./init/constants.js";import{existsSync as t,readFileSync as n}from"node:fs";import{dirname as r,resolve as i}from"node:path";import{fileURLToPath as a}from"node:url";const o=[{name:`upgrade`,description:`Upgrade
|
|
1
|
+
import{SKILL_NAMES as e}from"./init/constants.js";import{existsSync as t,readFileSync as n}from"node:fs";import{dirname as r,resolve as i}from"node:path";import{fileURLToPath as a}from"node:url";const o=[{name:`upgrade`,description:`Upgrade AI Kit agents, prompts, and skills to the latest version (user-level and workspace-level)`,usage:`aikit upgrade`,run:async()=>{let{initUser:o}=await import(`./init/user.js`);if(await o({force:!0}),t(i(process.cwd(),`.github`,`.aikit-scaffold.json`))){let{initScaffoldOnly:o}=await import(`./init/index.js`);if(await o({force:!0}),t(i(process.cwd(),`.github`,`skills`))){let{smartCopySkills:t}=await import(`./init/scaffold.js`),o=i(r(a(import.meta.url)),`..`,`..`,`..`,`..`),s=JSON.parse(n(i(o,`package.json`),`utf-8`)).version;t(process.cwd(),o,[...e],s,!0)}}}}];export{o as upgradeCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extractStrFlag as e,parseMaybeJsonString as t,printWorkset as n,readStdin as r,splitCsv as i}from"../helpers.js";import{addToWorkset as a,deleteWorkset as o,getWorkset as s,laneCreate as c,laneDiff as l,laneDiscard as u,laneList as d,laneMerge as f,laneStatus as p,listWorksets as m,queueClear as h,queueCreate as g,queueDelete as _,queueDone as v,queueFail as y,queueGet as b,queueList as x,queueNext as S,queuePush as C,removeFromWorkset as w,saveWorkset as T,stashClear as E,stashDelete as D,stashGet as O,stashList as k,stashSet as A}from"../../../tools/dist/index.js";const j=[{name:`workset`,description:`Manage saved file sets`,usage:`
|
|
1
|
+
import{extractStrFlag as e,parseMaybeJsonString as t,printWorkset as n,readStdin as r,splitCsv as i}from"../helpers.js";import{addToWorkset as a,deleteWorkset as o,getWorkset as s,laneCreate as c,laneDiff as l,laneDiscard as u,laneList as d,laneMerge as f,laneStatus as p,listWorksets as m,queueClear as h,queueCreate as g,queueDelete as _,queueDone as v,queueFail as y,queueGet as b,queueList as x,queueNext as S,queuePush as C,removeFromWorkset as w,saveWorkset as T,stashClear as E,stashDelete as D,stashGet as O,stashList as k,stashSet as A}from"../../../tools/dist/index.js";const j=[{name:`workset`,description:`Manage saved file sets`,usage:`aikit workset <action> [name] [--files f1,f2] [--description desc]`,run:async t=>{let r=t.shift()?.trim(),c=i(e(t,`--files`,``)),l=e(t,`--description`,``).trim()||void 0,u=t.shift()?.trim();switch(r||(console.error(`Usage: aikit workset <action> [name] [--files f1,f2] [--description desc]`),console.error(`Actions: save, get, list, delete, add, remove`),process.exit(1)),r){case`save`:{(!u||c.length===0)&&(console.error(`Usage: aikit workset save <name> --files f1,f2 [--description desc]`),process.exit(1));let e=T(u,c,{description:l});console.log(`Saved workset: ${e.name}`),n(e);return}case`get`:{u||(console.error(`Usage: aikit workset get <name>`),process.exit(1));let e=s(u);if(!e){console.log(`No workset found: ${u}`);return}n(e);return}case`list`:{let e=m();if(e.length===0){console.log(`No worksets saved.`);return}console.log(`Worksets (${e.length})`),console.log(`─`.repeat(60));for(let t of e)n(t),console.log(``);return}case`delete`:{u||(console.error(`Usage: aikit workset delete <name>`),process.exit(1));let e=o(u);console.log(e?`Deleted workset: ${u}`:`No workset found: ${u}`);return}case`add`:{(!u||c.length===0)&&(console.error(`Usage: aikit workset add <name> --files f1,f2`),process.exit(1));let e=a(u,c);console.log(`Updated workset: ${e.name}`),n(e);return}case`remove`:{(!u||c.length===0)&&(console.error(`Usage: aikit workset remove <name> --files f1,f2`),process.exit(1));let e=w(u,c);if(!e){console.log(`No workset found: ${u}`);return}console.log(`Updated workset: ${e.name}`),n(e);return}default:console.error(`Unknown workset action: ${r}`),console.error(`Actions: save, get, list, delete, add, remove`),process.exit(1)}}},{name:`stash`,description:`Persist and retrieve named intermediate values`,usage:`aikit stash <set|get|list|delete|clear> [key] [value]`,run:async e=>{let n=e.shift()?.trim(),i=e.shift()?.trim();switch(n||(console.error(`Usage: aikit stash <set|get|list|delete|clear> [key] [value]`),process.exit(1)),n){case`set`:{i||(console.error(`Usage: aikit stash set <key> <value>`),process.exit(1));let n=e.join(` `),a=n.trim()?``:await r(),o=A(i,t(n||a));console.log(`Stored stash entry: ${o.key}`),console.log(` Type: ${o.type}`),console.log(` Stored: ${o.storedAt}`);return}case`get`:{i||(console.error(`Usage: aikit stash get <key>`),process.exit(1));let e=O(i);if(!e){console.log(`No stash entry found: ${i}`);return}console.log(JSON.stringify(e,null,2));return}case`list`:{let e=k();if(e.length===0){console.log(`No stash entries saved.`);return}console.log(`Stash entries (${e.length})`),console.log(`─`.repeat(60));for(let t of e)console.log(`${t.key} (${t.type})`),console.log(` Stored: ${t.storedAt}`);return}case`delete`:{i||(console.error(`Usage: aikit stash delete <key>`),process.exit(1));let e=D(i);console.log(e?`Deleted stash entry: ${i}`:`No stash entry found: ${i}`);return}case`clear`:{let e=E();console.log(`Cleared ${e} stash entr${e===1?`y`:`ies`}.`);return}default:console.error(`Unknown stash action: ${n}`),console.error(`Actions: set, get, list, delete, clear`),process.exit(1)}}},{name:`lane`,description:`Manage verified lanes — isolated file copies for parallel exploration`,usage:`aikit lane <create|list|status|diff|merge|discard> [name] [--files f1,f2]`,run:async t=>{let n=t.shift();if((!n||![`create`,`list`,`status`,`diff`,`merge`,`discard`].includes(n))&&(console.error(`Usage: aikit lane <create|list|status|diff|merge|discard> [name] [--files f1,f2]`),process.exit(1)),n===`list`){let e=d();if(e.length===0){console.log(`No active lanes.`);return}for(let t of e)console.log(`${t.name} (${t.sourceFiles.length} files, created ${t.createdAt})`);return}let r=t.shift();switch(r||(console.error(`Lane name is required for "${n}".`),process.exit(1)),n){case`create`:{let n=e(t,`--files`,``);n||(console.error(`Usage: aikit lane create <name> --files file1.ts,file2.ts`),process.exit(1));let i=c(r,n.split(`,`).map(e=>e.trim()));console.log(`Lane "${i.name}" created with ${i.sourceFiles.length} files.`);break}case`status`:{let e=p(r);console.log(`Lane: ${e.name}`),console.log(`Modified: ${e.modified} | Added: ${e.added} | Deleted: ${e.deleted}`);for(let t of e.entries)console.log(` ${t.status.padEnd(10)} ${t.file}`);break}case`diff`:{let e=l(r);console.log(`Lane: ${e.name} — ${e.modified} modified, ${e.added} added, ${e.deleted} deleted`);for(let t of e.entries)t.diff&&(console.log(`\n--- ${t.file} (${t.status})`),console.log(t.diff));break}case`merge`:{let e=f(r);console.log(`Merged ${e.filesMerged} files from lane "${e.name}".`);for(let t of e.files)console.log(` ${t}`);break}case`discard`:{let e=u(r);console.log(e?`Lane "${r}" discarded.`:`Lane "${r}" not found.`);break}}}},{name:`queue`,description:`Manage task queues for sequential agent operations`,usage:`aikit queue <create|push|next|done|fail|get|list|clear|delete> [name] [args]`,run:async e=>{let t=e.shift();if((!t||![`create`,`push`,`next`,`done`,`fail`,`get`,`list`,`clear`,`delete`].includes(t))&&(console.error(`Usage: aikit queue <create|push|next|done|fail|get|list|clear|delete> [name] [args]`),process.exit(1)),t===`list`){let e=x();if(e.length===0){console.log(`No queues.`);return}for(let t of e)console.log(`${t.name} pending:${t.pending} done:${t.done} failed:${t.failed} total:${t.total}`);return}let n=e.shift();switch(n||(console.error(`Queue name is required for "${t}".`),process.exit(1)),t){case`create`:{let e=g(n);console.log(`Queue "${e.name}" created.`);break}case`push`:{let t=C(n,e.join(` `)||`Untitled task`);console.log(`Pushed "${t.title}" (${t.id}) to queue "${n}".`);break}case`next`:{let e=S(n);console.log(e?`Next: ${e.title} (${e.id})`:`No pending items in queue "${n}".`);break}case`done`:{let t=e.shift();t||(console.error(`Usage: aikit queue done <name> <id>`),process.exit(1));let r=v(n,t);console.log(`Marked "${r.title}" as done.`);break}case`fail`:{let t=e.shift(),r=e.join(` `)||`Unknown error`;t||(console.error(`Usage: aikit queue fail <name> <id> [error message]`),process.exit(1));let i=y(n,t,r);console.log(`Marked "${i.title}" as failed: ${r}`);break}case`get`:{let e=b(n);if(!e){console.log(`Queue "${n}" not found.`);return}console.log(`Queue: ${e.name} (${e.items.length} items)`);for(let t of e.items){let e=t.error?` — ${t.error}`:``;console.log(` ${t.status.padEnd(12)} ${t.id} ${t.title}${e}`)}break}case`clear`:{let e=h(n);console.log(`Cleared ${e} completed/failed items from queue "${n}".`);break}case`delete`:{let e=_(n);console.log(e?`Queue "${n}" deleted.`:`Queue "${n}" not found.`);break}}}}];export{j as workspaceCommands};
|
|
@@ -2,4 +2,4 @@ import{resolve as e}from"node:path";import{readFile as t}from"node:fs/promises";
|
|
|
2
2
|
`))console.log(` ${e}`)}}function x(e){console.log(e.id),console.log(` Command: ${e.command}${e.args.length>0?` ${e.args.join(` `)}`:``}`),console.log(` PID: ${e.pid??`unknown`}`),console.log(` Status: ${e.status}`),console.log(` Started: ${e.startedAt}`),e.exitCode!==void 0&&console.log(` Exit code: ${e.exitCode}`),console.log(` Logs: ${e.logs.length}`)}function S(e){if(console.log(`Exports scanned: ${e.totalExports}`),console.log(`Dead in source: ${e.totalDeadSource} (actionable)`),console.log(`Dead in docs: ${e.totalDeadDocs} (informational)`),e.totalDeadSource===0&&e.totalDeadDocs===0){console.log(`No dead symbols found.`);return}if(e.deadInSource.length>0){console.log(`
|
|
3
3
|
Dead in source (actionable):`);for(let t of e.deadInSource)console.log(` - ${t.path}:${t.line} ${t.kind} ${t.name}`)}if(e.deadInDocs.length>0){console.log(`
|
|
4
4
|
Dead in docs (informational):`);for(let t of e.deadInDocs)console.log(` - ${t.path}:${t.line} ${t.kind} ${t.name}`)}}function C(e){console.log(e.path),console.log(` Language: ${e.language}`),console.log(` Lines: ${e.lines}`),console.log(` Estimated tokens: ~${e.estimatedTokens}`),console.log(``),D(`Imports`,e.imports),D(`Exports`,e.exports),D(`Functions`,e.functions.map(e=>`${e.name} @ line ${e.line}${e.exported?` [exported]`:``}`)),D(`Classes`,e.classes.map(e=>`${e.name} @ line ${e.line}${e.exported?` [exported]`:``}`)),D(`Interfaces`,e.interfaces.map(e=>`${e.name} @ line ${e.line}`)),D(`Types`,e.types.map(e=>`${e.name} @ line ${e.line}`))}function w(e){if(console.log(`Symbol: ${e.name}`),e.definedIn?console.log(`Defined in: ${e.definedIn.path}:${e.definedIn.line} (${e.definedIn.kind})`):console.log(`Defined in: not found`),console.log(``),console.log(`Imported by:`),e.importedBy.length===0)console.log(` none`);else for(let t of e.importedBy)console.log(` - ${t.path}:${t.line} ${t.importStatement}`);if(console.log(``),console.log(`Referenced in:`),e.referencedIn.length===0)console.log(` none`);else for(let t of e.referencedIn)console.log(` - ${t.path}:${t.line} ${t.context}`)}function T(e){console.log(e.name),console.log(` Files: ${e.files.length}`),console.log(` Updated: ${e.updated}`),e.description&&console.log(` Description: ${e.description}`);for(let t of e.files)console.log(` - ${t}`)}function E(e){if(console.log(e.id),console.log(` Label: ${e.label}`),console.log(` Created: ${e.createdAt}`),e.notes&&console.log(` Notes: ${e.notes}`),e.files?.length){console.log(` Files: ${e.files.length}`);for(let t of e.files)console.log(` - ${t}`)}console.log(` Data:`);for(let t of JSON.stringify(e.data,null,2).split(`
|
|
5
|
-
`))console.log(` ${t}`)}function D(e,t){if(console.log(`${e}:`),t.length===0){console.log(` none`),console.log(``);return}for(let e of t)console.log(` - ${e}`);console.log(``)}function O(e){let t=e.trim();if(!t)return``;try{return JSON.parse(t)}catch{return e}}function k(e){let t=e.trim();if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Checkpoint data must be a JSON object.`);return n}function A(e,t,n=60){let r=new Map;for(let t=0;t<e.length;t++){let i=e[t];r.set(i.record.id,{record:i.record,score:1/(n+t+1)})}for(let e=0;e<t.length;e++){let i=t[e],a=r.get(i.record.id);a?a.score+=1/(n+e+1):r.set(i.record.id,{record:i.record,score:1/(n+e+1)})}return[...r.values()].sort((e,t)=>t.score-e.score)}async function j(e,t){switch(e.type){case`search`:{if(!t)throw Error(`search operation requires
|
|
5
|
+
`))console.log(` ${t}`)}function D(e,t){if(console.log(`${e}:`),t.length===0){console.log(` none`),console.log(``);return}for(let e of t)console.log(` - ${e}`);console.log(``)}function O(e){let t=e.trim();if(!t)return``;try{return JSON.parse(t)}catch{return e}}function k(e){let t=e.trim();if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Checkpoint data must be a JSON object.`);return n}function A(e,t,n=60){let r=new Map;for(let t=0;t<e.length;t++){let i=e[t];r.set(i.record.id,{record:i.record,score:1/(n+t+1)})}for(let e=0;e<t.length;e++){let i=t[e],a=r.get(i.record.id);a?a.score+=1/(n+e+1):r.set(i.record.id,{record:i.record,score:1/(n+e+1)})}return[...r.values()].sort((e,t)=>t.score-e.score)}async function j(e,t){switch(e.type){case`search`:{if(!t)throw Error(`search operation requires AI Kit context`);let n=typeof e.args.query==`string`?e.args.query.trim():``;if(!n)throw Error(`search operation requires a query`);let r=typeof e.args.limit==`number`?e.args.limit:5,i=e.args.search_mode===`semantic`||e.args.search_mode===`keyword`?e.args.search_mode:`hybrid`,a=typeof e.args.content_type==`string`?e.args.content_type:void 0,o=typeof e.args.min_score==`number`?e.args.min_score:.25;if(i===`keyword`)return(await t.store.ftsSearch(n,{limit:r,contentType:a,minScore:o})).slice(0,r);let s=await t.embedder.embedQuery(n);if(i===`semantic`)return t.store.search(s,{limit:r,contentType:a,minScore:o});let[c,l]=await Promise.all([t.store.search(s,{limit:r*2,contentType:a,minScore:o}),t.store.ftsSearch(n,{limit:r*2,contentType:a,minScore:o}).catch(()=>[])]);return A(c,l).slice(0,r)}case`find`:{if(!t)throw Error(`find operation requires AI Kit context`);let n=typeof e.args.query==`string`?e.args.query:void 0,i=typeof e.args.glob==`string`?e.args.glob:void 0,a=typeof e.args.pattern==`string`?e.args.pattern:void 0,o=typeof e.args.limit==`number`?e.args.limit:10,s=typeof e.args.content_type==`string`?e.args.content_type:void 0,c=typeof e.args.cwd==`string`?e.args.cwd:void 0;if(!n&&!i&&!a)throw Error(`find operation requires query, glob, or pattern`);return r(t.embedder,t.store,{query:n,glob:i,pattern:a,limit:o,contentType:s,cwd:c})}case`check`:return n({files:Array.isArray(e.args.files)?e.args.files.filter(e=>typeof e==`string`):void 0,cwd:typeof e.args.cwd==`string`?e.args.cwd:void 0,skipTypes:e.args.skip_types===!0,skipLint:e.args.skip_lint===!0});default:throw Error(`Unsupported batch operation type: ${e.type}`)}}export{j as executeCliBatchOperation,o as extractBoolFlag,i as extractNumFlag,a as extractStrFlag,f as formatFocusRanges,u as parseBatchPayload,O as parseMaybeJsonString,k as parseRecordString,m as printCheckResult,h as printCheckSection,E as printCheckpoint,S as printDeadSymbolsResult,v as printDiffFiles,b as printExamplesResult,C as printFileSummary,_ as printGitContext,x as printManagedProcess,p as printParsedOutput,D as printSection,w as printSymbolInfo,g as printTestRunResult,y as printTraceResult,T as printWorkset,c as readInput,s as readStdin,A as rrf,l as splitCsv,d as validateBatchOperations};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region packages/cli/src/index.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* @vpxa/aikit CLI — command-line interface for the
|
|
3
|
+
* @vpxa/aikit CLI — command-line interface for the AI Kit toolkit.
|
|
4
4
|
*
|
|
5
5
|
* Thin adapter: arg parsing + output formatting.
|
|
6
6
|
* All core logic lives in @aikit/core, @aikit/store, @aikit/embeddings, etc.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region packages/core/src/constants.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Default constants for the
|
|
3
|
+
* Default constants for the AI Kit system.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* Centralized directory paths for all
|
|
6
|
+
* Centralized directory paths for all AI Kit artifacts.
|
|
7
7
|
* Single source of truth — change here to update everywhere.
|
|
8
8
|
*/
|
|
9
9
|
declare const AIKIT_PATHS: {
|
|
@@ -19,7 +19,7 @@ declare const AIKIT_PATHS: {
|
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* Global-mode directory paths (under ~/.aikit-data/).
|
|
22
|
-
* Used when
|
|
22
|
+
* Used when AI Kit is installed at user level rather than per-workspace.
|
|
23
23
|
*/
|
|
24
24
|
declare const AIKIT_GLOBAL_PATHS: {
|
|
25
25
|
/** Root directory name for global data store */readonly root: ".aikit-data"; /** Registry file tracking all enrolled workspaces */
|
|
@@ -59,5 +59,11 @@ declare function getPartitionDir(partition: string): string;
|
|
|
59
59
|
* Check whether user-level mode is installed (registry.json exists in ~/.aikit-data/).
|
|
60
60
|
*/
|
|
61
61
|
declare function isUserInstalled(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Resolve the state directory for a given workspace root.
|
|
64
|
+
* - User-level install: `~/.aikit-data/<partition>/state/`
|
|
65
|
+
* - Workspace-level install: `<cwd>/.aikit-state/`
|
|
66
|
+
*/
|
|
67
|
+
declare function resolveStateDir(cwd: string): string;
|
|
62
68
|
//#endregion
|
|
63
|
-
export { GlobalRegistry, RegistryEntry, computePartitionKey, getGlobalDataDir, getPartitionDir, isUserInstalled, listWorkspaces, loadRegistry, lookupWorkspace, registerWorkspace, saveRegistry };
|
|
69
|
+
export { GlobalRegistry, RegistryEntry, computePartitionKey, getGlobalDataDir, getPartitionDir, isUserInstalled, listWorkspaces, loadRegistry, lookupWorkspace, registerWorkspace, resolveStateDir, saveRegistry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AIKIT_GLOBAL_PATHS as e}from"./constants.js";import{basename as
|
|
1
|
+
import{AIKIT_GLOBAL_PATHS as e,AIKIT_PATHS as t}from"./constants.js";import{basename as n,resolve as r}from"node:path";import{createHash as i}from"node:crypto";import{closeSync as a,constants as o,existsSync as s,mkdirSync as c,openSync as l,readFileSync as u,renameSync as d,statSync as f,unlinkSync as p,writeFileSync as m}from"node:fs";import{homedir as h}from"node:os";function g(){return process.env.AIKIT_GLOBAL_DATA_DIR??r(h(),e.root)}function _(e){let t=r(e);return`${n(t).toLowerCase().replace(/[^a-z0-9-]/g,`-`)||`workspace`}-${i(`sha256`).update(t).digest(`hex`).slice(0,8)}`}function v(){let t=r(g(),e.registry);if(!s(t))return{version:1,workspaces:{}};let n=u(t,`utf-8`);try{return JSON.parse(n)}catch{return{version:1,workspaces:{}}}}function y(e,t=5e3){let n=`${e}.lock`,r=Date.now()+t,i=10;for(;Date.now()<r;)try{let e=l(n,o.O_CREAT|o.O_EXCL|o.O_WRONLY);return m(e,`${process.pid}\n`),a(e),n}catch(e){if(e.code!==`EEXIST`)throw e;try{let{mtimeMs:e}=f(n);if(Date.now()-e>3e4){p(n);continue}}catch{}let t=new SharedArrayBuffer(4);Atomics.wait(new Int32Array(t),0,0,i),i=Math.min(i*2,200)}throw Error(`Failed to acquire registry lock after ${t}ms`)}function b(e){try{p(e)}catch{}}function x(t){let n=g();c(n,{recursive:!0});let i=r(n,e.registry),a=y(i);try{let e=`${i}.tmp`;m(e,JSON.stringify(t,null,2),`utf-8`),d(e,i)}finally{b(a)}}function S(e){let t=v(),n=_(e),i=new Date().toISOString();return t.workspaces[n]?t.workspaces[n].lastAccessedAt=i:t.workspaces[n]={partition:n,workspacePath:r(e),registeredAt:i,lastAccessedAt:i},c(T(n),{recursive:!0}),x(t),t.workspaces[n]}function C(e){let t=v(),n=_(e);return t.workspaces[n]}function w(){let e=v();return Object.values(e.workspaces)}function T(e){return r(g(),e)}function E(){return s(r(g(),e.registry))}function D(e){return E()?r(T(S(e).partition),`state`):r(e,t.state)}export{_ as computePartitionKey,g as getGlobalDataDir,T as getPartitionDir,E as isUserInstalled,w as listWorkspaces,v as loadRegistry,C as lookupWorkspace,S as registerWorkspace,D as resolveStateDir,x as saveRegistry};
|