@symplek/cli 0.0.0-stage → 0.2.0-beta.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/CHANGELOG.md +47 -0
- package/LICENSE +21 -0
- package/README.md +74 -2
- package/bin/symplek.js +5 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +44 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add.d.ts +36 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +467 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/generate.d.ts +26 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +491 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/init.d.ts +46 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +350 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/migrate.d.ts +41 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +518 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/validate.d.ts +252 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +515 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +24 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +39 -0
- package/dist/models.js.map +1 -0
- package/dist/naming.d.ts +20 -0
- package/dist/naming.d.ts.map +1 -0
- package/dist/naming.js +48 -0
- package/dist/naming.js.map +1 -0
- package/dist/templates/agent/agent.ts.template +41 -0
- package/dist/templates/agent/general.yaml.template +34 -0
- package/dist/templates/agent/researcher.yaml.template +42 -0
- package/dist/templates/agent/reviewer.yaml.template +51 -0
- package/dist/templates/project/full/.github/workflows/ci.yml.template +34 -0
- package/dist/templates/project/full/.gitignore.template +6 -0
- package/dist/templates/project/full/Dockerfile.template +43 -0
- package/dist/templates/project/full/README.md.template +77 -0
- package/dist/templates/project/full/agents/example.yaml.template +16 -0
- package/dist/templates/project/full/package.json.template +30 -0
- package/dist/templates/project/full/src/index.ts.template +43 -0
- package/dist/templates/project/full/src/symplek.config.ts.template +20 -0
- package/dist/templates/project/full/src/tools/index.ts.template +73 -0
- package/dist/templates/project/full/tests/example.test.ts.template +49 -0
- package/dist/templates/project/full/tsconfig.json.template +18 -0
- package/dist/templates/project/minimal/.gitignore.template +6 -0
- package/dist/templates/project/minimal/agents/example.yaml.template +16 -0
- package/dist/templates/project/minimal/package.json.template +27 -0
- package/dist/templates/project/minimal/src/index.ts.template +43 -0
- package/dist/templates/project/minimal/src/symplek.config.ts.template +20 -0
- package/dist/templates/project/minimal/tsconfig.json.template +18 -0
- package/dist/templates/project/standard/.gitignore.template +6 -0
- package/dist/templates/project/standard/README.md.template +77 -0
- package/dist/templates/project/standard/agents/example.yaml.template +16 -0
- package/dist/templates/project/standard/package.json.template +30 -0
- package/dist/templates/project/standard/src/index.ts.template +43 -0
- package/dist/templates/project/standard/src/symplek.config.ts.template +20 -0
- package/dist/templates/project/standard/src/tools/index.ts.template +73 -0
- package/dist/templates/project/standard/tests/example.test.ts.template +49 -0
- package/dist/templates/project/standard/tsconfig.json.template +18 -0
- package/dist/utils/templates.d.ts +41 -0
- package/dist/utils/templates.d.ts.map +1 -0
- package/dist/utils/templates.js +133 -0
- package/dist/utils/templates.js.map +1 -0
- package/package.json +60 -3
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processTemplate = processTemplate;
|
|
4
|
+
exports.getProjectTemplatePath = getProjectTemplatePath;
|
|
5
|
+
exports.getAgentTemplatePath = getAgentTemplatePath;
|
|
6
|
+
exports.loadProjectTemplate = loadProjectTemplate;
|
|
7
|
+
exports.loadAgentTemplate = loadAgentTemplate;
|
|
8
|
+
exports.getTemplatesRoot = getTemplatesRoot;
|
|
9
|
+
exports.getProjectTierFiles = getProjectTierFiles;
|
|
10
|
+
exports.getDefaultVars = getDefaultVars;
|
|
11
|
+
/**
|
|
12
|
+
* Template processing utilities for Symplek CLI
|
|
13
|
+
* Handles variable interpolation and template loading
|
|
14
|
+
*/
|
|
15
|
+
const node_fs_1 = require("node:fs");
|
|
16
|
+
const node_path_1 = require("node:path");
|
|
17
|
+
const models_js_1 = require("../models.js");
|
|
18
|
+
// Read at runtime so it is always the version of the CLI that is running.
|
|
19
|
+
// src/utils and dist/utils sit at the same depth below the package root.
|
|
20
|
+
const { version: CLI_VERSION } = require("../../package.json");
|
|
21
|
+
/**
|
|
22
|
+
* Process a template string by replacing {{variableName}} with actual values
|
|
23
|
+
* Unmatched variables are preserved as-is
|
|
24
|
+
*/
|
|
25
|
+
function processTemplate(content, vars) {
|
|
26
|
+
return content.replace(/\{\{(\w+)\}\}/g, (match, key) => vars[key] ?? match);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the templates root, handling both build and source layouts:
|
|
30
|
+
*
|
|
31
|
+
* - Built CLI (dist/utils/templates.js): `../templates` → `dist/templates/`,
|
|
32
|
+
* populated by `scripts/copy-templates.mjs` at build time.
|
|
33
|
+
* - Source-time / tests (src/utils/templates.ts): `../templates` would
|
|
34
|
+
* point at the deleted `src/templates/`. Walk one level higher to
|
|
35
|
+
* find the package-root `templates/` directory directly.
|
|
36
|
+
*/
|
|
37
|
+
function resolveTemplatesRoot() {
|
|
38
|
+
const dist = (0, node_path_1.resolve)(__dirname, "..", "templates");
|
|
39
|
+
if ((0, node_fs_1.existsSync)(dist))
|
|
40
|
+
return dist;
|
|
41
|
+
const src = (0, node_path_1.resolve)(__dirname, "..", "..", "templates");
|
|
42
|
+
return src;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get the absolute path to a project template file
|
|
46
|
+
*/
|
|
47
|
+
function getProjectTemplatePath(tier, ...pathSegments) {
|
|
48
|
+
return (0, node_path_1.join)(resolveTemplatesRoot(), "project", tier, ...pathSegments);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the absolute path to an agent template file
|
|
52
|
+
*/
|
|
53
|
+
function getAgentTemplatePath(filename) {
|
|
54
|
+
return (0, node_path_1.join)(resolveTemplatesRoot(), "agent", filename);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Load a project template file and process it with variables
|
|
58
|
+
*/
|
|
59
|
+
function loadProjectTemplate(tier, pathSegments, vars = {}) {
|
|
60
|
+
const templatePath = getProjectTemplatePath(tier, ...pathSegments);
|
|
61
|
+
if (!(0, node_fs_1.existsSync)(templatePath)) {
|
|
62
|
+
throw new Error(`Template not found: ${templatePath}`);
|
|
63
|
+
}
|
|
64
|
+
const content = (0, node_fs_1.readFileSync)(templatePath, "utf-8");
|
|
65
|
+
return processTemplate(content, vars);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Load an agent template file and process it with variables
|
|
69
|
+
*/
|
|
70
|
+
function loadAgentTemplate(type, vars = {}) {
|
|
71
|
+
const filename = type === "typescript" ? "agent.ts.template" : `${type}.yaml.template`;
|
|
72
|
+
const templatePath = getAgentTemplatePath(filename);
|
|
73
|
+
if (!(0, node_fs_1.existsSync)(templatePath)) {
|
|
74
|
+
throw new Error(`Agent template not found: ${templatePath}`);
|
|
75
|
+
}
|
|
76
|
+
const content = (0, node_fs_1.readFileSync)(templatePath, "utf-8");
|
|
77
|
+
return processTemplate(content, vars);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get the templates root directory path
|
|
81
|
+
*/
|
|
82
|
+
function getTemplatesRoot() {
|
|
83
|
+
return resolveTemplatesRoot();
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get list of files for a project tier
|
|
87
|
+
* Higher tiers inherit from lower tiers
|
|
88
|
+
*/
|
|
89
|
+
function getProjectTierFiles(tier) {
|
|
90
|
+
const minimalFiles = [
|
|
91
|
+
"package.json.template",
|
|
92
|
+
"tsconfig.json.template",
|
|
93
|
+
"src/symplek.config.ts.template",
|
|
94
|
+
"src/index.ts.template",
|
|
95
|
+
"agents/example.yaml.template",
|
|
96
|
+
];
|
|
97
|
+
const standardFiles = [
|
|
98
|
+
...minimalFiles,
|
|
99
|
+
"src/tools/index.ts.template",
|
|
100
|
+
"tests/example.test.ts.template",
|
|
101
|
+
"README.md.template",
|
|
102
|
+
];
|
|
103
|
+
const fullFiles = [
|
|
104
|
+
...standardFiles,
|
|
105
|
+
".github/workflows/ci.yml.template",
|
|
106
|
+
"Dockerfile.template",
|
|
107
|
+
];
|
|
108
|
+
switch (tier) {
|
|
109
|
+
case "minimal":
|
|
110
|
+
return minimalFiles;
|
|
111
|
+
case "standard":
|
|
112
|
+
return standardFiles;
|
|
113
|
+
case "full":
|
|
114
|
+
return fullFiles;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Default template variables with sensible defaults
|
|
119
|
+
*/
|
|
120
|
+
function getDefaultVars(name) {
|
|
121
|
+
return {
|
|
122
|
+
name,
|
|
123
|
+
version: "0.1.0",
|
|
124
|
+
description: `${name} - Symplek Agent Project`,
|
|
125
|
+
author: "",
|
|
126
|
+
model: models_js_1.DEFAULT_MODEL,
|
|
127
|
+
agentName: "example",
|
|
128
|
+
// A scaffolded project depends on the CLI that created it, so that
|
|
129
|
+
// `symplek generate` and `symplek validate` run from inside the project.
|
|
130
|
+
cliVersion: CLI_VERSION,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/utils/templates.ts"],"names":[],"mappings":";;AA2BA,0CAEC;AAqBD,wDAKC;AAKD,oDAEC;AAKD,kDAaC;AAKD,8CAcC;AAKD,4CAEC;AAMD,kDA8BC;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AY,CAAC;QACtB,KAAK,UAAU;YACb,OAAO,aAAa,CAAC;QACvB,KAAK,MAAM;YACT,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,GAAG,IAAI,0BAA0B;QAC9C,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,yBAAa;QACpB,SAAS,EAAE,SAAS;QACpB,mEAAmE;QACnE,yEAAyE;QACzE,UAAU,EAAE,WAAW;KACxB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symplek/cli",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0-beta.0",
|
|
4
|
+
"description": "Symplek CLI - AI Agent Development Toolkit",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"symplek": "./bin/symplek.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"dist",
|
|
14
|
+
"CHANGELOG.md"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ai",
|
|
18
|
+
"agents",
|
|
19
|
+
"cli",
|
|
20
|
+
"Symplek",
|
|
21
|
+
"scaffolding"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/symplek/symplek.git",
|
|
26
|
+
"directory": "packages/symplek-cli"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"ajv": "^8.17.0",
|
|
30
|
+
"chokidar": "^3.6.0",
|
|
31
|
+
"commander": "^12.1.0",
|
|
32
|
+
"inquirer": "^9.3.0",
|
|
33
|
+
"chalk": "^5.3.0",
|
|
34
|
+
"ora": "^8.0.1",
|
|
35
|
+
"js-yaml": "^4.1.0",
|
|
36
|
+
"glob": "^10.4.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/inquirer": "^9.0.7",
|
|
40
|
+
"@types/js-yaml": "^4.0.9",
|
|
41
|
+
"@types/node": "^20.11.0",
|
|
42
|
+
"typescript": "^5.5.0",
|
|
43
|
+
"vitest": "^4.0.17",
|
|
44
|
+
"@symplek/core": "1.0.0-beta.2"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@symplek/core": ">=1.0.0-beta.2"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=20.19"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public",
|
|
54
|
+
"registry": "https://registry.npmjs.org/"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsc && node scripts/copy-templates.mjs",
|
|
58
|
+
"dev": "tsc --watch",
|
|
59
|
+
"lint": "biome check .",
|
|
60
|
+
"typecheck": "tsc --noEmit",
|
|
61
|
+
"test": "vitest run"
|
|
62
|
+
}
|
|
6
63
|
}
|