@cad0p/napkin 0.8.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.
Files changed (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +342 -0
  3. package/dist/commands/aliases.d.ts +7 -0
  4. package/dist/commands/aliases.js +25 -0
  5. package/dist/commands/bases.d.ts +23 -0
  6. package/dist/commands/bases.js +139 -0
  7. package/dist/commands/bookmarks.d.ts +15 -0
  8. package/dist/commands/bookmarks.js +51 -0
  9. package/dist/commands/canvas.d.ts +49 -0
  10. package/dist/commands/canvas.js +186 -0
  11. package/dist/commands/config.d.ts +13 -0
  12. package/dist/commands/config.js +48 -0
  13. package/dist/commands/crud.d.ts +40 -0
  14. package/dist/commands/crud.js +195 -0
  15. package/dist/commands/daily.d.ts +20 -0
  16. package/dist/commands/daily.js +58 -0
  17. package/dist/commands/files.d.ts +23 -0
  18. package/dist/commands/files.js +132 -0
  19. package/dist/commands/graph.d.ts +4 -0
  20. package/dist/commands/graph.js +461 -0
  21. package/dist/commands/init.d.ts +7 -0
  22. package/dist/commands/init.js +52 -0
  23. package/dist/commands/links.d.ts +26 -0
  24. package/dist/commands/links.js +119 -0
  25. package/dist/commands/outline.d.ts +7 -0
  26. package/dist/commands/outline.js +48 -0
  27. package/dist/commands/overview.d.ts +6 -0
  28. package/dist/commands/overview.js +40 -0
  29. package/dist/commands/properties.d.ts +24 -0
  30. package/dist/commands/properties.js +115 -0
  31. package/dist/commands/search.d.ts +13 -0
  32. package/dist/commands/search.js +48 -0
  33. package/dist/commands/tags.d.ts +13 -0
  34. package/dist/commands/tags.js +51 -0
  35. package/dist/commands/tasks.d.ts +22 -0
  36. package/dist/commands/tasks.js +106 -0
  37. package/dist/commands/templates.d.ts +16 -0
  38. package/dist/commands/templates.js +70 -0
  39. package/dist/commands/vault.d.ts +4 -0
  40. package/dist/commands/vault.js +17 -0
  41. package/dist/commands/wordcount.d.ts +7 -0
  42. package/dist/commands/wordcount.js +43 -0
  43. package/dist/core/aliases.d.ts +5 -0
  44. package/dist/core/aliases.js +26 -0
  45. package/dist/core/bases.d.ts +29 -0
  46. package/dist/core/bases.js +67 -0
  47. package/dist/core/bookmarks.d.ts +14 -0
  48. package/dist/core/bookmarks.js +34 -0
  49. package/dist/core/canvas.d.ts +74 -0
  50. package/dist/core/canvas.js +125 -0
  51. package/dist/core/config.d.ts +7 -0
  52. package/dist/core/config.js +35 -0
  53. package/dist/core/crud.d.ts +32 -0
  54. package/dist/core/crud.js +119 -0
  55. package/dist/core/daily.d.ts +12 -0
  56. package/dist/core/daily.js +102 -0
  57. package/dist/core/files.d.ts +15 -0
  58. package/dist/core/files.js +30 -0
  59. package/dist/core/init.d.ts +31 -0
  60. package/dist/core/init.js +119 -0
  61. package/dist/core/links.d.ts +11 -0
  62. package/dist/core/links.js +66 -0
  63. package/dist/core/outline.d.ts +3 -0
  64. package/dist/core/outline.js +12 -0
  65. package/dist/core/overview.d.ts +15 -0
  66. package/dist/core/overview.js +384 -0
  67. package/dist/core/properties.d.ts +14 -0
  68. package/dist/core/properties.js +60 -0
  69. package/dist/core/search.d.ts +17 -0
  70. package/dist/core/search.js +153 -0
  71. package/dist/core/tags.d.ts +11 -0
  72. package/dist/core/tags.js +40 -0
  73. package/dist/core/tasks.d.ts +35 -0
  74. package/dist/core/tasks.js +97 -0
  75. package/dist/core/templates.d.ts +14 -0
  76. package/dist/core/templates.js +55 -0
  77. package/dist/core/vault.d.ts +10 -0
  78. package/dist/core/vault.js +37 -0
  79. package/dist/core/wordcount.d.ts +5 -0
  80. package/dist/core/wordcount.js +16 -0
  81. package/dist/index.d.ts +17 -0
  82. package/dist/index.js +1 -0
  83. package/dist/main.d.ts +2 -0
  84. package/dist/main.js +715 -0
  85. package/dist/sdk.d.ts +179 -0
  86. package/dist/sdk.js +232 -0
  87. package/dist/templates/coding.d.ts +2 -0
  88. package/dist/templates/coding.js +104 -0
  89. package/dist/templates/company.d.ts +2 -0
  90. package/dist/templates/company.js +121 -0
  91. package/dist/templates/index.d.ts +4 -0
  92. package/dist/templates/index.js +15 -0
  93. package/dist/templates/personal.d.ts +2 -0
  94. package/dist/templates/personal.js +91 -0
  95. package/dist/templates/product.d.ts +2 -0
  96. package/dist/templates/product.js +123 -0
  97. package/dist/templates/research.d.ts +2 -0
  98. package/dist/templates/research.js +114 -0
  99. package/dist/templates/types.d.ts +7 -0
  100. package/dist/templates/types.js +1 -0
  101. package/dist/utils/bases.d.ts +61 -0
  102. package/dist/utils/bases.js +661 -0
  103. package/dist/utils/config.d.ts +42 -0
  104. package/dist/utils/config.js +112 -0
  105. package/dist/utils/exit-codes.d.ts +5 -0
  106. package/dist/utils/exit-codes.js +5 -0
  107. package/dist/utils/files.d.ts +135 -0
  108. package/dist/utils/files.js +299 -0
  109. package/dist/utils/formula.d.ts +28 -0
  110. package/dist/utils/formula.js +462 -0
  111. package/dist/utils/frontmatter.d.ts +17 -0
  112. package/dist/utils/frontmatter.js +34 -0
  113. package/dist/utils/markdown.d.ts +31 -0
  114. package/dist/utils/markdown.js +80 -0
  115. package/dist/utils/output.d.ts +28 -0
  116. package/dist/utils/output.js +48 -0
  117. package/dist/utils/search-cache.d.ts +29 -0
  118. package/dist/utils/search-cache.js +41 -0
  119. package/dist/utils/test-helpers.d.ts +13 -0
  120. package/dist/utils/test-helpers.js +40 -0
  121. package/dist/utils/vault.d.ts +21 -0
  122. package/dist/utils/vault.js +144 -0
  123. package/package.json +76 -0
@@ -0,0 +1,91 @@
1
+ export const personal = {
2
+ name: "personal",
3
+ description: "Personal assistant / life management",
4
+ dirs: ["people", "projects", "areas", "daily", "references"],
5
+ files: {
6
+ "people/_about.md": `# People
7
+
8
+ One note per person. Include context the agent needs — role, relationship, preferences, last interaction.
9
+ `,
10
+ "projects/_about.md": `# Projects
11
+
12
+ Active projects. Move completed ones to an archive/ subfolder.
13
+ `,
14
+ "areas/_about.md": `# Areas
15
+
16
+ Ongoing life areas — health, finance, career, home, etc. Unlike projects, these don't end.
17
+ `,
18
+ "references/_about.md": `# References
19
+
20
+ Articles, book notes, recipes, how-tos. Anything you want to find later.
21
+ `,
22
+ "Templates/Person.md": `---
23
+ role: ""
24
+ relationship: ""
25
+ last_contact: "{{date}}"
26
+ ---
27
+ # {{title}}
28
+
29
+ ## Context
30
+ Who is this person and how do I know them?
31
+
32
+ ## Notes
33
+ -
34
+ `,
35
+ "Templates/Project.md": `---
36
+ status: active
37
+ started: "{{date}}"
38
+ ---
39
+ # {{title}}
40
+
41
+ ## Goal
42
+ What's the outcome?
43
+
44
+ ## Tasks
45
+ - [ ]
46
+
47
+ ## Notes
48
+ -
49
+ `,
50
+ "Templates/Area.md": `---
51
+ date: "{{date}}"
52
+ ---
53
+ # {{title}}
54
+
55
+ ## Current state
56
+ Where am I with this?
57
+
58
+ ## Goals
59
+ -
60
+
61
+ ## Actions
62
+ - [ ]
63
+ `,
64
+ "Templates/Daily Note.md": `# {{date}}
65
+
66
+ ## Today
67
+ -
68
+
69
+ ## Tasks
70
+ - [ ]
71
+
72
+ ## Notes
73
+ -
74
+ `,
75
+ },
76
+ napkinMd: `# About me
77
+
78
+ ## Who am I?
79
+ Name, role, context the agent needs.
80
+
81
+ ## Current priorities
82
+ -
83
+
84
+ ## Preferences
85
+ - Communication style:
86
+ - Scheduling:
87
+
88
+ ## Key people
89
+ -
90
+ `,
91
+ };
@@ -0,0 +1,2 @@
1
+ import type { VaultTemplate } from "./types.js";
2
+ export declare const product: VaultTemplate;
@@ -0,0 +1,123 @@
1
+ export const product = {
2
+ name: "product",
3
+ description: "Product development and management",
4
+ dirs: ["features", "roadmap", "research", "specs", "releases", "daily"],
5
+ files: {
6
+ "features/_about.md": `# Features
7
+
8
+ One note per feature. Include status, owner, and user-facing description.
9
+ `,
10
+ "roadmap/_about.md": `# Roadmap
11
+
12
+ Planning docs, quarterly goals, and prioritization.
13
+ `,
14
+ "research/_about.md": `# Research
15
+
16
+ User research, competitor analysis, market insights.
17
+ `,
18
+ "specs/_about.md": `# Specs
19
+
20
+ Product specs and requirements. Link to related features.
21
+ `,
22
+ "releases/_about.md": `# Releases
23
+
24
+ Release notes, rollout plans, and post-mortems.
25
+ `,
26
+ "Templates/Feature.md": `---
27
+ status: proposed
28
+ owner: ""
29
+ priority: ""
30
+ ---
31
+ # {{title}}
32
+
33
+ ## User story
34
+ As a ___, I want ___ so that ___.
35
+
36
+ ## Requirements
37
+ -
38
+
39
+ ## Design
40
+ -
41
+
42
+ ## Open questions
43
+ -
44
+ `,
45
+ "Templates/Spec.md": `---
46
+ status: draft
47
+ date: "{{date}}"
48
+ owner: ""
49
+ ---
50
+ # {{title}}
51
+
52
+ ## Overview
53
+ What is this spec for?
54
+
55
+ ## Requirements
56
+ ### Must have
57
+ -
58
+
59
+ ### Nice to have
60
+ -
61
+
62
+ ## Technical notes
63
+ -
64
+
65
+ ## Dependencies
66
+ -
67
+ `,
68
+ "Templates/Release.md": `---
69
+ version: ""
70
+ date: "{{date}}"
71
+ ---
72
+ # {{title}}
73
+
74
+ ## What's new
75
+ -
76
+
77
+ ## Breaking changes
78
+ -
79
+
80
+ ## Migration guide
81
+ -
82
+
83
+ ## Rollout plan
84
+ 1.
85
+ `,
86
+ "Templates/Research.md": `---
87
+ type: ""
88
+ date: "{{date}}"
89
+ ---
90
+ # {{title}}
91
+
92
+ ## Objective
93
+ What are we trying to learn?
94
+
95
+ ## Methodology
96
+ -
97
+
98
+ ## Findings
99
+ -
100
+
101
+ ## Recommendations
102
+ -
103
+ `,
104
+ },
105
+ napkinMd: `# Product name
106
+
107
+ ## What is this product?
108
+ Brief description and value proposition.
109
+
110
+ ## Users
111
+ - Target audience:
112
+ - Key personas:
113
+
114
+ ## Current priorities
115
+ -
116
+
117
+ ## Metrics
118
+ -
119
+
120
+ ## Roadmap
121
+ -
122
+ `,
123
+ };
@@ -0,0 +1,2 @@
1
+ import type { VaultTemplate } from "./types.js";
2
+ export declare const research: VaultTemplate;
@@ -0,0 +1,114 @@
1
+ export const research = {
2
+ name: "research",
3
+ description: "Research and knowledge work",
4
+ dirs: ["papers", "concepts", "questions", "experiments", "daily"],
5
+ files: {
6
+ "papers/_about.md": `# Papers
7
+
8
+ One note per paper. Include citation, key findings, and your commentary.
9
+ `,
10
+ "concepts/_about.md": `# Concepts
11
+
12
+ Key ideas and definitions. Link heavily between concepts.
13
+ `,
14
+ "questions/_about.md": `# Questions
15
+
16
+ Open research questions. Mark as resolved when answered, link to the answer.
17
+ `,
18
+ "experiments/_about.md": `# Experiments
19
+
20
+ Results, logs, and methodology notes. One file per experiment or trial.
21
+ `,
22
+ "Templates/Paper.md": `---
23
+ authors: []
24
+ year: ""
25
+ source: ""
26
+ tags: []
27
+ ---
28
+ # {{title}}
29
+
30
+ ## Summary
31
+ What is this paper about?
32
+
33
+ ## Key findings
34
+ -
35
+
36
+ ## Methodology
37
+ -
38
+
39
+ ## My commentary
40
+ -
41
+
42
+ ## Related
43
+ -
44
+ `,
45
+ "Templates/Concept.md": `---
46
+ aliases: []
47
+ tags: []
48
+ ---
49
+ # {{title}}
50
+
51
+ ## Definition
52
+ What is this concept?
53
+
54
+ ## Key points
55
+ -
56
+
57
+ ## Related concepts
58
+ -
59
+ `,
60
+ "Templates/Question.md": `---
61
+ status: open
62
+ date: "{{date}}"
63
+ ---
64
+ # {{title}}
65
+
66
+ ## Question
67
+ What exactly am I trying to answer?
68
+
69
+ ## Context
70
+ Why does this matter?
71
+
72
+ ## Progress
73
+ -
74
+
75
+ ## Answer
76
+ (fill when resolved)
77
+ `,
78
+ "Templates/Experiment.md": `---
79
+ date: "{{date}}"
80
+ status: in-progress
81
+ ---
82
+ # {{title}}
83
+
84
+ ## Hypothesis
85
+ What do I expect to happen?
86
+
87
+ ## Setup
88
+ -
89
+
90
+ ## Results
91
+ -
92
+
93
+ ## Conclusions
94
+ -
95
+ `,
96
+ },
97
+ napkinMd: `# Research area
98
+
99
+ ## Focus
100
+ What are you studying?
101
+
102
+ ## Key questions
103
+ -
104
+
105
+ ## Methodology
106
+ -
107
+
108
+ ## Current reading
109
+ -
110
+
111
+ ## Open threads
112
+ -
113
+ `,
114
+ };
@@ -0,0 +1,7 @@
1
+ export interface VaultTemplate {
2
+ name: string;
3
+ description: string;
4
+ dirs: string[];
5
+ files: Record<string, string>;
6
+ napkinMd: string;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,61 @@
1
+ import { type Database } from "sql.js";
2
+ export interface BaseView {
3
+ type: string;
4
+ name?: string;
5
+ limit?: number;
6
+ filters?: unknown;
7
+ order?: string[];
8
+ groupBy?: {
9
+ property: string;
10
+ direction?: string;
11
+ };
12
+ summaries?: Record<string, string>;
13
+ }
14
+ export interface BaseConfig {
15
+ filters?: unknown;
16
+ formulas?: Record<string, string>;
17
+ properties?: Record<string, {
18
+ displayName?: string;
19
+ }>;
20
+ summaries?: Record<string, string>;
21
+ views?: BaseView[];
22
+ }
23
+ /**
24
+ * Parse a .base YAML file. Bases are YAML format.
25
+ */
26
+ export declare function parseBaseFile(content: string): BaseConfig;
27
+ /**
28
+ * Build an in-memory SQLite database from vault files.
29
+ * Creates a `files` table with columns for file metadata and all frontmatter properties.
30
+ */
31
+ export declare function buildDatabase(vaultPath: string): Promise<Database>;
32
+ /**
33
+ * Translate a Bases filter expression to SQL WHERE clause.
34
+ * Handles the recursive and/or/not structure and simple comparison strings.
35
+ */
36
+ export declare function filterToSQL(filter: unknown, thisFile?: {
37
+ name: string;
38
+ path: string;
39
+ folder: string;
40
+ }): string;
41
+ /**
42
+ * Build ORDER BY clause from view config.
43
+ */
44
+ export declare function orderToSQL(order?: string[]): string;
45
+ /**
46
+ * Query the database using a base view config.
47
+ */
48
+ export declare function queryBase(db: Database, baseConfig: BaseConfig, viewName?: string, thisFile?: {
49
+ name: string;
50
+ path: string;
51
+ folder: string;
52
+ }): Promise<{
53
+ columns: string[];
54
+ rows: unknown[][];
55
+ groups?: {
56
+ key: string;
57
+ rows: unknown[][];
58
+ }[];
59
+ summaries?: Record<string, unknown>;
60
+ displayNames?: Record<string, string>;
61
+ }>;