@uns-kit/cli 2.0.71 → 2.0.73
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 +6 -1
- package/dist/index.js +58 -1
- package/dist/service-bundle.js +8 -0
- package/package.json +7 -6
- package/templates/cron/AGENTS.md +9 -0
- package/templates/default/AGENTS.md +9 -0
package/README.md
CHANGED
|
@@ -139,7 +139,12 @@ 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`)
|
|
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.
|
|
143
|
+
|
|
144
|
+
The installed migration guide is `node_modules/@uns-kit/core/MIGRATIONS.md`.
|
|
145
|
+
For example, an upgrade crossing `<2.0.71` to `>=2.0.71` must review MQTT
|
|
146
|
+
shutdown ownership, while an upgrade starting at `2.0.71` or newer must not
|
|
147
|
+
rewrite shutdown code solely because of that migration.
|
|
143
148
|
|
|
144
149
|
### `uns-kit help`
|
|
145
150
|
Display usage information.
|
package/dist/index.js
CHANGED
|
@@ -507,6 +507,52 @@ const OBSOLETE_SCRIPTS = [
|
|
|
507
507
|
"generate-uns-reference",
|
|
508
508
|
"generate-uns-metadata",
|
|
509
509
|
];
|
|
510
|
+
const AGENT_MIGRATION_START = "<!-- uns-kit:migrations:start -->";
|
|
511
|
+
const AGENT_MIGRATION_END = "<!-- uns-kit:migrations:end -->";
|
|
512
|
+
const AGENT_MIGRATION_BLOCK = [
|
|
513
|
+
AGENT_MIGRATION_START,
|
|
514
|
+
"## UNS Kit dependency upgrades",
|
|
515
|
+
"",
|
|
516
|
+
"- Before changing any `@uns-kit/*` version, record the installed source version and intended target version.",
|
|
517
|
+
"- 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.",
|
|
518
|
+
"- 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.",
|
|
519
|
+
AGENT_MIGRATION_END,
|
|
520
|
+
].join("\n");
|
|
521
|
+
async function ensureAgentMigrationGuidance(targetDir) {
|
|
522
|
+
const agentsPath = path.join(targetDir, "AGENTS.md");
|
|
523
|
+
let existing;
|
|
524
|
+
try {
|
|
525
|
+
existing = await readFile(agentsPath, "utf8");
|
|
526
|
+
}
|
|
527
|
+
catch (error) {
|
|
528
|
+
if (error.code !== "ENOENT") {
|
|
529
|
+
throw error;
|
|
530
|
+
}
|
|
531
|
+
await writeFile(agentsPath, `# AGENTS\n\n${AGENT_MIGRATION_BLOCK}\n`, "utf8");
|
|
532
|
+
return "created";
|
|
533
|
+
}
|
|
534
|
+
const startIndex = existing.indexOf(AGENT_MIGRATION_START);
|
|
535
|
+
const endIndex = existing.indexOf(AGENT_MIGRATION_END);
|
|
536
|
+
const hasStart = startIndex >= 0;
|
|
537
|
+
const hasEnd = endIndex >= 0;
|
|
538
|
+
if (hasStart !== hasEnd || (hasStart && endIndex < startIndex)) {
|
|
539
|
+
throw new Error(`Malformed UNS Kit migration block in ${agentsPath}. Remove the unmatched migration marker and run upgrade again.`);
|
|
540
|
+
}
|
|
541
|
+
let next;
|
|
542
|
+
if (hasStart) {
|
|
543
|
+
const afterEnd = endIndex + AGENT_MIGRATION_END.length;
|
|
544
|
+
next = existing.slice(0, startIndex) + AGENT_MIGRATION_BLOCK + existing.slice(afterEnd);
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
const separator = existing.endsWith("\n\n") ? "" : existing.endsWith("\n") ? "\n" : "\n\n";
|
|
548
|
+
next = `${existing}${separator}${AGENT_MIGRATION_BLOCK}\n`;
|
|
549
|
+
}
|
|
550
|
+
if (next === existing) {
|
|
551
|
+
return "unchanged";
|
|
552
|
+
}
|
|
553
|
+
await writeFile(agentsPath, next, "utf8");
|
|
554
|
+
return "updated";
|
|
555
|
+
}
|
|
510
556
|
async function configureDevops(targetPath, options) {
|
|
511
557
|
const targetDir = path.resolve(process.cwd(), targetPath ?? ".");
|
|
512
558
|
await ensureGitRepository(targetDir);
|
|
@@ -944,7 +990,9 @@ async function upgradeProject(targetPath) {
|
|
|
944
990
|
}
|
|
945
991
|
const syncScriptsChanged = ensureUnsReferenceScripts(scripts);
|
|
946
992
|
changed = syncScriptsChanged || changed;
|
|
947
|
-
|
|
993
|
+
const agentGuidanceResult = await ensureAgentMigrationGuidance(targetDir);
|
|
994
|
+
changed = agentGuidanceResult !== "unchanged" || changed;
|
|
995
|
+
if (removed.length > 0 || syncScriptsChanged) {
|
|
948
996
|
await writeFile(packagePath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
|
949
997
|
}
|
|
950
998
|
console.log(`\nUpgrade complete for ${targetDir}`);
|
|
@@ -960,6 +1008,15 @@ async function upgradeProject(targetPath) {
|
|
|
960
1008
|
else {
|
|
961
1009
|
console.log(" Ensured: sync-uns-schema, sync-uns-metadata");
|
|
962
1010
|
}
|
|
1011
|
+
if (agentGuidanceResult === "created") {
|
|
1012
|
+
console.log(" Created AGENTS.md with version-bounded migration guidance.");
|
|
1013
|
+
}
|
|
1014
|
+
else if (agentGuidanceResult === "updated") {
|
|
1015
|
+
console.log(" Added/updated version-bounded migration guidance in AGENTS.md.");
|
|
1016
|
+
}
|
|
1017
|
+
else {
|
|
1018
|
+
console.log(" Ensured version-bounded migration guidance in AGENTS.md.");
|
|
1019
|
+
}
|
|
963
1020
|
if (!changed) {
|
|
964
1021
|
console.log(" Already up to date.");
|
|
965
1022
|
}
|
package/dist/service-bundle.js
CHANGED
|
@@ -75,6 +75,14 @@ export function generateAgentsMarkdown(bundle) {
|
|
|
75
75
|
"- Read `service.bundle.json` first when planning or generating service-specific code; it is the project source of truth.",
|
|
76
76
|
"- Keep `SERVICE_SPEC.md` and this file aligned with `service.bundle.json` when the bundle changes.",
|
|
77
77
|
"",
|
|
78
|
+
"<!-- uns-kit:migrations:start -->",
|
|
79
|
+
"## UNS Kit dependency upgrades",
|
|
80
|
+
"",
|
|
81
|
+
"- Before changing any `@uns-kit/*` version, record the installed source version and intended target version.",
|
|
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
|
+
"- 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
|
+
"<!-- uns-kit:migrations:end -->",
|
|
85
|
+
"",
|
|
78
86
|
];
|
|
79
87
|
if (outputPublisherContracts.length) {
|
|
80
88
|
lines.push("## Output Publishing", ...outputPublisherContracts.flatMap((contract) => [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.73",
|
|
4
4
|
"description": "Command line scaffolding tool for UNS applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,13 +26,14 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"azure-devops-node-api": "^15.1.1",
|
|
29
|
-
"@uns-kit/core": "2.0.
|
|
29
|
+
"@uns-kit/core": "2.0.73"
|
|
30
30
|
},
|
|
31
31
|
"unsKitPackages": {
|
|
32
|
-
"@uns-kit/core": "2.0.
|
|
33
|
-
"@uns-kit/api": "2.0.
|
|
34
|
-
"@uns-kit/cron": "2.0.
|
|
35
|
-
"@uns-kit/database": "2.0.
|
|
32
|
+
"@uns-kit/core": "2.0.73",
|
|
33
|
+
"@uns-kit/api": "2.0.73",
|
|
34
|
+
"@uns-kit/cron": "2.0.73",
|
|
35
|
+
"@uns-kit/database": "2.0.73",
|
|
36
|
+
"@uns-kit/assistant-workflow": "2.0.73"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
39
|
"build": "tsc -p tsconfig.build.json",
|
package/templates/cron/AGENTS.md
CHANGED
|
@@ -9,6 +9,7 @@ Pointers for AI/code-assist tools when working in this generated project.
|
|
|
9
9
|
- `src/examples/*.ts` for cron-driven publish patterns and description registration.
|
|
10
10
|
- Installed docs (under `node_modules`):
|
|
11
11
|
- `@uns-kit/core/README.md`
|
|
12
|
+
- `@uns-kit/core/MIGRATIONS.md`
|
|
12
13
|
- `@uns-kit/api/README.md` (if installed)
|
|
13
14
|
- `@uns-kit/cron/README.md` (if installed)
|
|
14
15
|
- `@uns-kit/cli/README.md` (if installed)
|
|
@@ -18,3 +19,11 @@ Pointers for AI/code-assist tools when working in this generated project.
|
|
|
18
19
|
- `pnpm run generate-codegen` -> GraphQL codegen (after configure-codegen)
|
|
19
20
|
- `pnpm run sync-uns-schema -- --controller-url ... --token ...` -> pulls `uns-dictionary.json` + `uns-measurements.json` from the controller and regenerates local TS helpers
|
|
20
21
|
- `pnpm run sync-uns-metadata -- --controller-url ... --token ...` -> pulls topics/tags/assets from the controller and regenerates local TS helpers
|
|
22
|
+
|
|
23
|
+
<!-- uns-kit:migrations:start -->
|
|
24
|
+
## UNS Kit dependency upgrades
|
|
25
|
+
|
|
26
|
+
- Before changing any `@uns-kit/*` version, record the installed source version and intended target version.
|
|
27
|
+
- 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
|
+
- 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
|
+
<!-- uns-kit:migrations:end -->
|
|
@@ -9,6 +9,7 @@ Pointers for AI/code-assist tools when working in this generated project.
|
|
|
9
9
|
- `src/examples/*.ts` for idiomatic publishing (multi-attribute) and description registration.
|
|
10
10
|
- Installed docs (under `node_modules`):
|
|
11
11
|
- `@uns-kit/core/README.md`
|
|
12
|
+
- `@uns-kit/core/MIGRATIONS.md`
|
|
12
13
|
- `@uns-kit/api/README.md` (if installed)
|
|
13
14
|
- `@uns-kit/cron/README.md` (if installed)
|
|
14
15
|
- `@uns-kit/cli/README.md` (if installed)
|
|
@@ -18,3 +19,11 @@ Pointers for AI/code-assist tools when working in this generated project.
|
|
|
18
19
|
- `pnpm run generate-codegen` -> GraphQL codegen (after configure-codegen)
|
|
19
20
|
- `pnpm run sync-uns-schema -- --controller-url ... --token ...` -> pulls `uns-dictionary.json` + `uns-measurements.json` from the controller and regenerates local TS helpers
|
|
20
21
|
- `pnpm run sync-uns-metadata -- --controller-url ... --token ...` -> pulls topics/tags/assets from the controller and regenerates local TS helpers
|
|
22
|
+
|
|
23
|
+
<!-- uns-kit:migrations:start -->
|
|
24
|
+
## UNS Kit dependency upgrades
|
|
25
|
+
|
|
26
|
+
- Before changing any `@uns-kit/*` version, record the installed source version and intended target version.
|
|
27
|
+
- 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
|
+
- 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
|
+
<!-- uns-kit:migrations:end -->
|