project-logbook 1.1.0 → 1.2.0
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/README.md +3 -0
- package/dist/commands/new-helpers.d.ts +26 -0
- package/dist/commands/new-helpers.js +103 -0
- package/dist/commands/new-helpers.js.map +1 -0
- package/dist/commands/new.js +91 -92
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/start.d.ts +1 -1
- package/dist/commands/start.js +85 -42
- package/dist/commands/start.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/build-helpers.d.ts +2 -2
- package/dist/lib/build-helpers.js +43 -61
- package/dist/lib/build-helpers.js.map +1 -1
- package/dist/lib/markdown-processors.d.ts +5 -2
- package/dist/lib/markdown-processors.js +9 -7
- package/dist/lib/markdown-processors.js.map +1 -1
- package/dist/templates/CONTRIBUTING.md +35 -3
- package/dist/templates/adr.md +34 -0
- package/dist/templates/index.md +5 -4
- package/dist/templates/steer.txt +14 -1
- package/dist/utils/prompt.d.ts +6 -0
- package/dist/utils/prompt.js +59 -0
- package/dist/utils/prompt.js.map +1 -0
- package/package.json +2 -2
- package/src/templates/CONTRIBUTING.md +35 -3
- package/src/templates/adr.md +34 -0
- package/src/templates/index.md +5 -4
- package/src/templates/steer.txt +14 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,OAAO,IAAI,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,iBAAiB,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AQ,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,uBAAuB,aAAa,oCAAoC,CAAC,CAAC,CAAC;AACjG,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ program
|
|
|
48
48
|
await upgrade();
|
|
49
49
|
});
|
|
50
50
|
program
|
|
51
|
-
.command('start
|
|
51
|
+
.command('start [id]')
|
|
52
52
|
.description('Mark a logbook entry as active by ID, e.g. LB-5 (writes .logbook-active lockfile)')
|
|
53
53
|
.action(async (id) => {
|
|
54
54
|
const { start } = await import('./commands/start.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LogbookConfig } from './config.js';
|
|
2
2
|
import type { TimelineEntry } from './template-types.js';
|
|
3
|
-
export declare function mdToHtml(md: string): Promise<string>;
|
|
3
|
+
export declare function mdToHtml(md: string, prefix?: string): Promise<string>;
|
|
4
4
|
/** Process entry markdown with image path rewriting */
|
|
5
5
|
export declare function mdToHtmlWithImagePathRewrite(md: string): Promise<string>;
|
|
6
6
|
export declare function buildProjectMdFiles(projectRoot: string, outputDir: string, excludeDirs: string[], ctx: {
|
|
@@ -19,4 +19,4 @@ export declare function renderPost(data: TimelineEntry, i: number, allEntries: T
|
|
|
19
19
|
* Generate the standard footer metadata string.
|
|
20
20
|
* Always hardcoded to 'Project Logbook CLI' with link to npm.
|
|
21
21
|
*/
|
|
22
|
-
export declare
|
|
22
|
+
export declare const generateBuildMeta: (version: string, buildTime: string) => string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
|
-
import { join } from 'node:path';
|
|
2
|
+
import { join, relative } from 'node:path';
|
|
3
3
|
import matter from 'gray-matter';
|
|
4
4
|
import { layout, postTemplate } from './templates.js';
|
|
5
5
|
import { getGitCommits } from './git-helpers.js';
|
|
@@ -11,43 +11,43 @@ import { mdToHtmlWithImages, extractImagePathsFromMarkdown, copyImages, rehypeRe
|
|
|
11
11
|
import { transformLogToTimeline } from '../utils/log-timeline.js';
|
|
12
12
|
const processor = createGeneralMarkdownProcessor(rehypeRewriteMdLinks);
|
|
13
13
|
const entryProcessor = createEntryMarkdownProcessor(rehypeRewriteMdLinks, rehypeRewriteImagePaths);
|
|
14
|
-
export async function mdToHtml(md) {
|
|
15
|
-
const
|
|
16
|
-
return
|
|
14
|
+
export async function mdToHtml(md, prefix) {
|
|
15
|
+
const proc = prefix ? createGeneralMarkdownProcessor(rehypeRewriteMdLinks, { prefix }) : processor;
|
|
16
|
+
return (await proc.process(md)).toString();
|
|
17
17
|
}
|
|
18
18
|
/** Process entry markdown with image path rewriting */
|
|
19
19
|
export async function mdToHtmlWithImagePathRewrite(md) {
|
|
20
|
-
|
|
21
|
-
return result.toString();
|
|
20
|
+
return (await entryProcessor.process(md)).toString();
|
|
22
21
|
}
|
|
23
22
|
export async function buildProjectMdFiles(projectRoot, outputDir, excludeDirs, ctx) {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
23
|
+
const scan = (dir) => {
|
|
24
|
+
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((e) => {
|
|
25
|
+
if (e.name.startsWith('.') || excludeDirs.includes(e.name))
|
|
26
|
+
return [];
|
|
27
|
+
const p = join(dir, e.name);
|
|
28
|
+
return e.isDirectory() ? scan(p) : e.name.endsWith('.md') ? [relative(projectRoot, p)] : [];
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
for (const relPath of scan(projectRoot)) {
|
|
32
|
+
const relStem = relPath.replace(/\.md$/i, '');
|
|
33
|
+
const mdContent = await fs.readFile(join(projectRoot, relPath), 'utf8');
|
|
34
|
+
const title = relPath.split('/').pop()?.replace(/\.md$/i, '') || '';
|
|
36
35
|
const pageHtml = layout({
|
|
37
|
-
title
|
|
36
|
+
title,
|
|
38
37
|
projectName: ctx.config.projectName,
|
|
39
|
-
basePath: '../',
|
|
40
|
-
buildMeta,
|
|
41
|
-
header: `<header><h1>${
|
|
42
|
-
content:
|
|
38
|
+
basePath: '../'.repeat(relStem.split('/').length),
|
|
39
|
+
buildMeta: generateBuildMeta(ctx.version, ctx.buildTime),
|
|
40
|
+
header: `<header><h1>${title}</h1></header>`,
|
|
41
|
+
content: await mdToHtml(mdContent, '../'),
|
|
43
42
|
});
|
|
44
|
-
await fs.mkdirp(
|
|
45
|
-
await fs.writeFile(join(
|
|
43
|
+
await fs.mkdirp(join(outputDir, relStem));
|
|
44
|
+
await fs.writeFile(join(outputDir, relStem, 'index.html'), pageHtml);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
async function renderLinkedMdFiles(markdownSources, entryPath, entryOutputDir, ctx) {
|
|
49
48
|
const linkRegex = /\[.*?\]\(([^)]+\.md(?:#[^)]*)?)?\)/gi;
|
|
50
49
|
const seen = new Set();
|
|
50
|
+
const projectRoot = fs.realpathSync(process.cwd());
|
|
51
51
|
for (const source of markdownSources) {
|
|
52
52
|
let match;
|
|
53
53
|
linkRegex.lastIndex = 0;
|
|
@@ -56,42 +56,34 @@ async function renderLinkedMdFiles(markdownSources, entryPath, entryOutputDir, c
|
|
|
56
56
|
if (!raw)
|
|
57
57
|
continue;
|
|
58
58
|
const href = raw.split('#')[0];
|
|
59
|
-
if (!href)
|
|
60
|
-
continue;
|
|
61
|
-
if (isExternalUrl(href))
|
|
59
|
+
if (!href || isExternalUrl(href))
|
|
62
60
|
continue;
|
|
63
61
|
if (seen.has(href))
|
|
64
62
|
continue;
|
|
65
63
|
seen.add(href);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (!sourcePath || !(await pathExistsOrNull(sourcePath))) {
|
|
64
|
+
const sourcePath = (await pathExistsOrNull(join(entryPath, href))) ?? (await pathExistsOrNull(join(projectRoot, href)));
|
|
65
|
+
if (!sourcePath) {
|
|
69
66
|
console.warn(` Linked file not found, skipping: ${href}`);
|
|
70
67
|
continue;
|
|
71
68
|
}
|
|
72
|
-
// Path traversal protection: ensure resolved path stays within project boundaries
|
|
73
69
|
const resolvedPath = fs.realpathSync(sourcePath);
|
|
74
|
-
const projectRoot = fs.realpathSync(process.cwd());
|
|
75
70
|
if (!resolvedPath.startsWith(projectRoot + '/') && resolvedPath !== projectRoot) {
|
|
76
71
|
console.warn(` Path traversal blocked: ${href}`);
|
|
77
72
|
continue;
|
|
78
73
|
}
|
|
79
74
|
const mdContent = await fs.readFile(sourcePath, 'utf8');
|
|
80
|
-
const bodyHtml = await mdToHtml(mdContent);
|
|
81
75
|
const title = href.replace(/\.md$/i, '');
|
|
82
|
-
const
|
|
76
|
+
const stem = href.replace(/\.md$/i, '').replace(/^\.\//, '');
|
|
83
77
|
const pageHtml = layout({
|
|
84
78
|
title,
|
|
85
79
|
projectName: ctx.config.projectName,
|
|
86
80
|
basePath: '../',
|
|
87
|
-
buildMeta,
|
|
81
|
+
buildMeta: generateBuildMeta(ctx.version, ctx.buildTime),
|
|
88
82
|
header: `<header><h1>${title}</h1></header>`,
|
|
89
|
-
content:
|
|
83
|
+
content: await mdToHtml(mdContent, '../'),
|
|
90
84
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
await fs.mkdirp(outDir);
|
|
94
|
-
await fs.writeFile(join(outDir, 'index.html'), pageHtml);
|
|
85
|
+
await fs.mkdirp(join(entryOutputDir, stem));
|
|
86
|
+
await fs.writeFile(join(entryOutputDir, stem, 'index.html'), pageHtml);
|
|
95
87
|
}
|
|
96
88
|
}
|
|
97
89
|
}
|
|
@@ -108,15 +100,15 @@ export async function renderPost(data, i, allEntries, ctx, isResearch = false, c
|
|
|
108
100
|
const logRaw = await readFileIfExists(entryFilePaths.log);
|
|
109
101
|
// Process with image collection for index.md content
|
|
110
102
|
const { html: storyHtml, imagePaths: storyImages } = await mdToHtmlWithImages(content.replace(/^#\s+.+$/m, '').trim());
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
const allImagePaths = [
|
|
104
|
+
...storyImages,
|
|
105
|
+
...extractImagePathsFromMarkdown(ticketRaw),
|
|
106
|
+
...extractImagePathsFromMarkdown(logRaw),
|
|
107
|
+
];
|
|
115
108
|
const commits = await getGitCommits(entryPath);
|
|
116
109
|
const jiraUrl = ctx.config.jiraBaseUrl && data.ticket ? `${ctx.config.jiraBaseUrl}${data.ticket}` : undefined;
|
|
117
110
|
const prev = i > 0 ? allEntries[i - 1] : null;
|
|
118
111
|
const next = i < allEntries.length - 1 ? allEntries[i + 1] : null;
|
|
119
|
-
// Transform log to timeline if possible, otherwise fall back to plain markdown
|
|
120
112
|
const logHtml = logRaw ? await transformLogToTimeline(logRaw) : '';
|
|
121
113
|
const backLink = isResearch || customTypeName ? '../../index.html' : '../index.html';
|
|
122
114
|
const basePath = isResearch || customTypeName ? '../../' : '../';
|
|
@@ -135,33 +127,25 @@ export async function renderPost(data, i, allEntries, ctx, isResearch = false, c
|
|
|
135
127
|
nextEntry: next ? { slug: next.slug, title: next.title ?? '', ticket: next.ticket } : null,
|
|
136
128
|
backLink,
|
|
137
129
|
});
|
|
138
|
-
const descriptionRaw = typeof data.summary === 'string' ? data.summary.replace(/[*#`]/g, '').trim() : '';
|
|
139
|
-
const buildMeta = generateBuildMeta(ctx.version, ctx.buildTime);
|
|
140
130
|
const prevUrl = prev ? `../${prev.slug}/index.html` : undefined;
|
|
141
131
|
const nextUrl = next ? `../${next.slug}/index.html` : undefined;
|
|
142
132
|
const postHtml = layout({
|
|
143
133
|
title: data.title ?? data.slug,
|
|
144
134
|
projectName: ctx.config.projectName,
|
|
145
135
|
basePath,
|
|
146
|
-
description:
|
|
136
|
+
description: (typeof data.summary === 'string' ? data.summary.replace(/[*#`]/g, '').trim() : '').substring(0, 160),
|
|
147
137
|
bodySlug: data.slug,
|
|
148
|
-
buildMeta,
|
|
138
|
+
buildMeta: generateBuildMeta(ctx.version, ctx.buildTime),
|
|
149
139
|
header: postHeader,
|
|
150
140
|
content: postMainContent,
|
|
151
141
|
prevUrl,
|
|
152
142
|
nextUrl,
|
|
153
143
|
});
|
|
154
|
-
const entryOutputDir = customTypeName
|
|
155
|
-
? join(ctx.outputDir, customTypeName, data.slug)
|
|
156
|
-
: isResearch
|
|
157
|
-
? join(ctx.outputDir, 'research', data.slug)
|
|
158
|
-
: join(ctx.outputDir, data.slug);
|
|
144
|
+
const entryOutputDir = join(ctx.outputDir, customTypeName || (isResearch ? 'research' : ''), data.slug);
|
|
159
145
|
await fs.mkdirp(entryOutputDir);
|
|
160
146
|
await fs.writeFile(join(entryOutputDir, 'index.html'), postHtml);
|
|
161
|
-
// Copy images to output directory
|
|
162
147
|
if (allImagePaths.length > 0) {
|
|
163
|
-
|
|
164
|
-
await copyImages(entryPath, imagesOutputDir, allImagePaths);
|
|
148
|
+
await copyImages(entryPath, join(entryOutputDir, 'images'), allImagePaths);
|
|
165
149
|
}
|
|
166
150
|
await renderLinkedMdFiles([summaryContent, ticketRaw, logRaw], entryPath, entryOutputDir, ctx);
|
|
167
151
|
}
|
|
@@ -169,7 +153,5 @@ export async function renderPost(data, i, allEntries, ctx, isResearch = false, c
|
|
|
169
153
|
* Generate the standard footer metadata string.
|
|
170
154
|
* Always hardcoded to 'Project Logbook CLI' with link to npm.
|
|
171
155
|
*/
|
|
172
|
-
export
|
|
173
|
-
return `Generated by <a href="https://www.npmjs.com/package/project-logbook" target="_blank" rel="noopener noreferrer">Project Logbook CLI</a> v${version} • ${buildTime}`;
|
|
174
|
-
}
|
|
156
|
+
export const generateBuildMeta = (version, buildTime) => `Generated by <a href="https://www.npmjs.com/package/project-logbook" target="_blank" rel="noopener noreferrer">Project Logbook CLI</a> v${version} • ${buildTime}`;
|
|
175
157
|
//# sourceMappingURL=build-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-helpers.js","sourceRoot":"","sources":["../../src/lib/build-helpers.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C9E,2IAA2I,OAAO,MAAM,SAAS,EAAE,CAAC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { unified } from 'unified';
|
|
2
2
|
import type { Plugin } from 'unified';
|
|
3
3
|
import type { Root } from 'hast';
|
|
4
|
+
export interface RewriteMdLinksOptions {
|
|
5
|
+
prefix?: string;
|
|
6
|
+
}
|
|
4
7
|
/**
|
|
5
8
|
* Rehype plugin: rewrite relative .md links to /index.html equivalents.
|
|
6
9
|
*/
|
|
7
|
-
export declare const rehypeRewriteMdLinks: Plugin<[], Root>;
|
|
10
|
+
export declare const rehypeRewriteMdLinks: Plugin<[RewriteMdLinksOptions?], Root>;
|
|
8
11
|
/**
|
|
9
12
|
* General markdown processor for project files (README.md, etc.)
|
|
10
13
|
* Used for files that don't need image path rewriting
|
|
11
14
|
*/
|
|
12
|
-
export declare function createGeneralMarkdownProcessor(rehypeRewriteMdLinks: Plugin<[], Root
|
|
15
|
+
export declare function createGeneralMarkdownProcessor(rehypeRewriteMdLinks: Plugin<[RewriteMdLinksOptions?], Root>, options?: RewriteMdLinksOptions): ReturnType<typeof unified.prototype.use>;
|
|
13
16
|
/**
|
|
14
17
|
* Entry markdown processor with image path rewriting
|
|
15
18
|
* Used for logbook entry content (index.md, ticket.md, log.md)
|
|
@@ -10,7 +10,8 @@ import { isExternalUrlOrAnchor } from './url-helpers.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* Rehype plugin: rewrite relative .md links to /index.html equivalents.
|
|
12
12
|
*/
|
|
13
|
-
export const rehypeRewriteMdLinks = () => {
|
|
13
|
+
export const rehypeRewriteMdLinks = (options = {}) => {
|
|
14
|
+
const prefix = options.prefix ?? '';
|
|
14
15
|
return (tree) => {
|
|
15
16
|
visitHastElements(tree, 'a', (node) => {
|
|
16
17
|
const href = node.properties?.href;
|
|
@@ -23,7 +24,9 @@ export const rehypeRewriteMdLinks = () => {
|
|
|
23
24
|
return;
|
|
24
25
|
const base = mdMatch[1];
|
|
25
26
|
const fragment = mdMatch[2] ?? '';
|
|
26
|
-
|
|
27
|
+
const isRelative = !base.startsWith('/') && !base.startsWith('http://') && !base.startsWith('https://');
|
|
28
|
+
const finalBase = (isRelative ? `${prefix}${base}` : base).replace(/\/\.\//g, '/');
|
|
29
|
+
node.properties.href = `${finalBase}/index.html${fragment}`;
|
|
27
30
|
});
|
|
28
31
|
};
|
|
29
32
|
};
|
|
@@ -36,17 +39,16 @@ export const rehypeRewriteMdLinks = () => {
|
|
|
36
39
|
function createMarkdownProcessor(plugins = []) {
|
|
37
40
|
const processor = unified().use(remarkParse).use(remarkGfm).use(remarkRehype);
|
|
38
41
|
// Apply custom plugins before formatting
|
|
39
|
-
|
|
40
|
-
processor.use(plugin);
|
|
41
|
-
}
|
|
42
|
+
processor.use(plugins);
|
|
42
43
|
return processor.use(rehypeSlug).use(rehypeFormat).use(rehypeStringify);
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
46
|
* General markdown processor for project files (README.md, etc.)
|
|
46
47
|
* Used for files that don't need image path rewriting
|
|
47
48
|
*/
|
|
48
|
-
export function createGeneralMarkdownProcessor(rehypeRewriteMdLinks) {
|
|
49
|
-
|
|
49
|
+
export function createGeneralMarkdownProcessor(rehypeRewriteMdLinks, options) {
|
|
50
|
+
const pluginArg = options ? [rehypeRewriteMdLinks, options] : rehypeRewriteMdLinks;
|
|
51
|
+
return createMarkdownProcessor([pluginArg]);
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
52
54
|
* Entry markdown processor with image path rewriting
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-processors.js","sourceRoot":"","sources":["../../src/lib/markdown-processors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,UAAU,MAAM,aAAa,CAAC;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EzC,OAAO,uBAAuB,CAAC,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,CAAC,CAAC;AAClF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAC5C,qBAAuC,EACvC,uBAAyC,EACzC,oBAAuC;IAEvC,MAAM,OAAO,GAAmC,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC;IACjG,IAAI,oBAAoB,EAAE,CAAC;QACzB,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -65,7 +65,17 @@ Once the work is ready:
|
|
|
65
65
|
|
|
66
66
|
The linter enforces rules to be followed.
|
|
67
67
|
|
|
68
|
-
### 4.
|
|
68
|
+
### 4. Interactive Local QA Loop
|
|
69
|
+
Development is an iterative process. Expect to go through several feedback loops with the prompter before a ticket is finalized:
|
|
70
|
+
- **Test & Challenge**: The prompter will run and test your changes, challenge architectural patterns, and suggest revisions.
|
|
71
|
+
- **Cycle Routine**: During each feedback round:
|
|
72
|
+
1. Update code according to feedback.
|
|
73
|
+
2. Log key decisions, errors, and pivots in `log.md` (`logbook log "..."`).
|
|
74
|
+
3. Keep the story in `index.md` fully up-to-date with any design/code changes.
|
|
75
|
+
4. Run `npm run pre` to verify linting and tests pass.
|
|
76
|
+
- **Commit Optimization**: Once the implementation is solid, optimize the final git commit message to match project standards before releasing.
|
|
77
|
+
|
|
78
|
+
### 5. Final Review
|
|
69
79
|
Use the preview command to see how your entry looks in the context of the whole project:
|
|
70
80
|
```bash
|
|
71
81
|
logbook preview
|
|
@@ -88,9 +98,31 @@ If `jiraPrefix` is configured, entry folder names and ticket references must mat
|
|
|
88
98
|
|
|
89
99
|
## Research Logs
|
|
90
100
|
For exploratory research, technical spike investigations, and architectural decision groundwork, we use **Research Logs**.
|
|
91
|
-
|
|
92
|
-
- **
|
|
101
|
+
|
|
102
|
+
- **Required Setup**: Before creating your first research log, ensure that your configured research directory exists on your filesystem (for example, create it using `mkdir -p docs/research`).
|
|
103
|
+
- **Location**: Stored in `docs/research/` (configurable via `researchDir` in `.project-logbook`).
|
|
104
|
+
- **Scaffolding**: Run `logbook new [ID] [Slug] --research` or `logbook new -r` to scaffold. This automatically generates a numeric ID prefixed with `RES-` (e.g., `RES-1`).
|
|
93
105
|
- **Commands**: Commands like `logbook start RES-1`, `logbook log`, and `logbook release` work transparently.
|
|
94
106
|
- **Auto-Activity Tracking**: Writing a log message via `logbook log` automatically updates the `updated` frontmatter field inside the research log's `index.md`.
|
|
95
107
|
- **Status Lifecycle**: The frontmatter `status` field tracks progress: `active`, `paused`, `postponed`, or `completed`.
|
|
96
108
|
- **Visuals**: Research logs are compiled and displayed under a dedicated "Research" tab on the built logbook homepage, sorted by their latest `updated` date.
|
|
109
|
+
|
|
110
|
+
## Custom Storyline Types
|
|
111
|
+
Beyond standard logbook entries and Research Logs, you can define completely custom storyline types (e.g., "analyses", "spikes", "decisions") in `.project-logbook`.
|
|
112
|
+
|
|
113
|
+
- **Required Setup**: Define the custom types inside your `.project-logbook` configuration file under `customTypes` and ensure the directory exists on your filesystem:
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"customTypes": {
|
|
117
|
+
"analyses": {
|
|
118
|
+
"prefix": "ANA",
|
|
119
|
+
"dir": "docs/analyses",
|
|
120
|
+
"tabTitle": "Analyses",
|
|
121
|
+
"sortBy": "updated"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
- **Directory Setup**: Ensure the directory configured (e.g., `docs/analyses`) is created on your filesystem (for example, create it using `mkdir -p docs/analyses`).
|
|
127
|
+
- **Scaffolding**: Run `logbook new [ID] [Slug] --type analyses` or `logbook new -t analyses` to scaffold the entry.
|
|
128
|
+
- **Visuals**: Just like Research Logs, these custom types will automatically compile into dedicated tabs on the built logbook homepage using your specified `tabTitle`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: [ID_NUM]
|
|
3
|
+
title: [YAML_TITLE]
|
|
4
|
+
status: "proposed"
|
|
5
|
+
date: [DATE]
|
|
6
|
+
author: "[AUTHOR]"
|
|
7
|
+
superseded_by: null
|
|
8
|
+
tags: []
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# ADR [ID]: [TITLE]
|
|
12
|
+
|
|
13
|
+
## Context
|
|
14
|
+
[Describe the issue motivating this decision and any context that influences it.]
|
|
15
|
+
|
|
16
|
+
## Considered Options
|
|
17
|
+
1. **[Option A]**: [Brief description.]
|
|
18
|
+
2. **[Option B]**: [Brief description.]
|
|
19
|
+
|
|
20
|
+
## Decision
|
|
21
|
+
[State the decision and briefly explain what it means in practice.]
|
|
22
|
+
|
|
23
|
+
## Rationale
|
|
24
|
+
[Explain why this option was chosen over the alternatives.]
|
|
25
|
+
|
|
26
|
+
## Consequences
|
|
27
|
+
|
|
28
|
+
### Positive
|
|
29
|
+
* [Benefit 1]
|
|
30
|
+
* [Benefit 2]
|
|
31
|
+
|
|
32
|
+
### Negative
|
|
33
|
+
* [Drawback 1]
|
|
34
|
+
* [Drawback 2]
|
package/dist/templates/index.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# The ticket field should match the ID portion (e.g., LB-34)
|
|
3
3
|
ticket: {{id}}
|
|
4
4
|
# The title should be a human-readable description of the work
|
|
5
|
-
title: {{
|
|
5
|
+
title: {{yamlTitle}}
|
|
6
6
|
prompter: "[PROMPTER]"
|
|
7
7
|
harness: "[HARNESS]"
|
|
8
8
|
llm: "[LLM]"
|
|
@@ -27,9 +27,10 @@ TODO: Write a polished, highly readable ticket summary that reads like an engagi
|
|
|
27
27
|
|
|
28
28
|
### Formatting & Style Rules:
|
|
29
29
|
- **Maintain the narrative tone:** TODO: Keep the storytelling flair (e.g., describing how problems accumulated or how gaps surfaced), but stay strictly factual based on the provided changes.
|
|
30
|
-
- **Add thematic headings:** TODO: Break the narrative down into logical chapters using Markdown
|
|
31
|
-
- **
|
|
30
|
+
- **Add thematic headings:** TODO: Break the narrative down into logical chapters using action-oriented Markdown subheadings that describe what was improved/solved (e.g., ### Improving TabGroup Accessibility, ### Binding Dialog Colors to the Theme) rather than dry, generic headers like "Friction" or "The Fix".
|
|
31
|
+
- **Avoid forced bullet points:** TODO: Write in natural, flowing paragraphs (like in a dev blog post). Only use bullet points for actual, simple lists of items (e.g., list of modified files or configuration options), never to structure or split your main story thoughts.
|
|
32
32
|
- **Use bold emphasis:** TODO: Bold key concepts, problems, and solutions to guide the reader's eye.
|
|
33
33
|
- **Format code:** TODO: Use inline backticks for files, plugins, HTML elements, and code snippets (e.g., `src/lib/build-helpers.ts`).
|
|
34
|
-
- **Keep paragraphs short:** TODO: Ensure no paragraph is longer than
|
|
34
|
+
- **Keep paragraphs short:** TODO: Ensure no paragraph is longer than 4 sentences. Keep the pacing quick and engaging.
|
|
35
|
+
- **Weave the narrative:** TODO: Do not list all friction points in one massive block followed by all fixes/solutions in another. Instead, weave them together chronologically or by component/theme (e.g., describe the friction and its corresponding fix within the same chapter or paragraph).
|
|
35
36
|
- **Do not state the obvious**: TODO: Passed tests, lints, pre-commit suites are mandatory and no ticket is released without this. This does not need to be mentioned
|
package/dist/templates/steer.txt
CHANGED
|
@@ -33,9 +33,22 @@ You MUST log your work continuously using `logbook log "<message>"`. This is not
|
|
|
33
33
|
Phase 3: Synthesize
|
|
34
34
|
1. When implementation is finished, write the narrative in `index.md`.
|
|
35
35
|
2. Storytelling Mode: Explain the "Why" and the "Journey." Avoid simple technical bullet points.
|
|
36
|
+
- **Keep paragraphs short**: Max 4 sentences per paragraph to ensure fast-paced, readable prose.
|
|
37
|
+
- **Use bold & code formatting**: Use inline backticks for files/code, and bolding for key terms/problems.
|
|
38
|
+
- **Structure with H3 headings**: Use action-oriented subheadings describing the topic/component modified (e.g., ### Improving TabGroup Accessibility, ### Binding Dialog Colors to the Theme) instead of generic "Friction" or "Fix" headers.
|
|
39
|
+
- **Avoid forced lists**: Write in natural, flowing paragraphs. Only use bullet points for simple lists of items (e.g., files modified, options checked), never to split or structure your core narrative thoughts.
|
|
40
|
+
- **Weave friction & fix**: Do not separate all problems into one block and all solutions into another. Weave them together chronologically or group them by component/theme.
|
|
36
41
|
3. Clean up all template placeholders and complete the frontmatter (author, summary, dates).
|
|
37
42
|
|
|
38
43
|
Phase 4: Verify
|
|
39
44
|
1. Run `npm run pre` (which includes `logbook lint` and other quality gates).
|
|
40
45
|
2. Ensure there are no linter errors, unreplaced placeholders, or architectural violations before concluding your work.
|
|
41
|
-
3. Hand back to the prompter
|
|
46
|
+
3. Hand back to the prompter for local QA/review.
|
|
47
|
+
|
|
48
|
+
Phase 5: Local QA & Iterative Refinement
|
|
49
|
+
1. Expect feedback loops: The prompter will test your changes, challenge decisions, and request refinements.
|
|
50
|
+
2. In each iteration loop:
|
|
51
|
+
- Log decisions and pivots in `log.md` in real-time (`logbook log "<message>"`).
|
|
52
|
+
- Update the story in `index.md` to reflect any design/code changes.
|
|
53
|
+
- Run verification again (`npm run pre`).
|
|
54
|
+
3. Optimize the git commit message (conforming to project standards) before final release.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard-library CLI selection menu using Node's readline and raw mode.
|
|
3
|
+
* Moves cursor up/down, handles carriage return, Ctrl+C to abort, and hides the cursor.
|
|
4
|
+
* ponytail: simple raw-mode keyboard selection, no massive external prompt libraries.
|
|
5
|
+
*/
|
|
6
|
+
export declare function selectPrompt(message: string, choices: string[]): Promise<number>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import readline from 'node:readline';
|
|
2
|
+
/**
|
|
3
|
+
* Standard-library CLI selection menu using Node's readline and raw mode.
|
|
4
|
+
* Moves cursor up/down, handles carriage return, Ctrl+C to abort, and hides the cursor.
|
|
5
|
+
* ponytail: simple raw-mode keyboard selection, no massive external prompt libraries.
|
|
6
|
+
*/
|
|
7
|
+
export async function selectPrompt(message, choices) {
|
|
8
|
+
if (choices.length === 0) {
|
|
9
|
+
return -1;
|
|
10
|
+
}
|
|
11
|
+
const { stdin, stdout } = process;
|
|
12
|
+
// Non-interactive / non-TTY fallback to prevent hanging in CI/scripts
|
|
13
|
+
if (!stdin.isTTY) {
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
return new Promise((resolve) => {
|
|
17
|
+
let index = 0;
|
|
18
|
+
const render = () => {
|
|
19
|
+
stdout.write('\r\x1B[K' + message + '\n');
|
|
20
|
+
choices.forEach((choice, i) => {
|
|
21
|
+
const prefix = i === index ? '> ' : ' ';
|
|
22
|
+
stdout.write('\x1B[K' + prefix + choice + '\n');
|
|
23
|
+
});
|
|
24
|
+
// Move cursor back up to the start of the list
|
|
25
|
+
stdout.write(`\x1B[${choices.length + 1}A`);
|
|
26
|
+
};
|
|
27
|
+
readline.emitKeypressEvents(stdin);
|
|
28
|
+
stdin.setRawMode(true);
|
|
29
|
+
stdout.write('\x1B[?25l'); // Hide cursor
|
|
30
|
+
render();
|
|
31
|
+
const onKey = (_str, key) => {
|
|
32
|
+
if (key.name === 'up') {
|
|
33
|
+
index = (index - 1 + choices.length) % choices.length;
|
|
34
|
+
render();
|
|
35
|
+
}
|
|
36
|
+
else if (key.name === 'down') {
|
|
37
|
+
index = (index + 1) % choices.length;
|
|
38
|
+
render();
|
|
39
|
+
}
|
|
40
|
+
else if (key.name === 'return') {
|
|
41
|
+
cleanup();
|
|
42
|
+
resolve(index);
|
|
43
|
+
}
|
|
44
|
+
else if (key.ctrl && key.name === 'c') {
|
|
45
|
+
cleanup();
|
|
46
|
+
process.exit(130); // 130 is standard SIGINT exit code
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const cleanup = () => {
|
|
50
|
+
// Move cursor down past choices and show cursor again
|
|
51
|
+
stdout.write(`\x1B[${choices.length + 1}B\x1B[?25h\r`);
|
|
52
|
+
stdin.removeListener('keypress', onKey);
|
|
53
|
+
stdin.setRawMode(false);
|
|
54
|
+
stdin.pause(); // ponytail: pause stdin so Node can exit instead of hanging
|
|
55
|
+
};
|
|
56
|
+
stdin.on('keypress', onKey);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAe,EAAE,OAAiB;IACnE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAElC,sEAAsE;IACtE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,KAAK,GAAG,CAAC,CAAC;QAEd,MAAM,MAAM,GAAG,GAAG,EAAE;YAClB,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;YAC1C,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC5B,MAAM,MAAM,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;gBACzC,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC;YACH,+CAA+C;YAC/C,MAAM,CAAC,KAAK,CAAC,QAAQ,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC,CAAC;QAEF,QAA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C,CAAC;QAEF,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "project-logbook",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A command-line tool for project logbooks.",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"demo-app"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"madge": "madge --circular --extensions ts --ts-config ./tsconfig.json src/index.ts",
|
|
28
28
|
"jscpd": "jscpd src",
|
|
29
29
|
"test": "vitest run",
|
|
30
|
-
"pre": "npm run format && npm run lint && npm run test && npm run build && npm run knip && npm run madge && npm run jscpd && npm run dev build && npm run dev lint && npm audit",
|
|
30
|
+
"pre": "npm run format && npm run lint && npm run test && npm run build && npm run knip && npm run madge && npm run jscpd && npm run dev build && npm run dev lint && npm audit --audit-level=high",
|
|
31
31
|
"next": "node scripts/create-ticket-from-backlog.js",
|
|
32
32
|
"link": "npm run build && npm link",
|
|
33
33
|
"open": "npm run dev build && node scripts/open-and-view-dist.js"
|