@lark-project/cli
Version:
飞书项目插件开发工具
44 lines (43 loc) • 2.41 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.addUpdateCommand = void 0;
// ⚠️ 改命令名 / flag / alias 时,同步 grep `lpm` skills/ .claude/skills/ 修文档引用
const path_1 = __importDefault(require("path"));
const types_1 = require("../../types");
const local_plugin_config_1 = require("../../local-plugin-config");
const logger_1 = require("../../utils/logger");
const online_write_app_type_allowlist_1 = require("../../utils/online-write-app-type-allowlist");
const run_script_1 = __importDefault(require("../../utils/run-script"));
function addUpdateCommand(program) {
program
.command('update')
.description('Update the added plugin features')
.option('--source-type <source-type>', 'Config source: local or remote')
.option('--save-snapshot', 'Save backend-format snapshot for eval comparison (requires --case-id)')
.option('--case-id <case-id>', 'Eval case ID used to name the snapshot file')
.option('--delete-grant <token>', 'Grant token printed by `lpm allow-delete <token>`, passed back to authorize an irreversible point/property deletion when the user authorized in a DIFFERENT filesystem (e.g. agent runs in a sandbox). No local file needed.')
.action(options => {
var _a;
const appType = (_a = (0, local_plugin_config_1.getLocalPluginConfig)()) === null || _a === void 0 ? void 0 : _a.app_type;
if (!(0, online_write_app_type_allowlist_1.isAppTypeAllowedForOnlineWrite)(types_1.ECommandName.update, appType)) {
logger_1.logger.error((0, online_write_app_type_allowlist_1.formatOnlineWriteAppTypeError)(types_1.ECommandName.update, appType));
process.exit(1);
}
const { sourceType, saveSnapshot, caseId, deleteGrant } = options;
(0, run_script_1.default)(path_1.default.join(__dirname, '../dispatcher'), [
'--command',
types_1.ECommandName.update,
'--payload',
JSON.stringify({
source_type: sourceType,
save_snapshot: saveSnapshot,
case_id: caseId,
delete_grant: deleteGrant,
}),
]);
});
}
exports.addUpdateCommand = addUpdateCommand;