@trikhub/cli 0.6.0 → 0.7.0
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 +102 -200
- package/dist/commands/info.d.ts.map +1 -1
- package/dist/commands/info.js +35 -0
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +104 -27
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +4 -1
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js +20 -1
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +18 -1
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +2 -8
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js.map +1 -1
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/registry.js +4 -14
- package/dist/lib/registry.js.map +1 -1
- package/dist/templates/python.d.ts +1 -24
- package/dist/templates/python.d.ts.map +1 -1
- package/dist/templates/python.js +2 -262
- package/dist/templates/python.js.map +1 -1
- package/dist/templates/typescript.d.ts +13 -11
- package/dist/templates/typescript.d.ts.map +1 -1
- package/dist/templates/typescript.js +219 -173
- package/dist/templates/typescript.js.map +1 -1
- package/package.json +5 -8
- package/dist/lib/validator.d.ts +0 -33
- package/dist/lib/validator.d.ts.map +0 -1
- package/dist/lib/validator.js +0 -133
- package/dist/lib/validator.js.map +0 -1
|
@@ -1,271 +1,317 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TypeScript
|
|
2
|
+
* v2 TypeScript scaffold template.
|
|
3
3
|
*
|
|
4
|
-
* Generates
|
|
4
|
+
* Generates a complete v2 trik project structure using the
|
|
5
|
+
* agent-based handoff architecture with wrapAgent() from @trikhub/sdk.
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export function generateTypescriptProject(config) {
|
|
10
|
-
const files = [];
|
|
11
|
-
files.push({ path: 'manifest.json', content: generateManifest(config) });
|
|
12
|
-
files.push({ path: 'trikhub.json', content: generateTrikhubJson(config) });
|
|
13
|
-
files.push({ path: 'package.json', content: generatePackageJson(config) });
|
|
14
|
-
files.push({ path: 'tsconfig.json', content: generateTsConfig() });
|
|
15
|
-
files.push({ path: 'src/index.ts', content: generateIndexTs(config) });
|
|
16
|
-
files.push({ path: 'test.ts', content: generateTestTs() });
|
|
17
|
-
files.push({ path: 'README.md', content: generateReadme(config) });
|
|
18
|
-
files.push({ path: '.gitignore', content: generateGitignore() });
|
|
19
|
-
return files;
|
|
20
|
-
}
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// File generators
|
|
9
|
+
// ============================================================================
|
|
21
10
|
function generateManifest(config) {
|
|
11
|
+
const isToolMode = config.agentMode === 'tool';
|
|
12
|
+
const agent = {
|
|
13
|
+
mode: config.agentMode,
|
|
14
|
+
domain: config.domainTags,
|
|
15
|
+
};
|
|
16
|
+
if (!isToolMode) {
|
|
17
|
+
agent.handoffDescription = config.handoffDescription;
|
|
18
|
+
agent.systemPromptFile = './src/prompts/system.md';
|
|
19
|
+
agent.model = { capabilities: ['tool_use'] };
|
|
20
|
+
}
|
|
22
21
|
const manifest = {
|
|
23
|
-
schemaVersion:
|
|
22
|
+
schemaVersion: 2,
|
|
24
23
|
id: config.name,
|
|
25
24
|
name: config.displayName,
|
|
26
25
|
description: config.description,
|
|
27
26
|
version: '0.1.0',
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
agent,
|
|
28
|
+
};
|
|
29
|
+
// Tools block
|
|
30
|
+
if (isToolMode && config.toolNames.length > 0) {
|
|
31
|
+
const tools = {};
|
|
32
|
+
for (const toolName of config.toolNames) {
|
|
33
|
+
tools[toolName] = {
|
|
34
|
+
description: `TODO: describe ${toolName}`,
|
|
31
35
|
inputSchema: {
|
|
32
36
|
type: 'object',
|
|
33
37
|
properties: {
|
|
34
|
-
|
|
38
|
+
query: { type: 'string', maxLength: 200 },
|
|
35
39
|
},
|
|
36
|
-
required: ['
|
|
40
|
+
required: ['query'],
|
|
37
41
|
},
|
|
38
|
-
|
|
39
|
-
agentDataSchema: {
|
|
42
|
+
outputSchema: {
|
|
40
43
|
type: 'object',
|
|
41
44
|
properties: {
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
status: { type: 'string', enum: ['success', 'error'] },
|
|
46
|
+
resultId: { type: 'string', format: 'id' },
|
|
44
47
|
},
|
|
45
|
-
required: ['
|
|
46
|
-
},
|
|
47
|
-
responseTemplates: {
|
|
48
|
-
success: { text: '{{greeting}}' },
|
|
48
|
+
required: ['status'],
|
|
49
49
|
},
|
|
50
|
+
outputTemplate: `${toolName}: {{status}} ({{resultId}})`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
manifest.tools = tools;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
manifest.tools = {
|
|
57
|
+
exampleTool: {
|
|
58
|
+
description: 'An example tool',
|
|
50
59
|
},
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
tools: [],
|
|
54
|
-
},
|
|
55
|
-
limits: {
|
|
56
|
-
maxExecutionTimeMs: 5000,
|
|
57
|
-
},
|
|
58
|
-
entry: {
|
|
59
|
-
module: './dist/index.js',
|
|
60
|
-
export: 'default',
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
// Add storage capability if enabled
|
|
60
|
+
};
|
|
61
|
+
}
|
|
64
62
|
if (config.enableStorage) {
|
|
65
|
-
manifest.capabilities
|
|
66
|
-
enabled: true,
|
|
67
|
-
maxSizeBytes: 1048576,
|
|
68
|
-
persistent: true,
|
|
63
|
+
manifest.capabilities = {
|
|
64
|
+
storage: { enabled: true },
|
|
69
65
|
};
|
|
70
66
|
}
|
|
71
|
-
|
|
67
|
+
manifest.limits = { maxTurnTimeMs: 30000 };
|
|
68
|
+
manifest.entry = {
|
|
69
|
+
module: './dist/agent.js',
|
|
70
|
+
export: 'default',
|
|
71
|
+
};
|
|
72
|
+
manifest.author = config.authorName;
|
|
72
73
|
if (config.enableConfig) {
|
|
73
74
|
manifest.config = {
|
|
74
|
-
|
|
75
|
-
{ key: '
|
|
75
|
+
optional: [
|
|
76
|
+
{ key: 'ANTHROPIC_API_KEY', description: 'Anthropic API key for the agent' },
|
|
76
77
|
],
|
|
77
|
-
optional: [],
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
return JSON.stringify(manifest, null, 2)
|
|
80
|
+
return JSON.stringify(manifest, null, 2);
|
|
81
81
|
}
|
|
82
82
|
function generateTrikhubJson(config) {
|
|
83
|
-
const
|
|
83
|
+
const metadata = {
|
|
84
84
|
displayName: config.displayName,
|
|
85
85
|
shortDescription: config.description,
|
|
86
86
|
categories: [config.category],
|
|
87
|
-
keywords: [
|
|
87
|
+
keywords: [],
|
|
88
88
|
author: {
|
|
89
89
|
name: config.authorName,
|
|
90
90
|
github: config.authorGithub,
|
|
91
91
|
},
|
|
92
92
|
repository: `https://github.com/${config.authorGithub}/${config.name}`,
|
|
93
93
|
};
|
|
94
|
-
return JSON.stringify(
|
|
94
|
+
return JSON.stringify(metadata, null, 2);
|
|
95
95
|
}
|
|
96
96
|
function generatePackageJson(config) {
|
|
97
|
+
const isToolMode = config.agentMode === 'tool';
|
|
98
|
+
const dependencies = {
|
|
99
|
+
'@trikhub/sdk': 'latest',
|
|
100
|
+
};
|
|
101
|
+
// Conversational mode needs LangChain + LLM provider
|
|
102
|
+
if (!isToolMode) {
|
|
103
|
+
dependencies['@langchain/anthropic'] = '^0.3.0';
|
|
104
|
+
dependencies['@langchain/core'] = '^0.3.0';
|
|
105
|
+
dependencies['@langchain/langgraph'] = '^0.2.0';
|
|
106
|
+
dependencies['zod'] = '^3.25.0';
|
|
107
|
+
}
|
|
97
108
|
const pkg = {
|
|
98
|
-
name:
|
|
109
|
+
name: config.name,
|
|
99
110
|
version: '0.1.0',
|
|
100
111
|
description: config.description,
|
|
101
112
|
type: 'module',
|
|
102
|
-
main: 'dist/
|
|
113
|
+
main: './dist/agent.js',
|
|
103
114
|
scripts: {
|
|
104
115
|
build: 'tsc',
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
dependencies: {
|
|
109
|
-
'@trikhub/manifest': '^0.7.0',
|
|
116
|
+
dev: 'node --import tsx src/agent.ts',
|
|
117
|
+
clean: 'rm -rf dist *.tsbuildinfo',
|
|
110
118
|
},
|
|
119
|
+
dependencies,
|
|
111
120
|
devDependencies: {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
typescript: '^5.6.0',
|
|
115
|
-
},
|
|
116
|
-
engines: {
|
|
117
|
-
node: '>=20',
|
|
121
|
+
tsx: '^4.19.0',
|
|
122
|
+
typescript: '^5.7.0',
|
|
118
123
|
},
|
|
119
124
|
};
|
|
120
|
-
return JSON.stringify(pkg, null, 2)
|
|
125
|
+
return JSON.stringify(pkg, null, 2);
|
|
121
126
|
}
|
|
122
127
|
function generateTsConfig() {
|
|
123
128
|
const tsconfig = {
|
|
124
129
|
compilerOptions: {
|
|
125
130
|
target: 'ES2022',
|
|
126
131
|
module: 'NodeNext',
|
|
127
|
-
moduleResolution: '
|
|
132
|
+
moduleResolution: 'nodenext',
|
|
128
133
|
outDir: './dist',
|
|
129
134
|
rootDir: './src',
|
|
130
135
|
strict: true,
|
|
131
136
|
esModuleInterop: true,
|
|
132
137
|
skipLibCheck: true,
|
|
138
|
+
forceConsistentCasingInFileNames: true,
|
|
133
139
|
declaration: true,
|
|
140
|
+
declarationMap: true,
|
|
141
|
+
sourceMap: true,
|
|
134
142
|
},
|
|
135
143
|
include: ['src/**/*'],
|
|
136
|
-
exclude: ['node_modules', 'dist'],
|
|
137
144
|
};
|
|
138
|
-
return JSON.stringify(tsconfig, null, 2)
|
|
139
|
-
}
|
|
140
|
-
function generateIndexTs(config) {
|
|
141
|
-
const storageImport = config.enableStorage
|
|
142
|
-
? `
|
|
143
|
-
interface Storage {
|
|
144
|
-
get(key: string): Promise<string | null>;
|
|
145
|
-
set(key: string, value: string): Promise<void>;
|
|
146
|
-
delete(key: string): Promise<void>;
|
|
147
|
-
}
|
|
148
|
-
`
|
|
149
|
-
: '';
|
|
150
|
-
const configType = config.enableConfig
|
|
151
|
-
? `
|
|
152
|
-
interface Config {
|
|
153
|
-
API_KEY: string;
|
|
145
|
+
return JSON.stringify(tsconfig, null, 2);
|
|
154
146
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
config.enableStorage ? 'storage?: Storage' : null,
|
|
161
|
-
config.enableConfig ? 'config?: Config' : null,
|
|
162
|
-
]
|
|
163
|
-
.filter(Boolean)
|
|
164
|
-
.join('; ');
|
|
147
|
+
function generateToolModeAgentTs(config) {
|
|
148
|
+
const handlers = config.toolNames.map((name) => ` ${name}: async (input, context) => {
|
|
149
|
+
// TODO: Implement ${name}
|
|
150
|
+
return { result: 'Not implemented' };
|
|
151
|
+
},`).join('\n');
|
|
165
152
|
return `/**
|
|
166
|
-
* ${config.displayName}
|
|
153
|
+
* ${config.displayName} — tool-mode agent entry point.
|
|
167
154
|
*
|
|
168
|
-
*
|
|
155
|
+
* Exports native tools to the main agent. No handoff, no session.
|
|
169
156
|
*/
|
|
170
157
|
|
|
171
|
-
|
|
172
|
-
${invokeParams};
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
type InvokeResult = {
|
|
176
|
-
responseMode: 'template' | 'passthrough';
|
|
177
|
-
agentData?: Record<string, unknown>;
|
|
178
|
-
userContent?: Record<string, unknown>;
|
|
179
|
-
};
|
|
180
|
-
${storageImport}${configType}
|
|
181
|
-
class ${toPascalCase(config.name)}Graph {
|
|
182
|
-
async invoke(input: InvokeInput): Promise<InvokeResult> {
|
|
183
|
-
const { action, input: actionInput } = input;
|
|
184
|
-
|
|
185
|
-
if (action === 'hello') {
|
|
186
|
-
const name = (actionInput.name as string) || 'World';
|
|
187
|
-
return {
|
|
188
|
-
responseMode: 'template',
|
|
189
|
-
agentData: {
|
|
190
|
-
template: 'success',
|
|
191
|
-
greeting: \`Hello, \${name}!\`,
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return {
|
|
197
|
-
responseMode: 'template',
|
|
198
|
-
agentData: {
|
|
199
|
-
template: 'error',
|
|
200
|
-
message: \`Unknown action: \${action}\`,
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
}
|
|
158
|
+
import { wrapToolHandlers } from '@trikhub/sdk';
|
|
205
159
|
|
|
206
|
-
export default
|
|
160
|
+
export default wrapToolHandlers({
|
|
161
|
+
${handlers}
|
|
162
|
+
});
|
|
207
163
|
`;
|
|
208
164
|
}
|
|
209
|
-
function
|
|
165
|
+
function generateAgentTs(config) {
|
|
166
|
+
if (config.agentMode === 'tool') {
|
|
167
|
+
return generateToolModeAgentTs(config);
|
|
168
|
+
}
|
|
169
|
+
// Conversational mode
|
|
210
170
|
return `/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* Run with: npm test
|
|
171
|
+
* ${config.displayName} — conversational agent entry point.
|
|
214
172
|
*/
|
|
215
173
|
|
|
216
|
-
import
|
|
174
|
+
import { ChatAnthropic } from '@langchain/anthropic';
|
|
175
|
+
import { createReactAgent } from '@langchain/langgraph/prebuilt';
|
|
176
|
+
import { wrapAgent, transferBackTool } from '@trikhub/sdk';
|
|
177
|
+
import type { TrikContext } from '@trikhub/sdk';
|
|
178
|
+
import { readFileSync } from 'node:fs';
|
|
179
|
+
import { join, dirname } from 'node:path';
|
|
180
|
+
import { fileURLToPath } from 'node:url';
|
|
181
|
+
import { exampleTool } from './tools/example.js';
|
|
217
182
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
183
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
184
|
+
const systemPrompt = readFileSync(join(__dirname, '../src/prompts/system.md'), 'utf-8');
|
|
185
|
+
|
|
186
|
+
export default wrapAgent((context: TrikContext) => {
|
|
187
|
+
const model = new ChatAnthropic({
|
|
188
|
+
modelName: 'claude-sonnet-4-20250514',
|
|
189
|
+
anthropicApiKey: ${config.enableConfig ? "config.get('ANTHROPIC_API_KEY')" : 'process.env.ANTHROPIC_API_KEY'},
|
|
222
190
|
});
|
|
223
191
|
|
|
224
|
-
|
|
192
|
+
const tools = [
|
|
193
|
+
exampleTool,
|
|
194
|
+
transferBackTool,
|
|
195
|
+
];
|
|
196
|
+
|
|
197
|
+
return createReactAgent({
|
|
198
|
+
llm: model,
|
|
199
|
+
tools,
|
|
200
|
+
messageModifier: systemPrompt,
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
`;
|
|
225
204
|
}
|
|
205
|
+
function generateExampleTool() {
|
|
206
|
+
return `import { tool } from '@langchain/core/tools';
|
|
207
|
+
import { z } from 'zod';
|
|
226
208
|
|
|
227
|
-
|
|
209
|
+
export const exampleTool = tool(
|
|
210
|
+
async (input) => {
|
|
211
|
+
// TODO: Implement your tool logic here
|
|
212
|
+
return JSON.stringify({ result: \`Processed: \${input.query}\` });
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: 'exampleTool',
|
|
216
|
+
description: 'An example tool — replace with your own implementation',
|
|
217
|
+
schema: z.object({
|
|
218
|
+
query: z.string().describe('The input query to process'),
|
|
219
|
+
}),
|
|
220
|
+
},
|
|
221
|
+
);
|
|
222
|
+
`;
|
|
223
|
+
}
|
|
224
|
+
function generateSystemPrompt(config) {
|
|
225
|
+
const domainStr = config.domainTags.join(', ');
|
|
226
|
+
return `# ${config.displayName}
|
|
227
|
+
|
|
228
|
+
You are ${config.displayName}, a specialized assistant for ${config.description.toLowerCase()}.
|
|
229
|
+
|
|
230
|
+
## Your capabilities
|
|
231
|
+
- **exampleTool**: An example tool
|
|
232
|
+
|
|
233
|
+
## Guidelines
|
|
234
|
+
- Focus on tasks within your domain: ${domainStr}
|
|
235
|
+
- When the user's request is outside your expertise, use the transfer_back tool
|
|
236
|
+
- Provide clear, actionable responses
|
|
237
|
+
|
|
238
|
+
## Transfer back
|
|
239
|
+
Use the \`transfer_back\` tool when:
|
|
240
|
+
- The user's request is outside your domain
|
|
241
|
+
- You've completed the task and the user wants to do something else
|
|
242
|
+
- The user explicitly asks to go back
|
|
243
|
+
`;
|
|
244
|
+
}
|
|
245
|
+
function generateGitignore() {
|
|
246
|
+
return `node_modules/
|
|
247
|
+
dist/
|
|
248
|
+
*.tsbuildinfo
|
|
249
|
+
.env
|
|
250
|
+
.trikhub/secrets.json
|
|
228
251
|
`;
|
|
229
252
|
}
|
|
230
253
|
function generateReadme(config) {
|
|
254
|
+
const domainStr = config.domainTags.join(', ');
|
|
255
|
+
const isToolMode = config.agentMode === 'tool';
|
|
256
|
+
const devSection = isToolMode
|
|
257
|
+
? `- Implement your tool handlers in \`src/agent.ts\`
|
|
258
|
+
- Update inputSchema/outputSchema in \`manifest.json\``
|
|
259
|
+
: `- Edit your agent logic in \`src/agent.ts\`
|
|
260
|
+
- Add tools in \`src/tools/\`
|
|
261
|
+
- Customize the system prompt in \`src/prompts/system.md\``;
|
|
262
|
+
const archSection = isToolMode
|
|
263
|
+
? `Tools from this trik appear as native tools on the main agent — no handoff, no session.`
|
|
264
|
+
: `The main agent routes conversations to this trik using a \`talk_to_${config.name}\` tool.
|
|
265
|
+
When done, use the \`transfer_back\` tool to return control.`;
|
|
231
266
|
return `# ${config.displayName}
|
|
232
267
|
|
|
233
268
|
${config.description}
|
|
234
269
|
|
|
235
|
-
##
|
|
236
|
-
|
|
237
|
-
\`\`\`bash
|
|
238
|
-
npm install
|
|
239
|
-
npm run build
|
|
240
|
-
npm test
|
|
241
|
-
\`\`\`
|
|
270
|
+
## Getting Started
|
|
242
271
|
|
|
243
|
-
|
|
272
|
+
1. Install dependencies: \`npm install\`
|
|
273
|
+
2. Build: \`npm run build\`
|
|
274
|
+
3. Validate: \`trik lint .\`
|
|
275
|
+
4. Publish: \`trik publish\`
|
|
244
276
|
|
|
245
|
-
|
|
277
|
+
## Development
|
|
246
278
|
|
|
247
|
-
|
|
279
|
+
${devSection}
|
|
248
280
|
|
|
249
|
-
|
|
250
|
-
- \`name\` (string, required): Name to greet
|
|
281
|
+
## Architecture
|
|
251
282
|
|
|
252
|
-
|
|
283
|
+
This trik uses the TrikHub v2 architecture:
|
|
284
|
+
- **Mode**: ${config.agentMode}
|
|
285
|
+
- **Domain**: ${domainStr}
|
|
253
286
|
|
|
254
|
-
|
|
255
|
-
trik publish
|
|
256
|
-
\`\`\`
|
|
287
|
+
${archSection}
|
|
257
288
|
`;
|
|
258
289
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
290
|
+
// ============================================================================
|
|
291
|
+
// Public API
|
|
292
|
+
// ============================================================================
|
|
293
|
+
/**
|
|
294
|
+
* Generate a complete v2 TypeScript trik project.
|
|
295
|
+
*
|
|
296
|
+
* @returns Map of { relativePath: fileContent } for all project files.
|
|
297
|
+
*/
|
|
298
|
+
export function generateTypescriptProject(config) {
|
|
299
|
+
const files = {};
|
|
300
|
+
// Core config files
|
|
301
|
+
files['manifest.json'] = generateManifest(config);
|
|
302
|
+
files['trikhub.json'] = generateTrikhubJson(config);
|
|
303
|
+
files['package.json'] = generatePackageJson(config);
|
|
304
|
+
files['tsconfig.json'] = generateTsConfig();
|
|
305
|
+
files['.gitignore'] = generateGitignore();
|
|
306
|
+
files['README.md'] = generateReadme(config);
|
|
307
|
+
// Source files
|
|
308
|
+
files['src/agent.ts'] = generateAgentTs(config);
|
|
309
|
+
if (config.agentMode === 'conversational') {
|
|
310
|
+
// Conversational mode: example tool + system prompt
|
|
311
|
+
files['src/tools/example.ts'] = generateExampleTool();
|
|
312
|
+
files['src/prompts/system.md'] = generateSystemPrompt(config);
|
|
313
|
+
}
|
|
314
|
+
// Tool mode: no separate tool files or system prompt — all logic in agent.ts
|
|
315
|
+
return files;
|
|
270
316
|
}
|
|
271
317
|
//# sourceMappingURL=typescript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../src/templates/typescript.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../src/templates/typescript.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E,SAAS,gBAAgB,CAAC,MAAkB;IAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC;IAE/C,MAAM,KAAK,GAA4B;QACrC,IAAI,EAAE,MAAM,CAAC,SAAS;QACtB,MAAM,EAAE,MAAM,CAAC,UAAU;KAC1B,CAAC;IAEF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,KAAK,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;QACrD,KAAK,CAAC,gBAAgB,GAAG,yBAAyB,CAAC;QACnD,KAAK,CAAC,KAAK,GAAG,EAAE,YAAY,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;IAC/C,CAAC;IAED,MAAM,QAAQ,GAA4B;QACxC,aAAa,EAAE,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC,IAAI;QACf,IAAI,EAAE,MAAM,CAAC,WAAW;QACxB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,OAAO,EAAE,OAAO;QAChB,KAAK;KACN,CAAC;IAEF,cAAc;IACd,IAAI,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9C,MAAM,KAAK,GAA4C,EAAE,CAAC;QAC1D,K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AC/E,aAAa;AACb,+EAA+E;AAE/E;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAkB;IAC1D,MAAM,KAAK,GAA2B,EAAE,CAAC;IAEzC,oBAAoB;IACpB,KAAK,CAAC,eAAe,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClD,KAAK,CAAC,cAAc,CAAC,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACpD,KAAK,CAAC,cAAc,CAAC,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACpD,KAAK,CAAC,eAAe,CAAC,GAAG,gBAAgB,EAAE,CAAC;IAC5C,KAAK,CAAC,YAAY,CAAC,GAAG,iBAAiB,EAAE,CAAC;IAC1C,KAAK,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAE5C,eAAe;IACf,KAAK,CAAC,cAAc,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAEhD,IAAI,MAAM,CAAC,SAAS,KAAK,gBAAgB,EAAE,CAAC;QAC1C,oDAAoD;QACpD,KAAK,CAAC,sBAAsB,CAAC,GAAG,mBAAmB,EAAE,CAAC;QACtD,KAAK,CAAC,uBAAuB,CAAC,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;IACD,6EAA6E;IAE7E,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trikhub/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "CLI for TrikHub - Teaching AI new triks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,17 +22,14 @@
|
|
|
22
22
|
"@inquirer/prompts": "^7.2.1",
|
|
23
23
|
"chalk": "^5.3.0",
|
|
24
24
|
"commander": "^12.1.0",
|
|
25
|
-
"conf": "^13.0.1",
|
|
26
25
|
"ora": "^8.0.1",
|
|
27
26
|
"semver": "^7.6.3",
|
|
28
|
-
"
|
|
29
|
-
"@trikhub/
|
|
30
|
-
"@trikhub/manifest": "0.11.0"
|
|
27
|
+
"@trikhub/linter": "0.12.0",
|
|
28
|
+
"@trikhub/manifest": "0.12.0"
|
|
31
29
|
},
|
|
32
30
|
"devDependencies": {
|
|
33
31
|
"@types/node": "^20.14.0",
|
|
34
|
-
"@types/semver": "^7.5.8"
|
|
35
|
-
"@types/tar": "^6.1.13"
|
|
32
|
+
"@types/semver": "^7.5.8"
|
|
36
33
|
},
|
|
37
34
|
"engines": {
|
|
38
35
|
"node": ">=18.0.0"
|
|
@@ -53,7 +50,7 @@
|
|
|
53
50
|
"trikhub",
|
|
54
51
|
"trik",
|
|
55
52
|
"ai",
|
|
56
|
-
"
|
|
53
|
+
"agent",
|
|
57
54
|
"cli"
|
|
58
55
|
],
|
|
59
56
|
"author": "Molefas",
|
package/dist/lib/validator.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Use @trikhub/linter instead.
|
|
3
|
-
*
|
|
4
|
-
* This validator is deprecated and no longer used by the CLI.
|
|
5
|
-
* All validation is now centralized in @trikhub/linter which provides:
|
|
6
|
-
* - Support for both Node.js and Python package structures
|
|
7
|
-
* - Consistent validation between `trik lint` and `trik publish`
|
|
8
|
-
* - Full manifest schema validation via @trikhub/manifest
|
|
9
|
-
*
|
|
10
|
-
* Migration:
|
|
11
|
-
* import { TrikLinter } from '@trikhub/linter';
|
|
12
|
-
* const linter = new TrikLinter({ checkCompiledEntry: true });
|
|
13
|
-
* const results = await linter.lintManifestOnly(trikPath);
|
|
14
|
-
*
|
|
15
|
-
* This file will be removed in a future version.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Use LintResult[] from @trikhub/linter instead.
|
|
19
|
-
*/
|
|
20
|
-
export interface ValidationResult {
|
|
21
|
-
valid: boolean;
|
|
22
|
-
errors: string[];
|
|
23
|
-
warnings: string[];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated Use TrikLinter.lintManifestOnly() from @trikhub/linter instead.
|
|
27
|
-
*/
|
|
28
|
-
export declare function validateTrik(trikPath: string): ValidationResult;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated Use TrikLinter.formatResults() from @trikhub/linter instead.
|
|
31
|
-
*/
|
|
32
|
-
export declare function formatValidationResult(result: ValidationResult): string;
|
|
33
|
-
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAkCD;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAsG/D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAkBvE"}
|