Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2350e2b
docs: design read-only IDE snapshot protocol
wellwei Aug 5, 2026
9933126
docs: plan read-only IDE snapshot implementation
wellwei Aug 5, 2026
210a31b
feat(ide): define snapshot protocol model
wellwei Aug 5, 2026
3885a63
fix(ide): align snapshot fixture contract
wellwei Aug 5, 2026
9759acf
feat(ide): inspect workspaces without side effects
wellwei Aug 5, 2026
1ad07f9
fix(ide): restrict workspace package selector aliases
wellwei Aug 5, 2026
5336e9f
fix(ide): harden workspace inspection paths
wellwei Aug 5, 2026
68e1bbb
fix(ide): contain workspace inspection paths
wellwei Aug 6, 2026
1b6b6a1
feat(ide): serialize versioned workspace snapshots
wellwei Aug 6, 2026
4e99879
feat(cli): add read-only ide snapshot command
wellwei Aug 6, 2026
fee82fe
test(ide): prove snapshot is read only
wellwei Aug 6, 2026
c58bdf4
docs(ide): define universal project model and early CDB plan
wellwei Aug 6, 2026
e8dbd2c
feat(ide): define configuration and event protocol
wellwei Aug 6, 2026
0c9c2e4
feat(build): add fresh compile database publication
wellwei Aug 6, 2026
54faf3e
feat(ide): publish compile database before build
wellwei Aug 6, 2026
1e8f1f4
fix(ide): stage module prerequisites before publishing cdb
wellwei Aug 6, 2026
67587e3
test(ide): gate llvm configure e2e and track release version
wellwei Aug 6, 2026
18f41e8
docs(ide): record configure validation boundaries
wellwei Aug 6, 2026
b2d092b
fix(ide): keep configure events machine-readable
wellwei Aug 7, 2026
9ae6d9f
fix(ide): make configure publication portable
wellwei Aug 7, 2026
458c1a0
chore(release): bootstrap pin -> 2026.8.6.3
wellwei Aug 7, 2026
bd3843d
fix(ide): harden configured snapshot publication
wellwei Aug 7, 2026
50daf50
fix(test): preserve best-effort test inventory
wellwei Aug 7, 2026
10c8142
fix(ide): distinguish publication lock failures
wellwei Aug 7, 2026
0e519e0
docs(ide): document protocol and client lifecycle
wellwei Aug 7, 2026
07bbc16
docs(ide): clarify client trust and protocol limits
wellwei Aug 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(ide): define snapshot protocol model
  • Loading branch information
wellwei committed Aug 7, 2026
commit 210a31b485d46bf30e9fb4e3af783adc12e6edfd
115 changes: 115 additions & 0 deletions src/ide/model.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
export module mcpp.ide.model;

import std;

export namespace mcpp::ide {

enum class SnapshotState {
Partial,
Stale,
Unavailable,
Ready,
};

enum class ArtifactState {
Missing,
Stale,
};

enum class Severity {
Warning,
Error,
};

std::string_view wire_name(SnapshotState state) {
switch (state) {
case SnapshotState::Partial: return "partial";
case SnapshotState::Stale: return "stale";
case SnapshotState::Unavailable: return "unavailable";
case SnapshotState::Ready: return "ready";
}
return {};
}

std::string_view wire_name(ArtifactState state) {
switch (state) {
case ArtifactState::Missing: return "missing";
case ArtifactState::Stale: return "stale";
}
return {};
}

std::string_view wire_name(Severity severity) {
switch (severity) {
case Severity::Warning: return "warning";
case Severity::Error: return "error";
}
return {};
}

struct Position {
std::size_t line = 0;
std::size_t column = 0;
};

struct Range {
Position start;
Position end;
};

struct Diagnostic {
std::string code;
Severity severity = Severity::Error;
std::string message;
std::filesystem::path path;
std::optional<Range> range;
};

struct Selectors {
std::optional<std::string> package;
bool workspace = false;
std::optional<std::string> profile;
std::optional<std::string> target;
std::vector<std::string> features;
std::vector<std::string> capabilities;
bool includeDevDependencies = false;
};

struct InspectRequest {
std::filesystem::path start;
Selectors selectors;
};

struct DeclaredTarget {
std::string name;
std::string kind;
std::optional<std::string> main;
};

struct WorkspaceMember {
std::string name;
std::string version;
std::string workspacePath;
std::filesystem::path root;
std::filesystem::path manifest;
std::vector<DeclaredTarget> targets;
};

struct CompileCommandsArtifact {
std::string member;
std::filesystem::path path;
ArtifactState state = ArtifactState::Missing;
};

struct WorkspaceInspection {
SnapshotState state = SnapshotState::Unavailable;
InspectRequest request;
std::filesystem::path workspaceRoot;
std::filesystem::path workspaceManifest;
std::vector<WorkspaceMember> members;
std::vector<std::string> selectedMembers;
std::vector<CompileCommandsArtifact> compileCommands;
std::vector<Diagnostic> diagnostics;
};

} // namespace mcpp::ide
71 changes: 71 additions & 0 deletions tests/fixtures/ide/snapshot-v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"schemaVersion": 1,
"kind": "mcpp.ide.snapshot",
"snapshotId": "fnv1a64:0000000000000000",
"state": "partial",
"mcppVersion": "2026.8.5.2",
"protocol": {
"min": 1,
"max": 1
},
"capabilities": [
"workspace-inspection",
"manifest-diagnostics",
"compile-commands-location"
],
"request": {
"start": "/workspace/app",
"mode": "read-only",
"selectors": {
"package": null,
"workspace": false,
"profile": null,
"target": null,
"features": [],
"capabilities": [],
"includeDevDependencies": false
}
},
"workspace": {
"root": "/workspace/app",
"manifest": "/workspace/app/mcpp.toml",
"members": [
{
"name": "app",
"version": "1.0.0",
"workspacePath": ".",
"root": "/workspace/app",
"manifest": "/workspace/app/mcpp.toml",
"targets": [
{
"name": "app",
"kind": "binary",
"main": "src/main.cpp"
}
]
}
],
"selectedMembers": [
"app"
]
},
"artifacts": {
"state": "partial",
"compileCommands": [
{
"member": "app",
"path": "/workspace/app/compile_commands.json",
"state": "missing"
}
]
},
"diagnostics": [
{
"code": "MCPP_IDE_ARTIFACTS_MISSING",
"severity": "warning",
"message": "Compile commands are unavailable for one or more selected members.",
"path": "/workspace/app/mcpp.toml",
"range": null
}
]
}
16 changes: 16 additions & 0 deletions tests/unit/test_ide_snapshot.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <gtest/gtest.h>

import std;
import mcpp.ide.model;

TEST(IdeSnapshotModel, WireNamesAreStable) {
using namespace mcpp::ide;
EXPECT_EQ(wire_name(SnapshotState::Partial), "partial");
EXPECT_EQ(wire_name(SnapshotState::Stale), "stale");
EXPECT_EQ(wire_name(SnapshotState::Unavailable), "unavailable");
EXPECT_EQ(wire_name(SnapshotState::Ready), "ready");
EXPECT_EQ(wire_name(ArtifactState::Missing), "missing");
EXPECT_EQ(wire_name(ArtifactState::Stale), "stale");
EXPECT_EQ(wire_name(Severity::Warning), "warning");
EXPECT_EQ(wire_name(Severity::Error), "error");
}