2026-09-28 19:37:41 -07:00
|
|
|
// Plan2Code Web Console - the Help dialog's tab list and rules.
|
|
|
|
|
//
|
|
|
|
|
// The source of truth for which tabs Help has, in what order, and which one
|
|
|
|
|
// opens. The content itself is HTML in <template id="help-content">
|
2026-10-18 15:39:24 -07:00
|
|
|
// in index.html. No DOM access at module scope, and its one import is the
|
|
|
|
|
// data-only skills.js: the page and `node --test` both import this file.
|
|
|
|
|
|
|
|
|
|
import { SKILLS, isBuild } from "./skills.js";
|
2026-09-28 19:37:41 -07:00
|
|
|
|
|
|
|
|
const tab = (id, label, diagram) => Object.freeze({ id, label, diagram });
|
|
|
|
|
|
|
|
|
|
export const HELP_TABS = Object.freeze([
|
|
|
|
|
tab("about", "What this page is", true),
|
2026-10-08 17:21:34 -07:00
|
|
|
tab("stuck", "When something looks stuck", true),
|
2026-09-28 19:37:41 -07:00
|
|
|
tab("around", "Finding your way around", true),
|
|
|
|
|
tab("workspace", "Your workspace", false),
|
|
|
|
|
tab("planny", "Reading Planny", true),
|
|
|
|
|
tab("answering", "Answering questions", false),
|
|
|
|
|
tab("sending", "Sending and what happens next", true),
|
|
|
|
|
tab("notes", "Notes and attachments", false),
|
|
|
|
|
tab("docs", "Documents and printing", false),
|
|
|
|
|
tab("dashboard", "The dashboard", true),
|
|
|
|
|
tab("meter", "Session meter", false),
|
|
|
|
|
tab("build", "Watching a build", false),
|
2026-11-02 12:00:12 -08:00
|
|
|
tab("loop", "Implementation Loop", true),
|
2026-10-11 16:39:25 -07:00
|
|
|
tab("git", "The git board", false),
|
2026-10-06 17:57:22 -07:00
|
|
|
tab("subagents", "Helpers (subagents)", false),
|
2026-09-28 19:37:41 -07:00
|
|
|
tab("ask", "Ask a quick question", false),
|
2026-10-27 18:20:31 -07:00
|
|
|
tab("activities", "Activities", false),
|
2026-09-28 19:37:41 -07:00
|
|
|
tab("finishing", "Stopping and finishing", false),
|
|
|
|
|
tab("prefs", "Keyboard and preferences", false),
|
2026-11-03 04:08:27 -08:00
|
|
|
tab("setup", "Setting up an agent", false),
|
2026-09-28 19:37:41 -07:00
|
|
|
tab("privacy", "Privacy and where things are saved", false),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
// Not labels.js's BUILD_WORKFLOWS: that one leaves out quick-task, which is a
|
2026-10-18 15:39:24 -07:00
|
|
|
// build as far as the person watching it is concerned. Every build in skills.js.
|
|
|
|
|
const HELP_BUILD_WORKFLOWS = new Set(SKILLS.filter((s) => isBuild(s.workflow)).map((s) => s.workflow));
|
2026-09-28 19:37:41 -07:00
|
|
|
|
|
|
|
|
// Which tab Help opens on, from where the person is. First match wins.
|
|
|
|
|
export function helpTabFor({ view, dashboard, gone, adrift, finished, workflow, workspace, meterRed } = {}) {
|
|
|
|
|
const v = view || "";
|
|
|
|
|
// Finished comes first: a finished session's server is stopped on purpose,
|
|
|
|
|
// which also sets `gone`, and that is not something being stuck.
|
|
|
|
|
if (finished || v === "end") return "finishing";
|
|
|
|
|
if (gone || adrift) return "stuck";
|
|
|
|
|
if (workspace) return "workspace";
|
|
|
|
|
if (v === "ask") return "ask";
|
2026-10-06 17:57:22 -07:00
|
|
|
if (v === "subagents") return "subagents";
|
2026-11-03 04:08:27 -08:00
|
|
|
if (workflow === "setup") return "setup";
|
2026-09-28 19:37:41 -07:00
|
|
|
if (dashboard && meterRed) return "meter";
|
|
|
|
|
if (dashboard) return "dashboard";
|
2026-10-26 21:44:38 -07:00
|
|
|
if (v === "overview" || v === "map" || v === "draft" || v.startsWith("doc:")) return "docs";
|
2026-10-11 16:39:25 -07:00
|
|
|
if (workflow === "git") return "git";
|
2026-09-28 19:37:41 -07:00
|
|
|
if (HELP_BUILD_WORKFLOWS.has(workflow)) return "build";
|
|
|
|
|
return "about";
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-02 12:00:12 -08:00
|
|
|
// The tab index a key moves to, or -1 when the key is not a tab key: the
|
|
|
|
|
// shared tab helper's, under the name Help and the git board import.
|
|
|
|
|
export { tabKeyTarget as helpKeyTarget } from "./tabs.js";
|