@visulima/cerebro 3.0.0-alpha.7 → 3.0.0-alpha.8

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/commands/completion-command.js +203 -5
  3. package/dist/commands/help-command.js +3 -1
  4. package/dist/commands/readme-command.js +330 -32
  5. package/dist/commands/version-command.js +18 -1
  6. package/dist/index.js +7 -1
  7. package/dist/logger/create-pail-logger.js +34 -1
  8. package/dist/packem_chunks/has-new-version.js +259 -1
  9. package/dist/packem_shared/Cerebro-C2mnCyQf.js +3313 -0
  10. package/dist/packem_shared/VERBOSITY_QUIET-Dp46zlLW.js +10 -0
  11. package/dist/packem_shared/VisulimaError-DA7QsCxH.js +34 -0
  12. package/dist/packem_shared/cerebro-error-GmJ3jN7Q.js +16 -0
  13. package/dist/packem_shared/help-command-BY7rQUvM.js +249 -0
  14. package/dist/packem_shared/index-C2-8b3A4.js +259 -0
  15. package/dist/packem_shared/runtime-process-B6ZplyWn.js +187 -0
  16. package/dist/plugins/error-handler-plugin.js +636 -1
  17. package/dist/plugins/runtime-version-check-plugin.js +77 -1
  18. package/dist/plugins/update-notifier/update-notifier-plugin.js +517 -1
  19. package/package.json +8 -7
  20. package/dist/packem_shared/Cerebro-aPZjbfzf.js +0 -4
  21. package/dist/packem_shared/VERBOSITY_QUIET-XPultrIA.js +0 -1
  22. package/dist/packem_shared/VisulimaError-wAUvPRfg.js +0 -76
  23. package/dist/packem_shared/cerebro-error-BnJTixb2.js +0 -1
  24. package/dist/packem_shared/help-command-CIRIXN03.js +0 -1
  25. package/dist/packem_shared/index-DQ3pvLQH.js +0 -6
  26. package/dist/packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js +0 -1
  27. package/dist/packem_shared/renderError-ZMlMvw1N-eVUSdl6c.js +0 -24
  28. package/dist/packem_shared/runtime-process-G-n-wOub.js +0 -1
@@ -1 +1,77 @@
1
- var a=Object.defineProperty;var p=(r,t)=>a(r,"name",{value:t,configurable:!0});import{d as v,e as d,g as y}from"../packem_shared/runtime-process-G-n-wOub.js";var g=Object.defineProperty,n=p((r,t)=>g(r,"name",{value:t,configurable:!0}),"o");const s=n(r=>{if(!r||typeof r!="string")return 0;const t=r.split(".");if(t.length===0||!t[0])return 0;const e=Number.parseInt(t[0],10);return Number.isNaN(e)?0:e},"parseMajorVersion"),h=n(r=>!r||typeof r!="string"?"":r.replace("v",""),"extractNodeVersion"),l=n(()=>{if(typeof Bun<"u"){const e=Bun.version||"";return{major:s(e),type:"bun",version:e}}if(typeof Deno<"u"){const e=Deno.version?.deno||"";return{major:s(e),type:"deno",version:e}}const r=y().node??"",t=h(r);return{major:s(t),type:"node",version:t}},"detectRuntime"),b=n((r={})=>({description:"Checks if the current runtime version meets the minimum requirement",init:n(async t=>{const e=l(),c={bun:1,deno:1,node:18};let o;try{const u=v().CEREBRO_MIN_NODE_VERSION,m=u===void 0?void 0:Number.parseInt(u,10);o=Number.isNaN(m)?void 0:m}catch{o=void 0}let i;r.runtimes?.[e.type]?.minVersion!==void 0?i=r.runtimes[e.type].minVersion:e.type==="node"&&o!==void 0?i=o:i=c[e.type],e.major<i&&(t.logger.error(`cerebro requires ${e.type} version ${i} or higher. You have ${e.type} ${e.version}. Read our version support policy: https://github.com/visulima/visulima#supported-runtimes`),d(1)),t.logger.debug(`Runtime version check passed: ${e.type} ${e.version} >= ${i}`)},"init"),name:"runtime-version-check",version:"1.0.0"}),"runtimeVersionCheckPlugin");export{b as runtimeVersionCheckPlugin};
1
+ import { d as getEnv, e as exitProcess, a as getVersions } from '../packem_shared/runtime-process-B6ZplyWn.js';
2
+
3
+ const parseMajorVersion = (versionString) => {
4
+ if (!versionString || typeof versionString !== "string") {
5
+ return 0;
6
+ }
7
+ const parts = versionString.split(".");
8
+ if (parts.length === 0 || !parts[0]) {
9
+ return 0;
10
+ }
11
+ const major = Number.parseInt(parts[0], 10);
12
+ return Number.isNaN(major) ? 0 : major;
13
+ };
14
+ const extractNodeVersion = (processVersion) => {
15
+ if (!processVersion || typeof processVersion !== "string") {
16
+ return "";
17
+ }
18
+ return processVersion.replace("v", "");
19
+ };
20
+ const detectRuntime = () => {
21
+ if (typeof Bun !== "undefined") {
22
+ const version2 = Bun.version || "";
23
+ const major2 = parseMajorVersion(version2);
24
+ return { major: major2, type: "bun", version: version2 };
25
+ }
26
+ if (typeof Deno !== "undefined") {
27
+ const version2 = Deno.version?.deno || "";
28
+ const major2 = parseMajorVersion(version2);
29
+ return { major: major2, type: "deno", version: version2 };
30
+ }
31
+ const versions = getVersions();
32
+ const nodeVersion = versions.node ?? "";
33
+ const version = extractNodeVersion(nodeVersion);
34
+ const major = parseMajorVersion(version);
35
+ return { major, type: "node", version };
36
+ };
37
+ const runtimeVersionCheckPlugin = (options = {}) => {
38
+ return {
39
+ description: "Checks if the current runtime version meets the minimum requirement",
40
+ init: async (context) => {
41
+ const runtime = detectRuntime();
42
+ const defaultMinVersions = {
43
+ bun: 1,
44
+ deno: 1,
45
+ node: 18
46
+ };
47
+ let envMinVersion;
48
+ try {
49
+ const env = getEnv();
50
+ const envRaw = env.CEREBRO_MIN_NODE_VERSION;
51
+ const parsed = envRaw === void 0 ? void 0 : Number.parseInt(envRaw, 10);
52
+ envMinVersion = Number.isNaN(parsed) ? void 0 : parsed;
53
+ } catch {
54
+ envMinVersion = void 0;
55
+ }
56
+ let minVersion;
57
+ if (options.runtimes?.[runtime.type]?.minVersion !== void 0) {
58
+ minVersion = options.runtimes[runtime.type].minVersion;
59
+ } else if (runtime.type === "node" && envMinVersion !== void 0) {
60
+ minVersion = envMinVersion;
61
+ } else {
62
+ minVersion = defaultMinVersions[runtime.type];
63
+ }
64
+ if (runtime.major < minVersion) {
65
+ context.logger.error(
66
+ `cerebro requires ${runtime.type} version ${minVersion} or higher. You have ${runtime.type} ${runtime.version}. Read our version support policy: https://github.com/visulima/visulima#supported-runtimes`
67
+ );
68
+ exitProcess(1);
69
+ }
70
+ context.logger.debug(`Runtime version check passed: ${runtime.type} ${runtime.version} >= ${minVersion}`);
71
+ },
72
+ name: "runtime-version-check",
73
+ version: "1.0.0"
74
+ };
75
+ };
76
+
77
+ export { runtimeVersionCheckPlugin };
@@ -1 +1,517 @@
1
- var m=Object.defineProperty;var I=(t,r)=>m(t,"name",{value:r,configurable:!0});import{d as A}from"../../packem_shared/runtime-process-G-n-wOub.js";var i={},c,U;function l(){return U||(U=1,c=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]),c}I(l,"requireVendors");var L;function P(){return L||(L=1,(function(t){var r=Object.defineProperty,E=I((n,a)=>r(n,"name",{value:a,configurable:!0}),"t");const s=l(),e=process.env;Object.defineProperty(t,"_vendors",{value:s.map(function(n){return n.constant})}),t.name=null,t.isPR=null,t.id=null,e.CI!=="false"&&s.forEach(function(n){const a=(Array.isArray(n.env)?n.env:[n.env]).every(function(R){return o(R)});t[n.constant]=a,a&&(t.name=n.name,t.isPR=_(n),t.id=n.constant)}),t.isCI=!!(e.CI!=="false"&&(e.BUILD_ID||e.BUILD_NUMBER||e.CI||e.CI_APP_ID||e.CI_BUILD_ID||e.CI_BUILD_NUMBER||e.CI_NAME||e.CONTINUOUS_INTEGRATION||e.RUN_ID||t.name));function o(n){return typeof n=="string"?!!e[n]:"env"in n?e[n.env]&&e[n.env].includes(n.includes):"any"in n?n.any.some(function(a){return!!e[a]}):Object.keys(n).every(function(a){return e[a]===n[a]})}I(o,"checkEnv"),E(o,"checkEnv");function _(n){switch(typeof n.pr){case"string":return!!e[n.pr];case"object":return"env"in n.pr?"any"in n.pr?n.pr.any.some(function(a){return e[n.pr.env]===a}):n.pr.env in e&&e[n.pr.env]!==n.pr.ne:"any"in n.pr?n.pr.any.some(function(a){return!!e[a]}):o(n.pr);default:return null}}I(_,"checkPR"),E(_,"checkPR")})(i)),i}I(P,"requireCiInfo");var d=P(),O=Object.defineProperty,C=I((t,r)=>O(t,"name",{value:r,configurable:!0}),"i");const f=C((t={})=>({beforeCommand:C(async r=>{const{logger:E,runtime:s}=r,e=s.getPackageName(),o=s.getPackageVersion();if(!e||!o){E.debug("Update notifier: package name or version not provided, skipping...");return}const _=A(),n={alwaysRun:!1,debug:_.CEREBRO_OUTPUT_LEVEL==="256",distTag:"latest",pkg:{name:e,version:o},updateCheckInterval:1e3*60*60*24,...t};if(!(n.alwaysRun||!(_.NO_UPDATE_NOTIFIER||_.NODE_ENV==="test"||r.argv.includes("--no-update-notifier")||d.isCI))){E.debug("Update notifier: skipping check (disabled by environment or flags)");return}(E?.raw??E.log)("Checking for updates...");try{const a=await(await import("../../packem_chunks/has-new-version.js").then(R=>R.default))(n);if(a){const[{boxen:R},{dim:v,green:u,reset:T,yellow:D}]=await Promise.all([import("@visulima/boxen"),import("@visulima/colorize")]),p=`Update available ${v(o.toString())}${T(" → ")}${u(a)}`;E.error(R(p,{borderColor:C(S=>D(S),"borderColor"),borderStyle:"round",margin:1,padding:1,textAlignment:"center"}))}}catch(a){E.debug("Update notifier: failed to check for updates",a)}},"beforeCommand"),description:"Checks for package updates and notifies users",name:"update-notifier",version:"1.0.0"}),"updateNotifierPlugin");export{f as updateNotifierPlugin};
1
+ import { d as getEnv } from '../../packem_shared/runtime-process-B6ZplyWn.js';
2
+
3
+ var ciInfo = {};
4
+
5
+ var vendors;
6
+ var hasRequiredVendors;
7
+
8
+ function requireVendors () {
9
+ if (hasRequiredVendors) return vendors;
10
+ hasRequiredVendors = 1;
11
+ vendors = [
12
+ {
13
+ name: "Agola CI",
14
+ constant: "AGOLA",
15
+ env: "AGOLA_GIT_REF",
16
+ pr: "AGOLA_PULL_REQUEST_ID"
17
+ },
18
+ {
19
+ name: "Alpic",
20
+ constant: "ALPIC",
21
+ env: "ALPIC_HOST"
22
+ },
23
+ {
24
+ name: "Appcircle",
25
+ constant: "APPCIRCLE",
26
+ env: "AC_APPCIRCLE",
27
+ pr: {
28
+ env: "AC_GIT_PR",
29
+ ne: "false"
30
+ }
31
+ },
32
+ {
33
+ name: "AppVeyor",
34
+ constant: "APPVEYOR",
35
+ env: "APPVEYOR",
36
+ pr: "APPVEYOR_PULL_REQUEST_NUMBER"
37
+ },
38
+ {
39
+ name: "AWS CodeBuild",
40
+ constant: "CODEBUILD",
41
+ env: "CODEBUILD_BUILD_ARN",
42
+ pr: {
43
+ env: "CODEBUILD_WEBHOOK_EVENT",
44
+ any: [
45
+ "PULL_REQUEST_CREATED",
46
+ "PULL_REQUEST_UPDATED",
47
+ "PULL_REQUEST_REOPENED"
48
+ ]
49
+ }
50
+ },
51
+ {
52
+ name: "Azure Pipelines",
53
+ constant: "AZURE_PIPELINES",
54
+ env: "TF_BUILD",
55
+ pr: {
56
+ BUILD_REASON: "PullRequest"
57
+ }
58
+ },
59
+ {
60
+ name: "Bamboo",
61
+ constant: "BAMBOO",
62
+ env: "bamboo_planKey"
63
+ },
64
+ {
65
+ name: "Bitbucket Pipelines",
66
+ constant: "BITBUCKET",
67
+ env: "BITBUCKET_COMMIT",
68
+ pr: "BITBUCKET_PR_ID"
69
+ },
70
+ {
71
+ name: "Bitrise",
72
+ constant: "BITRISE",
73
+ env: "BITRISE_IO",
74
+ pr: "BITRISE_PULL_REQUEST"
75
+ },
76
+ {
77
+ name: "Buddy",
78
+ constant: "BUDDY",
79
+ env: "BUDDY_WORKSPACE_ID",
80
+ pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
81
+ },
82
+ {
83
+ name: "Buildkite",
84
+ constant: "BUILDKITE",
85
+ env: "BUILDKITE",
86
+ pr: {
87
+ env: "BUILDKITE_PULL_REQUEST",
88
+ ne: "false"
89
+ }
90
+ },
91
+ {
92
+ name: "CircleCI",
93
+ constant: "CIRCLE",
94
+ env: "CIRCLECI",
95
+ pr: "CIRCLE_PULL_REQUEST"
96
+ },
97
+ {
98
+ name: "Cirrus CI",
99
+ constant: "CIRRUS",
100
+ env: "CIRRUS_CI",
101
+ pr: "CIRRUS_PR"
102
+ },
103
+ {
104
+ name: "Cloudflare Pages",
105
+ constant: "CLOUDFLARE_PAGES",
106
+ env: "CF_PAGES"
107
+ },
108
+ {
109
+ name: "Cloudflare Workers",
110
+ constant: "CLOUDFLARE_WORKERS",
111
+ env: "WORKERS_CI"
112
+ },
113
+ {
114
+ name: "Codefresh",
115
+ constant: "CODEFRESH",
116
+ env: "CF_BUILD_ID",
117
+ pr: {
118
+ any: [
119
+ "CF_PULL_REQUEST_NUMBER",
120
+ "CF_PULL_REQUEST_ID"
121
+ ]
122
+ }
123
+ },
124
+ {
125
+ name: "Codemagic",
126
+ constant: "CODEMAGIC",
127
+ env: "CM_BUILD_ID",
128
+ pr: "CM_PULL_REQUEST"
129
+ },
130
+ {
131
+ name: "Codeship",
132
+ constant: "CODESHIP",
133
+ env: {
134
+ CI_NAME: "codeship"
135
+ }
136
+ },
137
+ {
138
+ name: "Drone",
139
+ constant: "DRONE",
140
+ env: "DRONE",
141
+ pr: {
142
+ DRONE_BUILD_EVENT: "pull_request"
143
+ }
144
+ },
145
+ {
146
+ name: "dsari",
147
+ constant: "DSARI",
148
+ env: "DSARI"
149
+ },
150
+ {
151
+ name: "Earthly",
152
+ constant: "EARTHLY",
153
+ env: "EARTHLY_CI"
154
+ },
155
+ {
156
+ name: "Expo Application Services",
157
+ constant: "EAS",
158
+ env: "EAS_BUILD"
159
+ },
160
+ {
161
+ name: "Gerrit",
162
+ constant: "GERRIT",
163
+ env: "GERRIT_PROJECT"
164
+ },
165
+ {
166
+ name: "Gitea Actions",
167
+ constant: "GITEA_ACTIONS",
168
+ env: "GITEA_ACTIONS"
169
+ },
170
+ {
171
+ name: "GitHub Actions",
172
+ constant: "GITHUB_ACTIONS",
173
+ env: "GITHUB_ACTIONS",
174
+ pr: {
175
+ GITHUB_EVENT_NAME: "pull_request"
176
+ }
177
+ },
178
+ {
179
+ name: "GitLab CI",
180
+ constant: "GITLAB",
181
+ env: "GITLAB_CI",
182
+ pr: "CI_MERGE_REQUEST_ID"
183
+ },
184
+ {
185
+ name: "GoCD",
186
+ constant: "GOCD",
187
+ env: "GO_PIPELINE_LABEL"
188
+ },
189
+ {
190
+ name: "Google Cloud Build",
191
+ constant: "GOOGLE_CLOUD_BUILD",
192
+ env: "BUILDER_OUTPUT"
193
+ },
194
+ {
195
+ name: "Harness CI",
196
+ constant: "HARNESS",
197
+ env: "HARNESS_BUILD_ID"
198
+ },
199
+ {
200
+ name: "Heroku",
201
+ constant: "HEROKU",
202
+ env: {
203
+ env: "NODE",
204
+ includes: "/app/.heroku/node/bin/node"
205
+ }
206
+ },
207
+ {
208
+ name: "Hudson",
209
+ constant: "HUDSON",
210
+ env: "HUDSON_URL"
211
+ },
212
+ {
213
+ name: "Jenkins",
214
+ constant: "JENKINS",
215
+ env: [
216
+ "JENKINS_URL",
217
+ "BUILD_ID"
218
+ ],
219
+ pr: {
220
+ any: [
221
+ "ghprbPullId",
222
+ "CHANGE_ID"
223
+ ]
224
+ }
225
+ },
226
+ {
227
+ name: "LayerCI",
228
+ constant: "LAYERCI",
229
+ env: "LAYERCI",
230
+ pr: "LAYERCI_PULL_REQUEST"
231
+ },
232
+ {
233
+ name: "Magnum CI",
234
+ constant: "MAGNUM",
235
+ env: "MAGNUM"
236
+ },
237
+ {
238
+ name: "Netlify CI",
239
+ constant: "NETLIFY",
240
+ env: "NETLIFY",
241
+ pr: {
242
+ env: "PULL_REQUEST",
243
+ ne: "false"
244
+ }
245
+ },
246
+ {
247
+ name: "Nevercode",
248
+ constant: "NEVERCODE",
249
+ env: "NEVERCODE",
250
+ pr: {
251
+ env: "NEVERCODE_PULL_REQUEST",
252
+ ne: "false"
253
+ }
254
+ },
255
+ {
256
+ name: "Prow",
257
+ constant: "PROW",
258
+ env: "PROW_JOB_ID"
259
+ },
260
+ {
261
+ name: "ReleaseHub",
262
+ constant: "RELEASEHUB",
263
+ env: "RELEASE_BUILD_ID"
264
+ },
265
+ {
266
+ name: "Render",
267
+ constant: "RENDER",
268
+ env: "RENDER",
269
+ pr: {
270
+ IS_PULL_REQUEST: "true"
271
+ }
272
+ },
273
+ {
274
+ name: "Sail CI",
275
+ constant: "SAIL",
276
+ env: "SAILCI",
277
+ pr: "SAIL_PULL_REQUEST_NUMBER"
278
+ },
279
+ {
280
+ name: "Screwdriver",
281
+ constant: "SCREWDRIVER",
282
+ env: "SCREWDRIVER",
283
+ pr: {
284
+ env: "SD_PULL_REQUEST",
285
+ ne: "false"
286
+ }
287
+ },
288
+ {
289
+ name: "Semaphore",
290
+ constant: "SEMAPHORE",
291
+ env: "SEMAPHORE",
292
+ pr: "PULL_REQUEST_NUMBER"
293
+ },
294
+ {
295
+ name: "Sourcehut",
296
+ constant: "SOURCEHUT",
297
+ env: {
298
+ CI_NAME: "sourcehut"
299
+ }
300
+ },
301
+ {
302
+ name: "Strider CD",
303
+ constant: "STRIDER",
304
+ env: "STRIDER"
305
+ },
306
+ {
307
+ name: "TaskCluster",
308
+ constant: "TASKCLUSTER",
309
+ env: [
310
+ "TASK_ID",
311
+ "RUN_ID"
312
+ ]
313
+ },
314
+ {
315
+ name: "TeamCity",
316
+ constant: "TEAMCITY",
317
+ env: "TEAMCITY_VERSION"
318
+ },
319
+ {
320
+ name: "Travis CI",
321
+ constant: "TRAVIS",
322
+ env: "TRAVIS",
323
+ pr: {
324
+ env: "TRAVIS_PULL_REQUEST",
325
+ ne: "false"
326
+ }
327
+ },
328
+ {
329
+ name: "Vela",
330
+ constant: "VELA",
331
+ env: "VELA",
332
+ pr: {
333
+ VELA_PULL_REQUEST: "1"
334
+ }
335
+ },
336
+ {
337
+ name: "Vercel",
338
+ constant: "VERCEL",
339
+ env: {
340
+ any: [
341
+ "NOW_BUILDER",
342
+ "VERCEL"
343
+ ]
344
+ },
345
+ pr: "VERCEL_GIT_PULL_REQUEST_ID"
346
+ },
347
+ {
348
+ name: "Visual Studio App Center",
349
+ constant: "APPCENTER",
350
+ env: "APPCENTER_BUILD_ID"
351
+ },
352
+ {
353
+ name: "Woodpecker",
354
+ constant: "WOODPECKER",
355
+ env: {
356
+ CI: "woodpecker"
357
+ },
358
+ pr: {
359
+ CI_BUILD_EVENT: "pull_request"
360
+ }
361
+ },
362
+ {
363
+ name: "Xcode Cloud",
364
+ constant: "XCODE_CLOUD",
365
+ env: "CI_XCODE_PROJECT",
366
+ pr: "CI_PULL_REQUEST_NUMBER"
367
+ },
368
+ {
369
+ name: "Xcode Server",
370
+ constant: "XCODE_SERVER",
371
+ env: "XCS"
372
+ }
373
+ ];
374
+ return vendors;
375
+ }
376
+
377
+ var hasRequiredCiInfo;
378
+
379
+ function requireCiInfo () {
380
+ if (hasRequiredCiInfo) return ciInfo;
381
+ hasRequiredCiInfo = 1;
382
+ (function (exports$1) {
383
+ const vendors = requireVendors();
384
+ const env = process.env;
385
+ Object.defineProperty(exports$1, "_vendors", {
386
+ value: vendors.map(function(v) {
387
+ return v.constant;
388
+ })
389
+ });
390
+ exports$1.name = null;
391
+ exports$1.isPR = null;
392
+ exports$1.id = null;
393
+ if (env.CI !== "false") {
394
+ vendors.forEach(function(vendor) {
395
+ const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
396
+ const isCI = envs.every(function(obj) {
397
+ return checkEnv(obj);
398
+ });
399
+ exports$1[vendor.constant] = isCI;
400
+ if (!isCI) {
401
+ return;
402
+ }
403
+ exports$1.name = vendor.name;
404
+ exports$1.isPR = checkPR(vendor);
405
+ exports$1.id = vendor.constant;
406
+ });
407
+ }
408
+ exports$1.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
409
+ (env.BUILD_ID || // Jenkins, Cloudbees
410
+ env.BUILD_NUMBER || // Jenkins, TeamCity
411
+ env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari, Cloudflare Pages/Workers
412
+ env.CI_APP_ID || // Appflow
413
+ env.CI_BUILD_ID || // Appflow
414
+ env.CI_BUILD_NUMBER || // Appflow
415
+ env.CI_NAME || // Codeship and others
416
+ env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
417
+ env.RUN_ID || // TaskCluster, dsari
418
+ exports$1.name || false));
419
+ function checkEnv(obj) {
420
+ if (typeof obj === "string") return !!env[obj];
421
+ if ("env" in obj) {
422
+ return env[obj.env] && env[obj.env].includes(obj.includes);
423
+ }
424
+ if ("any" in obj) {
425
+ return obj.any.some(function(k) {
426
+ return !!env[k];
427
+ });
428
+ }
429
+ return Object.keys(obj).every(function(k) {
430
+ return env[k] === obj[k];
431
+ });
432
+ }
433
+ function checkPR(vendor) {
434
+ switch (typeof vendor.pr) {
435
+ case "string":
436
+ return !!env[vendor.pr];
437
+ case "object":
438
+ if ("env" in vendor.pr) {
439
+ if ("any" in vendor.pr) {
440
+ return vendor.pr.any.some(function(key) {
441
+ return env[vendor.pr.env] === key;
442
+ });
443
+ } else {
444
+ return vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
445
+ }
446
+ } else if ("any" in vendor.pr) {
447
+ return vendor.pr.any.some(function(key) {
448
+ return !!env[key];
449
+ });
450
+ } else {
451
+ return checkEnv(vendor.pr);
452
+ }
453
+ default:
454
+ return null;
455
+ }
456
+ }
457
+ } (ciInfo));
458
+ return ciInfo;
459
+ }
460
+
461
+ var ciInfoExports = requireCiInfo();
462
+
463
+ const updateNotifierPlugin = (options = {}) => {
464
+ return {
465
+ beforeCommand: async (toolbox) => {
466
+ const { logger, runtime } = toolbox;
467
+ const packageName = runtime.getPackageName();
468
+ const packageVersion = runtime.getPackageVersion();
469
+ if (!packageName || !packageVersion) {
470
+ logger.debug("Update notifier: package name or version not provided, skipping...");
471
+ return;
472
+ }
473
+ const env = getEnv();
474
+ const updateNotifierOptions = {
475
+ alwaysRun: false,
476
+ debug: env.CEREBRO_OUTPUT_LEVEL === "256",
477
+ distTag: "latest",
478
+ pkg: {
479
+ name: packageName,
480
+ version: packageVersion
481
+ },
482
+ updateCheckInterval: 1e3 * 60 * 60 * 24,
483
+ ...options
484
+ };
485
+ const shouldCheck = updateNotifierOptions.alwaysRun || !(env.NO_UPDATE_NOTIFIER || env.NODE_ENV === "test" || toolbox.argv.includes("--no-update-notifier") || ciInfoExports.isCI);
486
+ if (!shouldCheck) {
487
+ logger.debug("Update notifier: skipping check (disabled by environment or flags)");
488
+ return;
489
+ }
490
+ (logger?.raw ?? logger.log)("Checking for updates...");
491
+ try {
492
+ const hasNewVersion = await import('../../packem_chunks/has-new-version.js').then((m) => m.default);
493
+ const updateAvailable = await hasNewVersion(updateNotifierOptions);
494
+ if (updateAvailable) {
495
+ const [{ boxen }, { dim, green, reset, yellow }] = await Promise.all([import('@visulima/boxen'), import('@visulima/colorize')]);
496
+ const template = `Update available ${dim(packageVersion.toString())}${reset(" → ")}${green(updateAvailable)}`;
497
+ logger.error(
498
+ boxen(template, {
499
+ borderColor: (border) => yellow(border),
500
+ borderStyle: "round",
501
+ margin: 1,
502
+ padding: 1,
503
+ textAlignment: "center"
504
+ })
505
+ );
506
+ }
507
+ } catch (error) {
508
+ logger.debug("Update notifier: failed to check for updates", error);
509
+ }
510
+ },
511
+ description: "Checks for package updates and notifies users",
512
+ name: "update-notifier",
513
+ version: "1.0.0"
514
+ };
515
+ };
516
+
517
+ export { updateNotifierPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/cerebro",
3
- "version": "3.0.0-alpha.7",
3
+ "version": "3.0.0-alpha.8",
4
4
  "description": "A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.",
5
5
  "keywords": [
6
6
  "visulima",
@@ -103,15 +103,15 @@
103
103
  "LICENSE.md"
104
104
  ],
105
105
  "dependencies": {
106
- "@visulima/colorize": "2.0.0-alpha.5",
107
- "@visulima/tabular": "4.0.0-alpha.6",
106
+ "@visulima/colorize": "2.0.0-alpha.6",
107
+ "@visulima/tabular": "4.0.0-alpha.7",
108
108
  "fastest-levenshtein": "^1.0.16"
109
109
  },
110
110
  "peerDependencies": {
111
- "@bomb.sh/tab": "^0.0.7",
112
- "@visulima/boxen": "3.0.0-alpha.6",
113
- "@visulima/find-cache-dir": "3.0.0-alpha.4",
114
- "@visulima/pail": "4.0.0-alpha.7",
111
+ "@bomb.sh/tab": "0.0.14",
112
+ "@visulima/boxen": "3.0.0-alpha.7",
113
+ "@visulima/find-cache-dir": "3.0.0-alpha.5",
114
+ "@visulima/pail": "4.0.0-alpha.8",
115
115
  "github-slugger": "2.0.0"
116
116
  },
117
117
  "peerDependenciesMeta": {
@@ -131,6 +131,7 @@
131
131
  "optional": true
132
132
  }
133
133
  },
134
+ "optionalDependencies": {},
134
135
  "engines": {
135
136
  "node": ">=22.13 <=25.x"
136
137
  },