feat(family): platforms declared at inception and detected from bound repos (milestone 463 step 2, #4988)
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
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>
This commit is contained in:
@@ -6,10 +6,16 @@
|
||||
* second step and only emits the choices (the project does not exist yet);
|
||||
* mode="decide" sits on ProjectView for an undecided project, loads that
|
||||
* project's current defaults, and records the decision itself.
|
||||
*
|
||||
* Platforms (milestone 463) start UNANSWERED (null). Ticking any box makes
|
||||
* the list the whole answer; in decide mode the boxes start from what
|
||||
* detection already found, so recording confirms it.
|
||||
*/
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { apiErrorMessage } from "@/api/client";
|
||||
import { fetchDesignSystems } from "@/api/designSystems";
|
||||
import { MEMBER_STATES } from "@/api/platforms";
|
||||
import { usePlatformsStore } from "@/stores/platforms";
|
||||
import {
|
||||
decideInception, emptyChoices, fetchInceptionDefaults,
|
||||
type InceptionChoices, type InceptionDecision, type InceptionDefaults,
|
||||
@@ -29,6 +35,9 @@ const emit = defineEmits<{
|
||||
const local = ref<InceptionChoices>(props.choices ? { ...props.choices } : emptyChoices());
|
||||
const designSystems = ref<{ id: number; title: string }[]>([]);
|
||||
const systemsCount = ref(0);
|
||||
const platforms = ref<{ slug: string; name: string }[]>([]);
|
||||
const detected = ref<Set<string>>(new Set());
|
||||
const platformsStore = usePlatformsStore();
|
||||
const loading = ref(true);
|
||||
const saving = ref(false);
|
||||
const error = ref("");
|
||||
@@ -46,11 +55,25 @@ async function load() {
|
||||
const d: InceptionDefaults = await fetchInceptionDefaults(props.projectId);
|
||||
designSystems.value = d.design_systems;
|
||||
systemsCount.value = d.systems;
|
||||
platforms.value = d.platforms;
|
||||
const members = d.project_platforms
|
||||
.filter((p) => MEMBER_STATES.includes(p.state))
|
||||
.map((p) => p.slug);
|
||||
detected.value = new Set(
|
||||
d.project_platforms.filter((p) => p.state === "detected").map((p) => p.slug),
|
||||
);
|
||||
// Start from what stands today, so "record" without changes keeps it.
|
||||
local.value = { design_system_id: d.design_system_id, seed_systems: false };
|
||||
local.value = {
|
||||
design_system_id: d.design_system_id,
|
||||
seed_systems: false,
|
||||
platforms: members.length ? members : null,
|
||||
};
|
||||
} else {
|
||||
const ds = await fetchDesignSystems();
|
||||
const [ds, catalog] = await Promise.all([
|
||||
fetchDesignSystems(), platformsStore.fetchCatalog(),
|
||||
]);
|
||||
designSystems.value = ds.design_systems.map((d) => ({ id: d.id, title: d.title }));
|
||||
platforms.value = catalog.map((p) => ({ slug: p.slug, name: p.name }));
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
error.value = apiErrorMessage(e, "Could not load what this project could inherit");
|
||||
@@ -61,6 +84,22 @@ async function load() {
|
||||
|
||||
const nothingToDecide = computed(() => !designSystems.value.length);
|
||||
|
||||
function isChecked(slug: string): boolean {
|
||||
return (local.value.platforms ?? []).includes(slug);
|
||||
}
|
||||
|
||||
function togglePlatform(slug: string, on: boolean) {
|
||||
const current = new Set(local.value.platforms ?? []);
|
||||
if (on) current.add(slug);
|
||||
else current.delete(slug);
|
||||
local.value.platforms = [...current].sort();
|
||||
}
|
||||
|
||||
/** Back to "not answered" — distinct from an empty list, which says "none". */
|
||||
function clearPlatforms() {
|
||||
local.value.platforms = null;
|
||||
}
|
||||
|
||||
async function record() {
|
||||
if (!props.projectId) return;
|
||||
saving.value = true;
|
||||
@@ -105,6 +144,31 @@ onMounted(load);
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div v-if="platforms.length" class="inception-group">
|
||||
<h4>Platforms</h4>
|
||||
<p class="inception-muted">
|
||||
What it is built on or ships as. Ideas the family has proven for a
|
||||
platform reach every project that is one.
|
||||
<template v-if="local.platforms === null"> Not answered yet.</template>
|
||||
<template v-else>
|
||||
Anything left unticked is recorded as "not this project".
|
||||
<button type="button" class="btn-ghost btn-sm" @click="clearPlatforms">Leave unanswered</button>
|
||||
</template>
|
||||
</p>
|
||||
<div class="inception-platforms">
|
||||
<label v-for="p in platforms" :key="p.slug" class="inception-choice">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="isChecked(p.slug)"
|
||||
@change="togglePlatform(p.slug, ($event.target as HTMLInputElement).checked)"
|
||||
/>
|
||||
<span>
|
||||
{{ p.name }}
|
||||
<em v-if="detected.has(p.slug)" class="inception-muted"> — detected</em>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="nothingToDecide" class="inception-muted">
|
||||
No design systems on this install yet — recording still settles the question.
|
||||
</p>
|
||||
@@ -132,6 +196,11 @@ onMounted(load);
|
||||
.inception-group h4 { margin: 0 0 0.35rem; font-size: 0.9rem; font-weight: 500; }
|
||||
.inception-choice { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.9rem; margin: 0.25rem 0; }
|
||||
.inception-choice input { margin-top: 0.2rem; accent-color: var(--fs-accent); }
|
||||
.inception-platforms {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
|
||||
gap: 0 1rem;
|
||||
}
|
||||
.inception-select {
|
||||
padding: 0.45rem 0.7rem;
|
||||
border: 1px solid var(--fs-border-color);
|
||||
|
||||
Reference in New Issue
Block a user