@decantr/cli 3.7.0 → 3.8.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 +21 -21
- package/dist/bin.js +2 -2
- package/dist/{chunk-NDH3BDXY.js → chunk-IP2CCX2W.js} +2 -2
- package/dist/{chunk-O7N4CCWS.js → chunk-VULJMJJP.js} +372 -533
- package/dist/{content-health-4KP2EGTI.js → content-health-TDV4LP2C.js} +2 -2
- package/dist/index.js +2 -2
- package/dist/{upgrade-4BUQAYBU.js → upgrade-NN7NTA4L.js} +1 -1
- package/package.json +7 -6
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
scaffoldProject,
|
|
15
15
|
syncRegistry,
|
|
16
16
|
writeExecutionPackBundleArtifacts
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IP2CCX2W.js";
|
|
18
18
|
import {
|
|
19
19
|
createWorkspaceHealthReport,
|
|
20
20
|
formatWorkspaceHealthMarkdown,
|
|
@@ -72,9 +72,9 @@ import {
|
|
|
72
72
|
} from "./chunk-24JR4ZNG.js";
|
|
73
73
|
|
|
74
74
|
// src/index.ts
|
|
75
|
-
import { existsSync as
|
|
76
|
-
import { basename as basename2, dirname as
|
|
77
|
-
import { fileURLToPath as
|
|
75
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync17, readdirSync as readdirSync8, readFileSync as readFileSync21, writeFileSync as writeFileSync20 } from "fs";
|
|
76
|
+
import { basename as basename2, dirname as dirname8, isAbsolute as isAbsolute4, join as join31, relative as relative7, resolve as resolve5 } from "path";
|
|
77
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
78
78
|
import {
|
|
79
79
|
buildGraphImpactContext,
|
|
80
80
|
buildGraphRouteContext,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
} from "@decantr/core";
|
|
84
84
|
import { evaluateGuard, isV4 as isV48, validateEssence as validateEssence2 } from "@decantr/essence-spec";
|
|
85
85
|
import {
|
|
86
|
-
CONTENT_TYPE_TO_API_CONTENT_TYPE as
|
|
86
|
+
CONTENT_TYPE_TO_API_CONTENT_TYPE as CONTENT_TYPE_TO_API_CONTENT_TYPE2,
|
|
87
87
|
CONTENT_TYPES as GET_CONTENT_TYPES,
|
|
88
88
|
getBlueprintPortfolioMetadata,
|
|
89
89
|
isApiContentType,
|
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
isPublicBlueprintSet,
|
|
93
93
|
API_CONTENT_TYPES as LIST_CONTENT_TYPES,
|
|
94
94
|
patternToDiscoveryCandidate,
|
|
95
|
-
RegistryAPIClient as
|
|
95
|
+
RegistryAPIClient as RegistryAPIClient2,
|
|
96
96
|
rankPatternCandidates
|
|
97
97
|
} from "@decantr/registry";
|
|
98
98
|
import {
|
|
@@ -3018,7 +3018,7 @@ function resolveWorkflowPolicy(input) {
|
|
|
3018
3018
|
} else {
|
|
3019
3019
|
workflowMode = hasRegistryContent ? "greenfield-scaffold" : "greenfield-contract-only";
|
|
3020
3020
|
}
|
|
3021
|
-
const adoptionMode = requestedAdoption ?? input.workflowSeed?.adoptionMode ??
|
|
3021
|
+
const adoptionMode = requestedAdoption ?? input.workflowSeed?.adoptionMode ?? "contract-only";
|
|
3022
3022
|
const contentSource = hasRegistryContent ? input.offline ? "cache" : "official" : "none";
|
|
3023
3023
|
const assistantBridge = requestedAssistantBridge ?? input.workflowSeed?.assistantBridge ?? (workflowMode === "brownfield-attach" && input.detected.existingRuleFiles.length > 0 ? "preview" : "none");
|
|
3024
3024
|
return {
|
|
@@ -5885,11 +5885,12 @@ async function cmdMigrate(projectRoot = process.cwd(), args = []) {
|
|
|
5885
5885
|
import { spawnSync } from "child_process";
|
|
5886
5886
|
import { existsSync as existsSync21, mkdirSync as mkdirSync13 } from "fs";
|
|
5887
5887
|
import { join as join23, resolve as resolve3 } from "path";
|
|
5888
|
-
import { fileURLToPath as
|
|
5888
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
5889
5889
|
|
|
5890
5890
|
// src/offline-content.ts
|
|
5891
5891
|
import { cpSync, existsSync as existsSync20, mkdirSync as mkdirSync12 } from "fs";
|
|
5892
|
-
import { join as join22, resolve as resolve2 } from "path";
|
|
5892
|
+
import { dirname as dirname6, join as join22, resolve as resolve2 } from "path";
|
|
5893
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5893
5894
|
var CONTENT_TYPES2 = ["archetypes", "blueprints", "patterns", "themes", "shells"];
|
|
5894
5895
|
function copyIfExists(source, target) {
|
|
5895
5896
|
if (!existsSync20(source)) return false;
|
|
@@ -5931,12 +5932,24 @@ function seedOfflineRegistry(projectDir, workspaceRoot) {
|
|
|
5931
5932
|
if (copiedCache || copiedCustom) {
|
|
5932
5933
|
return { seeded: true, strategy: "workspace-cache" };
|
|
5933
5934
|
}
|
|
5934
|
-
const
|
|
5935
|
-
if (hydrateContentRoot(projectDir,
|
|
5936
|
-
return { seeded: true, strategy: "
|
|
5935
|
+
const workspaceContentRoot = resolve2(workspaceRoot, "packages", "content");
|
|
5936
|
+
if (hydrateContentRoot(projectDir, workspaceContentRoot)) {
|
|
5937
|
+
return { seeded: true, strategy: "workspace-content-root" };
|
|
5938
|
+
}
|
|
5939
|
+
const installedContentRoot = resolveInstalledContentRoot();
|
|
5940
|
+
if (installedContentRoot && hydrateContentRoot(projectDir, installedContentRoot)) {
|
|
5941
|
+
return { seeded: true, strategy: "installed-content-package" };
|
|
5937
5942
|
}
|
|
5938
5943
|
return { seeded: false, strategy: null };
|
|
5939
5944
|
}
|
|
5945
|
+
function resolveInstalledContentRoot() {
|
|
5946
|
+
try {
|
|
5947
|
+
const entry = fileURLToPath2(import.meta.resolve("@decantr/content"));
|
|
5948
|
+
return resolve2(dirname6(entry), "..");
|
|
5949
|
+
} catch {
|
|
5950
|
+
return null;
|
|
5951
|
+
}
|
|
5952
|
+
}
|
|
5940
5953
|
|
|
5941
5954
|
// src/commands/new-project.ts
|
|
5942
5955
|
var BOLD6 = "\x1B[1m";
|
|
@@ -6041,7 +6054,7 @@ function runArgvCommand(command, args, cwd) {
|
|
|
6041
6054
|
}
|
|
6042
6055
|
}
|
|
6043
6056
|
function resolveInitCommand(initFlags) {
|
|
6044
|
-
const bundledCliEntrypoint =
|
|
6057
|
+
const bundledCliEntrypoint = fileURLToPath3(new URL("./bin.js", import.meta.url));
|
|
6045
6058
|
const cliEntrypoint = existsSync21(bundledCliEntrypoint) ? bundledCliEntrypoint : process.argv[1] && existsSync21(process.argv[1]) ? process.argv[1] : null;
|
|
6046
6059
|
if (cliEntrypoint) {
|
|
6047
6060
|
return {
|
|
@@ -6060,8 +6073,7 @@ async function cmdNewProject(projectName, options) {
|
|
|
6060
6073
|
const projectDir = resolve3(workspaceRoot, projectName);
|
|
6061
6074
|
const bootstrapTarget = resolveBootstrapTarget(options.target);
|
|
6062
6075
|
const bootstrapAdapter = getBootstrapAdapter(bootstrapTarget);
|
|
6063
|
-
const
|
|
6064
|
-
const inferredAdoption = options.adoption || (registryBackedScaffold ? "decantr-css" : "contract-only");
|
|
6076
|
+
const inferredAdoption = options.adoption || "contract-only";
|
|
6065
6077
|
const shouldBootstrapRuntime = Boolean(bootstrapAdapter && inferredAdoption === "decantr-css");
|
|
6066
6078
|
if (!/^[a-z0-9][a-z0-9._-]*$/i.test(projectName)) {
|
|
6067
6079
|
console.error(
|
|
@@ -6126,11 +6138,11 @@ ${YELLOW6}Dependency install failed. Run \`${packageManager} install\` manually.
|
|
|
6126
6138
|
console.log(dim3(` Seeded offline registry content from ${seeded.strategy}.`));
|
|
6127
6139
|
} else if (requiresOfflineContent) {
|
|
6128
6140
|
console.log(
|
|
6129
|
-
`${YELLOW6} Offline blueprint/archetype resolution requires local
|
|
6141
|
+
`${YELLOW6} Offline blueprint/archetype resolution requires local content corpus data.${RESET9}`
|
|
6130
6142
|
);
|
|
6131
6143
|
console.log(
|
|
6132
6144
|
dim3(
|
|
6133
|
-
" No parent workspace cache/custom content or
|
|
6145
|
+
" No parent workspace cache/custom content, configured content source, or installed @decantr/content corpus was found."
|
|
6134
6146
|
)
|
|
6135
6147
|
);
|
|
6136
6148
|
console.log("");
|
|
@@ -6141,7 +6153,7 @@ ${YELLOW6}Dependency install failed. Run \`${packageManager} install\` manually.
|
|
|
6141
6153
|
console.log(` ${cyan3(packageManager + " run dev")}`);
|
|
6142
6154
|
console.log(` ${cyan3("decantr sync")} ${dim3("# when online, then rerun decantr init")}`);
|
|
6143
6155
|
console.log(
|
|
6144
|
-
` ${cyan3("DECANTR_CONTENT_DIR=/path/to/
|
|
6156
|
+
` ${cyan3("DECANTR_CONTENT_DIR=/path/to/content decantr init --existing --offline")} ${dim3("# or seed a local content source")}`
|
|
6145
6157
|
);
|
|
6146
6158
|
console.log("");
|
|
6147
6159
|
return;
|
|
@@ -6196,73 +6208,18 @@ function detectPackageManager3() {
|
|
|
6196
6208
|
}
|
|
6197
6209
|
|
|
6198
6210
|
// src/commands/publish.ts
|
|
6199
|
-
import { existsSync as existsSync22, readFileSync as readFileSync15 } from "fs";
|
|
6200
|
-
import { join as join24 } from "path";
|
|
6201
|
-
import {
|
|
6202
|
-
API_CONTENT_TYPE_TO_CONTENT_TYPE,
|
|
6203
|
-
CONTENT_TYPE_TO_API_CONTENT_TYPE as CONTENT_TYPE_TO_API_CONTENT_TYPE2,
|
|
6204
|
-
RegistryAPIClient,
|
|
6205
|
-
RegistryAPIError
|
|
6206
|
-
} from "@decantr/registry";
|
|
6207
6211
|
async function cmdPublish(type, name, projectRoot = process.cwd()) {
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
}
|
|
6214
|
-
const singularType = API_CONTENT_TYPE_TO_CONTENT_TYPE[type] || type;
|
|
6215
|
-
const pluralType = CONTENT_TYPE_TO_API_CONTENT_TYPE2[type] || CONTENT_TYPE_TO_API_CONTENT_TYPE2[singularType] || `${type}s`;
|
|
6216
|
-
const customPath = join24(projectRoot, ".decantr", "custom", pluralType, `${name}.json`);
|
|
6217
|
-
if (!existsSync22(customPath)) {
|
|
6218
|
-
console.error(`Custom ${singularType} "${name}" not found at ${customPath}`);
|
|
6219
|
-
console.error(`Create one first: decantr create ${singularType} ${name}`);
|
|
6220
|
-
process.exitCode = 1;
|
|
6221
|
-
return;
|
|
6222
|
-
}
|
|
6223
|
-
let data;
|
|
6224
|
-
try {
|
|
6225
|
-
data = JSON.parse(readFileSync15(customPath, "utf-8"));
|
|
6226
|
-
} catch {
|
|
6227
|
-
console.error(`Failed to parse ${customPath}`);
|
|
6228
|
-
process.exitCode = 1;
|
|
6229
|
-
return;
|
|
6230
|
-
}
|
|
6231
|
-
const client = new RegistryAPIClient({
|
|
6232
|
-
apiKey: token
|
|
6233
|
-
});
|
|
6234
|
-
try {
|
|
6235
|
-
const result = await client.publishContent({
|
|
6236
|
-
type: pluralType,
|
|
6237
|
-
slug: name,
|
|
6238
|
-
version: data.version || "1.0.0",
|
|
6239
|
-
data,
|
|
6240
|
-
namespace: "@community",
|
|
6241
|
-
visibility: "public"
|
|
6242
|
-
});
|
|
6243
|
-
console.log(`Published ${singularType}/${name} to @community`);
|
|
6244
|
-
console.log(`Status: ${result.status}`);
|
|
6245
|
-
} catch (err) {
|
|
6246
|
-
if (err instanceof RegistryAPIError) {
|
|
6247
|
-
console.error(`Failed to publish: ${err.message}`);
|
|
6248
|
-
const details = err.details;
|
|
6249
|
-
if (Array.isArray(details?.validationErrors) && details.validationErrors.length > 0) {
|
|
6250
|
-
console.error("Validation errors:");
|
|
6251
|
-
for (const validationError of details.validationErrors) {
|
|
6252
|
-
console.error(` - ${String(validationError)}`);
|
|
6253
|
-
}
|
|
6254
|
-
}
|
|
6255
|
-
} else {
|
|
6256
|
-
console.error(`Failed to publish: ${err.message}`);
|
|
6257
|
-
}
|
|
6258
|
-
process.exitCode = 1;
|
|
6259
|
-
}
|
|
6212
|
+
void projectRoot;
|
|
6213
|
+
console.error(
|
|
6214
|
+
`Hosted community publishing has been retired. Keep ${type}/${name} in the official corpus under packages/content and run \`decantr content check\`.`
|
|
6215
|
+
);
|
|
6216
|
+
process.exitCode = 1;
|
|
6260
6217
|
}
|
|
6261
6218
|
|
|
6262
6219
|
// src/commands/refresh.ts
|
|
6263
6220
|
import { createHash } from "crypto";
|
|
6264
|
-
import { existsSync as
|
|
6265
|
-
import { isAbsolute as isAbsolute3, join as
|
|
6221
|
+
import { existsSync as existsSync22, readdirSync as readdirSync6, readFileSync as readFileSync15, statSync as statSync6 } from "fs";
|
|
6222
|
+
import { isAbsolute as isAbsolute3, join as join24, relative as relative6 } from "path";
|
|
6266
6223
|
import { isV4 as isV45 } from "@decantr/essence-spec";
|
|
6267
6224
|
import { collectMissingPackManifestFiles as collectMissingPackManifestFiles2 } from "@decantr/verifier";
|
|
6268
6225
|
var GREEN10 = "\x1B[32m";
|
|
@@ -6270,13 +6227,13 @@ var RED7 = "\x1B[31m";
|
|
|
6270
6227
|
var DIM10 = "\x1B[2m";
|
|
6271
6228
|
var RESET10 = "\x1B[0m";
|
|
6272
6229
|
function hashFile(path) {
|
|
6273
|
-
return createHash("sha256").update(
|
|
6230
|
+
return createHash("sha256").update(readFileSync15(path)).digest("hex");
|
|
6274
6231
|
}
|
|
6275
6232
|
function walkFiles(dir) {
|
|
6276
|
-
if (!
|
|
6233
|
+
if (!existsSync22(dir)) return [];
|
|
6277
6234
|
const files = [];
|
|
6278
6235
|
for (const entry of readdirSync6(dir, { withFileTypes: true })) {
|
|
6279
|
-
const path =
|
|
6236
|
+
const path = join24(dir, entry.name);
|
|
6280
6237
|
if (entry.isDirectory()) {
|
|
6281
6238
|
files.push(...walkFiles(path));
|
|
6282
6239
|
} else if (entry.isFile()) {
|
|
@@ -6287,15 +6244,15 @@ function walkFiles(dir) {
|
|
|
6287
6244
|
}
|
|
6288
6245
|
function trackedGeneratedFiles(projectRoot) {
|
|
6289
6246
|
const files = [
|
|
6290
|
-
|
|
6291
|
-
...walkFiles(
|
|
6247
|
+
join24(projectRoot, "DECANTR.md"),
|
|
6248
|
+
...walkFiles(join24(projectRoot, ".decantr", "context"))
|
|
6292
6249
|
];
|
|
6293
6250
|
if (!isContractOnlyProject2(projectRoot)) {
|
|
6294
6251
|
files.push(
|
|
6295
|
-
...["global.css", "tokens.css", "treatments.css", "decantr-bridge.css"].map((file) =>
|
|
6252
|
+
...["global.css", "tokens.css", "treatments.css", "decantr-bridge.css"].map((file) => join24(projectRoot, "src", "styles", file)).filter((path) => existsSync22(path))
|
|
6296
6253
|
);
|
|
6297
6254
|
}
|
|
6298
|
-
return files.filter((path) =>
|
|
6255
|
+
return files.filter((path) => existsSync22(path));
|
|
6299
6256
|
}
|
|
6300
6257
|
function snapshotGeneratedFiles(projectRoot) {
|
|
6301
6258
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -6318,33 +6275,33 @@ function fileMtimeMs(path) {
|
|
|
6318
6275
|
}
|
|
6319
6276
|
function newestInputMtime(projectRoot) {
|
|
6320
6277
|
return Math.max(
|
|
6321
|
-
fileMtimeMs(
|
|
6322
|
-
fileMtimeMs(
|
|
6278
|
+
fileMtimeMs(join24(projectRoot, "decantr.essence.json")),
|
|
6279
|
+
fileMtimeMs(join24(projectRoot, ".decantr", "project.json"))
|
|
6323
6280
|
);
|
|
6324
6281
|
}
|
|
6325
6282
|
function isContractOnlyProject2(projectRoot) {
|
|
6326
|
-
const projectJsonPath =
|
|
6327
|
-
if (!
|
|
6283
|
+
const projectJsonPath = join24(projectRoot, ".decantr", "project.json");
|
|
6284
|
+
if (!existsSync22(projectJsonPath)) return false;
|
|
6328
6285
|
try {
|
|
6329
|
-
const projectJson = JSON.parse(
|
|
6286
|
+
const projectJson = JSON.parse(readFileSync15(projectJsonPath, "utf-8"));
|
|
6330
6287
|
return projectJson.initialized?.adoptionMode === "contract-only";
|
|
6331
6288
|
} catch {
|
|
6332
6289
|
return false;
|
|
6333
6290
|
}
|
|
6334
6291
|
}
|
|
6335
6292
|
function checkRefreshFreshness(projectRoot) {
|
|
6336
|
-
const contextDir =
|
|
6293
|
+
const contextDir = join24(projectRoot, ".decantr", "context");
|
|
6337
6294
|
const generated = trackedGeneratedFiles(projectRoot);
|
|
6338
6295
|
const reasons = [];
|
|
6339
6296
|
const packHydrationOptional = isContractOnlyProject2(projectRoot);
|
|
6340
|
-
if (!
|
|
6341
|
-
if (!
|
|
6342
|
-
if (!
|
|
6297
|
+
if (!existsSync22(join24(projectRoot, "DECANTR.md"))) reasons.push("DECANTR.md is missing.");
|
|
6298
|
+
if (!existsSync22(contextDir)) reasons.push(".decantr/context is missing.");
|
|
6299
|
+
if (!existsSync22(join24(contextDir, "scaffold.md"))) {
|
|
6343
6300
|
reasons.push(".decantr/context/scaffold.md is missing.");
|
|
6344
6301
|
}
|
|
6345
|
-
if (!packHydrationOptional && !
|
|
6302
|
+
if (!packHydrationOptional && !existsSync22(join24(contextDir, "pack-manifest.json"))) {
|
|
6346
6303
|
reasons.push(".decantr/context/pack-manifest.json is missing.");
|
|
6347
|
-
} else if (
|
|
6304
|
+
} else if (existsSync22(join24(contextDir, "pack-manifest.json"))) {
|
|
6348
6305
|
const missingPackFiles = collectMissingPackManifestFiles2(projectRoot);
|
|
6349
6306
|
if (missingPackFiles.length > 0) {
|
|
6350
6307
|
reasons.push(
|
|
@@ -6397,7 +6354,7 @@ function summarizeChanges(projectRoot, before, after) {
|
|
|
6397
6354
|
}
|
|
6398
6355
|
function displayGeneratedPath(summary, file, displayRoot) {
|
|
6399
6356
|
if (!displayRoot) return file;
|
|
6400
|
-
const absolutePath =
|
|
6357
|
+
const absolutePath = join24(summary.projectRoot, file);
|
|
6401
6358
|
const relativePath = relative6(displayRoot, absolutePath).replace(/\\/g, "/");
|
|
6402
6359
|
if (relativePath && !relativePath.startsWith("..") && !isAbsolute3(relativePath)) {
|
|
6403
6360
|
return relativePath;
|
|
@@ -6432,15 +6389,15 @@ function printRefreshSummary(summary, displayRoot) {
|
|
|
6432
6389
|
}
|
|
6433
6390
|
}
|
|
6434
6391
|
async function cmdRefresh(projectRoot = process.cwd(), options = {}) {
|
|
6435
|
-
const essencePath =
|
|
6436
|
-
if (!
|
|
6392
|
+
const essencePath = join24(projectRoot, "decantr.essence.json");
|
|
6393
|
+
if (!existsSync22(essencePath)) {
|
|
6437
6394
|
console.error(`${RED7}No decantr.essence.json found. Run \`decantr init\` first.${RESET10}`);
|
|
6438
6395
|
process.exitCode = 1;
|
|
6439
6396
|
return;
|
|
6440
6397
|
}
|
|
6441
6398
|
let essence;
|
|
6442
6399
|
try {
|
|
6443
|
-
const raw =
|
|
6400
|
+
const raw = readFileSync15(essencePath, "utf-8");
|
|
6444
6401
|
const parsed = JSON.parse(raw);
|
|
6445
6402
|
if (!isV45(parsed)) {
|
|
6446
6403
|
console.error(
|
|
@@ -6466,7 +6423,7 @@ async function cmdRefresh(projectRoot = process.cwd(), options = {}) {
|
|
|
6466
6423
|
return;
|
|
6467
6424
|
}
|
|
6468
6425
|
const registryClient = new RegistryClient({
|
|
6469
|
-
cacheDir:
|
|
6426
|
+
cacheDir: join24(projectRoot, ".decantr", "cache"),
|
|
6470
6427
|
offline: options.offline
|
|
6471
6428
|
});
|
|
6472
6429
|
console.log("Regenerating derived files...\n");
|
|
@@ -6498,8 +6455,8 @@ async function cmdRefresh(projectRoot = process.cwd(), options = {}) {
|
|
|
6498
6455
|
|
|
6499
6456
|
// src/commands/registry-mirror.ts
|
|
6500
6457
|
import { mkdirSync as mkdirSync14, writeFileSync as writeFileSync14 } from "fs";
|
|
6501
|
-
import { join as
|
|
6502
|
-
import { API_CONTENT_TYPES, RegistryAPIClient
|
|
6458
|
+
import { join as join25 } from "path";
|
|
6459
|
+
import { API_CONTENT_TYPES, RegistryAPIClient } from "@decantr/registry";
|
|
6503
6460
|
var GREEN11 = "\x1B[32m";
|
|
6504
6461
|
var RED8 = "\x1B[31m";
|
|
6505
6462
|
var DIM11 = "\x1B[2m";
|
|
@@ -6509,7 +6466,7 @@ var RESET11 = "\x1B[0m";
|
|
|
6509
6466
|
var ALL_CONTENT_TYPES = [...API_CONTENT_TYPES];
|
|
6510
6467
|
async function cmdRegistryMirror(projectRoot, options = {}) {
|
|
6511
6468
|
const apiUrl = process.env.DECANTR_API_URL || "https://api.decantr.ai/v1";
|
|
6512
|
-
const apiClient = new
|
|
6469
|
+
const apiClient = new RegistryAPIClient({
|
|
6513
6470
|
baseUrl: apiUrl,
|
|
6514
6471
|
apiKey: process.env.DECANTR_API_KEY || void 0
|
|
6515
6472
|
});
|
|
@@ -6526,7 +6483,7 @@ async function cmdRegistryMirror(projectRoot, options = {}) {
|
|
|
6526
6483
|
process.exitCode = 1;
|
|
6527
6484
|
return;
|
|
6528
6485
|
}
|
|
6529
|
-
const cacheDir =
|
|
6486
|
+
const cacheDir = join25(projectRoot, ".decantr", "cache");
|
|
6530
6487
|
const counts = {};
|
|
6531
6488
|
const failed = [];
|
|
6532
6489
|
console.log(`
|
|
@@ -6536,19 +6493,19 @@ Mirroring registry content to ${DIM11}.decantr/cache/${RESET11}
|
|
|
6536
6493
|
try {
|
|
6537
6494
|
const result = await apiClient.listContent(type, { namespace: "@official" });
|
|
6538
6495
|
const items = result.items;
|
|
6539
|
-
const typeDir =
|
|
6496
|
+
const typeDir = join25(cacheDir, "@official", type);
|
|
6540
6497
|
mkdirSync14(typeDir, { recursive: true });
|
|
6541
|
-
writeFileSync14(
|
|
6498
|
+
writeFileSync14(join25(typeDir, "index.json"), JSON.stringify(result, null, 2));
|
|
6542
6499
|
let itemCount = 0;
|
|
6543
6500
|
for (const item of items) {
|
|
6544
6501
|
const slug = item.slug || item.id;
|
|
6545
6502
|
if (!slug) continue;
|
|
6546
6503
|
try {
|
|
6547
6504
|
const fullItem = await apiClient.getContent(type, "@official", slug);
|
|
6548
|
-
writeFileSync14(
|
|
6505
|
+
writeFileSync14(join25(typeDir, `${slug}.json`), JSON.stringify(fullItem, null, 2));
|
|
6549
6506
|
itemCount++;
|
|
6550
6507
|
} catch {
|
|
6551
|
-
writeFileSync14(
|
|
6508
|
+
writeFileSync14(join25(typeDir, `${slug}.json`), JSON.stringify(item, null, 2));
|
|
6552
6509
|
itemCount++;
|
|
6553
6510
|
}
|
|
6554
6511
|
}
|
|
@@ -6563,8 +6520,8 @@ Mirroring registry content to ${DIM11}.decantr/cache/${RESET11}
|
|
|
6563
6520
|
mirrored_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6564
6521
|
counts
|
|
6565
6522
|
};
|
|
6566
|
-
mkdirSync14(
|
|
6567
|
-
writeFileSync14(
|
|
6523
|
+
mkdirSync14(join25(cacheDir), { recursive: true });
|
|
6524
|
+
writeFileSync14(join25(cacheDir, "mirror-manifest.json"), JSON.stringify(manifest, null, 2));
|
|
6568
6525
|
const totalItems = Object.values(counts).reduce((a, b) => a + b, 0);
|
|
6569
6526
|
console.log("");
|
|
6570
6527
|
if (failed.length > 0) {
|
|
@@ -6581,8 +6538,8 @@ Mirroring registry content to ${DIM11}.decantr/cache/${RESET11}
|
|
|
6581
6538
|
}
|
|
6582
6539
|
|
|
6583
6540
|
// src/commands/remove.ts
|
|
6584
|
-
import { existsSync as
|
|
6585
|
-
import { join as
|
|
6541
|
+
import { existsSync as existsSync23, readFileSync as readFileSync16, rmSync as rmSync2, writeFileSync as writeFileSync15 } from "fs";
|
|
6542
|
+
import { join as join26 } from "path";
|
|
6586
6543
|
import { isV4 as isV46 } from "@decantr/essence-spec";
|
|
6587
6544
|
var GREEN12 = "\x1B[32m";
|
|
6588
6545
|
var RED9 = "\x1B[31m";
|
|
@@ -6590,15 +6547,15 @@ var YELLOW8 = "\x1B[33m";
|
|
|
6590
6547
|
var DIM12 = "\x1B[2m";
|
|
6591
6548
|
var RESET12 = "\x1B[0m";
|
|
6592
6549
|
function readV4Essence2(projectRoot) {
|
|
6593
|
-
const essencePath =
|
|
6594
|
-
if (!
|
|
6550
|
+
const essencePath = join26(projectRoot, "decantr.essence.json");
|
|
6551
|
+
if (!existsSync23(essencePath)) {
|
|
6595
6552
|
console.error(`${RED9}No decantr.essence.json found. Run \`decantr init\` first.${RESET12}`);
|
|
6596
6553
|
process.exitCode = 1;
|
|
6597
6554
|
return null;
|
|
6598
6555
|
}
|
|
6599
6556
|
let parsed;
|
|
6600
6557
|
try {
|
|
6601
|
-
parsed = JSON.parse(
|
|
6558
|
+
parsed = JSON.parse(readFileSync16(essencePath, "utf-8"));
|
|
6602
6559
|
} catch (e) {
|
|
6603
6560
|
console.error(`${RED9}Could not read essence: ${e.message}${RESET12}`);
|
|
6604
6561
|
process.exitCode = 1;
|
|
@@ -6686,14 +6643,14 @@ async function cmdRemoveSection(sectionId, args, projectRoot = process.cwd()) {
|
|
|
6686
6643
|
sections.splice(idx, 1);
|
|
6687
6644
|
recomputeGlobalFeatures(essence);
|
|
6688
6645
|
removeRoutes(essence, sectionId);
|
|
6689
|
-
const contextFile =
|
|
6690
|
-
if (
|
|
6646
|
+
const contextFile = join26(projectRoot, ".decantr", "context", `${sectionId}.md`);
|
|
6647
|
+
if (existsSync23(contextFile)) {
|
|
6691
6648
|
rmSync2(contextFile);
|
|
6692
6649
|
}
|
|
6693
6650
|
writeEssence2(essencePath, essence);
|
|
6694
6651
|
console.log(`${GREEN12}Removed section "${sectionId}".${RESET12}`);
|
|
6695
6652
|
const registryClient = new RegistryClient({
|
|
6696
|
-
cacheDir:
|
|
6653
|
+
cacheDir: join26(projectRoot, ".decantr", "cache")
|
|
6697
6654
|
});
|
|
6698
6655
|
await refreshDerivedFiles(projectRoot, essence, registryClient);
|
|
6699
6656
|
console.log(`${GREEN12}Derived files refreshed.${RESET12}`);
|
|
@@ -6736,7 +6693,7 @@ async function cmdRemovePage(path, args, projectRoot = process.cwd()) {
|
|
|
6736
6693
|
}
|
|
6737
6694
|
console.log(`${GREEN12}Removed page "${pageId}" from section "${resolvedSectionId}".${RESET12}`);
|
|
6738
6695
|
const registryClient = new RegistryClient({
|
|
6739
|
-
cacheDir:
|
|
6696
|
+
cacheDir: join26(projectRoot, ".decantr", "cache")
|
|
6740
6697
|
});
|
|
6741
6698
|
await refreshDerivedFiles(projectRoot, essence, registryClient);
|
|
6742
6699
|
console.log(`${GREEN12}Derived files refreshed.${RESET12}`);
|
|
@@ -6779,15 +6736,15 @@ async function cmdRemoveFeature(feature, args, projectRoot = process.cwd()) {
|
|
|
6779
6736
|
const target = sectionId ? `section "${sectionId}" and global` : "global";
|
|
6780
6737
|
console.log(`${GREEN12}Removed feature "${feature}" from ${target} features.${RESET12}`);
|
|
6781
6738
|
const registryClient = new RegistryClient({
|
|
6782
|
-
cacheDir:
|
|
6739
|
+
cacheDir: join26(projectRoot, ".decantr", "cache")
|
|
6783
6740
|
});
|
|
6784
6741
|
await refreshDerivedFiles(projectRoot, essence, registryClient);
|
|
6785
6742
|
console.log(`${GREEN12}Derived files refreshed.${RESET12}`);
|
|
6786
6743
|
}
|
|
6787
6744
|
|
|
6788
6745
|
// src/commands/resolve.ts
|
|
6789
|
-
import { existsSync as
|
|
6790
|
-
import { dirname as
|
|
6746
|
+
import { existsSync as existsSync24, mkdirSync as mkdirSync15, readFileSync as readFileSync17, writeFileSync as writeFileSync16 } from "fs";
|
|
6747
|
+
import { dirname as dirname7, join as join27, resolve as resolve4 } from "path";
|
|
6791
6748
|
var BOLD7 = "\x1B[1m";
|
|
6792
6749
|
var DIM13 = "\x1B[2m";
|
|
6793
6750
|
var GREEN13 = "\x1B[32m";
|
|
@@ -6795,13 +6752,13 @@ var RED10 = "\x1B[31m";
|
|
|
6795
6752
|
var YELLOW9 = "\x1B[33m";
|
|
6796
6753
|
var RESET13 = "\x1B[0m";
|
|
6797
6754
|
function driftLogPath(projectRoot) {
|
|
6798
|
-
return
|
|
6755
|
+
return join27(projectRoot, ".decantr", "drift-log.json");
|
|
6799
6756
|
}
|
|
6800
6757
|
function readDriftLog(projectRoot) {
|
|
6801
6758
|
const path = driftLogPath(projectRoot);
|
|
6802
|
-
if (!
|
|
6759
|
+
if (!existsSync24(path)) return { version: 1, entries: [] };
|
|
6803
6760
|
try {
|
|
6804
|
-
const parsed = JSON.parse(
|
|
6761
|
+
const parsed = JSON.parse(readFileSync17(path, "utf-8"));
|
|
6805
6762
|
return {
|
|
6806
6763
|
version: 1,
|
|
6807
6764
|
entries: Array.isArray(parsed.entries) ? parsed.entries : []
|
|
@@ -6812,7 +6769,7 @@ function readDriftLog(projectRoot) {
|
|
|
6812
6769
|
}
|
|
6813
6770
|
function writeDriftLog(projectRoot, log) {
|
|
6814
6771
|
const path = driftLogPath(projectRoot);
|
|
6815
|
-
mkdirSync15(
|
|
6772
|
+
mkdirSync15(dirname7(path), { recursive: true });
|
|
6816
6773
|
writeFileSync16(path, `${JSON.stringify(log, null, 2)}
|
|
6817
6774
|
`, "utf-8");
|
|
6818
6775
|
}
|
|
@@ -6932,8 +6889,8 @@ async function cmdResolve(projectRoot = process.cwd(), args = ["resolve"]) {
|
|
|
6932
6889
|
}
|
|
6933
6890
|
|
|
6934
6891
|
// src/commands/sync-drift.ts
|
|
6935
|
-
import { existsSync as
|
|
6936
|
-
import { join as
|
|
6892
|
+
import { existsSync as existsSync25, readFileSync as readFileSync18, writeFileSync as writeFileSync17 } from "fs";
|
|
6893
|
+
import { join as join28 } from "path";
|
|
6937
6894
|
var GREEN14 = "\x1B[32m";
|
|
6938
6895
|
var RED11 = "\x1B[31m";
|
|
6939
6896
|
var YELLOW10 = "\x1B[33m";
|
|
@@ -6942,8 +6899,8 @@ var DIM14 = "\x1B[2m";
|
|
|
6942
6899
|
var BOLD8 = "\x1B[1m";
|
|
6943
6900
|
var CYAN7 = "\x1B[36m";
|
|
6944
6901
|
async function cmdSyncDrift(projectRoot = process.cwd()) {
|
|
6945
|
-
const driftLogPath2 =
|
|
6946
|
-
if (!
|
|
6902
|
+
const driftLogPath2 = join28(projectRoot, ".decantr", "drift-log.json");
|
|
6903
|
+
if (!existsSync25(driftLogPath2)) {
|
|
6947
6904
|
console.log(`${GREEN14}No drift log found \u2014 no drift recorded.${RESET14}`);
|
|
6948
6905
|
console.log(
|
|
6949
6906
|
`${DIM14}Drift is logged when guard violations are detected during development.${RESET14}`
|
|
@@ -6952,7 +6909,7 @@ async function cmdSyncDrift(projectRoot = process.cwd()) {
|
|
|
6952
6909
|
}
|
|
6953
6910
|
let entries;
|
|
6954
6911
|
try {
|
|
6955
|
-
entries = JSON.parse(
|
|
6912
|
+
entries = JSON.parse(readFileSync18(driftLogPath2, "utf-8"));
|
|
6956
6913
|
} catch {
|
|
6957
6914
|
console.error(`${RED11}Could not parse drift-log.json${RESET14}`);
|
|
6958
6915
|
process.exitCode = 1;
|
|
@@ -6998,8 +6955,8 @@ ${BOLD8}Unresolved Drift Entries (${unresolved.length})${RESET14}
|
|
|
6998
6955
|
console.log("");
|
|
6999
6956
|
}
|
|
7000
6957
|
function resolveDriftEntries(projectRoot, options) {
|
|
7001
|
-
const driftLogPath2 =
|
|
7002
|
-
if (!
|
|
6958
|
+
const driftLogPath2 = join28(projectRoot, ".decantr", "drift-log.json");
|
|
6959
|
+
if (!existsSync25(driftLogPath2)) {
|
|
7003
6960
|
return { success: true };
|
|
7004
6961
|
}
|
|
7005
6962
|
if (options.clear) {
|
|
@@ -7012,7 +6969,7 @@ function resolveDriftEntries(projectRoot, options) {
|
|
|
7012
6969
|
}
|
|
7013
6970
|
let entries;
|
|
7014
6971
|
try {
|
|
7015
|
-
entries = JSON.parse(
|
|
6972
|
+
entries = JSON.parse(readFileSync18(driftLogPath2, "utf-8"));
|
|
7016
6973
|
} catch {
|
|
7017
6974
|
return { success: false, error: "Could not parse drift-log.json" };
|
|
7018
6975
|
}
|
|
@@ -7268,8 +7225,8 @@ function trimTrailingSlashes(value) {
|
|
|
7268
7225
|
}
|
|
7269
7226
|
|
|
7270
7227
|
// src/commands/theme-switch.ts
|
|
7271
|
-
import { existsSync as
|
|
7272
|
-
import { join as
|
|
7228
|
+
import { existsSync as existsSync26, readFileSync as readFileSync19, writeFileSync as writeFileSync18 } from "fs";
|
|
7229
|
+
import { join as join29 } from "path";
|
|
7273
7230
|
import { isV4 as isV47 } from "@decantr/essence-spec";
|
|
7274
7231
|
var GREEN16 = "\x1B[32m";
|
|
7275
7232
|
var RED12 = "\x1B[31m";
|
|
@@ -7286,15 +7243,15 @@ async function cmdThemeSwitch(themeName, args, projectRoot = process.cwd()) {
|
|
|
7286
7243
|
process.exitCode = 1;
|
|
7287
7244
|
return;
|
|
7288
7245
|
}
|
|
7289
|
-
const essencePath =
|
|
7290
|
-
if (!
|
|
7246
|
+
const essencePath = join29(projectRoot, "decantr.essence.json");
|
|
7247
|
+
if (!existsSync26(essencePath)) {
|
|
7291
7248
|
console.error(`${RED12}No decantr.essence.json found. Run \`decantr init\` first.${RESET16}`);
|
|
7292
7249
|
process.exitCode = 1;
|
|
7293
7250
|
return;
|
|
7294
7251
|
}
|
|
7295
7252
|
let parsed;
|
|
7296
7253
|
try {
|
|
7297
|
-
parsed = JSON.parse(
|
|
7254
|
+
parsed = JSON.parse(readFileSync19(essencePath, "utf-8"));
|
|
7298
7255
|
} catch (e) {
|
|
7299
7256
|
console.error(`${RED12}Could not read essence: ${e.message}${RESET16}`);
|
|
7300
7257
|
process.exitCode = 1;
|
|
@@ -7345,7 +7302,7 @@ async function cmdThemeSwitch(themeName, args, projectRoot = process.cwd()) {
|
|
|
7345
7302
|
essence.dna.theme.mode = mode;
|
|
7346
7303
|
}
|
|
7347
7304
|
const registryClient = new RegistryClient({
|
|
7348
|
-
cacheDir:
|
|
7305
|
+
cacheDir: join29(projectRoot, ".decantr", "cache")
|
|
7349
7306
|
});
|
|
7350
7307
|
try {
|
|
7351
7308
|
const themeResult = await registryClient.fetchTheme(themeName);
|
|
@@ -7668,8 +7625,8 @@ async function runSimplifiedInit(blueprints) {
|
|
|
7668
7625
|
}
|
|
7669
7626
|
|
|
7670
7627
|
// src/theme-commands.ts
|
|
7671
|
-
import { existsSync as
|
|
7672
|
-
import { join as
|
|
7628
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync16, readdirSync as readdirSync7, readFileSync as readFileSync20, rmSync as rmSync3, writeFileSync as writeFileSync19 } from "fs";
|
|
7629
|
+
import { join as join30 } from "path";
|
|
7673
7630
|
var REQUIRED_FIELDS = [
|
|
7674
7631
|
"$schema",
|
|
7675
7632
|
"id",
|
|
@@ -7729,11 +7686,11 @@ function validateCustomTheme(theme) {
|
|
|
7729
7686
|
};
|
|
7730
7687
|
}
|
|
7731
7688
|
function createTheme(projectRoot, id, name) {
|
|
7732
|
-
const customThemesDir =
|
|
7733
|
-
const themePath =
|
|
7734
|
-
const howToPath =
|
|
7689
|
+
const customThemesDir = join30(projectRoot, ".decantr", "custom", "themes");
|
|
7690
|
+
const themePath = join30(customThemesDir, `${id}.json`);
|
|
7691
|
+
const howToPath = join30(customThemesDir, "how-to-theme.md");
|
|
7735
7692
|
mkdirSync16(customThemesDir, { recursive: true });
|
|
7736
|
-
if (
|
|
7693
|
+
if (existsSync27(themePath)) {
|
|
7737
7694
|
return {
|
|
7738
7695
|
success: false,
|
|
7739
7696
|
error: `Theme "${id}" already exists at ${themePath}`
|
|
@@ -7741,7 +7698,7 @@ function createTheme(projectRoot, id, name) {
|
|
|
7741
7698
|
}
|
|
7742
7699
|
const skeleton = getThemeSkeleton(id, name);
|
|
7743
7700
|
writeFileSync19(themePath, JSON.stringify(skeleton, null, 2));
|
|
7744
|
-
if (!
|
|
7701
|
+
if (!existsSync27(howToPath)) {
|
|
7745
7702
|
writeFileSync19(howToPath, getHowToThemeDoc());
|
|
7746
7703
|
}
|
|
7747
7704
|
return {
|
|
@@ -7750,17 +7707,17 @@ function createTheme(projectRoot, id, name) {
|
|
|
7750
7707
|
};
|
|
7751
7708
|
}
|
|
7752
7709
|
function listCustomThemes(projectRoot) {
|
|
7753
|
-
const customThemesDir =
|
|
7754
|
-
if (!
|
|
7710
|
+
const customThemesDir = join30(projectRoot, ".decantr", "custom", "themes");
|
|
7711
|
+
if (!existsSync27(customThemesDir)) {
|
|
7755
7712
|
return [];
|
|
7756
7713
|
}
|
|
7757
7714
|
const themes = [];
|
|
7758
7715
|
try {
|
|
7759
7716
|
const files = readdirSync7(customThemesDir).filter((f) => f.endsWith(".json"));
|
|
7760
7717
|
for (const file of files) {
|
|
7761
|
-
const filePath =
|
|
7718
|
+
const filePath = join30(customThemesDir, file);
|
|
7762
7719
|
try {
|
|
7763
|
-
const data = JSON.parse(
|
|
7720
|
+
const data = JSON.parse(readFileSync20(filePath, "utf-8"));
|
|
7764
7721
|
themes.push({
|
|
7765
7722
|
id: data.id || file.replace(".json", ""),
|
|
7766
7723
|
name: data.name || data.id,
|
|
@@ -7775,8 +7732,8 @@ function listCustomThemes(projectRoot) {
|
|
|
7775
7732
|
return themes;
|
|
7776
7733
|
}
|
|
7777
7734
|
function deleteTheme(projectRoot, id) {
|
|
7778
|
-
const themePath =
|
|
7779
|
-
if (!
|
|
7735
|
+
const themePath = join30(projectRoot, ".decantr", "custom", "themes", `${id}.json`);
|
|
7736
|
+
if (!existsSync27(themePath)) {
|
|
7780
7737
|
return {
|
|
7781
7738
|
success: false,
|
|
7782
7739
|
error: `Theme "${id}" not found at ${themePath}`
|
|
@@ -7793,7 +7750,7 @@ function deleteTheme(projectRoot, id) {
|
|
|
7793
7750
|
}
|
|
7794
7751
|
}
|
|
7795
7752
|
function importTheme(projectRoot, sourcePath) {
|
|
7796
|
-
if (!
|
|
7753
|
+
if (!existsSync27(sourcePath)) {
|
|
7797
7754
|
return {
|
|
7798
7755
|
success: false,
|
|
7799
7756
|
errors: [`Source file not found: ${sourcePath}`]
|
|
@@ -7801,7 +7758,7 @@ function importTheme(projectRoot, sourcePath) {
|
|
|
7801
7758
|
}
|
|
7802
7759
|
let theme;
|
|
7803
7760
|
try {
|
|
7804
|
-
theme = JSON.parse(
|
|
7761
|
+
theme = JSON.parse(readFileSync20(sourcePath, "utf-8"));
|
|
7805
7762
|
} catch (e) {
|
|
7806
7763
|
return {
|
|
7807
7764
|
success: false,
|
|
@@ -7817,11 +7774,11 @@ function importTheme(projectRoot, sourcePath) {
|
|
|
7817
7774
|
}
|
|
7818
7775
|
theme.source = "custom";
|
|
7819
7776
|
const id = theme.id;
|
|
7820
|
-
const customThemesDir =
|
|
7821
|
-
const destPath =
|
|
7777
|
+
const customThemesDir = join30(projectRoot, ".decantr", "custom", "themes");
|
|
7778
|
+
const destPath = join30(customThemesDir, `${id}.json`);
|
|
7822
7779
|
mkdirSync16(customThemesDir, { recursive: true });
|
|
7823
|
-
const howToPath =
|
|
7824
|
-
if (!
|
|
7780
|
+
const howToPath = join30(customThemesDir, "how-to-theme.md");
|
|
7781
|
+
if (!existsSync27(howToPath)) {
|
|
7825
7782
|
writeFileSync19(howToPath, getHowToThemeDoc());
|
|
7826
7783
|
}
|
|
7827
7784
|
writeFileSync19(destPath, JSON.stringify(theme, null, 2));
|
|
@@ -8347,86 +8304,19 @@ function generateCuratedPrompt(ctx) {
|
|
|
8347
8304
|
return ctx.workflow === "brownfield-attach" || ctx.workflow === "hybrid-compose" ? generateBrownfieldPrompt(ctx) : generateGreenfieldPrompt(ctx);
|
|
8348
8305
|
}
|
|
8349
8306
|
function getAPIClient() {
|
|
8350
|
-
return new
|
|
8351
|
-
baseUrl: process.env.DECANTR_API_URL || void 0,
|
|
8307
|
+
return new RegistryAPIClient2({
|
|
8308
|
+
baseUrl: process.env.DECANTR_API_URL || process.env.REGISTRY_URL || void 0,
|
|
8352
8309
|
apiKey: process.env.DECANTR_API_KEY || void 0
|
|
8353
8310
|
});
|
|
8354
8311
|
}
|
|
8355
8312
|
function getPublicAPIClient() {
|
|
8356
|
-
return new
|
|
8357
|
-
baseUrl: process.env.DECANTR_API_URL || void 0
|
|
8313
|
+
return new RegistryAPIClient2({
|
|
8314
|
+
baseUrl: process.env.DECANTR_API_URL || process.env.REGISTRY_URL || void 0
|
|
8358
8315
|
});
|
|
8359
8316
|
}
|
|
8360
8317
|
function resolveUserPath(inputPath, cwd = process.cwd()) {
|
|
8361
8318
|
return isAbsolute4(inputPath) ? inputPath : resolve5(cwd, inputPath);
|
|
8362
8319
|
}
|
|
8363
|
-
function extractHostedAssetPaths(indexHtml) {
|
|
8364
|
-
const assetPaths = /* @__PURE__ */ new Set();
|
|
8365
|
-
for (const match of indexHtml.matchAll(/<(?:script|link)[^>]+(?:src|href)="([^"]+)"/g)) {
|
|
8366
|
-
const assetPath = match[1];
|
|
8367
|
-
const assetsIndex = assetPath.indexOf("/assets/");
|
|
8368
|
-
if (assetsIndex === -1) continue;
|
|
8369
|
-
assetPaths.add(assetPath.slice(assetsIndex));
|
|
8370
|
-
}
|
|
8371
|
-
return [...assetPaths];
|
|
8372
|
-
}
|
|
8373
|
-
function readHostedDistSnapshot(distPath) {
|
|
8374
|
-
const resolvedDistPath = distPath ? resolveUserPath(distPath) : join32(process.cwd(), "dist");
|
|
8375
|
-
const indexPath = join32(resolvedDistPath, "index.html");
|
|
8376
|
-
if (!existsSync29(indexPath)) {
|
|
8377
|
-
return void 0;
|
|
8378
|
-
}
|
|
8379
|
-
const indexHtml = readFileSync22(indexPath, "utf-8");
|
|
8380
|
-
const assetPaths = extractHostedAssetPaths(indexHtml);
|
|
8381
|
-
const assets = {};
|
|
8382
|
-
for (const assetPath of assetPaths) {
|
|
8383
|
-
const assetFilePath = join32(resolvedDistPath, assetPath.replace(/^[/\\]+/, ""));
|
|
8384
|
-
if (existsSync29(assetFilePath)) {
|
|
8385
|
-
assets[assetPath] = readFileSync22(assetFilePath, "utf-8");
|
|
8386
|
-
}
|
|
8387
|
-
}
|
|
8388
|
-
return {
|
|
8389
|
-
indexHtml,
|
|
8390
|
-
assets
|
|
8391
|
-
};
|
|
8392
|
-
}
|
|
8393
|
-
function isHostedSourceSnapshotFile(path) {
|
|
8394
|
-
if (/\.d\.ts$/i.test(path)) return false;
|
|
8395
|
-
return /\.(?:[cm]?[jt]sx?)$/i.test(path);
|
|
8396
|
-
}
|
|
8397
|
-
function readHostedSourceSnapshot(sourcePath) {
|
|
8398
|
-
if (!sourcePath) return void 0;
|
|
8399
|
-
const resolvedSourcePath = resolveUserPath(sourcePath);
|
|
8400
|
-
if (!existsSync29(resolvedSourcePath)) {
|
|
8401
|
-
return void 0;
|
|
8402
|
-
}
|
|
8403
|
-
const files = {};
|
|
8404
|
-
const ignoredDirNames = /* @__PURE__ */ new Set([
|
|
8405
|
-
"node_modules",
|
|
8406
|
-
".git",
|
|
8407
|
-
".decantr",
|
|
8408
|
-
"dist",
|
|
8409
|
-
"build",
|
|
8410
|
-
"coverage"
|
|
8411
|
-
]);
|
|
8412
|
-
const rootPrefix = basename2(resolvedSourcePath);
|
|
8413
|
-
const walk = (absoluteDir, relativeDir) => {
|
|
8414
|
-
for (const entry of readdirSync8(absoluteDir, { withFileTypes: true })) {
|
|
8415
|
-
if (ignoredDirNames.has(entry.name)) continue;
|
|
8416
|
-
const absolutePath = join32(absoluteDir, entry.name);
|
|
8417
|
-
const relativePath = join32(relativeDir, entry.name).replace(/\\/g, "/");
|
|
8418
|
-
if (entry.isDirectory()) {
|
|
8419
|
-
walk(absolutePath, relativePath);
|
|
8420
|
-
continue;
|
|
8421
|
-
}
|
|
8422
|
-
if (!entry.isFile()) continue;
|
|
8423
|
-
if (!isHostedSourceSnapshotFile(relativePath)) continue;
|
|
8424
|
-
files[relativePath] = readFileSync22(absolutePath, "utf-8");
|
|
8425
|
-
}
|
|
8426
|
-
};
|
|
8427
|
-
walk(resolvedSourcePath, rootPrefix);
|
|
8428
|
-
return Object.keys(files).length > 0 ? { files } : void 0;
|
|
8429
|
-
}
|
|
8430
8320
|
async function getShowcaseBenchmarkView(view = "shortlist") {
|
|
8431
8321
|
const client = getPublicAPIClient();
|
|
8432
8322
|
if (view === "manifest") {
|
|
@@ -8551,7 +8441,7 @@ async function printRegistryIntelligenceSummary(namespace, jsonOutput = false) {
|
|
|
8551
8441
|
return;
|
|
8552
8442
|
}
|
|
8553
8443
|
const typedSummary = summary;
|
|
8554
|
-
console.log(heading2("
|
|
8444
|
+
console.log(heading2("Content Intelligence Summary"));
|
|
8555
8445
|
console.log(` Namespace: ${typedSummary.namespace ?? "all public content"}`);
|
|
8556
8446
|
console.log(` Generated: ${typedSummary.generated_at}`);
|
|
8557
8447
|
console.log(` Public items: ${typedSummary.totals.total_public_items}`);
|
|
@@ -8614,13 +8504,13 @@ async function printHostedExecutionPackBundle(essencePath, namespace, jsonOutput
|
|
|
8614
8504
|
}
|
|
8615
8505
|
async function compileHostedExecutionPackBundle(essencePath, namespace) {
|
|
8616
8506
|
const client = getPublicAPIClient();
|
|
8617
|
-
const resolvedPath = essencePath ? resolveUserPath(essencePath) :
|
|
8618
|
-
if (!
|
|
8507
|
+
const resolvedPath = essencePath ? resolveUserPath(essencePath) : join31(process.cwd(), "decantr.essence.json");
|
|
8508
|
+
if (!existsSync28(resolvedPath)) {
|
|
8619
8509
|
throw new Error(`Essence file not found at ${resolvedPath}`);
|
|
8620
8510
|
}
|
|
8621
|
-
const essence = JSON.parse(
|
|
8511
|
+
const essence = JSON.parse(readFileSync21(resolvedPath, "utf-8"));
|
|
8622
8512
|
const bundle = await client.compileExecutionPacks(essence, namespace ? { namespace } : void 0);
|
|
8623
|
-
const contextDir =
|
|
8513
|
+
const contextDir = join31(dirname8(resolvedPath), ".decantr", "context");
|
|
8624
8514
|
return { resolvedPath, bundle, contextDir };
|
|
8625
8515
|
}
|
|
8626
8516
|
function writeHostedExecutionPackContextArtifacts(contextDir, bundle) {
|
|
@@ -8628,10 +8518,10 @@ function writeHostedExecutionPackContextArtifacts(contextDir, bundle) {
|
|
|
8628
8518
|
return writeExecutionPackBundleArtifacts(contextDir, bundle);
|
|
8629
8519
|
}
|
|
8630
8520
|
function resolvePagePackIdForRoute(essencePath, route) {
|
|
8631
|
-
if (!
|
|
8521
|
+
if (!existsSync28(essencePath)) {
|
|
8632
8522
|
throw new Error(`Essence file not found at ${essencePath}`);
|
|
8633
8523
|
}
|
|
8634
|
-
const essence = JSON.parse(
|
|
8524
|
+
const essence = JSON.parse(readFileSync21(essencePath, "utf-8"));
|
|
8635
8525
|
if (!isV48(essence)) {
|
|
8636
8526
|
throw new Error("Route-based pack resolution requires Essence v4.0.0.");
|
|
8637
8527
|
}
|
|
@@ -8646,14 +8536,14 @@ function resolvePagePackIdForRoute(essencePath, route) {
|
|
|
8646
8536
|
}
|
|
8647
8537
|
async function printHostedSelectedExecutionPack(packType, id, essencePath, namespace, jsonOutput = false, writeContext = false) {
|
|
8648
8538
|
const client = getPublicAPIClient();
|
|
8649
|
-
const resolvedPath = essencePath ? resolveUserPath(essencePath) :
|
|
8650
|
-
if (!
|
|
8539
|
+
const resolvedPath = essencePath ? resolveUserPath(essencePath) : join31(process.cwd(), "decantr.essence.json");
|
|
8540
|
+
if (!existsSync28(resolvedPath)) {
|
|
8651
8541
|
throw new Error(`Essence file not found at ${resolvedPath}`);
|
|
8652
8542
|
}
|
|
8653
8543
|
if ((packType === "section" || packType === "page" || packType === "mutation") && !id) {
|
|
8654
8544
|
throw new Error(`Pack type "${packType}" requires an id.`);
|
|
8655
8545
|
}
|
|
8656
|
-
const essence = JSON.parse(
|
|
8546
|
+
const essence = JSON.parse(readFileSync21(resolvedPath, "utf-8"));
|
|
8657
8547
|
const selected = await client.selectExecutionPack(
|
|
8658
8548
|
{
|
|
8659
8549
|
essence,
|
|
@@ -8664,17 +8554,17 @@ async function printHostedSelectedExecutionPack(packType, id, essencePath, names
|
|
|
8664
8554
|
);
|
|
8665
8555
|
let writtenContextDir = null;
|
|
8666
8556
|
if (writeContext) {
|
|
8667
|
-
const contextDir =
|
|
8557
|
+
const contextDir = join31(dirname8(resolvedPath), ".decantr", "context");
|
|
8668
8558
|
mkdirSync17(contextDir, { recursive: true });
|
|
8669
8559
|
writeFileSync20(
|
|
8670
|
-
|
|
8560
|
+
join31(contextDir, "pack-manifest.json"),
|
|
8671
8561
|
JSON.stringify(selected.manifest, null, 2) + "\n"
|
|
8672
8562
|
);
|
|
8673
8563
|
const manifestEntry = selected.selector.packType === "scaffold" ? selected.manifest.scaffold : selected.selector.packType === "review" ? selected.manifest.review : selected.selector.packType === "section" ? selected.manifest.sections.find((entry) => entry.id === selected.selector.id) : selected.selector.packType === "page" ? selected.manifest.pages.find((entry) => entry.id === selected.selector.id) : selected.manifest.mutations.find((entry) => entry.id === selected.selector.id);
|
|
8674
8564
|
const markdownFile = manifestEntry?.markdown ?? `${selected.selector.packType}${selected.selector.id ? `-${selected.selector.id}` : ""}-pack.md`;
|
|
8675
8565
|
const jsonFile = manifestEntry?.json ?? `${selected.selector.packType}${selected.selector.id ? `-${selected.selector.id}` : ""}-pack.json`;
|
|
8676
|
-
writeFileSync20(
|
|
8677
|
-
writeFileSync20(
|
|
8566
|
+
writeFileSync20(join31(contextDir, markdownFile), selected.pack.renderedMarkdown);
|
|
8567
|
+
writeFileSync20(join31(contextDir, jsonFile), JSON.stringify(selected.pack, null, 2) + "\n");
|
|
8678
8568
|
writtenContextDir = contextDir;
|
|
8679
8569
|
}
|
|
8680
8570
|
if (jsonOutput) {
|
|
@@ -8699,20 +8589,20 @@ async function printHostedSelectedExecutionPack(packType, id, essencePath, names
|
|
|
8699
8589
|
}
|
|
8700
8590
|
async function printHostedExecutionPackManifest(essencePath, namespace, jsonOutput = false, writeContext = false) {
|
|
8701
8591
|
const client = getPublicAPIClient();
|
|
8702
|
-
const resolvedPath = essencePath ? resolveUserPath(essencePath) :
|
|
8703
|
-
if (!
|
|
8592
|
+
const resolvedPath = essencePath ? resolveUserPath(essencePath) : join31(process.cwd(), "decantr.essence.json");
|
|
8593
|
+
if (!existsSync28(resolvedPath)) {
|
|
8704
8594
|
throw new Error(`Essence file not found at ${resolvedPath}`);
|
|
8705
8595
|
}
|
|
8706
|
-
const essence = JSON.parse(
|
|
8596
|
+
const essence = JSON.parse(readFileSync21(resolvedPath, "utf-8"));
|
|
8707
8597
|
const manifest = await client.getExecutionPackManifest(
|
|
8708
8598
|
essence,
|
|
8709
8599
|
namespace ? { namespace } : void 0
|
|
8710
8600
|
);
|
|
8711
8601
|
let writtenContextDir = null;
|
|
8712
8602
|
if (writeContext) {
|
|
8713
|
-
const contextDir =
|
|
8603
|
+
const contextDir = join31(dirname8(resolvedPath), ".decantr", "context");
|
|
8714
8604
|
mkdirSync17(contextDir, { recursive: true });
|
|
8715
|
-
writeFileSync20(
|
|
8605
|
+
writeFileSync20(join31(contextDir, "pack-manifest.json"), JSON.stringify(manifest, null, 2) + "\n");
|
|
8716
8606
|
writtenContextDir = contextDir;
|
|
8717
8607
|
}
|
|
8718
8608
|
if (jsonOutput) {
|
|
@@ -8733,14 +8623,14 @@ async function printHostedExecutionPackManifest(essencePath, namespace, jsonOutp
|
|
|
8733
8623
|
}
|
|
8734
8624
|
}
|
|
8735
8625
|
async function hydrateHostedExecutionPacksIfMissing(projectRoot, namespace = "@official") {
|
|
8736
|
-
const contextDir =
|
|
8737
|
-
const reviewPackPath =
|
|
8738
|
-
const manifestPath =
|
|
8739
|
-
if (
|
|
8626
|
+
const contextDir = join31(projectRoot, ".decantr", "context");
|
|
8627
|
+
const reviewPackPath = join31(contextDir, "review-pack.json");
|
|
8628
|
+
const manifestPath = join31(contextDir, "pack-manifest.json");
|
|
8629
|
+
if (existsSync28(reviewPackPath) && existsSync28(manifestPath)) {
|
|
8740
8630
|
return { attempted: false, hydrated: false };
|
|
8741
8631
|
}
|
|
8742
|
-
const essencePath =
|
|
8743
|
-
if (!
|
|
8632
|
+
const essencePath = join31(projectRoot, "decantr.essence.json");
|
|
8633
|
+
if (!existsSync28(essencePath)) {
|
|
8744
8634
|
return { attempted: false, hydrated: false };
|
|
8745
8635
|
}
|
|
8746
8636
|
const reviewHydration = await hydrateHostedReviewPackIfMissing(projectRoot, namespace);
|
|
@@ -8749,7 +8639,7 @@ async function hydrateHostedExecutionPacksIfMissing(projectRoot, namespace = "@o
|
|
|
8749
8639
|
}
|
|
8750
8640
|
try {
|
|
8751
8641
|
const client = getPublicAPIClient();
|
|
8752
|
-
const essence = JSON.parse(
|
|
8642
|
+
const essence = JSON.parse(readFileSync21(essencePath, "utf-8"));
|
|
8753
8643
|
const bundle = await client.compileExecutionPacks(essence, { namespace });
|
|
8754
8644
|
mkdirSync17(contextDir, { recursive: true });
|
|
8755
8645
|
writeExecutionPackBundleArtifacts(contextDir, bundle);
|
|
@@ -8759,19 +8649,19 @@ async function hydrateHostedExecutionPacksIfMissing(projectRoot, namespace = "@o
|
|
|
8759
8649
|
}
|
|
8760
8650
|
}
|
|
8761
8651
|
async function hydrateHostedReviewPackIfMissing(projectRoot, namespace = "@official") {
|
|
8762
|
-
const contextDir =
|
|
8763
|
-
const reviewPackPath =
|
|
8764
|
-
const manifestPath =
|
|
8765
|
-
if (
|
|
8652
|
+
const contextDir = join31(projectRoot, ".decantr", "context");
|
|
8653
|
+
const reviewPackPath = join31(contextDir, "review-pack.json");
|
|
8654
|
+
const manifestPath = join31(contextDir, "pack-manifest.json");
|
|
8655
|
+
if (existsSync28(reviewPackPath) && existsSync28(manifestPath)) {
|
|
8766
8656
|
return { attempted: false, hydrated: false };
|
|
8767
8657
|
}
|
|
8768
|
-
const essencePath =
|
|
8769
|
-
if (!
|
|
8658
|
+
const essencePath = join31(projectRoot, "decantr.essence.json");
|
|
8659
|
+
if (!existsSync28(essencePath)) {
|
|
8770
8660
|
return { attempted: false, hydrated: false };
|
|
8771
8661
|
}
|
|
8772
8662
|
try {
|
|
8773
8663
|
const client = getPublicAPIClient();
|
|
8774
|
-
const essence = JSON.parse(
|
|
8664
|
+
const essence = JSON.parse(readFileSync21(essencePath, "utf-8"));
|
|
8775
8665
|
const selected = await client.selectExecutionPack(
|
|
8776
8666
|
{
|
|
8777
8667
|
essence,
|
|
@@ -8780,12 +8670,12 @@ async function hydrateHostedReviewPackIfMissing(projectRoot, namespace = "@offic
|
|
|
8780
8670
|
{ namespace }
|
|
8781
8671
|
);
|
|
8782
8672
|
mkdirSync17(contextDir, { recursive: true });
|
|
8783
|
-
writeFileSync20(
|
|
8673
|
+
writeFileSync20(join31(contextDir, "review-pack.md"), selected.pack.renderedMarkdown);
|
|
8784
8674
|
writeFileSync20(
|
|
8785
|
-
|
|
8675
|
+
join31(contextDir, "review-pack.json"),
|
|
8786
8676
|
JSON.stringify(selected.pack, null, 2) + "\n"
|
|
8787
8677
|
);
|
|
8788
|
-
if (!
|
|
8678
|
+
if (!existsSync28(manifestPath)) {
|
|
8789
8679
|
writeFileSync20(manifestPath, JSON.stringify(selected.manifest, null, 2) + "\n");
|
|
8790
8680
|
}
|
|
8791
8681
|
return { attempted: true, hydrated: true, scope: "review" };
|
|
@@ -8793,72 +8683,6 @@ async function hydrateHostedReviewPackIfMissing(projectRoot, namespace = "@offic
|
|
|
8793
8683
|
return { attempted: true, hydrated: false };
|
|
8794
8684
|
}
|
|
8795
8685
|
}
|
|
8796
|
-
async function printHostedFileCritique(sourcePath, namespace, jsonOutput = false, essencePath, treatmentsPath) {
|
|
8797
|
-
const client = getPublicAPIClient();
|
|
8798
|
-
const resolvedSourcePath = resolveUserPath(sourcePath);
|
|
8799
|
-
const resolvedEssencePath = essencePath ? resolveUserPath(essencePath) : join32(process.cwd(), "decantr.essence.json");
|
|
8800
|
-
const resolvedTreatmentsPath = treatmentsPath ? resolveUserPath(treatmentsPath) : join32(process.cwd(), "src", "styles", "treatments.css");
|
|
8801
|
-
if (!existsSync29(resolvedSourcePath)) {
|
|
8802
|
-
throw new Error(`Source file not found at ${resolvedSourcePath}`);
|
|
8803
|
-
}
|
|
8804
|
-
if (!existsSync29(resolvedEssencePath)) {
|
|
8805
|
-
throw new Error(`Essence file not found at ${resolvedEssencePath}`);
|
|
8806
|
-
}
|
|
8807
|
-
const code = readFileSync22(resolvedSourcePath, "utf-8");
|
|
8808
|
-
const essence = JSON.parse(readFileSync22(resolvedEssencePath, "utf-8"));
|
|
8809
|
-
const treatmentsCss = existsSync29(resolvedTreatmentsPath) ? readFileSync22(resolvedTreatmentsPath, "utf-8") : void 0;
|
|
8810
|
-
const report = await client.critiqueFile(
|
|
8811
|
-
{
|
|
8812
|
-
essence,
|
|
8813
|
-
filePath: sourcePath,
|
|
8814
|
-
code,
|
|
8815
|
-
treatmentsCss
|
|
8816
|
-
},
|
|
8817
|
-
namespace ? { namespace } : void 0
|
|
8818
|
-
);
|
|
8819
|
-
if (jsonOutput) {
|
|
8820
|
-
console.log(JSON.stringify(report, null, 2));
|
|
8821
|
-
return;
|
|
8822
|
-
}
|
|
8823
|
-
console.log(heading2("Hosted File Critique"));
|
|
8824
|
-
console.log(` Source file: ${resolvedSourcePath}`);
|
|
8825
|
-
console.log(` Essence: ${resolvedEssencePath}`);
|
|
8826
|
-
if (treatmentsCss) {
|
|
8827
|
-
console.log(` Treatments: ${resolvedTreatmentsPath}`);
|
|
8828
|
-
}
|
|
8829
|
-
printFileCritiqueReport(report);
|
|
8830
|
-
}
|
|
8831
|
-
async function printHostedProjectAudit(namespace, jsonOutput = false, essencePath, distPath, sourcesPath) {
|
|
8832
|
-
const client = getPublicAPIClient();
|
|
8833
|
-
const resolvedEssencePath = essencePath ? resolveUserPath(essencePath) : join32(process.cwd(), "decantr.essence.json");
|
|
8834
|
-
if (!existsSync29(resolvedEssencePath)) {
|
|
8835
|
-
throw new Error(`Essence file not found at ${resolvedEssencePath}`);
|
|
8836
|
-
}
|
|
8837
|
-
const essence = JSON.parse(readFileSync22(resolvedEssencePath, "utf-8"));
|
|
8838
|
-
const dist = readHostedDistSnapshot(distPath);
|
|
8839
|
-
const sources = readHostedSourceSnapshot(sourcesPath);
|
|
8840
|
-
const report = await client.auditProject(
|
|
8841
|
-
{
|
|
8842
|
-
essence,
|
|
8843
|
-
dist,
|
|
8844
|
-
sources
|
|
8845
|
-
},
|
|
8846
|
-
namespace ? { namespace } : void 0
|
|
8847
|
-
);
|
|
8848
|
-
if (jsonOutput) {
|
|
8849
|
-
console.log(JSON.stringify(report, null, 2));
|
|
8850
|
-
return;
|
|
8851
|
-
}
|
|
8852
|
-
console.log(heading2("Hosted Project Audit"));
|
|
8853
|
-
console.log(` Essence: ${resolvedEssencePath}`);
|
|
8854
|
-
console.log(
|
|
8855
|
-
` Dist snapshot: ${dist ? distPath ? resolveUserPath(distPath) : join32(process.cwd(), "dist") : "none"}`
|
|
8856
|
-
);
|
|
8857
|
-
console.log(
|
|
8858
|
-
` Source snapshot: ${sources && sourcesPath ? resolveUserPath(sourcesPath) : "none"}`
|
|
8859
|
-
);
|
|
8860
|
-
printProjectAuditReport(report);
|
|
8861
|
-
}
|
|
8862
8686
|
function formatBlueprintPortfolioSummary(value) {
|
|
8863
8687
|
const portfolio = getBlueprintPortfolioMetadata(value);
|
|
8864
8688
|
if (!portfolio) return null;
|
|
@@ -8974,21 +8798,21 @@ function findPatternCandidateBySlug(candidates, slug) {
|
|
|
8974
8798
|
function readSuggestCodeContext(projectRoot, route, file) {
|
|
8975
8799
|
const pieces = [];
|
|
8976
8800
|
if (file) {
|
|
8977
|
-
const resolved = isAbsolute4(file) ? file :
|
|
8978
|
-
if (
|
|
8979
|
-
pieces.push(
|
|
8801
|
+
const resolved = isAbsolute4(file) ? file : join31(projectRoot, file);
|
|
8802
|
+
if (existsSync28(resolved)) {
|
|
8803
|
+
pieces.push(readFileSync21(resolved, "utf-8"));
|
|
8980
8804
|
}
|
|
8981
8805
|
}
|
|
8982
8806
|
if (route) {
|
|
8983
|
-
const analysisPath =
|
|
8984
|
-
if (
|
|
8807
|
+
const analysisPath = join31(projectRoot, ".decantr", "analysis.json");
|
|
8808
|
+
if (existsSync28(analysisPath)) {
|
|
8985
8809
|
try {
|
|
8986
|
-
const analysis = JSON.parse(
|
|
8810
|
+
const analysis = JSON.parse(readFileSync21(analysisPath, "utf-8"));
|
|
8987
8811
|
const routeEntry = analysis.routes?.routes?.find((entry) => entry.path === route);
|
|
8988
8812
|
if (routeEntry?.file) {
|
|
8989
|
-
const resolved =
|
|
8990
|
-
if (
|
|
8991
|
-
pieces.push(
|
|
8813
|
+
const resolved = join31(projectRoot, routeEntry.file);
|
|
8814
|
+
if (existsSync28(resolved)) {
|
|
8815
|
+
pieces.push(readFileSync21(resolved, "utf-8"));
|
|
8992
8816
|
}
|
|
8993
8817
|
}
|
|
8994
8818
|
} catch {
|
|
@@ -9074,7 +8898,7 @@ async function cmdSuggest(query, options = {}) {
|
|
|
9074
8898
|
}
|
|
9075
8899
|
}
|
|
9076
8900
|
const registryClient = new RegistryClient({
|
|
9077
|
-
cacheDir:
|
|
8901
|
+
cacheDir: join31(projectRoot, ".decantr", "cache")
|
|
9078
8902
|
});
|
|
9079
8903
|
const code = options.fromCode || options.file ? readSuggestCodeContext(projectRoot, options.route, options.file) : "";
|
|
9080
8904
|
const localMatches = localPatternMatches(projectRoot, [query, code].filter(Boolean).join("\n"));
|
|
@@ -9161,9 +8985,9 @@ async function cmdGet(type, id) {
|
|
|
9161
8985
|
process.exitCode = 1;
|
|
9162
8986
|
return;
|
|
9163
8987
|
}
|
|
9164
|
-
const apiType =
|
|
8988
|
+
const apiType = CONTENT_TYPE_TO_API_CONTENT_TYPE2[type];
|
|
9165
8989
|
const registryClient = new RegistryClient({
|
|
9166
|
-
cacheDir:
|
|
8990
|
+
cacheDir: join31(process.cwd(), ".decantr", "cache")
|
|
9167
8991
|
});
|
|
9168
8992
|
const result = await registryClient.fetchContentItem(apiType, id);
|
|
9169
8993
|
if (result) {
|
|
@@ -9180,10 +9004,10 @@ async function cmdGet(type, id) {
|
|
|
9180
9004
|
return;
|
|
9181
9005
|
}
|
|
9182
9006
|
async function cmdValidate(path) {
|
|
9183
|
-
const essencePath = path ||
|
|
9007
|
+
const essencePath = path || join31(process.cwd(), "decantr.essence.json");
|
|
9184
9008
|
let raw;
|
|
9185
9009
|
try {
|
|
9186
|
-
raw =
|
|
9010
|
+
raw = readFileSync21(essencePath, "utf-8");
|
|
9187
9011
|
} catch {
|
|
9188
9012
|
console.error(error2(`Could not read ${essencePath}`));
|
|
9189
9013
|
process.exitCode = 1;
|
|
@@ -9250,7 +9074,7 @@ async function cmdList(type, sort, recommended, intelligenceSource, blueprintSet
|
|
|
9250
9074
|
return;
|
|
9251
9075
|
}
|
|
9252
9076
|
const registryClient = new RegistryClient({
|
|
9253
|
-
cacheDir:
|
|
9077
|
+
cacheDir: join31(process.cwd(), ".decantr", "cache")
|
|
9254
9078
|
});
|
|
9255
9079
|
const result = await registryClient.fetchContentList(
|
|
9256
9080
|
type,
|
|
@@ -9332,11 +9156,11 @@ ${CYAN10}Telemetry enabled.${RESET18} Decantr will send privacy-filtered CLI pro
|
|
|
9332
9156
|
console.log(`${DIM18}Set "telemetry": false in .decantr/project.json to opt out.${RESET18}`);
|
|
9333
9157
|
}
|
|
9334
9158
|
function readCliPackageVersion2() {
|
|
9335
|
-
const here =
|
|
9336
|
-
const candidates = [
|
|
9159
|
+
const here = dirname8(fileURLToPath4(import.meta.url));
|
|
9160
|
+
const candidates = [join31(here, "..", "package.json"), join31(here, "..", "..", "package.json")];
|
|
9337
9161
|
for (const candidate of candidates) {
|
|
9338
9162
|
try {
|
|
9339
|
-
const pkg = JSON.parse(
|
|
9163
|
+
const pkg = JSON.parse(readFileSync21(candidate, "utf-8"));
|
|
9340
9164
|
if (pkg.version) return pkg.version;
|
|
9341
9165
|
} catch {
|
|
9342
9166
|
}
|
|
@@ -9347,19 +9171,19 @@ function timestampForFile() {
|
|
|
9347
9171
|
return (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
9348
9172
|
}
|
|
9349
9173
|
function backupExistingEssence(projectRoot, label) {
|
|
9350
|
-
const essencePath =
|
|
9351
|
-
if (!
|
|
9352
|
-
const backupPath =
|
|
9174
|
+
const essencePath = join31(projectRoot, "decantr.essence.json");
|
|
9175
|
+
if (!existsSync28(essencePath)) return null;
|
|
9176
|
+
const backupPath = join31(
|
|
9353
9177
|
projectRoot,
|
|
9354
9178
|
`decantr.essence.${label}.${timestampForFile()}.backup.json`
|
|
9355
9179
|
);
|
|
9356
|
-
writeFileSync20(backupPath,
|
|
9180
|
+
writeFileSync20(backupPath, readFileSync21(essencePath, "utf-8"), "utf-8");
|
|
9357
9181
|
return backupPath;
|
|
9358
9182
|
}
|
|
9359
9183
|
function writeBrownfieldProjectJson(input) {
|
|
9360
|
-
const decantrDir =
|
|
9361
|
-
mkdirSync17(
|
|
9362
|
-
mkdirSync17(
|
|
9184
|
+
const decantrDir = join31(input.projectRoot, ".decantr");
|
|
9185
|
+
mkdirSync17(join31(decantrDir, "context"), { recursive: true });
|
|
9186
|
+
mkdirSync17(join31(decantrDir, "cache"), { recursive: true });
|
|
9363
9187
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
9364
9188
|
const projectJson = {
|
|
9365
9189
|
detected: {
|
|
@@ -9400,7 +9224,7 @@ function writeBrownfieldProjectJson(input) {
|
|
|
9400
9224
|
}
|
|
9401
9225
|
}
|
|
9402
9226
|
};
|
|
9403
|
-
writeFileSync20(
|
|
9227
|
+
writeFileSync20(join31(decantrDir, "project.json"), JSON.stringify(projectJson, null, 2) + "\n");
|
|
9404
9228
|
}
|
|
9405
9229
|
async function applyAcceptedBrownfieldProposal(input) {
|
|
9406
9230
|
const proposal = readBrownfieldProposal(input.projectRoot);
|
|
@@ -9416,8 +9240,8 @@ async function applyAcceptedBrownfieldProposal(input) {
|
|
|
9416
9240
|
process.exitCode = 1;
|
|
9417
9241
|
return;
|
|
9418
9242
|
}
|
|
9419
|
-
const essencePath =
|
|
9420
|
-
const hasEssence =
|
|
9243
|
+
const essencePath = join31(input.projectRoot, "decantr.essence.json");
|
|
9244
|
+
const hasEssence = existsSync28(essencePath);
|
|
9421
9245
|
let essence;
|
|
9422
9246
|
let backupPath = null;
|
|
9423
9247
|
if (input.mode === "accept" && hasEssence) {
|
|
@@ -9431,7 +9255,7 @@ async function applyAcceptedBrownfieldProposal(input) {
|
|
|
9431
9255
|
return;
|
|
9432
9256
|
}
|
|
9433
9257
|
if (input.mode === "merge" && hasEssence) {
|
|
9434
|
-
const existing = JSON.parse(
|
|
9258
|
+
const existing = JSON.parse(readFileSync21(essencePath, "utf-8"));
|
|
9435
9259
|
if (!isV48(existing)) {
|
|
9436
9260
|
console.log(
|
|
9437
9261
|
error2(
|
|
@@ -9470,7 +9294,7 @@ async function applyAcceptedBrownfieldProposal(input) {
|
|
|
9470
9294
|
});
|
|
9471
9295
|
writeFileSync20(essencePath, JSON.stringify(essence, null, 2) + "\n", "utf-8");
|
|
9472
9296
|
const registryClient = new RegistryClient({
|
|
9473
|
-
cacheDir:
|
|
9297
|
+
cacheDir: join31(input.projectRoot, ".decantr", "cache"),
|
|
9474
9298
|
offline: true,
|
|
9475
9299
|
projectRoot: input.projectRoot
|
|
9476
9300
|
});
|
|
@@ -9649,7 +9473,7 @@ async function cmdInit(args) {
|
|
|
9649
9473
|
}
|
|
9650
9474
|
}
|
|
9651
9475
|
const registryClient = new RegistryClient({
|
|
9652
|
-
cacheDir:
|
|
9476
|
+
cacheDir: join31(projectRoot, ".decantr", "cache"),
|
|
9653
9477
|
apiUrl: args.registry,
|
|
9654
9478
|
offline: args.offline,
|
|
9655
9479
|
projectRoot
|
|
@@ -9981,7 +9805,7 @@ ${YELLOW13}You're offline. Scaffolding Decantr default.${RESET18}`);
|
|
|
9981
9805
|
if (appliedRuleFiles.length > 0) {
|
|
9982
9806
|
console.log(` ${dim4(`Rule bridge applied: ${appliedRuleFiles.join(", ")}`)}`);
|
|
9983
9807
|
}
|
|
9984
|
-
if (!
|
|
9808
|
+
if (!existsSync28(join31(projectRoot, "package.json"))) {
|
|
9985
9809
|
console.log("");
|
|
9986
9810
|
console.log(
|
|
9987
9811
|
dim4(` Note: ${cyan4("decantr init")} created Decantr contract/context files only.`)
|
|
@@ -9992,7 +9816,7 @@ ${YELLOW13}You're offline. Scaffolding Decantr default.${RESET18}`);
|
|
|
9992
9816
|
)
|
|
9993
9817
|
);
|
|
9994
9818
|
}
|
|
9995
|
-
const hasCompiledPacks =
|
|
9819
|
+
const hasCompiledPacks = existsSync28(join31(projectRoot, ".decantr", "context", "scaffold-pack.md"));
|
|
9996
9820
|
console.log("");
|
|
9997
9821
|
console.log(" Next steps:");
|
|
9998
9822
|
if (hasCompiledPacks) {
|
|
@@ -10032,7 +9856,7 @@ ${YELLOW13}You're offline. Scaffolding Decantr default.${RESET18}`);
|
|
|
10032
9856
|
console.log(` ${cyan4("decantr upgrade")} Update to latest patterns`);
|
|
10033
9857
|
console.log(` ${cyan4("decantr check")} Detect drift issues`);
|
|
10034
9858
|
console.log(` ${cyan4("decantr migrate --to v4")} Migrate older essence files to v4`);
|
|
10035
|
-
const essenceContent =
|
|
9859
|
+
const essenceContent = readFileSync21(result.essencePath, "utf-8");
|
|
10036
9860
|
const essence = JSON.parse(essenceContent);
|
|
10037
9861
|
const validation = validateEssence2(essence);
|
|
10038
9862
|
if (!validation.valid) {
|
|
@@ -10087,16 +9911,16 @@ Validation warnings: ${validation.errors.join(", ")}`));
|
|
|
10087
9911
|
}
|
|
10088
9912
|
}
|
|
10089
9913
|
async function cmdStatus(projectRoot = process.cwd()) {
|
|
10090
|
-
const essencePath =
|
|
10091
|
-
const projectJsonPath =
|
|
9914
|
+
const essencePath = join31(projectRoot, "decantr.essence.json");
|
|
9915
|
+
const projectJsonPath = join31(projectRoot, ".decantr", "project.json");
|
|
10092
9916
|
console.log(heading2("Decantr Project Status"));
|
|
10093
|
-
if (!
|
|
9917
|
+
if (!existsSync28(essencePath)) {
|
|
10094
9918
|
console.log(`${RED13}No decantr.essence.json found.${RESET18}`);
|
|
10095
9919
|
console.log(dim4('Run "decantr init" to create one.'));
|
|
10096
9920
|
return;
|
|
10097
9921
|
}
|
|
10098
9922
|
try {
|
|
10099
|
-
const essence = JSON.parse(
|
|
9923
|
+
const essence = JSON.parse(readFileSync21(essencePath, "utf-8"));
|
|
10100
9924
|
const validation = validateEssence2(essence);
|
|
10101
9925
|
const essenceVersion = isV48(essence) ? "v4" : "legacy";
|
|
10102
9926
|
console.log(`${BOLD11}Essence:${RESET18}`);
|
|
@@ -10144,9 +9968,9 @@ async function cmdStatus(projectRoot = process.cwd()) {
|
|
|
10144
9968
|
}
|
|
10145
9969
|
console.log("");
|
|
10146
9970
|
console.log(`${BOLD11}Sync Status:${RESET18}`);
|
|
10147
|
-
if (
|
|
9971
|
+
if (existsSync28(projectJsonPath)) {
|
|
10148
9972
|
try {
|
|
10149
|
-
const projectJson = JSON.parse(
|
|
9973
|
+
const projectJson = JSON.parse(readFileSync21(projectJsonPath, "utf-8"));
|
|
10150
9974
|
const syncStatus = projectJson.sync?.status || "unknown";
|
|
10151
9975
|
const lastSync = projectJson.sync?.lastSync || "never";
|
|
10152
9976
|
const source = projectJson.sync?.registrySource || "unknown";
|
|
@@ -10164,7 +9988,7 @@ async function cmdStatus(projectRoot = process.cwd()) {
|
|
|
10164
9988
|
}
|
|
10165
9989
|
async function cmdSync() {
|
|
10166
9990
|
const projectRoot = process.cwd();
|
|
10167
|
-
const cacheDir =
|
|
9991
|
+
const cacheDir = join31(projectRoot, ".decantr", "cache");
|
|
10168
9992
|
console.log(heading2("Syncing registry content..."));
|
|
10169
9993
|
const result = await syncRegistry(cacheDir);
|
|
10170
9994
|
if (result.synced.length > 0) {
|
|
@@ -10253,26 +10077,35 @@ function printFileCritiqueReport(report) {
|
|
|
10253
10077
|
console.log(`${BOLD11}Findings:${RESET18}`);
|
|
10254
10078
|
printVerificationFindings(report.findings);
|
|
10255
10079
|
}
|
|
10256
|
-
async function cmdAudit(filePath) {
|
|
10080
|
+
async function cmdAudit(filePath, options = {}) {
|
|
10257
10081
|
const projectRoot = process.cwd();
|
|
10082
|
+
const jsonOutput = options.json === true;
|
|
10258
10083
|
try {
|
|
10259
10084
|
if (filePath) {
|
|
10260
10085
|
const hydration2 = await hydrateHostedReviewPackIfMissing(projectRoot);
|
|
10261
|
-
|
|
10262
|
-
|
|
10086
|
+
if (!jsonOutput) {
|
|
10087
|
+
console.log(heading2(`Critiquing ${filePath}...`));
|
|
10088
|
+
}
|
|
10089
|
+
if (hydration2.hydrated && !jsonOutput) {
|
|
10263
10090
|
console.log(dim4("Hydrated missing review pack from hosted registry."));
|
|
10264
10091
|
console.log("");
|
|
10265
10092
|
}
|
|
10266
10093
|
const report2 = await critiqueProjectFile(filePath, projectRoot);
|
|
10267
|
-
|
|
10094
|
+
if (jsonOutput) {
|
|
10095
|
+
console.log(JSON.stringify(report2, null, 2));
|
|
10096
|
+
} else {
|
|
10097
|
+
printFileCritiqueReport(report2);
|
|
10098
|
+
}
|
|
10268
10099
|
if (report2.findings.some((finding) => finding.severity === "error")) {
|
|
10269
10100
|
process.exitCode = 1;
|
|
10270
10101
|
}
|
|
10271
10102
|
return;
|
|
10272
10103
|
}
|
|
10273
10104
|
const hydration = await hydrateHostedExecutionPacksIfMissing(projectRoot);
|
|
10274
|
-
|
|
10275
|
-
|
|
10105
|
+
if (!jsonOutput) {
|
|
10106
|
+
console.log(heading2("Auditing project..."));
|
|
10107
|
+
}
|
|
10108
|
+
if (hydration.hydrated && !jsonOutput) {
|
|
10276
10109
|
console.log(
|
|
10277
10110
|
dim4(
|
|
10278
10111
|
hydration.scope === "bundle" ? "Hydrated missing execution packs from hosted registry." : "Hydrated missing review pack and manifest from hosted registry."
|
|
@@ -10281,14 +10114,20 @@ async function cmdAudit(filePath) {
|
|
|
10281
10114
|
console.log("");
|
|
10282
10115
|
}
|
|
10283
10116
|
const report = await auditProject(projectRoot);
|
|
10284
|
-
|
|
10117
|
+
if (jsonOutput) {
|
|
10118
|
+
console.log(JSON.stringify(report, null, 2));
|
|
10119
|
+
} else {
|
|
10120
|
+
printProjectAuditReport(report);
|
|
10121
|
+
}
|
|
10285
10122
|
if (!report.valid) {
|
|
10286
10123
|
process.exitCode = 1;
|
|
10287
10124
|
return;
|
|
10288
10125
|
}
|
|
10289
10126
|
if (report.findings.length > 0) {
|
|
10290
|
-
|
|
10291
|
-
|
|
10127
|
+
if (!jsonOutput) {
|
|
10128
|
+
console.log("");
|
|
10129
|
+
console.log(dim4("Project audit completed with advisory findings."));
|
|
10130
|
+
}
|
|
10292
10131
|
}
|
|
10293
10132
|
} catch (e) {
|
|
10294
10133
|
console.log(`${RED13}Error: ${e.message}${RESET18}`);
|
|
@@ -10358,14 +10197,14 @@ ${BOLD11}Examples:${RESET18}
|
|
|
10358
10197
|
process.exitCode = 1;
|
|
10359
10198
|
return;
|
|
10360
10199
|
}
|
|
10361
|
-
const themePath =
|
|
10362
|
-
if (!
|
|
10200
|
+
const themePath = join31(projectRoot, ".decantr", "custom", "themes", `${name}.json`);
|
|
10201
|
+
if (!existsSync28(themePath)) {
|
|
10363
10202
|
console.error(error2(`Theme "${name}" not found at ${themePath}`));
|
|
10364
10203
|
process.exitCode = 1;
|
|
10365
10204
|
return;
|
|
10366
10205
|
}
|
|
10367
10206
|
try {
|
|
10368
|
-
const theme = JSON.parse(
|
|
10207
|
+
const theme = JSON.parse(readFileSync21(themePath, "utf-8"));
|
|
10369
10208
|
const result = validateCustomTheme(theme);
|
|
10370
10209
|
if (result.valid) {
|
|
10371
10210
|
console.log(success4(`Custom theme "${name}" is valid`));
|
|
@@ -10497,7 +10336,7 @@ function withProject(command, projectArg) {
|
|
|
10497
10336
|
return projectArg ? `${command} --project ${projectArg}` : command;
|
|
10498
10337
|
}
|
|
10499
10338
|
function displayProjectPath(workspaceInfo, projectPath) {
|
|
10500
|
-
const absolutePath =
|
|
10339
|
+
const absolutePath = join31(workspaceInfo.appRoot, projectPath);
|
|
10501
10340
|
const relativePath = relative7(workspaceInfo.cwd, absolutePath).replace(/\\/g, "/");
|
|
10502
10341
|
if (relativePath && !relativePath.startsWith("..") && !isAbsolute4(relativePath)) {
|
|
10503
10342
|
return relativePath;
|
|
@@ -10521,7 +10360,7 @@ function graphSourceNodeIdForTaskFile(projectRoot, snapshot, filePath) {
|
|
|
10521
10360
|
candidates.add(trimmed.replace(/\\/g, "/").replace(/^\.\//, ""));
|
|
10522
10361
|
const cwdRelative = projectRelativeGraphPath(projectRoot, trimmed);
|
|
10523
10362
|
if (cwdRelative) candidates.add(cwdRelative);
|
|
10524
|
-
const projectRelative = projectRelativeGraphPath(projectRoot,
|
|
10363
|
+
const projectRelative = projectRelativeGraphPath(projectRoot, join31(projectRoot, trimmed));
|
|
10525
10364
|
if (projectRelative) candidates.add(projectRelative);
|
|
10526
10365
|
for (const candidate of candidates) {
|
|
10527
10366
|
const nodeId = `src:${candidate}`;
|
|
@@ -10595,7 +10434,7 @@ function printWorkspaceProjectSelection(workspaceInfo, commandName = "command")
|
|
|
10595
10434
|
function printMonorepoSetupGuidance(workspaceInfo) {
|
|
10596
10435
|
const candidate = firstWorkspaceCandidate(workspaceInfo);
|
|
10597
10436
|
const attachedProjects = workspaceInfo.appCandidates.filter(
|
|
10598
|
-
(appCandidate) =>
|
|
10437
|
+
(appCandidate) => existsSync28(join31(workspaceInfo.workspaceRoot, appCandidate, "decantr.essence.json"))
|
|
10599
10438
|
);
|
|
10600
10439
|
const firstAttached = attachedProjects[0];
|
|
10601
10440
|
console.log(heading2("Decantr Setup"));
|
|
@@ -10663,7 +10502,7 @@ function printMonorepoSetupGuidance(workspaceInfo) {
|
|
|
10663
10502
|
function resolveWorkflowProject(flags, commandName = "command", options = {}) {
|
|
10664
10503
|
const projectArg = flagString(flags, "project");
|
|
10665
10504
|
const workspaceInfo = resolveWorkspaceInfo(process.cwd(), projectArg);
|
|
10666
|
-
if (projectArg && options.requireExisting !== false && !
|
|
10505
|
+
if (projectArg && options.requireExisting !== false && !existsSync28(workspaceInfo.appRoot)) {
|
|
10667
10506
|
printProjectNotFound(projectArg, commandName);
|
|
10668
10507
|
process.exitCode = 1;
|
|
10669
10508
|
return null;
|
|
@@ -11003,9 +10842,9 @@ async function cmdSetupWorkflow(args) {
|
|
|
11003
10842
|
console.log(` Detected: ${formatDetection(detected)}`);
|
|
11004
10843
|
console.log("");
|
|
11005
10844
|
if (detected.existingEssence) {
|
|
11006
|
-
const hasLocalPatterns =
|
|
11007
|
-
const hasLocalRules =
|
|
11008
|
-
const hasStyleBridge =
|
|
10845
|
+
const hasLocalPatterns = existsSync28(localPatternsPath(workspaceInfo.appRoot));
|
|
10846
|
+
const hasLocalRules = existsSync28(localRulesPath(workspaceInfo.appRoot));
|
|
10847
|
+
const hasStyleBridge = existsSync28(styleBridgePath(workspaceInfo.appRoot));
|
|
11009
10848
|
const verifyCommand = hasLocalPatterns || hasLocalRules ? "decantr verify --brownfield --local-patterns" : "decantr verify --brownfield";
|
|
11010
10849
|
console.log(`${BOLD11}Recommended path:${RESET18} maintain an attached Decantr project`);
|
|
11011
10850
|
console.log(
|
|
@@ -11093,7 +10932,7 @@ async function cmdAdoptWorkflow(args) {
|
|
|
11093
10932
|
const hydratePacks = flagBoolean(flags, "packs", true) && !flagBoolean(flags, "skip-packs") && !flagBoolean(flags, "offline") && process.env.DECANTR_OFFLINE !== "true";
|
|
11094
10933
|
const initCi = flagBoolean(flags, "ci") || flagBoolean(flags, "init-ci");
|
|
11095
10934
|
const assistantBridge = flagString(flags, "assistant-bridge");
|
|
11096
|
-
const hasEssence =
|
|
10935
|
+
const hasEssence = existsSync28(join31(projectRoot, "decantr.essence.json"));
|
|
11097
10936
|
const proposalFlag = flagBoolean(flags, "replace-essence") ? "--replace-essence" : flagBoolean(flags, "merge-proposal") || hasEssence ? "--merge-proposal" : "--accept-proposal";
|
|
11098
10937
|
const steps = [
|
|
11099
10938
|
"analyze current app and write .decantr/brownfield intelligence",
|
|
@@ -11142,7 +10981,7 @@ async function cmdAdoptWorkflow(args) {
|
|
|
11142
10981
|
if (hydratePacks) {
|
|
11143
10982
|
try {
|
|
11144
10983
|
const { bundle, contextDir } = await compileHostedExecutionPackBundle(
|
|
11145
|
-
|
|
10984
|
+
join31(projectRoot, "decantr.essence.json")
|
|
11146
10985
|
);
|
|
11147
10986
|
const written = writeHostedExecutionPackContextArtifacts(
|
|
11148
10987
|
contextDir,
|
|
@@ -11353,9 +11192,9 @@ async function cmdVerifyWorkflow(args) {
|
|
|
11353
11192
|
}
|
|
11354
11193
|
}
|
|
11355
11194
|
function readJsonIfPresent(path) {
|
|
11356
|
-
if (!
|
|
11195
|
+
if (!existsSync28(path)) return null;
|
|
11357
11196
|
try {
|
|
11358
|
-
return JSON.parse(
|
|
11197
|
+
return JSON.parse(readFileSync21(path, "utf-8"));
|
|
11359
11198
|
} catch {
|
|
11360
11199
|
return null;
|
|
11361
11200
|
}
|
|
@@ -11507,7 +11346,7 @@ async function cmdTaskWorkflow(args) {
|
|
|
11507
11346
|
}
|
|
11508
11347
|
const route = routeInput.startsWith("/") ? routeInput : `/${routeInput}`;
|
|
11509
11348
|
const taskSummary = positional.slice(1).join(" ").trim();
|
|
11510
|
-
const essencePath =
|
|
11349
|
+
const essencePath = join31(workspaceInfo.appRoot, "decantr.essence.json");
|
|
11511
11350
|
const essence = readJsonIfPresent(essencePath);
|
|
11512
11351
|
if (!essence) {
|
|
11513
11352
|
console.error(
|
|
@@ -11531,19 +11370,19 @@ async function cmdTaskWorkflow(args) {
|
|
|
11531
11370
|
}
|
|
11532
11371
|
const section = essence.blueprint.sections.find((entry) => entry.id === target.section);
|
|
11533
11372
|
const page = section?.pages.find((entry) => entry.id === target.page);
|
|
11534
|
-
const contextDir =
|
|
11535
|
-
const manifest = readJsonIfPresent(
|
|
11536
|
-
const projectJson = readJsonIfPresent(
|
|
11373
|
+
const contextDir = join31(workspaceInfo.appRoot, ".decantr", "context");
|
|
11374
|
+
const manifest = readJsonIfPresent(join31(contextDir, "pack-manifest.json"));
|
|
11375
|
+
const projectJson = readJsonIfPresent(join31(workspaceInfo.appRoot, ".decantr", "project.json"));
|
|
11537
11376
|
const pagePack = manifest?.pages?.find((entry) => entry.id === target.page);
|
|
11538
11377
|
const sectionPack = manifest?.sections?.find((entry) => entry.id === target.section);
|
|
11539
|
-
const visualManifest = readJsonIfPresent(
|
|
11378
|
+
const visualManifest = readJsonIfPresent(join31(workspaceInfo.appRoot, ".decantr", "evidence", "visual-manifest.json"));
|
|
11540
11379
|
const screenshot = visualManifest?.routes?.find((entry) => entry.route === route)?.screenshot;
|
|
11541
11380
|
const localPatternPackPath = localPatternsPath(workspaceInfo.appRoot);
|
|
11542
11381
|
const localRuleManifestPath = localRulesPath(workspaceInfo.appRoot);
|
|
11543
11382
|
const acceptedStyleBridgePath = styleBridgePath(workspaceInfo.appRoot);
|
|
11544
|
-
const graphDir =
|
|
11545
|
-
const contractCapsulePath =
|
|
11546
|
-
const graphSnapshotPath =
|
|
11383
|
+
const graphDir = join31(workspaceInfo.appRoot, ".decantr", "graph");
|
|
11384
|
+
const contractCapsulePath = join31(graphDir, "contract-capsule.json");
|
|
11385
|
+
const graphSnapshotPath = join31(graphDir, "graph.snapshot.json");
|
|
11547
11386
|
const contractCapsule = readJsonIfPresent(contractCapsulePath);
|
|
11548
11387
|
const graphSnapshot = readJsonIfPresent(graphSnapshotPath);
|
|
11549
11388
|
const routeGraphContext = buildGraphRouteContext(graphSnapshot, route, { task: taskSummary });
|
|
@@ -11586,21 +11425,21 @@ async function cmdTaskWorkflow(args) {
|
|
|
11586
11425
|
projectRoot: workspaceInfo.appRoot,
|
|
11587
11426
|
workflowMode: projectJson?.initialized?.workflowMode ?? null,
|
|
11588
11427
|
adoptionMode: projectJson?.initialized?.adoptionMode ?? null,
|
|
11589
|
-
hasLocalPatterns:
|
|
11590
|
-
hasLocalRules:
|
|
11428
|
+
hasLocalPatterns: existsSync28(localPatternPackPath),
|
|
11429
|
+
hasLocalRules: existsSync28(localRuleManifestPath),
|
|
11591
11430
|
hasPackManifest: Boolean(manifest),
|
|
11592
11431
|
taskSummary,
|
|
11593
|
-
hasStyleBridge:
|
|
11432
|
+
hasStyleBridge: existsSync28(acceptedStyleBridgePath)
|
|
11594
11433
|
});
|
|
11595
11434
|
const readTargets = [
|
|
11596
|
-
pagePack ? displayProjectPath(workspaceInfo,
|
|
11597
|
-
sectionPack ? displayProjectPath(workspaceInfo,
|
|
11598
|
-
manifest?.scaffold?.markdown ? displayProjectPath(workspaceInfo,
|
|
11435
|
+
pagePack ? displayProjectPath(workspaceInfo, join31(".decantr/context", pagePack.markdown)) : null,
|
|
11436
|
+
sectionPack ? displayProjectPath(workspaceInfo, join31(".decantr/context", sectionPack.markdown)) : null,
|
|
11437
|
+
manifest?.scaffold?.markdown ? displayProjectPath(workspaceInfo, join31(".decantr/context", manifest.scaffold.markdown)) : null,
|
|
11599
11438
|
displayProjectPath(workspaceInfo, ".decantr/context/scaffold.md"),
|
|
11600
11439
|
displayProjectPath(workspaceInfo, "DECANTR.md"),
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
|
|
11440
|
+
existsSync28(localPatternPackPath) ? displayProjectPath(workspaceInfo, ".decantr/local-patterns.json") : null,
|
|
11441
|
+
existsSync28(localRuleManifestPath) ? displayProjectPath(workspaceInfo, ".decantr/rules.json") : null,
|
|
11442
|
+
existsSync28(acceptedStyleBridgePath) ? displayProjectPath(workspaceInfo, ".decantr/style-bridge.json") : null,
|
|
11604
11443
|
contractCapsule ? displayProjectPath(workspaceInfo, ".decantr/graph/contract-capsule.json") : null,
|
|
11605
11444
|
routeGraphContext && !contractCapsule ? displayProjectPath(workspaceInfo, ".decantr/graph/graph.snapshot.json") : null
|
|
11606
11445
|
].filter((value) => Boolean(value));
|
|
@@ -11920,7 +11759,7 @@ async function cmdCodifyWorkflow(args) {
|
|
|
11920
11759
|
const workspaceInfo = resolveWorkflowProject(flags, "codify");
|
|
11921
11760
|
if (!workspaceInfo) return;
|
|
11922
11761
|
if (flagBoolean(flags, "accept")) {
|
|
11923
|
-
if (!
|
|
11762
|
+
if (!existsSync28(localPatternsProposalPath(workspaceInfo.appRoot)) && !existsSync28(localRulesProposalPath(workspaceInfo.appRoot)) && !existsSync28(styleBridgeProposalPath(workspaceInfo.appRoot))) {
|
|
11924
11763
|
console.error(
|
|
11925
11764
|
error2(
|
|
11926
11765
|
"No codify proposal found. Run `decantr codify --from-audit`, `decantr codify --style-bridge`, or `decantr codify` first."
|
|
@@ -11954,14 +11793,14 @@ async function cmdCodifyWorkflow(args) {
|
|
|
11954
11793
|
}
|
|
11955
11794
|
const detected = detectProject(workspaceInfo.appRoot);
|
|
11956
11795
|
const essence = readJsonIfPresent(
|
|
11957
|
-
|
|
11796
|
+
join31(workspaceInfo.appRoot, "decantr.essence.json")
|
|
11958
11797
|
);
|
|
11959
11798
|
const fromAudit = flagBoolean(flags, "from-audit") || flagBoolean(flags, "discover-local-patterns") || flagBoolean(flags, "codify-local-patterns");
|
|
11960
11799
|
const wantsStyleBridge = flagBoolean(flags, "style-bridge");
|
|
11961
11800
|
const mapPatternSlug = flagString(flags, "map-pattern") ?? flagString(flags, "hosted-pattern");
|
|
11962
11801
|
if (mapPatternSlug) {
|
|
11963
11802
|
const registryClient = new RegistryClient({
|
|
11964
|
-
cacheDir:
|
|
11803
|
+
cacheDir: join31(workspaceInfo.appRoot, ".decantr", "cache")
|
|
11965
11804
|
});
|
|
11966
11805
|
const candidates = await loadPatternDiscoveryCandidates(registryClient);
|
|
11967
11806
|
const candidate = findPatternCandidateBySlug(candidates, mapPatternSlug);
|
|
@@ -12046,8 +11885,12 @@ async function cmdCodifyWorkflow(args) {
|
|
|
12046
11885
|
}
|
|
12047
11886
|
async function cmdContentWorkflow(args) {
|
|
12048
11887
|
const subcommand = args[1] ?? "check";
|
|
11888
|
+
if (subcommand === "summary" || subcommand === "compile-packs" || subcommand === "get-pack") {
|
|
11889
|
+
await cmdContentCorpusWorkflow(args, "content");
|
|
11890
|
+
return;
|
|
11891
|
+
}
|
|
12049
11892
|
if (subcommand === "check" || subcommand === "health") {
|
|
12050
|
-
const { cmdContentHealth, parseContentHealthArgs } = await import("./content-health-
|
|
11893
|
+
const { cmdContentHealth, parseContentHealthArgs } = await import("./content-health-TDV4LP2C.js");
|
|
12051
11894
|
await cmdContentHealth(
|
|
12052
11895
|
process.cwd(),
|
|
12053
11896
|
parseContentHealthArgs(["content-health", ...args.slice(2)])
|
|
@@ -12068,19 +11911,74 @@ async function cmdContentWorkflow(args) {
|
|
|
12068
11911
|
return;
|
|
12069
11912
|
}
|
|
12070
11913
|
if (subcommand === "publish") {
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
11914
|
+
console.error(
|
|
11915
|
+
error2(
|
|
11916
|
+
"Hosted community publishing has been retired. Add official corpus changes under packages/content and run decantr content check."
|
|
11917
|
+
)
|
|
11918
|
+
);
|
|
11919
|
+
process.exitCode = 1;
|
|
11920
|
+
return;
|
|
11921
|
+
}
|
|
11922
|
+
console.error(error2("Usage: decantr content <check|create|summary|compile-packs|get-pack>"));
|
|
11923
|
+
process.exitCode = 1;
|
|
11924
|
+
}
|
|
11925
|
+
async function cmdContentCorpusWorkflow(args, commandName) {
|
|
11926
|
+
const subcommand = args[1];
|
|
11927
|
+
if (subcommand === "summary") {
|
|
11928
|
+
const namespaceIdx = args.indexOf("--namespace");
|
|
11929
|
+
const namespace = namespaceIdx !== -1 ? args[namespaceIdx + 1] : void 0;
|
|
11930
|
+
const jsonOutput = args.includes("--json");
|
|
11931
|
+
await printRegistryIntelligenceSummary(namespace, jsonOutput);
|
|
11932
|
+
return;
|
|
11933
|
+
}
|
|
11934
|
+
if (subcommand === "compile-packs") {
|
|
11935
|
+
const namespaceIdx = args.indexOf("--namespace");
|
|
11936
|
+
const namespace = namespaceIdx !== -1 ? args[namespaceIdx + 1] : void 0;
|
|
11937
|
+
const jsonOutput = args.includes("--json");
|
|
11938
|
+
const writeContext = args.includes("--write-context");
|
|
11939
|
+
const essencePath = args[2] && !args[2].startsWith("--") ? args[2] : void 0;
|
|
11940
|
+
await printHostedExecutionPackBundle(essencePath, namespace, jsonOutput, writeContext);
|
|
11941
|
+
return;
|
|
11942
|
+
}
|
|
11943
|
+
if (subcommand === "get-pack") {
|
|
11944
|
+
const namespaceIdx = args.indexOf("--namespace");
|
|
11945
|
+
const namespace = namespaceIdx !== -1 ? args[namespaceIdx + 1] : void 0;
|
|
11946
|
+
const jsonOutput = args.includes("--json");
|
|
11947
|
+
const writeContext = args.includes("--write-context");
|
|
11948
|
+
const essenceIdx = args.indexOf("--essence");
|
|
11949
|
+
const essencePath = essenceIdx !== -1 ? args[essenceIdx + 1] : void 0;
|
|
11950
|
+
const packType = args[2] && !args[2].startsWith("--") ? args[2] : void 0;
|
|
11951
|
+
const routeIdx = args.indexOf("--route");
|
|
11952
|
+
const route = routeIdx !== -1 ? args[routeIdx + 1] : void 0;
|
|
11953
|
+
let id = args[3] && !args[3].startsWith("--") ? args[3] : void 0;
|
|
11954
|
+
if (!packType || !["manifest", "scaffold", "review", "section", "page", "mutation"].includes(packType)) {
|
|
11955
|
+
console.error(
|
|
11956
|
+
`${RED13}Usage: decantr ${commandName} get-pack <manifest|scaffold|review|section|page|mutation> [id] [--namespace <namespace>] [--json] [--essence <path>] [--write-context]${RESET18}`
|
|
11957
|
+
);
|
|
12077
11958
|
process.exitCode = 1;
|
|
12078
11959
|
return;
|
|
12079
11960
|
}
|
|
12080
|
-
|
|
11961
|
+
if (packType === "manifest") {
|
|
11962
|
+
await printHostedExecutionPackManifest(essencePath, namespace, jsonOutput, writeContext);
|
|
11963
|
+
return;
|
|
11964
|
+
}
|
|
11965
|
+
if (packType === "page" && route && !id) {
|
|
11966
|
+
const resolvedPath = essencePath ? resolveUserPath(essencePath) : join31(process.cwd(), "decantr.essence.json");
|
|
11967
|
+
id = resolvePagePackIdForRoute(resolvedPath, route);
|
|
11968
|
+
}
|
|
11969
|
+
await printHostedSelectedExecutionPack(
|
|
11970
|
+
packType,
|
|
11971
|
+
id,
|
|
11972
|
+
essencePath,
|
|
11973
|
+
namespace,
|
|
11974
|
+
jsonOutput,
|
|
11975
|
+
writeContext
|
|
11976
|
+
);
|
|
12081
11977
|
return;
|
|
12082
11978
|
}
|
|
12083
|
-
console.error(
|
|
11979
|
+
console.error(
|
|
11980
|
+
`${RED13}Usage: decantr ${commandName} summary [--namespace <namespace>] [--json] | decantr ${commandName} compile-packs [path] [--namespace <namespace>] [--json] [--write-context] | decantr ${commandName} get-pack <manifest|scaffold|review|section|page|mutation> [id] [--namespace <namespace>] [--json] [--essence <path>] [--write-context]${RESET18}`
|
|
11981
|
+
);
|
|
12084
11982
|
process.exitCode = 1;
|
|
12085
11983
|
}
|
|
12086
11984
|
function cmdHelp() {
|
|
@@ -12090,7 +11988,7 @@ ${BOLD11}decantr${RESET18} \u2014 AI Frontend Governance for codebases touched b
|
|
|
12090
11988
|
${BOLD11}Usage:${RESET18}
|
|
12091
11989
|
decantr setup [--project <path>]
|
|
12092
11990
|
decantr scan [--project <path>] [--json]
|
|
12093
|
-
decantr new <name> [--blueprint=X] [--archetype=X] [--theme=X] [--workflow=greenfield] [--adoption=decantr-css] [--telemetry]
|
|
11991
|
+
decantr new <name> [--blueprint=X] [--archetype=X] [--theme=X] [--workflow=greenfield] [--adoption=contract-only|decantr-css] [--telemetry]
|
|
12094
11992
|
decantr adopt [--project <path>] [--base-url <url>] [--evidence] [--ci] [--no-packs] [--yes]
|
|
12095
11993
|
decantr task <route> ["task summary"] [--project <path>] [--since origin/main] [--json]
|
|
12096
11994
|
decantr verify [--project <path>] [--brownfield] [--local-patterns] [health options]
|
|
@@ -12122,11 +12020,9 @@ ${BOLD11}Advanced primitives:${RESET18}
|
|
|
12122
12020
|
decantr get <type> <id>
|
|
12123
12021
|
decantr list <type> [--sort <recommended|recent|name>] [--recommended] [--source <authored|benchmark|hybrid>]
|
|
12124
12022
|
decantr showcase [manifest|shortlist|verification] [--json]
|
|
12125
|
-
decantr
|
|
12126
|
-
decantr
|
|
12127
|
-
decantr
|
|
12128
|
-
decantr registry critique-file <file> [--namespace <namespace>] [--json] [--essence <path>] [--treatments <path>]
|
|
12129
|
-
decantr registry audit-project [--namespace <namespace>] [--json] [--essence <path>] [--dist <path>] [--sources <dir>]
|
|
12023
|
+
decantr content summary [--namespace <namespace>] [--json]
|
|
12024
|
+
decantr content compile-packs [path] [--namespace <namespace>] [--json] [--write-context]
|
|
12025
|
+
decantr content get-pack <manifest|scaffold|review|section|page|mutation> [id] [--namespace <namespace>] [--json] [--essence <path>] [--write-context]
|
|
12130
12026
|
decantr health [--format text|json|markdown] [--ci] [--fail-on error|warn|none]
|
|
12131
12027
|
decantr health --evidence [--browser] [--base-url <url>] [--design-tokens <path>]
|
|
12132
12028
|
decantr health --diagnostics [--json|--markdown]
|
|
@@ -12170,7 +12066,7 @@ ${BOLD11}Init Options:${RESET18}
|
|
|
12170
12066
|
--existing Initialize in existing project
|
|
12171
12067
|
--offline Force offline mode
|
|
12172
12068
|
--yes, -y Accept defaults, skip confirmations
|
|
12173
|
-
--registry Custom
|
|
12069
|
+
--registry Custom API URL (legacy alias; prefer DECANTR_API_URL)
|
|
12174
12070
|
--telemetry Opt this project into privacy-filtered CLI product telemetry
|
|
12175
12071
|
|
|
12176
12072
|
${BOLD11}Commands:${RESET18}
|
|
@@ -12187,7 +12083,7 @@ ${BOLD11}Commands:${RESET18}
|
|
|
12187
12083
|
${cyan4("connect")} Connect Decantr to AI coding tools such as Cursor
|
|
12188
12084
|
${cyan4("codify")} Propose or accept project-owned Brownfield UI patterns, behavior obligations, and rules
|
|
12189
12085
|
${cyan4("studio")} Open a local Project Health dashboard backed by the same report
|
|
12190
|
-
${cyan4("content")}
|
|
12086
|
+
${cyan4("content")} Official content-corpus namespace: check, summary, packs, create
|
|
12191
12087
|
|
|
12192
12088
|
${BOLD11}Advanced commands:${RESET18}
|
|
12193
12089
|
${cyan4("magic")} Greenfield-first intent flow; steers existing apps into analyze + init
|
|
@@ -12203,7 +12099,7 @@ ${BOLD11}Advanced commands:${RESET18}
|
|
|
12203
12099
|
${cyan4("sync-drift")} Review and resolve drift log entries
|
|
12204
12100
|
${cyan4("resolve")} Group source-vs-contract conflicts and print exact resolution actions
|
|
12205
12101
|
${cyan4("graph")} Generate .decantr/graph snapshot, history, manifest, diff, and contract capsule
|
|
12206
|
-
${cyan4("search")} Search official
|
|
12102
|
+
${cyan4("search")} Search official content-corpus vocabulary
|
|
12207
12103
|
${cyan4("suggest")} Suggest patterns or alternatives for a query
|
|
12208
12104
|
${cyan4("get")} Get full details of a vocabulary item
|
|
12209
12105
|
${cyan4("list")} List items by type
|
|
@@ -12211,9 +12107,9 @@ ${BOLD11}Advanced commands:${RESET18}
|
|
|
12211
12107
|
${cyan4("validate")} Validate an Essence v4 file
|
|
12212
12108
|
${cyan4("theme")} Manage custom themes (create, list, validate, delete, import)
|
|
12213
12109
|
${cyan4("create")} Create a custom content item (pattern, theme, blueprint, etc.)
|
|
12214
|
-
${cyan4("publish")}
|
|
12215
|
-
${cyan4("login")}
|
|
12216
|
-
${cyan4("logout")} Remove stored credentials
|
|
12110
|
+
${cyan4("publish")} Legacy retired hosted publishing command
|
|
12111
|
+
${cyan4("login")} Legacy API-key helper for compatibility scripts
|
|
12112
|
+
${cyan4("logout")} Remove stored legacy credentials
|
|
12217
12113
|
${cyan4("analyze")} Brownfield entrypoint: scan an existing project and emit attach guidance
|
|
12218
12114
|
${cyan4("telemetry")} Inspect or link this project's opted-in CLI telemetry identity
|
|
12219
12115
|
${cyan4("export")} Export design tokens to framework format (shadcn, tailwind, css-vars)
|
|
@@ -12228,6 +12124,7 @@ ${BOLD11}Examples:${RESET18}
|
|
|
12228
12124
|
decantr scan
|
|
12229
12125
|
decantr scan --json
|
|
12230
12126
|
decantr new my-app --blueprint=carbon-ai-portal
|
|
12127
|
+
decantr new my-app --blueprint=carbon-ai-portal --adoption=decantr-css
|
|
12231
12128
|
decantr adopt --yes
|
|
12232
12129
|
decantr adopt --project apps/web --yes
|
|
12233
12130
|
decantr task /feed "add saved recipe actions"
|
|
@@ -12280,18 +12177,16 @@ ${BOLD11}Examples:${RESET18}
|
|
|
12280
12177
|
decantr list patterns
|
|
12281
12178
|
decantr showcase shortlist
|
|
12282
12179
|
decantr showcase verification --json
|
|
12283
|
-
decantr
|
|
12284
|
-
decantr
|
|
12285
|
-
decantr
|
|
12286
|
-
decantr
|
|
12287
|
-
decantr
|
|
12288
|
-
decantr registry critique-file src/pages/Home.tsx --namespace @official --json
|
|
12289
|
-
decantr registry audit-project --namespace @official --json
|
|
12290
|
-
decantr registry audit-project --namespace @official --dist dist --sources src
|
|
12180
|
+
decantr content summary --namespace @official
|
|
12181
|
+
decantr content compile-packs decantr.essence.json --json
|
|
12182
|
+
decantr content compile-packs decantr.essence.json --write-context
|
|
12183
|
+
decantr content get-pack manifest --namespace @official --json
|
|
12184
|
+
decantr content get-pack review --namespace @official --write-context
|
|
12291
12185
|
decantr create pattern my-card
|
|
12292
12186
|
|
|
12293
12187
|
${BOLD11}Workflow Model:${RESET18}
|
|
12294
|
-
${cyan4("Greenfield blueprint")} decantr new my-app --blueprint=X --workflow=greenfield --adoption=
|
|
12188
|
+
${cyan4("Greenfield blueprint")} decantr new my-app --blueprint=X --workflow=greenfield --adoption=contract-only
|
|
12189
|
+
${cyan4("Legacy CSS adapter")} decantr new my-app --blueprint=X --adoption=decantr-css
|
|
12295
12190
|
${cyan4("Greenfield contract")} decantr init --workflow=greenfield --adoption=contract-only
|
|
12296
12191
|
${cyan4("Brownfield adoption")} decantr adopt --yes
|
|
12297
12192
|
${cyan4("Brownfield preview")} decantr scan -> decantr adopt --yes
|
|
@@ -12301,10 +12196,10 @@ ${BOLD11}Workflow Model:${RESET18}
|
|
|
12301
12196
|
${cyan4("Drift resolution")} decantr resolve -> codify/init/graph/repair source explicitly
|
|
12302
12197
|
${cyan4("Typed contract graph")} decantr graph -> agent session loads .decantr/graph/contract-capsule.json
|
|
12303
12198
|
${cyan4("Project-owned law")} decantr codify --from-audit -> edit proposal -> decantr codify --accept
|
|
12304
|
-
${cyan4("Hybrid composition")} decantr add/remove, decantr theme switch, decantr
|
|
12199
|
+
${cyan4("Hybrid composition")} decantr add/remove, decantr theme switch, decantr content, decantr upgrade
|
|
12305
12200
|
|
|
12306
12201
|
${BOLD11}Bootstrap adapters:${RESET18}
|
|
12307
|
-
Runnable starter adapters: ${cyan4("react-vite")}, ${cyan4("next-app")}, ${cyan4("vanilla-vite")}, ${cyan4("vue-vite")}, ${cyan4("sveltekit")}, ${cyan4("angular")}, ${cyan4("solid-vite")}
|
|
12202
|
+
Runnable starter adapters are legacy opt-in via ${cyan4("--adoption=decantr-css")}: ${cyan4("react-vite")}, ${cyan4("next-app")}, ${cyan4("vanilla-vite")}, ${cyan4("vue-vite")}, ${cyan4("sveltekit")}, ${cyan4("angular")}, ${cyan4("solid-vite")}
|
|
12308
12203
|
Unsupported targets resolve through ${cyan4("generic-web")} contract-only mode until their starter adapters land.
|
|
12309
12204
|
`);
|
|
12310
12205
|
}
|
|
@@ -12477,15 +12372,15 @@ ${BOLD11}Examples:${RESET18}
|
|
|
12477
12372
|
}
|
|
12478
12373
|
function cmdRegistryHelp() {
|
|
12479
12374
|
console.log(`
|
|
12480
|
-
${BOLD11}decantr registry${RESET18} \u2014
|
|
12375
|
+
${BOLD11}decantr registry${RESET18} \u2014 Legacy compatibility alias for content-corpus helpers
|
|
12481
12376
|
|
|
12482
12377
|
${BOLD11}Usage:${RESET18}
|
|
12483
12378
|
decantr registry summary [--namespace <namespace>] [--json]
|
|
12484
12379
|
decantr registry compile-packs [path] [--namespace <namespace>] [--json] [--write-context]
|
|
12485
12380
|
decantr registry get-pack <manifest|scaffold|review|section|page|mutation> [id] [--namespace <namespace>] [--json] [--essence <path>] [--write-context]
|
|
12486
12381
|
decantr registry get-pack page --route <route> [--namespace <namespace>] [--json] [--essence <path>]
|
|
12487
|
-
|
|
12488
|
-
|
|
12382
|
+
|
|
12383
|
+
Prefer the equivalent decantr content commands for new scripts.
|
|
12489
12384
|
`);
|
|
12490
12385
|
}
|
|
12491
12386
|
function cmdThemeHelp() {
|
|
@@ -12628,17 +12523,20 @@ ${BOLD11}Examples:${RESET18}
|
|
|
12628
12523
|
}
|
|
12629
12524
|
function cmdContentHelp() {
|
|
12630
12525
|
console.log(`
|
|
12631
|
-
${BOLD11}decantr content${RESET18} \u2014
|
|
12526
|
+
${BOLD11}decantr content${RESET18} \u2014 Official content-corpus namespace
|
|
12632
12527
|
|
|
12633
12528
|
${BOLD11}Usage:${RESET18}
|
|
12634
12529
|
decantr content check [content-health options]
|
|
12530
|
+
decantr content summary [--namespace <namespace>] [--json]
|
|
12531
|
+
decantr content compile-packs [path] [--namespace <namespace>] [--json] [--write-context]
|
|
12532
|
+
decantr content get-pack <manifest|scaffold|review|section|page|mutation> [id] [--namespace <namespace>] [--json] [--essence <path>] [--write-context]
|
|
12635
12533
|
decantr content create <type> <name>
|
|
12636
|
-
decantr content publish <type> <name>
|
|
12637
12534
|
|
|
12638
12535
|
${BOLD11}Examples:${RESET18}
|
|
12639
12536
|
decantr content check --ci --fail-on error
|
|
12537
|
+
decantr content summary --namespace @official --json
|
|
12538
|
+
decantr content compile-packs decantr.essence.json --write-context
|
|
12640
12539
|
decantr content create pattern my-card
|
|
12641
|
-
decantr content publish pattern my-card
|
|
12642
12540
|
`);
|
|
12643
12541
|
}
|
|
12644
12542
|
function printCommandHelp(command, args) {
|
|
@@ -12715,11 +12613,11 @@ async function main() {
|
|
|
12715
12613
|
}
|
|
12716
12614
|
if (command === "--version" || command === "-v" || command === "version") {
|
|
12717
12615
|
try {
|
|
12718
|
-
const here =
|
|
12719
|
-
const candidates = [
|
|
12616
|
+
const here = dirname8(fileURLToPath4(import.meta.url));
|
|
12617
|
+
const candidates = [join31(here, "..", "package.json"), join31(here, "..", "..", "package.json")];
|
|
12720
12618
|
for (const candidate of candidates) {
|
|
12721
|
-
if (
|
|
12722
|
-
const pkg = JSON.parse(
|
|
12619
|
+
if (existsSync28(candidate)) {
|
|
12620
|
+
const pkg = JSON.parse(readFileSync21(candidate, "utf-8"));
|
|
12723
12621
|
if (pkg.version) {
|
|
12724
12622
|
console.log(pkg.version);
|
|
12725
12623
|
return;
|
|
@@ -12916,7 +12814,7 @@ async function main() {
|
|
|
12916
12814
|
break;
|
|
12917
12815
|
}
|
|
12918
12816
|
case "upgrade": {
|
|
12919
|
-
const { cmdUpgrade } = await import("./upgrade-
|
|
12817
|
+
const { cmdUpgrade } = await import("./upgrade-NN7NTA4L.js");
|
|
12920
12818
|
const { flags } = parseLooseArgs(args);
|
|
12921
12819
|
const workspaceInfo = resolveWorkflowProject(flags, "upgrade");
|
|
12922
12820
|
if (!workspaceInfo) break;
|
|
@@ -12970,7 +12868,7 @@ async function main() {
|
|
|
12970
12868
|
cmdContentHealthHelp();
|
|
12971
12869
|
break;
|
|
12972
12870
|
}
|
|
12973
|
-
const { cmdContentHealth, parseContentHealthArgs } = await import("./content-health-
|
|
12871
|
+
const { cmdContentHealth, parseContentHealthArgs } = await import("./content-health-TDV4LP2C.js");
|
|
12974
12872
|
await cmdContentHealth(process.cwd(), parseContentHealthArgs(args));
|
|
12975
12873
|
} catch (e) {
|
|
12976
12874
|
console.error(error2(e.message));
|
|
@@ -13033,7 +12931,8 @@ async function main() {
|
|
|
13033
12931
|
break;
|
|
13034
12932
|
}
|
|
13035
12933
|
case "audit": {
|
|
13036
|
-
|
|
12934
|
+
const filePath = args[1] && !args[1].startsWith("--") ? args[1] : void 0;
|
|
12935
|
+
await cmdAudit(filePath, { json: args.includes("--json") });
|
|
13037
12936
|
break;
|
|
13038
12937
|
}
|
|
13039
12938
|
case "search": {
|
|
@@ -13283,59 +13182,12 @@ async function main() {
|
|
|
13283
13182
|
const mirrorType = typeIdx !== -1 ? args[typeIdx + 1] : void 0;
|
|
13284
13183
|
await cmdRegistryMirror(process.cwd(), { type: mirrorType });
|
|
13285
13184
|
} else if (subcommand === "summary") {
|
|
13286
|
-
|
|
13287
|
-
const namespace = namespaceIdx !== -1 ? args[namespaceIdx + 1] : void 0;
|
|
13288
|
-
const jsonOutput = args.includes("--json");
|
|
13289
|
-
await printRegistryIntelligenceSummary(namespace, jsonOutput);
|
|
13185
|
+
await cmdContentCorpusWorkflow(args, "registry");
|
|
13290
13186
|
} else if (subcommand === "compile-packs") {
|
|
13291
|
-
|
|
13292
|
-
const namespace = namespaceIdx !== -1 ? args[namespaceIdx + 1] : void 0;
|
|
13293
|
-
const jsonOutput = args.includes("--json");
|
|
13294
|
-
const writeContext = args.includes("--write-context");
|
|
13295
|
-
const essencePath = args[2] && !args[2].startsWith("--") ? args[2] : void 0;
|
|
13296
|
-
await printHostedExecutionPackBundle(essencePath, namespace, jsonOutput, writeContext);
|
|
13187
|
+
await cmdContentCorpusWorkflow(args, "registry");
|
|
13297
13188
|
} else if (subcommand === "get-pack") {
|
|
13298
|
-
|
|
13299
|
-
const namespace = namespaceIdx !== -1 ? args[namespaceIdx + 1] : void 0;
|
|
13300
|
-
const jsonOutput = args.includes("--json");
|
|
13301
|
-
const writeContext = args.includes("--write-context");
|
|
13302
|
-
const essenceIdx = args.indexOf("--essence");
|
|
13303
|
-
const essencePath = essenceIdx !== -1 ? args[essenceIdx + 1] : void 0;
|
|
13304
|
-
const packType = args[2] && !args[2].startsWith("--") ? args[2] : void 0;
|
|
13305
|
-
const routeIdx = args.indexOf("--route");
|
|
13306
|
-
const route = routeIdx !== -1 ? args[routeIdx + 1] : void 0;
|
|
13307
|
-
let id = args[3] && !args[3].startsWith("--") ? args[3] : void 0;
|
|
13308
|
-
if (!packType || !["manifest", "scaffold", "review", "section", "page", "mutation"].includes(packType)) {
|
|
13309
|
-
console.error(
|
|
13310
|
-
`${RED13}Usage: decantr registry get-pack <manifest|scaffold|review|section|page|mutation> [id] [--namespace <namespace>] [--json] [--essence <path>] [--write-context]${RESET18}`
|
|
13311
|
-
);
|
|
13312
|
-
process.exitCode = 1;
|
|
13313
|
-
break;
|
|
13314
|
-
}
|
|
13315
|
-
if (packType === "manifest") {
|
|
13316
|
-
await printHostedExecutionPackManifest(essencePath, namespace, jsonOutput, writeContext);
|
|
13317
|
-
break;
|
|
13318
|
-
}
|
|
13319
|
-
if (packType === "page" && route && !id) {
|
|
13320
|
-
const resolvedPath = essencePath ? resolveUserPath(essencePath) : join32(process.cwd(), "decantr.essence.json");
|
|
13321
|
-
id = resolvePagePackIdForRoute(resolvedPath, route);
|
|
13322
|
-
}
|
|
13323
|
-
await printHostedSelectedExecutionPack(
|
|
13324
|
-
packType,
|
|
13325
|
-
id,
|
|
13326
|
-
essencePath,
|
|
13327
|
-
namespace,
|
|
13328
|
-
jsonOutput,
|
|
13329
|
-
writeContext
|
|
13330
|
-
);
|
|
13189
|
+
await cmdContentCorpusWorkflow(args, "registry");
|
|
13331
13190
|
} else if (subcommand === "critique-file") {
|
|
13332
|
-
const namespaceIdx = args.indexOf("--namespace");
|
|
13333
|
-
const namespace = namespaceIdx !== -1 ? args[namespaceIdx + 1] : void 0;
|
|
13334
|
-
const jsonOutput = args.includes("--json");
|
|
13335
|
-
const essenceIdx = args.indexOf("--essence");
|
|
13336
|
-
const essencePath = essenceIdx !== -1 ? args[essenceIdx + 1] : void 0;
|
|
13337
|
-
const treatmentsIdx = args.indexOf("--treatments");
|
|
13338
|
-
const treatmentsPath = treatmentsIdx !== -1 ? args[treatmentsIdx + 1] : void 0;
|
|
13339
13191
|
const sourcePath = args[2] && !args[2].startsWith("--") ? args[2] : void 0;
|
|
13340
13192
|
if (!sourcePath) {
|
|
13341
13193
|
console.error(
|
|
@@ -13344,27 +13196,14 @@ async function main() {
|
|
|
13344
13196
|
process.exitCode = 1;
|
|
13345
13197
|
break;
|
|
13346
13198
|
}
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
namespace,
|
|
13350
|
-
jsonOutput,
|
|
13351
|
-
essencePath,
|
|
13352
|
-
treatmentsPath
|
|
13353
|
-
);
|
|
13199
|
+
console.error(dim4("Hosted registry critique is retired; running local decantr audit instead."));
|
|
13200
|
+
await cmdAudit(sourcePath, { json: args.includes("--json") });
|
|
13354
13201
|
} else if (subcommand === "audit-project") {
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
const jsonOutput = args.includes("--json");
|
|
13358
|
-
const essenceIdx = args.indexOf("--essence");
|
|
13359
|
-
const essencePath = essenceIdx !== -1 ? args[essenceIdx + 1] : void 0;
|
|
13360
|
-
const distIdx = args.indexOf("--dist");
|
|
13361
|
-
const distPath = distIdx !== -1 ? args[distIdx + 1] : void 0;
|
|
13362
|
-
const sourcesIdx = args.indexOf("--sources");
|
|
13363
|
-
const sourcesPath = sourcesIdx !== -1 ? args[sourcesIdx + 1] : void 0;
|
|
13364
|
-
await printHostedProjectAudit(namespace, jsonOutput, essencePath, distPath, sourcesPath);
|
|
13202
|
+
console.error(dim4("Hosted registry project audit is retired; running local decantr audit instead."));
|
|
13203
|
+
await cmdAudit(void 0, { json: args.includes("--json") });
|
|
13365
13204
|
} else {
|
|
13366
13205
|
console.error(
|
|
13367
|
-
`${RED13}Usage: decantr registry mirror [--type <type>] | decantr registry summary [--namespace <namespace>] [--json] | decantr registry compile-packs [path] [--namespace <namespace>] [--json] [--write-context] | decantr registry get-pack <manifest|scaffold|review|section|page|mutation> [id] [--namespace <namespace>] [--json] [--essence <path>] [--write-context]
|
|
13206
|
+
`${RED13}Usage: decantr registry mirror [--type <type>] | decantr registry summary [--namespace <namespace>] [--json] | decantr registry compile-packs [path] [--namespace <namespace>] [--json] [--write-context] | decantr registry get-pack <manifest|scaffold|review|section|page|mutation> [id] [--namespace <namespace>] [--json] [--essence <path>] [--write-context]${RESET18}`
|
|
13368
13207
|
);
|
|
13369
13208
|
process.exitCode = 1;
|
|
13370
13209
|
}
|
|
@@ -13515,7 +13354,7 @@ async function main() {
|
|
|
13515
13354
|
mcpOnly: flagBoolean(flags, "mcp-only"),
|
|
13516
13355
|
rulesOnly: flagBoolean(flags, "rules-only"),
|
|
13517
13356
|
routeHint,
|
|
13518
|
-
attached:
|
|
13357
|
+
attached: existsSync28(join31(workspaceInfo.appRoot, "decantr.essence.json"))
|
|
13519
13358
|
});
|
|
13520
13359
|
break;
|
|
13521
13360
|
}
|