From 234beb92007ed739b366282c59a1948b2e205065 Mon Sep 17 00:00:00 2001 From: 8ga <8ga@email.com> Date: Sat, 15 Aug 2026 16:21:12 +0800 Subject: [PATCH] add --- mis-agent-spec/SKILL.md | 11 ++++-- mis-agent-spec/references/directory-tree.md | 2 +- mis-agent-spec/references/mvn.md | 7 ++-- mis-agent-spec/references/nacos.md | 43 +++++++++------------ 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/mis-agent-spec/SKILL.md b/mis-agent-spec/SKILL.md index d5faa90..14d7161 100644 --- a/mis-agent-spec/SKILL.md +++ b/mis-agent-spec/SKILL.md @@ -9,11 +9,16 @@ description: 在`mis-agent`模块编写代码必备技能。 - [核心技术栈](./references/arch.md) - [代码书写规范](./references/coding-rules.md) - [HTTP接口文档示例](./examples/api-doc.md) -- [如何从nacos读取配置项](./references/nacos.md) -- [如何打包](./references/mvn.md) ## 约定 - 请结合**目录结构**与**核心技术栈**,并严格遵守**代码书写规范**修改、编写代码,被要求编写HTTP接口文档时,请参考**HTTP接口文档示例**。 - 当前项目具有3个环境(dev/qas/prod)若没有指定**环境**则默认使用**qas**,不可以访问**prod**环境任何数据,包括但不限于数据库、HTTP接口。 -- 从**根目录**下的**pom.xml**文件``标签里可得到不同环境下的`nacos`以及`NewAPI`连接信息。 \ No newline at end of file +- 从**根目录**下的**pom.xml**文件``标签里可得到不同环境下的`nacos`以及`NewAPI`连接信息。 + +## FAQ + +- Q:如何确认profile?A:如果当前分支出于dev则使用dev的profile,否则一律使用qas。 +- Q:如何读取nacos配置项?A:参考[nacos.md](./references/nacos.md)。 +- Q:如何打包?A:参考[mvn.md](./references/mvn.md) + diff --git a/mis-agent-spec/references/directory-tree.md b/mis-agent-spec/references/directory-tree.md index 5d083fa..36f3482 100644 --- a/mis-agent-spec/references/directory-tree.md +++ b/mis-agent-spec/references/directory-tree.md @@ -3,7 +3,7 @@ ## 根目录 ```text -\ +\ ├── mis-api\ ├── mis-auth\ ├── mis-common\ diff --git a/mis-agent-spec/references/mvn.md b/mis-agent-spec/references/mvn.md index 8d0492a..571add8 100644 --- a/mis-agent-spec/references/mvn.md +++ b/mis-agent-spec/references/mvn.md @@ -1,10 +1,11 @@ # Intro -系统已安装`mvnd`用来替换`mvn`命令。`{env}`取决于环境,源自**pom.xml**里面的****。 +系统已安装`mvnd`用来替换`mvn`命令,没有特殊要求使用**全局打包**。 ## 全局打包 + ```bash -mvnd clean package -DskipTests -P{env} +mvnd clean package -DskipTests -P{profile} ``` ## 单个模块打包 @@ -12,5 +13,5 @@ mvnd clean package -DskipTests -P{env} 变量`{module_name}`需要替换成目标模块名称。 ```bash -mvnd clean package -DskipTests -P{env} -pl {module_name} -am +mvnd clean package -DskipTests -P{profile} -pl {module_name} -am ``` \ No newline at end of file diff --git a/mis-agent-spec/references/nacos.md b/mis-agent-spec/references/nacos.md index e92113b..c48c864 100644 --- a/mis-agent-spec/references/nacos.md +++ b/mis-agent-spec/references/nacos.md @@ -1,55 +1,48 @@ # Intro -你可以通过本文档获取访问Nacos配置文件的方法。下文中的`{base_url}`、`{username}`、`password`需要从**pom.xml**的**profiles**标签中获取。根据**配置文件说明**以及上下文决定使用哪个`{dataId}`,没有特殊要求`{groupName}`使用`DEFAULT_GROUP`即可。对于`{namespace}`需要结合上下文确定当前的环境,默认是`qas`。 +你可以通过本文档获取访问Nacos配置。 + +## 变量 + +- base_url、username、password:从pom.xml里的profile获取。 +- dataId、namespace:使用profile的名称,例如:dev/qas。 +- groupName:固定值"DEFAULT_GROUP"。 ## 配置文件说明 -| dataId |分组| namespaceId |描述 | -|---|---|---|---| -|`mis-agent.yml`|DEFAULT_GROUP|dev/qas|当前模块也就是**mis-agent**应用的配置文件| -|`datasource.yml`|DEFAULT_GROUP|dev/qas|`MySQL`数据源配置| +- mis-agent.yml:当前模块也就是**mis-agent**应用的配置文件 +- datasource.yml:MySQL数据源配置。 ## 如何获取accessToken 请求示例: + ```bash curl -X POST 'http://{base_url}/nacos/v1/auth/login' -d 'username={username}&password={password}' ``` 输出示例: + ```json -{"accessToken":"xxx","tokenTtl":18000,"globalAdmin":true} +{"accessToken":"xxx"} ``` ## 如何获取配置项 -1. 参考**如何获取accessToken**获取**accessToken**。 -2. 携带**accessToken**获取配置项。 - 请求示例: + ```bash curl -X GET "http://{base_url}/nacos/v3/console/cs/config?dataId={dataId}&groupName={groupName}&namespaceId={namespace}" -H "Authorization: Bearer xxx" ``` -输出示例如下,`data.content`就是**yml**格式的配置内容。 +输出示例: ```json { "code": 0, "message": "success", - "data": { - "resultCode": 200, - "errorCode": 0, - "message": null, - "requestId": null, - "content": "...", - "encryptedDataKey": "", - "contentType": "yaml", - "md5": "7eccfe8d4aa1df087520d7678419fbbd", - "lastModified": 1786090433000, - "tag": null, - "beta": false, - "success": true - } + "data": {"content": "..."} } -``` \ No newline at end of file +``` + +> `data.content`就是**yml**格式的配置内容。 \ No newline at end of file