@jstn-sdk/ma 0.1.13 → 0.14.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/.agents/plugins/marketplace.json +0 -0
- package/.codex/agents/Architect.toml +1 -0
- package/.codex/agents/Auditor.toml +1 -0
- package/.codex/agents/Builder.toml +1 -0
- package/.codex/agents/Flow.toml +1 -0
- package/.codex/agents/Sage.toml +1 -0
- package/.codex/agents/Vibe.toml +1 -0
- package/.codex/hooks.json +12 -2
- package/.codex/prompts/enforcement.md +0 -0
- package/.codex/prompts/onboarding.md +6 -1
- package/.codex/prompts/release-rules.md +0 -0
- package/.codex/prompts/skill-contract.md +0 -0
- package/COVERAGE.md +7 -7
- package/DEMO.md +15 -6
- package/LICENSE +0 -0
- package/README.md +126 -793
- package/bin/ma.js +585 -97
- package/data/clone-data.ledger.json +0 -0
- package/data/clone-data.proof.json +0 -0
- package/data/clone-data.rvf +0 -0
- package/docs/README.md +8 -2
- package/docs/autonomous-tasks.md +46 -0
- package/docs/codex-integration.md +16 -0
- package/docs/getting-started.md +28 -4
- package/docs/installed-sdk.md +0 -0
- package/docs/mcp-setup.md +30 -1
- package/docs/qa/{release-issue-gates-0.1.13.json → release-issue-gates-0.14.0.json} +77 -77
- package/docs/qa/release-readiness-0.1.5.md +0 -0
- package/docs/qa/{release-readiness-0.1.13.md → release-readiness-0.14.0.md} +12 -12
- package/docs/quality.md +24 -0
- package/docs/reference/native-engineering-patterns.md +0 -0
- package/docs/reference/native-security-playbooks.md +0 -0
- package/docs/reference/native-source-selection.md +0 -0
- package/docs/reference/native-style-and-deslop.md +0 -0
- package/docs/release-spec.md +27 -14
- package/docs/skills.md +1 -1
- package/index.js +73 -0
- package/mcp/collections.json +0 -0
- package/mcp/fallback.json +0 -0
- package/mcp/local/code-intel.js +179 -41
- package/mcp/local/context.js +180 -0
- package/mcp/local/memory.js +17 -6
- package/mcp/local/playbooks.js +0 -0
- package/mcp/local/quality.js +39 -0
- package/mcp/local/state.js +7 -3
- package/mcp/local/team-run.js +8 -3
- package/mcp/local/trace.js +0 -0
- package/mcp/local-capabilities.json +9 -0
- package/mcp/native-playbooks.json +0 -0
- package/mcp/servers.json +0 -0
- package/package.json +26 -4
- package/plugins/meta-architect/.app.json +1 -1
- package/plugins/meta-architect/.codex-plugin/plugin.json +1 -1
- package/plugins/meta-architect/.mcp.json +1 -1
- package/plugins/meta-architect/README.md +2 -2
- package/plugins/meta-architect/obsidian/main.js +137 -4
- package/plugins/meta-architect/obsidian/manifest.json +1 -1
- package/plugins/meta-architect/obsidian/styles.css +0 -0
- package/plugins/meta-architect/skills/align/SKILL.md +0 -0
- package/plugins/meta-architect/skills/align/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/align/references/shared-language.md +0 -0
- package/plugins/meta-architect/skills/arch/SKILL.md +0 -0
- package/plugins/meta-architect/skills/arch/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/build/SKILL.md +0 -0
- package/plugins/meta-architect/skills/build/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/cleanup/SKILL.md +0 -0
- package/plugins/meta-architect/skills/cleanup/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/cleanup/references/style-and-deslop.md +0 -0
- package/plugins/meta-architect/skills/diagnose/SKILL.md +0 -0
- package/plugins/meta-architect/skills/diagnose/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/flow/SKILL.md +0 -0
- package/plugins/meta-architect/skills/flow/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/maestro/SKILL.md +0 -0
- package/plugins/meta-architect/skills/maestro/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/maestro/references/core-release-rules.md +0 -0
- package/plugins/meta-architect/skills/maestro/references/native-ingest-map.md +0 -0
- package/plugins/meta-architect/skills/sage/SKILL.md +0 -0
- package/plugins/meta-architect/skills/sage/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/sage/references/source-selection.md +0 -0
- package/plugins/meta-architect/skills/tdd/SKILL.md +0 -0
- package/plugins/meta-architect/skills/tdd/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/vet/SKILL.md +0 -0
- package/plugins/meta-architect/skills/vet/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/vet/references/security-playbooks.md +0 -0
- package/plugins/meta-architect/skills/vibe/SKILL.md +0 -0
- package/plugins/meta-architect/skills/vibe/agents/openai.yaml +0 -0
- package/schemas/autonomous-task-queue.schema.json +56 -0
- package/schemas/handoff-packet.schema.json +36 -0
- package/schemas/setup-receipt.schema.json +28 -0
- package/schemas/skill-frontmatter.schema.json +20 -0
- package/schemas/support-bundle.schema.json +37 -0
- package/schemas/task-contract.schema.json +31 -0
- package/scripts/active-autonomy-hook.mjs +141 -11
- package/scripts/biome-staged.js +0 -0
- package/scripts/build-linux-packages.mjs +7 -3
- package/scripts/cleanup-test-fixtures.sh +55 -0
- package/scripts/context-hydration-hook.mjs +89 -0
- package/scripts/demo-smoke.js +285 -0
- package/scripts/doctor.js +10 -8
- package/scripts/install.sh +33 -4
- package/scripts/install.sh.sha256 +1 -0
- package/scripts/linux-package-lib.mjs +0 -0
- package/scripts/linux-package-smoke.mjs +2 -2
- package/scripts/package-size-check.mjs +26 -0
- package/scripts/plugin-sync.js +83 -17
- package/scripts/postinstall.js +17 -10
- package/scripts/prepack.js +9 -0
- package/scripts/ralph/prompt.md +0 -0
- package/scripts/release-metadata.js +0 -0
- package/scripts/release-sync.js +72 -7
- package/scripts/release-verify.js +100 -7
- package/scripts/setup-npmrc.js +48 -23
- package/scripts/skills-install.js +9 -2
- package/scripts/skills-manifest.js +2 -21
- package/scripts/skills-pack.js +2 -2
- package/scripts/skills-validate.js +5 -55
- package/skills/align/SKILL.md +0 -0
- package/skills/align/agents/openai.yaml +0 -0
- package/skills/align/references/shared-language.md +0 -0
- package/skills/arch/SKILL.md +0 -0
- package/skills/arch/agents/openai.yaml +0 -0
- package/skills/build/SKILL.md +0 -0
- package/skills/build/agents/openai.yaml +0 -0
- package/skills/cleanup/SKILL.md +0 -0
- package/skills/cleanup/agents/openai.yaml +0 -0
- package/skills/cleanup/references/style-and-deslop.md +0 -0
- package/skills/diagnose/SKILL.md +0 -0
- package/skills/diagnose/agents/openai.yaml +0 -0
- package/skills/flow/SKILL.md +0 -0
- package/skills/flow/agents/openai.yaml +0 -0
- package/skills/index.json +0 -0
- package/skills/maestro/SKILL.md +0 -0
- package/skills/maestro/agents/openai.yaml +0 -0
- package/skills/maestro/references/core-release-rules.md +0 -0
- package/skills/maestro/references/native-ingest-map.md +0 -0
- package/skills/sage/SKILL.md +0 -0
- package/skills/sage/agents/openai.yaml +0 -0
- package/skills/sage/references/source-selection.md +0 -0
- package/skills/tdd/SKILL.md +0 -0
- package/skills/tdd/agents/openai.yaml +0 -0
- package/skills/vet/SKILL.md +0 -0
- package/skills/vet/agents/openai.yaml +0 -0
- package/skills/vet/references/security-playbooks.md +0 -0
- package/skills/vibe/SKILL.md +0 -0
- package/skills/vibe/agents/openai.yaml +0 -0
- package/sprint/00-idea.md +0 -0
- package/sprint/01-architecture.md +0 -0
- package/sprint/02-oss-evidence.md +0 -0
- package/sprint/03-logic.md +0 -0
- package/sprint/04-security.md +0 -0
- package/sprint/05-dx-ux.md +0 -0
- package/sprint/06-build-plan.md +0 -0
- package/sprint/07-release.md +0 -0
- package/src/agents.js +279 -0
- package/src/bootstrap.js +252 -63
- package/src/build-gate.js +0 -0
- package/src/codex-app-server.js +291 -0
- package/src/decision-log.js +0 -0
- package/src/fs-utils.js +175 -4
- package/src/launcher.js +24 -21
- package/src/mcp-config.js +9 -1
- package/src/mcp-live-client.js +140 -7
- package/src/paths.js +6 -1
- package/src/policy.js +2 -2
- package/src/prelaunch.js +189 -0
- package/src/quality/ai-quality-orchestrator.js +328 -0
- package/src/release-issue-gates.js +62 -0
- package/src/release-operations.js +62 -0
- package/src/release-state.js +0 -0
- package/src/runtime/active-autonomy-core.js +0 -0
- package/src/runtime/agent-compat.js +31 -0
- package/src/runtime/alignment-sentinel.js +0 -0
- package/src/runtime/architect-review.js +248 -10
- package/src/runtime/autonomous-tasks.js +408 -0
- package/src/runtime/build-readiness.js +0 -0
- package/src/runtime/code-graph-rehearse.js +0 -0
- package/src/runtime/codeburn-core.js +112 -0
- package/src/runtime/context-authority.js +40 -0
- package/src/runtime/context-economy-core.js +40 -0
- package/src/runtime/continuity-graph.js +201 -0
- package/src/runtime/continuity-notes.js +71 -26
- package/src/runtime/core-source-ingest.js +0 -0
- package/src/runtime/detached-provider.js +82 -14
- package/src/runtime/doctor-report.js +18 -0
- package/src/runtime/environment-awareness-core.js +0 -0
- package/src/runtime/exposure-catalog.js +0 -0
- package/src/runtime/graphify-core.js +167 -0
- package/src/runtime/guidance-stack.js +9 -2
- package/src/runtime/handoff-packets.js +92 -0
- package/src/runtime/headroom-core.js +104 -0
- package/src/runtime/helper-orchestration-core.js +0 -0
- package/src/runtime/hook-profiles.js +20 -0
- package/src/runtime/learning-loop-core.js +110 -4
- package/src/runtime/live-agent-verification.js +122 -0
- package/src/runtime/maestro-events.js +0 -0
- package/src/runtime/maestro-manager.js +0 -0
- package/src/runtime/maestro-output.js +58 -0
- package/src/runtime/maestro-state.js +0 -0
- package/src/runtime/managed-markdown.js +29 -0
- package/src/runtime/mcp-authority.js +147 -0
- package/src/runtime/mcp-policy.js +0 -0
- package/src/runtime/obsidian-integration-core.js +255 -17
- package/src/runtime/obsidian-plugin-bridge.js +344 -38
- package/src/runtime/orchestrator.js +0 -0
- package/src/runtime/pi-maestro-core.js +89 -0
- package/src/runtime/preferences.js +79 -0
- package/src/runtime/project-context.js +636 -0
- package/src/runtime/prompt-strategy-core.js +0 -0
- package/src/runtime/quorum-review.js +0 -0
- package/src/runtime/ralph-execution-core.js +0 -0
- package/src/runtime/redaction-gateway.js +218 -19
- package/src/runtime/runtime-state.js +94 -2
- package/src/runtime/schema-migrations.js +162 -0
- package/src/runtime/semantic-recording-core.js +0 -0
- package/src/runtime/signal-hooks.js +13 -0
- package/src/runtime/skills-registry-export.js +92 -8
- package/src/runtime/startup-path.js +0 -0
- package/src/runtime/task-contracts.js +83 -0
- package/src/runtime/universal-plugin-broker-core.js +373 -50
- package/src/runtime/workspace-intelligence-runtime.js +0 -0
- package/src/runtime/workspace-virtualizer.js +0 -0
- package/src/runtime/workspaces.js +0 -0
- package/src/runtime-artifacts.js +0 -0
- package/src/setup-lifecycle.js +359 -0
- package/src/skill-frontmatter.js +78 -0
- package/src/skill-installer.js +226 -71
- package/src/skills.js +297 -19
- package/src/state-sync.js +0 -0
- package/src/test-fixtures.js +543 -0
- package/src/tui/grid.js +67 -0
- package/src/tui/status-grid.js +23 -0
- package/support-bundle.json +114 -0
- package/templates/AGENTS.md +6 -2
- package/templates/catalog-manifest.json +0 -0
- package/templates/model-instructions/core.md +0 -0
- package/templates/model-instructions/release.md +0 -0
- package/templates/model-instructions/security.md +0 -0
- package/templates/quality/ai-quality-rules.yml +37 -0
- package/docs/assets/image/Screenshot(1).png +0 -0
- package/docs/assets/image/Screenshot(2).png +0 -0
- package/docs/assets/image/Screenshot(3).png +0 -0
- package/docs/assets/image/Screenshot(4).png +0 -0
- package/docs/assets/image/Screenshot(5).png +0 -0
- package/docs/assets/image/Screenshot(6).png +0 -0
- package/docs/assets/image/Screenshot(7).png +0 -0
- package/docs/assets/image/Screenshot(8).png +0 -0
- package/docs/assets/image/Screenshot(9).png +0 -0
- package/docs/assets/meta-architect-logo.png +0 -0
- package/docs/assets/meta-architect-logo.svg +0 -8
- package/docs/onboarding.md +0 -81
- package/docs/prompt-guidance-contract.md +0 -17
- package/docs/prompt-guidance-fragments/active-autonomy-core.md +0 -7
- package/docs/skills-publishing.md +0 -255
package/src/skills.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { appendDecision } from "./decision-log.js";
|
|
4
|
-
import { readJson, writeFileIfMissing, writeJson } from "./fs-utils.js";
|
|
4
|
+
import { readJson, writeFileIfMissing, writeJson, writeTextAtomically } from "./fs-utils.js";
|
|
5
5
|
import { validateMcpServers } from "./mcp-config.js";
|
|
6
6
|
import { createMcpLiveClient, hasConfiguredMcpRemoteBridge } from "./mcp-live-client.js";
|
|
7
7
|
import { getRepoRoot, getRuntimeReadPath, getRuntimeWritePath, packageRoot } from "./paths.js";
|
|
8
|
+
import { resolveReleaseIssueGates, resolveReleaseReadiness } from "./release-issue-gates.js";
|
|
8
9
|
import {
|
|
9
10
|
evaluateAlignmentDrift,
|
|
10
11
|
saveAlignmentSentinelReport,
|
|
@@ -19,6 +20,8 @@ import {
|
|
|
19
20
|
scanLockfilePackageExposure,
|
|
20
21
|
validateMcpPolicyExposure,
|
|
21
22
|
} from "./runtime/exposure-catalog.js";
|
|
23
|
+
import { getMergedGuidancePath } from "./runtime/guidance-stack.js";
|
|
24
|
+
import { createHandoffPacket, writeHandoffPacket } from "./runtime/handoff-packets.js";
|
|
22
25
|
import { createHelperReceipt } from "./runtime/helper-orchestration-core.js";
|
|
23
26
|
import { appendMaestroEvent } from "./runtime/maestro-events.js";
|
|
24
27
|
import {
|
|
@@ -34,7 +37,10 @@ import {
|
|
|
34
37
|
loadMaestroStateOrDefault,
|
|
35
38
|
saveMaestroState,
|
|
36
39
|
} from "./runtime/maestro-state.js";
|
|
40
|
+
import { embedProjectContext } from "./runtime/obsidian-integration-core.js";
|
|
37
41
|
import { submitTask } from "./runtime/orchestrator.js";
|
|
42
|
+
import { seedPreferences } from "./runtime/preferences.js";
|
|
43
|
+
import { refreshProjectIndex } from "./runtime/project-context.js";
|
|
38
44
|
import {
|
|
39
45
|
createQuorumReviewReceipt,
|
|
40
46
|
evaluateQuorumVotes,
|
|
@@ -48,6 +54,8 @@ import {
|
|
|
48
54
|
loadRuntimeSnapshot,
|
|
49
55
|
repairRuntimeScratchpadArtifacts,
|
|
50
56
|
} from "./runtime/runtime-state.js";
|
|
57
|
+
import { migrateSchemas } from "./runtime/schema-migrations.js";
|
|
58
|
+
import { createTaskContract, writeTaskContract } from "./runtime/task-contracts.js";
|
|
51
59
|
import {
|
|
52
60
|
seedRuntimeArtifacts,
|
|
53
61
|
writeArchitectureArtifacts,
|
|
@@ -59,6 +67,14 @@ import {
|
|
|
59
67
|
writeProjectContext,
|
|
60
68
|
writeSecuritySpec,
|
|
61
69
|
} from "./runtime-artifacts.js";
|
|
70
|
+
import {
|
|
71
|
+
assertNoSymlinkComponents,
|
|
72
|
+
assertSetupReceiptHealthy,
|
|
73
|
+
compactRuntimeState,
|
|
74
|
+
listManagedArtifacts,
|
|
75
|
+
withSetupLock,
|
|
76
|
+
writeSetupReceipt,
|
|
77
|
+
} from "./setup-lifecycle.js";
|
|
62
78
|
import { syncStatusUpdates } from "./state-sync.js";
|
|
63
79
|
|
|
64
80
|
const skillNames = [
|
|
@@ -1001,10 +1017,19 @@ export async function runArch() {
|
|
|
1001
1017
|
throw new Error("Cannot run $arch before ma idea captures a project brief");
|
|
1002
1018
|
}
|
|
1003
1019
|
|
|
1020
|
+
const guidance = await readJson(getMergedGuidancePath()).catch(() => ({
|
|
1021
|
+
sources: [],
|
|
1022
|
+
content: "",
|
|
1023
|
+
}));
|
|
1024
|
+
const advisoryGuidance = guidance.sources
|
|
1025
|
+
.map((source) => `${source.label ?? source.id ?? "Guidance"}: ${source.content ?? ""}`)
|
|
1026
|
+
.filter(Boolean)
|
|
1027
|
+
.join(" ");
|
|
1028
|
+
|
|
1004
1029
|
const blueprint = {
|
|
1005
1030
|
decision: "Approve the first bounded architecture direction.",
|
|
1006
1031
|
status: "APPROVED",
|
|
1007
|
-
summary: `Blueprint derived from idea: ${idea}. Runtime shell currently exposes ${runtimeSummary.workerCount} workers, ${runtimeSummary.workspaceCount} workspaces, and ${runtimeSummary.guidanceSourceCount} guidance sources
|
|
1032
|
+
summary: `Blueprint derived from idea: ${idea}. Runtime shell currently exposes ${runtimeSummary.workerCount} workers, ${runtimeSummary.workspaceCount} workspaces, and ${runtimeSummary.guidanceSourceCount} guidance sources. Advisory guidance: ${advisoryGuidance}`,
|
|
1008
1033
|
suggestedStack: ["Node.js", "MCP", "GitMCP", "Git worktree", "File-backed runtime state"],
|
|
1009
1034
|
workloadAssumptions: [
|
|
1010
1035
|
"single-repo operator workflow",
|
|
@@ -1055,6 +1080,7 @@ export async function runSage() {
|
|
|
1055
1080
|
const runtimeSummary = await readRuntimeSummary();
|
|
1056
1081
|
assertControlPlaneReady(runtimeSummary);
|
|
1057
1082
|
await seedRedactionVault();
|
|
1083
|
+
await seedPreferences();
|
|
1058
1084
|
const disableLiveProbe = process.env.MA_DISABLE_LIVE_MCP === "1";
|
|
1059
1085
|
const sourceEntries = config.servers.map((server) => ({
|
|
1060
1086
|
repo: server.repo,
|
|
@@ -1442,13 +1468,40 @@ export async function runVibe() {
|
|
|
1442
1468
|
assertControlPlaneReady(runtimeSummary);
|
|
1443
1469
|
const outcomes = await readJson(getRuntimeWritePath("evidence", "outcomes.json"));
|
|
1444
1470
|
const reviewApproved = outcomes.items.some(
|
|
1445
|
-
(item) =>
|
|
1471
|
+
(item) =>
|
|
1472
|
+
["review", "vibe-review", "dx-ux-review"].includes(item.source) && item.approved === true,
|
|
1446
1473
|
);
|
|
1447
|
-
const
|
|
1474
|
+
const automatedReviewChecks = [
|
|
1475
|
+
{
|
|
1476
|
+
name: "no_pending_mailbox_proposals",
|
|
1477
|
+
passed: runtimeSummary.pendingMailboxCount === 0,
|
|
1478
|
+
evidence: `${runtimeSummary.pendingMailboxCount} pending mailbox proposals`,
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
name: "runtime_artifacts_valid",
|
|
1482
|
+
passed: runtimeSummary.invalidArtifacts.length === 0,
|
|
1483
|
+
evidence: `${runtimeSummary.invalidArtifacts.length} invalid runtime artifacts`,
|
|
1484
|
+
},
|
|
1485
|
+
{
|
|
1486
|
+
name: "runtime_artifacts_present",
|
|
1487
|
+
passed: runtimeSummary.missingArtifacts.length === 0,
|
|
1488
|
+
evidence: `${runtimeSummary.missingArtifacts.length} missing runtime artifacts`,
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
name: "workspace_context_available",
|
|
1492
|
+
passed: runtimeSummary.workspaceCount > 0,
|
|
1493
|
+
evidence: `${runtimeSummary.workspaceCount} workspace context entries`,
|
|
1494
|
+
},
|
|
1495
|
+
];
|
|
1496
|
+
const runtimeApproved = automatedReviewChecks.every((check) => check.passed);
|
|
1497
|
+
const failedAutomatedReviewChecks = automatedReviewChecks
|
|
1498
|
+
.filter((check) => !check.passed)
|
|
1499
|
+
.map((check) => `${check.name}: ${check.evidence}`);
|
|
1448
1500
|
const note = {
|
|
1449
1501
|
area: "developer-experience",
|
|
1450
1502
|
source: "runtime-vibe-review",
|
|
1451
1503
|
summary: `Runtime DX/UX review recorded from current coordination state: ${runtimeSummary.taskCount} tasks, ${runtimeSummary.workspaceCount} workspaces, and ${runtimeSummary.pendingMailboxCount} pending mailbox proposals.`,
|
|
1504
|
+
automatedReviewChecks,
|
|
1452
1505
|
operatorFriction: [
|
|
1453
1506
|
runtimeSummary.pendingMailboxCount > 0
|
|
1454
1507
|
? "Pending mailbox proposals increase operator coordination overhead."
|
|
@@ -1465,7 +1518,10 @@ export async function runVibe() {
|
|
|
1465
1518
|
const blockers =
|
|
1466
1519
|
status === "GREEN"
|
|
1467
1520
|
? []
|
|
1468
|
-
: [
|
|
1521
|
+
: [
|
|
1522
|
+
"Automated DX/UX review must pass all runtime evidence checks or receive explicit review approval.",
|
|
1523
|
+
...failedAutomatedReviewChecks,
|
|
1524
|
+
];
|
|
1469
1525
|
const nextAllowedTriggers = status === "GREEN" ? ["$build"] : ["$vibe"];
|
|
1470
1526
|
await writeExperienceSpec({
|
|
1471
1527
|
note,
|
|
@@ -1498,8 +1554,52 @@ export async function runVibe() {
|
|
|
1498
1554
|
});
|
|
1499
1555
|
}
|
|
1500
1556
|
|
|
1501
|
-
export async function runMaestro({
|
|
1557
|
+
export async function runMaestro({
|
|
1558
|
+
autoHeal = false,
|
|
1559
|
+
parallel = false,
|
|
1560
|
+
taskContract = {},
|
|
1561
|
+
handoff = {},
|
|
1562
|
+
} = {}) {
|
|
1502
1563
|
await assertLeaderAuthority();
|
|
1564
|
+
const intakeContract = createTaskContract({
|
|
1565
|
+
goal: taskContract.goal ?? "Execute the next eligible Meta-Architect workflow step",
|
|
1566
|
+
contextUsed: taskContract.contextUsed ?? [
|
|
1567
|
+
".ma/context/project-index.json",
|
|
1568
|
+
".ma/context/agent-brief.md",
|
|
1569
|
+
],
|
|
1570
|
+
assumptions: taskContract.assumptions ?? [
|
|
1571
|
+
"Source files and fresh verification output outrank generated context",
|
|
1572
|
+
],
|
|
1573
|
+
constraints: taskContract.constraints ?? [
|
|
1574
|
+
"Do not mutate release state outside the owning lane",
|
|
1575
|
+
],
|
|
1576
|
+
risk: taskContract.risk ?? "medium",
|
|
1577
|
+
verification: taskContract.verification ?? ["ma doctor", "focused tests"],
|
|
1578
|
+
stopCondition:
|
|
1579
|
+
taskContract.stopCondition ??
|
|
1580
|
+
"Stop when the selected lane is complete, blocked, or requires review",
|
|
1581
|
+
persist: taskContract.persist !== false,
|
|
1582
|
+
});
|
|
1583
|
+
if (intakeContract.persist) {
|
|
1584
|
+
await writeTaskContract(`maestro-${Date.now()}`, intakeContract);
|
|
1585
|
+
}
|
|
1586
|
+
if (handoff.persist !== false) {
|
|
1587
|
+
await writeHandoffPacket(
|
|
1588
|
+
`maestro-${Date.now()}`,
|
|
1589
|
+
createHandoffPacket({
|
|
1590
|
+
goal: intakeContract.goal,
|
|
1591
|
+
currentState: "Manager intake accepted",
|
|
1592
|
+
contextUsed: intakeContract.context_used,
|
|
1593
|
+
decisions: handoff.decisions ?? [],
|
|
1594
|
+
blockers: handoff.blockers ?? [],
|
|
1595
|
+
risks: handoff.risks ?? [],
|
|
1596
|
+
changedFiles: handoff.changedFiles ?? [],
|
|
1597
|
+
verification: intakeContract.verification,
|
|
1598
|
+
nextAction: handoff.nextAction ?? "Continue the selected bounded workflow lane",
|
|
1599
|
+
status: handoff.status ?? "active",
|
|
1600
|
+
}),
|
|
1601
|
+
);
|
|
1602
|
+
}
|
|
1503
1603
|
let runtimeSnapshot = await loadRuntimeSnapshot();
|
|
1504
1604
|
let releaseState = runtimeSnapshot.release;
|
|
1505
1605
|
let runtimeSummary = createRuntimeSummary(runtimeSnapshot);
|
|
@@ -1783,8 +1883,18 @@ export async function runMaestro({ autoHeal = false, parallel = false } = {}) {
|
|
|
1783
1883
|
});
|
|
1784
1884
|
}
|
|
1785
1885
|
|
|
1786
|
-
|
|
1787
|
-
|
|
1886
|
+
async function runInitUnlocked({
|
|
1887
|
+
refresh = false,
|
|
1888
|
+
obsidianVault = process.env.MA_OBSIDIAN_VAULT,
|
|
1889
|
+
} = {}) {
|
|
1890
|
+
const repoRoot = getRepoRoot();
|
|
1891
|
+
const migrations = await migrateSchemas(repoRoot);
|
|
1892
|
+
const managedBefore = await listManagedArtifacts(repoRoot);
|
|
1893
|
+
const report = {
|
|
1894
|
+
directories: [],
|
|
1895
|
+
files: [],
|
|
1896
|
+
migrations,
|
|
1897
|
+
};
|
|
1788
1898
|
const targets = [
|
|
1789
1899
|
".codex/agents",
|
|
1790
1900
|
".codex/prompts",
|
|
@@ -1799,6 +1909,7 @@ export async function runInit() {
|
|
|
1799
1909
|
".ma/context",
|
|
1800
1910
|
".ma/specs",
|
|
1801
1911
|
".ma/plans",
|
|
1912
|
+
"scripts",
|
|
1802
1913
|
"mcp",
|
|
1803
1914
|
"docs",
|
|
1804
1915
|
"docs/qa",
|
|
@@ -1807,8 +1918,14 @@ export async function runInit() {
|
|
|
1807
1918
|
|
|
1808
1919
|
for (const relative of targets) {
|
|
1809
1920
|
const target = path.join(getRepoRoot(), relative);
|
|
1921
|
+
const existed = await pathExists(target);
|
|
1922
|
+
await assertNoSymlinkComponents(getRepoRoot(), target);
|
|
1810
1923
|
await fs.mkdir(target, { recursive: true });
|
|
1811
|
-
|
|
1924
|
+
report.directories.push({
|
|
1925
|
+
path: relative,
|
|
1926
|
+
kind: "directory",
|
|
1927
|
+
status: existed ? "existing" : "created",
|
|
1928
|
+
});
|
|
1812
1929
|
}
|
|
1813
1930
|
|
|
1814
1931
|
const templateCopies = [
|
|
@@ -1856,6 +1973,14 @@ export async function runInit() {
|
|
|
1856
1973
|
path.join(packageRoot, ".codex", "prompts", "onboarding.md"),
|
|
1857
1974
|
path.join(getRepoRoot(), ".codex", "prompts", "onboarding.md"),
|
|
1858
1975
|
],
|
|
1976
|
+
[
|
|
1977
|
+
path.join(packageRoot, "scripts", "active-autonomy-hook.mjs"),
|
|
1978
|
+
path.join(getRepoRoot(), "scripts", "active-autonomy-hook.mjs"),
|
|
1979
|
+
],
|
|
1980
|
+
[
|
|
1981
|
+
path.join(packageRoot, "scripts", "context-hydration-hook.mjs"),
|
|
1982
|
+
path.join(getRepoRoot(), "scripts", "context-hydration-hook.mjs"),
|
|
1983
|
+
],
|
|
1859
1984
|
[path.join(packageRoot, "docs", "README.md"), path.join(getRepoRoot(), "docs", "README.md")],
|
|
1860
1985
|
[
|
|
1861
1986
|
path.join(packageRoot, "docs", "getting-started.md"),
|
|
@@ -1871,12 +1996,16 @@ export async function runInit() {
|
|
|
1871
1996
|
path.join(getRepoRoot(), "docs", "release-spec.md"),
|
|
1872
1997
|
],
|
|
1873
1998
|
[
|
|
1874
|
-
|
|
1875
|
-
|
|
1999
|
+
resolveReleaseReadiness(packageRoot)?.path ??
|
|
2000
|
+
path.join(packageRoot, "docs", "qa", "release-readiness-missing.md"),
|
|
2001
|
+
resolveReleaseReadiness(getRepoRoot())?.path ??
|
|
2002
|
+
path.join(getRepoRoot(), "docs", "qa", "release-readiness-missing.md"),
|
|
1876
2003
|
],
|
|
1877
2004
|
[
|
|
1878
|
-
|
|
1879
|
-
|
|
2005
|
+
resolveReleaseIssueGates(packageRoot)?.path ??
|
|
2006
|
+
path.join(packageRoot, "docs", "qa", "release-issue-gates-missing.json"),
|
|
2007
|
+
resolveReleaseIssueGates(getRepoRoot())?.path ??
|
|
2008
|
+
path.join(getRepoRoot(), "docs", "qa", "release-issue-gates-missing.json"),
|
|
1880
2009
|
],
|
|
1881
2010
|
];
|
|
1882
2011
|
|
|
@@ -1911,14 +2040,46 @@ export async function runInit() {
|
|
|
1911
2040
|
}
|
|
1912
2041
|
|
|
1913
2042
|
for (const [src, dest] of templateCopies) {
|
|
1914
|
-
|
|
1915
|
-
await fs.access(dest);
|
|
1916
|
-
} catch {
|
|
1917
|
-
await fs.copyFile(src, dest);
|
|
1918
|
-
}
|
|
2043
|
+
report.files.push(await syncTemplateFile(src, dest, { refresh }));
|
|
1919
2044
|
}
|
|
1920
2045
|
|
|
1921
2046
|
await seedRuntimeArtifacts();
|
|
2047
|
+
const projectIndex = await refreshProjectIndex(repoRoot);
|
|
2048
|
+
report.context = {
|
|
2049
|
+
path: path.relative(repoRoot, getRuntimeWritePath("context", "project-index.json")),
|
|
2050
|
+
status: projectIndex.quality.confidence,
|
|
2051
|
+
completeness: projectIndex.quality.completeness,
|
|
2052
|
+
detected: {
|
|
2053
|
+
languages: projectIndex.languages,
|
|
2054
|
+
frameworks: projectIndex.frameworks,
|
|
2055
|
+
packageManager: projectIndex.packageManager,
|
|
2056
|
+
commands: projectIndex.commands,
|
|
2057
|
+
entrypoints: projectIndex.entrypoints,
|
|
2058
|
+
importantDocs: projectIndex.importantDocs,
|
|
2059
|
+
vendorIntegrations: projectIndex.vendorIntegrations,
|
|
2060
|
+
},
|
|
2061
|
+
unknown: projectIndex.quality.gaps,
|
|
2062
|
+
};
|
|
2063
|
+
|
|
2064
|
+
if (obsidianVault) {
|
|
2065
|
+
const embedded = await embedProjectContext({
|
|
2066
|
+
vaultPath: obsidianVault,
|
|
2067
|
+
projectIndex,
|
|
2068
|
+
});
|
|
2069
|
+
report.integrations = report.integrations ?? [];
|
|
2070
|
+
report.integrations.push({
|
|
2071
|
+
kind: "obsidian",
|
|
2072
|
+
status: embedded.noteStatus,
|
|
2073
|
+
vaultPath: embedded.vaultPath,
|
|
2074
|
+
notePath: embedded.notePath,
|
|
2075
|
+
indexPath: path.relative(
|
|
2076
|
+
repoRoot,
|
|
2077
|
+
getRuntimeWritePath("context", "obsidian-vault-index.json"),
|
|
2078
|
+
),
|
|
2079
|
+
records_as: "vault_context",
|
|
2080
|
+
build_evidence: false,
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
1922
2083
|
|
|
1923
2084
|
await writeFileIfMissing(
|
|
1924
2085
|
getRuntimeWritePath("decisions.json"),
|
|
@@ -2043,5 +2204,122 @@ export async function runInit() {
|
|
|
2043
2204
|
"# Onboarding\n\nMeta-Architect initializes the core scaffold, MCP config, and canonical .ma runtime files.\n",
|
|
2044
2205
|
);
|
|
2045
2206
|
|
|
2046
|
-
|
|
2207
|
+
const reported = new Set([
|
|
2208
|
+
...report.directories.map((entry) => entry.path),
|
|
2209
|
+
...report.files.map((entry) => entry.path),
|
|
2210
|
+
]);
|
|
2211
|
+
const managedAfter = await listManagedArtifacts(repoRoot);
|
|
2212
|
+
for (const [relative, kind] of managedAfter) {
|
|
2213
|
+
if (!managedBefore.has(relative) && !reported.has(relative)) {
|
|
2214
|
+
report.files.push({ path: relative, kind, status: "created" });
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
report.onboarding = {
|
|
2219
|
+
context: ".ma/context/project-index.json",
|
|
2220
|
+
future_agents_read: [
|
|
2221
|
+
".ma/context/agent-brief.md",
|
|
2222
|
+
".ma/context/project-index.json",
|
|
2223
|
+
"AGENTS.md",
|
|
2224
|
+
],
|
|
2225
|
+
integrations: {
|
|
2226
|
+
obsidian: report.integrations?.[0]?.status ?? "not configured",
|
|
2227
|
+
mcp: "local read-only context resources",
|
|
2228
|
+
hooks: ".codex/hooks.json",
|
|
2229
|
+
},
|
|
2230
|
+
freshness: report.context?.status ?? "unknown",
|
|
2231
|
+
next: ["ma doctor", "ma context refresh", "ma setup --rollback"],
|
|
2232
|
+
};
|
|
2233
|
+
|
|
2234
|
+
return report;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
export async function runInit(options = {}) {
|
|
2238
|
+
const repoRoot = getRepoRoot();
|
|
2239
|
+
return withSetupLock(repoRoot, async () => {
|
|
2240
|
+
await assertSetupReceiptHealthy(repoRoot);
|
|
2241
|
+
const managedBefore = await listManagedArtifacts(repoRoot);
|
|
2242
|
+
let report;
|
|
2243
|
+
try {
|
|
2244
|
+
report = await runInitUnlocked(options);
|
|
2245
|
+
} catch (error) {
|
|
2246
|
+
const managedAfter = await listManagedArtifacts(repoRoot);
|
|
2247
|
+
const partialFiles = [...managedAfter]
|
|
2248
|
+
.filter(([relative]) => !managedBefore.has(relative))
|
|
2249
|
+
.map(([relative, kind]) => ({
|
|
2250
|
+
path: relative,
|
|
2251
|
+
kind,
|
|
2252
|
+
status: "created",
|
|
2253
|
+
}));
|
|
2254
|
+
try {
|
|
2255
|
+
await writeSetupReceipt(repoRoot, { files: partialFiles });
|
|
2256
|
+
} catch (receiptError) {
|
|
2257
|
+
error.message = `${error.message}; failed to persist partial setup receipt: ${receiptError.message}`;
|
|
2258
|
+
}
|
|
2259
|
+
throw error;
|
|
2260
|
+
}
|
|
2261
|
+
const receipt = await writeSetupReceipt(repoRoot, report);
|
|
2262
|
+
await compactRuntimeState(repoRoot);
|
|
2263
|
+
report.files.push({ ...receipt, kind: "file", status: "refreshed" });
|
|
2264
|
+
return report;
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
async function syncTemplateFile(src, dest, { refresh = false } = {}) {
|
|
2269
|
+
const relativePath = path.relative(getRepoRoot(), dest);
|
|
2270
|
+
try {
|
|
2271
|
+
const [sourceContent, destContent] = await Promise.all([
|
|
2272
|
+
fs.readFile(src, "utf8"),
|
|
2273
|
+
fs.readFile(dest, "utf8").catch((error) => {
|
|
2274
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
2275
|
+
return null;
|
|
2276
|
+
}
|
|
2277
|
+
throw error;
|
|
2278
|
+
}),
|
|
2279
|
+
]);
|
|
2280
|
+
|
|
2281
|
+
if (destContent === null) {
|
|
2282
|
+
await writeTextAtomically(dest, sourceContent);
|
|
2283
|
+
return {
|
|
2284
|
+
path: relativePath,
|
|
2285
|
+
kind: "file",
|
|
2286
|
+
status: "created",
|
|
2287
|
+
};
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
if (destContent !== sourceContent && refresh) {
|
|
2291
|
+
await writeTextAtomically(dest, sourceContent);
|
|
2292
|
+
return {
|
|
2293
|
+
path: relativePath,
|
|
2294
|
+
kind: "file",
|
|
2295
|
+
status: "refreshed",
|
|
2296
|
+
};
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
if (destContent !== sourceContent) {
|
|
2300
|
+
return {
|
|
2301
|
+
path: relativePath,
|
|
2302
|
+
kind: "file",
|
|
2303
|
+
status: "skipped",
|
|
2304
|
+
warning: "existing file differs; rerun with --refresh to update it",
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
return {
|
|
2309
|
+
path: relativePath,
|
|
2310
|
+
kind: "file",
|
|
2311
|
+
status: "existing",
|
|
2312
|
+
};
|
|
2313
|
+
} catch (error) {
|
|
2314
|
+
throw new Error(`Unable to sync managed template ${relativePath}`, { cause: error });
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
async function pathExists(target) {
|
|
2319
|
+
try {
|
|
2320
|
+
await fs.access(target);
|
|
2321
|
+
return true;
|
|
2322
|
+
} catch {
|
|
2323
|
+
return false;
|
|
2324
|
+
}
|
|
2047
2325
|
}
|
package/src/state-sync.js
CHANGED
|
File without changes
|