project-logbook 0.3.3 → 0.4.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.
Files changed (75) hide show
  1. package/dist/commands/build.js +54 -76
  2. package/dist/commands/init.js +11 -11
  3. package/dist/commands/lint.js +27 -10
  4. package/dist/commands/list.js +18 -18
  5. package/dist/commands/log.js +5 -5
  6. package/dist/commands/new.js +19 -20
  7. package/dist/commands/preview.js +9 -8
  8. package/dist/commands/release.js +6 -6
  9. package/dist/commands/start.js +26 -21
  10. package/dist/commands/status.d.ts +1 -0
  11. package/dist/commands/status.js +138 -0
  12. package/dist/commands/steer.js +9 -9
  13. package/dist/commands/upgrade.js +5 -5
  14. package/dist/index.js +9 -8
  15. package/dist/lib/build-helpers.js +30 -67
  16. package/dist/lib/build-steps.d.ts +20 -0
  17. package/dist/lib/build-steps.js +57 -0
  18. package/dist/lib/config.d.ts +17 -0
  19. package/dist/lib/config.js +27 -3
  20. package/dist/lib/entry-id.d.ts +22 -0
  21. package/dist/lib/entry-id.js +26 -0
  22. package/dist/lib/entry-paths.d.ts +23 -0
  23. package/dist/lib/entry-paths.js +55 -0
  24. package/dist/lib/git-helpers.d.ts +32 -1
  25. package/dist/lib/git-helpers.js +119 -26
  26. package/dist/lib/hast-helpers.d.ts +10 -0
  27. package/dist/lib/hast-helpers.js +22 -0
  28. package/dist/lib/html-attributes.d.ts +17 -0
  29. package/dist/lib/html-attributes.js +17 -0
  30. package/dist/lib/html-escape.d.ts +16 -0
  31. package/dist/lib/html-escape.js +38 -0
  32. package/dist/lib/image-helpers.js +26 -33
  33. package/dist/lib/lint-runner.js +5 -5
  34. package/dist/lib/markdown-processors.d.ts +22 -0
  35. package/dist/lib/markdown-processors.js +68 -0
  36. package/dist/lib/package-version.d.ts +5 -0
  37. package/dist/lib/package-version.js +16 -0
  38. package/dist/lib/rss.d.ts +29 -0
  39. package/dist/lib/rss.js +77 -0
  40. package/dist/lib/styles.js +5 -2
  41. package/dist/lib/template-helpers.d.ts +4 -3
  42. package/dist/lib/template-helpers.js +51 -27
  43. package/dist/lib/template-types.d.ts +2 -2
  44. package/dist/lib/templates.d.ts +12 -3
  45. package/dist/lib/templates.js +59 -52
  46. package/dist/lib/theme.d.ts +37 -0
  47. package/dist/lib/theme.js +50 -0
  48. package/dist/lib/url-helpers.d.ts +13 -0
  49. package/dist/lib/url-helpers.js +27 -0
  50. package/dist/linters/diff-to-narrative.d.ts +6 -0
  51. package/dist/linters/diff-to-narrative.js +114 -0
  52. package/dist/linters/index.js +4 -0
  53. package/dist/linters/technical-log.d.ts +7 -0
  54. package/dist/linters/technical-log.js +72 -0
  55. package/dist/templates/CONTRIBUTING.md +12 -3
  56. package/dist/templates/index.md +10 -6
  57. package/dist/templates/log.md +5 -0
  58. package/dist/templates/logbook-client.js +42 -16
  59. package/dist/templates/steer.txt +21 -5
  60. package/dist/templates/styles.css +121 -0
  61. package/dist/utils/date.d.ts +30 -1
  62. package/dist/utils/date.js +68 -15
  63. package/dist/utils/frontmatter.d.ts +26 -0
  64. package/dist/utils/frontmatter.js +37 -0
  65. package/dist/utils/fs.d.ts +13 -0
  66. package/dist/utils/fs.js +23 -0
  67. package/dist/utils/log-timeline.d.ts +69 -0
  68. package/dist/utils/log-timeline.js +218 -0
  69. package/package.json +4 -2
  70. package/src/templates/CONTRIBUTING.md +12 -3
  71. package/src/templates/index.md +10 -6
  72. package/src/templates/log.md +5 -0
  73. package/src/templates/logbook-client.js +42 -16
  74. package/src/templates/steer.txt +21 -5
  75. package/src/templates/styles.css +121 -0
@@ -2,27 +2,40 @@
2
2
  'use strict';
3
3
 
4
4
  /* ── 1. Real-time relative dates ──────────────────────────────────────── */
5
- function relativeDate(isoString) {
6
- var d = new Date(isoString);
5
+ /**
6
+ * Calculate the relative date string (today, yesterday, 2 days ago, etc)
7
+ * Prepend the relative component to the locally-formatted absolute date.
8
+ */
9
+ function getRelativeComponent(d) {
7
10
  var now = new Date();
8
11
  // Normalise both to midnight local time for day-diff calculation
9
12
  var dDay = new Date(d.getFullYear(), d.getMonth(), d.getDate());
10
13
  var nDay = new Date(now.getFullYear(), now.getMonth(), now.getDate());
11
14
  var diffDays = Math.round((nDay - dDay) / 86400000);
12
15
 
13
- var relative;
14
- if (diffDays === 0) relative = 'today';
15
- else if (diffDays === 1) relative = 'yesterday';
16
- else if (diffDays < 7) relative = diffDays + ' days ago';
17
- else if (diffDays < 14) relative = '1 week ago';
18
- else if (diffDays < 30) relative = Math.floor(diffDays / 7) + ' weeks ago';
19
- else if (diffDays < 60) relative = '1 month ago';
20
- else if (diffDays < 365) relative = Math.floor(diffDays / 30) + ' months ago';
21
- else if (diffDays < 730) relative = '1 year ago';
22
- else relative = Math.floor(diffDays / 365) + ' years ago';
23
-
24
- var absolute = d.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' });
25
- return relative + ', ' + absolute;
16
+ if (diffDays === 0) return 'today';
17
+ else if (diffDays === 1) return 'yesterday';
18
+ else if (diffDays < 7) return diffDays + ' days ago';
19
+ else if (diffDays < 14) return '1 week ago';
20
+ else if (diffDays < 30) return Math.floor(diffDays / 7) + ' weeks ago';
21
+ else if (diffDays < 60) return '1 month ago';
22
+ else if (diffDays < 365) return Math.floor(diffDays / 30) + ' months ago';
23
+ else if (diffDays < 730) return '1 year ago';
24
+ else return Math.floor(diffDays / 365) + ' years ago';
25
+ }
26
+
27
+ /**
28
+ * Format a Date object as absolute date and time in browser's local timezone.
29
+ * Format: "26 May 2026, 10:51"
30
+ */
31
+ function formatAbsoluteComponent(d) {
32
+ var day = d.getDate();
33
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
34
+ var month = months[d.getMonth()];
35
+ var year = d.getFullYear();
36
+ var hours = d.getHours() < 10 ? '0' + d.getHours() : d.getHours();
37
+ var minutes = d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes();
38
+ return day + ' ' + month + ' ' + year + ', ' + hours + ':' + minutes;
26
39
  }
27
40
 
28
41
  function updateRelativeDates() {
@@ -30,7 +43,20 @@
30
43
  for (var i = 0; i < els.length; i++) {
31
44
  var el = els[i];
32
45
  var iso = el.getAttribute('data-date');
33
- if (iso) el.textContent = relativeDate(iso);
46
+ if (iso) {
47
+ var d = new Date(iso);
48
+ if (!isNaN(d.getTime())) {
49
+ // Format the absolute date in the user's browser/local timezone
50
+ var absolute = formatAbsoluteComponent(d);
51
+ // Prepend the relative component (e.g., "today")
52
+ var relative = getRelativeComponent(d);
53
+ if (relative) {
54
+ el.textContent = relative + ', ' + absolute;
55
+ } else {
56
+ el.textContent = absolute;
57
+ }
58
+ }
59
+ }
34
60
  }
35
61
  }
36
62
 
@@ -8,11 +8,27 @@ Phase 1: Understand
8
8
  2. Review `AGENTS.md` and `CONTRIBUTING.md` if you need architectural or workflow context.
9
9
 
10
10
  Phase 2: Execute & Trace
11
- 1. Use `log.md` as a live technical scratchpad.
12
- 2. Log your work in real-time using the `logbook log "<message>"` command. Record every major decision, error, and pivot. Do not reconstruct this at the end.
13
- Example: logbook log "Investigated root cause found issue in src/lib/config.ts"
14
- One message per call. For multiple entries, call the command once per message.
15
- 3. Stick to the active entry; never modify past entries in the logbook folder.
11
+
12
+ **CRITICAL: Real-Time Logging**
13
+ You MUST log your work continuously using `logbook log "<message>"`. This is not optional.
14
+
15
+ 1. Use `log.md` as your live technical scratchpad.
16
+ 2. After EVERY significant step, run: `logbook log "<what you just did>"`
17
+ - Investigated a file? Log it.
18
+ - Found an error? Log it.
19
+ - Made a design decision? Log it.
20
+ - Fixed a bug? Log it.
21
+ - Ran tests? Log the result.
22
+
23
+ Examples:
24
+ - `logbook log "Investigated src/lib/config.ts - found missing validation"`
25
+ - `logbook log "Created new RSS module with generateRssFeed() function"`
26
+ - `logbook log "Test failed: TypeScript error on line 42 - fixed type assertion"`
27
+ - `logbook log "All 127 tests pass, pre-commit suite successful"`
28
+
29
+ 3. **One message per command call.** For multiple entries, call the command multiple times.
30
+ 4. Do NOT reconstruct the log at the end. If the log is empty when you finish, you did it wrong.
31
+ 5. Stick to the active entry; never modify past entries in the logbook folder.
16
32
 
17
33
  Phase 3: Synthesize
18
34
  1. When implementation is finished, write the narrative in `index.md`.
@@ -33,6 +33,11 @@ header h1 {
33
33
  header h1 a {
34
34
  text-decoration: none !important;
35
35
  color: black !important;
36
+ transition: color 0.2s;
37
+ }
38
+
39
+ header h1 a:hover {
40
+ color: var(--primary) !important;
36
41
  }
37
42
 
38
43
  .tagline {
@@ -691,3 +696,119 @@ article img[src$='.webp'],
691
696
  article img[src$='.svg'] {
692
697
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
693
698
  }
699
+
700
+ /* Technical Log Timeline */
701
+ #log .timeline {
702
+ list-style: none;
703
+ padding: 0;
704
+ margin: 0;
705
+ position: relative;
706
+ }
707
+
708
+ #log .timeline::before {
709
+ content: '';
710
+ position: absolute;
711
+ left: 8px;
712
+ top: 0;
713
+ bottom: 0;
714
+ width: 2px;
715
+ background: var(--border);
716
+ }
717
+
718
+ #log .timeline-entry {
719
+ position: relative;
720
+ padding-left: 2rem;
721
+ margin-bottom: 0.75rem;
722
+ min-height: 1.5rem;
723
+ display: grid;
724
+ grid-template-columns: 55px 1fr;
725
+ gap: 0.5rem;
726
+ }
727
+
728
+ #log .timeline-entry.no-time .timeline-message {
729
+ grid-column: 2;
730
+ }
731
+
732
+ #log .timeline-entry.has-time::before {
733
+ content: '';
734
+ position: absolute;
735
+ left: 5px;
736
+ top: 4px;
737
+ width: 8px;
738
+ height: 8px;
739
+ border-radius: 50%;
740
+ background: var(--primary);
741
+ border: 2px solid var(--bg);
742
+ z-index: 1;
743
+ }
744
+
745
+ #log .timeline-entry.no-time::before {
746
+ content: '';
747
+ position: absolute;
748
+ left: 7px;
749
+ top: 0.6rem;
750
+ width: 4px;
751
+ height: 4px;
752
+ border-radius: 50%;
753
+ background: var(--text-muted);
754
+ opacity: 0.6;
755
+ }
756
+
757
+ #log .timeline-time {
758
+ font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
759
+ font-size: 0.75rem;
760
+ font-weight: 600;
761
+ color: var(--primary);
762
+ display: inline-block;
763
+ }
764
+
765
+ #log .timeline-message {
766
+ font-size: 0.9375rem;
767
+ color: var(--text);
768
+ line-height: 1.5;
769
+ }
770
+
771
+ #log .timeline-entry.no-time .timeline-message {
772
+ color: var(--text);
773
+ opacity: 0.85;
774
+ }
775
+
776
+ #log .timeline-gap {
777
+ position: relative;
778
+ padding-left: 2rem;
779
+ margin: 1.5rem 0;
780
+ min-height: 1rem;
781
+ }
782
+
783
+ #log .timeline-gap::before {
784
+ content: '';
785
+ position: absolute;
786
+ left: 7px;
787
+ top: 0.4rem;
788
+ width: 4px;
789
+ height: 4px;
790
+ border-radius: 50%;
791
+ background: var(--text-muted);
792
+ opacity: 0.5;
793
+ }
794
+
795
+ #log .gap-indicator {
796
+ font-size: 0.8125rem;
797
+ color: var(--text-muted);
798
+ font-style: italic;
799
+ display: inline-flex;
800
+ align-items: center;
801
+ gap: 0.25rem;
802
+ }
803
+
804
+ #log .log-fallback {
805
+ font-size: 0.9375rem;
806
+ color: var(--text);
807
+ line-height: 1.6;
808
+ white-space: pre-wrap;
809
+ background: var(--primary-soft);
810
+ padding: 1rem;
811
+ border-radius: 0.5rem;
812
+ font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
813
+ font-size: 0.8125rem;
814
+ }