Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ and listed with their assets on the
A service's or container's detail goes to the overview, a command's run
to the command list, since both belong to the lane left.

### Changed

- **The dashboard's "stack file behind" banner is one quiet line and can be
hidden**: neutral instead of blue, one "Bring up to date" button whose
menu holds the other agents, the copy and the prompt, and it says that the
agent skills are older too instead of a second banner. Hidden, it stays
hidden for that stack until the next minor devstack is installed; a patch
release does not bring it back.
- **The agent skills count as outdated only when their text changed**: a new
devstack whose skills read the same, apart from the version in their marker
line and docs links, no longer asks for a refresh (dashboard, `status`,
`doctor`, `skills check`).

### Fixed

- **A lane's memory check looks at Docker Desktop's VM** (#309): on Windows
Expand Down
69 changes: 46 additions & 23 deletions crates/devstack-skills/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//! (`.claude/skills` when it names none). A generated skill says so in a
//! marker line; installing again overwrites it, and `devstack status` (and
//! the dashboard, through the hub) notes when an installed copy, in those
//! folders or another agent's, no longer matches this devstack or this stack
//! file. What is
//! folders or another agent's, no longer matches this devstack's templates or
//! this stack file (a new version alone does not count). What is
//! specific to a project beyond that belongs in a skill of the project's own,
//! which devstack never touches.

Expand Down Expand Up @@ -104,17 +104,19 @@ fn file_name(stack_file: &Path) -> String {
pub fn render_all(stack: &Stack, stack_file: &Path) -> Vec<(&'static str, String)> {
TEMPLATES
.iter()
.map(|(name, tpl)| (*name, render(tpl, stack, stack_file)))
.map(|(name, tpl)| (*name, render(tpl, stack, stack_file, VERSION)))
.collect()
}

fn render(tpl: &str, stack: &Stack, stack_file: &Path) -> String {
/// `version` names the devstack in the marker line and the docs links: this
/// one, or an installed skill's own to tell whether more than that differs.
fn render(tpl: &str, stack: &Stack, stack_file: &Path, version: &str) -> String {
let file = file_name(stack_file);
let vars: Vec<(&str, String)> = vec![
(
"marker",
format!(
"generated by devstack {VERSION} from {file} {MARKER_TAG}: edits here are overwritten; put project specifics into a skill of your own"
"generated by devstack {version} from {file} {MARKER_TAG}: edits here are overwritten; put project specifics into a skill of your own"
),
),
("stack_name", stack.stack.name.clone()),
Expand All @@ -128,7 +130,7 @@ fn render(tpl: &str, stack: &Stack, stack_file: &Path) -> String {
.map_or_else(|| "any version".into(), |r| format!("devstack {r}")),
),
("repo_url", REPO_URL.into()),
("docs_url", format!("{REPO_URL}/blob/v{VERSION}/docs")),
("docs_url", format!("{REPO_URL}/blob/v{version}/docs")),
("services_table", services_table(stack)),
("held_paths", held_paths(stack)),
("commands_table", commands_table(stack)),
Expand Down Expand Up @@ -395,7 +397,9 @@ pub struct Installed {
/// Generated skills found, by folder: `.claude/skills/devstack` (one the
/// project wrote itself is not one).
pub found: Vec<String>,
/// Of those, the ones that differ from what `install` would write now.
/// Of those, the ones that differ from what `install` would write now,
/// apart from the devstack version: a release whose skills read the same
/// leaves them be.
pub outdated: Vec<String>,
/// The oldest devstack their marker lines name: the version the
/// repository was last set up with. `None` when no marker names one.
Expand All @@ -410,22 +414,29 @@ pub fn installed(stack_file: &Path) -> Installed {
let Ok(dirs) = search_dirs(&stack, stack_file) else {
return Installed::default();
};
let rendered = render_all(&stack, stack_file);
let mut out = Installed::default();
for dir in &dirs {
for (name, content) in &rendered {
for (name, tpl) in TEMPLATES {
let Ok(e) = std::fs::read_to_string(dir.join(name).join("SKILL.md")) else {
continue;
};
if !e.contains(MARKER_TAG) {
continue;
}
let at = shown(stack_file, dir, name);
if normalize(&e) != normalize(content) {
// Held against this devstack's text as the version that wrote it.
let version = marker_version(&e);
let content = render(
tpl,
&stack,
stack_file,
version.as_deref().unwrap_or(VERSION),
);
if normalize(&e) != normalize(&content) {
out.outdated.push(at.clone());
}
out.found.push(at);
if let Some(v) = marker_version(&e) {
if let Some(v) = version {
let older = out.from.as_deref().is_none_or(|f| {
devstack_config::version_order(&v) < devstack_config::version_order(f)
});
Expand Down Expand Up @@ -615,7 +626,7 @@ steps = [{ exec = "true" }]
#[test]
fn the_marker_names_the_version_it_was_written_by() {
let s = stack();
let written = render(TEMPLATES[0].1, &s, Path::new("devstack.toml"));
let written = render(TEMPLATES[0].1, &s, Path::new("devstack.toml"), VERSION);
assert_eq!(marker_version(&written).as_deref(), Some(VERSION));
assert_eq!(
marker_version(
Expand Down Expand Up @@ -645,23 +656,35 @@ ours"
assert!(now.outdated.is_empty());
assert_eq!(now.from.as_deref(), Some(VERSION));

// One of them written by an older devstack.
age(&dir.path().join(".claude/skills/devstack/SKILL.md"));
// One of them written by an older devstack whose skill read the same:
// nothing to refresh, but it still says how far back.
let skill = dir.path().join(".claude/skills/devstack/SKILL.md");
age(&skill, false);
let same = installed(&file);
assert!(same.outdated.is_empty(), "{:?}", same.outdated);
assert_eq!(same.from.as_deref(), Some("0.1.0"));

// One whose text has changed since.
install(&stack, &file, None, false).unwrap();
age(&skill, true);
let then = installed(&file);
assert_eq!(then.outdated, [".claude/skills/devstack"]);
assert_eq!(then.from.as_deref(), Some("0.1.0"));
}

const STACK: &str = "version = 1\n[stack]\nname = \"shop\"\n[services.api]\nrun = \"x\"\n";

/// As if an older devstack had written it.
fn age(skill: &Path) {
let text = std::fs::read_to_string(skill).unwrap();
std::fs::write(
skill,
text.replace(&format!("devstack {VERSION} "), "devstack 0.1.0 "),
)
.unwrap();
/// As if an older devstack had written it, with other text than this one
/// when `changed`.
fn age(skill: &Path, changed: bool) {
let mut text = std::fs::read_to_string(skill)
.unwrap()
.replace(&format!("devstack {VERSION} "), "devstack 0.1.0 ")
.replace(&format!("/blob/v{VERSION}/"), "/blob/v0.1.0/");
if changed {
text.push_str("\nA paragraph this devstack no longer writes.\n");
}
std::fs::write(skill, text).unwrap();
}

#[test]
Expand Down Expand Up @@ -690,7 +713,7 @@ ours"
// found and refreshed; the project's own skill there stays.
let github = dir.path().join(".github/skills");
install(&stack, &file, Some(&github), false).unwrap();
age(&github.join("devstack/SKILL.md"));
age(&github.join("devstack/SKILL.md"), true);
std::fs::write(github.join("devstack-config/SKILL.md"), "ours").unwrap();
assert_eq!(outdated(&file), [".github/skills/devstack"]);
install(&stack, &file, None, false).unwrap();
Expand Down
3 changes: 2 additions & 1 deletion docs/stack-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,8 @@ inside the repository and be named once; the list must not be empty.
A generated skill (its marker line says so) is also looked for in the other
agents' folders (`.github/skills`, `.cursor/skills`, `.gemini/skills`, ...):
`devstack status`, `doctor`, `skills check` and the dashboard report one that
no longer matches, and `skills install` refreshes it there. A skill the
no longer matches (a newer devstack whose skills read the same, apart from
its version, does not count), and `skills install` refreshes it there. A skill the
project wrote itself is never touched.

## Placeholders
Expand Down
111 changes: 109 additions & 2 deletions ui/src/components/AgentPrompt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,31 @@
// A prompt for a coding agent, written by the hub (ADR-0046, amendment
// 2026-10-22): copied, shown, or handed to an agent the hub starts in the
// right folder. The page names the prompt and what it is about, never text.
// `compact` fits it into a one-line banner: one button for the first agent,
// the others, the copy and the text in its menu.
import { computed, ref, watch } from 'vue';
import { api, paths } from '@/api';
import type { Opener, PromptKind, PromptTarget } from '@/api/types';
import { act } from '@/lib/actions';
import { useOpenerPrefs } from '@/lib/openers';
import { usePopover } from '@/lib/popover';
import { useHub } from '@/stores/hub';
import { useUi } from '@/stores/ui';
import Icon from './icons/Icon.vue';
import Modal from './Modal.vue';

const props = defineProps<{ kind: PromptKind; target: PromptTarget }>();
const props = defineProps<{ kind: PromptKind; target: PromptTarget; compact?: boolean; label?: string }>();
const hub = useHub();
const ui = useUi();
const prefs = useOpenerPrefs();

const text = ref<string | null>(null);
const problem = ref<string | null>(null);
const starting = ref<string | null>(null);
const showing = ref(false);
const root = ref<HTMLElement | null>(null);
const trigger = ref<HTMLButtonElement | null>(null);
const menu = usePopover(root, trigger);

// Keyed by the request itself: a parent that renders again passes a new
// target object for the same prompt.
Expand All @@ -45,6 +53,7 @@ void hub.loadOpeners();
const agents = computed(() => prefs.shown(hub.openers ?? []).filter((o) => o.prompt));

async function copy() {
menu.close();
if (!text.value) return;
try {
await navigator.clipboard.writeText(text.value);
Expand All @@ -55,6 +64,7 @@ async function copy() {
}

async function start(o: Opener) {
menu.close();
starting.value = o.id;
try {
await act({
Expand All @@ -73,7 +83,41 @@ async function start(o: Opener) {
</script>

<template>
<div class="agent-prompt" data-testid="agent-prompt" :data-kind="kind">
<div v-if="compact" ref="root" class="agent-prompt compact" data-testid="agent-prompt" :data-kind="kind">
<div class="split">
<button
type="button"
class="btn btn-sm btn-primary"
:disabled="!text || !!starting"
:title="problem ? `No prompt: ${problem}` : agents[0] ? `${agents[0].label} works on the prompt; the others, the prompt itself: the arrow` : 'Paste it into your coding agent'"
:data-testid="agents[0] ? `agent-start-${agents[0].id}` : 'agent-copy-prompt'"
@click="agents[0] ? start(agents[0]) : copy()"
>
<span v-if="starting" class="spinner" /><Icon v-else :name="agents[0] ? 'zap' : 'copy'" :size="14" />
{{ agents[0] ? `${label ?? 'Start'} in ${agents[0].label}` : 'Copy prompt' }}
</button>
<button ref="trigger" type="button" class="btn btn-sm btn-primary btn-icon" :disabled="!text" :aria-expanded="menu.open.value" aria-haspopup="true" aria-label="More ways" data-testid="agent-prompt-more" @click="menu.toggle">
<Icon name="chevronDown" :size="14" />
</button>
</div>
<Transition name="drop">
<div v-if="menu.open.value" class="menu" role="menu" data-testid="agent-prompt-menu">
<button v-for="o in agents.slice(1)" :key="o.id" type="button" class="item" role="menuitem" :data-testid="`agent-start-${o.id}`" @click="start(o)">
<Icon name="zap" :size="14" /> {{ o.label }}
</button>
<button v-if="agents.length" type="button" class="item" role="menuitem" data-testid="agent-copy-prompt" @click="copy">
<Icon name="copy" :size="14" /> Copy prompt
</button>
<button type="button" class="item" role="menuitem" data-testid="agent-show-prompt" @click="(menu.close(), (showing = true))">
<Icon name="file" :size="14" /> Show the prompt
</button>
</div>
</Transition>
<Modal :open="showing" title="The prompt" size="lg" testid="agent-prompt-modal" @close="showing = false">
<pre class="text" data-testid="agent-prompt-text">{{ text }}</pre>
</Modal>
</div>
<div v-else class="agent-prompt" data-testid="agent-prompt" :data-kind="kind">
<div class="row">
<button
v-for="(o, i) in agents"
Expand Down Expand Up @@ -104,6 +148,69 @@ async function start(o: Opener) {
.agent-prompt {
margin-top: 8px;
}
.compact {
position: relative;
margin-top: 0;
flex: none;
}
.split {
display: flex;
gap: 1px;
}
.split > .btn:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.split > .btn:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.menu {
position: absolute;
right: 0;
top: calc(100% + 6px);
z-index: 40;
min-width: 200px;
background: var(--bg-elev);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow-lg);
padding: 6px;
}
.item {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
border: 0;
background: transparent;
color: var(--text);
padding: 7px 8px;
border-radius: 8px;
cursor: pointer;
text-align: left;
font-size: 13px;
}
.item:hover,
.item:focus-visible {
background: var(--surface-hover);
}
.text {
white-space: pre-wrap;
font-size: 12px;
margin: 0;
}
.drop-enter-active,
.drop-leave-active {
transition:
opacity 0.12s,
transform 0.12s var(--ease);
}
.drop-enter-from,
.drop-leave-to {
opacity: 0;
transform: translateY(-4px);
}
.row {
display: flex;
gap: 6px;
Expand Down
Loading
Loading