Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
project.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <QtCore/QJsonObject>
7#include <QtCore/QString>
8
9namespace Sonde::Cli {
10
12inline constexpr QLatin1StringView kProjectDir{ ".sonde" };
13
15struct Project
16{
17 QString root;
18
20 QString config() const { return root + QStringLiteral("/.sonde/config.json"); }
22 QString local() const { return root + QStringLiteral("/.sonde/local.json"); }
24 QString state() const { return root + QStringLiteral("/.sonde/state"); }
26 QString endpointFile() const { return state() + QStringLiteral("/endpoint.json"); }
27
29 void makeState() const;
30};
31
34Project findProject(const QString &explicitConfig);
35
37QJsonObject readJsonObject(const QString &path);
38
41QJsonObject mergeConfig(QJsonObject config, const QJsonObject &local);
42
44QString configError(const QJsonObject &config, const QString &path);
45
48QJsonObject loadConfig(const Project &project);
49
50} // namespace Sonde::Cli
constexpr QLatin1StringView kProjectDir
The directory a project keeps its files in, at its root.
Definition project.h:12
Where a project keeps its files: .sonde/ at its root.
Definition project.h:16
void makeState() const
Creates the state directory, and .sonde/.gitignore beside it.
Definition project.cpp:40
QString config() const
.sonde/config.json.
Definition project.h:20
QString root
The project's root directory, absolute, with '/' separators.
Definition project.h:17
QString local() const
.sonde/local.json.
Definition project.h:22
QString endpointFile() const
.sonde/state/endpoint.json.
Definition project.h:26
QString state() const
.sonde/state.
Definition project.h:24