pm-skill 1.1.0 → 1.1.2
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/dist/workflows.js +33 -11
- package/package.json +1 -1
package/dist/workflows.js
CHANGED
|
@@ -5,7 +5,7 @@ import { resolve, dirname } from "path";
|
|
|
5
5
|
import { validateEnv, writeEnvFile, PKG_ROOT } from "./env.js";
|
|
6
6
|
import { loadConfig, getTemplate, resolvePriority, resolveSeverity, validateDocType, validateLabel, } from "./config.js";
|
|
7
7
|
import { getLinearClient, validateLinearKey, createIssue, getIssue, getIssueDetail, createRelation, createAttachment, createLabel, getTeams, getTeamStates, getTeamLabels, resolveLabels, } from "./linear.js";
|
|
8
|
-
import { getNotionClient, createTemplatedPage, createDatabaseEntry, validateNotionKey, } from "./notion.js";
|
|
8
|
+
import { getNotionClient, createTemplatedPage, createDatabaseEntry, validateNotionKey, searchPages, } from "./notion.js";
|
|
9
9
|
// ── Init ──
|
|
10
10
|
function copyBundledFile(srcName, destPath) {
|
|
11
11
|
if (existsSync(destPath)) {
|
|
@@ -69,11 +69,33 @@ async function init(args) {
|
|
|
69
69
|
throw new Error(`Team '${teamId}' not found. Run 'npx pm-skill init --linear-key <key>' to see available teams.`);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
// 3. Validate Notion key
|
|
72
|
+
// 3. Validate Notion key + auto-detect root page
|
|
73
|
+
let selectedNotionPage = notionPage;
|
|
73
74
|
if (notionKey) {
|
|
74
75
|
console.log("\n[Notion] Validating API key...");
|
|
75
76
|
const notionUser = await validateNotionKey(notionKey);
|
|
76
77
|
console.log(` Authenticated as: ${notionUser.name}`);
|
|
78
|
+
if (!selectedNotionPage) {
|
|
79
|
+
console.log(" Searching for accessible pages...");
|
|
80
|
+
const notionClient = getNotionClient(notionKey);
|
|
81
|
+
const pages = await searchPages(notionClient, "");
|
|
82
|
+
if (pages.length === 0) {
|
|
83
|
+
console.log(" ⚠️ No pages shared with this integration.");
|
|
84
|
+
console.log(" Share a page in Notion: page menu → Connections → add your integration");
|
|
85
|
+
}
|
|
86
|
+
else if (pages.length === 1) {
|
|
87
|
+
selectedNotionPage = pages[0].id;
|
|
88
|
+
console.log(` Auto-selected root page: "${pages[0].title}" (${pages[0].id})`);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.log(`\n Accessible pages (${pages.length}):`);
|
|
92
|
+
for (const page of pages) {
|
|
93
|
+
console.log(` ${page.title} | ${page.id}`);
|
|
94
|
+
}
|
|
95
|
+
selectedNotionPage = pages[0].id;
|
|
96
|
+
console.log(` Using first page: "${pages[0].title}". Override with --notion-page <id>`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
77
99
|
}
|
|
78
100
|
// 4. Write .env
|
|
79
101
|
console.log("\n[Config] Writing .env...");
|
|
@@ -85,8 +107,8 @@ async function init(args) {
|
|
|
85
107
|
envEntries.LINEAR_DEFAULT_PROJECT_ID = projectId;
|
|
86
108
|
if (notionKey)
|
|
87
109
|
envEntries.NOTION_API_KEY = notionKey;
|
|
88
|
-
if (
|
|
89
|
-
envEntries.NOTION_ROOT_PAGE_ID =
|
|
110
|
+
if (selectedNotionPage)
|
|
111
|
+
envEntries.NOTION_ROOT_PAGE_ID = selectedNotionPage;
|
|
90
112
|
const envPath = writeEnvFile(cwd, envEntries);
|
|
91
113
|
console.log(` Written: ${envPath}`);
|
|
92
114
|
// 5. Copy config.yml, SKILL.md, AGENTS.md
|
|
@@ -192,7 +214,7 @@ async function setup(ctx, args) {
|
|
|
192
214
|
async function startFeature(ctx, args) {
|
|
193
215
|
const title = args._[0];
|
|
194
216
|
if (!title) {
|
|
195
|
-
throw new Error("Usage: pm-skill start-feature <title>");
|
|
217
|
+
throw new Error("Usage: npx pm-skill start-feature <title>");
|
|
196
218
|
}
|
|
197
219
|
const tmpl = getTemplate(ctx.config, "feature");
|
|
198
220
|
const teamLabels = await getTeamLabels(ctx.linear, ctx.env.LINEAR_DEFAULT_TEAM_ID);
|
|
@@ -222,7 +244,7 @@ async function startFeature(ctx, args) {
|
|
|
222
244
|
async function reportBug(ctx, args) {
|
|
223
245
|
const title = args._[0];
|
|
224
246
|
if (!title) {
|
|
225
|
-
throw new Error("Usage: pm-skill report-bug <title> [--severity high]");
|
|
247
|
+
throw new Error("Usage: npx pm-skill report-bug <title> [--severity high]");
|
|
226
248
|
}
|
|
227
249
|
const severity = args.severity ?? "medium";
|
|
228
250
|
const priority = resolveSeverity(ctx.config, severity);
|
|
@@ -267,7 +289,7 @@ async function addTask(ctx, args) {
|
|
|
267
289
|
const parentIdentifier = args._[0];
|
|
268
290
|
const title = args._[1];
|
|
269
291
|
if (!parentIdentifier || !title) {
|
|
270
|
-
throw new Error("Usage: pm-skill add-task <parent-issue> <title>");
|
|
292
|
+
throw new Error("Usage: npx pm-skill add-task <parent-issue> <title>");
|
|
271
293
|
}
|
|
272
294
|
const parent = await getIssue(ctx.linear, parentIdentifier);
|
|
273
295
|
const child = await createIssue(ctx.linear, {
|
|
@@ -282,7 +304,7 @@ async function relate(ctx, args) {
|
|
|
282
304
|
const id1 = args._[0];
|
|
283
305
|
const id2 = args._[1];
|
|
284
306
|
if (!id1 || !id2) {
|
|
285
|
-
throw new Error("Usage: pm-skill relate <issue1> <issue2> [--type related]");
|
|
307
|
+
throw new Error("Usage: npx pm-skill relate <issue1> <issue2> [--type related]");
|
|
286
308
|
}
|
|
287
309
|
const type = args.type ?? "related";
|
|
288
310
|
if (type !== "related" && type !== "similar") {
|
|
@@ -297,7 +319,7 @@ async function block(ctx, args) {
|
|
|
297
319
|
const id1 = args._[0];
|
|
298
320
|
const id2 = args._[1];
|
|
299
321
|
if (!id1 || !id2) {
|
|
300
|
-
throw new Error("Usage: pm-skill block <blocker> <blocked>");
|
|
322
|
+
throw new Error("Usage: npx pm-skill block <blocker> <blocked>");
|
|
301
323
|
}
|
|
302
324
|
const issue1 = await getIssue(ctx.linear, id1);
|
|
303
325
|
const issue2 = await getIssue(ctx.linear, id2);
|
|
@@ -310,7 +332,7 @@ async function attachDoc(ctx, args) {
|
|
|
310
332
|
const title = args.title;
|
|
311
333
|
const type = args.type;
|
|
312
334
|
if (!identifier || !url || !title || !type) {
|
|
313
|
-
throw new Error('Usage: pm-skill attach-doc <issue> --url "URL" --title "Title" --type <type>');
|
|
335
|
+
throw new Error('Usage: npx pm-skill attach-doc <issue> --url "URL" --title "Title" --type <type>');
|
|
314
336
|
}
|
|
315
337
|
validateDocType(ctx.config, type);
|
|
316
338
|
const issue = await getIssue(ctx.linear, identifier);
|
|
@@ -320,7 +342,7 @@ async function attachDoc(ctx, args) {
|
|
|
320
342
|
async function get(ctx, args) {
|
|
321
343
|
const identifier = args._[0];
|
|
322
344
|
if (!identifier) {
|
|
323
|
-
throw new Error("Usage: pm-skill get <issue>");
|
|
345
|
+
throw new Error("Usage: npx pm-skill get <issue>");
|
|
324
346
|
}
|
|
325
347
|
const detail = await getIssueDetail(ctx.linear, identifier);
|
|
326
348
|
const { issue, children, relations, attachments } = detail;
|