@blocklet/pages-kit-agents 0.5.12
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/.env.local.example +8 -0
- package/LICENSE +13 -0
- package/README.md +10 -0
- package/cli.ts +354 -0
- package/index.ts +14 -0
- package/lib/cjs/agents/multi-agent-page-writer.d.ts +48 -0
- package/lib/cjs/agents/multi-agent-page-writer.js +203 -0
- package/lib/cjs/agents/page-metadata-generator.d.ts +10 -0
- package/lib/cjs/agents/page-metadata-generator.js +43 -0
- package/lib/cjs/agents/page-structure-planner.d.ts +55 -0
- package/lib/cjs/agents/page-structure-planner.js +106 -0
- package/lib/cjs/agents/page-structure-validator.d.ts +30 -0
- package/lib/cjs/agents/page-structure-validator.js +124 -0
- package/lib/cjs/agents/sample-html-generator.d.ts +6 -0
- package/lib/cjs/agents/sample-html-generator.js +35 -0
- package/lib/cjs/agents/section-content-generator.d.ts +19 -0
- package/lib/cjs/agents/section-content-generator.js +97 -0
- package/lib/cjs/index.d.ts +7 -0
- package/lib/cjs/index.js +30 -0
- package/lib/cjs/tsconfig.tsbuildinfo +1 -0
- package/lib/cjs/utils/agent-utils.d.ts +3 -0
- package/lib/cjs/utils/agent-utils.js +44 -0
- package/lib/cjs/utils/file-utils.d.ts +5 -0
- package/lib/cjs/utils/file-utils.js +90 -0
- package/lib/cjs/utils/index.d.ts +12 -0
- package/lib/cjs/utils/index.js +48 -0
- package/lib/cjs/utils/logger.d.ts +1 -0
- package/lib/cjs/utils/logger.js +4 -0
- package/lib/cjs/utils/template-utils.d.ts +28 -0
- package/lib/cjs/utils/template-utils.js +74 -0
- package/lib/esm/agents/multi-agent-page-writer.d.ts +48 -0
- package/lib/esm/agents/multi-agent-page-writer.js +199 -0
- package/lib/esm/agents/page-metadata-generator.d.ts +10 -0
- package/lib/esm/agents/page-metadata-generator.js +40 -0
- package/lib/esm/agents/page-structure-planner.d.ts +55 -0
- package/lib/esm/agents/page-structure-planner.js +103 -0
- package/lib/esm/agents/page-structure-validator.d.ts +30 -0
- package/lib/esm/agents/page-structure-validator.js +121 -0
- package/lib/esm/agents/sample-html-generator.d.ts +6 -0
- package/lib/esm/agents/sample-html-generator.js +32 -0
- package/lib/esm/agents/section-content-generator.d.ts +19 -0
- package/lib/esm/agents/section-content-generator.js +94 -0
- package/lib/esm/index.d.ts +7 -0
- package/lib/esm/index.js +8 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -0
- package/lib/esm/utils/agent-utils.d.ts +3 -0
- package/lib/esm/utils/agent-utils.js +38 -0
- package/lib/esm/utils/file-utils.d.ts +5 -0
- package/lib/esm/utils/file-utils.js +61 -0
- package/lib/esm/utils/index.d.ts +12 -0
- package/lib/esm/utils/index.js +28 -0
- package/lib/esm/utils/logger.d.ts +1 -0
- package/lib/esm/utils/logger.js +1 -0
- package/lib/esm/utils/template-utils.d.ts +28 -0
- package/lib/esm/utils/template-utils.js +67 -0
- package/lib/types/agents/multi-agent-page-writer.d.ts +48 -0
- package/lib/types/agents/page-metadata-generator.d.ts +10 -0
- package/lib/types/agents/page-structure-planner.d.ts +55 -0
- package/lib/types/agents/page-structure-validator.d.ts +30 -0
- package/lib/types/agents/sample-html-generator.d.ts +6 -0
- package/lib/types/agents/section-content-generator.d.ts +19 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -0
- package/lib/types/utils/agent-utils.d.ts +3 -0
- package/lib/types/utils/file-utils.d.ts +5 -0
- package/lib/types/utils/index.d.ts +12 -0
- package/lib/types/utils/logger.d.ts +1 -0
- package/lib/types/utils/template-utils.d.ts +28 -0
- package/package.json +46 -0
- package/types.d.ts +4 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 读取指定路径的文件并返回字符串内容
|
|
3
|
+
* @param filePath 文件路径,可以是相对路径或绝对路径
|
|
4
|
+
* @param encoding 文件编码,默认为 'utf-8'
|
|
5
|
+
* @returns 文件内容字符串
|
|
6
|
+
* @throws 如果文件不存在或读取失败则抛出异常
|
|
7
|
+
*/
|
|
8
|
+
export declare function readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
|
|
9
|
+
export * from './agent-utils';
|
|
10
|
+
export * from './logger';
|
|
11
|
+
export * from './template-utils';
|
|
12
|
+
export * from './file-utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const logger: Console;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 根据JSON数据更新HTML模板并保存到指定目录
|
|
3
|
+
* @param jsonData 需要应用到模板的JSON数据
|
|
4
|
+
* @param templatePath 模板HTML文件路径,默认为assets目录下的sample.html
|
|
5
|
+
* @param outputFolder 输出文件夹名称,将在output目录下创建
|
|
6
|
+
* @param outputFileName 输出HTML文件名称,不包含扩展名
|
|
7
|
+
* @returns 生成的HTML文件的完整路径
|
|
8
|
+
* @throws 如果模板文件不存在或无法创建输出目录则抛出异常
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateHtmlFromTemplate({ jsonData, outputFolder, outputFileName, templatePath, }: {
|
|
11
|
+
jsonData: Record<string, any>;
|
|
12
|
+
outputFolder: string;
|
|
13
|
+
outputFileName: string;
|
|
14
|
+
templatePath?: string;
|
|
15
|
+
}): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* 保存HTML内容到指定目录
|
|
18
|
+
* @param htmlContent 要保存的HTML内容
|
|
19
|
+
* @param outputFolder 输出文件夹路径
|
|
20
|
+
* @param outputFileName 输出HTML文件名称,不包含扩展名
|
|
21
|
+
* @returns 生成的HTML文件的完整路径
|
|
22
|
+
* @throws 如果无法创建输出目录或写入文件则抛出异常
|
|
23
|
+
*/
|
|
24
|
+
export declare function saveHtmlContent({ htmlContent, outputFolder, outputFileName, }: {
|
|
25
|
+
htmlContent: string;
|
|
26
|
+
outputFolder: string;
|
|
27
|
+
outputFileName: string;
|
|
28
|
+
}): Promise<string>;
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blocklet/pages-kit-agents",
|
|
3
|
+
"version": "0.5.12",
|
|
4
|
+
"description": "AIGNE based agents for pages kit",
|
|
5
|
+
"author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
|
|
6
|
+
"homepage": "https://github.com/blocklet/pages-kit#readme",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"main": "./lib/cjs/index.js",
|
|
9
|
+
"module": "./lib/esm/index.js",
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"bin": {
|
|
12
|
+
"pages-kit-agents": "cli.ts"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
".env.local.example",
|
|
16
|
+
"*.ts",
|
|
17
|
+
"README.md",
|
|
18
|
+
"lib"
|
|
19
|
+
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/blocklet/pages-kit.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@aigne/core": "^1.14.0",
|
|
27
|
+
"@types/js-yaml": "^4.0.9",
|
|
28
|
+
"@types/yargs": "^17.0.33",
|
|
29
|
+
"js-yaml": "^4.1.0",
|
|
30
|
+
"open": "^10.1.2",
|
|
31
|
+
"yargs": "^17.7.2",
|
|
32
|
+
"zod": "^3.24.2",
|
|
33
|
+
"@blocklet/pages-kit-block-studio": "0.5.12"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"start": "npx -y bun run cli.ts",
|
|
37
|
+
"lint": "eslint src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
38
|
+
"lint:fix": "npm run lint -- --fix",
|
|
39
|
+
"build": "run-p build:*",
|
|
40
|
+
"build:cjs": "tsc --module commonjs --outDir lib/cjs",
|
|
41
|
+
"build:esm": "tsc --module es2022 --outDir lib/esm",
|
|
42
|
+
"build:types": "tsc --declaration --emitDeclarationOnly --outDir lib/types",
|
|
43
|
+
"dev": "run-p 'build:* -- -w'",
|
|
44
|
+
"clean": "rimraf lib"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/types.d.ts
ADDED