specdojo 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/specdojo-orchestrator.md +4 -1
- package/CHANGELOG.md +64 -0
- package/dist/catalog/catalog.js +16 -14
- package/dist/commands/agent.js +5 -3
- package/dist/commands/build.js +69 -10
- package/dist/commands/git.js +206 -0
- package/dist/commands/init.js +4 -2
- package/dist/commands/where.js +25 -0
- package/dist/dashboard/dashboard.js +5 -3
- package/dist/dashboard/routines.js +4 -7
- package/dist/dashboard/timeline.js +14 -14
- package/dist/docs/index-command.js +2 -2
- package/dist/docs/yaml-business-tables.js +243 -0
- package/dist/docs/yaml-interface-tables.js +106 -0
- package/dist/docs/yaml-pages-command.js +5 -3
- package/dist/docs/yaml-pages.js +146 -3
- package/dist/docs/yaml-table-shared.js +70 -0
- package/dist/docs/yaml-tables.js +39 -0
- package/dist/exec/agent-config.js +9 -0
- package/dist/exec/agent-protected-config.js +2 -0
- package/dist/exec/commands.js +31 -18
- package/dist/exec/events.js +34 -14
- package/dist/exec/evidence.js +13 -3
- package/dist/exec/parent-validation.js +56 -3
- package/dist/exec/plans-core.js +21 -2
- package/dist/exec/plans-generation.js +6 -7
- package/dist/exec/post-integration.js +162 -0
- package/dist/exec/queue-command.js +166 -0
- package/dist/exec/queue.js +285 -0
- package/dist/exec/register-foreign-wait.js +84 -0
- package/dist/exec/repo-integration-sync.js +17 -5
- package/dist/exec/reporter.js +2 -2
- package/dist/exec/results.js +24 -4
- package/dist/exec/review-kata.js +4 -1
- package/dist/exec/run/agent-pipeline.js +3 -2
- package/dist/exec/run/agent.js +12 -6
- package/dist/exec/run/change-scope.js +365 -0
- package/dist/exec/run/deferred-cleanup.js +31 -0
- package/dist/exec/run/in-place.js +4 -1
- package/dist/exec/run/job-lock.js +66 -0
- package/dist/exec/run/job-sequence.js +137 -0
- package/dist/exec/run/job.js +56 -19
- package/dist/exec/run/lifecycle-commands.js +1 -1
- package/dist/exec/run/lock.js +22 -1
- package/dist/exec/run/register-command.js +8 -5
- package/dist/exec/run/register-mode.js +68 -8
- package/dist/exec/run/register-resume.js +68 -14
- package/dist/exec/run/register-state.js +13 -8
- package/dist/exec/run/register-worktree.js +140 -125
- package/dist/exec/run/schedule-mode.js +75 -14
- package/dist/exec/run/schedule-prepare.js +3 -0
- package/dist/exec/run/schedule-task.js +88 -38
- package/dist/exec/run/shared.js +5 -0
- package/dist/exec/schedule/schedule.js +116 -4
- package/dist/exec/shared.js +1 -1
- package/dist/exec/smoke.js +190 -0
- package/dist/exec/strategy.js +13 -3
- package/dist/exec/task-view.js +6 -4
- package/dist/exec/trial-commands.js +5 -2
- package/dist/exec/trial-core.js +6 -1
- package/dist/exec/validation-metrics.js +181 -0
- package/dist/exec/worktree-cleanup-lock.js +26 -0
- package/dist/exec/worktree-command.js +9 -1
- package/dist/exec/worktree-ops-commit.js +2 -2
- package/dist/exec/worktree.js +13 -2
- package/dist/grade/command-apply.js +3 -3
- package/dist/grade/command-inspect.js +5 -3
- package/dist/grade/command-plan.js +1 -1
- package/dist/grade/command-run.js +5 -1
- package/dist/grade/run.js +64 -8
- package/dist/job/definition.js +84 -8
- package/dist/job/job.js +79 -23
- package/dist/register/authoring-sources.js +22 -16
- package/dist/register/maintenance-commands.js +2 -2
- package/dist/register/register.js +31 -7
- package/dist/routine/definition.js +9 -0
- package/dist/routine/routine.js +137 -43
- package/dist/routine/status.js +62 -0
- package/dist/schedule/schedule.js +38 -39
- package/dist/shared/agent-types.js +5 -0
- package/dist/shared/cross-process-lock.js +9 -1
- package/dist/shared/dist-freshness.js +8 -2
- package/dist/shared/git-environment.js +2 -1
- package/dist/shared/git.js +44 -1
- package/dist/shared/lefthook-scaffold.js +3 -0
- package/dist/shared/local-config.js +244 -0
- package/dist/shared/specdojo-config.js +34 -20
- package/dist/shared/specdojo-gitignore.js +1 -0
- package/dist/shared/text.js +9 -1
- package/dist/shared/where-alias.js +13 -0
- package/dist/specdojo.js +4 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +2 -0
- package/docs/ja/specdojo/guides/exec-config-guide.md +23 -4
- package/docs/ja/specdojo/guides/exec-operation-guide.md +44 -1
- package/docs/ja/specdojo/guides/job-sequence-guide.md +77 -0
- package/docs/ja/specdojo/guides/quick-start-guide.md +3 -3
- package/docs/ja/specdojo/guides/register-operation-guide.md +1 -1
- package/docs/ja/specdojo/guides/routine-operation-guide.md +11 -6
- package/docs/ja/specdojo/guides/schedule-design-guide.md +20 -17
- package/docs/ja/specdojo/guides/waza-guide.md +12 -8
- package/docs/ja/specdojo/recipes/bac-recipe.md +66 -49
- package/docs/ja/specdojo/recipes/bes-recipe.md +90 -54
- package/docs/ja/specdojo/recipes/bps-recipe.md +88 -139
- package/docs/ja/specdojo/recipes/br-recipe.md +40 -47
- package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +97 -109
- package/docs/ja/specdojo/recipes/cdfd-recipe.md +85 -146
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +91 -110
- package/docs/ja/specdojo/recipes/cnd-recipe.md +79 -69
- package/docs/ja/specdojo/recipes/cpd-recipe.md +78 -64
- package/docs/ja/specdojo/recipes/cxd-recipe.md +92 -75
- package/docs/ja/specdojo/recipes/ifd-recipe.md +79 -68
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +78 -105
- package/docs/ja/specdojo/recipes/ifx-index-recipe.md +105 -71
- package/docs/ja/specdojo/recipes/pm-communication-plan-recipe.md +60 -49
- package/docs/ja/specdojo/recipes/pm-members-recipe.md +50 -51
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +59 -51
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +69 -56
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +37 -56
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +39 -53
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +52 -79
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +64 -93
- package/docs/ja/specdojo/recipes/prj-charter-recipe.md +71 -106
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +78 -157
- package/docs/ja/specdojo/recipes/prj-issues-and-approach-recipe.md +62 -111
- package/docs/ja/specdojo/recipes/prj-scope-recipe.md +67 -123
- package/docs/ja/specdojo/recipes/prj-stakeholder-register-recipe.md +60 -96
- package/docs/ja/specdojo/recipes/prj-success-criteria-and-acceptance-criteria-recipe.md +61 -105
- package/docs/ja/specdojo/recipes/stsd-recipe.md +79 -109
- package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +78 -55
- package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +82 -73
- package/docs/ja/specdojo/recipes/sysd-index-recipe.md +78 -59
- package/docs/ja/specdojo/recipes/tsd-recipe.md +149 -129
- package/docs/ja/specdojo/references/command-reference.md +257 -117
- package/docs/ja/specdojo/references/deliverables-reference.md +21 -12
- package/docs/ja/specdojo/references/specdojo-config-reference.md +37 -2
- package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +101 -257
- package/docs/ja/specdojo/rulebooks/atc-rulebook.md +102 -228
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +19 -28
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +16 -67
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +30 -51
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +41 -61
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +22 -50
- package/docs/ja/specdojo/rulebooks/bps-rulebook.md +24 -56
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +13 -38
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +41 -76
- package/docs/ja/specdojo/rulebooks/cdfd-d2-rulebook.md +18 -93
- package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +18 -52
- package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +109 -147
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +80 -108
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +21 -46
- package/docs/ja/specdojo/rulebooks/cdr-rulebook.md +144 -0
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +27 -48
- package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +37 -50
- package/docs/ja/specdojo/rulebooks/clis-rulebook.md +52 -69
- package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +33 -86
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +16 -32
- package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +45 -131
- package/docs/ja/specdojo/rulebooks/cop-rulebook.md +69 -275
- package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +20 -112
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +23 -56
- package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +12 -145
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +39 -47
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +37 -56
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +118 -175
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +5 -14
- package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +22 -66
- package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +36 -94
- package/docs/ja/specdojo/rulebooks/dss-rulebook.md +59 -81
- package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +31 -131
- package/docs/ja/specdojo/rulebooks/etc-rulebook.md +50 -104
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +51 -61
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +38 -45
- package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +14 -20
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +26 -38
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +26 -107
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +42 -49
- package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +14 -22
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +21 -44
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +41 -64
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +14 -38
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +34 -61
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +27 -50
- package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +70 -199
- package/docs/ja/specdojo/rulebooks/itc-rulebook.md +65 -153
- package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +74 -150
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +11 -23
- package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +99 -176
- package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +35 -61
- package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +75 -117
- package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +31 -60
- package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +26 -81
- package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +32 -70
- package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +45 -87
- package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +48 -101
- package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +44 -80
- package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +59 -127
- package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +31 -50
- package/docs/ja/specdojo/rulebooks/opd-rulebook.md +42 -109
- package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +29 -42
- package/docs/ja/specdojo/rulebooks/opr-rulebook.md +29 -87
- package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +62 -84
- package/docs/ja/specdojo/rulebooks/otp-rulebook.md +11 -61
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +91 -106
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +25 -34
- package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +30 -53
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +23 -35
- package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +27 -45
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +37 -45
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +45 -46
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +37 -48
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +25 -29
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +28 -35
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +36 -41
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +5 -18
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +16 -37
- package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +23 -97
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +39 -57
- package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +43 -116
- package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +16 -51
- package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +47 -92
- package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +25 -84
- package/docs/ja/specdojo/rulebooks/sac-rulebook.md +44 -107
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +39 -49
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +42 -49
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +64 -89
- package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +90 -189
- package/docs/ja/specdojo/rulebooks/stc-rulebook.md +45 -105
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +6 -12
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +49 -68
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +51 -60
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +46 -50
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +39 -64
- package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +47 -60
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +69 -70
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +65 -72
- package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +35 -46
- package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +49 -66
- package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +64 -139
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +41 -108
- package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +49 -144
- package/docs/ja/specdojo/rulebooks/utc-rulebook.md +67 -155
- package/docs/ja/specdojo/samples/bds-sample.md +58 -71
- package/docs/ja/specdojo/samples/bes-index-sample.md +20 -37
- package/docs/ja/specdojo/samples/bes-sample.md +43 -53
- package/docs/ja/specdojo/samples/bps-sample.md +42 -54
- package/docs/ja/specdojo/samples/br-sample.md +40 -52
- package/docs/ja/specdojo/samples/ccd-sample.md +0 -1
- package/docs/ja/specdojo/samples/cdr-sample.md +78 -0
- package/docs/ja/specdojo/samples/cdsd-sample.md +47 -63
- package/docs/ja/specdojo/samples/clis-sample.md +70 -77
- package/docs/ja/specdojo/samples/dec-sample.md +2 -3
- package/docs/ja/specdojo/samples/ifx-api-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/job-sequence.yaml +67 -0
- package/docs/ja/specdojo/samples/mip-index-sample.md +98 -20
- package/docs/ja/specdojo/samples/pm-communication-plan-sample.md +26 -19
- package/docs/ja/specdojo/samples/pm-organization-sample.md +39 -50
- package/docs/ja/specdojo/samples/pm-plan-sample.md +61 -67
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +31 -45
- package/docs/ja/specdojo/samples/pm-raci-sample.md +31 -37
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +32 -48
- package/docs/ja/specdojo/samples/prj-charter-sample.md +42 -59
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +55 -61
- package/docs/ja/specdojo/samples/prj-success-criteria-and-acceptance-criteria-sample.md +30 -33
- package/docs/ja/specdojo/samples/sf-index-sample.md +13 -55
- package/docs/ja/specdojo/samples/sf-sample.md +73 -85
- package/docs/ja/specdojo/samples/sld-sample.md +60 -79
- package/docs/ja/specdojo/samples/uis-sample.md +98 -121
- package/docs/ja/specdojo/standards/job-definition-standard.md +24 -9
- package/docs/ja/specdojo/templates/cdr-template.md +58 -0
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +2 -1
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +42 -5
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +35 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +23 -0
- package/docs/specdojo/schemas/v1/job.schema.yaml +63 -2
- package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +2 -2
- package/package.json +9 -6
- package/templates/antigravity/orchestrator.md +4 -1
- package/templates/claude/agents/specdojo-orchestrator.md +4 -1
- package/templates/codex/agents/specdojo-orchestrator.toml +4 -1
- package/templates/codex/orchestrator.md +4 -1
- package/templates/init-exec-defaults.yaml +13 -0
- package/templates/lefthook/tools/specdojo-pre-commit.mjs +8 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +5 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerDeprecatedWhereAlias } from "../shared/where-alias.js";
|
|
1
2
|
import { warnDeprecated } from "../shared/deprecation.js";
|
|
2
3
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
4
|
import { join, resolve } from "node:path";
|
|
@@ -54,22 +55,21 @@ function buildTimelineJson(result) {
|
|
|
54
55
|
})),
|
|
55
56
|
}, null, 2) + "\n");
|
|
56
57
|
}
|
|
58
|
+
export function printTimelinePaths(opts) {
|
|
59
|
+
try {
|
|
60
|
+
const { timelinePath, catalogPath } = resolveTimelinePaths(opts);
|
|
61
|
+
process.stdout.write(`timeline-path: ${timelinePath}\n`);
|
|
62
|
+
process.stdout.write(`catalog-path: ${catalogPath ?? "(not configured)"}\n`);
|
|
63
|
+
const indexFile = join(timelinePath, "tml-index.yaml");
|
|
64
|
+
process.stdout.write(`tml-index: ${indexFile}${existsSync(indexFile) ? "" : " (does not exist)"}\n`);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
printCommandError(error);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
57
70
|
export function registerTimelineCommands(program) {
|
|
58
71
|
const tml = program.command("timeline").description("Timeline build commands");
|
|
59
|
-
|
|
60
|
-
addProjectOption(wcmd);
|
|
61
|
-
wcmd.action((opts) => {
|
|
62
|
-
try {
|
|
63
|
-
const { timelinePath, catalogPath } = resolveTimelinePaths(opts);
|
|
64
|
-
process.stdout.write(`timeline-path: ${timelinePath}\n`);
|
|
65
|
-
process.stdout.write(`catalog-path: ${catalogPath ?? "(not configured)"}\n`);
|
|
66
|
-
const indexFile = join(timelinePath, "tml-index.yaml");
|
|
67
|
-
process.stdout.write(`tml-index: ${indexFile}${existsSync(indexFile) ? "" : " (does not exist)"}\n`);
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
printCommandError(error);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
72
|
+
registerDeprecatedWhereAlias(tml, printTimelinePaths);
|
|
73
73
|
const bcmd = tml
|
|
74
74
|
.command("build")
|
|
75
75
|
.description("Deprecated: derive track order and catalog targets from epics and legacy tml-index.yaml");
|
|
@@ -10,8 +10,8 @@ function printCommandError(error) {
|
|
|
10
10
|
export function registerIndexCommands(program) {
|
|
11
11
|
const idx = program.command("index").description("Document ID index commands");
|
|
12
12
|
idx
|
|
13
|
-
.command("build")
|
|
14
|
-
.description("
|
|
13
|
+
.command("build", { hidden: true })
|
|
14
|
+
.description("Internal compatibility entry for build --only index")
|
|
15
15
|
.option("--root <path>", "Root directory to scan", "docs")
|
|
16
16
|
.option("--output <path>", "Output path", ".specdojo/doc-index.json")
|
|
17
17
|
.action((opts) => {
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { code, properties, records, recordTable, TableBody, valueText, } from "./yaml-table-shared.js";
|
|
2
|
+
export function renderBdd(doc) {
|
|
3
|
+
const body = new TableBody();
|
|
4
|
+
for (const entity of records(doc.entities)) {
|
|
5
|
+
body.section(valueText(entity.logical_name), [
|
|
6
|
+
properties(entity, [
|
|
7
|
+
["physical_name", "物理名"],
|
|
8
|
+
["description", "説明"],
|
|
9
|
+
["key_fields", "キー項目"],
|
|
10
|
+
["schema_ref", "正本スキーマ"],
|
|
11
|
+
["type_ref", "正本型定義"],
|
|
12
|
+
["glossary_term_id", "用語 ID"],
|
|
13
|
+
["related_terms", "関連用語"],
|
|
14
|
+
]),
|
|
15
|
+
recordTable(records(entity.fields), [
|
|
16
|
+
["logical_name", "論理名"],
|
|
17
|
+
["physical_name", "物理名"],
|
|
18
|
+
["description", "業務上の意味"],
|
|
19
|
+
["type", "型"],
|
|
20
|
+
["unit", "単位"],
|
|
21
|
+
["constraints", "制約"],
|
|
22
|
+
["allowed_values", "許容値"],
|
|
23
|
+
["allowed_values_detailed", "許容値と業務ラベル"],
|
|
24
|
+
["example", "例"],
|
|
25
|
+
["glossary_term_id", "用語 ID"],
|
|
26
|
+
]),
|
|
27
|
+
].join("\n\n"));
|
|
28
|
+
}
|
|
29
|
+
return body.render();
|
|
30
|
+
}
|
|
31
|
+
export function renderRoles(doc) {
|
|
32
|
+
const body = new TableBody();
|
|
33
|
+
body.section("採用ロール", recordTable(records(doc.roles), [
|
|
34
|
+
["code", "ロールコード"],
|
|
35
|
+
["name", "名称"],
|
|
36
|
+
["project_note", "プロジェクトでの責務・補足"],
|
|
37
|
+
]));
|
|
38
|
+
return body.render();
|
|
39
|
+
}
|
|
40
|
+
export function renderMembers(doc) {
|
|
41
|
+
const body = new TableBody();
|
|
42
|
+
body.section("メンバー", recordTable(records(doc.members), [
|
|
43
|
+
["nickname", "実行主体 ID"],
|
|
44
|
+
["display_name", "表示名"],
|
|
45
|
+
["roles", "ロール"],
|
|
46
|
+
["type", "種別"],
|
|
47
|
+
["focus", "担当領域"],
|
|
48
|
+
["note", "補足"],
|
|
49
|
+
]));
|
|
50
|
+
if (Array.isArray(doc.rules))
|
|
51
|
+
body.section("運用ルール", recordTable(doc.rules.map((rule) => ({ rule })), [["rule", "ルール"]]));
|
|
52
|
+
return body.render();
|
|
53
|
+
}
|
|
54
|
+
export function renderTimeline(doc) {
|
|
55
|
+
const body = new TableBody();
|
|
56
|
+
body.section("計画の前提", properties(doc, [
|
|
57
|
+
["planned_start_date", "予定開始日"],
|
|
58
|
+
["notes", "注記"],
|
|
59
|
+
]));
|
|
60
|
+
body.section("トラック順序", recordTable(records(doc.tracks), [
|
|
61
|
+
["track", "トラック"],
|
|
62
|
+
["domains", "ドメイン"],
|
|
63
|
+
["catalog_status", "カタログ状態"],
|
|
64
|
+
["catalog_duration_estimate_days", "カタログ整備の見積日数"],
|
|
65
|
+
["order", "順序"],
|
|
66
|
+
["parallel_group", "並行グループ"],
|
|
67
|
+
["depends_on", "先行トラック"],
|
|
68
|
+
["note", "補足"],
|
|
69
|
+
]));
|
|
70
|
+
return body.render();
|
|
71
|
+
}
|
|
72
|
+
export function renderMilestones(doc) {
|
|
73
|
+
const body = new TableBody();
|
|
74
|
+
body.section("マイルストーン", recordTable(records(doc.milestones), [
|
|
75
|
+
["id", "ID"],
|
|
76
|
+
["name", "名称"],
|
|
77
|
+
["artifact_name", "対象成果物"],
|
|
78
|
+
["depends_on", "先行タスク"],
|
|
79
|
+
["owner", "担当ロール"],
|
|
80
|
+
["date_hint", "目安日"],
|
|
81
|
+
["tags", "タグ"],
|
|
82
|
+
["notes", "注記"],
|
|
83
|
+
]));
|
|
84
|
+
if (Array.isArray(doc.tasks))
|
|
85
|
+
body.section("概要タスク", recordTable(records(doc.tasks), [
|
|
86
|
+
["id", "ID"],
|
|
87
|
+
["name", "名称"],
|
|
88
|
+
["owner", "担当ロール"],
|
|
89
|
+
["depends_on", "先行タスク"],
|
|
90
|
+
]));
|
|
91
|
+
return body.render();
|
|
92
|
+
}
|
|
93
|
+
export function renderViewpoints(doc) {
|
|
94
|
+
const body = new TableBody();
|
|
95
|
+
if (typeof doc.extends === "string") {
|
|
96
|
+
body.section("共通定義の継承", `共通定義: [[${doc.extends}]]。以下の表はこの YAML が宣言する差分です。同じ ID・ロールは上書きし、新しい値は追加します。空の表は差分なしを表します。`);
|
|
97
|
+
}
|
|
98
|
+
for (const [key, title, columns] of [
|
|
99
|
+
[
|
|
100
|
+
"categories",
|
|
101
|
+
"分類",
|
|
102
|
+
[
|
|
103
|
+
["id", "ID"],
|
|
104
|
+
["name", "名称"],
|
|
105
|
+
],
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"coverage_types",
|
|
109
|
+
"確認対象の分類",
|
|
110
|
+
[
|
|
111
|
+
["id", "ID"],
|
|
112
|
+
["name", "名称"],
|
|
113
|
+
["description", "説明"],
|
|
114
|
+
["applies_to", "適用先"],
|
|
115
|
+
],
|
|
116
|
+
],
|
|
117
|
+
[
|
|
118
|
+
"severity_levels",
|
|
119
|
+
"重大度",
|
|
120
|
+
[
|
|
121
|
+
["id", "ID"],
|
|
122
|
+
["description", "意味・扱い"],
|
|
123
|
+
],
|
|
124
|
+
],
|
|
125
|
+
[
|
|
126
|
+
"verdict_definitions",
|
|
127
|
+
"判定",
|
|
128
|
+
[
|
|
129
|
+
["id", "ID"],
|
|
130
|
+
["description", "意味・次の対応"],
|
|
131
|
+
],
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
"viewpoints",
|
|
135
|
+
"レビュー観点",
|
|
136
|
+
[
|
|
137
|
+
["id", "ID"],
|
|
138
|
+
["role", "ロール"],
|
|
139
|
+
["category", "分類"],
|
|
140
|
+
["title", "観点"],
|
|
141
|
+
["check", "確認内容"],
|
|
142
|
+
["evidence", "根拠"],
|
|
143
|
+
["default_severity", "重大度"],
|
|
144
|
+
["evaluation", "評価方法"],
|
|
145
|
+
],
|
|
146
|
+
],
|
|
147
|
+
[
|
|
148
|
+
"role_viewpoint_sets",
|
|
149
|
+
"ロール別観点",
|
|
150
|
+
[
|
|
151
|
+
["role", "ロール"],
|
|
152
|
+
["viewpoints", "観点 ID"],
|
|
153
|
+
],
|
|
154
|
+
],
|
|
155
|
+
]) {
|
|
156
|
+
if (Array.isArray(doc[key]))
|
|
157
|
+
body.section(title, recordTable(records(doc[key]), columns.map(([field, label]) => [field, label])));
|
|
158
|
+
}
|
|
159
|
+
// 適用条件を省くと観点を誤用するため、指定された観点だけ補表で示す。
|
|
160
|
+
const scoped = records(doc.viewpoints).filter((item) => item.document_kinds || item.grade_targets || item.comparison_sources || item.coverage_types);
|
|
161
|
+
if (scoped.length)
|
|
162
|
+
body.section("観点の適用条件", recordTable(scoped, [
|
|
163
|
+
["id", "観点 ID"],
|
|
164
|
+
["coverage_types", "確認対象"],
|
|
165
|
+
["grade_targets", "評価対象"],
|
|
166
|
+
["comparison_sources", "比較元"],
|
|
167
|
+
["document_kinds", "文書種別の条件"],
|
|
168
|
+
]));
|
|
169
|
+
if (doc.disabled !== undefined)
|
|
170
|
+
body.section("無効化する共通定義", properties(doc.disabled));
|
|
171
|
+
if (doc.grade_rubric !== undefined)
|
|
172
|
+
body.section("採点基準", properties(doc.grade_rubric));
|
|
173
|
+
return body.render();
|
|
174
|
+
}
|
|
175
|
+
export function renderDctIndex(doc) {
|
|
176
|
+
const body = new TableBody();
|
|
177
|
+
body.section("カタログの設定", properties(doc, [
|
|
178
|
+
["project_id", "プロジェクト"],
|
|
179
|
+
["size", "規模"],
|
|
180
|
+
]));
|
|
181
|
+
const visit = (groups, parent) => {
|
|
182
|
+
for (const group of groups) {
|
|
183
|
+
const name = [parent, valueText(group.name)].filter(Boolean).join(" / ");
|
|
184
|
+
if (Array.isArray(group.domains))
|
|
185
|
+
body.section(name, recordTable(records(group.domains), [
|
|
186
|
+
["domain", "ドメイン"],
|
|
187
|
+
["name", "名称"],
|
|
188
|
+
["overview", "概要"],
|
|
189
|
+
]));
|
|
190
|
+
visit(records(group.groups), name);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
visit(records(doc.groups), "");
|
|
194
|
+
return body.render();
|
|
195
|
+
}
|
|
196
|
+
export function renderDct(doc) {
|
|
197
|
+
const body = new TableBody();
|
|
198
|
+
body.section("カタログの設定", properties(doc, [
|
|
199
|
+
["project_id", "プロジェクト"],
|
|
200
|
+
["domain", "ドメイン"],
|
|
201
|
+
["base_path", "基準パス"],
|
|
202
|
+
]));
|
|
203
|
+
const visit = (groups, parent) => {
|
|
204
|
+
for (const group of groups) {
|
|
205
|
+
const name = [parent, group.name ? valueText(group.name) : ""].filter(Boolean).join(" / ");
|
|
206
|
+
const items = records(group.deliverables);
|
|
207
|
+
if (items.length) {
|
|
208
|
+
body.section(name || "成果物", [
|
|
209
|
+
properties(group, [
|
|
210
|
+
["base_path", "配置先(親からの相対パス)"],
|
|
211
|
+
["note", "注記"],
|
|
212
|
+
]),
|
|
213
|
+
recordTable(items, [
|
|
214
|
+
["local_id", "成果物 ID"],
|
|
215
|
+
["name", "名称"],
|
|
216
|
+
["kind", "種別"],
|
|
217
|
+
["depends_on", "根拠"],
|
|
218
|
+
["overview", "概要"],
|
|
219
|
+
]),
|
|
220
|
+
...items
|
|
221
|
+
.filter((item) => item.done_criteria || item.path || item.brief)
|
|
222
|
+
.map((item) => [
|
|
223
|
+
`**${code(String(item.local_id))}**`,
|
|
224
|
+
properties(item, [
|
|
225
|
+
["path", "パス"],
|
|
226
|
+
["rulebook", "準拠ルール"],
|
|
227
|
+
["brief", "作成指示"],
|
|
228
|
+
["note", "注記"],
|
|
229
|
+
]),
|
|
230
|
+
recordTable(records(item.done_criteria), [
|
|
231
|
+
["text", "完了条件"],
|
|
232
|
+
["roles", "確認ロール"],
|
|
233
|
+
["viewpoint", "観点 ID"],
|
|
234
|
+
]),
|
|
235
|
+
].join("\n\n")),
|
|
236
|
+
].join("\n\n"));
|
|
237
|
+
}
|
|
238
|
+
visit(records(group.groups), name);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
visit(records(doc.groups), "");
|
|
242
|
+
return body.render();
|
|
243
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { isRecord, properties, records, recordTable, TableBody, table, valueText, code, } from "./yaml-table-shared.js";
|
|
2
|
+
export function renderCommand(doc) {
|
|
3
|
+
const body = new TableBody();
|
|
4
|
+
body.section("コマンド", properties(doc.command, [
|
|
5
|
+
["executable", "実行ファイル"],
|
|
6
|
+
["subcommands", "サブコマンド"],
|
|
7
|
+
["purpose", "目的"],
|
|
8
|
+
["reference", "仕様の参照先"],
|
|
9
|
+
["version_constraint", "バージョン制約"],
|
|
10
|
+
["shell", "シェル経由"],
|
|
11
|
+
]));
|
|
12
|
+
if (Array.isArray(doc.arguments))
|
|
13
|
+
body.section("引数", recordTable(records(doc.arguments), [
|
|
14
|
+
["name", "名称"],
|
|
15
|
+
["kind", "種別"],
|
|
16
|
+
["position", "位置"],
|
|
17
|
+
["required", "必須"],
|
|
18
|
+
["value_type", "値の型"],
|
|
19
|
+
["value_source", "値の供給元"],
|
|
20
|
+
["description", "説明"],
|
|
21
|
+
["example", "例"],
|
|
22
|
+
]));
|
|
23
|
+
const streams = isRecord(doc.streams) ? doc.streams : {};
|
|
24
|
+
body.section("標準入出力", table(["ストリーム", "モード", "形式", "文字コード", "契約"], Object.entries(streams).map(([name, stream]) => {
|
|
25
|
+
const item = isRecord(stream) ? stream : {};
|
|
26
|
+
return [name, ...[item.mode, item.format, item.encoding, item.description].map(valueText)];
|
|
27
|
+
})));
|
|
28
|
+
const files = isRecord(doc.files) ? doc.files : {};
|
|
29
|
+
for (const [key, title] of [
|
|
30
|
+
["inputs", "入力ファイル"],
|
|
31
|
+
["outputs", "出力ファイル"],
|
|
32
|
+
]) {
|
|
33
|
+
if (Array.isArray(files[key]))
|
|
34
|
+
body.section(title, recordTable(records(files[key]), [
|
|
35
|
+
["path", "パス"],
|
|
36
|
+
["format", "形式"],
|
|
37
|
+
["encoding", "文字コード"],
|
|
38
|
+
["description", "契約"],
|
|
39
|
+
]));
|
|
40
|
+
}
|
|
41
|
+
body.section("終了コード", recordTable(records(doc.exit_codes), [
|
|
42
|
+
["code", "コード"],
|
|
43
|
+
["meaning", "意味・判定条件"],
|
|
44
|
+
["category", "分類"],
|
|
45
|
+
["retryable", "再試行可否"],
|
|
46
|
+
]));
|
|
47
|
+
for (const [key, title] of [
|
|
48
|
+
["authentication", "認証"],
|
|
49
|
+
["execution", "実行制御"],
|
|
50
|
+
["error_handling", "異常時の扱い"],
|
|
51
|
+
])
|
|
52
|
+
body.section(title, properties(doc[key]));
|
|
53
|
+
body.section("副作用", table(["内容"], [[valueText(doc.side_effects)]]));
|
|
54
|
+
return body.render();
|
|
55
|
+
}
|
|
56
|
+
// IFX-FILE には専用 schema がないため、ifx-file-rulebook と正本の契約単位に沿って示す。
|
|
57
|
+
export function renderFileInterface(doc) {
|
|
58
|
+
const body = new TableBody();
|
|
59
|
+
body.section("連携の概要", properties(doc, [
|
|
60
|
+
["source", "連携元"],
|
|
61
|
+
["target", "連携先"],
|
|
62
|
+
["direction", "向き"],
|
|
63
|
+
["format", "形式"],
|
|
64
|
+
["timing", "タイミング"],
|
|
65
|
+
]));
|
|
66
|
+
body.section("受け渡すファイル", recordTable(records(doc.files), [
|
|
67
|
+
["name", "名称"],
|
|
68
|
+
["location", "配置"],
|
|
69
|
+
["description", "説明"],
|
|
70
|
+
["writer", "書き手"],
|
|
71
|
+
["reader", "読み手"],
|
|
72
|
+
["format", "形式"],
|
|
73
|
+
]));
|
|
74
|
+
for (const file of records(doc.files)) {
|
|
75
|
+
body.section(`ファイル契約: ${code(String(file.name))}`, properties(file, [
|
|
76
|
+
["naming_rule", "命名規則"],
|
|
77
|
+
["encoding", "文字コード"],
|
|
78
|
+
["schema_ref", "正本の型"],
|
|
79
|
+
["required_fields", "必須項目"],
|
|
80
|
+
]));
|
|
81
|
+
}
|
|
82
|
+
for (const [key, title] of [
|
|
83
|
+
["transport", "配送・書き込み"],
|
|
84
|
+
["schema", "データ契約"],
|
|
85
|
+
["error_handling", "異常時の扱い"],
|
|
86
|
+
])
|
|
87
|
+
body.section(title, properties(doc[key]));
|
|
88
|
+
const verification = isRecord(doc.verification) ? doc.verification : {};
|
|
89
|
+
body.section("検証方法", properties(verification, [
|
|
90
|
+
["procedure", "手順"],
|
|
91
|
+
["file_checks", "ファイルごとの確認"],
|
|
92
|
+
]));
|
|
93
|
+
body.section("検証ケース", recordTable(records(verification.cases), [
|
|
94
|
+
["id", "ケース ID"],
|
|
95
|
+
["viewpoint", "観点"],
|
|
96
|
+
["expected", "期待結果"],
|
|
97
|
+
]));
|
|
98
|
+
body.section("未決事項", recordTable(records(doc.open_decisions), [
|
|
99
|
+
["id", "ID"],
|
|
100
|
+
["topic", "論点"],
|
|
101
|
+
["impact", "影響"],
|
|
102
|
+
["owner", "担当"],
|
|
103
|
+
["next_action", "次の対応"],
|
|
104
|
+
]));
|
|
105
|
+
return body.render();
|
|
106
|
+
}
|
|
@@ -7,10 +7,12 @@ function printCommandError(error) {
|
|
|
7
7
|
process.exitCode = 1;
|
|
8
8
|
}
|
|
9
9
|
export function registerYamlPagesCommands(program) {
|
|
10
|
-
const cmd = program
|
|
10
|
+
const cmd = program
|
|
11
|
+
.command("yaml-pages", { hidden: true })
|
|
12
|
+
.description("YAML display page commands");
|
|
11
13
|
cmd
|
|
12
|
-
.command("build")
|
|
13
|
-
.description("
|
|
14
|
+
.command("build", { hidden: true })
|
|
15
|
+
.description("Internal compatibility entry for build --only yaml-pages")
|
|
14
16
|
.option("--root <path>", "Root directory to scan", "docs")
|
|
15
17
|
.action((opts) => {
|
|
16
18
|
try {
|
package/dist/docs/yaml-pages.js
CHANGED
|
@@ -3,6 +3,7 @@ import { dirname, join, posix } from "node:path";
|
|
|
3
3
|
import { dump, load } from "../shared/yaml.js";
|
|
4
4
|
import { collectDocIndexEntries } from "./doc-index.js";
|
|
5
5
|
import { isDctTemplateCatalog, renderCatalogTemplateBody } from "../shared/catalog-render.js";
|
|
6
|
+
import { renderTypedYamlTable } from "./yaml-tables.js";
|
|
6
7
|
// YAML は VitePress のページにならないため、doc-index に載っている YAML ごとに
|
|
7
8
|
// 同階層の generated/<name>.md へ表示用ページを生成する。
|
|
8
9
|
// wikilink・frontmatter リンクはこのページへ解決される。
|
|
@@ -118,6 +119,143 @@ function renderGlossaryBody(doc, terms) {
|
|
|
118
119
|
lines.push("", `## ${++chapter}. YAML の正本`, "");
|
|
119
120
|
return lines.join("\n");
|
|
120
121
|
}
|
|
122
|
+
const IFX_MODELINE_RE = /^#\s*(?:yaml-language-server:|specdojo-schema:)/;
|
|
123
|
+
function collectIfxIndexComments(content) {
|
|
124
|
+
const result = { document: [], interfaces: [] };
|
|
125
|
+
let inInterfaces = false;
|
|
126
|
+
let itemIndent = -1;
|
|
127
|
+
let pending = [];
|
|
128
|
+
let group;
|
|
129
|
+
let groupTarget = result.document;
|
|
130
|
+
let previousWasComment = false;
|
|
131
|
+
for (const line of content.split(/\r?\n/)) {
|
|
132
|
+
const trimmed = line.trim();
|
|
133
|
+
const indent = line.length - line.trimStart().length;
|
|
134
|
+
if (trimmed.startsWith("#")) {
|
|
135
|
+
if (IFX_MODELINE_RE.test(trimmed))
|
|
136
|
+
continue;
|
|
137
|
+
// 連携の内側(ダッシュより深い字下げ)は今の連携、ダッシュと同じ字下げは次の連携、
|
|
138
|
+
// 行頭のコメントは一覧全体の注記とする。
|
|
139
|
+
const current = result.interfaces.at(-1);
|
|
140
|
+
const target = !inInterfaces || indent === 0
|
|
141
|
+
? result.document
|
|
142
|
+
: current !== undefined && indent > itemIndent
|
|
143
|
+
? current
|
|
144
|
+
: pending;
|
|
145
|
+
if (!previousWasComment || target !== groupTarget) {
|
|
146
|
+
group = [];
|
|
147
|
+
target.push(group);
|
|
148
|
+
groupTarget = target;
|
|
149
|
+
}
|
|
150
|
+
group?.push(trimmed.replace(/^#\s?/, ""));
|
|
151
|
+
previousWasComment = true;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
previousWasComment = false;
|
|
155
|
+
if (trimmed === "")
|
|
156
|
+
continue;
|
|
157
|
+
if (indent === 0) {
|
|
158
|
+
result.document.push(...pending);
|
|
159
|
+
pending = [];
|
|
160
|
+
inInterfaces = /^interfaces:\s*$/.test(line);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (inInterfaces && trimmed.startsWith("- ") && (itemIndent === -1 || indent === itemIndent)) {
|
|
164
|
+
itemIndent = indent;
|
|
165
|
+
result.interfaces.push(pending);
|
|
166
|
+
pending = [];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
result.document.push(...pending);
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
172
|
+
const IFX_DIRECTION_LABELS = {
|
|
173
|
+
source_to_target: "連携元 → 連携先",
|
|
174
|
+
target_to_source: "連携先 → 連携元",
|
|
175
|
+
bidirectional: "双方向",
|
|
176
|
+
};
|
|
177
|
+
const IFX_LABEL_RE = /_(?:TODO|UNDECIDED|ASSUMPTION)_/g;
|
|
178
|
+
function ifxSpecRefCell(specRef, docId) {
|
|
179
|
+
if (specRef === "")
|
|
180
|
+
return "未記入";
|
|
181
|
+
if (specRef === "TBD")
|
|
182
|
+
return "未整備(TBD)";
|
|
183
|
+
// 成果物の wikilink は project 修飾 ID で解決するため、修飾のない参照には一覧の修飾を補う。
|
|
184
|
+
const prefix = docId.includes(":") ? `${docId.slice(0, docId.indexOf(":"))}:` : "";
|
|
185
|
+
return `[[${specRef.includes(":") ? specRef : `${prefix}${specRef}`}]]`;
|
|
186
|
+
}
|
|
187
|
+
function renderIfxIndexBody(doc, interfaces, content) {
|
|
188
|
+
const comments = collectIfxIndexComments(content);
|
|
189
|
+
const docId = glossaryText(doc.id);
|
|
190
|
+
const tbdCount = interfaces.filter((item) => glossaryText(item.spec_ref) === "TBD").length;
|
|
191
|
+
const paragraphs = (groups) => groups.flatMap((lines) => [lines.join("\n"), ""]);
|
|
192
|
+
const lines = [
|
|
193
|
+
"<!-- prettier-ignore -->",
|
|
194
|
+
"| ID | 状態 | 連携の数 | 詳細仕様が未整備(TBD) |",
|
|
195
|
+
"| --- | --- | --- | --- |",
|
|
196
|
+
`| ${[docId, glossaryText(doc.status)].map((value) => glossaryCell(value) || "-").join(" | ")} | ${interfaces.length} | ${tbdCount} |`,
|
|
197
|
+
"",
|
|
198
|
+
"## 1. 連携の一覧",
|
|
199
|
+
"",
|
|
200
|
+
"<!-- prettier-ignore -->",
|
|
201
|
+
"| No | 連携名 | 連携先 | 向き | 種別 | 形式 | 詳細仕様 | 注記 |",
|
|
202
|
+
"| --- | --- | --- | --- | --- | --- | --- | --- |",
|
|
203
|
+
];
|
|
204
|
+
interfaces.forEach((item, index) => {
|
|
205
|
+
const notes = comments.interfaces[index] ?? [];
|
|
206
|
+
const labels = [...new Set(notes.flat().join("\n").match(IFX_LABEL_RE) ?? [])];
|
|
207
|
+
const noteCell = notes.length === 0
|
|
208
|
+
? "-"
|
|
209
|
+
: [
|
|
210
|
+
`[${notes.length} 件](#ifx-${index + 1})`,
|
|
211
|
+
...labels.map((label) => `\`${label}\``),
|
|
212
|
+
].join(" ");
|
|
213
|
+
const direction = glossaryText(item.direction);
|
|
214
|
+
const cells = [
|
|
215
|
+
String(index + 1),
|
|
216
|
+
`[${glossaryText(item.name).replace(/[[\]\\]/g, "\\$&")}](#ifx-${index + 1})`,
|
|
217
|
+
glossaryText(item.target),
|
|
218
|
+
IFX_DIRECTION_LABELS[direction] ?? direction,
|
|
219
|
+
glossaryText(item.kind),
|
|
220
|
+
glossaryText(item.format),
|
|
221
|
+
ifxSpecRefCell(glossaryText(item.spec_ref), docId),
|
|
222
|
+
noteCell,
|
|
223
|
+
];
|
|
224
|
+
lines.push(`| ${cells.map((cell) => glossaryCell(cell) || "-").join(" | ")} |`);
|
|
225
|
+
});
|
|
226
|
+
lines.push("", "## 2. 連携ごとの詳細", "");
|
|
227
|
+
interfaces.forEach((item, index) => {
|
|
228
|
+
const name = glossaryText(item.name);
|
|
229
|
+
const direction = glossaryText(item.direction);
|
|
230
|
+
const rows = [
|
|
231
|
+
["連携名", `<a id="ifx-${index + 1}">${escapeAnchorText(name)}</a>`],
|
|
232
|
+
["連携元", glossaryText(item.source)],
|
|
233
|
+
["連携先", glossaryText(item.target)],
|
|
234
|
+
["向き", IFX_DIRECTION_LABELS[direction] ?? direction],
|
|
235
|
+
["種別", glossaryText(item.kind)],
|
|
236
|
+
["形式", glossaryText(item.format)],
|
|
237
|
+
["タイミング", glossaryText(item.timing)],
|
|
238
|
+
["異常時の扱い", glossaryText(item.error_handling)],
|
|
239
|
+
["詳細仕様", ifxSpecRefCell(glossaryText(item.spec_ref), docId)],
|
|
240
|
+
];
|
|
241
|
+
lines.push(`### 2.${index + 1}. ${glossaryCell(name) || "-"}`, "", "<!-- prettier-ignore -->", "| 項目 | 内容 |", "| --- | --- |", ...rows.map(([label, value]) => `| ${label} | ${glossaryCell(value) || "-"} |`), "");
|
|
242
|
+
const notes = comments.interfaces[index] ?? [];
|
|
243
|
+
if (notes.length > 0)
|
|
244
|
+
lines.push("注記(YAML のコメント):", "", ...paragraphs(notes));
|
|
245
|
+
});
|
|
246
|
+
let chapter = 2;
|
|
247
|
+
if (comments.document.length > 0) {
|
|
248
|
+
lines.push(`## ${++chapter}. 一覧全体の注記`, "", ...paragraphs(comments.document));
|
|
249
|
+
}
|
|
250
|
+
lines.push(`## ${++chapter}. YAML の正本`, "");
|
|
251
|
+
return lines.join("\n");
|
|
252
|
+
}
|
|
253
|
+
function isIfxIndex(yamlRelPath, parsed) {
|
|
254
|
+
return (/^ifx-index(?:-[a-z0-9-]+)?\.ya?ml$/.test(posix.basename(yamlRelPath)) &&
|
|
255
|
+
isRecord(parsed) &&
|
|
256
|
+
parsed.type === "api" &&
|
|
257
|
+
Array.isArray(parsed.interfaces));
|
|
258
|
+
}
|
|
121
259
|
// doc-index の "path:42" 形式から行番号サフィックスを除去する。
|
|
122
260
|
function stripLineSuffix(entry) {
|
|
123
261
|
const colonIndex = entry.lastIndexOf(":");
|
|
@@ -225,8 +363,13 @@ export function renderYamlPage(yamlRelPath, content) {
|
|
|
225
363
|
const longestRun = backtickRuns.reduce((max, run) => Math.max(max, run.length), 0);
|
|
226
364
|
const fence = "`".repeat(Math.max(3, longestRun + 1));
|
|
227
365
|
const body = content.endsWith("\n") ? content : `${content}\n`;
|
|
228
|
-
|
|
229
|
-
|
|
366
|
+
// 対応する文書系列は表で本文を描き、YAML の正本を折りたたんで添える。
|
|
367
|
+
const tableBody = isRecord(parsed) && parsed.type === "glossary" && Array.isArray(parsed.terms)
|
|
368
|
+
? renderGlossaryBody(parsed, parsed.terms.filter(isRecord))
|
|
369
|
+
: isIfxIndex(yamlRelPath, parsed)
|
|
370
|
+
? renderIfxIndexBody(parsed, parsed.interfaces.filter(isRecord), content)
|
|
371
|
+
: renderTypedYamlTable(yamlRelPath, parsed);
|
|
372
|
+
if (tableBody !== undefined) {
|
|
230
373
|
return [
|
|
231
374
|
...header,
|
|
232
375
|
`# ${heading}`,
|
|
@@ -235,7 +378,7 @@ export function renderYamlPage(yamlRelPath, content) {
|
|
|
235
378
|
"",
|
|
236
379
|
YAML_PAGE_MARKER,
|
|
237
380
|
"",
|
|
238
|
-
|
|
381
|
+
tableBody,
|
|
239
382
|
"<details>",
|
|
240
383
|
"<summary>YAML の正本を表示</summary>",
|
|
241
384
|
"",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export function isRecord(value) {
|
|
2
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
export function records(value) {
|
|
5
|
+
return Array.isArray(value) ? value.filter(isRecord) : [];
|
|
6
|
+
}
|
|
7
|
+
export function code(value) {
|
|
8
|
+
const runs = value.match(/`+/g) ?? [];
|
|
9
|
+
const fence = "`".repeat(Math.max(1, ...runs.map((run) => run.length + 1)));
|
|
10
|
+
return `${fence} ${value} ${fence}`.replace(/^` ([^`]+) `$/, "`$1`");
|
|
11
|
+
}
|
|
12
|
+
// Markdown の参照とコードを保ち、YAML に含まれるパスのプレースホルダを HTML として解釈させない。
|
|
13
|
+
function text(value) {
|
|
14
|
+
return value
|
|
15
|
+
.split(/(`+[^`]*`+|\[\[[^\]]+\]\]|\[[^\]]*\]\([^)]*\)|https?:\/\/[^\s<>]+)/g)
|
|
16
|
+
.map((part, index) => {
|
|
17
|
+
if (index % 2 === 1)
|
|
18
|
+
return /^https?:/.test(part) ? `<${part}>` : part;
|
|
19
|
+
return part
|
|
20
|
+
.replace(/&/g, "&")
|
|
21
|
+
.replace(/</g, "<")
|
|
22
|
+
.replace(/>/g, ">")
|
|
23
|
+
.replace(/\b[a-zA-Z0-9]+(?:_[a-zA-Z0-9]+)+\b/g, (identifier) => code(identifier));
|
|
24
|
+
})
|
|
25
|
+
.join("");
|
|
26
|
+
}
|
|
27
|
+
export function valueText(value) {
|
|
28
|
+
if (value === undefined || value === null || value === "")
|
|
29
|
+
return "-";
|
|
30
|
+
if (value instanceof Date)
|
|
31
|
+
return value.toISOString().slice(0, 10);
|
|
32
|
+
if (Array.isArray(value))
|
|
33
|
+
return value.length ? value.map(valueText).join(" / ") : "-";
|
|
34
|
+
if (isRecord(value)) {
|
|
35
|
+
return (Object.entries(value)
|
|
36
|
+
.map(([key, entry]) => `${code(key)}: ${valueText(entry)}`)
|
|
37
|
+
.join(" / ") || "-");
|
|
38
|
+
}
|
|
39
|
+
return text(String(value));
|
|
40
|
+
}
|
|
41
|
+
export function cell(value) {
|
|
42
|
+
return value
|
|
43
|
+
.replace(/\s*[\r\n]+\s*/g, " ")
|
|
44
|
+
.replace(/(\\*)\|/g, (_match, slashes) => `${slashes}${slashes.length % 2 === 0 ? "\\" : ""}|`);
|
|
45
|
+
}
|
|
46
|
+
export function table(headers, rows) {
|
|
47
|
+
return [
|
|
48
|
+
"<!-- prettier-ignore -->",
|
|
49
|
+
`| ${headers.join(" | ")} |`,
|
|
50
|
+
`| ${headers.map(() => "---").join(" | ")} |`,
|
|
51
|
+
...rows.map((row) => `| ${row.map((entry) => cell(entry) || "-").join(" | ")} |`),
|
|
52
|
+
].join("\n");
|
|
53
|
+
}
|
|
54
|
+
export function recordTable(items, columns) {
|
|
55
|
+
return table(columns.map(([, label]) => label), items.map((item) => columns.map(([key]) => valueText(item[key]))));
|
|
56
|
+
}
|
|
57
|
+
export function properties(value, columns) {
|
|
58
|
+
const entries = isRecord(value) ? value : {};
|
|
59
|
+
const selected = columns ?? Object.keys(entries).map((key) => [key, code(key)]);
|
|
60
|
+
return table(["項目", "内容"], selected.map(([key, label]) => [label, valueText(entries[key])]));
|
|
61
|
+
}
|
|
62
|
+
export class TableBody {
|
|
63
|
+
sections = [];
|
|
64
|
+
section(title, body) {
|
|
65
|
+
this.sections.push(`## ${this.sections.length + 1}. ${title}\n\n${body}`);
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
return [...this.sections, `## ${this.sections.length + 1}. YAML の正本\n`].join("\n\n");
|
|
69
|
+
}
|
|
70
|
+
}
|