@thjodann/wk 1.0.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 (153) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +197 -0
  3. package/dist/cli/commands/article.d.ts +2 -0
  4. package/dist/cli/commands/article.js +47 -0
  5. package/dist/cli/commands/article.js.map +1 -0
  6. package/dist/cli/commands/closeout.d.ts +2 -0
  7. package/dist/cli/commands/closeout.js +37 -0
  8. package/dist/cli/commands/closeout.js.map +1 -0
  9. package/dist/cli/commands/compile.d.ts +2 -0
  10. package/dist/cli/commands/compile.js +50 -0
  11. package/dist/cli/commands/compile.js.map +1 -0
  12. package/dist/cli/commands/concept.d.ts +2 -0
  13. package/dist/cli/commands/concept.js +36 -0
  14. package/dist/cli/commands/concept.js.map +1 -0
  15. package/dist/cli/commands/decision.d.ts +2 -0
  16. package/dist/cli/commands/decision.js +38 -0
  17. package/dist/cli/commands/decision.js.map +1 -0
  18. package/dist/cli/commands/event.d.ts +2 -0
  19. package/dist/cli/commands/event.js +32 -0
  20. package/dist/cli/commands/event.js.map +1 -0
  21. package/dist/cli/commands/init.d.ts +2 -0
  22. package/dist/cli/commands/init.js +52 -0
  23. package/dist/cli/commands/init.js.map +1 -0
  24. package/dist/cli/commands/installAgent.d.ts +2 -0
  25. package/dist/cli/commands/installAgent.js +130 -0
  26. package/dist/cli/commands/installAgent.js.map +1 -0
  27. package/dist/cli/commands/link.d.ts +2 -0
  28. package/dist/cli/commands/link.js +36 -0
  29. package/dist/cli/commands/link.js.map +1 -0
  30. package/dist/cli/commands/note.d.ts +2 -0
  31. package/dist/cli/commands/note.js +34 -0
  32. package/dist/cli/commands/note.js.map +1 -0
  33. package/dist/cli/commands/pages.d.ts +2 -0
  34. package/dist/cli/commands/pages.js +46 -0
  35. package/dist/cli/commands/pages.js.map +1 -0
  36. package/dist/cli/commands/record.d.ts +2 -0
  37. package/dist/cli/commands/record.js +101 -0
  38. package/dist/cli/commands/record.js.map +1 -0
  39. package/dist/cli/commands/render.d.ts +2 -0
  40. package/dist/cli/commands/render.js +33 -0
  41. package/dist/cli/commands/render.js.map +1 -0
  42. package/dist/cli/commands/search.d.ts +2 -0
  43. package/dist/cli/commands/search.js +125 -0
  44. package/dist/cli/commands/search.js.map +1 -0
  45. package/dist/cli/commands/setup.d.ts +2 -0
  46. package/dist/cli/commands/setup.js +53 -0
  47. package/dist/cli/commands/setup.js.map +1 -0
  48. package/dist/cli/commands/site.d.ts +2 -0
  49. package/dist/cli/commands/site.js +47 -0
  50. package/dist/cli/commands/site.js.map +1 -0
  51. package/dist/cli/commands/spin.d.ts +2 -0
  52. package/dist/cli/commands/spin.js +43 -0
  53. package/dist/cli/commands/spin.js.map +1 -0
  54. package/dist/cli/commands/status.d.ts +2 -0
  55. package/dist/cli/commands/status.js +63 -0
  56. package/dist/cli/commands/status.js.map +1 -0
  57. package/dist/cli/commands/symbol.d.ts +2 -0
  58. package/dist/cli/commands/symbol.js +37 -0
  59. package/dist/cli/commands/symbol.js.map +1 -0
  60. package/dist/cli/commands/theme.d.ts +2 -0
  61. package/dist/cli/commands/theme.js +52 -0
  62. package/dist/cli/commands/theme.js.map +1 -0
  63. package/dist/cli/commands/validate.d.ts +2 -0
  64. package/dist/cli/commands/validate.js +44 -0
  65. package/dist/cli/commands/validate.js.map +1 -0
  66. package/dist/cli/helpers.d.ts +30 -0
  67. package/dist/cli/helpers.js +131 -0
  68. package/dist/cli/helpers.js.map +1 -0
  69. package/dist/core/articles.d.ts +5 -0
  70. package/dist/core/articles.js +25 -0
  71. package/dist/core/articles.js.map +1 -0
  72. package/dist/core/automation.d.ts +96 -0
  73. package/dist/core/automation.js +384 -0
  74. package/dist/core/automation.js.map +1 -0
  75. package/dist/core/beads.d.ts +43 -0
  76. package/dist/core/beads.js +358 -0
  77. package/dist/core/beads.js.map +1 -0
  78. package/dist/core/compiler.d.ts +45 -0
  79. package/dist/core/compiler.js +399 -0
  80. package/dist/core/compiler.js.map +1 -0
  81. package/dist/core/config.d.ts +59 -0
  82. package/dist/core/config.js +187 -0
  83. package/dist/core/config.js.map +1 -0
  84. package/dist/core/git.d.ts +21 -0
  85. package/dist/core/git.js +109 -0
  86. package/dist/core/git.js.map +1 -0
  87. package/dist/core/ids.d.ts +2 -0
  88. package/dist/core/ids.js +8 -0
  89. package/dist/core/ids.js.map +1 -0
  90. package/dist/core/pages.d.ts +34 -0
  91. package/dist/core/pages.js +233 -0
  92. package/dist/core/pages.js.map +1 -0
  93. package/dist/core/paths.d.ts +15 -0
  94. package/dist/core/paths.js +67 -0
  95. package/dist/core/paths.js.map +1 -0
  96. package/dist/core/profiles.d.ts +30 -0
  97. package/dist/core/profiles.js +243 -0
  98. package/dist/core/profiles.js.map +1 -0
  99. package/dist/core/renderer.d.ts +8 -0
  100. package/dist/core/renderer.js +106 -0
  101. package/dist/core/renderer.js.map +1 -0
  102. package/dist/core/schemas.d.ts +1039 -0
  103. package/dist/core/schemas.js +108 -0
  104. package/dist/core/schemas.js.map +1 -0
  105. package/dist/core/site.d.ts +20 -0
  106. package/dist/core/site.js +2684 -0
  107. package/dist/core/site.js.map +1 -0
  108. package/dist/core/spin.d.ts +42 -0
  109. package/dist/core/spin.js +265 -0
  110. package/dist/core/spin.js.map +1 -0
  111. package/dist/core/store.d.ts +29 -0
  112. package/dist/core/store.js +146 -0
  113. package/dist/core/store.js.map +1 -0
  114. package/dist/core/theme.d.ts +35 -0
  115. package/dist/core/theme.js +1086 -0
  116. package/dist/core/theme.js.map +1 -0
  117. package/dist/core/validator.d.ts +8 -0
  118. package/dist/core/validator.js +154 -0
  119. package/dist/core/validator.js.map +1 -0
  120. package/dist/index.d.ts +3 -0
  121. package/dist/index.js +61 -0
  122. package/dist/index.js.map +1 -0
  123. package/dist/templates/articlesPage.d.ts +3 -0
  124. package/dist/templates/articlesPage.js +46 -0
  125. package/dist/templates/articlesPage.js.map +1 -0
  126. package/dist/templates/conceptsPage.d.ts +2 -0
  127. package/dist/templates/conceptsPage.js +24 -0
  128. package/dist/templates/conceptsPage.js.map +1 -0
  129. package/dist/templates/decisionsPage.d.ts +2 -0
  130. package/dist/templates/decisionsPage.js +27 -0
  131. package/dist/templates/decisionsPage.js.map +1 -0
  132. package/dist/templates/devlogPage.d.ts +2 -0
  133. package/dist/templates/devlogPage.js +22 -0
  134. package/dist/templates/devlogPage.js.map +1 -0
  135. package/dist/templates/indexPage.d.ts +6 -0
  136. package/dist/templates/indexPage.js +33 -0
  137. package/dist/templates/indexPage.js.map +1 -0
  138. package/dist/templates/linksPage.d.ts +2 -0
  139. package/dist/templates/linksPage.js +26 -0
  140. package/dist/templates/linksPage.js.map +1 -0
  141. package/dist/templates/notesPage.d.ts +2 -0
  142. package/dist/templates/notesPage.js +26 -0
  143. package/dist/templates/notesPage.js.map +1 -0
  144. package/dist/templates/symbolsPage.d.ts +2 -0
  145. package/dist/templates/symbolsPage.js +25 -0
  146. package/dist/templates/symbolsPage.js.map +1 -0
  147. package/docs/concepts.md +249 -0
  148. package/docs/reference.md +356 -0
  149. package/docs/setup.md +331 -0
  150. package/docs/workflows.md +154 -0
  151. package/package.json +61 -0
  152. package/skills/wk/SKILL.md +251 -0
  153. package/skills/wk/agents/openai.yaml +4 -0
@@ -0,0 +1,96 @@
1
+ import { type IntegrationSummary } from "./beads";
2
+ import { type WikiwikiConfig } from "./config";
3
+ import { type SuppressedGitStatusSummary } from "./git";
4
+ import { type SiteAudience, type WikiProfile } from "./profiles";
5
+ import { type SpinResult, type SuggestedUpdate } from "./spin";
6
+ import { recordCounts } from "./store";
7
+ import { type ValidationResult } from "./validator";
8
+ export type SetupOptions = {
9
+ profile?: string;
10
+ audience?: string;
11
+ sourceBaseUrl?: string;
12
+ force?: boolean;
13
+ };
14
+ export type SetupResult = {
15
+ ok: true;
16
+ repo_root: string;
17
+ store_path: string;
18
+ config_path: string;
19
+ config: WikiwikiConfig;
20
+ package_json: PackageSetupResult;
21
+ integrations?: IntegrationSummary;
22
+ };
23
+ export type PackageSetupResult = {
24
+ present: boolean;
25
+ path: string | null;
26
+ updated: boolean;
27
+ scripts_added: string[];
28
+ scripts_overwritten: string[];
29
+ scripts_skipped: string[];
30
+ script_conflicts: ScriptConflict[];
31
+ copy_commands: Record<string, string>;
32
+ skipped_reason?: string;
33
+ };
34
+ export type ScriptConflict = {
35
+ name: string;
36
+ existing: string;
37
+ desired: string;
38
+ };
39
+ export type CloseoutOptions = {
40
+ profile?: string;
41
+ audience?: string;
42
+ sourceBaseUrl?: string;
43
+ };
44
+ export type CloseoutDraft = {
45
+ type: SuggestedUpdate["type"];
46
+ title: string;
47
+ reason: string;
48
+ audience: SiteAudience;
49
+ tags: string[];
50
+ draft_path: string;
51
+ command_hint: string;
52
+ };
53
+ export type CloseoutManifest = {
54
+ type: "closeout-draft";
55
+ id: string;
56
+ created_at: string;
57
+ profile: WikiProfile;
58
+ audience: SiteAudience;
59
+ changed_files: string[];
60
+ drafts: CloseoutDraft[];
61
+ integrations?: IntegrationSummary;
62
+ rendered_files: string[];
63
+ site_files: string[];
64
+ };
65
+ export type CloseoutResult = {
66
+ ok: true;
67
+ id: string;
68
+ draft_path: string;
69
+ manifest_path: string;
70
+ profile: WikiProfile;
71
+ audience: SiteAudience;
72
+ status: AutomationStatus;
73
+ spin: SpinResult;
74
+ validation: ValidationResult;
75
+ integrations?: IntegrationSummary;
76
+ changed_files: string[];
77
+ drafts: CloseoutDraft[];
78
+ rendered_files: string[];
79
+ site_files: string[];
80
+ };
81
+ type AutomationStatus = {
82
+ repo_root: string;
83
+ initialized: boolean;
84
+ records: ReturnType<typeof recordCounts>;
85
+ generated_files: string[];
86
+ generated_site_files: string[];
87
+ git: {
88
+ changed_files: string[];
89
+ suppressed_changed_files: SuppressedGitStatusSummary;
90
+ };
91
+ integrations?: IntegrationSummary;
92
+ };
93
+ export declare function setupWikiwiki(root: string, options?: SetupOptions): SetupResult;
94
+ export declare function runCloseout(root: string, options?: CloseoutOptions): CloseoutResult;
95
+ export declare function setupScripts(profile: WikiProfile, audience: SiteAudience): Record<string, string>;
96
+ export {};
@@ -0,0 +1,384 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.setupWikiwiki = setupWikiwiki;
7
+ exports.runCloseout = runCloseout;
8
+ exports.setupScripts = setupScripts;
9
+ const crypto_1 = __importDefault(require("crypto"));
10
+ const fs_1 = __importDefault(require("fs"));
11
+ const path_1 = __importDefault(require("path"));
12
+ const beads_1 = require("./beads");
13
+ const config_1 = require("./config");
14
+ const git_1 = require("./git");
15
+ const paths_1 = require("./paths");
16
+ const profiles_1 = require("./profiles");
17
+ const renderer_1 = require("./renderer");
18
+ const site_1 = require("./site");
19
+ const spin_1 = require("./spin");
20
+ const store_1 = require("./store");
21
+ const validator_1 = require("./validator");
22
+ function setupWikiwiki(root, options = {}) {
23
+ const existingConfig = (0, config_1.readWikiwikiConfig)(root);
24
+ const profile = (0, profiles_1.parseWikiProfile)(options.profile ?? existingConfig.wiki_profile, "mixed");
25
+ const audience = (0, profiles_1.parseSiteAudience)(options.audience ?? existingConfig.site_audience, "all");
26
+ const sourceBaseUrl = (0, config_1.normalizeSourceBaseUrl)(options.sourceBaseUrl ?? existingConfig.source_base_url);
27
+ const desiredScripts = setupScripts(profile, audience);
28
+ const packageJson = preparePackageScripts(root, desiredScripts, options.force === true);
29
+ const nextConfig = {
30
+ ...existingConfig,
31
+ wiki_profile: profile,
32
+ site_audience: audience
33
+ };
34
+ if (sourceBaseUrl) {
35
+ nextConfig.source_base_url = sourceBaseUrl;
36
+ }
37
+ else {
38
+ delete nextConfig.source_base_url;
39
+ }
40
+ (0, store_1.ensureStore)(root);
41
+ (0, config_1.writeWikiwikiConfig)(root, nextConfig);
42
+ writePackageScripts(root, packageJson);
43
+ const integrations = (0, beads_1.readIntegrations)(root, nextConfig);
44
+ const result = {
45
+ ok: true,
46
+ repo_root: (0, paths_1.reportPath)(root),
47
+ store_path: (0, paths_1.reportPath)((0, paths_1.wikiwikiPath)(root)),
48
+ config_path: (0, paths_1.relativeReportPath)(root, (0, config_1.configPath)(root)),
49
+ config: nextConfig,
50
+ package_json: packageJson.result
51
+ };
52
+ if ((0, beads_1.shouldReportIntegrations)(integrations)) {
53
+ result.integrations = integrations;
54
+ }
55
+ return result;
56
+ }
57
+ function runCloseout(root, options = {}) {
58
+ const config = (0, config_1.readWikiwikiConfig)(root);
59
+ const profile = (0, profiles_1.parseWikiProfile)(options.profile ?? config.wiki_profile, "mixed");
60
+ const audience = (0, profiles_1.parseSiteAudience)(options.audience ?? config.site_audience, "all");
61
+ const sourceBaseUrl = (0, config_1.normalizeSourceBaseUrl)(options.sourceBaseUrl ?? config.source_base_url);
62
+ if (!(0, store_1.isInitialized)(root)) {
63
+ throw new Error("Wikiwiki is not initialized. Run `wk setup` first.");
64
+ }
65
+ const status = automationStatus(root);
66
+ const spin = (0, spin_1.createSpinResult)(root, profile);
67
+ const integrations = (0, beads_1.readIntegrations)(root, config);
68
+ const id = `closeout_${crypto_1.default.randomUUID()}`;
69
+ const createdAt = new Date().toISOString();
70
+ const draftRoot = path_1.default.join((0, paths_1.wikiwikiPath)(root), "drafts", "closeout", id);
71
+ const recordDraftRoot = path_1.default.join(draftRoot, "record-drafts");
72
+ fs_1.default.mkdirSync(recordDraftRoot, { recursive: true });
73
+ const drafts = writeCloseoutRecordDrafts(root, recordDraftRoot, spin.suggested_updates);
74
+ const validation = (0, validator_1.validateWikiwiki)(root);
75
+ if (!validation.valid) {
76
+ const manifest = {
77
+ type: "closeout-draft",
78
+ id,
79
+ created_at: createdAt,
80
+ profile,
81
+ audience,
82
+ changed_files: spin.changed_files,
83
+ drafts,
84
+ ...((0, beads_1.shouldReportIntegrations)(integrations) ? { integrations } : {}),
85
+ rendered_files: [],
86
+ site_files: []
87
+ };
88
+ writeCloseoutCommands(draftRoot, profile, audience, drafts);
89
+ writeCloseoutSummary(draftRoot, {
90
+ id,
91
+ profile,
92
+ audience,
93
+ changedFiles: spin.changed_files,
94
+ drafts,
95
+ renderedFiles: [],
96
+ siteFiles: [],
97
+ validation,
98
+ integrations
99
+ });
100
+ writeJson(path_1.default.join(draftRoot, "manifest.json"), manifest);
101
+ throw new Error(`Wikiwiki validation failed during closeout: ${validation.errors.join("; ")}`);
102
+ }
103
+ const renderedFiles = (0, renderer_1.renderWiki)(root).map((file) => (0, paths_1.relativeReportPath)(root, file));
104
+ const siteFiles = (0, site_1.renderSite)(root, { sourceBaseUrl, audience }).map((file) => (0, paths_1.relativeReportPath)(root, file));
105
+ const manifest = {
106
+ type: "closeout-draft",
107
+ id,
108
+ created_at: createdAt,
109
+ profile,
110
+ audience,
111
+ changed_files: spin.changed_files,
112
+ drafts,
113
+ ...((0, beads_1.shouldReportIntegrations)(integrations) ? { integrations } : {}),
114
+ rendered_files: renderedFiles,
115
+ site_files: siteFiles
116
+ };
117
+ writeCloseoutCommands(draftRoot, profile, audience, drafts);
118
+ writeCloseoutSummary(draftRoot, {
119
+ id,
120
+ profile,
121
+ audience,
122
+ changedFiles: spin.changed_files,
123
+ drafts,
124
+ renderedFiles,
125
+ siteFiles,
126
+ validation,
127
+ integrations
128
+ });
129
+ writeJson(path_1.default.join(draftRoot, "manifest.json"), manifest);
130
+ return {
131
+ ok: true,
132
+ id,
133
+ draft_path: (0, paths_1.relativeReportPath)(root, draftRoot),
134
+ manifest_path: (0, paths_1.relativeReportPath)(root, path_1.default.join(draftRoot, "manifest.json")),
135
+ profile,
136
+ audience,
137
+ status,
138
+ spin,
139
+ validation,
140
+ ...((0, beads_1.shouldReportIntegrations)(integrations) ? { integrations } : {}),
141
+ changed_files: spin.changed_files,
142
+ drafts,
143
+ rendered_files: renderedFiles,
144
+ site_files: siteFiles
145
+ };
146
+ }
147
+ function setupScripts(profile, audience) {
148
+ return {
149
+ "wiki:status": "wk status --json",
150
+ "wiki:spin": `wk spin --profile ${profile} --json`,
151
+ "wiki:check": "wk validate",
152
+ "wiki:render": "wk validate && wk render",
153
+ "wiki:site": `wk validate && wk render && wk site --audience ${audience}`,
154
+ "wiki:site:user": "wk validate && wk render && wk site --audience user",
155
+ "wiki:closeout": `wk closeout --profile ${profile} --audience ${audience}`
156
+ };
157
+ }
158
+ function preparePackageScripts(root, desiredScripts, force) {
159
+ const file = path_1.default.join(root, "package.json");
160
+ if (!fs_1.default.existsSync(file)) {
161
+ return {
162
+ result: {
163
+ present: false,
164
+ path: null,
165
+ updated: false,
166
+ scripts_added: [],
167
+ scripts_overwritten: [],
168
+ scripts_skipped: Object.keys(desiredScripts),
169
+ script_conflicts: [],
170
+ copy_commands: desiredScripts,
171
+ skipped_reason: "package.json not found"
172
+ }
173
+ };
174
+ }
175
+ const packageJson = JSON.parse(fs_1.default.readFileSync(file, "utf8"));
176
+ const scripts = isObject(packageJson.scripts) ? { ...packageJson.scripts } : {};
177
+ const result = {
178
+ present: true,
179
+ path: (0, paths_1.relativeReportPath)(root, file),
180
+ updated: false,
181
+ scripts_added: [],
182
+ scripts_overwritten: [],
183
+ scripts_skipped: [],
184
+ script_conflicts: [],
185
+ copy_commands: desiredScripts
186
+ };
187
+ for (const [name, desired] of Object.entries(desiredScripts)) {
188
+ const existing = scripts[name];
189
+ if (existing === undefined) {
190
+ scripts[name] = desired;
191
+ result.scripts_added.push(name);
192
+ continue;
193
+ }
194
+ if (existing === desired) {
195
+ result.scripts_skipped.push(name);
196
+ continue;
197
+ }
198
+ if (!force) {
199
+ result.script_conflicts.push({ name, existing, desired });
200
+ continue;
201
+ }
202
+ scripts[name] = desired;
203
+ result.scripts_overwritten.push(name);
204
+ }
205
+ if (result.script_conflicts.length > 0) {
206
+ const names = result.script_conflicts.map((conflict) => conflict.name).join(", ");
207
+ throw new Error(`Refusing to overwrite existing package scripts: ${names}. Re-run with --force to replace Wikiwiki scripts.`);
208
+ }
209
+ result.updated = result.scripts_added.length > 0 || result.scripts_overwritten.length > 0;
210
+ packageJson.scripts = scripts;
211
+ return { result, packageJson };
212
+ }
213
+ function writePackageScripts(root, prepared) {
214
+ if (!prepared.packageJson || !prepared.result.updated) {
215
+ return;
216
+ }
217
+ fs_1.default.writeFileSync(path_1.default.join(root, "package.json"), `${JSON.stringify(prepared.packageJson, null, 2)}\n`, "utf8");
218
+ }
219
+ function automationStatus(root) {
220
+ const generatedFiles = renderer_1.wikiPageFileNames
221
+ .map((fileName) => path_1.default.join((0, paths_1.wikiPath)(root), fileName))
222
+ .filter((file) => fs_1.default.existsSync(file));
223
+ const generatedSiteFiles = site_1.siteStaticPageFileNames
224
+ .map((fileName) => path_1.default.join((0, paths_1.sitePath)(root), fileName))
225
+ .filter((file) => fs_1.default.existsSync(file));
226
+ const integrations = (0, beads_1.readIntegrations)(root, (0, config_1.readWikiwikiConfig)(root));
227
+ const result = {
228
+ repo_root: (0, paths_1.reportPath)(root),
229
+ initialized: (0, store_1.isInitialized)(root),
230
+ records: (0, store_1.recordCounts)(root),
231
+ generated_files: generatedFiles.map((file) => (0, paths_1.relativeReportPath)(root, file)),
232
+ generated_site_files: generatedSiteFiles.map((file) => (0, paths_1.relativeReportPath)(root, file)),
233
+ git: {
234
+ changed_files: (0, git_1.changedFiles)(root),
235
+ suppressed_changed_files: (0, git_1.suppressedGitStatusSummary)(root)
236
+ }
237
+ };
238
+ if ((0, beads_1.shouldReportIntegrations)(integrations)) {
239
+ result.integrations = integrations;
240
+ }
241
+ return result;
242
+ }
243
+ function writeCloseoutRecordDrafts(root, recordDraftRoot, suggestions) {
244
+ return suggestions.map((suggestion, index) => {
245
+ const title = titleForDraft(suggestion);
246
+ const file = path_1.default.join(recordDraftRoot, `${String(index + 1).padStart(3, "0")}-${suggestion.type}-${slug(title)}.json`);
247
+ const audience = audienceForTags(suggestion.tags);
248
+ const payload = {
249
+ type: suggestion.type,
250
+ title,
251
+ reason: suggestion.reason,
252
+ audience,
253
+ tags: suggestion.tags,
254
+ confidence: suggestion.confidence,
255
+ files: suggestion.files,
256
+ draft: suggestion.draft,
257
+ command_hint: suggestion.command_hint
258
+ };
259
+ writeJson(file, payload);
260
+ return {
261
+ type: suggestion.type,
262
+ title,
263
+ reason: suggestion.reason,
264
+ audience,
265
+ tags: suggestion.tags,
266
+ draft_path: (0, paths_1.relativeReportPath)(root, file),
267
+ command_hint: suggestion.command_hint
268
+ };
269
+ });
270
+ }
271
+ function writeCloseoutCommands(draftRoot, profile, audience, drafts) {
272
+ const lines = [
273
+ "# Closeout Commands",
274
+ "",
275
+ "Generated by `wk closeout`. Review these drafts before appending records.",
276
+ "",
277
+ "## Review",
278
+ "",
279
+ `- Profile: \`${profile}\``,
280
+ `- Audience: \`${audience}\``,
281
+ "",
282
+ "## Suggested Record Commands",
283
+ ""
284
+ ];
285
+ if (drafts.length === 0) {
286
+ lines.push("- No record drafts were suggested from the current working tree.");
287
+ }
288
+ else {
289
+ drafts.forEach((draft) => {
290
+ lines.push(`- ${draft.title}`);
291
+ lines.push(` - ${draft.command_hint}`);
292
+ });
293
+ }
294
+ lines.push("", "## Verification", "", "- `wk validate`", "- `wk render`", `- \`wk site --audience ${audience}\``, "");
295
+ fs_1.default.writeFileSync(path_1.default.join(draftRoot, "commands.md"), `${lines.join("\n")}`, "utf8");
296
+ }
297
+ function writeCloseoutSummary(draftRoot, summary) {
298
+ const lines = [
299
+ "# Closeout Summary",
300
+ "",
301
+ `Closeout draft: \`${summary.id}\``,
302
+ "",
303
+ `- Profile: \`${summary.profile}\``,
304
+ `- Audience: \`${summary.audience}\``,
305
+ `- Validation: ${summary.validation.valid ? "passed" : "failed"}`,
306
+ `- Changed files: ${summary.changedFiles.length}`,
307
+ `- Record drafts: ${summary.drafts.length}`,
308
+ `- Markdown files rendered: ${summary.renderedFiles.length}`,
309
+ `- Site files rendered: ${summary.siteFiles.length}`,
310
+ "",
311
+ "## Changed Files",
312
+ ""
313
+ ];
314
+ if (summary.changedFiles.length === 0) {
315
+ lines.push("- None");
316
+ }
317
+ else {
318
+ lines.push(...summary.changedFiles.map((file) => `- ${file}`));
319
+ }
320
+ lines.push("", "## Record Drafts", "");
321
+ if (summary.drafts.length === 0) {
322
+ lines.push("- None");
323
+ }
324
+ else {
325
+ lines.push(...summary.drafts.map((draft) => `- ${draft.type}: ${draft.title} (${draft.draft_path})`));
326
+ }
327
+ const beads = summary.integrations.beads;
328
+ if (beads && (0, beads_1.shouldReportIntegrations)(summary.integrations)) {
329
+ lines.push("", "## Beads Work Context", "");
330
+ if (!beads.enabled) {
331
+ lines.push("- Beads is detected but disabled in Wikiwiki config.");
332
+ }
333
+ else if (beads.error === "beads_auto_read_skipped") {
334
+ lines.push("- Beads is detected; detailed reads were skipped to avoid dirtying `.beads/`.");
335
+ }
336
+ else if (!beads.available) {
337
+ lines.push(`- Beads is detected but unavailable: ${beads.error ?? "bd unavailable"}`);
338
+ }
339
+ else {
340
+ lines.push(`- Ready work: ${beads.counts.ready}`);
341
+ lines.push(`- In progress: ${beads.counts.in_progress}`);
342
+ lines.push(`- Recent closed: ${beads.counts.recent_closed}`);
343
+ if (beads.issue_ids.length > 0) {
344
+ lines.push(`- Related issue ids: ${beads.issue_ids.join(", ")}`);
345
+ }
346
+ }
347
+ }
348
+ lines.push("");
349
+ fs_1.default.writeFileSync(path_1.default.join(draftRoot, "summary.md"), `${lines.join("\n")}`, "utf8");
350
+ }
351
+ function writeJson(file, value) {
352
+ fs_1.default.mkdirSync(path_1.default.dirname(file), { recursive: true });
353
+ fs_1.default.writeFileSync(file, `${JSON.stringify(value, null, 2)}\n`, "utf8");
354
+ }
355
+ function titleForDraft(update) {
356
+ const draft = update.draft;
357
+ for (const key of ["name", "title", "summary", "body"]) {
358
+ const value = draft[key];
359
+ if (typeof value === "string" && value.trim()) {
360
+ return value.trim();
361
+ }
362
+ }
363
+ return update.reason;
364
+ }
365
+ function audienceForTags(tags) {
366
+ if (tags.includes("audience:user")) {
367
+ return "user";
368
+ }
369
+ if (tags.includes("audience:developer")) {
370
+ return "developer";
371
+ }
372
+ return "all";
373
+ }
374
+ function slug(value) {
375
+ const normalized = value
376
+ .toLowerCase()
377
+ .replace(/[^a-z0-9]+/g, "-")
378
+ .replace(/^-+|-+$/g, "");
379
+ return normalized || "draft";
380
+ }
381
+ function isObject(value) {
382
+ return typeof value === "object" && value !== null && !Array.isArray(value);
383
+ }
384
+ //# sourceMappingURL=automation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation.js","sourceRoot":"","sources":["../../src/core/automation.ts"],"names":[],"mappings":";;;;;AAiHA,sCAoCC;AAED,kCA+FC;AAED,oCAUC;AAlQD,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AACxB,mCAA8F;AAC9F,qCAA4H;AAC5H,+BAAkG;AAClG,mCAA2F;AAC3F,yCAAsG;AACtG,yCAA2D;AAC3D,iCAA6D;AAC7D,iCAAiF;AACjF,mCAAmE;AACnE,2CAAsE;AAqGtE,SAAgB,aAAa,CAAC,IAAY,EAAE,UAAwB,EAAE;IACpE,MAAM,cAAc,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,IAAA,2BAAgB,EAAC,OAAO,CAAC,OAAO,IAAI,cAAc,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC1F,MAAM,QAAQ,GAAG,IAAA,4BAAiB,EAAC,OAAO,CAAC,QAAQ,IAAI,cAAc,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC5F,MAAM,aAAa,GAAG,IAAA,+BAAsB,EAAC,OAAO,CAAC,aAAa,IAAI,cAAc,CAAC,eAAe,CAAC,CAAC;IACtG,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;IACxF,MAAM,UAAU,GAAmB;QACjC,GAAG,cAAc;QACjB,YAAY,EAAE,OAAO;QACrB,aAAa,EAA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EAAE,EAAE,CAAC,CAAC;IAC3B,OAAO,UAAU,IAAI,OAAO,CAAC;AAC/B,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { type WikiwikiConfig } from "./config";
2
+ export type BeadsIntegrationConfig = {
3
+ enabled?: boolean;
4
+ };
5
+ export type BeadsIssueSummary = {
6
+ id: string;
7
+ title: string;
8
+ status?: string;
9
+ type?: string;
10
+ priority?: string;
11
+ assignee?: string;
12
+ updated_at?: string;
13
+ closed_at?: string;
14
+ labels: string[];
15
+ };
16
+ export type BeadsIntegrationSummary = {
17
+ detected: boolean;
18
+ enabled: boolean;
19
+ available: boolean;
20
+ configured: "auto" | "enabled" | "disabled";
21
+ beads_path?: string;
22
+ error?: string;
23
+ warnings: string[];
24
+ counts: {
25
+ total?: number;
26
+ open?: number;
27
+ closed?: number;
28
+ ready: number;
29
+ in_progress: number;
30
+ recent_closed: number;
31
+ };
32
+ issue_ids: string[];
33
+ ready: BeadsIssueSummary[];
34
+ in_progress: BeadsIssueSummary[];
35
+ recent_closed: BeadsIssueSummary[];
36
+ };
37
+ export type IntegrationSummary = {
38
+ beads?: BeadsIntegrationSummary;
39
+ };
40
+ export declare function readIntegrations(root: string, config?: WikiwikiConfig): IntegrationSummary;
41
+ export declare function readBeadsIntegration(root: string, config?: BeadsIntegrationConfig | undefined): BeadsIntegrationSummary;
42
+ export declare function shouldReportIntegrations(integrations: IntegrationSummary): boolean;
43
+ export declare function shouldReportBeadsIntegration(beads: BeadsIntegrationSummary): boolean;