CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / Python lint (push) Successful in 2s
CI & Build / TypeScript typecheck (push) Failing after 21s
CI & Build / Python tests (push) Successful in 1m55s
CI & Build / integration (push) Successful in 2m2s
CI & Build / Build & push image (push) Skipped
A rule now carries what it does when it arrives, declared by its author rather than guessed from a score: enforce (the act is checked), hold (the reply or act waits for one read) or inform (a line beside the work, the default). And a salience, high, normal or low, for ranking among rules of the same enforcement at a crowded moment. A preference is always inform. Migration 0128 adds both with CHECKs. Every door carries them: the service, the MCP create and update tools, REST, backup and restore, and the rule editor, which also marks holding and enforced rules in the list. Unknown values are refused rather than mapped. Nothing reads them yet beyond the record; the ordering function and the lifecycle come next in this step, and step 5 decides who holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
103 lines
5.0 KiB
Vue
103 lines
5.0 KiB
Vue
<script setup lang="ts">
|
|
import type { RuleHeader } from "@/api/rulebooks";
|
|
import UsageBadge from "@/components/UsageBadge.vue";
|
|
import { DEAD_WEIGHT_ADVICE } from "@/utils/deadWeight";
|
|
|
|
defineProps<{ topicId: number; rules: RuleHeader[] }>();
|
|
const emit = defineEmits<{
|
|
"open-rule": [id: number];
|
|
"create-rule": [topicId: number];
|
|
}>();
|
|
</script>
|
|
|
|
<template>
|
|
<section class="pane">
|
|
<header><h2>Rules</h2></header>
|
|
<ul>
|
|
<li v-for="r in rules" :key="r.id" @click="emit('open-rule', r.id)">
|
|
<div class="title" :class="{ 'is-preference': r.kind === 'preference' }">
|
|
{{ r.title }}
|
|
<!-- Force is stated, never inferred. A preference does not bind and
|
|
is the one kind a session rewrites on its own, so an unmarked
|
|
row would teach the opposite of both. Rules carry no chip:
|
|
they are the default reading of a rulebook, and marking every
|
|
row marks nothing. -->
|
|
<span
|
|
v-if="r.kind === 'preference'"
|
|
class="rule-chip rule-chip-preference"
|
|
title="How you want work done. It does not bind, and Grimoire updates it as the work teaches it."
|
|
>preference</span>
|
|
<!-- Marked only when the rule stops the work: a line beside the work
|
|
is the default, and marking it on every row would mark nothing. -->
|
|
<span
|
|
v-if="r.enforcement === 'hold' || r.enforcement === 'enforce'"
|
|
class="rule-chip"
|
|
:title="r.enforcement === 'hold'
|
|
? 'The reply or act it governs waits for one read of it'
|
|
: 'The act it governs is checked against it'"
|
|
>{{ r.enforcement === "hold" ? "holds" : "enforced" }}</span>
|
|
<!-- Marked only when something is WRONG: every rule arrives by
|
|
retrieval now, so "conditional" stopped distinguishing anything.
|
|
A missing trigger does — it means nothing can retrieve this. -->
|
|
<span
|
|
v-if="!r.when_to_apply"
|
|
class="rule-chip rule-chip-inert"
|
|
title="No trigger, so nothing can retrieve it — this rule will never reach a session"
|
|
>never surfaces</span>
|
|
<!-- Present only on a rule carrying a check, so the chip's very
|
|
presence says "this one asserts a fact that can go false". -->
|
|
<span
|
|
v-if="r.last_verified"
|
|
class="rule-chip check-chip"
|
|
:class="{ unchecked: r.last_verified === 'never' }"
|
|
:title="r.last_verified === 'never'
|
|
? 'Asserts a fact nobody has confirmed yet'
|
|
: `Check last passed ${r.last_verified}`"
|
|
>{{ r.last_verified === "never" ? "unverified" : `checked ${r.last_verified}` }}</span>
|
|
<UsageBadge :usage="r.usage" :dead-weight-advice="DEAD_WEIGHT_ADVICE.rule" />
|
|
</div>
|
|
<div class="statement">{{ r.statement }}</div>
|
|
<div v-if="r.when_to_apply || r.updated_at" class="meta">
|
|
<span v-if="r.when_to_apply" class="trigger">{{ r.when_to_apply }}</span>
|
|
<span v-if="r.updated_at" class="age" :title="`Last changed ${r.updated_at}`">{{ r.updated_at }}</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<button class="new-rule" @click="emit('create-rule', topicId)">+ New rule</button>
|
|
</section>
|
|
</template>
|
|
|
|
<style src="@/assets/rules-shared.css" />
|
|
<style scoped>
|
|
ul { list-style: none; padding: 0; margin: 1rem 0; }
|
|
li {
|
|
padding: 0.75rem;
|
|
cursor: pointer;
|
|
border-radius: 6px;
|
|
border-left: 2px solid var(--fs-accent);
|
|
margin-bottom: 0.5rem;
|
|
background: rgba(255, 255, 255, 0.02);
|
|
}
|
|
li:hover { background: var(--fs-surface-hover); }
|
|
.title { font-family: Fraunces, serif; font-style: italic; font-size: 1.05em; }
|
|
/* The chip says which kind; this says it again at a glance, for scanning a
|
|
long topic rather than reading one row. Weight, not colour — the chip
|
|
already carries the accent, and a second coloured thing would compete
|
|
with it for the same job. */
|
|
.title.is-preference { font-weight: 500; }
|
|
|
|
.statement { font-size: 0.9em; opacity: 0.8; margin-top: 0.25rem; }
|
|
.meta { display: flex; align-items: baseline; gap: 0.5rem; margin-top: 0.35rem; font-size: 0.75em; }
|
|
.trigger { flex: 1; min-width: 0; color: var(--fs-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
.age { color: var(--fs-text-tertiary); font-variant-numeric: tabular-nums; flex-shrink: 0; }
|
|
/* Only the departures from .rule-chip (rules-shared.css) live here. */
|
|
.check-chip { font-variant-numeric: tabular-nums; }
|
|
/* No age-graded colour on purpose. The sweep is already ordered by urgency, so
|
|
a red/amber ramp would restate the ordering AND require an invented "stale
|
|
after N days" threshold — a magic number nobody could defend and the first
|
|
thing to go out of date. Only "never" is marked, because it is categorically
|
|
different from a date rather than a worse one. */
|
|
.check-chip.unchecked { font-style: italic; color: var(--fs-text-tertiary); }
|
|
.new-rule { cursor: pointer; }
|
|
</style>
|