feat(plugin): support sandbox manifest fields (sandbox / allowed_hosts / permissions)#1447
Open
nameless-mc wants to merge 18 commits into
Open
feat(plugin): support sandbox manifest fields (sandbox / allowed_hosts / permissions)#1447nameless-mc wants to merge 18 commits into
nameless-mc wants to merge 18 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds CLI support for sandbox-aware plugin manifests by surfacing three new optional manifest fields (sandbox, allowed_hosts, permissions) across plugin pack, plugin info, and plugin upload, along with docs and fixtures/tests.
Changes:
- Extend manifest types/interfaces (v1 + interface; v2 conformance) to expose
sandbox,allowedHosts, andpermissions. - Update
plugin infoandplugin uploadto conditionally print a cohesive sandbox-related block (plain) and emit manifest-shaped keys (JSON). - Add validation fixture + E2E asset/scenarios, plus experimental documentation (EN/JA).
Reviewed changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| website/i18n/ja/docusaurus-plugin-content-docs/current/guide/experimental/sandbox.md | Japanese experimental docs for sandbox fields/output |
| website/docs/guide/experimental/sandbox.md | English experimental docs for sandbox fields/output |
| src/plugin/upload/index.ts | Add sandbox summary block to installation summary |
| src/plugin/info/index.ts | Surface sandbox fields in plain + JSON output |
| src/plugin/core/manifest/v2/index.ts | Implement new interface accessors for v2 manifests |
| src/plugin/core/manifest/v1/index.ts | Add v1 accessors + extend v1 JSON type with fields |
| src/plugin/core/manifest/interface.ts | Introduce ManifestPermissions + new accessors |
| src/plugin/core/manifest/tests/validate.test.ts | Add positive validation fixture coverage |
| src/plugin/core/manifest/tests/fixtures/plugin-sandbox-valid/manifest.json | New “valid sandbox manifest” fixture |
| src/plugin/core/manifest/tests/fixtures/plugin-sandbox-valid/image/icon.png | Fixture icon for sandbox-valid manifest |
| features/plugin/pack.feature | E2E scenarios for packing + plugin info output |
| features/assets/plugin_project_sandbox/private.ppk | Test asset private key for sandbox plugin project |
| features/assets/plugin_project_sandbox/manifest.json | Sandbox-aware plugin manifest test asset |
| features/assets/plugin_project_sandbox/js/mobile.js | Sandbox plugin project mobile JS asset |
| features/assets/plugin_project_sandbox/js/desktop.js | Sandbox plugin project desktop JS asset |
| features/assets/plugin_project_sandbox/js/config.js | Sandbox plugin project config JS asset |
| features/assets/plugin_project_sandbox/image/icon.png | Sandbox plugin project icon asset |
| features/assets/plugin_project_sandbox/html/config.html | Sandbox plugin project config HTML asset |
| features/assets/plugin_project_sandbox/css/mobile.css | Sandbox plugin project mobile CSS asset |
| features/assets/plugin_project_sandbox/css/desktop.css | Sandbox plugin project desktop CSS asset |
| features/assets/plugin_project_sandbox/css/config.css | Sandbox plugin project config CSS asset |
| features/assets/plugin_project_sandbox/css/51-modern-default.css | Sandbox plugin project bundled base CSS asset |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
shabaraba
reviewed
Apr 24, 2026
Comment on lines
+44
to
+45
| "js_api": ["app:read", "network:connect"], | ||
| "rest_api": ["app_record:read"] |
Member
There was a problem hiding this comment.
(将来的に: スコープの種類とか決まったら説明どっかに書くかリンク貼っときたい)
shabaraba
reviewed
Apr 24, 2026
Comment on lines
+31
to
+53
| const formatList = (list: string[] | undefined) => { | ||
| if (list === undefined) { | ||
| return "(not set)"; | ||
| } | ||
| if (list.length === 0) { | ||
| return "(none)"; | ||
| } | ||
| return list.join(", "); | ||
| }; | ||
|
|
||
| // `permissions.js_api` and `permissions.rest_api` share one parent, so treat | ||
| // "parent defined but child absent" as "(none)" rather than "(not set)". | ||
| const formatPermissionList = ( | ||
| list: string[] | undefined, | ||
| parentDefined: boolean, | ||
| ) => { | ||
| if (!parentDefined) { | ||
| return "(not set)"; | ||
| } | ||
| if (list === undefined || list.length === 0) { | ||
| return "(none)"; | ||
| } | ||
| return list.join(", "); |
Member
There was a problem hiding this comment.
uploadのsummaryと出力内容同じだしまとめてしまっても良さそう
Contributor
Author
There was a problem hiding this comment.
e5978da で対応
出力のスタイルが結構違うのでそこの整形はそれぞれでやってます
(共通化したい)
8c3522b to
e5978da
Compare
shabaraba
approved these changes
Apr 27, 2026
92115c3 to
f5e5ea1
Compare
`permissions.js_api` / `permissions.rest_api` are optional arrays in the manifest schema (validated by @kintone/plugin-manifest-validator), so the schema distinguishes "child key absent" from "child key declared as empty array". The previous summary collapsed both into `(none)`, hiding that distinction in `plugin info` / `plugin upload` output. Align with the schema: render the absent case as `(not set)` and reserve `(none)` for an explicitly empty array. Also unify `formatHostList` / `formatPermissionList` into a single `formatList`.
The sandbox-related lines were appended via `lines.push(...)` after the array was constructed. Inlining them via a conditional spread keeps the array a single declarative expression.
The "accessors return raw values; normalization belongs to the validator" comment was duplicated on both ManifestV1 and ManifestV2. Hoist it to ManifestInterface so the contract has a single source. The v2 sandbox getter keeps its own note that v2 does not define a sandbox field.
f5e5ea1 to
cb453d6
Compare
fab77ac to
052a1d6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Support three new optional manifest fields (
sandbox,allowed_hosts,permissions) acrossplugin pack/plugin info/plugin upload, so authors can package and inspect sandbox-aware plugins.What
ManifestV1JsonObjectgains three optional fields (sandbox,allowed_hosts,permissions).ManifestInterfacegains three accessors (sandbox,allowedHosts,permissions) plus a sharedManifestPermissionstype.ManifestV1forwards the raw manifest values;ManifestV2returnsundefinedforsandboxby design (v2 does not define it) and forwards its existingallowed_hosts/permissionsfields for interface conformance. v2's inlinepermissionstype is kept to minimize changes to v2.plugin info: when any ofsandbox/allowed_hosts/permissionsis defined in the manifest, print all four sandbox-related lines together. Sandbox-unaware plugins (none of the three fields defined) skip the block entirely. JSON output mirrors manifest naming (sandbox,allowed_hosts,permissions) and omits absent keys.plugin upload: installation summary follows the same "all four lines together" rule asplugin info.(not set)is used when the parent field is absent from the manifest;(none)is used when the parent is declared but has no entries.plugin-sandbox-validmanifest fixture. Negative cases are covered at the validator layer, so only a positive fixture lives here.features/plugin/pack.featuregains a sandbox pack scenario and aplugin infooutput-pattern scenario, backed by a newfeatures/assets/plugin_project_sandbox/asset bundle.unlisted: true) added atwebsite/docs/guide/experimental/sandbox.mdand the Japanese equivalent, describing the fields, required-when-sandbox behavior, and command output.Output examples
plugin info(plain) — sandbox-aware plugin:plugin info(plain) — sandbox-unaware plugin (the block is omitted entirely):plugin info(json) — only keys present in the manifest are emitted:{ "id": "<plugin id>", "name": "hello-kintone-sandbox", "version": 1, "description": "Sandbox-enabled plugin sample.", "homepage": "https://example.com/en/", "sandbox": true, "allowed_hosts": ["https://example.com", "wss://example.com/ws/*"], "permissions": { "js_api": ["app:read", "network:connect"], "rest_api": ["app_record:read"] } }plugin uploadinstallation summary — sandbox-aware plugin:plugin uploadinstallation summary — sandbox-unaware plugin (no extra lines):How to test
pnpm installpnpm typecheckpnpm test(301 passed / 2 skipped)pnpm lint(ESLint + Prettier)plugin pack --input features/assets/plugin_project_sandbox/manifest.json --private-key features/assets/plugin_project_sandbox/private.ppk --output /tmp/plugin.zipplugin info --input /tmp/plugin.zip(plain /--format json) and confirm the output examples above.plugin info.Checklist
pnpm lintandpnpm teston the root directory.