specdojo 0.3.1 → 0.4.1
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 +61 -2
- package/CHANGELOG.md +90 -0
- package/README.md +85 -25
- package/dist/{catalog-build-references.js → catalog/build-references.js} +4 -4
- package/dist/catalog/build-render.js +32 -0
- package/dist/{catalog-build.js → catalog/build.js} +9 -9
- package/dist/{catalog.js → catalog/catalog.js} +10 -10
- package/dist/{catalog-generate.js → catalog/generate.js} +8 -8
- package/dist/catalog/paths.js +1 -0
- package/dist/{catalog-plan-generate.js → catalog/plan-generate.js} +4 -4
- package/dist/{catalog-plan.js → catalog/plan.js} +4 -4
- package/dist/{catalog-scaffold.js → catalog/scaffold.js} +3 -3
- package/dist/{agent.js → commands/agent.js} +11 -11
- package/dist/{build-command.js → commands/build.js} +2 -2
- package/dist/{init-command.js → commands/init.js} +168 -45
- package/dist/commands/night-orchestrator.js +287 -0
- package/dist/{orchestrator.js → commands/orchestrator.js} +12 -5
- package/dist/{watch.js → commands/watch.js} +3 -3
- package/dist/{dashboard-timeline.js → dashboard/dashboard-timeline.js} +2 -2
- package/dist/{dashboard.js → dashboard/dashboard.js} +11 -10
- package/dist/{dashboard-exec-records.js → dashboard/exec-records.js} +2 -2
- package/dist/{dashboard-routines.js → dashboard/routines.js} +6 -5
- package/dist/{dashboard-shared.js → dashboard/shared.js} +1 -1
- package/dist/{timeline-build.js → dashboard/timeline-build.js} +2 -1
- package/dist/{timeline.js → dashboard/timeline.js} +1 -1
- package/dist/{deliverable.js → deliverable/deliverable.js} +5 -5
- package/dist/{deliverable-trash.js → deliverable/trash.js} +5 -5
- package/dist/{devcontainer-command.js → devcontainer/command.js} +8 -4
- package/dist/devcontainer/scaffold.js +418 -0
- package/dist/{doc-index.js → docs/doc-index.js} +1 -1
- package/dist/{frontmatter-namespace.js → docs/frontmatter-namespace.js} +1 -1
- package/dist/{index-command.js → docs/index-command.js} +1 -1
- package/dist/docs/template-resolution.js +1 -0
- package/dist/{viewpoint-document-kinds-check.js → docs/viewpoint-document-kinds-check.js} +1 -1
- package/dist/{yaml-pages-command.js → docs/yaml-pages-command.js} +1 -1
- package/dist/{yaml-pages.js → docs/yaml-pages.js} +2 -2
- package/dist/{exec-agent-config.js → exec/agent-config.js} +92 -5
- package/dist/{exec-agent-git-state.js → exec/agent-git-state.js} +1 -1
- package/dist/{exec-agent-protected-config.js → exec/agent-protected-config.js} +1 -1
- package/dist/{exec-commands.js → exec/commands.js} +22 -18
- package/dist/{exec-core.js → exec/core.js} +11 -11
- package/dist/{exec-events.js → exec/events.js} +2 -2
- package/dist/{exec-evidence.js → exec/evidence.js} +11 -6
- package/dist/exec/exec.js +2 -0
- package/dist/exec/format.js +1 -0
- package/dist/{exec-handoff.js → exec/handoff.js} +13 -12
- package/dist/{exec-limit.js → exec/limit.js} +93 -12
- package/dist/{exec-parent-validation.js → exec/parent-validation.js} +18 -4
- package/dist/{exec-pipeline-state.js → exec/pipeline-state.js} +29 -2
- package/dist/{exec-plans-core.js → exec/plans-core.js} +68 -114
- package/dist/{exec-plans-generation.js → exec/plans-generation.js} +53 -10
- package/dist/{exec-plans-storage.js → exec/plans-storage.js} +5 -5
- package/dist/{exec-plans.js → exec/plans.js} +3 -3
- package/dist/{exec-project.js → exec/project.js} +1 -1
- package/dist/{exec-protection-handoff.js → exec/protection-handoff.js} +3 -3
- package/dist/{exec-register-resume.js → exec/register-resume.js} +2 -2
- package/dist/{exec-register.js → exec/register.js} +114 -9
- package/dist/{exec-repo-integration-git.js → exec/repo-integration-git.js} +2 -2
- package/dist/{exec-repo-integration-sync.js → exec/repo-integration-sync.js} +4 -4
- package/dist/{exec-repo-integration.js → exec/repo-integration.js} +14 -11
- package/dist/{exec-repo-trace.js → exec/repo-trace.js} +3 -3
- package/dist/{exec-reporter-output.js → exec/reporter-output.js} +2 -2
- package/dist/{exec-reporter.js → exec/reporter.js} +142 -25
- package/dist/{exec-results.js → exec/results.js} +287 -31
- package/dist/{exec-run-agent-pipeline.js → exec/run/agent-pipeline.js} +35 -12
- package/dist/{exec-run-agent.js → exec/run/agent.js} +115 -28
- package/dist/{exec-run-in-place.js → exec/run/in-place.js} +56 -27
- package/dist/{exec-run-job.js → exec/run/job.js} +65 -36
- package/dist/{exec-run-lifecycle-commands.js → exec/run/lifecycle-commands.js} +30 -22
- package/dist/{exec-run-lock.js → exec/run/lock.js} +4 -3
- package/dist/{exec-run-mode-shared.js → exec/run/mode-shared.js} +3 -3
- package/dist/{exec-run-register-command.js → exec/run/register-command.js} +38 -11
- package/dist/{exec-run-register-core.js → exec/run/register-core.js} +63 -21
- package/dist/{exec-run-register-mode.js → exec/run/register-mode.js} +58 -31
- package/dist/exec/run/register-post-review.js +420 -0
- package/dist/{exec-run-register-resume.js → exec/run/register-resume.js} +48 -27
- package/dist/{exec-run-register-state.js → exec/run/register-state.js} +13 -10
- package/dist/{exec-run-register-worktree.js → exec/run/register-worktree.js} +119 -24
- package/dist/{exec-run.js → exec/run/run.js} +11 -11
- package/dist/{exec-run-schedule-mode.js → exec/run/schedule-mode.js} +17 -17
- package/dist/{exec-run-schedule-prepare.js → exec/run/schedule-prepare.js} +31 -18
- package/dist/{exec-run-schedule-task.js → exec/run/schedule-task.js} +45 -18
- package/dist/{exec-run-shared.js → exec/run/shared.js} +78 -30
- package/dist/{exec-schedule-calendar.js → exec/schedule/calendar.js} +1 -1
- package/dist/{exec-schedule-cpm.js → exec/schedule/cpm.js} +2 -2
- package/dist/{exec-schedule-gantt-chart-render.js → exec/schedule/gantt-chart-render.js} +2 -2
- package/dist/exec/schedule/gantt-chart.js +2 -0
- package/dist/{exec-schedule-hash.js → exec/schedule/hash.js} +2 -2
- package/dist/exec/schedule/index.js +1 -0
- package/dist/{exec-schedule-initial.js → exec/schedule/initial.js} +2 -2
- package/dist/{exec-schedule-progress.js → exec/schedule/progress.js} +2 -2
- package/dist/{exec-schedule-ready.js → exec/schedule/ready.js} +2 -2
- package/dist/{exec-schedule.js → exec/schedule/schedule.js} +11 -11
- package/dist/exec/shared.js +63 -0
- package/dist/exec/slot-lock.js +1 -0
- package/dist/{exec-strategy.js → exec/strategy.js} +2 -2
- package/dist/{exec-task-repos.js → exec/task-repos.js} +104 -17
- package/dist/{exec-task-view.js → exec/task-view.js} +4 -4
- package/dist/{exec-trial-commands.js → exec/trial-commands.js} +20 -22
- package/dist/{exec-trial-core.js → exec/trial-core.js} +6 -6
- package/dist/{exec-trial.js → exec/trial.js} +2 -2
- package/dist/{exec-worktree-command.js → exec/worktree-command.js} +25 -23
- package/dist/{exec-worktree-ops-commit.js → exec/worktree-ops-commit.js} +25 -60
- package/dist/{exec-worktree-ops-lifecycle.js → exec/worktree-ops-lifecycle.js} +13 -8
- package/dist/{exec-worktree-ops-merge.js → exec/worktree-ops-merge.js} +48 -7
- package/dist/{exec-worktree-ops.js → exec/worktree-ops.js} +3 -3
- package/dist/exec/worktree.js +305 -0
- package/dist/{grade-apply.js → grade/apply.js} +9 -9
- package/dist/{grade-command-apply.js → grade/command-apply.js} +7 -7
- package/dist/{grade-command-inspect.js → grade/command-inspect.js} +6 -6
- package/dist/{grade-command-plan.js → grade/command-plan.js} +5 -5
- package/dist/{grade-core.js → grade/core.js} +3 -3
- package/dist/grade/grade.js +19 -0
- package/dist/{grade-markdown.js → grade/markdown.js} +6 -6
- package/dist/{grade-pipeline-state.js → grade/pipeline-state.js} +4 -4
- package/dist/{grade-plan.js → grade/plan.js} +5 -5
- package/dist/{grade-result.js → grade/result.js} +5 -94
- package/dist/{grade-target-discovery.js → grade/target-discovery.js} +7 -7
- package/dist/{grade-targets.js → grade/targets.js} +11 -8
- package/dist/{job-definition.js → job/definition.js} +25 -6
- package/dist/{job.js → job/job.js} +12 -11
- package/dist/{kata-command.js → kata/command.js} +3 -3
- package/dist/{kata.js → kata/kata.js} +5 -5
- package/dist/register/approach.js +134 -0
- package/dist/{register-core.js → register/core.js} +26 -8
- package/dist/{register-create-commands.js → register/create-commands.js} +171 -8
- package/dist/{register-date.js → register/date.js} +1 -1
- package/dist/register/derivation.js +163 -0
- package/dist/{register-event-merge.js → register/event-merge.js} +44 -3
- package/dist/{register-events.js → register/events.js} +13 -3
- package/dist/{register-history.js → register/history.js} +7 -6
- package/dist/{register-item.js → register/item.js} +32 -5
- package/dist/register/lifecycle-lock.js +5 -0
- package/dist/{register-maintenance-commands.js → register/maintenance-commands.js} +13 -7
- package/dist/{register-migrate-timestamps.js → register/migrate-timestamps.js} +3 -3
- package/dist/{register-migration.js → register/migration.js} +5 -4
- package/dist/{register.js → register/register.js} +32 -27
- package/dist/{register-renumber.js → register/renumber.js} +38 -11
- package/dist/{register-transition-commands.js → register/transition-commands.js} +3 -3
- package/dist/{register-update.js → register/update.js} +5 -5
- package/dist/{register-views.js → register/views.js} +47 -7
- package/dist/{review-grade.js → review/grade.js} +2 -2
- package/dist/{review-plan.js → review/plan.js} +3 -3
- package/dist/{routine-definition.js → routine/definition.js} +2 -2
- package/dist/{routine.js → routine/routine.js} +49 -22
- package/dist/{schedule-approach.js → schedule/approach.js} +8 -8
- package/dist/{schedule-build.js → schedule/build.js} +7 -4
- package/dist/{schedule.js → schedule/schedule.js} +6 -6
- package/dist/{schedule-strategy-generate-document.js → schedule/strategy-generate-document.js} +2 -2
- package/dist/{schedule-strategy-generate-scope.js → schedule/strategy-generate-scope.js} +4 -4
- package/dist/{schedule-strategy-generate.js → schedule/strategy-generate.js} +10 -10
- package/dist/shared/agent-types.js +23 -0
- package/dist/shared/artifact-path.js +9 -0
- package/dist/{build-if-stale.js → shared/build-if-stale.js} +1 -1
- package/dist/{catalog-build-render.js → shared/catalog-render.js} +3 -32
- package/dist/{exec-slot-lock.js → shared/cross-process-lock.js} +3 -1
- package/dist/shared/fs.js +30 -0
- package/dist/shared/git.js +346 -0
- package/dist/shared/grade-result.js +94 -0
- package/dist/{package-paths.js → shared/package-paths.js} +3 -3
- package/dist/shared/plan-templates.js +114 -0
- package/dist/{exec-provider-scaffold.js → shared/provider-scaffold.js} +6 -3
- package/dist/shared/random.js +4 -0
- package/dist/{exec-schedule-index.js → shared/schedule-index.js} +3 -1
- package/dist/shared/schedule-paths.js +9 -0
- package/dist/{specdojo-config.js → shared/specdojo-config.js} +162 -21
- package/dist/{exec-shared.js → shared/text.js} +4 -135
- package/dist/shared/time.js +28 -0
- package/dist/shared/workspace-scaffold.js +69 -0
- package/dist/specdojo.js +22 -22
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +31 -18
- package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +1 -2
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +3 -2
- package/docs/ja/specdojo/exec-templates/xer-template.md +1 -3
- package/docs/ja/specdojo/exec-templates/xrp-job-template.md +6 -4
- package/docs/ja/specdojo/exec-templates/xrp-register-post-run-template.md +46 -0
- package/docs/ja/specdojo/guides/branch-workflow-guide.md +34 -1
- package/docs/ja/specdojo/guides/docs-structure-guide.md +2 -0
- package/docs/ja/specdojo/guides/exec-config-guide.md +169 -26
- package/docs/ja/specdojo/guides/exec-operation-guide.md +184 -13
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +2 -0
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +40 -3
- package/docs/ja/specdojo/guides/quick-start-guide.md +89 -21
- package/docs/ja/specdojo/guides/register-operation-guide.md +44 -1
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +61 -6
- package/docs/ja/specdojo/guides/review-guide.md +1 -1
- package/docs/ja/specdojo/guides/routine-operation-guide.md +5 -5
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +1 -1
- package/docs/ja/specdojo/guides/use-case-guide.md +1 -1
- package/docs/ja/specdojo/guides/waza-guide.md +1 -1
- package/docs/ja/specdojo/references/command-reference.md +124 -55
- package/docs/ja/specdojo/references/specdojo-config-reference.md +33 -7
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +22 -13
- package/docs/ja/specdojo/standards/job-definition-standard.md +20 -18
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +2 -2
- package/docs/ja/specdojo/templates/pjr-derived-items-template.md +22 -0
- package/docs/ja/specdojo/templates/pjr-index-template.md +1 -0
- package/docs/specdojo/schemas/v1/agent-members.schema.yaml +29 -2
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +111 -17
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +28 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +2 -2
- package/docs/specdojo/schemas/v1/job.schema.yaml +7 -0
- package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +38 -0
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +5 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +91 -7
- package/docs/specdojo/schemas/v1/routine-run.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +36 -1
- package/package.json +17 -17
- package/templates/antigravity/README.md +6 -2
- package/templates/antigravity/agent-members-snippet.yaml +108 -12
- package/templates/antigravity/exec-defaults-snippet.yaml +8 -13
- package/templates/antigravity/orchestrator.md +61 -2
- package/templates/claude/README.md +27 -3
- package/templates/claude/agents/claude-executor.md +0 -1
- package/templates/claude/agents/claude-reporter.md +2 -1
- package/templates/claude/agents/claude-review-executor.md +0 -1
- package/templates/claude/agents/specdojo-orchestrator.md +61 -2
- package/templates/codex/README.md +40 -4
- package/templates/codex/agents/specdojo-orchestrator.toml +61 -2
- package/templates/codex/orchestrator.md +61 -2
- package/templates/devcontainer/devcontainer.json +5 -2
- package/templates/devcontainer/post-create.sh +15 -7
- package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +102 -0
- package/templates/devcontainer/remote-host/ssh-config.sample +19 -0
- package/templates/devcontainer/vim/vimrc +37 -0
- package/templates/init-agent-members.yaml +75 -25
- package/templates/init-exec-defaults.yaml +44 -9
- package/templates/opencode/README.md +17 -3
- package/templates/opencode/agents/opencode-executor.md +0 -1
- package/templates/opencode/agents/opencode-reporter.md +2 -1
- package/templates/opencode/agents/opencode-review-executor.md +0 -1
- package/templates/opencode/agents/specdojo-orchestrator.md +61 -2
- package/dist/devcontainer-scaffold.js +0 -165
- package/dist/exec-schedule-gantt-chart.js +0 -2
- package/dist/exec-worktree.js +0 -474
- package/dist/exec.js +0 -2
- package/dist/grade.js +0 -19
- package/templates/claude/agents/claude-expert-review-executor.md +0 -14
- /package/dist/{catalog-plan-prompt.js → catalog/plan-prompt.js} +0 -0
- /package/dist/{catalog-types.js → catalog/types.js} +0 -0
- /package/dist/{template-frontmatter.js → docs/template-frontmatter.js} +0 -0
- /package/dist/{role-types.js → exec/role-types.js} +0 -0
- /package/dist/{exec-schedule-gantt-chart-scope.js → exec/schedule/gantt-chart-scope.js} +0 -0
- /package/dist/{exec-types.js → exec/types.js} +0 -0
- /package/dist/{grade-command-shared.js → grade/command-shared.js} +0 -0
- /package/dist/{register-command-types.js → register/command-types.js} +0 -0
- /package/dist/{review-types.js → review/types.js} +0 -0
- /package/dist/{schedule-phase-sets.js → schedule/phase-sets.js} +0 -0
- /package/dist/{schedule-strategy-profiles.js → schedule/strategy-profiles.js} +0 -0
- /package/dist/{agent-response.js → shared/agent-response.js} +0 -0
- /package/dist/{catalog-paths.js → shared/catalog-paths.js} +0 -0
- /package/dist/{dist-freshness.js → shared/dist-freshness.js} +0 -0
- /package/dist/{git-environment.js → shared/git-environment.js} +0 -0
- /package/dist/{exec-format.js → shared/markdown-format.js} +0 -0
- /package/dist/{practice-id.js → shared/practice-id.js} +0 -0
- /package/dist/{spawn-self.js → shared/spawn-self.js} +0 -0
- /package/dist/{specdojo-gitignore.js → shared/specdojo-gitignore.js} +0 -0
- /package/dist/{template-resolution.js → shared/template-resolution.js} +0 -0
- /package/dist/{yaml-schema-modeline.js → shared/yaml-schema-modeline.js} +0 -0
- /package/dist/{yaml.js → shared/yaml.js} +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join, relative, resolve, sep } from "node:path";
|
|
3
|
-
import { PARENT_VALIDATION_PROJECT_REPO, failedParentValidationReason, } from "./
|
|
4
|
-
import { getProjectExecutionPath, resolveRepoRoot, specdojoRootDir, } from "
|
|
5
|
-
import { MAX_TEXT_LENGTH, parseReporterOutput, reporterOutputSchemaForMode, } from "./
|
|
6
|
-
|
|
3
|
+
import { PARENT_VALIDATION_PROJECT_REPO, failedParentValidationReason, } from "./parent-validation.js";
|
|
4
|
+
import { getProjectExecutionPath, resolveRepoRoot, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
5
|
+
import { MAX_TEXT_LENGTH, parseReporterOutput, reporterOutputSchemaForMode, } from "./reporter-output.js";
|
|
6
|
+
import { repoEnvironmentVariableName } from "./task-repos.js";
|
|
7
|
+
export { REPORTER_OUTPUT_SCHEMA, REVIEW_VERDICTS, parseReporterOutput, reporterOutputSchemaForMode, } from "./reporter-output.js";
|
|
7
8
|
const REPORTER_FORMAT_ATTEMPTS = 3;
|
|
8
9
|
function isProjectConfig(value) {
|
|
9
10
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -154,9 +155,10 @@ export function deriveReporterFacts(evidence, options = {}) {
|
|
|
154
155
|
commands.add(command);
|
|
155
156
|
target.set(repo, commands);
|
|
156
157
|
};
|
|
157
|
-
// sandbox で実行できない検証を executor が not_run(親 runner
|
|
158
|
-
//
|
|
159
|
-
// failed は runner
|
|
158
|
+
// sandbox で実行できない検証を executor が not_run(親 runner へ委譲)または
|
|
159
|
+
// not_applicable と記録し、runner が同じリポジトリで同じコマンドを実行して通した場合は、
|
|
160
|
+
// 親検証の結果を正として満たされたものと扱う。executor の failed は runner の結果で
|
|
161
|
+
// 打ち消さない(PJR-2GZE、PJR-7AW0)。
|
|
160
162
|
for (const validation of evidence.validations) {
|
|
161
163
|
if (validation.status !== "passed")
|
|
162
164
|
continue;
|
|
@@ -173,16 +175,27 @@ export function deriveReporterFacts(evidence, options = {}) {
|
|
|
173
175
|
// `npm run check` のような合成コマンドを executor が not_run(親 runner へ委譲)とした場合は、
|
|
174
176
|
// 対象リポジトリの package.json の script を展開し、構成する各コマンドが同じリポジトリの
|
|
175
177
|
// 親検証か executor 自身の検証で通っていれば満たされたものとして扱う(PJR-SDWF)。
|
|
176
|
-
const
|
|
178
|
+
const validationCommandAndRepo = (command) => {
|
|
177
179
|
const manifest = commandManifest(normalizeValidationCommand(command), applicabilityOptions, specdojoConfig);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
return {
|
|
181
|
+
command: manifest.command,
|
|
182
|
+
repo: manifest.repoName ?? PARENT_VALIDATION_PROJECT_REPO,
|
|
183
|
+
scripts: manifest.scripts,
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
const isPassedParentValidation = (command) => {
|
|
187
|
+
const target = validationCommandAndRepo(command);
|
|
188
|
+
return (runnerPassedCommandsByRepo.get(target.repo) ?? new Set()).has(target.command);
|
|
189
|
+
};
|
|
190
|
+
const isDelegatedValidationSatisfied = (command) => {
|
|
191
|
+
const target = validationCommandAndRepo(command);
|
|
192
|
+
if ((runnerPassedCommandsByRepo.get(target.repo) ?? new Set()).has(target.command)) {
|
|
181
193
|
return true;
|
|
182
|
-
|
|
183
|
-
const
|
|
194
|
+
}
|
|
195
|
+
const passedCommands = passedCommandsByRepo.get(target.repo) ?? new Set();
|
|
196
|
+
const components = compositeComponents(target.command, target.scripts);
|
|
184
197
|
return (components !== undefined &&
|
|
185
|
-
components.every((component) => isComponentSatisfied(component, passedCommands,
|
|
198
|
+
components.every((component) => isComponentSatisfied(component, passedCommands, target.scripts)));
|
|
186
199
|
};
|
|
187
200
|
// runner が担う検証(index build)の executor 側の not_run / not_applicable は満たしたものとする。
|
|
188
201
|
// runner の再生成が失敗した場合は worktree の準備で run が止まり、runner の記録に失敗が残れば
|
|
@@ -202,6 +215,10 @@ export function deriveReporterFacts(evidence, options = {}) {
|
|
|
202
215
|
runnerOwnedValidationReason(validation.command) !== undefined) {
|
|
203
216
|
return false;
|
|
204
217
|
}
|
|
218
|
+
if ((validation.status === "not_run" || validation.status === "not_applicable") &&
|
|
219
|
+
isPassedParentValidation(validation.command)) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
205
222
|
if (validation.status === "not_applicable") {
|
|
206
223
|
return !isValidNotApplicableValidation(validation.command, validation.reason, applicabilityOptions);
|
|
207
224
|
}
|
|
@@ -244,6 +261,20 @@ function invokedScriptNameOf(command) {
|
|
|
244
261
|
return "test";
|
|
245
262
|
return /^npm run ([A-Za-z0-9:_.-]+)(?:\s|$)/u.exec(command)?.[1];
|
|
246
263
|
}
|
|
264
|
+
// `npm init` が入れる仮の test script(`echo "Error: no test specified" && exit 1`)。引用符の
|
|
265
|
+
// 有無・種類と空白の違いを許す。中身が常に失敗する仮置きなので、適用条件では script がないものとみなす。
|
|
266
|
+
const NPM_INIT_PLACEHOLDER_TEST_PATTERN = /^echo\s+(["']?)Error:\s*no\s+test\s+specified\1\s*&&\s*exit\s+1\s*;?$/iu;
|
|
267
|
+
function isNpmInitPlaceholderTestScript(body) {
|
|
268
|
+
return NPM_INIT_PLACEHOLDER_TEST_PATTERN.test(body.trim());
|
|
269
|
+
}
|
|
270
|
+
// 適用条件の判定で script があるとみなすか。`test` の仮の script は executor と runner の判断を
|
|
271
|
+
// そろえるため、ないものとして扱う(PJR-6EF8)。
|
|
272
|
+
function hasApplicableScript(scripts, scriptName) {
|
|
273
|
+
const body = scripts[scriptName];
|
|
274
|
+
if (body === undefined)
|
|
275
|
+
return false;
|
|
276
|
+
return !(scriptName === "test" && isNpmInitPlaceholderTestScript(body));
|
|
277
|
+
}
|
|
247
278
|
function npxPackageNameOf(command) {
|
|
248
279
|
return /^npx\s+((?:@[A-Za-z0-9_.-]+\/)?[A-Za-z0-9_.-]+)(?:\s|$)/u.exec(command)?.[1];
|
|
249
280
|
}
|
|
@@ -265,6 +296,60 @@ export function runnerOwnedValidationReason(command) {
|
|
|
265
296
|
return "index は runner が worktree の準備と統合の前に再生成する";
|
|
266
297
|
}
|
|
267
298
|
const PROJECT_DOCUMENTS_ROOT = "docs/ja/projects/";
|
|
299
|
+
const hasExtension = (extensions) => (path) => {
|
|
300
|
+
const normalized = path.toLowerCase();
|
|
301
|
+
return extensions.some((extension) => normalized.endsWith(extension));
|
|
302
|
+
};
|
|
303
|
+
// The command-to-change mapping is kept in one place and mirrors the change-type rows in
|
|
304
|
+
// xep-common-conventions-template.md. Checks such as typecheck intentionally remain outside this
|
|
305
|
+
// table: PJR-8WBN requires their existing script-based applicability to stay unchanged.
|
|
306
|
+
const CHANGE_SCOPED_VALIDATIONS = [
|
|
307
|
+
{
|
|
308
|
+
pathCondition: "YAML ファイル(*.yaml / *.yml)",
|
|
309
|
+
matchesCommand: (command) => /^npm run validate:schema:file(?:\s|$)/u.test(command),
|
|
310
|
+
matchesPath: hasExtension([".yaml", ".yml"]),
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
pathCondition: "Prettier 対象ファイル(*.md / *.ts / *.js / *.json / *.yaml / *.yml)",
|
|
314
|
+
matchesCommand: (command) => /^(?:npx\s+)?prettier(?:\s|$)/u.test(command),
|
|
315
|
+
matchesPath: hasExtension([".md", ".ts", ".js", ".json", ".yaml", ".yml"]),
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
pathCondition: "Markdown ファイル(*.md)",
|
|
319
|
+
matchesCommand: (command) => /^npm run lint:md(?:\s|$)/u.test(command) ||
|
|
320
|
+
/^(?:npx\s+)?(?:markdownlint|markdownlint-cli2)(?:\s|$)/u.test(command) ||
|
|
321
|
+
/^node\s+\S*specdojo-docs-lint\.js\s+markdownlint(?:\s|$)/u.test(command),
|
|
322
|
+
matchesPath: hasExtension([".md"]),
|
|
323
|
+
},
|
|
324
|
+
];
|
|
325
|
+
function changedPathSides(path) {
|
|
326
|
+
return path.split(" -> ").map((side) => side.replaceAll("\\", "/").replace(/^\.\//u, ""));
|
|
327
|
+
}
|
|
328
|
+
function changePathsForCommand(changedPaths, repoName, config, projectId) {
|
|
329
|
+
const repoNames = declaredRepos(config, projectId).map((repo) => repo.name);
|
|
330
|
+
return changedPaths.flatMap(changedPathSides).flatMap((path) => {
|
|
331
|
+
if (repoName !== undefined) {
|
|
332
|
+
const prefix = `${repoName}:`;
|
|
333
|
+
return path.startsWith(prefix) ? [path.slice(prefix.length)] : [];
|
|
334
|
+
}
|
|
335
|
+
return repoNames.some((name) => path.startsWith(`${name}:`)) ? [] : [path];
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function changeScopedValidationApplicability(command, changedPaths, repoName, config, projectId) {
|
|
339
|
+
const validation = CHANGE_SCOPED_VALIDATIONS.find(({ matchesCommand }) => matchesCommand(command));
|
|
340
|
+
if (!validation)
|
|
341
|
+
return { recognized: false };
|
|
342
|
+
if (changedPaths === undefined)
|
|
343
|
+
return { recognized: true };
|
|
344
|
+
const relevantPaths = changePathsForCommand(changedPaths, repoName, config, projectId);
|
|
345
|
+
return relevantPaths.some(validation.matchesPath)
|
|
346
|
+
? { recognized: true, applicable: true }
|
|
347
|
+
: {
|
|
348
|
+
recognized: true,
|
|
349
|
+
applicable: false,
|
|
350
|
+
reason: `変更に ${validation.pathCondition} がない`,
|
|
351
|
+
};
|
|
352
|
+
}
|
|
268
353
|
function changesReachProjectDocuments(changedPaths) {
|
|
269
354
|
return changedPaths
|
|
270
355
|
.flatMap((path) => path.split(" -> "))
|
|
@@ -322,10 +407,15 @@ export function mechanicallyNotApplicableReason(command, options = {}) {
|
|
|
322
407
|
return specdojo.applicable === false ? specdojo.reason : undefined;
|
|
323
408
|
}
|
|
324
409
|
const manifest = commandManifest(normalized, options, config);
|
|
410
|
+
const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId);
|
|
411
|
+
if (changeScoped.applicable === false)
|
|
412
|
+
return changeScoped.reason;
|
|
325
413
|
const packageJson = manifest.repoName === undefined ? "package.json" : `${manifest.repoName} の package.json`;
|
|
326
414
|
const scriptName = invokedScriptNameOf(manifest.command);
|
|
327
|
-
if (scriptName !== undefined && manifest.scripts
|
|
328
|
-
return
|
|
415
|
+
if (scriptName !== undefined && !hasApplicableScript(manifest.scripts, scriptName)) {
|
|
416
|
+
return manifest.scripts[scriptName] === undefined
|
|
417
|
+
? `${packageJson} に npm script '${scriptName}' がない`
|
|
418
|
+
: `${packageJson} の npm script '${scriptName}' は npm init の仮の script である`;
|
|
329
419
|
}
|
|
330
420
|
const packageName = npxPackageNameOf(manifest.command);
|
|
331
421
|
if (packageName !== undefined && !manifest.dependencies.has(packageName)) {
|
|
@@ -342,11 +432,16 @@ function isValidNotApplicableValidation(command, reason, options) {
|
|
|
342
432
|
if (specdojo.recognized)
|
|
343
433
|
return specdojo.applicable !== true;
|
|
344
434
|
const manifest = commandManifest(normalized, options, config);
|
|
435
|
+
const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId);
|
|
436
|
+
if (changeScoped.applicable === false)
|
|
437
|
+
return true;
|
|
345
438
|
const scriptName = invokedScriptNameOf(manifest.command);
|
|
346
|
-
if (scriptName !== undefined && manifest.scripts
|
|
439
|
+
if (scriptName !== undefined && hasApplicableScript(manifest.scripts, scriptName))
|
|
347
440
|
return false;
|
|
348
441
|
const packageName = npxPackageNameOf(manifest.command);
|
|
349
|
-
|
|
442
|
+
if (packageName !== undefined)
|
|
443
|
+
return !manifest.dependencies.has(packageName);
|
|
444
|
+
return true;
|
|
350
445
|
}
|
|
351
446
|
const PREFIX_OPTION_PATTERN = /(?:^|\s)--prefix(?:=|\s+)(\S+)(?=\s|$)/u;
|
|
352
447
|
function normalizeRepoPathText(path) {
|
|
@@ -364,8 +459,26 @@ function declaredRepos(config, projectId) {
|
|
|
364
459
|
typeof repo.path === "string");
|
|
365
460
|
}
|
|
366
461
|
/**
|
|
367
|
-
*
|
|
368
|
-
*
|
|
462
|
+
* True when a command references a shell variable without mistaking a longer variable name for
|
|
463
|
+
* the requested one. Both `$NAME` and `${NAME}` forms are recognized.
|
|
464
|
+
*/
|
|
465
|
+
function referencesShellVariable(command, variable) {
|
|
466
|
+
if (command.includes("${" + variable + "}"))
|
|
467
|
+
return true;
|
|
468
|
+
const reference = `$${variable}`;
|
|
469
|
+
let offset = command.indexOf(reference);
|
|
470
|
+
while (offset >= 0) {
|
|
471
|
+
const next = command[offset + reference.length];
|
|
472
|
+
if (next === undefined || !/[A-Za-z0-9_]/u.test(next))
|
|
473
|
+
return true;
|
|
474
|
+
offset = command.indexOf(reference, offset + reference.length);
|
|
475
|
+
}
|
|
476
|
+
return false;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Identifies a command that targets a declared product repository through `--prefix <repo>` (the
|
|
480
|
+
* repository name or its configured path), `$SPECDOJO_REPO_<NAME>` / its braced form, or a
|
|
481
|
+
* `<repo>:<path>` argument.
|
|
369
482
|
*/
|
|
370
483
|
function productRepoCommand(command, repos) {
|
|
371
484
|
const prefix = PREFIX_OPTION_PATTERN.exec(command)?.[1];
|
|
@@ -379,6 +492,9 @@ function productRepoCommand(command, repos) {
|
|
|
379
492
|
command: normalizeValidationCommand(command.replace(PREFIX_OPTION_PATTERN, " ")),
|
|
380
493
|
};
|
|
381
494
|
}
|
|
495
|
+
const environmentRepo = repos.find((candidate) => referencesShellVariable(command, repoEnvironmentVariableName(candidate.name)));
|
|
496
|
+
if (environmentRepo)
|
|
497
|
+
return { repo: environmentRepo, command };
|
|
382
498
|
const tokens = command.split(" ");
|
|
383
499
|
const repo = repos.find((candidate) => tokens.some((token) => token.startsWith(`${candidate.name}:`)));
|
|
384
500
|
return repo ? { repo, command } : undefined;
|
|
@@ -547,11 +663,12 @@ misread it as emphasis.
|
|
|
547
663
|
The plan below was written as generic instructions for a single agent that both edits the
|
|
548
664
|
deliverable and records its own result. In this pipeline, those two responsibilities are split:
|
|
549
665
|
the executor already completed the deliverable edit and intentionally left the result file
|
|
550
|
-
untouched because the runner writes it from your prose and machine facts. For edit mode,
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
666
|
+
untouched because the runner writes it from your prose and machine facts. For edit mode, explain
|
|
667
|
+
what was changed in each file in changed_files, especially deliverables (docs/), source files (src/),
|
|
668
|
+
and test files (tests/). Identify each changed_files summary with the exact path from its evidence.changes
|
|
669
|
+
entry. The runner matches descriptions by path: order does not matter, missing descriptions are filled
|
|
670
|
+
with Git change metadata by the runner, and paths absent from evidence are discarded. Do not include
|
|
671
|
+
statuses. An empty changes list requires an empty changed_files list. Validation entries with source="runner" were executed by the parent
|
|
555
672
|
process and remain authoritative machine facts. Do not turn them into outcome or block_reason
|
|
556
673
|
fields. When runner_context is present, it contains additional authoritative facts: do not ask for
|
|
557
674
|
a command in mechanically_not_applicable to be run, because the runner already determined that it
|