@vibe-agent-toolkit/cli 0.1.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -0
- package/dist/bin/vat.d.ts +7 -0
- package/dist/bin/vat.d.ts.map +1 -0
- package/dist/bin/vat.js +52 -0
- package/dist/bin/vat.js.map +1 -0
- package/dist/bin.d.ts +7 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +103 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/agent/audit.d.ts +9 -0
- package/dist/commands/agent/audit.d.ts.map +1 -0
- package/dist/commands/agent/audit.js +139 -0
- package/dist/commands/agent/audit.js.map +1 -0
- package/dist/commands/agent/build.d.ts +13 -0
- package/dist/commands/agent/build.d.ts.map +1 -0
- package/dist/commands/agent/build.js +52 -0
- package/dist/commands/agent/build.js.map +1 -0
- package/dist/commands/agent/help.d.ts +5 -0
- package/dist/commands/agent/help.d.ts.map +1 -0
- package/dist/commands/agent/help.js +10 -0
- package/dist/commands/agent/help.js.map +1 -0
- package/dist/commands/agent/import.d.ts +10 -0
- package/dist/commands/agent/import.d.ts.map +1 -0
- package/dist/commands/agent/import.js +50 -0
- package/dist/commands/agent/import.js.map +1 -0
- package/dist/commands/agent/index.d.ts +7 -0
- package/dist/commands/agent/index.d.ts.map +1 -0
- package/dist/commands/agent/index.js +293 -0
- package/dist/commands/agent/index.js.map +1 -0
- package/dist/commands/agent/install.d.ts +15 -0
- package/dist/commands/agent/install.d.ts.map +1 -0
- package/dist/commands/agent/install.js +107 -0
- package/dist/commands/agent/install.js.map +1 -0
- package/dist/commands/agent/installed.d.ts +13 -0
- package/dist/commands/agent/installed.d.ts.map +1 -0
- package/dist/commands/agent/installed.js +106 -0
- package/dist/commands/agent/installed.js.map +1 -0
- package/dist/commands/agent/list.d.ts +8 -0
- package/dist/commands/agent/list.d.ts.map +1 -0
- package/dist/commands/agent/list.js +41 -0
- package/dist/commands/agent/list.js.map +1 -0
- package/dist/commands/agent/run.d.ts +17 -0
- package/dist/commands/agent/run.d.ts.map +1 -0
- package/dist/commands/agent/run.js +44 -0
- package/dist/commands/agent/run.js.map +1 -0
- package/dist/commands/agent/uninstall.d.ts +13 -0
- package/dist/commands/agent/uninstall.d.ts.map +1 -0
- package/dist/commands/agent/uninstall.js +48 -0
- package/dist/commands/agent/uninstall.js.map +1 -0
- package/dist/commands/agent/validate.d.ts +8 -0
- package/dist/commands/agent/validate.d.ts.map +1 -0
- package/dist/commands/agent/validate.js +51 -0
- package/dist/commands/agent/validate.js.map +1 -0
- package/dist/commands/rag/clear-command.d.ts +10 -0
- package/dist/commands/rag/clear-command.d.ts.map +1 -0
- package/dist/commands/rag/clear-command.js +22 -0
- package/dist/commands/rag/clear-command.js.map +1 -0
- package/dist/commands/rag/command-helpers.d.ts +27 -0
- package/dist/commands/rag/command-helpers.d.ts.map +1 -0
- package/dist/commands/rag/command-helpers.js +58 -0
- package/dist/commands/rag/command-helpers.js.map +1 -0
- package/dist/commands/rag/help.d.ts +5 -0
- package/dist/commands/rag/help.d.ts.map +1 -0
- package/dist/commands/rag/help.js +10 -0
- package/dist/commands/rag/help.js.map +1 -0
- package/dist/commands/rag/index-command.d.ts +10 -0
- package/dist/commands/rag/index-command.d.ts.map +1 -0
- package/dist/commands/rag/index-command.js +49 -0
- package/dist/commands/rag/index-command.js.map +1 -0
- package/dist/commands/rag/index.d.ts +7 -0
- package/dist/commands/rag/index.d.ts.map +1 -0
- package/dist/commands/rag/index.js +168 -0
- package/dist/commands/rag/index.js.map +1 -0
- package/dist/commands/rag/query-command.d.ts +11 -0
- package/dist/commands/rag/query-command.d.ts.map +1 -0
- package/dist/commands/rag/query-command.js +54 -0
- package/dist/commands/rag/query-command.js.map +1 -0
- package/dist/commands/rag/stats-command.d.ts +10 -0
- package/dist/commands/rag/stats-command.d.ts.map +1 -0
- package/dist/commands/rag/stats-command.js +25 -0
- package/dist/commands/rag/stats-command.js.map +1 -0
- package/dist/commands/resources/command-helpers.d.ts +5 -0
- package/dist/commands/resources/command-helpers.d.ts.map +1 -0
- package/dist/commands/resources/command-helpers.js +6 -0
- package/dist/commands/resources/command-helpers.js.map +1 -0
- package/dist/commands/resources/help.d.ts +5 -0
- package/dist/commands/resources/help.d.ts.map +1 -0
- package/dist/commands/resources/help.js +10 -0
- package/dist/commands/resources/help.js.map +1 -0
- package/dist/commands/resources/index.d.ts +7 -0
- package/dist/commands/resources/index.d.ts.map +1 -0
- package/dist/commands/resources/index.js +64 -0
- package/dist/commands/resources/index.js.map +1 -0
- package/dist/commands/resources/scan.d.ts +9 -0
- package/dist/commands/resources/scan.d.ts.map +1 -0
- package/dist/commands/resources/scan.js +47 -0
- package/dist/commands/resources/scan.js.map +1 -0
- package/dist/commands/resources/validate.d.ts +9 -0
- package/dist/commands/resources/validate.d.ts.map +1 -0
- package/dist/commands/resources/validate.js +61 -0
- package/dist/commands/resources/validate.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/config.d.ts +1034 -0
- package/dist/schemas/config.d.ts.map +1 -0
- package/dist/schemas/config.js +135 -0
- package/dist/schemas/config.js.map +1 -0
- package/dist/utils/agent-discovery.d.ts +32 -0
- package/dist/utils/agent-discovery.d.ts.map +1 -0
- package/dist/utils/agent-discovery.js +108 -0
- package/dist/utils/agent-discovery.js.map +1 -0
- package/dist/utils/agent-runner.d.ts +22 -0
- package/dist/utils/agent-runner.d.ts.map +1 -0
- package/dist/utils/agent-runner.js +120 -0
- package/dist/utils/agent-runner.js.map +1 -0
- package/dist/utils/command-error.d.ts +19 -0
- package/dist/utils/command-error.d.ts.map +1 -0
- package/dist/utils/command-error.js +36 -0
- package/dist/utils/command-error.js.map +1 -0
- package/dist/utils/config-loader.d.ts +12 -0
- package/dist/utils/config-loader.d.ts.map +1 -0
- package/dist/utils/config-loader.js +39 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/help-loader.d.ts +12 -0
- package/dist/utils/help-loader.d.ts.map +1 -0
- package/dist/utils/help-loader.js +39 -0
- package/dist/utils/help-loader.js.map +1 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +21 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/output.d.ts +20 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +40 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/project-root.d.ts +11 -0
- package/dist/utils/project-root.d.ts.map +1 -0
- package/dist/utils/project-root.js +35 -0
- package/dist/utils/project-root.js.map +1 -0
- package/dist/utils/resource-loader.d.ts +30 -0
- package/dist/utils/resource-loader.d.ts.map +1 -0
- package/dist/utils/resource-loader.js +63 -0
- package/dist/utils/resource-loader.js.map +1 -0
- package/dist/utils/scope-locations.d.ts +17 -0
- package/dist/utils/scope-locations.d.ts.map +1 -0
- package/dist/utils/scope-locations.js +40 -0
- package/dist/utils/scope-locations.js.map +1 -0
- package/dist/utils/validate-help-files.d.ts +14 -0
- package/dist/utils/validate-help-files.d.ts.map +1 -0
- package/dist/utils/validate-help-files.js +61 -0
- package/dist/utils/validate-help-files.js.map +1 -0
- package/dist/version.d.ts +13 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +27 -0
- package/dist/version.js.map +1 -0
- package/docs/agent.md +100 -0
- package/docs/index.md +65 -0
- package/docs/rag.md +449 -0
- package/docs/resources.md +158 -0
- package/package.json +68 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/schemas/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB/B,CAAC;AAGH,eAAO,MAAM,w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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOrB,CAAC;AAEZ,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGhE,eAAO,MAAM,cAAc,EAAE,aAyB5B,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration schemas for vibe-agent-toolkit
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
// Metadata configuration
|
|
6
|
+
export const MetadataConfigSchema = z.object({
|
|
7
|
+
frontmatter: z.boolean().optional().describe('Parse YAML frontmatter for metadata'),
|
|
8
|
+
inference: z
|
|
9
|
+
.object({
|
|
10
|
+
type: z.enum(['by-directory', 'by-filename', 'none']).optional(),
|
|
11
|
+
tags: z.enum(['by-heading', 'by-directory', 'none']).optional(),
|
|
12
|
+
})
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('Metadata inference strategies'),
|
|
15
|
+
defaults: z
|
|
16
|
+
.object({
|
|
17
|
+
type: z.string().optional(),
|
|
18
|
+
tags: z.array(z.string()).optional(),
|
|
19
|
+
})
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('Default metadata values'),
|
|
22
|
+
});
|
|
23
|
+
// Resource collection configuration
|
|
24
|
+
export const ResourceCollectionSchema = z.object({
|
|
25
|
+
include: z.array(z.string()).describe('Glob patterns for files to include'),
|
|
26
|
+
exclude: z.array(z.string()).optional().describe('Glob patterns for files to exclude'),
|
|
27
|
+
metadata: MetadataConfigSchema.optional().describe('Metadata configuration for this collection'),
|
|
28
|
+
});
|
|
29
|
+
// Resource defaults and collections
|
|
30
|
+
export const ResourcesConfigSchema = z
|
|
31
|
+
.object({
|
|
32
|
+
include: z
|
|
33
|
+
.array(z.string())
|
|
34
|
+
.optional()
|
|
35
|
+
.describe('Glob patterns for files to include (applies to all collections unless overridden)'),
|
|
36
|
+
exclude: z
|
|
37
|
+
.array(z.string())
|
|
38
|
+
.optional()
|
|
39
|
+
.describe('Glob patterns for files to exclude (applies to all collections unless overridden)'),
|
|
40
|
+
metadata: MetadataConfigSchema.optional().describe('Metadata configuration (applies to all collections unless overridden)'),
|
|
41
|
+
collections: z
|
|
42
|
+
.record(z.string(), ResourceCollectionSchema)
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('Named resource collections for reuse'),
|
|
45
|
+
validation: z
|
|
46
|
+
.object({
|
|
47
|
+
checkLinks: z.boolean().optional(),
|
|
48
|
+
checkAnchors: z.boolean().optional(),
|
|
49
|
+
allowExternal: z.boolean().optional(),
|
|
50
|
+
})
|
|
51
|
+
.optional()
|
|
52
|
+
.describe('Resource validation settings'),
|
|
53
|
+
})
|
|
54
|
+
.strict();
|
|
55
|
+
// Agent discovery configuration
|
|
56
|
+
export const AgentsConfigSchema = z.object({
|
|
57
|
+
include: z.array(z.string()).describe('Glob patterns for agent directories'),
|
|
58
|
+
exclude: z.array(z.string()).optional().describe('Glob patterns to exclude'),
|
|
59
|
+
external: z
|
|
60
|
+
.array(z.string())
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('External agent dependencies (npm packages with semver)'),
|
|
63
|
+
});
|
|
64
|
+
// RAG embedding configuration
|
|
65
|
+
export const RAGEmbeddingConfigSchema = z.object({
|
|
66
|
+
provider: z.enum(['transformers-js', 'openai']).describe('Embedding provider'),
|
|
67
|
+
model: z.string().describe('Model identifier'),
|
|
68
|
+
});
|
|
69
|
+
// RAG chunking configuration
|
|
70
|
+
export const RAGChunkingConfigSchema = z.object({
|
|
71
|
+
targetSize: z.number().int().positive().describe('Target chunk size in tokens'),
|
|
72
|
+
paddingFactor: z
|
|
73
|
+
.number()
|
|
74
|
+
.min(0)
|
|
75
|
+
.max(1)
|
|
76
|
+
.describe('Safety factor for token counting (0.0-1.0)'),
|
|
77
|
+
});
|
|
78
|
+
// RAG store configuration
|
|
79
|
+
export const RAGStoreSchema = z.object({
|
|
80
|
+
db: z.string().describe('Database path (relative to project root)'),
|
|
81
|
+
resources: z.string().describe('Named resource collection to use'),
|
|
82
|
+
embedding: RAGEmbeddingConfigSchema.optional().describe('Override default embedding config'),
|
|
83
|
+
chunking: RAGChunkingConfigSchema.optional().describe('Override default chunking config'),
|
|
84
|
+
});
|
|
85
|
+
// RAG configuration
|
|
86
|
+
export const RAGConfigSchema = z.object({
|
|
87
|
+
defaults: z
|
|
88
|
+
.object({
|
|
89
|
+
embedding: RAGEmbeddingConfigSchema.optional(),
|
|
90
|
+
chunking: RAGChunkingConfigSchema.optional(),
|
|
91
|
+
})
|
|
92
|
+
.optional()
|
|
93
|
+
.describe('Default configuration for all RAG stores'),
|
|
94
|
+
stores: z
|
|
95
|
+
.record(z.string(), RAGStoreSchema)
|
|
96
|
+
.optional()
|
|
97
|
+
.describe('Named RAG stores for semantic search'),
|
|
98
|
+
});
|
|
99
|
+
// Root project configuration
|
|
100
|
+
export const ProjectConfigSchema = z
|
|
101
|
+
.object({
|
|
102
|
+
version: z.literal(1).describe('Configuration schema version'),
|
|
103
|
+
resources: ResourcesConfigSchema.optional().describe('Resource management configuration'),
|
|
104
|
+
agents: AgentsConfigSchema.optional().describe('Agent discovery configuration'),
|
|
105
|
+
rag: RAGConfigSchema.optional().describe('RAG semantic search configuration'),
|
|
106
|
+
})
|
|
107
|
+
.strict();
|
|
108
|
+
// Default configuration
|
|
109
|
+
export const DEFAULT_CONFIG = {
|
|
110
|
+
version: 1,
|
|
111
|
+
resources: {
|
|
112
|
+
exclude: ['**/node_modules/**', '**/dist/**', '**/.git/**'],
|
|
113
|
+
metadata: {
|
|
114
|
+
frontmatter: true,
|
|
115
|
+
},
|
|
116
|
+
validation: {
|
|
117
|
+
checkLinks: true,
|
|
118
|
+
checkAnchors: true,
|
|
119
|
+
allowExternal: true,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
rag: {
|
|
123
|
+
defaults: {
|
|
124
|
+
embedding: {
|
|
125
|
+
provider: 'transformers-js',
|
|
126
|
+
model: 'Xenova/all-MiniLM-L6-v2',
|
|
127
|
+
},
|
|
128
|
+
chunking: {
|
|
129
|
+
targetSize: 512,
|
|
130
|
+
paddingFactor: 0.9,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/schemas/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yBAAyB;AACzB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAA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
|
|
3
|
+
*/
|
|
4
|
+
export interface DiscoveredAgent {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
path: string;
|
|
8
|
+
manifestPath: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Discover all agents in common locations
|
|
12
|
+
*/
|
|
13
|
+
export declare function discoverAgents(): Promise<DiscoveredAgent[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Find agent by name from discovered agents
|
|
16
|
+
*/
|
|
17
|
+
export declare function findAgentByName(name: string): Promise<DiscoveredAgent | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve agent path from name or path
|
|
20
|
+
*
|
|
21
|
+
* If the input looks like a path (contains / or \, or ends with .yaml/.yml),
|
|
22
|
+
* it is returned as-is. Otherwise, it's treated as an agent name and
|
|
23
|
+
* resolved via discovery.
|
|
24
|
+
*
|
|
25
|
+
* @param pathOrName - Agent name or path
|
|
26
|
+
* @param logger - Optional logger for debug output
|
|
27
|
+
* @returns Resolved agent path
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveAgentPath(pathOrName: string, logger?: {
|
|
30
|
+
debug: (message: string) => void;
|
|
31
|
+
}): Promise<string>;
|
|
32
|
+
//# sourceMappingURL=agent-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-discovery.d.ts","sourceRoot":"","sources":["../../src/utils/agent-discovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAWjE;AAwED;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAGnF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE;IAAE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAC5C,OAAO,CAAC,MAAM,CAAC,CAiBjB"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent discovery utility - finds agents in common locations
|
|
3
|
+
*/
|
|
4
|
+
import fs from 'node:fs/promises';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import * as yaml from 'js-yaml';
|
|
7
|
+
/**
|
|
8
|
+
* Discover all agents in common locations
|
|
9
|
+
*/
|
|
10
|
+
export async function discoverAgents() {
|
|
11
|
+
const searchPaths = [
|
|
12
|
+
'packages/vat-development-agents/agents',
|
|
13
|
+
'agents',
|
|
14
|
+
'.',
|
|
15
|
+
];
|
|
16
|
+
const agentPromises = searchPaths.map(searchPath => discoverAgentsInPath(searchPath));
|
|
17
|
+
const agentArrays = await Promise.all(agentPromises);
|
|
18
|
+
return agentArrays.flat();
|
|
19
|
+
}
|
|
20
|
+
async function discoverAgentsInPath(searchPath) {
|
|
21
|
+
try {
|
|
22
|
+
const absolutePath = path.resolve(process.cwd(), searchPath);
|
|
23
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Path is from predefined constant list
|
|
24
|
+
const entries = await fs.readdir(absolutePath, { withFileTypes: true });
|
|
25
|
+
const directories = entries.filter(entry => entry.isDirectory());
|
|
26
|
+
const agentPromises = directories.map(entry => discoverAgentInDirectory(path.join(absolutePath, entry.name)));
|
|
27
|
+
const agents = await Promise.all(agentPromises);
|
|
28
|
+
return agents.filter((agent) => agent !== null);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// Path doesn't exist or not accessible - return empty array
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function discoverAgentInDirectory(agentDir) {
|
|
36
|
+
const manifestPath = await findManifest(agentDir);
|
|
37
|
+
if (!manifestPath) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return parseAgentManifest(manifestPath, agentDir);
|
|
41
|
+
}
|
|
42
|
+
async function findManifest(dir) {
|
|
43
|
+
const candidates = ['agent.yaml', 'agent.yml'];
|
|
44
|
+
for (const candidate of candidates) {
|
|
45
|
+
const manifestPath = path.join(dir, candidate);
|
|
46
|
+
try {
|
|
47
|
+
await fs.access(manifestPath);
|
|
48
|
+
return manifestPath;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// Continue
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
async function parseAgentManifest(manifestPath, agentDir) {
|
|
57
|
+
try {
|
|
58
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- manifestPath from findManifest, trusted
|
|
59
|
+
const content = await fs.readFile(manifestPath, 'utf-8');
|
|
60
|
+
const data = yaml.load(content);
|
|
61
|
+
if (data?.metadata?.name && data?.metadata?.version) {
|
|
62
|
+
return {
|
|
63
|
+
name: data.metadata.name,
|
|
64
|
+
version: data.metadata.version,
|
|
65
|
+
path: agentDir,
|
|
66
|
+
manifestPath,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Invalid manifest - skip
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Find agent by name from discovered agents
|
|
77
|
+
*/
|
|
78
|
+
export async function findAgentByName(name) {
|
|
79
|
+
const agents = await discoverAgents();
|
|
80
|
+
return agents.find(agent => agent.name === name) ?? null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Resolve agent path from name or path
|
|
84
|
+
*
|
|
85
|
+
* If the input looks like a path (contains / or \, or ends with .yaml/.yml),
|
|
86
|
+
* it is returned as-is. Otherwise, it's treated as an agent name and
|
|
87
|
+
* resolved via discovery.
|
|
88
|
+
*
|
|
89
|
+
* @param pathOrName - Agent name or path
|
|
90
|
+
* @param logger - Optional logger for debug output
|
|
91
|
+
* @returns Resolved agent path
|
|
92
|
+
*/
|
|
93
|
+
export async function resolveAgentPath(pathOrName, logger) {
|
|
94
|
+
// If it looks like a path, return it as-is
|
|
95
|
+
if (pathOrName.includes('/') || pathOrName.includes('\\') || pathOrName.endsWith('.yaml') || pathOrName.endsWith('.yml')) {
|
|
96
|
+
return pathOrName;
|
|
97
|
+
}
|
|
98
|
+
// Otherwise, try to resolve as agent name
|
|
99
|
+
logger?.debug(`Looking up agent by name: ${pathOrName}`);
|
|
100
|
+
const agent = await findAgentByName(pathOrName);
|
|
101
|
+
if (agent) {
|
|
102
|
+
logger?.debug(`Found agent: ${agent.name} at ${agent.path}`);
|
|
103
|
+
return agent.path;
|
|
104
|
+
}
|
|
105
|
+
logger?.debug(`No agent found with name '${pathOrName}', treating as path`);
|
|
106
|
+
return pathOrName;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=agent-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-discovery.js","sourceRoot":"","sources":["../../src/utils/agent-discovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAShC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,WAAW,GAAG;QAClB,wCAAwC;QACxC,QAAQ;QACR,GAAG;KACJ,CAAC;IAEF,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC;IACtF,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAErD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,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACzH,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,0CAA0C;IAC1C,MAAM,EAAE,KAAK,CAAC,6BAA6B,UAAU,EAAE,CAAC,CAAC;IACzD,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;IAEhD,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,EAAE,KAAK,CAAC,gBAAgB,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7D,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,CAAC;IAED,MAAM,EAAE,KAAK,CAAC,6BAA6B,UAAU,qBAAqB,CAAC,CAAC;IAC5E,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Runner Utility
|
|
3
|
+
*
|
|
4
|
+
* Minimal runner for executing agents with LLM providers.
|
|
5
|
+
* Loads manifests, prompts, and handles API calls.
|
|
6
|
+
*/
|
|
7
|
+
export interface RunAgentOptions {
|
|
8
|
+
userInput: string;
|
|
9
|
+
debug?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface RunAgentResult {
|
|
12
|
+
response: string;
|
|
13
|
+
usage?: {
|
|
14
|
+
inputTokens: number;
|
|
15
|
+
outputTokens: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Runs an agent with the specified input
|
|
20
|
+
*/
|
|
21
|
+
export declare function runAgent(pathOrName: string, options: RunAgentOptions): Promise<RunAgentResult>;
|
|
22
|
+
//# sourceMappingURL=agent-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runner.d.ts","sourceRoot":"","sources":["../../src/utils/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAqCD;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CA+FzB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Runner Utility
|
|
3
|
+
*
|
|
4
|
+
* Minimal runner for executing agents with LLM providers.
|
|
5
|
+
* Loads manifests, prompts, and handles API calls.
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from 'node:fs/promises';
|
|
8
|
+
import * as path from 'node:path';
|
|
9
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
10
|
+
import { loadAgentManifest } from '@vibe-agent-toolkit/agent-config';
|
|
11
|
+
/**
|
|
12
|
+
* Loads a prompt file from the agent directory
|
|
13
|
+
*/
|
|
14
|
+
async function loadPromptFile(manifestPath, promptRef) {
|
|
15
|
+
const agentDir = path.dirname(manifestPath);
|
|
16
|
+
const promptPath = path.resolve(agentDir, promptRef.replace(/^\.\//u, ''));
|
|
17
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Path is derived from validated manifest
|
|
18
|
+
return await fs.readFile(promptPath, 'utf-8');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Simple template variable substitution
|
|
22
|
+
* For MVP: Only handles {{userInput}} and strips Jinja2 conditionals
|
|
23
|
+
*/
|
|
24
|
+
function substituteTemplate(template, variables) {
|
|
25
|
+
let result = template;
|
|
26
|
+
// Replace {{variable}} placeholders
|
|
27
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
28
|
+
// Use String.raw to avoid escaping and replaceAll for complete replacement
|
|
29
|
+
const placeholder = String.raw `\{\{\s*${key}\s*\}\}`;
|
|
30
|
+
// eslint-disable-next-line security/detect-non-literal-regexp -- Variable name from controlled source
|
|
31
|
+
const regex = new RegExp(placeholder, 'gu');
|
|
32
|
+
result = result.replaceAll(regex, value);
|
|
33
|
+
}
|
|
34
|
+
// Strip Jinja2 conditional blocks {% if ... %}...{% endif %}
|
|
35
|
+
// This is a simple regex approach for MVP - won't handle nested conditionals
|
|
36
|
+
// Using [^] instead of [\s\S] to match any character including newlines
|
|
37
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Simple template stripping, not user-controlled input
|
|
38
|
+
result = result.replaceAll(/\{%\s*if\s+[^%]+%\}[^]*?\{%\s*endif\s*%\}/gu, '');
|
|
39
|
+
return result.trim();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Runs an agent with the specified input
|
|
43
|
+
*/
|
|
44
|
+
export async function runAgent(pathOrName, options) {
|
|
45
|
+
const { userInput, debug } = options;
|
|
46
|
+
// Load agent manifest
|
|
47
|
+
const manifest = await loadAgentManifest(pathOrName);
|
|
48
|
+
if (debug) {
|
|
49
|
+
console.error(`[DEBUG] Loaded agent: ${manifest.metadata.name} v${manifest.metadata.version}`);
|
|
50
|
+
console.error(`[DEBUG] Provider: ${manifest.spec.llm.provider}, Model: ${manifest.spec.llm.model}`);
|
|
51
|
+
}
|
|
52
|
+
// Validate provider
|
|
53
|
+
if (manifest.spec.llm.provider !== 'anthropic') {
|
|
54
|
+
throw new Error(`Unsupported LLM provider: ${manifest.spec.llm.provider}. Currently only 'anthropic' is supported.`);
|
|
55
|
+
}
|
|
56
|
+
// Validate prompts configuration
|
|
57
|
+
if (!manifest.spec.prompts) {
|
|
58
|
+
throw new Error(`Agent ${manifest.metadata.name} is missing prompts configuration`);
|
|
59
|
+
}
|
|
60
|
+
if (!manifest.spec.prompts.system?.$ref) {
|
|
61
|
+
throw new Error(`Agent ${manifest.metadata.name} is missing system prompt reference`);
|
|
62
|
+
}
|
|
63
|
+
if (!manifest.spec.prompts.user?.$ref) {
|
|
64
|
+
throw new Error(`Agent ${manifest.metadata.name} is missing user prompt reference`);
|
|
65
|
+
}
|
|
66
|
+
// Load prompts
|
|
67
|
+
const systemPromptRef = manifest.spec.prompts.system.$ref;
|
|
68
|
+
const userPromptRef = manifest.spec.prompts.user.$ref;
|
|
69
|
+
const systemPrompt = await loadPromptFile(manifest.__manifestPath, systemPromptRef);
|
|
70
|
+
const userPromptTemplate = await loadPromptFile(manifest.__manifestPath, userPromptRef);
|
|
71
|
+
if (debug) {
|
|
72
|
+
console.error(`[DEBUG] System prompt length: ${systemPrompt.length} chars`);
|
|
73
|
+
console.error(`[DEBUG] User prompt template length: ${userPromptTemplate.length} chars`);
|
|
74
|
+
}
|
|
75
|
+
// Substitute user prompt variables
|
|
76
|
+
const userPrompt = substituteTemplate(userPromptTemplate, { userInput });
|
|
77
|
+
if (debug) {
|
|
78
|
+
console.error(`[DEBUG] Substituted user prompt length: ${userPrompt.length} chars`);
|
|
79
|
+
console.error('[DEBUG] Calling Anthropic API...');
|
|
80
|
+
}
|
|
81
|
+
// Call Anthropic API
|
|
82
|
+
const apiKey = process.env['ANTHROPIC_API_KEY'];
|
|
83
|
+
if (!apiKey) {
|
|
84
|
+
throw new Error('ANTHROPIC_API_KEY environment variable is not set. Please set it to use Anthropic-based agents.');
|
|
85
|
+
}
|
|
86
|
+
const client = new Anthropic({ apiKey });
|
|
87
|
+
// Use manifest config or sensible defaults
|
|
88
|
+
const maxTokens = manifest.spec.llm.maxTokens ?? 4096;
|
|
89
|
+
const temperature = manifest.spec.llm.temperature ?? 1;
|
|
90
|
+
const response = await client.messages.create({
|
|
91
|
+
model: manifest.spec.llm.model,
|
|
92
|
+
max_tokens: maxTokens,
|
|
93
|
+
temperature,
|
|
94
|
+
system: systemPrompt,
|
|
95
|
+
messages: [
|
|
96
|
+
{
|
|
97
|
+
role: 'user',
|
|
98
|
+
content: userPrompt,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
if (debug) {
|
|
103
|
+
console.error(`[DEBUG] API call complete. Status: ${response.stop_reason}`);
|
|
104
|
+
console.error(`[DEBUG] Input tokens: ${response.usage.input_tokens}`);
|
|
105
|
+
console.error(`[DEBUG] Output tokens: ${response.usage.output_tokens}`);
|
|
106
|
+
}
|
|
107
|
+
// Extract text response
|
|
108
|
+
const textContent = response.content.find((block) => block.type === 'text');
|
|
109
|
+
if (textContent?.type !== 'text') {
|
|
110
|
+
throw new Error('No text content in API response');
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
response: textContent.text,
|
|
114
|
+
usage: {
|
|
115
|
+
inputTokens: response.usage.input_tokens,
|
|
116
|
+
outputTokens: response.usage.output_tokens,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=agent-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../src/utils/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAA4B,MAAM,kCAAkC,CAAC;AAe/F;;GAEG;AACH,KAAK,UAAU,cAAc,CAAC,YAAoB,EAAE,SAAiB;IACnE,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAA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AC,WAAW,EAAE,CAAC,CAAC;QAC5E,OAAO,CAAC,KAAK,CAAC,yBAAyB,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;QACtE,OAAO,CAAC,KAAK,CAAC,0BAA0B,QAAQ,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,wBAAwB;IACxB,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IAC5E,IAAI,WAAW,EAAE,IAAI,KAAK,MAAM,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,WAAW,CAAC,IAAI;QAC1B,KAAK,EAAE;YACL,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY;YACxC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,aAAa;SAC3C;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared command error handling utilities
|
|
3
|
+
*/
|
|
4
|
+
import type { Logger } from './logger.js';
|
|
5
|
+
/**
|
|
6
|
+
* Format duration for human readability
|
|
7
|
+
* @param ms - Duration in milliseconds
|
|
8
|
+
* @returns Formatted duration string (e.g., "500ms", "1.5s", "1.5m")
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatDuration(ms: number): string;
|
|
11
|
+
/**
|
|
12
|
+
* Handle command error with standard formatting and exit
|
|
13
|
+
* @param error - The error that occurred
|
|
14
|
+
* @param logger - Logger instance for error output
|
|
15
|
+
* @param startTime - Command start time (from Date.now())
|
|
16
|
+
* @param commandName - Name of the command (for error message)
|
|
17
|
+
*/
|
|
18
|
+
export declare function handleCommandError(error: unknown, logger: Logger, startTime: number, commandName: string): never;
|
|
19
|
+
//# sourceMappingURL=command-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-error.d.ts","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,KAAK,CAWP"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared command error handling utilities
|
|
3
|
+
*/
|
|
4
|
+
import { writeYamlOutput } from './output.js';
|
|
5
|
+
/**
|
|
6
|
+
* Format duration for human readability
|
|
7
|
+
* @param ms - Duration in milliseconds
|
|
8
|
+
* @returns Formatted duration string (e.g., "500ms", "1.5s", "1.5m")
|
|
9
|
+
*/
|
|
10
|
+
export function formatDuration(ms) {
|
|
11
|
+
if (ms < 1000) {
|
|
12
|
+
return `${ms}ms`;
|
|
13
|
+
}
|
|
14
|
+
if (ms < 60000) {
|
|
15
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
16
|
+
}
|
|
17
|
+
return `${(ms / 60000).toFixed(1)}m`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Handle command error with standard formatting and exit
|
|
21
|
+
* @param error - The error that occurred
|
|
22
|
+
* @param logger - Logger instance for error output
|
|
23
|
+
* @param startTime - Command start time (from Date.now())
|
|
24
|
+
* @param commandName - Name of the command (for error message)
|
|
25
|
+
*/
|
|
26
|
+
export function handleCommandError(error, logger, startTime, commandName) {
|
|
27
|
+
const duration = Date.now() - startTime;
|
|
28
|
+
logger.error(`${commandName} failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
29
|
+
writeYamlOutput({
|
|
30
|
+
status: 'error',
|
|
31
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
32
|
+
duration: formatDuration(duration),
|
|
33
|
+
});
|
|
34
|
+
process.exit(2);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=command-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-error.js","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;QACd,OAAO,GAAG,EAAE,IAAI,CAAC;IACnB,CAAC;IACD,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC;QACf,OAAO,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACtC,CAAC;IACD,OAAO,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAc,EACd,MAAc,EACd,SAAiB,EACjB,WAAmB;IAEnB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IACxC,MAAM,CAAC,KAAK,CAAC,GAAG,WAAW,YAAY,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;IAEnG,eAAe,CAAC;QACd,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;QAC/D,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC;KACnC,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration file loading and validation
|
|
3
|
+
*/
|
|
4
|
+
import { type ProjectConfig } from '../schemas/config.js';
|
|
5
|
+
/**
|
|
6
|
+
* Load and validate project configuration
|
|
7
|
+
* @param projectRoot - Project root directory
|
|
8
|
+
* @returns Validated configuration or default if not found
|
|
9
|
+
* @throws Error if config file exists but is invalid
|
|
10
|
+
*/
|
|
11
|
+
export declare function loadConfig(projectRoot: string): ProjectConfig;
|
|
12
|
+
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAuC,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI/F;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CA6B7D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration file loading and validation
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import * as yaml from 'js-yaml';
|
|
7
|
+
import { ProjectConfigSchema, DEFAULT_CONFIG } from '../schemas/config.js';
|
|
8
|
+
const CONFIG_FILENAME = 'vibe-agent-toolkit.config.yaml';
|
|
9
|
+
/**
|
|
10
|
+
* Load and validate project configuration
|
|
11
|
+
* @param projectRoot - Project root directory
|
|
12
|
+
* @returns Validated configuration or default if not found
|
|
13
|
+
* @throws Error if config file exists but is invalid
|
|
14
|
+
*/
|
|
15
|
+
export function loadConfig(projectRoot) {
|
|
16
|
+
const configPath = join(projectRoot, CONFIG_FILENAME);
|
|
17
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- configPath is derived from projectRoot parameter
|
|
18
|
+
if (!existsSync(configPath)) {
|
|
19
|
+
return DEFAULT_CONFIG;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- configPath is derived from projectRoot parameter
|
|
23
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
24
|
+
const parsed = yaml.load(content);
|
|
25
|
+
// Validate with Zod schema
|
|
26
|
+
const result = ProjectConfigSchema.safeParse(parsed);
|
|
27
|
+
if (!result.success) {
|
|
28
|
+
throw new Error(`Invalid configuration file: ${result.error.message}`);
|
|
29
|
+
}
|
|
30
|
+
return result.data;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof Error) {
|
|
34
|
+
throw new Error(`Failed to load config: ${error.message}`);
|
|
35
|
+
}
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=config-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAsB,MAAM,sBAAsB,CAAC;AAE/F,MAAM,eAAe,GAAG,gCAAgC,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,WAAmB;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAEtD,uHAAuH;IACvH,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,IAAI,CAAC;QACH,uHAAuH;QACvH,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAElC,2BAA2B;QAC3B,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAErD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACb,+BAA+B,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CACtD,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,0BAA0B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7D,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help loader - reads verbose help from markdown files
|
|
3
|
+
* Markdown docs are the source of truth for CLI help
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Load verbose help from markdown files in packages/cli/docs/
|
|
7
|
+
*
|
|
8
|
+
* @param section - Optional section name (e.g., 'resources'). If not provided, loads index.md
|
|
9
|
+
* @returns Markdown content as string
|
|
10
|
+
*/
|
|
11
|
+
export declare function loadVerboseHelp(section?: string): string;
|
|
12
|
+
//# sourceMappingURL=help-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-loader.d.ts","sourceRoot":"","sources":["../../src/utils/help-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAyBxD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help loader - reads verbose help from markdown files
|
|
3
|
+
* Markdown docs are the source of truth for CLI help
|
|
4
|
+
*/
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { dirname, join } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
/**
|
|
9
|
+
* Load verbose help from markdown files in packages/cli/docs/
|
|
10
|
+
*
|
|
11
|
+
* @param section - Optional section name (e.g., 'resources'). If not provided, loads index.md
|
|
12
|
+
* @returns Markdown content as string
|
|
13
|
+
*/
|
|
14
|
+
export function loadVerboseHelp(section) {
|
|
15
|
+
// Get package root (packages/cli/)
|
|
16
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const packageRoot = join(__dirname, '../..');
|
|
18
|
+
// Determine which markdown file to load
|
|
19
|
+
const filename = section ? `${section}.md` : 'index.md';
|
|
20
|
+
const helpPath = join(packageRoot, 'docs', filename);
|
|
21
|
+
try {
|
|
22
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- path is constructed from known safe components
|
|
23
|
+
const content = readFileSync(helpPath, 'utf-8');
|
|
24
|
+
return content;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
// Fallback if markdown file not found
|
|
28
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
29
|
+
return `# Help Documentation Not Found
|
|
30
|
+
|
|
31
|
+
Error loading help from ${helpPath}
|
|
32
|
+
|
|
33
|
+
${errorMessage}
|
|
34
|
+
|
|
35
|
+
Please report this issue at: https://github.com/jdutton/vibe-agent-toolkit/issues
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=help-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-loader.js","sourceRoot":"","sources":["../../src/utils/help-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,mCAAmC;IACnC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAE7C,wCAAwC;IACxC,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC;IACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAErD,IAAI,CAAC;QACH,qHAAqH;QACrH,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,sCAAsC;QACtC,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,OAAO;;0BAEe,QAAQ;;EAEhC,YAAY;;;CAGb,CAAC;IACA,CAAC;AACH,CAAC"}
|