kibi-cli 0.10.0 → 0.10.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.
Files changed (42) hide show
  1. package/dist/cli.js +2 -0
  2. package/dist/commands/check.d.ts.map +1 -1
  3. package/dist/commands/check.js +204 -3
  4. package/dist/commands/init-helpers.d.ts.map +1 -1
  5. package/dist/commands/init-helpers.js +11 -14
  6. package/dist/commands/sync/manifest.d.ts +8 -2
  7. package/dist/commands/sync/manifest.d.ts.map +1 -1
  8. package/dist/commands/sync/manifest.js +56 -11
  9. package/dist/commands/sync.d.ts +1 -0
  10. package/dist/commands/sync.d.ts.map +1 -1
  11. package/dist/commands/sync.js +9 -7
  12. package/dist/extractors/manifest.d.ts +30 -0
  13. package/dist/extractors/manifest.d.ts.map +1 -1
  14. package/dist/extractors/manifest.js +60 -7
  15. package/dist/extractors/symbol-coordinates.d.ts +15 -0
  16. package/dist/extractors/symbol-coordinates.d.ts.map +1 -0
  17. package/dist/extractors/symbol-coordinates.js +83 -0
  18. package/dist/public/extractors/manifest.d.ts +1 -1
  19. package/dist/public/extractors/manifest.d.ts.map +1 -1
  20. package/dist/public/extractors/manifest.js +1 -1
  21. package/dist/traceability/evidence-model.d.ts +142 -0
  22. package/dist/traceability/evidence-model.d.ts.map +1 -0
  23. package/dist/traceability/evidence-model.js +70 -0
  24. package/dist/traceability/git-staged.d.ts +1 -0
  25. package/dist/traceability/git-staged.d.ts.map +1 -1
  26. package/dist/traceability/git-staged.js +28 -3
  27. package/dist/traceability/staged-diagnostics.d.ts +25 -0
  28. package/dist/traceability/staged-diagnostics.d.ts.map +1 -0
  29. package/dist/traceability/staged-diagnostics.js +67 -0
  30. package/dist/traceability/staged-impact-contract.d.ts +57 -0
  31. package/dist/traceability/staged-impact-contract.d.ts.map +1 -0
  32. package/dist/traceability/staged-impact-contract.js +202 -0
  33. package/dist/traceability/staged-symbols-manifest.d.ts +23 -0
  34. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -0
  35. package/dist/traceability/staged-symbols-manifest.js +269 -0
  36. package/dist/traceability/symbol-extract.d.ts.map +1 -1
  37. package/dist/traceability/symbol-extract.js +33 -9
  38. package/dist/utils/manifest-paths.d.ts +8 -0
  39. package/dist/utils/manifest-paths.d.ts.map +1 -0
  40. package/dist/utils/manifest-paths.js +62 -0
  41. package/package.json +1 -1
  42. package/src/public/extractors/manifest.ts +2 -0
@@ -0,0 +1,62 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import * as path from "node:path";
3
+ export const DEFAULT_SYMBOLS_PATH = "documentation/symbols.yaml";
4
+ export const DEFAULT_COORDINATES_PATH = "documentation/symbol-coordinates.yaml";
5
+ function isNonEmptyString(value) {
6
+ return typeof value === "string" && value.trim().length > 0;
7
+ }
8
+ function resolveConfigPath(workspaceRoot, configPath) {
9
+ const configuredPath = configPath ?? path.join(workspaceRoot, ".kb", "config.json");
10
+ return path.isAbsolute(configuredPath)
11
+ ? configuredPath
12
+ : path.resolve(workspaceRoot, configuredPath);
13
+ }
14
+ function readManifestResolverConfig(workspaceRoot, configPath) {
15
+ const resolvedConfigPath = resolveConfigPath(workspaceRoot, configPath);
16
+ if (!existsSync(resolvedConfigPath)) {
17
+ return null;
18
+ }
19
+ try {
20
+ return JSON.parse(readFileSync(resolvedConfigPath, "utf8"));
21
+ }
22
+ catch {
23
+ return null;
24
+ }
25
+ }
26
+ function resolveConfiguredSymbolsPath(workspaceRoot, configPath) {
27
+ const config = readManifestResolverConfig(workspaceRoot, configPath);
28
+ if (!config) {
29
+ return null;
30
+ }
31
+ const configuredPathCandidate = config.paths?.symbols ?? config.symbolsManifest;
32
+ if (!isNonEmptyString(configuredPathCandidate)) {
33
+ return null;
34
+ }
35
+ return path.isAbsolute(configuredPathCandidate)
36
+ ? configuredPathCandidate
37
+ : path.resolve(workspaceRoot, configuredPathCandidate);
38
+ }
39
+ function resolveDefaultSymbolsPath(workspaceRoot) {
40
+ const candidates = [
41
+ path.join(workspaceRoot, DEFAULT_SYMBOLS_PATH),
42
+ path.join(workspaceRoot, "symbols.yaml"),
43
+ path.join(workspaceRoot, "symbols.yml"),
44
+ ];
45
+ return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0] ?? path.join(workspaceRoot, DEFAULT_SYMBOLS_PATH);
46
+ }
47
+ function deriveCoordinatesPath(symbolsPath) {
48
+ return path.join(path.dirname(symbolsPath), path.basename(DEFAULT_COORDINATES_PATH));
49
+ }
50
+ // implements REQ-cli-sync
51
+ export function resolveSymbolsManifestPaths(workspaceRoot, configPath) {
52
+ const symbolsPath = resolveConfiguredSymbolsPath(workspaceRoot, configPath) ??
53
+ resolveDefaultSymbolsPath(workspaceRoot);
54
+ return {
55
+ symbolsPath,
56
+ coordinatesPath: deriveCoordinatesPath(symbolsPath),
57
+ };
58
+ }
59
+ // implements REQ-cli-sync
60
+ export function resolveSymbolsManifestPath(workspaceRoot, configPath) {
61
+ return resolveSymbolsManifestPaths(workspaceRoot, configPath).symbolsPath;
62
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-cli",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "type": "module",
5
5
  "description": "Kibi CLI for knowledge base management",
6
6
  "engines": {
@@ -19,6 +19,8 @@
19
19
  export {
20
20
  extractFromManifest,
21
21
  extractFromManifestString,
22
+ readManifestWithCoordinateOverlay,
22
23
  type ExtractionResult,
23
24
  type ManifestError,
25
+ type ManifestSymbolRecord,
24
26
  } from "../../extractors/manifest.js";