@trikhub/cli 0.3.6 → 0.4.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 +73 -0
- package/dist/cli.js +20 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +195 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/lint.d.ts +13 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +29 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +85 -21
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +17 -5
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/publish.d.ts +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +19 -65
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/unpublish.d.ts +7 -0
- package/dist/commands/unpublish.d.ts.map +1 -0
- package/dist/commands/unpublish.js +79 -0
- package/dist/commands/unpublish.js.map +1 -0
- package/dist/lib/registry.d.ts +4 -0
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/registry.js +15 -1
- package/dist/lib/registry.js.map +1 -1
- package/dist/lib/storage.d.ts +15 -0
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +29 -0
- package/dist/lib/storage.js.map +1 -1
- package/dist/lib/validator.d.ts +16 -7
- package/dist/lib/validator.d.ts.map +1 -1
- package/dist/lib/validator.js +15 -6
- package/dist/lib/validator.js.map +1 -1
- package/dist/templates/python.d.ts +25 -0
- package/dist/templates/python.d.ts.map +1 -0
- package/dist/templates/python.js +263 -0
- package/dist/templates/python.js.map +1 -0
- package/dist/templates/typescript.d.ts +25 -0
- package/dist/templates/typescript.d.ts.map +1 -0
- package/dist/templates/typescript.js +271 -0
- package/dist/templates/typescript.js.map +1 -0
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAmB,MAAM,mBAAmB,CAAC;AA2C9E;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,gCAAgC;IAChC,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IACrD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,CAAC,uBAAuB,CAAC;YACjC,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;IAED,oBAAoB;IACpB,IAAI,QAAsB,CAAC;IAC3B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACpD,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,CAAC,0BAA0B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YAC5F,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;IAED,8BAA8B;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AAC;QACpB,IAAI,QAAQ,CAAC,MAAM,CAAC,kBAAkB,GAAG,MAAM,EAAE,CAAC;YAChD,QAAQ,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC1B,MAAM;QACN,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAwB;IAC7D,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAClC,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC,aAAa,KAAK,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,YAAY,OAAO,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python Trik Template Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates all files needed for a Python trik project.
|
|
5
|
+
*/
|
|
6
|
+
import { TrikCategory } from '../types.js';
|
|
7
|
+
export interface PyTemplateConfig {
|
|
8
|
+
name: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
description: string;
|
|
11
|
+
authorName: string;
|
|
12
|
+
authorGithub: string;
|
|
13
|
+
category: TrikCategory;
|
|
14
|
+
enableStorage: boolean;
|
|
15
|
+
enableConfig: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface GeneratedFile {
|
|
18
|
+
path: string;
|
|
19
|
+
content: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generate all files for a Python trik project
|
|
23
|
+
*/
|
|
24
|
+
export declare function generatePythonProject(config: PyTemplateConfig): GeneratedFile[];
|
|
25
|
+
//# sourceMappingURL=python.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/templates/python.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AASD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,aAAa,EAAE,CAc/E"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python Trik Template Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates all files needed for a Python trik project.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Convert trik name to Python package name (dashes to underscores)
|
|
8
|
+
*/
|
|
9
|
+
function toPackageName(name) {
|
|
10
|
+
return name.replace(/-/g, '_');
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Generate all files for a Python trik project
|
|
14
|
+
*/
|
|
15
|
+
export function generatePythonProject(config) {
|
|
16
|
+
const files = [];
|
|
17
|
+
const pkgName = toPackageName(config.name);
|
|
18
|
+
files.push({ path: 'trikhub.json', content: generateTrikhubJson(config) });
|
|
19
|
+
files.push({ path: 'pyproject.toml', content: generatePyproject(config, pkgName) });
|
|
20
|
+
files.push({ path: 'test.py', content: generateTestPy(pkgName) });
|
|
21
|
+
files.push({ path: 'README.md', content: generateReadme(config) });
|
|
22
|
+
files.push({ path: '.gitignore', content: generateGitignore() });
|
|
23
|
+
files.push({ path: `${pkgName}/__init__.py`, content: generateInitPy() });
|
|
24
|
+
files.push({ path: `${pkgName}/manifest.json`, content: generateManifest(config) });
|
|
25
|
+
files.push({ path: `${pkgName}/graph.py`, content: generateGraphPy(config) });
|
|
26
|
+
return files;
|
|
27
|
+
}
|
|
28
|
+
function generateManifest(config) {
|
|
29
|
+
const manifest = {
|
|
30
|
+
schemaVersion: 1,
|
|
31
|
+
id: config.name,
|
|
32
|
+
name: config.displayName,
|
|
33
|
+
description: config.description,
|
|
34
|
+
version: '0.1.0',
|
|
35
|
+
actions: {
|
|
36
|
+
hello: {
|
|
37
|
+
description: 'Say hello to someone',
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {
|
|
41
|
+
name: { type: 'string', description: 'Name to greet' },
|
|
42
|
+
},
|
|
43
|
+
required: ['name'],
|
|
44
|
+
},
|
|
45
|
+
responseMode: 'template',
|
|
46
|
+
agentDataSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
template: { type: 'string', enum: ['success'] },
|
|
50
|
+
greeting: { type: 'string', maxLength: 200, pattern: '^.{1,200}$' },
|
|
51
|
+
},
|
|
52
|
+
required: ['template', 'greeting'],
|
|
53
|
+
},
|
|
54
|
+
responseTemplates: {
|
|
55
|
+
success: { text: '{{greeting}}' },
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
capabilities: {
|
|
60
|
+
tools: [],
|
|
61
|
+
},
|
|
62
|
+
limits: {
|
|
63
|
+
maxExecutionTimeMs: 5000,
|
|
64
|
+
},
|
|
65
|
+
entry: {
|
|
66
|
+
module: './graph.py',
|
|
67
|
+
export: 'graph',
|
|
68
|
+
runtime: 'python',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
// Add storage capability if enabled
|
|
72
|
+
if (config.enableStorage) {
|
|
73
|
+
manifest.capabilities.storage = {
|
|
74
|
+
enabled: true,
|
|
75
|
+
maxSizeBytes: 1048576,
|
|
76
|
+
persistent: true,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// Add config if enabled
|
|
80
|
+
if (config.enableConfig) {
|
|
81
|
+
manifest.config = {
|
|
82
|
+
required: [
|
|
83
|
+
{ key: 'API_KEY', description: 'Your API key' },
|
|
84
|
+
],
|
|
85
|
+
optional: [],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return JSON.stringify(manifest, null, 2) + '\n';
|
|
89
|
+
}
|
|
90
|
+
function generateTrikhubJson(config) {
|
|
91
|
+
const trikhub = {
|
|
92
|
+
displayName: config.displayName,
|
|
93
|
+
shortDescription: config.description,
|
|
94
|
+
categories: [config.category],
|
|
95
|
+
keywords: [config.name],
|
|
96
|
+
author: {
|
|
97
|
+
name: config.authorName,
|
|
98
|
+
github: config.authorGithub,
|
|
99
|
+
},
|
|
100
|
+
repository: `https://github.com/${config.authorGithub}/${config.name}`,
|
|
101
|
+
};
|
|
102
|
+
return JSON.stringify(trikhub, null, 2) + '\n';
|
|
103
|
+
}
|
|
104
|
+
function generatePyproject(config, pkgName) {
|
|
105
|
+
return `[build-system]
|
|
106
|
+
requires = ["hatchling"]
|
|
107
|
+
build-backend = "hatchling.build"
|
|
108
|
+
|
|
109
|
+
[project]
|
|
110
|
+
name = "${config.name}"
|
|
111
|
+
version = "0.1.0"
|
|
112
|
+
description = "${config.description}"
|
|
113
|
+
readme = "README.md"
|
|
114
|
+
requires-python = ">=3.10"
|
|
115
|
+
license = {text = "MIT"}
|
|
116
|
+
authors = [
|
|
117
|
+
{ name = "${config.authorName}" }
|
|
118
|
+
]
|
|
119
|
+
dependencies = []
|
|
120
|
+
|
|
121
|
+
[project.urls]
|
|
122
|
+
Repository = "https://github.com/${config.authorGithub}/${config.name}"
|
|
123
|
+
|
|
124
|
+
[tool.hatch.build.targets.wheel]
|
|
125
|
+
packages = ["${pkgName}"]
|
|
126
|
+
|
|
127
|
+
[tool.hatch.build.targets.sdist]
|
|
128
|
+
include = [
|
|
129
|
+
"${pkgName}/**",
|
|
130
|
+
"README.md",
|
|
131
|
+
]
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
function generateGraphPy(config) {
|
|
135
|
+
const storageType = config.enableStorage ? ', storage: dict | None = None' : '';
|
|
136
|
+
const configType = config.enableConfig ? ', config: dict | None = None' : '';
|
|
137
|
+
return `"""
|
|
138
|
+
${config.displayName}
|
|
139
|
+
|
|
140
|
+
${config.description}
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
from __future__ import annotations
|
|
144
|
+
|
|
145
|
+
from typing import Any
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class ${toPascalCase(config.name)}Graph:
|
|
149
|
+
"""Main graph for the ${config.displayName} trik."""
|
|
150
|
+
|
|
151
|
+
async def invoke(self, input_data: dict[str, Any]) -> dict[str, Any]:
|
|
152
|
+
"""
|
|
153
|
+
Main entry point called by the TrikHub gateway.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
input_data: Contains action, input${config.enableStorage ? ', storage' : ''}${config.enableConfig ? ', config' : ''}
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
Response with responseMode and agentData/userContent
|
|
160
|
+
"""
|
|
161
|
+
action = input_data.get("action")
|
|
162
|
+
action_input = input_data.get("input", {})${config.enableStorage ? '\n storage = input_data.get("storage")' : ''}${config.enableConfig ? '\n config = input_data.get("config")' : ''}
|
|
163
|
+
|
|
164
|
+
if action == "hello":
|
|
165
|
+
name = action_input.get("name", "World")
|
|
166
|
+
return {
|
|
167
|
+
"responseMode": "template",
|
|
168
|
+
"agentData": {
|
|
169
|
+
"template": "success",
|
|
170
|
+
"greeting": f"Hello, {name}!",
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
"responseMode": "template",
|
|
176
|
+
"agentData": {
|
|
177
|
+
"template": "error",
|
|
178
|
+
"message": f"Unknown action: {action}",
|
|
179
|
+
},
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
# Export the graph instance
|
|
184
|
+
graph = ${toPascalCase(config.name)}Graph()
|
|
185
|
+
`;
|
|
186
|
+
}
|
|
187
|
+
function generateInitPy() {
|
|
188
|
+
return `"""${''} Package init """
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
function generateTestPy(pkgName) {
|
|
192
|
+
return `"""
|
|
193
|
+
Local test script
|
|
194
|
+
|
|
195
|
+
Run with: python test.py
|
|
196
|
+
"""
|
|
197
|
+
|
|
198
|
+
import asyncio
|
|
199
|
+
from ${pkgName}.graph import graph
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
async def main():
|
|
203
|
+
result = await graph.invoke({
|
|
204
|
+
"action": "hello",
|
|
205
|
+
"input": {"name": "World"},
|
|
206
|
+
})
|
|
207
|
+
print(result)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
if __name__ == "__main__":
|
|
211
|
+
asyncio.run(main())
|
|
212
|
+
`;
|
|
213
|
+
}
|
|
214
|
+
function generateReadme(config) {
|
|
215
|
+
return `# ${config.displayName}
|
|
216
|
+
|
|
217
|
+
${config.description}
|
|
218
|
+
|
|
219
|
+
## Development
|
|
220
|
+
|
|
221
|
+
\`\`\`bash
|
|
222
|
+
python test.py
|
|
223
|
+
\`\`\`
|
|
224
|
+
|
|
225
|
+
## Actions
|
|
226
|
+
|
|
227
|
+
### hello
|
|
228
|
+
|
|
229
|
+
Say hello to someone.
|
|
230
|
+
|
|
231
|
+
**Input:**
|
|
232
|
+
- \`name\` (string, required): Name to greet
|
|
233
|
+
|
|
234
|
+
## Publishing
|
|
235
|
+
|
|
236
|
+
\`\`\`bash
|
|
237
|
+
trik publish
|
|
238
|
+
\`\`\`
|
|
239
|
+
`;
|
|
240
|
+
}
|
|
241
|
+
function generateGitignore() {
|
|
242
|
+
return `__pycache__/
|
|
243
|
+
*.py[cod]
|
|
244
|
+
*$py.class
|
|
245
|
+
*.so
|
|
246
|
+
.Python
|
|
247
|
+
build/
|
|
248
|
+
dist/
|
|
249
|
+
*.egg-info/
|
|
250
|
+
.eggs/
|
|
251
|
+
*.egg
|
|
252
|
+
.venv/
|
|
253
|
+
venv/
|
|
254
|
+
.DS_Store
|
|
255
|
+
`;
|
|
256
|
+
}
|
|
257
|
+
function toPascalCase(str) {
|
|
258
|
+
return str
|
|
259
|
+
.split('-')
|
|
260
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
261
|
+
.join('');
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=python.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.js","sourceRoot":"","sources":["../../src/templates/python.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoBH;;GAEG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAwB;IAC5D,MAAM,KAAK,GAAoB,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE3C,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC3E,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,CAAC,MAA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CAAC,aAAa,CAAC,CAAC,CAAC,+CAA+C,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,6CAA6C,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;UAsBhM,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC;CAClC,CAAC;AACF,CAAC;AAED,SAAS,cAAc;IACrB,OAAO,MAAM,EAAE;CAChB,CAAC;AACF,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,OAAO;;;;;;;OAOF,OAAO;;;;;;;;;;;;;CAab,CAAC;AACF,CAAC;AAED,SAAS,cAAc,CAAC,MAAwB;IAC9C,OAAO,KAAK,MAAM,CAAC,WAAW;;EAE9B,MAAM,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;CAsBnB,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO;;;;;;;;;;;;;CAaR,CAAC;AACF,CAAC;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3D,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Trik Template Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates all files needed for a TypeScript trik project.
|
|
5
|
+
*/
|
|
6
|
+
import { TrikCategory } from '../types.js';
|
|
7
|
+
export interface TsTemplateConfig {
|
|
8
|
+
name: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
description: string;
|
|
11
|
+
authorName: string;
|
|
12
|
+
authorGithub: string;
|
|
13
|
+
category: TrikCategory;
|
|
14
|
+
enableStorage: boolean;
|
|
15
|
+
enableConfig: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface GeneratedFile {
|
|
18
|
+
path: string;
|
|
19
|
+
content: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generate all files for a TypeScript trik project
|
|
23
|
+
*/
|
|
24
|
+
export declare function generateTypescriptProject(config: TsTemplateConfig): GeneratedFile[];
|
|
25
|
+
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/templates/typescript.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,aAAa,EAAE,CAanF"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Trik Template Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates all files needed for a TypeScript trik project.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Generate all files for a TypeScript trik project
|
|
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
|
+
}
|
|
21
|
+
function generateManifest(config) {
|
|
22
|
+
const manifest = {
|
|
23
|
+
schemaVersion: 1,
|
|
24
|
+
id: config.name,
|
|
25
|
+
name: config.displayName,
|
|
26
|
+
description: config.description,
|
|
27
|
+
version: '0.1.0',
|
|
28
|
+
actions: {
|
|
29
|
+
hello: {
|
|
30
|
+
description: 'Say hello to someone',
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
name: { type: 'string', description: 'Name to greet' },
|
|
35
|
+
},
|
|
36
|
+
required: ['name'],
|
|
37
|
+
},
|
|
38
|
+
responseMode: 'template',
|
|
39
|
+
agentDataSchema: {
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: {
|
|
42
|
+
template: { type: 'string', enum: ['success'] },
|
|
43
|
+
greeting: { type: 'string', maxLength: 200, pattern: '^.{1,200}$' },
|
|
44
|
+
},
|
|
45
|
+
required: ['template', 'greeting'],
|
|
46
|
+
},
|
|
47
|
+
responseTemplates: {
|
|
48
|
+
success: { text: '{{greeting}}' },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
capabilities: {
|
|
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
|
|
64
|
+
if (config.enableStorage) {
|
|
65
|
+
manifest.capabilities.storage = {
|
|
66
|
+
enabled: true,
|
|
67
|
+
maxSizeBytes: 1048576,
|
|
68
|
+
persistent: true,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// Add config if enabled
|
|
72
|
+
if (config.enableConfig) {
|
|
73
|
+
manifest.config = {
|
|
74
|
+
required: [
|
|
75
|
+
{ key: 'API_KEY', description: 'Your API key' },
|
|
76
|
+
],
|
|
77
|
+
optional: [],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return JSON.stringify(manifest, null, 2) + '\n';
|
|
81
|
+
}
|
|
82
|
+
function generateTrikhubJson(config) {
|
|
83
|
+
const trikhub = {
|
|
84
|
+
displayName: config.displayName,
|
|
85
|
+
shortDescription: config.description,
|
|
86
|
+
categories: [config.category],
|
|
87
|
+
keywords: [config.name],
|
|
88
|
+
author: {
|
|
89
|
+
name: config.authorName,
|
|
90
|
+
github: config.authorGithub,
|
|
91
|
+
},
|
|
92
|
+
repository: `https://github.com/${config.authorGithub}/${config.name}`,
|
|
93
|
+
};
|
|
94
|
+
return JSON.stringify(trikhub, null, 2) + '\n';
|
|
95
|
+
}
|
|
96
|
+
function generatePackageJson(config) {
|
|
97
|
+
const pkg = {
|
|
98
|
+
name: `@${config.authorGithub.toLowerCase()}/${config.name}`,
|
|
99
|
+
version: '0.1.0',
|
|
100
|
+
description: config.description,
|
|
101
|
+
type: 'module',
|
|
102
|
+
main: 'dist/index.js',
|
|
103
|
+
scripts: {
|
|
104
|
+
build: 'tsc',
|
|
105
|
+
clean: 'rm -rf dist',
|
|
106
|
+
test: 'npm run build && tsx test.ts',
|
|
107
|
+
},
|
|
108
|
+
dependencies: {
|
|
109
|
+
'@trikhub/manifest': '^0.7.0',
|
|
110
|
+
},
|
|
111
|
+
devDependencies: {
|
|
112
|
+
'@types/node': '^20.0.0',
|
|
113
|
+
tsx: '^4.0.0',
|
|
114
|
+
typescript: '^5.6.0',
|
|
115
|
+
},
|
|
116
|
+
engines: {
|
|
117
|
+
node: '>=20',
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
return JSON.stringify(pkg, null, 2) + '\n';
|
|
121
|
+
}
|
|
122
|
+
function generateTsConfig() {
|
|
123
|
+
const tsconfig = {
|
|
124
|
+
compilerOptions: {
|
|
125
|
+
target: 'ES2022',
|
|
126
|
+
module: 'NodeNext',
|
|
127
|
+
moduleResolution: 'NodeNext',
|
|
128
|
+
outDir: './dist',
|
|
129
|
+
rootDir: './src',
|
|
130
|
+
strict: true,
|
|
131
|
+
esModuleInterop: true,
|
|
132
|
+
skipLibCheck: true,
|
|
133
|
+
declaration: true,
|
|
134
|
+
},
|
|
135
|
+
include: ['src/**/*'],
|
|
136
|
+
exclude: ['node_modules', 'dist'],
|
|
137
|
+
};
|
|
138
|
+
return JSON.stringify(tsconfig, null, 2) + '\n';
|
|
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;
|
|
154
|
+
}
|
|
155
|
+
`
|
|
156
|
+
: '';
|
|
157
|
+
const invokeParams = [
|
|
158
|
+
'action: string',
|
|
159
|
+
'input: Record<string, unknown>',
|
|
160
|
+
config.enableStorage ? 'storage?: Storage' : null,
|
|
161
|
+
config.enableConfig ? 'config?: Config' : null,
|
|
162
|
+
]
|
|
163
|
+
.filter(Boolean)
|
|
164
|
+
.join('; ');
|
|
165
|
+
return `/**
|
|
166
|
+
* ${config.displayName}
|
|
167
|
+
*
|
|
168
|
+
* ${config.description}
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
type InvokeInput = {
|
|
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
|
+
}
|
|
205
|
+
|
|
206
|
+
export default new ${toPascalCase(config.name)}Graph();
|
|
207
|
+
`;
|
|
208
|
+
}
|
|
209
|
+
function generateTestTs() {
|
|
210
|
+
return `/**
|
|
211
|
+
* Local test script
|
|
212
|
+
*
|
|
213
|
+
* Run with: npm test
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
import graph from './src/index.js';
|
|
217
|
+
|
|
218
|
+
async function main() {
|
|
219
|
+
const result = await graph.invoke({
|
|
220
|
+
action: 'hello',
|
|
221
|
+
input: { name: 'World' },
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
console.log(JSON.stringify(result, null, 2));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
main().catch(console.error);
|
|
228
|
+
`;
|
|
229
|
+
}
|
|
230
|
+
function generateReadme(config) {
|
|
231
|
+
return `# ${config.displayName}
|
|
232
|
+
|
|
233
|
+
${config.description}
|
|
234
|
+
|
|
235
|
+
## Development
|
|
236
|
+
|
|
237
|
+
\`\`\`bash
|
|
238
|
+
npm install
|
|
239
|
+
npm run build
|
|
240
|
+
npm test
|
|
241
|
+
\`\`\`
|
|
242
|
+
|
|
243
|
+
## Actions
|
|
244
|
+
|
|
245
|
+
### hello
|
|
246
|
+
|
|
247
|
+
Say hello to someone.
|
|
248
|
+
|
|
249
|
+
**Input:**
|
|
250
|
+
- \`name\` (string, required): Name to greet
|
|
251
|
+
|
|
252
|
+
## Publishing
|
|
253
|
+
|
|
254
|
+
\`\`\`bash
|
|
255
|
+
trik publish
|
|
256
|
+
\`\`\`
|
|
257
|
+
`;
|
|
258
|
+
}
|
|
259
|
+
function generateGitignore() {
|
|
260
|
+
return `node_modules/
|
|
261
|
+
*.log
|
|
262
|
+
.DS_Store
|
|
263
|
+
`;
|
|
264
|
+
}
|
|
265
|
+
function toPascalCase(str) {
|
|
266
|
+
return str
|
|
267
|
+
.split('-')
|
|
268
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
269
|
+
.join('');
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../src/templates/typescript.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoBH;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAwB;IAChE,MAAM,KAAK,GAAoB,EAAE,CAAC;IAElC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,m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;;;;;CAwBnB,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO;;;CAGR,CAAC;AACF,CAAC;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3D,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trikhub/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "CLI for TrikHub - Teaching AI new triks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"ora": "^8.0.1",
|
|
27
27
|
"semver": "^7.6.3",
|
|
28
28
|
"tar": "^7.4.0",
|
|
29
|
-
"@trikhub/
|
|
29
|
+
"@trikhub/linter": "0.10.0",
|
|
30
|
+
"@trikhub/manifest": "0.10.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@types/node": "^20.14.0",
|