Skip to content

Commit aae95e2

Browse files
author
CodeBuddy Attribution Bot
committed
fix(attribution): HTTP 云函数 Skill 缺少路径映射和网关路径处理的关键说明 (issue_mo1hkx69_frhv2z)
1 parent ff969bd commit aae95e2

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

config/source/guideline/cloudbase/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ If a skill points to its own `references/...` files, keep following those relati
3838
- Always specify `EnvId` explicitly in code, configuration, and command examples when initializing CloudBase clients or manager operations. Do not rely on the current CLI-selected environment, implicit defaults, or copied local state.
3939
- For HTTP Functions, keep the public gateway path and the in-function router path as separate layers. Do not write gateway prefixes such as `/api/httpDemo` into the function router itself.
4040
- Creating an HTTP Function does not guarantee a browser/public URL exists. If the task needs external access, create gateway access only when required and confirm the actual exposed path with `queryGateway(action="getAccess")` instead of assuming it is `/{functionName}`.
41+
- If the task explicitly says no HTTP access service is needed, do not create gateway access just to mirror the function name. Keep direct function invocation and gateway routing as separate delivery choices.
42+
- When a gateway path is created later, keep the path mapping separate: a public prefix such as `/api/httpDemo` should still map to in-function routes like `/`, `/health`, and `/users` instead of rewriting handlers to `/api/httpDemo/...`.
4143
- If an external HTTP invocation may be anonymous, or the caller reports `EXCEED_AUTHORITY`, inspect the function permission rule first and only widen access when the product requirement really needs anonymous callers.
4244
- Keep scenario-specific pitfall lists in the matching child skills instead of expanding this entry file.
4345

scripts/skills-repo-template/cloudbase-guidelines/SKILL.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ If a skill points to its own `references/...` files, keep following those relati
2727
- Use MCP or mcporter first for CloudBase management tasks, and inspect tool schemas before execution.
2828
- If the task includes UI, read `ui-design` first and output the design specification before interface code.
2929
- If the task includes login, registration, or auth configuration, read `auth-tool` first and enable required providers before frontend implementation.
30+
- For HTTP Functions, keep the public gateway path and the in-function router path as separate layers. Do not write gateway prefixes such as `/api/httpDemo` into the function router itself.
31+
- Creating an HTTP Function does not guarantee a browser/public URL exists. If the task needs external access, create gateway access only when required and confirm the actual exposed path with `queryGateway(action="getAccess")` instead of assuming it is `/{functionName}`.
32+
- If the task explicitly says no HTTP access service is needed, do not create gateway access just to mirror the function name. Keep direct function invocation and gateway routing as separate delivery choices.
33+
- When a gateway path is created later, keep the path mapping separate: a public prefix such as `/api/httpDemo` should still map to in-function routes like `/`, `/health`, and `/users` instead of rewriting handlers to `/api/httpDemo/...`.
34+
- If an external HTTP invocation may be anonymous, or the caller reports `EXCEED_AUTHORITY`, inspect the function permission rule first and only widen access when the product requirement really needs anonymous callers.
3035

3136
### High-priority routing
3237

tests/build-allinone-skill.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ test.skipIf(!hasNode24ViaNvm())(
9292
expect(mainSkill).toContain('references/auth-web/SKILL.md');
9393
expect(mainSkill).toContain('## Activation Contract');
9494
expect(mainSkill).toContain('Provider status and publishable key');
95+
expect(mainSkill).toContain('do not create gateway access just to mirror the function name');
96+
expect(mainSkill).toContain('should still map to in-function routes like `/`, `/health`, and `/users`');
9597
},
9698
);
9799

tests/build-skills-repo.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,11 @@ test('build-skills-repo publishes skills and guideline from minimal sources', ()
3131
const readme = fs.readFileSync(path.join(OUTPUT_DIR, 'README.md'), 'utf8');
3232
expect(readme).toContain('cloudbase-guidelines');
3333
expect(readme).toContain('auth-web');
34+
35+
const guideline = fs.readFileSync(
36+
path.join(OUTPUT_DIR, 'skills', 'cloudbase-guidelines', 'SKILL.md'),
37+
'utf8',
38+
);
39+
expect(guideline).toContain('do not create gateway access just to mirror the function name');
40+
expect(guideline).toContain('should still map to in-function routes like `/`, `/health`, and `/users`');
3441
});

0 commit comments

Comments
 (0)