-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathagents.js
More file actions
50 lines (48 loc) · 1.76 KB
/
Copy pathagents.js
File metadata and controls
50 lines (48 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const path = require('path')
const fs = require('fs')
const agents = [
"AGENTS.md",
"CLAUDE.md",
"GEMINI.md",
"QWEN.md",
".clinerules",
".cursorrules",
".windsurfrules"
]
module.exports = async (kernel, req) => {
const cwd = req.cwd
const recipe = req.recipe || "AGENTS.md"
const structure = req.structure || "clone"
const app_root = req.app_root || "app"
const recipe_path = path.resolve(__dirname, recipe)
const structure_path = path.resolve(__dirname, "structure", structure)
const structure_content = await fs.promises.readFile(structure_path, "utf-8")
let rendered_recipe = await kernel.renderFile(recipe_path, {
structure: structure_content,
examples: kernel.path("prototype/system/examples"),
browser_logs: kernel.path("logs/browser.log"),
PINOKIO_DOCUMENTATION: kernel.path("prototype/PINOKIO.md"),
PTERM_DOCUMENTATION: kernel.path("prototype/PTERM.md"),
app_root
})
const gitignore_path = path.resolve(req.cwd, ".gitignore")
for(let agent of agents) {
await fs.promises.writeFile(path.resolve(cwd, agent), rendered_recipe)
//await fs.promises.cp(path.resolve(__dirname, recipe), path.resolve(cwd, agent))
}
await fs.promises.writeFile(path.resolve(cwd, ".geminiignore"), `ENVIRONMENT
!/logs
!/GEMINI.md
!/SPEC.md
!/app
!${kernel.homedir}`)
// // copy readme
// let readme_path = kernel.path("prototype/PINOKIO.md")
// await fs.promises.cp(readme_path, path.resolve(cwd, "PINOKIO.md"))
// // copy pterm.md
// let cli_readme_path = kernel.path("prototype/PTERM.md")
// await fs.promises.cp(cli_readme_path, path.resolve(cwd, "PTERM.md"))
// // copy examples
// let examples_path = kernel.path("prototype/system/examples")
// await fs.promises.cp(examples_path, path.resolve(cwd, "examples"), { recursive: true })
}