@koreanhole/kandev 0.0.0-stage → 0.1.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.
Files changed (51) hide show
  1. package/README.md +367 -2
  2. package/bin/codex-acp.js +16 -0
  3. package/bin/kandev-auto-sync.mjs +101 -0
  4. package/bin/kandev-config.js +53 -0
  5. package/bin/kandev.js +35 -0
  6. package/config/config.yaml +6 -0
  7. package/config/docker/projects/opencodex-cli.json +79 -0
  8. package/config/docker/projects/samsung-bus-tracker.json +91 -0
  9. package/config/gateways.json +14 -0
  10. package/config/pipeline.json +150 -0
  11. package/config/workflows/sdlc.yaml +1019 -0
  12. package/docker/Dockerfile +68 -0
  13. package/docker/Dockerfile.opencodex-cli +44 -0
  14. package/docker/Dockerfile.samsung-bus-tracker +75 -0
  15. package/package.json +61 -4
  16. package/scripts/agent-tools-docker.mjs +223 -0
  17. package/scripts/baseline.mjs +20 -0
  18. package/scripts/codex-medium +2 -0
  19. package/scripts/codex-stage +22 -0
  20. package/scripts/gate.mjs +909 -0
  21. package/scripts/gateways/docker.mjs +64 -0
  22. package/scripts/gateways/speckit.mjs +78 -0
  23. package/scripts/install-prerequisites.mjs +48 -0
  24. package/scripts/lib/artifacts.mjs +990 -0
  25. package/scripts/lib/bugfix.mjs +325 -0
  26. package/scripts/lib/checksum.mjs +166 -0
  27. package/scripts/lib/docker-workspace.mjs +1209 -0
  28. package/scripts/lib/gateways.mjs +79 -0
  29. package/scripts/lib/kandev.mjs +273 -0
  30. package/scripts/lib/mcp.mjs +111 -0
  31. package/scripts/lib/pipeline.mjs +548 -0
  32. package/scripts/lib/planning-replan.mjs +103 -0
  33. package/scripts/lib/resume.mjs +207 -0
  34. package/scripts/lib/review-history.mjs +260 -0
  35. package/scripts/lib/stage-boundary.mjs +146 -0
  36. package/scripts/lib/stage-model.mjs +23 -0
  37. package/scripts/lib/task-worktree.mjs +40 -0
  38. package/scripts/measure-tokens.mjs +121 -0
  39. package/scripts/planning-tools.mjs +166 -0
  40. package/scripts/replan-planning.mjs +82 -0
  41. package/scripts/review-digest.mjs +240 -0
  42. package/scripts/run-android-e2e.mjs +116 -0
  43. package/scripts/run-code-review.mjs +281 -0
  44. package/scripts/run-detached.mjs +163 -0
  45. package/scripts/run-doc-review.mjs +155 -0
  46. package/scripts/run-gateways.mjs +138 -0
  47. package/scripts/sync.mjs +588 -0
  48. package/scripts/verify-change.mjs +252 -0
  49. package/scripts/verify-node.mjs +288 -0
  50. package/scripts/verify.mjs +442 -0
  51. package/scripts/wait-status.mjs +88 -0
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Docker Gateway adapter:
3
+ * Ensures the per-task Docker container is running, project dependencies are provisioned,
4
+ * and the Git worktree is verified inside the container.
5
+ */
6
+ import { ensureTaskDockerWorkspace } from "../lib/docker-workspace.mjs";
7
+
8
+ export async function run({ cwd, log = () => {}, root = process.cwd(), docker = undefined } = {}) {
9
+ const actions = [];
10
+ const evidence = [];
11
+
12
+ try {
13
+ const overrides = typeof docker === "boolean" ? { docker } : {};
14
+ const result = await ensureTaskDockerWorkspace({ cwd, root, log, overrides });
15
+
16
+ if (!result.enabled) {
17
+ return {
18
+ id: "docker",
19
+ status: "PASS",
20
+ version: "disabled",
21
+ actions: [],
22
+ evidence: [".agentic/docker.json"],
23
+ };
24
+ }
25
+
26
+ if (result.skipped) {
27
+ return {
28
+ id: "docker",
29
+ status: "PASS",
30
+ version: "skipped",
31
+ actions: [],
32
+ evidence: [".agentic/docker.json"],
33
+ };
34
+ }
35
+
36
+ for (const cmd of result.commands || []) {
37
+ actions.push(cmd);
38
+ }
39
+ evidence.push(".agentic/docker.json");
40
+
41
+ const ok = result.verified_in_container === true;
42
+ return {
43
+ id: "docker",
44
+ status: ok ? "PASS" : "FAIL",
45
+ ...(result.project ? { project: result.project } : {}),
46
+ version: result.image || "kandev-task-runtime:bookworm",
47
+ execution_mode: result.execution_mode || "container",
48
+ container_id: result.container_id,
49
+ container_name: result.container_name,
50
+ actions,
51
+ evidence,
52
+ ...(ok ? {} : { error: "Git worktree verification inside Docker container failed" }),
53
+ };
54
+ } catch (err) {
55
+ return {
56
+ id: "docker",
57
+ status: "FAIL",
58
+ version: "",
59
+ actions,
60
+ evidence,
61
+ error: err.message,
62
+ };
63
+ }
64
+ }
@@ -0,0 +1,78 @@
1
+ /** Spec Kit gateway adapter: ensure the Codex project skills exist. */
2
+ import { spawnSync } from "node:child_process";
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+
6
+ const SKILLS = [
7
+ "speckit-specify",
8
+ "speckit-clarify",
9
+ "speckit-plan",
10
+ "speckit-tasks",
11
+ "speckit-analyze",
12
+ "speckit-implement",
13
+ ];
14
+
15
+ function bounded(value, limit = 2000) {
16
+ const text = String(value || "");
17
+ return text.length > limit ? `${text.slice(0, limit)}\n[output truncated]\n` : text;
18
+ }
19
+
20
+ function hasSkills(cwd) {
21
+ return SKILLS.every((skill) => fs.existsSync(path.join(cwd, ".agents", "skills", skill, "SKILL.md")));
22
+ }
23
+
24
+ function command(cwd, argv) {
25
+ const result = spawnSync(argv[0], argv.slice(1), {
26
+ cwd,
27
+ encoding: "utf8",
28
+ timeout: 180_000,
29
+ maxBuffer: 8 * 1024 * 1024,
30
+ });
31
+ return {
32
+ command: argv.join(" "),
33
+ exit_code: Number.isInteger(result.status) ? result.status : 1,
34
+ output: bounded(`${result.stdout || ""}${result.stderr || ""}${result.error?.message || ""}`),
35
+ };
36
+ }
37
+
38
+ export async function run({ cwd }) {
39
+ const actions = [];
40
+ const evidence = [];
41
+ const version = command(cwd, ["specify", "--version"]);
42
+ actions.push(version);
43
+ if (version.exit_code !== 0) {
44
+ return { id: "speckit", status: "FAIL", version: "", actions, evidence, error: "specify CLI is not available" };
45
+ }
46
+ const versionText = version.output.split("\n")[0].replace(/^specify\s*/i, "").trim();
47
+
48
+ if (!hasSkills(cwd) && fs.existsSync(path.join(cwd, ".specify"))) {
49
+ actions.push(command(cwd, [
50
+ "specify", "integration", "install", "codex",
51
+ "--integration-options=--skills", "--force",
52
+ ]));
53
+ }
54
+
55
+ if (!hasSkills(cwd)) {
56
+ actions.push(command(cwd, [
57
+ "specify", "init", "--here", "--integration", "codex",
58
+ "--integration-options=--skills", "--force", "--non-interactive",
59
+ ]));
60
+ }
61
+
62
+ for (const skill of SKILLS) {
63
+ const file = path.join(".agents", "skills", skill, "SKILL.md");
64
+ if (fs.existsSync(path.join(cwd, file))) evidence.push(file);
65
+ }
66
+ const scripts = path.join(cwd, ".specify", "scripts", "bash", "check-prerequisites.sh");
67
+ if (fs.existsSync(scripts)) evidence.push(".specify/scripts/bash/check-prerequisites.sh");
68
+
69
+ const ok = hasSkills(cwd) && fs.existsSync(scripts);
70
+ return {
71
+ id: "speckit",
72
+ status: ok ? "PASS" : "FAIL",
73
+ version: versionText,
74
+ actions,
75
+ evidence,
76
+ ...(ok ? {} : { error: "Spec Kit Codex skills are incomplete after install" }),
77
+ };
78
+ }
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ /** Install the Spec Kit CLI when it is missing; Codex authentication stays manual. */
3
+ import { spawnSync } from "node:child_process";
4
+
5
+ const SPECIFY_SPEC = "specify-cli==1.2.0";
6
+
7
+ function run(command, args, { inherit = false } = {}) {
8
+ return spawnSync(command, args, {
9
+ encoding: "utf8",
10
+ stdio: inherit ? "inherit" : "ignore",
11
+ timeout: 120000,
12
+ });
13
+ }
14
+
15
+ function hasSpecify() {
16
+ return run("specify", ["--version"]).status === 0;
17
+ }
18
+
19
+ function main() {
20
+ if (process.env.KANDEV_SKIP_PREREQ_INSTALL === "1") {
21
+ console.log("[kandev] prerequisite install skipped");
22
+ return;
23
+ }
24
+ if (hasSpecify()) {
25
+ console.log("[kandev] specify CLI already installed");
26
+ return;
27
+ }
28
+ if (run("uv", ["--version"]).status === 0) {
29
+ console.log(`[kandev] installing ${SPECIFY_SPEC} with uv`);
30
+ const result = run("uv", ["tool", "install", SPECIFY_SPEC], { inherit: true });
31
+ if (result.status === 0 && hasSpecify()) return;
32
+ }
33
+ if (run("pipx", ["--version"]).status === 0) {
34
+ console.log(`[kandev] installing ${SPECIFY_SPEC} with pipx`);
35
+ const result = run("pipx", ["install", SPECIFY_SPEC], { inherit: true });
36
+ if (result.status === 0 && hasSpecify()) return;
37
+ }
38
+ console.error("[kandev] specify CLI is required but could not be installed.");
39
+ console.error(
40
+ `[kandev] Install it with: uv tool install ${SPECIFY_SPEC} (or pipx install ${SPECIFY_SPEC}), then rerun npm install.`,
41
+ );
42
+ console.error(
43
+ "[kandev] Set KANDEV_SKIP_PREREQ_INSTALL=1 only if you intentionally manage specify yourself.",
44
+ );
45
+ process.exitCode = 1;
46
+ }
47
+
48
+ main();