@kal-elsam/kairo-runtime 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.
- package/README.md +937 -0
- package/bin/harness.js +11 -0
- package/bin/kairo-runtime.js +11 -0
- package/bin/kairo.js +11 -0
- package/global-template/components/catalog.json +25 -0
- package/global-template/components/orchestrator/orchestrator.md +55 -0
- package/global-template/components/sdd-core/handoff.md +38 -0
- package/global-template/components/sdd-core/spec-sizing.md +38 -0
- package/global-template/components/sdd-core/workflow.md +31 -0
- package/global-template/core/orchestrator.md +55 -0
- package/package.json +64 -0
- package/prompts/HARNESS_ENFORCEMENT_UPGRADE.md +11 -0
- package/prompts/HARNESS_ENTERPRISE.md +33 -0
- package/prompts/HARNESS_INSTALLER_MASTER.md +853 -0
- package/prompts/HARNESS_MINIMAL.md +30 -0
- package/prompts/HARNESS_SPEC_SIZING_UPGRADE.md +41 -0
- package/prompts/HARNESS_STANDARD.md +35 -0
- package/prompts/HARNESS_UNIVERSAL_PARITY.md +56 -0
- package/repo-template/.claude/agents/adapter-parity-reviewer.md +17 -0
- package/repo-template/.claude/agents/architect.md +17 -0
- package/repo-template/.claude/agents/eval-engineer.md +17 -0
- package/repo-template/.claude/agents/reviewer.md +17 -0
- package/repo-template/.claude/agents/sdd-reviewer.md +17 -0
- package/repo-template/.claude/agents/sdd-spec-writer.md +17 -0
- package/repo-template/.claude/skills/checkpoint/SKILL.md +13 -0
- package/repo-template/.claude/skills/eval-design/SKILL.md +3 -0
- package/repo-template/.claude/skills/evals/SKILL.md +13 -0
- package/repo-template/.claude/skills/loop-engineering/SKILL.md +16 -0
- package/repo-template/.claude/skills/maintainability-review/SKILL.md +3 -0
- package/repo-template/.claude/skills/quality-gate-review/SKILL.md +3 -0
- package/repo-template/.claude/skills/sdd/SKILL.md +13 -0
- package/repo-template/.claude/skills/spec-complexity-classifier/SKILL.md +10 -0
- package/repo-template/.claude/skills/spec-escalation-review/SKILL.md +10 -0
- package/repo-template/.claude/skills/spec-intake/SKILL.md +10 -0
- package/repo-template/.claude/skills/tdd/SKILL.md +13 -0
- package/repo-template/.claude/skills/trust-review/SKILL.md +3 -0
- package/repo-template/.codex/skills/adapter-parity/SKILL.md +29 -0
- package/repo-template/.codex/skills/checkpoint/SKILL.md +36 -0
- package/repo-template/.codex/skills/eval-design/SKILL.md +3 -0
- package/repo-template/.codex/skills/evals/SKILL.md +28 -0
- package/repo-template/.codex/skills/loop-engineering/SKILL.md +24 -0
- package/repo-template/.codex/skills/maintainability-review/SKILL.md +3 -0
- package/repo-template/.codex/skills/quality-gate-review/SKILL.md +3 -0
- package/repo-template/.codex/skills/sdd/SKILL.md +30 -0
- package/repo-template/.codex/skills/spec-complexity-classifier/SKILL.md +10 -0
- package/repo-template/.codex/skills/spec-escalation-review/SKILL.md +10 -0
- package/repo-template/.codex/skills/spec-intake/SKILL.md +10 -0
- package/repo-template/.codex/skills/tdd/SKILL.md +27 -0
- package/repo-template/.codex/skills/trust-review/SKILL.md +3 -0
- package/repo-template/.cursor/agents/adapter-parity-reviewer.md +29 -0
- package/repo-template/.cursor/agents/architect.md +27 -0
- package/repo-template/.cursor/agents/context-engineer.md +27 -0
- package/repo-template/.cursor/agents/debugger.md +27 -0
- package/repo-template/.cursor/agents/eval-engineer.md +27 -0
- package/repo-template/.cursor/agents/harness-orchestrator.md +27 -0
- package/repo-template/.cursor/agents/loop-controller.md +17 -0
- package/repo-template/.cursor/agents/loop-debugger.md +16 -0
- package/repo-template/.cursor/agents/reviewer.md +27 -0
- package/repo-template/.cursor/agents/sdd/sdd-acceptance-reviewer.md +31 -0
- package/repo-template/.cursor/agents/sdd/sdd-implementation-guardian.md +31 -0
- package/repo-template/.cursor/agents/sdd/sdd-intake-analyst.md +31 -0
- package/repo-template/.cursor/agents/sdd/sdd-orchestrator.md +31 -0
- package/repo-template/.cursor/agents/sdd/sdd-spec-reviewer.md +31 -0
- package/repo-template/.cursor/agents/sdd/sdd-spec-writer.md +31 -0
- package/repo-template/.cursor/agents/sdd/sdd-task-breakdown.md +31 -0
- package/repo-template/.cursor/agents/sdd/sdd-technical-planner.md +31 -0
- package/repo-template/.cursor/agents/sdd/sdd-test-planner.md +31 -0
- package/repo-template/.cursor/agents/spec-intake-analyst.md +14 -0
- package/repo-template/.cursor/agents/test-engineer.md +27 -0
- package/repo-template/.cursor/commands/adapter-parity.md +34 -0
- package/repo-template/.cursor/commands/checkpoint.md +30 -0
- package/repo-template/.cursor/commands/debug.md +13 -0
- package/repo-template/.cursor/commands/init-eval.md +12 -0
- package/repo-template/.cursor/commands/init-feature.md +12 -0
- package/repo-template/.cursor/commands/init-harness.md +13 -0
- package/repo-template/.cursor/commands/loop-debug.md +3 -0
- package/repo-template/.cursor/commands/loop-review.md +3 -0
- package/repo-template/.cursor/commands/loop-run.md +5 -0
- package/repo-template/.cursor/commands/review.md +21 -0
- package/repo-template/.cursor/commands/sdd-intake.md +18 -0
- package/repo-template/.cursor/commands/sdd-plan.md +18 -0
- package/repo-template/.cursor/commands/sdd-spec.md +18 -0
- package/repo-template/.cursor/commands/sdd-tasks.md +18 -0
- package/repo-template/.cursor/commands/sdd-validate.md +18 -0
- package/repo-template/.cursor/commands/spec-escalate.md +9 -0
- package/repo-template/.cursor/commands/spec-intake.md +10 -0
- package/repo-template/.cursor/commands/spec-size.md +21 -0
- package/repo-template/.cursor/rules/adapter-parity.mdc +20 -0
- package/repo-template/.cursor/rules/api.mdc +12 -0
- package/repo-template/.cursor/rules/core.mdc +21 -0
- package/repo-template/.cursor/rules/enforcement.mdc +16 -0
- package/repo-template/.cursor/rules/evals.mdc +10 -0
- package/repo-template/.cursor/rules/git.mdc +19 -0
- package/repo-template/.cursor/rules/harness.mdc +14 -0
- package/repo-template/.cursor/rules/loops.mdc +17 -0
- package/repo-template/.cursor/rules/testing.mdc +13 -0
- package/repo-template/.cursor/rules/ui.mdc +13 -0
- package/repo-template/.cursor/skills/api-design/SKILL.md +23 -0
- package/repo-template/.cursor/skills/architecture/SKILL.md +23 -0
- package/repo-template/.cursor/skills/code-review/SKILL.md +23 -0
- package/repo-template/.cursor/skills/context-graph/SKILL.md +23 -0
- package/repo-template/.cursor/skills/debugging/SKILL.md +23 -0
- package/repo-template/.cursor/skills/evals/SKILL.md +23 -0
- package/repo-template/.cursor/skills/git-workflow/SKILL.md +23 -0
- package/repo-template/.cursor/skills/testing/SKILL.md +23 -0
- package/repo-template/.cursor/skills/ui-design/SKILL.md +23 -0
- package/repo-template/.gentle-ai/README.md +37 -0
- package/repo-template/.gentle-ai/loops/README.md +27 -0
- package/repo-template/.gentle-ai/loops/sdd-tdd-repair.loop.md +27 -0
- package/repo-template/.gentle-ai/model-routing.md +25 -0
- package/repo-template/.github/copilot-instructions.md +37 -0
- package/repo-template/.github/dependabot.yml +11 -0
- package/repo-template/.github/instructions/harness.instructions.md +11 -0
- package/repo-template/.github/workflows/harness-quality-gate.yml +67 -0
- package/repo-template/.github/workflows/harness-security-gate.yml +32 -0
- package/repo-template/.harness/spec-sizing.json +33 -0
- package/repo-template/.opencode/README.md +71 -0
- package/repo-template/.opencode/agents/adapter-parity-reviewer.md +23 -0
- package/repo-template/.opencode/agents/architect.md +38 -0
- package/repo-template/.opencode/agents/checkpoint-reviewer.md +38 -0
- package/repo-template/.opencode/agents/eval-engineer.md +38 -0
- package/repo-template/.opencode/agents/loop-controller.md +38 -0
- package/repo-template/.opencode/agents/loop-debugger.md +38 -0
- package/repo-template/.opencode/agents/model-router.md +38 -0
- package/repo-template/.opencode/agents/sdd-orchestrator.md +38 -0
- package/repo-template/.opencode/agents/sdd-spec-reviewer.md +38 -0
- package/repo-template/.opencode/agents/spec-intake-analyst.md +19 -0
- package/repo-template/.opencode/agents/tdd-engineer.md +38 -0
- package/repo-template/.opencode/commands/checkpoint.md +3 -0
- package/repo-template/.opencode/commands/eval-design.md +3 -0
- package/repo-template/.opencode/commands/maintainability-review.md +3 -0
- package/repo-template/.opencode/commands/quality-gate.md +3 -0
- package/repo-template/.opencode/commands/spec-escalate.md +9 -0
- package/repo-template/.opencode/commands/spec-intake.md +10 -0
- package/repo-template/.opencode/commands/spec-size.md +21 -0
- package/repo-template/.opencode/commands/trust-review.md +3 -0
- package/repo-template/.opencode/loops/ai-behavior-improvement.loop.md +15 -0
- package/repo-template/.opencode/loops/bug-repair.loop.md +16 -0
- package/repo-template/.opencode/loops/documentation-sync.loop.md +13 -0
- package/repo-template/.opencode/loops/feature-development.loop.md +25 -0
- package/repo-template/.opencode/skills/spec-complexity-classifier/SKILL.md +10 -0
- package/repo-template/.opencode/skills/spec-escalation-review/SKILL.md +10 -0
- package/repo-template/.opencode/skills/spec-intake/SKILL.md +10 -0
- package/repo-template/.pi/README.md +21 -0
- package/repo-template/.pi/prompts/checkpoint.md +11 -0
- package/repo-template/.pi/prompts/loop-run.md +10 -0
- package/repo-template/.pi/prompts/sdd-plan.md +11 -0
- package/repo-template/.pi/prompts/sdd-spec.md +13 -0
- package/repo-template/.pi/prompts/spec-escalate.md +9 -0
- package/repo-template/.pi/prompts/spec-intake.md +10 -0
- package/repo-template/.pi/prompts/spec-size.md +21 -0
- package/repo-template/.pi/skills/adapter-parity/SKILL.md +7 -0
- package/repo-template/.pi/skills/checkpoint/SKILL.md +7 -0
- package/repo-template/.pi/skills/eval-design/SKILL.md +3 -0
- package/repo-template/.pi/skills/evals/SKILL.md +7 -0
- package/repo-template/.pi/skills/loop-engineering/SKILL.md +7 -0
- package/repo-template/.pi/skills/maintainability-review/SKILL.md +3 -0
- package/repo-template/.pi/skills/quality-gate-review/SKILL.md +3 -0
- package/repo-template/.pi/skills/sdd/SKILL.md +7 -0
- package/repo-template/.pi/skills/spec-complexity-classifier/SKILL.md +10 -0
- package/repo-template/.pi/skills/spec-escalation-review/SKILL.md +10 -0
- package/repo-template/.pi/skills/spec-intake/SKILL.md +10 -0
- package/repo-template/.pi/skills/tdd/SKILL.md +7 -0
- package/repo-template/.pi/skills/trust-review/SKILL.md +3 -0
- package/repo-template/AGENT.md +8 -0
- package/repo-template/AGENTS.md +165 -0
- package/repo-template/CLAUDE.md +9 -0
- package/repo-template/GEMINI.md +9 -0
- package/repo-template/docs/ai/adapter-parity.md +135 -0
- package/repo-template/docs/ai/agent-workflow.md +45 -0
- package/repo-template/docs/ai/api.md +28 -0
- package/repo-template/docs/ai/architecture.md +53 -0
- package/repo-template/docs/ai/context-budget.md +54 -0
- package/repo-template/docs/ai/context-graph.md +39 -0
- package/repo-template/docs/ai/conventions.md +34 -0
- package/repo-template/docs/ai/decision-log.md +5 -0
- package/repo-template/docs/ai/enforcement.md +63 -0
- package/repo-template/docs/ai/eval-strategy.md +42 -0
- package/repo-template/docs/ai/evals.md +44 -0
- package/repo-template/docs/ai/git-workflow.md +35 -0
- package/repo-template/docs/ai/governance.md +61 -0
- package/repo-template/docs/ai/harness.md +49 -0
- package/repo-template/docs/ai/installer-cli.md +34 -0
- package/repo-template/docs/ai/loop-log.md +5 -0
- package/repo-template/docs/ai/loop-observability.md +57 -0
- package/repo-template/docs/ai/loop-policy.md +86 -0
- package/repo-template/docs/ai/loops.md +95 -0
- package/repo-template/docs/ai/maintainability-gates.md +26 -0
- package/repo-template/docs/ai/memory.md +71 -0
- package/repo-template/docs/ai/model-policy.md +105 -0
- package/repo-template/docs/ai/observability-runtime.md +48 -0
- package/repo-template/docs/ai/provider-routing.md +138 -0
- package/repo-template/docs/ai/quality-gates.md +48 -0
- package/repo-template/docs/ai/rollback-runtime.md +25 -0
- package/repo-template/docs/ai/security.md +12 -0
- package/repo-template/docs/ai/spec-driven-development.md +124 -0
- package/repo-template/docs/ai/spec-escalation.md +44 -0
- package/repo-template/docs/ai/spec-intake.md +46 -0
- package/repo-template/docs/ai/spec-sizing.md +207 -0
- package/repo-template/docs/ai/test-driven-development.md +35 -0
- package/repo-template/docs/ai/testing.md +28 -0
- package/repo-template/docs/ai/tool-adapters.md +186 -0
- package/repo-template/docs/ai/trust-allowlist.md +5 -0
- package/repo-template/docs/ai/trust-policy.md +41 -0
- package/repo-template/docs/ai/ui.md +17 -0
- package/repo-template/docs/skills/adapter-parity-review.md +46 -0
- package/repo-template/docs/skills/api-design.md +37 -0
- package/repo-template/docs/skills/architecture.md +37 -0
- package/repo-template/docs/skills/code-review.md +37 -0
- package/repo-template/docs/skills/context-graph.md +38 -0
- package/repo-template/docs/skills/debugging.md +37 -0
- package/repo-template/docs/skills/eval-design.md +12 -0
- package/repo-template/docs/skills/evals.md +37 -0
- package/repo-template/docs/skills/git-workflow.md +37 -0
- package/repo-template/docs/skills/look-trust-review.md +12 -0
- package/repo-template/docs/skills/loop-debugging.md +16 -0
- package/repo-template/docs/skills/loop-design.md +39 -0
- package/repo-template/docs/skills/loop-retrospective.md +15 -0
- package/repo-template/docs/skills/loop-review.md +16 -0
- package/repo-template/docs/skills/maintainability-review.md +12 -0
- package/repo-template/docs/skills/model-selection.md +36 -0
- package/repo-template/docs/skills/quality-gate-review.md +12 -0
- package/repo-template/docs/skills/spec-complexity-classifier.md +41 -0
- package/repo-template/docs/skills/spec-escalation-review.md +34 -0
- package/repo-template/docs/skills/spec-intake.md +25 -0
- package/repo-template/docs/skills/testing.md +37 -0
- package/repo-template/docs/skills/tool-adapter-sync.md +36 -0
- package/repo-template/docs/skills/ui-design.md +37 -0
- package/repo-template/docs/specs/README.md +9 -0
- package/repo-template/docs/specs/templates/basic-spec.md +41 -0
- package/repo-template/docs/specs/templates/complex-spec.md +145 -0
- package/repo-template/docs/specs/templates/standard-spec.md +58 -0
- package/repo-template/evals/README.md +11 -0
- package/repo-template/evals/golden/sample-golden.json +12 -0
- package/repo-template/evals/loop-regression/README.md +11 -0
- package/repo-template/evals/regression/sample-regression.json +12 -0
- package/repo-template/evals/schema/sample-schema.json +12 -0
- package/repo-template/evals/tool-calls/sample-tool-calls.json +12 -0
- package/repo-template/opencode.json.sample +29 -0
- package/repo-template/scripts/harness/backup.mjs +7 -0
- package/repo-template/scripts/harness/doctor.mjs +20 -0
- package/repo-template/scripts/harness/run-evals.mjs +27 -0
- package/repo-template/setup-agent-links.sh +54 -0
- package/scripts/check-published-release.mjs +127 -0
- package/scripts/check-release-commit.mjs +32 -0
- package/scripts/install.sh +225 -0
- package/scripts/installer-smoke-test.sh +155 -0
- package/scripts/lib/attribution-guard.mjs +59 -0
- package/scripts/registry-smoke-test.sh +149 -0
- package/scripts/smoke-test.sh +197 -0
- package/scripts/ux-smoke-test.sh +140 -0
- package/src/cli.js +625 -0
- package/src/doctor.js +68 -0
- package/src/global/adapter-context.js +27 -0
- package/src/global/adapter-matrix.js +38 -0
- package/src/global/adapters/claude.js +8 -0
- package/src/global/adapters/codex.js +8 -0
- package/src/global/adapters/cursor.js +8 -0
- package/src/global/adapters/opencode.js +8 -0
- package/src/global/agents.js +7 -0
- package/src/global/apply-confirmation.js +62 -0
- package/src/global/backups.js +54 -0
- package/src/global/brand/cli.js +52 -0
- package/src/global/brand/index.js +85 -0
- package/src/global/clack/setup-preview.js +48 -0
- package/src/global/clack/setup-wizard-constants.js +6 -0
- package/src/global/clack/setup-wizard.js +207 -0
- package/src/global/clack/theme.js +145 -0
- package/src/global/component-authoring.js +121 -0
- package/src/global/component-builders.js +43 -0
- package/src/global/component-distribution.js +270 -0
- package/src/global/component-installer.js +106 -0
- package/src/global/component-paths.js +22 -0
- package/src/global/component-registry.js +89 -0
- package/src/global/components/orchestrator.js +14 -0
- package/src/global/components/sdd-core.js +17 -0
- package/src/global/diff.js +233 -0
- package/src/global/drift.js +264 -0
- package/src/global/explain.js +144 -0
- package/src/global/global-cli.js +1145 -0
- package/src/global/global-doctor.js +67 -0
- package/src/global/global-installer.js +284 -0
- package/src/global/history.js +313 -0
- package/src/global/ink/run-setup-ink.js +77 -0
- package/src/global/ink/setup-app.js +278 -0
- package/src/global/ink/setup-routing.js +51 -0
- package/src/global/ink/setup-state.js +180 -0
- package/src/global/ink/terminal.js +13 -0
- package/src/global/json-output.js +22 -0
- package/src/global/load-component-catalog.js +41 -0
- package/src/global/load-workspace-component-catalog.js +123 -0
- package/src/global/managed-body.js +28 -0
- package/src/global/managed-config-adapter.js +134 -0
- package/src/global/managed-section.js +73 -0
- package/src/global/npm-registry.js +25 -0
- package/src/global/paths.js +22 -0
- package/src/global/policy.js +344 -0
- package/src/global/preflight.js +65 -0
- package/src/global/registry.js +79 -0
- package/src/global/report.js +110 -0
- package/src/global/rollback.js +126 -0
- package/src/global/setup.js +284 -0
- package/src/global/state-migration.js +65 -0
- package/src/global/state.js +50 -0
- package/src/global/status.js +94 -0
- package/src/global/sync.js +129 -0
- package/src/global/upgrade.js +145 -0
- package/src/harness-files.js +145 -0
- package/src/harness-updater.js +120 -0
- package/src/hash.js +5 -0
- package/src/manifest.js +36 -0
- package/src/project-detection.js +105 -0
- package/src/template-installer.js +72 -0
- package/src/text-template.js +24 -0
- package/src/workspace-cli.js +115 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { mkdir, symlink, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { COMPATIBILITY_LINKS, adapterForPath, listTemplateFiles, pathExists, renderFileContent } from "./harness-files.js";
|
|
4
|
+
import { hashBuffer } from "./hash.js";
|
|
5
|
+
import { createManifest, readManifest, writeManifest } from "./manifest.js";
|
|
6
|
+
|
|
7
|
+
export async function installHarness({ project, packageRoot, mode, adapters, packageName, cliVersion, force = false, dryRun = false }) {
|
|
8
|
+
const templateFiles = await listTemplateFiles(packageRoot, mode, { adapters });
|
|
9
|
+
const normalizedAdapters = adapters == null ? null : [...adapters].sort();
|
|
10
|
+
const result = { mode, adapters: normalizedAdapters, created: [], skipped: [], updated: [] };
|
|
11
|
+
const manifestFiles = {};
|
|
12
|
+
|
|
13
|
+
for (const { relativePath, sourcePath } of templateFiles) {
|
|
14
|
+
const destinationPath = resolve(project.root, relativePath);
|
|
15
|
+
const exists = await pathExists(destinationPath);
|
|
16
|
+
|
|
17
|
+
if (exists && !force) {
|
|
18
|
+
result.skipped.push(relativePath);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const content = await renderFileContent(sourcePath, project);
|
|
23
|
+
|
|
24
|
+
if (!dryRun) {
|
|
25
|
+
await mkdir(dirname(destinationPath), { recursive: true });
|
|
26
|
+
await writeFile(destinationPath, content);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
result[exists ? "updated" : "created"].push(relativePath);
|
|
30
|
+
manifestFiles[relativePath] = hashBuffer(content);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await createCompatibilityLinks(project.root, { adapters: normalizedAdapters, force, dryRun, result });
|
|
34
|
+
|
|
35
|
+
if (!dryRun) {
|
|
36
|
+
const existingManifest = await readManifest(project.root);
|
|
37
|
+
await writeManifest(project.root, createManifest({
|
|
38
|
+
packageName,
|
|
39
|
+
cliVersion,
|
|
40
|
+
mode,
|
|
41
|
+
adapters: normalizedAdapters ?? existingManifest?.adapters,
|
|
42
|
+
files: { ...existingManifest?.files, ...manifestFiles },
|
|
43
|
+
installedAt: existingManifest?.installedAt
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function createCompatibilityLinks(root, { adapters, force, dryRun, result }) {
|
|
51
|
+
for (const [linkPath, target] of COMPATIBILITY_LINKS) {
|
|
52
|
+
const adapter = adapterForPath(linkPath);
|
|
53
|
+
if (adapters && adapter && !adapters.includes(adapter)) continue;
|
|
54
|
+
|
|
55
|
+
const destination = resolve(root, linkPath);
|
|
56
|
+
const exists = await pathExists(destination);
|
|
57
|
+
|
|
58
|
+
if (exists && !force) continue;
|
|
59
|
+
|
|
60
|
+
if (!dryRun) {
|
|
61
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
62
|
+
if (exists) continue;
|
|
63
|
+
try {
|
|
64
|
+
await symlink(target, destination);
|
|
65
|
+
} catch {
|
|
66
|
+
await writeFile(destination, `Compatibility pointer. Source of truth: ${target}\n`, "utf8");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!exists) result.created.push(linkPath);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function renderTemplate(input, project) {
|
|
2
|
+
const replacements = {
|
|
3
|
+
"[PROJECT_NAME]": project.name,
|
|
4
|
+
"[PROJECT_PURPOSE]": project.purpose,
|
|
5
|
+
"[STACK]": project.stack,
|
|
6
|
+
"[PACKAGE_MANAGER]": project.packageManager,
|
|
7
|
+
"[ARCHITECTURE_PATTERN]": project.architecturePattern,
|
|
8
|
+
"[INSTALL_COMMAND]": project.commands.install,
|
|
9
|
+
"[DEV_COMMAND]": project.commands.dev,
|
|
10
|
+
"[LINT_COMMAND]": project.commands.lint,
|
|
11
|
+
"[FORMAT_COMMAND]": project.commands.format,
|
|
12
|
+
"[TYPE_CHECK_COMMAND]": project.commands.typeCheck,
|
|
13
|
+
"[TEST_COMMAND]": project.commands.test,
|
|
14
|
+
"[BUILD_COMMAND]": project.commands.build
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let output = input;
|
|
18
|
+
|
|
19
|
+
for (const [token, value] of Object.entries(replacements)) {
|
|
20
|
+
output = output.split(token).join(value);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return output;
|
|
24
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { detectProject } from "./project-detection.js";
|
|
2
|
+
import { installHarness } from "./template-installer.js";
|
|
3
|
+
import { updateHarness } from "./harness-updater.js";
|
|
4
|
+
import { runDoctorChecks } from "./doctor.js";
|
|
5
|
+
import { BRAND } from "./global/brand/index.js";
|
|
6
|
+
|
|
7
|
+
export async function runWorkspaceInit(options, packageManifest, packageRoot, suggestedInvocation) {
|
|
8
|
+
const project = await detectProject(options.cwd);
|
|
9
|
+
const adapters = resolveAdapters(project, options);
|
|
10
|
+
const result = await installHarness({
|
|
11
|
+
project,
|
|
12
|
+
packageRoot,
|
|
13
|
+
mode: options.mode,
|
|
14
|
+
adapters,
|
|
15
|
+
packageName: packageManifest.name,
|
|
16
|
+
cliVersion: packageManifest.version,
|
|
17
|
+
force: options.force,
|
|
18
|
+
dryRun: options.dryRun
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
console.log(`${BRAND.displayName} ${options.dryRun ? "plan" : "installed"} for ${project.name} (scope: workspace)`);
|
|
22
|
+
console.log(`Mode: ${result.mode}`);
|
|
23
|
+
console.log(`Adapters: ${formatAdapters(result.adapters)}`);
|
|
24
|
+
console.log(`Created: ${result.created.length}`);
|
|
25
|
+
console.log(`Skipped: ${result.skipped.length}`);
|
|
26
|
+
console.log(`Updated: ${result.updated.length}`);
|
|
27
|
+
|
|
28
|
+
if (result.skipped.length > 0 && !options.force) {
|
|
29
|
+
console.log("Existing files were preserved. Re-run with --force to overwrite.");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!options.dryRun) {
|
|
33
|
+
console.log(`Tracked in .harness/manifest.json. Run "${suggestedInvocation} update --scope=workspace" to apply future harness releases.`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function runWorkspaceUpdate(options, packageManifest, packageRoot) {
|
|
38
|
+
const project = await detectProject(options.cwd);
|
|
39
|
+
const adapters = resolveAdapters(project, options, { allowManifestFallback: true });
|
|
40
|
+
const result = await updateHarness({
|
|
41
|
+
project,
|
|
42
|
+
packageRoot,
|
|
43
|
+
packageName: packageManifest.name,
|
|
44
|
+
cliVersion: packageManifest.version,
|
|
45
|
+
mode: options.modeExplicit ? options.mode : undefined,
|
|
46
|
+
adapters,
|
|
47
|
+
force: options.force,
|
|
48
|
+
dryRun: options.dryRun
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
console.log(`${BRAND.displayName} ${options.dryRun ? "update plan" : "updated"} for ${project.name} (scope: workspace)`);
|
|
52
|
+
console.log(`Mode: ${result.mode}`);
|
|
53
|
+
console.log(`Adapters: ${formatAdapters(result.adapters)}`);
|
|
54
|
+
console.log(`Created: ${result.created.length}`);
|
|
55
|
+
console.log(`Updated: ${result.updated.length}`);
|
|
56
|
+
console.log(`Unchanged: ${result.unchanged.length}`);
|
|
57
|
+
|
|
58
|
+
if (result.skippedModified.length > 0) {
|
|
59
|
+
console.log(`Skipped, modified locally: ${result.skippedModified.length}`);
|
|
60
|
+
console.log("Re-run with --force to overwrite locally modified files.");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (result.skippedUntracked.length > 0) {
|
|
64
|
+
console.log(`Skipped, untracked pre-existing files: ${result.skippedUntracked.length}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export async function runWorkspaceDoctor(options) {
|
|
69
|
+
const project = await detectProject(options.cwd);
|
|
70
|
+
const { checks, ok } = await runDoctorChecks(project);
|
|
71
|
+
|
|
72
|
+
console.log(`${BRAND.displayName} doctor for ${project.name} (scope: workspace)`);
|
|
73
|
+
console.log(`Root: ${project.root}`);
|
|
74
|
+
console.log(`Package manager: ${project.packageManager}`);
|
|
75
|
+
console.log(`Stack: ${project.stack}`);
|
|
76
|
+
console.log("");
|
|
77
|
+
|
|
78
|
+
for (const check of checks) {
|
|
79
|
+
const label = check.status.toUpperCase().padEnd(8);
|
|
80
|
+
const detail = check.detail ? ` — ${check.detail}` : "";
|
|
81
|
+
console.log(`[${label}] ${check.name}${detail}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
console.log("");
|
|
85
|
+
console.log(ok ? "Status: OK" : "Status: FAILED (missing required files)");
|
|
86
|
+
|
|
87
|
+
if (!ok) process.exitCode = 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export async function runWorkspaceDetect(options, suggestedInvocation) {
|
|
91
|
+
const project = await detectProject(options.cwd);
|
|
92
|
+
const adapters = options.allAdapters ? null : options.adapters ?? project.detectedAdapters;
|
|
93
|
+
|
|
94
|
+
console.log(`Workspace project: ${project.name}`);
|
|
95
|
+
console.log(`Root: ${project.root}`);
|
|
96
|
+
console.log(`Package manager: ${project.packageManager}`);
|
|
97
|
+
console.log(`Stack: ${project.stack}`);
|
|
98
|
+
console.log(`Detected adapters: ${formatAdapters(project.detectedAdapters)}`);
|
|
99
|
+
console.log(`Recommended adapters: ${formatAdapters(adapters)}`);
|
|
100
|
+
console.log(`Suggested workspace install: ${suggestedInvocation} install --scope=workspace --mode standard${adapters?.length ? ` --adapters ${adapters.join(",")}` : ""}`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function resolveAdapters(project, options, config = {}) {
|
|
104
|
+
if (options.allAdapters) return null;
|
|
105
|
+
if (options.adapters) return options.adapters;
|
|
106
|
+
if (options.detect) return project.detectedAdapters;
|
|
107
|
+
if (config.allowManifestFallback) return undefined;
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function formatAdapters(adapters) {
|
|
112
|
+
if (adapters == null) return "all";
|
|
113
|
+
if (adapters.length === 0) return "core only";
|
|
114
|
+
return adapters.join(", ");
|
|
115
|
+
}
|