@uns-kit/cli 3.0.5 → 3.0.7
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 +7 -7
- package/dist/index.js +13 -12
- package/dist/service-bundle.js +1 -0
- package/package.json +9 -9
- package/templates/cron/AGENTS.md +3 -0
- package/templates/default/AGENTS.md +3 -0
- package/templates/default/README.md +2 -2
- package/templates/default/package.json +1 -1
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
|
|
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-
|
|
12
|
-
| [`@uns-kit/api`](https://github.com/uns-
|
|
13
|
-
| [`@uns-kit/cron`](https://github.com/uns-
|
|
14
|
-
| [`@uns-kit/cli`](https://github.com/uns-
|
|
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, initialises a git repository if `git` is available, and marks the package as a controller-installable UNS
|
|
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 and `package.json` UNS
|
|
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
|
@@ -10,8 +10,8 @@ import readline from "node:readline/promises";
|
|
|
10
10
|
import { promisify } from "node:util";
|
|
11
11
|
import * as azdev from "azure-devops-node-api";
|
|
12
12
|
import { generateAgentsMarkdown, generateServiceSpecMarkdown, getServiceBundleOutputPublisherContracts, readAndValidateServiceBundle, } from "./service-bundle.js";
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const currentFilename = fileURLToPath(import.meta.url);
|
|
14
|
+
const currentDirname = path.dirname(currentFilename);
|
|
15
15
|
const require = createRequire(import.meta.url);
|
|
16
16
|
const cliVersion = resolveCliVersion();
|
|
17
17
|
const coreVersion = resolveCoreVersion();
|
|
@@ -261,7 +261,7 @@ async function createProjectFromBundle(options) {
|
|
|
261
261
|
}
|
|
262
262
|
async function scaffoldTsProject(projectName, targetDir, options = {}) {
|
|
263
263
|
await ensureTargetDir(targetDir, { allowExisting: options.allowExisting });
|
|
264
|
-
const templateDir = path.resolve(
|
|
264
|
+
const templateDir = path.resolve(currentDirname, `../templates/${options.templateName ?? DEFAULT_TEMPLATE_NAME}`);
|
|
265
265
|
try {
|
|
266
266
|
await access(templateDir);
|
|
267
267
|
}
|
|
@@ -529,6 +529,7 @@ const AGENT_MIGRATION_BLOCK = [
|
|
|
529
529
|
"- After installing the target version, read `node_modules/@uns-kit/core/MIGRATIONS.md` and apply every migration whose version boundary is crossed. Do not apply unrelated migrations.",
|
|
530
530
|
"- When crossing `<2.0.71` to `>=2.0.71`, inspect MQTT proxy ownership and follow the documented shutdown migration. Process-owned and standalone proxies have different shutdown paths.",
|
|
531
531
|
"- When crossing `<3.0.0` to `>=3.0.0`, migrate MQTT `message.table.columns` publishers from named arrays to named objects and consumers to object-entry iteration. Keep schema `tableColumns` and Assistant/UI table formats unchanged.",
|
|
532
|
+
"- When crossing `<3.0.7` to `>=3.0.7`, update the application's direct `zod` dependency to Zod 4, migrate Zod-3-only project config extension APIs, and regenerate `config.schema.json` plus `src/config/app-config.ts`.",
|
|
532
533
|
AGENT_MIGRATION_END,
|
|
533
534
|
].join("\n");
|
|
534
535
|
async function ensureAgentMigrationGuidance(targetDir) {
|
|
@@ -694,7 +695,7 @@ async function applyAzureDevopsConfig(targetDir, options) {
|
|
|
694
695
|
scripts["pull-request"] = "node ./node_modules/@uns-kit/core/dist/tools/pull-request.js";
|
|
695
696
|
pkgChanged = true;
|
|
696
697
|
}
|
|
697
|
-
const azurePipelineTemplatePath = path.resolve(
|
|
698
|
+
const azurePipelineTemplatePath = path.resolve(currentDirname, "../templates/azure-pipelines.yml");
|
|
698
699
|
try {
|
|
699
700
|
await access(azurePipelineTemplatePath);
|
|
700
701
|
}
|
|
@@ -753,7 +754,7 @@ function logDevopsResult(result, options) {
|
|
|
753
754
|
}
|
|
754
755
|
async function configureVscode(targetPath, options = {}) {
|
|
755
756
|
const targetDir = path.resolve(process.cwd(), targetPath ?? ".");
|
|
756
|
-
const templateDir = path.resolve(
|
|
757
|
+
const templateDir = path.resolve(currentDirname, "../templates/vscode");
|
|
757
758
|
try {
|
|
758
759
|
await access(templateDir);
|
|
759
760
|
}
|
|
@@ -786,7 +787,7 @@ async function configureVscode(targetPath, options = {}) {
|
|
|
786
787
|
}
|
|
787
788
|
async function configureConfigFiles(targetPath, options = {}) {
|
|
788
789
|
const targetDir = path.resolve(process.cwd(), targetPath ?? ".");
|
|
789
|
-
const templateDir = path.resolve(
|
|
790
|
+
const templateDir = path.resolve(currentDirname, "../templates/config-files");
|
|
790
791
|
try {
|
|
791
792
|
await access(templateDir);
|
|
792
793
|
}
|
|
@@ -839,7 +840,7 @@ async function applyConfigTemplatePlaceholders(targetDir, relativePaths) {
|
|
|
839
840
|
}
|
|
840
841
|
async function configureCodegen(targetPath, options = {}) {
|
|
841
842
|
const targetDir = path.resolve(process.cwd(), targetPath ?? ".");
|
|
842
|
-
const templateDir = path.resolve(
|
|
843
|
+
const templateDir = path.resolve(currentDirname, "../templates/codegen");
|
|
843
844
|
const packagePath = path.join(targetDir, "package.json");
|
|
844
845
|
try {
|
|
845
846
|
await access(templateDir);
|
|
@@ -1136,7 +1137,7 @@ function parseConfigureTemplatesArgs(args, availableTemplates) {
|
|
|
1136
1137
|
return { targetPath, overwrite, includeAll, templateNames };
|
|
1137
1138
|
}
|
|
1138
1139
|
async function runConfigureTemplatesCommand(args) {
|
|
1139
|
-
const templateRoot = path.resolve(
|
|
1140
|
+
const templateRoot = path.resolve(currentDirname, "../templates");
|
|
1140
1141
|
const availableTemplates = await listTemplateDirectories(templateRoot, { includeDefault: true });
|
|
1141
1142
|
const allTemplates = await listTemplateDirectories(templateRoot, { includeDefault: false });
|
|
1142
1143
|
const { targetPath, overwrite, includeAll, templateNames } = parseConfigureTemplatesArgs(args, availableTemplates);
|
|
@@ -1384,7 +1385,7 @@ function normalizeTemplateFilename(filename) {
|
|
|
1384
1385
|
async function configurePlugin(options) {
|
|
1385
1386
|
const { targetPath, templateName, dependencyName, dependencySpecifier, label, overwrite } = options;
|
|
1386
1387
|
const targetDir = path.resolve(process.cwd(), targetPath ?? ".");
|
|
1387
|
-
const templateDir = path.resolve(
|
|
1388
|
+
const templateDir = path.resolve(currentDirname, `../templates/${templateName}`);
|
|
1388
1389
|
const packagePath = path.join(targetDir, "package.json");
|
|
1389
1390
|
try {
|
|
1390
1391
|
await access(templateDir);
|
|
@@ -1852,7 +1853,7 @@ function normalizePackageName(input) {
|
|
|
1852
1853
|
|| "uns-app";
|
|
1853
1854
|
}
|
|
1854
1855
|
function resolveUnsPackageSpecifier(packageName, relativeLocalPath) {
|
|
1855
|
-
const localPath = path.resolve(
|
|
1856
|
+
const localPath = path.resolve(currentDirname, relativeLocalPath);
|
|
1856
1857
|
if (existsSync(localPath)) {
|
|
1857
1858
|
const pkg = require(localPath);
|
|
1858
1859
|
const version = pkg?.version ?? "0.0.1";
|
|
@@ -1878,7 +1879,7 @@ function resolveUnsPackageVersion(packageName, relativeLocalPath) {
|
|
|
1878
1879
|
return directVersion;
|
|
1879
1880
|
}
|
|
1880
1881
|
const workspaceVersion = attempt(() => {
|
|
1881
|
-
const pkgPath = path.resolve(
|
|
1882
|
+
const pkgPath = path.resolve(currentDirname, relativeLocalPath);
|
|
1882
1883
|
const pkg = require(pkgPath);
|
|
1883
1884
|
return pkg?.version;
|
|
1884
1885
|
});
|
|
@@ -1944,7 +1945,7 @@ function resolveCoreVersion() {
|
|
|
1944
1945
|
return directVersion;
|
|
1945
1946
|
}
|
|
1946
1947
|
const workspaceVersion = attempt(() => {
|
|
1947
|
-
const localPath = path.resolve(
|
|
1948
|
+
const localPath = path.resolve(currentDirname, "../../uns-core/package.json");
|
|
1948
1949
|
const pkg = require(localPath);
|
|
1949
1950
|
return pkg?.version;
|
|
1950
1951
|
});
|
package/dist/service-bundle.js
CHANGED
|
@@ -82,6 +82,7 @@ export function generateAgentsMarkdown(bundle) {
|
|
|
82
82
|
"- After installing the target version, read `node_modules/@uns-kit/core/MIGRATIONS.md` and apply every migration whose version boundary is crossed. Do not apply unrelated migrations.",
|
|
83
83
|
"- When crossing `<2.0.71` to `>=2.0.71`, inspect MQTT proxy ownership and follow the documented shutdown migration. Process-owned and standalone proxies have different shutdown paths.",
|
|
84
84
|
"- When crossing `<3.0.0` to `>=3.0.0`, migrate MQTT `message.table.columns` publishers from named arrays to named objects and consumers to object-entry iteration. Keep schema `tableColumns` and Assistant/UI table formats unchanged.",
|
|
85
|
+
"- When crossing `<3.0.7` to `>=3.0.7`, update the application's direct `zod` dependency to Zod 4, migrate Zod-3-only project config extension APIs, and regenerate `config.schema.json` plus `src/config/app-config.ts`.",
|
|
85
86
|
"<!-- uns-kit:migrations:end -->",
|
|
86
87
|
"",
|
|
87
88
|
];
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cli",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
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-
|
|
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.
|
|
29
|
-
"@uns-kit/core": "3.0.
|
|
28
|
+
"azure-devops-node-api": "^15.1.2",
|
|
29
|
+
"@uns-kit/core": "3.0.7"
|
|
30
30
|
},
|
|
31
31
|
"unsKitPackages": {
|
|
32
|
-
"@uns-kit/core": "3.0.
|
|
33
|
-
"@uns-kit/api": "3.0.
|
|
34
|
-
"@uns-kit/cron": "3.0.
|
|
35
|
-
"@uns-kit/database": "3.0.
|
|
36
|
-
"@uns-kit/assistant-workflow": "3.0.
|
|
32
|
+
"@uns-kit/core": "3.0.7",
|
|
33
|
+
"@uns-kit/api": "3.0.7",
|
|
34
|
+
"@uns-kit/cron": "3.0.7",
|
|
35
|
+
"@uns-kit/database": "3.0.7",
|
|
36
|
+
"@uns-kit/assistant-workflow": "3.0.7"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -p tsconfig.build.json",
|
package/templates/cron/AGENTS.md
CHANGED
|
@@ -21,10 +21,13 @@ Pointers for AI/code-assist tools when working in this generated project.
|
|
|
21
21
|
- `pnpm run sync-uns-metadata -- --controller-url ... --token ...` -> pulls topics/tags/assets from the controller and regenerates local TS helpers
|
|
22
22
|
|
|
23
23
|
<!-- uns-kit:migrations:start -->
|
|
24
|
+
|
|
24
25
|
## UNS Kit dependency upgrades
|
|
25
26
|
|
|
26
27
|
- Before changing any `@uns-kit/*` version, record the installed source version and intended target version.
|
|
27
28
|
- After installing the target version, read `node_modules/@uns-kit/core/MIGRATIONS.md` and apply every migration whose version boundary is crossed. Do not apply unrelated migrations.
|
|
28
29
|
- When crossing `<2.0.71` to `>=2.0.71`, inspect MQTT proxy ownership and follow the documented shutdown migration. Process-owned and standalone proxies have different shutdown paths.
|
|
29
30
|
- When crossing `<3.0.0` to `>=3.0.0`, migrate MQTT `message.table.columns` publishers from named arrays to named objects and consumers to object-entry iteration. Keep schema `tableColumns` and Assistant/UI table formats unchanged.
|
|
31
|
+
- When crossing `<3.0.7` to `>=3.0.7`, update the application's direct `zod` dependency to Zod 4, migrate Zod-3-only project config extension APIs, and regenerate `config.schema.json` plus `src/config/app-config.ts`.
|
|
32
|
+
|
|
30
33
|
<!-- uns-kit:migrations:end -->
|
|
@@ -21,10 +21,13 @@ Pointers for AI/code-assist tools when working in this generated project.
|
|
|
21
21
|
- `pnpm run sync-uns-metadata -- --controller-url ... --token ...` -> pulls topics/tags/assets from the controller and regenerates local TS helpers
|
|
22
22
|
|
|
23
23
|
<!-- uns-kit:migrations:start -->
|
|
24
|
+
|
|
24
25
|
## UNS Kit dependency upgrades
|
|
25
26
|
|
|
26
27
|
- Before changing any `@uns-kit/*` version, record the installed source version and intended target version.
|
|
27
28
|
- After installing the target version, read `node_modules/@uns-kit/core/MIGRATIONS.md` and apply every migration whose version boundary is crossed. Do not apply unrelated migrations.
|
|
28
29
|
- When crossing `<2.0.71` to `>=2.0.71`, inspect MQTT proxy ownership and follow the documented shutdown migration. Process-owned and standalone proxies have different shutdown paths.
|
|
29
30
|
- When crossing `<3.0.0` to `>=3.0.0`, migrate MQTT `message.table.columns` publishers from named arrays to named objects and consumers to object-entry iteration. Keep schema `tableColumns` and Assistant/UI table formats unchanged.
|
|
31
|
+
- When crossing `<3.0.7` to `>=3.0.7`, update the application's direct `zod` dependency to Zod 4, migrate Zod-3-only project config extension APIs, and regenerate `config.schema.json` plus `src/config/app-config.ts`.
|
|
32
|
+
|
|
30
33
|
<!-- uns-kit:migrations:end -->
|
|
@@ -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
|
|
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
|
|
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";
|