Checkpoint 2: integrate native Editor, MCP, gameplay builds and standalone export

This commit is contained in:
Emil
2026-09-18 03:40:15 +03:00
parent 5c6b24d34d
commit 999686a896
125 changed files with 16086 additions and 1714 deletions
+14 -7
View File
@@ -5,16 +5,23 @@
namespace faset {
class Error : public std::runtime_error {
public:
public:
Error(std::string code, std::string message, Json details = Json::object())
: std::runtime_error(std::move(message)), code_(std::move(code)), details_(std::move(details)) {}
const std::string& code() const noexcept { return code_; }
Json json() const { return {{"code", code_}, {"message", what()}, {"details", details_}}; }
private:
: std::runtime_error(std::move(message)), code_(std::move(code)),
details_(std::move(details)) {}
const std::string& code() const noexcept {
return code_;
}
Json json() const {
return {{"code", code_}, {"message", what()}, {"details", details_}};
}
private:
std::string code_;
Json details_;
};
inline void require(bool condition, const std::string& code, const std::string& message) {
if (!condition) throw Error(code, message);
}
if (!condition)
throw Error(code, message);
}
} // namespace faset
+1 -1
View File
@@ -11,4 +11,4 @@ inline std::string sha256(std::string_view text) {
return sha256(std::as_bytes(std::span(text.data(), text.size())));
}
std::string sha256_file(const std::filesystem::path& path);
}
} // namespace faset
+3 -2
View File
@@ -11,5 +11,6 @@ Json read_json(const std::filesystem::path& path);
void atomic_write(const std::filesystem::path& path, std::string_view bytes);
void atomic_write_json(const std::filesystem::path& path, const Json& value);
// Rejects traversal and symlink escapes before project-scoped file operations.
std::filesystem::path project_path(const std::filesystem::path& root, const std::filesystem::path& relative);
}
std::filesystem::path project_path(const std::filesystem::path& root,
const std::filesystem::path& relative);
} // namespace faset
+3 -1
View File
@@ -1,3 +1,5 @@
#pragma once
#include <nlohmann/json.hpp>
namespace faset { using Json = nlohmann::json; }
namespace faset {
using Json = nlohmann::json;
}
+38
View File
@@ -0,0 +1,38 @@
#pragma once
#include <filesystem>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>
namespace faset {
struct ProcessOptions {
// First element is the executable. Arguments are passed directly, never through a shell.
std::vector<std::string> arguments;
std::filesystem::path working_directory;
std::map<std::string, std::string> environment;
};
struct ProcessPoll {
bool running{};
std::optional<int> exit_code;
std::string output; // Newly available stdout and stderr, combined.
};
class Process {
public:
explicit Process(const ProcessOptions&);
~Process();
Process(Process&&) noexcept;
Process& operator=(Process&&) noexcept;
Process(const Process&) = delete;
Process& operator=(const Process&) = delete;
ProcessPoll poll();
// Terminates the process group/job, including its compiler children.
void cancel();
private:
struct Impl;
std::unique_ptr<Impl> impl_;
};
std::filesystem::path find_executable(const std::string& name);
} // namespace faset