@volcengine/tls-observer-opencode-install 0.0.3
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/CHANGELOG.md +19 -0
- package/LICENCE +13 -0
- package/README.md +64 -0
- package/bin/tls-observer-opencode-install.mjs +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +744 -0
- package/dist/installer/installer-runner.d.ts +2 -0
- package/package.json +40 -0
- package/scripts/sync-plugin.mjs +30 -0
- package/src/index.ts +1 -0
- package/src/installer/installer-runner.ts +901 -0
package/CHANGELOG.md
ADDED
package/LICENCE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright 2023 Beijing Volcano Engine Technology Ltd.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# TLS Observer OpenCode Installer
|
|
2
|
+
|
|
3
|
+
一键安装 `@volcengine/tls-observer-opencode` 到 OpenCode 全局插件目录。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm exec -y \
|
|
9
|
+
--package=@volcengine/tls-observer-opencode-install -- \
|
|
10
|
+
tls-observer-opencode-install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
安装器默认从 registry 下载插件 `@latest`。使用 beta:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm exec -y \
|
|
17
|
+
--package=@volcengine/tls-observer-opencode-install -- \
|
|
18
|
+
tls-observer-opencode-install --beta
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`--plugin-version <version>` 可以指定精确版本或 dist-tag,并覆盖 `--beta`。
|
|
22
|
+
|
|
23
|
+
## 安装结果
|
|
24
|
+
|
|
25
|
+
- 插件入口:`~/.config/opencode/plugins/tls-observer-opencode.js`
|
|
26
|
+
- 插件运行时:`~/.config/opencode/plugins/tls-observer-opencode`
|
|
27
|
+
- TLS env:`~/.config/opencode/tls-observer-opencode.env`
|
|
28
|
+
- 运行数据:`~/.config/opencode/plugins/data/tls-observer-opencode`
|
|
29
|
+
|
|
30
|
+
OpenCode 会自动加载 `~/.config/opencode/plugins/` 下的本地插件文件。安装器不会修改
|
|
31
|
+
`~/.config/opencode/config.json`,也不会写入 `OPENCODE_TLS_ENV_FILE`;运行时默认读取
|
|
32
|
+
`~/.config/opencode/tls-observer-opencode.env`。
|
|
33
|
+
|
|
34
|
+
如果旧版本安装器曾在 `~/.config/opencode/config.json` 中写入非法的 `plugins` / `env`
|
|
35
|
+
键,新安装器会在安装时移除这两个键,保留其他配置。
|
|
36
|
+
|
|
37
|
+
## 非交互安装
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm exec -y \
|
|
41
|
+
--package=@volcengine/tls-observer-opencode-install -- \
|
|
42
|
+
tls-observer-opencode-install \
|
|
43
|
+
--non-interactive \
|
|
44
|
+
--force \
|
|
45
|
+
--trace-topic-id <trace-topic-id> \
|
|
46
|
+
--api-key <api-key>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
TLS Region 默认是 `cn-beijing`,TLS Producer endpoint 会自动生成为 `tls-cn-beijing.volces.com`。如需切换 Region,使用 `--region <region>`;如需单独覆盖 endpoint,使用 `--tls-endpoint <host>`。旧的 `--otel-endpoint` 仅保留兼容。
|
|
50
|
+
|
|
51
|
+
AK/SK 模式将 `--api-key` 替换为 `--ak`、`--sk`,并可提供 `--project-name`、`--app-name` 自动准备 TLS LogApp。若未传 `--trace-topic-id`,安装器会从 LogApp 关联资源中发现 `trace` topic,并写入 `OPENCODE_TLS_TRACE_TOPIC_ID`。
|
|
52
|
+
|
|
53
|
+
## 本地开发
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
emo run build --filter @volcengine/tls-observer-opencode
|
|
57
|
+
emo run check --filter @volcengine/tls-observer-opencode-install
|
|
58
|
+
emo run build --filter @volcengine/tls-observer-opencode-install
|
|
59
|
+
|
|
60
|
+
OPENCODE_PLUGIN_SOURCE="$PWD/packages/opencode" \
|
|
61
|
+
node packages/opencode-install/bin/tls-observer-opencode-install.mjs --force
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
安装器会读取源码包的 `publishConfig.directory`,因此本地开发与正式发布都会使用构建生成的 `dist-package`。
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from './installer/installer-runner.js';
|