Skip to content
Open
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
20 changes: 20 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ Pick the bump (major / minor / patch) and write a summary — it becomes the cha
entry. On merge to `main`, the release workflow opens (or updates) a "Version Packages" PR;
merging that PR publishes to npm.

## Writing the summary

`changelog.cjs` prints the summary as-is, so write only what a user of the package needs:

- One line per change: what changed, not how or why. The reasoning goes in the PR body.
- Lead with the primitive in brackets (`[Thread]`), shown as a badge in the docs. Leave it off
a line that isn't about one primitive.
- Then a verb (Add, Fix, Improve, Remove) or "New", with API names in code spans.
- A breaking change adds a `[Breaking]` tag and the migration in one sentence. Before 1.0 it
ships as a minor bump, so the tag is what marks it.

```md
---
"@intentface/chat": minor
---

- [Composer] Fix an Escape in one composer stopping generation in another.
- [Composer] [Breaking] Escape stops generation only from inside `Composer.Root`. To stop on any Escape, handle it on your chat container, such as `Thread.Root`.
```

If a package change intentionally needs no release, add an empty changeset instead:

```bash
Expand Down
10 changes: 10 additions & 0 deletions .changeset/changelog.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// A release line is the changeset's summary alone: no PR link, commit hash or credit.
/** @type {import("@changesets/types").ChangelogFunctions} */
module.exports = {
// A summary is one line, or a list of them (see README.md).
getReleaseLine: async ({ summary }) => {
const line = summary.trim();
return line.startsWith("- ") ? line : `- ${line}`;
},
getDependencyReleaseLine: async () => "",
};
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "Intentface/intentface-chat" }],
"changelog": "./changelog.cjs",
"commit": false,
"fixed": [],
"linked": [],
Expand Down
2 changes: 2 additions & 0 deletions .changeset/forty-symbols-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Two constraints follow, and both are load-bearing:

This pattern is used throughout: `Message`, `Composer`, `Attachments`, `Chip`, `Thread`, `Steps`, `Reasoning`, `AskUser`.

A change to the package needs a changeset, and a changeset is one short line per change, not a write-up: see [`.changeset/README.md`](./.changeset/README.md). The reasoning goes in the PR body.

### AI Integration

The chat API follows Vercel AI SDK conventions
Expand Down
19 changes: 1 addition & 18 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion content/docs/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ description: Every release of @intentface/chat, newest first.

{/* Changesets writes packages/chat/CHANGELOG.md on every release; it is included
here at build time, so this page is always the released notes. Its own
`# @intentface/chat` title is hidden, and the first version keeps no rule. */}
`# @intentface/chat` title is hidden, and the first version keeps no rule.
A line's leading [Tag]s become badges (lib/docs/remark-changelog-tags.ts). */}

<div className="[&>h1]:hidden [&>h1+h2]:mt-0 [&>h1+h2]:border-0 [&>h1+h2]:pt-0">

Expand Down
62 changes: 62 additions & 0 deletions lib/docs/remark-changelog-tags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// CHANGELOG.md tags a line with plain-text brackets ("- [Thread] Fix …") so it
// reads on GitHub too. On the changelog page, the leading tags become badges.

type MarkdownNode = {
type: string;
value?: string;
children?: MarkdownNode[];
data?: Record<string, unknown>;
};

const LEADING_TAGS = /^(?:\[\w+\] )+/;

// Each tag's dot colour as an OKLCH hue. A tag missing here gets a grey dot.
const TAG_HUES: Record<string, number> = {
Breaking: 25,
Nav: 65,
Shell: 95,
AskUser: 125,
Attachments: 150,
Steps: 175,
Message: 200,
Thread: 230,
Composer: 258,
Reasoning: 290,
Chip: 320,
Tabs: 345,
};

const badge = (name: string): MarkdownNode => {
const hue = TAG_HUES[name];
return {
type: "emphasis",
data: {
hName: "span",
hProperties: {
className:
"mr-1.5 inline-flex h-5 items-center gap-1.5 rounded-[5px] bg-ink-primary/7 px-1.5 font-medium text-ink-primary text-xs before:size-1.5 before:rounded-full before:bg-[var(--tag-color,var(--color-ink-tertiary))]",
style: hue === undefined ? undefined : `--tag-color: oklch(0.68 0.14 ${hue})`,
},
},
children: [{ type: "text", value: name }],
};
};

const tagListItem = (item: MarkdownNode) => {
const paragraph = item.children?.[0];
const text = paragraph?.children?.[0];
const tags = text?.type === "text" ? text.value?.match(LEADING_TAGS)?.[0] : undefined;
if (!paragraph?.children || !text?.value || !tags) return;

text.value = text.value.slice(tags.length);
paragraph.children.unshift(...(tags.match(/\w+/g) ?? []).map(badge));
};

const visit = (node: MarkdownNode) => {
if (node.type === "listItem") tagListItem(node);
node.children?.forEach(visit);
};

export const remarkChangelogTags = () => (tree: MarkdownNode, file: { path?: string }) => {
if (file.path?.endsWith("changelog.mdx")) visit(tree);
};
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
},
"devDependencies": {
"@biomejs/biome": "2.2.0",
"@changesets/changelog-github": "^0.7.0",
"@changesets/cli": "^2.31.0",
"@tailwindcss/postcss": "^4.3.2",
"@types/mdx": "^2.0.14",
Expand Down
Loading
Loading