Skip to content
Open
Changes from 1 commit
Commits
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
Pass resolver snapshot into lookupActiveLayerForCommand
Co-authored-by: nicolehaugen <10600161+nicolehaugen@users.noreply.github.com>
  • Loading branch information
Copilot and nicolehaugen authored Aug 26, 2026
commit f69df09f15b39f492efe5bffee123a80aa384e0b
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export function resolvePipelineEntry(id, snapshot) {
// (state.json has status:"done", artifactPath set). Mirrors the
// extension branch below.
const scanned = snapshot?.phases?.[id] ?? null;
const active = lookupActiveLayerForCommand({ id, commandName: `speckit.${id}` });
const active = lookupActiveLayerForCommand({ id, commandName: `speckit.${id}` }, snapshot);
return {
kind: "core",
id,
Expand Down Expand Up @@ -237,7 +237,7 @@ export function resolvePipelineEntry(id, snapshot) {
// there so the phase card renders a live "Writes to" link the same
// way core phases do.
const scanned = snapshot?.phases?.[id] ?? null;
const active = lookupActiveLayerForCommand({ id, commandName: extResolved.commandName });
const active = lookupActiveLayerForCommand({ id, commandName: extResolved.commandName }, snapshot);
return {
kind: "extension",
id,
Expand Down Expand Up @@ -929,10 +929,13 @@ export function commandSourcePath(p) {
// Look up the winning composition layer for a phase, using phase-discovery
// semantics: prefer the "commands/<commandName>" artifact, falling back to
// the phase `id` (either "commands/<name>" or a bare phase id).
export function lookupActiveLayerForCommand(p) {
// `snapshot` defaults to the global state snapshot for UI-only callers;
// snapshot-pure callers (e.g. resolvePipelineEntry) must pass their own so
// the resolved layer comes from the same snapshot as the rest of the data.
export function lookupActiveLayerForCommand(p, snapshot = state.snapshot) {
const id = p?.id;
const commandName = p?.commandName;
const compArtifacts = state.snapshot?.composition?.artifacts ?? [];
const compArtifacts = snapshot?.composition?.artifacts ?? [];
const cmdLookupId = commandName ? `commands/${commandName}` : null;
const compArtifact =
(cmdLookupId && compArtifacts.find((a) => a.id === cmdLookupId)) ||
Expand Down