@deftai/directive-core 0.57.0 → 0.58.0

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.
@@ -37,7 +37,7 @@
37
37
  * at freeze time. Leave it `null` otherwise. This is the only edit required to
38
38
  * pin the bridge version; the freeze + drift gates pick it up automatically.
39
39
  */
40
- export const LAST_GO_INSTALLER = "v0.56.0";
40
+ export const LAST_GO_INSTALLER = "v0.58.0";
41
41
  /** Returns the frozen final Go-installer tag, or `null` while unfrozen. */
42
42
  export function lastGoInstaller() {
43
43
  return LAST_GO_INSTALLER;
@@ -37,7 +37,7 @@ function defaultScmRunner() {
37
37
  call(source, verb, args, options = {}) {
38
38
  try {
39
39
  const result = call(source, verb, args, {
40
- check: options.check ?? false,
40
+ check: false,
41
41
  captureOutput: true,
42
42
  });
43
43
  if ((options.check ?? false) && result.returncode !== 0) {
@@ -4,14 +4,27 @@ import { isRelativeTo, resolveRefPath } from "./paths.js";
4
4
  import { runProjectDefinitionHooks } from "./plan-hooks.js";
5
5
  import { formatRegistryStatusMismatch, registryStatusScopeUris } from "./registry-status.js";
6
6
  import { validateProjectDefNarratives } from "./schema.js";
7
- function validateProjectRegistryScopeStatus(item, itemIndex, plan, filepath, vbriefDir) {
7
+ function isJsonObject(value) {
8
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9
+ }
10
+ function readJsonObject(path) {
11
+ let parsed;
12
+ try {
13
+ parsed = JSON.parse(readFileSync(path, "utf8"));
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ return isJsonObject(parsed) ? parsed : null;
19
+ }
20
+ function validateProjectRegistryScopeStatus(item, itemIndex, filepath, vbriefDir) {
8
21
  const errors = [];
9
22
  const itemStatus = item.status;
10
23
  if (typeof itemStatus !== "string") {
11
24
  return errors;
12
25
  }
13
26
  const resolvedRoot = resolve(vbriefDir);
14
- for (const uri of registryStatusScopeUris(item, plan)) {
27
+ for (const uri of registryStatusScopeUris(item)) {
15
28
  if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("#")) {
16
29
  continue;
17
30
  }
@@ -22,15 +35,12 @@ function validateProjectRegistryScopeStatus(item, itemIndex, plan, filepath, vbr
22
35
  if (!isRelativeTo(scopePath, resolvedRoot) || !existsSync(scopePath)) {
23
36
  continue;
24
37
  }
25
- let scopeData;
26
- try {
27
- scopeData = JSON.parse(readFileSync(scopePath, "utf8"));
28
- }
29
- catch {
38
+ const parsedScope = readJsonObject(scopePath);
39
+ if (parsedScope === null) {
30
40
  continue;
31
41
  }
32
- const scopePlan = scopeData.plan;
33
- if (typeof scopePlan !== "object" || scopePlan === null || Array.isArray(scopePlan)) {
42
+ const scopePlan = parsedScope.plan;
43
+ if (!isJsonObject(scopePlan)) {
34
44
  continue;
35
45
  }
36
46
  const scopeStatus = scopePlan.status;
@@ -45,7 +55,7 @@ export function validateProjectDefinition(filepath, data, vbriefDir) {
45
55
  const errors = [];
46
56
  const resolvedRoot = resolve(vbriefDir);
47
57
  const plan = data.plan;
48
- if (typeof plan !== "object" || plan === null || Array.isArray(plan)) {
58
+ if (!isJsonObject(plan)) {
49
59
  return errors;
50
60
  }
51
61
  const planObj = plan;
@@ -55,19 +65,18 @@ export function validateProjectDefinition(filepath, data, vbriefDir) {
55
65
  if (Array.isArray(items)) {
56
66
  for (let i = 0; i < items.length; i += 1) {
57
67
  const item = items[i];
58
- if (typeof item !== "object" || item === null || Array.isArray(item)) {
68
+ if (!isJsonObject(item)) {
59
69
  continue;
60
70
  }
61
71
  const itemObj = item;
62
- errors.push(...validateProjectRegistryScopeStatus(itemObj, i, planObj, filepath, vbriefDir));
72
+ errors.push(...validateProjectRegistryScopeStatus(itemObj, i, filepath, vbriefDir));
63
73
  const rawRefs = itemObj.references;
64
74
  const refs = Array.isArray(rawRefs) ? rawRefs : [];
65
75
  for (const ref of refs) {
66
- if (typeof ref !== "object" || ref === null || Array.isArray(ref)) {
76
+ if (!isJsonObject(ref)) {
67
77
  continue;
68
78
  }
69
- const refObj = ref;
70
- const uriRaw = refObj.uri;
79
+ const uriRaw = ref.uri;
71
80
  const uri = typeof uriRaw === "string" ? uriRaw : "";
72
81
  if (uri && uri.startsWith("file://")) {
73
82
  const refPath = uri.replace("file://", "");
@@ -12,9 +12,9 @@ export declare function deriveRegistryItemStatus(planStatus: unknown, lifecycleF
12
12
  */
13
13
  export declare function registryMetadataReferencesFromScope(references: unknown): unknown[];
14
14
  /**
15
- * Local scope URIs whose ``plan.status`` must agree with the registry item
16
- * status (D3). Shared by render output expectations and the validator.
15
+ * Local source URI whose ``plan.status`` must agree with the registry item
16
+ * status (D3). Child plan links can move through the lifecycle independently.
17
17
  */
18
- export declare function registryStatusScopeUris(item: JsonObject, plan: JsonObject): string[];
18
+ export declare function registryStatusScopeUris(item: JsonObject): string[];
19
19
  export declare function formatRegistryStatusMismatch(filepath: string, itemIndex: number, itemStatus: string, uri: string, scopeStatus: string): string;
20
20
  //# sourceMappingURL=registry-status.d.ts.map
@@ -1,4 +1,3 @@
1
- import { scopeIdsForRefUri } from "./paths.js";
2
1
  export const REGISTRY_SCOPE_LINK_TYPE = "x-vbrief/plan";
3
2
  /** Derive the registry item status from a scope vBRIEF (render side). */
4
3
  export function deriveRegistryItemStatus(planStatus, lifecycleFolder) {
@@ -27,20 +26,11 @@ export function registryMetadataReferencesFromScope(references) {
27
26
  }
28
27
  return references.filter((ref) => !isScopeLinkRef(ref));
29
28
  }
30
- function pushPlanScopeLink(uris, ref) {
31
- if (!isScopeLinkRef(ref)) {
32
- return;
33
- }
34
- const uri = ref.uri;
35
- if (typeof uri === "string" && uri.length > 0) {
36
- uris.push(uri);
37
- }
38
- }
39
29
  /**
40
- * Local scope URIs whose ``plan.status`` must agree with the registry item
41
- * status (D3). Shared by render output expectations and the validator.
30
+ * Local source URI whose ``plan.status`` must agree with the registry item
31
+ * status (D3). Child plan links can move through the lifecycle independently.
42
32
  */
43
- export function registryStatusScopeUris(item, plan) {
33
+ export function registryStatusScopeUris(item) {
44
34
  const uris = [];
45
35
  const metadata = item.metadata;
46
36
  if (typeof metadata === "object" && metadata !== null && !Array.isArray(metadata)) {
@@ -50,31 +40,6 @@ export function registryStatusScopeUris(item, plan) {
50
40
  uris.push(sourcePath);
51
41
  }
52
42
  }
53
- const itemRefs = item.references;
54
- if (Array.isArray(itemRefs)) {
55
- for (const ref of itemRefs) {
56
- pushPlanScopeLink(uris, ref);
57
- }
58
- }
59
- const itemId = item.id;
60
- const itemTitle = item.title;
61
- const planRefs = plan.references;
62
- if (Array.isArray(planRefs)) {
63
- for (const ref of planRefs) {
64
- if (!isScopeLinkRef(ref)) {
65
- continue;
66
- }
67
- const uri = ref.uri;
68
- if (typeof uri !== "string" || uri.length === 0) {
69
- continue;
70
- }
71
- const titleMatches = typeof itemTitle === "string" && ref.title === itemTitle;
72
- const idMatches = typeof itemId === "string" && scopeIdsForRefUri(uri).has(itemId);
73
- if (titleMatches || idMatches) {
74
- uris.push(uri);
75
- }
76
- }
77
- }
78
43
  return [...new Set(uris)];
79
44
  }
80
45
  export function formatRegistryStatusMismatch(filepath, itemIndex, itemStatus, uri, scopeStatus) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive-core",
3
- "version": "0.57.0",
3
+ "version": "0.58.0",
4
4
  "description": "TypeScript engine core for the Directive framework.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -209,8 +209,8 @@
209
209
  "provenance": true
210
210
  },
211
211
  "dependencies": {
212
- "@deftai/directive-content": "^0.57.0",
213
- "@deftai/directive-types": "^0.57.0"
212
+ "@deftai/directive-content": "^0.58.0",
213
+ "@deftai/directive-types": "^0.58.0"
214
214
  },
215
215
  "scripts": {
216
216
  "build": "tsc -b",