Skip to content

Commit eb53c8c

Browse files
Merge branch 'develop' into xuxiaowei/spring-boot-4
# Conflicts: # ai/src/test/java/com/alibaba/nacos/ai/controller/SkillClientControllerTest.java # config/src/test/java/com/alibaba/nacos/config/server/controller/v3/ConfigControllerV3Test.java # plugin-default-impl/nacos-default-auth-plugin/src/test/java/com/alibaba/nacos/plugin/auth/impl/controller/UserControllerTest.java # plugin-default-impl/nacos-default-auth-plugin/src/test/java/com/alibaba/nacos/plugin/auth/impl/controller/v3/UserControllerV3Test.java # pom.xml
2 parents ad5f6ff + 92ab494 commit eb53c8c

680 files changed

Lines changed: 43752 additions & 4836 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ dependency-reduced-pom.xml
2525
.jqwik-database
2626
.qoder/
2727
openspec/
28+
.codegraph

AGENTS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ mvn spotless:apply
7272
mvn -B clean compile apache-rat:check checkstyle:check spotbugs:check spotless:check -DskipTests
7373
```
7474

75+
### Mandatory Formatting Before Commit
76+
77+
Before committing Java code or tests, AI agents MUST run Spotless for the
78+
affected module or nearest aggregator:
79+
80+
1. Run `mvn spotless:apply` first.
81+
2. Run `mvn spotless:check` for the same scope.
82+
3. Then run the relevant compile/check/test command.
83+
4. Commit only after Spotless and the relevant validation pass.
84+
85+
Do not rely on `checkstyle:check`, `spotbugs:check`, or `git diff --check` as a
86+
substitute for Spotless. Spotless uses the project formatter and may accept
87+
formatting that generic whitespace checks report differently.
88+
7589
## Code Style
7690

7791
Follows **Alibaba Java Coding Guidelines**.

address/src/main/java/com/alibaba/nacos/address/controller/AddressServerClusterController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.alibaba.nacos.address.controller;
1818

19+
import com.alibaba.nacos.api.annotation.Since;
1920
import com.alibaba.nacos.address.component.AddressServerGeneratorManager;
2021
import com.alibaba.nacos.address.component.AddressServerManager;
2122
import com.alibaba.nacos.address.constant.AddressServerConstants;
@@ -83,6 +84,7 @@ public AddressServerClusterController(InstanceOperator instanceOperator,
8384
* @param ips will post ip list.
8485
* @return result of create new cluster
8586
*/
87+
@Since("1.1.0")
8688
@RequestMapping(value = "", method = RequestMethod.POST)
8789
public ResponseEntity<String> postCluster(@RequestParam(required = false) String product,
8890
@RequestParam(required = false) String cluster, @RequestParam(name = "ips") String ips) {
@@ -164,6 +166,7 @@ private Result registerCluster(String serviceName, String productName, String cl
164166
* @param ips will delete ips.
165167
* @return delete result (the cluster information is return if success, exception information is return if fail)
166168
*/
169+
@Since("1.1.0")
167170
@RequestMapping(value = "", method = RequestMethod.DELETE)
168171
public ResponseEntity<String> deleteCluster(@RequestParam(required = false) String product,
169172
@RequestParam(required = false) String cluster, @RequestParam String ips) {

address/src/main/java/com/alibaba/nacos/address/controller/ServerListController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.alibaba.nacos.address.controller;
1818

19+
import com.alibaba.nacos.api.annotation.Since;
1920
import com.alibaba.nacos.address.component.AddressServerGeneratorManager;
2021
import com.alibaba.nacos.api.common.Constants;
2122
import com.alibaba.nacos.api.naming.pojo.ServiceInfo;
@@ -65,6 +66,7 @@ public ServerListController(AddressServerGeneratorManager addressServerBuilderMa
6566
* @param cluster will get Ip list of that product cluster to be associated
6667
* @return result of get
6768
*/
69+
@Since("1.1.0")
6870
@RequestMapping(value = "/{product}/{cluster}", method = RequestMethod.GET)
6971
public ResponseEntity<String> getCluster(@PathVariable String product,
7072
@PathVariable String cluster) {

ai-registry-adaptor/src/main/java/com/alibaba/nacos/airegistry/controller/McpRegistryController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.alibaba.nacos.airegistry.controller;
1818

19+
import com.alibaba.nacos.api.annotation.Since;
1920
import com.alibaba.nacos.airegistry.form.GetServerForm;
2021
import com.alibaba.nacos.airegistry.form.ListServerForm;
2122
import com.alibaba.nacos.airegistry.form.ListServersNacosForm;
@@ -68,6 +69,7 @@ public McpRegistryController(NacosMcpRegistryService nacosMcpRegistryService) {
6869
* @return mcp server list {@link McpRegistryServerList}
6970
* @throws NacosApiException if request parameter is invalid or handle error
7071
*/
72+
@Since("3.2.1")
7173
@GetMapping(value = "/v0/servers")
7274
public McpRegistryServerList listMcpServers(ListServersNacosForm form)
7375
throws NacosApiException, NacosException {
@@ -106,6 +108,7 @@ public McpRegistryServerList listMcpServers(ListServersNacosForm form)
106108
* @return mcp server detail or McpErrorResponse when server not found.
107109
* @throws NacosApiException if request parameter is invalid or handle error
108110
*/
111+
@Since("3.2.1")
109112
@GetMapping(value = "/v0/servers/{name}/versions")
110113
public Object getServerVersions(@PathVariable String name, GetServerForm form,
111114
HttpServletResponse response)
@@ -136,6 +139,7 @@ public Object getServerVersions(@PathVariable String name, GetServerForm form,
136139
* found.
137140
* @throws NacosException if handle error
138141
*/
142+
@Since("3.2.1")
139143
@GetMapping(value = "/v0/servers/{serverName}/versions/{version}")
140144
public Object getVersionedServer(@PathVariable String serverName, @PathVariable String version,
141145
GetServerForm form, HttpServletResponse response)

ai-registry-adaptor/src/main/java/com/alibaba/nacos/airegistry/controller/SkillsRegistryController.java

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.alibaba.nacos.airegistry.controller;
1818

19+
import com.alibaba.nacos.api.annotation.Since;
1920
import com.alibaba.nacos.api.annotation.NacosApi;
2021
import com.alibaba.nacos.api.exception.NacosException;
2122
import com.alibaba.nacos.common.utils.StringUtils;
@@ -26,6 +27,7 @@
2627
import com.alibaba.nacos.airegistry.service.NacosSkillsRegistryService;
2728
import jakarta.servlet.http.HttpServletRequest;
2829
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
30+
import org.springframework.http.HttpHeaders;
2931
import org.springframework.http.MediaType;
3032
import org.springframework.http.ResponseEntity;
3133
import org.springframework.util.AntPathMatcher;
@@ -52,6 +54,8 @@ public class SkillsRegistryController {
5254

5355
private static final String WELL_KNOWN_SKILLS = BASE_PATH + "/{namespaceId}/.well-known/skills";
5456

57+
private static final String APPLICATION_ZIP_VALUE = "application/zip";
58+
5559
private static final AntPathMatcher PATH_MATCHER = new AntPathMatcher();
5660

5761
private final NacosSkillsRegistryService nacosSkillsRegistryService;
@@ -67,12 +71,27 @@ public SkillsRegistryController(NacosSkillsRegistryService nacosSkillsRegistrySe
6771
* @return well-known index payload
6872
* @throws NacosException if query fails
6973
*/
70-
@GetMapping(value = {
71-
WELL_KNOWN_AGENT_SKILLS + "/index.json",
72-
WELL_KNOWN_SKILLS + "/index.json"
73-
}, produces = MediaType.APPLICATION_JSON_VALUE)
74-
public WellKnownSkillsIndex getIndex(@PathVariable String namespaceId) throws NacosException {
75-
return nacosSkillsRegistryService.buildIndex(namespaceId);
74+
@Since("3.2.2")
75+
@GetMapping(value = WELL_KNOWN_AGENT_SKILLS + "/index.json",
76+
produces = MediaType.APPLICATION_JSON_VALUE)
77+
public WellKnownSkillsIndex getAgentSkillsIndex(@PathVariable String namespaceId)
78+
throws NacosException {
79+
return nacosSkillsRegistryService.buildAgentSkillsIndex(namespaceId);
80+
}
81+
82+
/**
83+
* Expose legacy well-known index.json for v0.1-compatible clients.
84+
*
85+
* @param namespaceId namespace to query
86+
* @return legacy well-known index payload
87+
* @throws NacosException if query fails
88+
*/
89+
@Since("3.2.2")
90+
@GetMapping(value = WELL_KNOWN_SKILLS + "/index.json",
91+
produces = MediaType.APPLICATION_JSON_VALUE)
92+
public WellKnownSkillsIndex getLegacySkillsIndex(@PathVariable String namespaceId)
93+
throws NacosException {
94+
return nacosSkillsRegistryService.buildLegacySkillsIndex(namespaceId);
7695
}
7796

7897
/**
@@ -84,6 +103,7 @@ public WellKnownSkillsIndex getIndex(@PathVariable String namespaceId) throws Na
84103
* @return search response with CLI-compatible shape
85104
* @throws NacosException if query fails
86105
*/
106+
@Since("3.2.1")
87107
@GetMapping(value = BASE_PATH + "/{namespaceId}/api/search",
88108
produces = MediaType.APPLICATION_JSON_VALUE)
89109
public SkillsSearchResponse search(@PathVariable String namespaceId, SkillsSearchForm form,
@@ -104,6 +124,7 @@ public SkillsSearchResponse search(@PathVariable String namespaceId, SkillsSearc
104124
* @return skill markdown when the skill is exportable, otherwise 404
105125
* @throws NacosException if query fails
106126
*/
127+
@Since("3.2.1")
107128
@GetMapping(value = {
108129
WELL_KNOWN_AGENT_SKILLS + "/{skillName}/SKILL.md",
109130
WELL_KNOWN_SKILLS + "/{skillName}/SKILL.md"
@@ -122,6 +143,32 @@ public ResponseEntity<String> getSkillMarkdown(@PathVariable String namespaceId,
122143
: ResponseEntity.ok().contentType(MediaType.TEXT_PLAIN).body(content);
123144
}
124145

146+
/**
147+
* Return an exported skill archive for v0.2 well-known discovery.
148+
*
149+
* @param namespaceId namespace to query
150+
* @param skillName skill name
151+
* @return skill ZIP archive when exportable, otherwise 404
152+
* @throws NacosException if query fails
153+
*/
154+
@Since("3.2.2")
155+
@GetMapping(value = {
156+
WELL_KNOWN_AGENT_SKILLS + "/{skillName}.zip",
157+
WELL_KNOWN_SKILLS + "/{skillName}.zip"
158+
}, produces = APPLICATION_ZIP_VALUE)
159+
public ResponseEntity<byte[]> getSkillArchive(@PathVariable String namespaceId,
160+
@PathVariable String skillName)
161+
throws NacosException {
162+
byte[] content = nacosSkillsRegistryService.getSkillArchiveContent(namespaceId,
163+
skillName);
164+
return content == null ? ResponseEntity.notFound().build()
165+
: ResponseEntity.ok()
166+
.header(HttpHeaders.CONTENT_DISPOSITION,
167+
"attachment;filename=" + skillName + ".zip")
168+
.contentType(MediaType.parseMediaType(APPLICATION_ZIP_VALUE))
169+
.body(content);
170+
}
171+
125172
/**
126173
* Return an exported text resource for a namespace skill.
127174
*
@@ -131,6 +178,7 @@ public ResponseEntity<String> getSkillMarkdown(@PathVariable String namespaceId,
131178
* @return file content when the skill and file are exportable, otherwise 404
132179
* @throws NacosException if query fails
133180
*/
181+
@Since("3.2.1")
134182
@GetMapping(value = {
135183
WELL_KNOWN_AGENT_SKILLS + "/{skillName}/**",
136184
WELL_KNOWN_SKILLS + "/{skillName}/**"

ai-registry-adaptor/src/main/java/com/alibaba/nacos/airegistry/model/skills/WellKnownSkillEntry.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,30 @@
1616

1717
package com.alibaba.nacos.airegistry.model.skills;
1818

19+
import com.fasterxml.jackson.annotation.JsonInclude;
20+
1921
import java.util.List;
2022

2123
/**
2224
* Well-known skill entry for the skills CLI.
2325
*
2426
* @author nacos
2527
*/
28+
@JsonInclude(JsonInclude.Include.NON_NULL)
2629
public class WellKnownSkillEntry {
2730

2831
private String name;
2932

33+
private String type;
34+
3035
private String description;
3136

37+
private String url;
38+
39+
private String digest;
40+
41+
private String version;
42+
3243
private List<String> files;
3344

3445
public String getName() {
@@ -39,6 +50,14 @@ public void setName(String name) {
3950
this.name = name;
4051
}
4152

53+
public String getType() {
54+
return type;
55+
}
56+
57+
public void setType(String type) {
58+
this.type = type;
59+
}
60+
4261
public String getDescription() {
4362
return description;
4463
}
@@ -47,6 +66,30 @@ public void setDescription(String description) {
4766
this.description = description;
4867
}
4968

69+
public String getUrl() {
70+
return url;
71+
}
72+
73+
public void setUrl(String url) {
74+
this.url = url;
75+
}
76+
77+
public String getDigest() {
78+
return digest;
79+
}
80+
81+
public void setDigest(String digest) {
82+
this.digest = digest;
83+
}
84+
85+
public String getVersion() {
86+
return version;
87+
}
88+
89+
public void setVersion(String version) {
90+
this.version = version;
91+
}
92+
5093
public List<String> getFiles() {
5194
return files;
5295
}

ai-registry-adaptor/src/main/java/com/alibaba/nacos/airegistry/model/skills/WellKnownSkillsIndex.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,32 @@
1616

1717
package com.alibaba.nacos.airegistry.model.skills;
1818

19+
import com.fasterxml.jackson.annotation.JsonInclude;
20+
import com.fasterxml.jackson.annotation.JsonProperty;
21+
1922
import java.util.List;
2023

2124
/**
2225
* Well-known skills index response for the skills CLI.
2326
*
2427
* @author nacos
2528
*/
29+
@JsonInclude(JsonInclude.Include.NON_NULL)
2630
public class WellKnownSkillsIndex {
2731

32+
@JsonProperty("$schema")
33+
private String schema;
34+
2835
private List<WellKnownSkillEntry> skills;
2936

37+
public String getSchema() {
38+
return schema;
39+
}
40+
41+
public void setSchema(String schema) {
42+
this.schema = schema;
43+
}
44+
3045
public List<WellKnownSkillEntry> getSkills() {
3146
return skills;
3247
}

0 commit comments

Comments
 (0)