@uns-kit/cli 3.0.4 → 3.0.5

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/README.md CHANGED
@@ -35,7 +35,7 @@ pnpm install
35
35
  pnpm run dev
36
36
  ```
37
37
 
38
- The scaffold creates a project directory from the default TypeScript template, pins `@uns-kit/core` to the current version, and initialises a git repository if `git` is available.
38
+ The scaffold creates a project directory from the default TypeScript template, pins `@uns-kit/core` to the current version, initialises a git repository if `git` is available, and marks the package as a controller-installable UNS Datahub add-on in `package.json`.
39
39
 
40
40
  The default template includes a Datahub REST client example (`UnsClient`) for last-value lookups, using a token-first pattern suitable for long-lived service tokens.
41
41
 
@@ -139,7 +139,7 @@ uns-kit upgrade # upgrade current directory
139
139
  uns-kit upgrade ./my-app # upgrade a specific project
140
140
  ```
141
141
 
142
- Removes scripts that have been superseded (`generate-uns-dictionary`, `generate-uns-measurements`, `generate-uns-reference`, `generate-uns-metadata`), ensures the `sync-uns-*` scripts are present, and adds an idempotent managed section to `AGENTS.md` that directs agents to version-bounded `@uns-kit/core` migrations. Existing project-specific agent instructions are preserved.
142
+ Removes scripts that have been superseded (`generate-uns-dictionary`, `generate-uns-measurements`, `generate-uns-reference`, `generate-uns-metadata`), ensures the `sync-uns-*` scripts and `package.json` UNS Datahub add-on metadata are present, and adds an idempotent managed section to `AGENTS.md` that directs agents to version-bounded `@uns-kit/core` migrations. Existing package metadata and project-specific agent instructions are preserved.
143
143
 
144
144
  The installed migration guide is `node_modules/@uns-kit/core/MIGRATIONS.md`.
145
145
  For example, an upgrade crossing `<2.0.71` to `>=2.0.71` must review MQTT
package/dist/index.js CHANGED
@@ -489,6 +489,18 @@ async function initGitRepository(targetDir) {
489
489
  return false;
490
490
  }
491
491
  }
492
+ const DEFAULT_UNS_DATAHUB_ADDON_METADATA = {
493
+ schemaVersion: 1,
494
+ kind: "addon",
495
+ controllerCompatibility: ">=7.1 <8",
496
+ };
497
+ function ensureUnsDatahubAddonMetadata(pkg) {
498
+ if (pkg.unsDatahub !== undefined) {
499
+ return false;
500
+ }
501
+ pkg.unsDatahub = { ...DEFAULT_UNS_DATAHUB_ADDON_METADATA };
502
+ return true;
503
+ }
492
504
  function setPackageScript(scripts, name, command) {
493
505
  if (scripts[name] === command) {
494
506
  return false;
@@ -981,6 +993,8 @@ async function upgradeProject(targetPath) {
981
993
  const pkg = JSON.parse(pkgRaw);
982
994
  const scripts = (pkg.scripts ??= {});
983
995
  let changed = false;
996
+ const addonMetadataChanged = ensureUnsDatahubAddonMetadata(pkg);
997
+ changed = addonMetadataChanged || changed;
984
998
  const removed = [];
985
999
  for (const name of OBSOLETE_SCRIPTS) {
986
1000
  if (scripts[name] !== undefined) {
@@ -993,7 +1007,7 @@ async function upgradeProject(targetPath) {
993
1007
  changed = syncScriptsChanged || changed;
994
1008
  const agentGuidanceResult = await ensureAgentMigrationGuidance(targetDir);
995
1009
  changed = agentGuidanceResult !== "unchanged" || changed;
996
- if (removed.length > 0 || syncScriptsChanged) {
1010
+ if (removed.length > 0 || syncScriptsChanged || addonMetadataChanged) {
997
1011
  await writeFile(packagePath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
998
1012
  }
999
1013
  console.log(`\nUpgrade complete for ${targetDir}`);
@@ -1009,6 +1023,12 @@ async function upgradeProject(targetPath) {
1009
1023
  else {
1010
1024
  console.log(" Ensured: sync-uns-schema, sync-uns-metadata");
1011
1025
  }
1026
+ if (addonMetadataChanged) {
1027
+ console.log(" Added: package.json unsDatahub add-on metadata");
1028
+ }
1029
+ else {
1030
+ console.log(" Preserved: existing package.json unsDatahub metadata");
1031
+ }
1012
1032
  if (agentGuidanceResult === "created") {
1013
1033
  console.log(" Created AGENTS.md with version-bounded migration guidance.");
1014
1034
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uns-kit/cli",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "Command line scaffolding tool for UNS applications",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,14 +26,14 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "azure-devops-node-api": "^15.1.1",
29
- "@uns-kit/core": "3.0.4"
29
+ "@uns-kit/core": "3.0.5"
30
30
  },
31
31
  "unsKitPackages": {
32
- "@uns-kit/core": "3.0.4",
33
- "@uns-kit/api": "3.0.4",
34
- "@uns-kit/cron": "3.0.4",
35
- "@uns-kit/database": "3.0.4",
36
- "@uns-kit/assistant-workflow": "3.0.4"
32
+ "@uns-kit/core": "3.0.5",
33
+ "@uns-kit/api": "3.0.5",
34
+ "@uns-kit/cron": "3.0.5",
35
+ "@uns-kit/database": "3.0.5",
36
+ "@uns-kit/assistant-workflow": "3.0.5"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsc -p tsconfig.build.json",
@@ -3,6 +3,11 @@
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
5
  "description": "UNS application generated by @uns-kit/cli",
6
+ "unsDatahub": {
7
+ "schemaVersion": 1,
8
+ "kind": "addon",
9
+ "controllerCompatibility": ">=7.1 <8"
10
+ },
6
11
  "type": "module",
7
12
  "engines": {
8
13
  "node": ">=22"