@ogygie/cli 0.5.2 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +51 -22
  2. 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 loadPublishedStudio() {
14968
- return await import(PUBLISHED_STUDIO_SERVER);
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 ?? loadPublishedStudio;
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 join4 } from "node:path";
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 = join4(deps.projectRoot, "package.json");
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 = join4(deps.projectRoot, governed.targetPath);
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
- join4(deps.templatesDir, governed.templatePath),
15150
+ join5(deps.templatesDir, governed.templatePath),
15146
15151
  "utf8"
15147
15152
  );
15148
- const absolutePath = join4(deps.projectRoot, governed.targetPath);
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 = join4(deps.projectRoot, write.targetPath);
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 join5, relative, sep } from "node:path";
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");
@@ -15237,9 +15242,20 @@ function findProductVocabulary(sourceText, vocabularyRoots) {
15237
15242
  return matches;
15238
15243
  }
15239
15244
  function stripComments(sourceText) {
15240
- const blankKeepingNewlines = (text) => text.replace(/[^\n]/g, " ");
15241
15245
  return sourceText.replace(/\/\*[\s\S]*?\*\//g, blankKeepingNewlines).replace(/\/\/[^\n]*/g, blankKeepingNewlines);
15242
15246
  }
15247
+ function blankKeepingNewlines(text) {
15248
+ return text.replace(/[^\n]/g, " ");
15249
+ }
15250
+ var MACHINE_STRING_CONTENT = /^[A-Za-z0-9_$\-./:@]+$/;
15251
+ function stripProseStrings(sourceText) {
15252
+ const blankProse = (literal2) => {
15253
+ const content = literal2.slice(1, -1);
15254
+ if (MACHINE_STRING_CONTENT.test(content)) return literal2;
15255
+ return literal2[0] + blankKeepingNewlines(content) + literal2[literal2.length - 1];
15256
+ };
15257
+ return sourceText.replace(/`(?:[^`\\]|\\[\s\S])*`/g, blankProse).replace(/"(?:[^"\\\n]|\\.)*"/g, blankProse).replace(/'(?:[^'\\\n]|\\.)*'/g, blankProse);
15258
+ }
15243
15259
 
15244
15260
  // ../ogygie-core/src/vocabulary-audit.ts
15245
15261
  function canonicalByAlias(vocabulary) {
@@ -15257,7 +15273,8 @@ function auditProductVocabulary(input) {
15257
15273
  const canonicalTerms = vocabulary.entries.map((entry) => entry.canonical);
15258
15274
  const violations = [];
15259
15275
  for (const file2 of input.sourceFiles) {
15260
- for (const match of findProductVocabulary(stripComments(file2.content), forbiddenAliases)) {
15276
+ const judged = stripProseStrings(stripComments(file2.content));
15277
+ for (const match of findProductVocabulary(judged, forbiddenAliases)) {
15261
15278
  violations.push({
15262
15279
  kind: "FORBIDDEN_ALIAS",
15263
15280
  filePath: file2.path,
@@ -15283,7 +15300,7 @@ function auditProductVocabulary(input) {
15283
15300
  var CODE_EXTENSIONS = [".ts", ".tsx", ".mts", ".mjs", ".js", ".jsx"];
15284
15301
  var IGNORED_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".git", "coverage"]);
15285
15302
  function readManifest(projectRoot) {
15286
- const manifestPath = join5(projectRoot, MANIFEST_FILE_NAME);
15303
+ const manifestPath = join6(projectRoot, MANIFEST_FILE_NAME);
15287
15304
  if (!existsSync5(manifestPath)) {
15288
15305
  throwOgygieError({
15289
15306
  code: "OGYGIE_CLI_USAGE",
@@ -15308,13 +15325,13 @@ function readManifest(projectRoot) {
15308
15325
  return parsed.data;
15309
15326
  }
15310
15327
  function collectCodeFiles(projectRoot, folder) {
15311
- const absoluteFolder = join5(projectRoot, folder);
15328
+ const absoluteFolder = join6(projectRoot, folder);
15312
15329
  if (!existsSync5(absoluteFolder)) return [];
15313
15330
  const files = [];
15314
15331
  const walk = (directory) => {
15315
15332
  for (const entry of readdirSync2(directory)) {
15316
15333
  if (IGNORED_DIRS.has(entry)) continue;
15317
- const entryPath = join5(directory, entry);
15334
+ const entryPath = join6(directory, entry);
15318
15335
  if (statSync2(entryPath).isDirectory()) {
15319
15336
  walk(entryPath);
15320
15337
  continue;
@@ -15350,9 +15367,9 @@ function verifyVocabulary(deps) {
15350
15367
  const sourceFiles = productCodeFoldersOf(manifest).flatMap(
15351
15368
  (folder) => collectCodeFiles(deps.projectRoot, folder)
15352
15369
  );
15353
- const governed = governedFiles.filter((file2) => existsSync5(join5(deps.projectRoot, file2.targetPath))).map((file2) => ({
15370
+ const governed = governedFiles.filter((file2) => existsSync5(join6(deps.projectRoot, file2.targetPath))).map((file2) => ({
15354
15371
  path: file2.targetPath,
15355
- content: readFileSync5(join5(deps.projectRoot, file2.targetPath), "utf8")
15372
+ content: readFileSync5(join6(deps.projectRoot, file2.targetPath), "utf8")
15356
15373
  }));
15357
15374
  return auditProductVocabulary({
15358
15375
  vocabulary: manifest.vocabulary,
@@ -15418,27 +15435,39 @@ var governedChecksumsByVersion = {
15418
15435
  "AGENTS.md": "c7d51a0cd97b67343b486bdb7c54914da68d96409eaa985959d2a525c65549fd",
15419
15436
  "CLAUDE.md": "785ee8d90e368806d8cf0b4d84a15f29d1dc961168bda86cf1a6c60a923c8c9b",
15420
15437
  "tsconfig.base.json": "0f8919e9ed8bbc88e0308fa2fa91471dabb18d1df721bd78c04076597eba89a2"
15438
+ },
15439
+ "0.5.3": {
15440
+ ".github/workflows/ogygie-gates.yml": "48c40efe9fe66dd0f9c3b94287026d80eae9afd6782b5833fdf8846d8662babf",
15441
+ "AGENTS.md": "c7d51a0cd97b67343b486bdb7c54914da68d96409eaa985959d2a525c65549fd",
15442
+ "CLAUDE.md": "785ee8d90e368806d8cf0b4d84a15f29d1dc961168bda86cf1a6c60a923c8c9b",
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"
15421
15450
  }
15422
15451
  };
15423
15452
 
15424
15453
  // src/paths.ts
15425
15454
  import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
15426
- import { dirname as dirname3, join as join6 } from "node:path";
15455
+ import { dirname as dirname3, join as join7 } from "node:path";
15427
15456
  import { fileURLToPath } from "node:url";
15428
- var PACKAGE_ROOT = join6(dirname3(fileURLToPath(import.meta.url)), "..");
15457
+ var PACKAGE_ROOT = join7(dirname3(fileURLToPath(import.meta.url)), "..");
15429
15458
  var PackageVersionSchema2 = external_exports.object({ version: external_exports.string() });
15430
15459
  function cliVersion() {
15431
15460
  return PackageVersionSchema2.parse(
15432
- JSON.parse(readFileSync6(join6(PACKAGE_ROOT, "package.json"), "utf8"))
15461
+ JSON.parse(readFileSync6(join7(PACKAGE_ROOT, "package.json"), "utf8"))
15433
15462
  ).version;
15434
15463
  }
15435
15464
  function templatesDir() {
15436
- const embedded = join6(PACKAGE_ROOT, "templates");
15465
+ const embedded = join7(PACKAGE_ROOT, "templates");
15437
15466
  if (existsSync6(embedded)) return embedded;
15438
15467
  return repoTemplatesDir();
15439
15468
  }
15440
15469
  function repoTemplatesDir() {
15441
- return join6(PACKAGE_ROOT, "..", "..", "templates");
15470
+ return join7(PACKAGE_ROOT, "..", "..", "templates");
15442
15471
  }
15443
15472
 
15444
15473
  // src/cli.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ogygie/cli",
3
- "version": "0.5.2",
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.2"
25
+ "@ogygie/core": "0.5.4"
26
26
  },
27
27
  "scripts": {
28
28
  "typecheck": "tsc -p tsconfig.json",