feat(desktop): embed BoosAPI Desktop client as a subproject
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as a monorepo subdirectory under desktop/. Source only — node_modules, dist, Cargo target and the upstream .git history are excluded. desktop/ keeps its own independent Cargo workspace (desktop/src-tauri with crates/*); it is not part of the backend boosapi crate, so a `cargo check` at the metapi root still compiles only the backend. Build the desktop app from desktop/src-tauri per desktop/README.md. Note: app icons are still placeholder assets pending the final BoosAPI logo. The updater signing keys live outside the repo and are not included.
This commit is contained in:
+62
@@ -0,0 +1,62 @@
|
||||
import type { NodeComponentProps } from 'markstream-react'
|
||||
import MarkdownRender, { MarkdownCodeBlockNode, setCustomComponents } from 'markstream-react'
|
||||
import 'markstream-react/index.css'
|
||||
|
||||
function rewriteDocsUrl(url: string) {
|
||||
if (url.startsWith('/docs/'))
|
||||
return `https://markstream.example.com${url}`
|
||||
return url
|
||||
}
|
||||
|
||||
function CustomHeading({ node, ctx, renderNode, indexKey }: NodeComponentProps<any>) {
|
||||
const Tag = `h${node.level || 1}` as keyof JSX.IntrinsicElements
|
||||
|
||||
return (
|
||||
<Tag className="docs-title">
|
||||
{node.children?.map((child: any, i: number) =>
|
||||
renderNode && ctx
|
||||
? renderNode(child, `${String(indexKey)}-heading-${i}`, ctx)
|
||||
: null,
|
||||
)}
|
||||
</Tag>
|
||||
)
|
||||
}
|
||||
|
||||
function CustomLink({ node, ctx, renderNode, indexKey }: NodeComponentProps<any>) {
|
||||
const href = rewriteDocsUrl(node.href)
|
||||
|
||||
return (
|
||||
<a href={href} target="_blank" rel="noreferrer">
|
||||
{node.children?.map((child: any, i: number) =>
|
||||
renderNode && ctx
|
||||
? renderNode(child, `${String(indexKey)}-link-${i}`, ctx)
|
||||
: null,
|
||||
)}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
|
||||
setCustomComponents('migration-demo', {
|
||||
heading: CustomHeading,
|
||||
link: CustomLink,
|
||||
code_block: ({ node, isDark, ctx }: any) => (
|
||||
<MarkdownCodeBlockNode
|
||||
node={node}
|
||||
isDark={isDark}
|
||||
stream={ctx?.codeBlockStream}
|
||||
{...(ctx?.codeBlockProps || {})}
|
||||
/>
|
||||
),
|
||||
})
|
||||
|
||||
export function AdvancedArticle({ markdown }: { markdown: string }) {
|
||||
return (
|
||||
<MarkdownRender
|
||||
customId="migration-demo"
|
||||
content={markdown}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
// If the previous component depended on `allowedElements`, filter the parsed
|
||||
// node tree before render. There is no direct allowlist prop on markstream-react.
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import MarkdownRender from 'markstream-react'
|
||||
import 'markstream-react/index.css'
|
||||
|
||||
export function BasicArticle({ markdown }: { markdown: string }) {
|
||||
return <MarkdownRender content={markdown} />
|
||||
}
|
||||
Vendored
+71
@@ -0,0 +1,71 @@
|
||||
import Markdown from 'react-markdown'
|
||||
import rehypeRaw from 'rehype-raw'
|
||||
import remarkGfm from 'remark-gfm'
|
||||
|
||||
function rewriteDocsUrl(url: string) {
|
||||
if (url.startsWith('/docs/'))
|
||||
return `https://markstream.example.com${url}`
|
||||
return url
|
||||
}
|
||||
|
||||
export function AdvancedArticle({ markdown }: { markdown: string }) {
|
||||
return (
|
||||
<Markdown
|
||||
remarkPlugins={[remarkGfm]}
|
||||
rehypePlugins={[rehypeRaw]}
|
||||
allowedElements={[
|
||||
'h1',
|
||||
'h2',
|
||||
'p',
|
||||
'a',
|
||||
'code',
|
||||
'pre',
|
||||
'ul',
|
||||
'ol',
|
||||
'li',
|
||||
'strong',
|
||||
'em',
|
||||
'table',
|
||||
'thead',
|
||||
'tbody',
|
||||
'tr',
|
||||
'th',
|
||||
'td',
|
||||
]}
|
||||
urlTransform={rewriteDocsUrl}
|
||||
components={{
|
||||
h1({ children }) {
|
||||
return <h1 className="docs-title">{children}</h1>
|
||||
},
|
||||
a({ href, children }) {
|
||||
return (
|
||||
<a href={href} target="_blank" rel="noreferrer">
|
||||
{children}
|
||||
</a>
|
||||
)
|
||||
},
|
||||
code({ className, children, ...rest }) {
|
||||
const isBlock = /language-/.test(className || '')
|
||||
|
||||
if (isBlock) {
|
||||
return (
|
||||
<pre className="docs-code">
|
||||
<code className={className} {...rest}>
|
||||
{children}
|
||||
</code>
|
||||
</pre>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<code className="inline-code" {...rest}>
|
||||
{children}
|
||||
</code>
|
||||
)
|
||||
},
|
||||
}}
|
||||
>
|
||||
{markdown}
|
||||
</Markdown>
|
||||
)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import Markdown from 'react-markdown'
|
||||
|
||||
export function BasicArticle({ markdown }: { markdown: string }) {
|
||||
return <Markdown>{markdown}</Markdown>
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
# Demo Skill Output
|
||||
|
||||
This folder is an isolated demo for the `react-markdown-to-markstream-react` skill.
|
||||
The main repository is not a real `react-markdown` consumer, so this fixture exists to show what a meaningful audit and migration result would look like.
|
||||
|
||||
## Audit Summary
|
||||
|
||||
- Found 2 `react-markdown` call sites in this demo fixture.
|
||||
- Classified 1 call site as direct migration and 1 as advanced/plugin-heavy migration.
|
||||
- Safe direct migrations were applied in `after-basic.tsx` and `after-advanced.tsx`.
|
||||
- Manual review is still required for HTML policy and element allowlisting.
|
||||
|
||||
## Call Sites
|
||||
|
||||
| File | Classification | Why |
|
||||
|---|---|---|
|
||||
| `before-basic.tsx` | direct | Plain `<Markdown>{markdown}</Markdown>` usage |
|
||||
| `before-advanced.tsx` | renderer-custom + plugin-heavy + security-heavy | Uses `components`, `remark-gfm`, `rehype-raw`, `allowedElements`, and `urlTransform` |
|
||||
|
||||
## Direct Mappings Applied
|
||||
|
||||
| `react-markdown` usage | `markstream-react` migration |
|
||||
|---|---|
|
||||
| `children` | `content` |
|
||||
| `components.h1` | `setCustomComponents('migration-demo', { heading })` with `node.level` |
|
||||
| `components.a` | custom `link` renderer |
|
||||
| `components.code` | custom `code_block` renderer with `MarkdownCodeBlockNode` |
|
||||
| `urlTransform` | link rewrite logic moved into the custom `link` renderer |
|
||||
|
||||
## Manual Review Items
|
||||
|
||||
### `rehypeRaw`
|
||||
|
||||
`markstream-react` does not expose a public `rehype` stage.
|
||||
If the old app relied on `rehypeRaw` for standard HTML rendering, verify the new HTML behavior.
|
||||
If it relied on trusted custom tags, prefer `customHtmlTags` plus `setCustomComponents`.
|
||||
|
||||
### `allowedElements`
|
||||
|
||||
There is no direct `allowedElements` prop in `markstream-react`.
|
||||
If exact allowlisting still matters, filter the parsed node tree before rendering.
|
||||
|
||||
### Security parity
|
||||
|
||||
The new renderer sanitizes blocked tags, dangerous event-handler attributes, and unsafe URLs in built-in HTML renderers, but it is still not a byte-for-byte replacement for a repo-specific `rehype` sanitization stack.
|
||||
|
||||
## Suggested User-Facing Skill Result
|
||||
|
||||
1. Replace `react-markdown` with `markstream-react` for direct call sites first.
|
||||
2. Convert HTML-tag-based `components` overrides into node-type-based `setCustomComponents`.
|
||||
3. Remove `remark-gfm` only after checking rendered tables, task lists, and other edge cases.
|
||||
4. Revisit any `rehype`-based HTML and security logic before claiming migration completeness.
|
||||
5. Adopt `nodes` + `parseMarkdownToStructure` later only if the app actually needs streaming updates.
|
||||
Reference in New Issue
Block a user