aether-colony 3.1.4 → 3.1.15
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/.claude/commands/ant/archaeology.md +12 -0
- package/.claude/commands/ant/build.md +382 -319
- package/.claude/commands/ant/chaos.md +23 -1
- package/.claude/commands/ant/colonize.md +147 -87
- package/.claude/commands/ant/continue.md +213 -23
- package/.claude/commands/ant/council.md +22 -0
- package/.claude/commands/ant/dream.md +18 -0
- package/.claude/commands/ant/entomb.md +178 -6
- package/.claude/commands/ant/init.md +87 -13
- package/.claude/commands/ant/lay-eggs.md +45 -5
- package/.claude/commands/ant/oracle.md +82 -9
- package/.claude/commands/ant/organize.md +2 -2
- package/.claude/commands/ant/pause-colony.md +86 -28
- package/.claude/commands/ant/phase.md +26 -0
- package/.claude/commands/ant/plan.md +204 -111
- package/.claude/commands/ant/resume-colony.md +23 -1
- package/.claude/commands/ant/resume.md +159 -0
- package/.claude/commands/ant/seal.md +177 -3
- package/.claude/commands/ant/swarm.md +78 -97
- package/.claude/commands/ant/verify-castes.md +7 -7
- package/.claude/commands/ant/watch.md +17 -0
- package/.opencode/agents/aether-ambassador.md +97 -0
- package/.opencode/agents/aether-archaeologist.md +91 -0
- package/.opencode/agents/aether-architect.md +66 -0
- package/.opencode/agents/aether-auditor.md +111 -0
- package/.opencode/agents/aether-builder.md +28 -10
- package/.opencode/agents/aether-chaos.md +98 -0
- package/.opencode/agents/aether-chronicler.md +80 -0
- package/.opencode/agents/aether-gatekeeper.md +107 -0
- package/.opencode/agents/aether-guardian.md +107 -0
- package/.opencode/agents/aether-includer.md +108 -0
- package/.opencode/agents/aether-keeper.md +106 -0
- package/.opencode/agents/aether-measurer.md +119 -0
- package/.opencode/agents/aether-probe.md +91 -0
- package/.opencode/agents/aether-queen.md +72 -19
- package/.opencode/agents/aether-route-setter.md +85 -0
- package/.opencode/agents/aether-sage.md +98 -0
- package/.opencode/agents/aether-scout.md +33 -15
- package/.opencode/agents/aether-surveyor-disciplines.md +334 -0
- package/.opencode/agents/aether-surveyor-nest.md +272 -0
- package/.opencode/agents/aether-surveyor-pathogens.md +209 -0
- package/.opencode/agents/aether-surveyor-provisions.md +277 -0
- package/.opencode/agents/aether-tracker.md +91 -0
- package/.opencode/agents/aether-watcher.md +30 -12
- package/.opencode/agents/aether-weaver.md +87 -0
- package/.opencode/agents/workers.md +1034 -0
- package/.opencode/commands/ant/archaeology.md +44 -26
- package/.opencode/commands/ant/build.md +327 -295
- package/.opencode/commands/ant/chaos.md +32 -4
- package/.opencode/commands/ant/colonize.md +119 -93
- package/.opencode/commands/ant/continue.md +98 -10
- package/.opencode/commands/ant/council.md +28 -0
- package/.opencode/commands/ant/dream.md +24 -0
- package/.opencode/commands/ant/entomb.md +73 -1
- package/.opencode/commands/ant/feedback.md +8 -2
- package/.opencode/commands/ant/flag.md +9 -3
- package/.opencode/commands/ant/flags.md +8 -2
- package/.opencode/commands/ant/focus.md +8 -2
- package/.opencode/commands/ant/help.md +12 -0
- package/.opencode/commands/ant/init.md +49 -4
- package/.opencode/commands/ant/lay-eggs.md +30 -2
- package/.opencode/commands/ant/oracle.md +39 -7
- package/.opencode/commands/ant/organize.md +9 -3
- package/.opencode/commands/ant/pause-colony.md +54 -1
- package/.opencode/commands/ant/phase.md +36 -4
- package/.opencode/commands/ant/plan.md +225 -117
- package/.opencode/commands/ant/redirect.md +8 -2
- package/.opencode/commands/ant/resume-colony.md +51 -26
- package/.opencode/commands/ant/seal.md +76 -0
- package/.opencode/commands/ant/status.md +50 -20
- package/.opencode/commands/ant/swarm.md +108 -104
- package/.opencode/commands/ant/tunnels.md +107 -2
- package/CHANGELOG.md +21 -0
- package/README.md +199 -86
- package/bin/cli.js +142 -25
- package/bin/generate-commands.sh +100 -16
- package/bin/lib/caste-colors.js +5 -5
- package/bin/lib/errors.js +16 -0
- package/bin/lib/file-lock.js +279 -44
- package/bin/lib/state-sync.js +206 -23
- package/bin/lib/update-transaction.js +206 -24
- package/bin/sync-to-runtime.sh +129 -0
- package/package.json +2 -2
- package/runtime/CONTEXT.md +160 -0
- package/runtime/aether-utils.sh +1421 -55
- package/runtime/docs/AETHER-2.0-IMPLEMENTATION-PLAN.md +1343 -0
- package/runtime/docs/AETHER-PHEROMONE-SYSTEM-MASTER-SPEC.md +2642 -0
- package/runtime/docs/PHEROMONE-INJECTION.md +240 -0
- package/runtime/docs/PHEROMONE-INTEGRATION.md +192 -0
- package/runtime/docs/PHEROMONE-SYSTEM-DESIGN.md +426 -0
- package/runtime/docs/README.md +94 -0
- package/runtime/docs/VISUAL-OUTPUT-SPEC.md +219 -0
- package/runtime/docs/biological-reference.md +272 -0
- package/runtime/docs/codebase-review.md +399 -0
- package/runtime/docs/command-sync.md +164 -0
- package/runtime/docs/implementation-learnings.md +89 -0
- package/runtime/docs/known-issues.md +217 -0
- package/runtime/docs/namespace.md +148 -0
- package/runtime/docs/planning-discipline.md +159 -0
- package/runtime/lib/queen-utils.sh +729 -0
- package/runtime/model-profiles.yaml +100 -0
- package/runtime/recover.sh +136 -0
- package/runtime/templates/QUEEN.md.template +79 -0
- package/runtime/utils/atomic-write.sh +5 -5
- package/runtime/utils/chamber-utils.sh +6 -3
- package/runtime/utils/error-handler.sh +200 -0
- package/runtime/utils/queen-to-md.xsl +395 -0
- package/runtime/utils/spawn-tree.sh +428 -0
- package/runtime/utils/spawn-with-model.sh +56 -0
- package/runtime/utils/state-loader.sh +215 -0
- package/runtime/utils/swarm-display.sh +5 -5
- package/runtime/utils/watch-spawn-tree.sh +90 -22
- package/runtime/utils/xml-compose.sh +247 -0
- package/runtime/utils/xml-core.sh +186 -0
- package/runtime/utils/xml-utils.sh +2161 -0
- package/runtime/verification-loop.md +1 -1
- package/runtime/workers-new-castes.md +516 -0
- package/runtime/workers.md +20 -8
- package/.aether/visualizations/anthill-stages/brood-stable.txt +0 -26
- package/.aether/visualizations/anthill-stages/crowned-anthill.txt +0 -30
- package/.aether/visualizations/anthill-stages/first-mound.txt +0 -18
- package/.aether/visualizations/anthill-stages/open-chambers.txt +0 -24
- package/.aether/visualizations/anthill-stages/sealed-chambers.txt +0 -28
- package/.aether/visualizations/anthill-stages/ventilated-nest.txt +0 -27
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
XSLT Stylesheet: queen-wisdom to Markdown
|
|
4
|
+
|
|
5
|
+
Purpose: Transform queen-wisdom.xml into human-readable QUEEN.md format
|
|
6
|
+
for display and documentation purposes.
|
|
7
|
+
|
|
8
|
+
Usage: xsltproc queen-to-md.xsl queen-wisdom.xml > QUEEN.md
|
|
9
|
+
|
|
10
|
+
Version: 1.0.0
|
|
11
|
+
Namespace: http://aether.colony/schemas/queen-wisdom/1.0
|
|
12
|
+
-->
|
|
13
|
+
<xsl:stylesheet version="1.0"
|
|
14
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
15
|
+
|
|
16
|
+
<xsl:output method="text" encoding="UTF-8" indent="no"/>
|
|
17
|
+
|
|
18
|
+
<!-- ============================================================ -->
|
|
19
|
+
<!-- Main Template -->
|
|
20
|
+
<!-- ============================================================ -->
|
|
21
|
+
|
|
22
|
+
<xsl:template match="/queen-wisdom">
|
|
23
|
+
<xsl:text># QUEEN.md — Colony Wisdom </xsl:text>
|
|
24
|
+
|
|
25
|
+
<!-- Metadata Header -->
|
|
26
|
+
<xsl:text>> Last evolved: </xsl:text>
|
|
27
|
+
<xsl:value-of select="metadata/modified"/>
|
|
28
|
+
<xsl:text> </xsl:text>
|
|
29
|
+
|
|
30
|
+
<xsl:text>> Colonies contributed: </xsl:text>
|
|
31
|
+
<xsl:value-of select="count(//evidence/colony-ref/@id)"/>
|
|
32
|
+
<xsl:text> </xsl:text>
|
|
33
|
+
|
|
34
|
+
<xsl:text>> Wisdom version: </xsl:text>
|
|
35
|
+
<xsl:value-of select="metadata/version"/>
|
|
36
|
+
<xsl:text> </xsl:text>
|
|
37
|
+
|
|
38
|
+
<xsl:text>--- </xsl:text>
|
|
39
|
+
|
|
40
|
+
<!-- Philosophies Section -->
|
|
41
|
+
<xsl:apply-templates select="philosophies"/>
|
|
42
|
+
|
|
43
|
+
<!-- Patterns Section -->
|
|
44
|
+
<xsl:apply-templates select="patterns"/>
|
|
45
|
+
|
|
46
|
+
<!-- Redirects Section -->
|
|
47
|
+
<xsl:apply-templates select="redirects"/>
|
|
48
|
+
|
|
49
|
+
<!-- Stack Wisdom Section -->
|
|
50
|
+
<xsl:apply-templates select="stack-wisdom"/>
|
|
51
|
+
|
|
52
|
+
<!-- Decrees Section -->
|
|
53
|
+
<xsl:apply-templates select="decrees"/>
|
|
54
|
+
|
|
55
|
+
<!-- Evolution Log Section -->
|
|
56
|
+
<xsl:apply-templates select="evolution-log"/>
|
|
57
|
+
|
|
58
|
+
<xsl:text>--- </xsl:text>
|
|
59
|
+
|
|
60
|
+
<!-- JSON Metadata Block (for backward compatibility) -->
|
|
61
|
+
<xsl:call-template name="metadata-block"/>
|
|
62
|
+
</xsl:template>
|
|
63
|
+
|
|
64
|
+
<!-- ============================================================ -->
|
|
65
|
+
<!-- Section Templates -->
|
|
66
|
+
<!-- ============================================================ -->
|
|
67
|
+
|
|
68
|
+
<xsl:template match="philosophies">
|
|
69
|
+
<xsl:text>## 📜 Philosophies </xsl:text>
|
|
70
|
+
<xsl:text>Core beliefs that guide all colony work. These are validated through repeated successful application across multiple colonies. </xsl:text>
|
|
71
|
+
|
|
72
|
+
<xsl:for-each select="philosophy">
|
|
73
|
+
<xsl:text>- **</xsl:text>
|
|
74
|
+
<xsl:value-of select="@id"/>
|
|
75
|
+
<xsl:text>** (</xsl:text>
|
|
76
|
+
<xsl:value-of select="@created_at"/>
|
|
77
|
+
<xsl:text>): </xsl:text>
|
|
78
|
+
<xsl:value-of select="content"/>
|
|
79
|
+
<xsl:text> </xsl:text>
|
|
80
|
+
|
|
81
|
+
<!-- Principles subsection if present -->
|
|
82
|
+
<xsl:if test="principles/principle">
|
|
83
|
+
<xsl:text> - Principles: </xsl:text>
|
|
84
|
+
<xsl:for-each select="principles/principle">
|
|
85
|
+
<xsl:text> - </xsl:text>
|
|
86
|
+
<xsl:value-of select="."/>
|
|
87
|
+
<xsl:text> </xsl:text>
|
|
88
|
+
</xsl:for-each>
|
|
89
|
+
</xsl:if>
|
|
90
|
+
|
|
91
|
+
<!-- Evidence subsection -->
|
|
92
|
+
<xsl:if test="evidence/colony-ref">
|
|
93
|
+
<xsl:text> - Validated by: </xsl:text>
|
|
94
|
+
<xsl:for-each select="evidence/colony-ref">
|
|
95
|
+
<xsl:value-of select="@id"/>
|
|
96
|
+
<xsl:if test="position() != last()">, </xsl:if>
|
|
97
|
+
</xsl:for-each>
|
|
98
|
+
<xsl:text> </xsl:text>
|
|
99
|
+
</xsl:if>
|
|
100
|
+
</xsl:for-each>
|
|
101
|
+
|
|
102
|
+
<xsl:text> </xsl:text>
|
|
103
|
+
</xsl:template>
|
|
104
|
+
|
|
105
|
+
<xsl:template match="patterns">
|
|
106
|
+
<xsl:text>## 🧭 Patterns </xsl:text>
|
|
107
|
+
<xsl:text>Validated approaches that consistently work. These represent discovered best practices that have proven themselves in the field. </xsl:text>
|
|
108
|
+
|
|
109
|
+
<xsl:for-each select="pattern">
|
|
110
|
+
<xsl:text>- **</xsl:text>
|
|
111
|
+
<xsl:value-of select="@id"/>
|
|
112
|
+
<xsl:text>**</xsl:text>
|
|
113
|
+
|
|
114
|
+
<xsl:if test="pattern_type">
|
|
115
|
+
<xsl:text> [</xsl:text>
|
|
116
|
+
<xsl:value-of select="pattern_type"/>
|
|
117
|
+
<xsl:text>]</xsl:text>
|
|
118
|
+
</xsl:if>
|
|
119
|
+
|
|
120
|
+
<xsl:text> (</xsl:text>
|
|
121
|
+
<xsl:value-of select="@created_at"/>
|
|
122
|
+
<xsl:text>): </xsl:text>
|
|
123
|
+
<xsl:value-of select="content"/>
|
|
124
|
+
<xsl:text> </xsl:text>
|
|
125
|
+
|
|
126
|
+
<!-- Detection criteria if present -->
|
|
127
|
+
<xsl:if test="detection_criteria">
|
|
128
|
+
<xsl:text> - When to apply: </xsl:text>
|
|
129
|
+
<xsl:value-of select="detection_criteria"/>
|
|
130
|
+
<xsl:text> </xsl:text>
|
|
131
|
+
</xsl:if>
|
|
132
|
+
|
|
133
|
+
<!-- Examples if present -->
|
|
134
|
+
<xsl:if test="examples/example">
|
|
135
|
+
<xsl:text> - Examples: </xsl:text>
|
|
136
|
+
<xsl:for-each select="examples/example">
|
|
137
|
+
<xsl:text> - Scenario: </xsl:text>
|
|
138
|
+
<xsl:value-of select="scenario"/>
|
|
139
|
+
<xsl:text> → Application: </xsl:text>
|
|
140
|
+
<xsl:value-of select="application"/>
|
|
141
|
+
<xsl:if test="outcome">
|
|
142
|
+
<xsl:text> (Outcome: </xsl:text>
|
|
143
|
+
<xsl:value-of select="outcome"/>
|
|
144
|
+
<xsl:text>)</xsl:text>
|
|
145
|
+
</xsl:if>
|
|
146
|
+
<xsl:text> </xsl:text>
|
|
147
|
+
</xsl:for-each>
|
|
148
|
+
</xsl:if>
|
|
149
|
+
</xsl:for-each>
|
|
150
|
+
|
|
151
|
+
<xsl:text> </xsl:text>
|
|
152
|
+
</xsl:template>
|
|
153
|
+
|
|
154
|
+
<xsl:template match="redirects">
|
|
155
|
+
<xsl:text>## ⚠️ Redirects </xsl:text>
|
|
156
|
+
<xsl:text>Anti-patterns to avoid. These represent approaches that have caused problems and should be redirected away from. </xsl:text>
|
|
157
|
+
|
|
158
|
+
<xsl:for-each select="redirect">
|
|
159
|
+
<xsl:text>- **</xsl:text>
|
|
160
|
+
<xsl:value-of select="@id"/>
|
|
161
|
+
<xsl:text>**</xsl:text>
|
|
162
|
+
|
|
163
|
+
<xsl:if test="@confidence">
|
|
164
|
+
<xsl:text> [strength: </xsl:text>
|
|
165
|
+
<xsl:value-of select="@confidence"/>
|
|
166
|
+
<xsl:text>]</xsl:text>
|
|
167
|
+
</xsl:if>
|
|
168
|
+
|
|
169
|
+
<xsl:text> (</xsl:text>
|
|
170
|
+
<xsl:value-of select="@created_at"/>
|
|
171
|
+
<xsl:text>): </xsl:text>
|
|
172
|
+
<xsl:value-of select="content"/>
|
|
173
|
+
<xsl:text> </xsl:text>
|
|
174
|
+
|
|
175
|
+
<!-- Constraint type if present -->
|
|
176
|
+
<xsl:if test="constraint_type">
|
|
177
|
+
<xsl:text> - Constraint: </xsl:text>
|
|
178
|
+
<xsl:value-of select="constraint_type"/>
|
|
179
|
+
<xsl:text> </xsl:text>
|
|
180
|
+
</xsl:if>
|
|
181
|
+
|
|
182
|
+
<!-- Context if present -->
|
|
183
|
+
<xsl:if test="context">
|
|
184
|
+
<xsl:text> - Context: </xsl:text>
|
|
185
|
+
<xsl:value-of select="context"/>
|
|
186
|
+
<xsl:text> </xsl:text>
|
|
187
|
+
</xsl:if>
|
|
188
|
+
</xsl:for-each>
|
|
189
|
+
|
|
190
|
+
<xsl:text> </xsl:text>
|
|
191
|
+
</xsl:template>
|
|
192
|
+
|
|
193
|
+
<xsl:template match="stack-wisdom">
|
|
194
|
+
<xsl:text>## 🔧 Stack Wisdom </xsl:text>
|
|
195
|
+
<xsl:text>Technology-specific insights and constraints detected through codebase analysis. </xsl:text>
|
|
196
|
+
|
|
197
|
+
<xsl:for-each select="wisdom">
|
|
198
|
+
<xsl:text>- **</xsl:text>
|
|
199
|
+
<xsl:value-of select="@id"/>
|
|
200
|
+
<xsl:text>**</xsl:text>
|
|
201
|
+
|
|
202
|
+
<xsl:if test="technology">
|
|
203
|
+
<xsl:text> [</xsl:text>
|
|
204
|
+
<xsl:value-of select="technology"/>
|
|
205
|
+
<xsl:text>]</xsl:text>
|
|
206
|
+
</xsl:if>
|
|
207
|
+
|
|
208
|
+
<xsl:text> (</xsl:text>
|
|
209
|
+
<xsl:value-of select="@created_at"/>
|
|
210
|
+
<xsl:text>): </xsl:text>
|
|
211
|
+
<xsl:value-of select="content"/>
|
|
212
|
+
<xsl:text> </xsl:text>
|
|
213
|
+
|
|
214
|
+
<!-- Version range if present -->
|
|
215
|
+
<xsl:if test="version_range">
|
|
216
|
+
<xsl:text> - Applies to: </xsl:text>
|
|
217
|
+
<xsl:value-of select="version_range"/>
|
|
218
|
+
<xsl:text> </xsl:text>
|
|
219
|
+
</xsl:if>
|
|
220
|
+
|
|
221
|
+
<!-- Workaround if present -->
|
|
222
|
+
<xsl:if test="workaround">
|
|
223
|
+
<xsl:text> - Workaround: </xsl:text>
|
|
224
|
+
<xsl:value-of select="workaround"/>
|
|
225
|
+
<xsl:text> </xsl:text>
|
|
226
|
+
</xsl:if>
|
|
227
|
+
</xsl:for-each>
|
|
228
|
+
|
|
229
|
+
<xsl:text> </xsl:text>
|
|
230
|
+
</xsl:template>
|
|
231
|
+
|
|
232
|
+
<xsl:template match="decrees">
|
|
233
|
+
<xsl:text>## 🏛️ Decrees </xsl:text>
|
|
234
|
+
<xsl:text>User-mandated rules that override other guidance. These represent explicit directives from the Queen. </xsl:text>
|
|
235
|
+
|
|
236
|
+
<xsl:for-each select="decree">
|
|
237
|
+
<xsl:text>- **</xsl:text>
|
|
238
|
+
<xsl:value-of select="@id"/>
|
|
239
|
+
<xsl:text>**</xsl:text>
|
|
240
|
+
|
|
241
|
+
<xsl:if test="scope">
|
|
242
|
+
<xsl:text> [</xsl:text>
|
|
243
|
+
<xsl:value-of select="scope"/>
|
|
244
|
+
<xsl:text>]</xsl:text>
|
|
245
|
+
</xsl:if>
|
|
246
|
+
|
|
247
|
+
<xsl:text> (</xsl:text>
|
|
248
|
+
<xsl:value-of select="@created_at"/>
|
|
249
|
+
<xsl:text>): </xsl:text>
|
|
250
|
+
<xsl:value-of select="content"/>
|
|
251
|
+
<xsl:text> </xsl:text>
|
|
252
|
+
|
|
253
|
+
<!-- Authority if present -->
|
|
254
|
+
<xsl:if test="authority">
|
|
255
|
+
<xsl:text> - Authority: </xsl:text>
|
|
256
|
+
<xsl:value-of select="authority"/>
|
|
257
|
+
<xsl:text> </xsl:text>
|
|
258
|
+
</xsl:if>
|
|
259
|
+
|
|
260
|
+
<!-- Expiration if present -->
|
|
261
|
+
<xsl:if test="expiration">
|
|
262
|
+
<xsl:text> - Expires: </xsl:text>
|
|
263
|
+
<xsl:value-of select="expiration"/>
|
|
264
|
+
<xsl:text> </xsl:text>
|
|
265
|
+
</xsl:if>
|
|
266
|
+
</xsl:for-each>
|
|
267
|
+
|
|
268
|
+
<xsl:text> </xsl:text>
|
|
269
|
+
</xsl:template>
|
|
270
|
+
|
|
271
|
+
<xsl:template match="evolution-log">
|
|
272
|
+
<xsl:text>## 📊 Evolution Log </xsl:text>
|
|
273
|
+
<xsl:text>Track how wisdom has evolved over time. </xsl:text>
|
|
274
|
+
|
|
275
|
+
<xsl:text>| Date | Colony | Change | Details | </xsl:text>
|
|
276
|
+
<xsl:text>|------|--------|--------|---------| </xsl:text>
|
|
277
|
+
|
|
278
|
+
<xsl:for-each select="entry">
|
|
279
|
+
<xsl:text>| </xsl:text>
|
|
280
|
+
<xsl:value-of select="@timestamp"/>
|
|
281
|
+
<xsl:text> | </xsl:text>
|
|
282
|
+
<xsl:value-of select="@colony"/>
|
|
283
|
+
<xsl:text> | </xsl:text>
|
|
284
|
+
<xsl:value-of select="@action"/>
|
|
285
|
+
<xsl:text> | </xsl:text>
|
|
286
|
+
|
|
287
|
+
<!-- Build details string -->
|
|
288
|
+
<xsl:choose>
|
|
289
|
+
<xsl:when test="@type and @from">
|
|
290
|
+
<xsl:text>Promoted </xsl:text>
|
|
291
|
+
<xsl:value-of select="@type"/>
|
|
292
|
+
<xsl:text> from </xsl:text>
|
|
293
|
+
<xsl:value-of select="@from"/>
|
|
294
|
+
</xsl:when>
|
|
295
|
+
<xsl:when test="@type">
|
|
296
|
+
<xsl:text>Added: </xsl:text>
|
|
297
|
+
<xsl:value-of select="@type"/>
|
|
298
|
+
</xsl:when>
|
|
299
|
+
<xsl:otherwise>
|
|
300
|
+
<xsl:text>Entry recorded</xsl:text>
|
|
301
|
+
</xsl:otherwise>
|
|
302
|
+
</xsl:choose>
|
|
303
|
+
|
|
304
|
+
<xsl:if test="note">
|
|
305
|
+
<xsl:text> - </xsl:text>
|
|
306
|
+
<xsl:value-of select="note"/>
|
|
307
|
+
</xsl:if>
|
|
308
|
+
|
|
309
|
+
<xsl:text> | </xsl:text>
|
|
310
|
+
</xsl:for-each>
|
|
311
|
+
|
|
312
|
+
<xsl:text> </xsl:text>
|
|
313
|
+
</xsl:template>
|
|
314
|
+
|
|
315
|
+
<!-- ============================================================ -->
|
|
316
|
+
<!-- Metadata Block Template -->
|
|
317
|
+
<!-- ============================================================ -->
|
|
318
|
+
|
|
319
|
+
<xsl:template name="metadata-block">
|
|
320
|
+
<xsl:text><!-- METADATA </xsl:text>
|
|
321
|
+
<xsl:text>{ </xsl:text>
|
|
322
|
+
|
|
323
|
+
<xsl:text> "version": "</xsl:text>
|
|
324
|
+
<xsl:value-of select="metadata/version"/>
|
|
325
|
+
<xsl:text>", </xsl:text>
|
|
326
|
+
|
|
327
|
+
<xsl:text> "last_evolved": "</xsl:text>
|
|
328
|
+
<xsl:value-of select="metadata/modified"/>
|
|
329
|
+
<xsl:text>", </xsl:text>
|
|
330
|
+
|
|
331
|
+
<!-- Count colonies contributed -->
|
|
332
|
+
<xsl:text> "colonies_contributed": [</xsl:text>
|
|
333
|
+
<xsl:for-each select="//evidence/colony-ref[not(@id=preceding::colony-ref/@id)]">
|
|
334
|
+
<xsl:text>"</xsl:text>
|
|
335
|
+
<xsl:value-of select="@id"/>
|
|
336
|
+
<xsl:text>"</xsl:text>
|
|
337
|
+
<xsl:if test="position() != last()">, </xsl:if>
|
|
338
|
+
</xsl:for-each>
|
|
339
|
+
<xsl:text>], </xsl:text>
|
|
340
|
+
|
|
341
|
+
<!-- Promotion thresholds -->
|
|
342
|
+
<xsl:text> "promotion_thresholds": { </xsl:text>
|
|
343
|
+
<xsl:text> "philosophy": 5, </xsl:text>
|
|
344
|
+
<xsl:text> "pattern": 3, </xsl:text>
|
|
345
|
+
<xsl:text> "redirect": 2, </xsl:text>
|
|
346
|
+
<xsl:text> "stack": 1, </xsl:text>
|
|
347
|
+
<xsl:text> "decree": 0 </xsl:text>
|
|
348
|
+
<xsl:text> }, </xsl:text>
|
|
349
|
+
|
|
350
|
+
<!-- Stats -->
|
|
351
|
+
<xsl:text> "stats": { </xsl:text>
|
|
352
|
+
<xsl:text> "total_philosophies": </xsl:text>
|
|
353
|
+
<xsl:value-of select="count(//philosophy)"/>
|
|
354
|
+
<xsl:text>, </xsl:text>
|
|
355
|
+
|
|
356
|
+
<xsl:text> "total_patterns": </xsl:text>
|
|
357
|
+
<xsl:value-of select="count(//pattern)"/>
|
|
358
|
+
<xsl:text>, </xsl:text>
|
|
359
|
+
|
|
360
|
+
<xsl:text> "total_redirects": </xsl:text>
|
|
361
|
+
<xsl:value-of select="count(//redirect)"/>
|
|
362
|
+
<xsl:text>, </xsl:text>
|
|
363
|
+
|
|
364
|
+
<xsl:text> "total_stack_entries": </xsl:text>
|
|
365
|
+
<xsl:value-of select="count(//stack-wisdom/wisdom)"/>
|
|
366
|
+
<xsl:text>, </xsl:text>
|
|
367
|
+
|
|
368
|
+
<xsl:text> "total_decrees": </xsl:text>
|
|
369
|
+
<xsl:value-of select="count(//decree)"/>
|
|
370
|
+
<xsl:text> </xsl:text>
|
|
371
|
+
|
|
372
|
+
<xsl:text> } </xsl:text>
|
|
373
|
+
<xsl:text>} </xsl:text>
|
|
374
|
+
<xsl:text>--> </xsl:text>
|
|
375
|
+
</xsl:template>
|
|
376
|
+
|
|
377
|
+
<!-- ============================================================ -->
|
|
378
|
+
<!-- Utility Templates -->
|
|
379
|
+
<!-- ============================================================ -->
|
|
380
|
+
|
|
381
|
+
<!-- Strip trailing/leading whitespace -->
|
|
382
|
+
<xsl:template name="trim">
|
|
383
|
+
<xsl:param name="string"/>
|
|
384
|
+
<xsl:value-of select="normalize-space($string)"/>
|
|
385
|
+
</xsl:template>
|
|
386
|
+
|
|
387
|
+
<!-- Escape markdown special characters in content -->
|
|
388
|
+
<xsl:template name="escape-markdown">
|
|
389
|
+
<xsl:param name="text"/>
|
|
390
|
+
<!-- Note: In XSLT 1.0, complex string replacement requires recursive templates -->
|
|
391
|
+
<!-- For simplicity, we assume content doesn't contain problematic markdown -->
|
|
392
|
+
<xsl:value-of select="$text"/>
|
|
393
|
+
</xsl:template>
|
|
394
|
+
|
|
395
|
+
</xsl:stylesheet>
|