Lines 1-41javascript
1import * as fs from "node:fs/promises";
2import * as path from "node:path";
3import { z } from "zod";
4import { getDesignToolAdapter, saveSnapshot, exportAllComponentContexts, loadManifest, updateComponentArtifacts, loadConfig, getGenerator, syncManifestWithReport, createNamingStrategy, resolveDSPaths, isIconComponent, normalizeIconDisplayName, getComponentContext, generateComponentStories, generateComponentPrompt, generateComponentDoc, buildReverseDepsMap, formatMetadataHeader, pruneStaleComponents, resolveTokenSource, enrichIconsWithSvg, enrichBitmapAssets, enrichComponentThumbnails, resolveToken, } from "@calibrate-ds/core";
5import { computeVerifyVerdict } from "@calibrate-ds/core";
6import { invalidateCache, resolveCwd } from "../server.js";
7import { getManagedSnapshot } from "../../utils/managed-components.js";
8import { getGitIdentity } from "../../utils/team-roster.js";
10 return name.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
12function buildDocsPayload(context, codeName, ctx) {
13 const tool = ctx.config.docs?.tool ?? "none";
14 const fileKey = ctx.config.designTool?.fileKey ?? "";
15 const storyTemplate = tool === "storybook"
16 ? generateComponentStories(context, codeName, fileKey)
18 return { tool, shouldGenerate: tool !== "none", storyTemplate };
20async function loadLock(workspaceRoot) {
22 return JSON.parse(await fs.readFile(path.join(workspaceRoot, "ptb.lock"), "utf-8"));
23 }
MediumInstall Persistence
Source writes installer persistence such as shell profile or service configuration.
dist/mcp/tools/action-tools.jsView on unpkg · L21 28async function saveLock(workspaceRoot, lock) {
29 const p = path.join(workspaceRoot, "ptb.lock");
30 const tmp = `${p}.tmp.${process.pid}`;
31 await fs.writeFile(tmp, JSON.stringify(lock, null, 2) + "\n", "utf-8");
32 await fs.rename(tmp, p);
35 * GAP-003: reconcile the persisted context's dependency statuses with the same
36 * lock-stamp readiness that drives `blockedBy`, so the two never contradict
37 * (a dep implemented-but-not-stamped used to read "ready" in the context while
38 * appearing in blockedBy as "unbuilt"). Strict semantics: a dependency is only
39 * "ready" when it is lock-stamped to the current design. Each dependency also
40 * gains a `lockStatus` (ready | stale | unbuilt) mirroring the blockedBy vocab.
41 * Deps with no lock entry (external/unmanaged) keep their existing status.