@syengup/friday-channel-next 0.0.31 → 0.0.34

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.
@@ -29,7 +29,9 @@ function realHome() {
29
29
  const USER_HOME = realHome();
30
30
  const PLUGIN_DIR = process.argv[2] || join(USER_HOME, ".openclaw", "extensions", "friday-channel-next");
31
31
  const OPENCLAW_CONFIG = join(USER_HOME, ".openclaw", "openclaw.json");
32
+ const REPO_URL = process.env.FRIDAY_NEXT_REPO || "https://github.com/SyengUp/openclaw-fridaynext-channel.git";
32
33
 
34
+ const G = (s) => `\x1b[32m${s}\x1b[0m`;
33
35
  const Y = (s) => `\x1b[33m${s}\x1b[0m`;
34
36
  const R = (s) => `\x1b[31m${s}\x1b[0m`;
35
37
  function log(msg) {
@@ -94,6 +96,33 @@ if (missing.length) {
94
96
  process.exit(1);
95
97
  }
96
98
 
99
+ // --------------- version check ---------------
100
+ {
101
+ const MIN_OPENCLAW = [2026, 5, 12];
102
+ try {
103
+ const verOut = execSync(`${openclawCmd} --version`, { encoding: "utf8" }).trim();
104
+ const m = verOut.match(/(\d{4})\.(\d{1,2})\.(\d{1,2})/);
105
+ if (m) {
106
+ const cur = [parseInt(m[1], 10), parseInt(m[2], 10), parseInt(m[3], 10)];
107
+ let tooOld = false;
108
+ for (let i = 0; i < 3; i++) {
109
+ if (cur[i] > MIN_OPENCLAW[i]) break;
110
+ if (cur[i] < MIN_OPENCLAW[i]) { tooOld = true; break; }
111
+ }
112
+ if (tooOld) {
113
+ err(`OpenClaw version ${m[0]} is too old.`);
114
+ err(`Friday Next channel requires OpenClaw 2026.5.12 or above.`);
115
+ err(`Please update: ${openclawCmd} update`);
116
+ err(`请先升级 OpenClaw 至 2026.5.12 或以上版本:${openclawCmd} update`);
117
+ process.exit(1);
118
+ }
119
+ }
120
+ } catch {
121
+ // If version check itself fails, don't block — continue with a warning
122
+ warn("Could not determine OpenClaw version — continuing anyway.");
123
+ }
124
+ }
125
+
97
126
  const PKG = has("pnpm") ? "pnpm" : has("npm") ? "npm" : null;
98
127
  if (!PKG) {
99
128
  err("pnpm or npm is required but not found. Install one first.");
@@ -122,7 +151,7 @@ if (!existsSync(OPENCLAW_CONFIG)) {
122
151
 
123
152
  // --------------- acquire source ---------------
124
153
 
125
- function copyFromNpmPackage() {
154
+ if (isRunningFromNpmPackage()) {
126
155
  log(`Copying plugin from npm package to ${PLUGIN_DIR} ...`);
127
156
  cpSync(__dirname, PLUGIN_DIR, {
128
157
  recursive: true,
@@ -133,22 +162,24 @@ function copyFromNpmPackage() {
133
162
  return ![".git", "node_modules", "dist", "attachments", ".claude"].includes(top);
134
163
  },
135
164
  });
136
- }
137
-
138
- if (isRunningFromNpmPackage()) {
139
- copyFromNpmPackage();
140
165
  } else if (existsSync(PLUGIN_DIR)) {
141
166
  log(`Plugin directory found: ${PLUGIN_DIR}`);
142
- log("Updating via npx...");
143
- try {
144
- execSync("npx -y @syengup/friday-channel-next", { stdio: "inherit" });
145
- process.exit(0);
146
- } catch {
147
- warn("Could not update via npx — continuing with existing source.");
167
+ if (existsSync(join(PLUGIN_DIR, ".git"))) {
168
+ try {
169
+ log("Pulling latest changes...");
170
+ execSync("git fetch origin && git checkout -f origin/main", { cwd: PLUGIN_DIR, stdio: "pipe" });
171
+ log("Updated to latest version.");
172
+ } catch {
173
+ warn("Could not update from git — continuing with existing source.");
174
+ }
148
175
  }
149
176
  } else {
150
- err("This plugin is installed via npx. Run: npx -y @syengup/friday-channel-next");
151
- process.exit(1);
177
+ if (!has("git")) {
178
+ err("git is required for installation from GitHub. Install git first or use npx @openclaw/friday-channel-next.");
179
+ process.exit(1);
180
+ }
181
+ log(`Cloning plugin to ${PLUGIN_DIR} ...`);
182
+ execSync(`git clone "${REPO_URL}" "${PLUGIN_DIR}"`, { stdio: "inherit" });
152
183
  }
153
184
 
154
185
  process.chdir(PLUGIN_DIR);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@syengup/friday-channel-next",
3
- "version": "0.0.31",
3
+ "version": "0.0.34",
4
4
  "description": "OpenClaw Friday Next Apple channel plugin",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "index.ts",
8
8
  "src/",
9
- "cli.mjs",
9
+ "install.js",
10
10
  "tsconfig.json",
11
11
  "openclaw.plugin.json"
12
12
  ],
@@ -19,7 +19,7 @@
19
19
  "test:msg-live": "node scripts/message-roundtrip-live.mjs"
20
20
  },
21
21
  "bin": {
22
- "friday-channel-next": "cli.mjs"
22
+ "friday-channel-next": "install.js"
23
23
  },
24
24
  "main": "./dist/index.js",
25
25
  "types": "./dist/index.d.ts",