MCPcopy Create free account
hub / github.com/coi/coi / dev_project

Function dev_project

src/cli/cli.cc:571–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

569}
570
571int dev_project(bool keep_cc, bool cc_only, bool hot_reloading)
572{
573 print_banner("dev");
574
575 // First build (silent banner since dev already showed one)
576 int ret = build_project(keep_cc, cc_only, true);
577 if (ret != 0)
578 {
579 return ret;
580 }
581
582 fs::path project_dir = fs::current_path();
583 fs::path dist_dir = project_dir / "dist";
584 fs::path exe_dir = get_executable_dir();
585 fs::path coi_bin = exe_dir / "coi";
586 fs::path dev_script = exe_dir / "scripts" / "dev_server.py";
587
588 std::cout << " " << GREEN << "➜" << RESET << " Local: " << CYAN << BOLD << "http://localhost:8000" << RESET << std::endl;
589 if (!hot_reloading)
590 {
591 std::cout << " " << DIM << "↻ Hot reload: disabled" << RESET << std::endl;
592 }
593 std::cout << " " << DIM << "Press Ctrl+C to stop" << RESET << std::endl;
594 std::cout << std::endl;
595
596 if (!fs::exists(dev_script))
597 {
598 ErrorHandler::cli_error("Dev server script not found.",
599 "Expected at: " + dev_script.string());
600 return 1;
601 }
602
603 std::string cmd = "python3 " + dev_script.string() +
604 " " + project_dir.string() +
605 " " + coi_bin.string() +
606 " " + dist_dir.string();
607
608 if (!hot_reloading) cmd += " --no-watch";
609 if (keep_cc) cmd += " --keep-cc";
610 if (cc_only) cmd += " --cc-only";
611
612 return system(cmd.c_str());
613}
614
615void print_version()
616{

Callers 1

mainFunction · 0.85

Calls 3

print_bannerFunction · 0.85
build_projectFunction · 0.85
get_executable_dirFunction · 0.85

Tested by

no test coverage detected