@getxflow/cli 0.10.0 → 0.10.2

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/state.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.shouldNudge = shouldNudge;
4
+ exports.shouldNudgeSkill = shouldNudgeSkill;
5
+ exports.markSkillNudged = markSkillNudged;
6
+ exports.clearSkillNudges = clearSkillNudges;
4
7
  exports.markNudged = markNudged;
5
8
  const node_fs_1 = require("node:fs");
6
9
  const node_os_1 = require("node:os");
@@ -33,11 +36,53 @@ function shouldNudge(version) {
33
36
  return true;
34
37
  return Date.now() - at > NUDGE_INTERVAL_MS;
35
38
  }
36
- /** Best effort: a read-only home folder must not break the command that just worked. */
39
+ /**
40
+ * Same window, but per stale copy rather than per version. The key carries the CLI
41
+ * version, so the day a release actually changes the skill the notice speaks again
42
+ * instead of staying quiet on yesterday's answer.
43
+ *
44
+ * A window and not a single "already said it": the copy stays wrong until somebody
45
+ * refreshes it, and an agent whose session starts tomorrow has to hear about it too.
46
+ */
47
+ function shouldNudgeSkill(key) {
48
+ if (process.env.CI)
49
+ return false;
50
+ const at = read().skillNudgedAt?.[key];
51
+ const said = at ? Date.parse(at) : Number.NaN;
52
+ if (!Number.isFinite(said))
53
+ return true;
54
+ return Date.now() - said > NUDGE_INTERVAL_MS;
55
+ }
56
+ /** Entries pile up across versions and folders, so the stale ones go on every write. */
57
+ function markSkillNudged(key) {
58
+ const now = Date.now();
59
+ const kept = {};
60
+ for (const [seen, at] of Object.entries(read().skillNudgedAt ?? {})) {
61
+ const said = Date.parse(at);
62
+ if (Number.isFinite(said) && now - said < NUDGE_INTERVAL_MS * 30)
63
+ kept[seen] = at;
64
+ }
65
+ kept[key] = new Date(now).toISOString();
66
+ write({ skillNudgedAt: kept });
67
+ }
68
+ /**
69
+ * Forget what was said once there is nothing to repair. The window is for a copy nobody
70
+ * fixed, not for the memory of one that is fine now: without this, "warned, refreshed,
71
+ * drifted again" stays silent all day, because the key is the path and it is already marked.
72
+ */
73
+ function clearSkillNudges() {
74
+ if (Object.keys(read().skillNudgedAt ?? {}).length === 0)
75
+ return;
76
+ write({ skillNudgedAt: {} });
77
+ }
37
78
  function markNudged(version) {
79
+ write({ nudgedVersion: version, nudgedAt: new Date().toISOString() });
80
+ }
81
+ /** Best effort: a read-only home folder must not break the command that just worked. */
82
+ function write(patch) {
38
83
  try {
39
84
  (0, node_fs_1.mkdirSync)((0, node_path_1.join)((0, node_os_1.homedir)(), '.xflow'), { recursive: true, mode: 0o700 });
40
- const state = { ...read(), nudgedVersion: version, nudgedAt: new Date().toISOString() };
85
+ const state = { ...read(), ...patch };
41
86
  (0, node_fs_1.writeFileSync)(statePath(), `${JSON.stringify(state, null, 2)}\n`, 'utf-8');
42
87
  }
43
88
  catch {
package/dist/version.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_API_URL = exports.CLI_VERSION = void 0;
4
4
  /** Keep in sync with cli/package.json. */
5
- exports.CLI_VERSION = '0.10.0';
5
+ exports.CLI_VERSION = '0.10.2';
6
6
  /** Overridden by XFLOW_API_URL or the `api` field in xflow.json. */
7
7
  exports.DEFAULT_API_URL = 'https://app.getxflow.com';
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
- {
2
- "name": "@getxflow/cli",
3
- "version": "0.10.0",
4
- "description": "CLI for the XFlow platform: source sync, deployment and publishing of applications",
5
- "license": "UNLICENSED",
6
- "engines": {
7
- "node": ">=20"
8
- },
9
- "bin": {
10
- "xflow": "dist/bin.js"
11
- },
12
- "files": [
13
- "dist",
14
- "skills"
15
- ],
16
- "scripts": {
17
- "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
18
- "build": "npm run clean && tsc -p tsconfig.json",
19
- "prepublishOnly": "npm run build"
20
- },
21
- "publishConfig": {
22
- "access": "public"
23
- }
24
- }
1
+ {
2
+ "name": "@getxflow/cli",
3
+ "version": "0.10.2",
4
+ "description": "CLI for the XFlow platform: source sync, deployment and publishing of applications",
5
+ "license": "UNLICENSED",
6
+ "engines": {
7
+ "node": ">=20"
8
+ },
9
+ "bin": {
10
+ "xflow": "dist/bin.js"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "skills"
15
+ ],
16
+ "scripts": {
17
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
18
+ "build": "npm run clean && tsc -p tsconfig.json",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ }
24
+ }