@lovrabet/lovrabet-cli 2.3.13-beta.1 → 2.4.0-beta.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/README.md +22 -14
- package/lib/cli.js +4 -1
- package/lib/commands/api-doc/index.js +11 -1
- package/lib/commands/app/cache.js +2 -1
- package/lib/commands/app/definitions.js +7 -1
- package/lib/commands/app/eligibility.js +2 -1
- package/lib/commands/app/mock-loader.js +1 -1
- package/lib/commands/app/remote-source.js +2 -1
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/approval/index.js +7 -1
- package/lib/commands/artifact/index.js +11 -1
- package/lib/commands/auth/device.js +8 -1
- package/lib/commands/auth/index.js +9 -1
- package/lib/commands/auth/prompt.js +2 -1
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/exec.js +1 -1
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/cli-skill/index.js +2 -1
- package/lib/commands/common/config-policy.js +2 -1
- package/lib/commands/common/constraints.js +2 -1
- package/lib/commands/common/flags.js +2 -1
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/config/definitions.js +8 -1
- package/lib/commands/config/init.js +4 -1
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/import-excel.js +10 -1
- package/lib/commands/data/index.js +10 -1
- package/lib/commands/dataset/detail.js +6 -1
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.js +2 -1
- package/lib/commands/dataset/sdk-doc.js +1 -1
- package/lib/commands/doctor.js +9 -1
- package/lib/commands/file/index.js +3 -1
- package/lib/commands/init.js +4 -1
- package/lib/commands/issue/context.js +1 -1
- package/lib/commands/issue/index.js +1 -1
- package/lib/commands/issue/report.js +5 -1
- package/lib/commands/kb/index.js +7 -1
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/metric/contract.js +5 -1
- package/lib/commands/metric/definition.js +4 -1
- package/lib/commands/metric/detail.js +1 -1
- package/lib/commands/metric/exec.js +3 -1
- package/lib/commands/metric/index.js +1 -1
- package/lib/commands/metric/list.js +2 -1
- package/lib/commands/metric/shared.js +2 -1
- package/lib/commands/notification/config-list.js +1 -1
- package/lib/commands/notification/index.js +1 -1
- package/lib/commands/notification/shared.js +2 -1
- package/lib/commands/ocr/index.js +4 -1
- package/lib/commands/permit/dataset-get.js +1 -1
- package/lib/commands/permit/dataset-set.js +5 -1
- package/lib/commands/permit/index.js +1 -1
- package/lib/commands/permit/page-get.js +1 -1
- package/lib/commands/permit/page-set.js +3 -1
- package/lib/commands/permit/role-menus-set.js +4 -1
- package/lib/commands/permit/role-menus.js +1 -1
- package/lib/commands/permit/shared.js +7 -1
- package/lib/commands/personal-bff/index.js +7 -1
- package/lib/commands/registry.js +6 -1
- package/lib/commands/role/create.js +2 -1
- package/lib/commands/role/delete.js +2 -1
- package/lib/commands/role/detail.js +1 -1
- package/lib/commands/role/index.js +1 -1
- package/lib/commands/role/list.js +2 -1
- package/lib/commands/role/shared.js +8 -1
- package/lib/commands/role/update.js +3 -1
- package/lib/commands/role/user-add.js +2 -1
- package/lib/commands/role/user-remove.js +2 -1
- package/lib/commands/schedule/index.js +7 -1
- package/lib/commands/schema.js +1 -1
- package/lib/commands/service/dynamic.js +10 -1
- package/lib/commands/service/function-name-adapter.js +3 -1
- package/lib/commands/service/index.js +8 -1
- package/lib/commands/service/registry.js +12 -1
- package/lib/commands/skill/commands/create.js +3 -1
- package/lib/commands/skill/commands/diagram.js +4 -1
- package/lib/commands/skill/commands/install.js +6 -1
- package/lib/commands/skill/commands/list.js +3 -1
- package/lib/commands/skill/commands/push.js +1 -1
- package/lib/commands/skill/commands/validate.js +1 -1
- package/lib/commands/skill/diagram.js +3 -1
- package/lib/commands/skill/flags.js +4 -1
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/skill/manifest-helpers.js +1 -1
- package/lib/commands/skill/push-execute.js +11 -1
- package/lib/commands/skill/push-flow-helpers.js +4 -1
- package/lib/commands/skill/push-retarget.js +1 -1
- package/lib/commands/skill/scopes.js +1 -1
- package/lib/commands/skill/summary.js +1 -1
- package/lib/commands/skill/templates.js +8 -1
- package/lib/commands/skill/validate.js +8 -1
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.js +2 -1
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/update.d.ts +2 -1
- package/lib/commands/update.js +8 -1
- package/lib/commands/user-account/bind.js +3 -1
- package/lib/commands/user-account/index.js +1 -1
- package/lib/commands/workspace/index.js +7 -1
- package/lib/config/domain-config.js +6 -1
- package/lib/config/schema.js +5 -1
- package/lib/constant/app.js +1 -1
- package/lib/constant/auth-mode.js +1 -1
- package/lib/constant/cli.js +3 -1
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/distribution.js +1 -1
- package/lib/constant/domain.js +2 -1
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.js +1 -1
- package/lib/constant/product.js +2 -1
- package/lib/constant/region.js +2 -1
- package/lib/constant/risk.js +1 -1
- package/lib/constant/url.js +1 -1
- package/lib/context.js +11 -1
- package/lib/core/api-client.js +38 -1
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/kb-management-client.js +6 -1
- package/lib/core/kb-sdk-errors.js +2 -1
- package/lib/core/kb-search-client.js +2 -1
- package/lib/core/sdk-client.js +5 -1
- package/lib/errors.js +2 -1
- package/lib/framework/access-error.js +1 -1
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/dryrun.js +1 -1
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.js +2 -1
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.js +1 -1
- package/lib/framework/preparse.js +3 -1
- package/lib/framework/rate-limit.js +2 -1
- package/lib/framework/raw-flags.js +2 -1
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-confirmation.js +2 -1
- package/lib/framework/runner-error.js +2 -1
- package/lib/framework/runner.js +9 -1
- package/lib/framework/schema-export.js +2 -1
- package/lib/framework/service-order.js +1 -1
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -4
- package/lib/generated/build-info.js +1 -1
- package/lib/generated/official-routing.js +2 -1
- package/lib/generated/routing-contract.js +1 -1
- package/lib/help.js +1 -1
- package/lib/runtime/confirmation.js +1 -1
- package/lib/runtime/event.js +1 -1
- package/lib/runtime/index.js +4 -1
- package/lib/runtime/queue.js +1 -1
- package/lib/runtime/resolve.js +2 -1
- package/lib/runtime/types.js +1 -1
- package/lib/services/dataset-import/auto-id-runner.js +9 -1
- package/lib/services/dataset-import/excel-reader.js +25 -1
- package/lib/services/dataset-import/image-bytes.js +6 -1
- package/lib/services/dataset-import/image-ooxml.js +15 -1
- package/lib/services/dataset-import/image-runner.js +9 -1
- package/lib/services/dataset-import/metadata.js +1 -1
- package/lib/services/dataset-import/preview.js +1 -1
- package/lib/services/dataset-import/runner.js +13 -1
- package/lib/services/dataset-import/types.js +1 -1
- package/lib/skills/builtin-skill.js +8 -1
- package/lib/skills/install-updated-skill.d.ts +8 -0
- package/lib/skills/install-updated-skill.js +3 -0
- package/lib/skills/local-skills-installer.d.ts +2 -0
- package/lib/skills/local-skills-installer.js +1 -0
- package/lib/skills/npx-skills-add.d.ts +2 -2
- package/lib/skills/npx-skills-add.js +4 -1
- package/lib/skills/runtime-skill-sync/constants.js +1 -1
- package/lib/skills/runtime-skill-sync/fs-utils.js +3 -1
- package/lib/skills/runtime-skill-sync/hashing.js +1 -1
- package/lib/skills/runtime-skill-sync/install-target.js +1 -1
- package/lib/skills/runtime-skill-sync/links.js +9 -1
- package/lib/skills/runtime-skill-sync/list-local.js +4 -1
- package/lib/skills/runtime-skill-sync/local-files.js +5 -1
- package/lib/skills/runtime-skill-sync/materialize.js +9 -1
- package/lib/skills/runtime-skill-sync/metadata.js +3 -1
- package/lib/skills/runtime-skill-sync/paths.js +2 -1
- package/lib/skills/runtime-skill-sync/push.js +8 -1
- package/lib/skills/runtime-skill-sync/scopes.js +1 -1
- package/lib/skills/runtime-skill-sync/types.js +1 -1
- package/lib/skills/runtime-skill-sync/zip-codec.js +2 -1
- package/lib/skills/runtime-skill-sync/zip-package.js +6 -1
- package/lib/skills/runtime-skill-sync.js +1 -1
- package/lib/skills/skill-presence.d.ts +1 -34
- package/lib/skills/skill-presence.js +2 -1
- package/lib/utils/access-key-redaction.js +2 -1
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/cli-version-check.js +2 -1
- package/lib/utils/cli-version-policy.js +3 -1
- package/lib/utils/logger.js +3 -1
- package/lib/utils/lossless-json.js +3 -1
- package/lib/utils/params.js +3 -1
- package/lib/utils/positive-safe-integer.js +1 -1
- package/lib/utils/redaction.js +2 -1
- package/lib/utils/runtime-user-id.js +1 -1
- package/lib/utils/update-notice.js +3 -1
- package/lib/utils/version.js +1 -1
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +5 -7
- package/skills/lovrabet/SKILL.md +3 -3
- package/skills/lovrabet/references/lovrabet-skill-install.md +1 -1
- package/skills/lovrabet/references/lovrabet-update.md +6 -4
- package/skills/lovrabet-report-generation/SKILL.md +1 -1
- package/skills/lovrabet.manifest.json +3 -3
- package/lib/postinstall.d.ts +0 -2
- package/lib/postinstall.js +0 -1
- package/scripts/postinstall.mjs +0 -24
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Global Skill install-state resolution, decoupled from the external `skills` CLI.
|
|
3
|
-
*
|
|
4
|
-
* Only reasonably trustworthy signals are used, and "confirmed missing" is kept
|
|
5
|
-
* distinct from "cannot tell":
|
|
6
|
-
* - artifact probe: `<globalSkillsDir>/<name>/SKILL.md`, what consumers actually resolve
|
|
7
|
-
* - install bookkeeping: the `skills` CLI's own `~/.agents/.skill-lock.json`
|
|
8
|
-
*
|
|
9
|
-
* Directory layout is owned by the external tool, so a stale layout assumption must
|
|
10
|
-
* resolve to `unverifiable` (pass through with a reason) rather than `absent` (fail).
|
|
11
|
-
* Only when both the artifact probe and the bookkeeping agree is the skill `absent`.
|
|
12
|
-
*/
|
|
13
|
-
/** Install bookkeeping file written by the `skills` CLI, relative to HOME. */
|
|
14
|
-
export declare const SKILL_LOCK_RELATIVE_PATH: string;
|
|
15
|
-
/** Known global Skill directories, relative to HOME, in probe order. */
|
|
16
|
-
export declare const GLOBAL_SKILLS_DIR_RELATIVE_PATHS: string[];
|
|
17
|
-
/**
|
|
18
|
-
* Install state of a global Skill.
|
|
19
|
-
*
|
|
20
|
-
* `unverifiable` is deliberate: local assumptions were not sufficient to decide, so
|
|
21
|
-
* callers should pass through instead of failing.
|
|
22
|
-
*/
|
|
23
1
|
export type SkillPresence = {
|
|
24
2
|
state: "present";
|
|
25
3
|
path: string;
|
|
@@ -31,18 +9,7 @@ export type SkillPresence = {
|
|
|
31
9
|
reason: string;
|
|
32
10
|
};
|
|
33
11
|
export interface ResolveSkillPresenceOptions {
|
|
34
|
-
/** Override
|
|
35
|
-
globalSkillsDirs?: string[];
|
|
36
|
-
/** Override the `skills` CLI bookkeeping file path. */
|
|
37
|
-
lockFile?: string;
|
|
38
|
-
/** Override HOME. Tests only. */
|
|
12
|
+
/** Override the user home for isolated verification only. */
|
|
39
13
|
home?: string;
|
|
40
14
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Resolves whether a global Skill is currently discoverable by consumers.
|
|
43
|
-
*
|
|
44
|
-
* @param skillName - Global Skill name (its directory name), e.g. `lovrabet`.
|
|
45
|
-
* @param options - Probe overrides for isolated environments or tests.
|
|
46
|
-
* @returns `present`, `absent`, or `unverifiable`.
|
|
47
|
-
*/
|
|
48
15
|
export declare function resolveInstalledSkill(skillName: string, options?: ResolveSkillPresenceOptions): SkillPresence;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{spawnSync}from"node:child_process";import{isAbsolute,join}from"node:path";import{resolveLocalSkillsInstaller}from"../skills/local-skills-installer.js";export function resolveInstalledSkill(skillName,options){try{const env={...process.env,DISABLE_TELEMETRY:"1",DO_NOT_TRACK:"1",...options?.home?{HOME:options.home,USERPROFILE:options.home}:{}};const result=spawnSync(process.execPath,[resolveLocalSkillsInstaller(),"list","-g","--json"],{env:env,encoding:"utf8",shell:false,timeout:3e4,maxBuffer:16*1024*1024});if(result.error||result.status!==0){throw new Error(result.error?.message||result.stderr?.trim()||"Skills CLI listing failed")}const rows=JSON.parse(result.stdout);if(!Array.isArray(rows)||rows.some(row=>!row||typeof row.name!=="string"||row.scope!=="global")){throw new Error("Unsupported Skills CLI listing response")}const matches=rows.filter(row=>row.name===skillName);if(matches.length===0||matches.every(row=>row.status==="missing"&&row.path===null)){return{state:"absent",
|
|
2
|
+
checked:[]}}if(matches.some(row=>!["tracked","untracked","modified"].includes(row.status)||typeof row.path!=="string"||!isAbsolute(row.path))){throw new Error(`Skills CLI returned an invalid installation path or status for "${skillName}"`)}const paths=[...new Set(matches.map(row=>row.path))];if(paths.length!==1)throw new Error(`Skills CLI returned multiple installation paths for "${skillName}"`);return{state:"present",path:join(paths[0],"SKILL.md")}}catch(error){return{state:"unverifiable",reason:error instanceof Error?error.message:String(error)}}}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
const
|
|
1
|
+
const REDACTED_ACCESS_KEY="<redacted>";export function maskCliAccessKey(value){if(typeof value!=="string"||value.length<=8){return REDACTED_ACCESS_KEY}return`${value.slice(0,8)}${"*".repeat(value.length-8)}`}export function redactCliConfigCredentials(config){const displayed={...config};if(Object.prototype.hasOwnProperty.call(displayed,"accessKey")){displayed.accessKey=maskCliAccessKey(displayed.accessKey)}if(displayed.apps&&typeof displayed.apps==="object"&&!Array.isArray(displayed.apps)){displayed.apps=redactLegacyAppCredentials(displayed.apps)}return displayed}export function redactCliConfigValue(path,value){if(path==="accessKey"||/^apps\.[^.]+\.accessKey$/.test(path)){return maskCliAccessKey(value)}if(path==="apps"&&value&&typeof value==="object"&&!Array.isArray(value)){return redactLegacyAppCredentials(value)}if(/^apps\.[^.]+$/.test(path)&&value&&typeof value==="object"&&!Array.isArray(value)){const profile=value;return Object.prototype.hasOwnProperty.call(profile,"accessKey")?{
|
|
2
|
+
...profile,accessKey:maskCliAccessKey(profile.accessKey)}:value}return value}function redactLegacyAppCredentials(apps){return Object.fromEntries(Object.entries(apps).map(([alias,profile])=>{if(!profile||typeof profile!=="object"||Array.isArray(profile)){return[alias,profile]}const displayedProfile={...profile};if(Object.prototype.hasOwnProperty.call(displayedProfile,"accessKey")){displayedProfile.accessKey=maskCliAccessKey(displayedProfile.accessKey)}return[alias,displayedProfile]}))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{createJqFilter,resolveBundledJqPaths}from"@lovrabet/cli-framework";import{CliErrors}from"../errors.js";export const applyJqFilter=createJqFilter(CliErrors,{bundledJqPaths:resolveBundledJqPaths()});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import semver from"semver";import{LOVRABET_NPM_PACKAGE_NAME}from"../constant/distribution.js";import{CliErrors}from"../errors.js";import{getCliVersionPolicy}from"../utils/cli-version-policy.js";import{getCliVersion}from"../utils/version.js";export function evaluateCliVersionPolicy(currentVersion,policy){const currentIsValid=semver.valid(currentVersion)===currentVersion;const stableVersion=policy?.stableVersion??null;const minimumVersion=policy?.minimumVersion??null;const needsUpgrade=Boolean(currentIsValid&&stableVersion&&semver.lt(currentVersion,stableVersion));const belowMinimum=Boolean(currentIsValid&&minimumVersion&&semver.lt(currentVersion,minimumVersion));return{currentVersion:currentVersion,stableVersion:stableVersion,minimumVersion:minimumVersion,needsUpgrade:needsUpgrade||belowMinimum,belowMinimum:belowMinimum,upgradeMessage:policy?.upgradeMessage,minimumVersionMessage:policy?.minimumVersionMessage}}export async function checkCliVersion(){
|
|
2
|
+
return evaluateCliVersionPolicy(getCliVersion(),await getCliVersionPolicy())}export function getCliUpgradeCommand(result){return`npm install -g ${LOVRABET_NPM_PACKAGE_NAME}@${result.stableVersion??"latest"}`}export function assertCliVersionSupported(result){if(!result.belowMinimum)return;const details=[result.minimumVersionMessage,`Current version: ${result.currentVersion}`,`Minimum supported: ${result.minimumVersion}`,`Recommended stable: ${result.stableVersion??"unavailable"}`,`Upgrade command: ${getCliUpgradeCommand(result)}`].filter(Boolean).join("\n");throw CliErrors.validation("Current CLI version is below the minimum supported version.",details)}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import semver from"semver";import{LOVRABET_CLI_VERSION_POLICY_URL}from"../constant/distribution.js";const SUCCESS_CACHE_TTL_MS=5*60*1e3;const FAILURE_CACHE_TTL_MS=60*1e3;const FETCH_TIMEOUT_MS=1500;function pickString(value){return typeof value==="string"&&value.trim()?value.trim():null}function pickStrictSemver(value){const text=pickString(value);return text&&semver.valid(text)===text?text:null}export function normalizeCliVersionPolicy(raw){if(!raw||typeof raw!=="object")return null;const root=raw;const source=root.cli&&typeof root.cli==="object"?root.cli:root;const stableVersion=pickStrictSemver(source.stableVersion??source.latestVersion??source.recommendedVersion);const minimumVersion=pickStrictSemver(source.minimumVersion??source.minVersion);if(!stableVersion&&!minimumVersion)return null;if(stableVersion&&minimumVersion&&semver.gt(minimumVersion,stableVersion)){return null}return{stableVersion:stableVersion,minimumVersion:minimumVersion,
|
|
2
|
+
upgradeMessage:pickString(source.upgradeMessage)??undefined,minimumVersionMessage:pickString(source.minimumVersionMessage)??undefined}}export async function fetchCliVersionPolicy(){try{const response=await fetch(LOVRABET_CLI_VERSION_POLICY_URL,{headers:{Accept:"application/json"},signal:AbortSignal.timeout(FETCH_TIMEOUT_MS)});if(!response.ok)return null;return normalizeCliVersionPolicy(await response.json())}catch{return null}}let cachedPolicy=null;let cachedAt=0;let hasCachedPolicy=false;let pendingPolicy=null;export async function getCliVersionPolicy(){const now=Date.now();if(hasCachedPolicy){const ttl=cachedPolicy?SUCCESS_CACHE_TTL_MS:FAILURE_CACHE_TTL_MS;if(now-cachedAt<ttl)return cachedPolicy}if(pendingPolicy)return pendingPolicy;pendingPolicy=fetchCliVersionPolicy().then(policy=>{cachedPolicy=policy;cachedAt=Date.now();hasCachedPolicy=true;return policy}).finally(()=>{pendingPolicy=null});return pendingPolicy}export function clearCliVersionPolicyCache(){cachedPolicy=null
|
|
3
|
+
;cachedAt=0;hasCachedPolicy=false;pendingPolicy=null}
|
package/lib/utils/logger.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import winston from"winston";import fs from"node:fs";import path from"node:path";import{PRODUCT_CONFIG}from"../constant/product.js";class Logger{winstonLogger;logFilePath="";currentRawCommand="";constructor(){}setRawCommand(rawCommand){this.currentRawCommand=rawCommand}setLogPath(projectPath){this.logFilePath=path.join(projectPath,PRODUCT_CONFIG.logFileName);if(this.winstonLogger){this.winstonLogger.clear()}this.initWinstonLogger()}initWinstonLogger(){const dir=path.dirname(this.logFilePath);if(!fs.existsSync(dir)){fs.mkdirSync(dir,{recursive:true})}const customFormat=winston.format.combine(winston.format.timestamp(),winston.format.errors({stack:true}),winston.format.printf(info=>{const logEntry={timestamp:info.timestamp||(new Date).toISOString(),level:info.level||"info",command:info.command||"unknown",rawCommand:info.rawCommand||this.currentRawCommand||undefined,message:info.message||"",duration:info.duration||undefined,details:info.details||undefined};return JSON.stringify(logEntry)
|
|
2
|
+
}));this.winstonLogger=winston.createLogger({level:"info",format:customFormat,transports:[new winston.transports.File({filename:this.logFilePath,level:"info"})],silent:false});winston.addColors({success:"green",error:"red",warn:"yellow",info:"blue"})}info(command,message,details){if(!this.logFilePath||!this.winstonLogger)return;this.winstonLogger.info(message,{command:command,details:details})}success(command,message,duration,details){if(!this.logFilePath||!this.winstonLogger)return;this.winstonLogger.log("info",message,{level:"success",command:command,duration:duration,details:details})}error(command,message,details){if(!this.logFilePath||!this.winstonLogger)return;this.winstonLogger.error(message,{command:command,details:details})}warn(command,message,details){if(!this.logFilePath||!this.winstonLogger)return;this.winstonLogger.warn(message,{command:command,details:details})}async logTask(command,taskName,task){const startTime=Date.now();this.info(command,`Starting: ${taskName}`);try{
|
|
3
|
+
const result=await task();const duration=Date.now()-startTime;this.success(command,`Completed: ${taskName}`,duration);return result}catch(error){const duration=Date.now()-startTime;this.error(command,`Failed: ${taskName}`,{error:error instanceof Error?error.message:String(error),duration:duration});throw error}}readLogs(){try{if(!fs.existsSync(this.logFilePath)){return[]}const content=fs.readFileSync(this.logFilePath,"utf8");return content.split(/\r?\n/).filter(line=>line.trim()).map(line=>JSON.parse(line))}catch(error){console.warn("Failed to read logs:",error);return[]}}clearLogs(){try{if(fs.existsSync(this.logFilePath)){fs.writeFileSync(this.logFilePath,"","utf8")}}catch(error){console.warn("Failed to clear logs:",error)}}getWinstonInstance(){return this.winstonLogger}}export const logger=new Logger;
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
const JSON_NUMBER_PATTERN=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/;const MAX_SAFE_INTEGER=BigInt(Number.MAX_SAFE_INTEGER);const MIN_SAFE_INTEGER=BigInt(Number.MIN_SAFE_INTEGER);let restoreResponseJsonParser;let responseJsonPrototype;let originalResponseJsonDescriptor;function isUnsafeIntegerLiteral(token){if(token.includes(".")||token.includes("e")||token.includes("E")){return false}const value=BigInt(token);return value>MAX_SAFE_INTEGER||value<MIN_SAFE_INTEGER}function quoteUnsafeIntegerLiterals(text){let output="";let inString=false;let escaped=false;for(let index=0;index<text.length;){const character=text[index];if(inString){output+=character;index+=1;if(escaped){escaped=false}else if(character==="\\"){escaped=true}else if(character==='"'){inString=false}continue}if(character==='"'){inString=true;output+=character;index+=1;continue}if(character==="-"||character>="0"&&character<="9"){const token=JSON_NUMBER_PATTERN.exec(text.slice(index))?.[0];if(token){
|
|
2
|
+
output+=isUnsafeIntegerLiteral(token)?`"${token}"`:token;index+=token.length;continue}}output+=character;index+=1}return output}export function parseLosslessJson(text){return JSON.parse(quoteUnsafeIntegerLiterals(text))}export function installLosslessJsonResponseParser(){if(typeof Response==="undefined")return()=>{};if(restoreResponseJsonParser)return restoreResponseJsonParser;responseJsonPrototype=Response.prototype;originalResponseJsonDescriptor=Object.getOwnPropertyDescriptor(responseJsonPrototype,"json");Object.defineProperty(responseJsonPrototype,"json",{...originalResponseJsonDescriptor??{configurable:true,enumerable:false,writable:true},value:async function losslessJson(){return parseLosslessJson(await this.text())}});restoreResponseJsonParser=()=>{if(!responseJsonPrototype)return;if(originalResponseJsonDescriptor){Object.defineProperty(responseJsonPrototype,"json",originalResponseJsonDescriptor)}else{delete responseJsonPrototype.json}responseJsonPrototype=undefined
|
|
3
|
+
;originalResponseJsonDescriptor=undefined;restoreResponseJsonParser=undefined};return restoreResponseJsonParser}export function restoreLosslessJsonResponseParser(){restoreResponseJsonParser?.()}
|
package/lib/utils/params.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import{CliErrors}from"../errors.js";import{parseLosslessJson}from"../utils/lossless-json.js";export const MAX_DATA_UPDATE_IDS=1e3;export function parseJsonParams(paramsStr){if(!paramsStr)return undefined;try{return parseLosslessJson(paramsStr)}catch{throw CliErrors.validation(`Invalid JSON for --params: ${paramsStr}`)}}export function parseJsonParamsValue(paramsStr){if(!paramsStr)return undefined;try{return parseLosslessJson(paramsStr)}catch{throw CliErrors.validation(`Invalid JSON for --params: ${paramsStr}`)}}export function parseBatchCreateItemsFromParams(params){if(Array.isArray(params)){return params}if(params!==null&¶ms!==undefined&&typeof params==="object"&&Array.isArray(params.items)){return params.items}throw CliErrors.validation('batchCreate --params must be a JSON array or {"items":[...]}','Example: --params \'[{"name":"a"},{"name":"b"}]\'')}function parseDataUpdateId(value,label){if(typeof value==="number"&&Number.isSafeInteger(value)&&value>0){return value}
|
|
2
|
+
if(typeof value==="string"){if(/^[1-9]\d*$/.test(value)){return value}}throw CliErrors.validation(`data update --params.${label} must be a positive integer or numeric string.`)}export function parseUpdateIdsFromParams(params){if(params===null||params===undefined||typeof params!=="object"||Array.isArray(params)){throw CliErrors.validation("data update --params must be a JSON object with id.",'Example: --params \'{"id":[1,2,3],"status":"done"}\'')}const id=params.id;if(id===undefined||id===null){throw CliErrors.validation('data update requires "id" in --params.','Example: --params \'{"id":[1,2,3],"status":"done"}\'')}const rawIds=Array.isArray(id)?id:[id];if(rawIds.length===0){throw CliErrors.validation("data update id array cannot be empty.")}if(rawIds.length>MAX_DATA_UPDATE_IDS){throw CliErrors.validation(`data update can update at most ${MAX_DATA_UPDATE_IDS} records per call; received ${rawIds.length}.`)}
|
|
3
|
+
return rawIds.map((value,index)=>parseDataUpdateId(value,Array.isArray(id)?`id[${index}]`:"id"))}export function normalizeUpdateParamsForRuntime(params,ids){if(Array.isArray(params.id)&&ids.length>1){return{...params,id:ids.join(",")}}return params}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export function normalizePositiveSafeInteger(value){if(typeof value==="number"){return Number.isSafeInteger(value)&&value>0?value:undefined}if(typeof value!=="string"||!/^\d+$/.test(value)){return undefined}const normalized=Number(value);return Number.isSafeInteger(normalized)&&normalized>0?normalized:undefined}
|
package/lib/utils/redaction.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
const
|
|
1
|
+
const REDACTED_VALUE="[REDACTED]";const SENSITIVE_KEY_PATTERN=/(?:access.?key|api.?key|authorization|cookie|credential|password|passwd|private.?key|secret|token|webhook)/i;const SENSITIVE_FLAG_NAMES=new Set(["comment","variables"]);const SENSITIVE_VALUE_KEYS=new Set(["comment"]);export function isSensitiveKey(key){const normalized=key.replace(/_/g,"-").toLowerCase();return SENSITIVE_KEY_PATTERN.test(normalized)}export function isSensitiveFlagName(key){const normalized=key.replace(/_/g,"-").toLowerCase();return isSensitiveKey(normalized)||SENSITIVE_FLAG_NAMES.has(normalized)}function redactVariableValues(value){if(Array.isArray(value)){return value.map(item=>redactVariableValues(item))}if(value&&typeof value==="object"){return Object.fromEntries(Object.entries(value).map(([key,item])=>[key,redactVariableValues(item)]))}return REDACTED_VALUE}export function redactSensitiveValue(value){if(Array.isArray(value)){return value.map(item=>redactSensitiveValue(item))}
|
|
2
|
+
if(!value||typeof value!=="object"){return value}const output={};for(const[key,item]of Object.entries(value)){const normalized=key.replace(/_/g,"-").toLowerCase();output[key]=normalized==="variables"?redactVariableValues(item):SENSITIVE_VALUE_KEYS.has(normalized)||isSensitiveKey(key)?REDACTED_VALUE:redactSensitiveValue(item)}return output}export function redactCommandArgv(argv){const output=[];let redactNext=false;for(const token of argv){if(redactNext){output.push(REDACTED_VALUE);redactNext=false;continue}const match=token.match(/^--([^=]+)(?:=(.*))?$/);if(!match||!isSensitiveFlagName(match[1]??"")){output.push(token);continue}output.push(`--${match[1]}${match[2]===undefined?"":`=${REDACTED_VALUE}`}`);if(match[2]===undefined){redactNext=true}}return output}export{REDACTED_VALUE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export function normalizeRuntimeUserId(value){if(typeof value==="number"){return Number.isSafeInteger(value)&&value>0?String(value):undefined}if(typeof value!=="string"||!/^\d+$/.test(value))return undefined;const normalized=value.replace(/^0+/,"");return normalized||undefined}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import{mkdir,readFile,writeFile}from"node:fs/promises";import{homedir}from"node:os";import{dirname,join}from"node:path";import{LOVRABET_NPM_PACKAGE_NAME}from"../constant/distribution.js";import{CLI_BIN_NAME}from"../constant/cli.js";import{checkCliVersion,getCliUpgradeCommand}from"../utils/cli-version-check.js";const UPDATE_NOTICE_TTL_MS=24*60*60*1e3;function isUpdateNoticeDisabled(){const raw=process.env.LOVRABET_NO_UPDATE_NOTICE?.trim().toLowerCase();return raw==="1"||raw==="true"||raw==="yes"}function cacheRoot(){return process.env.XDG_CACHE_HOME||process.env.LOCALAPPDATA||join(homedir(),".cache")}export function getUpdateNoticeCachePath(){return join(cacheRoot(),"lovrabet-cli","update-check.json")}async function readUpdateNoticeCache(){try{const content=await readFile(getUpdateNoticeCachePath(),"utf8");const parsed=JSON.parse(content);if(!parsed||typeof parsed!=="object")return{};return parsed}catch{return{}}}async function writeUpdateNoticeCache(cache){try{
|
|
2
|
+
const file=getUpdateNoticeCachePath();await mkdir(dirname(file),{recursive:true});await writeFile(file,`${JSON.stringify(cache,null,2)}\n`,"utf8")}catch{}}function isRecentlyNotified(cache,latest,now){return cache.lastNotifiedVersion===latest&&typeof cache.lastNotifiedAt==="number"&&now-cache.lastNotifiedAt<UPDATE_NOTICE_TTL_MS}export function buildNpmVersionUrl(version){return`https://www.npmjs.com/package/${LOVRABET_NPM_PACKAGE_NAME}/v/${version}`}export async function resolveLatestUpdateNotice(checked){if(isUpdateNoticeDisabled())return null;try{const now=Date.now();const result=checked??await checkCliVersion();const current=result.currentVersion;const latest=result.stableVersion;const cache=await readUpdateNoticeCache();if(!latest||!result.needsUpgrade||result.belowMinimum)return null;if(isRecentlyNotified(cache,latest,now))return null;const command=getCliUpgradeCommand(result);await writeUpdateNoticeCache({...cache,checkedAt:now,latest:latest,failed:false,
|
|
3
|
+
lastNotifiedVersion:latest,lastNotifiedAt:now});return{command:command,current:current,latest:latest,url:buildNpmVersionUrl(latest),message:[result.upgradeMessage,`${CLI_BIN_NAME} ${latest} is recommended, current ${current}, run: ${command}`].filter(Boolean).join(" ")}}catch{return null}}
|
package/lib/utils/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{BUILD_TIME,GIT_COMMIT,VERSION}from"../generated/build-info.js";export function getCliVersion(){return VERSION}export function getCliGitCommit(){const gitCommit=String(GIT_COMMIT);return gitCommit&&gitCommit!=="unknown"?gitCommit:""}export function getCliVersionDisplay(){const gitCommit=getCliGitCommit();const buildDate=BUILD_TIME.slice(0,10);if(!gitCommit||!buildDate)return VERSION;return`${VERSION} (${gitCommit}, ${buildDate})`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export function writeCliSideChannelLine(line){process.stderr.write(`${line}\n`)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovrabet/lovrabet-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0-beta.2",
|
|
4
4
|
"description": "Runtime CLI for Lovrabet apps, datasets, SQL, Backend Function, skills, and AI agent workflows.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"prebuild": "node scripts/generate-build-info.js && node scripts/generate-builtin-skill-manifest.mjs --check",
|
|
44
|
-
"build": "
|
|
44
|
+
"build": "node scripts/clean-build-output.mjs && tsc && tsc-alias && node scripts/minify-build-output.mjs && node scripts/ensure-bin-executable.mjs",
|
|
45
45
|
"prebuild:dev": "node scripts/generate-build-info.js",
|
|
46
|
-
"build:dev": "
|
|
46
|
+
"build:dev": "node scripts/clean-build-output.mjs && tsc && tsc-alias && node scripts/ensure-bin-executable.mjs",
|
|
47
47
|
"prestart": "node scripts/generate-build-info.js",
|
|
48
48
|
"start": "tsc --watch",
|
|
49
49
|
"pretypecheck": "node scripts/generate-build-info.js",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"check:skill-version": "node scripts/check-skill-version.mjs",
|
|
64
64
|
"generate:builtin-skill-manifest": "node scripts/generate-builtin-skill-manifest.mjs",
|
|
65
65
|
"check:builtin-skill-manifest": "node scripts/generate-builtin-skill-manifest.mjs --check",
|
|
66
|
-
"postinstall": "node scripts/postinstall.mjs",
|
|
67
66
|
"ci": "npm run typecheck && npm run check:skill-version && npm run check:lockfile && npm run build",
|
|
68
67
|
"pretest": "node scripts/generate-build-info.js",
|
|
69
68
|
"test": "vitest run",
|
|
@@ -79,7 +78,6 @@
|
|
|
79
78
|
"skills/lovrabet",
|
|
80
79
|
"skills/lovrabet-report-generation",
|
|
81
80
|
"skills/lovrabet.manifest.json",
|
|
82
|
-
"scripts/postinstall.mjs",
|
|
83
81
|
"README.md",
|
|
84
82
|
"LICENSE",
|
|
85
83
|
"NOTICE"
|
|
@@ -106,6 +104,7 @@
|
|
|
106
104
|
"react": "^19.2.0",
|
|
107
105
|
"saxes": "6.0.0",
|
|
108
106
|
"semver": "^7.7.3",
|
|
107
|
+
"skills": "1.8.1",
|
|
109
108
|
"winston": "^3.17.0",
|
|
110
109
|
"ws": "8.20.1",
|
|
111
110
|
"yaml": "^2.9.0",
|
|
@@ -118,8 +117,7 @@
|
|
|
118
117
|
"@types/semver": "^7.7.1",
|
|
119
118
|
"@types/yauzl": "2.10.3",
|
|
120
119
|
"@vitest/coverage-v8": "^4.1.2",
|
|
121
|
-
"
|
|
122
|
-
"rimraf": "^6.1.3",
|
|
120
|
+
"terser": "5.51.2",
|
|
123
121
|
"tsc-alias": "^1.8.10",
|
|
124
122
|
"typescript": "5.9.3",
|
|
125
123
|
"vitest": "^4.1.2",
|
package/skills/lovrabet/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lovrabet
|
|
3
3
|
displayName: Lovrabet 运行态 CLI
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.4.0-beta.2
|
|
5
5
|
description: "Lovrabet 运行态 CLI — 面向业务场景的 AI 操作套件,通过 lovrabet 命令管理应用目录、业务角色与权限、用户级外部账号、API 文档发现、数据集查询、Instant API 数据操作、可恢复 Excel 导入、Custom SQL/Backend Function、Personal Backend Function、文件上传、面向票证类业务材料文字与结构化字段提取的 OCR、审批待办与任务办理、定时任务、Skill、知识库与运行态 app-config key 状态检查。触发词:云图、lovrabet、lovrabet-cli、指标查询、统计口径、经营报告、业务角色、角色成员、页面权限、菜单权限、数据集权限、user-account bind、provider 外部账号绑定、钉钉 userId 绑定、api-doc、dataset、data filter、Excel 导入、data import-excel、file upload、file query-url、ocr recognize、OCR 识别、票证文字提取、票证字段提取、发票识别、票据识别、证照识别、附件上传、personal-bff、approval、审批、待办、approve、reject、transfer、schedule、定时任务、cron、kb、skill、sql exec、bff exec、app-config、accessKey、compress、jq。"
|
|
6
6
|
metadata:
|
|
7
7
|
requires:
|
|
@@ -53,7 +53,7 @@ metadata:
|
|
|
53
53
|
npm install -g @lovrabet/lovrabet-cli
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
npm
|
|
56
|
+
npm 包携带同版本 Built-in Skill;首次 npm 安装后必须执行 `lovrabet cli-skill install` 显式安装。若 `lovrabet doctor` 报告缺失、版本不一致或内容不一致,先处理提示的网络/权限问题,再执行 `lovrabet cli-skill install` 从当前 npm 包内修复。详见 [CLI 更新](references/lovrabet-update.md) 与 [诊断](references/lovrabet-doctor.md)。
|
|
57
57
|
|
|
58
58
|
## 认证
|
|
59
59
|
|
|
@@ -311,7 +311,7 @@ npm 包会自动安装同版本 Built-in Skill。若 `lovrabet doctor` 报告缺
|
|
|
311
311
|
|
|
312
312
|
### CLI 更新
|
|
313
313
|
|
|
314
|
-
`lovrabet update` 只查询 npm package 的 dist-tags,不依赖 CDN 文件。默认等价于 `--latest`;`--beta` 使用 npm `beta` dist-tag;`--version <version>` 安装指定 semver。CLI 与 Built-in Skill
|
|
314
|
+
`lovrabet update` 只查询 npm package 的 dist-tags,不依赖 CDN 文件。默认等价于 `--latest`;`--beta` 使用 npm `beta` dist-tag;`--version <version>` 安装指定 semver。CLI 与 Built-in Skill 一体升级,不提供拆分升级选项;升级后启动新版 CLI 的显式安装命令并验证 Skill 版本及内容摘要,同版本检查则直接从当前包内修复。
|
|
315
315
|
|
|
316
316
|
开源二开配置集中在项目代码的 `src/constant/product.ts`,`src/constant/distribution.ts` 只做兼容导出:
|
|
317
317
|
|
|
@@ -25,7 +25,7 @@ lovrabet skill install --project
|
|
|
25
25
|
|
|
26
26
|
## CLI Built-in Skill
|
|
27
27
|
|
|
28
|
-
`lovrabet skill install` 仅安装当前应用的业务 Skill。CLI Built-in Skill 已包含在当前 npm
|
|
28
|
+
`lovrabet skill install` 仅安装当前应用的业务 Skill。CLI Built-in Skill 已包含在当前 npm 包内,首次 npm 安装后须显式安装;`lovrabet update` 会显式调用新版安装器并验证同版本内容。诊断显示缺失、版本不一致或内容不一致时,使用当前包内的确定版本修复:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
31
|
lovrabet cli-skill install
|
|
@@ -19,8 +19,8 @@ lovrabet update --version <version>
|
|
|
19
19
|
|
|
20
20
|
## 行为
|
|
21
21
|
|
|
22
|
-
- npm 安装包携带同版本 Built-in Skill
|
|
23
|
-
- CLI
|
|
22
|
+
- npm 安装包携带同版本 Built-in Skill,首次 npm 安装后须显式执行 `lovrabet cli-skill install`。
|
|
23
|
+
- CLI 包升级后,按绝对路径启动新版 CLI 的 `cli-skill install`,验证新包版本及 Skill 内容摘要,通过后才报告成功。
|
|
24
24
|
- CLI 已经是目标版本时,命令从当前 npm 包内检查并修复 Built-in Skill。
|
|
25
25
|
- Skill 缺失、版本不一致或验证失败时,命令返回失败并提示 `lovrabet cli-skill install`;不要把“CLI 包已更新”误报为完整成功。
|
|
26
26
|
- `lovrabet skill install` 仍只管理当前应用的业务 Skill,与 Built-in Skill 生命周期相互独立。
|
|
@@ -28,7 +28,9 @@ lovrabet update --version <version>
|
|
|
28
28
|
手动复现或修复 npm 安装问题时,可以使用:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
npm install -g @lovrabet/lovrabet-cli@<version>
|
|
32
|
-
lovrabet doctor
|
|
31
|
+
npm install -g @lovrabet/lovrabet-cli@<version> --ignore-scripts
|
|
33
32
|
lovrabet cli-skill install
|
|
33
|
+
lovrabet doctor
|
|
34
34
|
```
|
|
35
|
+
|
|
36
|
+
Skill 安装失败时 CLI 包可能已更新,不自动回滚;修复成功前不能报告完整升级成功。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lovrabet-report-generation
|
|
3
3
|
displayName: 业务报告与分析
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.4.0-beta.2
|
|
5
5
|
description: "Use when 用户需要日报、周报、经营汇总、指标比较、综合分析,修改已有报告,或根据已提供的上下文补齐报告。完整匹配的企业业务 Skill 可直接使用;单值或身份查询不强制生成报告。不用于开发发布指标或修改业务数据。"
|
|
6
6
|
example: "帮我整理昨天各门店的经营情况。"
|
|
7
7
|
metadata:
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "lovrabet",
|
|
4
4
|
"packageName": "@lovrabet/lovrabet-cli",
|
|
5
|
-
"packageVersion": "2.
|
|
6
|
-
"skillVersion": "2.
|
|
5
|
+
"packageVersion": "2.4.0-beta.2",
|
|
6
|
+
"skillVersion": "2.4.0-beta.2",
|
|
7
7
|
"files": [
|
|
8
8
|
"SKILL.md",
|
|
9
9
|
"guides/app-resolution.md",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"references/lovrabet-user-account.md",
|
|
44
44
|
"references/lovrabet-workspace.md"
|
|
45
45
|
],
|
|
46
|
-
"digest": "
|
|
46
|
+
"digest": "e888e18c4ddce0067ce95f9fc112ace1ffb40fca962bb6865c7c5972ad4609f6"
|
|
47
47
|
}
|
package/lib/postinstall.d.ts
DELETED
package/lib/postinstall.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(_0x569abf,_0x213224){const _0x2a7d7e=a143_0x280f,_0x946469=_0x569abf();while(!![]){try{const _0x23fdf4=parseInt(_0x2a7d7e(0x159))/0x1+-parseInt(_0x2a7d7e(0x153))/0x2+parseInt(_0x2a7d7e(0x161))/0x3+-parseInt(_0x2a7d7e(0x150))/0x4*(-parseInt(_0x2a7d7e(0x15c))/0x5)+-parseInt(_0x2a7d7e(0x156))/0x6*(parseInt(_0x2a7d7e(0x157))/0x7)+parseInt(_0x2a7d7e(0x163))/0x8+-parseInt(_0x2a7d7e(0x165))/0x9*(-parseInt(_0x2a7d7e(0x15e))/0xa);if(_0x23fdf4===_0x213224)break;else _0x946469['push'](_0x946469['shift']());}catch(_0x25bb20){_0x946469['push'](_0x946469['shift']());}}}(a143_0x13c5,0xcf3bc));import{installBuiltinSkill}from'./skills/builtin-skill.js';function a143_0x13c5(){const _0x26c752=['2760046xiEQfA','\x20via\x20skills@latest','Lovrabet\x20Built-in\x20Skill\x20','6xuVaiI','6080634Rvrskp','installedPath','896254XkGfCU','Repair\x20with:\x20','SOURCE_INVALID','6700GDRWBd','repairCommand','1030UaikMK','log','installed','2258508hVtSUF','warn','1965168XhPkIB','[BUILTIN_SKILL_INSTALL_','27351hJDKYK','\x20at\x20','FAILED','skillVersion','2656hwrXiE','code','changed'];a143_0x13c5=function(){return _0x26c752;};return a143_0x13c5();}function a143_0x280f(_0x12cfd2,_0x4f18ab){_0x12cfd2=_0x12cfd2-0x14d;const _0x13c50d=a143_0x13c5();let _0x280ff2=_0x13c50d[_0x12cfd2];return _0x280ff2;}export async function runPostinstall(_0xbc7a24={}){const _0x4f2eb5=a143_0x280f,_0x5b7582=installBuiltinSkill(_0xbc7a24);if(_0x5b7582['ok']){const _0x78b512=_0x5b7582[_0x4f2eb5(0x152)]?_0x4f2eb5(0x160):'already\x20current',_0x54dd19=_0x5b7582[_0x4f2eb5(0x158)]?_0x4f2eb5(0x14d)+_0x5b7582[_0x4f2eb5(0x158)]:_0x4f2eb5(0x154);return console[_0x4f2eb5(0x15f)](_0x4f2eb5(0x155)+_0x5b7582[_0x4f2eb5(0x14f)]+'\x20'+_0x78b512+_0x54dd19),_0x5b7582;}const _0x75b147=_0x4f2eb5(0x164)+(_0x5b7582[_0x4f2eb5(0x151)]??_0x4f2eb5(0x14e))+']\x20'+(_0x5b7582['error']??'Installation\x20failed')+'.\x20'+(_0x4f2eb5(0x15a)+_0x5b7582[_0x4f2eb5(0x15d)]);if(_0x5b7582[_0x4f2eb5(0x151)]===_0x4f2eb5(0x15b))throw new Error(_0x75b147);return console[_0x4f2eb5(0x162)](_0x75b147),_0x5b7582;}
|
package/scripts/postinstall.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { dirname, join, resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
-
|
|
6
|
-
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
-
const entry = join(root, "lib", "postinstall.js");
|
|
8
|
-
|
|
9
|
-
if (!existsSync(entry)) {
|
|
10
|
-
if (existsSync(join(root, "src", "postinstall.ts"))) {
|
|
11
|
-
console.log("Skipping Lovrabet Built-in Skill postinstall in an unbuilt source checkout.");
|
|
12
|
-
} else {
|
|
13
|
-
console.error("[BUILTIN_SKILL_INSTALL_SOURCE_MISSING] Missing lib/postinstall.js");
|
|
14
|
-
process.exitCode = 1;
|
|
15
|
-
}
|
|
16
|
-
} else {
|
|
17
|
-
try {
|
|
18
|
-
const { runPostinstall } = await import(pathToFileURL(entry).href);
|
|
19
|
-
await runPostinstall();
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
22
|
-
process.exitCode = 1;
|
|
23
|
-
}
|
|
24
|
-
}
|