pm-presets 2026.6.2 → 2026.6.3-1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.6.3-1 - 2026-06-03
4
+
5
+ ### Added
6
+
7
+ - Deepen presets toolset: add show, diff, validate, enrich list ([pm-ruih](https://github.com/unbraind/pm-presets/blob/main/.agents/pm/features/pm-ruih.toon))
8
+
9
+ ### Other
10
+
11
+ - Unit tests + functional test against real workspace + release 2026.6.3 ([pm-q60r](https://github.com/unbraind/pm-presets/blob/main/.agents/pm/tasks/pm-q60r.toon))
12
+
13
+ ## 2026.06.03 - 2026-06-02
14
+
15
+ ### Added
16
+
17
+ - Enrich presets list output + add --json; document apply idempotency ([pm-g9oh](https://github.com/unbraind/pm-presets/blob/main/.agents/pm/tasks/pm-g9oh.toon))
18
+
19
+ ### Other
20
+
21
+ - DECISION: apply idempotency, --with-seeds, and capability array ([pm-cj9x](https://github.com/unbraind/pm-presets/blob/main/.agents/pm/tasks/pm-cj9x.toon))
22
+ - Implement presets validate \(all bundled presets parse/load\) ([pm-e2qb](https://github.com/unbraind/pm-presets/blob/main/.agents/pm/tasks/pm-e2qb.toon))
23
+ - Implement presets diff <name\> \(workspace vs preset, --json\) ([pm-xa8m](https://github.com/unbraind/pm-presets/blob/main/.agents/pm/tasks/pm-xa8m.toon))
24
+ - Implement presets show <name\> \(full definition, --json, exit 3\) ([pm-0r28](https://github.com/unbraind/pm-presets/blob/main/.agents/pm/tasks/pm-0r28.toon))
25
+
3
26
  ## 2026.06.01 - 2026-06-01
4
27
 
5
28
  ### Fixed
package/README.md CHANGED
@@ -17,6 +17,9 @@ pm install github.com/unbraind/pm-presets --project
17
17
  | **open-source** | `pm oss-setup` | standard | OSS maintainers with community contributors |
18
18
  | **software-sprint** | `pm sprint-setup` | standard | Engineering teams running sprints |
19
19
  | **startup-roadmap** | `pm roadmap-setup` | custom | Startups with investor-facing roadmaps |
20
+ | **kanban** | `pm kanban-setup` | minimal | Continuous-flow boards with a custom `Card` item type |
21
+
22
+ Run `pm presets list` for the full, machine-readable catalog.
20
23
 
21
24
  ## Usage
22
25
 
@@ -36,7 +39,7 @@ pm install github.com/unbraind/pm-presets --project
36
39
  pm roadmap-setup # startup roadmap
37
40
  ```
38
41
 
39
- All commands share the same flags:
42
+ All setup commands share the same flags:
40
43
 
41
44
  | Flag | Short | Description |
42
45
  |---|---|---|
@@ -48,6 +51,56 @@ Each setup command installs valid `pm create` templates and registers the
48
51
  `templates show` runtime handler required by the current pm CLI, so
49
52
  `pm create --template <name>` works after installing and applying this package.
50
53
 
54
+ ## Managing presets
55
+
56
+ Beyond the per-preset `*-setup` aliases, pm-presets ships a unified, read-only
57
+ management surface plus a generic `apply`:
58
+
59
+ | Command | Description |
60
+ |---|---|
61
+ | `pm presets list` | Enumerate every bundled preset and what it configures (governance, built-in + custom item types, templates). |
62
+ | `pm presets show <id>` | Print the full definition of one preset: the settings patch it merges, every template (with its `pm create` option keys), and any custom item types it registers. |
63
+ | `pm presets diff <id>` | Compare the current workspace (`settings.json` + installed templates) against a preset and report what `apply` would add / change, plus which templates are missing. |
64
+ | `pm presets validate` | Validate that all bundled presets parse and load coherently (governance enums, template names/options, registry↔export agreement). |
65
+ | `pm presets apply <id>` | Scaffold a preset into the current workspace (the generic form of the `*-setup` commands). |
66
+
67
+ All of the read-only commands accept `--json` for machine-readable output, and
68
+ all commands accept `--help`. An unknown preset id exits with code `3`
69
+ (`NOT_FOUND`).
70
+
71
+ ```bash
72
+ pm presets list
73
+ pm presets show software-sprint --json
74
+ pm presets diff software-sprint # what would change if I applied it?
75
+ pm presets validate
76
+ pm presets apply software-sprint --dry-run
77
+ ```
78
+
79
+ ### `presets apply` flags
80
+
81
+ `presets apply` accepts the shared `--force` / `--dry-run` / `--prefix` flags,
82
+ plus:
83
+
84
+ | Flag | Short | Description |
85
+ |---|---|---|
86
+ | `--with-seeds` | `-s` | Also create the preset's starter items after applying it. |
87
+
88
+ **Idempotency & safety.** `apply` is safe to re-run:
89
+
90
+ - `settings.json` is **deep-merged** — the preset's keys are layered over your
91
+ existing settings, so unrelated config (telemetry, locks, etc.) is preserved.
92
+ - Templates are **skipped if a file with that name already exists**; pass
93
+ `--force` to overwrite them.
94
+ - `--dry-run` previews every settings merge, template write, and seed item
95
+ without touching disk.
96
+
97
+ **Seeds and custom fields (pm-cli #97).** Starter items created by
98
+ `--with-seeds` set only **built-in** fields (`type`, `title`, `priority`,
99
+ `tags`, `body`). Custom scalar fields registered via `registerItemFields` have
100
+ no `pm create --<field>` setter today, so any preset-specific context lives in
101
+ the seed item's body text rather than in custom options. The kanban `Card`
102
+ type *is* a registered item type, so its seed is created as `--type Card`.
103
+
51
104
  ## Presets in Detail
52
105
 
53
106
  ### bug-triage
@@ -0,0 +1,93 @@
1
+ /**
2
+ * catalog.ts — structured, read-only views over the bundled presets.
3
+ *
4
+ * The individual preset modules export their SETTINGS / TEMPLATES (and, for
5
+ * kanban, ITEM_TYPES). This module joins those raw exports with the
6
+ * PRESET_REGISTRY descriptors and derives the higher-level views consumed by
7
+ * the read-only commands `presets show`, `presets diff`, and `presets validate`
8
+ * (plus the enriched `presets list`).
9
+ *
10
+ * Everything here is pure: no filesystem, no process exit, no SDK runtime. That
11
+ * keeps it unit-testable with `node --test` and side-effect free.
12
+ */
13
+ import type { PresetSettingsPatch } from "./presets/shared.js";
14
+ import { type PresetDescriptor } from "./registry.js";
15
+ /** A minimally-typed mirror of the SDK's SchemaItemTypeDefinition. */
16
+ export interface PresetItemTypeView {
17
+ name: string;
18
+ aliases: string[];
19
+ options: Array<{
20
+ key: string;
21
+ values: string[];
22
+ }>;
23
+ }
24
+ /** A single template summarized for human and JSON consumption. */
25
+ export interface PresetTemplateView {
26
+ name: string;
27
+ /** The built-in pm item type the template creates (e.g. "Issue"). */
28
+ type: string;
29
+ /** All `pm create` option keys the template sets (sorted). */
30
+ optionKeys: string[];
31
+ }
32
+ /** The full, structured definition of one preset. */
33
+ export interface PresetDefinition {
34
+ id: string;
35
+ displayName: string;
36
+ description: string;
37
+ command: string;
38
+ idPrefix: string;
39
+ governance: PresetDescriptor["governance"];
40
+ /** The settings.json patch this preset deep-merges on apply. */
41
+ settings: PresetSettingsPatch;
42
+ /** Templates this preset installs. */
43
+ templates: PresetTemplateView[];
44
+ /** Custom item types registered at activation (kanban only today). */
45
+ itemTypes: PresetItemTypeView[];
46
+ }
47
+ /** All preset definitions in registry order. */
48
+ export declare function listPresetDefinitions(): PresetDefinition[];
49
+ /**
50
+ * Find one preset definition by id (case-insensitive, trimmed).
51
+ *
52
+ * Returns `undefined` for unknown names so callers decide the error contract;
53
+ * `requirePresetDefinition` is the throwing variant for command handlers.
54
+ */
55
+ export declare function findPresetDefinition(id: string | undefined): PresetDefinition | undefined;
56
+ /** Throwing lookup: NOT_FOUND (exit 3) for unknown names. */
57
+ export declare function requirePresetDefinition(id: string | undefined): PresetDefinition;
58
+ /** A compact row for `presets list`, enriched with what each preset configures. */
59
+ export interface PresetListRow {
60
+ id: string;
61
+ name: string;
62
+ command: string;
63
+ governance: PresetDescriptor["governance"];
64
+ idPrefix: string;
65
+ templates: string[];
66
+ templateCount: number;
67
+ /** Distinct built-in item types the templates create. */
68
+ itemTypes: string[];
69
+ /** Names of custom item types registered via the schema API. */
70
+ customItemTypes: string[];
71
+ description: string;
72
+ }
73
+ export declare function buildListRows(): PresetListRow[];
74
+ /** One validation problem found in a bundled preset. */
75
+ export interface PresetValidationIssue {
76
+ presetId: string;
77
+ message: string;
78
+ }
79
+ export interface PresetValidationResult {
80
+ ok: boolean;
81
+ checked: number;
82
+ issues: PresetValidationIssue[];
83
+ }
84
+ /**
85
+ * Validate that every bundled preset parses/loads coherently:
86
+ * - registry descriptor and raw exports agree,
87
+ * - governance is a known enum value,
88
+ * - id_prefix is present,
89
+ * - templates have valid names and string/string[] option values,
90
+ * - the descriptor's advertised template list matches what is exported.
91
+ */
92
+ export declare function validateAllPresets(): PresetValidationResult;
93
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAEV,mBAAmB,EAGpB,MAAM,qBAAqB,CAAC;AAiB7B,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEvE,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CACnD;AAED,mEAAmE;AACnE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,qDAAqD;AACrD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,gEAAgE;IAChE,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,sCAAsC;IACtC,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,sEAAsE;IACtE,SAAS,EAAE,kBAAkB,EAAE,CAAC;CACjC;AAiED,gDAAgD;AAChD,wBAAgB,qBAAqB,IAAI,gBAAgB,EAAE,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,GAAG,SAAS,CAUzF;AAED,6DAA6D;AAC7D,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAUhF;AAED,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,gEAAgE;IAChE,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,aAAa,IAAI,aAAa,EAAE,CAkB/C;AAED,wDAAwD;AACxD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAKD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,IAAI,sBAAsB,CAsD3D"}
@@ -0,0 +1,173 @@
1
+ /**
2
+ * catalog.ts — structured, read-only views over the bundled presets.
3
+ *
4
+ * The individual preset modules export their SETTINGS / TEMPLATES (and, for
5
+ * kanban, ITEM_TYPES). This module joins those raw exports with the
6
+ * PRESET_REGISTRY descriptors and derives the higher-level views consumed by
7
+ * the read-only commands `presets show`, `presets diff`, and `presets validate`
8
+ * (plus the enriched `presets list`).
9
+ *
10
+ * Everything here is pure: no filesystem, no process exit, no SDK runtime. That
11
+ * keeps it unit-testable with `node --test` and side-effect free.
12
+ */
13
+ import { CommandError, EXIT_CODE } from "./presets/shared.js";
14
+ import { bugTriageSettings, bugTriageTemplates, indieDevSettings, indieDevTemplates, openSourceSettings, openSourceTemplates, softwareSprintSettings, softwareSprintTemplates, startupRoadmapSettings, startupRoadmapTemplates, kanbanSettings, kanbanTemplates, kanbanItemTypes, } from "./registry.js";
15
+ import { PRESET_REGISTRY } from "./registry.js";
16
+ /** Raw exports keyed by preset id. */
17
+ const RAW_PRESETS = {
18
+ "bug-triage": { settings: bugTriageSettings, templates: bugTriageTemplates },
19
+ "indie-dev": { settings: indieDevSettings, templates: indieDevTemplates },
20
+ "open-source": { settings: openSourceSettings, templates: openSourceTemplates },
21
+ "software-sprint": { settings: softwareSprintSettings, templates: softwareSprintTemplates },
22
+ "startup-roadmap": { settings: startupRoadmapSettings, templates: startupRoadmapTemplates },
23
+ "kanban": { settings: kanbanSettings, templates: kanbanTemplates, itemTypes: kanbanItemTypes },
24
+ };
25
+ function templateView(document) {
26
+ const options = document.options;
27
+ const type = typeof options.type === "string" ? options.type : "Task";
28
+ const optionKeys = Object.keys(options).sort((left, right) => left.localeCompare(right));
29
+ return { name: document.name, type, optionKeys };
30
+ }
31
+ function itemTypeViews(raw) {
32
+ if (!raw.itemTypes) {
33
+ return [];
34
+ }
35
+ return raw.itemTypes.map((entry) => ({
36
+ name: entry.name,
37
+ aliases: Array.isArray(entry.aliases) ? [...entry.aliases] : [],
38
+ options: Array.isArray(entry.options)
39
+ ? entry.options.map((option) => ({
40
+ key: option.key,
41
+ values: Array.isArray(option.values) ? [...option.values] : [],
42
+ }))
43
+ : [],
44
+ }));
45
+ }
46
+ /** Build the full structured definition for a known descriptor. */
47
+ function buildDefinition(descriptor) {
48
+ const raw = RAW_PRESETS[descriptor.id];
49
+ if (!raw) {
50
+ // Registry and raw exports are compile-time bound, so this is a guard for
51
+ // future drift rather than a runtime-reachable path.
52
+ throw new CommandError(`No definition exports for preset '${descriptor.id}'.`);
53
+ }
54
+ const templates = Object.values(raw.templates)
55
+ .map(templateView)
56
+ .sort((left, right) => left.name.localeCompare(right.name));
57
+ return {
58
+ id: descriptor.id,
59
+ displayName: descriptor.displayName,
60
+ description: descriptor.description,
61
+ command: descriptor.command,
62
+ idPrefix: descriptor.idPrefix,
63
+ governance: descriptor.governance,
64
+ settings: raw.settings,
65
+ templates,
66
+ itemTypes: itemTypeViews(raw),
67
+ };
68
+ }
69
+ /** All preset definitions in registry order. */
70
+ export function listPresetDefinitions() {
71
+ return PRESET_REGISTRY.map(buildDefinition);
72
+ }
73
+ /**
74
+ * Find one preset definition by id (case-insensitive, trimmed).
75
+ *
76
+ * Returns `undefined` for unknown names so callers decide the error contract;
77
+ * `requirePresetDefinition` is the throwing variant for command handlers.
78
+ */
79
+ export function findPresetDefinition(id) {
80
+ if (typeof id !== "string") {
81
+ return undefined;
82
+ }
83
+ const needle = id.trim().toLowerCase();
84
+ if (needle.length === 0) {
85
+ return undefined;
86
+ }
87
+ const descriptor = PRESET_REGISTRY.find((preset) => preset.id.toLowerCase() === needle);
88
+ return descriptor ? buildDefinition(descriptor) : undefined;
89
+ }
90
+ /** Throwing lookup: NOT_FOUND (exit 3) for unknown names. */
91
+ export function requirePresetDefinition(id) {
92
+ const found = findPresetDefinition(id);
93
+ if (!found) {
94
+ const ids = PRESET_REGISTRY.map((preset) => preset.id).join(", ");
95
+ throw new CommandError(`Unknown preset '${id ?? ""}'. Available: ${ids}. Run \`pm presets list\` for details.`, EXIT_CODE.NOT_FOUND);
96
+ }
97
+ return found;
98
+ }
99
+ export function buildListRows() {
100
+ return listPresetDefinitions().map((definition) => {
101
+ const builtinTypes = [...new Set(definition.templates.map((template) => template.type))].sort((left, right) => left.localeCompare(right));
102
+ return {
103
+ id: definition.id,
104
+ name: definition.displayName,
105
+ command: definition.command,
106
+ governance: definition.governance,
107
+ idPrefix: definition.idPrefix,
108
+ templates: definition.templates.map((template) => template.name),
109
+ templateCount: definition.templates.length,
110
+ itemTypes: builtinTypes,
111
+ customItemTypes: definition.itemTypes.map((type) => type.name),
112
+ description: definition.description,
113
+ };
114
+ });
115
+ }
116
+ const GOVERNANCE_VALUES = new Set(["minimal", "default", "strict", "custom"]);
117
+ const TEMPLATE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
118
+ /**
119
+ * Validate that every bundled preset parses/loads coherently:
120
+ * - registry descriptor and raw exports agree,
121
+ * - governance is a known enum value,
122
+ * - id_prefix is present,
123
+ * - templates have valid names and string/string[] option values,
124
+ * - the descriptor's advertised template list matches what is exported.
125
+ */
126
+ export function validateAllPresets() {
127
+ const issues = [];
128
+ const definitions = listPresetDefinitions();
129
+ for (const definition of definitions) {
130
+ const add = (message) => issues.push({ presetId: definition.id, message });
131
+ if (!GOVERNANCE_VALUES.has(definition.governance)) {
132
+ add(`invalid governance '${definition.governance}'`);
133
+ }
134
+ if (typeof definition.idPrefix !== "string" || definition.idPrefix.length === 0) {
135
+ add("missing id_prefix");
136
+ }
137
+ if (typeof definition.settings.id_prefix !== "string" || definition.settings.id_prefix.length === 0) {
138
+ add("settings patch is missing id_prefix");
139
+ }
140
+ if (definition.templates.length === 0) {
141
+ add("has no templates");
142
+ }
143
+ const raw = RAW_PRESETS[definition.id];
144
+ for (const [filename, document] of Object.entries(raw.templates)) {
145
+ if (!TEMPLATE_NAME_PATTERN.test(document.name)) {
146
+ add(`template name '${document.name}' is invalid`);
147
+ }
148
+ if (filename !== `${document.name}.json`) {
149
+ add(`template map key '${filename}' does not match document name '${document.name}'`);
150
+ }
151
+ for (const [key, value] of Object.entries(document.options)) {
152
+ const validValue = typeof value === "string" ||
153
+ (Array.isArray(value) && value.every((entry) => typeof entry === "string"));
154
+ if (key.trim().length === 0) {
155
+ add(`template '${document.name}' has an empty option key`);
156
+ }
157
+ if (!validValue) {
158
+ add(`template '${document.name}' option '${key}' has a non-string value`);
159
+ }
160
+ }
161
+ }
162
+ // The registry descriptor advertises a template list; confirm it matches
163
+ // what the preset module actually exports (drift would mislead `list`).
164
+ const descriptor = PRESET_REGISTRY.find((preset) => preset.id === definition.id);
165
+ const advertised = [...(descriptor?.templates ?? [])].sort((a, b) => a.localeCompare(b));
166
+ const exported = definition.templates.map((template) => template.name).sort((a, b) => a.localeCompare(b));
167
+ if (JSON.stringify(advertised) !== JSON.stringify(exported)) {
168
+ add(`registry templates [${advertised.join(", ")}] differ from exported [${exported.join(", ")}]`);
169
+ }
170
+ }
171
+ return { ok: issues.length === 0, checked: definitions.length, issues };
172
+ }
173
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAyB,MAAM,eAAe,CAAC;AAwCvE,sCAAsC;AACtC,MAAM,WAAW,GAA8B;IAC7C,YAAY,EAAE,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,EAAE,kBAAkB,EAAE;IAC5E,WAAW,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,iBAAiB,EAAE;IACzE,aAAa,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,mBAAmB,EAAE;IAC/E,iBAAiB,EAAE,EAAE,QAAQ,EAAE,sBAAsB,EAAE,SAAS,EAAE,uBAAuB,EAAE;IAC3F,iBAAiB,EAAE,EAAE,QAAQ,EAAE,sBAAsB,EAAE,SAAS,EAAE,uBAAuB,EAAE;IAC3F,QAAQ,EAAE,EAAE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AAE,MAAM,EAAE,CAAC;AAC1E,CAAC"}
package/dist/diff.d.ts ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * diff.ts — compare a pm workspace against a bundled preset definition.
3
+ *
4
+ * The comparison is split in two so the interesting logic stays pure and
5
+ * unit-testable:
6
+ *
7
+ * - `computePresetDiff(definition, snapshot)` is pure: it takes an already-read
8
+ * workspace snapshot and the preset definition and returns a structured diff.
9
+ * - `readWorkspaceSnapshot(pmDir)` is the only filesystem-touching part.
10
+ *
11
+ * What we compare:
12
+ * - settings.json: every leaf in the preset's settings patch (added vs changed
13
+ * vs already-matching),
14
+ * - templates: which of the preset's templates are missing / present in the
15
+ * workspace `templates/` directory,
16
+ * - item types: the custom item types the preset registers (informational —
17
+ * they are registered in-memory at activation, not written to disk).
18
+ */
19
+ import type { PresetDefinition } from "./catalog.js";
20
+ type JsonValue = unknown;
21
+ type JsonObject = Record<string, unknown>;
22
+ export interface WorkspaceSnapshot {
23
+ /** Parsed settings.json (or `undefined` if absent/unreadable). */
24
+ settings: JsonObject | undefined;
25
+ /** Template names present in the workspace `templates/` directory. */
26
+ templateNames: string[];
27
+ }
28
+ export interface SettingDiffEntry {
29
+ /** Dotted path into settings.json, e.g. "governance.preset". */
30
+ path: string;
31
+ status: "add" | "change" | "match";
32
+ preset: JsonValue;
33
+ workspace: JsonValue;
34
+ }
35
+ export interface PresetDiff {
36
+ presetId: string;
37
+ /** True when applying the preset would change nothing. */
38
+ inSync: boolean;
39
+ settings: SettingDiffEntry[];
40
+ templates: {
41
+ missing: string[];
42
+ present: string[];
43
+ };
44
+ /** Custom item types the preset would register (informational). */
45
+ itemTypes: string[];
46
+ summary: {
47
+ settingsToAdd: number;
48
+ settingsToChange: number;
49
+ templatesMissing: number;
50
+ };
51
+ }
52
+ /** Pure diff: preset definition vs an already-read workspace snapshot. */
53
+ export declare function computePresetDiff(definition: PresetDefinition, snapshot: WorkspaceSnapshot): PresetDiff;
54
+ /** Read the workspace snapshot from disk (the only impure part). */
55
+ export declare function readWorkspaceSnapshot(pmDir: string): WorkspaceSnapshot;
56
+ export {};
57
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,KAAK,SAAS,GAAG,OAAO,CAAC;AACzB,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAChC,kEAAkE;IAClE,QAAQ,EAAE,UAAU,GAAG,SAAS,CAAC;IACjC,sEAAsE;IACtE,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACnC,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,SAAS,EAAE;QACT,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,mEAAmE;IACnE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,gBAAgB,EAAE,MAAM,CAAC;QACzB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAuCD,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,iBAAiB,GAC1B,UAAU,CAyCZ;AAED,oEAAoE;AACpE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAwBtE"}
package/dist/diff.js ADDED
@@ -0,0 +1,120 @@
1
+ /**
2
+ * diff.ts — compare a pm workspace against a bundled preset definition.
3
+ *
4
+ * The comparison is split in two so the interesting logic stays pure and
5
+ * unit-testable:
6
+ *
7
+ * - `computePresetDiff(definition, snapshot)` is pure: it takes an already-read
8
+ * workspace snapshot and the preset definition and returns a structured diff.
9
+ * - `readWorkspaceSnapshot(pmDir)` is the only filesystem-touching part.
10
+ *
11
+ * What we compare:
12
+ * - settings.json: every leaf in the preset's settings patch (added vs changed
13
+ * vs already-matching),
14
+ * - templates: which of the preset's templates are missing / present in the
15
+ * workspace `templates/` directory,
16
+ * - item types: the custom item types the preset registers (informational —
17
+ * they are registered in-memory at activation, not written to disk).
18
+ */
19
+ import * as fs from "node:fs";
20
+ import * as path from "node:path";
21
+ function isJsonObject(value) {
22
+ return typeof value === "object" && value !== null && !Array.isArray(value);
23
+ }
24
+ /** Flatten a settings patch into dotted-path leaves, recursing into objects. */
25
+ function flattenLeaves(value, prefix = "") {
26
+ const leaves = [];
27
+ for (const [key, child] of Object.entries(value)) {
28
+ const dotted = prefix ? `${prefix}.${key}` : key;
29
+ if (isJsonObject(child)) {
30
+ leaves.push(...flattenLeaves(child, dotted));
31
+ }
32
+ else {
33
+ leaves.push({ path: dotted, value: child });
34
+ }
35
+ }
36
+ return leaves;
37
+ }
38
+ /** Read a dotted path out of a JSON object; returns `undefined` if any hop misses. */
39
+ function readPath(root, dotted) {
40
+ if (!root) {
41
+ return { found: false, value: undefined };
42
+ }
43
+ let current = root;
44
+ for (const segment of dotted.split(".")) {
45
+ if (!isJsonObject(current) || !Object.prototype.hasOwnProperty.call(current, segment)) {
46
+ return { found: false, value: undefined };
47
+ }
48
+ current = current[segment];
49
+ }
50
+ return { found: true, value: current };
51
+ }
52
+ function valuesEqual(left, right) {
53
+ return JSON.stringify(left) === JSON.stringify(right);
54
+ }
55
+ /** Pure diff: preset definition vs an already-read workspace snapshot. */
56
+ export function computePresetDiff(definition, snapshot) {
57
+ const presetSettings = definition.settings;
58
+ const settingLeaves = flattenLeaves(presetSettings);
59
+ const settings = settingLeaves.map((leaf) => {
60
+ const current = readPath(snapshot.settings, leaf.path);
61
+ if (!current.found) {
62
+ return { path: leaf.path, status: "add", preset: leaf.value, workspace: undefined };
63
+ }
64
+ if (valuesEqual(current.value, leaf.value)) {
65
+ return { path: leaf.path, status: "match", preset: leaf.value, workspace: current.value };
66
+ }
67
+ return { path: leaf.path, status: "change", preset: leaf.value, workspace: current.value };
68
+ });
69
+ const workspaceTemplates = new Set(snapshot.templateNames);
70
+ const missing = [];
71
+ const present = [];
72
+ for (const template of definition.templates) {
73
+ if (workspaceTemplates.has(template.name)) {
74
+ present.push(template.name);
75
+ }
76
+ else {
77
+ missing.push(template.name);
78
+ }
79
+ }
80
+ const settingsToAdd = settings.filter((entry) => entry.status === "add").length;
81
+ const settingsToChange = settings.filter((entry) => entry.status === "change").length;
82
+ return {
83
+ presetId: definition.id,
84
+ inSync: settingsToAdd === 0 && settingsToChange === 0 && missing.length === 0,
85
+ settings,
86
+ templates: { missing, present },
87
+ itemTypes: definition.itemTypes.map((type) => type.name),
88
+ summary: {
89
+ settingsToAdd,
90
+ settingsToChange,
91
+ templatesMissing: missing.length,
92
+ },
93
+ };
94
+ }
95
+ /** Read the workspace snapshot from disk (the only impure part). */
96
+ export function readWorkspaceSnapshot(pmDir) {
97
+ const settingsPath = path.join(pmDir, "settings.json");
98
+ let settings;
99
+ if (fs.existsSync(settingsPath)) {
100
+ try {
101
+ const parsed = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
102
+ if (isJsonObject(parsed)) {
103
+ settings = parsed;
104
+ }
105
+ }
106
+ catch {
107
+ settings = undefined;
108
+ }
109
+ }
110
+ const templatesDir = path.join(pmDir, "templates");
111
+ let templateNames = [];
112
+ if (fs.existsSync(templatesDir)) {
113
+ templateNames = fs
114
+ .readdirSync(templatesDir)
115
+ .filter((entry) => entry.toLowerCase().endsWith(".json"))
116
+ .map((entry) => entry.slice(0, -".json".length));
117
+ }
118
+ return { settings, templateNames };
119
+ }
120
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAwClC,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,gFAAgF;AAChF,SAAS,aAAa,CAAC,KAAiB,EAAE,MAAM,GAAG,EAAE;IACnD,MAAM,MAAM,GAA8C,EAAE,CAAC;IAC7D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QACjD,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,sFAAsF;AACtF,SAAS,QAAQ,CAAC,IAA4B,EAAE,MAAc;IAC5D,IAAI,CAAC,IA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C,QAAQ,CAAC,OAAO,CAAC,CAAC;aACxD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AACrC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,6 +12,13 @@
12
12
  * pm oss-setup # open-source preset
13
13
  * pm sprint-setup # software-sprint preset
14
14
  * pm roadmap-setup # startup-roadmap preset
15
+ *
16
+ * Plus a unified, read-only management surface:
17
+ * pm presets list # enumerate presets + what each configures
18
+ * pm presets show <id> # full definition of one preset
19
+ * pm presets diff <id> # workspace vs preset differences
20
+ * pm presets validate # validate all bundled presets parse/load
21
+ * pm presets apply <id> # scaffold a preset into this workspace
15
22
  */
16
23
  declare const _default: {
17
24
  activate(api: import("@unbrained/pm-cli/sdk").ExtensionApi): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;AAgEH,wBA4IG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;AA2FH,wBA2NG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -12,15 +12,25 @@
12
12
  * pm oss-setup # open-source preset
13
13
  * pm sprint-setup # software-sprint preset
14
14
  * pm roadmap-setup # startup-roadmap preset
15
+ *
16
+ * Plus a unified, read-only management surface:
17
+ * pm presets list # enumerate presets + what each configures
18
+ * pm presets show <id> # full definition of one preset
19
+ * pm presets diff <id> # workspace vs preset differences
20
+ * pm presets validate # validate all bundled presets parse/load
21
+ * pm presets apply <id> # scaffold a preset into this workspace
15
22
  */
16
23
  import { runBugTriageSetup } from "./presets/bug-triage/index.js";
17
24
  import { runIndieDevSetup } from "./presets/indie-dev/index.js";
18
25
  import { runKanbanSetup, ITEM_TYPES as kanbanItemTypes } from "./presets/kanban/index.js";
19
26
  import { runOpenSourceSetup } from "./presets/open-source/index.js";
20
- import { runTemplatesList, runTemplatesShow } from "./presets/shared.js";
27
+ import { resolvePmDir, readBooleanOption, runTemplatesList, runTemplatesShow } from "./presets/shared.js";
21
28
  import { runSoftwareSprintSetup } from "./presets/software-sprint/index.js";
22
29
  import { runStartupRoadmapSetup } from "./presets/startup-roadmap/index.js";
23
30
  import { PRESET_REGISTRY } from "./registry.js";
31
+ import { buildListRows, requirePresetDefinition, validateAllPresets, } from "./catalog.js";
32
+ import { computePresetDiff, readWorkspaceSnapshot } from "./diff.js";
33
+ import { planSeeds, seedPresetItems, seedsForPreset } from "./seeds.js";
24
34
  const defineExtension = ((extension) => extension);
25
35
  // A thrown error only yields a clean non-zero exit (no double-invocation) when
26
36
  // it carries a numeric `exitCode`. Standalone-installed extensions can't import
@@ -68,6 +78,24 @@ const COMMON_FLAGS = [
68
78
  description: "Override the id_prefix written to settings.json.",
69
79
  },
70
80
  ];
81
+ // `presets apply` additionally accepts --with-seeds to create starter items.
82
+ const APPLY_FLAGS = [
83
+ ...COMMON_FLAGS,
84
+ {
85
+ long: "--with-seeds",
86
+ short: "-s",
87
+ type: "boolean",
88
+ description: "Also create the preset's starter items (built-in fields only; see #97).",
89
+ },
90
+ ];
91
+ // `presets list`/`show`/`diff`/`validate` are read-only and JSON-friendly.
92
+ const JSON_FLAG = [
93
+ {
94
+ long: "--json",
95
+ type: "boolean",
96
+ description: "Emit machine-readable JSON instead of the human summary.",
97
+ },
98
+ ];
71
99
  export default defineExtension({
72
100
  activate(api) {
73
101
  // ── bug-triage ──────────────────────────────────────────────────────────
@@ -116,24 +144,61 @@ export default defineExtension({
116
144
  if (typeof api.registerItemTypes === "function") {
117
145
  api.registerItemTypes(kanbanItemTypes);
118
146
  }
119
- // ── unified presets list / apply ────────────────────────────────────────
147
+ // ── unified presets list / show / diff / validate / apply ────────────────
120
148
  api.registerCommand({
121
149
  name: "presets list",
122
150
  action: "presets-list",
123
- description: "List all available workspace presets bundled in pm-presets.",
124
- examples: ["pm presets list"],
151
+ description: "List all bundled workspace presets with what each configures (governance, item types, templates).",
152
+ examples: ["pm presets list", "pm presets list --json"],
153
+ flags: JSON_FLAG,
125
154
  run: () => ({
126
- presets: PRESET_REGISTRY.map((p) => ({
127
- id: p.id,
128
- name: p.displayName,
129
- command: p.command,
130
- governance: p.governance,
131
- templates: p.templates,
132
- description: p.description,
133
- })),
155
+ presets: buildListRows(),
134
156
  count: PRESET_REGISTRY.length,
135
157
  }),
136
158
  });
159
+ api.registerCommand({
160
+ name: "presets show",
161
+ action: "presets-show",
162
+ description: "Print the full definition of one preset: settings patch, templates, and custom item types.",
163
+ examples: ["pm presets show software-sprint", "pm presets show kanban --json"],
164
+ arguments: [
165
+ { name: "preset", required: true, description: "Preset id (see `pm presets list`)." },
166
+ ],
167
+ flags: JSON_FLAG,
168
+ run: (ctx) => requirePresetDefinition(ctx.args?.[0]),
169
+ });
170
+ api.registerCommand({
171
+ name: "presets diff",
172
+ action: "presets-diff",
173
+ description: "Compare the current pm workspace (settings + installed templates) against a preset and report differences.",
174
+ examples: ["pm presets diff software-sprint", "pm presets diff bug-triage --json"],
175
+ arguments: [
176
+ { name: "preset", required: true, description: "Preset id (see `pm presets list`)." },
177
+ ],
178
+ flags: JSON_FLAG,
179
+ run: (ctx) => {
180
+ const definition = requirePresetDefinition(ctx.args?.[0]);
181
+ const snapshot = readWorkspaceSnapshot(resolvePmDir(ctx));
182
+ return computePresetDiff(definition, snapshot);
183
+ },
184
+ });
185
+ api.registerCommand({
186
+ name: "presets validate",
187
+ action: "presets-validate",
188
+ description: "Validate that all bundled presets parse and load correctly.",
189
+ examples: ["pm presets validate", "pm presets validate --json"],
190
+ flags: JSON_FLAG,
191
+ run: () => {
192
+ const result = validateAllPresets();
193
+ if (!result.ok) {
194
+ const detail = result.issues
195
+ .map((issue) => ` ${issue.presetId}: ${issue.message}`)
196
+ .join("\n");
197
+ throw new PresetError(`${result.issues.length} preset validation issue(s) across ${result.checked} preset(s):\n${detail}`, 1);
198
+ }
199
+ return result;
200
+ },
201
+ });
137
202
  api.registerCommand({
138
203
  name: "presets apply",
139
204
  action: "presets-apply",
@@ -141,20 +206,52 @@ export default defineExtension({
141
206
  examples: [
142
207
  "pm presets apply kanban",
143
208
  "pm presets apply software-sprint --dry-run",
209
+ "pm presets apply bug-triage --with-seeds",
144
210
  "pm presets apply bug-triage --force",
145
211
  ],
146
212
  arguments: [
147
213
  { name: "preset", required: true, description: "Preset id (see `pm presets list`)." },
148
214
  ],
149
- flags: COMMON_FLAGS,
215
+ flags: APPLY_FLAGS,
150
216
  run: (ctx) => {
151
217
  const id = ctx.args?.[0];
152
- const handler = id ? PRESET_HANDLERS[id] : undefined;
153
- if (!handler) {
154
- const ids = Object.keys(PRESET_HANDLERS).join(", ");
155
- throw new PresetError(`Unknown preset '${id ?? ""}'. Available: ${ids}. Run \`pm presets list\` for details.`, 2);
218
+ // Validate the id up front (NOT_FOUND/exit 3 for unknown names).
219
+ const definition = requirePresetDefinition(id);
220
+ const handler = PRESET_HANDLERS[definition.id];
221
+ handler(ctx);
222
+ const withSeeds = readBooleanOption(ctx.options, "withSeeds", "with-seeds");
223
+ if (!withSeeds) {
224
+ return;
225
+ }
226
+ const dryRun = readBooleanOption(ctx.options, "dryRun", "dry-run");
227
+ const pmRoot = resolvePmDir(ctx);
228
+ const seeds = seedsForPreset(definition.id);
229
+ if (seeds.length === 0) {
230
+ console.log(`No starter seeds defined for '${definition.id}'.`);
231
+ return;
232
+ }
233
+ if (dryRun) {
234
+ console.log("");
235
+ console.log(`[dry-run] Would seed ${seeds.length} starter item(s):`);
236
+ for (const entry of planSeeds(pmRoot, definition.id)) {
237
+ console.log(` - ${entry.type}: ${entry.title}`);
238
+ }
239
+ return;
240
+ }
241
+ console.log("");
242
+ console.log(`Seeding ${seeds.length} starter item(s)...`);
243
+ const seedResult = seedPresetItems(pmRoot, definition.id);
244
+ for (const detail of seedResult.details) {
245
+ if (detail.ok) {
246
+ console.log(` Created: ${detail.title}`);
247
+ }
248
+ else {
249
+ console.warn(` Failed: ${detail.title}${detail.message ? ` (${detail.message})` : ""}`);
250
+ }
251
+ }
252
+ if (seedResult.failed > 0) {
253
+ throw new PresetError(`Seeded ${seedResult.created} item(s) but ${seedResult.failed} failed.`, 1);
156
254
  }
157
- return handler(ctx);
158
255
  },
159
256
  });
160
257
  // ── create-template runtime ─────────────────────────────────────────────
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,eAAe,GAA+B,CAAC,CAAC,SAAc,EAAE,EAAE,CAAC,SAAS,CAAQ,CAAC;AAE3F,+EAA+E;AAC/E,gFAAgF;AAChF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AE,uDAAuD;YACpE,GAAG,EAAE,gBAAgB;SACtB,CAAC,CAAC;QAEH,GAAG,CAAC,eAAe,CAAC;YAClB,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,gBAAgB;YACxB,WAAW,EAAE,wDAAwD;YACrE,SAAS,EAAE;gBACT;oBACE,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,gBAAgB;iBAC9B;aACF;YACD,GAAG,EAAE,gBAAgB;SACtB,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAEH,uBAAuB;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * seeds.ts — optional starter items for `presets apply <id> --with-seeds`.
3
+ *
4
+ * IMPORTANT (pm-cli issue #97): custom scalar fields registered via
5
+ * `registerItemFields` have no `pm create --<field>` setter. Seed items
6
+ * therefore set ONLY built-in fields (title, type, priority, tags, body). Any
7
+ * preset-specific context lives in the body text, not in custom options.
8
+ *
9
+ * Seeding shells out to the `pm` binary so item IDs, the toon format, and
10
+ * workspace governance are all handled by pm itself rather than re-implemented
11
+ * here. The seed *definitions* and the dry-run plan are pure and unit-tested;
12
+ * only `seedPresetItems` touches the process.
13
+ */
14
+ /** A single starter item, restricted to built-in create fields. */
15
+ export interface SeedItem {
16
+ type: string;
17
+ title: string;
18
+ priority?: string;
19
+ tags?: string;
20
+ body?: string;
21
+ }
22
+ /** Built-in-only seed items keyed by preset id. */
23
+ export declare const PRESET_SEEDS: Record<string, SeedItem[]>;
24
+ export declare function seedsForPreset(presetId: string): SeedItem[];
25
+ /** Build the `pm create` argv for one seed item (built-in fields only). */
26
+ export declare function buildSeedCreateArgs(pmRoot: string, seed: SeedItem): string[];
27
+ export interface SeedPlanEntry {
28
+ title: string;
29
+ type: string;
30
+ command: string;
31
+ }
32
+ /** Pure dry-run plan: what `--with-seeds` would create, without running anything. */
33
+ export declare function planSeeds(pmRoot: string, presetId: string): SeedPlanEntry[];
34
+ export interface SeedResult {
35
+ created: number;
36
+ failed: number;
37
+ details: Array<{
38
+ title: string;
39
+ ok: boolean;
40
+ message?: string;
41
+ }>;
42
+ }
43
+ /**
44
+ * Create the preset's starter items by shelling out to `pm create`.
45
+ * Non-throwing: failures are collected so a partial seed still reports clearly.
46
+ */
47
+ export declare function seedPresetItems(pmRoot: string, presetId: string, pmBin?: string): SeedResult;
48
+ //# sourceMappingURL=seeds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seeds.d.ts","sourceRoot":"","sources":["../src/seeds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,mEAAmE;AACnE,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,mDAAmD;AACnD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CA8DnD,CAAC;AAEF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAE3D;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAY5E;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qFAAqF;AACrF,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAM3E;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,SAAO,GAAG,UAAU,CAwB1F"}
package/dist/seeds.js ADDED
@@ -0,0 +1,132 @@
1
+ /**
2
+ * seeds.ts — optional starter items for `presets apply <id> --with-seeds`.
3
+ *
4
+ * IMPORTANT (pm-cli issue #97): custom scalar fields registered via
5
+ * `registerItemFields` have no `pm create --<field>` setter. Seed items
6
+ * therefore set ONLY built-in fields (title, type, priority, tags, body). Any
7
+ * preset-specific context lives in the body text, not in custom options.
8
+ *
9
+ * Seeding shells out to the `pm` binary so item IDs, the toon format, and
10
+ * workspace governance are all handled by pm itself rather than re-implemented
11
+ * here. The seed *definitions* and the dry-run plan are pure and unit-tested;
12
+ * only `seedPresetItems` touches the process.
13
+ */
14
+ import { spawnSync } from "node:child_process";
15
+ /** Built-in-only seed items keyed by preset id. */
16
+ export const PRESET_SEEDS = {
17
+ "bug-triage": [
18
+ {
19
+ type: "Issue",
20
+ title: "Example production incident",
21
+ priority: "1",
22
+ tags: "incident,production",
23
+ body: "Starter incident seeded by pm-presets. Replace with a real incident.",
24
+ },
25
+ ],
26
+ "indie-dev": [
27
+ {
28
+ type: "Task",
29
+ title: "Set up project skeleton",
30
+ priority: "2",
31
+ tags: "task",
32
+ body: "Starter task seeded by pm-presets.",
33
+ },
34
+ ],
35
+ "open-source": [
36
+ {
37
+ type: "Issue",
38
+ title: "Triage incoming community issues",
39
+ priority: "2",
40
+ tags: "triage",
41
+ body: "Starter triage issue seeded by pm-presets.",
42
+ },
43
+ ],
44
+ "software-sprint": [
45
+ {
46
+ type: "Epic",
47
+ title: "First sprint epic",
48
+ priority: "2",
49
+ tags: "epic,sprint",
50
+ body: "Starter epic seeded by pm-presets.",
51
+ },
52
+ {
53
+ type: "Task",
54
+ title: "First sprint task",
55
+ priority: "2",
56
+ tags: "task,sprint",
57
+ body: "Starter task seeded by pm-presets.",
58
+ },
59
+ ],
60
+ "startup-roadmap": [
61
+ {
62
+ type: "Feature",
63
+ title: "Define first roadmap initiative",
64
+ priority: "2",
65
+ tags: "roadmap",
66
+ body: "Starter initiative seeded by pm-presets.",
67
+ },
68
+ ],
69
+ "kanban": [
70
+ {
71
+ type: "Card",
72
+ title: "First card on the board",
73
+ priority: "2",
74
+ tags: "kanban",
75
+ body: "Starter card seeded by pm-presets.",
76
+ },
77
+ ],
78
+ };
79
+ export function seedsForPreset(presetId) {
80
+ return PRESET_SEEDS[presetId] ?? [];
81
+ }
82
+ /** Build the `pm create` argv for one seed item (built-in fields only). */
83
+ export function buildSeedCreateArgs(pmRoot, seed) {
84
+ const args = ["--path", pmRoot, "create", "--type", seed.type, "--title", seed.title];
85
+ if (seed.priority) {
86
+ args.push("--priority", seed.priority);
87
+ }
88
+ if (seed.tags) {
89
+ args.push("--tags", seed.tags);
90
+ }
91
+ if (seed.body) {
92
+ args.push("--body", seed.body);
93
+ }
94
+ return args;
95
+ }
96
+ /** Pure dry-run plan: what `--with-seeds` would create, without running anything. */
97
+ export function planSeeds(pmRoot, presetId) {
98
+ return seedsForPreset(presetId).map((seed) => ({
99
+ title: seed.title,
100
+ type: seed.type,
101
+ command: `pm ${buildSeedCreateArgs(pmRoot, seed).join(" ")}`,
102
+ }));
103
+ }
104
+ /**
105
+ * Create the preset's starter items by shelling out to `pm create`.
106
+ * Non-throwing: failures are collected so a partial seed still reports clearly.
107
+ */
108
+ export function seedPresetItems(pmRoot, presetId, pmBin = "pm") {
109
+ const seeds = seedsForPreset(presetId);
110
+ const details = [];
111
+ let created = 0;
112
+ let failed = 0;
113
+ for (const seed of seeds) {
114
+ const result = spawnSync(pmBin, buildSeedCreateArgs(pmRoot, seed), {
115
+ encoding: "utf8",
116
+ });
117
+ if (result.status === 0) {
118
+ created += 1;
119
+ details.push({ title: seed.title, ok: true });
120
+ }
121
+ else {
122
+ failed += 1;
123
+ const message = (result.stderr || result.stdout || result.error?.message || "")
124
+ .toString()
125
+ .trim()
126
+ .split("\n")[0];
127
+ details.push({ title: seed.title, ok: false, message });
128
+ }
129
+ }
130
+ return { created, failed, details };
131
+ }
132
+ //# sourceMappingURL=seeds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seeds.js","sourceRoot":"","sources":["../src/seeds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAW/C,mDAAmD;AACnD,MAAM,CAAC,MAAM,YAAY,GAA+B;IACtD,YAAY,EAAE;QACZ;YACE,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,6BAA6B;YACpC,QAAQ,EAAE,GAAG;YACb,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EAAE,sEAAsE;SAC7E;KACF;IACD,WAAW,EAAE;QACX;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,yBAAyB;YAChC,QAAQ,EAAE,GAAG;YACb,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,oCAAoC;SAC3C;KACF;IACD,aAAa,EAAE;QACb;YACE,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,kCAAkC;YACzC,QAAQ,EAAE,GAAG;YACb,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,4CAA4C;SACnD;KACF;IACD,iBAAiB,EAAE;QACjB;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,mBAAmB;YAC1B,QAAQ,EAAE,GAAG;YACb,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,oCAAoC;SAC3C;QACD;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,mBAAmB;YAC1B,QAAQ,EAAE,GAAG;YACb,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,oCAAoC;SAC3C;KACF;IAC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IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AACtC,CAAC"}
package/manifest.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pm-presets",
3
- "version": "2026.6.2",
3
+ "version": "2026.6.3-1",
4
4
  "description": "All 5 official pm-cli workspace presets in one package: bug-triage, indie-dev, open-source, software-sprint, startup-roadmap",
5
5
  "author": "@unbraind",
6
6
  "entry": "./dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pm-presets",
3
- "version": "2026.6.2",
3
+ "version": "2026.6.3-1",
4
4
  "description": "All 5 official pm-cli workspace presets in one package: bug-triage, indie-dev, open-source, software-sprint, startup-roadmap",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "prepack": "npm run build",
35
35
  "typecheck": "tsc --noEmit",
36
36
  "check": "npm run typecheck",
37
- "test": "node --test --experimental-strip-types tests/registry.test.ts",
37
+ "test": "node --test --experimental-strip-types tests/registry.test.ts tests/catalog.test.ts tests/diff.test.ts tests/seeds.test.ts",
38
38
  "audit:prod": "npm audit --omit=dev",
39
39
  "pack:dry-run": "npm pack --dry-run",
40
40
  "changelog": "pm-changelog --pm-root .agents/pm --mode prepend --output CHANGELOG.md --release-version-from-package --since-previous-tag --until-release-tag --item-url-base https://github.com/unbraind/pm-presets/blob/main/.agents/pm",
@@ -43,12 +43,12 @@
43
43
  "release:check": "npm run typecheck && npm run build && npm run audit:prod && npm run pack:dry-run && npm run changelog:check"
44
44
  },
45
45
  "peerDependencies": {
46
- "@unbrained/pm-cli": ">=2026.5.29"
46
+ "@unbrained/pm-cli": ">=2026.5.31"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^25.9.1",
50
50
  "@unbrained/pm-cli": "^2026.5.31",
51
- "pm-changelog": "^2026.5.29-2",
51
+ "pm-changelog": "^2026.6.2",
52
52
  "typescript": "^6.0.3"
53
53
  },
54
54
  "engines": {