@ogygie/cli 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +47 -6
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -14991,6 +14991,19 @@ function diffLines(oldText, newText) {
14991
14991
  return output.join("\n");
14992
14992
  }
14993
14993
 
14994
+ // src/framework-gates.ts
14995
+ var frameworkGates = [
14996
+ {
14997
+ scriptName: "ogygie:verify-vocabulary",
14998
+ command: "ogygie verify-vocabulary",
14999
+ intent: "Le vocabulaire d\xE9clar\xE9 au manifeste : alias interdits dans les identifiants, puret\xE9 des fichiers gouvern\xE9s."
15000
+ }
15001
+ ];
15002
+ function missingFrameworkGates(scripts) {
15003
+ const commands = Object.values(scripts ?? {}).join(" ; ");
15004
+ return frameworkGates.filter((gate) => !commands.includes(gate.command));
15005
+ }
15006
+
14994
15007
  // src/version.ts
14995
15008
  function compareVersions(a, b) {
14996
15009
  const partsA = a.split(".").map(Number);
@@ -15005,6 +15018,30 @@ function compareVersions(a, b) {
15005
15018
  }
15006
15019
 
15007
15020
  // src/commands/upgrade.ts
15021
+ function reportMissingGates(deps) {
15022
+ const packageJsonPath = join4(deps.projectRoot, "package.json");
15023
+ if (!existsSync4(packageJsonPath)) return;
15024
+ let scripts;
15025
+ try {
15026
+ const parsed = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
15027
+ const scriptsValue = typeof parsed === "object" && parsed !== null ? parsed.scripts : void 0;
15028
+ if (typeof scriptsValue === "object" && scriptsValue !== null) {
15029
+ scripts = scriptsValue;
15030
+ }
15031
+ } catch {
15032
+ return;
15033
+ }
15034
+ const missing = missingFrameworkGates(scripts);
15035
+ if (missing.length === 0) return;
15036
+ deps.log("");
15037
+ deps.log(
15038
+ `\u26A0 ${missing.length} gate(s) du framework ne tournent pas dans ta boucle locale (package.json n'est pas gouvern\xE9 \u2014 \xE0 toi de l'ajouter, la CI gouvern\xE9e les appelle d\xE9j\xE0) :`
15039
+ );
15040
+ for (const gate of missing) {
15041
+ deps.log(` "${gate.scriptName}": "${gate.command}" # ${gate.intent}`);
15042
+ }
15043
+ deps.log(" puis appelle ces scripts depuis ton script `verify`.");
15044
+ }
15008
15045
  async function upgradeProject(deps) {
15009
15046
  const installedVersion = readPinnedOgygieVersion(deps.projectRoot);
15010
15047
  if (compareVersions(deps.cliVersion, installedVersion) < 0) {
@@ -15013,7 +15050,7 @@ async function upgradeProject(deps) {
15013
15050
  message: `The running CLI (${deps.cliVersion}) is older than the project's ogygieVersion (${installedVersion}) \u2014 a downgrade does not exist.`,
15014
15051
  file: "ogygie.manifest.json",
15015
15052
  cause: `cli ${deps.cliVersion} < ogygieVersion ${installedVersion}`,
15016
- suggestedFix: "Run `pnpm update @ogygie/cli` first, then retry the upgrade."
15053
+ suggestedFix: `Install a CLI at least as recent as the project, WITH an explicit version (init pins exact ranges, so a bare \`pnpm update\` moves nothing): pnpm update @ogygie/core@${installedVersion} @ogygie/cli@${installedVersion} \u2014 then retry the upgrade.`
15017
15054
  });
15018
15055
  }
15019
15056
  if (compareVersions(deps.cliVersion, installedVersion) === 0) {
@@ -15089,6 +15126,7 @@ ${diff}`);
15089
15126
  deps.log(
15090
15127
  `Rappel lockstep (D2) : mettre @ogygie/core ET @ogygie/cli \xE0 ${deps.cliVersion} (\`pnpm update @ogygie/core@${deps.cliVersion} @ogygie/cli@${deps.cliVersion}\`), puis committer l'upgrade SEUL \u2014 jamais m\xEAl\xE9 \xE0 une feature.`
15091
15128
  );
15129
+ reportMissingGates(deps);
15092
15130
  return {
15093
15131
  fromVersion: installedVersion,
15094
15132
  toVersion: deps.cliVersion,
@@ -15152,9 +15190,6 @@ function stripComments(sourceText) {
15152
15190
  }
15153
15191
 
15154
15192
  // ../ogygie-core/src/vocabulary-audit.ts
15155
- function vocabularyRootsOf(vocabulary) {
15156
- return vocabulary.entries.flatMap((entry) => [entry.canonical, ...entry.forbiddenAliases]);
15157
- }
15158
15193
  function canonicalByAlias(vocabulary) {
15159
15194
  const byAlias = /* @__PURE__ */ new Map();
15160
15195
  for (const entry of vocabulary.entries) {
@@ -15167,7 +15202,7 @@ function auditProductVocabulary(input) {
15167
15202
  if (vocabulary === void 0 || vocabulary.entries.length === 0) return [];
15168
15203
  const canonicalOfAlias = canonicalByAlias(vocabulary);
15169
15204
  const forbiddenAliases = [...canonicalOfAlias.keys()];
15170
- const everyRoot = vocabularyRootsOf(vocabulary);
15205
+ const canonicalTerms = vocabulary.entries.map((entry) => entry.canonical);
15171
15206
  const violations = [];
15172
15207
  for (const file2 of input.sourceFiles) {
15173
15208
  for (const match of findProductVocabulary(stripComments(file2.content), forbiddenAliases)) {
@@ -15180,7 +15215,7 @@ function auditProductVocabulary(input) {
15180
15215
  }
15181
15216
  }
15182
15217
  for (const file2 of input.governedFiles) {
15183
- for (const match of findProductVocabulary(file2.content, everyRoot)) {
15218
+ for (const match of findProductVocabulary(file2.content, canonicalTerms)) {
15184
15219
  violations.push({
15185
15220
  kind: "GOVERNED_FILE",
15186
15221
  filePath: file2.path,
@@ -15292,6 +15327,12 @@ var governedChecksumsByVersion = {
15292
15327
  "AGENTS.md": "ca73ab619d8c55fac11858d815bf5fbab6537ecebe7ae4123cbdeb3e3e36bf1a",
15293
15328
  "CLAUDE.md": "785ee8d90e368806d8cf0b4d84a15f29d1dc961168bda86cf1a6c60a923c8c9b",
15294
15329
  "tsconfig.base.json": "0f8919e9ed8bbc88e0308fa2fa91471dabb18d1df721bd78c04076597eba89a2"
15330
+ },
15331
+ "0.3.0": {
15332
+ ".github/workflows/ogygie-gates.yml": "48c40efe9fe66dd0f9c3b94287026d80eae9afd6782b5833fdf8846d8662babf",
15333
+ "AGENTS.md": "ca73ab619d8c55fac11858d815bf5fbab6537ecebe7ae4123cbdeb3e3e36bf1a",
15334
+ "CLAUDE.md": "785ee8d90e368806d8cf0b4d84a15f29d1dc961168bda86cf1a6c60a923c8c9b",
15335
+ "tsconfig.base.json": "0f8919e9ed8bbc88e0308fa2fa91471dabb18d1df721bd78c04076597eba89a2"
15295
15336
  }
15296
15337
  };
15297
15338
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ogygie/cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
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.2.0"
25
+ "@ogygie/core": "0.3.0"
26
26
  },
27
27
  "scripts": {
28
28
  "typecheck": "tsc -p tsconfig.json",