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.
- package/dist/cli.js +2 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +204 -3
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +11 -14
- package/dist/commands/sync/manifest.d.ts +8 -2
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +56 -11
- package/dist/commands/sync.d.ts +1 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +9 -7
- package/dist/extractors/manifest.d.ts +30 -0
- package/dist/extractors/manifest.d.ts.map +1 -1
- package/dist/extractors/manifest.js +60 -7
- package/dist/extractors/symbol-coordinates.d.ts +15 -0
- package/dist/extractors/symbol-coordinates.d.ts.map +1 -0
- package/dist/extractors/symbol-coordinates.js +83 -0
- package/dist/public/extractors/manifest.d.ts +1 -1
- package/dist/public/extractors/manifest.d.ts.map +1 -1
- package/dist/public/extractors/manifest.js +1 -1
- package/dist/traceability/evidence-model.d.ts +142 -0
- package/dist/traceability/evidence-model.d.ts.map +1 -0
- package/dist/traceability/evidence-model.js +70 -0
- package/dist/traceability/git-staged.d.ts +1 -0
- package/dist/traceability/git-staged.d.ts.map +1 -1
- package/dist/traceability/git-staged.js +28 -3
- package/dist/traceability/staged-diagnostics.d.ts +25 -0
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -0
- package/dist/traceability/staged-diagnostics.js +67 -0
- package/dist/traceability/staged-impact-contract.d.ts +57 -0
- package/dist/traceability/staged-impact-contract.d.ts.map +1 -0
- package/dist/traceability/staged-impact-contract.js +202 -0
- package/dist/traceability/staged-symbols-manifest.d.ts +23 -0
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -0
- package/dist/traceability/staged-symbols-manifest.js +269 -0
- package/dist/traceability/symbol-extract.d.ts.map +1 -1
- package/dist/traceability/symbol-extract.js +33 -9
- package/dist/utils/manifest-paths.d.ts +8 -0
- package/dist/utils/manifest-paths.d.ts.map +1 -0
- package/dist/utils/manifest-paths.js +62 -0
- package/package.json +1 -1
- 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