- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::nsmcp::CodeUpstreamTool
::nsmcp::CodeUpstreamToolcreate ... \
[ -adminExample (default "") ] \
[ -adminSummary (default "") ] \
[ -description (default "Compare an installed Tcl/NX/XOTcl procedure or method with literal source declarations in administrator-mapped public GitHub repositories. Returns immutable commit/file links, body and argument comparisons, bounded source excerpts and recent file commits. Optional configured baseline distinguishes differences from a declared installation baseline; differences alone do not prove a bug or an upstream fix. Never evaluates remote code or sends local source to GitHub. Requires enableCodeTools and enableCodeUpstream. Unsupported/dynamic/ambiguous source is unavailable, never equal.") ] \
[ -inputSchema (default "{"type":"object","properties":{"name":{"type":"string"},"ref":{"type":"string","description":"Optional branch, tag or commit within the configured repository; defaults to the mapping ref."}},"required":["name"],"additionalProperties":false}") ] \
[ -name (default "code_upstream_compare") ] \
[ -outputSchema (default "") ] \
[ -permission (default "diagnostics.code.read") ]
Defined in /usr/local/ns/tcl/nsmcp/code-upstream.tcl
Class Relations
::nx::Class create ::nsmcp::CodeUpstreamTool \ -superclass ::nsmcp::ToolMethods (to be applied on instances)
describe (scripted, public)
<instance of nsmcp::CodeUpstreamTool> describe
Describe the upstream comparison tool and its network annotation. Start with the base descriptor and mark the configured GitHub comparison as an open-world operation.
- Returns:
- The rooted JSON tool descriptor.
- Testcases:
- No testcase defined.
set description [next] set fields {} foreach {key type value} [lindex $description 2] { if {$key eq "annotations"} { set value {readOnlyHint boolean true destructiveHint boolean false openWorldHint boolean true} } lappend fields $key $type $value } return [list {} object $fields]execute (scripted, public)
<instance of nsmcp::CodeUpstreamTool> execute context arguments
Compare a loaded definition with its configured GitHub upstream. Use administrator-owned repository mappings and immutable revisions; return explicit unavailable reasons rather than claiming an unperformed comparison.
- Parameters:
- context (required)
- Authenticated request context carrying the principal, grants and selected server.
- arguments (required)
- Rooted ns_json typed triples for the tool's JSON argument object.
- Returns:
- A rooted JSON tool-result object, including availability or job metadata as appropriate.
- Testcases:
- No testcase defined.
set opts [:options $arguments] try { return [:compare $context $opts] } on error {message options} { # Return a bounded diagnostic, not SQL, transport details or remote # response bodies. Unavailable is distinct from an equal comparison. set reason upstream-comparison-unavailable if {[regexp {^(upstream-[a-z-]+|github-(?:http-[0-9]{3}|transport-failed|response-too-large)|invalid-(?:upstream-[a-z-]+|github-[a-z-]+)|local-(?:source-file-metadata-unavailable|definition-not-scripted))$} $message]} { set reason $message } return [list {} object [list available boolean false name string [dict get $opts name] server string [$context server] observedAt number [clock seconds] reason string $reason upstreamFixVerified boolean false comparisonPerformed boolean false]] }validate (scripted, public)
<instance of nsmcp::CodeUpstreamTool> validate arguments
Validate upstream-comparison options. Decode the rooted JSON argument object and enforce this tool's option, range and combination constraints.
- Parameters:
- arguments (required)
- Rooted ns_json typed triples for the tool's JSON argument object.
- Returns:
- An empty result on success; invalid input raises RPC error -32602.
- Testcases:
- No testcase defined.
if {[catch { :options $arguments } message]} { return -code error -errorcode {NSMCP RPC -32602} $message }
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
![[i]](/resources/acs-subsite/ZoomIn16.gif)