silvermoon 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -236
- package/README.zh-CN.md +114 -199
- package/assets/silvermoon.svg +176 -175
- package/bin/silvermoon.js +0 -0
- package/docs/assets/silvermoon-avatar.svg +395 -0
- package/docs/core-concepts.md +69 -0
- package/docs/getting-started.md +115 -0
- package/docs/maintaining.md +56 -0
- package/docs/npm-package-releases.md +139 -0
- package/docs/operations.md +110 -0
- package/docs/reference.md +138 -0
- package/docs/repository-tasks.md +61 -0
- package/package.json +69 -65
- package/schema/v1/config.schema.json +27 -24
- package/schema/v1/definitions.schema.json +30 -25
- package/schema/v1/idea-status.schema.json +44 -41
- package/schema/v1/user-config.schema.json +19 -0
- package/skills/silvermoon/SKILL.md +216 -209
- package/skills/silvermoon/references/adoption.md +122 -122
- package/src/adoption.js +313 -313
- package/src/cli.js +200 -196
- package/src/config.js +193 -176
- package/src/create-idea.js +272 -235
- package/src/git.js +284 -284
- package/src/idea-layout.js +439 -439
- package/src/idea-templates.js +109 -109
- package/src/ideas.js +140 -131
- package/src/index.js +260 -260
- package/src/language.js +29 -0
- package/src/layout.js +21 -21
- package/src/repository.js +87 -87
- package/src/user-config.js +135 -0
- package/src/whatsnext.js +453 -378
- package/src/yaml.js +66 -66
package/src/yaml.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { isAlias, isMap, parseDocument, stringify, visit } from "yaml";
|
|
2
|
-
|
|
3
|
-
function unsupportedFeature(document) {
|
|
4
|
-
if (document.commentBefore || document.comment) return true;
|
|
5
|
-
if (document.directives?.docStart || document.directives?.docEnd) return true;
|
|
6
|
-
if (document.directives?.yaml?.explicit) return true;
|
|
7
|
-
const tags = Object.entries(document.directives?.tags ?? {});
|
|
8
|
-
if (
|
|
9
|
-
tags.length !== 1 ||
|
|
10
|
-
tags[0]?.[0] !== "!!" ||
|
|
11
|
-
tags[0]?.[1] !== "tag:yaml.org,2002:"
|
|
12
|
-
) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
let unsupported = false;
|
|
17
|
-
visit(document, (_key, node) => {
|
|
18
|
-
if (
|
|
19
|
-
isAlias(node) ||
|
|
20
|
-
node?.anchor ||
|
|
21
|
-
node?.tag ||
|
|
22
|
-
node?.commentBefore ||
|
|
23
|
-
node?.comment
|
|
24
|
-
) {
|
|
25
|
-
unsupported = true;
|
|
26
|
-
return visit.BREAK;
|
|
27
|
-
}
|
|
28
|
-
if (
|
|
29
|
-
isMap(node) &&
|
|
30
|
-
node.items.some((item) => item.key?.value === "<<")
|
|
31
|
-
) {
|
|
32
|
-
unsupported = true;
|
|
33
|
-
return visit.BREAK;
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
});
|
|
37
|
-
return unsupported;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function parseStrictYaml(source) {
|
|
41
|
-
const document = parseDocument(source, {
|
|
42
|
-
maxAliasCount: 0,
|
|
43
|
-
prettyErrors: false,
|
|
44
|
-
strict: true,
|
|
45
|
-
uniqueKeys: true,
|
|
46
|
-
version: "1.2",
|
|
47
|
-
});
|
|
48
|
-
if (document.errors.length > 0 || document.warnings.length > 0) {
|
|
49
|
-
throw new Error(
|
|
50
|
-
document.errors[0]?.message ?? document.warnings[0]?.message ?? "Invalid YAML",
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
if (unsupportedFeature(document)) {
|
|
54
|
-
throw new Error("Comments, directives, anchors, aliases, merge keys, and tags are not supported");
|
|
55
|
-
}
|
|
56
|
-
return document.toJS({ maxAliasCount: 0 });
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function stringifyCanonicalYaml(value) {
|
|
60
|
-
return stringify(value, {
|
|
61
|
-
defaultKeyType: "PLAIN",
|
|
62
|
-
defaultStringType: "PLAIN",
|
|
63
|
-
indent: 2,
|
|
64
|
-
lineWidth: 0,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
1
|
+
import { isAlias, isMap, parseDocument, stringify, visit } from "yaml";
|
|
2
|
+
|
|
3
|
+
function unsupportedFeature(document) {
|
|
4
|
+
if (document.commentBefore || document.comment) return true;
|
|
5
|
+
if (document.directives?.docStart || document.directives?.docEnd) return true;
|
|
6
|
+
if (document.directives?.yaml?.explicit) return true;
|
|
7
|
+
const tags = Object.entries(document.directives?.tags ?? {});
|
|
8
|
+
if (
|
|
9
|
+
tags.length !== 1 ||
|
|
10
|
+
tags[0]?.[0] !== "!!" ||
|
|
11
|
+
tags[0]?.[1] !== "tag:yaml.org,2002:"
|
|
12
|
+
) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let unsupported = false;
|
|
17
|
+
visit(document, (_key, node) => {
|
|
18
|
+
if (
|
|
19
|
+
isAlias(node) ||
|
|
20
|
+
node?.anchor ||
|
|
21
|
+
node?.tag ||
|
|
22
|
+
node?.commentBefore ||
|
|
23
|
+
node?.comment
|
|
24
|
+
) {
|
|
25
|
+
unsupported = true;
|
|
26
|
+
return visit.BREAK;
|
|
27
|
+
}
|
|
28
|
+
if (
|
|
29
|
+
isMap(node) &&
|
|
30
|
+
node.items.some((item) => item.key?.value === "<<")
|
|
31
|
+
) {
|
|
32
|
+
unsupported = true;
|
|
33
|
+
return visit.BREAK;
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
});
|
|
37
|
+
return unsupported;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function parseStrictYaml(source) {
|
|
41
|
+
const document = parseDocument(source, {
|
|
42
|
+
maxAliasCount: 0,
|
|
43
|
+
prettyErrors: false,
|
|
44
|
+
strict: true,
|
|
45
|
+
uniqueKeys: true,
|
|
46
|
+
version: "1.2",
|
|
47
|
+
});
|
|
48
|
+
if (document.errors.length > 0 || document.warnings.length > 0) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
document.errors[0]?.message ?? document.warnings[0]?.message ?? "Invalid YAML",
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
if (unsupportedFeature(document)) {
|
|
54
|
+
throw new Error("Comments, directives, anchors, aliases, merge keys, and tags are not supported");
|
|
55
|
+
}
|
|
56
|
+
return document.toJS({ maxAliasCount: 0 });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function stringifyCanonicalYaml(value) {
|
|
60
|
+
return stringify(value, {
|
|
61
|
+
defaultKeyType: "PLAIN",
|
|
62
|
+
defaultStringType: "PLAIN",
|
|
63
|
+
indent: 2,
|
|
64
|
+
lineWidth: 0,
|
|
65
|
+
});
|
|
66
|
+
}
|