Compare commits
680
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7475c79cb2 | ||
|
|
484cb10d66 | ||
|
|
8f842a7f08 | ||
|
|
5798999691 | ||
|
|
7aac052149 | ||
|
|
f08ec00dec | ||
|
|
198b3acc86 | ||
|
|
c5415d5bc5 | ||
|
|
8c1ec4c91e | ||
|
|
451000e9ad | ||
|
|
b4395416fd | ||
|
|
cbbd819370 | ||
|
|
ad52612355 | ||
|
|
024d803494 | ||
|
|
4c5c102593 | ||
|
|
1c55baabd5 | ||
|
|
ffe06d7afa | ||
|
|
180a111799 | ||
|
|
a3948dbe0d | ||
|
|
24959a0ba8 | ||
|
|
afbb9f191c | ||
|
|
8db699191e | ||
|
|
e5580d9640 | ||
|
|
9ce2ae1037 | ||
|
|
166b01c86b | ||
|
|
87cfe05095 | ||
|
|
b37387e6da | ||
|
|
895752a1fd | ||
|
|
38c07d9a0e | ||
|
|
a7a5554c0f | ||
|
|
343504c7a8 | ||
|
|
3d9fa0da96 | ||
|
|
bb8960c5eb | ||
|
|
9331af78e2 | ||
|
|
73bf574a55 | ||
|
|
4fae71342d | ||
|
|
63d60e3ba1 | ||
|
|
44d2928c06 | ||
|
|
fa832268b3 | ||
|
|
9576188a2e | ||
|
|
528a1f0dbc | ||
|
|
a11b347659 | ||
|
|
8e437e2cd3 | ||
|
|
23229a6ac9 | ||
|
|
58b65215a1 | ||
|
|
92c3f80055 | ||
|
|
8a66f803cb | ||
|
|
3ce59a4da8 | ||
|
|
90688741c5 | ||
|
|
70b88b3767 | ||
|
|
f859e6eeea | ||
|
|
6705e2e6b7 | ||
|
|
6e8a62928b | ||
|
|
398a0b7222 | ||
|
|
e8f1a3e126 | ||
|
|
8ea56cbe30 | ||
|
|
8085d06124 | ||
|
|
6f929dc2da | ||
|
|
dd22180269 | ||
|
|
cc48bf6d05 | ||
|
|
19f986953a | ||
|
|
770dee5199 | ||
|
|
f6612813e3 | ||
|
|
643ea06340 | ||
|
|
0cd64a7450 | ||
|
|
981faac022 | ||
|
|
f818834ec1 | ||
|
|
8d47507d15 | ||
|
|
1e1f05c087 | ||
|
|
06e61efc51 | ||
|
|
2dfa0b2a5b | ||
|
|
629ad8ed39 | ||
|
|
ee677478be | ||
|
|
edbf241d99 | ||
|
|
add6a7d32c | ||
|
|
c64ec99115 | ||
|
|
60a3b84a84 | ||
|
|
02a4f2d20d | ||
|
|
88490e3092 | ||
|
|
9031c106a1 | ||
|
|
633436e40f | ||
|
|
cf73fcf1ef | ||
|
|
e48fd5b0f4 | ||
|
|
b2f97e72c3 | ||
|
|
c7c0f66d1f | ||
|
|
d5ab9daebb | ||
|
|
5795236d1f | ||
|
|
e8d6dc92fc | ||
|
|
afe31cb2a8 | ||
|
|
905a67df32 | ||
|
|
f63b7ef48d | ||
|
|
393558ca97 | ||
|
|
0d9bd99fc0 | ||
|
|
a0c779e022 | ||
|
|
a82b6fdde1 | ||
|
|
3613ed7c4e | ||
|
|
9564dff777 | ||
|
|
f56deffefe | ||
|
|
bdedf3ecd8 | ||
|
|
b0ee958fcf | ||
|
|
e64f6b23b4 | ||
|
|
eed4f05ea4 | ||
|
|
d88ed274ed | ||
|
|
7fdd97f675 | ||
|
|
c299efe589 | ||
|
|
b3867c46db | ||
|
|
1a39a53d93 | ||
|
|
6d6f580d24 | ||
|
|
af05f19301 | ||
|
|
3201369470 | ||
|
|
05197378b3 | ||
|
|
f3b3152f07 | ||
|
|
22364f2f1b | ||
|
|
b69a90501d | ||
|
|
7ff881f506 | ||
|
|
9acbe10986 | ||
|
|
81989a26d7 | ||
|
|
cf0ba6dccd | ||
|
|
0de703f86a | ||
|
|
4907f92d84 | ||
|
|
eac6921524 | ||
|
|
c0dc18433b | ||
|
|
7d9af11398 | ||
|
|
d9aef957f7 | ||
|
|
aa0c4d0f55 | ||
|
|
c50c515c4a | ||
|
|
16c44588d5 | ||
|
|
5080136d65 | ||
|
|
cc5277d2b5 | ||
|
|
bb06dad134 | ||
|
|
24dcb97354 | ||
|
|
76aa02846a | ||
|
|
0e389f34ec | ||
|
|
492790e985 | ||
|
|
ca434a8bab | ||
|
|
6195ad1d5d | ||
|
|
a87c2154ff | ||
|
|
8f1010f967 | ||
|
|
e3d9021bb6 | ||
|
|
142ab523d6 | ||
|
|
82c8d78fd3 | ||
|
|
58791fc7d9 | ||
|
|
1730f26fc7 | ||
|
|
4018e9928a | ||
|
|
628e3b6e5d | ||
|
|
5c6c612edd | ||
|
|
41587f319e | ||
|
|
298fbd51ea | ||
|
|
265dfdbcc4 | ||
|
|
42a43f5ffd | ||
|
|
037a963547 | ||
|
|
a32638e935 | ||
|
|
43eebe5671 | ||
|
|
e833dc05e2 | ||
|
|
11bb7ef277 | ||
|
|
6bd90bb2d0 | ||
|
|
4683f2e067 | ||
|
|
5912164039 | ||
|
|
303c06f773 | ||
|
|
a1086fd6c3 | ||
|
|
6ffe5ceb19 | ||
|
|
6b568aff3d | ||
|
|
16f26d7d60 | ||
|
|
b8265a92aa | ||
|
|
9af929971c | ||
|
|
2c4fa4bb05 | ||
|
|
3cabe53da2 | ||
|
|
58e13ee6d3 | ||
|
|
1b11fe063a | ||
|
|
b792f44556 | ||
|
|
9ea5bebfc3 | ||
|
|
c7c329341b | ||
|
|
8cf5288481 | ||
|
|
69c4e74872 | ||
|
|
af0bda2e40 | ||
|
|
090b026547 | ||
|
|
03396afd02 | ||
|
|
663a8ba2c0 | ||
|
|
dc853fb580 | ||
|
|
0b80ff8e50 | ||
|
|
b8a4ddd38f | ||
|
|
352bc0d2c5 | ||
|
|
8a6d09d582 | ||
|
|
dcd3d329d4 | ||
|
|
0e1bfb3359 | ||
|
|
e9ae7ff1ae | ||
|
|
ecbdd18303 | ||
|
|
bedd53e212 | ||
|
|
7674ebb869 | ||
|
|
434be9fd52 | ||
|
|
ae97891266 | ||
|
|
aea86746e7 | ||
|
|
c773503938 | ||
|
|
939e23ee88 | ||
|
|
687c168014 | ||
|
|
eac9b45263 | ||
|
|
74b298e80d | ||
|
|
fc7097bae4 | ||
|
|
b624084745 | ||
|
|
0bbe735c3c | ||
|
|
92de46aca4 | ||
|
|
8bbe017a5e | ||
|
|
1a13989230 | ||
|
|
5ad1a07f5c | ||
|
|
bcfc763ba4 | ||
|
|
bf76e069ee | ||
|
|
9015de26e5 | ||
|
|
8c24d96626 | ||
|
|
4a2f5bf226 | ||
|
|
86e921e959 | ||
|
|
b196a44685 | ||
|
|
c8ed5bffb7 | ||
|
|
fb135ae2f8 | ||
|
|
69fcdd6227 | ||
|
|
deac53d0f5 | ||
|
|
932403237a | ||
|
|
a14a6e221d | ||
|
|
8b0ea9ed7a | ||
|
|
6ae0d39e5a | ||
|
|
307c8efa81 | ||
|
|
34b0911218 | ||
|
|
4488a3cb70 | ||
|
|
9dbcc728b6 | ||
|
|
0405a60d68 | ||
|
|
409b8df2cb | ||
|
|
6bba0be6d2 | ||
|
|
1c90312c02 | ||
|
|
fd0cfcb566 | ||
|
|
6dd0ce47b1 | ||
|
|
1a94cc8490 | ||
|
|
11417c42e0 | ||
|
|
13012cac0e | ||
|
|
5a0f4ed747 | ||
|
|
05b8edc186 | ||
|
|
8926f7bed6 | ||
|
|
18b0c655f7 | ||
|
|
924885969f | ||
|
|
619271b8eb | ||
|
|
719b7a8d82 | ||
|
|
dfe99a10b4 | ||
|
|
fac68e85ea | ||
|
|
639b0ebcd1 | ||
|
|
2c4dac005c | ||
|
|
0ac661eef2 | ||
|
|
1dd74578b5 | ||
|
|
14114993c4 | ||
|
|
e80c944c40 | ||
|
|
30cd5a0833 | ||
|
|
e2068c2051 | ||
|
|
9cda80ee7d | ||
|
|
eae4815fc7 | ||
|
|
3260494e5c | ||
|
|
3330a0fc66 | ||
|
|
42a1a46383 | ||
|
|
b6629e5450 | ||
|
|
ecd7d5e433 | ||
|
|
aeb5a2a43d | ||
|
|
f2d651e063 | ||
|
|
b020b9d218 | ||
|
|
33a14d272c | ||
|
|
6ed70fd8b8 | ||
|
|
115d1f6c0b | ||
|
|
7dc5e56850 | ||
|
|
514caa55ae | ||
|
|
74908ebf04 | ||
|
|
0f852593bc | ||
|
|
34e2fb4f74 | ||
|
|
0e407b2bd3 | ||
|
|
e5e532d83f | ||
|
|
064522a338 | ||
|
|
c85f1a2829 | ||
|
|
a7266185b2 | ||
|
|
4d7c0bea1b | ||
|
|
53758ebd1c | ||
|
|
dff0b700ae | ||
|
|
4da07c1b26 | ||
|
|
78922102e4 | ||
|
|
064bae2c65 | ||
|
|
92b91ffc81 | ||
|
|
ab6648ae0e | ||
|
|
5acf026e0c | ||
|
|
8dcd69412f | ||
|
|
2a13e52981 | ||
|
|
9b269f6447 | ||
|
|
15362cb048 | ||
|
|
05d48f68a4 | ||
|
|
e4387259ba | ||
|
|
518f8e386b | ||
|
|
9da12c9093 | ||
|
|
e0d34669e0 | ||
|
|
0ba4d3d2d7 | ||
|
|
ad3ebf243a | ||
|
|
142d30ce08 | ||
|
|
4757b82edd | ||
|
|
bff2f53e52 | ||
|
|
fb28eee62f | ||
|
|
01468ad976 | ||
|
|
f3791d11b4 | ||
|
|
7fef690167 | ||
|
|
024cdee82a | ||
|
|
f666eaaf40 | ||
|
|
e6f05c7748 | ||
|
|
81f9ea0072 | ||
|
|
dbf3f3a14b | ||
|
|
654e89d98c | ||
|
|
be20629496 | ||
|
|
3223295841 | ||
|
|
beb5bdbe8c | ||
|
|
b8cb022018 | ||
|
|
b9e331cb31 | ||
|
|
476c2b607b | ||
|
|
d99b275336 | ||
|
|
1415aee08f | ||
|
|
0f2c12b636 | ||
|
|
9873df7099 | ||
|
|
3001ed7ba5 | ||
|
|
050d71927f | ||
|
|
7859170aec | ||
|
|
e32ff8f6b3 | ||
|
|
c21a28c3bc | ||
|
|
1e61dca9d8 | ||
|
|
ba675a4767 | ||
|
|
bfd468d5e3 | ||
|
|
8353ba38fe | ||
|
|
b43a08b2e2 | ||
|
|
1908bf1a53 | ||
|
|
c44ea38ae2 | ||
|
|
d489f7c088 | ||
|
|
a993cfd76a | ||
|
|
d5f826a8c8 | ||
|
|
0f72173d08 | ||
|
|
a707758d47 | ||
|
|
63bcb882a6 | ||
|
|
1bb16dd6db | ||
|
|
58ec2172d6 | ||
|
|
66926e9e0a | ||
|
|
dcf4c05663 | ||
|
|
f47a1e143a | ||
|
|
9cf98a98b5 | ||
|
|
f99d552d87 | ||
|
|
7d49c358c1 | ||
|
|
a32c0cd78f | ||
|
|
0a8f76d9b4 | ||
|
|
4e2419b598 | ||
|
|
f6374d1593 | ||
|
|
9ede4bc63d | ||
|
|
3ae8f2c843 | ||
|
|
e9c1a8a730 | ||
|
|
5554b1642c | ||
|
|
fe15603a91 | ||
|
|
1418742655 | ||
|
|
ed31a2b31d | ||
|
|
56ab52356f | ||
|
|
2e425c3010 | ||
|
|
46a0263d7f | ||
|
|
ff252fd469 | ||
|
|
67bac1bf02 | ||
|
|
33f8b94bb0 | ||
|
|
0ed57b6d54 | ||
|
|
c29d48f38c | ||
|
|
f1e82ce4e5 | ||
|
|
2d412e3bba | ||
|
|
46d78c6e15 | ||
|
|
81a14f9b38 | ||
|
|
88dc6d5a54 | ||
|
|
4a2d89406b | ||
|
|
d8d435fead | ||
|
|
1f8e61f3bf | ||
|
|
a9ee858f53 | ||
|
|
8489d90926 | ||
|
|
5272acaea0 | ||
|
|
cba51238b6 | ||
|
|
5fffb800f9 | ||
|
|
1a729eb9ec | ||
|
|
00c763300e | ||
|
|
224b3d4a66 | ||
|
|
81d26a265a | ||
|
|
5b599125d1 | ||
|
|
18d89d6cf2 | ||
|
|
199b5c532f | ||
|
|
db5f0e830b | ||
|
|
7a449c40b1 | ||
|
|
97fda7aa10 | ||
|
|
a49592a3ba | ||
|
|
ed9ac03c0c | ||
|
|
cb46ad7abe | ||
|
|
586975090b | ||
|
|
544805266b | ||
|
|
f3051fb536 | ||
|
|
86b183e2d7 | ||
|
|
8e23a5395a | ||
|
|
cab609ee91 | ||
|
|
b752cd49b7 | ||
|
|
2c91b5cc7b | ||
|
|
453321c8c2 | ||
|
|
981d754133 | ||
|
|
410f36f719 | ||
|
|
bd06aedb90 | ||
|
|
42ddeb14e7 | ||
|
|
6bd127a313 | ||
|
|
4b7643d833 | ||
|
|
3f96592c99 | ||
|
|
98018fc63b | ||
|
|
aeac4d6d20 | ||
|
|
9e9a80df31 | ||
|
|
5f07b1c3b1 | ||
|
|
bfea2204eb | ||
|
|
fb30cd3db3 | ||
|
|
584cb9ac9d | ||
|
|
428ee141e1 | ||
|
|
ec9718466d | ||
|
|
c5bb08022a | ||
|
|
b710745e88 | ||
|
|
5cf84fe9b7 | ||
|
|
27991a7822 | ||
|
|
d1e2f0ced0 | ||
|
|
e848306187 | ||
|
|
2ee9d7e66d | ||
|
|
e31585842d | ||
|
|
f068b4ab75 | ||
|
|
26e29409a9 | ||
|
|
4923129d10 | ||
|
|
8ab55e2193 | ||
|
|
9bc7ef3b5a | ||
|
|
9431ad835c | ||
|
|
2984d7d4f8 | ||
|
|
6324036e41 | ||
|
|
3287799959 | ||
|
|
f95e5d3339 | ||
|
|
52b4bae423 | ||
|
|
037592087c | ||
|
|
3eb8e732ea | ||
|
|
761b92afce | ||
|
|
b5f43ee993 | ||
|
|
76da97f090 | ||
|
|
7554e45f60 | ||
|
|
6994acb91d | ||
|
|
bccfec86ba | ||
|
|
114fd53cd1 | ||
|
|
c8f41164c5 | ||
|
|
6f303ff957 | ||
|
|
95a49697f7 | ||
|
|
8846f5f070 | ||
|
|
4f09e515ee | ||
|
|
551f4ff322 | ||
|
|
d5a9301c7f | ||
|
|
34915e3b16 | ||
|
|
c55aad775e | ||
|
|
ac3f0633cd | ||
|
|
d55567a634 | ||
|
|
abcb141737 | ||
|
|
8d97adc1dc | ||
|
|
5c37d54070 | ||
|
|
fecaacd5be | ||
|
|
53bc3538da | ||
|
|
0e0655b316 | ||
|
|
5058f5ddcf | ||
|
|
4a1c9c48a2 | ||
|
|
5e74ff39f2 | ||
|
|
b5c07385e9 | ||
|
|
bfb10d172b | ||
|
|
00a77181ef | ||
|
|
e13468dc43 | ||
|
|
d3b137c919 | ||
|
|
e292c8a7c7 | ||
|
|
ce195998c1 | ||
|
|
e20cf8b386 | ||
|
|
c4a726397d | ||
|
|
7fab85b389 | ||
|
|
12d2c7be69 | ||
|
|
26955f4f36 | ||
|
|
56df0736fa | ||
|
|
695939ac74 | ||
|
|
4c06851e0e | ||
|
|
23e4bc406e | ||
|
|
fe18c4d1d6 | ||
|
|
e6fdeb0b31 | ||
|
|
5ec4b3c17d | ||
|
|
6e94d0a179 | ||
|
|
4357045904 | ||
|
|
1ef71d7492 | ||
|
|
1fc985db7e | ||
|
|
364428ca1e | ||
|
|
09b549a862 | ||
|
|
2d238a8c36 | ||
|
|
7a0309284a | ||
|
|
fd3f1724e6 | ||
|
|
ca40c698a2 | ||
|
|
fb6254e501 | ||
|
|
cf9d96477b | ||
|
|
493d0ad91a | ||
|
|
a0e88919a6 | ||
|
|
237962c3be | ||
|
|
1637acce6e | ||
|
|
68c4f8c822 | ||
|
|
784d5ec346 | ||
|
|
955834e453 | ||
|
|
435f36b6e9 | ||
|
|
08c48f3acb | ||
|
|
ff1870cedc | ||
|
|
5e51ee1bb2 | ||
|
|
55f1a37b3d | ||
|
|
58dff0a1e9 | ||
|
|
fc543f1ca5 | ||
|
|
2e068e66d4 | ||
|
|
a4c346d4a2 | ||
|
|
fe14d1f7e3 | ||
|
|
f4b39dfe80 | ||
|
|
7d86ed1d9c | ||
|
|
506de65dae | ||
|
|
08384c7540 | ||
|
|
94ae6713aa | ||
|
|
838a2b425a | ||
|
|
1a5ee57a6f | ||
|
|
d539e6b96b | ||
|
|
3ade036d34 | ||
|
|
f3c49e86ae | ||
|
|
b2401b8458 | ||
|
|
51bb8767e3 | ||
|
|
c0fbe9b182 | ||
|
|
01287d9e7e | ||
|
|
70fb2fbfb2 | ||
|
|
b6f116108c | ||
|
|
03aca7cdac | ||
|
|
96da88e168 | ||
|
|
b6cceab218 | ||
|
|
95b16be714 | ||
|
|
d31ad79bc0 | ||
|
|
5745805a5d | ||
|
|
590f7a58fa | ||
|
|
027b19c5db | ||
|
|
7670673a39 | ||
|
|
824b9bf607 | ||
|
|
155183eb30 | ||
|
|
b10a84466b | ||
|
|
0aa0f47a9d | ||
|
|
5f91be7c21 | ||
|
|
e3e2cfa9d1 | ||
|
|
d1b4e62d4d | ||
|
|
ff1b846b73 | ||
|
|
ad47d4a0d2 | ||
|
|
c080b79c5b | ||
|
|
f19f614e0d | ||
|
|
8fbf617e05 | ||
|
|
a9d30cdf4a | ||
|
|
4c27c8afeb | ||
|
|
9d591674aa | ||
|
|
e40d21760a | ||
|
|
2445c290c9 | ||
|
|
04890e0c73 | ||
|
|
ab52db2037 | ||
|
|
aac896b044 | ||
|
|
fb037022ba | ||
|
|
a75b7a1c87 | ||
|
|
f2fd4fb34e | ||
|
|
2079577314 | ||
|
|
416914a346 | ||
|
|
1e5e6f4891 | ||
|
|
4c37e79dae | ||
|
|
9a8545b725 | ||
|
|
ee3116513b | ||
|
|
729357b7c0 | ||
|
|
07ab7d52c6 | ||
|
|
d7be903297 | ||
|
|
d0b184939f | ||
|
|
c36383bf28 | ||
|
|
eba0d703c5 | ||
|
|
dfb27d41dc | ||
|
|
cf4dbdeade | ||
|
|
f3fe7f268e | ||
|
|
88fe076216 | ||
|
|
4956460773 | ||
|
|
eafa203205 | ||
|
|
7317a653c7 | ||
|
|
0fddc3bf05 | ||
|
|
724a22e48d | ||
|
|
6db3da1cc0 | ||
|
|
86bfb0648c | ||
|
|
c6360adccb | ||
|
|
2d51f29199 | ||
|
|
323449c2c3 | ||
|
|
6808d56c9d | ||
|
|
e3b0314382 | ||
|
|
a900fd550f | ||
|
|
034f52b7e7 | ||
|
|
e7c9c21a49 | ||
|
|
be6223f1fb | ||
|
|
da9fc75b1e | ||
|
|
7645dd4c1f | ||
|
|
7dfa161422 | ||
|
|
b84e82eb56 | ||
|
|
d7924ea8c7 | ||
|
|
bd5555afaa | ||
|
|
f275d1e030 | ||
|
|
1bf414c745 | ||
|
|
ecc92f473a | ||
|
|
56b9bfa5a3 | ||
|
|
209dc4fc5d | ||
|
|
db27f5c8d3 | ||
|
|
106e1d5136 | ||
|
|
d269ccb7e7 | ||
|
|
505d478724 | ||
|
|
b842644686 | ||
|
|
60d570756f | ||
|
|
eea6fe1a0e | ||
|
|
25b7be6739 | ||
|
|
91d51f3f0a | ||
|
|
ff6425e6c5 | ||
|
|
e853b00fe2 | ||
|
|
4a7a33e29a | ||
|
|
25b6b86c26 | ||
|
|
e4be0b0492 | ||
|
|
db6158e9e2 | ||
|
|
a0c56fa352 | ||
|
|
c181b74a88 | ||
|
|
02b3dfab48 | ||
|
|
b09538d242 | ||
|
|
0dcd9e3d03 | ||
|
|
897db76aa7 | ||
|
|
ee019fb1c2 | ||
|
|
9599303c4c | ||
|
|
8041a2274c | ||
|
|
ab8ea8438f | ||
|
|
f240bdf156 | ||
|
|
ff84c43c10 | ||
|
|
dbb2765553 | ||
|
|
7e3b193d49 | ||
|
|
2a9fceb51c | ||
|
|
d1ddb74235 | ||
|
|
b6bb42e460 | ||
|
|
5456d9ff83 | ||
|
|
a23fdedfa2 | ||
|
|
3463628165 | ||
|
|
d1b33c78c6 | ||
|
|
fbece725e1 | ||
|
|
1f23e2ed93 | ||
|
|
99132ac8fc | ||
|
|
118448538c | ||
|
|
2e65c055b8 | ||
|
|
3da7b276d3 | ||
|
|
63e5be80ab | ||
|
|
92d88fe761 | ||
|
|
c4ffb9473f | ||
|
|
3a7e11c995 | ||
|
|
b0c777c480 | ||
|
|
b00b018056 | ||
|
|
b974f10c6e | ||
|
|
72777a8c74 | ||
|
|
e08cd839be | ||
|
|
5309848292 | ||
|
|
1271aafcdd | ||
|
|
54a507d906 | ||
|
|
ea17ae1074 | ||
|
|
fe9046cecf | ||
|
|
b5e9d15391 | ||
|
|
dcd0cdb8f7 | ||
|
|
a53ebb65ee | ||
|
|
a5d30c00b3 | ||
|
|
fd36b92224 | ||
|
|
30cd39fd8f | ||
|
|
31a4b69bbd | ||
|
|
7848180454 | ||
|
|
69fecaeaab | ||
|
|
04098db74c | ||
|
|
96a7c6ce76 | ||
|
|
29418e14f2 | ||
|
|
ac0a3fbced | ||
|
|
a29bf6e97b | ||
|
|
69b626e919 | ||
|
|
63d7866d06 | ||
|
|
27a289217f | ||
|
|
1ae2ae0be8 | ||
|
|
fd128abd13 | ||
|
|
8f44f10bc9 | ||
|
|
23fa4284a8 | ||
|
|
c1a4bb47b6 | ||
|
|
0ae5bce70a | ||
|
|
2cb05fd838 | ||
|
|
117a03ca8e | ||
|
|
84317a1607 |
No files matched your search
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
* text=auto
|
||||||
|
*.sh text eol=lf
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
name: 功能、缺陷或迁移
|
||||||
|
about: 记录唯一负责仓库、可复现候选与验收
|
||||||
|
---
|
||||||
|
|
||||||
|
## 问题与所有权
|
||||||
|
|
||||||
|
- 责任组件(全局 ID / 仓库):
|
||||||
|
- 类型:bug | missing capability | contract change | migration
|
||||||
|
- 影响消费者(ID / 关联工单):
|
||||||
|
- 权威合同链接:
|
||||||
|
|
||||||
|
## 可复现的候选组合
|
||||||
|
|
||||||
|
- 根 / 领域 / 组件 SHA:
|
||||||
|
- CLI、Worker、Stdlib、依赖制品 SHA-256 与平台:
|
||||||
|
- 环境与工具链:
|
||||||
|
- 最小 fixture / 命令 / 实际结果:
|
||||||
|
- 预期结果:
|
||||||
|
|
||||||
|
## 修复范围
|
||||||
|
|
||||||
|
- 必须:
|
||||||
|
- 禁止:兼容旧协议、复制实现、无关重构、扩大权限等
|
||||||
|
- 上游阻塞:<工单链接或无>
|
||||||
|
|
||||||
|
## 验收
|
||||||
|
|
||||||
|
- 正例:
|
||||||
|
- 负例 / 授权与安全边界:
|
||||||
|
- 回归 / 性能条件:
|
||||||
|
- 组件 CI:
|
||||||
|
- 领域 / 消费者组合测试:
|
||||||
|
- 修复提交与制品证据:
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
## 工单与责任仓库
|
||||||
|
|
||||||
|
- 责任工单:
|
||||||
|
- 唯一责任仓库与组件 ID:
|
||||||
|
- 本次变更是否涉及 domain、gitlink、`planned → active` 或公共合同:<是/否,说明>
|
||||||
|
|
||||||
|
## 组合与证据
|
||||||
|
|
||||||
|
- 组件提交(C2)/ 领域组合(B2)/ 根组合(A2):
|
||||||
|
- C1/C2/C3 CI 链接:
|
||||||
|
- 可复现命令、平台、依赖制品摘要:
|
||||||
|
- 本次未运行 / UNVERIFIED 的项:
|
||||||
|
|
||||||
|
## 分层与边界检查
|
||||||
|
|
||||||
|
- [ ] 变更落在唯一责任仓库,聚合仓未引入生产实现
|
||||||
|
- [ ] 未创建占位 gitlink 或伪造 active `entry`;planned 不计入验收
|
||||||
|
- [ ] 公共合同变更与实际消费者配对候选,未引入旧协议 fallback
|
||||||
|
- [ ] 主仓库只更新精确 gitlink、治理文件与集成脚本,未借机重构无关组件
|
||||||
|
- [ ] 未在根或聚合脚本中加入 workaround、复制协议或绕开权限
|
||||||
|
|
||||||
|
## 发行与回滚
|
||||||
|
|
||||||
|
- 公共协议 / 制品影响:
|
||||||
|
- 旧基线或回滚方式(恢复上一组已接受 gitlink):
|
||||||
Regular → Executable
+9
-1
@@ -1 +1,9 @@
|
|||||||
/target
|
.env
|
||||||
|
.env.*
|
||||||
|
/.migration-work/
|
||||||
|
/.integration-work/
|
||||||
|
/__pycache__/
|
||||||
|
**/__pycache__/
|
||||||
|
|
||||||
|
# Local build/cache/scratch (DSH workspace tooling)
|
||||||
|
/.build/
|
||||||
+102
@@ -0,0 +1,102 @@
|
|||||||
|
[submodule "cli"]
|
||||||
|
path = cli
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-cli.git
|
||||||
|
[submodule "tests/conformance"]
|
||||||
|
path = tests/conformance
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-extension-conformance.git
|
||||||
|
[submodule "tools/view"]
|
||||||
|
path = tools/view
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-view.git
|
||||||
|
[submodule "tools/knowledge"]
|
||||||
|
path = tools/knowledge
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-knowledge.git
|
||||||
|
[submodule "tools/prove"]
|
||||||
|
path = tools/prove
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-prove.git
|
||||||
|
[submodule "tools/lint"]
|
||||||
|
path = tools/lint
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-lint.git
|
||||||
|
[submodule "extensions/ai"]
|
||||||
|
path = extensions/ai
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-ai.git
|
||||||
|
[submodule "extensions/archive"]
|
||||||
|
path = extensions/archive
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-archive.git
|
||||||
|
[submodule "extensions/browser"]
|
||||||
|
path = extensions/browser
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-browser.git
|
||||||
|
[submodule "extensions/cache"]
|
||||||
|
path = extensions/cache
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-cache.git
|
||||||
|
[submodule "extensions/crypto"]
|
||||||
|
path = extensions/crypto
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-crypto.git
|
||||||
|
[submodule "extensions/database"]
|
||||||
|
path = extensions/database
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-database.git
|
||||||
|
[submodule "extensions/datetime"]
|
||||||
|
path = extensions/datetime
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-datetime.git
|
||||||
|
[submodule "extensions/document"]
|
||||||
|
path = extensions/document
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-document.git
|
||||||
|
[submodule "extensions/engineering"]
|
||||||
|
path = extensions/engineering
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-engineering.git
|
||||||
|
[submodule "extensions/http"]
|
||||||
|
path = extensions/http
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-http.git
|
||||||
|
[submodule "extensions/linalg"]
|
||||||
|
path = extensions/linalg
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-linalg.git
|
||||||
|
[submodule "extensions/math"]
|
||||||
|
path = extensions/math
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-math.git
|
||||||
|
[submodule "extensions/mcp"]
|
||||||
|
path = extensions/mcp
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-mcp.git
|
||||||
|
[submodule "extensions/quantum"]
|
||||||
|
path = extensions/quantum
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-quantum.git
|
||||||
|
[submodule "extensions/regex"]
|
||||||
|
path = extensions/regex
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-regex.git
|
||||||
|
[submodule "extensions/security"]
|
||||||
|
path = extensions/security
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-security.git
|
||||||
|
[submodule "extensions/storage"]
|
||||||
|
path = extensions/storage
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-storage.git
|
||||||
|
[submodule "extensions/web"]
|
||||||
|
path = extensions/web
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-web.git
|
||||||
|
[submodule "extensions/websocket"]
|
||||||
|
path = extensions/websocket
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-ext-websocket.git
|
||||||
|
[submodule "stdlib/collections"]
|
||||||
|
path = stdlib/collections
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-std-collections.git
|
||||||
|
[submodule "stdlib/core"]
|
||||||
|
path = stdlib/core
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-std-core.git
|
||||||
|
[submodule "stdlib/data"]
|
||||||
|
path = stdlib/data
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-std-data.git
|
||||||
|
[submodule "stdlib/encoding"]
|
||||||
|
path = stdlib/encoding
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-std-encoding.git
|
||||||
|
[submodule "stdlib/fs"]
|
||||||
|
path = stdlib/fs
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-std-fs.git
|
||||||
|
[submodule "stdlib/io"]
|
||||||
|
path = stdlib/io
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-std-io.git
|
||||||
|
[submodule "stdlib/net"]
|
||||||
|
path = stdlib/net
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-std-net.git
|
||||||
|
[submodule "stdlib/system"]
|
||||||
|
path = stdlib/system
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-std-system.git
|
||||||
|
[submodule "stdlib/text"]
|
||||||
|
path = stdlib/text
|
||||||
|
url = https://git.cflmy.cn/cflmy/marqdo-std-text.git
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
when:
|
||||||
|
event: [push, pull_request, manual]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
layout:
|
||||||
|
image: rust:1.100-bookworm
|
||||||
|
commands:
|
||||||
|
- apt-get update && apt-get install -y --no-install-recommends ca-certificates git python3
|
||||||
|
- python3 scripts/check-layout.py
|
||||||
|
- python3 -m unittest discover -s tests/integration
|
||||||
|
- git submodule update --init
|
||||||
|
- |
|
||||||
|
set -eu
|
||||||
|
domains="$(python3 scripts/check-layout.py --domain-paths)"
|
||||||
|
for domain in $domains; do
|
||||||
|
git -C "$domain" submodule update --init
|
||||||
|
done
|
||||||
|
- python3 scripts/check-layout.py --checkouts
|
||||||
|
|
||||||
|
candidate:
|
||||||
|
# Match the Linux/glibc environment already used by View for the RC.4 artifact.
|
||||||
|
image: mcr.microsoft.com/playwright:v1.49.0-noble
|
||||||
|
depends_on: [layout]
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
set -eu
|
||||||
|
for attempt in 1 2 3; do
|
||||||
|
if apt-get -o Acquire::By-Hash=force -o Acquire::Retries=3 update --error-on=any; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ "$attempt" -eq 3 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 15
|
||||||
|
done
|
||||||
|
apt-get -o Acquire::Retries=3 install -y --no-install-recommends ca-certificates curl git python3 python3-jsonschema build-essential
|
||||||
|
curl -fsSL --retry 3 https://sh.rustup.rs -o /tmp/marqdo-rustup.sh
|
||||||
|
sh /tmp/marqdo-rustup.sh -y --profile minimal --default-toolchain 1.100.0 --no-modify-path
|
||||||
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
bash scripts/integration.sh
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Marqdo 维护指引
|
||||||
|
|
||||||
|
1. 从 [各仓库任务](docs/REPOSITORY-TASKS.md)、[组件目录](components.toml) 与 [架构边界](docs/ARCHITECTURE.md) 确定**唯一**责任仓库:功能缺陷在功能仓库,领域合同/组合在领域聚合仓库,gitlink、跨领域集成、发行组合与治理在主仓库。主仓库和聚合仓库不实现子组件业务。
|
||||||
|
2. 治理树最多两级:根 → 领域聚合(`kind = "domain"`)→ 功能组件。每个组件只有一个父级,全局 ID 与权威远端唯一,领域聚合仓库只做治理、合同、示例和组合验收。已发布的 `planned` 仓库可以挂载真实 gitlink。激活时登记实际 `entry`,只有通过验收的 active 组件计入完成率。
|
||||||
|
3. 找到或建立责任仓库的工单,按 `.gitea/ISSUE_TEMPLATE/change.md` 记录目标、当前提交、最小复现、公共契约、影响消费者和验收命令。跨仓库阻塞在上游开关联工单,并在消费者记录回归条件。不要按错误最终显示的仓库定责,找第一个违反公开合同的所有者。
|
||||||
|
4. 在责任仓库独立修改、构建和测试。需要调整公共语义时,在 CLI 提交 ADR;调整 Web 作者面语义时,只在 `marqdo-ext-web` 的 [WEB-DESIGN 合同](https://git.cflmy.cn/cflmy/marqdo-ext-web/src/branch/main/docs/WEB-DESIGN.md) 走 ADR,并与实际消费者(Design/Preview)同候选验证;不得并列维护第二份现行规范或旧协议 fallback。
|
||||||
|
5. 逐层晋升:功能提交 C2 通过组件 CI → 领域 PR 更新 gitlink 至 C2 并通过领域 CI(B2)→ 主仓库 PR 更新领域 gitlink 至 B2 并通过根递归校验与受影响组合验收(A2)。先推送子仓库提交,再在主仓库提交精确 gitlink;区分组件 CI、公共契约 CI 和生态 CI 证据。以 [开发流程](docs/DEVELOPMENT.md) 为准。
|
||||||
|
6. 新接入组件先核对公开 API、直接依赖、独立入口和实际测试。空仓在 [迁移台账](docs/MIGRATION.md) 中保持 `planned`;Web 领域的 Design/Preview 子组件记录在 `marqdo-ext-web` 自己的 `components.toml`,根目录不登记其后代路径。
|
||||||
|
7. 记录 FAIL 和 UNVERIFIED 的具体环境、命令和日志。只有实际通过且匹配候选 SHA 的证据才可用于集成与发行;模拟、mock 或原型测试不能冒充生产验收。
|
||||||
|
8. Web 边界硬约束:不新增 CLI 核心语法或 Web 专属关键字;不复制 Markdown/语言解析器;默认不允许 HTML 注入、业务 JS 或真实网络/数据库/认证;预览是有限确定性解释,生产实现由成熟框架在目标应用仓库承担。
|
||||||
Generated
-7
@@ -1,7 +0,0 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
|
||||||
# It is not intended for manual editing.
|
|
||||||
version = 4
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "marqdo"
|
|
||||||
version = "0.1.0"
|
|
||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "marqdo"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "marqdo"
|
|
||||||
path = "src/marqdo.rs"
|
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
# Marqdo
|
||||||
|
|
||||||
|
**Marqdo 是一门以 Markdown 为源文档的编程语言。** 用 `.mq.md` 可以把业务规则、公式、解释和可执行步骤写在同一份文档中。读者用 Markdown 阅读器查看正文,开发者用 Marqdo 检查、运行和验证其中的程序。这个仓库维护生态组件的集成、验收和发行入口。
|
||||||
|
|
||||||
|
生态治理采用有限分层:主仓库固定领域聚合仓库,领域聚合仓库固定本领域功能仓库,最多两级 Gitlink。主仓库和聚合仓库只做治理、组合与验收,不实现子组件业务;Web 领域把设计文档直接作为原型与工程交付的源材料,详见 [架构边界](docs/ARCHITECTURE.md)。
|
||||||
|
|
||||||
|
## 为什么开发 Marqdo
|
||||||
|
|
||||||
|
规则通常写在说明文档里,实现放在脚本里,结果再写进报告。三份内容分开维护后,读者很难确认某个结果用了哪条规则,也很难重新验证。Marqdo 让解释和计算随同一份源文档修改、评审和运行。它适合写带示例的算法说明、可重跑的分析流程,以及需要交代验证过程的知识文档。
|
||||||
|
|
||||||
|
## 主要特性
|
||||||
|
|
||||||
|
- **Markdown 原生**。文档保留 CommonMark/GFM 的结构,并支持公式。在 `.mq.md` 中,以 `@exec` 标明可执行区,以 `@knowledge` 标明说明与知识区。正文可以直接阅读。
|
||||||
|
- **先检查,再运行**。`marqdo check` 静态检查语法与调用,`--refs` 检查文档引用。Analysis 提供结构化分析结果,供编辑器和独立工具使用。
|
||||||
|
- **可观察的运行**。Rust 解释器显式运行文档代码,Observation 记录执行事件与结果。文件、网络、进程等外部操作受运行模式与能力授权约束。
|
||||||
|
- **可组合的生态**。基础发行包含标准库。程序可以通过锁文件固定包与领域扩展的来源和摘要。阅读、知识索引、证明和静态诊断由独立工具提供。
|
||||||
|
|
||||||
|
## 快速开始
|
||||||
|
|
||||||
|
从 [CLI 发行页](https://git.cflmy.cn/cflmy/marqdo-cli/releases) 下载适合平台的发行包。把解包目录加入 `PATH`,保持 CLI、Worker 和旁置 `stdlib/` 的目录结构。将下面的内容保存为 `hello.mq.md`。
|
||||||
|
|
||||||
|
````markdown
|
||||||
|
# 问候示例
|
||||||
|
|
||||||
|
这一节说明程序的用途。下方函数由 CLI 执行。
|
||||||
|
|
||||||
|
## @exec main
|
||||||
|
|
||||||
|
`params()`
|
||||||
|
|
||||||
|
`打印("你好,Marqdo")`
|
||||||
|
````
|
||||||
|
|
||||||
|
```sh
|
||||||
|
marqdo check hello.mq.md
|
||||||
|
marqdo run hello.mq.md
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
你好,Marqdo
|
||||||
|
```
|
||||||
|
|
||||||
|
[CLI 使用指南](https://git.cflmy.cn/cflmy/marqdo-cli) · [语言规范](https://git.cflmy.cn/cflmy/marqdo-cli/src/branch/master/spec/mapping.md)
|
||||||
|
|
||||||
|
## 仓库与职责
|
||||||
|
|
||||||
|
### 已接入的核心和工具
|
||||||
|
|
||||||
|
| 仓库 | 职责 |
|
||||||
|
| --- | --- |
|
||||||
|
| [marqdo](https://git.cflmy.cn/cflmy/marqdo) | 生态主仓库,维护仓库索引、固定提交组合、跨仓库验收与发行 |
|
||||||
|
| [marqdo-cli](https://git.cflmy.cn/cflmy/marqdo-cli) | 语言规范、Rust 解释器、CLI、运行权限和公开协议 |
|
||||||
|
| [marqdo-extension-conformance](https://git.cflmy.cn/cflmy/marqdo-extension-conformance) | 用冻结的真实 CLI 独立验收包、插件、Provider、Foreign 和 Tool |
|
||||||
|
| [marqdo-knowledge](https://git.cflmy.cn/cflmy/marqdo-knowledge) | 使用公开 Analysis 编译、索引和检索知识文档 |
|
||||||
|
| [marqdo-prove](https://git.cflmy.cn/cflmy/marqdo-prove) | 处理证明依赖、Lean 证书与独立重放 |
|
||||||
|
| [marqdo-view](https://git.cflmy.cn/cflmy/marqdo-view) | 阅读和预览文档、显示执行观察、静态导出 |
|
||||||
|
| [marqdo-lint](https://git.cflmy.cn/cflmy/marqdo-lint) | 静态规则、诊断定位与显式修复 |
|
||||||
|
|
||||||
|
### 独立产品
|
||||||
|
|
||||||
|
| 仓库 | 职责 |
|
||||||
|
| --- | --- |
|
||||||
|
| [marqdo-site](https://git.cflmy.cn/cflmy/marqdo-site) | 官网、入门文档、静态站点构建与托管 |
|
||||||
|
| [marqdo-vscode](https://git.cflmy.cn/cflmy/marqdo-vscode) | VS Code 文件关联、编辑体验、CLI 集成与 VSIX 发布 |
|
||||||
|
|
||||||
|
### 标准库
|
||||||
|
|
||||||
|
标准库组件负责低层通用能力,验收后共同组成基础发行的标准库 Bundle。`stdlib/` 的子模块固定各独立仓库的开发提交,状态为 `planned`。 [标准库目录](stdlib/README.md)
|
||||||
|
|
||||||
|
| 仓库 | 职责 |
|
||||||
|
| --- | --- |
|
||||||
|
| [marqdo-std-core](https://git.cflmy.cn/cflmy/marqdo-std-core) | Result 与基础数值 |
|
||||||
|
| [marqdo-std-collections](https://git.cflmy.cn/cflmy/marqdo-std-collections) | List、Map 和 Table 值操作 |
|
||||||
|
| [marqdo-std-text](https://git.cflmy.cn/cflmy/marqdo-std-text) | Unicode 文本、字节值与 UTF-8 |
|
||||||
|
| [marqdo-std-encoding](https://git.cflmy.cn/cflmy/marqdo-std-encoding) | Base64、Base32 和 Hex |
|
||||||
|
| [marqdo-std-data](https://git.cflmy.cn/cflmy/marqdo-std-data) | JSON、CSV、TOML 与 GFM 数据转换 |
|
||||||
|
| [marqdo-std-io](https://git.cflmy.cn/cflmy/marqdo-std-io) | Console、Stream、格式化和官方 print 别名 |
|
||||||
|
| [marqdo-std-fs](https://git.cflmy.cn/cflmy/marqdo-std-fs) | 文件、目录与路径 |
|
||||||
|
| [marqdo-std-system](https://git.cflmy.cn/cflmy/marqdo-std-system) | 时钟、UTC、环境、进程与随机 |
|
||||||
|
| [marqdo-std-net](https://git.cflmy.cn/cflmy/marqdo-std-net) | TCP、UDP、TLS 和网络字节流 |
|
||||||
|
|
||||||
|
### 领域扩展
|
||||||
|
|
||||||
|
领域扩展负责按需安装的算法、协议和业务能力。`extensions/` 的子模块链接各独立仓库,功能从 `planned` 状态开始开发。 [领域扩展目录](extensions/README.md)
|
||||||
|
|
||||||
|
| 仓库 | 职责 |
|
||||||
|
| --- | --- |
|
||||||
|
| [marqdo-ext-math](https://git.cflmy.cn/cflmy/marqdo-ext-math) | 数值算法、统计、符号数学及绘图 |
|
||||||
|
| [marqdo-ext-linalg](https://git.cflmy.cn/cflmy/marqdo-ext-linalg) | 复数、矩阵、分解及数值线性代数 |
|
||||||
|
| [marqdo-ext-quantum](https://git.cflmy.cn/cflmy/marqdo-ext-quantum) | 量子电路、态向量、采样与模拟 |
|
||||||
|
| [marqdo-ext-http](https://git.cflmy.cn/cflmy/marqdo-ext-http) | HTTP、URL、SSE 与报文生命周期 |
|
||||||
|
| [marqdo-ext-websocket](https://git.cflmy.cn/cflmy/marqdo-ext-websocket) | WebSocket 握手、帧与连接语义 |
|
||||||
|
| [marqdo-ext-ai](https://git.cflmy.cn/cflmy/marqdo-ext-ai) | 模型协议、流式输出与工具调用数据 |
|
||||||
|
| [marqdo-ext-mcp](https://git.cflmy.cn/cflmy/marqdo-ext-mcp) | MCP 协议、传输、发现和调用 |
|
||||||
|
| [marqdo-ext-crypto](https://git.cflmy.cn/cflmy/marqdo-ext-crypto) | 成熟密码学实现的封装 |
|
||||||
|
| [marqdo-ext-database](https://git.cflmy.cn/cflmy/marqdo-ext-database) | SQL 参数绑定、事务和驱动连接 |
|
||||||
|
| [marqdo-ext-storage](https://git.cflmy.cn/cflmy/marqdo-ext-storage) | 本地和对象存储接口 |
|
||||||
|
| [marqdo-ext-cache](https://git.cflmy.cn/cflmy/marqdo-ext-cache) | TTL、缓存和失效 |
|
||||||
|
| [marqdo-ext-security](https://git.cflmy.cn/cflmy/marqdo-ext-security) | 应用身份、会话及权限模型 |
|
||||||
|
| [marqdo-ext-browser](https://git.cflmy.cn/cflmy/marqdo-ext-browser) | 浏览器宿主、WASM 适配、DOM 和事件 |
|
||||||
|
| [marqdo-ext-document](https://git.cflmy.cn/cflmy/marqdo-ext-document) | Markdown 结构与显式文档编辑 |
|
||||||
|
| [marqdo-ext-archive](https://git.cflmy.cn/cflmy/marqdo-ext-archive) | 压缩、安全归档和解包 |
|
||||||
|
| [marqdo-ext-engineering](https://git.cflmy.cn/cflmy/marqdo-ext-engineering) | 工程操作、文件补丁与产物 |
|
||||||
|
| [marqdo-ext-regex](https://git.cflmy.cn/cflmy/marqdo-ext-regex) | 正则匹配、捕获、扫描和替换 |
|
||||||
|
| [marqdo-ext-datetime](https://git.cflmy.cn/cflmy/marqdo-ext-datetime) | IANA 时区、DST 和高级日历 |
|
||||||
|
|
||||||
|
### Web 领域聚合
|
||||||
|
|
||||||
|
Web 领域以设计文档为源材料,面向可交互的原型预览与工程交付。HTTP、数据库、认证和浏览器运行时各自独立维护。`extensions/web` 链接 `planned` 的 Web 领域仓,Design 和 Preview 由该领域仓固定。 [WEB-DESIGN](https://git.cflmy.cn/cflmy/marqdo-ext-web/src/branch/main/docs/WEB-DESIGN.md)
|
||||||
|
|
||||||
|
| 仓库 | 职责 |
|
||||||
|
| --- | --- |
|
||||||
|
| [marqdo-ext-web](https://git.cflmy.cn/cflmy/marqdo-ext-web) | Web 领域聚合:唯一设计合同、示例、组合验收与交付协调,不含生产实现 |
|
||||||
|
| [marqdo-web-design](https://git.cflmy.cn/cflmy/marqdo-web-design) | 设计文档解释、校验、组件/依赖图、诊断与 handoff(独立 Rust library) |
|
||||||
|
| [marqdo-web-preview](https://git.cflmy.cn/cflmy/marqdo-web-preview) | 通用离线预览渲染、有限状态交互与 `web` Tool 发行 |
|
||||||
|
|
||||||
|
## 参与开发
|
||||||
|
|
||||||
|
在负责的独立仓库提交实现和测试。主仓库用 Git 子模块按“根 → 领域 → 功能”最多两级固定提交,组件的发行状态由 catalog 独立记录。需要获取当前组合时,运行:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://git.cflmy.cn/cflmy/marqdo.git
|
||||||
|
cd marqdo
|
||||||
|
git submodule update --init --recursive
|
||||||
|
python3 scripts/check-layout.py --checkouts
|
||||||
|
python3 -m unittest discover -s tests/integration
|
||||||
|
```
|
||||||
|
|
||||||
|
`check-layout.py` 校验每层 catalog、gitlink、权威远端、全局 ID 和依赖图。`--checkouts` 同时核对递归检出的实际提交。`planned` 子模块提供固定开发快照,只有 `active` 组件进入发行验收。
|
||||||
|
|
||||||
|
[各仓库任务](docs/REPOSITORY-TASKS.md) · [组件目录](components.toml) · [架构边界](docs/ARCHITECTURE.md) · [开发流程](docs/DEVELOPMENT.md) · [迁移台账](docs/MIGRATION.md) · [架构决策记录](docs/adr/README.md) · [AGENTS](AGENTS.md)
|
||||||
|
|
||||||
|
旧版实现与文档可在历史标签查阅。 [v2.9.1 历史树](https://git.cflmy.cn/cflmy/marqdo/src/tag/v2.9.1)
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
---
|
|
||||||
title: Marqdo主分支开发记录
|
|
||||||
date: 2026-08-11
|
|
||||||
author: pingan
|
|
||||||
---
|
|
||||||
|
|
||||||
## 前言
|
|
||||||
在经过一周多的ai疯狂开发之后,尽管marqdo已经做出了并拥有了许多非常良好的特性,作者确逐渐感到非常的不安,
|
|
||||||
这种不安来自于崩塌感,作者不知道什么时候,ai就会更改关键的定义,导致突然的崩塌,在开发智能体拓展库的时候作者还尚未有这种感觉,但是在网络拓展库,这种不安定感几乎席卷了作者的全部身心。
|
|
||||||
|
|
||||||
必须承认,ai在没有经过大量训练就撰写一门崭新的语法,定义一些它完全没有接触过的东西对于ai还是太困难了,ai并不能通过我的监督,真正的理解marqdo代码即文档的设计思路,所以,尽管非常的遗憾,作者还是决定回归古法编程,还是手搓代码吧,尽管这意味着marqdo很难赶上ai的浪潮了。
|
|
||||||
|
|
||||||
marqdo的设计初衷很是简单,这就不是一门设计给程序员的语言,哪个程序员会用markdown表格来表示集合呢?不会的,这太过繁复了,但是ai可以,这就使得过去编程语言的范式变得不是那么重要了。
|
|
||||||
|
|
||||||
自然如果只是为了易读性,marqdo并没有完全的开发必要,重点在于对md的支持,作者必须承认谷歌提出的OKF规范,把markdown这种文件格式放到了一个极高的位置,这意味着,可执行的知识体系,如果能做到,为什么不试试?
|
|
||||||
|
|
||||||
此外,jupyter notebook笔记本体积太大不利于管理的问题也是存在的,作者就在想,markdown支持代码块的插入,这个代码如果可以直接执行并放回,这不就是最好的jupyter替代品吗?事实上,在main分支的marqdo已经实现了这个功能,但是还不够好,作者要把marqdo真正做成一门科学计算的顶级语言。
|
|
||||||
|
|
||||||
最后是数学公式的支持,公式库需要能够自动的渲染,高可读,还要能够自动的画图,自动的完成诸多内容,让可执行=正确,让ai支持数学推理不再困难。
|
|
||||||
|
|
||||||
最后,2026年8月11日,我预祝未来的自己,开发成功。
|
|
||||||
|
|
||||||
## 开发
|
|
||||||
|
|
||||||
### Marqdo上下文无关文法
|
|
||||||
|
|
||||||
file -> "---" metadata "---" content ;
|
|
||||||
|
|
||||||
metadata -> file_information |
|
|
||||||
import_lib_name ;
|
|
||||||
|
|
||||||
content -> comment |
|
|
||||||
code_body ;
|
|
||||||
|
|
||||||
comment -> comment_content ;
|
|
||||||
|
|
||||||
code_body -> class |
|
|
||||||
function|
|
|
||||||
code|
|
|
||||||
$formula$|$$formula$$|\[formula\]|
|
|
||||||
```code_block_type
|
|
||||||
code_block
|
|
||||||
```;
|
|
||||||
|
|
||||||
class -> # class_name code_body |
|
|
||||||
# class_name => parent_class_name code_body ;
|
|
||||||
|
|
||||||
function -> function_header param_list body return_stmt ;
|
|
||||||
|
|
||||||
function_header -> ## identifier |
|
|
||||||
### identifier |
|
|
||||||
#### identifier ;
|
|
||||||
|
|
||||||
param_list -> + identifier ;
|
|
||||||
|
|
||||||
body -> statement |
|
|
||||||
branch |
|
|
||||||
loop ;
|
|
||||||
|
|
||||||
return_stmt -> ** statement ** ;
|
|
||||||
|
|
||||||
<!--the number of # stand for the level of function -->
|
|
||||||
|
|
||||||
code -> 1. branch |
|
|
||||||
- loop |
|
|
||||||
statement ;
|
|
||||||
|
|
||||||
<!--Ordered lists represent branch, unordered lists represent loop-->
|
|
||||||
|
|
||||||
branch -> statement ;
|
|
||||||
|
|
||||||
loop -> statement ;
|
|
||||||
|
|
||||||
statement -> > call |
|
|
||||||
literal|
|
|
||||||
`var_value_name`|
|
|
||||||
list and dict|
|
|
||||||
"str"|
|
|
||||||
*statement_without_any_marker*;
|
|
||||||
|
|
||||||
<!--here we use markdown table to stand for list and dict-->
|
|
||||||
|
|
||||||
call -> function_name args;
|
|
||||||
|
|
||||||
literal -> literal_code as other code;
|
|
||||||
|
|
||||||
formula -> latex math code;
|
|
||||||
|
|
||||||
code_block_type -> code_block's code type;
|
|
||||||
|
|
||||||
code_block -> code of a code_block;
|
|
||||||
Submodule
+1
Submodule cli added at 452e9a32bd.
+387
@@ -0,0 +1,387 @@
|
|||||||
|
# 生态组件职责与构建关系。精确提交由 Git tree 的 gitlink 锁定。
|
||||||
|
# 治理树最多两级:根 → 领域聚合(kind = "domain")→ 功能组件。每个聚合仓库只登记直属子组件,
|
||||||
|
# 递归展平后全局 ID 与权威远端唯一;禁止在根同时登记某个计划中聚合及其后代路径。
|
||||||
|
# kind = "domain" 是治理角色:requires = [],release 为 none(普通领域)或 base(Stdlib Bundle 聚合),
|
||||||
|
# 聚合仓自身不含生产实现;其子组件在领域仓库自己的 components.toml 登记。
|
||||||
|
# planned 的 requires 是设计输入,激活前须核对实际 imports 和发布依赖。
|
||||||
|
# 已发布的仓库提交可以作为 planned gitlink 固定,发行验收以 active 状态为准。
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "cli"
|
||||||
|
path = "cli"
|
||||||
|
kind = "core"
|
||||||
|
state = "active"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "语言语义、运行时、受控宿主和公共协议"
|
||||||
|
requires = []
|
||||||
|
checks_with = ["conformance"]
|
||||||
|
release = "base"
|
||||||
|
entry = "tools/release/smoke.py"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "conformance"
|
||||||
|
path = "tests/conformance"
|
||||||
|
kind = "test"
|
||||||
|
state = "active"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "可执行的独立公共协议测试"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "none"
|
||||||
|
entry = "scripts/build_all.sh"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "view"
|
||||||
|
path = "tools/view"
|
||||||
|
kind = "tool"
|
||||||
|
state = "active"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "阅读、运行观察与静态导出"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
entry = "scripts/acceptance.sh"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "knowledge"
|
||||||
|
path = "tools/knowledge"
|
||||||
|
kind = "tool"
|
||||||
|
state = "active"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "静态知识编译与检索"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
entry = "scripts/ci.sh"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "prove"
|
||||||
|
path = "tools/prove"
|
||||||
|
kind = "tool"
|
||||||
|
state = "active"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "证明依赖、证书及 Lean 后端"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
entry = "scripts/package-tool.sh"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "lint"
|
||||||
|
path = "tools/lint"
|
||||||
|
kind = "tool"
|
||||||
|
state = "active"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "静态规则、诊断及显式修复"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
entry = "scripts/package-tool.sh"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "std-core"
|
||||||
|
path = "stdlib/core"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "Result 与基础数值"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "std-collections"
|
||||||
|
path = "stdlib/collections"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "List、Map 和 Table 值操作"
|
||||||
|
requires = ["cli", "std-core"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "std-text"
|
||||||
|
path = "stdlib/text"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "Unicode 文本、字节值与 UTF-8"
|
||||||
|
requires = ["cli", "std-core", "std-collections"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "std-encoding"
|
||||||
|
path = "stdlib/encoding"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "Base64、Base32 和 Hex"
|
||||||
|
requires = ["cli", "std-core", "std-text"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "std-data"
|
||||||
|
path = "stdlib/data"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "JSON、CSV、TOML 与 GFM 数据转换"
|
||||||
|
requires = ["cli", "std-collections", "std-text", "std-encoding"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "std-io"
|
||||||
|
path = "stdlib/io"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "Console、Stream、格式化和官方 print 别名"
|
||||||
|
requires = ["cli", "std-core", "std-text"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "std-fs"
|
||||||
|
path = "stdlib/fs"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "文件、目录与路径"
|
||||||
|
requires = ["cli", "std-io", "std-text"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "std-system"
|
||||||
|
path = "stdlib/system"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "时钟、UTC、环境、进程与随机"
|
||||||
|
requires = ["cli", "std-text", "std-io"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "std-net"
|
||||||
|
path = "stdlib/net"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "TCP、UDP、TLS 和网络字节流"
|
||||||
|
requires = ["cli", "std-io", "std-system"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "math"
|
||||||
|
path = "extensions/math"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "数值算法、统计、符号数学及绘图"
|
||||||
|
requires = ["cli", "std-core", "std-collections", "std-text"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "linalg"
|
||||||
|
path = "extensions/linalg"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "复数、矩阵、分解及数值线性代数"
|
||||||
|
requires = ["cli", "math"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "quantum"
|
||||||
|
path = "extensions/quantum"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "量子电路、态向量、采样与模拟"
|
||||||
|
requires = ["cli", "linalg"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "http"
|
||||||
|
path = "extensions/http"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "HTTP、URL、SSE 与报文生命周期"
|
||||||
|
requires = ["cli", "std-net", "std-text", "std-encoding"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "websocket"
|
||||||
|
path = "extensions/websocket"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "WebSocket 握手、帧与连接语义"
|
||||||
|
requires = ["cli", "http"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "ai"
|
||||||
|
path = "extensions/ai"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "模型协议、流式输出与工具调用数据"
|
||||||
|
requires = ["cli", "http", "std-data"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "mcp"
|
||||||
|
path = "extensions/mcp"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "MCP 协议、传输、发现和调用"
|
||||||
|
requires = ["cli", "http", "std-system"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "crypto"
|
||||||
|
path = "extensions/crypto"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "成熟密码学实现的封装"
|
||||||
|
requires = ["cli", "std-encoding"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "database"
|
||||||
|
path = "extensions/database"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "SQL 参数绑定、事务和驱动连接"
|
||||||
|
requires = ["cli", "std-data"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "storage"
|
||||||
|
path = "extensions/storage"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "本地和对象存储接口"
|
||||||
|
requires = ["cli", "std-fs"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "cache"
|
||||||
|
path = "extensions/cache"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "TTL、缓存和失效"
|
||||||
|
requires = ["cli", "std-system"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "security"
|
||||||
|
path = "extensions/security"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "应用身份、会话及权限模型"
|
||||||
|
requires = ["cli", "crypto", "http"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "web"
|
||||||
|
path = "extensions/web"
|
||||||
|
kind = "domain"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "Web 原型设计领域治理:唯一设计合同、组合验收与交付协调"
|
||||||
|
requires = []
|
||||||
|
checks_with = []
|
||||||
|
release = "none"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "browser"
|
||||||
|
path = "extensions/browser"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "浏览器宿主、WASM 适配、DOM 和事件"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "document"
|
||||||
|
path = "extensions/document"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "Markdown 结构与显式文档编辑"
|
||||||
|
requires = ["cli", "std-fs", "std-text"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "archive"
|
||||||
|
path = "extensions/archive"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "压缩、安全归档和解包"
|
||||||
|
requires = ["cli", "std-text", "std-fs"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "engineering"
|
||||||
|
path = "extensions/engineering"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "工程操作、文件补丁与产物"
|
||||||
|
requires = ["cli", "document", "archive"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "regex"
|
||||||
|
path = "extensions/regex"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "正则匹配、捕获、扫描和替换"
|
||||||
|
requires = ["cli", "std-text"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "datetime"
|
||||||
|
path = "extensions/datetime"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "cflmy"
|
||||||
|
scope = "IANA 时区、DST 和高级日历"
|
||||||
|
requires = ["cli", "std-system"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
# 架构与所有权
|
||||||
|
|
||||||
|
自建 Git `git.cflmy.cn/cflmy` 是代码、工单和合并的权威,`ci.cflmy.cn` 是 CI 权威,GitHub 仅作镜像或分发渠道。主仓库维护生态组件关系、精确组合、跨组件验收、发行与责任治理;领域聚合仓库维护本领域的合同与组合验收;功能仓库拥有唯一实现、测试和缺陷修复。
|
||||||
|
|
||||||
|
## 三种关系,不得混用
|
||||||
|
|
||||||
|
| 关系 | 表达载体 | 用途 | 约束 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 治理树 | `.gitmodules` + Git tree gitlink + 每层 `components.toml` | 源码归属、父级与提交身份 | 每个组件只有一个父级;全局 ID 与权威远端唯一;Gitlink 是提交身份唯一权威,`.gitmodules` 是权威远端唯一记录 |
|
||||||
|
| 构建/制品依赖 DAG | `requires` 与真实 package/Cargo/Tool/Bundle 依赖 | 编译、打包、发行装配顺序 | 可以跨治理树;必须有向无环;聚合节点不是可被程序 import 的包 |
|
||||||
|
| 协同验收关系 | `checks_with` | 跨组件测试与消费者回归 | 不是安装依赖;允许互相测试;调度固定点必须去重且不得互相等待形成死锁 |
|
||||||
|
|
||||||
|
组件关系不能由目录物理位置推导,也不能把兄弟仓库的源码路径当作公开依赖。`requires` 只表达真实直接构建或制品依赖,禁止把计划假想写成实际依赖。
|
||||||
|
|
||||||
|
## 治理树与分层
|
||||||
|
|
||||||
|
治理树最多两级 Gitlink:**根仓库 → 领域聚合仓库 → 功能仓库**(主仓库→领域→功能,深度 2)。新增三级 gitlink 需要生态 ADR 和真实跨仓维护收益,默认拒绝。目录层级不等于运行时依赖层级。
|
||||||
|
|
||||||
|
- **领域(`kind = "domain"`)**:工程治理角色,不是语言层也不是运行协议。领域仓库只登记直属子组件,可拥有 `components.toml`、`.gitmodules`、领域公共规范、跨组件集成测试、综合示例、发布装配脚本、ADR 与维护指南;禁止在其中建立 renderer、解析器、数据库驱动等生产实现,也禁止把子仓库源码复制进普通目录。领域 `requires = []`,`release` 为 `none`(普通领域)或 `base`(Stdlib Bundle 聚合)。
|
||||||
|
- **功能组件**:`kind` 仍为 `core/stdlib/extension/tool/test`,在责任仓库独立实现、测试和发版;`release` 与 `kind` 的对应关系不变(base/optional/none)。
|
||||||
|
- **唯一归属**:一个功能只有一个权威实现,一个组件只有一个治理归属,一个公共边界只有一套现行合同。已有仓库直接复用,不能因为命名不符创建重复实现。
|
||||||
|
- **`planned` 纪律**:已有仓库可以通过 gitlink 固定已发布的开发提交。尚无提交的仓库登记在 [迁移台账](MIGRATION.md)。组件通过联合验收后才晋升为 `active` 并登记实际 `entry`。将直属组件迁入领域时,在同一根候选转移清单和 gitlink,保证一个组件只有一个父级。
|
||||||
|
- **聚合准入**:功能拆分须至少有一种独立价值(独立维护责任、显著不同依赖/安全/平台边界、独立版本与制品、可重复独立验收)。若两个仓库几乎每个 PR 都必须一起改动且接口未稳定,应先收敛合同或合并,不能无限拆分。
|
||||||
|
- **工具目录**(`tools/`)暂不聚合,现有四个 Tool 保持原路径。
|
||||||
|
|
||||||
|
**当前状态**(以 [components.toml](../components.toml) 与 [迁移台账](MIGRATION.md) 为准):根仓库有六个直属 active 组件(`cli`、`conformance`、`view`、`knowledge`、`prove`、`lint`)。九个标准库和十八个独立扩展是根层的 planned 子模块。`extensions/web` 是 planned 领域子模块,Design 和 Preview 由 Web 领域仓挂载。`marqdo-stdlib` 聚合和 `web-components` 仍在计划中。
|
||||||
|
|
||||||
|
## 语言与产品层(不因仓库变多而改变)
|
||||||
|
|
||||||
|
| 层 | 权威所有者 | 允许 | 禁止 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| L0 语言核心 | CLI | Markdown 映射、AST、IR、Value、Memory、求值 | Web/AI/数据库专属关键字 |
|
||||||
|
| L1 平台能力 | CLI Capability Host | 权限、预算、通用资源/扩展机制 | 网页布局和业务协议 |
|
||||||
|
| L2 标准库 | Stdlib 各功能仓库 | 基础发行默认安装的通用低层算法及薄封装 | 依赖领域扩展或大型专业运行环境 |
|
||||||
|
| L3 扩展 | 各领域功能仓库 | 可选专业算法、协议和资源后端 | 修改或复制语言内核 |
|
||||||
|
| L4 应用 | 用户项目 | 使用已发布能力实现具体任务 | 作为默认基础发行依赖 |
|
||||||
|
| Tool(旁路) | 独立工具 | 通过公开 CLI 协议处理源码、分析及制品 | 伪装成 Runtime 插件,反向侵入核心 |
|
||||||
|
|
||||||
|
## 权威记录与递归校验
|
||||||
|
|
||||||
|
每个拥有子模块的聚合仓库只登记直接子组件;普通功能仓库不需要另建治理清单。配置与身份的唯一来源:
|
||||||
|
|
||||||
|
| 记录 | 权威内容 |
|
||||||
|
| --- | --- |
|
||||||
|
| `components.toml`(每层) | 组件 ID、父级路径、kind、state、owner、scope、`requires`、`checks_with`、release、active 入口 |
|
||||||
|
| `.gitmodules`(每层) | 直属子组件权威远端 |
|
||||||
|
| Git tree gitlink | 精确提交身份 |
|
||||||
|
| Cargo.lock / `marqdo.lock` / 现行 Bundle manifest | 相应依赖与制品身份 |
|
||||||
|
|
||||||
|
主仓库 `scripts/check-layout.py` 校验 catalog、gitlink、远端与文件白名单。`--checkouts` 递归读取每个已挂载领域的固定提交,逐层验证 gitlink、远端、工作树和活跃入口,并检查全局 ID、依赖边界和无环性。CI 用 `--domain-paths` 在检出子组件前校验领域远端。 [开发流程](DEVELOPMENT.md)
|
||||||
|
|
||||||
|
## 各领域排他边界
|
||||||
|
|
||||||
|
| 领域 / 功能 | 应拥有 | 不应拥有 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Stdlib/Core、Collections、Text、Encoding、Data、IO、FS、System、Net | 默认安装的通用低层能力及薄封装 | 专业计算、外部服务、HTTP 协议 |
|
||||||
|
| Ext-Net(HTTP/WebSocket) | URL、HTTP 客户端/服务端协议、SSE、Cookie、Multipart、WebSocket 帧与生命周期 | Web 页面模型、应用实时协作状态 |
|
||||||
|
| Web 领域 | 设计模型、快速预览、交付清单与组件复用 | 生产级前端框架、HTTP/DB/认证协议、AI 调度 |
|
||||||
|
| Browser | 将来可选的真实浏览器执行宿主与平台桥 | 本期 Web 原型必需依赖、第二套解释器 |
|
||||||
|
| AI / MCP | 模型访问、流式结果、工具调用数据;MCP 发现/调用/传输 | 全量 Agent 调度、HTTP 实现、Agent 框架 |
|
||||||
|
| Database / Storage / Cache / Auth | 参数化查询与事务、存储接口、TTL 缓存、OIDC/会话/RBAC | Web 后台页面、文件系统原语、替代 Capability Host |
|
||||||
|
| Crypto / Datetime / Regex / Archive | 成熟密码学封装、IANA 时区、完整正则、安全归档 | 自制不安全加密、重复宿主基础原语 |
|
||||||
|
| Document / Engineering | 文档显式编辑、工程操作与产物 | 静态分析或编辑器全栈平台 |
|
||||||
|
| Quantum / Linalg / Math | 量子态/电路/模拟、矩阵/张量/分解、数值与符号数学 | 复制矩阵内核、通用前端框架 |
|
||||||
|
|
||||||
|
上表是规划边界,不是开发完成承诺。旧标准库中 `net/http.mq.md`、`regex.mq.md`、`compress.mq.md` 的迁移必须有真实替代实现与验收才能退出原归属,不得先删造成回归,也不得长期维护两个官方实现。
|
||||||
|
|
||||||
|
## Web 领域
|
||||||
|
|
||||||
|
Web 领域的产品定义是**文档原生、可交互的前端设计原型及工程交付**,不是新的通用前端框架。GFM 表描述组件关系,普通 Markdown 描述内容与意图,链接表达精确的组件引用与设计依赖,有限场景表达交互原型;生产级前端由成熟框架完成。HTTP、数据库、认证、浏览器运行时仍是独立通用能力,不是原型工具的强制依赖。
|
||||||
|
|
||||||
|
- **唯一作者合同**:[marqdo-ext-web 的 WEB-DESIGN](https://git.cflmy.cn/cflmy/marqdo-ext-web/src/branch/main/docs/WEB-DESIGN.md)。主仓库、组件仓库和作者文档都引用它,不并列维护第二份现行合同;合同变更在该领域走 ADR 并与 Design/Preview 同候选验证。
|
||||||
|
- **领域聚合** `marqdo-ext-web`(planned):治理、合同、示例、组合验收;无运行时入口,不实现 renderer/parser。
|
||||||
|
- **Web Design** `marqdo-web-design`(planned):独立 Rust library,唯一解释作者合同、消费真实 CLI Analysis、产出设计模型/诊断/handoff;不启动服务、不渲染 DOM、不复制 CLI parser。
|
||||||
|
- **Web Preview** `marqdo-web-preview`(planned):独立 executable + `tool.json`,注册唯一 `web` 命令;消费 Design 公开 API,生成离线安全预览与有限状态交互;不自行解释表格、不写任务专用 JS、不启动生产服务器。
|
||||||
|
- **组件模板** `web-components`:候选,只有至少两个独立真实复用模板及稳定合同后才准入,不阻塞首版。
|
||||||
|
- **边界**:首版不迁移 WASM、不重新实现语言、不要求旧 plugin 回调,不新增 CLI Web 关键字或 `@component` 语义;复杂视觉、真实登录/支付/数据库/网络和任意状态管理交给生产实现。Web 领域已通过 gitlink 固定开发提交,状态为 `planned`。 [开发流程](DEVELOPMENT.md)
|
||||||
|
|
||||||
|
## 新增能力与公共边界
|
||||||
|
|
||||||
|
先复用职责匹配的组件。需要独立维护、依赖、安全或发行边界时,为新仓库发起评审;加入标准库须证明基础发行默认需要、至少三个领域真实复用、依赖闭包受控,并说明错误、授权和预算语义。
|
||||||
|
|
||||||
|
需要新增 builtin、HostOp、值类型、语法或公共协议字段时,在 CLI 提交 ADR,写明现有机制为何不足、最小复现、三个领域用例、替换及正负例。Web 专属需求不得进入 CLI 核心;设计领域能自己解释的内容留在 Web 合同。公开接口破坏性更新按同一候选组合切换产生者和消费者,保留单套现行协议;历史行为通过固定版本的历史发行复现。
|
||||||
|
|
||||||
|
## 架构门禁
|
||||||
|
|
||||||
|
| 门禁 | 检查与拒绝条件 | 权威 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 归属唯一 | Git tree/catalog 递归一致,一个全局 ID 与远端只出现一次,不允许同功能两个官方实现 | 根 |
|
||||||
|
| 聚合纯度 | 根与领域聚合不含生产实现;新增文件须落在治理/集成/示例职责 | 根/领域 |
|
||||||
|
| 深度 | 超过两级 Gitlink 拒绝,除非批准 ADR 先更新单一规则 | 根 |
|
||||||
|
| 真实依赖 | active 不依赖 planned;requires DAG 无环;无父 checkout 或跨仓私有源码依赖 | 根/组件 |
|
||||||
|
| 标准库准入 | 基础发行默认必需、低层、至少三类真实消费者、依赖与授权有界;新功能默认 extension | Stdlib/根 |
|
||||||
|
| 内核准入 | 新 builtin/HostOp/语法/协议字段须 ADR、最小复现、三个不相关领域用例;Web 专属需求不进入 CLI | CLI |
|
||||||
|
| Web 作者面 | 不新增核心语法、重复表头方言、隐式解析普通文档、HTML 注入默认通道 | Ext-Web/Design |
|
||||||
|
| 通用渲染 | 新普通组件由设计文档复用实现;不得新增任务/页面/业务专用 renderer 分支 | Preview |
|
||||||
|
| 原型诚实性 | 模拟明确标注;无真实后端、无假执行、无伪造生产测试 | Web |
|
||||||
|
| 独立产品 | 组件能独立构建;只有实际产品需要才创建新仓库 | 各级 |
|
||||||
|
| 现行合同唯一 | 不引入旧协议 fallback、版本数组、旧语法探测;配对候选一次切换 | 各级 |
|
||||||
|
| 默认安装规模 | 基础制品不引入可选 Tool/领域环境;体积、构建时间及依赖增长记录基线 | 根/Stdlib |
|
||||||
|
| 范围控制 | 每个 PR 关联责任工单、复现与验收;无关重构拆独立任务 | 各级 |
|
||||||
|
|
||||||
|
每次架构变更须回答:谁是唯一责任方?是否必须新增公开边界?如何证明现有机制不足?能否在单仓修复?新功能能否独立测试?删除或替代了什么?回答不明确则不进入开发。
|
||||||
|
|
||||||
|
跨组件测试以真实 CLI/Worker、独立消费者和现行权限配置验证。Native 后端与外部工具按 CLI 安全边界执行,权限、隔离和预算声明以可验证的实际行为为准。
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
# 开发、验收与发行
|
||||||
|
|
||||||
|
生态采用**逐层候选晋升**:功能仓库修实现,领域聚合仓库固定组合并做领域验收,主仓库固定整个递归树并做生态验收。任何一层失败都停在该层,不让未验证组合进入受保护的分支;回退根 gitlink 即可复现上一个已接受组合,不重写子仓库历史。
|
||||||
|
|
||||||
|
## 责任仓库与工单
|
||||||
|
|
||||||
|
1. 先确定唯一责任仓库:功能行为在功能仓库;领域合同、示例与组合在领域聚合仓库;gitlink、跨领域集成、发行组合与治理在主仓库。拿不准时按“第一个违反公开合同的所有者”定责,而不是按错误最后显示的仓库。
|
||||||
|
2. 在责任仓库找到或建立工单,按 `.gitea/ISSUE_TEMPLATE/change.md` 记录:责任组件与类型、影响消费者、根/领域/组件 SHA、CLI 与依赖制品摘要及平台、最小 fixture 与命令、实际与预期结果、权威合同链接、修复范围、验收命令。
|
||||||
|
3. 跨仓库阻塞在上游仓库开工单,并在消费者工单记录回归条件;不同问题拆分,重复发现追加证据。任何维护者或 AI 都可以读其它仓库定位,但修改必须进入对应责任仓库的独立提交。
|
||||||
|
|
||||||
|
## 分层候选流程
|
||||||
|
|
||||||
|
以 Web 领域为例,一般组件同理:
|
||||||
|
|
||||||
|
```text
|
||||||
|
功能提交 C2(功能仓库,通过组件 CI)
|
||||||
|
-> 领域 PR 将 gitlink 更新到 C2,通过领域 CI,形成 B2
|
||||||
|
-> 主仓库 PR 将领域 gitlink 更新到 B2,通过根递归校验与受影响组合验收,形成 A2
|
||||||
|
```
|
||||||
|
|
||||||
|
- 子模块的 detached HEAD 只用于复现与集成;开发应在子仓库独立创建分支后推送,禁止 `git submodule update --remote` 在发布/验收中追踪浮动分支。
|
||||||
|
- 同一份公共合同切换需要多个组件同步变化时,在一个候选组合中提交整组 gitlink,配对候选联调通过后再晋升;不允许主分支出现半套协议。
|
||||||
|
- 领域激活(planned → active)的门禁:两个功能仓具备真实 `entry` 与候选提交,领域 `components.toml` 与 gitlink 一致,领域 CI 和根递归校验通过,Design/Preview 等有依赖关系的组件获得同候选证据。已发布的开发提交可先作为 `planned` 子模块固定。
|
||||||
|
|
||||||
|
## 递归校验与组合检查
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git submodule update --init --recursive
|
||||||
|
python3 scripts/check-layout.py # 根层:catalog/gitlink/远端/白名单
|
||||||
|
python3 scripts/check-layout.py --checkouts # 递归:各 active 领域固定提交、全局图与依赖
|
||||||
|
python3 -m unittest discover -s tests/integration
|
||||||
|
bash scripts/integration.sh # 生态候选:真实 CLI 制品 + 组件验收
|
||||||
|
```
|
||||||
|
|
||||||
|
- 校验器读取 Git tree 中固定提交的 catalog,不以工作区改动替代候选;`--checkouts` 需要子模块已初始化,缺失、错误 HEAD、脏工作区、错误入口都明确 FAIL/UNVERIFIED,不静默跳过。CI 先验证并检出直属子模块,再用 `--domain-paths` 校验领域的子模块远端,最后逐个领域检出直属子库。
|
||||||
|
- 没有 active 领域时,新校验规则同样接受合法的直属功能组件,这不是历史协议兼容。
|
||||||
|
- 未知的 active 入口、未声明的 gitlink、目录与 catalog 不一致都必须让候选失败。`planned` 不进入验收计数。
|
||||||
|
- 当前 CI 为 `layout` 与 `candidate` 两段;统一 CLI 制品准备、声明驱动调度与递归影响分析仍在推进(见 `.woodpecker/eco.yml` 与主仓库工单),不得以本文件描述当作已实现。
|
||||||
|
|
||||||
|
## 三层验收
|
||||||
|
|
||||||
|
| 层 | 责任与证据 |
|
||||||
|
| --- | --- |
|
||||||
|
| C1 组件 CI | 责任组件独立检出、独立构建与测试、授权负例、固定依赖、打包 smoke;由组件仓库维护 |
|
||||||
|
| C2 公共契约 | 真实 CLI 和 Worker、独立 Conformance 与消费者,覆盖当前协议、失败和正确身份 |
|
||||||
|
| C3 生态集成 | 递归结构校验、公开冷克隆、精确 gitlink、官方基础发行、CLI Tool 与契约消费回归 |
|
||||||
|
|
||||||
|
三层不是重复跑三次测试:同一候选、同一制品、同一环境的有效证据可以复用;身份不匹配必须重跑。每个 active 组件提供独立验收入口(建议 `scripts/ci.sh` 或 `scripts/integration.sh`),从显式传入的 `MARQDO_BIN`、Bundle/依赖制品位置和隔离输出目录读取输入,不自行拉取浮动 CLI 或其它组件 main。
|
||||||
|
|
||||||
|
## 统一 CLI 与制品输入
|
||||||
|
|
||||||
|
- 生态候选使用**固定、可验证**的 CLI/Worker/Stdlib 候选制品;输入必须绑定 CLI gitlink SHA、目标平台、归档/二进制/Bundle digest、工具链与锁。
|
||||||
|
- 标准库 Bundle 的唯一生产者是根仓库的 `scripts/build-stdlib.py`:它从根提交的精确组件 gitlink 读取各 active `kind = "stdlib"` 组件的 `modules/`,校验发布路径(只发布 `.mq.md`、拒绝 symlink/子模块/大小写与 NFC 冲突、`tests/` 不入库),生成现行 `stdlib.json`(tree digest + aliases digest),配置在 `scripts/stdlib-bundle.json`。版本变化必须显式(`--baseline-manifest` 拒绝同版本不同摘要)。组件仓继续拥有源码与测试,根不复制模块。
|
||||||
|
- 组合验收入口是根仓库的 `scripts/acceptance-stdlib.py`:只接受显式 `--cli` 与 `--bundle`(或按根 gitlink 构建),运行各 active 组件的 `entry`、跨仓组合 fixture(别名、Table 切分、默认 Bundle smoke)和必须失败的负例;提供 `--pack-tool` 时用 CLI 自己的打包器做两次确定性打包并核对摘要。CLI 自身打包请使用 Phase A 之后的 `--stdlib-dir` 输入,不再默认读取 CLI 源码树。
|
||||||
|
- 当前候选的冻结制品适配器以正式 RC.4 为基线,临时从 View 的 `frozen-beta.sh` 获取;这属于待替换的过渡实现,CLI 版本不得由任一消费者决定。主仓库统一制品准备落地后,在此切换并记录证据。
|
||||||
|
- 组件验收只读取传入制品,不自行下载未知版本;开发目录覆盖入口(如 `MARQDO_STDLIB_DIR`)不得当作发行行为。缺失、摘要不符或平台不符必须拒绝。
|
||||||
|
|
||||||
|
## 影响范围与调度
|
||||||
|
|
||||||
|
比较已接受根提交与候选递归展开的 `(global_id, parent, remote, SHA, state)`;领域指针变化必须展开差异,不能只标记父节点。变更叶子加入集合后,取反向传递依赖闭包,再加所在祖先领域及需要协同验收的 `checks_with`(固定点去重、不作为构建先决);公共协议/权限/根集成逻辑变化触发相应全量 conformance 与消费者。删除或移动组件用新旧图并集计算受影响者。无法确定影响范围时全量而非跳过;正式发行执行所有 active 组件与完整测试。
|
||||||
|
|
||||||
|
## 工单路由与状态
|
||||||
|
|
||||||
|
| 现象 | 责任归属 |
|
||||||
|
| --- | --- |
|
||||||
|
| 组件表头正确但 Design 未识别 | web-design(若 Analysis 的真实 AST 正确) |
|
||||||
|
| Link 中 `not_loaded` 错误处理 | web-design;若 CLI candidate 违反公开 resolver 合同则 CLI |
|
||||||
|
| 手机布局溢出、场景实例串扰 | web-preview |
|
||||||
|
| 特定设计模板不符合合同 | web-components(激活后)或作者项目,不修改核心 renderer 迎合坏模板 |
|
||||||
|
| Web 设计约定出现冲突 | marqdo-ext-web 协调,Design/Preview 各自提交 |
|
||||||
|
| 真实生产框架渲染/业务错误 | 目标应用仓库,不归 Web 原型 |
|
||||||
|
| SSE 或网络传输错误 | Ext-Net 的 HTTP/WS 或 CLI Resource 真正责任方 |
|
||||||
|
| 固定 SHA 组合构建失败 | 若各组件公开制品正确,由所属聚合/根修复装配,否则责任组件 |
|
||||||
|
|
||||||
|
状态流:`open → triaged → in-progress / blocked → component-verified → integrated`。可用现有 Git 平台标签与关联链接,不设计新工单数据库;阻塞项不能以 mock PASS 关闭。组件 PR 合并后可关闭组件修复工单,但消费者/领域或生态集成任务保留到真实候选组合通过。
|
||||||
|
|
||||||
|
## 自动化权限
|
||||||
|
|
||||||
|
先实现人工触发与 PR/CI 门禁,不开发自动 Agent 管理平台。Webhook 只作通知(记录仓库、完整 SHA、CI URL);上级通过 API 验证存在性、审批与权限后再创建候选 PR,不得自动合入或提升权限。外部不可信 PR、未批准 gitlink 或脚本不得在拥有跨仓库写权限/发版密钥的 runner 中运行;区分只读 checkout/test token、受限 issue/PR token、受保护发布权限。日志不得输出凭证、完整 Analysis 或生产 API key。
|
||||||
|
|
||||||
|
## 发行与回滚
|
||||||
|
|
||||||
|
- 组件可独立 SemVer 发布;领域可发布经过验证的组合制品;根生态 release 固定整个 gitlink 树。独立版本不代表维护多套现行协议。
|
||||||
|
- 每份证据记录根及递归组件 SHA、制品摘要、真实命令、退出码、环境/工具链、日志、测试范围与未验证项。复用现有 manifest/evidence 模式,不复制成新的权威锁。
|
||||||
|
- Git tree 是源码身份权威;Cargo.lock/`marqdo.lock`/现行 Bundle manifest 是对应依赖权威。记录不可变归档校验和、可信来源及获取方法;摘要校验不是发布者身份认证。
|
||||||
|
- 基础发行包含同源 CLI、必需 Worker 与单一标准库 Bundle;不使用浮动 branch/标签名作为发布依据。发布失败保留日志,使用新候选;已有标签和资产保持不可变。回滚用新集成提交恢复上一组通过的 gitlink。
|
||||||
|
|
||||||
|
## Web 领域开发约束
|
||||||
|
|
||||||
|
- 唯一作者合同是 `marqdo-ext-web` 的 `docs/WEB-DESIGN.md`;Design 是唯一解释实现,Preview 不另加解析规则。合同变更在该领域走 ADR,并让 Design/Preview 以配对候选一次切换。
|
||||||
|
- Design 只消费公开 CLI `check --emit` 的 Analysis 3,不复制 Markdown/语言解析器、不依赖 CLI 私有 Rust crate;Preview 只消费 Design 的公开 crate/固定 revision,`,...` 不通过 `../design` 长期路径依赖,最终发布以 `Cargo.lock` 固定真实依赖身份。
|
||||||
|
- 首版不迁移 WASM、不新增 CLI 语义、不要求旧 plugin 回调;模拟状态、原型标识与“未实现真实功能”必须对作者可见。
|
||||||
|
- 真实验收使用真实浏览器 `file://` 制品、真实 CLI 正负例与真实冷安装;原型测试 PASS 不能当作生产测试 PASS。
|
||||||
|
|
||||||
|
## 本地环境
|
||||||
|
|
||||||
|
需要 Linux x86_64/glibc ≥ 2.39、Python 3.11+、Git、Rust、C 编译器和 curl;`integration.sh` 另需 jsonschema 与冻结 CLI 归档。详细命令与组件验收入口见各仓库 `README.md` 与 [各仓库任务](REPOSITORY-TASKS.md)。
|
||||||
|
|
||||||
|
## 迁移台账
|
||||||
|
|
||||||
|
标准库与扩展的现状、历史归属和切换顺序以 [迁移台账](MIGRATION.md) 为准。当前 CLI 内置标准库仍是基础发行的现行权威;`marqdo-stdlib` 聚合与九个功能仓库的迁移完成前,不得声称 Stdlib 拆分完成,也不得先删旧实现造成产品回归。
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
# 迁移台账
|
||||||
|
|
||||||
|
## 权威盘点
|
||||||
|
|
||||||
|
历史主分支最后提交为 `1c55baabd570e18b9da8f9057cef2f848e176690`,v2.9.1 的发布提交为 `ffe06d7afab7acaed87be5ff16edddc37da536a2`。自建 Git 已核验旧标签和主分支。旧实现、文档、示例、测试与工作流以历史提交为迁移资料。[历史主分支末尾](https://git.cflmy.cn/cflmy/marqdo/src/commit/1c55baabd570e18b9da8f9057cef2f848e176690)
|
||||||
|
|
||||||
|
| 已有仓库 | 审计时默认分支 | 发行或证据 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| [marqdo-cli](https://git.cflmy.cn/cflmy/marqdo-cli) | `master` | v3.0.0-rc.4 |
|
||||||
|
| [marqdo-extension-conformance](https://git.cflmy.cn/cflmy/marqdo-extension-conformance) | `main` | 有独立固定 fixture |
|
||||||
|
| [marqdo-knowledge](https://git.cflmy.cn/cflmy/marqdo-knowledge) | `master` | v0.1.0-beta.3 |
|
||||||
|
| [marqdo-lint](https://git.cflmy.cn/cflmy/marqdo-lint) | `main` | v0.2.0 |
|
||||||
|
| [marqdo-prove](https://git.cflmy.cn/cflmy/marqdo-prove) | `master` | v0.1.0-beta.1 |
|
||||||
|
| [marqdo-view](https://git.cflmy.cn/cflmy/marqdo-view) | `master` | v0.3.0 |
|
||||||
|
| [marqdo-ext-web](https://git.cflmy.cn/cflmy/marqdo-ext-web) | `main` | Web 领域聚合,planned;唯一设计合同在 `docs/WEB-DESIGN.md` |
|
||||||
|
| [marqdo-web-design](https://git.cflmy.cn/cflmy/marqdo-web-design) | `main` | Web Design 组件,planned;初始开发文档 |
|
||||||
|
| [marqdo-web-preview](https://git.cflmy.cn/cflmy/marqdo-web-preview) | `main` | Web Preview 组件,planned;初始开发文档 |
|
||||||
|
|
||||||
|
CLI gitlink 采用 RC.4 正式发布源码,以匹配冻结归档和现有 View/Lint 契约。
|
||||||
|
其文档后续提交曾用于 Knowledge 的独立 CI;生态候选以自身测试判定实际组合。
|
||||||
|
Conformance 使用 CLI 已固定的真实 fixture 提交。
|
||||||
|
|
||||||
|
## 标准库和扩展目录
|
||||||
|
|
||||||
|
主仓库的 [标准库目录](../stdlib/README.md) 和 [扩展目录](../extensions/README.md) 通过 Git 子模块固定独立仓库的开发提交。Web Design 和 Preview 从 Web 领域聚合仓递归获取。是否参加发行验收以 [组件目录](../components.toml) 与该组件所在层的 catalog 为准。
|
||||||
|
|
||||||
|
**标准库(planned,聚合仓库 marqdo-stdlib 尚未创建)** · [core](https://git.cflmy.cn/cflmy/marqdo-std-core) · [collections](https://git.cflmy.cn/cflmy/marqdo-std-collections) · [text](https://git.cflmy.cn/cflmy/marqdo-std-text) · [encoding](https://git.cflmy.cn/cflmy/marqdo-std-encoding) · [data](https://git.cflmy.cn/cflmy/marqdo-std-data) · [io](https://git.cflmy.cn/cflmy/marqdo-std-io) · [fs](https://git.cflmy.cn/cflmy/marqdo-std-fs) · [system](https://git.cflmy.cn/cflmy/marqdo-std-system) · [net](https://git.cflmy.cn/cflmy/marqdo-std-net)
|
||||||
|
|
||||||
|
**扩展(planned,独立组件)** · [math](https://git.cflmy.cn/cflmy/marqdo-ext-math) · [linalg](https://git.cflmy.cn/cflmy/marqdo-ext-linalg) · [quantum](https://git.cflmy.cn/cflmy/marqdo-ext-quantum) · [http](https://git.cflmy.cn/cflmy/marqdo-ext-http) · [websocket](https://git.cflmy.cn/cflmy/marqdo-ext-websocket) · [ai](https://git.cflmy.cn/cflmy/marqdo-ext-ai) · [mcp](https://git.cflmy.cn/cflmy/marqdo-ext-mcp) · [crypto](https://git.cflmy.cn/cflmy/marqdo-ext-crypto) · [database](https://git.cflmy.cn/cflmy/marqdo-ext-database) · [storage](https://git.cflmy.cn/cflmy/marqdo-ext-storage) · [cache](https://git.cflmy.cn/cflmy/marqdo-ext-cache) · [security](https://git.cflmy.cn/cflmy/marqdo-ext-security) · [browser](https://git.cflmy.cn/cflmy/marqdo-ext-browser) · [document](https://git.cflmy.cn/cflmy/marqdo-ext-document) · [archive](https://git.cflmy.cn/cflmy/marqdo-ext-archive) · [engineering](https://git.cflmy.cn/cflmy/marqdo-ext-engineering) · [regex](https://git.cflmy.cn/cflmy/marqdo-ext-regex) · [datetime](https://git.cflmy.cn/cflmy/marqdo-ext-datetime)
|
||||||
|
|
||||||
|
**Web 领域(planned domain)** · 聚合 [marqdo-ext-web](https://git.cflmy.cn/cflmy/marqdo-ext-web)(唯一合同 `docs/WEB-DESIGN.md`)· 子组件 [marqdo-web-design](https://git.cflmy.cn/cflmy/marqdo-web-design) · [marqdo-web-preview](https://git.cflmy.cn/cflmy/marqdo-web-preview)
|
||||||
|
|
||||||
|
## 分层治理与领域聚合(2026-11-26 起)
|
||||||
|
|
||||||
|
根 catalog 支持唯一的新增类型 `kind = "domain"`(聚合治理角色),治理树最多两级:**根 → 领域聚合 → 功能组件**。规则要点:
|
||||||
|
|
||||||
|
- 每个拥有子模块的聚合仓库只登记直接子组件;全局 ID 与权威远端唯一;功能仓库仍只有一个父级。Gitlink 是提交身份唯一权威,`.gitmodules` 是权威远端唯一记录。
|
||||||
|
- 聚合仓库可拥有 `components.toml`、`.gitmodules`、领域公共规范、跨组件集成测试、综合示例、发布装配脚本、ADR 与维护指南;**禁止**生产实现与源码复制。
|
||||||
|
- 已有 `planned` 仓的 gitlink 固定真实开发提交。尚无提交的组件只登记计划,激活以后再填写真实 `entry` 并计入完成率。领域及其后代分别登记在各自父仓库。
|
||||||
|
- 领域激活门禁:子组件具备真实入口与候选提交、领域 catalog 与 gitlink 一致、领域 CI 通过、根 `check-layout.py --checkouts` 递归校验通过、存在依赖关系的组件以同候选证据验证。
|
||||||
|
- 主仓库 `scripts/check-layout.py` 已引入 domain 角色与递归校验;统一 CLI 制品准备、声明驱动调度、递归影响分析仍在推进,CI 证据以真实候选为准。
|
||||||
|
|
||||||
|
当前状态:**没有任何 active 领域**。Web 领域为 planned(`extensions/web`,聚合仓 marqdo-ext-web,子组件 design/preview 在其 catalog 登记);标准库聚合 marqdo-stdlib 尚未创建,九个 `std-*` 保持根 catalog 的 planned 直属记录;HTTP/WebSocket 等仍为独立 planned 扩展,等至少两个真实组件形成共同边界后再评估聚合。首批 Web 实施工单为 WEB-00(合同与真实 Analysis 风险探测)、WEB-01(Design)、WEB-02(Preview)、WEB-03(handoff/组件图)、WEB-04(组合案例与框架交付)、WEB-05(根接入与冷安装),WEB-06(components)为候选;工单在对应责任仓库创建。Web 合同语义冲突由 marqdo-ext-web 协调,不回流 CLI 核心。
|
||||||
|
|
||||||
|
## 阶段与阻塞
|
||||||
|
|
||||||
|
| 原分支 | 独立仓库与迁移状态 |
|
||||||
|
| --- | --- |
|
||||||
|
| `gh-pages` | 官网架构、v2.9.1 源内容和部署快照均已迁入 marqdo-site。原分支保留现有公共入口,部署切换以独立托管和路由验收为准。[托管切换工单](https://git.cflmy.cn/cflmy/marqdo-site/issues/1) |
|
||||||
|
| `vscode-extension` | 扩展目录历史归档到 marqdo-vscode 的 `legacy-v2.8.0`。现行 CLI 适配和新版 VSIX 由扩展仓独立开发和验收。[首版实现工单](https://git.cflmy.cn/cflmy/marqdo-vscode/issues/1) |
|
||||||
|
|
||||||
|
| 阶段 | 当前范围 | 后续验收 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| M0 盘点 | 自建 Git、历史标签、已有六组件和新仓位 | 通过真实远端候选持续维护台账 |
|
||||||
|
| M1 集成骨架 | 六个 active gitlink,另固定 28 个直属和 2 个 Web 子级的 planned 开发提交 | 查看候选 Woodpecker 运行及各组件独立 CI |
|
||||||
|
| M2 标准库切换 | planned,CLI RC.4 提供官方完整 Bundle | [CLI 外部 Bundle](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11) 和 [九组件切换](https://git.cflmy.cn/cflmy/marqdo/issues/2),包括 HTTP、Regex、Archive 迁出与同步删除旧路径 |
|
||||||
|
| M3 跨仓闭环 | 工单、人工候选、同 SHA 门禁 | [跨仓库 CI](https://git.cflmy.cn/cflmy/marqdo/issues/3) 跟踪真实缺陷闭环、候选通知鉴权、去重和影响分析 |
|
||||||
|
| M4 领域接入 | Web 领域 planned:三仓文档与工单就绪;根 catalog 登记 planned domain | W-M0 真实 CLI 风险探测、WEB-01/02 实现、领域 gitlink、根递归校验与冷安装验收;Stdlib 聚合按 STD-01..04 独立推进 |
|
||||||
|
| 后续领域 | 空仓和预期职责 | 逐组件开展最小真实功能、独立 CI、制品与接入 |
|
||||||
|
|
||||||
|
### 标准库切换顺序
|
||||||
|
|
||||||
|
1. CLI 打包器与产品测试接受单一显式外部 Bundle 输入。内核独立编译;制品仍附带一个校验过的标准库。
|
||||||
|
2. 标准库在各组件维护唯一生产源码和自测。组装拒绝冲突、符号链接或测试污染,调用 CLI 权威打包器。std-io 维护 print/打印 的别名元数据。
|
||||||
|
3. HTTP、Regex、Archive 的真实替代和授权回归先行。候选同时移除 CLI 中旧领域宿主服务和旧导入。
|
||||||
|
4. 验证同输入两次组装结果、摘要及路径负例、C1/C2/C3、独立冷安装和真实工具集成后,再切换基础发行。当前状态为 UNVERIFIED。
|
||||||
|
|
||||||
|
## 标准库源码归位迁移(marqdo#9,2026-11-26 M0 冻结)
|
||||||
|
|
||||||
|
本节是标准库迁出的**唯一现行台账**,取代此前按未来目录规划起草的路径表(如 `system/clock.mq.md`、`io/index.mq.md`);旧路径方案会改变公开 `std:` 路径,与“迁移不改语言/库语义”冲突,已作废。详细实施与验收见父仓工单 [marqdo#9](https://git.cflmy.cn/cflmy/marqdo/issues/9),各接收仓子工单在对应仓库 issue #1。
|
||||||
|
|
||||||
|
### 基线与身份(M0)
|
||||||
|
|
||||||
|
| 对象 | 权威身份 |
|
||||||
|
| --- | --- |
|
||||||
|
| 根仓库 | `cflmy/marqdo@484cb10d66db9b92f0527499642ae6abddb3ef29` |
|
||||||
|
| CLI 标准库源 | `cflmy/marqdo-cli@452e9a32bd9e40dba427d4180691c58bab74449e`(RC.4 发行组合;`stdlib/` 自 `4bbefc9` 起未变) |
|
||||||
|
| 迁移前 Bundle | `marqdo-stdlib@0.1.0`,tree digest `sha256:5407d3665ba2fe105820d0f1af5efaafa10c277a69eb819c3225719813c8c713`(含 `tests/`) |
|
||||||
|
| 公开函数台账 | 20 个模块、151 个 H2 函数,由基线 Bundle 上 `marqdo inspect --signature` 生成并记入各接收仓工单 |
|
||||||
|
| CLI 显式 Bundle 输入 | [marqdo-cli#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11) Phase A(PR #12)已提供 `--stdlib-dir`/pin 校验;Phase B(删除仓内源树)以本台账根组合验收为前置 |
|
||||||
|
|
||||||
|
### 模块归属与冻结发布路径
|
||||||
|
|
||||||
|
接收仓库负责源码、测试和后续缺陷;根只做组合、锁定和验收。`modules/` 镜像 Bundle 根相对路径,只收模块不收 `tests/`;官方 manifest 由根唯一生产者生成。
|
||||||
|
|
||||||
|
| 原 CLI 路径(相对 `stdlib/`) | 接收仓 / 工单 | 冻结发布路径(Bundle 根相对) | 公开函数 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `clock.mq.md` | [std-system#1](https://git.cflmy.cn/cflmy/marqdo-std-system/issues/1) | `clock.mq.md` | 1 |
|
||||||
|
| `datetime.mq.md` | [std-system#1](https://git.cflmy.cn/cflmy/marqdo-std-system/issues/1) | `datetime.mq.md` | 14 |
|
||||||
|
| `env.mq.md` | [std-system#1](https://git.cflmy.cn/cflmy/marqdo-std-system/issues/1) | `env.mq.md` | 2 |
|
||||||
|
| `process.mq.md` | [std-system#1](https://git.cflmy.cn/cflmy/marqdo-std-system/issues/1) | `process.mq.md` | 1 |
|
||||||
|
| `random.mq.md` | [std-system#1](https://git.cflmy.cn/cflmy/marqdo-std-system/issues/1) | `random.mq.md` | 2 |
|
||||||
|
| `format.mq.md` | [std-io#1](https://git.cflmy.cn/cflmy/marqdo-std-io/issues/1) | `format.mq.md` | 8 |
|
||||||
|
| `io.mq.md` | [std-io#1](https://git.cflmy.cn/cflmy/marqdo-std-io/issues/1) | `io.mq.md` | 5 |
|
||||||
|
| `io/console.mq.md` | [std-io#1](https://git.cflmy.cn/cflmy/marqdo-std-io/issues/1) | `io/console.mq.md` | 4 |
|
||||||
|
| `io/stream.mq.md` | [std-io#1](https://git.cflmy.cn/cflmy/marqdo-std-io/issues/1) | `io/stream.mq.md` | 3 |
|
||||||
|
| `data/json.mq.md` | [std-data#1](https://git.cflmy.cn/cflmy/marqdo-std-data/issues/1) | `data/json.mq.md` | 22 |
|
||||||
|
| `data/csv.mq.md` | [std-data#1](https://git.cflmy.cn/cflmy/marqdo-std-data/issues/1) | `data/csv.mq.md` | 7 |
|
||||||
|
| `data/table.mq.md` | [std-collections#1](https://git.cflmy.cn/cflmy/marqdo-std-collections/issues/1) / [std-data#1](https://git.cflmy.cn/cflmy/marqdo-std-data/issues/1) | `collections/table.mq.md`(8 个值操作)/ `data/table.mq.md`(4 个序列化) | 12 |
|
||||||
|
| `fs/file.mq.md` | [std-fs#1](https://git.cflmy.cn/cflmy/marqdo-std-fs/issues/1) | `fs/file.mq.md` | 14 |
|
||||||
|
| `path.mq.md` | [std-fs#1](https://git.cflmy.cn/cflmy/marqdo-std-fs/issues/1) | `path.mq.md` | 8 |
|
||||||
|
| `text.mq.md` | [std-text#1](https://git.cflmy.cn/cflmy/marqdo-std-text/issues/1) | `text.mq.md`(`utf8编码` 薄封装) | 1 |
|
||||||
|
| `text/utf8.mq.md` | [std-text#1](https://git.cflmy.cn/cflmy/marqdo-std-text/issues/1) | `text/utf8.mq.md`(唯一编解码实现) | 10 |
|
||||||
|
| `net/http.mq.md` | [ext-http#1](https://git.cflmy.cn/cflmy/marqdo-ext-http/issues/1) | 显式 Package 模块,**不进入默认 Bundle**,不再是 `std:` | 11 |
|
||||||
|
| `regex.mq.md` | [ext-regex#1](https://git.cflmy.cn/cflmy/marqdo-ext-regex/issues/1) | 显式 Package 模块,**不进入默认 Bundle**,不再是 `std:` | 22 |
|
||||||
|
| `compress.mq.md` | [ext-archive#1](https://git.cflmy.cn/cflmy/marqdo-ext-archive/issues/1) | 显式 Package 模块,**不进入默认 Bundle**,不再是 `std:` | 2 |
|
||||||
|
| `demo.mq.md` | 不设接收仓;根 Bundle 组合 fixture | 不作为公开安装模块 | 2 |
|
||||||
|
|
||||||
|
`std-core`、`std-encoding`、`std-net` 没有与之对应的旧模块:本轮不发空工单、不激活、不要求补齐未来规划;若已实现模块被本期 Bundle 实际依赖,再按真实依赖补充工单。
|
||||||
|
|
||||||
|
### 原测试断言归属
|
||||||
|
|
||||||
|
每项必须在新归属留下真实执行证据;跨模块断言归根 Bundle 组合测试。
|
||||||
|
|
||||||
|
| 原 `stdlib/tests/` 文件 | 接收仓 | 断言载体 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `clock.mq.md`、`datetime.mq.md`、`env.mq.md`、`process.mq.md`、`random.mq.md` | std-system | 组件 case,覆盖原 Rust 断言 |
|
||||||
|
| `console.mq.md`、`format.mq.md`、`io.mq.md`、`stream.mq.md` | std-io | 组件 case + resource 端点事件检查 |
|
||||||
|
| `csv.mq.md`、`json.mq.md` | std-data | 组件 case,覆盖原 Rust 断言 |
|
||||||
|
| `table.mq.md` | std-collections(值操作)+ std-data(GFM)+ 根组合 | 切分后的组件 case 与根组合用例 |
|
||||||
|
| `fs.mq.md`、`path.mq.md` | std-fs | 组件 case,覆盖原 Rust 断言 |
|
||||||
|
| `text.mq.md`、`utf8.mq.md` | std-text | 组件 case,覆盖原 Rust 断言 |
|
||||||
|
| `http.mq.md` | ext-http | 领域回归(基线仅运行级覆盖,需补真实断言) |
|
||||||
|
| `regex.mq.md` | ext-regex | 领域回归,覆盖原 Rust 断言 |
|
||||||
|
| `compress.mq.md` | ext-archive | 领域回归,覆盖原 Rust 断言 |
|
||||||
|
| `demo.mq.md` | 根 Bundle 组合测试 | 组合运行证据 |
|
||||||
|
|
||||||
|
### 决策与取舍
|
||||||
|
|
||||||
|
1. **冻结路径**:以 Bundle 根相对路径为公开身份,迁移不改 `std:` 导入路径;被旧台账规划改名(如 `system/clock.mq.md`、`io/index.mq.md`)的条目按本表冻结。
|
||||||
|
2. **测试不随发行**:`tests/` 迁入组件仓并留在仓库外,默认 Bundle 只含模块;因此 Bundle 内容必然变化,版本与 digest 由 MIG-BUNDLE 唯一生产者显式更新,摘要算法不变。
|
||||||
|
3. **Table 切分**:值操作以 `std:collections/table` 为唯一权威,GFM 序列化以 `std:data/table` 为唯一权威;不保留旧 `std:data/table` 的值操作兼容转发,已知消费者在同一候选内更新。
|
||||||
|
4. **Text 去重**:UTF-8 编解码唯一实现在 `text/utf8.mq.md`,`text.mq.md#utf8编码` 为保留公开名称的薄封装。
|
||||||
|
5. **IO 别名**:`io.mq.md` 保持官方 `print`/`打印` 的别名目标 `写值`,签名与 effects 不变;别名元数据仍由 Bundle 生产者生成。
|
||||||
|
6. **三个领域模块**:HTTP/Regex/Archive 迁入既有扩展仓并退出默认 Bundle,不保留隐藏的 `std:` fallback;CLI 现有 `regex.*`/`compress.*` 宿主请求是历史例外,本轮不删除也不新增同类请求,彻底消除另开工单。
|
||||||
|
7. **`demo.mq.md`**:不作为公开库模块,转为根 Bundle 组合 fixture,避免为了放置文件创建无独立责任的新仓库。
|
||||||
|
8. **staging 不是发行**:迁移期为了隔离测试,允许用基线 Bundle 覆盖组件模块并重算 digest 的 staging 组合;它不是官方发布源,最终只有根唯一生产路径。
|
||||||
|
9. **CLI 侧最小修改**:Phase A 显式制品输入已落地;Phase B 删除仓内官方源树只在组件替代与根组合验收通过后执行,不同时进行核心重构。
|
||||||
|
10. **未创建的新仓**:不为缺失模块创建同名替代仓;`marqdo-stdlib` 聚合仓仍未建立,聚合治理按原独立计划推进,不阻塞本次源码归位。
|
||||||
|
|
||||||
|
### 迁移状态
|
||||||
|
|
||||||
|
| 项 | 状态 | 证据 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| M0 盘点与派单 | 完成 | 本节、9 个接收仓 issue #1、[marqdo#9](https://git.cflmy.cn/cflmy/marqdo/issues/9) 评论 |
|
||||||
|
| 组件接收(源码+断言) | 候选已推送(6 个 std 仓) | [std-text PR #2](https://git.cflmy.cn/cflmy/marqdo-std-text/pulls/2)、[std-system PR #2](https://git.cflmy.cn/cflmy/marqdo-std-system/pulls/2)、[std-io PR #2](https://git.cflmy.cn/cflmy/marqdo-std-io/pulls/2)、[std-fs PR #2](https://git.cflmy.cn/cflmy/marqdo-std-fs/pulls/2)、[std-data PR #2](https://git.cflmy.cn/cflmy/marqdo-std-data/pulls/2)、[std-collections PR #2](https://git.cflmy.cn/cflmy/marqdo-std-collections/pulls/2) |
|
||||||
|
| 领域模块(http/regex/archive) | 未开始 | ext-http/ext-regex/ext-archive issue #1 |
|
||||||
|
| Bundle 唯一生产者 | 脚本与契约测试已落地,待根候选验收 | `scripts/build-stdlib.py`、`scripts/stdlib-bundle.json`、`tests/integration/test_build_stdlib.py` |
|
||||||
|
| 组合验收入口 | 已落地,待根候选执行 | `scripts/acceptance-stdlib.py`、`tests/integration/composition/` |
|
||||||
|
| CLI 旧源树删除 | 未开始(等待根组合验收) | [marqdo-cli#11](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11) Phase B |
|
||||||
|
| 根组合与切换 | 未开始 | 本仓 MIG-RELEASE 候选 |
|
||||||
|
|
||||||
|
## v2 功能历史索引
|
||||||
|
|
||||||
|
按表中的归属逐项拆分工单,记录来源路径、目标接口、正负例、状态和真实测试提交。
|
||||||
|
|
||||||
|
| 旧版 lib 模块 | 目标 | 迁移决策 / 主要缺口 |
|
||||||
|
|---|---|---|
|
||||||
|
| archive | archive | ZIP/TAR 等安全归档;现有 gzip 迁移,测试路径穿越 |
|
||||||
|
| browser | browser | 31 个 H2 所涉 DOM、存储、事件、fetch、WS、下载;不复制旧 WASM runtime |
|
||||||
|
| bytes | std-text / std-encoding | 字节值、slice、UTF-8 归 Text,base64 归 Encoding,单一 byte 表示 |
|
||||||
|
| cli | std-system | 应用参数 parse,非 CLI 自身 flag parser |
|
||||||
|
| csv | std-data | 已有 parse/format;补非法输入与多行测试 |
|
||||||
|
| datetime | std-system / datetime | UTC 基础已有;时区、DST 和高级日历明确拆分 |
|
||||||
|
| document | document | sections、tables、links、code blocks、replace;通过受支持静态事实与显式文件编辑 |
|
||||||
|
| encoding | std-encoding | Base64/Base32/Hex 编解码缺失 |
|
||||||
|
| foreign | CLI 现有 Foreign / 独立可选会话扩展(待 ADR) | one-shot run/call 已有;不恢复 set_cmd/register 等隐式动态机制;session/replay 需真实设计 |
|
||||||
|
| fs | std-fs / document / engineering | 40 个 H2 涵盖文件操作;新版14个 H2;二进制、递归、原子、临时、读写组合;文本 patch/工程 sync 归相应扩展 |
|
||||||
|
| hash | crypto | SHA/HMAC 等,密码学不进入内核 |
|
||||||
|
| html | web(合同见 WEB-DESIGN) | HTML escape/unescape 属渲染安全细节,按 WEB-DESIGN 与 Preview 安全合同处理;不恢复旧页面/模板插件模型 |
|
||||||
|
| json | std-data | parse/stringify 已有;get/keys/set 等可复用 collections;严格 Result |
|
||||||
|
| log | std-system | 结构化、level、输出门面,不引入服务框架 |
|
||||||
|
| math | std-core / math | abs/min/max/clamp 基础归 Core;数值、超越、公式、CAS、绘图归 Math;随机归 System |
|
||||||
|
| net | std-net / http / ai / document | TCP/TLS 基础归 Net;HTTP/SSE/cookie/multipart/download 归 HTTP;OpenAI 特定 SSE 归 AI;Markdown 解析归 Document 或公开静态事实 |
|
||||||
|
| path | std-fs | join/normalize 等已有;relative/with_extension 等补齐 |
|
||||||
|
| plugin | CLI 现行扩展选择机制 | 不迁移 load/unload 自动加载;使用显式 descriptors、lock、grant |
|
||||||
|
| re | regex | 查找/替换/分割/捕获和现有纯子集、成熟后端,取消宿主 convenience 重复 |
|
||||||
|
| result | std-core | ok/error/value_or,统一现行可恢复错误约定 |
|
||||||
|
| secrets | std-system / crypto | token 生成归 System,密钥/密码学安全操作归 Crypto;不泄漏 secret |
|
||||||
|
| stats | math | mean/median/stdev;定义样本与总体、空集合、精度 |
|
||||||
|
| subtask | CLI Structured Tasks(待开发) / std-system | spawn/join/cancel 等先验证通用语义;库只薄封装,不移植旧 scheduler |
|
||||||
|
| sys | std-system / CLI 公共事实 | env/args/process/clock;旧 stream_publish 和 meta 由现行 Observation/Analysis 或真正应用输出处理;不恢复隐式环境写入 |
|
||||||
|
| table | std-collections / std-data | 60 个 H2 入口(List/Map/Table 混合);值操作归 Collections,GFM/数据格式归 Data |
|
||||||
|
| text | std-text | trim/split/join、contains/replace、大小写、repeat/pad 等缺口 |
|
||||||
|
| time | std-system | now/UTC parse 已部分有;sleep 仅在受控原语可用后实现 |
|
||||||
|
| toml | std-data | parse/stringify/try_parse,实际支持标准及错误边界 |
|
||||||
|
| url | http | URL parse/query/percent 与同协议归属,std-net 不重复 |
|
||||||
|
| uuid | std-system | v4 使用 OS entropy;检查版本/variant |
|
||||||
|
| writeback | document / engineering | 显式有界编辑、来源摘要及冲突检查;不恢复隐式自修改/自动 oracle writeback |
|
||||||
|
| lint/narrative | lint Tool | 静态诊断与显式修复,不进 CLI runtime |
|
||||||
|
|
||||||
|
### 领域与插件
|
||||||
|
|
||||||
|
| 旧目录 | 目标及处理 |
|
||||||
|
|---|---|
|
||||||
|
| `ext/ai` + `plugins/llm` / `plugins/agent` | AI 模型协议、MCP 独立迁移;agent 97 个 H2 涉及 workflow/memory/工具/恢复等,按真实通用能力拆分,不整体复制。qdagent 应用管理其自己的最小工作流、记忆、意图和 SKILL,不作为通用标准库。知识检索、证明分别由对应 Tool;sandbox 用 CLI 的实际保证,不伪造 OS 隔离。 |
|
||||||
|
| `ext/linalg` + `plugins/linalg` | Linalg;迁移数值算法、复数及矩阵符号知识;重新适配 ABI,减少重复。 |
|
||||||
|
| `ext/quantum` + `plugins/quantum` | Quantum;gate/state/circuit/simulate/density/viz,移除与 Linalg 重复的实现或建立经测试的后端共享边界。 |
|
||||||
|
| `ext/net` | HTTP、WebSocket、URL,低层 TCP/TLS 归 Std Net。 |
|
||||||
|
| `ext/data` | Database/Cache/Storage;form/admin/api/view 的 Web 部分归 Web,数据验证及查询归唯一相应库。旧 Web Go plugin 的 DB、storage、cache 子模块分别迁移。 |
|
||||||
|
| `ext/security` | Security + Crypto;旧 Go plugin auth/OIDC/RBAC/tenant/password 按归属拆分,不混入 Host capability。 |
|
||||||
|
| `ext/web` + `plugins/web` | 拆为 Web 设计原型领域(唯一合同见 marqdo-ext-web `docs/WEB-DESIGN.md`:设计文档解释、递归组件、有限场景、离线预览与 handoff)与 HTTP/WebSocket/Browser/Database/Security 各自独立组件;删除 monolithic Go plugin 调度与旧页面模型,不恢复旧 Web Artifact 兼容层。 |
|
||||||
|
| `ext/engineering` + `plugins/engineering` | Engineering;Git 操作、文件、archive 分配给已有权威库,避免重复平台操作。 |
|
||||||
|
| `crates/marqdo-wasm`、旧 browser examples | Browser 组件参考;语言核心可移植性需要 CLI 工单,而非复制旧执行器。 |
|
||||||
|
| 旧 `src/knowledge`/proof/view/lint/对应历史 CI 与 examples | 独立 Tool,只迁移所需知识、算法和 fixture;当前公共 Analysis/Observation 优先;新旧协议不并存。 |
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# Marqdo 各仓库任务
|
||||||
|
|
||||||
|
按仓库领取任务。标为 **大改** 的条目可涉及模块拆分、实现重写或发布切换。责任仓库应先限定本轮交付范围,涉及公共接口时与实际消费者一起验收。
|
||||||
|
|
||||||
|
生态治理采用“根 → 领域聚合 → 功能组件”最多两级 Gitlink:功能仓库实现与修复、领域聚合仓库维护合同与组合验收、主仓库固定 gitlink、治理与发行。`planned` 组件可以挂载真实开发提交,实际入口随验收登记。当前没有 active 领域;Web 领域为 planned(聚合仓 `marqdo-ext-web`,子组件 `marqdo-web-design`/`marqdo-web-preview` 在其 catalog 登记)。先推进 CLI 外部 Bundle、九个标准库,以及 HTTP、Regex、Archive 的迁出;这些改动在同一候选组合中验证后切换基础发行。官网和 VS Code 可独立推进。[迁移台账](MIGRATION.md) · [开发流程](DEVELOPMENT.md)
|
||||||
|
|
||||||
|
## 集成和语言
|
||||||
|
|
||||||
|
| 仓库 | 要完成的任务 |
|
||||||
|
| --- | --- |
|
||||||
|
| `marqdo` | 固定已验收的组件组合与领域 gitlink,完成跨仓库工单闭环、CI 和生态发行验证。推进递归治理校验(domain 角色与全局依赖 DAG)、声明驱动集成计划、统一 CLI 制品输入与递归影响分析;保留现有 conformance/View/Knowledge/Prove/Lint 真实门禁。 |
|
||||||
|
| `marqdo-cli` | **大改**。拆分内核构建和基础发行装配,接受显式外部标准库 Bundle。完成领域能力迁出后,移除旧标准库入口和被替代的专用宿主实现。 |
|
||||||
|
| `marqdo-extension-conformance` | 更新真实 CLI 的公共契约测试,覆盖 Bundle 切换、五类扩展机制及其权限边界。 |
|
||||||
|
|
||||||
|
## 领域聚合(planned)
|
||||||
|
|
||||||
|
领域聚合仓库只做治理、唯一合同、示例、跨组件验收与交付协调,不含生产实现。激活前保持 planned,子组件在其自身 `components.toml` 登记,根 catalog 不重复登记。
|
||||||
|
|
||||||
|
| 仓库 | 要完成的任务 |
|
||||||
|
| --- | --- |
|
||||||
|
| `marqdo-ext-web` | Web 领域聚合:维护唯一作者合同 `docs/WEB-DESIGN.md`、§8 组合示例与领域 CI;验证真实 Analysis 风险(WEB-00),协调设计合同变更与 Design/Preview 配对候选;在子组件通过 WEB-01..04 后以领域 gitlink 接入根(WEB-05)。 |
|
||||||
|
| `marqdo-web-design` | WEB-01:消费真实 CLI Analysis 3,解释精确组件引用、递归布局、有限场景与依赖,输出稳定诊断、组件图和源身份;WEB-03:handoff、单组件切片与漂移标识。独立 Rust library,禁止复制 parser/启动服务。 |
|
||||||
|
| `marqdo-web-preview` | WEB-02:通用离线预览渲染器与有限状态交互、响应式、安全负例、Tool 打包;作为唯一 `web` 命令入口消费 Design 公开 API,禁止任务专用 JS、第二套解析或生产服务器。 |
|
||||||
|
|
||||||
|
## 工具和产品
|
||||||
|
|
||||||
|
| 仓库 | 要完成的任务 |
|
||||||
|
| --- | --- |
|
||||||
|
| `marqdo-knowledge` | 基于公开 Analysis 完善可复现的知识编译、索引和检索,验证独立发行。 |
|
||||||
|
| `marqdo-prove` | 完善证明依赖、Lean 证书生成和独立重放,清楚展示各项证明的核验状态。 |
|
||||||
|
| `marqdo-view` | 维护文档阅读、显式运行、Observation 和静态导出,验证与现行 CLI 及官网构建的组合。 |
|
||||||
|
| `marqdo-lint` | 扩展静态规则和诊断定位,为可修复规则提供显式修复。 |
|
||||||
|
| `marqdo-site` | **大改**。用现行 CLI 和 View 重建官网与入门内容,验证新站和旧链接后切换托管。 |
|
||||||
|
| `marqdo-vscode` | **大改**。按现行 CLI 重做诊断和运行适配,先完成高亮、静态诊断、显式运行和可安装的 VSIX。 |
|
||||||
|
|
||||||
|
## 标准库
|
||||||
|
|
||||||
|
每个仓库交付可独立测试的模块,共同组成默认 Bundle。聚合仓库 `marqdo-stdlib` 尚未创建,九个 `std-*` 当前保持根 catalog 的 planned 直属记录;CLI 内置标准库仍是现行发行权威,迁移完成前不得声称拆分完成。迁移的基线、模块/函数与断言台账、冻结发布路径见 [迁移台账](MIGRATION.md) 的“标准库源码归位迁移”一节;唯一 Bundle 生产者是根 `scripts/build-stdlib.py`,组合验收入口是 `scripts/acceptance-stdlib.py`。
|
||||||
|
|
||||||
|
| 仓库 | 要完成的任务 |
|
||||||
|
| --- | --- |
|
||||||
|
| `marqdo-std-core` | 实现共用 Result 和基础数值操作。 |
|
||||||
|
| `marqdo-std-collections` | 实现 List、Map 和 Table 的通用集合操作,从数据格式处理中拆出表格算法。 |
|
||||||
|
| `marqdo-std-text` | 统一 Unicode 文本、字节值切片和 UTF-8 编解码。 |
|
||||||
|
| `marqdo-std-encoding` | 提供 Base64、Base32 和 Hex,并定义非法输入的行为。 |
|
||||||
|
| `marqdo-std-data` | 迁入 JSON、CSV 和表格格式转换,补齐 TOML 与 GFM。 |
|
||||||
|
| `marqdo-std-io` | 迁入 Console、Stream 和格式化,负责官方 `print` 与 `打印` 别名。 |
|
||||||
|
| `marqdo-std-fs` | 迁入文件、路径和目录操作,核验读写边界。 |
|
||||||
|
| `marqdo-std-system` | 迁入时钟、UTC、环境、进程和随机能力。 |
|
||||||
|
| `marqdo-std-net` | 提供有界 TCP、UDP、TLS 和字节流,供上层协议复用。 |
|
||||||
|
|
||||||
|
## 扩展
|
||||||
|
|
||||||
|
每个仓库先完成一个可安装、可验证的用例。历史实现可用于迁移取证,公开接口按现行契约验收。
|
||||||
|
|
||||||
|
| 仓库 | 要完成的任务 |
|
||||||
|
| --- | --- |
|
||||||
|
| `marqdo-ext-math` | 建立数值算法、统计、符号数学和绘图能力,先交付可验证的数值用例。 |
|
||||||
|
| `marqdo-ext-linalg` | 迁移复数、矩阵和分解,向量子组件提供可复用的线性代数接口。 |
|
||||||
|
| `marqdo-ext-quantum` | 迁移量子电路、态向量、采样与模拟,验证代表性电路结果。 |
|
||||||
|
| `marqdo-ext-http` | **大改**。把现有 HTTP 迁为基于 std-net 的独立包,覆盖 URL、消息编解码、请求生命周期和 SSE。 |
|
||||||
|
| `marqdo-ext-websocket` | 交付基于 HTTP 与网络流的 WebSocket 握手、帧和连接生命周期。 |
|
||||||
|
| `marqdo-ext-ai` | **大改**。从旧 AI 实现拆出模型协议、流式输出和工具调用数据。 |
|
||||||
|
| `marqdo-ext-mcp` | 交付 MCP 传输、能力发现和受控工具调用。 |
|
||||||
|
| `marqdo-ext-crypto` | 封装成熟密码学实现,先交付一种带标准测试向量的能力。 |
|
||||||
|
| `marqdo-ext-database` | 交付一个支持参数绑定和事务的数据库驱动。 |
|
||||||
|
| `marqdo-ext-storage` | 定义本地与对象存储接口,先验证一套读写和错误处理流程。 |
|
||||||
|
| `marqdo-ext-cache` | 交付带 TTL 和失效行为的缓存。 |
|
||||||
|
| `marqdo-ext-security` | 交付应用身份、会话与授权,复用加密扩展。 |
|
||||||
|
| `marqdo-ext-web` | 已改为 Web 领域聚合仓库,任务见「领域聚合」小节;不再作为 HTTP 页面/路由渲染实现。 |
|
||||||
|
| `marqdo-ext-browser` | **大改**。按现行运行时边界适配浏览器宿主、WASM、DOM 和事件。 |
|
||||||
|
| `marqdo-ext-document` | 交付 Markdown 结构查询与显式编辑接口。 |
|
||||||
|
| `marqdo-ext-archive` | 实现归档与安全解包,为 CLI 移除旧压缩入口提供可验证的替代。 |
|
||||||
|
| `marqdo-ext-engineering` | 拆分工程操作、文件补丁和产物处理,先交付一个独立工程用例。 |
|
||||||
|
| `marqdo-ext-regex` | 提供匹配、捕获、扫描与替换,为 CLI 移除旧正则入口提供可验证的替代。 |
|
||||||
|
| `marqdo-ext-datetime` | 交付 IANA 时区、夏令时和高级日历能力,与标准库 UTC 接口对接。 |
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
|||||||
|
# 架构决策记录
|
||||||
|
|
||||||
|
按时间顺序保存影响生态边界、公共合同或发行方式的决策。现行规则以 `docs/ARCHITECTURE.md`、`docs/DEVELOPMENT.md`、`components.toml` 与各责任仓库的合同文档为准;ADR 是决策历史,不是第二套现行规范。
|
||||||
|
|
||||||
|
| ADR | 状态 | 主题 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| [0001](0001-hierarchical-ecosystem-and-web-domain.md) | 已采纳(实施记录) | 分层生态治理(根→领域→功能)与 Web 原型设计领域合同 |
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# 领域扩展与领域聚合
|
||||||
|
|
||||||
|
本目录覆盖按需安装的领域能力。功能组件默认 `planned`,通过 Git 子模块固定独立仓库的开发提交,完成验收后晋升;聚合仓库不实现子组件业务,根 catalog 只登记 `kind = "domain"` 的聚合本身,不重复登记其后代路径。
|
||||||
|
|
||||||
|
## 领域聚合(planned)
|
||||||
|
|
||||||
|
| 路径 | 仓库 | 说明 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `web/` | [marqdo-ext-web](https://git.cflmy.cn/cflmy/marqdo-ext-web) | Web 原型设计领域聚合:唯一设计合同、示例、组合验收与交付协调;子组件 [marqdo-web-design](https://git.cflmy.cn/cflmy/marqdo-web-design)、[marqdo-web-preview](https://git.cflmy.cn/cflmy/marqdo-web-preview) 在领域 `components.toml` 登记 |
|
||||||
|
|
||||||
|
## 独立组件(planned)
|
||||||
|
|
||||||
|
- [marqdo-ext-math](https://git.cflmy.cn/cflmy/marqdo-ext-math) · 数值算法、统计、符号数学及绘图
|
||||||
|
- [marqdo-ext-linalg](https://git.cflmy.cn/cflmy/marqdo-ext-linalg) · 复数、矩阵、分解及数值线性代数
|
||||||
|
- [marqdo-ext-quantum](https://git.cflmy.cn/cflmy/marqdo-ext-quantum) · 量子电路、态向量、采样与模拟
|
||||||
|
- [marqdo-ext-http](https://git.cflmy.cn/cflmy/marqdo-ext-http) · HTTP、URL、SSE 与报文生命周期
|
||||||
|
- [marqdo-ext-websocket](https://git.cflmy.cn/cflmy/marqdo-ext-websocket) · WebSocket 握手、帧与连接语义
|
||||||
|
- [marqdo-ext-ai](https://git.cflmy.cn/cflmy/marqdo-ext-ai) · 模型协议、流式输出与工具调用数据
|
||||||
|
- [marqdo-ext-mcp](https://git.cflmy.cn/cflmy/marqdo-ext-mcp) · MCP 协议、传输、发现和调用
|
||||||
|
- [marqdo-ext-crypto](https://git.cflmy.cn/cflmy/marqdo-ext-crypto) · 成熟密码学实现的封装
|
||||||
|
- [marqdo-ext-database](https://git.cflmy.cn/cflmy/marqdo-ext-database) · SQL 参数绑定、事务和驱动连接
|
||||||
|
- [marqdo-ext-storage](https://git.cflmy.cn/cflmy/marqdo-ext-storage) · 本地和对象存储接口
|
||||||
|
- [marqdo-ext-cache](https://git.cflmy.cn/cflmy/marqdo-ext-cache) · TTL、缓存和失效
|
||||||
|
- [marqdo-ext-security](https://git.cflmy.cn/cflmy/marqdo-ext-security) · 应用身份、会话及权限模型
|
||||||
|
- [marqdo-ext-browser](https://git.cflmy.cn/cflmy/marqdo-ext-browser) · 浏览器宿主、WASM 适配、DOM 和事件
|
||||||
|
- [marqdo-ext-document](https://git.cflmy.cn/cflmy/marqdo-ext-document) · Markdown 结构与显式文档编辑
|
||||||
|
- [marqdo-ext-archive](https://git.cflmy.cn/cflmy/marqdo-ext-archive) · 压缩、安全归档和解包
|
||||||
|
- [marqdo-ext-engineering](https://git.cflmy.cn/cflmy/marqdo-ext-engineering) · 工程操作、文件补丁与产物
|
||||||
|
- [marqdo-ext-regex](https://git.cflmy.cn/cflmy/marqdo-ext-regex) · 正则匹配、捕获、扫描和替换
|
||||||
|
- [marqdo-ext-datetime](https://git.cflmy.cn/cflmy/marqdo-ext-datetime) · IANA 时区、DST 和高级日历
|
||||||
|
|
||||||
|
[组件目录](../components.toml) · [各仓库任务](../docs/REPOSITORY-TASKS.md) · [架构边界](../docs/ARCHITECTURE.md)
|
||||||
Submodule
+1
Submodule extensions/ai added at 4d2c3e4f1a.
Submodule
+1
Submodule extensions/archive added at 527650e726.
Submodule
+1
Submodule extensions/browser added at 35c1a75fd0.
Submodule
+1
Submodule extensions/cache added at 0357907e1d.
Submodule
+1
Submodule extensions/crypto added at 21529b8b25.
Submodule
+1
Submodule extensions/database added at e86a397c8e.
Submodule
+1
Submodule extensions/datetime added at 5e2e2a1b34.
Submodule
+1
Submodule extensions/document added at eb88be346a.
Submodule
+1
Submodule extensions/engineering added at b9f3ddba05.
Submodule
+1
Submodule extensions/http added at f2dde4234c.
Submodule
+1
Submodule extensions/linalg added at 773ba9ef2e.
Submodule
+1
Submodule extensions/math added at f7ef25014a.
Submodule
+1
Submodule extensions/mcp added at df477bceec.
Submodule
+1
Submodule extensions/quantum added at 33f4780e9e.
Submodule
+1
Submodule extensions/regex added at 5458dff039.
Submodule
+1
Submodule extensions/security added at 6939018249.
Submodule
+1
Submodule extensions/storage added at 6a798f099e.
Submodule
+1
Submodule extensions/web added at f70095d60a.
Submodule
+1
Submodule extensions/websocket added at e79f2e78fa.
Executable
+360
@@ -0,0 +1,360 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Accept the stdlib migration candidate with explicit, verified inputs.
|
||||||
|
|
||||||
|
This is the root-layer composition gate: it builds (or accepts) the one Bundle
|
||||||
|
produced by ``scripts/build-stdlib.py`` from the pinned component gitlinks, runs
|
||||||
|
each active stdlib component's own entry point against that Bundle, runs the
|
||||||
|
cross-repository composition fixtures, exercises the negative inputs that must
|
||||||
|
fail closed, and optionally packages the Bundle with the CLI's own packer twice
|
||||||
|
to prove determinism.
|
||||||
|
|
||||||
|
Every input is explicit: a real ``marqdo`` executable (``--cli``) and either a
|
||||||
|
Bundle (``--bundle``) or a checkout that can build one at its pinned gitlinks.
|
||||||
|
Nothing is downloaded and no sibling component is discovered implicitly.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
python3 scripts/acceptance-stdlib.py --cli build/marqdo --work build/accept
|
||||||
|
python3 scripts/acceptance-stdlib.py --cli build/marqdo --work build/accept \
|
||||||
|
--pack-tool /path/to/cli/tools/pack-stdlib.py --evidence build/accept/evidence.json
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import base64
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tomllib
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
CASES = ROOT / "tests" / "integration" / "composition" / "cases"
|
||||||
|
CASES_SCHEMA = "marqdo.stdlib-test-case"
|
||||||
|
FORBIDDEN = {
|
||||||
|
"net/http.mq.md",
|
||||||
|
"regex.mq.md",
|
||||||
|
"compress.mq.md",
|
||||||
|
"demo.mq.md",
|
||||||
|
"tests",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class AcceptanceError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def run(command, cwd=None, env=None, input_bytes=b""):
|
||||||
|
result = subprocess.run(
|
||||||
|
command, cwd=cwd, env=env, input=input_bytes, capture_output=True
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def sha256(path: Path) -> str:
|
||||||
|
return "sha256:" + hashlib.sha256(path.read_bytes()).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def channel_text(events: list[dict], channel: str) -> str:
|
||||||
|
chunks = []
|
||||||
|
for event in events:
|
||||||
|
if event.get("kind") != channel:
|
||||||
|
continue
|
||||||
|
payload = event["payload"]
|
||||||
|
data = base64.b64decode(payload["data_base64"])
|
||||||
|
if len(data) != payload["byte_count"]:
|
||||||
|
raise AcceptanceError(f"{channel} byte_count mismatch")
|
||||||
|
chunks.append(data)
|
||||||
|
return b"".join(chunks).decode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
def tree_digest(bundle: Path) -> str:
|
||||||
|
digest = hashlib.sha256()
|
||||||
|
for path in sorted(bundle.rglob("*.mq.md"), key=lambda p: p.relative_to(bundle).as_posix()):
|
||||||
|
digest.update(path.relative_to(bundle).as_posix().encode())
|
||||||
|
digest.update(b"\0")
|
||||||
|
digest.update(path.read_bytes())
|
||||||
|
digest.update(b"\0")
|
||||||
|
return "sha256:" + digest.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def aliases_digest(aliases: list[dict]) -> str:
|
||||||
|
digest = hashlib.sha256()
|
||||||
|
for alias in sorted(aliases, key=lambda a: (a["target_module"], a["target_function"])):
|
||||||
|
digest.update(alias["target_module"].encode()); digest.update(b"\0")
|
||||||
|
digest.update(alias["target_function"].encode()); digest.update(b"\0")
|
||||||
|
for name in sorted(alias["public_names"]):
|
||||||
|
digest.update(name.encode()); digest.update(b"\0")
|
||||||
|
return "sha256:" + digest.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def verify_bundle(bundle: Path) -> dict:
|
||||||
|
manifest_path = bundle / "stdlib.json"
|
||||||
|
if not manifest_path.is_file():
|
||||||
|
raise AcceptanceError(f"missing Bundle manifest: {manifest_path}")
|
||||||
|
manifest = json.loads(manifest_path.read_text())
|
||||||
|
for field in ("name", "version", "digest", "aliases_digest"):
|
||||||
|
if not isinstance(manifest.get(field), str) or not manifest[field]:
|
||||||
|
raise AcceptanceError(f"manifest has no {field}")
|
||||||
|
computed = tree_digest(bundle)
|
||||||
|
if computed != manifest["digest"]:
|
||||||
|
raise AcceptanceError(
|
||||||
|
f"manifest digest mismatch: {manifest['digest']} != {computed}"
|
||||||
|
)
|
||||||
|
aliases = manifest.get("public_aliases", [])
|
||||||
|
expected_alias = aliases_digest(aliases)
|
||||||
|
if expected_alias != manifest["aliases_digest"]:
|
||||||
|
raise AcceptanceError("aliases digest mismatch")
|
||||||
|
files = sorted(
|
||||||
|
path.relative_to(bundle).as_posix()
|
||||||
|
for path in bundle.rglob("*.mq.md")
|
||||||
|
)
|
||||||
|
for relative in files:
|
||||||
|
parts = relative.split("/")
|
||||||
|
if "tests" in parts or relative in FORBIDDEN:
|
||||||
|
raise AcceptanceError(f"forbidden module in Bundle: {relative}")
|
||||||
|
for alias in aliases:
|
||||||
|
if alias["target_module"] not in files:
|
||||||
|
raise AcceptanceError(
|
||||||
|
f"public alias targets missing module {alias['target_module']}"
|
||||||
|
)
|
||||||
|
if "io.mq.md" not in files:
|
||||||
|
raise AcceptanceError("Bundle lost the io.mq.md alias target")
|
||||||
|
return {
|
||||||
|
"manifest": manifest,
|
||||||
|
"files": files,
|
||||||
|
"tree_digest": computed,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def run_case(cli: str, bundle: Path, case: dict) -> dict:
|
||||||
|
source = ROOT / "tests" / "integration" / "composition" / case["file"]
|
||||||
|
command = [cli, "run", str(source), *case.get("args", []), "--output", "json"]
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["MARQDO_STDLIB_DIR"] = str(bundle)
|
||||||
|
for key, value in case.get("env", {}).items():
|
||||||
|
env[key] = value.replace("$MARQDO_BIN", cli)
|
||||||
|
result = run(command, cwd=ROOT, env=env, input_bytes=case.get("stdin", "").encode())
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise AcceptanceError(
|
||||||
|
f"composition case {case['name']} failed: "
|
||||||
|
f"{result.stderr.decode(errors='replace')}"
|
||||||
|
)
|
||||||
|
report = json.loads(result.stdout)
|
||||||
|
if report.get("run", {}).get("status") != "ok":
|
||||||
|
raise AcceptanceError(f"composition case {case['name']} run status not ok")
|
||||||
|
terminal = report["events"][-1]["payload"]
|
||||||
|
if terminal.get("value") != case["expected_terminal"]:
|
||||||
|
raise AcceptanceError(
|
||||||
|
f"composition case {case['name']} terminal value changed"
|
||||||
|
)
|
||||||
|
stdout = channel_text(report["events"], "stdout.chunk")
|
||||||
|
if stdout != case.get("expected_stdout", ""):
|
||||||
|
raise AcceptanceError(
|
||||||
|
f"composition case {case['name']} stdout changed: {stdout!r}"
|
||||||
|
)
|
||||||
|
return {"name": case["name"], "status": "PASS"}
|
||||||
|
|
||||||
|
|
||||||
|
def load_components() -> list[dict]:
|
||||||
|
catalog = tomllib.loads((ROOT / "components.toml").read_text())
|
||||||
|
return [
|
||||||
|
component
|
||||||
|
for component in catalog["component"]
|
||||||
|
if component.get("kind") == "stdlib" and component.get("state") == "active"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def component_gates(cli: str, bundle: Path) -> list[dict]:
|
||||||
|
results = []
|
||||||
|
for component in load_components():
|
||||||
|
entry = ROOT / component["path"] / component["entry"]
|
||||||
|
if not entry.is_file():
|
||||||
|
raise AcceptanceError(
|
||||||
|
f"active component {component['id']} has no entry {component['entry']}"
|
||||||
|
)
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["MARQDO_BIN"] = cli
|
||||||
|
env["MARQDO_STDLIB_DIR"] = str(bundle)
|
||||||
|
result = run([str(entry)], cwd=entry.parent.parent, env=env)
|
||||||
|
output = (result.stdout + result.stderr).decode(errors="replace").strip()
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise AcceptanceError(
|
||||||
|
f"component {component['id']} failed entry {component['entry']}:\n{output}"
|
||||||
|
)
|
||||||
|
results.append(
|
||||||
|
{
|
||||||
|
"id": component["id"],
|
||||||
|
"entry": component["entry"],
|
||||||
|
"status": "PASS",
|
||||||
|
"output": output,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
def negative_gates(cli: str, bundle: Path, work: Path) -> list[dict]:
|
||||||
|
results = []
|
||||||
|
|
||||||
|
def expect_failure(name, command):
|
||||||
|
result = run(command)
|
||||||
|
if result.returncode == 0:
|
||||||
|
raise AcceptanceError(f"negative gate {name} unexpectedly passed")
|
||||||
|
results.append(
|
||||||
|
{
|
||||||
|
"name": name,
|
||||||
|
"status": "PASS",
|
||||||
|
"exit": result.returncode,
|
||||||
|
"stderr": result.stderr.decode(errors="replace").strip()[:400],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
missing = work / "missing-bundle"
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["MARQDO_STDLIB_DIR"] = str(missing)
|
||||||
|
expect_failure(
|
||||||
|
"missing-explicit-bundle",
|
||||||
|
[cli, "run", str(ROOT / "tests/integration/composition/default-bundle.mq.md")],
|
||||||
|
)
|
||||||
|
|
||||||
|
tampered = work / "tampered-bundle"
|
||||||
|
if tampered.exists():
|
||||||
|
shutil.rmtree(tampered)
|
||||||
|
shutil.copytree(bundle, tampered)
|
||||||
|
target = next(iter(sorted(tampered.rglob("*.mq.md"))))
|
||||||
|
target.write_bytes(target.read_bytes() + b"\n")
|
||||||
|
env["MARQDO_STDLIB_DIR"] = str(tampered)
|
||||||
|
expect_failure(
|
||||||
|
"tampered-module-digest",
|
||||||
|
[cli, "run", str(ROOT / "tests/integration/composition/default-bundle.mq.md")],
|
||||||
|
)
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
def packaging_gates(pack_tool: str, bundle: Path, work: Path) -> list[dict]:
|
||||||
|
results = []
|
||||||
|
archives = []
|
||||||
|
for attempt in (1, 2):
|
||||||
|
out_dir = work / f"pack-{attempt}"
|
||||||
|
if out_dir.exists():
|
||||||
|
shutil.rmtree(out_dir)
|
||||||
|
result = run(
|
||||||
|
[
|
||||||
|
sys.executable,
|
||||||
|
pack_tool,
|
||||||
|
"--stdlib-dir",
|
||||||
|
str(bundle),
|
||||||
|
"--out-dir",
|
||||||
|
str(out_dir),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise AcceptanceError(
|
||||||
|
"CLI packer rejected the Bundle: "
|
||||||
|
+ result.stderr.decode(errors="replace")
|
||||||
|
)
|
||||||
|
archives.append(sorted(out_dir.glob("*.tar.gz"))[0])
|
||||||
|
if archives[0].read_bytes() != archives[1].read_bytes():
|
||||||
|
raise AcceptanceError("two packaging runs are not byte-identical")
|
||||||
|
descriptor = json.loads(
|
||||||
|
sorted(archives[0].parent.glob("*.json"))[0].read_text()
|
||||||
|
)
|
||||||
|
results.append(
|
||||||
|
{
|
||||||
|
"status": "PASS",
|
||||||
|
"archive": archives[0].name,
|
||||||
|
"archive_sha256": sha256(archives[0]),
|
||||||
|
"tree_digest": descriptor.get("tree_digest"),
|
||||||
|
"aliases_digest": descriptor.get("aliases_digest"),
|
||||||
|
"deterministic": True,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv: list[str]) -> int:
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument("--cli", required=True)
|
||||||
|
parser.add_argument("--work", required=True)
|
||||||
|
parser.add_argument("--bundle")
|
||||||
|
parser.add_argument("--pack-tool")
|
||||||
|
parser.add_argument("--evidence")
|
||||||
|
parser.add_argument("--root-commit")
|
||||||
|
args = parser.parse_args(argv)
|
||||||
|
cli = str(Path(args.cli).resolve())
|
||||||
|
if not Path(cli).is_file():
|
||||||
|
raise SystemExit(f"acceptance-stdlib: error: no CLI executable at {cli}")
|
||||||
|
work = Path(args.work).resolve()
|
||||||
|
work.mkdir(parents=True, exist_ok=True)
|
||||||
|
try:
|
||||||
|
if args.bundle:
|
||||||
|
bundle = Path(args.bundle).resolve()
|
||||||
|
else:
|
||||||
|
bundle = work / "bundle"
|
||||||
|
if bundle.exists():
|
||||||
|
shutil.rmtree(bundle)
|
||||||
|
command = [
|
||||||
|
sys.executable,
|
||||||
|
str(ROOT / "scripts" / "build-stdlib.py"),
|
||||||
|
"--out",
|
||||||
|
str(bundle),
|
||||||
|
]
|
||||||
|
if args.root_commit:
|
||||||
|
command += ["--root-commit", args.root_commit]
|
||||||
|
result = run(command, cwd=ROOT)
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise AcceptanceError(
|
||||||
|
"Bundle producer failed: "
|
||||||
|
+ result.stderr.decode(errors="replace")
|
||||||
|
)
|
||||||
|
bundle_record = verify_bundle(bundle)
|
||||||
|
version = run([cli, "--version"]).stdout.decode().strip()
|
||||||
|
cases = []
|
||||||
|
for path in sorted(CASES.glob("*.json")):
|
||||||
|
case = json.loads(path.read_text())
|
||||||
|
if case.get("schema") != CASES_SCHEMA:
|
||||||
|
raise AcceptanceError(f"unsupported case schema: {path}")
|
||||||
|
cases.append(run_case(cli, bundle, case))
|
||||||
|
components = component_gates(cli, bundle)
|
||||||
|
negatives = negative_gates(cli, bundle, work)
|
||||||
|
packaging = (
|
||||||
|
packaging_gates(args.pack_tool, bundle, work)
|
||||||
|
if args.pack_tool
|
||||||
|
else []
|
||||||
|
)
|
||||||
|
evidence = {
|
||||||
|
"schema": "marqdo.stdlib-acceptance",
|
||||||
|
"schema_version": 1,
|
||||||
|
"cli": {"path": cli, "version": version, "sha256": sha256(Path(cli))},
|
||||||
|
"root_commit": run(
|
||||||
|
["git", "-C", str(ROOT), "rev-parse", "HEAD"]
|
||||||
|
).stdout.decode().strip(),
|
||||||
|
"bundle": {
|
||||||
|
"name": bundle_record["manifest"]["name"],
|
||||||
|
"version": bundle_record["manifest"]["version"],
|
||||||
|
"tree_digest": bundle_record["tree_digest"],
|
||||||
|
"aliases_digest": bundle_record["manifest"]["aliases_digest"],
|
||||||
|
"files": bundle_record["files"],
|
||||||
|
},
|
||||||
|
"components": components,
|
||||||
|
"composition": cases,
|
||||||
|
"negatives": negatives,
|
||||||
|
"packaging": packaging,
|
||||||
|
"status": "PASS",
|
||||||
|
}
|
||||||
|
except AcceptanceError as error:
|
||||||
|
print(f"acceptance-stdlib: FAIL: {error}", file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
text = json.dumps(evidence, ensure_ascii=False, indent=2) + "\n"
|
||||||
|
if args.evidence:
|
||||||
|
Path(args.evidence).write_text(text)
|
||||||
|
print(text)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main(sys.argv[1:]))
|
||||||
Executable
+397
@@ -0,0 +1,397 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Build the one official `marqdo-stdlib` Bundle from pinned component gitlinks.
|
||||||
|
|
||||||
|
The producer owns composition only: it collects the published `modules/` files
|
||||||
|
of every **active** `kind = "stdlib"` component at the exact commit pinned by
|
||||||
|
the root Gitlink, validates the published path set, generates the current
|
||||||
|
`stdlib.json` (tree digest + public aliases digest) and writes a deterministic
|
||||||
|
Bundle directory. Component repositories keep the module sources and tests; the
|
||||||
|
root repository does not copy or edit them. The CLI packages the resulting
|
||||||
|
Bundle with its existing `tools/pack-stdlib.py`.
|
||||||
|
|
||||||
|
Identity rules:
|
||||||
|
|
||||||
|
* release mode (default) reads `components.toml`, the Bundle config and the
|
||||||
|
gitlinks from the ``--root-commit`` tree, never from the working tree;
|
||||||
|
* `--worktree` is a development-only mode that reads each component's
|
||||||
|
``HEAD`` and requires a clean component checkout;
|
||||||
|
* only ``modules/**/*.mq.md`` is published. Other files under ``modules/``
|
||||||
|
(for example ``modules/README.md``) stay repository documentation and are
|
||||||
|
not packed. Symlinks, submodules and non-regular entries are refused;
|
||||||
|
* published paths must be NFC, case-insensitively unique and free of
|
||||||
|
``tests/``, ``.git`` or traversal segments;
|
||||||
|
* a version bump is explicit: with ``--baseline-manifest`` content digest
|
||||||
|
changes are refused unless ``version`` also changes.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
python3 scripts/build-stdlib.py --out build/stdlib
|
||||||
|
python3 scripts/build-stdlib.py --out build/stdlib --worktree
|
||||||
|
python3 scripts/build-stdlib.py --out build/stdlib \
|
||||||
|
--baseline-manifest previous/stdlib.json
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import tomllib
|
||||||
|
import unicodedata
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
DEFAULT_CONFIG = Path("scripts") / "stdlib-bundle.json"
|
||||||
|
MANIFEST = "stdlib.json"
|
||||||
|
MODULES = "modules"
|
||||||
|
PUBLISHED_SUFFIX = ".mq.md"
|
||||||
|
|
||||||
|
|
||||||
|
class BundleError(Exception):
|
||||||
|
"""An input cannot become the official Bundle."""
|
||||||
|
|
||||||
|
|
||||||
|
def _git(repo: Path, *args: str) -> bytes:
|
||||||
|
result = subprocess.run(
|
||||||
|
["git", "-C", str(repo), *args], capture_output=True
|
||||||
|
)
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise BundleError(
|
||||||
|
f"git failed in {repo}: {' '.join(args)}: "
|
||||||
|
f"{result.stderr.decode(errors='replace').strip()}"
|
||||||
|
)
|
||||||
|
return result.stdout
|
||||||
|
|
||||||
|
|
||||||
|
def _nfc(value: str) -> str:
|
||||||
|
return unicodedata.normalize("NFC", value)
|
||||||
|
|
||||||
|
|
||||||
|
def load_json(path: Path) -> dict:
|
||||||
|
try:
|
||||||
|
data = json.loads(path.read_text(encoding="utf-8"))
|
||||||
|
except (OSError, UnicodeDecodeError, json.JSONDecodeError) as error:
|
||||||
|
raise BundleError(f"cannot read {path}: {error}") from error
|
||||||
|
if not isinstance(data, dict):
|
||||||
|
raise BundleError(f"{path} must contain a JSON object")
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def read_blob(repo: Path, revision: str, path: str) -> bytes | None:
|
||||||
|
result = subprocess.run(
|
||||||
|
["git", "-C", str(repo), "show", f"{revision}:{path}"],
|
||||||
|
capture_output=True,
|
||||||
|
)
|
||||||
|
return result.stdout if result.returncode == 0 else None
|
||||||
|
|
||||||
|
|
||||||
|
def read_catalog(root: Path, revision: str | None) -> list[dict]:
|
||||||
|
if revision is None:
|
||||||
|
raw = (root / "components.toml").read_bytes()
|
||||||
|
else:
|
||||||
|
raw = read_blob(root, revision, "components.toml")
|
||||||
|
if raw is None:
|
||||||
|
raise BundleError(f"root commit {revision} has no components.toml")
|
||||||
|
try:
|
||||||
|
catalog = tomllib.loads(raw.decode("utf-8"))
|
||||||
|
except (UnicodeDecodeError, tomllib.TOMLDecodeError) as error:
|
||||||
|
raise BundleError(f"invalid components.toml: {error}") from error
|
||||||
|
components = catalog.get("component")
|
||||||
|
if not isinstance(components, list):
|
||||||
|
raise BundleError("components.toml has no [[component]] entries")
|
||||||
|
return components
|
||||||
|
|
||||||
|
|
||||||
|
def read_config(root: Path, revision: str | None, path: Path) -> dict:
|
||||||
|
if not path.is_absolute():
|
||||||
|
path = root / path
|
||||||
|
if revision is not None:
|
||||||
|
relative = path.resolve().relative_to(root.resolve()).as_posix()
|
||||||
|
raw = read_blob(root, revision, relative)
|
||||||
|
if raw is None:
|
||||||
|
raise BundleError(f"root commit {revision} has no {relative}")
|
||||||
|
try:
|
||||||
|
config = json.loads(raw.decode("utf-8"))
|
||||||
|
except (UnicodeDecodeError, json.JSONDecodeError) as error:
|
||||||
|
raise BundleError(f"invalid Bundle config {relative}: {error}") from error
|
||||||
|
else:
|
||||||
|
config = load_json(path)
|
||||||
|
for field in ("name", "version"):
|
||||||
|
value = config.get(field)
|
||||||
|
if not isinstance(value, str) or not value:
|
||||||
|
raise BundleError(f"Bundle config has no non-empty `{field}`")
|
||||||
|
aliases = config.get("public_aliases", [])
|
||||||
|
if not isinstance(aliases, list):
|
||||||
|
raise BundleError("Bundle config `public_aliases` must be a list")
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
def pinned_gitlink(root: Path, revision: str, path: str) -> str:
|
||||||
|
result = _git(root, "ls-tree", revision, "--", path).decode().strip()
|
||||||
|
if not result:
|
||||||
|
raise BundleError(
|
||||||
|
f"root commit {revision} has no gitlink at {path}; only published "
|
||||||
|
"components may join the Bundle"
|
||||||
|
)
|
||||||
|
fields = result.split()
|
||||||
|
if len(fields) != 4:
|
||||||
|
raise BundleError(f"invalid gitlink record for {path}")
|
||||||
|
mode, kind, sha, _ = fields
|
||||||
|
if mode != "160000" or kind != "commit":
|
||||||
|
raise BundleError(f"{path} is not a gitlink in root commit {revision}")
|
||||||
|
return sha
|
||||||
|
|
||||||
|
|
||||||
|
def worktree_sha(component_dir: Path) -> str:
|
||||||
|
if not (component_dir / ".git").exists():
|
||||||
|
raise BundleError(f"missing component checkout: {component_dir}")
|
||||||
|
status = _git(component_dir, "status", "--porcelain").decode().strip()
|
||||||
|
if status:
|
||||||
|
raise BundleError(f"dirty component checkout: {component_dir}")
|
||||||
|
return _git(component_dir, "rev-parse", "HEAD").decode().strip()
|
||||||
|
|
||||||
|
|
||||||
|
def validate_published_path(relative: str, component_id: str) -> None:
|
||||||
|
if not relative or relative.startswith("/"):
|
||||||
|
raise BundleError(f"{component_id}: invalid published path {relative!r}")
|
||||||
|
parts = relative.split("/")
|
||||||
|
if any(part in ("", ".", "..") for part in parts):
|
||||||
|
raise BundleError(f"{component_id}: unsafe published path {relative!r}")
|
||||||
|
if any(part.startswith(".") for part in parts):
|
||||||
|
raise BundleError(f"{component_id}: hidden path segment in {relative!r}")
|
||||||
|
if "tests" in parts:
|
||||||
|
raise BundleError(f"{component_id}: tests must not enter the Bundle: {relative!r}")
|
||||||
|
if not relative.endswith(PUBLISHED_SUFFIX):
|
||||||
|
raise BundleError(
|
||||||
|
f"{component_id}: only {PUBLISHED_SUFFIX} files are published, got {relative!r}"
|
||||||
|
)
|
||||||
|
if _nfc(relative) != relative:
|
||||||
|
raise BundleError(
|
||||||
|
f"{component_id}: published path is not NFC normalised: {relative!r}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def component_modules(component_dir: Path, revision: str, component_id: str) -> list[tuple[str, str]]:
|
||||||
|
output = _git(
|
||||||
|
component_dir, "ls-tree", "-r", "-z", revision, "--", MODULES
|
||||||
|
)
|
||||||
|
records = [record for record in output.split(b"\0") if record]
|
||||||
|
published: list[tuple[str, str]] = []
|
||||||
|
for record in records:
|
||||||
|
header, _, raw_path = record.partition(b"\t")
|
||||||
|
fields = header.decode().split()
|
||||||
|
if len(fields) != 3:
|
||||||
|
raise BundleError(f"{component_id}: invalid tree record {record!r}")
|
||||||
|
mode, kind, sha = fields
|
||||||
|
path = raw_path.decode()
|
||||||
|
if kind != "blob" or mode not in ("100644", "100755"):
|
||||||
|
raise BundleError(
|
||||||
|
f"{component_id}: only regular modules files are publishable, "
|
||||||
|
f"found {mode} {kind} at {path}"
|
||||||
|
)
|
||||||
|
relative = path[len(MODULES) + 1 :]
|
||||||
|
if not relative.endswith(PUBLISHED_SUFFIX):
|
||||||
|
continue
|
||||||
|
validate_published_path(relative, component_id)
|
||||||
|
published.append((relative, sha))
|
||||||
|
if not published:
|
||||||
|
raise BundleError(
|
||||||
|
f"{component_id}: active component publishes no {PUBLISHED_SUFFIX} modules"
|
||||||
|
)
|
||||||
|
return published
|
||||||
|
|
||||||
|
|
||||||
|
def collect(root: Path, components: list[dict], *, root_commit: str | None) -> tuple[dict[str, bytes], list[dict]]:
|
||||||
|
active = [
|
||||||
|
component
|
||||||
|
for component in components
|
||||||
|
if component.get("kind") == "stdlib" and component.get("state") == "active"
|
||||||
|
]
|
||||||
|
if not active:
|
||||||
|
raise BundleError("no active stdlib component; nothing to publish")
|
||||||
|
for component in active:
|
||||||
|
if component.get("release") != "base":
|
||||||
|
raise BundleError(
|
||||||
|
f'{component["id"]}: active stdlib component must have release = "base"'
|
||||||
|
)
|
||||||
|
files: dict[str, bytes] = {}
|
||||||
|
identities: list[dict] = []
|
||||||
|
owners: dict[str, str] = {}
|
||||||
|
folded: dict[str, str] = {}
|
||||||
|
for component in active:
|
||||||
|
component_id = component["id"]
|
||||||
|
path = component["path"]
|
||||||
|
component_dir = (root / path).resolve()
|
||||||
|
revision = (
|
||||||
|
pinned_gitlink(root, root_commit, path)
|
||||||
|
if root_commit is not None
|
||||||
|
else worktree_sha(component_dir)
|
||||||
|
)
|
||||||
|
modules = component_modules(component_dir, revision, component_id)
|
||||||
|
for relative, sha in modules:
|
||||||
|
key = _nfc(relative).casefold()
|
||||||
|
if relative in owners:
|
||||||
|
raise BundleError(
|
||||||
|
f"duplicate published path {relative!r}: "
|
||||||
|
f"{owners[relative]} and {component_id}"
|
||||||
|
)
|
||||||
|
if key in folded:
|
||||||
|
raise BundleError(
|
||||||
|
f"case/NFC collision on {relative!r}: "
|
||||||
|
f"{folded[key]} and {component_id}"
|
||||||
|
)
|
||||||
|
owners[relative] = component_id
|
||||||
|
folded[key] = component_id
|
||||||
|
files[relative] = _git(component_dir, "cat-file", "blob", sha)
|
||||||
|
identities.append(
|
||||||
|
{"id": component_id, "path": path, "revision": revision, "files": len(modules)}
|
||||||
|
)
|
||||||
|
return files, identities
|
||||||
|
|
||||||
|
|
||||||
|
def tree_digest(files: dict[str, bytes]) -> str:
|
||||||
|
digest = hashlib.sha256()
|
||||||
|
for relative in sorted(files):
|
||||||
|
digest.update(relative.encode())
|
||||||
|
digest.update(b"\0")
|
||||||
|
digest.update(files[relative])
|
||||||
|
digest.update(b"\0")
|
||||||
|
return "sha256:" + digest.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def aliases_digest(aliases: list[dict]) -> str:
|
||||||
|
digest = hashlib.sha256()
|
||||||
|
for alias in sorted(
|
||||||
|
aliases, key=lambda item: (item["target_module"], item["target_function"])
|
||||||
|
):
|
||||||
|
digest.update(alias["target_module"].encode())
|
||||||
|
digest.update(b"\0")
|
||||||
|
digest.update(alias["target_function"].encode())
|
||||||
|
digest.update(b"\0")
|
||||||
|
for name in sorted(alias["public_names"]):
|
||||||
|
digest.update(name.encode())
|
||||||
|
digest.update(b"\0")
|
||||||
|
return "sha256:" + digest.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def validate_aliases(aliases: list[dict], files: dict[str, bytes]) -> None:
|
||||||
|
seen: set[str] = set()
|
||||||
|
for alias in aliases:
|
||||||
|
if not isinstance(alias, dict):
|
||||||
|
raise BundleError("public alias entry must be an object")
|
||||||
|
module = alias.get("target_module")
|
||||||
|
function = alias.get("target_function")
|
||||||
|
names = alias.get("public_names")
|
||||||
|
if module not in files:
|
||||||
|
raise BundleError(f"public alias targets missing module: {module!r}")
|
||||||
|
if not isinstance(function, str) or not function:
|
||||||
|
raise BundleError(f"public alias for {module} has no target_function")
|
||||||
|
if not isinstance(names, list) or not names or not all(
|
||||||
|
isinstance(name, str) and name for name in names
|
||||||
|
):
|
||||||
|
raise BundleError(f"public alias for {module}.{function} has invalid names")
|
||||||
|
for name in names:
|
||||||
|
if name in seen:
|
||||||
|
raise BundleError(f"public alias name declared twice: {name!r}")
|
||||||
|
seen.add(name)
|
||||||
|
if alias.get("expected_signature") != "params(值)":
|
||||||
|
raise BundleError(
|
||||||
|
f"public alias {module}.{function} must keep expected_signature params(值)"
|
||||||
|
)
|
||||||
|
if alias.get("effects") != ["host"]:
|
||||||
|
raise BundleError(
|
||||||
|
f"public alias {module}.{function} must keep effects [host]"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def build_manifest(config: dict, files: dict[str, bytes]) -> dict:
|
||||||
|
aliases = config.get("public_aliases", [])
|
||||||
|
validate_aliases(aliases, files)
|
||||||
|
return {
|
||||||
|
"name": config["name"],
|
||||||
|
"version": config["version"],
|
||||||
|
"digest": tree_digest(files),
|
||||||
|
"public_aliases": aliases,
|
||||||
|
"aliases_digest": aliases_digest(aliases),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def check_baseline(manifest: dict, baseline_path: Path) -> None:
|
||||||
|
baseline = load_json(baseline_path)
|
||||||
|
if baseline.get("version") == manifest["version"] and baseline.get(
|
||||||
|
"digest"
|
||||||
|
) != manifest["digest"]:
|
||||||
|
raise BundleError(
|
||||||
|
f"Bundle content changed but version is still {manifest['version']}; "
|
||||||
|
"bump the version explicitly"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def write_bundle(out: Path, manifest: dict, files: dict[str, bytes], force: bool) -> None:
|
||||||
|
if out.exists():
|
||||||
|
if not force:
|
||||||
|
raise BundleError(f"output directory already exists: {out}")
|
||||||
|
shutil.rmtree(out)
|
||||||
|
out.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
staging = Path(tempfile.mkdtemp(prefix=".stdlib-build-", dir=str(out.parent)))
|
||||||
|
try:
|
||||||
|
for relative, data in files.items():
|
||||||
|
target = staging / relative
|
||||||
|
target.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
target.write_bytes(data)
|
||||||
|
(staging / MANIFEST).write_text(
|
||||||
|
json.dumps(manifest, ensure_ascii=False, indent=2) + "\n",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
os.replace(staging, out)
|
||||||
|
except BaseException:
|
||||||
|
shutil.rmtree(staging, ignore_errors=True)
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv: list[str]) -> int:
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument("--out", required=True, help="Bundle output directory")
|
||||||
|
parser.add_argument("--root-commit", default=None)
|
||||||
|
parser.add_argument("--worktree", action="store_true")
|
||||||
|
parser.add_argument("--config", default=None)
|
||||||
|
parser.add_argument("--baseline-manifest", default=None)
|
||||||
|
parser.add_argument("--force", action="store_true")
|
||||||
|
parser.add_argument("--root", default=str(ROOT), help=argparse.SUPPRESS)
|
||||||
|
args = parser.parse_args(argv)
|
||||||
|
if args.worktree and args.root_commit:
|
||||||
|
parser.error("--worktree and --root-commit are mutually exclusive")
|
||||||
|
root = Path(args.root).resolve()
|
||||||
|
revision = None
|
||||||
|
if not args.worktree:
|
||||||
|
revision = args.root_commit or _git(root, "rev-parse", "HEAD").decode().strip()
|
||||||
|
try:
|
||||||
|
components = read_catalog(root, revision)
|
||||||
|
config = read_config(root, revision, Path(args.config) if args.config else DEFAULT_CONFIG)
|
||||||
|
files, identities = collect(root, components, root_commit=revision)
|
||||||
|
manifest = build_manifest(config, files)
|
||||||
|
if args.baseline_manifest:
|
||||||
|
check_baseline(manifest, Path(args.baseline_manifest))
|
||||||
|
except BundleError as error:
|
||||||
|
raise SystemExit(f"build-stdlib: error: {error}") from error
|
||||||
|
write_bundle(Path(args.out), manifest, files, args.force)
|
||||||
|
summary = {
|
||||||
|
"name": manifest["name"],
|
||||||
|
"version": manifest["version"],
|
||||||
|
"tree_digest": manifest["digest"],
|
||||||
|
"aliases_digest": manifest["aliases_digest"],
|
||||||
|
"root_commit": revision,
|
||||||
|
"components": identities,
|
||||||
|
"files": sorted(files),
|
||||||
|
}
|
||||||
|
print(json.dumps(summary, ensure_ascii=False, indent=2))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main(sys.argv[1:]))
|
||||||
@@ -0,0 +1,455 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Validate a Marqdo ecosystem Git tree.
|
||||||
|
|
||||||
|
The checker follows the hierarchical governance rules of the Marqdo ecosystem
|
||||||
|
specification (sections 2-4, 13):
|
||||||
|
|
||||||
|
* the root catalog describes direct components and domain aggregates;
|
||||||
|
* a registered ``kind = "domain"`` gitlink is expanded at its exact pinned
|
||||||
|
commit for ``--checkouts`` or to validate URLs before updating its children;
|
||||||
|
* each aggregate layer has its own ``components.toml`` / ``.gitmodules`` and
|
||||||
|
registers only its direct children;
|
||||||
|
* governance depth is limited to two gitlink levels (root -> domain -> leaf);
|
||||||
|
* global ids and remotes are unique, dependency edges resolve globally and
|
||||||
|
``requires`` stays acyclic while ``checks_with`` may contain cycles.
|
||||||
|
|
||||||
|
Commit identity comes from the Git tree (gitlinks), the authority for remotes
|
||||||
|
is ``.gitmodules`` and the catalog never repeats SHAs. The checker never
|
||||||
|
fetches from a network remote, never runs ``git submodule update`` and only
|
||||||
|
reads objects already present in the local repositories.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import graphlib
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tomllib
|
||||||
|
import unicodedata
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
NAME = r"[a-z][a-z0-9]*(?:-[a-z0-9]+)*"
|
||||||
|
FIELDS = {"id", "path", "kind", "state", "owner", "scope", "requires", "checks_with", "release"}
|
||||||
|
ROOT_FILES = {".gitattributes", ".gitignore", ".gitmodules", "AGENTS.md", "LICENSE", "README.md", "components.toml"}
|
||||||
|
ROOT_DIRS = {".gitea", ".woodpecker", "docs", "examples", "scripts"}
|
||||||
|
CATEGORY_READMES = {"stdlib/README.md", "extensions/README.md"}
|
||||||
|
RELEASE_ROLES = {"core": "base", "stdlib": "base", "extension": "optional", "tool": "optional", "test": "none"}
|
||||||
|
DOMAIN_RELEASE = {"none", "base"}
|
||||||
|
DOMAIN_FILES = {".gitattributes", ".gitignore", ".gitmodules", "AGENTS.md", "LICENSE", "README.md", "components.toml"}
|
||||||
|
DOMAIN_DIRS = {".gitea", ".woodpecker", "docs", "examples", "scripts", "tests"}
|
||||||
|
DOMAIN_CHILD_KINDS = {"stdlib", "extension", "tool"}
|
||||||
|
AUTHORITY = "https://git.cflmy.cn/cflmy"
|
||||||
|
ENTRY = r"(?:[a-zA-Z0-9_-]+/)*[a-zA-Z0-9_-][a-zA-Z0-9_.-]*"
|
||||||
|
|
||||||
|
|
||||||
|
def git(*args, cwd=ROOT):
|
||||||
|
return subprocess.check_output(["git", "-C", str(cwd), *args]).decode()
|
||||||
|
|
||||||
|
|
||||||
|
def require(condition, message):
|
||||||
|
if not condition:
|
||||||
|
raise ValueError(message)
|
||||||
|
|
||||||
|
|
||||||
|
def nfc(value):
|
||||||
|
return unicodedata.normalize("NFC", value)
|
||||||
|
|
||||||
|
|
||||||
|
class Layer:
|
||||||
|
"""One governance level: the root tree or one expanded domain aggregate."""
|
||||||
|
|
||||||
|
def __init__(self, repo, revision, label, depth, order, components, gitlinks, linked, urls):
|
||||||
|
self.repo = Path(repo)
|
||||||
|
self.revision = revision
|
||||||
|
self.label = label
|
||||||
|
self.depth = depth
|
||||||
|
self.order = order
|
||||||
|
self.components = components
|
||||||
|
self.gitlinks = gitlinks
|
||||||
|
self.linked = linked
|
||||||
|
self.urls = urls
|
||||||
|
|
||||||
|
|
||||||
|
def read_blob(repo, revision, path, label):
|
||||||
|
try:
|
||||||
|
return git("show", f"{revision}:{path}", cwd=repo)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def check_relative_path(path, id, label):
|
||||||
|
require(isinstance(path, str) and path, f"{label}: invalid path for {id}: {path!r}")
|
||||||
|
require("\\" not in path and not path.startswith("/") and not path.endswith("/"),
|
||||||
|
f"{label}: invalid path for {id}: {path!r}")
|
||||||
|
segments = path.split("/")
|
||||||
|
require(all(segment and segment not in {".", ".."} for segment in segments),
|
||||||
|
f"{label}: invalid path for {id}: {path!r}")
|
||||||
|
require(all(re.fullmatch(NAME, segment) for segment in segments),
|
||||||
|
f"{label}: invalid path for {id}: {path!r}")
|
||||||
|
require(nfc(path) == path, f"{label}: non-NFC path for {id}: {path!r}")
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def expected_root_path(component):
|
||||||
|
kind = component["kind"]
|
||||||
|
id = component["id"]
|
||||||
|
if kind == "core":
|
||||||
|
return "cli" if id == "cli" else None
|
||||||
|
if kind == "test":
|
||||||
|
return "tests/conformance" if id == "conformance" else None
|
||||||
|
if kind == "stdlib":
|
||||||
|
return f"stdlib/{id.removeprefix('std-')}" if id.startswith("std-") else None
|
||||||
|
if kind == "extension":
|
||||||
|
return f"extensions/{id}"
|
||||||
|
if kind == "tool":
|
||||||
|
return f"tools/{id}"
|
||||||
|
if kind == "domain":
|
||||||
|
return "stdlib" if id == "stdlib" else f"extensions/{id}"
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def expected_remote(component, depth):
|
||||||
|
"""Derive the single approved self-hosted HTTPS remote for a component.
|
||||||
|
|
||||||
|
Root direct components keep their historical ``marqdo-<id>`` /
|
||||||
|
``marqdo-ext-<id>`` / ``marqdo-extension-conformance`` repository names.
|
||||||
|
Components registered by a domain aggregate are independently named
|
||||||
|
``marqdo-<id>`` (for example ``marqdo-web-design``).
|
||||||
|
"""
|
||||||
|
id = component["id"]
|
||||||
|
kind = component["kind"]
|
||||||
|
if depth == 0:
|
||||||
|
if kind == "test":
|
||||||
|
name = "extension-conformance"
|
||||||
|
elif kind == "extension":
|
||||||
|
name = f"ext-{id}"
|
||||||
|
elif kind == "domain":
|
||||||
|
name = "stdlib" if id == "stdlib" else f"ext-{id}"
|
||||||
|
else:
|
||||||
|
name = id
|
||||||
|
else:
|
||||||
|
name = id
|
||||||
|
return f"{AUTHORITY}/marqdo-{name}.git"
|
||||||
|
|
||||||
|
|
||||||
|
def check_component(raw, depth, label, by_id, paths, path_keys):
|
||||||
|
require(isinstance(raw, dict), f"{label}: invalid component entry: {raw!r}")
|
||||||
|
id = raw.get("id")
|
||||||
|
state = raw.get("state")
|
||||||
|
require(state in {"active", "planned"}, f"{label}: invalid state: {id!r}")
|
||||||
|
fields = FIELDS | ({"entry"} if state == "active" else set())
|
||||||
|
require(set(raw) == fields, f"{label}: invalid fields for {id!r}: {sorted(set(raw) ^ fields)}")
|
||||||
|
require(isinstance(id, str) and re.fullmatch(NAME, id), f"{label}: invalid id: {id!r}")
|
||||||
|
|
||||||
|
for key in ("requires", "checks_with"):
|
||||||
|
items = raw[key]
|
||||||
|
require(isinstance(items, list) and all(isinstance(item, str) for item in items),
|
||||||
|
f"{label}: invalid {key}: {id}")
|
||||||
|
require(id not in items and len(set(items)) == len(items), f"{label}: invalid {key}: {id}")
|
||||||
|
|
||||||
|
kind = raw["kind"]
|
||||||
|
require(kind in RELEASE_ROLES or kind == "domain", f"{label}: unknown kind: {id}: {kind!r}")
|
||||||
|
if kind == "domain":
|
||||||
|
require(depth == 0, f"{label}: domain kind is only allowed at the root layer: {id}")
|
||||||
|
require(raw["release"] in DOMAIN_RELEASE, f"{label}: invalid release role: {id}")
|
||||||
|
require(raw["requires"] == [], f"{label}: domain requires must be empty: {id}")
|
||||||
|
else:
|
||||||
|
require(depth == 0 or kind in DOMAIN_CHILD_KINDS,
|
||||||
|
f"{label}: component kind is not allowed inside a domain: {id} ({kind})")
|
||||||
|
require(raw["release"] == RELEASE_ROLES[kind], f"{label}: invalid release role: {id}")
|
||||||
|
|
||||||
|
path = check_relative_path(raw["path"], id, label)
|
||||||
|
if depth == 0:
|
||||||
|
expected = expected_root_path(raw)
|
||||||
|
require(expected is not None and path == expected,
|
||||||
|
f"{label}: invalid path: {id}: {path} (expected {expected})")
|
||||||
|
require(path not in paths, f"{label}: invalid or duplicate path: {path}")
|
||||||
|
key = nfc(path).casefold()
|
||||||
|
require(key not in path_keys, f"{label}: path case/NFC conflict: {id}: {path}")
|
||||||
|
for other in paths:
|
||||||
|
require(not path.startswith(other + "/") and not other.startswith(path + "/"),
|
||||||
|
f"{label}: overlapping component path: {path} / {other}")
|
||||||
|
|
||||||
|
for key in ("owner", "scope"):
|
||||||
|
require(isinstance(raw[key], str) and raw[key].strip(), f"{label}: missing {key}: {id}")
|
||||||
|
if state == "active":
|
||||||
|
require(isinstance(raw["entry"], str) and re.fullmatch(ENTRY, raw["entry"]),
|
||||||
|
f"{label}: unsafe entry: {id}")
|
||||||
|
|
||||||
|
paths.add(path)
|
||||||
|
path_keys.add(key)
|
||||||
|
by_id[id] = raw
|
||||||
|
return raw
|
||||||
|
|
||||||
|
|
||||||
|
def parse_catalog(repo, revision, label):
|
||||||
|
text = read_blob(repo, revision, "components.toml", label)
|
||||||
|
require(text is not None, f"{label}: missing components.toml at {revision}")
|
||||||
|
try:
|
||||||
|
data = tomllib.loads(text)
|
||||||
|
except tomllib.TOMLDecodeError as error:
|
||||||
|
raise ValueError(f"{label}: invalid components.toml: {error}") from None
|
||||||
|
require(set(data) == {"component"} and isinstance(data["component"], list), f"{label}: invalid catalog")
|
||||||
|
return data["component"]
|
||||||
|
|
||||||
|
|
||||||
|
def tree_entries(repo, revision, label):
|
||||||
|
try:
|
||||||
|
output = git("ls-tree", "-rz", "--full-tree", revision, cwd=repo)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
raise ValueError(f"{label}: missing Git tree at {revision}") from None
|
||||||
|
entries = {}
|
||||||
|
for record in output.split("\0"):
|
||||||
|
if record:
|
||||||
|
metadata, path = record.split("\t", 1)
|
||||||
|
mode, _, sha = metadata.split()
|
||||||
|
entries[path] = (mode, sha)
|
||||||
|
return entries
|
||||||
|
|
||||||
|
|
||||||
|
def check_root_tree(entries, linked, unlinked, label):
|
||||||
|
allowed_readmes = CATEGORY_READMES | {
|
||||||
|
f'{item["path"]}/README.md'
|
||||||
|
for item in unlinked
|
||||||
|
if item["kind"] in {"stdlib", "extension", "domain"}
|
||||||
|
}
|
||||||
|
for path, (mode, _) in entries.items():
|
||||||
|
root = path.split("/", 1)[0]
|
||||||
|
require(
|
||||||
|
path in linked or (mode == "100644" and path in allowed_readmes)
|
||||||
|
or (mode in {"100644", "100755"} and (
|
||||||
|
path in ROOT_FILES or root in ROOT_DIRS and "/" in path or path.startswith("tests/integration/")
|
||||||
|
)),
|
||||||
|
f"{label}: unexpected tracked path or mode: {path} ({mode})",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def check_domain_tree(entries, linked, unlinked, label):
|
||||||
|
"""Aggregate layers only carry governance, docs, examples and tests.
|
||||||
|
|
||||||
|
Production implementations stay in the child repositories: an aggregate
|
||||||
|
may not add a renderer, parser or driver under its own tree.
|
||||||
|
"""
|
||||||
|
allowed_readmes = {f'{item["path"]}/README.md' for item in unlinked}
|
||||||
|
for path, (mode, _) in entries.items():
|
||||||
|
if path in linked:
|
||||||
|
continue
|
||||||
|
if mode == "100644" and path in allowed_readmes:
|
||||||
|
continue
|
||||||
|
top = path.split("/", 1)[0]
|
||||||
|
top_level_doc = mode == "100644" and "/" not in path and path.endswith(".md")
|
||||||
|
require(
|
||||||
|
mode in {"100644", "100755"} and (
|
||||||
|
path in DOMAIN_FILES or top_level_doc or (top in DOMAIN_DIRS and "/" in path)
|
||||||
|
),
|
||||||
|
f"{label}: unexpected aggregate tracked path or mode: {path} ({mode})",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def read_submodules(repo, revision, label):
|
||||||
|
if read_blob(repo, revision, ".gitmodules", label) is None:
|
||||||
|
return {}
|
||||||
|
try:
|
||||||
|
output = git("config", "--null", "--blob", f"{revision}:.gitmodules", "--list", cwd=repo)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
raise ValueError(f"{label}: invalid .gitmodules") from None
|
||||||
|
config = {}
|
||||||
|
for record in output.split("\0"):
|
||||||
|
if record:
|
||||||
|
key, value = record.split("\n", 1)
|
||||||
|
require(key not in config, f"{label}: duplicate submodule setting: {key}")
|
||||||
|
config[key] = value
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
def check_submodules(config, linked, depth, label, urls):
|
||||||
|
"""Match ``.gitmodules`` sections by ``path``, not by section name.
|
||||||
|
|
||||||
|
Git configuration keys are keyed by the submodule section name, which is
|
||||||
|
not required to equal the checked-out path. Path and URL remain the
|
||||||
|
authority for identity; any other setting (for example an ``update``
|
||||||
|
command or a relative override) is rejected as unexpected.
|
||||||
|
"""
|
||||||
|
sections = {}
|
||||||
|
extras = []
|
||||||
|
for key, value in config.items():
|
||||||
|
match = re.fullmatch(r"submodule\.(.+)\.(path|url)", key)
|
||||||
|
if not match:
|
||||||
|
extras.append(key)
|
||||||
|
continue
|
||||||
|
name, field = match.groups()
|
||||||
|
sections.setdefault(name, {})[field] = value
|
||||||
|
by_path = {}
|
||||||
|
for name, fields in sections.items():
|
||||||
|
require(set(fields) == {"path", "url"},
|
||||||
|
f"{label}: unexpected submodule settings: "
|
||||||
|
f"{sorted(f'submodule.{name}.{field}' for field in set(fields) ^ {'path', 'url'})}")
|
||||||
|
path = fields["path"]
|
||||||
|
require(path not in by_path, f"{label}: duplicate submodule path: {path}")
|
||||||
|
by_path[path] = fields["url"]
|
||||||
|
require(not extras, f"{label}: unexpected submodule settings: {sorted(extras)}")
|
||||||
|
for path, component in linked.items():
|
||||||
|
require(path in by_path, f"{label}: missing or invalid submodule path: {path}")
|
||||||
|
url = by_path.pop(path)
|
||||||
|
expected = expected_remote(component, depth)
|
||||||
|
require(url == expected, f"{label}: invalid submodule URL: {path}: {url!r}")
|
||||||
|
require(url not in urls, f"{label}: duplicate submodule remote: {path}: {url}")
|
||||||
|
urls[url] = path
|
||||||
|
require(not by_path, f"{label}: unexpected submodule settings: {sorted(by_path)}")
|
||||||
|
|
||||||
|
|
||||||
|
def read_layer(repo, revision, label, depth):
|
||||||
|
repo = Path(repo)
|
||||||
|
order = []
|
||||||
|
components = {}
|
||||||
|
paths = set()
|
||||||
|
path_keys = set()
|
||||||
|
for raw in parse_catalog(repo, revision, label):
|
||||||
|
order.append(check_component(raw, depth, label, components, paths, path_keys))
|
||||||
|
entries = tree_entries(repo, revision, label)
|
||||||
|
gitlinks = {path: sha for path, (mode, sha) in entries.items() if mode == "160000"}
|
||||||
|
active_paths = {item["path"] for item in order if item["state"] == "active"}
|
||||||
|
mismatch = (active_paths - gitlinks.keys()) | (gitlinks.keys() - paths)
|
||||||
|
require(not mismatch, f"{label}: gitlink/catalog mismatch: {sorted(mismatch)}")
|
||||||
|
linked = {item["path"]: item for item in order if item["path"] in gitlinks}
|
||||||
|
unlinked = [item for item in order if item["path"] not in gitlinks]
|
||||||
|
if depth == 0:
|
||||||
|
check_root_tree(entries, linked, unlinked, label)
|
||||||
|
else:
|
||||||
|
check_domain_tree(entries, linked, unlinked, label)
|
||||||
|
urls = {}
|
||||||
|
check_submodules(read_submodules(repo, revision, label), linked, depth, label, urls)
|
||||||
|
return Layer(repo, revision, label, depth, order, components, gitlinks, linked, urls)
|
||||||
|
|
||||||
|
|
||||||
|
def verify_checkout(layer, component):
|
||||||
|
path = component["path"]
|
||||||
|
checkout = layer.repo / path
|
||||||
|
sha = layer.gitlinks[path]
|
||||||
|
require(checkout.resolve() == checkout and (checkout / ".git").exists(),
|
||||||
|
f"{layer.label}: missing submodule checkout: {path}")
|
||||||
|
try:
|
||||||
|
git("cat-file", "-e", f"{sha}^{{commit}}", cwd=checkout)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
raise ValueError(f"{layer.label}: missing committed object: {path}@{sha}") from None
|
||||||
|
require(git("rev-parse", "HEAD", cwd=checkout).strip() == sha,
|
||||||
|
f"{layer.label}: wrong checked-out commit: {path}")
|
||||||
|
status = ["status", "--porcelain"]
|
||||||
|
if component["kind"] == "domain":
|
||||||
|
# Child dirt is the responsibility of the child checkout and is
|
||||||
|
# reported by its own leaf check, not by the aggregate repository.
|
||||||
|
status.append("--ignore-submodules=all")
|
||||||
|
require(not git(*status, cwd=checkout),
|
||||||
|
f"{layer.label}: dirty submodule: {path}")
|
||||||
|
if component["state"] == "active":
|
||||||
|
entry = checkout / component["entry"]
|
||||||
|
require(entry.is_file() and entry.resolve() == entry,
|
||||||
|
f"{layer.label}: missing or symbolic entry: {path}/{component['entry']}")
|
||||||
|
return checkout
|
||||||
|
|
||||||
|
|
||||||
|
def verify_leaf(layer, component):
|
||||||
|
checkout = verify_checkout(layer, component)
|
||||||
|
sha = layer.gitlinks[component["path"]]
|
||||||
|
label = f'{layer.label} leaf {component["id"]} ({component["path"]})'
|
||||||
|
nested = tree_entries(checkout, sha, label)
|
||||||
|
gitlinks = sorted(path for path, (mode, _) in nested.items() if mode == "160000")
|
||||||
|
require(not gitlinks, f"{label}: leaf must not register gitlinks: {gitlinks}")
|
||||||
|
|
||||||
|
|
||||||
|
def validate_graph(layers):
|
||||||
|
components = {}
|
||||||
|
for layer in layers:
|
||||||
|
for component in layer.order:
|
||||||
|
id = component["id"]
|
||||||
|
require(id not in components, f"{layer.label}: duplicate global id: {id}")
|
||||||
|
components[id] = (component, layer)
|
||||||
|
remotes = {}
|
||||||
|
for layer in layers:
|
||||||
|
for url, path in layer.urls.items():
|
||||||
|
require(url not in remotes, f"{layer.label}: duplicate global remote: {path}: {url}")
|
||||||
|
remotes[url] = path
|
||||||
|
for layer in layers:
|
||||||
|
for component in layer.order:
|
||||||
|
id = component["id"]
|
||||||
|
for field in ("requires", "checks_with"):
|
||||||
|
for dependency in component[field]:
|
||||||
|
require(dependency in components, f"{layer.label}: unknown dependency: {id} -> {dependency}")
|
||||||
|
target, _ = components[dependency]
|
||||||
|
require(component["state"] != "active" or target["state"] == "active",
|
||||||
|
f"{layer.label}: active depends on planned: {id} -> {dependency}")
|
||||||
|
if field != "requires":
|
||||||
|
continue
|
||||||
|
target_kind = target["kind"]
|
||||||
|
source_kind = component["kind"]
|
||||||
|
require(target_kind != "domain",
|
||||||
|
f"{layer.label}: requires must not target a domain: {id} -> {dependency}")
|
||||||
|
if source_kind in {"core", "domain"}:
|
||||||
|
require(False, f"{layer.label}: dependency violation: {id} must not require {dependency}")
|
||||||
|
if source_kind == "stdlib":
|
||||||
|
require(target_kind in {"core", "stdlib"},
|
||||||
|
f"{layer.label}: stdlib dependency violation: {id} -> {dependency}")
|
||||||
|
elif source_kind == "tool":
|
||||||
|
require(target_kind in {"core", "extension"},
|
||||||
|
f"{layer.label}: tool dependency violation: {id} -> {dependency}")
|
||||||
|
elif source_kind == "extension":
|
||||||
|
require(target_kind in {"core", "stdlib", "extension"},
|
||||||
|
f"{layer.label}: extension dependency violation: {id} -> {dependency}")
|
||||||
|
try:
|
||||||
|
graph = {id: list(item["requires"]) for id, (item, _) in components.items()}
|
||||||
|
tuple(graphlib.TopologicalSorter(graph).static_order())
|
||||||
|
except graphlib.CycleError as error:
|
||||||
|
raise ValueError(f"root: requires DAG cycle: {error}") from None
|
||||||
|
|
||||||
|
|
||||||
|
def validate(revision, checkouts, expand_domains=False):
|
||||||
|
layers = [read_layer(ROOT, revision, "root", 0)]
|
||||||
|
if checkouts or expand_domains:
|
||||||
|
root = layers[0]
|
||||||
|
for path, component in root.linked.items():
|
||||||
|
if component["kind"] != "domain":
|
||||||
|
if checkouts:
|
||||||
|
verify_leaf(root, component)
|
||||||
|
continue
|
||||||
|
domain_repo = verify_checkout(root, component)
|
||||||
|
domain = read_layer(domain_repo, root.gitlinks[path],
|
||||||
|
f"domain {component['id']} ({path})", 1)
|
||||||
|
layers.append(domain)
|
||||||
|
if checkouts:
|
||||||
|
for child in domain.linked.values():
|
||||||
|
verify_leaf(domain, child)
|
||||||
|
validate_graph(layers)
|
||||||
|
return layers
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="Validate a Marqdo ecosystem Git tree")
|
||||||
|
parser.add_argument("revision", nargs="?", default="HEAD")
|
||||||
|
parser.add_argument("--checkouts", action="store_true")
|
||||||
|
paths = parser.add_mutually_exclusive_group()
|
||||||
|
paths.add_argument("--active-paths", action="store_true", help="print only direct active component paths")
|
||||||
|
paths.add_argument("--domain-paths", action="store_true", help="validate domain URLs and print domain paths")
|
||||||
|
args = parser.parse_args()
|
||||||
|
try:
|
||||||
|
revision = git("rev-parse", "--verify", args.revision + "^{commit}").strip()
|
||||||
|
layers = validate(revision, args.checkouts, expand_domains=args.domain_paths)
|
||||||
|
if args.active_paths:
|
||||||
|
for path, component in sorted(layers[0].linked.items()):
|
||||||
|
if component["state"] == "active":
|
||||||
|
print(path)
|
||||||
|
elif args.domain_paths:
|
||||||
|
for path, component in sorted(layers[0].linked.items()):
|
||||||
|
if component["kind"] == "domain":
|
||||||
|
print(path)
|
||||||
|
else:
|
||||||
|
for layer in layers:
|
||||||
|
for path, component in sorted(layer.linked.items()):
|
||||||
|
relative = (layer.repo / path).relative_to(ROOT).as_posix()
|
||||||
|
print(f'{component["id"]} {relative} {layer.gitlinks[path]} {component["state"]}')
|
||||||
|
except (AttributeError, KeyError, OSError, subprocess.CalledProcessError, TypeError, ValueError) as error:
|
||||||
|
sys.exit(f"layout: {error}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Executable
+108
@@ -0,0 +1,108 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
root="$PWD"
|
||||||
|
active="$(python3 scripts/check-layout.py --checkouts --active-paths)"
|
||||||
|
expected=$'cli\ntests/conformance\ntools/knowledge\ntools/lint\ntools/prove\ntools/view'
|
||||||
|
if [[ "$active" != "$expected" ]]; then
|
||||||
|
echo "UNVERIFIED: update the integration plan for the changed active component set" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p .integration-work
|
||||||
|
work="$(mktemp -d "$root/.integration-work/run.XXXXXX")"
|
||||||
|
echo "integration evidence: $work"
|
||||||
|
exec > >(tee "$work/run.log") 2>&1
|
||||||
|
set -x
|
||||||
|
git rev-parse HEAD
|
||||||
|
git submodule status --recursive
|
||||||
|
uname -m
|
||||||
|
ldd --version
|
||||||
|
cargo --version
|
||||||
|
python3 --version
|
||||||
|
python3 -c 'import jsonschema'
|
||||||
|
|
||||||
|
unset MARQDO_STDLIB_DIR
|
||||||
|
export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
|
||||||
|
mkdir "$work/frozen"
|
||||||
|
frozen="$root/tools/view/scripts/frozen-beta.sh"
|
||||||
|
metadata="$("$frozen" metadata)"
|
||||||
|
artifact="$(sed -n 's/^artifact=//p' <<<"$metadata")"
|
||||||
|
if [[ -n "${MARQDO_INTEGRATION_ARCHIVE:-}" ]]; then
|
||||||
|
archive="$(realpath "$MARQDO_INTEGRATION_ARCHIVE")"
|
||||||
|
archive_sha="$(sed -n 's/^archive_sha=//p' <<<"$metadata")"
|
||||||
|
printf '%s %s\n' "$archive_sha" "$archive" | sha256sum -c -
|
||||||
|
tar -xzf "$archive" -C "$work/frozen"
|
||||||
|
MARQDO_BIN="$work/frozen/$artifact/marqdo"
|
||||||
|
"$frozen" verify "$MARQDO_BIN"
|
||||||
|
else
|
||||||
|
MARQDO_BIN="$("$frozen" fetch "$work/frozen")"
|
||||||
|
archive="$work/frozen/$artifact.tar.gz"
|
||||||
|
fi
|
||||||
|
export MARQDO_BIN
|
||||||
|
source_sha="$(git -C cli rev-parse HEAD)"
|
||||||
|
test "$(cat "$(dirname "$MARQDO_BIN")/SOURCE_SHA")" = "$source_sha"
|
||||||
|
sha256sum "$archive" "$MARQDO_BIN" "$(dirname "$MARQDO_BIN")/marqdo-provider-worker"
|
||||||
|
|
||||||
|
python3 cli/tools/release/smoke.py --archive "$archive"
|
||||||
|
python3 cli/tools/ci/verify_extension_contracts.py \
|
||||||
|
--source-repo cli --tested-sha "$source_sha" --cli "$MARQDO_BIN" \
|
||||||
|
--release-info "$(dirname "$MARQDO_BIN")/RELEASE_INFO.json" \
|
||||||
|
--fixtures tests/conformance --out "$work/conformance.json"
|
||||||
|
|
||||||
|
(
|
||||||
|
cd tools/view
|
||||||
|
export MARQDO_TOOL_HOME="$work/view-registry"
|
||||||
|
scripts/package.sh
|
||||||
|
"$MARQDO_BIN" tool install dist/marqdo-view/tool.json
|
||||||
|
"$MARQDO_BIN" view verify examples/mixed-modes/index.mq.md
|
||||||
|
"$MARQDO_BIN" view export examples/tables-math --out "$work/view-export"
|
||||||
|
setsid "$MARQDO_BIN" view examples/control-flow --port 0 --no-open >"$work/view-server.log" 2>&1 &
|
||||||
|
view_pid=$!
|
||||||
|
stop_view() {
|
||||||
|
kill -- "-$view_pid" 2>/dev/null || true
|
||||||
|
wait "$view_pid" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
trap stop_view EXIT
|
||||||
|
view_url=""
|
||||||
|
for attempt in {1..100}; do
|
||||||
|
view_url="$(grep -m1 -o 'http://127\.0\.0\.1:[0-9]\+/' "$work/view-server.log" || true)"
|
||||||
|
if [[ -n "$view_url" ]] || ! kill -0 "$view_pid" 2>/dev/null; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
if [[ -z "$view_url" ]]; then
|
||||||
|
cat "$work/view-server.log" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
python3 scripts/acceptance-run.py "$view_url"
|
||||||
|
stop_view
|
||||||
|
trap - EXIT
|
||||||
|
python3 scripts/check-observation.py stream-snapshot
|
||||||
|
"$MARQDO_BIN" tool remove view
|
||||||
|
if "$MARQDO_BIN" view --version; then
|
||||||
|
echo "view still dispatches after removal" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
|
(
|
||||||
|
cd tools/knowledge
|
||||||
|
MARQDO_TEST_BIN="$MARQDO_BIN" cargo test --locked --test core_cli --test compile
|
||||||
|
)
|
||||||
|
(
|
||||||
|
cd tools/prove
|
||||||
|
cargo test --locked --test analysis_document --test document_contract
|
||||||
|
)
|
||||||
|
(
|
||||||
|
cd tools/lint
|
||||||
|
export MARQDO_TOOL_HOME="$work/lint-registry"
|
||||||
|
scripts/package-tool.sh "$work/lint"
|
||||||
|
"$MARQDO_BIN" tool install "$work/lint/tool.json"
|
||||||
|
"$MARQDO_BIN" lint examples/nested/inventory.mq.md --format json
|
||||||
|
"$MARQDO_BIN" tool remove lint
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "PASS: ecosystem RC.4 candidate checks"
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "marqdo-stdlib",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"public_aliases": [
|
||||||
|
{
|
||||||
|
"public_names": ["print", "打印"],
|
||||||
|
"target_module": "io.mq.md",
|
||||||
|
"target_function": "写值",
|
||||||
|
"expected_signature": "params(值)",
|
||||||
|
"effects": ["host"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
title: 解释器源码的放置位置
|
|
||||||
date: 2026-08-11
|
|
||||||
---
|
|
||||||
|
|
||||||
## 这里放置解释器源码
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
//解释器检测到错误的处理模块
|
|
||||||
|
|
||||||
//! 错误报告模块,集中管理解释器所有语法错误输出
|
|
||||||
// use std::io;
|
|
||||||
// use std::io::Write;
|
|
||||||
|
|
||||||
//建立独立抽象ErrorReport结构体
|
|
||||||
//错误报告器,保存错误状态并提供错误报告接口
|
|
||||||
#[derive(Debug, Default)]
|
|
||||||
pub struct ErrorReport {
|
|
||||||
had_error: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ErrorReport {
|
|
||||||
//创建新的错误报告器
|
|
||||||
pub fn new() -> Self {
|
|
||||||
Self { had_error: false }
|
|
||||||
}
|
|
||||||
|
|
||||||
//对外公开的错误接口,指定行号和错误信息
|
|
||||||
pub fn error(&mut self, line: usize, message: &str) {
|
|
||||||
self.report(line, "", message);
|
|
||||||
}
|
|
||||||
|
|
||||||
//内部私有函数,输出错误信息,标记错误状态为true
|
|
||||||
fn report(&mut self, line: usize, location: &str, message: &str) {
|
|
||||||
eprintln!("[line {}] Error{}: {}", line, location, message);
|
|
||||||
self.had_error = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取错误状态
|
|
||||||
pub fn has_error(&self) -> bool {
|
|
||||||
self.had_error
|
|
||||||
}
|
|
||||||
|
|
||||||
//重置错误状态
|
|
||||||
pub fn clear(&mut self) {
|
|
||||||
self.had_error = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
//使用rust开发marqdo语言的解释器
|
|
||||||
|
|
||||||
//导入库
|
|
||||||
use std::env; //用于获取命令行参数
|
|
||||||
use std::fs; //用于读取文件
|
|
||||||
// use std::io; //用于读取标准输入和输出
|
|
||||||
// use std::io::BufReader; //用于读取缓冲区
|
|
||||||
|
|
||||||
//导入错误报告模块
|
|
||||||
mod error;
|
|
||||||
use error::ErrorReport;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
//创建新的错误报告器
|
|
||||||
let mut error_report = ErrorReport::new();
|
|
||||||
//获取命令行参数
|
|
||||||
let args: Vec<String> = env::args().collect();
|
|
||||||
|
|
||||||
//解析命令行参数
|
|
||||||
if args.len() > 3 {
|
|
||||||
eprintln!("Usage: marqdo <use_mode> <file>");
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
|
||||||
else if args.len() == 3 {
|
|
||||||
let use_mode = &args[1];
|
|
||||||
let file_path = &args[2];
|
|
||||||
//传入模式选择函数,根据不同的模式选择不同的函数执行
|
|
||||||
mode_selector(use_mode, file_path, &mut error_report);
|
|
||||||
}
|
|
||||||
else if args.len() == 2 {
|
|
||||||
let file_path = &args[1];
|
|
||||||
//默认为run模式,自动进行文件执行
|
|
||||||
run_file(file_path, &mut error_report);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//无参数输入,默认进入交互模式
|
|
||||||
run_prompt(&mut error_report);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//模式选择函数
|
|
||||||
fn mode_selector(use_mode: &str, file_path: &str, error_report: &mut ErrorReport) {
|
|
||||||
//根据不同的模式选择不同的函数执行
|
|
||||||
match use_mode {
|
|
||||||
"run" => run_file(file_path, error_report),
|
|
||||||
_ => {eprintln!("Invalid use mode: {}", use_mode);
|
|
||||||
std::process::exit(2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//读取marqdo文件并运行marqdo脚本文件
|
|
||||||
fn run_file(file_path: &str, error_report: &mut ErrorReport) {
|
|
||||||
match fs::read_to_string(file_path) {
|
|
||||||
Ok(source) => {
|
|
||||||
run(&source, error_report);
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
eprintln!("Error reading file: {}", e);
|
|
||||||
std::process::exit(3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//交互式模式
|
|
||||||
fn run_prompt(error_report: &mut ErrorReport) {
|
|
||||||
//提示交互式模式正在开发中
|
|
||||||
println!("Interactive mode is not available yet.");
|
|
||||||
error_report.error(0, "Interactive mode is not available yet.");
|
|
||||||
//清除错误报告
|
|
||||||
error_report.clear();
|
|
||||||
std::process::exit(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
//运行marqdo脚本
|
|
||||||
fn run(source: &str, error_report: &mut ErrorReport) {
|
|
||||||
//提示正在开发中
|
|
||||||
println!("Running script is not available yet.");
|
|
||||||
//输出source
|
|
||||||
println!("Source: {}", source);
|
|
||||||
//输出错误报告
|
|
||||||
println!("Error report: {}", error_report.has_error());
|
|
||||||
//退出程序
|
|
||||||
std::process::exit(5);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# 标准库
|
||||||
|
|
||||||
|
标准库组件负责低层通用能力,验收后共同组成基础发行的标准库 Bundle。各目录通过 Git 子模块固定独立标准库仓库的开发提交。
|
||||||
|
|
||||||
|
- [marqdo-std-core](https://git.cflmy.cn/cflmy/marqdo-std-core) · Result 与基础数值
|
||||||
|
- [marqdo-std-collections](https://git.cflmy.cn/cflmy/marqdo-std-collections) · List、Map 和 Table 值操作
|
||||||
|
- [marqdo-std-text](https://git.cflmy.cn/cflmy/marqdo-std-text) · Unicode 文本、字节值与 UTF-8
|
||||||
|
- [marqdo-std-encoding](https://git.cflmy.cn/cflmy/marqdo-std-encoding) · Base64、Base32 和 Hex
|
||||||
|
- [marqdo-std-data](https://git.cflmy.cn/cflmy/marqdo-std-data) · JSON、CSV、TOML 与 GFM 数据转换
|
||||||
|
- [marqdo-std-io](https://git.cflmy.cn/cflmy/marqdo-std-io) · Console、Stream、格式化和官方 print 别名
|
||||||
|
- [marqdo-std-fs](https://git.cflmy.cn/cflmy/marqdo-std-fs) · 文件、目录与路径
|
||||||
|
- [marqdo-std-system](https://git.cflmy.cn/cflmy/marqdo-std-system) · 时钟、UTC、环境、进程与随机
|
||||||
|
- [marqdo-std-net](https://git.cflmy.cn/cflmy/marqdo-std-net) · TCP、UDP、TLS 和网络字节流
|
||||||
|
|
||||||
|
[组件目录](../components.toml) · [各仓库任务](../docs/REPOSITORY-TASKS.md)
|
||||||
Submodule
+1
Submodule stdlib/collections added at 0851e1f8a0.
Submodule
+1
Submodule stdlib/core added at 997a970f9e.
Submodule
+1
Submodule stdlib/data added at e3c9488dca.
Submodule
+1
Submodule stdlib/encoding added at 1aab705e5b.
Submodule
+1
Submodule stdlib/fs added at 3ef21c7de0.
Submodule
+1
Submodule stdlib/io added at 945e76eed8.
Submodule
+1
Submodule stdlib/net added at 8aad76d87f.
Submodule
+1
Submodule stdlib/system added at e1c4da4cc5.
Submodule
+1
Submodule stdlib/text added at 9f1e862953.
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
title: marqdo语言测试用例的放置位置
|
|
||||||
date: 2026-08-11
|
|
||||||
---
|
|
||||||
|
|
||||||
## 这里用于放置marqdo语言的测试用例
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
title: hello marqdo!
|
|
||||||
---
|
|
||||||
|
|
||||||
> print "hello marqdo!"
|
|
||||||
Submodule
+1
Submodule tests/conformance added at 015ff8ac15.
@@ -0,0 +1,9 @@
|
|||||||
|
# @exec aliases
|
||||||
|
|
||||||
|
## main
|
||||||
|
|
||||||
|
> **打印("alias-打印")**
|
||||||
|
|
||||||
|
> **print("alias-print")**
|
||||||
|
|
||||||
|
`return None`
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"schema": "marqdo.stdlib-test-case",
|
||||||
|
"schema_version": 1,
|
||||||
|
"name": "aliases",
|
||||||
|
"file": "aliases.mq.md",
|
||||||
|
"args": [],
|
||||||
|
"stdin": "",
|
||||||
|
"env": {},
|
||||||
|
"expected_stdout": "alias-打印\nalias-print\n",
|
||||||
|
"expected_terminal": {
|
||||||
|
"type": "none"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"schema": "marqdo.stdlib-test-case",
|
||||||
|
"schema_version": 1,
|
||||||
|
"name": "default-bundle",
|
||||||
|
"file": "default-bundle.mq.md",
|
||||||
|
"args": [],
|
||||||
|
"stdin": "",
|
||||||
|
"env": {},
|
||||||
|
"expected_stdout": "default-bundle\n",
|
||||||
|
"expected_terminal": {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"decimal": "2",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "195",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "169",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "é"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "[\"ok\", 3]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "[1, 2]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "a/b/c"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "2026-11-21T08:00:00.123Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "2",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "list"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,314 @@
|
|||||||
|
{
|
||||||
|
"schema": "marqdo.stdlib-test-case",
|
||||||
|
"schema_version": 1,
|
||||||
|
"name": "table",
|
||||||
|
"file": "table.mq.md",
|
||||||
|
"args": [],
|
||||||
|
"stdin": "",
|
||||||
|
"env": {},
|
||||||
|
"expected_stdout": "",
|
||||||
|
"expected_terminal": {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"header": [
|
||||||
|
"分数"
|
||||||
|
],
|
||||||
|
"rows": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"decimal": "87",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"decimal": "92",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"decimal": "71",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"type": "table"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"header": [
|
||||||
|
"名称",
|
||||||
|
"分数"
|
||||||
|
],
|
||||||
|
"rows": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "甲"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "87",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "乙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "92",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"type": "table"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"header": [
|
||||||
|
"名称",
|
||||||
|
"分数"
|
||||||
|
],
|
||||||
|
"rows": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "丙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "71",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "甲"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "87",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "乙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "92",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"type": "table"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"header": [
|
||||||
|
"名称",
|
||||||
|
"分数"
|
||||||
|
],
|
||||||
|
"rows": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "甲"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "87",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "乙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "92",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "丙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "71",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "丁"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "65",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"type": "table"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"header": [
|
||||||
|
"名称",
|
||||||
|
"分数"
|
||||||
|
],
|
||||||
|
"rows": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "甲"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "99",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "乙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "92",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "丙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "71",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"type": "table"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"header": [
|
||||||
|
"名称",
|
||||||
|
"分数",
|
||||||
|
"名称",
|
||||||
|
"等级"
|
||||||
|
],
|
||||||
|
"rows": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "甲"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "87",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "甲"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "乙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "92",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "乙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "A"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"type": "table"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"entries": {
|
||||||
|
"a": {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"decimal": "1",
|
||||||
|
"type": "int"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "3",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "list"
|
||||||
|
},
|
||||||
|
"b": {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"decimal": "2",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "list"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "map"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"header": [
|
||||||
|
"名称",
|
||||||
|
"分数"
|
||||||
|
],
|
||||||
|
"rows": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "甲"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "87",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "乙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "92",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "丙"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimal": "71",
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"type": "table"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"value": "| 名称 | 分数 |\n| --- | --- |\n| 甲 | 87 |\n| 乙 | 92 |\n| 丙 | 71 |"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "list"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
import:
|
||||||
|
io: "std:io"
|
||||||
|
format: "std:format"
|
||||||
|
json: "std:data/json"
|
||||||
|
text_lib: "std:text"
|
||||||
|
utf8: "std:text/utf8"
|
||||||
|
path: "std:path"
|
||||||
|
datetime: "std:datetime"
|
||||||
|
---
|
||||||
|
|
||||||
|
# @exec bundle
|
||||||
|
|
||||||
|
## main
|
||||||
|
|
||||||
|
**内存 = memory.new(1, 4)**
|
||||||
|
|
||||||
|
**长度 = text_lib.utf8编码("é", 内存, 0)**
|
||||||
|
|
||||||
|
**解码 = utf8.解码(内存, 0, 长度)**
|
||||||
|
|
||||||
|
**对象 = json.解析("[1, 2]")**
|
||||||
|
|
||||||
|
**时间 = datetime.格式化(1795248000123)**
|
||||||
|
|
||||||
|
> **io.写值("default-bundle")**
|
||||||
|
|
||||||
|
`return [长度, 内存[0], 内存[1], 解码.value, format.显示(["ok", 3]), json.格式化(对象.value), path.连接(["a", "b", "c"]), 时间, format.字节长度("é")]`
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
import:
|
||||||
|
table_lib: "std:collections/table"
|
||||||
|
gfm_lib: "std:data/table"
|
||||||
|
---
|
||||||
|
|
||||||
|
# @exec table
|
||||||
|
|
||||||
|
## main
|
||||||
|
|
||||||
|
**数据 = 表(["名称", "分数"], [["甲", 87], ["乙", 92], ["丙", 71]])**
|
||||||
|
|
||||||
|
**选择 = table_lib.选择列(数据, 1)**
|
||||||
|
|
||||||
|
**过滤 = table_lib.过滤数值大于(数据, 1, 80)**
|
||||||
|
|
||||||
|
**排序 = table_lib.排序(数据, 1)**
|
||||||
|
|
||||||
|
**追加 = table_lib.追加行(数据, ["丁", 65])**
|
||||||
|
|
||||||
|
**设置 = table_lib.设置单元格(数据, 0, 1, 99)**
|
||||||
|
|
||||||
|
**左 = 表(["名称", "分数"], [["甲", 87], ["乙", 92]])**
|
||||||
|
|
||||||
|
**右 = 表(["名称", "等级"], [["乙", "A"], ["甲", "B"]])**
|
||||||
|
|
||||||
|
**连接 = table_lib.连接(左, 右, 0, 0)**
|
||||||
|
|
||||||
|
**分组 = table_lib.分组(表(["类别", "值"], [["a", 1], ["b", 2], ["a", 3]]), 0, 1)**
|
||||||
|
|
||||||
|
`return [选择, 过滤, 排序, 追加, 设置, 连接, 分组, 数据, gfm_lib.转GFM(数据)]`
|
||||||
@@ -0,0 +1,368 @@
|
|||||||
|
"""Contract tests for the root-owned, unique stdlib Bundle producer.
|
||||||
|
|
||||||
|
These tests build real temporary Git repositories so the producer is exercised
|
||||||
|
through its real identity path: root catalog + exact gitlinks + component module
|
||||||
|
trees. They never call a network remote and never use the repository's own
|
||||||
|
Bundles.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import importlib.util
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
SCRIPT = Path(__file__).resolve().parents[2] / "scripts" / "build-stdlib.py"
|
||||||
|
SPEC = importlib.util.spec_from_file_location("build_stdlib", SCRIPT)
|
||||||
|
producer = importlib.util.module_from_spec(SPEC)
|
||||||
|
SPEC.loader.exec_module(producer)
|
||||||
|
|
||||||
|
GIT_ENV = {
|
||||||
|
"GIT_AUTHOR_NAME": "test",
|
||||||
|
"GIT_AUTHOR_EMAIL": "test@example.invalid",
|
||||||
|
"GIT_COMMITTER_NAME": "test",
|
||||||
|
"GIT_COMMITTER_EMAIL": "test@example.invalid",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def git(cwd, *args, check=True):
|
||||||
|
env = os.environ.copy()
|
||||||
|
env.update(GIT_ENV)
|
||||||
|
result = subprocess.run(
|
||||||
|
["git", "-C", str(cwd), *args], capture_output=True, env=env
|
||||||
|
)
|
||||||
|
if check and result.returncode != 0:
|
||||||
|
raise AssertionError(
|
||||||
|
f"git {' '.join(args)} failed: {result.stderr.decode(errors='replace')}"
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def init_repo(path: Path) -> Path:
|
||||||
|
path.mkdir(parents=True, exist_ok=True)
|
||||||
|
git(path, "init", "-q")
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def commit_all(repo: Path, message: str = "fixture") -> str:
|
||||||
|
git(repo, "add", "-A")
|
||||||
|
git(repo, "commit", "-q", "-m", message)
|
||||||
|
return git(repo, "rev-parse", "HEAD").stdout.decode().strip()
|
||||||
|
|
||||||
|
|
||||||
|
def write(path: Path, data) -> None:
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
path.write_bytes(data if isinstance(data, bytes) else data.encode())
|
||||||
|
|
||||||
|
|
||||||
|
def component(repo: Path, files: dict) -> str:
|
||||||
|
init_repo(repo)
|
||||||
|
for relative, data in files.items():
|
||||||
|
write(repo / relative, data)
|
||||||
|
return commit_all(repo)
|
||||||
|
|
||||||
|
|
||||||
|
def catalog(*components: dict) -> str:
|
||||||
|
blocks = []
|
||||||
|
for component_spec in components:
|
||||||
|
lines = ["[[component]]"]
|
||||||
|
for key, value in component_spec.items():
|
||||||
|
if isinstance(value, list):
|
||||||
|
rendered = "[" + ", ".join(json.dumps(item) for item in value) + "]"
|
||||||
|
else:
|
||||||
|
rendered = json.dumps(value)
|
||||||
|
lines.append(f"{key} = {rendered}")
|
||||||
|
blocks.append("\n".join(lines))
|
||||||
|
return "\n\n".join(blocks) + "\n"
|
||||||
|
|
||||||
|
|
||||||
|
def root_repo(path: Path, catalog_text: str, links: dict, config: dict) -> str:
|
||||||
|
init_repo(path)
|
||||||
|
write(path / "components.toml", catalog_text)
|
||||||
|
write(path / "scripts/stdlib-bundle.json", json.dumps(config, indent=2))
|
||||||
|
for relative, sha in links.items():
|
||||||
|
git(path, "update-index", "--add", "--cacheinfo", f"160000,{sha},{relative}")
|
||||||
|
git(path, "add", "components.toml", "scripts/stdlib-bundle.json")
|
||||||
|
git(path, "commit", "-q", "-m", "root fixture")
|
||||||
|
return git(path, "rev-parse", "HEAD").stdout.decode().strip()
|
||||||
|
|
||||||
|
|
||||||
|
def base_config(version="0.1.0", aliases=None) -> dict:
|
||||||
|
return {
|
||||||
|
"name": "marqdo-stdlib",
|
||||||
|
"version": version,
|
||||||
|
"public_aliases": aliases or [],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def std_component(component_id: str, path: str, state="active") -> dict:
|
||||||
|
return {
|
||||||
|
"id": component_id,
|
||||||
|
"path": path,
|
||||||
|
"kind": "stdlib",
|
||||||
|
"state": state,
|
||||||
|
"owner": "test",
|
||||||
|
"scope": "fixture",
|
||||||
|
"requires": ["cli"],
|
||||||
|
"checks_with": [],
|
||||||
|
"release": "base",
|
||||||
|
} | ({"entry": "scripts/test.sh"} if state == "active" else {})
|
||||||
|
|
||||||
|
|
||||||
|
class ProducerTest(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.tmp = tempfile.TemporaryDirectory()
|
||||||
|
self.root = Path(self.tmp.name) / "root"
|
||||||
|
self.root.mkdir()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.tmp.cleanup()
|
||||||
|
|
||||||
|
def build(self, *extra):
|
||||||
|
import contextlib
|
||||||
|
import io
|
||||||
|
|
||||||
|
out = Path(self.tmp.name) / (
|
||||||
|
"out-" + str(len(list(Path(self.tmp.name).glob("out-*"))))
|
||||||
|
)
|
||||||
|
buffer = io.StringIO()
|
||||||
|
with contextlib.redirect_stdout(buffer):
|
||||||
|
status = producer.main(
|
||||||
|
["--out", str(out), "--root", str(self.root), *extra]
|
||||||
|
)
|
||||||
|
self.assertEqual(status, 0)
|
||||||
|
return buffer.getvalue(), out
|
||||||
|
|
||||||
|
def make_two_components(self):
|
||||||
|
text = component(
|
||||||
|
self.root / "stdlib/text",
|
||||||
|
{
|
||||||
|
"modules/text.mq.md": "# @exec text\n",
|
||||||
|
"modules/text/utf8.mq.md": "# @exec utf8\n",
|
||||||
|
"modules/README.md": "not published\n",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
io = component(
|
||||||
|
self.root / "stdlib/io",
|
||||||
|
{
|
||||||
|
"modules/io.mq.md": "# @exec io\n",
|
||||||
|
"modules/io/console.mq.md": "# @exec console\n",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return text, io
|
||||||
|
|
||||||
|
def two_component_root(self, text_sha, io_sha, version="0.1.0", aliases=None):
|
||||||
|
cat = catalog(
|
||||||
|
std_component("std-text", "stdlib/text"),
|
||||||
|
std_component("std-io", "stdlib/io"),
|
||||||
|
)
|
||||||
|
return root_repo(
|
||||||
|
self.root,
|
||||||
|
cat,
|
||||||
|
{"stdlib/text": text_sha, "stdlib/io": io_sha},
|
||||||
|
base_config(version, aliases),
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_builds_deterministic_bundle_and_excludes_non_modules(self):
|
||||||
|
text_sha, io_sha = self.make_two_components()
|
||||||
|
self.two_component_root(text_sha, io_sha)
|
||||||
|
summary_one, out_one = self.build()
|
||||||
|
payload = json.loads(summary_one)
|
||||||
|
self.assertEqual(payload["files"], [
|
||||||
|
"io.mq.md",
|
||||||
|
"io/console.mq.md",
|
||||||
|
"text.mq.md",
|
||||||
|
"text/utf8.mq.md",
|
||||||
|
])
|
||||||
|
self.assertNotIn("README.md", payload["files"])
|
||||||
|
manifest = json.loads((out_one / "stdlib.json").read_text())
|
||||||
|
self.assertEqual(manifest["name"], "marqdo-stdlib")
|
||||||
|
self.assertEqual(manifest["version"], "0.1.0")
|
||||||
|
self.assertEqual(manifest["digest"], payload["tree_digest"])
|
||||||
|
self.assertEqual(
|
||||||
|
manifest["aliases_digest"], producer.aliases_digest([])
|
||||||
|
)
|
||||||
|
summary_two, out_two = self.build()
|
||||||
|
self.assertEqual(
|
||||||
|
json.loads(summary_two)["tree_digest"], payload["tree_digest"]
|
||||||
|
)
|
||||||
|
for relative in payload["files"]:
|
||||||
|
self.assertEqual(
|
||||||
|
(out_one / relative).read_bytes(), (out_two / relative).read_bytes()
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
(out_one / "stdlib.json").read_bytes(),
|
||||||
|
(out_two / "stdlib.json").read_bytes(),
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_worktree_mode_requires_clean_components(self):
|
||||||
|
self.make_two_components()
|
||||||
|
write(
|
||||||
|
self.root / "components.toml",
|
||||||
|
catalog(
|
||||||
|
std_component("std-text", "stdlib/text"),
|
||||||
|
std_component("std-io", "stdlib/io"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
write(
|
||||||
|
self.root / "scripts/stdlib-bundle.json",
|
||||||
|
json.dumps(base_config(), indent=2),
|
||||||
|
)
|
||||||
|
out = Path(self.tmp.name) / "w"
|
||||||
|
producer.main(["--out", str(out), "--root", str(self.root), "--worktree"])
|
||||||
|
self.assertTrue((out / "text.mq.md").is_file())
|
||||||
|
write(self.root / "stdlib/text/modules/dirty.mq.md", "# @exec dirty\n")
|
||||||
|
with self.assertRaises(SystemExit):
|
||||||
|
producer.main([
|
||||||
|
"--out", str(Path(self.tmp.name) / "w2"),
|
||||||
|
"--root", str(self.root),
|
||||||
|
"--worktree",
|
||||||
|
])
|
||||||
|
|
||||||
|
def test_planned_component_is_not_published(self):
|
||||||
|
text_sha, _ = self.make_two_components()
|
||||||
|
planned_sha = component(
|
||||||
|
self.root / "stdlib/net", {"modules/net/tcp.mq.md": "# @exec tcp\n"}
|
||||||
|
)
|
||||||
|
cat = catalog(
|
||||||
|
std_component("std-text", "stdlib/text"),
|
||||||
|
std_component("std-net", "stdlib/net", state="planned"),
|
||||||
|
)
|
||||||
|
root_repo(
|
||||||
|
self.root,
|
||||||
|
cat,
|
||||||
|
{"stdlib/text": text_sha, "stdlib/net": planned_sha},
|
||||||
|
base_config(),
|
||||||
|
)
|
||||||
|
summary, out = self.build()
|
||||||
|
self.assertEqual(json.loads(summary)["files"], ["text.mq.md", "text/utf8.mq.md"])
|
||||||
|
self.assertFalse((out / "net/tcp.mq.md").exists())
|
||||||
|
|
||||||
|
def test_duplicate_and_case_colliding_paths_are_rejected(self):
|
||||||
|
text_sha, _ = self.make_two_components()
|
||||||
|
clash_sha = component(
|
||||||
|
self.root / "stdlib/other", {"modules/Text.mq.md": "# @exec clash\n"}
|
||||||
|
)
|
||||||
|
cat = catalog(
|
||||||
|
std_component("std-text", "stdlib/text"),
|
||||||
|
std_component("std-other", "stdlib/other"),
|
||||||
|
)
|
||||||
|
root_repo(
|
||||||
|
self.root,
|
||||||
|
cat,
|
||||||
|
{"stdlib/text": text_sha, "stdlib/other": clash_sha},
|
||||||
|
base_config(),
|
||||||
|
)
|
||||||
|
with self.assertRaises(SystemExit):
|
||||||
|
self.build()
|
||||||
|
|
||||||
|
def test_non_nfc_and_symlink_entries_are_rejected(self):
|
||||||
|
import unicodedata
|
||||||
|
|
||||||
|
decomposed = unicodedata.normalize("NFD", "text/café.mq.md")
|
||||||
|
text_sha = component(
|
||||||
|
self.root / "stdlib/text",
|
||||||
|
{"modules/text.mq.md": "# @exec text\n", f"modules/{decomposed}": "# x\n"},
|
||||||
|
)
|
||||||
|
io_sha = component(
|
||||||
|
self.root / "stdlib/io", {"modules/io.mq.md": "# @exec io\n"}
|
||||||
|
)
|
||||||
|
self.two_component_root(text_sha, io_sha)
|
||||||
|
with self.assertRaises(SystemExit):
|
||||||
|
self.build()
|
||||||
|
|
||||||
|
tmp = tempfile.TemporaryDirectory()
|
||||||
|
try:
|
||||||
|
root = Path(tmp.name) / "sr"
|
||||||
|
root.mkdir()
|
||||||
|
text = root / "stdlib/text"
|
||||||
|
init_repo(text)
|
||||||
|
write(text / "modules/text.mq.md", "# @exec text\n")
|
||||||
|
(text / "modules/link.mq.md").symlink_to("text.mq.md")
|
||||||
|
sha = commit_all(text)
|
||||||
|
io = component(root / "stdlib/io", {"modules/io.mq.md": "# @exec io\n"})
|
||||||
|
cat = catalog(
|
||||||
|
std_component("std-text", "stdlib/text"),
|
||||||
|
std_component("std-io", "stdlib/io"),
|
||||||
|
)
|
||||||
|
root_repo(root, cat, {"stdlib/text": sha, "stdlib/io": io}, base_config())
|
||||||
|
with self.assertRaises(SystemExit):
|
||||||
|
producer.main(["--out", str(root / "bundle"), "--root", str(root)])
|
||||||
|
finally:
|
||||||
|
tmp.cleanup()
|
||||||
|
|
||||||
|
def test_active_component_without_modules_is_rejected(self):
|
||||||
|
text_sha, io_sha = self.make_two_components()
|
||||||
|
empty_sha = component(self.root / "stdlib/empty", {"README.md": "x\n"})
|
||||||
|
cat = catalog(
|
||||||
|
std_component("std-text", "stdlib/text"),
|
||||||
|
std_component("std-io", "stdlib/io"),
|
||||||
|
std_component("std-empty", "stdlib/empty"),
|
||||||
|
)
|
||||||
|
root_repo(
|
||||||
|
self.root,
|
||||||
|
cat,
|
||||||
|
{
|
||||||
|
"stdlib/text": text_sha,
|
||||||
|
"stdlib/io": io_sha,
|
||||||
|
"stdlib/empty": empty_sha,
|
||||||
|
},
|
||||||
|
base_config(),
|
||||||
|
)
|
||||||
|
with self.assertRaises(SystemExit):
|
||||||
|
self.build()
|
||||||
|
|
||||||
|
def test_content_change_requires_explicit_version_bump(self):
|
||||||
|
text_sha, io_sha = self.make_two_components()
|
||||||
|
self.two_component_root(text_sha, io_sha)
|
||||||
|
_, out = self.build()
|
||||||
|
baseline = out / "stdlib.json"
|
||||||
|
changed = component(
|
||||||
|
self.root / "stdlib/io",
|
||||||
|
{
|
||||||
|
"modules/io.mq.md": "# @exec io\n# changed\n",
|
||||||
|
"modules/io/console.mq.md": "# @exec console\n",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
git(self.root, "reset", "-q", "--hard", "HEAD")
|
||||||
|
self.two_component_root(text_sha, changed)
|
||||||
|
with self.assertRaises(SystemExit):
|
||||||
|
self.build("--baseline-manifest", str(baseline))
|
||||||
|
new_root = self.two_component_root(text_sha, changed, version="0.2.0")
|
||||||
|
self.assertIsNotNone(new_root)
|
||||||
|
summary, out_two = self.build("--baseline-manifest", str(baseline))
|
||||||
|
self.assertEqual(json.loads(summary)["version"], "0.2.0")
|
||||||
|
|
||||||
|
def test_public_alias_must_target_a_published_module(self):
|
||||||
|
text_sha, io_sha = self.make_two_components()
|
||||||
|
alias = {
|
||||||
|
"public_names": ["print", "打印"],
|
||||||
|
"target_module": "io.mq.md",
|
||||||
|
"target_function": "写值",
|
||||||
|
"expected_signature": "params(值)",
|
||||||
|
"effects": ["host"],
|
||||||
|
}
|
||||||
|
self.two_component_root(text_sha, io_sha, aliases=[alias])
|
||||||
|
summary, out = self.build()
|
||||||
|
manifest = json.loads((out / "stdlib.json").read_text())
|
||||||
|
self.assertEqual(
|
||||||
|
manifest["aliases_digest"], json.loads(summary)["aliases_digest"]
|
||||||
|
)
|
||||||
|
bad = dict(alias, target_module="missing.mq.md")
|
||||||
|
git(self.root, "reset", "-q", "--hard", "HEAD")
|
||||||
|
self.two_component_root(text_sha, io_sha, aliases=[bad])
|
||||||
|
with self.assertRaises(SystemExit):
|
||||||
|
self.build()
|
||||||
|
|
||||||
|
def test_digest_algorithm_vector(self):
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
files = {"a.mq.md": b"content"}
|
||||||
|
expected = "sha256:" + hashlib.sha256(b"a.mq.md\0content\0").hexdigest()
|
||||||
|
self.assertEqual(producer.tree_digest(files), expected)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,721 @@
|
|||||||
|
import importlib.util
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
from pathlib import Path
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
SCRIPT = Path(__file__).resolve().parents[2] / "scripts/check-layout.py"
|
||||||
|
SPEC = importlib.util.spec_from_file_location("check_layout", SCRIPT)
|
||||||
|
layout = importlib.util.module_from_spec(SPEC)
|
||||||
|
SPEC.loader.exec_module(layout)
|
||||||
|
|
||||||
|
CLI = '''
|
||||||
|
[[component]]
|
||||||
|
id = "cli"
|
||||||
|
path = "cli"
|
||||||
|
kind = "core"
|
||||||
|
state = "active"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "core implementation"
|
||||||
|
requires = []
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
entry = "scripts/test.sh"
|
||||||
|
'''
|
||||||
|
|
||||||
|
PLANNED = '''
|
||||||
|
[[component]]
|
||||||
|
id = "std-core"
|
||||||
|
path = "stdlib/core"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "primitive utilities"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
'''
|
||||||
|
|
||||||
|
CORE_URL = "https://git.cflmy.cn/cflmy/marqdo-cli.git"
|
||||||
|
|
||||||
|
WEB_DOMAIN = '''
|
||||||
|
[[component]]
|
||||||
|
id = "web"
|
||||||
|
path = "extensions/web"
|
||||||
|
kind = "domain"
|
||||||
|
state = "active"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "web prototype domain governance"
|
||||||
|
requires = []
|
||||||
|
checks_with = []
|
||||||
|
release = "none"
|
||||||
|
entry = "scripts/integration.sh"
|
||||||
|
'''
|
||||||
|
|
||||||
|
STDLIB_DOMAIN = '''
|
||||||
|
[[component]]
|
||||||
|
id = "stdlib"
|
||||||
|
path = "stdlib"
|
||||||
|
kind = "domain"
|
||||||
|
state = "active"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "standard library bundle assembly"
|
||||||
|
requires = []
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
entry = "scripts/integration.sh"
|
||||||
|
'''
|
||||||
|
|
||||||
|
DOMAIN = '''
|
||||||
|
[[component]]
|
||||||
|
id = "web-design"
|
||||||
|
path = "design"
|
||||||
|
kind = "extension"
|
||||||
|
state = "active"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "design document interpretation"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
entry = "scripts/ci.sh"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "web-preview"
|
||||||
|
path = "preview"
|
||||||
|
kind = "tool"
|
||||||
|
state = "active"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "prototype rendering"
|
||||||
|
requires = ["cli", "web-design"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
entry = "scripts/ci.sh"
|
||||||
|
|
||||||
|
[[component]]
|
||||||
|
id = "web-components"
|
||||||
|
path = "components"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "design templates"
|
||||||
|
requires = ["web-design"]
|
||||||
|
checks_with = ["web-preview"]
|
||||||
|
release = "optional"
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
def catalog(*blocks):
|
||||||
|
return "".join(blocks)
|
||||||
|
|
||||||
|
|
||||||
|
class LayoutTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
temporary = tempfile.TemporaryDirectory()
|
||||||
|
self.addCleanup(temporary.cleanup)
|
||||||
|
self.root = Path(temporary.name)
|
||||||
|
self.enterContext(patch.object(layout, "ROOT", self.root))
|
||||||
|
self.enterContext(patch.object(layout, "git", side_effect=self.git))
|
||||||
|
self.git("init", "-q")
|
||||||
|
self.git("-c", "user.name=Test", "-c", "user.email=test@example.invalid", "commit", "--allow-empty", "-qm", "fixture")
|
||||||
|
self.sha = self.git("rev-parse", "HEAD").strip()
|
||||||
|
|
||||||
|
def git(self, *args, cwd=None):
|
||||||
|
return subprocess.check_output(["git", "-C", cwd or self.root, *args]).decode()
|
||||||
|
|
||||||
|
def candidate(self, metadata=CLI, url=CORE_URL, extra=None, file=None, extra_url=None):
|
||||||
|
(self.root / "components.toml").write_text(metadata)
|
||||||
|
modules = f'[submodule "cli"]\npath = cli\nurl = {url}\n'
|
||||||
|
if extra_url:
|
||||||
|
modules += f'[submodule "{extra}"]\npath = {extra}\nurl = {extra_url}\n'
|
||||||
|
(self.root / ".gitmodules").write_text(modules)
|
||||||
|
self.git("add", ".gitmodules", "components.toml")
|
||||||
|
self.git("update-index", "--add", "--cacheinfo", f"160000,{self.sha},cli")
|
||||||
|
if extra:
|
||||||
|
self.git("update-index", "--add", "--cacheinfo", f"160000,{self.sha},{extra}")
|
||||||
|
if file:
|
||||||
|
path = self.root / file
|
||||||
|
path.parent.mkdir(parents=True)
|
||||||
|
path.write_text("Fixture")
|
||||||
|
self.git("add", file)
|
||||||
|
self.git("-c", "user.name=Test", "-c", "user.email=test@example.invalid", "commit", "-qm", "candidate")
|
||||||
|
|
||||||
|
def test_accepts_active_gitlink_and_planned_component(self):
|
||||||
|
self.candidate(CLI + PLANNED)
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_accepts_a_planned_component_directory_readme(self):
|
||||||
|
self.candidate(CLI + PLANNED, file="stdlib/core/README.md")
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_source_under_a_planned_component(self):
|
||||||
|
self.candidate(CLI + PLANNED, file="stdlib/core/result.mq.md")
|
||||||
|
with self.assertRaisesRegex(ValueError, "unexpected tracked path or mode"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_an_unregistered_component_directory(self):
|
||||||
|
self.candidate(CLI + PLANNED, file="stdlib/missing/README.md")
|
||||||
|
with self.assertRaisesRegex(ValueError, "unexpected tracked path or mode"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_a_planned_gitlink_without_a_registered_remote(self):
|
||||||
|
self.candidate(CLI + PLANNED, extra="stdlib/core")
|
||||||
|
with self.assertRaisesRegex(ValueError, "missing or invalid submodule path: stdlib/core"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_accepts_a_planned_gitlink_with_its_remote(self):
|
||||||
|
self.candidate(CLI + PLANNED, extra="stdlib/core",
|
||||||
|
extra_url="https://git.cflmy.cn/cflmy/marqdo-std-core.git")
|
||||||
|
root = layout.validate("HEAD", False)[0]
|
||||||
|
self.assertEqual(root.linked["stdlib/core"]["state"], "planned")
|
||||||
|
|
||||||
|
def test_rejects_active_dependency_on_planned(self):
|
||||||
|
self.candidate(CLI.replace("requires = []", 'requires = ["std-core"]') + PLANNED)
|
||||||
|
with self.assertRaisesRegex(ValueError, "active depends on planned"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_other_host(self):
|
||||||
|
self.candidate(url="https://example.invalid/cflmy/marqdo-cli.git")
|
||||||
|
with self.assertRaisesRegex(ValueError, "invalid submodule URL"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_wrong_repository_at_authority(self):
|
||||||
|
self.candidate(url="https://git.cflmy.cn/cflmy/marqdo-view.git")
|
||||||
|
with self.assertRaisesRegex(ValueError, "invalid submodule URL"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_unstaged_checkout(self):
|
||||||
|
self.candidate()
|
||||||
|
with self.assertRaisesRegex(ValueError, "missing submodule checkout"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
|
||||||
|
class HierarchicalLayoutTests(unittest.TestCase):
|
||||||
|
"""End-to-end fixtures with real local Git repositories.
|
||||||
|
|
||||||
|
The fixture builds root -> domain -> two leaves using only local clones:
|
||||||
|
no network remote is contacted, no ``git submodule update`` is executed.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
temporary = tempfile.TemporaryDirectory()
|
||||||
|
self.addCleanup(temporary.cleanup)
|
||||||
|
self.root = Path(temporary.name)
|
||||||
|
sources = tempfile.TemporaryDirectory()
|
||||||
|
self.addCleanup(sources.cleanup)
|
||||||
|
self.sources = Path(sources.name)
|
||||||
|
self.enterContext(patch.object(layout, "ROOT", self.root))
|
||||||
|
self.enterContext(patch.object(layout, "git", side_effect=self.git))
|
||||||
|
self.git("init", "-q", "-b", "main")
|
||||||
|
self.git("commit", "--allow-empty", "-qm", "fixture")
|
||||||
|
|
||||||
|
def git(self, *args, cwd=None):
|
||||||
|
return subprocess.check_output([
|
||||||
|
"git",
|
||||||
|
"-c", "user.name=Test",
|
||||||
|
"-c", "user.email=test@example.invalid",
|
||||||
|
"-C", str(cwd or self.root),
|
||||||
|
*args,
|
||||||
|
], stderr=subprocess.DEVNULL).decode()
|
||||||
|
|
||||||
|
# -- fixture primitives -------------------------------------------------
|
||||||
|
|
||||||
|
def repo(self, name):
|
||||||
|
path = self.sources / name
|
||||||
|
path.mkdir(parents=True)
|
||||||
|
self.git("init", "-q", "-b", "main", cwd=path)
|
||||||
|
return path
|
||||||
|
|
||||||
|
def write(self, repo, relative, content):
|
||||||
|
path = Path(repo) / relative
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
path.write_text(content)
|
||||||
|
|
||||||
|
def stage(self, repo):
|
||||||
|
self.git("add", "-A", cwd=repo)
|
||||||
|
|
||||||
|
def commit(self, repo, message):
|
||||||
|
self.git("commit", "-qm", message, cwd=repo)
|
||||||
|
return self.git("rev-parse", "HEAD", cwd=repo).strip()
|
||||||
|
|
||||||
|
def gitlink(self, repo, path, sha):
|
||||||
|
self.git("update-index", "--add", "--cacheinfo", f"160000,{sha},{path}", cwd=repo)
|
||||||
|
|
||||||
|
def modules(self, repo, entries):
|
||||||
|
self.write(repo, ".gitmodules", "".join(
|
||||||
|
f'[submodule "{path}"]\n\tpath = {path}\n\turl = {url}\n' for path, url in entries.items()))
|
||||||
|
|
||||||
|
def leaf(self, name, entry="scripts/ci.sh", symlink_entry=False):
|
||||||
|
repo = self.repo(name)
|
||||||
|
if symlink_entry:
|
||||||
|
self.write(repo, "scripts/real.sh", "#!/bin/sh\nexit 0\n")
|
||||||
|
link = repo / entry
|
||||||
|
link.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
link.symlink_to("real.sh")
|
||||||
|
else:
|
||||||
|
self.write(repo, entry, "#!/bin/sh\nexit 0\n")
|
||||||
|
self.stage(repo)
|
||||||
|
return repo, self.commit(repo, f"leaf {name}")
|
||||||
|
|
||||||
|
def leaf_with_gitlink(self, name):
|
||||||
|
inner = self.repo(f"{name}-inner")
|
||||||
|
self.write(inner, "scripts/ci.sh", "#!/bin/sh\nexit 0\n")
|
||||||
|
self.stage(inner)
|
||||||
|
inner_sha = self.commit(inner, "inner")
|
||||||
|
repo = self.repo(name)
|
||||||
|
self.write(repo, "scripts/ci.sh", "#!/bin/sh\nexit 0\n")
|
||||||
|
self.stage(repo)
|
||||||
|
self.gitlink(repo, "nested/inner", inner_sha)
|
||||||
|
return repo, self.commit(repo, f"leaf {name}")
|
||||||
|
|
||||||
|
def domain(self, catalog_text, links, files=None, modules=None):
|
||||||
|
repo = self.repo("domain-source")
|
||||||
|
if catalog_text is not None:
|
||||||
|
self.write(repo, "components.toml", catalog_text)
|
||||||
|
self.write(repo, "scripts/integration.sh", "#!/bin/sh\nexit 0\n")
|
||||||
|
for relative, content in (files or {}).items():
|
||||||
|
self.write(repo, relative, content)
|
||||||
|
entries = {
|
||||||
|
"design": "https://git.cflmy.cn/cflmy/marqdo-web-design.git",
|
||||||
|
"preview": "https://git.cflmy.cn/cflmy/marqdo-web-preview.git",
|
||||||
|
}
|
||||||
|
if modules is not None:
|
||||||
|
entries = modules
|
||||||
|
self.modules(repo, entries)
|
||||||
|
self.stage(repo)
|
||||||
|
for path, sha in links.items():
|
||||||
|
self.gitlink(repo, path, sha)
|
||||||
|
return repo, self.commit(repo, "domain")
|
||||||
|
|
||||||
|
def root_repo(self, catalog_text, links, modules):
|
||||||
|
self.write(self.root, "components.toml", catalog_text)
|
||||||
|
self.modules(self.root, modules)
|
||||||
|
self.stage(self.root)
|
||||||
|
for path, sha in links.items():
|
||||||
|
self.gitlink(self.root, path, sha)
|
||||||
|
return self.commit(self.root, "root")
|
||||||
|
|
||||||
|
def clone(self, source, target, sha):
|
||||||
|
target.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
self.git("clone", "-q", str(source), str(target), cwd=self.sources)
|
||||||
|
self.git("checkout", "-q", sha, cwd=target)
|
||||||
|
|
||||||
|
def assemble(self, domain_catalog=DOMAIN, domain_files=None, domain_modules=None,
|
||||||
|
omit_domain_link=None, extra_domain_link=None, root_catalog=None,
|
||||||
|
root_modules=None, checkout=True, core=None, design=None, preview=None):
|
||||||
|
core = core or self.leaf("core", entry="scripts/test.sh")
|
||||||
|
design = design or self.leaf("design")
|
||||||
|
preview = preview or self.leaf("preview")
|
||||||
|
links = {"design": design[1], "preview": preview[1]}
|
||||||
|
if omit_domain_link:
|
||||||
|
links.pop(omit_domain_link)
|
||||||
|
if extra_domain_link:
|
||||||
|
links[extra_domain_link[0]] = extra_domain_link[1]
|
||||||
|
domain_repo, domain_sha = self.domain(domain_catalog, links, domain_files, domain_modules)
|
||||||
|
modules = root_modules if root_modules is not None else {
|
||||||
|
"cli": CORE_URL,
|
||||||
|
"extensions/web": "https://git.cflmy.cn/cflmy/marqdo-ext-web.git",
|
||||||
|
}
|
||||||
|
self.root_repo(root_catalog if root_catalog is not None else catalog(CLI, WEB_DOMAIN),
|
||||||
|
{"cli": core[1], "extensions/web": domain_sha}, modules)
|
||||||
|
if checkout:
|
||||||
|
self.clone(core[0], self.root / "cli", core[1])
|
||||||
|
self.clone(domain_repo, self.root / "extensions/web", domain_sha)
|
||||||
|
sources = {"design": design, "preview": preview}
|
||||||
|
for path, sha in links.items():
|
||||||
|
self.clone(sources.get(path, design)[0], self.root / "extensions/web" / path, sha)
|
||||||
|
return {"core": core, "design": design, "preview": preview, "domain": (domain_repo, domain_sha)}
|
||||||
|
|
||||||
|
# -- positive cases -----------------------------------------------------
|
||||||
|
|
||||||
|
def test_accepts_a_two_level_domain_tree_with_checkouts(self):
|
||||||
|
self.assemble(domain_files={"docs/WEB-DESIGN.md": "# contract\n", "examples/research/README.md": "example\n"})
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_accepts_a_planned_domain_and_planned_child_gitlinks(self):
|
||||||
|
web = WEB_DOMAIN.replace('state = "active"', 'state = "planned"').replace(
|
||||||
|
'entry = "scripts/integration.sh"\n', '')
|
||||||
|
children = DOMAIN.replace('state = "active"', 'state = "planned"').replace(
|
||||||
|
'entry = "scripts/ci.sh"\n', '')
|
||||||
|
self.assemble(root_catalog=CLI + web, domain_catalog=children)
|
||||||
|
root, domain = layout.validate("HEAD", True)
|
||||||
|
self.assertEqual(root.linked["extensions/web"]["state"], "planned")
|
||||||
|
self.assertEqual(set(domain.linked), {"design", "preview"})
|
||||||
|
self.assertTrue(all(child["state"] == "planned" for child in domain.linked.values()))
|
||||||
|
|
||||||
|
def test_non_checkout_mode_only_validates_the_root_layer(self):
|
||||||
|
self.assemble()
|
||||||
|
shutil.rmtree(self.root / "extensions" / "web")
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
with self.assertRaisesRegex(ValueError, "missing submodule checkout: extensions/web"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_accepts_a_stdlib_domain_with_base_release(self):
|
||||||
|
self.root_repo(catalog(CLI, STDLIB_DOMAIN),
|
||||||
|
{"cli": self.leaf("core", entry="scripts/test.sh")[1], "stdlib": "a" * 40},
|
||||||
|
{"cli": CORE_URL, "stdlib": "https://git.cflmy.cn/cflmy/marqdo-stdlib.git"})
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_allows_checks_with_cycles(self):
|
||||||
|
cycle = CLI.replace('checks_with = []', 'checks_with = ["view"]') + '''
|
||||||
|
[[component]]
|
||||||
|
id = "view"
|
||||||
|
path = "tools/view"
|
||||||
|
kind = "tool"
|
||||||
|
state = "active"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "read and observe"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = ["cli"]
|
||||||
|
release = "optional"
|
||||||
|
entry = "scripts/acceptance.sh"
|
||||||
|
'''
|
||||||
|
sha = self.leaf("core", entry="scripts/test.sh")[1]
|
||||||
|
self.root_repo(cycle, {"cli": sha, "tools/view": sha},
|
||||||
|
{"cli": CORE_URL, "tools/view": "https://git.cflmy.cn/cflmy/marqdo-view.git"})
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
# -- checkout failures --------------------------------------------------
|
||||||
|
|
||||||
|
def test_rejects_a_dirty_domain_child(self):
|
||||||
|
self.assemble()
|
||||||
|
(self.root / "extensions/web/design/scratch.txt").write_text("dirty")
|
||||||
|
with self.assertRaisesRegex(ValueError, r"domain web \(extensions/web\): dirty submodule: design"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_wrong_checked_out_commit(self):
|
||||||
|
self.assemble()
|
||||||
|
self.git("commit", "--allow-empty", "-qm", "drift", cwd=self.root / "extensions/web/design")
|
||||||
|
with self.assertRaisesRegex(ValueError, r"domain web \(extensions/web\): wrong checked-out commit: design"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_missing_domain_child_checkout(self):
|
||||||
|
self.assemble()
|
||||||
|
shutil.rmtree(self.root / "extensions/web/preview")
|
||||||
|
with self.assertRaisesRegex(ValueError, r"domain web \(extensions/web\): missing submodule checkout: preview"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_missing_committed_object(self):
|
||||||
|
self.assemble()
|
||||||
|
self.git("update-index", "--add", "--cacheinfo", f"160000,{'f' * 40},extensions/web", cwd=self.root)
|
||||||
|
self.git("commit", "-qm", "bad gitlink")
|
||||||
|
with self.assertRaisesRegex(ValueError, "missing committed object: extensions/web"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_symbolic_entry(self):
|
||||||
|
design = self.leaf("design", symlink_entry=True)
|
||||||
|
self.assemble(design=design)
|
||||||
|
with self.assertRaisesRegex(ValueError, "missing or symbolic entry: design/scripts/ci.sh"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_third_level_gitlink(self):
|
||||||
|
design = self.leaf_with_gitlink("design")
|
||||||
|
self.assemble(design=design)
|
||||||
|
with self.assertRaisesRegex(ValueError, r"domain web \(extensions/web\) leaf web-design \(design\): leaf must not register gitlinks"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
# -- catalog and layer failures ----------------------------------------
|
||||||
|
|
||||||
|
def test_rejects_a_missing_domain_catalog(self):
|
||||||
|
self.assemble(domain_catalog=None)
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
with self.assertRaisesRegex(ValueError, "missing components.toml at"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_domain_catalog_missing_a_gitlink(self):
|
||||||
|
extra = DOMAIN + '''
|
||||||
|
[[component]]
|
||||||
|
id = "web-extra"
|
||||||
|
path = "extra"
|
||||||
|
kind = "extension"
|
||||||
|
state = "active"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "extra component"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
entry = "scripts/ci.sh"
|
||||||
|
'''
|
||||||
|
self.assemble(domain_catalog=extra)
|
||||||
|
with self.assertRaisesRegex(ValueError, r"domain web \(extensions/web\): gitlink/catalog mismatch"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_an_unregistered_domain_gitlink(self):
|
||||||
|
info = self.assemble()
|
||||||
|
extra = self.leaf("extra")
|
||||||
|
domain_repo = self.sources / "domain-source"
|
||||||
|
self.git("update-index", "--add", "--cacheinfo", f"160000,{extra[1]},extra", cwd=domain_repo)
|
||||||
|
new_domain_sha = self.commit(domain_repo, "extra gitlink")
|
||||||
|
self.git("update-index", "--add", "--cacheinfo", f"160000,{new_domain_sha},extensions/web", cwd=self.root)
|
||||||
|
self.git("commit", "-qm", "advance domain")
|
||||||
|
shutil.rmtree(self.root / "extensions/web")
|
||||||
|
self.clone(domain_repo, self.root / "extensions/web", new_domain_sha)
|
||||||
|
for name in ("design", "preview"):
|
||||||
|
self.clone(info[name][0], self.root / "extensions/web" / name, info[name][1])
|
||||||
|
self.clone(extra[0], self.root / "extensions/web" / "extra", extra[1])
|
||||||
|
with self.assertRaisesRegex(ValueError, r"domain web \(extensions/web\): gitlink/catalog mismatch"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_nested_domain(self):
|
||||||
|
nested = '''
|
||||||
|
[[component]]
|
||||||
|
id = "web-inner"
|
||||||
|
path = "inner"
|
||||||
|
kind = "domain"
|
||||||
|
state = "planned"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "nested aggregate"
|
||||||
|
requires = []
|
||||||
|
checks_with = []
|
||||||
|
release = "none"
|
||||||
|
'''
|
||||||
|
self.assemble(domain_catalog=nested)
|
||||||
|
with self.assertRaisesRegex(ValueError, "domain kind is only allowed at the root layer: web-inner"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_core_component_inside_a_domain(self):
|
||||||
|
nested = '''
|
||||||
|
[[component]]
|
||||||
|
id = "web-core"
|
||||||
|
path = "core"
|
||||||
|
kind = "core"
|
||||||
|
state = "planned"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "not allowed here"
|
||||||
|
requires = []
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
'''
|
||||||
|
self.assemble(domain_catalog=nested)
|
||||||
|
with self.assertRaisesRegex(ValueError, "component kind is not allowed inside a domain: web-core"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_production_file_in_the_domain_tree(self):
|
||||||
|
self.assemble(domain_files={"Cargo.toml": '[package]\nname = "web-domain"\n'})
|
||||||
|
with self.assertRaisesRegex(ValueError, "unexpected aggregate tracked path or mode: Cargo.toml"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_planned_child_implementation_file(self):
|
||||||
|
self.assemble(domain_files={"components/renderer.py": "print('not allowed')\n"})
|
||||||
|
with self.assertRaisesRegex(ValueError, "unexpected aggregate tracked path or mode: components/renderer.py"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_a_wrong_domain_child_url(self):
|
||||||
|
self.assemble(domain_modules={
|
||||||
|
"design": "https://git.cflmy.cn/cflmy/marqdo-ext-design.git",
|
||||||
|
"preview": "https://git.cflmy.cn/cflmy/marqdo-web-preview.git",
|
||||||
|
})
|
||||||
|
shutil.rmtree(self.root / "extensions/web/design")
|
||||||
|
with self.assertRaisesRegex(ValueError, "invalid submodule URL: design"):
|
||||||
|
layout.validate("HEAD", False, expand_domains=True)
|
||||||
|
|
||||||
|
# -- global graph failures ---------------------------------------------
|
||||||
|
|
||||||
|
def test_rejects_a_duplicate_global_id(self):
|
||||||
|
self.assemble(domain_catalog=DOMAIN.replace('id = "web-components"', 'id = "cli"'))
|
||||||
|
with self.assertRaisesRegex(ValueError, "duplicate global id: cli"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_an_unknown_domain_dependency(self):
|
||||||
|
self.assemble(domain_catalog=DOMAIN.replace('requires = ["cli"]', 'requires = ["cli", "missing"]', 1))
|
||||||
|
with self.assertRaisesRegex(ValueError, "unknown dependency: web-design -> missing"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_an_active_domain_child_dependency_on_planned(self):
|
||||||
|
self.assemble(domain_catalog=DOMAIN.replace(
|
||||||
|
'requires = ["cli", "web-design"]', 'requires = ["cli", "web-design", "web-components"]', 1))
|
||||||
|
with self.assertRaisesRegex(ValueError, "active depends on planned: web-preview -> web-components"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
# -- root catalog rules -------------------------------------------------
|
||||||
|
|
||||||
|
def test_rejects_domain_requires(self):
|
||||||
|
self.root_repo(CLI + WEB_DOMAIN.replace("requires = []", 'requires = ["cli"]'),
|
||||||
|
{"cli": "a" * 40, "extensions/web": "b" * 40},
|
||||||
|
{"cli": CORE_URL, "extensions/web": "https://git.cflmy.cn/cflmy/marqdo-ext-web.git"})
|
||||||
|
with self.assertRaisesRegex(ValueError, "domain requires must be empty: web"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_an_invalid_domain_release_role(self):
|
||||||
|
self.root_repo(CLI + WEB_DOMAIN.replace('release = "none"', 'release = "optional"'),
|
||||||
|
{"cli": "a" * 40, "extensions/web": "b" * 40},
|
||||||
|
{"cli": CORE_URL, "extensions/web": "https://git.cflmy.cn/cflmy/marqdo-ext-web.git"})
|
||||||
|
with self.assertRaisesRegex(ValueError, "invalid release role: web"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_an_invalid_domain_path(self):
|
||||||
|
self.root_repo(CLI + WEB_DOMAIN.replace('path = "extensions/web"', 'path = "extensions/other"'),
|
||||||
|
{"cli": "a" * 40, "extensions/other": "b" * 40},
|
||||||
|
{"cli": CORE_URL, "extensions/other": "https://git.cflmy.cn/cflmy/marqdo-ext-web.git"})
|
||||||
|
with self.assertRaisesRegex(ValueError, "invalid path: web: extensions/other"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_a_requires_edge_to_a_domain(self):
|
||||||
|
view = '''
|
||||||
|
[[component]]
|
||||||
|
id = "view"
|
||||||
|
path = "tools/view"
|
||||||
|
kind = "tool"
|
||||||
|
state = "active"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "read and observe"
|
||||||
|
requires = ["web"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
entry = "scripts/acceptance.sh"
|
||||||
|
'''
|
||||||
|
self.root_repo(CLI + WEB_DOMAIN + view,
|
||||||
|
{"cli": "a" * 40, "extensions/web": "b" * 40, "tools/view": "a" * 40},
|
||||||
|
{"cli": CORE_URL,
|
||||||
|
"extensions/web": "https://git.cflmy.cn/cflmy/marqdo-ext-web.git",
|
||||||
|
"tools/view": "https://git.cflmy.cn/cflmy/marqdo-view.git"})
|
||||||
|
with self.assertRaisesRegex(ValueError, "requires must not target a domain: view -> web"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_stdlib_dependency_on_extension(self):
|
||||||
|
stdlib_extra = '''
|
||||||
|
[[component]]
|
||||||
|
id = "std-extra"
|
||||||
|
path = "stdlib/extra"
|
||||||
|
kind = "stdlib"
|
||||||
|
state = "planned"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "not allowed to depend on extensions"
|
||||||
|
requires = ["math"]
|
||||||
|
checks_with = []
|
||||||
|
release = "base"
|
||||||
|
'''
|
||||||
|
math = '''
|
||||||
|
[[component]]
|
||||||
|
id = "math"
|
||||||
|
path = "extensions/math"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "numeric algorithms"
|
||||||
|
requires = ["cli"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
'''
|
||||||
|
self.root_repo(CLI + stdlib_extra + math, {"cli": "a" * 40}, {"cli": CORE_URL})
|
||||||
|
with self.assertRaisesRegex(ValueError, "stdlib dependency violation: std-extra -> math"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_core_build_dependency_on_other_component(self):
|
||||||
|
conformance = '''
|
||||||
|
[[component]]
|
||||||
|
id = "conformance"
|
||||||
|
path = "tests/conformance"
|
||||||
|
kind = "test"
|
||||||
|
state = "active"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "independent protocol tests"
|
||||||
|
requires = []
|
||||||
|
checks_with = []
|
||||||
|
release = "none"
|
||||||
|
entry = "scripts/build_all.sh"
|
||||||
|
'''
|
||||||
|
cli = CLI.replace("requires = []", 'requires = ["conformance"]')
|
||||||
|
self.root_repo(cli + conformance,
|
||||||
|
{"cli": "a" * 40, "tests/conformance": "a" * 40},
|
||||||
|
{"cli": CORE_URL,
|
||||||
|
"tests/conformance": "https://git.cflmy.cn/cflmy/marqdo-extension-conformance.git"})
|
||||||
|
with self.assertRaisesRegex(ValueError, "dependency violation: cli must not require conformance"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_a_requires_cycle(self):
|
||||||
|
math = '''
|
||||||
|
[[component]]
|
||||||
|
id = "math"
|
||||||
|
path = "extensions/math"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "numeric algorithms"
|
||||||
|
requires = ["linalg"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
'''
|
||||||
|
linalg = '''
|
||||||
|
[[component]]
|
||||||
|
id = "linalg"
|
||||||
|
path = "extensions/linalg"
|
||||||
|
kind = "extension"
|
||||||
|
state = "planned"
|
||||||
|
owner = "maintainer"
|
||||||
|
scope = "linear algebra"
|
||||||
|
requires = ["math"]
|
||||||
|
checks_with = []
|
||||||
|
release = "optional"
|
||||||
|
'''
|
||||||
|
self.root_repo(CLI + math + linalg, {"cli": "a" * 40}, {"cli": CORE_URL})
|
||||||
|
with self.assertRaisesRegex(ValueError, "requires DAG cycle"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_overlapping_component_paths(self):
|
||||||
|
stdlib_domain = STDLIB_DOMAIN.replace("state = \"active\"", "state = \"planned\"").replace(
|
||||||
|
'entry = "scripts/integration.sh"\n', "")
|
||||||
|
planned = PLANNED
|
||||||
|
self.root_repo(CLI + stdlib_domain + planned, {"cli": "a" * 40}, {"cli": CORE_URL})
|
||||||
|
with self.assertRaisesRegex(ValueError, "overlapping component path: stdlib/core / stdlib"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_a_submodule_update_command(self):
|
||||||
|
self.root_repo(CLI, {"cli": "a" * 40}, {"cli": CORE_URL})
|
||||||
|
self.write(self.root, ".gitmodules",
|
||||||
|
f'[submodule "cli"]\n\tpath = cli\n\turl = {CORE_URL}\n\tupdate = !false\n')
|
||||||
|
self.stage(self.root)
|
||||||
|
self.gitlink(self.root, "cli", "a" * 40)
|
||||||
|
self.git("commit", "-qm", "update command")
|
||||||
|
with self.assertRaisesRegex(ValueError, "unexpected submodule settings"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_forbidden_submodule_urls(self):
|
||||||
|
for url in ("file:///tmp/marqdo-cli.git", "../marqdo-cli.git", "git@git.cflmy.cn:cflmy/marqdo-cli.git"):
|
||||||
|
with self.subTest(url=url):
|
||||||
|
self.root_repo(CLI, {"cli": "a" * 40}, {"cli": url})
|
||||||
|
with self.assertRaisesRegex(ValueError, "invalid submodule URL: cli"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_accepts_a_submodule_section_name_that_differs_from_its_path(self):
|
||||||
|
self.root_repo(CLI, {"cli": "a" * 40}, {"cli": CORE_URL})
|
||||||
|
self.write(self.root, ".gitmodules",
|
||||||
|
f'[submodule "core-runtime"]\n\tpath = cli\n\turl = {CORE_URL}\n')
|
||||||
|
self.stage(self.root)
|
||||||
|
self.gitlink(self.root, "cli", "a" * 40)
|
||||||
|
self.git("commit", "-qm", "named section")
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_a_wrong_domain_root_url(self):
|
||||||
|
self.root_repo(CLI + WEB_DOMAIN,
|
||||||
|
{"cli": "a" * 40, "extensions/web": "b" * 40},
|
||||||
|
{"cli": CORE_URL,
|
||||||
|
"extensions/web": "https://git.cflmy.cn/cflmy/ext-web.git"})
|
||||||
|
with self.assertRaisesRegex(ValueError, "invalid submodule URL: extensions/web"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_a_domain_without_submodule_gitmodules(self):
|
||||||
|
self.assemble(domain_modules={})
|
||||||
|
with self.assertRaisesRegex(ValueError, "missing or invalid submodule path: design"):
|
||||||
|
layout.validate("HEAD", True)
|
||||||
|
|
||||||
|
def test_rejects_an_unknown_root_dependency(self):
|
||||||
|
self.root_repo(CLI.replace('requires = []', 'requires = ["missing"]'), {"cli": "a" * 40}, {"cli": CORE_URL})
|
||||||
|
with self.assertRaisesRegex(ValueError, "unknown dependency: cli -> missing"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
def test_rejects_an_absolute_or_parent_path(self):
|
||||||
|
for path in ("/extensions/web", "extensions/../web", "extensions//web"):
|
||||||
|
with self.subTest(path=path):
|
||||||
|
self.root_repo(
|
||||||
|
CLI + WEB_DOMAIN.replace('path = "extensions/web"', f'path = "{path}"'),
|
||||||
|
{"cli": "a" * 40},
|
||||||
|
{"cli": CORE_URL})
|
||||||
|
with self.assertRaisesRegex(ValueError, "invalid path for web"):
|
||||||
|
layout.validate("HEAD", False)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Submodule
+1
Submodule tools/knowledge added at d8fa201b28.
Submodule
+1
Submodule tools/lint added at 111e085f24.
Submodule
+1
Submodule tools/prove added at d8c340b6e2.
Submodule
+1
Submodule tools/view added at 04f3a0e9e5.
Reference in new issue
Block a user