@ogygie/cli 0.5.3 → 0.5.4
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/dist/cli.js +31 -20
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -14963,16 +14963,21 @@ function initProject(deps, productName2) {
|
|
|
14963
14963
|
}
|
|
14964
14964
|
|
|
14965
14965
|
// src/commands/studio.ts
|
|
14966
|
+
import { createRequire } from "node:module";
|
|
14967
|
+
import { join as join4 } from "node:path";
|
|
14968
|
+
import { pathToFileURL } from "node:url";
|
|
14966
14969
|
var PUBLISHED_STUDIO_SERVER = "@ogygie/studio/server";
|
|
14967
|
-
async function
|
|
14968
|
-
|
|
14970
|
+
async function loadStudioFrom(projectRoot) {
|
|
14971
|
+
const resolveFromProject = createRequire(join4(projectRoot, "package.json"));
|
|
14972
|
+
const entryPoint = resolveFromProject.resolve(PUBLISHED_STUDIO_SERVER);
|
|
14973
|
+
return await import(pathToFileURL(entryPoint).href);
|
|
14969
14974
|
}
|
|
14970
14975
|
function isModuleNotFound(thrown) {
|
|
14971
14976
|
const code = thrown?.code;
|
|
14972
14977
|
return code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED" || typeof thrown === "object" && thrown !== null && thrown instanceof Error && /Cannot find (package|module)/i.test(thrown.message);
|
|
14973
14978
|
}
|
|
14974
14979
|
async function runStudio(deps) {
|
|
14975
|
-
const importStudio = deps.importStudio ??
|
|
14980
|
+
const importStudio = deps.importStudio ?? (() => loadStudioFrom(deps.projectRoot));
|
|
14976
14981
|
let studioServer;
|
|
14977
14982
|
try {
|
|
14978
14983
|
studioServer = await importStudio();
|
|
@@ -15003,7 +15008,7 @@ async function runStudio(deps) {
|
|
|
15003
15008
|
|
|
15004
15009
|
// src/commands/upgrade.ts
|
|
15005
15010
|
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
15006
|
-
import { dirname as dirname2, join as
|
|
15011
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
15007
15012
|
|
|
15008
15013
|
// src/diff.ts
|
|
15009
15014
|
function diffLines(oldText, newText) {
|
|
@@ -15071,7 +15076,7 @@ function compareVersions(a, b) {
|
|
|
15071
15076
|
|
|
15072
15077
|
// src/commands/upgrade.ts
|
|
15073
15078
|
function reportMissingGates(deps) {
|
|
15074
|
-
const packageJsonPath =
|
|
15079
|
+
const packageJsonPath = join5(deps.projectRoot, "package.json");
|
|
15075
15080
|
if (!existsSync4(packageJsonPath)) return;
|
|
15076
15081
|
let scripts;
|
|
15077
15082
|
try {
|
|
@@ -15126,7 +15131,7 @@ async function upgradeProject(deps) {
|
|
|
15126
15131
|
for (const governed of governedFiles) {
|
|
15127
15132
|
const expected = installedChecksums[governed.targetPath];
|
|
15128
15133
|
if (expected === void 0) continue;
|
|
15129
|
-
const absolutePath =
|
|
15134
|
+
const absolutePath = join5(deps.projectRoot, governed.targetPath);
|
|
15130
15135
|
const actual = existsSync4(absolutePath) ? sha256Hex(readFileSync4(absolutePath, "utf8")) : "<absent>";
|
|
15131
15136
|
if (actual !== expected) {
|
|
15132
15137
|
throwOgygieError({
|
|
@@ -15142,10 +15147,10 @@ async function upgradeProject(deps) {
|
|
|
15142
15147
|
const diffBlocks = [];
|
|
15143
15148
|
for (const governed of governedFiles) {
|
|
15144
15149
|
const content = readFileSync4(
|
|
15145
|
-
|
|
15150
|
+
join5(deps.templatesDir, governed.templatePath),
|
|
15146
15151
|
"utf8"
|
|
15147
15152
|
);
|
|
15148
|
-
const absolutePath =
|
|
15153
|
+
const absolutePath = join5(deps.projectRoot, governed.targetPath);
|
|
15149
15154
|
const current = existsSync4(absolutePath) ? readFileSync4(absolutePath, "utf8") : "";
|
|
15150
15155
|
const diff = diffLines(current, content);
|
|
15151
15156
|
if (diff !== "") {
|
|
@@ -15166,7 +15171,7 @@ ${diff}`);
|
|
|
15166
15171
|
};
|
|
15167
15172
|
}
|
|
15168
15173
|
for (const write of plannedWrites) {
|
|
15169
|
-
const absolutePath =
|
|
15174
|
+
const absolutePath = join5(deps.projectRoot, write.targetPath);
|
|
15170
15175
|
mkdirSync2(dirname2(absolutePath), { recursive: true });
|
|
15171
15176
|
writeFileSync3(absolutePath, write.content);
|
|
15172
15177
|
}
|
|
@@ -15188,7 +15193,7 @@ ${diff}`);
|
|
|
15188
15193
|
|
|
15189
15194
|
// src/commands/verify-vocabulary.ts
|
|
15190
15195
|
import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
|
|
15191
|
-
import { join as
|
|
15196
|
+
import { join as join6, relative, sep } from "node:path";
|
|
15192
15197
|
|
|
15193
15198
|
// ../ogygie-core/src/vocabulary.ts
|
|
15194
15199
|
var TOKEN_PATTERN = new RegExp("\\p{L}[\\p{L}\\p{N}]*(?:[-_$][\\p{L}\\p{N}]+)*", "gu");
|
|
@@ -15295,7 +15300,7 @@ function auditProductVocabulary(input) {
|
|
|
15295
15300
|
var CODE_EXTENSIONS = [".ts", ".tsx", ".mts", ".mjs", ".js", ".jsx"];
|
|
15296
15301
|
var IGNORED_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".git", "coverage"]);
|
|
15297
15302
|
function readManifest(projectRoot) {
|
|
15298
|
-
const manifestPath =
|
|
15303
|
+
const manifestPath = join6(projectRoot, MANIFEST_FILE_NAME);
|
|
15299
15304
|
if (!existsSync5(manifestPath)) {
|
|
15300
15305
|
throwOgygieError({
|
|
15301
15306
|
code: "OGYGIE_CLI_USAGE",
|
|
@@ -15320,13 +15325,13 @@ function readManifest(projectRoot) {
|
|
|
15320
15325
|
return parsed.data;
|
|
15321
15326
|
}
|
|
15322
15327
|
function collectCodeFiles(projectRoot, folder) {
|
|
15323
|
-
const absoluteFolder =
|
|
15328
|
+
const absoluteFolder = join6(projectRoot, folder);
|
|
15324
15329
|
if (!existsSync5(absoluteFolder)) return [];
|
|
15325
15330
|
const files = [];
|
|
15326
15331
|
const walk = (directory) => {
|
|
15327
15332
|
for (const entry of readdirSync2(directory)) {
|
|
15328
15333
|
if (IGNORED_DIRS.has(entry)) continue;
|
|
15329
|
-
const entryPath =
|
|
15334
|
+
const entryPath = join6(directory, entry);
|
|
15330
15335
|
if (statSync2(entryPath).isDirectory()) {
|
|
15331
15336
|
walk(entryPath);
|
|
15332
15337
|
continue;
|
|
@@ -15362,9 +15367,9 @@ function verifyVocabulary(deps) {
|
|
|
15362
15367
|
const sourceFiles = productCodeFoldersOf(manifest).flatMap(
|
|
15363
15368
|
(folder) => collectCodeFiles(deps.projectRoot, folder)
|
|
15364
15369
|
);
|
|
15365
|
-
const governed = governedFiles.filter((file2) => existsSync5(
|
|
15370
|
+
const governed = governedFiles.filter((file2) => existsSync5(join6(deps.projectRoot, file2.targetPath))).map((file2) => ({
|
|
15366
15371
|
path: file2.targetPath,
|
|
15367
|
-
content: readFileSync5(
|
|
15372
|
+
content: readFileSync5(join6(deps.projectRoot, file2.targetPath), "utf8")
|
|
15368
15373
|
}));
|
|
15369
15374
|
return auditProductVocabulary({
|
|
15370
15375
|
vocabulary: manifest.vocabulary,
|
|
@@ -15436,27 +15441,33 @@ var governedChecksumsByVersion = {
|
|
|
15436
15441
|
"AGENTS.md": "c7d51a0cd97b67343b486bdb7c54914da68d96409eaa985959d2a525c65549fd",
|
|
15437
15442
|
"CLAUDE.md": "785ee8d90e368806d8cf0b4d84a15f29d1dc961168bda86cf1a6c60a923c8c9b",
|
|
15438
15443
|
"tsconfig.base.json": "0f8919e9ed8bbc88e0308fa2fa91471dabb18d1df721bd78c04076597eba89a2"
|
|
15444
|
+
},
|
|
15445
|
+
"0.5.4": {
|
|
15446
|
+
".github/workflows/ogygie-gates.yml": "48c40efe9fe66dd0f9c3b94287026d80eae9afd6782b5833fdf8846d8662babf",
|
|
15447
|
+
"AGENTS.md": "c7d51a0cd97b67343b486bdb7c54914da68d96409eaa985959d2a525c65549fd",
|
|
15448
|
+
"CLAUDE.md": "785ee8d90e368806d8cf0b4d84a15f29d1dc961168bda86cf1a6c60a923c8c9b",
|
|
15449
|
+
"tsconfig.base.json": "0f8919e9ed8bbc88e0308fa2fa91471dabb18d1df721bd78c04076597eba89a2"
|
|
15439
15450
|
}
|
|
15440
15451
|
};
|
|
15441
15452
|
|
|
15442
15453
|
// src/paths.ts
|
|
15443
15454
|
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
|
|
15444
|
-
import { dirname as dirname3, join as
|
|
15455
|
+
import { dirname as dirname3, join as join7 } from "node:path";
|
|
15445
15456
|
import { fileURLToPath } from "node:url";
|
|
15446
|
-
var PACKAGE_ROOT =
|
|
15457
|
+
var PACKAGE_ROOT = join7(dirname3(fileURLToPath(import.meta.url)), "..");
|
|
15447
15458
|
var PackageVersionSchema2 = external_exports.object({ version: external_exports.string() });
|
|
15448
15459
|
function cliVersion() {
|
|
15449
15460
|
return PackageVersionSchema2.parse(
|
|
15450
|
-
JSON.parse(readFileSync6(
|
|
15461
|
+
JSON.parse(readFileSync6(join7(PACKAGE_ROOT, "package.json"), "utf8"))
|
|
15451
15462
|
).version;
|
|
15452
15463
|
}
|
|
15453
15464
|
function templatesDir() {
|
|
15454
|
-
const embedded =
|
|
15465
|
+
const embedded = join7(PACKAGE_ROOT, "templates");
|
|
15455
15466
|
if (existsSync6(embedded)) return embedded;
|
|
15456
15467
|
return repoTemplatesDir();
|
|
15457
15468
|
}
|
|
15458
15469
|
function repoTemplatesDir() {
|
|
15459
|
-
return
|
|
15470
|
+
return join7(PACKAGE_ROOT, "..", "..", "templates");
|
|
15460
15471
|
}
|
|
15461
15472
|
|
|
15462
15473
|
// src/cli.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogygie/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Ogygie framework CLI: deterministic scaffolding (init), governed-file upgrades (upgrade) and lockstep verification (check) for Ogygie products.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"tsx": "^4.20.0",
|
|
23
23
|
"typescript": "^5.8.0",
|
|
24
24
|
"zod": "^4.0.0",
|
|
25
|
-
"@ogygie/core": "0.5.
|
|
25
|
+
"@ogygie/core": "0.5.4"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"typecheck": "tsc -p tsconfig.json",
|