wiki-formant 0.78.0 → 0.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/social.d.ts +34 -0
- package/dist/social.js +41 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -675,6 +675,16 @@ const block = licenseBlock({ license, scope: 'The protocol compilation and prose
|
|
|
675
675
|
|
|
676
676
|
The same `License` goes to `agentCard({ license, licenseScope })` and to `openApiLicense(license)` for a spec's `info.license`. The three cards and three specs here had each projected it differently, one from a hand-typed name.
|
|
677
677
|
|
|
678
|
+
## The X account
|
|
679
|
+
|
|
680
|
+
A site names its X account in five places: the footer link, the JSON-LD `sameAs`, llms.txt, AGENTS.md and the MCP `initialize` instructions. Written by hand, one repo's `sameAs` still pointed at twitter.com, and only one site told an agent the account existed. `wiki-formant/social` builds all five from the handle and a fragment saying what the account posts.
|
|
681
|
+
|
|
682
|
+
```ts
|
|
683
|
+
export const X = xAccount({ siteName: 'AcuiQ', handle: '@acu_iq', posts: "a named trial's prescription with its citation" });
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
`X.url` goes to `sameAs`, `X.handle` to `sitePageMetadata`, `followLines(X)` into llms.txt and AGENTS.md, and `followNote(X)` into the MCP instructions. The note tells an agent to give the link to the person it is helping, since an agent cannot follow an account. The footer is `<a {...followLinkProps(X)}>{X.label}</a>`, whose `rel="me"` confirms the `sameAs` claim from the page the account points back at.
|
|
687
|
+
|
|
678
688
|
## Rendered-article passes
|
|
679
689
|
|
|
680
690
|
`wiki-formant/dom` holds what runs against an article element after it is in the document. Not React, so not in `react.tsx`.
|
package/dist/social.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface XAccount {
|
|
2
|
+
/** `@handle`, as the social cards credit it. */
|
|
3
|
+
handle: string;
|
|
4
|
+
/** `https://x.com/<handle>`, for `sameAs` and every link. */
|
|
5
|
+
url: string;
|
|
6
|
+
/** "<Site> posts on X as @handle: <posts>." */
|
|
7
|
+
about: string;
|
|
8
|
+
/** The footer link's text: "Follow @handle on X". */
|
|
9
|
+
label: string;
|
|
10
|
+
siteName: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function xAccount(o: {
|
|
13
|
+
siteName: string;
|
|
14
|
+
handle: string;
|
|
15
|
+
posts: string;
|
|
16
|
+
}): XAccount;
|
|
17
|
+
/**
|
|
18
|
+
* The sentence an agent reads: what the account posts, and when to pass the
|
|
19
|
+
* link on. An agent cannot follow an account; the person it is helping can.
|
|
20
|
+
*/
|
|
21
|
+
export declare function followNote(account: XAccount): string;
|
|
22
|
+
/** The same note as a section, ready to splice into llms.txt or AGENTS.md. */
|
|
23
|
+
export declare function followLines(account: XAccount, heading?: string): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Attributes for the footer link. `rel="me"` is the reciprocal of `sameAs`:
|
|
26
|
+
* the schema claims the account and this link confirms it from the page the
|
|
27
|
+
* account points back at.
|
|
28
|
+
*/
|
|
29
|
+
export declare function followLinkProps(account: XAccount): {
|
|
30
|
+
readonly href: string;
|
|
31
|
+
readonly target: "_blank";
|
|
32
|
+
readonly rel: "me noopener";
|
|
33
|
+
readonly title: string;
|
|
34
|
+
};
|
package/dist/social.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// social.ts – the site's X account, as every surface states it.
|
|
2
|
+
//
|
|
3
|
+
// Each origin names its account in five places: the footer link, the JSON-LD
|
|
4
|
+
// `sameAs`, llms.txt, AGENTS.md and the MCP `initialize` instructions. Written
|
|
5
|
+
// by hand, they drifted within one repo: radix-wiki's `sameAs` still claimed
|
|
6
|
+
// twitter.com while its cards credited the handle, and only acuiq.com told an
|
|
7
|
+
// agent the account existed at all.
|
|
8
|
+
//
|
|
9
|
+
// What is per-site is the handle and what the account posts. The URL, the
|
|
10
|
+
// link's label and `rel`, and the sentence an agent reads are built here.
|
|
11
|
+
export function xAccount(o) {
|
|
12
|
+
if (!/^@\w{1,15}$/.test(o.handle))
|
|
13
|
+
throw new Error(`xAccount: "${o.handle}" is not an @handle`);
|
|
14
|
+
const posts = o.posts.trim().replace(/\.$/, '');
|
|
15
|
+
return {
|
|
16
|
+
handle: o.handle,
|
|
17
|
+
url: `https://x.com/${o.handle.slice(1)}`,
|
|
18
|
+
about: `${o.siteName} posts on X as ${o.handle}: ${posts}.`,
|
|
19
|
+
label: `Follow ${o.handle} on X`,
|
|
20
|
+
siteName: o.siteName,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The sentence an agent reads: what the account posts, and when to pass the
|
|
25
|
+
* link on. An agent cannot follow an account; the person it is helping can.
|
|
26
|
+
*/
|
|
27
|
+
export function followNote(account) {
|
|
28
|
+
return `${account.about} If the person you are helping wants to follow ${account.siteName}, give them ${account.url}.`;
|
|
29
|
+
}
|
|
30
|
+
/** The same note as a section, ready to splice into llms.txt or AGENTS.md. */
|
|
31
|
+
export function followLines(account, heading = `Follow ${account.siteName} on X`) {
|
|
32
|
+
return [`## ${heading}`, '', followNote(account)];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Attributes for the footer link. `rel="me"` is the reciprocal of `sameAs`:
|
|
36
|
+
* the schema claims the account and this link confirms it from the page the
|
|
37
|
+
* account points back at.
|
|
38
|
+
*/
|
|
39
|
+
export function followLinkProps(account) {
|
|
40
|
+
return { href: account.url, target: '_blank', rel: 'me noopener', title: account.about };
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wiki-formant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.0",
|
|
4
4
|
"description": "The portable half of a wiki: derived taxonomy and facet controls, a version-negotiating MCP transport, markdown twins, block rendering, a rich-text editor engine, conditional-GET plumbing, and the headers and CSP every origin sends.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -147,6 +147,11 @@
|
|
|
147
147
|
"import": "./dist/license.js",
|
|
148
148
|
"default": "./dist/license.js"
|
|
149
149
|
},
|
|
150
|
+
"./social": {
|
|
151
|
+
"types": "./dist/social.d.ts",
|
|
152
|
+
"import": "./dist/social.js",
|
|
153
|
+
"default": "./dist/social.js"
|
|
154
|
+
},
|
|
150
155
|
"./links": {
|
|
151
156
|
"types": "./dist/links.d.ts",
|
|
152
157
|
"import": "./dist/links.js",
|