@wopr-network/defcon 1.0.2 → 1.0.3

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.
@@ -10,8 +10,18 @@ export async function executeOnEnter(onEnter, entity, entityRepo) {
10
10
  // Render command via Handlebars
11
11
  const hbs = getHandlebars();
12
12
  let renderedCommand;
13
+ // Merge artifact refs into entity.refs so onEnter command templates like
14
+ // {{entity.refs.github.repo}} resolve correctly for REST-created entities.
15
+ const artifactRefs = entity.artifacts !== null &&
16
+ typeof entity.artifacts === "object" &&
17
+ "refs" in entity.artifacts &&
18
+ entity.artifacts.refs !== null &&
19
+ typeof entity.artifacts.refs === "object"
20
+ ? entity.artifacts.refs
21
+ : {};
22
+ const entityForContext = { ...entity, refs: { ...artifactRefs, ...(entity.refs ?? {}) } };
13
23
  try {
14
- renderedCommand = hbs.compile(onEnter.command)({ entity });
24
+ renderedCommand = hbs.compile(onEnter.command)({ entity: entityForContext });
15
25
  }
16
26
  catch (err) {
17
27
  const error = `onEnter template error: ${err instanceof Error ? err.message : String(err)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wopr-network/defcon",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@9.15.4",
6
6
  "engines": {