@univer-cli/content-inspection-command 1.0.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 +62 -0
- package/README.zh-CN.md +67 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.mjs +1 -0
- package/package.json +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @univer-cli/content-inspection-command
|
|
2
|
+
|
|
3
|
+
English | [简体中文](./README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Provide a native Commander `inspect` command preset for `@univer-cli/content-inspection`, including selector parsing, default text or JSON output, and runtime lease acquisition and release.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add commander @univer-cli/content-inspection @univer-cli/content-inspection-command
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Commander `^15.0.0` is a peer dependency. Requires Node.js 22.12 or higher.
|
|
14
|
+
|
|
15
|
+
## Select preset
|
|
16
|
+
|
|
17
|
+
The package provides two independent factories:
|
|
18
|
+
|
|
19
|
+
- `createContentInspectionCommand()`: only receives Unit ID, no Worktree option appears;
|
|
20
|
+
- `createWorktreeContentInspectionCommand()`: forces the caller to choose either `--trunk` or `--worktree <id>`.
|
|
21
|
+
|
|
22
|
+
Ordinary applications should choose the former; use the latter only if the target model explicitly includes Worktree.
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { createContentInspectionCommand } from "@univer-cli/content-inspection-command";
|
|
28
|
+
import { Command } from "commander";
|
|
29
|
+
|
|
30
|
+
const program = new Command("my-cli");
|
|
31
|
+
|
|
32
|
+
program.addCommand(
|
|
33
|
+
createContentInspectionCommand({
|
|
34
|
+
async acquireRuntime({ unitId }) {
|
|
35
|
+
const lease = await runtimes.acquire({
|
|
36
|
+
key: `unit:${unitId}`,
|
|
37
|
+
init: { unitId },
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
unitId: lease.unitId,
|
|
42
|
+
unitType: "sheet",
|
|
43
|
+
execute: async (input) => await lease.execute(input),
|
|
44
|
+
invalidate: async () => await lease.invalidate(),
|
|
45
|
+
release: async () => await lease.release(),
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
await program.parseAsync();
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Lifecycle
|
|
55
|
+
|
|
56
|
+
The command acquires a runtime when its action starts and releases it on success or failure. If inspection or presentation fails, it invalidates the lease before passing the failure to Commander. The application still owns target-to-pool-key mapping, runtime initialization, authentication, and remote data loading.
|
|
57
|
+
|
|
58
|
+
## Input and output
|
|
59
|
+
|
|
60
|
+
The command accepts a Unit ID, a Unit-specific selector, and `--json`. Default text is human-readable; JSON output directly represents the capability's structured result. Selector syntax validation belongs to the command adapter, while the actual inspection rules belong to the capability.
|
|
61
|
+
|
|
62
|
+
The factory returns a native `Command`, so you can continue to use Commander to customize its name, help, output, and exit behavior. This package does not create a root program.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @univer-cli/content-inspection-command
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
为 `@univer-cli/content-inspection` 提供原生 Commander `inspect` command preset,包括 selector 解析、
|
|
6
|
+
默认文本或 JSON 输出,以及 runtime lease 的 acquire/release。
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm add commander @univer-cli/content-inspection @univer-cli/content-inspection-command
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Commander `^15.0.0` 是 peer dependency。要求 Node.js 22.12 或更高版本。
|
|
15
|
+
|
|
16
|
+
## 选择 preset
|
|
17
|
+
|
|
18
|
+
Package 提供两个独立 factory:
|
|
19
|
+
|
|
20
|
+
- `createContentInspectionCommand()`:只接收 Unit ID,不出现 Worktree 选项;
|
|
21
|
+
- `createWorktreeContentInspectionCommand()`:强制调用方在 `--trunk` 与 `--worktree <id>` 中二选一。
|
|
22
|
+
|
|
23
|
+
普通 application 应选择前者;只有 target model 明确包含 Worktree 时才使用后者。
|
|
24
|
+
|
|
25
|
+
## 快速开始
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { createContentInspectionCommand } from "@univer-cli/content-inspection-command";
|
|
29
|
+
import { Command } from "commander";
|
|
30
|
+
|
|
31
|
+
const program = new Command("my-cli");
|
|
32
|
+
|
|
33
|
+
program.addCommand(
|
|
34
|
+
createContentInspectionCommand({
|
|
35
|
+
async acquireRuntime({ unitId }) {
|
|
36
|
+
const lease = await runtimes.acquire({
|
|
37
|
+
key: `unit:${unitId}`,
|
|
38
|
+
init: { unitId },
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
unitId: lease.unitId,
|
|
43
|
+
unitType: "sheet",
|
|
44
|
+
execute: async (input) => await lease.execute(input),
|
|
45
|
+
invalidate: async () => await lease.invalidate(),
|
|
46
|
+
release: async () => await lease.release(),
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
await program.parseAsync();
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 生命周期
|
|
56
|
+
|
|
57
|
+
Command 会在 action 开始时 acquire runtime,并在成功或失败后 release。Inspection 或 presentation 失败时会先
|
|
58
|
+
invalidate lease,再交给 Commander 处理失败。Application 仍然拥有 target 到 pool key、runtime init、认证和
|
|
59
|
+
远程数据加载规则。
|
|
60
|
+
|
|
61
|
+
## 输入与输出
|
|
62
|
+
|
|
63
|
+
Command 接受 Unit ID、Unit-specific selector 和 `--json`。默认文本用于人工阅读;JSON 输出直接表达 capability
|
|
64
|
+
的结构化结果。Selector 的语法校验属于 command adapter,实际 inspection 规则属于 capability。
|
|
65
|
+
|
|
66
|
+
Factory 返回原生 `Command`,可继续用 Commander 定制名称、help、输出和退出行为。本 package 不创建 root
|
|
67
|
+
program。
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';module['exports']=require('./index.mjs');
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ContentInspectionQuery, ContentInspectionResult, ContentInspectionRuntime, ContentInspectionTarget } from "@univer-cli/content-inspection";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
//#region src/text-presenter.d.ts
|
|
4
|
+
declare function renderContentInspection(result: ContentInspectionResult): string;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/query-parser.d.ts
|
|
7
|
+
interface InspectionCommandOptions {
|
|
8
|
+
readonly worksheet?: string;
|
|
9
|
+
}
|
|
10
|
+
declare class InspectionCommandInputError extends Error {}
|
|
11
|
+
declare function parseInspectionQuery(target: ContentInspectionTarget, selectors: readonly string[], options: InspectionCommandOptions): ContentInspectionQuery;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/index.d.ts
|
|
14
|
+
interface ContentInspectionCommandDependencies {
|
|
15
|
+
readonly acquireRuntime: (input: {
|
|
16
|
+
readonly unitId: string;
|
|
17
|
+
}) => Promise<ContentInspectionLease>;
|
|
18
|
+
}
|
|
19
|
+
interface WorktreeContentInspectionCommandDependencies {
|
|
20
|
+
readonly acquireRuntime: (input: {
|
|
21
|
+
readonly unitId: string;
|
|
22
|
+
readonly worktreeID?: string;
|
|
23
|
+
}) => Promise<ContentInspectionLease>;
|
|
24
|
+
}
|
|
25
|
+
interface ContentInspectionLease extends ContentInspectionRuntime {
|
|
26
|
+
invalidate(): Promise<void>;
|
|
27
|
+
release(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
declare function createContentInspectionCommand(dependencies: ContentInspectionCommandDependencies): Command;
|
|
30
|
+
declare function createWorktreeContentInspectionCommand(dependencies: WorktreeContentInspectionCommandDependencies): Command;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { ContentInspectionCommandDependencies, ContentInspectionLease, InspectionCommandInputError, type InspectionCommandOptions, WorktreeContentInspectionCommandDependencies, createContentInspectionCommand, createWorktreeContentInspectionCommand, parseInspectionQuery, renderContentInspection };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x9b41b1=_0x4486;(function(_0x12c0df,_0x464f8e){const _0x4dcc2f=_0x4486,_0x39c46b=_0x12c0df();while(!![]){try{const _0x34b092=-parseInt(_0x4dcc2f(0x1a5))/0x1+parseInt(_0x4dcc2f(0x1d0))/0x2*(-parseInt(_0x4dcc2f(0x18c))/0x3)+parseInt(_0x4dcc2f(0x1c1))/0x4*(parseInt(_0x4dcc2f(0x156))/0x5)+-parseInt(_0x4dcc2f(0x1bf))/0x6+parseInt(_0x4dcc2f(0x1a4))/0x7+parseInt(_0x4dcc2f(0x1be))/0x8+parseInt(_0x4dcc2f(0x15a))/0x9*(parseInt(_0x4dcc2f(0x1cb))/0xa);if(_0x34b092===_0x464f8e)break;else _0x39c46b['push'](_0x39c46b['shift']());}catch(_0x173eb1){_0x39c46b['push'](_0x39c46b['shift']());}}}(_0x5ea3,0x4e2be));import{ContentInspectionError as _0x53d47a,inspectContent as _0x2fa521}from'@univer-cli/content-inspection';import{Argument as _0x591fbe,Command as _0x1440a8,Option as _0xe44af1}from'commander';var a=class extends Error{};function o(_0x278408,_0x5eab4b,_0x35f146){const _0x3c1ab5=_0x4486;if(_0x278408==='workbook'||_0x278408===_0x3c1ab5(0x1aa)||_0x278408===_0x3c1ab5(0x1a9))return p(_0x278408,_0x5eab4b),m(_0x278408,_0x35f146[_0x3c1ab5(0x170)]),{'kind':_0x278408};if(_0x278408==='worksheet')return m(_0x278408,_0x35f146[_0x3c1ab5(0x170)]),{'kind':_0x278408,'worksheets':f(_0x5eab4b,s)};if(_0x278408==='slide')return m(_0x278408,_0x35f146[_0x3c1ab5(0x170)]),{'kind':_0x278408,'slides':f(_0x5eab4b,c)};if(_0x278408==='paragraph')return m(_0x278408,_0x35f146[_0x3c1ab5(0x170)]),{'kind':_0x278408,'paragraphs':f(_0x5eab4b,l)};if(_0x35f146[_0x3c1ab5(0x170)]===void 0x0)throw new a(_0x3c1ab5(0x1ab));let _0x2cafb3=s(_0x35f146[_0x3c1ab5(0x170)]);return{'kind':_0x278408,'ranges':f(_0x5eab4b,_0x38ac96=>{const _0x2d37ee=_0x3c1ab5;if(_0x38ac96[_0x2d37ee(0x198)]===0x0)throw new a('Range\x20cannot\x20be\x20empty');return{'range':_0x38ac96,'worksheet':_0x2cafb3};})};}function s(_0x58652d){const _0x1551ea=_0x4486;let _0x2ca65a=u(_0x58652d);if(_0x2ca65a[_0x1551ea(0x19b)]==='id')return{'id':_0x2ca65a[_0x1551ea(0x17e)]};if(_0x2ca65a['prefix']==='name')return{'name':_0x2ca65a[_0x1551ea(0x17e)]};if(_0x2ca65a[_0x1551ea(0x19b)]==='index')return{'index':d(_0x2ca65a['value'])};throw new a('Unknown\x20worksheet\x20selector\x20prefix\x20\x22'+_0x2ca65a[_0x1551ea(0x19b)]+'\x22;\x20use\x20id:,\x20name:,\x20or\x20index:');}function c(_0x426a44){const _0x271d06=_0x4486;let _0x250e10=u(_0x426a44);if(_0x250e10[_0x271d06(0x19b)]==='id')return{'id':_0x250e10[_0x271d06(0x17e)]};if(_0x250e10['prefix']===_0x271d06(0x1d6))return{'index':d(_0x250e10['value'])};throw new a('Unknown\x20slide\x20selector\x20prefix\x20\x22'+_0x250e10['prefix']+_0x271d06(0x1b1));}function l(_0x1cdce9){const _0x3f31e9=_0x4486;let _0x261488=u(_0x1cdce9);if(_0x261488[_0x3f31e9(0x19b)]==='id')return{'id':_0x261488[_0x3f31e9(0x17e)]};if(_0x261488[_0x3f31e9(0x19b)]===_0x3f31e9(0x1d6))return{'index':d(_0x261488[_0x3f31e9(0x17e)])};throw new a('Unknown\x20paragraph\x20selector\x20prefix\x20\x22'+_0x261488[_0x3f31e9(0x19b)]+_0x3f31e9(0x1b1));}function u(_0x3894d4){const _0x3657b3=_0x4486;let _0x2334c4=_0x3894d4['indexOf'](':');if(_0x2334c4<=0x0||_0x2334c4===_0x3894d4[_0x3657b3(0x198)]-0x1)throw new a(_0x3657b3(0x187)+_0x3894d4+_0x3657b3(0x180));return{'prefix':_0x3894d4[_0x3657b3(0x15d)](0x0,_0x2334c4),'value':_0x3894d4['slice'](_0x2334c4+0x1)};}function d(_0xfb91b7){const _0x39d51b=_0x4486;if(!/^\d+$/[_0x39d51b(0x1b0)](_0xfb91b7))throw new a('Invalid\x20index\x20\x22'+_0xfb91b7+_0x39d51b(0x199));let _0x2194c8=Number(_0xfb91b7);if(!Number[_0x39d51b(0x1c7)](_0x2194c8)||_0x2194c8<0x1)throw new a('Invalid\x20index\x20\x22'+_0xfb91b7+_0x39d51b(0x1c5));return _0x2194c8-0x1;}function _0x5ea3(){const _0x1b4188=['range\x20requires\x20--worksheet\x20<selector>','clipped','title','\x20omitted','--trunk\x20and\x20--worktree\x20cannot\x20be\x20used\x20together','test','\x22;\x20use\x20id:\x20or\x20index:','range','--trunk','total','worksheet-range','slide','width','presentation\x20','text','characterCount','layoutSlideCount','ranges','code','2019176qudQNg','2814300yeBAVK','mergedRanges','13444uTkoDc','mode','name','\x20—\x20','\x22;\x20CLI\x20indices\x20start\x20at\x201','requestedRange','isSafeInteger','masterSlideCount','paragraph\x20[','columnCount','4154110HlmiiA','string','\x09…\x20','textPreview','\x0atext\x20runs:\x20','4vDzopf','error','Specify\x20exactly\x20one\x20of\x20--trunk\x20or\x20--worktree\x20<id>','count','\x20inspection\x20does\x20not\x20accept\x20selectors','Unit\x20to\x20inspect','index',',\x20layouts:\x20','5caOJkr','description','option','addOption','18bnmzZM','size','write\x20the\x20complete\x20structured\x20result\x20as\x20JSON','slice','workbook','formulaUsedRanges','\x20columns\x20omitted','--worksheet\x20is\x20only\x20valid\x20for\x20range,\x20not\x20','inspect.invalid-input','message','type','images','stringify','inspect.failed','masters:\x20','paragraphs','textRuns','rowCount','valueUsedRanges','Inspect\x20structured\x20Univer\x20content','choices','writeOut','worksheet','join','inspect\x20the\x20trunk','unitId','trunk','trim','conflicts','inspect','\x20\x20formulas:\x20','push','conditionalFormatting','\x20\x20tables:\x20','explicit\x20selectors\x20such\x20as\x20id:sheet-1,\x20name:Plan,\x20or\x20index:2','paragraph','value','inspect\x20a\x20worktree','\x22;\x20selectors\x20require\x20an\x20explicit\x20prefix','requiredOption','worksheets','worktree','replace',')\x20[','displayValues','Invalid\x20selector\x20\x22','configureOutput',',\x20images\x20','This\x20inspection\x20target\x20requires\x20at\x20least\x20one\x20selector','acquireRuntime','521547tlkrrr','slides','\x20rows\x20omitted','map','\x20\x20data\x20validation:\x20',',\x20shapes\x20','workbook\x20','<target>','drawings','charts','Missing\x20selector','tables','length','\x22;\x20index\x20must\x20be\x20an\x20integer','height','prefix','\x20\x20conditional\x20formatting:\x20','document\x20','speakerNotes','--worktree\x20<id>','action','argument','kind','\x20elements','3009132uouFSF','379518ZRZaRz','\x20(charts\x20','\x20\x20[','styleUsedRanges','document','presentation'];_0x5ea3=function(){return _0x1b4188;};return _0x5ea3();}function f(_0x25f2ba,_0x4cc5d5){const _0x4a50fb=_0x4486;if(_0x25f2ba[_0x4a50fb(0x198)]===0x0)throw new a(_0x4a50fb(0x18a));let _0x11075c=_0x25f2ba[0x0];if(_0x11075c===void 0x0)throw new a(_0x4a50fb(0x196));return[_0x4cc5d5(_0x11075c),..._0x25f2ba['slice'](0x1)[_0x4a50fb(0x18f)](_0x4cc5d5)];}function p(_0x59f3df,_0x6cbf23){const _0x42e567=_0x4486;if(_0x6cbf23[_0x42e567(0x198)]>0x0)throw new a(_0x59f3df+_0x42e567(0x1d4));}function m(_0x35de86,_0xf331e0){const _0x29351d=_0x4486;if(_0xf331e0!==void 0x0)throw new a(_0x29351d(0x161)+_0x35de86);}var h=0xc,g=0x8,_=0xc;function v(_0x43b59a){const _0x1c0717=_0x4486;switch(_0x43b59a[_0x1c0717(0x1a2)]){case _0x1c0717(0x15e):return[_0x1c0717(0x192)+_0x43b59a[_0x1c0717(0x1c3)]+'\x20('+_0x43b59a['unitId']+')',..._0x43b59a[_0x1c0717(0x182)][_0x1c0717(0x18f)](y)]['join']('\x0a');case _0x1c0717(0x170):return _0x43b59a[_0x1c0717(0x182)][_0x1c0717(0x18f)](y)[_0x1c0717(0x171)]('\x0a');case _0x1c0717(0x1b5):return _0x43b59a[_0x1c0717(0x1bc)][_0x1c0717(0x18f)](_0x349c48=>_0x349c48[_0x1c0717(0x170)]['name']+'!'+_0x349c48['resolvedRange']+(_0x349c48[_0x1c0717(0x1ac)]?'\x20(clipped\x20from\x20'+_0x349c48[_0x1c0717(0x1c6)]+')':'')+'\x0a'+b(_0x349c48[_0x1c0717(0x186)]))[_0x1c0717(0x171)]('\x0a\x0a');case'presentation':return[_0x1c0717(0x1b8)+_0x43b59a['name']+'\x20('+_0x43b59a[_0x1c0717(0x173)]+')\x20'+_0x43b59a[_0x1c0717(0x15b)][_0x1c0717(0x1b7)]+'x'+_0x43b59a['size'][_0x1c0717(0x19a)],_0x1c0717(0x168)+_0x43b59a[_0x1c0717(0x1c8)]+_0x1c0717(0x1d7)+_0x43b59a[_0x1c0717(0x1bb)],..._0x43b59a[_0x1c0717(0x18d)]['map'](_0x10ed6c=>_0x1c0717(0x1a7)+(_0x10ed6c['index']+0x1)+']\x20'+_0x10ed6c['id']+'\x20'+_0x10ed6c[_0x1c0717(0x1c3)]+'\x20—\x20'+_0x10ed6c['elementCounts'][_0x1c0717(0x1b4)]+_0x1c0717(0x1a3)+(_0x10ed6c[_0x1c0717(0x1ce)]===void 0x0?'':_0x1c0717(0x1c4)+_0x10ed6c['textPreview']))]['join']('\x0a');case _0x1c0717(0x1b6):return _0x43b59a[_0x1c0717(0x18d)][_0x1c0717(0x18f)](_0x57c8cf=>['slide\x20['+(_0x57c8cf[_0x1c0717(0x1d6)]+0x1)+']\x20'+_0x57c8cf['id']+'\x20'+_0x57c8cf[_0x1c0717(0x1c3)],..._0x57c8cf['elements']['map'](_0x491dac=>x(_0x491dac,'\x20\x20')),..._0x57c8cf[_0x1c0717(0x19e)]===''?[]:['\x20\x20notes:\x20'+_0x57c8cf['speakerNotes']]][_0x1c0717(0x171)]('\x0a'))[_0x1c0717(0x171)]('\x0a\x0a');case _0x1c0717(0x1a9):return[_0x1c0717(0x19d)+_0x43b59a[_0x1c0717(0x1ad)]+'\x20('+_0x43b59a[_0x1c0717(0x173)]+_0x1c0717(0x185)+_0x43b59a[_0x1c0717(0x1c2)]+']',_0x43b59a['paragraphCount']+'\x20paragraphs,\x20'+_0x43b59a[_0x1c0717(0x1ba)]+'\x20characters',..._0x43b59a[_0x1c0717(0x169)][_0x1c0717(0x18f)](_0x599900=>_0x1c0717(0x1a7)+(_0x599900[_0x1c0717(0x1d6)]+0x1)+']\x20'+_0x599900['id']+_0x1c0717(0x1c4)+_0x599900[_0x1c0717(0x1ce)])][_0x1c0717(0x171)]('\x0a');case _0x1c0717(0x17d):return _0x43b59a['paragraphs'][_0x1c0717(0x18f)](_0x10fe25=>_0x1c0717(0x1c9)+(_0x10fe25[_0x1c0717(0x1d6)]+0x1)+']\x20'+_0x10fe25['id']+'\x0a'+_0x10fe25[_0x1c0717(0x1b9)]+(_0x10fe25[_0x1c0717(0x16a)][_0x1c0717(0x198)]===0x0?'':_0x1c0717(0x1cf)+_0x10fe25[_0x1c0717(0x16a)][_0x1c0717(0x198)]))[_0x1c0717(0x171)]('\x0a\x0a');}}function y(_0x3781d6){const _0x8ddcff=_0x4486;let _0x3a5a83=['worksheet\x20['+(_0x3781d6[_0x8ddcff(0x1d6)]+0x1)+']\x20'+_0x3781d6['id']+'\x20'+_0x3781d6['name']+'\x20('+_0x3781d6[_0x8ddcff(0x16b)]+'x'+_0x3781d6[_0x8ddcff(0x1ca)]+')','\x20\x20values:\x20'+S(_0x3781d6[_0x8ddcff(0x16c)]),_0x8ddcff(0x178)+S(_0x3781d6[_0x8ddcff(0x15f)]),'\x20\x20styles:\x20'+S(_0x3781d6[_0x8ddcff(0x1a8)]),'\x20\x20merged:\x20'+S(_0x3781d6[_0x8ddcff(0x1c0)])];return _0x3781d6['tables']['length']>0x0&&_0x3a5a83[_0x8ddcff(0x179)](_0x8ddcff(0x17b)+S(_0x3781d6[_0x8ddcff(0x197)][_0x8ddcff(0x18f)](_0x7c7eb6=>_0x7c7eb6[_0x8ddcff(0x1c3)]+'('+_0x7c7eb6[_0x8ddcff(0x1b2)]+')'))),_0x3a5a83[_0x8ddcff(0x179)](_0x8ddcff(0x19c)+_0x3781d6[_0x8ddcff(0x17a)][_0x8ddcff(0x1d3)],_0x8ddcff(0x190)+_0x3781d6['dataValidation'][_0x8ddcff(0x1d3)],'\x20\x20drawings:\x20'+_0x3781d6[_0x8ddcff(0x194)][_0x8ddcff(0x1b4)]+_0x8ddcff(0x1a6)+_0x3781d6[_0x8ddcff(0x194)][_0x8ddcff(0x195)]+_0x8ddcff(0x189)+_0x3781d6[_0x8ddcff(0x194)][_0x8ddcff(0x165)]+_0x8ddcff(0x191)+_0x3781d6[_0x8ddcff(0x194)]['shapes']+')'),_0x3a5a83['join']('\x0a');}function b(_0x50e1f0){const _0x54f056=_0x4486;let _0x3dca94=_0x50e1f0[_0x54f056(0x15d)](0x0,h)['map'](_0xa27822=>{const _0x49368c=_0x54f056;let _0x1ffbe9=_0xa27822[_0x49368c(0x15d)](0x0,g),_0x7cc632=_0xa27822[_0x49368c(0x198)]-_0x1ffbe9['length'];return''+_0x1ffbe9[_0x49368c(0x18f)](_0x2b98fa=>JSON['stringify'](_0x2b98fa))['join']('\x09')+(_0x7cc632>0x0?_0x49368c(0x1cd)+_0x7cc632+_0x49368c(0x160):'');}),_0x54c420=_0x50e1f0[_0x54f056(0x198)]-_0x3dca94[_0x54f056(0x198)];return _0x54c420>0x0&&_0x3dca94['push']('…\x20'+_0x54c420+_0x54f056(0x18e)),_0x3dca94[_0x54f056(0x171)]('\x0a');}function x(_0x45aa25,_0x379dec){const _0x24455a=_0x4486;let _0x2c7be6=_0x45aa25[_0x24455a(0x1b9)]?.[_0x24455a(0x1b9)][_0x24455a(0x184)](/\s+/g,'\x20')[_0x24455a(0x175)]();return[''+_0x379dec+_0x45aa25[_0x24455a(0x164)]+'\x20'+_0x45aa25['id']+(_0x45aa25[_0x24455a(0x1c3)]===''?'':'\x20'+_0x45aa25['name'])+(_0x2c7be6===void 0x0||_0x2c7be6===''?'':_0x24455a(0x1c4)+_0x2c7be6),...(_0x45aa25['children']??[])['map'](_0x448919=>x(_0x448919,_0x379dec+'\x20\x20'))][_0x24455a(0x171)]('\x0a');}function S(_0x2a35ed){const _0x508ab6=_0x4486;if(_0x2a35ed['length']===0x0)return'none';let _0x248397=_0x2a35ed['slice'](0x0,_),_0x1dc2a9=_0x2a35ed[_0x508ab6(0x198)]-_0x248397[_0x508ab6(0x198)];return''+_0x248397['join'](',\x20')+(_0x1dc2a9>0x0?',\x20…\x20'+_0x1dc2a9+_0x508ab6(0x1ae):'');}var C=[_0x9b41b1(0x15e),_0x9b41b1(0x170),'range',_0x9b41b1(0x1aa),_0x9b41b1(0x1b6),_0x9b41b1(0x1a9),_0x9b41b1(0x17d)];function w(_0x2250bf){return E({'acquireRuntime':async _0x4cb480=>await _0x2250bf['acquireRuntime']({'unitId':_0x4cb480}),'worktree':!0x1});}function T(_0x38011c){return E({'acquireRuntime':async(_0x382c73,_0x41938b)=>{const _0x6b1b3a=_0x4486;if(_0x41938b[_0x6b1b3a(0x174)]===!0x0&&_0x41938b[_0x6b1b3a(0x183)]!==void 0x0)throw new a(_0x6b1b3a(0x1af));if(_0x41938b[_0x6b1b3a(0x174)]!==!0x0&&_0x41938b[_0x6b1b3a(0x183)]===void 0x0)throw new a(_0x6b1b3a(0x1d2));return await _0x38011c['acquireRuntime']({'unitId':_0x382c73,..._0x41938b['worktree']===void 0x0?{}:{'worktreeID':_0x41938b[_0x6b1b3a(0x183)]}});},'worktree':!0x0});}function E(_0x1637bc){const _0x1f3815=_0x9b41b1;let _0x549e82=new _0x1440a8(_0x1f3815(0x177))[_0x1f3815(0x157)](_0x1f3815(0x16d))['addArgument'](new _0x591fbe(_0x1f3815(0x193),'content\x20target')[_0x1f3815(0x16e)](C))[_0x1f3815(0x1a1)]('[selectors...]',_0x1f3815(0x17c))[_0x1f3815(0x181)]('--unit\x20<unit-id>',_0x1f3815(0x1d5))[_0x1f3815(0x158)]('--worksheet\x20<selector>','worksheet\x20selector\x20for\x20range')[_0x1f3815(0x158)]('--json',_0x1f3815(0x15c));return _0x1637bc[_0x1f3815(0x183)]&&_0x549e82[_0x1f3815(0x159)](new _0xe44af1(_0x1f3815(0x1b3),_0x1f3815(0x172))[_0x1f3815(0x176)]('worktree'))[_0x1f3815(0x159)](new _0xe44af1(_0x1f3815(0x19f),_0x1f3815(0x17f))[_0x1f3815(0x176)](_0x1f3815(0x174))),_0x549e82[_0x1f3815(0x1a0)](async(_0x32c32a,_0x5d84da,_0x375d3f)=>{const _0x3ca464=_0x1f3815;let _0x422c03=_0x32c32a===_0x3ca464(0x1b2)?'worksheet-range':_0x32c32a,_0xe2a13a;try{_0xe2a13a=o(_0x422c03,_0x5d84da,_0x375d3f);}catch(_0x1bb3f){throw _0x1bb3f instanceof a&&_0x549e82[_0x3ca464(0x1d1)](_0x1bb3f['message'],{'code':_0x3ca464(0x162),'exitCode':0x1}),_0x1bb3f;}let _0x2919f7,_0x568dce;try{_0x2919f7=await _0x1637bc[_0x3ca464(0x18b)](_0x375d3f['unit'],_0x375d3f),_0x568dce=await _0x2fa521(_0x2919f7,_0xe2a13a);}catch(_0x284be3){throw _0x2919f7!==void 0x0&&await D(_0x2919f7),(_0x284be3 instanceof _0x53d47a||O(_0x284be3))&&_0x549e82[_0x3ca464(0x1d1)](_0x284be3[_0x3ca464(0x1bd)]+':\x20'+_0x284be3[_0x3ca464(0x163)],{'code':_0x3ca464(0x167),'exitCode':0x1}),_0x284be3 instanceof a&&_0x549e82[_0x3ca464(0x1d1)](_0x284be3['message'],{'code':_0x3ca464(0x162),'exitCode':0x1}),_0x284be3;}await _0x2919f7['release'](),_0x549e82[_0x3ca464(0x188)]()[_0x3ca464(0x16f)]?.((_0x375d3f['json']===!0x0?JSON[_0x3ca464(0x166)](_0x568dce,null,0x2):v(_0x568dce))+'\x0a');}),_0x549e82;}function _0x4486(_0x5812e5,_0x16ef11){_0x5812e5=_0x5812e5-0x156;const _0x5ea34d=_0x5ea3();let _0x4486d3=_0x5ea34d[_0x5812e5];return _0x4486d3;}async function D(_0x5532da){await _0x5532da['release']();}function O(_0x3fc0f1){const _0x536954=_0x9b41b1;return _0x3fc0f1 instanceof Error&&typeof _0x3fc0f1['code']==_0x536954(0x1cc);}export{a as InspectionCommandInputError,w as createContentInspectionCommand,T as createWorktreeContentInspectionCommand,o as parseInspectionQuery,v as renderContentInspection};
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@univer-cli/content-inspection-command",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0-beta.2",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"README.zh-CN.md"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@univer-cli/content-inspection": "1.0.0-beta.2"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"commander": "^15.0.0"
|
|
25
|
+
}
|
|
26
|
+
}
|