@biaoo/tiangong-wiki 0.2.0 → 0.2.2
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 +39 -50
- package/README.zh-CN.md +39 -50
- package/SKILL.md +75 -107
- package/assets/templates/achievement.md +8 -8
- package/assets/templates/bridge.md +8 -8
- package/assets/templates/concept.md +14 -18
- package/assets/templates/faq.md +8 -10
- package/assets/templates/lesson.md +8 -8
- package/assets/templates/method.md +16 -8
- package/assets/templates/misconception.md +10 -10
- package/assets/templates/person.md +8 -8
- package/assets/templates/research-note.md +10 -10
- package/assets/templates/resume.md +11 -10
- package/assets/templates/source-summary.md +8 -12
- package/assets/tiangong-wiki-framework.png +0 -0
- package/assets/wiki.config.default.json +6 -3
- package/dist/commands/asset.js +21 -0
- package/dist/commands/skill.js +78 -0
- package/dist/commands/template.js +30 -0
- package/dist/core/cli-env.js +34 -5
- package/dist/core/global-config.js +61 -0
- package/dist/core/onboarding.js +252 -102
- package/dist/core/workflow-context.js +58 -21
- package/dist/core/workspace-skills.js +496 -60
- package/dist/daemon/server.js +8 -0
- package/dist/index.js +36 -1
- package/dist/operations/asset.js +81 -0
- package/dist/operations/query.js +25 -1
- package/dist/operations/template-lint.js +160 -0
- package/dist/utils/asset.js +75 -0
- package/dist/utils/errors.js +6 -0
- package/package.json +2 -1
- package/references/cli-interface.md +32 -1
- package/references/template-design-guide.md +125 -113
- package/references/{env.md → troubleshooting.md} +64 -33
- package/references/vault-to-wiki-instruction.md +109 -51
- package/references/wiki-maintenance-instruction.md +15 -15
|
@@ -51,6 +51,10 @@ export function buildVaultWorkflowPrompt(input) {
|
|
|
51
51
|
`RESULT_JSON_PATH=${input.resultJsonPath}`,
|
|
52
52
|
`ALLOW_TEMPLATE_EVOLUTION=${input.allowTemplateEvolution ? "true" : "false"}`,
|
|
53
53
|
"",
|
|
54
|
+
"## Goal",
|
|
55
|
+
"",
|
|
56
|
+
"Extract reusable, high-value information units from a vault file and express them as wiki pages. The wiki is a knowledge base, not a notebook. Every page must earn its place by being independently useful for retrieval, graph traversal, or downstream reuse. If a source contains nothing worth extracting, skip it.",
|
|
57
|
+
"",
|
|
54
58
|
"## Environment",
|
|
55
59
|
"",
|
|
56
60
|
"Workspace-local skills are available from WORKSPACE_ROOT through normal Codex skill discovery.",
|
|
@@ -66,18 +70,20 @@ export function buildVaultWorkflowPrompt(input) {
|
|
|
66
70
|
"- `tiangong-wiki page-info <pageId>` — show full metadata and edges for one page",
|
|
67
71
|
"- `tiangong-wiki graph <root>` — traverse the wiki knowledge graph",
|
|
68
72
|
"- `tiangong-wiki stat` — show aggregate wiki index statistics",
|
|
73
|
+
"- `tiangong-wiki asset save <source-file> [--name <slug>]` — save an image to wiki assets, returns the asset path",
|
|
74
|
+
"- `tiangong-wiki asset ref <name-or-path> --page <page-id>` — compute the relative path from a page to an asset for markdown references",
|
|
69
75
|
"",
|
|
70
76
|
"Use whichever combination you judge necessary. These are tools at your disposal, not a mandatory checklist.",
|
|
71
77
|
"",
|
|
72
78
|
"## Step 1 — Read and Discover",
|
|
73
79
|
"",
|
|
74
80
|
"1. Read queue-item.json next to RESULT_JSON_PATH.",
|
|
75
|
-
"2. Read the target vault file at VAULT_FILE_PATH.",
|
|
76
|
-
"3. Discover the current page type ontology
|
|
77
|
-
"4.
|
|
78
|
-
" -
|
|
79
|
-
" -
|
|
80
|
-
" -
|
|
81
|
+
"2. Read the target vault file at VAULT_FILE_PATH. Refer to `references/vault-to-wiki-instruction.md` (Phase 1) in the wiki package for file-type-specific reading strategies, parser skill discovery, image handling, and metadata utilization.",
|
|
82
|
+
"3. Discover the current page type ontology via `tiangong-wiki type list` and `tiangong-wiki type show <type>`. Do not assume any type, template, or default target type.",
|
|
83
|
+
"4. Search the existing wiki for overlapping or related content:",
|
|
84
|
+
" - Use `tiangong-wiki fts` and `tiangong-wiki search` with key terms from the source.",
|
|
85
|
+
" - For each candidate hit, use `tiangong-wiki page-info` to understand its scope, type, and current edges.",
|
|
86
|
+
" - Determine: does this source reinforce, extend, contradict, or have no overlap with existing pages?",
|
|
81
87
|
"",
|
|
82
88
|
"These questions must be answered before proceeding to Step 2.",
|
|
83
89
|
"",
|
|
@@ -87,33 +93,64 @@ export function buildVaultWorkflowPrompt(input) {
|
|
|
87
93
|
"",
|
|
88
94
|
"## Step 2 — Decide",
|
|
89
95
|
"",
|
|
90
|
-
"###
|
|
96
|
+
"### 2a. Identify Information Units",
|
|
97
|
+
"",
|
|
98
|
+
"Before choosing any type, decompose the source into independently reusable information units. An information unit is a concept, method, lesson, pattern, insight, person profile, achievement, or any other piece of information that has standalone value.",
|
|
99
|
+
"",
|
|
100
|
+
"Ask for each candidate unit:",
|
|
101
|
+
"- Can it be understood and reused without reading the original source?",
|
|
102
|
+
"- Would someone searching the wiki benefit from finding this as a standalone page?",
|
|
103
|
+
"- Is it specific enough to have a single clear topic?",
|
|
104
|
+
"",
|
|
105
|
+
"If the answer to any of these is no, the unit is not worth extracting. If the entire source yields zero extractable units, set decision=skip.",
|
|
106
|
+
"",
|
|
107
|
+
"### 2b. Type Selection",
|
|
108
|
+
"",
|
|
109
|
+
"For each information unit, select the page type that best captures its nature:",
|
|
110
|
+
"1. Run `tiangong-wiki type list` and understand the purpose of each registered type.",
|
|
111
|
+
"2. Match the unit to the type whose semantic intent fits best. Consult `tiangong-wiki template show <type>` to verify the template structure supports the content you want to express.",
|
|
112
|
+
"3. You must be able to articulate why this type fits. If you find yourself choosing a type simply because it is the easiest to fill, reconsider.",
|
|
113
|
+
"",
|
|
114
|
+
"### 2c. Update vs Create vs Skip",
|
|
115
|
+
"",
|
|
116
|
+
"For each information unit, search the wiki (Step 1 results) and decide:",
|
|
117
|
+
"- **Update**: An existing page already covers this topic. Add new information, correct outdated content, or enrich it. Preserve existing valid content.",
|
|
118
|
+
"- **Create**: No existing page covers this topic. Create a new page.",
|
|
119
|
+
"- **Skip**: An existing page already fully covers this content with equal or better quality. Do not duplicate.",
|
|
91
120
|
"",
|
|
92
|
-
"
|
|
121
|
+
"### 2d. Page Granularity and Splitting",
|
|
93
122
|
"",
|
|
94
|
-
"
|
|
123
|
+
"Each page should have a single, clear core topic and express it completely.",
|
|
124
|
+
"- Aim for roughly 1000 words or fewer per page body. This is a guideline, not a hard limit, but if a page grows significantly beyond this, it likely covers more than one topic and should be split.",
|
|
125
|
+
"- A single vault source may produce multiple pages when it contains multiple independent information units. At most 5 pages per vault source.",
|
|
126
|
+
"- When splitting, each resulting page must independently satisfy the information unit criteria above.",
|
|
127
|
+
"- If a new vault source is complex, split it into multiple pages. Each split page still goes through the update-vs-create check above.",
|
|
95
128
|
"",
|
|
96
|
-
"
|
|
129
|
+
"### 2e. Building Relations",
|
|
97
130
|
"",
|
|
98
|
-
"
|
|
131
|
+
"Relations are how the knowledge graph gains structure and navigability.",
|
|
99
132
|
"",
|
|
100
|
-
"
|
|
101
|
-
"-
|
|
102
|
-
"-
|
|
133
|
+
"Priority order for choosing relation types:",
|
|
134
|
+
"1. **Type-specific edges** (e.g., prerequisites, correctedConcepts, fromConcepts/toConcepts, bridges_from/bridges_to): Use these whenever the relationship matches the semantic intent defined by the type schema. Discover available edges via `tiangong-wiki template show <type>`.",
|
|
135
|
+
"2. **sourceRefs** (edgeType: sourced_from): Records wiki-internal knowledge dependency. Use when the new page's content builds upon, extends, synthesizes, or is derived from existing wiki pages. This is the primary mechanism for knowledge lineage within the wiki. Do not put vault paths into sourceRefs — that is what vaultPath is for.",
|
|
136
|
+
"3. **relatedPages** (edgeType: related): Use only for genuine thematic relationships that do not fit any type-specific edge or sourceRefs. This is a last resort, not a default.",
|
|
103
137
|
"",
|
|
104
|
-
"
|
|
138
|
+
"If during discovery you find that the new source, combined with existing wiki pages, enables a higher-level synthesis (e.g., two existing concepts can now be bridged, or a pattern emerges across multiple existing pages), you may create that synthesis page and use sourceRefs to link back to its constituent pages.",
|
|
105
139
|
"",
|
|
106
|
-
"
|
|
140
|
+
"Orphan pages with no relations are acceptable when the source introduces a topic with genuinely no overlap to existing wiki content.",
|
|
107
141
|
"",
|
|
108
142
|
"## Step 3 — Create or Update Pages",
|
|
109
143
|
"",
|
|
110
144
|
"### Field Conventions",
|
|
111
145
|
"",
|
|
112
|
-
"- **vaultPath**: MUST be relative to the vault root. Never use absolute paths. Derive it by stripping the vault root prefix from VAULT_FILE_PATH.",
|
|
113
|
-
"- **sourceRefs**:
|
|
114
|
-
"- **relatedPages**:
|
|
146
|
+
"- **vaultPath**: MUST be relative to the vault root. Never use absolute paths. Derive it by stripping the vault root prefix from VAULT_FILE_PATH. This field tracks which original source file produced this page.",
|
|
147
|
+
"- **sourceRefs**: Wiki-internal knowledge dependency. Points to existing wiki page paths that this page's content builds upon. Do not use for vault file references. Leave empty only when this page genuinely has no dependency on existing wiki knowledge.",
|
|
148
|
+
"- **relatedPages**: Thematic relations only. Do not use as a substitute for sourceRefs or type-specific edges.",
|
|
115
149
|
"- **createdAt / updatedAt**: Leave placeholders unchanged or omit them. The system will normalize them to YYYY-MM-DD during indexing and refresh updatedAt on modified pages.",
|
|
116
|
-
"- **nodeId**:
|
|
150
|
+
"- **nodeId**: Lowercase kebab-case slug derived from the topic (not the source document name).",
|
|
151
|
+
" - For English titles: use key words directly (e.g., \"API Rate Limiting\" → `api-rate-limiting`).",
|
|
152
|
+
" - For Chinese titles: use a short English translation of the core topic, NOT pinyin (e.g., \"平台产品需求文档\" → `platform-product-requirements`, NOT `ping-tai-chan-pin-xu-qiu-wen-dang`).",
|
|
153
|
+
" - Keep under 50 characters. Drop filler words.",
|
|
117
154
|
"",
|
|
118
155
|
"Consult the template for your chosen type before writing a page.",
|
|
119
156
|
"If ALLOW_TEMPLATE_EVOLUTION=false, do not create templates or new page types.",
|
|
@@ -124,7 +161,7 @@ export function buildVaultWorkflowPrompt(input) {
|
|
|
124
161
|
"1. `tiangong-wiki sync --path <page>`",
|
|
125
162
|
"2. `tiangong-wiki lint --path <page> --format json`",
|
|
126
163
|
"",
|
|
127
|
-
"Fix
|
|
164
|
+
"Fix all errors before proceeding. Also review warnings: if a warning indicates a field mismatch between your page and the type schema (e.g., unregistered fields, empty required references), fix it. Only ignore warnings that are clearly cosmetic or irrelevant to schema correctness.",
|
|
128
165
|
"",
|
|
129
166
|
"## Step 4 — Write Result Manifest",
|
|
130
167
|
"",
|