@uns-kit/cli 3.0.4 → 3.0.6

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
@@ -2,16 +2,16 @@
2
2
 
3
3
  Command line scaffolding tool for the UNS toolkit. Bootstraps new projects with `@uns-kit/core` preconfigured and ready to extend with plugins. Also provides configure and upgrade commands for existing projects.
4
4
 
5
- Note: Apps built with uns-kit are intended to be managed by the **UNS Datahub controller**.
5
+ Note: Apps built with uns-kit are intended to be managed by the **UNS OpenHub controller**.
6
6
 
7
7
  ## uns-kit in context
8
8
 
9
9
  | Package | Description |
10
10
  | --- | --- |
11
- | [`@uns-kit/core`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-core) | Base runtime (UnsProxyProcess, MQTT helpers, config tooling, gRPC gateway). |
12
- | [`@uns-kit/api`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-api) | Express plugin — HTTP endpoints, JWT/JWKS auth, Swagger, UNS metadata. |
13
- | [`@uns-kit/cron`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cron) | Cron-driven scheduler that emits UNS events on a fixed cadence. |
14
- | [`@uns-kit/cli`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cli) | CLI for scaffolding new UNS applications. |
11
+ | [`@uns-kit/core`](https://github.com/uns-openhub/uns-kit/tree/main/packages/uns-core) | Base runtime (UnsProxyProcess, MQTT helpers, config tooling, gRPC gateway). |
12
+ | [`@uns-kit/api`](https://github.com/uns-openhub/uns-kit/tree/main/packages/uns-api) | Express plugin — HTTP endpoints, JWT/JWKS auth, Swagger, UNS metadata. |
13
+ | [`@uns-kit/cron`](https://github.com/uns-openhub/uns-kit/tree/main/packages/uns-cron) | Cron-driven scheduler that emits UNS events on a fixed cadence. |
14
+ | [`@uns-kit/cli`](https://github.com/uns-openhub/uns-kit/tree/main/packages/uns-cli) | CLI for scaffolding new UNS applications. |
15
15
 
16
16
  ## Prerequisites
17
17
 
@@ -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 OpenHub 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 OpenHub 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,13 +1,13 @@
1
1
  {
2
2
  "name": "@uns-kit/cli",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "Command line scaffolding tool for UNS applications",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Aljoša Vister <aljosa.vister@gmail.com>",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/uns-datahub/uns-kit.git",
10
+ "url": "https://github.com/uns-openhub/uns-kit.git",
11
11
  "directory": "packages/uns-cli"
12
12
  },
13
13
  "bin": {
@@ -25,15 +25,15 @@
25
25
  "templates"
26
26
  ],
27
27
  "dependencies": {
28
- "azure-devops-node-api": "^15.1.1",
29
- "@uns-kit/core": "3.0.4"
28
+ "azure-devops-node-api": "^15.1.2",
29
+ "@uns-kit/core": "3.0.6"
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.6",
33
+ "@uns-kit/api": "3.0.6",
34
+ "@uns-kit/cron": "3.0.6",
35
+ "@uns-kit/database": "3.0.6",
36
+ "@uns-kit/assistant-workflow": "3.0.6"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsc -p tsconfig.build.json",
@@ -69,7 +69,7 @@ shows how a producer publishes:
69
69
  - `systemRole: "lifecycle-time-source"` with `lifecycle`
70
70
 
71
71
  These fields are retained in the produced-topics registry and stored by the
72
- UNS Datahub controller in `attribute_schema.schema_json`.
72
+ UNS OpenHub controller in `attribute_schema.schema_json`.
73
73
 
74
74
  ## Sub-Asset Publishing
75
75
 
@@ -86,7 +86,7 @@ asset path and `asset` is the leaf sub-asset.
86
86
 
87
87
  ## Datahub client (last value)
88
88
 
89
- `UnsClient` provides a minimal REST client for the UNS Datahub API, including the batch last-value endpoint. Prefer a long-lived service token if available; you can pass it directly and skip username/password auth.
89
+ `UnsClient` provides a minimal REST client for the UNS OpenHub API, including the batch last-value endpoint. Prefer a long-lived service token if available; you can pass it directly and skip username/password auth.
90
90
 
91
91
  ```ts
92
92
  import { ConfigFile, UnsClient } from "@uns-kit/core";
@@ -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"