@forwardimpact/libcodegen 0.1.62 → 0.1.65

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/bin/fit-codegen.js +14 -11
  2. package/package.json +6 -6
@@ -316,17 +316,9 @@ async function executeGeneration(codegens, sourcePath, flags) {
316
316
  * @param {string[]} protoDirs - Discovered proto directories
317
317
  * @param {string} projectRoot - Project root directory path
318
318
  * @param {object} finder - Finder instance for path management
319
+ * @param {object} parsedFlags - Parsed generation flags
319
320
  */
320
- async function runCodegen(protoDirs, projectRoot, finder) {
321
- const parsedFlags = parseFlags();
322
-
323
- if (!parsedFlags.hasGenerationFlags()) {
324
- cli.usageError(
325
- "no generation flags specified (use --all, --type, --service, --client, --definition, or --metadata)",
326
- );
327
- process.exit(2);
328
- }
329
-
321
+ async function runCodegen(protoDirs, projectRoot, finder, parsedFlags) {
330
322
  const generatedStorage = createStorage("generated", "local");
331
323
  const sourcePath = generatedStorage.path();
332
324
 
@@ -375,6 +367,17 @@ async function runCodegen(protoDirs, projectRoot, finder) {
375
367
  */
376
368
  async function main() {
377
369
  try {
370
+ // Flags must parse before project-root and proto discovery: --help and
371
+ // --version have to exit 0 from a bare directory, and discovery throws
372
+ // outside a proto-bearing project.
373
+ const parsedFlags = parseFlags();
374
+ if (!parsedFlags.hasGenerationFlags()) {
375
+ cli.usageError(
376
+ "no generation flags specified (use --all, --type, --service, --client, --definition, or --metadata)",
377
+ );
378
+ process.exit(2);
379
+ }
380
+
378
381
  const logger = new Logger("codegen", runtime);
379
382
  // The shared runtime.finder carries a no-op logger; bind this CLI's logger
380
383
  // so createPackageSymlinks (the one logging Finder consumer) keeps emitting
@@ -391,7 +394,7 @@ async function main() {
391
394
  );
392
395
  }
393
396
 
394
- await runCodegen(protoDirs, projectRoot, finder);
397
+ await runCodegen(protoDirs, projectRoot, finder, parsedFlags);
395
398
  } catch (err) {
396
399
  const logger = new Logger("codegen", runtime);
397
400
  logger.exception("main", err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forwardimpact/libcodegen",
3
- "version": "0.1.62",
3
+ "version": "0.1.65",
4
4
  "description": "Protobuf code generation — keep types in sync with proto definitions without hand-writing.",
5
5
  "keywords": [
6
6
  "codegen",
@@ -20,10 +20,10 @@
20
20
  {
21
21
  "user": "Platform Builders",
22
22
  "goal": "Keep Service Contracts Typed",
23
- "trigger": "Adding a proto definition and realizing the JavaScript types are already stale.",
24
- "bigHire": "keep types in sync with proto definitions without hand-writing.",
23
+ "trigger": "A service contract changes and the drift surfaces at runtime, in a client, an endpoint, or an MCP tool that no longer matches the proto.",
24
+ "bigHire": "generate types, clients, endpoints, and MCP tools from one proto source so contracts cannot drift.",
25
25
  "littleHire": "change a proto definition and trust the JavaScript types follow.",
26
- "competesWith": "manual type definitions; hoping hand-written types match; skipping types entirely"
26
+ "competesWith": "hand-rolled clients and JSON contracts; per-service endpoint boilerplate; hand-written MCP wrappers; trusting that callers and services agree"
27
27
  }
28
28
  ],
29
29
  "type": "module",
@@ -52,8 +52,8 @@
52
52
  "@forwardimpact/libutil": "^0.1.64",
53
53
  "@grpc/proto-loader": "^0.8.1",
54
54
  "mustache": "^4.2.0",
55
- "protobufjs": "^7.6.2",
56
- "protobufjs-cli": "1.2.2"
55
+ "protobufjs": "^7.6.3",
56
+ "protobufjs-cli": "1.3.3"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@forwardimpact/libmock": "^0.1.0"