@uns-kit/cli 3.0.10 → 3.0.12
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/dist/index.js +10 -3
- package/package.json +7 -7
- package/templates/config-files/{config-localhost.json → config-development-host.json} +1 -13
- package/templates/config-files/config-development-podman.json +23 -0
- package/templates/config-files/config-production.json +23 -0
- package/templates/default/.env.example +9 -0
- package/templates/default/AGENTS.md +1 -0
- package/templates/default/README.md +19 -4
- package/templates/default/config.json +1 -13
- package/templates/default/gitignore +1 -1
- package/templates/default/package.json +1 -1
- package/templates/vscode/.vscode/settings.json +1 -1
- package/templates/config-files/config-docker.json +0 -35
package/dist/index.js
CHANGED
|
@@ -492,7 +492,7 @@ async function initGitRepository(targetDir) {
|
|
|
492
492
|
const DEFAULT_UNS_DATAHUB_ADDON_METADATA = {
|
|
493
493
|
schemaVersion: 1,
|
|
494
494
|
kind: "addon",
|
|
495
|
-
controllerCompatibility: ">=
|
|
495
|
+
controllerCompatibility: ">=2 <3",
|
|
496
496
|
};
|
|
497
497
|
function ensureUnsDatahubAddonMetadata(pkg) {
|
|
498
498
|
if (pkg.unsDatahub !== undefined) {
|
|
@@ -530,6 +530,7 @@ const AGENT_MIGRATION_BLOCK = [
|
|
|
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
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`.",
|
|
533
|
+
"- When crossing `<3.0.11` to `>=3.0.11` for an OpenHub 2.x add-on, replace the old `>=7.1 <8` manifest range with `>=2 <3` only after compatibility validation, then use the three credential-free runtime profiles and `ServiceTokenProvider` guidance in `MIGRATIONS.md`.",
|
|
533
534
|
AGENT_MIGRATION_END,
|
|
534
535
|
].join("\n");
|
|
535
536
|
async function ensureAgentMigrationGuidance(targetDir) {
|
|
@@ -1710,15 +1711,21 @@ async function replacePlaceholders(targetDir, packageName) {
|
|
|
1710
1711
|
__APP_NAME__: packageName,
|
|
1711
1712
|
__APP_CONFIG__: deriveConfigIdentifier(configFilePath),
|
|
1712
1713
|
};
|
|
1714
|
+
const profileFiles = [
|
|
1715
|
+
configFilePath,
|
|
1716
|
+
path.join(targetDir, "config-development-host.json"),
|
|
1717
|
+
path.join(targetDir, "config-development-podman.json"),
|
|
1718
|
+
path.join(targetDir, "config-production.json"),
|
|
1719
|
+
];
|
|
1713
1720
|
const filesToUpdate = [
|
|
1714
1721
|
path.join(targetDir, "README.md"),
|
|
1715
1722
|
path.join(targetDir, "src/index.ts"),
|
|
1716
|
-
|
|
1723
|
+
...profileFiles,
|
|
1717
1724
|
];
|
|
1718
1725
|
for (const file of filesToUpdate) {
|
|
1719
1726
|
try {
|
|
1720
1727
|
await access(file);
|
|
1721
|
-
if (path.resolve(file) === path.resolve(
|
|
1728
|
+
if (profileFiles.some(profileFile => path.resolve(file) === path.resolve(profileFile))) {
|
|
1722
1729
|
await replaceConfigTemplatePlaceholders(file, replacements, packageName);
|
|
1723
1730
|
continue;
|
|
1724
1731
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cli",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.12",
|
|
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.2",
|
|
29
|
-
"@uns-kit/core": "3.0.
|
|
29
|
+
"@uns-kit/core": "3.0.12"
|
|
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.12",
|
|
33
|
+
"@uns-kit/api": "3.0.12",
|
|
34
|
+
"@uns-kit/cron": "3.0.12",
|
|
35
|
+
"@uns-kit/database": "3.0.12",
|
|
36
|
+
"@uns-kit/assistant-workflow": "3.0.12"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -15,21 +15,9 @@
|
|
|
15
15
|
"handover": true,
|
|
16
16
|
"jwksWellKnownUrl": "http://localhost:3200/api/.well-known/jwks.json",
|
|
17
17
|
"kidWellKnownUrl": "http://localhost:3200/api/.well-known/kid",
|
|
18
|
-
"
|
|
19
|
-
"password": "secret"
|
|
18
|
+
"env": "dev"
|
|
20
19
|
},
|
|
21
20
|
"infra": {
|
|
22
21
|
"host": "localhost"
|
|
23
|
-
},
|
|
24
|
-
"output": {
|
|
25
|
-
"host": "localhost"
|
|
26
|
-
},
|
|
27
|
-
"input": {
|
|
28
|
-
"host": "localhost"
|
|
29
|
-
},
|
|
30
|
-
"devops": {
|
|
31
|
-
"provider": "azure-devops",
|
|
32
|
-
"organization": "example-org",
|
|
33
|
-
"project": "example-project"
|
|
34
22
|
}
|
|
35
23
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uns": {
|
|
3
|
+
"graphql": "http://localhost:3200/graphql",
|
|
4
|
+
"rest": "http://localhost:3200/api",
|
|
5
|
+
"processName": "__APP_NAME__",
|
|
6
|
+
"supervisor": {
|
|
7
|
+
"enabled": false,
|
|
8
|
+
"restartOnExit": false,
|
|
9
|
+
"maxMemoryMb": 512,
|
|
10
|
+
"restartOnUnhealthy": false,
|
|
11
|
+
"unhealthyAfterMs": 60000,
|
|
12
|
+
"restartCooldownMs": 300000
|
|
13
|
+
},
|
|
14
|
+
"instanceMode": "wait",
|
|
15
|
+
"handover": true,
|
|
16
|
+
"jwksWellKnownUrl": "http://localhost:3200/api/.well-known/jwks.json",
|
|
17
|
+
"kidWellKnownUrl": "http://localhost:3200/api/.well-known/kid",
|
|
18
|
+
"env": "dev"
|
|
19
|
+
},
|
|
20
|
+
"infra": {
|
|
21
|
+
"host": "mosquitto"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uns": {
|
|
3
|
+
"graphql": "http://localhost:3200/graphql",
|
|
4
|
+
"rest": "http://localhost:3200/api",
|
|
5
|
+
"processName": "__APP_NAME__",
|
|
6
|
+
"supervisor": {
|
|
7
|
+
"enabled": false,
|
|
8
|
+
"restartOnExit": false,
|
|
9
|
+
"maxMemoryMb": 512,
|
|
10
|
+
"restartOnUnhealthy": false,
|
|
11
|
+
"unhealthyAfterMs": 60000,
|
|
12
|
+
"restartCooldownMs": 300000
|
|
13
|
+
},
|
|
14
|
+
"instanceMode": "wait",
|
|
15
|
+
"handover": true,
|
|
16
|
+
"jwksWellKnownUrl": "http://localhost:3200/api/.well-known/jwks.json",
|
|
17
|
+
"kidWellKnownUrl": "http://localhost:3200/api/.well-known/kid",
|
|
18
|
+
"env": "prod"
|
|
19
|
+
},
|
|
20
|
+
"infra": {
|
|
21
|
+
"host": "mosquitto"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Used only by a directly started host-development process with
|
|
2
|
+
# config-development-host.json. Controller-managed Podman and production
|
|
3
|
+
# instances receive UNS_SERVICE_TOKEN_FILE automatically.
|
|
4
|
+
UNS_SERVICE_TOKEN=replace-with-development-machine-token
|
|
5
|
+
|
|
6
|
+
# Required for direct host development so API route metadata identifies the
|
|
7
|
+
# local controller. Controller-managed instances receive these values from PM2.
|
|
8
|
+
UNS_CONTROLLER_NAME=controller-local
|
|
9
|
+
UNS_CONTROLLER_PUBLIC_BASE=http://localhost:3200
|
|
@@ -29,5 +29,6 @@ Pointers for AI/code-assist tools when working in this generated project.
|
|
|
29
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.
|
|
30
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
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
|
+
- When crossing `<3.0.11` to `>=3.0.11` for an OpenHub 2.x add-on, replace the old `>=7.1 <8` manifest range with `>=2 <3` only after compatibility validation, then use the three credential-free runtime profiles and `ServiceTokenProvider` guidance in `MIGRATIONS.md`.
|
|
32
33
|
|
|
33
34
|
<!-- uns-kit:migrations:end -->
|
|
@@ -18,7 +18,19 @@ pnpm run sync-uns-metadata -- --controller-url http://localhost:3200 --token <me
|
|
|
18
18
|
|
|
19
19
|
## Configuration
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
The generator provides three committed, credential-free runtime profiles. Copy
|
|
22
|
+
the appropriate profile to the untracked `config.json` before running the app:
|
|
23
|
+
|
|
24
|
+
| Profile | Use it when | MQTT | Service credential |
|
|
25
|
+
|---|---|---|---|
|
|
26
|
+
| `config-development-host.json` | Running `pnpm run dev` directly on the host | `localhost` | `.env` → `UNS_SERVICE_TOKEN` |
|
|
27
|
+
| `config-development-podman.json` | Deploying through a local Podman OpenHub controller | `mosquitto` | Controller-managed `UNS_SERVICE_TOKEN_FILE` |
|
|
28
|
+
| `config-production.json` | Creating a production controller instance | `mosquitto` | Controller-managed token file or approved secret provider |
|
|
29
|
+
|
|
30
|
+
The profiles contain neither a token nor `uns.email`/`uns.password`. For a
|
|
31
|
+
direct host process, copy `.env.example` to `.env`, set a development machine
|
|
32
|
+
token, and keep that file untracked. Controller-managed instances receive the
|
|
33
|
+
mounted token file and controller identity automatically.
|
|
22
34
|
|
|
23
35
|
For standalone local development, `pnpm run dev` and `pnpm run start` load a
|
|
24
36
|
local `.env` file when it exists. The generated `.gitignore` excludes `.env`
|
|
@@ -86,15 +98,18 @@ asset path and `asset` is the leaf sub-asset.
|
|
|
86
98
|
|
|
87
99
|
## Datahub client (last value)
|
|
88
100
|
|
|
89
|
-
`UnsClient` provides a minimal REST client for the UNS OpenHub API, including the batch last-value endpoint. Prefer
|
|
101
|
+
`UnsClient` provides a minimal REST client for the UNS OpenHub API, including the batch last-value endpoint. Prefer the controller-managed token file or a development machine token; do not place it in a tracked config file.
|
|
90
102
|
|
|
91
103
|
```ts
|
|
92
|
-
import { ConfigFile, UnsClient } from "@uns-kit/core";
|
|
104
|
+
import { ConfigFile, ServiceTokenProvider, UnsClient } from "@uns-kit/core";
|
|
93
105
|
|
|
94
106
|
const config = await ConfigFile.loadConfig();
|
|
95
107
|
|
|
108
|
+
const tokenProvider = new ServiceTokenProvider({
|
|
109
|
+
configToken: typeof config.uns.token === "string" ? config.uns.token : undefined,
|
|
110
|
+
});
|
|
96
111
|
const client = new UnsClient("https://datahub.example.com", {
|
|
97
|
-
|
|
112
|
+
tokenProvider,
|
|
98
113
|
});
|
|
99
114
|
|
|
100
115
|
const values = await client.lastValue([
|
|
@@ -15,21 +15,9 @@
|
|
|
15
15
|
"handover": true,
|
|
16
16
|
"jwksWellKnownUrl": "http://localhost:3200/api/.well-known/jwks.json",
|
|
17
17
|
"kidWellKnownUrl": "http://localhost:3200/api/.well-known/kid",
|
|
18
|
-
"
|
|
19
|
-
"password": "123"
|
|
18
|
+
"env": "dev"
|
|
20
19
|
},
|
|
21
20
|
"infra": {
|
|
22
21
|
"host": "localhost"
|
|
23
|
-
},
|
|
24
|
-
"output": {
|
|
25
|
-
"host": "localhost"
|
|
26
|
-
},
|
|
27
|
-
"input": {
|
|
28
|
-
"host": "localhost"
|
|
29
|
-
},
|
|
30
|
-
"devops": {
|
|
31
|
-
"provider": "azure-devops",
|
|
32
|
-
"organization": "example-org",
|
|
33
|
-
"project": "example-project"
|
|
34
22
|
}
|
|
35
23
|
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"uns": {
|
|
3
|
-
"graphql": "http://uns-datahub-controller:3200/graphql",
|
|
4
|
-
"rest": "http://uns-datahub-controller:3200/api",
|
|
5
|
-
"processName": "__APP_NAME__",
|
|
6
|
-
"supervisor": {
|
|
7
|
-
"enabled": false,
|
|
8
|
-
"restartOnExit": false,
|
|
9
|
-
"maxMemoryMb": 512,
|
|
10
|
-
"restartOnUnhealthy": false,
|
|
11
|
-
"unhealthyAfterMs": 60000,
|
|
12
|
-
"restartCooldownMs": 300000
|
|
13
|
-
},
|
|
14
|
-
"instanceMode": "wait",
|
|
15
|
-
"handover": true,
|
|
16
|
-
"jwksWellKnownUrl": "http://uns-datahub-controller:3200/api/.well-known/jwks.json",
|
|
17
|
-
"kidWellKnownUrl": "http://uns-datahub-controller:3200/api/.well-known/kid",
|
|
18
|
-
"email": "user@example-org.com",
|
|
19
|
-
"password": "secret"
|
|
20
|
-
},
|
|
21
|
-
"infra": {
|
|
22
|
-
"host": "mosquitto:1883"
|
|
23
|
-
},
|
|
24
|
-
"output": {
|
|
25
|
-
"host": "mosquitto:1883"
|
|
26
|
-
},
|
|
27
|
-
"input": {
|
|
28
|
-
"host": "mosquitto:1883"
|
|
29
|
-
},
|
|
30
|
-
"devops": {
|
|
31
|
-
"provider": "azure-devops",
|
|
32
|
-
"organization": "example-org",
|
|
33
|
-
"project": "example-project"
|
|
34
|
-
}
|
|
35
|
-
}
|