This commit is contained in:
2025-05-20 09:48:56 +04:00
parent fd8b8c8f42
commit 2d5d1befae
8 changed files with 98 additions and 38 deletions

59
cli/config.heroscript Normal file
View File

@@ -0,0 +1,59 @@
!!docusaurus.config
name:"superbrain"
title:"Geomind"
tagline:"Sovereign Neuromorphic AI & Compute"
url:"https://info.ourworld.tf"
base_url:"/superbrain/"
url_home:"docs/"
favicon:"img/ourworld_favicon.png"
image:"img/geomind.png"
!!docusaurus.config_meta
description:"Geomind Ebook"
image:"https://info.ourworld.tf/img/logo.svg"
title:"Sovereign Neuromorphic AI & Compute"
!!docusaurus.navbar
title:""
logo_alt:"ThreeFold Logo"
logo_src:"img/geomind.png"
!!docusaurus.navbar_item
label:"OurWorld Intro"
href:"https://info.ourworld.tf/intro/"
position:"right"
!!docusaurus.navbar_item
label:"ThreeFold.io"
href:"https://threefold.io"
position:"right"
!!docusaurus.navbar_item
label:"Mycelium Network"
href:"https://mycelium.threefold.io/"
position:"right"
!!docusaurus.navbar_item
label:"AI Box"
href:"https://aibox.threefold.io/"
position:"right"
!!docusaurus.footer
style:"dark"
!!docusaurus.footer_item
title:"Web"
label:"ThreeFold.io"
href:"https://threefold.io"
!!docusaurus.footer_item
title:"Web"
label:"OurWorld"
href:"https://ourworld.tf"
!!docusaurus.build_dest
path:"root@info.ourworld.tf:/root/hero/www/info/superbrain"
!!docusaurus.build_dest_dev
path:"root@info.ourworld.tf:/root/hero/www/infodev/superbrain"

View File

@@ -138,16 +138,16 @@ fn cmd_docusaurus_execute(cmd Command) ! {
mut provided_path := cmd.flags.get_string('path') or { '' }
mut heroscript_source_path := ''
build_cfg_dir := os.join_path(build_path, 'cfg')
target_heroscript_path := os.join_path(build_cfg_dir, 'config.heroscript')
// target_heroscript_path := os.join_path(build_cfg_dir, 'config.heroscript')
if provided_path != '' {
if !os.exists(provided_path) || !os.is_file(provided_path) {
return error('Provided path "${provided_path}" does not exist or is not a file.')
}
heroscript_source_path = provided_path
// --- Copy Heroscript to Build Location ---
os.mkdir_all(build_cfg_dir)!
os.cp(heroscript_source_path, target_heroscript_path)!
// heroscript_source_path = provided_path
// // --- Copy Heroscript to Build Location ---
// os.mkdir_all(build_cfg_dir)!
// os.cp(heroscript_source_path, target_heroscript_path)!
} else {
// Path not provided, look in ./cfg/
mut cwd := os.getwd()
@@ -155,21 +155,21 @@ fn cmd_docusaurus_execute(cmd Command) ! {
if !os.exists(cfg_dir) || !os.is_dir(cfg_dir) {
return error('Flag -path not provided and directory "./cfg" not found in the current working directory.')
}
mut found_files := []string
for file in os.ls(cfg_dir) or { []string{} } {
if file.ends_with('.heroscript') {
found_files << os.join_path(cfg_dir, file)
}
}
if found_files.len == 1 {
heroscript_source_path = found_files[0]
os.mkdir_all(build_cfg_dir)!
os.cp(heroscript_source_path, target_heroscript_path)!
} else if found_files.len == 0 {
return error('Flag -path not provided and no *.heroscript file found in "./cfg".')
} else {
return error('Flag -path not provided and multiple *.heroscript files found in "./cfg". Please specify one using -path.')
}
// mut found_files := []string
// for file in os.ls(cfg_dir) or { []string{} } {
// if file.ends_with('.heroscript') {
// found_files << os.join_path(cfg_dir, file)
// }
// }
// if found_files.len == 1 {
// heroscript_source_path = found_files[0]
// os.mkdir_all(build_cfg_dir)!
// os.cp(heroscript_source_path, target_heroscript_path)!
// } else if found_files.len == 0 {
// return error('Flag -path not provided and no *.heroscript file found in "./cfg".')
// } else {
// return error('Flag -path not provided and multiple *.heroscript files found in "./cfg". Please specify one using -path.')
// }
}
@@ -181,7 +181,7 @@ fn cmd_docusaurus_execute(cmd Command) ! {
mut docs := docusaurus.new(
update: update
build_path: build_path
heroscript: os.read_file(target_heroscript_path)! // Read the copied heroscript
// heroscript: os.read_file(target_heroscript_path)! // Read the copied heroscript
)!
mut site := docs.get(

View File

@@ -95,10 +95,10 @@ pub fn (mut s DocSite) dev() ! {
console.print_item(' 3. To list all screens: screen -ls')
console.print_item('The site content is on::')
console.print_item(' 1. location of documents: ${s.path_src.path}/docs')
if osal.cmd_exists('code') {
console.print_item(' 2. We opened above dir in vscode.')
osal.exec(cmd: 'code ${s.path_src.path}/docs')!
}
// if osal.cmd_exists('code') {
// console.print_item(' 2. We opened above dir in vscode.')
// osal.exec(cmd: 'code ${s.path_src.path}/docs')!
// }
// Start the watcher in a separate thread
// mut tf:=spawn watch_docs(docs_path, s.path_src.path, s.path_build.path)

View File

@@ -48,6 +48,7 @@ pub fn (mut f DocusaurusFactory) get(args_ DSiteGetArgs) !&DocSite {
mut r := gs.get_repo(
url: 'https://github.com/freeflowuniverse/docusaurus_template.git'
reset: args.update
)!
mut template_path := r.patho()!
@@ -58,17 +59,17 @@ pub fn (mut f DocusaurusFactory) get(args_ DSiteGetArgs) !&DocSite {
} else if f.config.main.title != '' {
// Use the factory's config from heroscript if available
generate_configuration(args.path, f.config)!
} else {
// Then ensure cfg directory exists in src,
if !os.exists('${args.path}/cfg') {
if args.init {
// else copy config from template
mut template_cfg := template_path.dir_get('cfg')!
template_cfg.copy(dest: '${args.path}/cfg')!
} else {
return error("Can't find cfg dir in chosen docusaurus location: ${args.path}")
}
}
// } else {
// // Then ensure cfg directory exists in src,
// if !os.exists('${args.path}/cfg') {
// if args.init {
// // else copy config from template
// mut template_cfg := template_path.dir_get('cfg')!
// template_cfg.copy(dest: '${args.path}/cfg')!
// } else {
// return error("Can't find cfg dir in chosen docusaurus location: ${args.path}")
// }
// }
}
if !os.exists('${args.path}/docs') {
if args.init {

View File

@@ -25,8 +25,8 @@ pub mut:
build_path string
production bool
update bool
heroscript string
heroscript_path string
// heroscript string
// heroscript_path string
}
pub fn new(args_ DocusaurusArgs) !&DocusaurusFactory {