@forwardimpact/map 0.14.0 → 0.15.1

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/fit-map.js CHANGED
@@ -12,9 +12,12 @@
12
12
  * --help Show help
13
13
  */
14
14
 
15
- import { stat } from "fs/promises";
15
+ import fs from "fs/promises";
16
16
  import { join, resolve, dirname } from "path";
17
17
  import { fileURLToPath } from "url";
18
+ import { homedir } from "os";
19
+ import { Finder } from "@forwardimpact/libutil";
20
+ import { createLogger } from "@forwardimpact/libtelemetry";
18
21
 
19
22
  const __filename = fileURLToPath(import.meta.url);
20
23
  const __dirname = dirname(__filename);
@@ -48,46 +51,31 @@ function parseArgs(args) {
48
51
  return { command, subcommand, options, positional: rest };
49
52
  }
50
53
 
51
- /**
52
- * Check if a directory exists
53
- */
54
- async function dirExists(path) {
55
- try {
56
- const stats = await stat(path);
57
- return stats.isDirectory();
58
- } catch {
59
- return false;
60
- }
61
- }
62
-
63
54
  /**
64
55
  * Find the data directory
56
+ * @param {string|undefined} providedPath - Explicit path from --data flag
57
+ * @returns {Promise<string>} Resolved data directory path
65
58
  */
66
59
  async function findDataDir(providedPath) {
67
60
  if (providedPath) {
68
61
  const resolved = resolve(providedPath);
69
- if (await dirExists(resolved)) {
70
- return resolved;
62
+ try {
63
+ await fs.access(resolved);
64
+ } catch {
65
+ throw new Error(`Data directory not found: ${providedPath}`);
71
66
  }
72
- throw new Error(`Data directory not found: ${providedPath}`);
67
+ return resolved;
73
68
  }
74
69
 
75
- const candidates = [
76
- join(process.cwd(), "data/pathway"),
77
- join(process.cwd(), "examples/pathway"),
78
- join(process.cwd(), "data"),
79
- join(process.cwd(), "examples"),
80
- ];
81
-
82
- for (const candidate of candidates) {
83
- if (await dirExists(candidate)) {
84
- return candidate;
85
- }
70
+ const logger = createLogger("map");
71
+ const finder = new Finder(fs, logger, process);
72
+ try {
73
+ return join(finder.findData("data", homedir()), "pathway");
74
+ } catch {
75
+ throw new Error(
76
+ "No data directory found. Use --data=<path> to specify location.",
77
+ );
86
78
  }
87
-
88
- throw new Error(
89
- "No data directory found. Use --data=PATH to specify location.",
90
- );
91
79
  }
92
80
 
93
81
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forwardimpact/map",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "description": "Public data model for career frameworks, consumed by AI agents and engineers",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -46,12 +46,12 @@
46
46
  "./activity/transform": "./activity/transform/index.js"
47
47
  },
48
48
  "dependencies": {
49
- "ajv": "^8.17.1",
49
+ "ajv": "^8.18.0",
50
50
  "ajv-formats": "^3.0.1",
51
- "yaml": "^2.3.4"
51
+ "yaml": "^2.8.3"
52
52
  },
53
53
  "devDependencies": {
54
- "n3": "^2.0.1"
54
+ "n3": "^2.0.3"
55
55
  },
56
56
  "engines": {
57
57
  "node": ">=18.0.0"
@@ -60,6 +60,13 @@
60
60
  "items": {
61
61
  "type": "string"
62
62
  }
63
+ },
64
+ "returnFormat": {
65
+ "type": "array",
66
+ "description": "Expected outputs when completing this stage",
67
+ "items": {
68
+ "type": "string"
69
+ }
63
70
  }
64
71
  },
65
72
  "additionalProperties": false
package/src/loader.js CHANGED
@@ -284,8 +284,12 @@ export class DataLoader {
284
284
  async loadQuestionFolder(questionsDir) {
285
285
  const [skillProficiencies, behaviourMaturities, capabilityLevels] =
286
286
  await Promise.all([
287
- this.#loadQuestionsFromDir(join(questionsDir, "skills")),
288
- this.#loadQuestionsFromDir(join(questionsDir, "behaviours")),
287
+ this.#loadQuestionsFromDir(join(questionsDir, "skills")).catch(
288
+ () => ({}),
289
+ ),
290
+ this.#loadQuestionsFromDir(join(questionsDir, "behaviours")).catch(
291
+ () => ({}),
292
+ ),
289
293
  this.#loadQuestionsFromDir(join(questionsDir, "capabilities")).catch(
290
294
  () => ({}),
291
295
  ),
@@ -367,21 +371,13 @@ export class DataLoader {
367
371
  const tracksDir = join(dataDir, "tracks");
368
372
  const behavioursDir = join(dataDir, "behaviours");
369
373
 
370
- const [
371
- disciplineFiles,
372
- trackFiles,
373
- behaviourFiles,
374
- vscodeSettings,
375
- devcontainer,
376
- copilotSetupSteps,
377
- ] = await Promise.all([
378
- this.#loadDisciplinesFromDir(disciplinesDir),
379
- this.#loadTracksFromDir(tracksDir),
380
- this.#loadBehavioursFromDir(behavioursDir),
381
- this.#loadRepoFile(dataDir, "vscode-settings.yaml", {}),
382
- this.#loadRepoFile(dataDir, "devcontainer.yaml", {}),
383
- this.#loadRepoFile(dataDir, "copilot-setup-steps.yaml", null),
384
- ]);
374
+ const [disciplineFiles, trackFiles, behaviourFiles, claudeCodeSettings] =
375
+ await Promise.all([
376
+ this.#loadDisciplinesFromDir(disciplinesDir),
377
+ this.#loadTracksFromDir(tracksDir),
378
+ this.#loadBehavioursFromDir(behavioursDir),
379
+ this.#loadRepoFile(dataDir, "claude-code-settings.yaml", {}),
380
+ ]);
385
381
 
386
382
  const disciplines = disciplineFiles
387
383
  .filter((d) => d.agent)
@@ -408,9 +404,7 @@ export class DataLoader {
408
404
  disciplines,
409
405
  tracks,
410
406
  behaviours,
411
- vscodeSettings,
412
- devcontainer,
413
- copilotSetupSteps,
407
+ claudeCodeSettings,
414
408
  };
415
409
  }
416
410