hirmos 1.3.1 → 1.3.3
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 +17 -0
- package/dist/commands/init.js +10 -1
- package/dist/index.js +8 -0
- package/dist/lib/update-notice.js +79 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,6 +61,23 @@ Disable remote download and require an existing `_hirmos/` or local `--source`:
|
|
|
61
61
|
hirmos init --offline
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
## CLI update notice
|
|
65
|
+
|
|
66
|
+
When `hirmos init` runs online, it checks whether a newer published HIRMOS CLI version is available on npm. If a newer version exists, the CLI prints a non-blocking message such as:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
A newer HIRMOS CLI is available: 1.3.3.
|
|
70
|
+
Update with: npm install -g hirmos@latest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The notice does not stop initialization. Network failures, registry errors, or timeouts are ignored.
|
|
74
|
+
|
|
75
|
+
Use `--offline` to disable both remote framework download and the update check. To disable only the update notice while keeping remote framework download available, run:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
HIRMOS_CLI_UPDATE_CHECK=0 hirmos init
|
|
79
|
+
```
|
|
80
|
+
|
|
64
81
|
## Supported integrations
|
|
65
82
|
|
|
66
83
|
```text
|
package/dist/commands/init.js
CHANGED
|
@@ -58,7 +58,16 @@ function formatInitSummary(first, selected, added, alreadyInstalled, targets, in
|
|
|
58
58
|
for (const target of targets)
|
|
59
59
|
lines.push(`- ${target}`);
|
|
60
60
|
lines.push("", "Next step:");
|
|
61
|
-
lines.push("Open your AI coding tool and
|
|
61
|
+
lines.push("Open your AI coding tool in this project and run a HIRMOS workflow command, for example:");
|
|
62
|
+
lines.push("");
|
|
63
|
+
lines.push("hirmos requirements");
|
|
64
|
+
lines.push("hirmos system-design");
|
|
65
|
+
lines.push("hirmos implementation");
|
|
66
|
+
lines.push("");
|
|
67
|
+
lines.push("Fallback initialization:");
|
|
68
|
+
lines.push("If your tool does not automatically pick up the selected agent/tool integration files, copy and paste this prompt into your agent:");
|
|
69
|
+
lines.push("");
|
|
70
|
+
lines.push("Read and follow the instructions on _hirmos/HIRMOS_CORE.md.");
|
|
62
71
|
lines.push("", "To add more integrations later:");
|
|
63
72
|
lines.push("hirmos init --integration claude,cursor,copilot");
|
|
64
73
|
return `${lines.join("\n")}\n`;
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const args_1 = require("./lib/args");
|
|
5
5
|
const errors_1 = require("./lib/errors");
|
|
6
6
|
const init_1 = require("./commands/init");
|
|
7
|
+
const update_notice_1 = require("./lib/update-notice");
|
|
7
8
|
function main() {
|
|
8
9
|
try {
|
|
9
10
|
const parsed = (0, args_1.parseArgs)(process.argv.slice(2));
|
|
@@ -12,6 +13,13 @@ function main() {
|
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
if (parsed.command === "init") {
|
|
16
|
+
if (!parsed.offline) {
|
|
17
|
+
const updateNotice = (0, update_notice_1.getUpdateNotice)();
|
|
18
|
+
if (updateNotice)
|
|
19
|
+
process.stderr.write(`${(0, update_notice_1.formatUpdateNotice)(updateNotice)}
|
|
20
|
+
|
|
21
|
+
`);
|
|
22
|
+
}
|
|
15
23
|
const summary = (0, init_1.runInit)({
|
|
16
24
|
projectPath: parsed.projectPath,
|
|
17
25
|
integrations: parsed.integrations,
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getInstalledCliVersion = getInstalledCliVersion;
|
|
7
|
+
exports.normalizeSemver = normalizeSemver;
|
|
8
|
+
exports.compareSemver = compareSemver;
|
|
9
|
+
exports.buildUpdateNotice = buildUpdateNotice;
|
|
10
|
+
exports.formatUpdateNotice = formatUpdateNotice;
|
|
11
|
+
exports.getLatestPublishedVersion = getLatestPublishedVersion;
|
|
12
|
+
exports.getUpdateNotice = getUpdateNotice;
|
|
13
|
+
const fs_1 = __importDefault(require("fs"));
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const child_process_1 = require("child_process");
|
|
16
|
+
const PACKAGE_NAME = "hirmos";
|
|
17
|
+
const DEFAULT_TIMEOUT_MS = 1500;
|
|
18
|
+
const ANSI_BOLD = "\u001b[1m";
|
|
19
|
+
const ANSI_YELLOW = "\u001b[33m";
|
|
20
|
+
const ANSI_RESET = "\u001b[0m";
|
|
21
|
+
function getInstalledCliVersion(cliRoot = path_1.default.resolve(__dirname, "../..")) {
|
|
22
|
+
try {
|
|
23
|
+
const packageJsonPath = path_1.default.join(cliRoot, "package.json");
|
|
24
|
+
const raw = fs_1.default.readFileSync(packageJsonPath, "utf8");
|
|
25
|
+
const parsed = JSON.parse(raw);
|
|
26
|
+
return typeof parsed.version === "string" && parsed.version.trim() ? parsed.version.trim() : null;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function normalizeSemver(value) {
|
|
33
|
+
return value.trim().replace(/^v/u, "").split("-")[0];
|
|
34
|
+
}
|
|
35
|
+
function compareSemver(left, right) {
|
|
36
|
+
const leftParts = normalizeSemver(left).split(".").map((part) => Number.parseInt(part, 10));
|
|
37
|
+
const rightParts = normalizeSemver(right).split(".").map((part) => Number.parseInt(part, 10));
|
|
38
|
+
for (let i = 0; i < 3; i += 1) {
|
|
39
|
+
const leftValue = Number.isFinite(leftParts[i]) ? leftParts[i] : 0;
|
|
40
|
+
const rightValue = Number.isFinite(rightParts[i]) ? rightParts[i] : 0;
|
|
41
|
+
if (leftValue > rightValue)
|
|
42
|
+
return 1;
|
|
43
|
+
if (leftValue < rightValue)
|
|
44
|
+
return -1;
|
|
45
|
+
}
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
function buildUpdateNotice(currentVersion, latestVersion) {
|
|
49
|
+
if (!currentVersion || !latestVersion)
|
|
50
|
+
return null;
|
|
51
|
+
if (compareSemver(latestVersion, currentVersion) <= 0)
|
|
52
|
+
return null;
|
|
53
|
+
return `A newer HIRMOS CLI is available: ${latestVersion}.\nUpdate with: npm install -g ${PACKAGE_NAME}@latest`;
|
|
54
|
+
}
|
|
55
|
+
function formatUpdateNotice(message, useColor = Boolean(process.stderr.isTTY) && process.env.NO_COLOR === undefined) {
|
|
56
|
+
return useColor ? `${ANSI_BOLD}${ANSI_YELLOW}${message}${ANSI_RESET}` : message;
|
|
57
|
+
}
|
|
58
|
+
function getLatestPublishedVersion(timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
59
|
+
if (process.env.HIRMOS_CLI_UPDATE_CHECK === "0" || process.env.HIRMOS_NO_UPDATE_CHECK === "1") {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const result = (0, child_process_1.spawnSync)("npm", ["view", PACKAGE_NAME, "version", "--silent"], {
|
|
64
|
+
encoding: "utf8",
|
|
65
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
66
|
+
timeout: timeoutMs
|
|
67
|
+
});
|
|
68
|
+
if (result.error || result.status !== 0)
|
|
69
|
+
return null;
|
|
70
|
+
const version = String(result.stdout ?? "").trim();
|
|
71
|
+
return /^v?\d+\.\d+\.\d+(?:[-+][A-Za-z0-9.-]+)?$/u.test(version) ? version : null;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function getUpdateNotice() {
|
|
78
|
+
return buildUpdateNotice(getInstalledCliVersion(), getLatestPublishedVersion());
|
|
79
|
+
}
|