CI & Build / Python lint (push) Successful in 4s
CI & Build / Plugin hooks (push) Successful in 21s
CI & Build / TypeScript typecheck (push) Successful in 1m10s
CI & Build / integration (push) Successful in 1m48s
CI & Build / Python tests (push) Successful in 2m40s
CI & Build / Build & push image (push) Failing after 44s
A project's platforms decide which family ideas reach it. This step makes membership answerable from every door: - services/platforms.py: the global catalog (writes are admin-only and duplicate-gated by slug); pure marker detection; and membership reads and writes. Detection only ADDS, and only where nobody has answered. It never overrides a declared or rejected row and never removes one. - coverage: the archive scan now carries every path, and the refresh runs detection fail-open. - inception: a platforms choice (slugs, or null for unanswered). The list is the whole answer: members left out of it become rejected. - MCP: list_platforms and set_project_platforms; enter_project and get_project carry the project's platforms. - REST: /api/platforms (admin writes) and /api/projects/<id>/platforms. - UI: a platforms checklist on the inception card, a Family tab on ProjectView, and a Platforms admin tab in Settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
2.6 KiB
TypeScript
78 lines
2.6 KiB
TypeScript
/**
|
|
* Platforms — what a project is built on or ships as (milestone 463).
|
|
*
|
|
* The catalog is GLOBAL, like the canonical areas, and admin-written. A
|
|
* project's answer per platform is `declared` (a person said so), `detected`
|
|
* (a marker file in a bound repo said so) or `rejected` (a person said no —
|
|
* kept, so the next refresh cannot detect it back). Only declared and
|
|
* detected make a project a member, and membership is what decides which
|
|
* family ideas reach it.
|
|
*/
|
|
import { apiGet, apiPatch, apiPost, apiPut } from "@/api/client";
|
|
|
|
export interface Platform {
|
|
id: number;
|
|
name: string;
|
|
/** The match key, and the name every door takes (stable across restores). */
|
|
slug: string;
|
|
description: string | null;
|
|
/** Repo-relative globs. A bare name matches a basename anywhere; one with
|
|
* a slash matches the whole path. Empty = declare-only. */
|
|
markers: string[];
|
|
order_index: number;
|
|
created_at: string | null;
|
|
updated_at: string | null;
|
|
}
|
|
|
|
export type PlatformState = "declared" | "detected" | "rejected";
|
|
/** What a person may set. `null` withdraws the answer. */
|
|
export type SettablePlatformState = "declared" | "rejected" | null;
|
|
|
|
export interface ProjectPlatform {
|
|
id: number;
|
|
slug: string;
|
|
name: string;
|
|
state: PlatformState;
|
|
}
|
|
|
|
export const MEMBER_STATES: PlatformState[] = ["declared", "detected"];
|
|
|
|
export async function listPlatforms(): Promise<Platform[]> {
|
|
const data = await apiGet<{ platforms: Platform[] }>("/api/platforms");
|
|
return data.platforms;
|
|
}
|
|
|
|
/** Admin only. A name that reduces to an existing slug answers 409. */
|
|
export async function createPlatform(data: {
|
|
name: string;
|
|
description?: string;
|
|
markers?: string[];
|
|
}): Promise<Platform> {
|
|
return apiPost("/api/platforms", data);
|
|
}
|
|
|
|
export async function updatePlatform(
|
|
id: number,
|
|
data: Partial<{ name: string; description: string; order_index: number; markers: string[] }>,
|
|
): Promise<Platform> {
|
|
return apiPatch(`/api/platforms/${id}`, data);
|
|
}
|
|
|
|
export async function fetchProjectPlatforms(projectId: number): Promise<ProjectPlatform[]> {
|
|
const data = await apiGet<{ project_platforms: ProjectPlatform[] }>(
|
|
`/api/projects/${projectId}/platforms`,
|
|
);
|
|
return data.project_platforms;
|
|
}
|
|
|
|
/** Only the slugs named change; the update applies whole or not at all. */
|
|
export async function setProjectPlatforms(
|
|
projectId: number,
|
|
platforms: Record<string, SettablePlatformState>,
|
|
): Promise<ProjectPlatform[]> {
|
|
const data = await apiPut<{ project_platforms: ProjectPlatform[] }>(
|
|
`/api/projects/${projectId}/platforms`, { platforms },
|
|
);
|
|
return data.project_platforms;
|
|
}
|