@jstn-sdk/ma 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 (97) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.codex/agents/Architect.toml +4 -0
  3. package/.codex/agents/Auditor.toml +4 -0
  4. package/.codex/agents/Builder.toml +4 -0
  5. package/.codex/agents/Flow.toml +4 -0
  6. package/.codex/agents/Sage.toml +4 -0
  7. package/.codex/agents/Vibe.toml +4 -0
  8. package/.codex/hooks.json +15 -0
  9. package/.codex/prompts/enforcement.md +59 -0
  10. package/.codex/prompts/onboarding.md +41 -0
  11. package/.codex/prompts/release-rules.md +28 -0
  12. package/.codex/prompts/skill-contract.md +41 -0
  13. package/LICENSE +21 -0
  14. package/README.md +532 -0
  15. package/bin/ma.js +300 -0
  16. package/bin/meta-architect.js +3 -0
  17. package/docs/README.md +24 -0
  18. package/docs/assets/meta-architect-logo.png +0 -0
  19. package/docs/assets/meta-architect-logo.svg +8 -0
  20. package/docs/getting-started.md +451 -0
  21. package/docs/mcp-setup.md +5 -0
  22. package/docs/onboarding.md +65 -0
  23. package/docs/qa/release-readiness-0.1.0.md +62 -0
  24. package/docs/release-spec.md +86 -0
  25. package/docs/skills-publishing.md +231 -0
  26. package/docs/skills.md +91 -0
  27. package/index.js +28 -0
  28. package/mcp/collections.json +21 -0
  29. package/mcp/fallback.json +7 -0
  30. package/mcp/servers.json +55 -0
  31. package/package.json +84 -0
  32. package/plugins/meta-architect/.app.json +8 -0
  33. package/plugins/meta-architect/.codex-plugin/plugin.json +23 -0
  34. package/plugins/meta-architect/.mcp.json +12 -0
  35. package/plugins/meta-architect/README.md +121 -0
  36. package/plugins/meta-architect/skills/arch/SKILL.md +27 -0
  37. package/plugins/meta-architect/skills/arch/agents/openai.yaml +4 -0
  38. package/plugins/meta-architect/skills/build/SKILL.md +24 -0
  39. package/plugins/meta-architect/skills/build/agents/openai.yaml +4 -0
  40. package/plugins/meta-architect/skills/flow/SKILL.md +24 -0
  41. package/plugins/meta-architect/skills/flow/agents/openai.yaml +4 -0
  42. package/plugins/meta-architect/skills/meta-architect/SKILL.md +30 -0
  43. package/plugins/meta-architect/skills/meta-architect/agents/openai.yaml +4 -0
  44. package/plugins/meta-architect/skills/meta-architect/references/core-release-rules.md +13 -0
  45. package/plugins/meta-architect/skills/sage/SKILL.md +24 -0
  46. package/plugins/meta-architect/skills/sage/agents/openai.yaml +4 -0
  47. package/plugins/meta-architect/skills/vet/SKILL.md +25 -0
  48. package/plugins/meta-architect/skills/vet/agents/openai.yaml +4 -0
  49. package/plugins/meta-architect/skills/vibe/SKILL.md +24 -0
  50. package/plugins/meta-architect/skills/vibe/agents/openai.yaml +4 -0
  51. package/scripts/doctor.js +37 -0
  52. package/scripts/plugin-sync.js +92 -0
  53. package/scripts/postinstall.js +19 -0
  54. package/scripts/release-metadata.js +94 -0
  55. package/scripts/release-verify.js +153 -0
  56. package/scripts/setup-npmrc.js +39 -0
  57. package/scripts/skills-install.js +29 -0
  58. package/scripts/skills-manifest.js +61 -0
  59. package/scripts/skills-pack.js +54 -0
  60. package/scripts/skills-validate.js +118 -0
  61. package/skills/arch/SKILL.md +27 -0
  62. package/skills/arch/agents/openai.yaml +4 -0
  63. package/skills/build/SKILL.md +24 -0
  64. package/skills/build/agents/openai.yaml +4 -0
  65. package/skills/flow/SKILL.md +24 -0
  66. package/skills/flow/agents/openai.yaml +4 -0
  67. package/skills/index.json +40 -0
  68. package/skills/meta-architect/SKILL.md +30 -0
  69. package/skills/meta-architect/agents/openai.yaml +4 -0
  70. package/skills/meta-architect/references/core-release-rules.md +13 -0
  71. package/skills/sage/SKILL.md +24 -0
  72. package/skills/sage/agents/openai.yaml +4 -0
  73. package/skills/vet/SKILL.md +25 -0
  74. package/skills/vet/agents/openai.yaml +4 -0
  75. package/skills/vibe/SKILL.md +24 -0
  76. package/skills/vibe/agents/openai.yaml +4 -0
  77. package/sprint/00-idea.md +27 -0
  78. package/sprint/01-architecture.md +26 -0
  79. package/sprint/02-oss-evidence.md +26 -0
  80. package/sprint/03-logic.md +25 -0
  81. package/sprint/04-security.md +25 -0
  82. package/sprint/05-dx-ux.md +24 -0
  83. package/sprint/06-build-plan.md +26 -0
  84. package/sprint/07-release.md +26 -0
  85. package/src/build-gate.js +52 -0
  86. package/src/decision-log.js +40 -0
  87. package/src/fs-utils.js +25 -0
  88. package/src/launcher.js +55 -0
  89. package/src/mcp-config.js +30 -0
  90. package/src/mcp-live-client.js +186 -0
  91. package/src/paths.js +26 -0
  92. package/src/policy.js +23 -0
  93. package/src/release-state.js +59 -0
  94. package/src/runtime-artifacts.js +363 -0
  95. package/src/skill-installer.js +49 -0
  96. package/src/skills.js +507 -0
  97. package/src/state-sync.js +15 -0
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: arch
3
+ description: "Use when the user wants architecture-first product and system design with explicit stack rationale, boundaries, tradeoffs, data model choices, and phased delivery planning."
4
+ ---
5
+
6
+ # Arch
7
+
8
+ Use this skill inside Codex to turn a product idea into a concrete architecture brief.
9
+
10
+ ## Output
11
+
12
+ Produce:
13
+ - problem framing
14
+ - user and workload assumptions
15
+ - system architecture and subsystem boundaries
16
+ - stack recommendation with tradeoffs
17
+ - data model and storage choices
18
+ - auth, security, and operational concerns
19
+ - phased delivery plan
20
+ - top risks and open questions
21
+ - exact next trigger, usually `$sage`
22
+
23
+ ## Rules
24
+
25
+ - Ask only for constraints that materially change the architecture.
26
+ - Keep the design biased toward the simplest system that can satisfy the stated requirements.
27
+ - Be explicit about tradeoffs, failure modes, and what should stay out of the first version.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "MA Architect"
3
+ short_description: "Architecture and stack design for MA flows"
4
+ default_prompt: "Use $arch to produce architecture, stack rationale, subsystem boundaries, tradeoffs, and a phased delivery plan."
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: build
3
+ description: "Use when the user wants to decide whether implementation is ready, what remains blocked, and what the exact next build step should be."
4
+ ---
5
+
6
+ # Build
7
+
8
+ Use this skill inside Codex to convert the earlier review lanes into an implementation-ready decision.
9
+
10
+ ## Output
11
+
12
+ Produce:
13
+ - current readiness verdict
14
+ - blockers that still prevent implementation
15
+ - the narrowest viable build slice
16
+ - branch or worktree suggestions when relevant
17
+ - test and verification expectations
18
+ - the exact next implementation step
19
+
20
+ ## Rules
21
+
22
+ - Do not claim readiness if architecture, evidence, logic, security, or DX/UX gaps remain unresolved.
23
+ - Keep the recommended build slice small, testable, and reversible.
24
+ - If the user wants code immediately and the path is clear, end with a concrete implementation plan rather than more review prose.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "MA Build"
3
+ short_description: "Gated build planning and branch/worktree prep"
4
+ default_prompt: "Use $build to decide whether implementation is ready, what remains blocked, and what the next build slice should be."
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: flow
3
+ description: "Use when the user wants logic validation: states, transitions, invariants, edge cases, dead ends, and blockers before implementation."
4
+ ---
5
+
6
+ # Flow
7
+
8
+ Use this skill inside Codex to pressure-test how the system behaves, not just how it is structured.
9
+
10
+ ## Output
11
+
12
+ Produce:
13
+ - key actors and system states
14
+ - main flows and failure flows
15
+ - invariants and state transitions
16
+ - race conditions, dead ends, and consistency risks
17
+ - missing requirements or ambiguous behavior
18
+ - exact next trigger, usually `$vet`
19
+
20
+ ## Rules
21
+
22
+ - Focus on behavior, not UI polish or low-level code details.
23
+ - Surface ambiguity aggressively when it affects correctness.
24
+ - Prefer simple state models over sprawling branching logic.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "MA Flow"
3
+ short_description: "Business logic and state validation for MA"
4
+ default_prompt: "Use $flow to map business logic, state transitions, invariants, and blockers in the current design."
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: meta-architect
3
+ description: "Use when the user wants the full Meta-Architect workflow inside Codex: architecture-first planning, evidence-backed OSS selection, logic review, security review, DX/UX review, and build readiness without leaving the Codex session."
4
+ ---
5
+
6
+ # Meta-Architect
7
+
8
+ ## Overview
9
+
10
+ Run the full Meta-Architect workflow inside Codex. Use this skill when the user wants the gated design-and-review sequence rather than a single specialist lane.
11
+
12
+ ## Workflow
13
+
14
+ 1. Start with `$arch` and turn the user's goal into a concrete architecture brief.
15
+ 2. Continue with `$sage` to validate core stack choices against official docs or approved repo-backed sources.
16
+ 3. Run `$flow` to map states, transitions, invariants, and blockers.
17
+ 4. Run `$vet` to review trust boundaries, auth, data handling, and abuse paths.
18
+ 5. Run `$vibe` to review developer and user experience quality.
19
+ 6. Finish with `$build` to decide whether implementation is ready, what remains blocked, and what the exact next execution step should be.
20
+
21
+ ## Rules
22
+
23
+ - Stay inside Codex unless the user explicitly asks for repo-local helper commands.
24
+ - Keep the workflow architecture-first. Do not jump into code before the architecture and review lanes are grounded.
25
+ - Prefer official docs, upstream repos, and repo-configured GitMCP sources when validating tooling choices.
26
+ - End each lane with a clear result shape: decision, evidence, blockers, and exact next trigger.
27
+
28
+ ## References
29
+
30
+ - For release gates and branch policy, read `references/core-release-rules.md`.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Meta-Architect"
3
+ short_description: "Core orchestration and gated build workflows"
4
+ default_prompt: "Use $meta-architect to run the full Meta-Architect workflow inside Codex, then route through $arch, $sage, $flow, $vet, $vibe, and $build as needed."
@@ -0,0 +1,13 @@
1
+ # Core Release Rules
2
+
3
+ - Required status fields live in `.ma/decisions.json` and `.ma/release.json`.
4
+ - `$build` is blocked unless:
5
+ - `idea_status = CLEAR`
6
+ - `architecture_status = APPROVED`
7
+ - `evidence_status = VERIFIED`
8
+ - `logic_status = GREEN`
9
+ - `security_status = GREEN`
10
+ - `experience_status = GREEN` or `WAIVED`
11
+ - Feature work merges into `development`, never directly into `prod`.
12
+ - Release promotion is allowed only from `development` or approved `release/*`.
13
+ - Use the helper CLI only when repo-local state automation is explicitly needed; otherwise stay inside Codex and carry the gate decisions in the session.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: sage
3
+ description: "Use when the user wants evidence-backed technology choices, OSS evaluation, and source-grounded validation of the stack proposed in `$arch`."
4
+ ---
5
+
6
+ # Sage
7
+
8
+ Use this skill inside Codex to verify or challenge stack choices with real sources.
9
+
10
+ ## Output
11
+
12
+ Produce:
13
+ - candidate tools, libraries, or services
14
+ - why each option fits or fails the architecture
15
+ - source-backed evidence from official docs, upstream repos, or approved GitMCP sources
16
+ - recommendation with tradeoffs
17
+ - unresolved gaps or missing evidence
18
+ - exact next trigger, usually `$flow`
19
+
20
+ ## Rules
21
+
22
+ - Do not invent package capabilities or maturity claims.
23
+ - Prefer primary sources over summaries when validating technical details.
24
+ - If the evidence is weak or contradictory, say so clearly and keep the recommendation conditional.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "MA Sage"
3
+ short_description: "GitMCP-backed OSS evidence selection"
4
+ default_prompt: "Use $sage to validate stack choices with official docs, upstream repos, and approved GitMCP-backed sources."
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: vet
3
+ description: "Use when the user wants a security and trust-boundary review of the current design before implementation or release."
4
+ ---
5
+
6
+ # Vet
7
+
8
+ Use this skill inside Codex to review security posture before the build lane.
9
+
10
+ ## Output
11
+
12
+ Produce:
13
+ - trust boundaries
14
+ - authn/authz expectations
15
+ - sensitive data paths
16
+ - abuse cases and likely failure modes
17
+ - concrete mitigations
18
+ - release blockers vs acceptable risks
19
+ - exact next trigger, usually `$vibe`
20
+
21
+ ## Rules
22
+
23
+ - Prioritize material risks over exhaustive but low-value checklists.
24
+ - Call out missing assumptions that affect security posture.
25
+ - Distinguish between must-fix blockers and documented accepted risk.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "MA Vet"
3
+ short_description: "Security, CVE, and risk review for MA"
4
+ default_prompt: "Use $vet to review trust boundaries, security risks, abuse cases, and safer alternatives in the current design."
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: vibe
3
+ description: "Use when the user wants a DX and UX review of the planned workflow before implementation proceeds."
4
+ ---
5
+
6
+ # Vibe
7
+
8
+ Use this skill inside Codex to review whether the system will feel coherent for both operators and end users.
9
+
10
+ ## Output
11
+
12
+ Produce:
13
+ - developer workflow risks
14
+ - user workflow risks
15
+ - complexity hotspots
16
+ - onboarding or operability friction
17
+ - simplifications that improve clarity
18
+ - exact next trigger, usually `$build`
19
+
20
+ ## Rules
21
+
22
+ - Focus on concrete friction, not aesthetics-only feedback.
23
+ - Prefer fewer surfaces, fewer steps, and clearer operator outcomes.
24
+ - Preserve the architecture and security constraints established earlier in the flow.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "MA Vibe"
3
+ short_description: "DX and UX review before Meta-Architect build"
4
+ default_prompt: "Use $vibe to review developer and user experience risks before the build lane proceeds."
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs";
4
+
5
+ const checks = [
6
+ ["package.json", fs.existsSync("package.json")],
7
+ ["skills/index.json", fs.existsSync("skills/index.json")],
8
+ ["dist/meta-architect-skills.tgz", fs.existsSync("dist/meta-architect-skills.tgz")],
9
+ [".codex/hooks.json", fs.existsSync(".codex/hooks.json")],
10
+ [".ma/decisions.json", fs.existsSync(".ma/decisions.json")],
11
+ [".ma/release.json", fs.existsSync(".ma/release.json")],
12
+ ["docs/release-spec.md", fs.existsSync("docs/release-spec.md")],
13
+ [".agents/plugins/marketplace.json", fs.existsSync(".agents/plugins/marketplace.json")],
14
+ ["plugins/meta-architect/.app.json", fs.existsSync("plugins/meta-architect/.app.json")],
15
+ [
16
+ "plugins/meta-architect/.codex-plugin/plugin.json",
17
+ fs.existsSync("plugins/meta-architect/.codex-plugin/plugin.json"),
18
+ ],
19
+ ["plugins/meta-architect/.mcp.json", fs.existsSync("plugins/meta-architect/.mcp.json")],
20
+ [
21
+ "missions/collaborative-whiteboard/mission.md",
22
+ fs.existsSync("missions/collaborative-whiteboard/mission.md"),
23
+ ],
24
+ ["prompts/architect.md", fs.existsSync("prompts/architect.md")],
25
+ ];
26
+
27
+ let failures = 0;
28
+ for (const [label, ok] of checks) {
29
+ if (ok) {
30
+ console.log(`[OK] ${label}`);
31
+ } else {
32
+ console.log(`[MISSING] ${label}`);
33
+ failures += 1;
34
+ }
35
+ }
36
+
37
+ process.exitCode = failures === 0 ? 0 : 1;
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs/promises";
4
+ import path from "node:path";
5
+ import process from "node:process";
6
+
7
+ const repoRoot = process.cwd();
8
+ const skillsRoot = path.join(repoRoot, "skills");
9
+ const pluginRoot = path.join(repoRoot, "plugins", "meta-architect");
10
+ const pluginSkillsRoot = path.join(pluginRoot, "skills");
11
+
12
+ function parseArgs(argv) {
13
+ return {
14
+ check: argv.includes("--check"),
15
+ };
16
+ }
17
+
18
+ async function copyDir(src, dest) {
19
+ await fs.mkdir(dest, { recursive: true });
20
+ const entries = await fs.readdir(src, { withFileTypes: true });
21
+ for (const entry of entries) {
22
+ const srcPath = path.join(src, entry.name);
23
+ const destPath = path.join(dest, entry.name);
24
+ if (entry.isDirectory()) {
25
+ await copyDir(srcPath, destPath);
26
+ } else {
27
+ await fs.copyFile(srcPath, destPath);
28
+ }
29
+ }
30
+ }
31
+
32
+ async function listSkillDirs(root) {
33
+ const entries = await fs.readdir(root, { withFileTypes: true }).catch(() => []);
34
+ return entries
35
+ .filter((entry) => entry.isDirectory())
36
+ .map((entry) => entry.name)
37
+ .sort();
38
+ }
39
+
40
+ async function syncPluginSkills() {
41
+ const skillDirs = await listSkillDirs(skillsRoot);
42
+ await fs.mkdir(pluginSkillsRoot, { recursive: true });
43
+
44
+ const existingPluginDirs = await listSkillDirs(pluginSkillsRoot);
45
+ for (const name of existingPluginDirs) {
46
+ if (!skillDirs.includes(name)) {
47
+ await fs.rm(path.join(pluginSkillsRoot, name), { recursive: true, force: true });
48
+ }
49
+ }
50
+
51
+ for (const name of skillDirs) {
52
+ const src = path.join(skillsRoot, name);
53
+ const dest = path.join(pluginSkillsRoot, name);
54
+ await fs.rm(dest, { recursive: true, force: true });
55
+ await copyDir(src, dest);
56
+ }
57
+
58
+ return skillDirs;
59
+ }
60
+
61
+ async function verifyPluginSkills() {
62
+ const skillDirs = await listSkillDirs(skillsRoot);
63
+ const pluginDirs = await listSkillDirs(pluginSkillsRoot);
64
+ if (skillDirs.length !== pluginDirs.length) {
65
+ throw new Error("Plugin skill mirror drift: directory count mismatch");
66
+ }
67
+
68
+ for (let index = 0; index < skillDirs.length; index += 1) {
69
+ if (skillDirs[index] !== pluginDirs[index]) {
70
+ throw new Error(
71
+ `Plugin skill mirror drift: expected ${skillDirs[index]}, found ${pluginDirs[index]}`,
72
+ );
73
+ }
74
+ }
75
+ }
76
+
77
+ async function main() {
78
+ const args = parseArgs(process.argv.slice(2));
79
+ if (args.check) {
80
+ await verifyPluginSkills();
81
+ console.log(pluginSkillsRoot);
82
+ return;
83
+ }
84
+
85
+ await syncPluginSkills();
86
+ console.log(pluginSkillsRoot);
87
+ }
88
+
89
+ main().catch((error) => {
90
+ console.error(error.message);
91
+ process.exitCode = 1;
92
+ });
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+
3
+ import process from "node:process";
4
+ import { installSkills } from "../src/skill-installer.js";
5
+
6
+ async function main() {
7
+ if (process.env.MA_SKIP_AUTO_INSTALL === "1") {
8
+ console.log("meta-architect: skipped Codex skill auto-install");
9
+ return;
10
+ }
11
+
12
+ const { targetRoot, installed } = await installSkills();
13
+ console.log(`meta-architect: installed ${installed.length} Codex skills into ${targetRoot}`);
14
+ }
15
+
16
+ main().catch((error) => {
17
+ console.error(`meta-architect: failed to install Codex skills: ${error.message}`);
18
+ process.exitCode = 1;
19
+ });
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs";
4
+ import process from "node:process";
5
+
6
+ function loadPackageJson() {
7
+ return JSON.parse(fs.readFileSync("package.json", "utf8"));
8
+ }
9
+
10
+ function parseVersion(version) {
11
+ const match = version.match(
12
+ /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(?:-(?<prerelease>[0-9A-Za-z.-]+))?$/,
13
+ );
14
+ if (!match?.groups) {
15
+ throw new Error(`Invalid package.json version: ${version}`);
16
+ }
17
+ return match.groups;
18
+ }
19
+
20
+ function computeMetadata(version) {
21
+ const parsed = parseVersion(version);
22
+ const prerelease = parsed.prerelease ?? "";
23
+ const prereleaseIdentifiers = prerelease ? prerelease.split(".") : [];
24
+ const isPrerelease = prereleaseIdentifiers.length > 0;
25
+ const distTag = isPrerelease ? prereleaseIdentifiers[0] : "latest";
26
+
27
+ return {
28
+ version,
29
+ gitTag: `v${version}`,
30
+ isPrerelease,
31
+ distTag,
32
+ prerelease,
33
+ };
34
+ }
35
+
36
+ function parseArgs(argv) {
37
+ const args = {
38
+ field: "",
39
+ githubOutput: "",
40
+ };
41
+
42
+ for (let index = 0; index < argv.length; index += 1) {
43
+ const token = argv[index];
44
+ if (token === "--field") {
45
+ args.field = argv[index + 1] ?? "";
46
+ index += 1;
47
+ continue;
48
+ }
49
+ if (token === "--github-output") {
50
+ args.githubOutput = argv[index + 1] ?? "";
51
+ index += 1;
52
+ }
53
+ }
54
+
55
+ return args;
56
+ }
57
+
58
+ function writeGithubOutput(outputPath, metadata) {
59
+ const lines = [
60
+ `version=${metadata.version}`,
61
+ `git_tag=${metadata.gitTag}`,
62
+ `dist_tag=${metadata.distTag}`,
63
+ `is_prerelease=${metadata.isPrerelease}`,
64
+ ];
65
+ fs.appendFileSync(outputPath, `${lines.join("\n")}\n`);
66
+ }
67
+
68
+ function main() {
69
+ const args = parseArgs(process.argv.slice(2));
70
+ const pkg = loadPackageJson();
71
+ const metadata = computeMetadata(pkg.version);
72
+
73
+ if (args.githubOutput) {
74
+ writeGithubOutput(args.githubOutput, metadata);
75
+ }
76
+
77
+ if (args.field) {
78
+ const value = metadata[args.field];
79
+ if (value === undefined) {
80
+ throw new Error(`Unknown metadata field: ${args.field}`);
81
+ }
82
+ console.log(value);
83
+ return;
84
+ }
85
+
86
+ console.log(JSON.stringify(metadata, null, 2));
87
+ }
88
+
89
+ try {
90
+ main();
91
+ } catch (error) {
92
+ console.error(error.message);
93
+ process.exitCode = 1;
94
+ }
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import process from "node:process";
6
+
7
+ const CANONICAL_PACKAGE = "@jstn-sdk/ma";
8
+ const CANONICAL_INSTALL = "npm i -g @openai/codex@latest @jstn-sdk/ma@latest";
9
+ const CANONICAL_LAUNCH = "ma --madmax --high";
10
+ const UNINSTALL_MA = "npm uninstall -g @jstn-sdk/ma";
11
+ const UNINSTALL_BOTH = "npm uninstall -g @jstn-sdk/ma @openai/codex";
12
+
13
+ function readJson(file) {
14
+ return JSON.parse(fs.readFileSync(file, "utf8"));
15
+ }
16
+
17
+ function readText(file) {
18
+ return fs.readFileSync(file, "utf8");
19
+ }
20
+
21
+ function fail(message) {
22
+ throw new Error(message);
23
+ }
24
+
25
+ function assert(condition, message) {
26
+ if (!condition) {
27
+ fail(message);
28
+ }
29
+ }
30
+
31
+ function parseVersion(version) {
32
+ const match = version.match(
33
+ /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(?:-(?<prerelease>[0-9A-Za-z.-]+))?$/,
34
+ );
35
+ if (!match?.groups) {
36
+ fail(`Invalid package version: ${version}`);
37
+ }
38
+ return match.groups;
39
+ }
40
+
41
+ function verifyInstallBlock(file) {
42
+ const content = readText(file);
43
+ if (!content.includes(CANONICAL_INSTALL)) {
44
+ return;
45
+ }
46
+
47
+ assert(content.includes(CANONICAL_LAUNCH), `${file}: missing canonical launch command`);
48
+ assert(content.includes(UNINSTALL_MA), `${file}: missing uninstall Meta-Architect command`);
49
+ assert(
50
+ content.includes(UNINSTALL_BOTH),
51
+ `${file}: missing uninstall Meta-Architect + Codex command`,
52
+ );
53
+ }
54
+
55
+ function main() {
56
+ const pkg = readJson("package.json");
57
+ const lock = readJson("package-lock.json");
58
+ const version = pkg.version;
59
+ const gitTag = `v${version}`;
60
+ const parsed = parseVersion(version);
61
+ const isPrerelease = Boolean(parsed.prerelease);
62
+
63
+ assert(pkg.name === CANONICAL_PACKAGE, "package.json: wrong package name");
64
+ assert(lock.name === CANONICAL_PACKAGE, "package-lock.json: wrong package name");
65
+ assert(lock.version === version, "package-lock.json: version drift from package.json");
66
+ assert(lock.packages?.[""]?.version === version, "package-lock.json: root package version drift");
67
+ assert(
68
+ pkg.publishConfig?.access === "public",
69
+ "package.json: publishConfig.access must be public",
70
+ );
71
+
72
+ const changelog = readText("CHANGELOG.md");
73
+ assert(changelog.includes(`## ${gitTag}`), "CHANGELOG.md: missing current version heading");
74
+
75
+ const release = readText("RELEASE.md");
76
+ assert(release.includes(`# Meta-Architect ${gitTag}`), "RELEASE.md: wrong title version");
77
+
78
+ const releaseSpec = readText(path.join("docs", "release-spec.md"));
79
+ assert(
80
+ releaseSpec.includes(`# ${gitTag} Requirements & Rules`),
81
+ "docs/release-spec.md: wrong title version",
82
+ );
83
+ assert(
84
+ releaseSpec.includes(`package.json\` version \`${version}\``) ||
85
+ releaseSpec.includes(`package.json\` version \`${version}`),
86
+ "docs/release-spec.md: missing package version reference",
87
+ );
88
+ assert(
89
+ releaseSpec.includes(`git tag \`${gitTag}\``),
90
+ "docs/release-spec.md: missing git tag reference",
91
+ );
92
+
93
+ const qaPath = path.join("docs", "qa", `release-readiness-${version}.md`);
94
+ assert(fs.existsSync(qaPath), `Missing QA release-readiness file: ${qaPath}`);
95
+ const qa = readText(qaPath);
96
+ assert(qa.includes(`# Release Readiness ${version}`), `${qaPath}: wrong title version`);
97
+
98
+ const pluginApp = readJson(path.join("plugins", "meta-architect", ".app.json"));
99
+ const pluginMcp = readJson(path.join("plugins", "meta-architect", ".mcp.json"));
100
+ const pluginManifest = readJson(
101
+ path.join("plugins", "meta-architect", ".codex-plugin", "plugin.json"),
102
+ );
103
+ assert(pluginApp.version === version, "plugins/meta-architect/.app.json: version drift");
104
+ assert(pluginMcp.version === version, "plugins/meta-architect/.mcp.json: version drift");
105
+ assert(
106
+ pluginManifest.version === version,
107
+ "plugins/meta-architect/.codex-plugin/plugin.json: version drift",
108
+ );
109
+
110
+ for (const file of [
111
+ "README.md",
112
+ path.join("docs", "getting-started.md"),
113
+ path.join("docs", "onboarding.md"),
114
+ path.join("docs", "skills.md"),
115
+ path.join("plugins", "meta-architect", "README.md"),
116
+ ]) {
117
+ verifyInstallBlock(file);
118
+ }
119
+
120
+ const envTag =
121
+ process.env.RELEASE_TAG || process.env.GITHUB_REF_NAME || process.env.GIT_TAG || "";
122
+ if (envTag.startsWith("v")) {
123
+ assert(envTag === gitTag, `Release tag mismatch: expected ${gitTag}, got ${envTag}`);
124
+ }
125
+
126
+ if (isPrerelease) {
127
+ const prereleaseTag = parsed.prerelease.split(".")[0];
128
+ assert(
129
+ prereleaseTag && prereleaseTag !== "latest",
130
+ `Prerelease version ${version} must resolve to an explicit non-latest dist-tag`,
131
+ );
132
+ }
133
+
134
+ console.log(
135
+ JSON.stringify(
136
+ {
137
+ name: pkg.name,
138
+ version,
139
+ gitTag,
140
+ isPrerelease,
141
+ },
142
+ null,
143
+ 2,
144
+ ),
145
+ );
146
+ }
147
+
148
+ try {
149
+ main();
150
+ } catch (error) {
151
+ console.error(error.message);
152
+ process.exitCode = 1;
153
+ }
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs/promises";
4
+ import path from "node:path";
5
+ import process from "node:process";
6
+
7
+ function normalizeRegistry(registryUrl) {
8
+ return registryUrl.endsWith("/") ? registryUrl : `${registryUrl}/`;
9
+ }
10
+
11
+ async function main() {
12
+ const token = process.env.NPM_TOKEN || process.env.NODE_AUTH_TOKEN;
13
+ if (!token) {
14
+ console.log("No npm token detected. Skipping .npmrc generation.");
15
+ return;
16
+ }
17
+
18
+ const registry = normalizeRegistry(process.env.NPM_REGISTRY_URL || "https://registry.npmjs.org/");
19
+ const scope = process.env.NPM_SCOPE || "";
20
+ const host = new URL(registry).host;
21
+ const npmrcPath = path.join(process.cwd(), ".npmrc");
22
+
23
+ const content = [
24
+ `registry=${registry}`,
25
+ ...(scope ? [`${scope}:registry=${registry}`] : []),
26
+ `//${host}/:_authToken=${token}`,
27
+ "",
28
+ ].join("\n");
29
+
30
+ await fs.writeFile(npmrcPath, content, "utf8");
31
+ console.log(
32
+ `Wrote CI .npmrc for ${scope ? `scope ${scope}` : "the canonical unscoped package"}.`,
33
+ );
34
+ }
35
+
36
+ main().catch((error) => {
37
+ console.error(error.message);
38
+ process.exitCode = 1;
39
+ });