@unbrained/pm-cli 2026.5.11 → 2026.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +3 -116
- package/CHANGELOG.md +18 -0
- package/PRD.md +18 -39
- package/README.md +8 -5
- package/dist/cli/commander-usage.js +27 -0
- package/dist/cli/commander-usage.js.map +1 -1
- package/dist/cli/commands/activity.js +19 -4
- package/dist/cli/commands/activity.js.map +1 -1
- package/dist/cli/commands/calendar.js +5 -2
- package/dist/cli/commands/calendar.js.map +1 -1
- package/dist/cli/commands/contracts.js +63 -19
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/create.js +58 -3
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/extension.d.ts +14 -3
- package/dist/cli/commands/extension.js +481 -95
- package/dist/cli/commands/extension.js.map +1 -1
- package/dist/cli/commands/index.d.ts +1 -8
- package/dist/cli/commands/index.js +1 -8
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/reindex.d.ts +8 -0
- package/dist/cli/commands/reindex.js +96 -23
- package/dist/cli/commands/reindex.js.map +1 -1
- package/dist/cli/commands/search.js +51 -25
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/test.js +14 -6
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/commands/upgrade.d.ts +63 -0
- package/dist/cli/commands/upgrade.js +260 -0
- package/dist/cli/commands/upgrade.js.map +1 -0
- package/dist/cli/guide-topics.js +18 -16
- package/dist/cli/guide-topics.js.map +1 -1
- package/dist/cli/help-content.js +57 -18
- package/dist/cli/help-content.js.map +1 -1
- package/dist/cli/main.js +73 -7
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.js +24 -142
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +49 -257
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.js +29 -198
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/register-setup.js +181 -204
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.d.ts +2 -2
- package/dist/cli/registration-helpers.js +1 -19
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/core/extensions/loader.js +7 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/packages/manifest.d.ts +38 -0
- package/dist/core/packages/manifest.js +221 -0
- package/dist/core/packages/manifest.js.map +1 -0
- package/dist/core/search/embedding-batches.d.ts +13 -1
- package/dist/core/search/embedding-batches.js +19 -1
- package/dist/core/search/embedding-batches.js.map +1 -1
- package/dist/core/store/front-matter-cache.d.ts +8 -1
- package/dist/core/store/front-matter-cache.js +20 -11
- package/dist/core/store/front-matter-cache.js.map +1 -1
- package/dist/mcp/server.d.ts +8 -0
- package/dist/mcp/server.js +100 -43
- package/dist/mcp/server.js.map +1 -1
- package/dist/sdk/cli-contracts/commander-mutation-options.d.ts +7 -0
- package/dist/sdk/cli-contracts/commander-mutation-options.js +477 -0
- package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -0
- package/dist/sdk/cli-contracts/commander-types.d.ts +21 -0
- package/dist/sdk/cli-contracts/commander-types.js +92 -0
- package/dist/sdk/cli-contracts/commander-types.js.map +1 -0
- package/dist/sdk/cli-contracts.d.ts +22 -32
- package/dist/sdk/cli-contracts.js +155 -296
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +2 -0
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/runtime.d.ts +29 -0
- package/dist/sdk/runtime.js +28 -0
- package/dist/sdk/runtime.js.map +1 -0
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/COMMANDS.md +17 -1
- package/docs/EXTENSIONS.md +169 -61
- package/docs/QUICKSTART.md +11 -2
- package/docs/README.md +4 -6
- package/docs/RELEASING.md +4 -2
- package/docs/SDK.md +79 -438
- package/package.json +6 -23
- package/packages/pm-beads/README.md +10 -0
- package/packages/pm-beads/extensions/beads/index.js +113 -0
- package/{.agents/pm/extensions/beads/index.js → packages/pm-beads/extensions/beads/index.ts} +42 -20
- package/{.agents/pm → packages/pm-beads}/extensions/beads/runtime.js +2 -17
- package/{.agents/pm → packages/pm-beads}/extensions/beads/runtime.ts +41 -18
- package/packages/pm-beads/package.json +50 -0
- package/packages/pm-calendar/README.md +13 -0
- package/packages/pm-calendar/extensions/calendar/index.js +56 -0
- package/packages/pm-calendar/extensions/calendar/index.ts +62 -0
- package/packages/pm-calendar/extensions/calendar/manifest.json +7 -0
- package/packages/pm-calendar/extensions/calendar/runtime.js +95 -0
- package/packages/pm-calendar/extensions/calendar/runtime.ts +104 -0
- package/packages/pm-calendar/package.json +51 -0
- package/packages/pm-governance-audit/README.md +23 -0
- package/packages/pm-governance-audit/extensions/governance-audit/index.js +117 -0
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +118 -0
- package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +7 -0
- package/packages/pm-governance-audit/extensions/governance-audit/runtime.js +159 -0
- package/packages/pm-governance-audit/extensions/governance-audit/runtime.ts +176 -0
- package/packages/pm-governance-audit/package.json +52 -0
- package/packages/pm-guide-shell/README.md +23 -0
- package/packages/pm-guide-shell/extensions/guide-shell/index.js +76 -0
- package/packages/pm-guide-shell/extensions/guide-shell/index.ts +81 -0
- package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +7 -0
- package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +263 -0
- package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +327 -0
- package/packages/pm-guide-shell/package.json +52 -0
- package/packages/pm-linked-test-adapters/README.md +24 -0
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.js +101 -0
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.ts +102 -0
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +7 -0
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.js +142 -0
- package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.ts +173 -0
- package/packages/pm-linked-test-adapters/package.json +53 -0
- package/packages/pm-search-advanced/README.md +27 -0
- package/packages/pm-search-advanced/extensions/search-advanced/index.js +93 -0
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +94 -0
- package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +7 -0
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +120 -0
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +144 -0
- package/packages/pm-search-advanced/package.json +54 -0
- package/packages/pm-templates/README.md +20 -0
- package/packages/pm-templates/extensions/templates/index.js +101 -0
- package/packages/pm-templates/extensions/templates/index.ts +109 -0
- package/packages/pm-templates/extensions/templates/manifest.json +7 -0
- package/packages/pm-templates/extensions/templates/runtime.js +226 -0
- package/packages/pm-templates/extensions/templates/runtime.ts +283 -0
- package/packages/pm-templates/package.json +50 -0
- package/packages/pm-todos/README.md +11 -0
- package/packages/pm-todos/extensions/todos/index.js +130 -0
- package/{.agents/pm/extensions/todos/index.js → packages/pm-todos/extensions/todos/index.ts} +47 -23
- package/{.agents/pm → packages/pm-todos}/extensions/todos/runtime.js +3 -18
- package/{.agents/pm → packages/pm-todos}/extensions/todos/runtime.ts +42 -20
- package/packages/pm-todos/package.json +51 -0
- package/plugins/pm-cli-claude/README.md +1 -2
- package/plugins/pm-cli-claude/hooks/session-start.mjs +4 -55
- package/plugins/pm-cli-claude/scripts/pm-mcp-server.mjs +4 -2
- package/plugins/pm-cli-codex/scripts/pm-mcp-server.mjs +4 -2
- package/.agents/pm/extensions/.managed-extensions.json +0 -42
- package/.agents/skills/HARNESS_COMPATIBILITY.md +0 -45
- package/.agents/skills/README.md +0 -21
- package/.agents/skills/pm-developer/SKILL.md +0 -73
- package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +0 -48
- package/.agents/skills/pm-developer/references/PROMPTS.md +0 -17
- package/.agents/skills/pm-extensions/SKILL.md +0 -57
- package/.agents/skills/pm-extensions/references/LIFECYCLE.md +0 -40
- package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +0 -25
- package/.agents/skills/pm-sdk/SKILL.md +0 -50
- package/.agents/skills/pm-sdk/references/INTEGRATION_CHECKLIST.md +0 -31
- package/.agents/skills/pm-sdk/references/PROMPTS.md +0 -13
- package/.agents/skills/pm-user/SKILL.md +0 -59
- package/.agents/skills/pm-user/references/PROMPTS.md +0 -17
- package/.agents/skills/pm-user/references/WORKFLOWS.md +0 -35
- package/.pi/README.md +0 -35
- package/.pi/agents/pm-triage-agent.md +0 -19
- package/.pi/agents/pm-verification-agent.md +0 -21
- package/.pi/chains/pm-native-delivery.chain.md +0 -11
- package/.pi/extensions/pm-cli/index.js +0 -387
- package/.pi/prompts/pm-workflow.md +0 -5
- package/.pi/skills/pm-native/SKILL.md +0 -44
- package/.pi/skills/pm-release/SKILL.md +0 -35
- package/dist/pi/native.d.ts +0 -5
- package/dist/pi/native.js +0 -236
- package/dist/pi/native.js.map +0 -1
- package/docs/PI_PACKAGE.md +0 -141
- /package/{.agents/pm → packages/pm-beads}/extensions/beads/manifest.json +0 -0
- /package/{.agents/pm → packages/pm-todos}/extensions/todos/manifest.json +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type ExtensionScope, type ManagedExtensionSource } from "./extension.js";
|
|
2
|
+
import type { GlobalOptions } from "../../core/shared/command-types.js";
|
|
3
|
+
export interface UpgradeCommandOptions {
|
|
4
|
+
dryRun?: boolean;
|
|
5
|
+
cliOnly?: boolean;
|
|
6
|
+
packagesOnly?: boolean;
|
|
7
|
+
project?: boolean;
|
|
8
|
+
local?: boolean;
|
|
9
|
+
global?: boolean;
|
|
10
|
+
repair?: boolean;
|
|
11
|
+
tag?: string;
|
|
12
|
+
packageName?: string;
|
|
13
|
+
commandRunner?: UpgradeCommandRunner;
|
|
14
|
+
}
|
|
15
|
+
export interface UpgradeCommandRunnerResult {
|
|
16
|
+
stdout: string;
|
|
17
|
+
stderr: string;
|
|
18
|
+
}
|
|
19
|
+
export type UpgradeCommandRunner = (command: string, args: string[], options?: {
|
|
20
|
+
cwd?: string;
|
|
21
|
+
}) => Promise<UpgradeCommandRunnerResult>;
|
|
22
|
+
export interface UpgradeCliResult {
|
|
23
|
+
requested: boolean;
|
|
24
|
+
status: "planned" | "updated" | "failed" | "skipped";
|
|
25
|
+
package: string;
|
|
26
|
+
target: string;
|
|
27
|
+
command: string[];
|
|
28
|
+
before_version?: string;
|
|
29
|
+
after_version?: string;
|
|
30
|
+
repair: boolean;
|
|
31
|
+
reason?: string;
|
|
32
|
+
error?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface UpgradePackageResult {
|
|
35
|
+
name: string;
|
|
36
|
+
directory: string;
|
|
37
|
+
scope: ExtensionScope;
|
|
38
|
+
source: ManagedExtensionSource;
|
|
39
|
+
status: "planned" | "updated" | "failed" | "skipped";
|
|
40
|
+
command: string[];
|
|
41
|
+
previous_version: string;
|
|
42
|
+
installed_version?: string;
|
|
43
|
+
reason?: string;
|
|
44
|
+
error?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface UpgradeResult {
|
|
47
|
+
ok: boolean;
|
|
48
|
+
action: "upgrade";
|
|
49
|
+
dry_run: boolean;
|
|
50
|
+
scope: ExtensionScope;
|
|
51
|
+
target?: string;
|
|
52
|
+
cli: UpgradeCliResult;
|
|
53
|
+
packages: UpgradePackageResult[];
|
|
54
|
+
summary: {
|
|
55
|
+
requested_cli: boolean;
|
|
56
|
+
requested_packages: boolean;
|
|
57
|
+
planned: number;
|
|
58
|
+
updated: number;
|
|
59
|
+
skipped: number;
|
|
60
|
+
failed: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export declare function runUpgrade(target: string | undefined, options: UpgradeCommandOptions, global: GlobalOptions): Promise<UpgradeResult>;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { readManagedExtensionState, runExtension, } from "./extension.js";
|
|
7
|
+
import { resolveExtensionRoots } from "../../core/extensions/loader.js";
|
|
8
|
+
import { pathExists } from "../../core/fs/fs-utils.js";
|
|
9
|
+
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
10
|
+
import { PmCliError } from "../../core/shared/errors.js";
|
|
11
|
+
import { resolvePmRoot } from "../../core/store/paths.js";
|
|
12
|
+
const execFileAsync = promisify(execFile);
|
|
13
|
+
const DEFAULT_CLI_PACKAGE = "@unbrained/pm-cli";
|
|
14
|
+
const DEFAULT_TAG = "latest";
|
|
15
|
+
function resolveScope(options) {
|
|
16
|
+
const projectLike = options.project === true || options.local === true;
|
|
17
|
+
const global = options.global === true;
|
|
18
|
+
if (projectLike && global) {
|
|
19
|
+
throw new PmCliError('Options "--project/--local" and "--global" are mutually exclusive.', EXIT_CODE.USAGE);
|
|
20
|
+
}
|
|
21
|
+
return global ? "global" : "project";
|
|
22
|
+
}
|
|
23
|
+
function normalizeTarget(value) {
|
|
24
|
+
return value.trim().toLowerCase();
|
|
25
|
+
}
|
|
26
|
+
function packageRecordMatchesTarget(record, target) {
|
|
27
|
+
const normalizedTarget = normalizeTarget(target);
|
|
28
|
+
const values = [
|
|
29
|
+
record.name,
|
|
30
|
+
record.directory,
|
|
31
|
+
record.source.input,
|
|
32
|
+
record.source.location,
|
|
33
|
+
record.source.package,
|
|
34
|
+
record.source.repository,
|
|
35
|
+
record.source.owner && record.source.repo ? `${record.source.owner}/${record.source.repo}` : undefined,
|
|
36
|
+
];
|
|
37
|
+
return values.some((value) => typeof value === "string" && normalizeTarget(value) === normalizedTarget);
|
|
38
|
+
}
|
|
39
|
+
function resolveRoots(scope, global) {
|
|
40
|
+
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
41
|
+
const roots = resolveExtensionRoots(pmRoot, process.cwd());
|
|
42
|
+
return {
|
|
43
|
+
selected_root: scope === "global" ? roots.global : roots.project,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
async function defaultCommandRunner(command, args, options) {
|
|
47
|
+
try {
|
|
48
|
+
const result = await execFileAsync(command, args, {
|
|
49
|
+
cwd: options?.cwd,
|
|
50
|
+
encoding: "utf8",
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
stdout: result.stdout ?? "",
|
|
54
|
+
stderr: result.stderr ?? "",
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
const stderr = typeof error === "object" && error !== null && "stderr" in error
|
|
59
|
+
? String(error.stderr ?? "")
|
|
60
|
+
: "";
|
|
61
|
+
const message = stderr.trim().length > 0 ? stderr.trim() : error instanceof Error ? error.message : String(error);
|
|
62
|
+
throw new PmCliError(`Command failed: ${command} ${args.join(" ")}\n${message}`, EXIT_CODE.GENERIC_FAILURE);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function readCurrentVersion() {
|
|
66
|
+
const packageJsonPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..", "package.json");
|
|
67
|
+
try {
|
|
68
|
+
const parsed = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
|
|
69
|
+
return typeof parsed.version === "string" ? parsed.version : undefined;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function resolveTag(options) {
|
|
76
|
+
return typeof options.tag === "string" && options.tag.trim().length > 0 ? options.tag.trim() : DEFAULT_TAG;
|
|
77
|
+
}
|
|
78
|
+
function resolveCliPackage(options) {
|
|
79
|
+
return typeof options.packageName === "string" && options.packageName.trim().length > 0
|
|
80
|
+
? options.packageName.trim()
|
|
81
|
+
: DEFAULT_CLI_PACKAGE;
|
|
82
|
+
}
|
|
83
|
+
async function upgradeCli(options, dryRun) {
|
|
84
|
+
const runner = options.commandRunner ?? defaultCommandRunner;
|
|
85
|
+
const packageName = resolveCliPackage(options);
|
|
86
|
+
const tag = resolveTag(options);
|
|
87
|
+
const target = `${packageName}@${tag}`;
|
|
88
|
+
const command = ["npm", "install", "-g", target];
|
|
89
|
+
if (options.repair === true) {
|
|
90
|
+
command.push("--force");
|
|
91
|
+
}
|
|
92
|
+
const beforeVersion = await readCurrentVersion();
|
|
93
|
+
const planned = {
|
|
94
|
+
requested: true,
|
|
95
|
+
status: "planned",
|
|
96
|
+
package: packageName,
|
|
97
|
+
target,
|
|
98
|
+
command,
|
|
99
|
+
before_version: beforeVersion,
|
|
100
|
+
repair: options.repair === true,
|
|
101
|
+
};
|
|
102
|
+
if (dryRun) {
|
|
103
|
+
return planned;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
await runner(command[0], command.slice(1));
|
|
107
|
+
const verified = await runner("pm", ["--version"]);
|
|
108
|
+
return {
|
|
109
|
+
...planned,
|
|
110
|
+
status: "updated",
|
|
111
|
+
after_version: verified.stdout.trim() || undefined,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
return {
|
|
116
|
+
...planned,
|
|
117
|
+
status: "failed",
|
|
118
|
+
error: error instanceof Error ? error.message : String(error),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function isLocalNpmSpec(spec) {
|
|
123
|
+
return path.isAbsolute(spec) || spec.startsWith(".") || spec.startsWith("..") || spec.startsWith("file:");
|
|
124
|
+
}
|
|
125
|
+
function resolvePackageInstallSource(source, tag) {
|
|
126
|
+
if (source.kind === "npm") {
|
|
127
|
+
const rawSpec = source.input.startsWith("npm:") ? source.input.slice("npm:".length).trim() : source.input.trim();
|
|
128
|
+
if (!isLocalNpmSpec(rawSpec) && source.package && source.package.trim().length > 0) {
|
|
129
|
+
return `npm:${source.package.trim()}@${tag}`;
|
|
130
|
+
}
|
|
131
|
+
return source.input.startsWith("npm:") ? source.input : `npm:${source.input}`;
|
|
132
|
+
}
|
|
133
|
+
return source.input;
|
|
134
|
+
}
|
|
135
|
+
async function resolveRunnablePackageSource(source, tag) {
|
|
136
|
+
const installSource = resolvePackageInstallSource(source, tag);
|
|
137
|
+
if (source.kind !== "local") {
|
|
138
|
+
return installSource;
|
|
139
|
+
}
|
|
140
|
+
if (await pathExists(installSource)) {
|
|
141
|
+
return installSource;
|
|
142
|
+
}
|
|
143
|
+
if (await pathExists(source.location)) {
|
|
144
|
+
return source.location;
|
|
145
|
+
}
|
|
146
|
+
return installSource;
|
|
147
|
+
}
|
|
148
|
+
function packageCommandFor(source, installSource, scope, ref) {
|
|
149
|
+
const command = ["pm", "install", installSource, scope === "global" ? "--global" : "--project"];
|
|
150
|
+
if (source.kind === "github" && ref && ref.trim().length > 0) {
|
|
151
|
+
command.push("--ref", ref.trim());
|
|
152
|
+
}
|
|
153
|
+
return command;
|
|
154
|
+
}
|
|
155
|
+
async function readManagedRecords(scope, global) {
|
|
156
|
+
const roots = resolveRoots(scope, global);
|
|
157
|
+
const managedState = await readManagedExtensionState(roots.selected_root);
|
|
158
|
+
return managedState.state.entries.filter((entry) => entry.scope === scope);
|
|
159
|
+
}
|
|
160
|
+
async function refreshManagedRecord(scope, global, record) {
|
|
161
|
+
const records = await readManagedRecords(scope, global);
|
|
162
|
+
return records.find((candidate) => packageRecordMatchesTarget(candidate, record.name)) ??
|
|
163
|
+
records.find((candidate) => normalizeTarget(candidate.directory) === normalizeTarget(record.directory));
|
|
164
|
+
}
|
|
165
|
+
async function upgradePackageRecord(record, options, global, scope, dryRun) {
|
|
166
|
+
const tag = resolveTag(options);
|
|
167
|
+
const installSource = await resolveRunnablePackageSource(record.source, tag);
|
|
168
|
+
const command = packageCommandFor(record.source, installSource, scope, record.source.ref);
|
|
169
|
+
const planned = {
|
|
170
|
+
name: record.name,
|
|
171
|
+
directory: record.directory,
|
|
172
|
+
scope,
|
|
173
|
+
source: record.source,
|
|
174
|
+
status: "planned",
|
|
175
|
+
command,
|
|
176
|
+
previous_version: record.manifest_version,
|
|
177
|
+
};
|
|
178
|
+
if (dryRun) {
|
|
179
|
+
return planned;
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
await runExtension(installSource, {
|
|
183
|
+
install: true,
|
|
184
|
+
project: scope === "project",
|
|
185
|
+
global: scope === "global",
|
|
186
|
+
ref: record.source.kind === "github" ? record.source.ref : undefined,
|
|
187
|
+
}, global);
|
|
188
|
+
const refreshed = await refreshManagedRecord(scope, global, record);
|
|
189
|
+
return {
|
|
190
|
+
...planned,
|
|
191
|
+
status: "updated",
|
|
192
|
+
installed_version: refreshed?.manifest_version,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
return {
|
|
197
|
+
...planned,
|
|
198
|
+
status: "failed",
|
|
199
|
+
error: error instanceof Error ? error.message : String(error),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function summarize(cli, packages, includeCli, includePackages) {
|
|
204
|
+
const statuses = [includeCli ? cli.status : undefined, ...packages.map((entry) => entry.status)].filter((value) => typeof value === "string");
|
|
205
|
+
return {
|
|
206
|
+
requested_cli: includeCli,
|
|
207
|
+
requested_packages: includePackages,
|
|
208
|
+
planned: statuses.filter((status) => status === "planned").length,
|
|
209
|
+
updated: statuses.filter((status) => status === "updated").length,
|
|
210
|
+
skipped: statuses.filter((status) => status === "skipped").length,
|
|
211
|
+
failed: statuses.filter((status) => status === "failed").length,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
export async function runUpgrade(target, options, global) {
|
|
215
|
+
if (options.cliOnly === true && options.packagesOnly === true) {
|
|
216
|
+
throw new PmCliError('Options "--cli-only" and "--packages-only" are mutually exclusive.', EXIT_CODE.USAGE);
|
|
217
|
+
}
|
|
218
|
+
const scope = resolveScope(options);
|
|
219
|
+
const dryRun = options.dryRun === true;
|
|
220
|
+
const normalizedTarget = typeof target === "string" && target.trim().length > 0 ? target.trim() : undefined;
|
|
221
|
+
if (options.cliOnly === true && normalizedTarget) {
|
|
222
|
+
throw new PmCliError('A package target cannot be used with "--cli-only".', EXIT_CODE.USAGE);
|
|
223
|
+
}
|
|
224
|
+
const includeCli = options.packagesOnly === true || normalizedTarget ? false : true;
|
|
225
|
+
const includePackages = options.cliOnly === true ? false : true;
|
|
226
|
+
const cli = includeCli
|
|
227
|
+
? await upgradeCli(options, dryRun)
|
|
228
|
+
: {
|
|
229
|
+
requested: false,
|
|
230
|
+
status: "skipped",
|
|
231
|
+
package: resolveCliPackage(options),
|
|
232
|
+
target: `${resolveCliPackage(options)}@${resolveTag(options)}`,
|
|
233
|
+
command: ["npm", "install", "-g", `${resolveCliPackage(options)}@${resolveTag(options)}`],
|
|
234
|
+
repair: options.repair === true,
|
|
235
|
+
reason: "not_requested",
|
|
236
|
+
};
|
|
237
|
+
let packageRecords = includePackages ? await readManagedRecords(scope, global) : [];
|
|
238
|
+
if (normalizedTarget) {
|
|
239
|
+
packageRecords = packageRecords.filter((entry) => packageRecordMatchesTarget(entry, normalizedTarget));
|
|
240
|
+
if (packageRecords.length === 0) {
|
|
241
|
+
throw new PmCliError(`Managed package "${normalizedTarget}" was not found in ${scope} scope.`, EXIT_CODE.NOT_FOUND);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const packages = [];
|
|
245
|
+
for (const record of packageRecords) {
|
|
246
|
+
packages.push(await upgradePackageRecord(record, options, global, scope, dryRun));
|
|
247
|
+
}
|
|
248
|
+
const summary = summarize(cli, packages, includeCli, includePackages);
|
|
249
|
+
return {
|
|
250
|
+
ok: summary.failed === 0,
|
|
251
|
+
action: "upgrade",
|
|
252
|
+
dry_run: dryRun,
|
|
253
|
+
scope,
|
|
254
|
+
target: normalizedTarget,
|
|
255
|
+
cli,
|
|
256
|
+
packages,
|
|
257
|
+
summary,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=upgrade.js.map
|
|
@@ -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AC,KAAK,EAAE,EAAE,CAAC,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACvG,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,UAAU,CAAC,oBAAoB,gBAAgB,sBAAsB,KAAK,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACtH,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;QACpC,QAAQ,CAAC,IAAI,CAAC,MAAM,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IACpF,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IACtE,OAAO;QACL,EAAE,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC;QACxB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,MAAM;QACf,KAAK;QACL,MAAM,EAAE,gBAAgB;QACxB,GAAG;QACH,QAAQ;QACR,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["import { execFile } from \"node:child_process\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { promisify } from \"node:util\";\nimport {\n readManagedExtensionState,\n runExtension,\n type ExtensionScope,\n type ManagedExtensionRecord,\n type ManagedExtensionSource,\n} from \"./extension.js\";\nimport { resolveExtensionRoots } from \"../../core/extensions/loader.js\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { resolvePmRoot } from \"../../core/store/paths.js\";\n\nconst execFileAsync = promisify(execFile);\nconst DEFAULT_CLI_PACKAGE = \"@unbrained/pm-cli\";\nconst DEFAULT_TAG = \"latest\";\n\nexport interface UpgradeCommandOptions {\n dryRun?: boolean;\n cliOnly?: boolean;\n packagesOnly?: boolean;\n project?: boolean;\n local?: boolean;\n global?: boolean;\n repair?: boolean;\n tag?: string;\n packageName?: string;\n commandRunner?: UpgradeCommandRunner;\n}\n\nexport interface UpgradeCommandRunnerResult {\n stdout: string;\n stderr: string;\n}\n\nexport type UpgradeCommandRunner = (\n command: string,\n args: string[],\n options?: { cwd?: string },\n) => Promise<UpgradeCommandRunnerResult>;\n\nexport interface UpgradeCliResult {\n requested: boolean;\n status: \"planned\" | \"updated\" | \"failed\" | \"skipped\";\n package: string;\n target: string;\n command: string[];\n before_version?: string;\n after_version?: string;\n repair: boolean;\n reason?: string;\n error?: string;\n}\n\nexport interface UpgradePackageResult {\n name: string;\n directory: string;\n scope: ExtensionScope;\n source: ManagedExtensionSource;\n status: \"planned\" | \"updated\" | \"failed\" | \"skipped\";\n command: string[];\n previous_version: string;\n installed_version?: string;\n reason?: string;\n error?: string;\n}\n\nexport interface UpgradeResult {\n ok: boolean;\n action: \"upgrade\";\n dry_run: boolean;\n scope: ExtensionScope;\n target?: string;\n cli: UpgradeCliResult;\n packages: UpgradePackageResult[];\n summary: {\n requested_cli: boolean;\n requested_packages: boolean;\n planned: number;\n updated: number;\n skipped: number;\n failed: number;\n };\n}\n\nfunction resolveScope(options: UpgradeCommandOptions): ExtensionScope {\n const projectLike = options.project === true || options.local === true;\n const global = options.global === true;\n if (projectLike && global) {\n throw new PmCliError('Options \"--project/--local\" and \"--global\" are mutually exclusive.', EXIT_CODE.USAGE);\n }\n return global ? \"global\" : \"project\";\n}\n\nfunction normalizeTarget(value: string): string {\n return value.trim().toLowerCase();\n}\n\nfunction packageRecordMatchesTarget(record: ManagedExtensionRecord, target: string): boolean {\n const normalizedTarget = normalizeTarget(target);\n const values = [\n record.name,\n record.directory,\n record.source.input,\n record.source.location,\n record.source.package,\n record.source.repository,\n record.source.owner && record.source.repo ? `${record.source.owner}/${record.source.repo}` : undefined,\n ];\n return values.some((value) => typeof value === \"string\" && normalizeTarget(value) === normalizedTarget);\n}\n\nfunction resolveRoots(scope: ExtensionScope, global: GlobalOptions): {\n selected_root: string;\n} {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n const roots = resolveExtensionRoots(pmRoot, process.cwd());\n return {\n selected_root: scope === \"global\" ? roots.global : roots.project,\n };\n}\n\nasync function defaultCommandRunner(\n command: string,\n args: string[],\n options?: { cwd?: string },\n): Promise<UpgradeCommandRunnerResult> {\n try {\n const result = await execFileAsync(command, args, {\n cwd: options?.cwd,\n encoding: \"utf8\",\n });\n return {\n stdout: result.stdout ?? \"\",\n stderr: result.stderr ?? \"\",\n };\n } catch (error: unknown) {\n const stderr = typeof error === \"object\" && error !== null && \"stderr\" in error\n ? String((error as { stderr?: unknown }).stderr ?? \"\")\n : \"\";\n const message = stderr.trim().length > 0 ? stderr.trim() : error instanceof Error ? error.message : String(error);\n throw new PmCliError(`Command failed: ${command} ${args.join(\" \")}\\n${message}`, EXIT_CODE.GENERIC_FAILURE);\n }\n}\n\nasync function readCurrentVersion(): Promise<string | undefined> {\n const packageJsonPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), \"../../..\", \"package.json\");\n try {\n const parsed = JSON.parse(await fs.readFile(packageJsonPath, \"utf8\")) as { version?: unknown };\n return typeof parsed.version === \"string\" ? parsed.version : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction resolveTag(options: UpgradeCommandOptions): string {\n return typeof options.tag === \"string\" && options.tag.trim().length > 0 ? options.tag.trim() : DEFAULT_TAG;\n}\n\nfunction resolveCliPackage(options: UpgradeCommandOptions): string {\n return typeof options.packageName === \"string\" && options.packageName.trim().length > 0\n ? options.packageName.trim()\n : DEFAULT_CLI_PACKAGE;\n}\n\nasync function upgradeCli(options: UpgradeCommandOptions, dryRun: boolean): Promise<UpgradeCliResult> {\n const runner = options.commandRunner ?? defaultCommandRunner;\n const packageName = resolveCliPackage(options);\n const tag = resolveTag(options);\n const target = `${packageName}@${tag}`;\n const command = [\"npm\", \"install\", \"-g\", target];\n if (options.repair === true) {\n command.push(\"--force\");\n }\n const beforeVersion = await readCurrentVersion();\n const planned: UpgradeCliResult = {\n requested: true,\n status: \"planned\",\n package: packageName,\n target,\n command,\n before_version: beforeVersion,\n repair: options.repair === true,\n };\n if (dryRun) {\n return planned;\n }\n try {\n await runner(command[0]!, command.slice(1));\n const verified = await runner(\"pm\", [\"--version\"]);\n return {\n ...planned,\n status: \"updated\",\n after_version: verified.stdout.trim() || undefined,\n };\n } catch (error: unknown) {\n return {\n ...planned,\n status: \"failed\",\n error: error instanceof Error ? error.message : String(error),\n };\n }\n}\n\nfunction isLocalNpmSpec(spec: string): boolean {\n return path.isAbsolute(spec) || spec.startsWith(\".\") || spec.startsWith(\"..\") || spec.startsWith(\"file:\");\n}\n\nfunction resolvePackageInstallSource(source: ManagedExtensionSource, tag: string): string {\n if (source.kind === \"npm\") {\n const rawSpec = source.input.startsWith(\"npm:\") ? source.input.slice(\"npm:\".length).trim() : source.input.trim();\n if (!isLocalNpmSpec(rawSpec) && source.package && source.package.trim().length > 0) {\n return `npm:${source.package.trim()}@${tag}`;\n }\n return source.input.startsWith(\"npm:\") ? source.input : `npm:${source.input}`;\n }\n return source.input;\n}\n\nasync function resolveRunnablePackageSource(source: ManagedExtensionSource, tag: string): Promise<string> {\n const installSource = resolvePackageInstallSource(source, tag);\n if (source.kind !== \"local\") {\n return installSource;\n }\n if (await pathExists(installSource)) {\n return installSource;\n }\n if (await pathExists(source.location)) {\n return source.location;\n }\n return installSource;\n}\n\nfunction packageCommandFor(source: ManagedExtensionSource, installSource: string, scope: ExtensionScope, ref?: string): string[] {\n const command = [\"pm\", \"install\", installSource, scope === \"global\" ? \"--global\" : \"--project\"];\n if (source.kind === \"github\" && ref && ref.trim().length > 0) {\n command.push(\"--ref\", ref.trim());\n }\n return command;\n}\n\nasync function readManagedRecords(scope: ExtensionScope, global: GlobalOptions): Promise<ManagedExtensionRecord[]> {\n const roots = resolveRoots(scope, global);\n const managedState = await readManagedExtensionState(roots.selected_root);\n return managedState.state.entries.filter((entry) => entry.scope === scope);\n}\n\nasync function refreshManagedRecord(\n scope: ExtensionScope,\n global: GlobalOptions,\n record: ManagedExtensionRecord,\n): Promise<ManagedExtensionRecord | undefined> {\n const records = await readManagedRecords(scope, global);\n return records.find((candidate) => packageRecordMatchesTarget(candidate, record.name)) ??\n records.find((candidate) => normalizeTarget(candidate.directory) === normalizeTarget(record.directory));\n}\n\nasync function upgradePackageRecord(\n record: ManagedExtensionRecord,\n options: UpgradeCommandOptions,\n global: GlobalOptions,\n scope: ExtensionScope,\n dryRun: boolean,\n): Promise<UpgradePackageResult> {\n const tag = resolveTag(options);\n const installSource = await resolveRunnablePackageSource(record.source, tag);\n const command = packageCommandFor(record.source, installSource, scope, record.source.ref);\n const planned: UpgradePackageResult = {\n name: record.name,\n directory: record.directory,\n scope,\n source: record.source,\n status: \"planned\",\n command,\n previous_version: record.manifest_version,\n };\n if (dryRun) {\n return planned;\n }\n try {\n await runExtension(\n installSource,\n {\n install: true,\n project: scope === \"project\",\n global: scope === \"global\",\n ref: record.source.kind === \"github\" ? record.source.ref : undefined,\n },\n global,\n );\n const refreshed = await refreshManagedRecord(scope, global, record);\n return {\n ...planned,\n status: \"updated\",\n installed_version: refreshed?.manifest_version,\n };\n } catch (error: unknown) {\n return {\n ...planned,\n status: \"failed\",\n error: error instanceof Error ? error.message : String(error),\n };\n }\n}\n\nfunction summarize(\n cli: UpgradeCliResult,\n packages: UpgradePackageResult[],\n includeCli: boolean,\n includePackages: boolean,\n): UpgradeResult[\"summary\"] {\n const statuses = [includeCli ? cli.status : undefined, ...packages.map((entry) => entry.status)].filter(\n (value): value is UpgradeCliResult[\"status\"] => typeof value === \"string\",\n );\n return {\n requested_cli: includeCli,\n requested_packages: includePackages,\n planned: statuses.filter((status) => status === \"planned\").length,\n updated: statuses.filter((status) => status === \"updated\").length,\n skipped: statuses.filter((status) => status === \"skipped\").length,\n failed: statuses.filter((status) => status === \"failed\").length,\n };\n}\n\nexport async function runUpgrade(\n target: string | undefined,\n options: UpgradeCommandOptions,\n global: GlobalOptions,\n): Promise<UpgradeResult> {\n if (options.cliOnly === true && options.packagesOnly === true) {\n throw new PmCliError('Options \"--cli-only\" and \"--packages-only\" are mutually exclusive.', EXIT_CODE.USAGE);\n }\n\n const scope = resolveScope(options);\n const dryRun = options.dryRun === true;\n const normalizedTarget = typeof target === \"string\" && target.trim().length > 0 ? target.trim() : undefined;\n if (options.cliOnly === true && normalizedTarget) {\n throw new PmCliError('A package target cannot be used with \"--cli-only\".', EXIT_CODE.USAGE);\n }\n const includeCli = options.packagesOnly === true || normalizedTarget ? false : true;\n const includePackages = options.cliOnly === true ? false : true;\n const cli = includeCli\n ? await upgradeCli(options, dryRun)\n : {\n requested: false,\n status: \"skipped\",\n package: resolveCliPackage(options),\n target: `${resolveCliPackage(options)}@${resolveTag(options)}`,\n command: [\"npm\", \"install\", \"-g\", `${resolveCliPackage(options)}@${resolveTag(options)}`],\n repair: options.repair === true,\n reason: \"not_requested\",\n } as UpgradeCliResult;\n\n let packageRecords = includePackages ? await readManagedRecords(scope, global) : [];\n if (normalizedTarget) {\n packageRecords = packageRecords.filter((entry) => packageRecordMatchesTarget(entry, normalizedTarget));\n if (packageRecords.length === 0) {\n throw new PmCliError(`Managed package \"${normalizedTarget}\" was not found in ${scope} scope.`, EXIT_CODE.NOT_FOUND);\n }\n }\n\n const packages: UpgradePackageResult[] = [];\n for (const record of packageRecords) {\n packages.push(await upgradePackageRecord(record, options, global, scope, dryRun));\n }\n\n const summary = summarize(cli, packages, includeCli, includePackages);\n return {\n ok: summary.failed === 0,\n action: \"upgrade\",\n dry_run: dryRun,\n scope,\n target: normalizedTarget,\n cli,\n packages,\n summary,\n };\n}\n"]}
|
package/dist/cli/guide-topics.js
CHANGED
|
@@ -128,27 +128,29 @@ const GUIDE_TOPICS = [
|
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
id: "extensions",
|
|
131
|
-
aliases: ["plugins", "extension-authoring"],
|
|
132
|
-
title: "Extensions",
|
|
133
|
-
summary: "Install, author, and diagnose extensions with deterministic lifecycle controls.",
|
|
134
|
-
intent: "Use this for
|
|
131
|
+
aliases: ["plugins", "extension-authoring", "packages", "package-authoring"],
|
|
132
|
+
title: "Packages and Extensions",
|
|
133
|
+
summary: "Install, author, and diagnose packages/extensions with deterministic lifecycle controls.",
|
|
134
|
+
intent: "Use this for package management, extension capability registration, and runtime diagnostics.",
|
|
135
135
|
commands: [
|
|
136
|
-
"pm
|
|
137
|
-
"pm
|
|
138
|
-
"pm
|
|
139
|
-
"pm
|
|
140
|
-
"pm
|
|
141
|
-
"pm
|
|
136
|
+
"pm install <target> --project",
|
|
137
|
+
"pm upgrade --dry-run",
|
|
138
|
+
"pm package explore --project",
|
|
139
|
+
"pm package manage --detail summary",
|
|
140
|
+
"pm package doctor --detail deep",
|
|
141
|
+
"pm package activate <target> --project",
|
|
142
|
+
"pm package deactivate <target> --project",
|
|
142
143
|
],
|
|
143
144
|
workflows: [
|
|
144
145
|
{
|
|
145
146
|
name: "Lifecycle Triage",
|
|
146
147
|
goal: "Diagnose extension state before forceful lifecycle actions.",
|
|
147
|
-
prompt: "You are debugging
|
|
148
|
+
prompt: "You are debugging package behavior. Inspect managed state first, then run doctor diagnostics, then apply install/adopt/activate actions.",
|
|
148
149
|
commands: [
|
|
149
|
-
"pm
|
|
150
|
-
"pm
|
|
151
|
-
"pm
|
|
150
|
+
"pm package explore --project",
|
|
151
|
+
"pm package manage --detail summary",
|
|
152
|
+
"pm package doctor --detail deep",
|
|
153
|
+
"pm upgrade --packages-only --dry-run",
|
|
152
154
|
],
|
|
153
155
|
},
|
|
154
156
|
],
|
|
@@ -196,8 +198,8 @@ const GUIDE_TOPICS = [
|
|
|
196
198
|
id: "harnesses",
|
|
197
199
|
aliases: ["compatibility", "agent-compatibility"],
|
|
198
200
|
title: "Agent Harness Compatibility",
|
|
199
|
-
summary: "Cross-harness compatibility guidance for
|
|
200
|
-
intent: "Use this when adapting pm
|
|
201
|
+
summary: "Cross-harness compatibility guidance for docs routing.",
|
|
202
|
+
intent: "Use this when adapting pm docs and SDK contracts for an external automation harness.",
|
|
201
203
|
commands: ["pm guide skills", "pm guide commands", "pm contracts --runtime-only --availability-only"],
|
|
202
204
|
workflows: [
|
|
203
205
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guide-topics.js","sourceRoot":"/","sources":["cli/guide-topics.ts"],"names":[],"mappings":"AAyBA,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,YAAY,GAA2B;IAC3C;QACE,EAAE,EAAE,YAAY;QAChB,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,CAAC;QAClD,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,+EAA+E;QACxF,MAAM,EAAE,kGAAkG;QAC1G,QAAQ,EAAE;YACR,SAAS;YACT,uBAAuB;YACvB,yBAAyB;YACzB,uFAAuF;YACvF,eAAe;YACf,qCAAqC;YACrC,gEAAgE;SACjE;QACD,SAAS,EAAE;YACT;gBACE,IAAI,EAAE,sBAAsB;gBAC5B,IAAI,EAAE,6CAA6C;gBACnD,MAAM,EACJ,yIAAyI;gBAC3I,QAAQ,EAAE,CAAC,uBAAuB,EAAE,yBAAyB,EAAE,eAAe,CAAC;aAChF;SACF;QACD,IAAI,EAAE;YACJ,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,4CAA4C,EAAE;YAC5E,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,4CAA4C,EAAE;YACrF,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,gCAAg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AE,GAAG,GAAG,EAAE,CAAC,CAAC;QAC3C,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;KAC5B,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAA4B;IAC5D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;AAChD,CAAC","sourcesContent":["export interface GuideDocReference {\n path: string;\n purpose: string;\n optional?: boolean;\n}\n\nexport interface GuideWorkflowTemplate {\n name: string;\n goal: string;\n prompt: string;\n commands: string[];\n}\n\nexport interface GuideTopicDefinition {\n id: string;\n aliases: string[];\n title: string;\n summary: string;\n intent: string;\n commands: string[];\n workflows: GuideWorkflowTemplate[];\n docs: GuideDocReference[];\n related: string[];\n}\n\nfunction normalizeTopicToken(value: string): string {\n return value.trim().toLowerCase().replaceAll(\"_\", \"-\");\n}\n\nconst GUIDE_TOPICS: GuideTopicDefinition[] = [\n {\n id: \"quickstart\",\n aliases: [\"start\", \"getting-started\", \"bootstrap\"],\n title: \"Quickstart\",\n summary: \"Initialize a tracker and run the shortest safe plan -> execute -> close loop.\",\n intent: \"Use this when a human or agent needs to start productive work quickly with minimal context load.\",\n commands: [\n \"pm init\",\n \"pm context --limit 10\",\n \"pm list-open --limit 20\",\n \"pm create --create-mode progressive --title \\\"...\\\" --description \\\"...\\\" --type Task\",\n \"pm claim <ID>\",\n \"pm update <ID> --status in_progress\",\n \"pm close <ID> \\\"<reason with evidence>\\\" --validate-close warn\",\n ],\n workflows: [\n {\n name: \"Start Session Safely\",\n goal: \"Bootstrap without mutating unrelated state.\",\n prompt:\n \"You are bootstrapping pm work. Use a token-efficient context snapshot first, then select one open item, claim it, and only then mutate.\",\n commands: [\"pm context --limit 10\", \"pm list-open --limit 20\", \"pm claim <ID>\"],\n },\n ],\n docs: [\n { path: \"README.md\", purpose: \"High-level project and install entrypoint.\" },\n { path: \"docs/QUICKSTART.md\", purpose: \"Short setup and first-command walkthrough.\" },\n { path: \"docs/COMMANDS.md\", purpose: \"Task-oriented command recipes.\" },\n ],\n related: [\"commands\", \"workflows\", \"release\"],\n },\n {\n id: \"commands\",\n aliases: [\"cli\", \"operations\", \"reference\"],\n title: \"CLI Command Routing\",\n summary: \"Find the right command family quickly and use command-scoped help/contracts output.\",\n intent: \"Use this when selecting command paths, flags, and output formats for implementation or automation.\",\n commands: [\n \"pm --help\",\n \"pm <command> --help\",\n \"pm <command> --help --explain\",\n \"pm contracts --command <command> --flags-only\",\n \"pm contracts --command <command> --availability-only --runtime-only\",\n \"pm completion <bash|zsh|fish>\",\n ],\n workflows: [\n {\n name: \"Flag Discovery\",\n goal: \"Resolve command flags deterministically before mutations.\",\n prompt:\n \"You are preparing to run a command. Use help and contracts surfaces to verify required/optional flags before execution.\",\n commands: [\"pm <command> --help --explain\", \"pm contracts --command <command> --flags-only\"],\n },\n ],\n docs: [\n { path: \"docs/COMMANDS.md\", purpose: \"Command grouping and examples.\" },\n { path: \"docs/CONFIGURATION.md\", purpose: \"Project/global settings and policy controls.\" },\n { path: \"docs/TESTING.md\", purpose: \"Linked-test orchestration and safety guidance.\" },\n ],\n related: [\"quickstart\", \"workflows\", \"sdk\", \"extensions\"],\n },\n {\n id: \"workflows\",\n aliases: [\"developer\", \"maintainer\", \"agent\"],\n title: \"Developer and Agent Workflows\",\n summary: \"Apply canonical claim -> execute -> verify -> close workflows with append-only evidence.\",\n intent: \"Use this for day-to-day coding-agent execution loops and handoff-safe updates.\",\n commands: [\n \"pm claim <ID>\",\n \"pm update <ID> --status in_progress\",\n \"pm files <ID> --add ...\",\n \"pm test <ID> --add ...\",\n \"pm comments <ID> \\\"...\\\"\",\n \"pm validate --check-resolution --check-history-drift\",\n \"pm release <ID>\",\n ],\n workflows: [\n {\n name: \"Execution Loop\",\n goal: \"Keep code, tests, and tracker evidence synchronized.\",\n prompt:\n \"You are implementing a scoped change. Claim first, link files/tests/docs as you go, append evidence comments, and close only after validation.\",\n commands: [\n \"pm claim <ID>\",\n \"pm update <ID> --status in_progress\",\n \"pm files <ID> --add path=<file>,scope=project\",\n \"pm test <ID> --run --progress\",\n \"pm close <ID> \\\"<evidence>\\\" --validate-close warn\",\n ],\n },\n ],\n docs: [\n { path: \"AGENTS.md\", purpose: \"Repository operating rules and required workflow.\" },\n { path: \"docs/AGENT_GUIDE.md\", purpose: \"Agent-oriented usage and context strategy.\" },\n { path: \"docs/TESTING.md\", purpose: \"Sandbox-safe test execution rules.\" },\n ],\n related: [\"quickstart\", \"commands\", \"skills\"],\n },\n {\n id: \"sdk\",\n aliases: [\"api\", \"typescript-sdk\"],\n title: \"SDK and Integrations\",\n summary: \"Use the published SDK surface for extension authoring and contract-safe integrations.\",\n intent: \"Use this when building or reviewing programmatic integrations against @unbrained/pm-cli/sdk.\",\n commands: [\n \"pm contracts --schema-only\",\n \"pm contracts --command extension --flags-only\",\n \"pm contracts --runtime-only --availability-only\",\n ],\n workflows: [\n {\n name: \"Integration Contract Check\",\n goal: \"Confirm action schemas and runtime availability before coding.\",\n prompt:\n \"You are wiring an integration. Capture schema + runtime availability first, then map your adapter payload fields to contract keys.\",\n commands: [\n \"pm contracts --schema-only\",\n \"pm contracts --availability-only --runtime-only\",\n \"pm contracts --command <command> --flags-only\",\n ],\n },\n ],\n docs: [\n { path: \"docs/SDK.md\", purpose: \"Public SDK exports and extension authoring references.\" },\n { path: \"docs/ARCHITECTURE.md\", purpose: \"Core runtime composition and extension load flow.\" },\n ],\n related: [\"extensions\", \"commands\"],\n },\n {\n id: \"extensions\",\n aliases: [\"plugins\", \"extension-authoring\"],\n title: \"Extensions\",\n summary: \"Install, author, and diagnose extensions with deterministic lifecycle controls.\",\n intent: \"Use this for extension management, capability registration, and runtime diagnostics.\",\n commands: [\n \"pm extension explore --project\",\n \"pm extension install <target> --project\",\n \"pm extension manage --detail summary\",\n \"pm extension doctor --detail deep\",\n \"pm extension activate <target> --project\",\n \"pm extension deactivate <target> --project\",\n ],\n workflows: [\n {\n name: \"Lifecycle Triage\",\n goal: \"Diagnose extension state before forceful lifecycle actions.\",\n prompt:\n \"You are debugging extension behavior. Inspect managed state first, then run doctor diagnostics, then apply install/adopt/activate actions.\",\n commands: [\n \"pm extension explore --project\",\n \"pm extension manage --detail summary\",\n \"pm extension doctor --detail deep\",\n ],\n },\n ],\n docs: [\n { path: \"docs/EXTENSIONS.md\", purpose: \"Capability model and lifecycle command usage.\" },\n {\n path: \"docs/examples/starter-extension/README.md\",\n purpose: \"Starter extension scaffold and local development path.\",\n },\n { path: \"docs/SDK.md\", purpose: \"SDK contracts used by extension implementations.\" },\n ],\n related: [\"sdk\", \"commands\", \"skills\"],\n },\n {\n id: \"skills\",\n aliases: [\"agent-skills\", \"agentskills\"],\n title: \"Agent Skills\",\n summary: \"Skill bundles for developer, user, extensions, and sdk workflows aligned to the current CLI.\",\n intent: \"Use this when an agent needs reproducible prompts/workflows with strict compatibility metadata.\",\n commands: [\n \"pm guide skills --depth deep\",\n \"pm contracts --command guide --flags-only\",\n \"pm validate --check-command-references\",\n ],\n workflows: [\n {\n name: \"Skill Selection\",\n goal: \"Pick the narrowest compatible skill first to minimize context usage.\",\n prompt:\n \"Select a pm skill based on the task intent, then execute only the workflow section needed for the current change.\",\n commands: [\"pm guide skills\", \"pm guide skills --depth deep\"],\n },\n ],\n docs: [\n { path: \"docs/AGENT_GUIDE.md\", purpose: \"Agent-first usage and context model.\" },\n { path: \"docs/README.md\", purpose: \"Documentation routing with progressive disclosure.\" },\n { path: \".agents/skills/README.md\", purpose: \"Agent skills index and routing overview.\" },\n { path: \".agents/skills/pm-developer/SKILL.md\", purpose: \"Developer-oriented pm skill workflow.\" },\n { path: \".agents/skills/pm-user/SKILL.md\", purpose: \"User/operator pm skill workflow.\" },\n { path: \".agents/skills/pm-extensions/SKILL.md\", purpose: \"Extension-focused pm skill workflow.\" },\n { path: \".agents/skills/pm-sdk/SKILL.md\", purpose: \"SDK integration pm skill workflow.\" },\n ],\n related: [\"workflows\", \"harnesses\", \"commands\"],\n },\n {\n id: \"harnesses\",\n aliases: [\"compatibility\", \"agent-compatibility\"],\n title: \"Agent Harness Compatibility\",\n summary: \"Cross-harness compatibility guidance for skill discovery, prompts, and docs routing.\",\n intent: \"Use this when adapting pm skills/docs usage for Pi, OpenClaw, Claude Code, Codex CLI, OpenCode, Amp, Droid, Hermes, or Gemini CLI.\",\n commands: [\"pm guide skills\", \"pm guide commands\", \"pm contracts --runtime-only --availability-only\"],\n workflows: [\n {\n name: \"Harness Mapping\",\n goal: \"Route each harness to the same canonical skill/docs sources.\",\n prompt:\n \"Map harness-specific entrypoints to the same pm guide topics and .agents/skills workflows without adding runtime harness-specific code.\",\n commands: [\"pm guide harnesses --depth standard\", \"pm guide skills --depth deep\"],\n },\n ],\n docs: [\n { path: \"docs/AGENT_GUIDE.md\", purpose: \"Agent context and output-mode conventions.\" },\n { path: \"docs/README.md\", purpose: \"Single-source documentation routing entrypoint.\" },\n { path: \".agents/skills/HARNESS_COMPATIBILITY.md\", purpose: \"Harness compatibility matrix and usage notes.\" },\n ],\n related: [\"skills\", \"workflows\"],\n },\n {\n id: \"release\",\n aliases: [\"gates\", \"ship\", \"release-readiness\"],\n title: \"Release and Staleness Gates\",\n summary: \"Run release gates and docs/skills freshness checks before publishing.\",\n intent: \"Use this when validating release readiness and preventing docs/skills drift.\",\n commands: [\n \"pnpm build\",\n \"pnpm test:coverage\",\n \"pnpm quality:static\",\n \"node scripts/release/run-gates.mjs --telemetry-mode best-effort\",\n \"pnpm security:scan\",\n ],\n workflows: [\n {\n name: \"Pre-Release Gate Sweep\",\n goal: \"Ensure code, docs, and skills are all green before publish.\",\n prompt:\n \"Run release gates in deterministic order and treat docs/skills freshness failures as release blockers.\",\n commands: [\n \"pnpm build\",\n \"pnpm test:coverage\",\n \"node scripts/release/run-gates.mjs --telemetry-mode best-effort\",\n ],\n },\n ],\n docs: [\n { path: \"docs/RELEASING.md\", purpose: \"Release flow and safety checks.\" },\n { path: \"CHANGELOG.md\", purpose: \"Versioned release history and unreleased notes.\" },\n { path: \"scripts/release/run-gates.mjs\", purpose: \"Source of truth for release gate ordering.\" },\n ],\n related: [\"commands\", \"skills\", \"workflows\"],\n },\n];\n\nconst TOPIC_BY_TOKEN = new Map<string, GuideTopicDefinition>();\nfor (const topic of GUIDE_TOPICS) {\n TOPIC_BY_TOKEN.set(topic.id, topic);\n for (const alias of topic.aliases) {\n TOPIC_BY_TOKEN.set(alias, topic);\n }\n}\n\nexport function listGuideTopics(): GuideTopicDefinition[] {\n return GUIDE_TOPICS.map((topic) => ({\n ...topic,\n aliases: [...topic.aliases],\n commands: [...topic.commands],\n workflows: topic.workflows.map((workflow) => ({\n ...workflow,\n commands: [...workflow.commands],\n })),\n docs: topic.docs.map((doc) => ({ ...doc })),\n related: [...topic.related],\n }));\n}\n\nexport function listGuideTopicIds(): string[] {\n return GUIDE_TOPICS.map((topic) => topic.id);\n}\n\nexport function resolveGuideTopic(rawTopic: string | undefined): GuideTopicDefinition | null {\n if (!rawTopic) {\n return null;\n }\n const normalized = normalizeTopicToken(rawTopic);\n if (!normalized) {\n return null;\n }\n return TOPIC_BY_TOKEN.get(normalized) ?? null;\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"guide-topics.js","sourceRoot":"/","sources":["cli/guide-topics.ts"],"names":[],"mappings":"AAyBA,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,U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CAAC;IACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;AAChD,CAAC","sourcesContent":["export interface GuideDocReference {\n path: string;\n purpose: string;\n optional?: boolean;\n}\n\nexport interface GuideWorkflowTemplate {\n name: string;\n goal: string;\n prompt: string;\n commands: string[];\n}\n\nexport interface GuideTopicDefinition {\n id: string;\n aliases: string[];\n title: string;\n summary: string;\n intent: string;\n commands: string[];\n workflows: GuideWorkflowTemplate[];\n docs: GuideDocReference[];\n related: string[];\n}\n\nfunction normalizeTopicToken(value: string): string {\n return value.trim().toLowerCase().replaceAll(\"_\", \"-\");\n}\n\nconst GUIDE_TOPICS: GuideTopicDefinition[] = [\n {\n id: \"quickstart\",\n aliases: [\"start\", \"getting-started\", \"bootstrap\"],\n title: \"Quickstart\",\n summary: \"Initialize a tracker and run the shortest safe plan -> execute -> close loop.\",\n intent: \"Use this when a human or agent needs to start productive work quickly with minimal context load.\",\n commands: [\n \"pm init\",\n \"pm context --limit 10\",\n \"pm list-open --limit 20\",\n \"pm create --create-mode progressive --title \\\"...\\\" --description \\\"...\\\" --type Task\",\n \"pm claim <ID>\",\n \"pm update <ID> --status in_progress\",\n \"pm close <ID> \\\"<reason with evidence>\\\" --validate-close warn\",\n ],\n workflows: [\n {\n name: \"Start Session Safely\",\n goal: \"Bootstrap without mutating unrelated state.\",\n prompt:\n \"You are bootstrapping pm work. Use a token-efficient context snapshot first, then select one open item, claim it, and only then mutate.\",\n commands: [\"pm context --limit 10\", \"pm list-open --limit 20\", \"pm claim <ID>\"],\n },\n ],\n docs: [\n { path: \"README.md\", purpose: \"High-level project and install entrypoint.\" },\n { path: \"docs/QUICKSTART.md\", purpose: \"Short setup and first-command walkthrough.\" },\n { path: \"docs/COMMANDS.md\", purpose: \"Task-oriented command recipes.\" },\n ],\n related: [\"commands\", \"workflows\", \"release\"],\n },\n {\n id: \"commands\",\n aliases: [\"cli\", \"operations\", \"reference\"],\n title: \"CLI Command Routing\",\n summary: \"Find the right command family quickly and use command-scoped help/contracts output.\",\n intent: \"Use this when selecting command paths, flags, and output formats for implementation or automation.\",\n commands: [\n \"pm --help\",\n \"pm <command> --help\",\n \"pm <command> --help --explain\",\n \"pm contracts --command <command> --flags-only\",\n \"pm contracts --command <command> --availability-only --runtime-only\",\n \"pm completion <bash|zsh|fish>\",\n ],\n workflows: [\n {\n name: \"Flag Discovery\",\n goal: \"Resolve command flags deterministically before mutations.\",\n prompt:\n \"You are preparing to run a command. Use help and contracts surfaces to verify required/optional flags before execution.\",\n commands: [\"pm <command> --help --explain\", \"pm contracts --command <command> --flags-only\"],\n },\n ],\n docs: [\n { path: \"docs/COMMANDS.md\", purpose: \"Command grouping and examples.\" },\n { path: \"docs/CONFIGURATION.md\", purpose: \"Project/global settings and policy controls.\" },\n { path: \"docs/TESTING.md\", purpose: \"Linked-test orchestration and safety guidance.\" },\n ],\n related: [\"quickstart\", \"workflows\", \"sdk\", \"extensions\"],\n },\n {\n id: \"workflows\",\n aliases: [\"developer\", \"maintainer\", \"agent\"],\n title: \"Developer and Agent Workflows\",\n summary: \"Apply canonical claim -> execute -> verify -> close workflows with append-only evidence.\",\n intent: \"Use this for day-to-day coding-agent execution loops and handoff-safe updates.\",\n commands: [\n \"pm claim <ID>\",\n \"pm update <ID> --status in_progress\",\n \"pm files <ID> --add ...\",\n \"pm test <ID> --add ...\",\n \"pm comments <ID> \\\"...\\\"\",\n \"pm validate --check-resolution --check-history-drift\",\n \"pm release <ID>\",\n ],\n workflows: [\n {\n name: \"Execution Loop\",\n goal: \"Keep code, tests, and tracker evidence synchronized.\",\n prompt:\n \"You are implementing a scoped change. Claim first, link files/tests/docs as you go, append evidence comments, and close only after validation.\",\n commands: [\n \"pm claim <ID>\",\n \"pm update <ID> --status in_progress\",\n \"pm files <ID> --add path=<file>,scope=project\",\n \"pm test <ID> --run --progress\",\n \"pm close <ID> \\\"<evidence>\\\" --validate-close warn\",\n ],\n },\n ],\n docs: [\n { path: \"AGENTS.md\", purpose: \"Repository operating rules and required workflow.\" },\n { path: \"docs/AGENT_GUIDE.md\", purpose: \"Agent-oriented usage and context strategy.\" },\n { path: \"docs/TESTING.md\", purpose: \"Sandbox-safe test execution rules.\" },\n ],\n related: [\"quickstart\", \"commands\", \"skills\"],\n },\n {\n id: \"sdk\",\n aliases: [\"api\", \"typescript-sdk\"],\n title: \"SDK and Integrations\",\n summary: \"Use the published SDK surface for extension authoring and contract-safe integrations.\",\n intent: \"Use this when building or reviewing programmatic integrations against @unbrained/pm-cli/sdk.\",\n commands: [\n \"pm contracts --schema-only\",\n \"pm contracts --command extension --flags-only\",\n \"pm contracts --runtime-only --availability-only\",\n ],\n workflows: [\n {\n name: \"Integration Contract Check\",\n goal: \"Confirm action schemas and runtime availability before coding.\",\n prompt:\n \"You are wiring an integration. Capture schema + runtime availability first, then map your adapter payload fields to contract keys.\",\n commands: [\n \"pm contracts --schema-only\",\n \"pm contracts --availability-only --runtime-only\",\n \"pm contracts --command <command> --flags-only\",\n ],\n },\n ],\n docs: [\n { path: \"docs/SDK.md\", purpose: \"Public SDK exports and extension authoring references.\" },\n { path: \"docs/ARCHITECTURE.md\", purpose: \"Core runtime composition and extension load flow.\" },\n ],\n related: [\"extensions\", \"commands\"],\n },\n {\n id: \"extensions\",\n aliases: [\"plugins\", \"extension-authoring\", \"packages\", \"package-authoring\"],\n title: \"Packages and Extensions\",\n summary: \"Install, author, and diagnose packages/extensions with deterministic lifecycle controls.\",\n intent: \"Use this for package management, extension capability registration, and runtime diagnostics.\",\n commands: [\n \"pm install <target> --project\",\n \"pm upgrade --dry-run\",\n \"pm package explore --project\",\n \"pm package manage --detail summary\",\n \"pm package doctor --detail deep\",\n \"pm package activate <target> --project\",\n \"pm package deactivate <target> --project\",\n ],\n workflows: [\n {\n name: \"Lifecycle Triage\",\n goal: \"Diagnose extension state before forceful lifecycle actions.\",\n prompt:\n \"You are debugging package behavior. Inspect managed state first, then run doctor diagnostics, then apply install/adopt/activate actions.\",\n commands: [\n \"pm package explore --project\",\n \"pm package manage --detail summary\",\n \"pm package doctor --detail deep\",\n \"pm upgrade --packages-only --dry-run\",\n ],\n },\n ],\n docs: [\n { path: \"docs/EXTENSIONS.md\", purpose: \"Capability model and lifecycle command usage.\" },\n {\n path: \"docs/examples/starter-extension/README.md\",\n purpose: \"Starter extension scaffold and local development path.\",\n },\n { path: \"docs/SDK.md\", purpose: \"SDK contracts used by extension implementations.\" },\n ],\n related: [\"sdk\", \"commands\", \"skills\"],\n },\n {\n id: \"skills\",\n aliases: [\"agent-skills\", \"agentskills\"],\n title: \"Agent Skills\",\n summary: \"Skill bundles for developer, user, extensions, and sdk workflows aligned to the current CLI.\",\n intent: \"Use this when an agent needs reproducible prompts/workflows with strict compatibility metadata.\",\n commands: [\n \"pm guide skills --depth deep\",\n \"pm contracts --command guide --flags-only\",\n \"pm validate --check-command-references\",\n ],\n workflows: [\n {\n name: \"Skill Selection\",\n goal: \"Pick the narrowest compatible skill first to minimize context usage.\",\n prompt:\n \"Select a pm skill based on the task intent, then execute only the workflow section needed for the current change.\",\n commands: [\"pm guide skills\", \"pm guide skills --depth deep\"],\n },\n ],\n docs: [\n { path: \"docs/AGENT_GUIDE.md\", purpose: \"Agent-first usage and context model.\" },\n { path: \"docs/README.md\", purpose: \"Documentation routing with progressive disclosure.\" },\n { path: \".agents/skills/README.md\", purpose: \"Agent skills index and routing overview.\" },\n { path: \".agents/skills/pm-developer/SKILL.md\", purpose: \"Developer-oriented pm skill workflow.\" },\n { path: \".agents/skills/pm-user/SKILL.md\", purpose: \"User/operator pm skill workflow.\" },\n { path: \".agents/skills/pm-extensions/SKILL.md\", purpose: \"Extension-focused pm skill workflow.\" },\n { path: \".agents/skills/pm-sdk/SKILL.md\", purpose: \"SDK integration pm skill workflow.\" },\n ],\n related: [\"workflows\", \"harnesses\", \"commands\"],\n },\n {\n id: \"harnesses\",\n aliases: [\"compatibility\", \"agent-compatibility\"],\n title: \"Agent Harness Compatibility\",\n summary: \"Cross-harness compatibility guidance for docs routing.\",\n intent: \"Use this when adapting pm docs and SDK contracts for an external automation harness.\",\n commands: [\"pm guide skills\", \"pm guide commands\", \"pm contracts --runtime-only --availability-only\"],\n workflows: [\n {\n name: \"Harness Mapping\",\n goal: \"Route each harness to the same canonical skill/docs sources.\",\n prompt:\n \"Map harness-specific entrypoints to the same pm guide topics and .agents/skills workflows without adding runtime harness-specific code.\",\n commands: [\"pm guide harnesses --depth standard\", \"pm guide skills --depth deep\"],\n },\n ],\n docs: [\n { path: \"docs/AGENT_GUIDE.md\", purpose: \"Agent context and output-mode conventions.\" },\n { path: \"docs/README.md\", purpose: \"Single-source documentation routing entrypoint.\" },\n { path: \".agents/skills/HARNESS_COMPATIBILITY.md\", purpose: \"Harness compatibility matrix and usage notes.\" },\n ],\n related: [\"skills\", \"workflows\"],\n },\n {\n id: \"release\",\n aliases: [\"gates\", \"ship\", \"release-readiness\"],\n title: \"Release and Staleness Gates\",\n summary: \"Run release gates and docs/skills freshness checks before publishing.\",\n intent: \"Use this when validating release readiness and preventing docs/skills drift.\",\n commands: [\n \"pnpm build\",\n \"pnpm test:coverage\",\n \"pnpm quality:static\",\n \"node scripts/release/run-gates.mjs --telemetry-mode best-effort\",\n \"pnpm security:scan\",\n ],\n workflows: [\n {\n name: \"Pre-Release Gate Sweep\",\n goal: \"Ensure code, docs, and skills are all green before publish.\",\n prompt:\n \"Run release gates in deterministic order and treat docs/skills freshness failures as release blockers.\",\n commands: [\n \"pnpm build\",\n \"pnpm test:coverage\",\n \"node scripts/release/run-gates.mjs --telemetry-mode best-effort\",\n ],\n },\n ],\n docs: [\n { path: \"docs/RELEASING.md\", purpose: \"Release flow and safety checks.\" },\n { path: \"CHANGELOG.md\", purpose: \"Versioned release history and unreleased notes.\" },\n { path: \"scripts/release/run-gates.mjs\", purpose: \"Source of truth for release gate ordering.\" },\n ],\n related: [\"commands\", \"skills\", \"workflows\"],\n },\n];\n\nconst TOPIC_BY_TOKEN = new Map<string, GuideTopicDefinition>();\nfor (const topic of GUIDE_TOPICS) {\n TOPIC_BY_TOKEN.set(topic.id, topic);\n for (const alias of topic.aliases) {\n TOPIC_BY_TOKEN.set(alias, topic);\n }\n}\n\nexport function listGuideTopics(): GuideTopicDefinition[] {\n return GUIDE_TOPICS.map((topic) => ({\n ...topic,\n aliases: [...topic.aliases],\n commands: [...topic.commands],\n workflows: topic.workflows.map((workflow) => ({\n ...workflow,\n commands: [...workflow.commands],\n })),\n docs: topic.docs.map((doc) => ({ ...doc })),\n related: [...topic.related],\n }));\n}\n\nexport function listGuideTopicIds(): string[] {\n return GUIDE_TOPICS.map((topic) => topic.id);\n}\n\nexport function resolveGuideTopic(rawTopic: string | undefined): GuideTopicDefinition | null {\n if (!rawTopic) {\n return null;\n }\n const normalized = normalizeTopicToken(rawTopic);\n if (!normalized) {\n return null;\n }\n return TOPIC_BY_TOKEN.get(normalized) ?? null;\n}\n"]}
|