Files
whetstone_DSL/editor/src/PolyApiProject.h
Bill 1f1234b28b Sprint 272: fitness-routed polyglot test projects — Phase 2 (steps 1888-1892)
Added PolyglotProjectSpec data model and three concrete 2-language test
project fixtures, all routing correctly via LanguageFitnessScorer.

New headers:
- PolyglotProjectSpec.h: PolyglotInterface, PolyglotSection, PolyglotProjectSpec,
  PolyglotFitnessRouter (explicit override + auto-routing via scorer)
- PolySortProject.h: sort-core → Rust, data-gen → Python
- PolyApiProject.h: http-server → Go, api-client → TypeScript
- PolyParseProject.h: lexer → C++, ast-transform → Haskell
- Sprint272IntegrationSummary.h

25/25 tests passing (steps 1888-1892). All new headers ≤ 600 lines.
tools/claude/tools.json: added whetstone_score_language_fitness (tool 91).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 14:17:33 -07:00

44 lines
1.8 KiB
C++

#pragma once
#include "PolyglotProjectSpec.h"
namespace whetstone {
class PolyApiProject {
public:
// Returns a fully-populated poly-api PolyglotProjectSpec.
// http-server (FlatLoop/Channels/Blocking/None) → Go
// api-client (FlatLoop/None/Async/SimpleGenerics) → TypeScript
static PolyglotProjectSpec make() {
PolyglotProjectSpec spec;
spec.projectName = "poly-api";
PolyglotSection httpServer;
httpServer.componentName = "http-server";
httpServer.features.mutationRatio = 0.30f;
httpServer.features.recursionShape = ASTFeatures::RecursionShape::FlatLoop;
httpServer.features.concurrencyPrimitive = ASTFeatures::ConcurrencyPrimitive::Channels;
httpServer.features.ioPattern = ASTFeatures::IOPattern::Blocking;
httpServer.features.typeComplexity = ASTFeatures::TypeComplexity::None;
spec.sections.push_back(httpServer);
PolyglotSection apiClient;
apiClient.componentName = "api-client";
apiClient.features.mutationRatio = 0.20f;
apiClient.features.recursionShape = ASTFeatures::RecursionShape::FlatLoop;
apiClient.features.concurrencyPrimitive = ASTFeatures::ConcurrencyPrimitive::None;
apiClient.features.ioPattern = ASTFeatures::IOPattern::Async;
apiClient.features.typeComplexity = ASTFeatures::TypeComplexity::SimpleGenerics;
spec.sections.push_back(apiClient);
PolyglotInterface iface;
iface.fromComponent = "api-client";
iface.toComponent = "http-server";
iface.description = "JSON REST calls";
spec.interfaces.push_back(iface);
return spec;
}
};
} // namespace whetstone