Documentation
¶
Overview ¶
Package projects owns the M4 "projects" plugin. The plugin is gated by the `read:project` OAuth scope; when the active token does not advertise the scope, Run returns Skipped=true. In M4 the actual GraphQL fetch is deferred — the scope-gate path is wired and tests exercise it, but a real `user.projects` GraphQL query lands as a follow-up.
Index ¶
Constants ¶
const Name = "projects"
Name is the canonical plugin slug.
Variables ¶
var Plugin plugins.Plugin = &projectsPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
func Partial ¶
Partial renders the classic SVG fragment for the projects plugin. Mirrors upstream org_repo/source/templates/classic/partials/projects.ejs for the fields the M4 data model exposes (name, description, updatedAt, url). Progress bars + items rows are upstream-only until the GraphQL fetch lands (see projects.go Run TODO).
Empty state: upstream gates only on `<% if (plugins.projects) { %>` (object presence) and unconditionally prints `<%= plugins.projects.totalCount %> Project<s>` in the header, so a `0 Projects` header is emitted whenever the plugin is enabled — even with an empty project list. The dispatcher (classic.go) already gates on `plugin_projects` truthy + non-Skipped, so the only guard here is `r.Skipped`; an empty List still renders the header + empty `<section class="project">`, matching sponsors (#451) / starlists.
Output structure:
<section data-section="projects">
<h2 class="field"><svg project/>N Project(s)</h2>
<div class="row"><section class="project">
[for each project]:
<div class="row fill-width"><section>
<div class="field"><svg roadmap/>${name}</div>
</section></div>
[if description]:
<div class="row fill-width"><section>
<div class="field description">${description}</div>
</section></div>
<div class="row"><section>
<div class="field"><svg clock/>Updated ${date}</div>
</section></div>
</section></div>
</section>
Types ¶
type Project ¶
type Project struct {
Name string `json:"name"`
Description string `json:"description"`
URL string `json:"url"`
UpdatedAt time.Time `json:"updatedAt"`
Closed bool `json:"closed,omitempty"`
}
Project mirrors one upstream project entry.