@forwardimpact/libcoaligned 0.1.7 → 0.1.8

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/bin/coaligned.js CHANGED
@@ -9,16 +9,8 @@ import { checkInstructions, checkJtbd } from "../src/index.js";
9
9
 
10
10
  const runtime = createDefaultRuntime();
11
11
 
12
- const { version: VERSION } = JSON.parse(
13
- runtime.fsSync.readFileSync(
14
- new URL("../package.json", import.meta.url),
15
- "utf8",
16
- ),
17
- );
18
-
19
12
  const definition = {
20
13
  name: "coaligned",
21
- version: VERSION,
22
14
  description:
23
15
  "Enforce the layered instruction architecture defined in COALIGNED.md (no subcommand: run every check)",
24
16
  commands: [
@@ -51,7 +43,10 @@ const definition = {
51
43
  examples: ["coaligned", "coaligned instructions", "coaligned jtbd --fix"],
52
44
  };
53
45
 
54
- const cli = createCli(definition);
46
+ const cli = createCli(definition, {
47
+ runtime,
48
+ packageJsonUrl: new URL("../package.json", import.meta.url),
49
+ });
55
50
 
56
51
  function writeFindings(findings, passMessage, jsonOutput, cwd, rt) {
57
52
  if (jsonOutput) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forwardimpact/libcoaligned",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Co-Aligned architecture checks — enforce instruction-layer length caps and JTBD invariants across the repo.",
5
5
  "keywords": [
6
6
  "coaligned",
@@ -50,6 +50,9 @@
50
50
  "@forwardimpact/libutil": "*",
51
51
  "prettier": "^3.0.0"
52
52
  },
53
+ "devDependencies": {
54
+ "@forwardimpact/libmock": "^0.1.0"
55
+ },
53
56
  "engines": {
54
57
  "bun": ">=1.2.0",
55
58
  "node": ">=22.0.0"
@@ -1,5 +1,4 @@
1
1
  import { resolve } from "node:path";
2
- import { createDefaultRuntime } from "@forwardimpact/libutil/runtime";
3
2
  import { runRules } from "@forwardimpact/libutil";
4
3
 
5
4
  const SKIP_DIRS = new Set([
@@ -322,7 +321,8 @@ export const INSTRUCTION_RULES = [
322
321
  * with `emitFindingsText` / `emitFindingsJson` from libutil.
323
322
  */
324
323
  export async function checkInstructions({ root, runtime }) {
325
- const { fs } = runtime ?? createDefaultRuntime();
324
+ if (!runtime) throw new Error("runtime is required");
325
+ const { fs } = runtime;
326
326
  const { layers, skillDirs } = await buildLayers(root, fs);
327
327
  const fileSubjects = await buildFileSubjects(root, layers, fs);
328
328
  const checklistSubjects = await buildChecklistSubjects(
package/src/jtbd.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import * as prettier from "prettier";
3
3
  import { runRules } from "@forwardimpact/libutil";
4
- import { createDefaultRuntime } from "@forwardimpact/libutil/runtime";
5
4
 
6
5
  const VALID_USERS = [
7
6
  "Engineering Leaders",
@@ -503,7 +502,8 @@ async function processJtbdMd(root, fix, formatMarkdown, result, fsSync) {
503
502
  * that were rewritten in place.
504
503
  */
505
504
  export async function checkJtbd({ root, fix = false, runtime }) {
506
- const { fsSync } = runtime ?? createDefaultRuntime();
505
+ if (!runtime) throw new Error("runtime is required");
506
+ const { fsSync } = runtime;
507
507
  const result = { findings: [], stale: [], fixed: [] };
508
508
  const prettierConfig = await prettier.resolveConfig(join(root, "JTBD.md"));
509
509
  const formatMarkdown = makeFormatter(prettierConfig);