concept-atlas-dense-explain 0.2.2 → 0.3.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/bin/cli.mjs +143 -0
- package/package.json +15 -2
- package/skill/SKILL.md +19 -92
- package/template/content/scroll-reading-demo.mdx +31 -0
- package/{skill/assets/template → template}/package.json +1 -1
- package/template/scripts/build.mjs +43 -0
- package/{skill/assets/template → template}/scripts/validate-content.mjs +48 -48
- package/template/scroll.html +12 -0
- package/{skill/assets/template → template}/src/components/MDXComponents.jsx +85 -47
- package/{skill/assets/template → template}/src/main.jsx +2 -2
- package/{skill/assets/template → template}/src/model/normalize-content.js +10 -4
- package/template/src/scroll-main.jsx +35 -0
- package/{skill/assets/template → template}/src/styles/concept-explain.css +3045 -2600
- package/{skill/assets/template → template}/src/views/NodeExplorer.jsx +668 -668
- package/{skill/assets/template → template}/src/views/RelationGraph.jsx +723 -723
- package/{skill/assets/template → template}/vite.config.js +6 -6
- package/bin/install.mjs +0 -17
- package/skill/assets/template/scripts/build.mjs +0 -37
- package/skill/references/components.md +0 -74
- package/skill/references/prompting.md +0 -90
- /package/{skill/assets/template → template}/content/compile-runtime.mdx +0 -0
- /package/{skill/assets/template → template}/index.html +0 -0
- /package/{skill/assets/template → template}/scripts/clean-temp.mjs +0 -0
- /package/{skill/assets/template → template}/src/app/App.jsx +0 -0
- /package/{skill/assets/template → template}/src/components/index.js +0 -0
- /package/{skill/assets/template → template}/src/model/concept-schema.js +0 -0
- /package/{skill/assets/template → template}/src/model/relation-types.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
2
|
import react from '@vitejs/plugin-react';
|
|
3
3
|
import mdx from '@mdx-js/rollup';
|
|
4
4
|
import { viteSingleFile } from 'vite-plugin-singlefile';
|
|
@@ -14,8 +14,8 @@ export default defineConfig({
|
|
|
14
14
|
react(),
|
|
15
15
|
viteSingleFile(),
|
|
16
16
|
],
|
|
17
|
-
build: {
|
|
18
|
-
outDir: 'dist',
|
|
19
|
-
emptyOutDir: true,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
17
|
+
build: {
|
|
18
|
+
outDir: 'dist',
|
|
19
|
+
emptyOutDir: true,
|
|
20
|
+
},
|
|
21
|
+
});
|
package/bin/install.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import os from 'node:os';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
|
|
7
|
-
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
|
-
const source = path.join(packageRoot, 'skill');
|
|
9
|
-
const args = process.argv.slice(2);
|
|
10
|
-
const targetArg = args.find(arg => arg.startsWith('--target='))?.slice('--target='.length);
|
|
11
|
-
const codexHome = process.env.CODEX_HOME || path.join(os.homedir(), '.codex');
|
|
12
|
-
const target = path.resolve(targetArg || path.join(codexHome, 'skills', 'concept-atlas-dense-explain'));
|
|
13
|
-
|
|
14
|
-
await fs.mkdir(target, { recursive: true });
|
|
15
|
-
await fs.cp(source, target, { recursive: true, force: true });
|
|
16
|
-
console.log(`Installed concept-atlas-dense-explain to ${target}`);
|
|
17
|
-
console.log('The skill includes a self-contained template under assets/template.');
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { build } from 'vite';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
const rootDir = path.resolve(__dirname, '..');
|
|
9
|
-
|
|
10
|
-
async function runBuild() {
|
|
11
|
-
console.log('🚀 开始构建 Concept Atlas 知识讲解页面...');
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
// 确保 dist 目录存在
|
|
15
|
-
const distDir = path.resolve(rootDir, 'dist');
|
|
16
|
-
if (!fs.existsSync(distDir)) {
|
|
17
|
-
fs.mkdirSync(distDir, { recursive: true });
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// 执行 Vite 构建
|
|
21
|
-
await build({
|
|
22
|
-
root: rootDir,
|
|
23
|
-
build: {
|
|
24
|
-
outDir: 'dist',
|
|
25
|
-
// Always remove stale assets so dist is a self-contained release.
|
|
26
|
-
emptyOutDir: true,
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
console.log('✅ 构建成功!产物已生成到 dist/ 目录。');
|
|
31
|
-
} catch (err) {
|
|
32
|
-
console.error('❌ 构建失败:', err);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
runBuild();
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Component contract
|
|
2
|
-
|
|
3
|
-
## Structure
|
|
4
|
-
|
|
5
|
-
```mdx
|
|
6
|
-
<ExplainPage id="topic" title="..." summary="...">
|
|
7
|
-
<ConceptGraph root="root">
|
|
8
|
-
<ConceptNode id="root" title="..." level="L0" summary="...">
|
|
9
|
-
<Definition>...</Definition>
|
|
10
|
-
<Input>...</Input><Output>...</Output>
|
|
11
|
-
<Children><ConceptRef id="child" /></Children>
|
|
12
|
-
</ConceptNode>
|
|
13
|
-
<ConceptNode id="child" title="..." level="L1" parent="root">...</ConceptNode>
|
|
14
|
-
<Relation from="child" to="other" type="depends-on" label="依赖" />
|
|
15
|
-
</ConceptGraph>
|
|
16
|
-
</ExplainPage>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Supported semantic content includes `Overview`, `Definition`, `Mechanism`, `Implementation`, `Example`, `Counterexample`, `Boundary`, `Prerequisite`, `Input`, `Output`, and `Glossary`.
|
|
20
|
-
|
|
21
|
-
High-value verification components: `LearningObjectives`, `KeyQuestion`, `Evidence(command, observes)`, `Invariant(title)`, `FailureMode(symptom, cause, evidence, remedy)`, and `Tradeoff(options)`.
|
|
22
|
-
|
|
23
|
-
Presentation components: `Stack`, `Grid`, `Split`, `Tabs`, `Flow`, `Compare`, `DecisionMatrix`, `Timeline`, `FrameworkModel`, `MatrixModel`, `FormulaModel`, `PyramidModel`, `FunnelModel`, `Callout`, `Details`, `RelationMap`, `RelationPath`, `Insight`, and `NoteGrid`.
|
|
24
|
-
|
|
25
|
-
经典结构模型建议按问题选择,避免重复堆叠:
|
|
26
|
-
|
|
27
|
-
- `FrameworkModel`:一分为几、多因素并列、阶段、分层或循环;用 `type="elements|stages|layers|cycle"` 区分结构。
|
|
28
|
-
- `MatrixModel`:两个关键元素组成的二维象限,例如重要/紧急、增长率/市场份额。
|
|
29
|
-
- `FormulaModel`:用公式表达变量之间的乘加减关系,例如业绩、价值或行为模型。
|
|
30
|
-
- `PyramidModel`:从基础到顶层的分层归纳,例如学习目标、需求层次或论证结构。
|
|
31
|
-
- `FunnelModel`:从输入到筛选、转化、结果的逐步收敛,例如 AIDA 或销售漏斗。
|
|
32
|
-
|
|
33
|
-
原有 `Flow`、`DecisionMatrix`、`Compare`、`Timeline` 继续保留,用于兼容已有内容;新内容优先使用上面的模型组件表达“关键元素与结构”的关系。
|
|
34
|
-
|
|
35
|
-
## Relation types (whitelist — only these render)
|
|
36
|
-
|
|
37
|
-
Write cross-branch `Relation`s with `type` from this exact list. Any other value renders no styled edge.
|
|
38
|
-
|
|
39
|
-
| type | label | use for |
|
|
40
|
-
| --- | --- | --- |
|
|
41
|
-
| `prerequisite` | 前置知识 | knowledge required before this concept |
|
|
42
|
-
| `causes` | 因果推动 | one concept triggers a state change in another |
|
|
43
|
-
| `produces` | 产出生成 | a stage outputs an artifact or entity |
|
|
44
|
-
| `uses` | 消费使用 | a concept consumes or calls another |
|
|
45
|
-
| `implements` | 实现关系 | a concrete mechanism implements an abstraction |
|
|
46
|
-
| `contrasts` | 对比关系 | side-by-side contrast (no arrowhead) |
|
|
47
|
-
| `depends-on` | 依赖关系 | runtime/effect depends on an external condition |
|
|
48
|
-
| `exception-of` | 异常/反例 | a boundary case, counterexample, or broken assumption |
|
|
49
|
-
| `precedes` | 时序先后 | pipeline or temporal ordering |
|
|
50
|
-
|
|
51
|
-
Do **not** write `parent-child` as a `Relation`; the tree edge is generated automatically from `parent` / `Children`. Add a short `label` to every relation so the graph edge is readable.
|
|
52
|
-
|
|
53
|
-
## Levels L0–L4
|
|
54
|
-
|
|
55
|
-
| Level | name | role | typical components |
|
|
56
|
-
| --- | --- | --- | --- |
|
|
57
|
-
| `L0` | 全局概览 | system-wide framing and the root claim | `Definition`, `Prerequisite`, `LearningObjectives`, `KeyQuestion`, `Input`/`Output`, `Callout`, `Tabs` |
|
|
58
|
-
| `L1` | 主要阶段 / 子系统 | major lifecycle stage or subsystem | `Definition`, `Input`/`Output`, `Example`, `Children` |
|
|
59
|
-
| `L2` | 局部机制 | concrete mechanism and flow | `Definition`, `Mechanism`, `Details`, `Evidence`, `Invariant`, `Tradeoff`, `FailureMode` |
|
|
60
|
-
| `L3` | 实现细节 | algorithm, data structure, or code | `Definition`, `Example`, `Glossary` |
|
|
61
|
-
| `L4` | 边界与反例 | boundary, exception, or counterexample | `Callout(danger/warn)`, `Example`, `FailureMode` |
|
|
62
|
-
|
|
63
|
-
## Density targets
|
|
64
|
-
|
|
65
|
-
Match the exemplar (`assets/template/content/compile-runtime.mdx`):
|
|
66
|
-
|
|
67
|
-
- 1 `L0` root, 4–5 `L1` branches, 2–3 children per branch, ~15–25 nodes total.
|
|
68
|
-
- Every key node: 3–6 semantic components; `L3`/`L4` nodes may be leaner but still concrete.
|
|
69
|
-
- At least a few nodes per document carry `Evidence`, `Invariant`, or `FailureMode` with a real command/observation.
|
|
70
|
-
- ~8–15 cross-branch `Relation`s, each with a `label`.
|
|
71
|
-
|
|
72
|
-
## Request priorities
|
|
73
|
-
|
|
74
|
-
The portable template covers the core `req.md` contract, node exploration, graph view, semantic relations, search, level/relation filters, URL node state, browsing history, keyboard shortcuts, Mermaid zoom, and responsive rendering. Evidence-oriented components and compact tradeoffs cover the highest-value `request.md` enhancements without adding permanent side panels.
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# AI prompt guide
|
|
2
|
-
|
|
3
|
-
Include this contract when asking an AI to generate or revise a dense explanation:
|
|
4
|
-
|
|
5
|
-
```text
|
|
6
|
-
先通读 content/compile-runtime.mdx(黄金样例),再产出;不要跳过、不要直接覆盖。
|
|
7
|
-
输出语义 MDX,不要输出 CSS、HTML 布局、坐标、SVG 或交互脚本。
|
|
8
|
-
先给一个 L0 根节点,再用 L1/L2/L3/L4 表达结构、机制、实现细节和边界。
|
|
9
|
-
父子层级使用 parent/Children;跨分支含义使用 Relation。
|
|
10
|
-
Relation 的 type 只能是:prerequisite, causes, produces, uses, implements, contrasts, depends-on, exception-of, precedes;每条都要带 label。
|
|
11
|
-
每个关键节点优先提供:summary、Definition、Input/Output、Mechanism、一个 Example,以及 Evidence 或 Boundary。
|
|
12
|
-
只在确实有帮助时使用组件:Flow 表示顺序,Compare/Tradeoff 表示选择,Timeline 表示时间,Evidence 表示验证,Invariant 表示必须保持的条件,FailureMode 表示故障定位。
|
|
13
|
-
首屏只保留核心结论和 3–5 个关键事实;次要解释放进 Details。不要为了“看起来丰富”堆卡片。
|
|
14
|
-
规模对齐样例:1 个根、4–5 个 L1、总计约 15–25 个节点、8–15 条 Relation。
|
|
15
|
-
证据要具体:真实命令、指标或命名的产物,不要泛泛而谈。
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Template availability gate
|
|
19
|
-
|
|
20
|
-
Use this gate before the contract above:
|
|
21
|
-
|
|
22
|
-
```text
|
|
23
|
-
先确认当前 skill 目录中的 assets/template 可访问,并读取黄金样例与模板源码。
|
|
24
|
-
如果模板不可访问,立即停止并说明缺少 Concept Atlas 模板;禁止自行用 JSX、HTML、CSS 或普通 Markdown 页面替代。
|
|
25
|
-
模板可访问后,复制完整模板,只修改 content/compile-runtime.mdx,最后运行 npm run validate 和 npm run build。
|
|
26
|
-
交付物必须是模板构建出的 dist/index.html。
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## What "good" looks like (from the exemplar)
|
|
30
|
-
|
|
31
|
-
`assets/template/content/compile-runtime.mdx` is the reference standard. Extract these patterns:
|
|
32
|
-
|
|
33
|
-
- **Scale**: 1 `L0` + 5 `L1` + ~20 nodes, descending to `L4`.
|
|
34
|
-
- **Titles are claims, not nouns**: 「缺页风暴与抖动」, 「ABI 破坏:能链接,不等于能调用」.
|
|
35
|
-
- **Every node opens with a one-sentence judgment** in `summary`, then 3–6 components.
|
|
36
|
-
- **Concrete evidence**: `readelf -Ws`, `nm -C`, `objdump -dr app.o`, `.bss`, ASLR, build-id.
|
|
37
|
-
- **Semantic relations carry the cross-branch meaning**: `produces`, `precedes`, `causes`, `depends-on`, `exception-of`, each labeled.
|
|
38
|
-
- **Detail is layered**: first screen = core claim + 3–5 facts; deep detail lives in `Details`, `Tabs`, `Glossary`.
|
|
39
|
-
|
|
40
|
-
## Density targets
|
|
41
|
-
|
|
42
|
-
| Metric | Target | Thin (failure) |
|
|
43
|
-
| --- | --- | --- |
|
|
44
|
-
| `L0` roots | 1 | 0 or many |
|
|
45
|
-
| `L1` branches | 4–5 | 1–2 |
|
|
46
|
-
| Nodes total | ~15–25 | < 8 |
|
|
47
|
-
| Components per key node | 3–6 | 1 |
|
|
48
|
-
| Cross-branch `Relation`s | 8–15 | 0–3 |
|
|
49
|
-
| Nodes with concrete evidence | several | none |
|
|
50
|
-
| Max depth | `L3`/`L4` | only `L0`/`L1` |
|
|
51
|
-
|
|
52
|
-
## Component selection
|
|
53
|
-
|
|
54
|
-
| Information shape | Component |
|
|
55
|
-
| --- | --- |
|
|
56
|
-
| 顺序、阶段、因果链 | `Flow` / `RelationPath` |
|
|
57
|
-
| 两到四个对象的同维度比较 | `Compare` |
|
|
58
|
-
| 方案、收益、代价、适用条件 | `Tradeoff` / `DecisionMatrix` |
|
|
59
|
-
| 时间先后 | `Timeline` |
|
|
60
|
-
| 可执行命令和观察结果 | `Evidence` |
|
|
61
|
-
| 必须保持的条件 | `Invariant` |
|
|
62
|
-
| 症状到原因和修复 | `FailureMode` |
|
|
63
|
-
| 次要细节或长解释 | `Details` |
|
|
64
|
-
|
|
65
|
-
Avoid using more than one primary presentation component in a single node unless the information shapes are genuinely different. Prefer short prose around one useful visual structure over a stack of decorative blocks.
|
|
66
|
-
|
|
67
|
-
## Minimal generation skeleton
|
|
68
|
-
|
|
69
|
-
```mdx
|
|
70
|
-
<ConceptNode id="mechanism" title="机制:输入如何在约束下变成输出" level="L2" parent="structure" summary="一句话结论">
|
|
71
|
-
<Definition>它是什么,以及为什么重要。</Definition>
|
|
72
|
-
<Mechanism>输入 → 转换 → 输出。</Mechanism>
|
|
73
|
-
<Example title="一个具体案例">名称 + 数值 + 结果,而不是泛指。</Example>
|
|
74
|
-
<Evidence command="tool --inspect target" observes="验证哪个不变量或产物。" />
|
|
75
|
-
<Boundary>何时不成立,或哪些实现细节会改变结论。</Boundary>
|
|
76
|
-
</ConceptNode>
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Anti-patterns
|
|
80
|
-
|
|
81
|
-
- **Thin graph**: a handful of nodes with one paragraph each. Fix by adding `L2`/`L3`/`L4` depth.
|
|
82
|
-
- **Noun titles / no judgment**: `"缓存"` instead of `"缓存一致性与内存序"`; `summary` missing or restating the title.
|
|
83
|
-
- **Generic filler**: "性能会受到影响" instead of a named command, metric, or artifact.
|
|
84
|
-
- **Card stacking**: five decorative blocks with no conclusion, evidence, or limitation.
|
|
85
|
-
- **Invented types**: `Relation type="related"` — not in the whitelist, renders nothing.
|
|
86
|
-
- **Prose instead of structure**: cross-branch links described in a paragraph instead of a labeled `Relation`.
|
|
87
|
-
|
|
88
|
-
## Before returning the result
|
|
89
|
-
|
|
90
|
-
Verify the self-check list in `SKILL.md`. In short: 1 root, claim titles, one-line summaries, 3–6 components per key node, concrete evidence, whitelisted relations, layered detail, no layout in MDX, template builds.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|