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,14 +1,14 @@
|
|
|
1
1
|
import { createInterface } from "node:readline/promises";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative } from "node:path";
|
|
4
|
-
import
|
|
5
|
-
import { runScaffold } from "
|
|
6
|
-
import { runDevcontainerScaffold } from "
|
|
7
|
-
import { runProviderScaffold } from "
|
|
8
|
-
import { generateDerivedViewFiles } from "
|
|
9
|
-
import { defaultWorktreeBase, projectGitignoreLayout, specdojoRootDir, } from "
|
|
10
|
-
import { ensureGitignore, formatGitignoreReport, gitignorePatternsForLayouts, } from "
|
|
11
|
-
import { specdojoPackageRootDir } from "
|
|
4
|
+
import { dump, load } from "../shared/yaml.js";
|
|
5
|
+
import { runScaffold } from "../catalog/scaffold.js";
|
|
6
|
+
import { runDevcontainerScaffold } from "../devcontainer/scaffold.js";
|
|
7
|
+
import { runProviderScaffold } from "../shared/provider-scaffold.js";
|
|
8
|
+
import { generateDerivedViewFiles } from "../register/register.js";
|
|
9
|
+
import { defaultWorktreeBase, projectGitignoreLayout, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
10
|
+
import { ensureGitignore, formatGitignoreReport, gitignorePatternsForLayouts, } from "../shared/specdojo-gitignore.js";
|
|
11
|
+
import { specdojoPackageRootDir } from "../shared/package-paths.js";
|
|
12
12
|
const PROVIDERS = ["claude", "codex", "opencode", "antigravity", "copilot"];
|
|
13
13
|
const PARENT_VALIDATION_SCRIPTS = {
|
|
14
14
|
"lint-ts": "lint:ts",
|
|
@@ -63,22 +63,53 @@ function parseCatalog(value) {
|
|
|
63
63
|
}
|
|
64
64
|
throw new Error(`Invalid catalog size: ${value}. Must be small, medium, large, or none`);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
if (!/^prj-[0-9]{4,}$/.test(
|
|
68
|
-
throw new Error(`Invalid project ID: ${
|
|
66
|
+
function validateProjectId(projectId) {
|
|
67
|
+
if (!/^prj-[0-9]{4,}$/.test(projectId)) {
|
|
68
|
+
throw new Error(`Invalid project ID: ${projectId}. Expected prj-0001 style`);
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
return projectId;
|
|
71
|
+
}
|
|
72
|
+
function validateProjectName(projectName) {
|
|
73
|
+
if (!projectName.trim())
|
|
71
74
|
throw new Error("Project name must not be empty");
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
return projectName;
|
|
76
|
+
}
|
|
77
|
+
function validateNickname(nickname) {
|
|
78
|
+
if (!/^[a-z0-9][a-z0-9_-]{0,62}$/.test(nickname)) {
|
|
79
|
+
throw new Error(`Invalid nickname: ${nickname}`);
|
|
74
80
|
}
|
|
75
|
-
|
|
81
|
+
return nickname;
|
|
82
|
+
}
|
|
83
|
+
function validateDisplayName(displayName) {
|
|
84
|
+
if (!displayName.trim())
|
|
76
85
|
throw new Error("Display name must not be empty");
|
|
77
|
-
|
|
86
|
+
return displayName;
|
|
87
|
+
}
|
|
88
|
+
function validateExecProviders(providers, exec) {
|
|
89
|
+
if (exec && providers.length === 0) {
|
|
78
90
|
throw new Error("--exec requires at least one --provider");
|
|
79
91
|
}
|
|
92
|
+
return providers;
|
|
93
|
+
}
|
|
94
|
+
function validateAnswers(answers) {
|
|
95
|
+
validateProjectId(answers.projectId);
|
|
96
|
+
validateProjectName(answers.projectName);
|
|
97
|
+
validateNickname(answers.nickname);
|
|
98
|
+
validateDisplayName(answers.displayName);
|
|
99
|
+
validateExecProviders(answers.providers, answers.exec);
|
|
80
100
|
return answers;
|
|
81
101
|
}
|
|
102
|
+
async function promptUntilValid(prompter, prompt, parse) {
|
|
103
|
+
while (true) {
|
|
104
|
+
const answer = await prompter.question(prompt);
|
|
105
|
+
try {
|
|
106
|
+
return parse(answer);
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
82
113
|
export async function collectInitAnswers(options, prompter) {
|
|
83
114
|
if (!prompter) {
|
|
84
115
|
const answers = validateAnswers({
|
|
@@ -116,18 +147,21 @@ export async function collectInitAnswers(options, prompter) {
|
|
|
116
147
|
const displayNameDefault = options.displayName?.trim() || DEFAULTS.displayName;
|
|
117
148
|
const providerDefault = options.provider?.trim() || DEFAULTS.providers.join(",");
|
|
118
149
|
const execDefault = !!options.exec;
|
|
119
|
-
const catalogDefault = options.catalog?.trim() || "none";
|
|
120
150
|
const devcontainerDefault = !!options.devcontainer;
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const exec =
|
|
129
|
-
|
|
130
|
-
|
|
151
|
+
const providerPrompt = `Orchestrator providers (${PROVIDERS.join(", ")}) [${providerDefault}]: `;
|
|
152
|
+
const projectId = await promptUntilValid(prompter, `Project ID [${projectDefault}]: `, (answer) => validateProjectId(answer.trim() || projectDefault));
|
|
153
|
+
const projectName = await promptUntilValid(prompter, `Project name [${nameDefault}]: `, (answer) => validateProjectName(answer.trim() || nameDefault));
|
|
154
|
+
const register = await promptUntilValid(prompter, `Create a project register? [${registerDefault ? "Y/n" : "y/N"}]: `, (answer) => parseBoolean(answer, registerDefault));
|
|
155
|
+
const nickname = await promptUntilValid(prompter, `Your nickname [${nicknameDefault}]: `, (answer) => validateNickname(answer.trim() || nicknameDefault));
|
|
156
|
+
const displayName = await promptUntilValid(prompter, `Your display name [${displayNameDefault}]: `, (answer) => validateDisplayName(answer.trim() || displayNameDefault));
|
|
157
|
+
let providers = await promptUntilValid(prompter, providerPrompt, (answer) => parseProviders(answer.trim() || providerDefault));
|
|
158
|
+
const exec = await promptUntilValid(prompter, `Delegate work to agents (exec)? [${execDefault ? "Y/n" : "y/N"}]: `, (answer) => parseBoolean(answer, execDefault));
|
|
159
|
+
if (exec && providers.length === 0) {
|
|
160
|
+
process.stderr.write("--exec requires at least one --provider\n");
|
|
161
|
+
providers = await promptUntilValid(prompter, providerPrompt, (answer) => validateExecProviders(parseProviders(answer.trim() || providerDefault), true));
|
|
162
|
+
}
|
|
163
|
+
const catalog = parseCatalog(options.catalog);
|
|
164
|
+
const devcontainer = await promptUntilValid(prompter, `Create a Dev Container? [${devcontainerDefault ? "Y/n" : "y/N"}]: `, (answer) => parseBoolean(answer, devcontainerDefault));
|
|
131
165
|
return validateAnswers({
|
|
132
166
|
projectId,
|
|
133
167
|
projectName,
|
|
@@ -179,7 +213,7 @@ function writeNewFile(repoRoot, relPath, content, dryRun) {
|
|
|
179
213
|
return true;
|
|
180
214
|
}
|
|
181
215
|
function humanRoster(answers) {
|
|
182
|
-
return
|
|
216
|
+
return dump({
|
|
183
217
|
id: `${answers.projectId}:pm-members`,
|
|
184
218
|
type: "project",
|
|
185
219
|
status: "draft",
|
|
@@ -201,7 +235,7 @@ function humanRoster(answers) {
|
|
|
201
235
|
}, { lineWidth: 120, noRefs: true });
|
|
202
236
|
}
|
|
203
237
|
function loadInitTemplate(packageRoot, filename) {
|
|
204
|
-
return
|
|
238
|
+
return load(readFileSync(join(packageRoot, "templates", filename), "utf8"));
|
|
205
239
|
}
|
|
206
240
|
function readPackageScripts(repoRoot) {
|
|
207
241
|
const packageJsonPath = join(repoRoot, "package.json");
|
|
@@ -242,11 +276,35 @@ function selectParentValidations(repoRoot, configured) {
|
|
|
242
276
|
}
|
|
243
277
|
return selected;
|
|
244
278
|
}
|
|
279
|
+
// 別名は向き先の実体が選ばれた provider に含まれる場合だけ残す。別名どうしの連鎖も辿る。
|
|
280
|
+
function selectAliases(aliases, memberNicknames) {
|
|
281
|
+
const targets = new Map(aliases.map((alias) => [alias.nickname, alias.alias_of]));
|
|
282
|
+
const resolvesToSelected = (nickname) => {
|
|
283
|
+
const seen = new Set();
|
|
284
|
+
let current = nickname;
|
|
285
|
+
while (!seen.has(current)) {
|
|
286
|
+
seen.add(current);
|
|
287
|
+
const target = targets.get(current);
|
|
288
|
+
if (!target)
|
|
289
|
+
return false;
|
|
290
|
+
if (memberNicknames.has(target))
|
|
291
|
+
return true;
|
|
292
|
+
current = target;
|
|
293
|
+
}
|
|
294
|
+
return false;
|
|
295
|
+
};
|
|
296
|
+
return aliases.filter((alias) => resolvesToSelected(alias.nickname));
|
|
297
|
+
}
|
|
298
|
+
// 次の手順の案内には、利用者が見慣れた別名を優先して示す(実体の名前でも同じ member が動く)。
|
|
299
|
+
function preferredAgentName(member, aliases) {
|
|
300
|
+
return aliases.find((alias) => alias.alias_of === member.nickname)?.nickname ?? member.nickname;
|
|
301
|
+
}
|
|
245
302
|
function writeExecConfiguration(repoRoot, packageRoot, providers, dryRun) {
|
|
246
303
|
const memberTemplate = loadInitTemplate(packageRoot, "init-agent-members.yaml");
|
|
247
304
|
const defaultsTemplate = loadInitTemplate(packageRoot, "init-exec-defaults.yaml");
|
|
248
305
|
const selected = new Set(providers);
|
|
249
306
|
const members = memberTemplate.members.filter((member) => member.provider && selected.has(member.provider));
|
|
307
|
+
const aliases = selectAliases(memberTemplate.aliases ?? [], new Set(members.map((member) => member.nickname)));
|
|
250
308
|
const providerDefaults = Object.fromEntries(Object.entries(defaultsTemplate.providers).filter(([provider]) => selected.has(provider)));
|
|
251
309
|
const { providers: _providers, ...commonDefaults } = defaultsTemplate;
|
|
252
310
|
const commonPipeline = commonDefaults.pipeline && typeof commonDefaults.pipeline === "object"
|
|
@@ -264,8 +322,8 @@ function writeExecConfiguration(repoRoot, packageRoot, providers, dryRun) {
|
|
|
264
322
|
else {
|
|
265
323
|
delete configuredDefaults.pipeline;
|
|
266
324
|
}
|
|
267
|
-
writeNewFile(repoRoot, ".specdojo/agent-members.yaml",
|
|
268
|
-
writeNewFile(repoRoot, ".specdojo/exec-defaults.yaml",
|
|
325
|
+
writeNewFile(repoRoot, ".specdojo/agent-members.yaml", dump({ version: 1, members, ...(aliases.length > 0 ? { aliases } : {}) }, { lineWidth: 120, noRefs: true }), dryRun);
|
|
326
|
+
writeNewFile(repoRoot, ".specdojo/exec-defaults.yaml", dump({ ...configuredDefaults, providers: providerDefaults }, { lineWidth: 120, noRefs: true }), dryRun);
|
|
269
327
|
const primaryProvider = providers[0];
|
|
270
328
|
const executor = members.find((member) => member.provider === primaryProvider &&
|
|
271
329
|
member.stage_role === "executor" &&
|
|
@@ -274,7 +332,10 @@ function writeExecConfiguration(repoRoot, packageRoot, providers, dryRun) {
|
|
|
274
332
|
if (!executor || !reporter) {
|
|
275
333
|
throw new Error("init-agent-members.yaml must define an edit executor and reporter");
|
|
276
334
|
}
|
|
277
|
-
return {
|
|
335
|
+
return {
|
|
336
|
+
executor: preferredAgentName(executor, aliases),
|
|
337
|
+
reporter: preferredAgentName(reporter, aliases),
|
|
338
|
+
};
|
|
278
339
|
}
|
|
279
340
|
function scaffoldRegister(repoRoot, config, answers, dryRun) {
|
|
280
341
|
if (!answers.register)
|
|
@@ -301,7 +362,7 @@ function catalogTemplateEntries(packageRoot) {
|
|
|
301
362
|
.filter((file) => /^dct-.+-template\.yaml$/.test(file))
|
|
302
363
|
.sort()
|
|
303
364
|
.map((file) => {
|
|
304
|
-
const doc =
|
|
365
|
+
const doc = load(readFileSync(join(templateDir, file), "utf8"));
|
|
305
366
|
return {
|
|
306
367
|
file,
|
|
307
368
|
domain: doc.domain,
|
|
@@ -317,7 +378,7 @@ function scaffoldCatalog(repoRoot, packageRoot, config, answers, dryRun) {
|
|
|
317
378
|
const catalogPath = join(repoRoot, catalogRel);
|
|
318
379
|
const templates = catalogTemplateEntries(packageRoot);
|
|
319
380
|
const domains = [...new Map(templates.map((entry) => [entry.domain, entry])).values()];
|
|
320
|
-
writeNewFile(repoRoot, join(catalogRel, "dct-index.yaml"),
|
|
381
|
+
writeNewFile(repoRoot, join(catalogRel, "dct-index.yaml"), dump({
|
|
321
382
|
id: `${answers.projectId}:dct-index`,
|
|
322
383
|
type: "project",
|
|
323
384
|
status: "draft",
|
|
@@ -392,18 +453,19 @@ export async function runInit(options, deps) {
|
|
|
392
453
|
await runDevcontainerScaffold({
|
|
393
454
|
packageRoot,
|
|
394
455
|
repoRoot,
|
|
456
|
+
workspaceName: options.workspaceName,
|
|
395
457
|
providers: answers.providers,
|
|
396
458
|
editors: [],
|
|
397
459
|
ollama: answers.providers.includes("opencode"),
|
|
398
460
|
cron: false,
|
|
399
|
-
tmux:
|
|
461
|
+
tmux: true,
|
|
400
462
|
force: false,
|
|
401
463
|
dryRun,
|
|
402
464
|
});
|
|
403
465
|
}
|
|
404
466
|
const firstProvider = answers.providers[0];
|
|
405
467
|
const script = firstProvider === "claude"
|
|
406
|
-
? "orch:
|
|
468
|
+
? "orch:opus"
|
|
407
469
|
: firstProvider === "antigravity"
|
|
408
470
|
? "orch:agy"
|
|
409
471
|
: `orch:${firstProvider}`;
|
|
@@ -414,7 +476,10 @@ export async function runInit(options, deps) {
|
|
|
414
476
|
(execAgents
|
|
415
477
|
? ` 2. To run an item without the orchestrator: npx specdojo exec run --register <id> --executor-by ${execAgents.executor} --reporter-by ${execAgents.reporter}\n`
|
|
416
478
|
: "") +
|
|
417
|
-
` ${execAgents ? "3" : "2"}. Review and commit the files created by specdojo init.\n`
|
|
479
|
+
` ${execAgents ? "3" : "2"}. Review and commit the files created by specdojo init.\n` +
|
|
480
|
+
(answers.catalog
|
|
481
|
+
? ""
|
|
482
|
+
: "When deliverables are ready, configure catalog_path in .specdojo/specdojo.config.json and run npx specdojo catalog scaffold (see docs/ja/specdojo/guides/quick-start-guide.md).\n"));
|
|
418
483
|
}
|
|
419
484
|
export function registerInitCommand(program) {
|
|
420
485
|
program
|
|
@@ -430,6 +495,7 @@ export function registerInitCommand(program) {
|
|
|
430
495
|
.option("--exec", "Configure executor and reporter agents", false)
|
|
431
496
|
.option("--catalog <size>", "Create a deliverables catalog (small|medium|large)")
|
|
432
497
|
.option("--devcontainer", "Create a Dev Container for the selected providers", false)
|
|
498
|
+
.option("--workspace-name <name>", "Override the Dev Container workspace parent name used under /workspaces")
|
|
433
499
|
.option("--dry-run", "Show planned files and changes without writing", false)
|
|
434
500
|
.action(async (options) => {
|
|
435
501
|
try {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { constants as osConstants } from "node:os";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
-
import { agentExtraRootArguments, resolveProductRepos } from "
|
|
5
|
-
import { loadConfig, specdojoRootDir, } from "
|
|
4
|
+
import { agentExtraRootArguments, resolveProductRepos } from "../exec/task-repos.js";
|
|
5
|
+
import { loadConfig, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
6
6
|
const ORCHESTRATOR_EXECUTABLES = {
|
|
7
7
|
claude: "claude",
|
|
8
8
|
codex: "codex",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { watch as fsWatch, existsSync, readdirSync } from "node:fs";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
|
-
import { getProjectCatalogPath, getProjectExecutionPath, getProjectRegisterPath, getProjectSchedulePath, loadConfig, loadEnv, specdojoRootDir, } from "
|
|
5
|
-
import { selfRunArgs } from "
|
|
6
|
-
import { isDctPlanFileName } from "
|
|
4
|
+
import { getProjectCatalogPath, getProjectExecutionPath, getProjectRegisterPath, getProjectSchedulePath, loadConfig, loadEnv, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
5
|
+
import { selfRunArgs } from "../shared/spawn-self.js";
|
|
6
|
+
import { isDctPlanFileName } from "../catalog/plan.js";
|
|
7
7
|
const VALID_SCOPES = ["exec", "catalog", "register", "index", "all"];
|
|
8
8
|
const SKIP_DIRS = new Set([".git", "node_modules", "generated", "dist", ".vitepress"]);
|
|
9
9
|
// ================================
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { addWorkingDaysToDate } from "../exec/schedule/calendar.js";
|
|
2
|
+
import { buildScheduleIndex, defaultScheduleCalendar } from "../shared/schedule-index.js";
|
|
3
|
+
import { buildTimelineWaves } from "./timeline-build.js";
|
|
4
|
+
// tml-index の tracks を order → wave に集約し、planned_start_date と稼働日カレンダーで各トラックの
|
|
5
|
+
// 予定開始日・終了日を算出する。横軸は日付であり、wave 番号ではない。
|
|
6
|
+
export function computeTimelineTrackSchedules(index, calendar) {
|
|
7
|
+
const waves = buildTimelineWaves(index.tracks);
|
|
8
|
+
const waveNumberByOrder = new Map();
|
|
9
|
+
for (const wave of waves) {
|
|
10
|
+
for (const tk of wave.tracks)
|
|
11
|
+
waveNumberByOrder.set(tk.order, wave.wave);
|
|
12
|
+
}
|
|
13
|
+
const startByTrack = new Map();
|
|
14
|
+
const endByTrack = new Map();
|
|
15
|
+
let cursor = index.planned_start_date;
|
|
16
|
+
for (const wave of waves) {
|
|
17
|
+
const waveStart = cursor;
|
|
18
|
+
let waveEnd;
|
|
19
|
+
for (const tk of wave.tracks) {
|
|
20
|
+
startByTrack.set(tk.track, waveStart);
|
|
21
|
+
if (tk.catalog_duration_estimate_days && waveStart) {
|
|
22
|
+
const end = addWorkingDaysToDate(waveStart, tk.catalog_duration_estimate_days, calendar);
|
|
23
|
+
endByTrack.set(tk.track, end);
|
|
24
|
+
if (!waveEnd || end > waveEnd)
|
|
25
|
+
waveEnd = end;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
endByTrack.set(tk.track, undefined);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// 次 wave の手始め。本 wave に推定日数のあるトラックがあれば最遅完了日の翌稼働日で、
|
|
32
|
+
// 未定のトラックだけなら直前の手始め日をそのまま受け継ぐ(後続波まで日付が伝播する)。
|
|
33
|
+
cursor = waveEnd ? addWorkingDaysToDate(waveEnd, 1, calendar) : cursor;
|
|
34
|
+
}
|
|
35
|
+
const schedule = index.tracks.map((tk) => ({
|
|
36
|
+
track: tk.track,
|
|
37
|
+
order: tk.order,
|
|
38
|
+
domains: tk.domains,
|
|
39
|
+
status: tk.catalog_status,
|
|
40
|
+
estimateDays: tk.catalog_duration_estimate_days,
|
|
41
|
+
parallel_group: tk.parallel_group,
|
|
42
|
+
depends_on: tk.depends_on,
|
|
43
|
+
startDate: startByTrack.get(tk.track),
|
|
44
|
+
endDate: endByTrack.get(tk.track),
|
|
45
|
+
wave: waveNumberByOrder.get(tk.order) ?? 0,
|
|
46
|
+
}));
|
|
47
|
+
return { schedule, plannedStartDate: index.planned_start_date };
|
|
48
|
+
}
|
|
49
|
+
// 稼働日カレンダーの機械可読正本:tml-index.planned_start_date を起点にし、Schedule 側
|
|
50
|
+
// (sch-defaults.yaml と各 sch-*.yaml)の calendar を buildScheduleIndex から復用する。
|
|
51
|
+
// 両方とも YAML 正本から機械的に読み取り、表示文言の解析に依存しない。
|
|
52
|
+
export function resolveDashboardCalendar(schedulePath) {
|
|
53
|
+
try {
|
|
54
|
+
return buildScheduleIndex(schedulePath).calendar;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return defaultScheduleCalendar();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// ================================
|
|
61
|
+
// Timeline Gantt SVG (x-axis = date)
|
|
62
|
+
// ================================
|
|
63
|
+
function xmlEscape(text) {
|
|
64
|
+
return text
|
|
65
|
+
.replace(/&/g, "&")
|
|
66
|
+
.replace(/</g, "<")
|
|
67
|
+
.replace(/>/g, ">")
|
|
68
|
+
.replace(/"/g, """);
|
|
69
|
+
}
|
|
70
|
+
function statusColor(status) {
|
|
71
|
+
if (status === "primary")
|
|
72
|
+
return "#16a34a";
|
|
73
|
+
if (status === "draft")
|
|
74
|
+
return "#2563eb";
|
|
75
|
+
return "#d1d5db";
|
|
76
|
+
}
|
|
77
|
+
// 予定日付の無いトラックはバーを持たずラベルのみ表示する(手始め日 or 推定稼働日が未設定)。
|
|
78
|
+
export function buildTimelineGanttSvg(schedule, plannedStartDate, title = "トラック計画ガントチャート") {
|
|
79
|
+
const dayWidth = 30;
|
|
80
|
+
const rowHeight = 26;
|
|
81
|
+
const leftPad = 240;
|
|
82
|
+
const topPad = 56;
|
|
83
|
+
const bottomPad = 20;
|
|
84
|
+
// バーは startDate かつ endDate 両方を持つトラックへ。開始日のみのトラックは着手順の着手点として
|
|
85
|
+
// 四角(diamond)で表示する。軸の範囲は endDate が無いトラックも startDate を含めて算出する。
|
|
86
|
+
const fullRows = schedule.filter((row) => row.startDate);
|
|
87
|
+
if (fullRows.length === 0 || !plannedStartDate) {
|
|
88
|
+
return noDataTimelineSvg(title, plannedStartDate
|
|
89
|
+
? "トラックの予定開始日・終了日を算出できませんでした。"
|
|
90
|
+
: "計画開始日(tml-index.yaml の planned_start_date)が未設定です。");
|
|
91
|
+
}
|
|
92
|
+
const parseMs = (dateOnly) => {
|
|
93
|
+
const [year, month, day] = dateOnly.split("-").map(Number);
|
|
94
|
+
return Date.UTC(year, month - 1, day, 0, 0, 0, 0);
|
|
95
|
+
};
|
|
96
|
+
const startMs = parseMs(plannedStartDate);
|
|
97
|
+
let endMs = startMs;
|
|
98
|
+
for (const row of fullRows) {
|
|
99
|
+
const last = row.endDate ?? row.startDate;
|
|
100
|
+
if (parseMs(last) > endMs)
|
|
101
|
+
endMs = parseMs(last);
|
|
102
|
+
}
|
|
103
|
+
const totalDays = Math.max(1, Math.ceil((endMs - startMs) / 86_400_000) + 1);
|
|
104
|
+
const width = leftPad + totalDays * dayWidth + 24;
|
|
105
|
+
const height = topPad + schedule.length * rowHeight + bottomPad;
|
|
106
|
+
const xForDate = (dateOnly) => {
|
|
107
|
+
const daysDiff = Math.floor((parseMs(dateOnly) - startMs) / 86_400_000);
|
|
108
|
+
return leftPad + daysDiff * dayWidth;
|
|
109
|
+
};
|
|
110
|
+
const parts = [];
|
|
111
|
+
parts.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" role="img" aria-label="${xmlEscape(title)}">`);
|
|
112
|
+
parts.push(`<style>
|
|
113
|
+
text { font-family: ui-sans-serif, system-ui, -apple-system, sans-serif; fill: #1f2937; }
|
|
114
|
+
.tl-title { font-size: 16px; font-weight: 700; fill: #0f172a; }
|
|
115
|
+
.tl-caption { font-size: 11px; fill: #64748b; }
|
|
116
|
+
.tl-label { font-size: 11px; font-weight: 600; fill: #1f2937; }
|
|
117
|
+
.tl-axis { font-size: 10px; fill: #475569; }
|
|
118
|
+
.tl-grid { stroke: #e2e8f0; stroke-width: 1; }
|
|
119
|
+
.tl-month-grid { stroke: #94a3b8; stroke-width: 1.5; }
|
|
120
|
+
.tl-note { font-size: 10px; fill: #9ca3af; }
|
|
121
|
+
</style>`);
|
|
122
|
+
parts.push(`<rect x="0" y="0" width="${width}" height="${height}" fill="#fffdf8" />`);
|
|
123
|
+
parts.push(`<text class="tl-title" x="16" y="24">${xmlEscape(title)}</text>`);
|
|
124
|
+
parts.push(`<text class="tl-caption" x="16" y="42">横軸は日付。予定開始日・予定終了日は tml-index.yaml の planned_start_date と catalog_duration_estimate_days(推定稼働日数)から算出。</text>`);
|
|
125
|
+
for (let offset = 0; offset < totalDays; offset++) {
|
|
126
|
+
const dayMs = startMs + offset * 86_400_000;
|
|
127
|
+
if (new Date(dayMs).getUTCDate() !== 1)
|
|
128
|
+
continue;
|
|
129
|
+
const x = leftPad + offset * dayWidth;
|
|
130
|
+
parts.push(`<line class="tl-month-grid" x1="${x}" y1="${topPad - 22}" x2="${x}" y2="${height - bottomPad}" />`);
|
|
131
|
+
parts.push(`<text class="tl-axis" x="${x + 4}" y="${topPad - 8}">${xmlEscape(new Date(dayMs).toISOString().slice(0, 7))}</text>`);
|
|
132
|
+
}
|
|
133
|
+
parts.push(`<line class="tl-grid" x1="${leftPad}" y1="${topPad - 22}" x2="${leftPad}" y2="${height - bottomPad}" />`);
|
|
134
|
+
let currentY = topPad;
|
|
135
|
+
for (const row of schedule) {
|
|
136
|
+
parts.push(`<text class="tl-label" x="8" y="${currentY + 14}">${xmlEscape(row.track)}</text>`);
|
|
137
|
+
if (row.startDate && row.endDate) {
|
|
138
|
+
const x1 = xForDate(row.startDate);
|
|
139
|
+
const x2 = xForDate(row.endDate);
|
|
140
|
+
const barWidth = Math.max(4, x2 - x1);
|
|
141
|
+
parts.push(`<rect x="${x1}" y="${currentY + 6}" width="${barWidth}" height="12" rx="3" fill="${statusColor(row.status)}" opacity="0.9" />`);
|
|
142
|
+
}
|
|
143
|
+
else if (row.startDate) {
|
|
144
|
+
// 開始日のみ(推定稼働日数未定): 着手点の diamond マーカーで表示。
|
|
145
|
+
const cx = xForDate(row.startDate);
|
|
146
|
+
parts.push(`<polygon points="${cx},${currentY + 2} ${cx + 6},${currentY + 8} ${cx},${currentY + 14} ${cx - 6},${currentY + 8}" fill="${statusColor(row.status)}" opacity="0.85" />`);
|
|
147
|
+
parts.push(`<text class="tl-note" x="${xForDate(row.startDate) + 8}" y="${currentY + 14}">${xmlEscape(datePlanNote(row))}</text>`);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
parts.push(`<text class="tl-note" x="${leftPad + 4}" y="${currentY + 14}">${xmlEscape(datePlanNote(row))}</text>`);
|
|
151
|
+
}
|
|
152
|
+
parts.push(`<line class="tl-grid" x1="0" y1="${currentY + rowHeight}" x2="${width}" y2="${currentY + rowHeight}" />`);
|
|
153
|
+
currentY += rowHeight;
|
|
154
|
+
}
|
|
155
|
+
parts.push(`</svg>`);
|
|
156
|
+
return parts.join("\n");
|
|
157
|
+
}
|
|
158
|
+
function datePlanNote(row) {
|
|
159
|
+
if (!row.startDate)
|
|
160
|
+
return "手始め日未定";
|
|
161
|
+
if (row.endDate === undefined || !row.estimateDays)
|
|
162
|
+
return `着手順 ${row.order}(推定稼働日数未定)`;
|
|
163
|
+
return `${row.startDate} ~ ${row.endDate}`;
|
|
164
|
+
}
|
|
165
|
+
function noDataTimelineSvg(title, message) {
|
|
166
|
+
const width = 560;
|
|
167
|
+
const height = 120;
|
|
168
|
+
return [
|
|
169
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" role="img" aria-label="${xmlEscape(title)}">`,
|
|
170
|
+
`<rect x="0" y="0" width="${width}" height="${height}" fill="#fffdf8" />`,
|
|
171
|
+
`<text class="tl-title" x="16" y="24">${xmlEscape(title)}</text>`,
|
|
172
|
+
`<text x="16" y="72" font-size="13" fill="#64748b">${xmlEscape(message)}</text>`,
|
|
173
|
+
`</svg>`,
|
|
174
|
+
].join("\n");
|
|
175
|
+
}
|