specdojo 0.3.0 → 0.4.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/CHANGELOG.md +65 -0
- package/README.md +77 -18
- package/dist/catalog/build-references.js +144 -0
- package/dist/catalog/build-render.js +32 -0
- package/dist/{catalog-build.js → catalog/build.js} +18 -295
- package/dist/{catalog.js → catalog/catalog.js} +11 -11
- package/dist/{catalog-generate.js → catalog/generate.js} +13 -16
- package/dist/catalog/paths.js +1 -0
- package/dist/{catalog-plan-generate.js → catalog/plan-generate.js} +5 -5
- package/dist/{catalog-plan.js → catalog/plan.js} +9 -9
- package/dist/{catalog-scaffold.js → catalog/scaffold.js} +6 -6
- 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} +103 -37
- package/dist/{orchestrator.js → commands/orchestrator.js} +2 -2
- package/dist/{watch.js → commands/watch.js} +3 -3
- package/dist/dashboard/dashboard-timeline.js +175 -0
- package/dist/{dashboard.js → dashboard/dashboard.js} +16 -549
- package/dist/dashboard/exec-records.js +105 -0
- package/dist/dashboard/routines.js +256 -0
- package/dist/dashboard/shared.js +14 -0
- 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} +7 -7
- package/dist/{devcontainer-command.js → devcontainer/command.js} +5 -3
- package/dist/{devcontainer-scaffold.js → devcontainer/scaffold.js} +94 -2
- package/dist/{doc-index.js → docs/doc-index.js} +3 -3
- package/dist/{frontmatter-namespace.js → docs/frontmatter-namespace.js} +2 -2
- 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} +3 -3
- package/dist/{yaml-pages-command.js → docs/yaml-pages-command.js} +1 -1
- package/dist/{yaml-pages.js → docs/yaml-pages.js} +5 -5
- package/dist/{exec-agent-config.js → exec/agent-config.js} +33 -4
- 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.js → exec/commands.js} +22 -467
- package/dist/exec/core.js +457 -0
- 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} +4 -4
- package/dist/{exec-pipeline-state.js → exec/pipeline-state.js} +16 -2
- package/dist/{exec-plans.js → exec/plans-core.js} +97 -468
- package/dist/exec/plans-generation.js +249 -0
- package/dist/exec/plans-storage.js +131 -0
- package/dist/exec/plans.js +3 -0
- 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} +92 -9
- package/dist/exec/repo-integration-git.js +23 -0
- package/dist/exec/repo-integration-sync.js +264 -0
- package/dist/{exec-repo-integration.js → exec/repo-integration.js} +13 -287
- package/dist/{exec-repo-trace.js → exec/repo-trace.js} +3 -3
- package/dist/exec/reporter-output.js +206 -0
- package/dist/{exec-reporter.js → exec/reporter.js} +29 -216
- package/dist/{exec-results.js → exec/results.js} +277 -36
- package/dist/exec/run/agent-pipeline.js +276 -0
- package/dist/exec/run/agent.js +583 -0
- package/dist/exec/run/in-place.js +570 -0
- package/dist/exec/run/job.js +746 -0
- package/dist/exec/run/lifecycle-commands.js +530 -0
- package/dist/{exec-run-lock.js → exec/run/lock.js} +4 -3
- package/dist/exec/run/mode-shared.js +140 -0
- package/dist/exec/run/register-command.js +252 -0
- package/dist/exec/run/register-core.js +411 -0
- package/dist/exec/run/register-mode.js +210 -0
- package/dist/exec/run/register-resume.js +398 -0
- package/dist/exec/run/register-state.js +325 -0
- package/dist/exec/run/register-worktree.js +540 -0
- package/dist/exec/run/run.js +11 -0
- package/dist/exec/run/schedule-mode.js +294 -0
- package/dist/exec/run/schedule-prepare.js +366 -0
- package/dist/exec/run/schedule-task.js +599 -0
- package/dist/exec/run/shared.js +449 -0
- 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} +2 -2
- package/dist/{exec-task-view.js → exec/task-view.js} +4 -4
- package/dist/{exec-trial.js → exec/trial-commands.js} +23 -388
- package/dist/exec/trial-core.js +371 -0
- package/dist/exec/trial.js +2 -0
- package/dist/{exec-worktree-command.js → exec/worktree-command.js} +25 -23
- package/dist/exec/worktree-ops-commit.js +672 -0
- package/dist/exec/worktree-ops-lifecycle.js +297 -0
- package/dist/exec/worktree-ops-merge.js +344 -0
- package/dist/exec/worktree-ops.js +3 -0
- package/dist/exec/worktree.js +305 -0
- package/dist/grade/apply.js +734 -0
- package/dist/grade/command-apply.js +250 -0
- package/dist/grade/command-inspect.js +138 -0
- package/dist/grade/command-plan.js +101 -0
- package/dist/grade/command-shared.js +68 -0
- package/dist/grade/core.js +307 -0
- package/dist/grade/grade.js +19 -0
- package/dist/grade/markdown.js +274 -0
- package/dist/grade/pipeline-state.js +184 -0
- package/dist/grade/plan.js +507 -0
- package/dist/{grade-result.js → grade/result.js} +7 -96
- package/dist/grade/target-discovery.js +265 -0
- package/dist/grade/targets.js +435 -0
- package/dist/{job.js → job/definition.js} +32 -574
- package/dist/job/job.js +568 -0
- package/dist/{kata-command.js → kata/command.js} +4 -4
- package/dist/{kata.js → kata/kata.js} +5 -5
- package/dist/register/approach.js +134 -0
- package/dist/register/command-types.js +1 -0
- package/dist/register/core.js +369 -0
- package/dist/register/create-commands.js +352 -0
- 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} +32 -3
- package/dist/{register-events.js → register/events.js} +12 -6
- package/dist/{register-history.js → register/history.js} +7 -6
- package/dist/{register-item.js → register/item.js} +28 -10
- package/dist/register/lifecycle-lock.js +5 -0
- package/dist/register/maintenance-commands.js +193 -0
- package/dist/{register-migrate-timestamps.js → register/migrate-timestamps.js} +3 -3
- package/dist/register/migration.js +268 -0
- package/dist/register/register.js +404 -0
- package/dist/register/renumber.js +341 -0
- package/dist/register/transition-commands.js +248 -0
- package/dist/register/update.js +230 -0
- package/dist/register/views.js +296 -0
- package/dist/{review-grade.js → review/grade.js} +2 -2
- package/dist/{review-plan.js → review/plan.js} +5 -5
- package/dist/routine/definition.js +401 -0
- package/dist/{routine.js → routine/routine.js} +50 -419
- package/dist/{schedule-approach.js → schedule/approach.js} +9 -9
- package/dist/{schedule-build.js → schedule/build.js} +7 -4
- package/dist/{schedule.js → schedule/schedule.js} +9 -9
- package/dist/schedule/strategy-generate-document.js +273 -0
- package/dist/schedule/strategy-generate-scope.js +199 -0
- package/dist/schedule/strategy-generate.js +348 -0
- 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/shared/catalog-render.js +115 -0
- 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 +316 -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} +3 -1
- 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} +96 -9
- package/dist/{exec-shared.js → shared/text.js} +0 -134
- package/dist/shared/time.js +28 -0
- package/dist/shared/yaml.js +28 -0
- package/dist/specdojo.js +22 -22
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +29 -17
- package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +1 -2
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -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/guides/exec-config-guide.md +97 -22
- package/docs/ja/specdojo/guides/exec-operation-guide.md +145 -12
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +2 -0
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +51 -18
- package/docs/ja/specdojo/guides/quick-start-guide.md +81 -16
- package/docs/ja/specdojo/guides/register-operation-guide.md +2 -1
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +10 -1
- package/docs/ja/specdojo/guides/review-guide.md +1 -1
- package/docs/ja/specdojo/guides/routine-operation-guide.md +6 -6
- package/docs/ja/specdojo/guides/use-case-guide.md +1 -1
- package/docs/ja/specdojo/references/command-reference.md +52 -28
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +17 -11
- 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 +20 -0
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +23 -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 +26 -0
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +70 -7
- package/docs/specdojo/schemas/v1/routine-run.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +1 -1
- package/package.json +4 -5
- package/templates/antigravity/README.md +7 -3
- package/templates/antigravity/agent-members-snippet.yaml +108 -12
- package/templates/antigravity/exec-defaults-snippet.yaml +10 -13
- 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/codex/README.md +23 -4
- package/templates/devcontainer/devcontainer.json +2 -2
- package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +69 -0
- package/templates/devcontainer/remote-host/ssh-config.sample +16 -0
- package/templates/init-agent-members.yaml +75 -25
- package/templates/init-exec-defaults.yaml +26 -8
- 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/dist/exec-run.js +0 -6182
- package/dist/exec-schedule-gantt-chart.js +0 -2
- package/dist/exec-worktree-ops.js +0 -1292
- package/dist/exec-worktree.js +0 -446
- package/dist/grade.js +0 -3193
- package/dist/register.js +0 -2407
- package/dist/schedule-strategy-generate.js +0 -812
- 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/{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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { basename, dirname, isAbsolute, join, posix, relative, resolve } from "node:path";
|
|
3
3
|
import dotenv from "dotenv";
|
|
4
|
-
import
|
|
4
|
+
import { dump, load } from "./yaml.js";
|
|
5
5
|
import Ajv2020Module from "ajv/dist/2020.js";
|
|
6
|
-
import { runProviderScaffold, specdojoPackageRootDir } from "./
|
|
6
|
+
import { runProviderScaffold, specdojoPackageRootDir } from "./provider-scaffold.js";
|
|
7
7
|
import { ensureGitignore, formatGitignoreReport, gitignorePatternsForLayouts, } from "./specdojo-gitignore.js";
|
|
8
8
|
/** Default IANA time zone for register date derivation when run.register_date_timezone is unset. */
|
|
9
9
|
export const DEFAULT_REGISTER_DATE_TIMEZONE = "UTC";
|
|
@@ -56,6 +56,33 @@ export function resolveRepoRoot(rootDir, repo) {
|
|
|
56
56
|
return resolve(rootDir, repo.path);
|
|
57
57
|
}
|
|
58
58
|
export const DEFAULT_PROJECT_CONTEXT = ["prj-overview"];
|
|
59
|
+
// Resolve either a concrete agent nickname or a backward-compatible alias to the concrete
|
|
60
|
+
// member. Alias validity is checked while loading the roster, but keep the traversal guarded so
|
|
61
|
+
// callers and tests that construct a roster directly cannot loop forever on malformed input.
|
|
62
|
+
export function resolveAgentMember(roster, nickname) {
|
|
63
|
+
if (!roster)
|
|
64
|
+
return undefined;
|
|
65
|
+
const members = new Map(roster.members
|
|
66
|
+
.filter((member) => member.type === "agent")
|
|
67
|
+
.map((member) => [member.nickname, member]));
|
|
68
|
+
const direct = members.get(nickname);
|
|
69
|
+
if (direct)
|
|
70
|
+
return direct;
|
|
71
|
+
const aliases = new Map((roster.aliases ?? []).map((alias) => [alias.nickname, alias.alias_of]));
|
|
72
|
+
const seen = new Set();
|
|
73
|
+
let current = nickname;
|
|
74
|
+
while (!seen.has(current)) {
|
|
75
|
+
seen.add(current);
|
|
76
|
+
const target = aliases.get(current);
|
|
77
|
+
if (!target)
|
|
78
|
+
return undefined;
|
|
79
|
+
const member = members.get(target);
|
|
80
|
+
if (member)
|
|
81
|
+
return member.disabled ? undefined : member;
|
|
82
|
+
current = target;
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
59
86
|
export const DEFAULT_AGENT_MEMBERS_PATH = ".specdojo/agent-members.yaml";
|
|
60
87
|
function findUpward(startDir, name) {
|
|
61
88
|
let currentDir = resolve(startDir);
|
|
@@ -313,6 +340,7 @@ export function loadMemberRoster(baseDir, project) {
|
|
|
313
340
|
throw new Error(`Invalid agent members file: ${agentFullPath}: human '${human.nickname ?? "<unknown>"}' is not allowed`);
|
|
314
341
|
}
|
|
315
342
|
validateMemberFile("agent-members.schema.yaml", agentFullPath, agentRoster);
|
|
343
|
+
validateAgentAliases(agentFullPath, agentRoster);
|
|
316
344
|
}
|
|
317
345
|
if (!humanRoster && !agentRoster)
|
|
318
346
|
return null;
|
|
@@ -328,16 +356,70 @@ export function loadMemberRoster(baseDir, project) {
|
|
|
328
356
|
}
|
|
329
357
|
seen.set(member.nickname, source);
|
|
330
358
|
}
|
|
359
|
+
for (const alias of agentRoster?.aliases ?? []) {
|
|
360
|
+
const previousSource = seen.get(alias.nickname);
|
|
361
|
+
if (previousSource) {
|
|
362
|
+
throw new Error(`Duplicate member or alias nickname '${alias.nickname}' across ${previousSource} and ${agentFullPath}`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
331
365
|
const members = membersWithSources.map(({ member }) => member);
|
|
366
|
+
const aliases = agentRoster?.aliases;
|
|
332
367
|
if (humanRoster)
|
|
333
|
-
return { ...humanRoster, members };
|
|
334
|
-
return { version: agentRoster?.version ?? 1, members };
|
|
368
|
+
return { ...humanRoster, members, ...(aliases ? { aliases } : {}) };
|
|
369
|
+
return { version: agentRoster?.version ?? 1, members, ...(aliases ? { aliases } : {}) };
|
|
370
|
+
}
|
|
371
|
+
function validateAgentAliases(path, roster) {
|
|
372
|
+
const members = new Map();
|
|
373
|
+
for (const member of roster.members) {
|
|
374
|
+
if (members.has(member.nickname)) {
|
|
375
|
+
throw new Error(`Invalid agent members file: ${path}: duplicate member '${member.nickname}'`);
|
|
376
|
+
}
|
|
377
|
+
members.set(member.nickname, member);
|
|
378
|
+
}
|
|
379
|
+
const aliases = new Map();
|
|
380
|
+
for (const alias of roster.aliases ?? []) {
|
|
381
|
+
if (members.has(alias.nickname)) {
|
|
382
|
+
throw new Error(`Invalid agent alias '${alias.nickname}' in ${path}: name conflicts with a member`);
|
|
383
|
+
}
|
|
384
|
+
if (aliases.has(alias.nickname)) {
|
|
385
|
+
throw new Error(`Invalid agent alias '${alias.nickname}' in ${path}: duplicate alias name`);
|
|
386
|
+
}
|
|
387
|
+
aliases.set(alias.nickname, alias.alias_of);
|
|
388
|
+
}
|
|
389
|
+
const resolved = new Set();
|
|
390
|
+
const resolveAlias = (nickname, chain) => {
|
|
391
|
+
if (resolved.has(nickname))
|
|
392
|
+
return;
|
|
393
|
+
const cycleStart = chain.indexOf(nickname);
|
|
394
|
+
if (cycleStart >= 0) {
|
|
395
|
+
const cycle = [...chain.slice(cycleStart), nickname].join(" -> ");
|
|
396
|
+
throw new Error(`Invalid agent alias '${nickname}' in ${path}: alias cycle ${cycle}`);
|
|
397
|
+
}
|
|
398
|
+
const target = aliases.get(nickname);
|
|
399
|
+
if (!target)
|
|
400
|
+
return;
|
|
401
|
+
const member = members.get(target);
|
|
402
|
+
if (member) {
|
|
403
|
+
if (member.disabled) {
|
|
404
|
+
throw new Error(`Invalid agent alias '${nickname}' in ${path}: alias_of '${target}' resolves to a disabled member`);
|
|
405
|
+
}
|
|
406
|
+
resolved.add(nickname);
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
if (!aliases.has(target)) {
|
|
410
|
+
throw new Error(`Invalid agent alias '${nickname}' in ${path}: alias_of '${target}' does not resolve to a member`);
|
|
411
|
+
}
|
|
412
|
+
resolveAlias(target, [...chain, nickname]);
|
|
413
|
+
resolved.add(nickname);
|
|
414
|
+
};
|
|
415
|
+
for (const nickname of aliases.keys())
|
|
416
|
+
resolveAlias(nickname, []);
|
|
335
417
|
}
|
|
336
418
|
const Ajv2020 = Ajv2020Module.default;
|
|
337
419
|
const memberSchemaValidators = new Map();
|
|
338
420
|
function readYamlFile(path) {
|
|
339
421
|
try {
|
|
340
|
-
return
|
|
422
|
+
return load(readFileSync(path, "utf8"));
|
|
341
423
|
}
|
|
342
424
|
catch (error) {
|
|
343
425
|
throw new Error(`Invalid YAML: ${path}: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -374,8 +456,7 @@ function validateMemberFile(schemaName, path, value) {
|
|
|
374
456
|
function dumpMemberFile(path, schemaName, value) {
|
|
375
457
|
const schemaPath = join(specdojoPackageRootDir(), "docs", "specdojo", "schemas", "v1", schemaName);
|
|
376
458
|
const schemaRef = relative(dirname(path), schemaPath).replaceAll("\\", "/");
|
|
377
|
-
return (`# yaml-language-server: $schema=${schemaRef}\n` +
|
|
378
|
-
yaml.dump(value, { lineWidth: 100, noRefs: true }));
|
|
459
|
+
return (`# yaml-language-server: $schema=${schemaRef}\n` + dump(value, { lineWidth: 100, noRefs: true }));
|
|
379
460
|
}
|
|
380
461
|
function configuredAgentMembersPath(baseDir) {
|
|
381
462
|
const configPath = resolve(baseDir, ".specdojo", "specdojo.config.json");
|
|
@@ -601,8 +682,12 @@ export function migrateAgentMembers(options) {
|
|
|
601
682
|
if (existsSync(agentPath)) {
|
|
602
683
|
existingAgents = readYamlFile(agentPath);
|
|
603
684
|
validateMemberFile("agent-members.schema.yaml", agentPath, existingAgents);
|
|
685
|
+
validateAgentAliases(agentPath, existingAgents);
|
|
604
686
|
}
|
|
605
|
-
const agentNicknames = new Set(
|
|
687
|
+
const agentNicknames = new Set([
|
|
688
|
+
...existingAgents.members.map((member) => member.nickname),
|
|
689
|
+
...(existingAgents.aliases ?? []).map((alias) => alias.nickname),
|
|
690
|
+
]);
|
|
606
691
|
const moved = [];
|
|
607
692
|
const updates = [];
|
|
608
693
|
for (const [projectId, project] of projectEntries) {
|
|
@@ -629,7 +714,7 @@ export function migrateAgentMembers(options) {
|
|
|
629
714
|
}
|
|
630
715
|
for (const agent of agents) {
|
|
631
716
|
if (agentNicknames.has(agent.nickname)) {
|
|
632
|
-
throw new Error(`Duplicate agent nickname '${agent.nickname}' while migrating ${path}`);
|
|
717
|
+
throw new Error(`Duplicate agent member or alias nickname '${agent.nickname}' while migrating ${path}`);
|
|
633
718
|
}
|
|
634
719
|
agentNicknames.add(agent.nickname);
|
|
635
720
|
moved.push(agent);
|
|
@@ -639,10 +724,12 @@ export function migrateAgentMembers(options) {
|
|
|
639
724
|
updates.push({ path, roster: humanRoster, count: agents.length });
|
|
640
725
|
}
|
|
641
726
|
const mergedAgents = {
|
|
727
|
+
...existingAgents,
|
|
642
728
|
version: existingAgents.version || 1,
|
|
643
729
|
members: [...existingAgents.members, ...moved],
|
|
644
730
|
};
|
|
645
731
|
validateMemberFile("agent-members.schema.yaml", agentPath, mergedAgents);
|
|
732
|
+
validateAgentAliases(agentPath, mergedAgents);
|
|
646
733
|
for (const update of updates) {
|
|
647
734
|
for (const human of update.roster.members) {
|
|
648
735
|
if (agentNicknames.has(human.nickname)) {
|
|
@@ -1,51 +1,3 @@
|
|
|
1
|
-
import { randomBytes } from "node:crypto";
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { basename, join, relative } from "node:path";
|
|
4
|
-
import yaml from "js-yaml";
|
|
5
|
-
import { specdojoRootDir } from "./specdojo-config.js";
|
|
6
|
-
export function nowUtcIsoSeconds() {
|
|
7
|
-
return new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
8
|
-
}
|
|
9
|
-
export function isUtcIsoSeconds(ts) {
|
|
10
|
-
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(ts);
|
|
11
|
-
}
|
|
12
|
-
export function tsForFilenameUtc(ts) {
|
|
13
|
-
return ts.replace(/[-:]/g, "").replace("T", "T");
|
|
14
|
-
}
|
|
15
|
-
// worktree/branch 生成専用。project 修飾した task ID(`<projectId>:<taskId>`)を返す。
|
|
16
|
-
// projectId が未解決(env path override 等)の場合は bare のままにして後方互換を保つ。
|
|
17
|
-
// schedule 検索・plan/result ファイル名・claim には使わない(bare の task ID を使う)。
|
|
18
|
-
export function qualifyTaskId(projectId, taskId) {
|
|
19
|
-
return projectId ? `${projectId}:${taskId}` : taskId;
|
|
20
|
-
}
|
|
21
|
-
export function safeSlug(s) {
|
|
22
|
-
return s
|
|
23
|
-
.trim()
|
|
24
|
-
.replace(/\s+/g, "-")
|
|
25
|
-
.replace(/[^A-Za-z0-9._-]/g, "_")
|
|
26
|
-
.slice(0, 80);
|
|
27
|
-
}
|
|
28
|
-
export function randomHex(bytes) {
|
|
29
|
-
return randomBytes(bytes).toString("hex");
|
|
30
|
-
}
|
|
31
|
-
export function ensureDir(path) {
|
|
32
|
-
if (!existsSync(path))
|
|
33
|
-
mkdirSync(path, { recursive: true });
|
|
34
|
-
}
|
|
35
|
-
export function requireNonEmpty(name, v) {
|
|
36
|
-
if (typeof v !== "string" || v.trim().length === 0)
|
|
37
|
-
throw new Error(`${name} is required`);
|
|
38
|
-
return v.trim();
|
|
39
|
-
}
|
|
40
|
-
export function collectRepeatable(value, previous) {
|
|
41
|
-
return previous.concat([value]);
|
|
42
|
-
}
|
|
43
|
-
// CPM 由来の日数値(ES / EF / slack / duration 等)の表示用フォーマット。
|
|
44
|
-
// 浮動小数点誤差(例: 6.2509999999999994)を吸収し、小数点以下を最大2桁に丸める。
|
|
45
|
-
// JSON 等のデータ出力には使わず、Markdown 表示にのみ使う。
|
|
46
|
-
export function formatDays(value) {
|
|
47
|
-
return String(Math.round(value * 100) / 100);
|
|
48
|
-
}
|
|
49
1
|
// East Asian Wide / Fullwidth code point ranges. Characters in these ranges occupy two terminal
|
|
50
2
|
// columns, so they must count as 2 when aligning columns (e.g. Japanese task names in `exec status`).
|
|
51
3
|
const WIDE_CODE_POINT_RANGES = [
|
|
@@ -159,89 +111,3 @@ export function redactSensitiveText(value) {
|
|
|
159
111
|
.replace(/\b(sk-(?:proj-)?[A-Za-z0-9_-]{8,}|gh[opsu]_[A-Za-z0-9_]{8,})\b/gu, "[REDACTED]")
|
|
160
112
|
.replace(/\b(api[_-]?key|access[_-]?token|auth(?:orization)?|password|passwd|secret)\b(\s*[:=]\s*)([^\s,;]+)/giu, "$1$2[REDACTED]");
|
|
161
113
|
}
|
|
162
|
-
export function parseKeyValuePairs(pairs) {
|
|
163
|
-
if (!pairs || pairs.length === 0)
|
|
164
|
-
return undefined;
|
|
165
|
-
const out = {};
|
|
166
|
-
for (const p of pairs) {
|
|
167
|
-
const idx = p.indexOf("=");
|
|
168
|
-
if (idx <= 0)
|
|
169
|
-
throw new Error(`Invalid key=value: ${p}`);
|
|
170
|
-
const k = p.slice(0, idx).trim();
|
|
171
|
-
const v = p.slice(idx + 1).trim();
|
|
172
|
-
if (!k)
|
|
173
|
-
throw new Error(`Empty key in: ${p}`);
|
|
174
|
-
out[k] = v;
|
|
175
|
-
}
|
|
176
|
-
return Object.keys(out).length ? out : undefined;
|
|
177
|
-
}
|
|
178
|
-
export function listFilesRecursive(dir) {
|
|
179
|
-
const out = [];
|
|
180
|
-
if (!existsSync(dir))
|
|
181
|
-
return out;
|
|
182
|
-
for (const name of readdirSync(dir)) {
|
|
183
|
-
const full = join(dir, name);
|
|
184
|
-
const st = statSync(full);
|
|
185
|
-
if (st.isDirectory())
|
|
186
|
-
out.push(...listFilesRecursive(full));
|
|
187
|
-
else if (st.isFile())
|
|
188
|
-
out.push(full);
|
|
189
|
-
}
|
|
190
|
-
return out;
|
|
191
|
-
}
|
|
192
|
-
export function readJson(path) {
|
|
193
|
-
return JSON.parse(readFileSync(path, "utf8"));
|
|
194
|
-
}
|
|
195
|
-
export function isRecord(value) {
|
|
196
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
197
|
-
}
|
|
198
|
-
export function isStringArray(value) {
|
|
199
|
-
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
200
|
-
}
|
|
201
|
-
export function writeJson(path, data) {
|
|
202
|
-
writeFileSync(path, JSON.stringify(data, null, 2) + "\n", "utf8");
|
|
203
|
-
}
|
|
204
|
-
export function readYaml(path) {
|
|
205
|
-
return yaml.load(readFileSync(path, "utf8"));
|
|
206
|
-
}
|
|
207
|
-
export function isSchYamlFilename(path) {
|
|
208
|
-
const name = basename(path);
|
|
209
|
-
return /^sch-.*\.(yaml|yml)$/.test(name);
|
|
210
|
-
}
|
|
211
|
-
export function sleepMs(ms) {
|
|
212
|
-
const sab = new SharedArrayBuffer(4);
|
|
213
|
-
const int32 = new Int32Array(sab);
|
|
214
|
-
Atomics.wait(int32, 0, 0, ms);
|
|
215
|
-
}
|
|
216
|
-
export function toPortablePath(path) {
|
|
217
|
-
return path.replace(/\\/g, "/");
|
|
218
|
-
}
|
|
219
|
-
export function toArtifactPath(path) {
|
|
220
|
-
const rel = relative(specdojoRootDir(), path);
|
|
221
|
-
return toPortablePath(rel || ".");
|
|
222
|
-
}
|
|
223
|
-
export function toScheduleFilePath(schedulePath, filePath) {
|
|
224
|
-
return toPortablePath(relative(schedulePath, filePath) || ".");
|
|
225
|
-
}
|
|
226
|
-
export function formatDateOnlyUtc(dt) {
|
|
227
|
-
const yyyy = dt.getUTCFullYear().toString().padStart(4, "0");
|
|
228
|
-
const mm = (dt.getUTCMonth() + 1).toString().padStart(2, "0");
|
|
229
|
-
const dd = dt.getUTCDate().toString().padStart(2, "0");
|
|
230
|
-
return `${yyyy}-${mm}-${dd}`;
|
|
231
|
-
}
|
|
232
|
-
export function normalizeDateOnly(value) {
|
|
233
|
-
if (value instanceof Date && !Number.isNaN(value.getTime()))
|
|
234
|
-
return formatDateOnlyUtc(value);
|
|
235
|
-
if (typeof value !== "string")
|
|
236
|
-
return null;
|
|
237
|
-
const trimmed = value.trim();
|
|
238
|
-
if (!trimmed)
|
|
239
|
-
return null;
|
|
240
|
-
const m = trimmed.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
241
|
-
if (m)
|
|
242
|
-
return m[1];
|
|
243
|
-
const dt = new Date(trimmed);
|
|
244
|
-
if (Number.isNaN(dt.getTime()))
|
|
245
|
-
return null;
|
|
246
|
-
return formatDateOnlyUtc(dt);
|
|
247
|
-
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function nowUtcIsoSeconds() {
|
|
2
|
+
return new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
3
|
+
}
|
|
4
|
+
export function isUtcIsoSeconds(ts) {
|
|
5
|
+
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(ts);
|
|
6
|
+
}
|
|
7
|
+
export function formatDateOnlyUtc(dt) {
|
|
8
|
+
const yyyy = dt.getUTCFullYear().toString().padStart(4, "0");
|
|
9
|
+
const mm = (dt.getUTCMonth() + 1).toString().padStart(2, "0");
|
|
10
|
+
const dd = dt.getUTCDate().toString().padStart(2, "0");
|
|
11
|
+
return `${yyyy}-${mm}-${dd}`;
|
|
12
|
+
}
|
|
13
|
+
export function normalizeDateOnly(value) {
|
|
14
|
+
if (value instanceof Date && !Number.isNaN(value.getTime()))
|
|
15
|
+
return formatDateOnlyUtc(value);
|
|
16
|
+
if (typeof value !== "string")
|
|
17
|
+
return null;
|
|
18
|
+
const trimmed = value.trim();
|
|
19
|
+
if (!trimmed)
|
|
20
|
+
return null;
|
|
21
|
+
const m = trimmed.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
22
|
+
if (m)
|
|
23
|
+
return m[1];
|
|
24
|
+
const dt = new Date(trimmed);
|
|
25
|
+
if (Number.isNaN(dt.getTime()))
|
|
26
|
+
return null;
|
|
27
|
+
return formatDateOnlyUtc(dt);
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { dump as dumpWithJsYaml, load as loadWithJsYaml, } from "js-yaml";
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
const jsYamlSchemas = require("js-yaml");
|
|
5
|
+
const legacyLoadSchema = (jsYamlSchemas.YAML11_SCHEMA ??
|
|
6
|
+
jsYamlSchemas.DEFAULT_SCHEMA);
|
|
7
|
+
const usesV5Api = jsYamlSchemas.YAML11_SCHEMA !== undefined;
|
|
8
|
+
if (legacyLoadSchema === undefined) {
|
|
9
|
+
throw new Error("js-yaml does not expose a YAML 1.1-compatible schema");
|
|
10
|
+
}
|
|
11
|
+
/** Load YAML with the scalar and merge-key behavior used by js-yaml 4. */
|
|
12
|
+
export function load(source, options = {}) {
|
|
13
|
+
return loadWithJsYaml(source, { ...options, schema: options.schema ?? legacyLoadSchema });
|
|
14
|
+
}
|
|
15
|
+
/** Dump YAML using the v5 option name while remaining runnable before the dependency handoff. */
|
|
16
|
+
export function dump(input, options = {}) {
|
|
17
|
+
const normalized = { ...options };
|
|
18
|
+
const quoteStyle = normalized.quoteStyle;
|
|
19
|
+
delete normalized.quoteStyle;
|
|
20
|
+
if (quoteStyle !== undefined) {
|
|
21
|
+
normalized[usesV5Api ? "quoteStyle" : "quotingType"] = usesV5Api
|
|
22
|
+
? quoteStyle
|
|
23
|
+
: quoteStyle === "single"
|
|
24
|
+
? "'"
|
|
25
|
+
: '"';
|
|
26
|
+
}
|
|
27
|
+
return dumpWithJsYaml(input, normalized);
|
|
28
|
+
}
|
package/dist/specdojo.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { Command } from "commander";
|
|
4
|
-
import { evaluateDistFreshness, inspectDistEntryFreshness } from "./dist-freshness.js";
|
|
5
|
-
import { specdojoPackageVersion } from "./package-paths.js";
|
|
6
|
-
import { registerConfigCommands, registerProjectCommands } from "./specdojo-config.js";
|
|
7
|
-
import { registerExecCommands } from "./exec.js";
|
|
8
|
-
import { registerCatalogCommands } from "./catalog.js";
|
|
9
|
-
import { registerDeliverableCommands } from "./deliverable.js";
|
|
10
|
-
import { registerScheduleCommands } from "./schedule.js";
|
|
11
|
-
import { registerTimelineCommands } from "./timeline.js";
|
|
12
|
-
import { registerIndexCommands } from "./index-command.js";
|
|
13
|
-
import { registerRegisterCommands } from "./register.js";
|
|
14
|
-
import { registerRoutineCommands } from "./routine.js";
|
|
15
|
-
import { registerJobCommands } from "./job.js";
|
|
16
|
-
import { registerWatchCommand } from "./watch.js";
|
|
17
|
-
import { registerBuildCommand } from "./build
|
|
18
|
-
import { registerYamlPagesCommands } from "./yaml-pages-command.js";
|
|
19
|
-
import { registerDashboardCommands } from "./dashboard.js";
|
|
20
|
-
import { registerGradeCommand } from "./grade.js";
|
|
21
|
-
import { registerAgentCommands } from "./agent.js";
|
|
22
|
-
import { registerKataCommands } from "./kata
|
|
23
|
-
import { registerDevcontainerCommands } from "./devcontainer
|
|
24
|
-
import { registerInitCommand } from "./init
|
|
25
|
-
import { registerOrchestratorCommands } from "./orchestrator.js";
|
|
4
|
+
import { evaluateDistFreshness, inspectDistEntryFreshness } from "./shared/dist-freshness.js";
|
|
5
|
+
import { specdojoPackageVersion } from "./shared/package-paths.js";
|
|
6
|
+
import { registerConfigCommands, registerProjectCommands } from "./shared/specdojo-config.js";
|
|
7
|
+
import { registerExecCommands } from "./exec/exec.js";
|
|
8
|
+
import { registerCatalogCommands } from "./catalog/catalog.js";
|
|
9
|
+
import { registerDeliverableCommands } from "./deliverable/deliverable.js";
|
|
10
|
+
import { registerScheduleCommands } from "./schedule/schedule.js";
|
|
11
|
+
import { registerTimelineCommands } from "./dashboard/timeline.js";
|
|
12
|
+
import { registerIndexCommands } from "./docs/index-command.js";
|
|
13
|
+
import { registerRegisterCommands } from "./register/register.js";
|
|
14
|
+
import { registerRoutineCommands } from "./routine/routine.js";
|
|
15
|
+
import { registerJobCommands } from "./job/job.js";
|
|
16
|
+
import { registerWatchCommand } from "./commands/watch.js";
|
|
17
|
+
import { registerBuildCommand } from "./commands/build.js";
|
|
18
|
+
import { registerYamlPagesCommands } from "./docs/yaml-pages-command.js";
|
|
19
|
+
import { registerDashboardCommands } from "./dashboard/dashboard.js";
|
|
20
|
+
import { registerGradeCommand } from "./grade/grade.js";
|
|
21
|
+
import { registerAgentCommands } from "./commands/agent.js";
|
|
22
|
+
import { registerKataCommands } from "./kata/command.js";
|
|
23
|
+
import { registerDevcontainerCommands } from "./devcontainer/command.js";
|
|
24
|
+
import { registerInitCommand } from "./commands/init.js";
|
|
25
|
+
import { registerOrchestratorCommands } from "./commands/orchestrator.js";
|
|
26
26
|
/**
|
|
27
27
|
* bin は dist/specdojo.js を指すため、開発チェックアウトで `npm run build` を忘れると
|
|
28
28
|
* 古い挙動のまま実行される。src が dist より新しい場合は警告し、exec 系は中断する。
|
|
@@ -2,42 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
この規約は、生成される全 exec plan に共通で適用される。result の完了条件、他文書を参照する際のリンク記法、成果物の状態(status)の扱いを統一する。
|
|
4
4
|
|
|
5
|
+
要点(次の `plan-essentials` マーカーの間の箇条書き)は、plan の本文にもそのまま転記される。plan に転記するとき、`_SCHEMA_REF_` はタスクごとに解決した schema のパスに置き換わり、schema の無いタスクではその行が除かれる。
|
|
6
|
+
|
|
7
|
+
<!-- plan-essentials:start -->
|
|
8
|
+
|
|
5
9
|
- result(review plan の場合は review result)への記入は、タスク完了に必須の作業である。成果物の編集とは別に、最後に必ず実施する。
|
|
6
10
|
- 終了コード 0 で完了する前に、result の必須セクションをすべて実際の内容で埋め、プレースホルダ(_TODO_ など)や未記入のセクションを残さない。
|
|
7
|
-
- 成果物に変更が不要と判断した場合でも、result の記入は省略しない。変更不要と判断した理由と根拠を result に記入してから完了する。
|
|
8
|
-
- result が未記入・プレースホルダのまま終了コード 0 で終了すると、runner は成果物未完了(block)として扱い、タスクはやり直しになる。完了前に result の記入漏れがないことを必ず確認する。
|
|
9
|
-
- result の frontmatter は scaffold 済みの構造を正本とする。`id` / `task_id` / `mode` / `project_id` / `plan_ref` / `agent` / `execution` / `approach` / `targets` はキーの追加・削除・改名をせず、scaffold された値のまま維持する。見出し構成(`# Edit Result` などの H1、`## 1.` 以降の章立て)も独自の構成に置き換えない。埋めるのは本文セクションの `_TODO_` プレースホルダの中身だけである。`status` と `completed_at` は完了処理(runner 側)が更新するため、自分で書き換えない。
|
|
10
11
|
- 文書へのリンクは、対象文書が既に存在する場合は `[[id|title]]` 形式で記載する(`id` は project 修飾 doc id)。
|
|
11
12
|
- リンクを表(テーブル)のセル内に置く場合は、区切りの `|` を `[[id\|title]]` のようにエスケープする。エスケープしないと列がずれて表が壊れ、prettier 整形でセルが分割されて固定化される。
|
|
12
13
|
- まだ存在しない文書を参照する場合は、`[[...]]` ではなく `` `id` `` または `` `filename` `` のようにバッククォートで仮置きする。
|
|
13
14
|
- Markdown の自由記述では、`_` を含む識別子・フィールド名(例: `depends_on`)を必ずインラインコードで囲む。result に描画される executor evidence や reporter の自由記述も同じ記法にする。
|
|
14
15
|
- 成果物 frontmatter の `status` を `ready` に変更しない。`ready` への昇格は人間のみが行うため、`draft` のまま据え置く(exec のコミット時ガードでも昇格はブロックされる)。
|
|
16
|
+
- ファイルの読み取り・書き込み・編集は、作業ディレクトリ(カレントディレクトリ)からの相対パスで指定する。絶対パスを自分で組み立てたり、作業ディレクトリ名を推測して指定したりしない(作業ディレクトリ名の取り違えは外部パス扱いになり拒否される)。
|
|
17
|
+
- 検査を実行する前に、リポジトリの `package.json`、`.specdojo/specdojo.config.json`、hook 設定(`lefthook.yml` など)を読み、本共通規約の詳細にある検査表の適用条件で、実行する検査を決める。
|
|
18
|
+
- 適用条件を満たさない検査は実行せず、executor evidence の validations に `not_applicable` と非適用の理由を `reason` へ記録する。適用される検査が 1 つもない場合も同じく、該当する検査ごとに `not_applicable` と理由を記録する。
|
|
19
|
+
- `not_run` は、適用される検査を実行できたのに実行しなかった場合だけに使う。runner は `not_run` を検証失敗として扱い、タスクを先へ進めない。
|
|
20
|
+
- YAML 成果物を編集した場合、対応 schema `_SCHEMA_REF_` に従って記述する。`package.json` に `validate:schema:file` script がある場合だけ、`npm run validate:schema:file -- --schema _SCHEMA_REF_ --data <対象ファイル>` で schema 検査を実施する。適用した検査でエラーが出た場合は修正してから完了とする。
|
|
21
|
+
|
|
22
|
+
<!-- plan-essentials:end -->
|
|
23
|
+
|
|
24
|
+
- 成果物に変更が不要と判断した場合でも、result の記入は省略しない。変更不要と判断した理由と根拠を result に記入してから完了する。
|
|
25
|
+
- result の変更ファイル欄には、変更したファイル(成果物・ソース・テストなど)ごとの実施内容を具体的に記入する。
|
|
26
|
+
- result が未記入・プレースホルダのまま終了コード 0 で終了すると、runner は成果物未完了(block)として扱い、タスクはやり直しになる。完了前に result の記入漏れがないことを必ず確認する。
|
|
27
|
+
- result の frontmatter は scaffold 済みの構造を正本とする。`id` / `task_id` / `mode` / `project_id` / `plan_ref` / `agent` / `execution` / `approach` / `targets` はキーの追加・削除・改名をせず、scaffold された値のまま維持する。見出し構成(`# Edit Result` などの H1、`## 1.` 以降の章立て)も独自の構成に置き換えない。埋めるのは本文セクションの `_TODO_` プレースホルダの中身だけである。`status` と `completed_at` は完了処理(runner 側)が更新するため、自分で書き換えない。
|
|
15
28
|
- plan に「プロジェクトコンテキスト」章がある場合、そこに挙がる文書はプロジェクト共通の前提を読むための参照であり、成果物 frontmatter の `based_on` へ転記しない。参照して得た前提は本文の記述内容へ反映する。
|
|
16
29
|
- 成果物 frontmatter の `based_on` に書けるのは、その成果物の `depends_on` の推移閉包に含まれる先行成果物だけである。閉包外の ID を書くと `catalog validate` が「`based_on` が `depends_on` の推移閉包に含まれていません」としてエラーになり、コミットがブロックされる。`based_on` を増やす必要が生じた場合は、自分で転記せず、根拠不足として result に記録する。
|
|
17
|
-
- ファイルの読み取り・書き込み・編集は、作業ディレクトリ(カレントディレクトリ)からの相対パスで指定する。絶対パスを自分で組み立てたり、作業ディレクトリ名を推測して指定したりしない(作業ディレクトリ名の取り違えは外部パス扱いになり拒否される)。
|
|
18
30
|
- 編集・書き込みが作業ディレクトリ外(`external_directory`)として拒否された場合、原因はパス指定の誤り(誤った絶対パス・ディレクトリ名の取り違え)である。bash の heredoc などへ回避的に切り替えず、相対パスに直したうえで同じ編集ツールで再実行する。
|
|
19
31
|
- 作業用のファイル(編集用スクリプト、検証用の一時データなど)はリポジトリの外(一時ディレクトリ)または worktree の `tmp/` 配下に置き、終了前に削除する。使い捨てのファイルを最上位に作らない。`tmp/` 配下のファイルは commit の対象から除外される。
|
|
20
32
|
- 整形・静的検査は、この plan の完了手順または本共通規約で明示されたコマンドを実行する。変更対象に必要な test、build、schema 検証は、plan に個別記載がなくても実行してよい。同じ test script では対象限定と全件を同一 executor run 内で連続実行せず、どちらか一方に絞る。下表、plan、またはプロジェクト標準が全件 test を求める場合は、全件を1回だけ実行して対象限定の実行を省く。この制約は executor が sandbox 内で実行する test script の回数に対するものであり、親検証に設定された ID のコマンドは対象外である(親 runner が別途実行する)。実行したコマンド・対象・結果は result に記録する。
|
|
21
33
|
- executor / reporter pipeline で親 runner の検証が設定されている場合、executor は設定済み ID に対応するコマンドを sandbox 内で実行せず、executor 終了後に親 runner が固定許可リストから実行して evidence へ追記する。`validate-schema` は `npm run validate:schema`、`test-unit` は `npm run test:unit`、`test-integration` は `npm run test:integration` に対応する。executor は親検証と同じコマンドの対象限定版も追加せず、二重実行しない。
|
|
22
|
-
-
|
|
34
|
+
- 適用条件の判定と `not_applicable` / `not_run` の使い分けは、要点に記した規則に従う。誤って `not_run` と記録しても、npm script・依存 package の不在、または SpecDojo サブコマンドの設定上の非適用を runner が機械的に確定できる場合は適用外として扱われるが、この救済を前提に記録を省略しない。
|
|
23
35
|
- 依存パッケージの有無は、対象リポジトリの `package.json` の `dependencies` / `devDependencies` と、リポジトリに固定された package manager の設定を基準に判断する。`npx` が未導入パッケージをネットワークから一時取得できることは、導入済みとはみなさない。設定ファイルがない、壊れているなどの理由で適用条件を確定できない検査は実行せず、validations に `not_applicable` として理由と次の確認事項を記録する。
|
|
36
|
+
- `npm init` が `package.json` に入れる仮の `test` script(`echo "Error: no test specified" && exit 1` と、引用符の有無・種類や空白だけが違う変種)は、常に失敗する仮置きであり、`test` script がないものとみなす。`npm test` は実行せず、validations に `not_applicable` と、仮の script である旨を `reason` に記録する。runner も同じ判断で `not_applicable` を受け付ける。本物の test script がある場合は適用される。
|
|
24
37
|
- Markdown 成果物を編集した場合、Prettier が導入されているときだけ `npx prettier --write <対象ファイル>` で整形する。`markdownlint-cli` または `markdownlint` が導入されているときだけ `npx markdownlint <対象ファイル>` を実行し、`markdownlint-cli2` を採用するリポジトリでは、そのリポジトリで定めた CLI2 のコマンドを実行する。適用した検査でエラーが出た場合は修正してから完了とする。
|
|
25
|
-
- YAML 成果物を編集した場合、対応 schema `_SCHEMA_REF_` に従って記述する。`package.json` に `validate:schema:file` script がある場合だけ、`npm run validate:schema:file -- --schema _SCHEMA_REF_ --data <対象ファイル>` で schema 検査を実施する。適用した検査でエラーが出た場合は修正してから完了とする。
|
|
26
38
|
- 終了する前に、コミット時に実行される検査(pre-commit 相当)のうち、現在のリポジトリに設定され、上記の適用条件を満たすものを先回りで実行する。適用した検査の失敗はすべて修正してから完了する。
|
|
27
39
|
- 実行対象は、変更したファイルの種別で判断する。下表のうち、変更したファイルが該当し、かつ適用条件を満たす行の検査を実行する。該当行がない場合や適用条件を満たさない場合は追加の検査は不要である。ただし親検証に設定された ID のコマンドは下表よりも優先し、executor は実行しない。下表に同じコマンドが挙がっていても、親 runner の実行に委ねる。
|
|
28
40
|
- 検査コマンドの正本はリポジトリの hook 設定(`lefthook.yml` など)である。下表と設定が食い違う場合は、適用条件を満たす設定側のコマンドに合わせ、実行したコマンドと結果を result に記録する。`specdojo` コマンドは、リポジトリで定められた起動方法(`npx specdojo <subcommand>`、`npx tsx src/specdojo.ts <subcommand>` など)で実行する。ただし、sandbox 環境で `tsx` の IPC エラー(`EPERM`)が発生する場合は、代わりに `node --import tsx src/specdojo.ts <subcommand>` を使用して実行する。
|
|
29
41
|
|
|
30
|
-
| 変更したファイル | 適用条件
|
|
31
|
-
| ------------------------------------------------------------------------------------------------------ |
|
|
32
|
-
| `*.md` | 対応するローカル依存が `package.json` にある
|
|
33
|
-
| `*.ts` / `*.js` / `*.json` / `*.yaml` / `*.yml` | Prettier が `package.json` にある
|
|
34
|
-
| `src/`、`tests/`、`scripts/`、`tools/`、`tsconfig*.json` | `package.json` に `typecheck` script がある
|
|
35
|
-
| `src/`、`tests/`、`docs/ja/specdojo/templates/`、`docs/ja/specdojo/exec-templates/`、`vitest.config.*` | pipeline executor は `test:unit`、それ以外は `test` script が `package.json`
|
|
36
|
-
| `docs/ja/projects/` 配下 | 対象 project に `catalog_path` が設定されている
|
|
37
|
-
| `dct-*.yaml` | 対象 project に `catalog_path` が設定されている
|
|
38
|
-
| `pjr-index.md` | 対象 project に `project_register_path` が設定されている
|
|
39
|
-
| `sch-*.yaml` | 対象 project に `schedule_path` が設定されている
|
|
40
|
-
| `docs/` 配下 | リポジトリで定められた起動方法により SpecDojo CLI を実行できる
|
|
42
|
+
| 変更したファイル | 適用条件 | 実行する検査 |
|
|
43
|
+
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
44
|
+
| `*.md` | 対応するローカル依存が `package.json` にある | `npx prettier --write <対象ファイル>`、導入済み実装に対応する markdownlint コマンド |
|
|
45
|
+
| `*.ts` / `*.js` / `*.json` / `*.yaml` / `*.yml` | Prettier が `package.json` にある | `npx prettier --write <対象ファイル>` |
|
|
46
|
+
| `src/`、`tests/`、`scripts/`、`tools/`、`tsconfig*.json` | `package.json` に `typecheck` script がある | `npm run typecheck` |
|
|
47
|
+
| `src/`、`tests/`、`docs/ja/specdojo/templates/`、`docs/ja/specdojo/exec-templates/`、`vitest.config.*` | pipeline executor は `test:unit`、それ以外は `test` script が `package.json` にある(`npm init` の仮の `test` script は、ないものとみなす) | pipeline executor は `npm run test:unit`、それ以外は `npm test`(`test-unit` が親検証に設定されている場合は executor では実行しない) |
|
|
48
|
+
| `docs/ja/projects/` 配下 | 対象 project に `catalog_path` が設定されている | `specdojo catalog validate` |
|
|
49
|
+
| `dct-*.yaml` | 対象 project に `catalog_path` が設定されている | `specdojo catalog build` |
|
|
50
|
+
| `pjr-index.md` | 対象 project に `project_register_path` が設定されている | `specdojo register build` |
|
|
51
|
+
| `sch-*.yaml` | 対象 project に `schedule_path` が設定されている | `specdojo exec refresh` |
|
|
52
|
+
| `docs/` 配下 | リポジトリで定められた起動方法により SpecDojo CLI を実行できる | `specdojo index build` |
|
|
41
53
|
|
|
42
54
|
<!-- review-only:start -->
|
|
43
55
|
|
|
@@ -15,13 +15,12 @@ _PJR_DESCRIPTION_
|
|
|
15
15
|
- `priority`: _PJR_PRIORITY_
|
|
16
16
|
- `owner`: _PJR_OWNER_
|
|
17
17
|
- `due`: _PJR_DUE_
|
|
18
|
-
- `登録簿`: `_PJR_INDEX_PATH_`
|
|
19
18
|
- `個票`: _PJR_TICKET_REF_
|
|
20
19
|
- `result`: `_RESULT_REF_`
|
|
21
20
|
|
|
22
21
|
## 3. 進め方
|
|
23
22
|
|
|
24
|
-
1.
|
|
23
|
+
1. 個票(存在する場合)を読み、問い・リスク内容・判断に必要な条件を把握する。登録簿の一覧は大きいため読まない。
|
|
25
24
|
2. 関連する成果物・設計書・実装・実行ログを確認し、判断材料を集める。
|
|
26
25
|
3. 実行 agent が Web 検索能力を持ち、一般的な観点・用語・標準の確認が必要な場合は、関連情報を取得して出典を添える。
|
|
27
26
|
4. 集めた材料から結論案を組み立てる。question は回答案、risk は影響・発生可能性の評価と対応案(回避・軽減・受容など)を示す。
|
|
@@ -15,13 +15,12 @@ _PJR_DESCRIPTION_
|
|
|
15
15
|
- `priority`: _PJR_PRIORITY_
|
|
16
16
|
- `owner`: _PJR_OWNER_
|
|
17
17
|
- `due`: _PJR_DUE_
|
|
18
|
-
- `登録簿`: `_PJR_INDEX_PATH_`
|
|
19
18
|
- `個票`: _PJR_TICKET_REF_
|
|
20
19
|
- `result`: `_RESULT_REF_`
|
|
21
20
|
|
|
22
21
|
## 3. 進め方
|
|
23
22
|
|
|
24
|
-
1.
|
|
23
|
+
1. 個票(存在する場合)を読み、目的・完了条件・制約を把握する。登録簿の一覧は大きいため読まない。
|
|
25
24
|
2. 個票に完了条件がある場合はそれを作業の基準にする。無い場合はタイトルと説明から完了条件の仮説を立て、その仮説を result に明記する。
|
|
26
25
|
3. 関連する成果物・設計書・実装を確認し、対象ファイルを特定して変更する。
|
|
27
26
|
4. 個票が存在する場合は、個票の作業内容・対応結果セクションを実施内容で更新する。
|
|
@@ -14,6 +14,4 @@ _TODO_: 変更したファイルのパスを記入する。
|
|
|
14
14
|
|
|
15
15
|
_TODO_: 後続タスクへの申し送り事項を記入する(なければ削除)。
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_TODO_: `approach` に従ってどう進めたか、その進め方の中で実践の型(rulebook / recipe / sample / template)をどう適用したかを記入する(`fully-guided` で rulebook / recipe / sample / template をどう使い分けたか、`recipe-guided` で recipe のみを基準にした内容、`freeform` で実践の型より優先した実例やプロジェクト文脈、`retrofit` で実際に参照した実装パス・抽出した現在動作・反映/新設判断・未反映の乖離・未確認範囲、`rulebook-maintenance` などの maintenance 系で見直した実践の型とその根拠、など)。実践の型を基準にしなかった場合は、その判断と代わりに根拠にした内容も記入する。複数文書間に矛盾があり rulebook を正として判断した箇所、参照範囲から外れていた文書とその代わりに根拠にした内容があれば、あわせて記録する。
|
|
17
|
+
_APPROACH_SECTION_
|
|
@@ -30,15 +30,17 @@ _ANALYSIS_DESCRIPTION_
|
|
|
30
30
|
1. `_BASE_COMMIT_.._OUTPUT_COMMIT_` の差分が当該 Job Run の出力だけで構成されている。
|
|
31
31
|
2. Job Run の状態、command evidence、result の記述が相互に整合している。
|
|
32
32
|
3. score・verdict・finding・失敗文書がある場合は、その変化と理由を確認している。
|
|
33
|
-
4. Run
|
|
34
|
-
5.
|
|
33
|
+
4. Run が `partial` の場合は、完了分を統合でき、失敗分が次の Run で再試行できる記録を持つときだけ `complete-with-findings` とし、失敗した対象と理由を finding に残している。
|
|
34
|
+
5. Run が `failed` の場合、または `partial` でも完了分がない、失敗分を再試行できない、未開始の対象がある場合は `incomplete` とし、再開または人手対応に必要な理由を残している。
|
|
35
|
+
6. reviewer は Job Run の出力を修正せず、review result だけに判断を記録している。
|
|
35
36
|
|
|
36
37
|
## 4. 判断手順
|
|
37
38
|
|
|
38
39
|
1. `git diff --stat _BASE_COMMIT_.._OUTPUT_COMMIT_` と `git diff --name-status _BASE_COMMIT_.._OUTPUT_COMMIT_` で出力範囲を確認する。
|
|
39
40
|
2. Job Run の plan・result・evidence・Run JSON と、Job が更新した成果物を照合する。
|
|
40
|
-
3.
|
|
41
|
-
4.
|
|
41
|
+
3. `succeeded` で完了条件を満たす場合は `complete`、軽微な finding を残して統合可能なら `complete-with-findings` とする。
|
|
42
|
+
4. `partial` で完了分を統合可能かつ失敗分を次の Run へ回せる場合は `complete-with-findings` とする。`partial` に `complete` は使わない。
|
|
43
|
+
5. 失敗、未完了、対象外変更、根拠不足がある場合は `incomplete` とし、改善指示と waiting の理由を明記する。
|
|
42
44
|
|
|
43
45
|
## 5. 完了手順
|
|
44
46
|
|