feat(metadata): persist npm/mcp fields (node_minimum, npm_package, npm_scope, registry_url, bin, publish_target) [#363]
Universal: Auto Version Bump / Version Bump (push) Successful in 24s
Universal: PR Check / Branch Policy (pull_request) Successful in 3s
Universal: PR Check / Require Docs Update (pull_request) Has been skipped
Universal: PR Check / Wiki Update Reminder (pull_request) Has been skipped
Generic: Project CI / Tests (pull_request) Successful in 35s
Generic: Project CI / Lint & Validate (pull_request) Successful in 39s
Universal: PR Check / Validate PR (pull_request) Successful in 8s
Universal: PR Check / Secret Scan (pull_request) Successful in 37s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Successful in 2s
Universal: Auto Version Bump / Version Bump (push) Successful in 24s
Universal: PR Check / Branch Policy (pull_request) Successful in 3s
Universal: PR Check / Require Docs Update (pull_request) Has been skipped
Universal: PR Check / Wiki Update Reminder (pull_request) Has been skipped
Generic: Project CI / Tests (pull_request) Successful in 35s
Generic: Project CI / Lint & Validate (pull_request) Successful in 39s
Universal: PR Check / Validate PR (pull_request) Successful in 8s
Universal: PR Check / Secret Scan (pull_request) Successful in 37s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Successful in 2s
Add six npm/mcp metadata columns to the repo_manifest table and round-trip them through the /metadata API (GET response, PUT apply, PUT response) so they are no longer silently dropped by the fixed struct property set. Authored-by: Moko Consulting
This commit is contained in:
@@ -449,6 +449,7 @@ func prepareMigrationTasks() []*migration {
|
||||
newMigration(369, "Rename mokogitea-actions system user to mokogit-actions", v1_27.RenameActionsUserToMokoGit),
|
||||
newMigration(370, "Remap saved gitea-* user themes to mokogit-*", v1_27.RemapGiteaThemesToMokogit),
|
||||
newMigration(371, "Widen action_run_job.workflow_payload to MEDIUMBLOB", v1_27.WidenActionRunJobWorkflowPayload),
|
||||
newMigration(372, "Add npm/mcp fields to repo manifest", v1_27.AddNpmFieldsToRepoManifest),
|
||||
}
|
||||
return preparedMigrations
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package v1_27
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// AddNpmFieldsToRepoManifest adds npm/mcp metadata columns to repo_manifest so
|
||||
// the PUT /api/v1/repos/{owner}/{repo}/metadata handler can persist them
|
||||
// instead of silently dropping them. See issue #363.
|
||||
func AddNpmFieldsToRepoManifest(x *xorm.Engine) error {
|
||||
type RepoManifest struct {
|
||||
NodeMinimum string `xorm:"VARCHAR(20) 'node_minimum'"`
|
||||
NpmPackage string `xorm:"TEXT 'npm_package'"`
|
||||
NpmScope string `xorm:"VARCHAR(100) 'npm_scope'"`
|
||||
RegistryURL string `xorm:"TEXT 'registry_url'"`
|
||||
Bin string `xorm:"TEXT 'bin'"`
|
||||
PublishTarget string `xorm:"VARCHAR(50) 'publish_target'"`
|
||||
}
|
||||
return x.Sync(new(RepoManifest))
|
||||
}
|
||||
@@ -52,6 +52,14 @@ type RepoMetadata struct {
|
||||
ExtensionType string `xorm:"VARCHAR(50) 'extension_type'"` // component, module, plugin, package, template, library, file
|
||||
EntryPoint string `xorm:"TEXT 'entry_point'"` // build entry point path
|
||||
|
||||
// npm/mcp section (used by node/npm publish workflows and mokocli)
|
||||
NodeMinimum string `xorm:"VARCHAR(20) 'node_minimum'"` // minimum Node.js version, e.g. "18"
|
||||
NpmPackage string `xorm:"TEXT 'npm_package'"` // published npm package name, e.g. "@moko/foo"
|
||||
NpmScope string `xorm:"VARCHAR(100) 'npm_scope'"` // npm scope, e.g. "@moko"
|
||||
RegistryURL string `xorm:"TEXT 'registry_url'"` // npm registry URL
|
||||
Bin string `xorm:"TEXT 'bin'"` // bin entry (name or JSON map)
|
||||
PublishTarget string `xorm:"VARCHAR(50) 'publish_target'"` // publish target, e.g. "npm", "registry"
|
||||
|
||||
// deploy section
|
||||
DeployHost string `xorm:"VARCHAR(255) 'deploy_host'"` // SSH host for deploy
|
||||
DeployPort string `xorm:"VARCHAR(10) 'deploy_port'"` // SSH port (default 2918)
|
||||
|
||||
@@ -33,6 +33,14 @@ type apiMetadata struct {
|
||||
ExtensionType string `json:"extension_type"`
|
||||
EntryPoint string `json:"entry_point"`
|
||||
|
||||
// npm/mcp
|
||||
NodeMinimum string `json:"node_minimum,omitempty"`
|
||||
NpmPackage string `json:"npm_package,omitempty"`
|
||||
NpmScope string `json:"npm_scope,omitempty"`
|
||||
RegistryURL string `json:"registry_url,omitempty"`
|
||||
Bin string `json:"bin,omitempty"`
|
||||
PublishTarget string `json:"publish_target,omitempty"`
|
||||
|
||||
// deploy
|
||||
DeployHost string `json:"deploy_host,omitempty"`
|
||||
DeployPort string `json:"deploy_port,omitempty"`
|
||||
@@ -109,6 +117,12 @@ func GetRepoMetadata(ctx *context.APIContext) {
|
||||
Language: m.Language,
|
||||
ExtensionType: m.ExtensionType,
|
||||
EntryPoint: m.EntryPoint,
|
||||
NodeMinimum: m.NodeMinimum,
|
||||
NpmPackage: m.NpmPackage,
|
||||
NpmScope: m.NpmScope,
|
||||
RegistryURL: m.RegistryURL,
|
||||
Bin: m.Bin,
|
||||
PublishTarget: m.PublishTarget,
|
||||
DeployHost: m.DeployHost,
|
||||
DeployPort: m.DeployPort,
|
||||
DeployUser: m.DeployUser,
|
||||
@@ -188,6 +202,12 @@ func UpdateRepoMetadata(ctx *context.APIContext) {
|
||||
setStr("language", &m.Language)
|
||||
setStr("extension_type", &m.ExtensionType)
|
||||
setStr("entry_point", &m.EntryPoint)
|
||||
setStr("node_minimum", &m.NodeMinimum)
|
||||
setStr("npm_package", &m.NpmPackage)
|
||||
setStr("npm_scope", &m.NpmScope)
|
||||
setStr("registry_url", &m.RegistryURL)
|
||||
setStr("bin", &m.Bin)
|
||||
setStr("publish_target", &m.PublishTarget)
|
||||
setStr("deploy_host", &m.DeployHost)
|
||||
setStr("deploy_port", &m.DeployPort)
|
||||
setStr("deploy_user", &m.DeployUser)
|
||||
@@ -223,6 +243,12 @@ func UpdateRepoMetadata(ctx *context.APIContext) {
|
||||
Language: m.Language,
|
||||
ExtensionType: m.ExtensionType,
|
||||
EntryPoint: m.EntryPoint,
|
||||
NodeMinimum: m.NodeMinimum,
|
||||
NpmPackage: m.NpmPackage,
|
||||
NpmScope: m.NpmScope,
|
||||
RegistryURL: m.RegistryURL,
|
||||
Bin: m.Bin,
|
||||
PublishTarget: m.PublishTarget,
|
||||
DeployHost: m.DeployHost,
|
||||
DeployPort: m.DeployPort,
|
||||
DeployUser: m.DeployUser,
|
||||
|
||||
Reference in New Issue
Block a user